feat(hero): interactive workbench demo (exclusiveDemo) - #185
feat(hero): interactive workbench demo (exclusiveDemo)#185wailingwombat wants to merge 3 commits into
Conversation
Introduces exclusiveDemo hero variation with an embeddable five-step tour, static workbench-demo iframe bundle, and scoped framing headers. Restores exclusive for other pages with full-bleed images. Co-authored-by: Cursor <cursoragent@cursor.com>
Add Hero exclusiveDemo variation with desktop-only iframe tour, parent frame controls, book-demo postMessage wiring, and static workbench-demo assets. Harden next.config framing for /workbench-demo; dev-only homepage preview override for local QA. Co-authored-by: Cursor <cursoragent@cursor.com>
Greptile SummaryIntroduces the
Confidence Score: 5/5Safe to merge — the feature is well-scoped, the iframe communication is correctly origin-validated, and the CSP headers are properly split. The core iframe–parent postMessage bridge is correctly implemented with origin checks on both sides, nav controls are disabled until the iframe is ready, and production React builds with SRI hashes are used. The two findings are non-blocking: a leaked setTimeout in an iframe animation component and a global id on ContactDefault that could cause duplicate-ID issues only if two Contact slices appear on the same page — an edge case unlikely in a curated marketing site. src/slices/main/Contact/ContactDefault.tsx warrants a second look if the site ever gains pages with multiple Contact slices, since the hardcoded id is now applied globally.
|
| Filename | Overview |
|---|---|
| src/components/workbench-demo/WorkbenchDemoFrame.tsx | Parent frame managing iframe lifecycle, step sync via postMessage, and navigation controls. Nav buttons are properly gated with disabled={!loaded}. Origin validation is correct on both sides of the postMessage boundary. |
| next.config.ts | CSP/X-Frame-Options headers correctly split between DENY (everywhere) and SAMEORIGIN (workbench-demo path). isDev is a module-level const evaluated once at server start — correct behavior for Next.js config. |
| public/workbench-demo/index.html | Runtime JSX compilation via Babel standalone; production React builds and SRI integrity hashes are all present. Uses unpkg.com CDN for React 18 + Babel — acceptable trade-off for a marketing demo as noted in the PR description. |
| src/slices/main/Contact/ContactDefault.tsx | Adds id="book-demo", tabIndex={-1}, and scroll-mt-24 outline-none to the container — these apply globally to every ContactDefault instance on the site, not just the demo homepage. |
| public/workbench-demo/cc-job.jsx | Drives the running→done animation via setInterval + a trailing setTimeout; the setTimeout is not cancelled on unmount, leaving a 900 ms window where a stale setPhase('done') can fire on an unmounted component. |
| src/slices/main/Hero/HeroExclusiveDemoMedia.tsx | Correctly uses a media-query listener to gate the iframe at ≥1080 px, starts showDemo=false for SSR safety, and cleans up the listener on unmount. |
| src/app/[locale]/page.tsx | Dev-only withHeroDemoPreview forces exclusiveDemo variation on the hero slice; guarded by process.env.NODE_ENV !== 'production' so it has no effect in production. |
| public/workbench-demo/app.jsx | Top-level App component in the iframe; correctly validates origin on incoming postMessage and wraps outgoing postMessage in try/catch. Auto-advances step 3→4 when the job animation completes, syncing the parent frame without user interaction — this appears intentional. |
| src/components/workbench-demo/bookDemoTarget.ts | Thin utility; programmatically clicks the hero CTA anchor so the iframe's "Book demo" action reuses whatever href/target is configured in Prismic. |
| scripts/sync-workbench-tour-config.mjs | Generates public/workbench-demo/tour-config.js from JSON, validates total === steps.length, and round-trip checks the output. Hooked into build and dev:next. |
Reviews (2): Last reviewed commit: "fix(workbench-demo): address PR review (..." | Re-trigger Greptile
Use production React/ReactDOM UMD builds with SRI on CDN scripts. Disable tour nav until iframe load to avoid step desync on mount. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
✅ Deploy preview for marketing-pr-185 is ready!
| Name | Details |
|---|---|
| ⚡ Service | marketing-pr-185 (5 / 5 ready) |
| ☁️ Cluster | plural (eks) |
| d5cd66e | |
| https://console.mgmt.plural.sh/cd/clusters/446acdef-8524-425a-a49f-5336a... | |
| 🔍 Logs URL | https://console.mgmt.plural.sh/cd/clusters/446acdef-8524-425a-a49f-5336a... |
| 🌊 Flow URL | https://console.mgmt.plural.sh/flows/fbbadfa5-fa67-4c16-ab32-42dca133aa3... |
| Preview Link | Preview |
You can learn more about preview environments and Plural Flows here
Summary
exclusiveDemo: five-step guided workbench walkthrough in a same-origin iframe (/workbench-demo/) with a parent frame (step copy, prev/next dots, refresh on last step).HeroExclusiveDemoMedia: mounts iframe only at ≥1080px; below that, static Prismicfull_bleed_image/image_mobile.workbenchDemoTour.json→npm run sync:workbench-tour→public/workbench-demo/tour-config.js(runs onbuild/dev).next.config.ts: production keepsX-Frame-Options: SAMEORIGIN+frame-ancestors 'self'on/workbench-demo/*;DENYelsewhere.workbench-demo-book-demo; parentWorkbenchDemoFramecallsactivateHeroBookDemoCta()on[data-hero-book-demo-cta](hero Prismic CTA). Ensure copied page CTA targets a real destination (e.g. Contact#book-demo).src/app/[locale]/page.tsxforcesexclusiveDemoon/whenNODE_ENV !== 'production'. Dev/staging/prod/will not show the demo until Prismic usesexclusiveDemoon that document (use a copied homepage for remote preview).Pre-flight review
npm run lintnpm run buildtour-config.jsvs JSONprismicio-types.d.tsHeroSliceExclusiveDemonext.config.tsRisks for reviewers
public/workbench-demo/index.htmlloads React 18 + Babel standalone from unpkg.com and compiles JSX at runtime. Acceptable for a marketing demo, or pre-bundle later (availability + perf)./on deployed envs: No demo without PrismicexclusiveDemoon live home (or copied page UID).public/workbench-demo/— hard refresh after edits.#book-demo/valid href, modal click may not navigate usefully.Test plan
/en-us/home-demo) with HeroexclusiveDemo, desktop ≥1080px.#book-demoif configured).npm run lint&&npm run buildon branch.exclusiveDemo.Dev / staging deploy
ghcr.io/pluralsh/marketing:marketing-interactive-demo(built on branch push).Prismic (before sign-off)
exclusiveDemo) from Slice Machine.home-demo; set Hero toexclusiveDemo.Plural Flow: marketing
Plural Preview: marketing