Skip to content
Open
Show file tree
Hide file tree
Changes from 60 commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
9c19be9
refactor and fix commit error
im2nguyen Jan 22, 2025
06d6259
add multiple lab support for playgrounds
im2nguyen Mar 11, 2025
3543851
update playground page to support multiple labs using the existing co…
im2nguyen Mar 11, 2025
2e947f8
fix playground bug
im2nguyen Mar 11, 2025
6ca858f
Merge branch 'main' into playground-page-poc-v2
im2nguyen Mar 11, 2025
c438edc
update terraform sandbox
im2nguyen Mar 11, 2025
f2768b0
embed terminal persist across pages
im2nguyen Mar 11, 2025
48ab51c
update text color
im2nguyen Mar 11, 2025
de144d4
fix playground configuration, fix consul
im2nguyen Mar 12, 2025
fc2c9f1
remove extraneous config
im2nguyen Mar 12, 2025
ddf8468
prevent instruqt pane from closing when going to individual tutorials…
im2nguyen Mar 12, 2025
d49c701
remove min height to ensure embeded element works even when reduced
im2nguyen Mar 13, 2025
7ec56ef
Merge branch 'main' into playground-page-poc-v3
im2nguyen Mar 19, 2025
c5395dc
Merge branch 'main' into playground-page-poc-v3
im2nguyen Mar 20, 2025
741dde8
fix build error
im2nguyen Mar 20, 2025
c707932
fix behavior and styles for playgrounds dropdown, add playground to r…
im2nguyen Mar 20, 2025
a6ae6b0
fix tutorial-view behavior, should load tutorial lab instead of playg…
im2nguyen Mar 20, 2025
f62b8bd
fix tutorial-view behavior, should load tutorial lab instead of playg…
im2nguyen Mar 20, 2025
94b2fe2
fix ci tests
im2nguyen Mar 20, 2025
a23cce2
fix more ci tests
im2nguyen Mar 20, 2025
0165c8a
posthog tracking experiment
im2nguyen Mar 20, 2025
b2763f5
revert hcanges to typing
im2nguyen Mar 20, 2025
ff7c979
debugging posthog logs in dev preview
im2nguyen Mar 20, 2025
d098876
playground -> sandbox
im2nguyen Mar 20, 2025
e268bae
Merge branch 'main' into playground-page-poc-v3
im2nguyen Mar 20, 2025
e1b3a57
rename straggler to sandbox
im2nguyen Mar 20, 2025
f722721
Use enum instead of string
im2nguyen Mar 24, 2025
a5d8721
move posthog events to dedicated lib, use enum instead of string for …
im2nguyen Mar 24, 2025
a4fc9bd
remove interactivelabwrapper since we moved instruqt provider into ma…
im2nguyen Mar 24, 2025
44a7722
Update src/data/sandbox.json
im2nguyen Apr 1, 2025
6c43e35
add test cases
im2nguyen Apr 1, 2025
8ac2ff5
adds boundary sandbox
stellarsquall Apr 2, 2025
d3d5280
Merge branch 'staging' into playground-page-poc-v3
im2nguyen Apr 2, 2025
9213d42
Merge branch 'playground-page-poc-v3' of ssh://github.com/hashicorp/d…
im2nguyen Apr 3, 2025
2f75973
update sandbox labids
im2nguyen Apr 3, 2025
6db0b41
improve copy for launchign sandbox in the dropdown
im2nguyen Apr 3, 2025
02a98b7
revert changes
im2nguyen Apr 3, 2025
9854076
Change Consul lab URL
danielehc Apr 17, 2025
04bb67f
add and render docs for sandboxes
im2nguyen Apr 30, 2025
cdc4922
Merge branch 'staging' into playground-page-poc-v3
im2nguyen Apr 30, 2025
82507b6
update broken tracking/merge error
im2nguyen Apr 30, 2025
7d2a3fa
fix broken tests, remove unnecessary imports
im2nguyen May 1, 2025
cd7ab67
fix broken ci tests
im2nguyen May 1, 2025
e2e3566
implement multiproduct lab descriptions
im2nguyen May 1, 2025
1bc409d
update styles for sandbox dropdown
im2nguyen May 1, 2025
d2628a3
add product specific label to learn more
im2nguyen May 1, 2025
be41bc1
Merge branch 'staging' into playground-page-poc-v3
im2nguyen May 28, 2025
8720498
Merge branch 'staging' into playground-page-poc-v3
im2nguyen Jun 11, 2025
4c0ae3b
Merge branch 'staging' into playground-page-poc-v3
im2nguyen Jul 28, 2025
3a8a38a
merge main
im2nguyen Sep 3, 2025
c6debc4
Refactors lab embed component for robustness
Younique98 Sep 8, 2025
1fe5eb0
Navigates to primary product's sandbox page
Younique98 Sep 10, 2025
3f7b35d
Refactors resize listener management
Younique98 Sep 10, 2025
ab1d7cf
Merged Main Branch In - Which Removes explicit consent management
Younique98 Sep 10, 2025
946fb87
Updates @types/node to the latest version
Younique98 Sep 11, 2025
de90944
Updates `unist-util-visit` import
Younique98 Sep 11, 2025
195601c
Updates npm to the latest version
Younique98 Sep 11, 2025
a3d6fd5
Apply suggestions from code review
im2nguyen Sep 11, 2025
1a364bf
Merge branch 'main' into playground-page-poc-v3
im2nguyen Sep 11, 2025
e3ea27e
Update src/lib/build-instruqt-url.ts
im2nguyen Sep 11, 2025
a59b928
Updates sandbox lab ID generation and retrieval
Younique98 Sep 15, 2025
13229dd
Removes environment variable dependency for Instruqt tokens
Younique98 Sep 15, 2025
87df35c
Adds sandbox authoring guide
Younique98 Sep 15, 2025
4314f49
update validation schema to support tokens in instruqtTrack URLs
Younique98 Sep 15, 2025
f0caccc
refactor: improve code clarity and maintainability
Younique98 Sep 15, 2025
f39724a
Updates dependencies and CI workflow
Younique98 Sep 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ jobs:
with:
node-version: 22

