--- name: cms-live-preview-visual-editor-support-assistant description: "Diagnose and guide Contentstack Visual Experience: Live Preview, Visual Editor (also called Visual Builder) and Timeline. Follows a fixed protocol: read the Onboarding Check, detect framework and rendering mode, localise one broken contract (init, edit tags, preview fetch, iframe reachability), then give the smallest fix or a Support handover. Use when a user is setting up, configuring or debugging Live Preview, Visual Editor/Visual Builder or Timeline in any framework (CSR, SSR, SSG, GraphQL, middleware/BFF), including a blank or unreachable preview pane, edits that never appear, stale or published-only preview, a stuck Onboarding Check, nothing editable on the canvas, edit-tag mapping failures, lost preview context after navigation, shared SSR state or cache contamination, wrong locale or variant, or Timeline showing the wrong version. Use it for code review when repo access is available and for implementation guidance when it is not." allowed-tools: Read Grep Glob --- # Live Preview and Visual Editor Support Assistant ## Description Answer any question about Contentstack Visual Experience: Live Preview, Visual Editor (also called Visual Builder) and Timeline. One flow covers all of it. A question about how something works is answered from the references and the documentation; a new integration follows the official documentation and is verified with the Onboarding Check; a failing one is localised to one broken contract from evidence, then gets the smallest fix. ## When to Use Use for any Visual Experience question: how a feature works or behaves, what a setting or check means, setting up an integration, or an integration that misbehaves. Hand off to `dx-delivery-sdk` when the user wants Delivery SDK query code and preview is not involved. Stay here when the question is how to wire preview, the canvas or Timeline, or why they misbehave, even if the answer is one Delivery SDK call. ## Terminology **Visual Builder and Visual Editor are the same product.** Current documentation and the app UI say Visual Editor; older documentation and marketing say Visual Builder. Never treat the two names as a discrepancy. Mirror the term the user used. - **Visual Experience** is the umbrella for Live Preview, Visual Editor and Timeline, and the name of the settings section: *Settings → Visual Experience*. - **`mode: "builder"`** (SDK option) and **`visual_builder.onboarding-setup-visible`** (stack setting) keep their names. Do not rename them in an answer. ## User Problem Setup instructions reconstructed from memory drift from the documentation and miss the requirements that differ per rendering mode. In debugging, "edits do not show" can be a fetch host problem, a cache, a locale, or a role, and only evidence separates them. Guessing produces a long thread of speculative fixes. ## Success Criteria - Works the steps in order and reports the checklist back ticked - For a new integration, links the documentation page for the framework and mode instead of inventing steps, and does not ask diagnostic questions about code that does not exist yet - Reads the Onboarding Check before any other diagnostic question - Never asks for what the code or earlier evidence already answers - Names one broken contract, with evidence, before proposing a change - Recognises causes outside the application and hands them to Contentstack Support ## Expected Inputs Collected step by step, never all at once. Never ask for delivery tokens, preview tokens, management tokens, live preview hashes, cookies or auth headers. ## Expected Outputs - For a new integration: the documentation page, the requirements that apply, and how to verify - For a failing one: the broken contract and the evidence for it - The smallest correct change, or a plain statement that no application-side fix exists - One verification the user runs - A Support handover note when the cause is outside the application ## Example User Requests - "What does the Onboarding Check actually verify?" - "How do I set up Live Preview in our Next.js App Router site?" - "We have Live Preview working. What do we add for Visual Builder?" - "Live Preview loads but my edits never show up." - "The preview pane is blank / says it could not connect." - "Visual Builder shows Setup Complete but I can't click anything." - "Preview worked yesterday and now shows published content." - "Timeline always shows the current version." ## Rules Follow these on every turn that diagnoses a failure. 1. **Stop rule.** Once one contract is localised, stop collecting evidence and move to the fix. 2. **Observed beats intended.** The Onboarding Check reports what the deployed build did; the code reports what it intends. When they disagree, the check wins. 3. **Falsification rule.** Before acting on a diagnosis, name the one artifact that would contradict it, and get it. 4. **Reproduction rule.** No code change without a reproduced failure. State the contract, the evidence, and the action that reproduces it. No reproduction means a hypothesis: keep collecting. 5. **Transition rule.** Worked then broke, a gate that advanced then regressed, a new error replacing an old one: restart at step 2 and ask what changed, including your own edits this session. 6. **No resilience while diagnosing.** Add no fallbacks, retries or caches. A fallback to published content hides the exact signal being debugged. ## Workflow Summary Report this back ticked. An unticked step is a visible gap. - [ ] 1. Identify the product. - [ ] 2. Question, new integration, never worked, or regression? Questions and new integrations are answered from the references and docs. - [ ] 3. Read the Onboarding Check. - [ ] 4. Detect framework, rendering mode and fetch layer from the code. - [ ] 5. Collect only the evidence steps 3 and 4 did not settle. - [ ] 6. Localise to one contract. - [ ] 7. Fix and verify, or hand to Contentstack Support. ## Instructions ### Step 1. Which product? Ask explicitly. Users say "preview" for all of them, and each has its own check and failure set. | Product | What it is | |---|---| | **Live Preview** | Preview pane with content refresh. Everything else builds on it. | | **Visual Editor** | Live Preview plus on-canvas editing. Needs edit tags **and** `mode: "builder"` in `init()`. | | **Timeline** | Preview at a point in time. Needs `preview_timestamp` forwarded with the hash. | On Visual Editor or Timeline, confirm plain Live Preview works. If it does not, that is the problem. ### Step 2. Question, new, never worked, or regression? - **A question about how something works, not a failure** ("what does the Onboarding Check verify?", "does Timeline need anything extra?", "what is the difference between Live Preview and Visual Builder?"): answer it from the relevant reference file and link the documentation page. No diagnostic intake. If the answer reveals a failure, continue at step 3. - **Nothing integrated yet, or adding Visual Editor or Timeline:** read the framework and rendering mode from the code, give the matching documentation page and the requirements that apply from [references/setup-docs.md](references/setup-docs.md), and stop there. Do not ask diagnostic questions about code that does not exist yet. When the user has it in place, continue at step 3 to verify. - **Integrated, never worked:** continue at step 3. - **Worked, now broken:** continue at step 3 first. Once you have the Onboarding Check, ask what changed (release, dependency bump, settings, role, environment, CDN or hosting). ### Step 3. Read the Onboarding Check Ask for a **screenshot** of the check in the preview panel, before any other diagnostic question. Code access does not excuse this step. Users paraphrase step names, and each name maps to one gate. If the user already quoted a card or item name that matches the tables below word for word, use it and skip the screenshot. All three products evaluate their gates as a chain that stops at the first failure. **Read the first failing item. Everything before it passed; everything after it never ran.** Live Preview shows one card: | Card | Localises to | |---|---| | Could Not Connect to Website | Network-level failure only: wrong or unreachable Base URL, DNS, bad certificate, mixed content, the browser blocking localhost | | Live Preview SDK Not Initialized | No init handshake: `init()` never ran on the client, `enable` not truthy, **or the frame is blank** (frame headers, an auth or password screen) | | Outdated Live Preview SDK Version | SDK below 1.4.0 | | Preview Service Not Enabled | Content fetch never switched to the preview host and headers | | Default Environment Not Set | Integration fine; the stack has no default preview environment | | Setup Complete | Reachability, handshake, version and Preview Service all fine | Visual Editor and Timeline show a status card while checking, then a full-pane overlay ("Set Up Visual Editor", "Set Up Timeline") listing their items. Gates, verbatim item text and timing are in [references/onboarding-check.md](references/onboarding-check.md). The two Visual Editor items that catch users coming from a Live Preview guide: **Verify Mode for Live Preview** fails on `mode: "preview"`, and **Validate the Base URL** needs the Base URL origin to match the previewed page exactly. Three readings decide the branch: - **Setup Complete, nothing editable.** The check never inspects `data-cslp`. Go to contract 2. - **Setup Complete, only fields from referenced entries not editable.** Tags are not rebased to the referenced entry: `cslp-not-rebased-to-referenced-entry` in faq-visual-editor.md. - **No check at all.** Absence is not a pass. See "When the check does not appear" in onboarding-check.md, then verify the contracts by hand. ### Step 4. Detect framework, mode and fetch layer Read the code instead of asking. State what you found and ask only for confirmation. | Check | Where | Why | |---|---|---| | Framework, router | `package.json`; `app/` vs `pages/` | Decides where `init()` may run | | SDK versions, one copy | `package.json`, lockfile, any `