- name: Install latest npm
run: npm install --global npm@latest

- run: npm ci
- run: npm run test:ci

Expand All @@ -33,6 +36,9 @@ jobs:
with:
node-version: 22

- name: Install latest npm
run: npm install --global npm@latest

- name: Install Dependencies
run: npm ci

Expand Down
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
engine-strict=true
@hashicorp:registry=https://registry.npmjs.org/
13 changes: 12 additions & 1 deletion config/base.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,18 @@
"clientToken": "pubd5cf774aa1cbbd001accd50cb463925b",
"service": "non-prod.developer.hashicorp.com"
},
"product_slugs_with_integrations": ["vault", "nomad", "packer"]
"product_slugs_with_integrations": ["vault", "nomad", "packer"],
"sandbox": {
"instruqt_base_url": "https://play.instruqt.com/embed",
"default_tokens": {
"terraform-sandbox": "em_3vgTsBqCLq2blqtQ",
"vault-sandbox": "em_CUFCBU0nSfCl2VHi",
"boundary-sandbox": "em_YHsmJu4K1Wk3hwht",
"consul-sandbox": "em_I5XI2XjO-ZMeH1_w",
"consul-sandbox-sd": "em_MdAn4Od_foU6oybz",
"nomad-sandbox": "em_0wOuIAyyjAQllLkc"
}
}
},
"learn": {
"max_static_paths": 10
Expand Down
5 changes: 4 additions & 1 deletion config/development.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
"max_static_paths": 1
},
"dev_dot": {
"max_static_paths": 1
"max_static_paths": 1,
"sandbox": {
"instruqt_base_url": "https://play.instruqt.com/embed"
}
},
"learn": {
"max_static_paths": 1
Expand Down
31 changes: 10 additions & 21 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@
"@types/google-spreadsheet": "^3.2.2",
"@types/js-cookie": "^3.0.6",
"@types/jsonwebtoken": "^8.5.9",
"@types/node": "^18.18.9",
"@types/react": "^18.2.6",
"@types/node": "^20.19.0",
"@types/react-dom": "^18.2.4",
"@types/semver": "^7.3.9",
"@types/shortid": "^0.0.29",
Expand Down
Binary file added public/img/sandbox/hashicorp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,8 @@ describe('`MdxInlineAlert` Component', () => {
const { queryByText, queryByTestId } = render(
<MdxInlineAlert>{data.body}</MdxInlineAlert>
)
// icon renders
expect(queryByTestId('icon')).toBeInTheDocument()
// default title renders
expect(queryByText(data.title)).toBeInTheDocument()
// body text renders
expect(queryByText(data.body)).toBeInTheDocument()
})

Expand All @@ -51,11 +48,8 @@ describe('`MdxInlineAlert` Component', () => {
const { queryByText, queryByTestId } = render(
<MdxInlineAlert type="highlight">{data.body}</MdxInlineAlert>
)
// icon renders
expect(queryByTestId('icon')).toBeInTheDocument()
// default title renders
expect(queryByText(data.title)).toBeInTheDocument()
// body text renders
expect(queryByText(data.body)).toBeInTheDocument()
})

Expand All @@ -64,11 +58,8 @@ describe('`MdxInlineAlert` Component', () => {
const { queryByText, queryByTestId } = render(
<MdxInlineAlert type="note">{data.body}</MdxInlineAlert>
)
// icon renders
expect(queryByTestId('icon')).toBeInTheDocument()
// default title renders
expect(queryByText(data.title)).toBeInTheDocument()
// body text renders
expect(queryByText(data.body)).toBeInTheDocument()
})

Expand All @@ -77,11 +68,8 @@ describe('`MdxInlineAlert` Component', () => {
const { queryByText, queryByTestId } = render(
<MdxInlineAlert type="warning">{data.body}</MdxInlineAlert>
)
// icon renders
expect(queryByTestId('icon')).toBeInTheDocument()
// default title renders
expect(queryByText(data.title)).toBeInTheDocument()
// body text renders
expect(queryByText(data.body)).toBeInTheDocument()
})

Expand All @@ -94,32 +82,42 @@ describe('`MdxInlineAlert` Component', () => {
expect(queryByText(TEST_DATA.customTitle)).toBeInTheDocument()
})

it('throws when children are not passed', () => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
expect(() => render(<MdxInlineAlert />)).toThrowError(
TEST_DATA.errors.noChildren
)
it('renders error fallback when children are empty', () => {
const { getByText } = render(<MdxInlineAlert>{''}</MdxInlineAlert>)

// Should render the error fallback UI instead of throwing
expect(getByText('Alert Error')).toBeInTheDocument()
expect(
getByText(
'There was an error rendering this alert. Please check the alert configuration.'
)
).toBeInTheDocument()
})

it('throws when type is invalid', () => {
expect(() =>
render(
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
<MdxInlineAlert type="doughnut">I am an MdxInlineAlert</MdxInlineAlert>
it('renders error fallback when type is invalid', () => {
const invalidType = 'doughnut' as 'tip' | 'highlight' | 'note' | 'warning'
const { getByText } = render(
<MdxInlineAlert type={invalidType}>I am an MdxInlineAlert</MdxInlineAlert>
)

// Should render the error fallback UI instead of throwing
expect(getByText('Alert Error')).toBeInTheDocument()
expect(
getByText(
'There was an error rendering this alert. Please check the alert configuration.'
)
).toThrowError(TEST_DATA.errors.invalidType)
).toBeInTheDocument()
})

it('renders multiple children', () => {
expect(() =>
render(
<MdxInlineAlert>
<p> Liquorice cake marzipan danish brownie</p>
<p>Lollipop gingerbread bear claw muffin croissant</p>
</MdxInlineAlert>
)
).not.toThrowError()
const { getByText } = render(
<MdxInlineAlert>
<p>This may render multiple children.</p>
<p>This should get multiple children.</p>
</MdxInlineAlert>
)

expect(getByText('This may render multiple children.')).toBeInTheDocument()
expect(getByText('This should get multiple children.')).toBeInTheDocument()
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

import InlineAlert from 'components/inline-alert'
import { withErrorBoundary } from 'components/error-boundary'
import { IconInfo24 } from '@hashicorp/flight-icons/svg-react/info-24'
import { IconAlertTriangle24 } from '@hashicorp/flight-icons/svg-react/alert-triangle-24'
import { IconAlertDiamond24 } from '@hashicorp/flight-icons/svg-react/alert-diamond-24'
Expand All @@ -22,7 +23,7 @@ const ALERT_DATA: MdxInlineAlertData = {
},
}

export function MdxInlineAlert({
function MdxInlineAlertBase({
children,
title,
type = 'tip',
Expand Down Expand Up @@ -55,4 +56,38 @@ export function MdxInlineAlert({
)
}

// Create a fallback UI for when the alert component fails
const AlertErrorFallback = (
<div className={s.spacing}>
<InlineAlert
icon={<IconAlertDiamond24 />}
title="Alert Error"
description="There was an error rendering this alert. Please check the alert configuration."
color="critical"
className={s.typographyOverride}
/>
</div>
)

export const MdxInlineAlert = withErrorBoundary(
MdxInlineAlertBase,
AlertErrorFallback,
(error, errorInfo) => {
if (typeof window !== 'undefined' && window.posthog?.capture) {
window.posthog.capture('mdx_component_error', {
component_name: 'MdxInlineAlert',
error_message: error.message,
error_stack: error.stack,
component_stack: errorInfo?.componentStack,
timestamp: new Date().toISOString(),
page_url: window.location.href,
})
}

if (process.env.NODE_ENV === 'development') {
console.warn('MdxInlineAlert validation error:', error.message, errorInfo)
}
}
)

export { MdxHighlight, MdxTip, MdxNote, MdxWarning }
Loading
Loading