// Get set up: the user's setup checklist (GET /api/setup) and a short tour // of how investigations work. Reached from Help in the top bar and from the // prompt on the Overview. Shares the primitives and `api` defined in app.jsx // and workspace.jsx (every JSX file is a plain script in one global scope). const SETUP_LEVELS = { required: { label: "Required", className: "badge-open" }, recommended: { label: "Recommended", className: "badge-env" }, optional: { label: "Optional", className: "" }, }; // Steps still worth doing: everything not done that is not optional. function setupStepsLeft(setup) { return (setup?.steps || []).filter((s) => !s.done && s.level !== "optional") .length; } function tourSteps(setup) { return [ { icon: "folder", title: "Start from an investigation", page: "list", link: "Open Investigations", body: (

Every search of a client's data is kept on an investigation, so the next person can see what you found. Search{" "} Investigations for open work on the same issue first. Otherwise click New investigation, link its Case, Bug or Ticket, and choose the client's environment: the tools need it, and the web app can't add it later.

), }, { icon: "server", title: "Find the client's environment", page: "environments", link: "Open Environments", body: ( <>

Environments lists every client tenant and whether Watson can read it now. Search by client name, org ID or Heroku app. Only available environments can be chosen.

{setup?.gate_enabled === false ? (

Interim: the client-grant gate is off, so every live client is readable. Open a client only for assigned work, and keep every read on the investigation. "Not gated" is a reminder, not a permission.

) : (

Watson reads a client only while they have granted StoreConnect support login access in Salesforce. When access is closed, the environment's Support Access card says why.

)} ), }, { icon: "search", title: "Gather the evidence", page: "lookup", link: "Try Record lookup", body: (

On the investigation page, Run Tool looks up records, builds a timeline, audits payments and checks shipments, and saves each result as evidence. The tools in the menu are for quick checks: they save nothing until you click{" "} Add to Investigation. Times are in UTC.

), }, { icon: "chat", title: "Ask Watson", page: "integrations", link: "Check your connections", body: (

The Ask Watson tab on an investigation runs the tools for you and explains what it finds, on your own Claude subscription. Claude Code and the Claude app do the same through your Watson connection. Check what it tells you against the evidence.

), }, { icon: "book", title: "Match known issues", page: "knowledge", link: "Open the Knowledge library", body: (

Before treating a problem as new, check the{" "} Known issues tab on the investigation or the{" "} Knowledge library. Record Confirmed on the entry that matches, or add the new cause, so the next investigation starts ahead.

), }, { icon: "arrow", title: "Report and hand off", body: (

Record the findings and resolution, then set the status.{" "} Log Bug files a Bug in Salesforce only when you click it. Hand off to Operations in the original #4-12-operations thread, and end every report with links to the Case, the Bug and the Slack thread. Watson never posts on a Case or emails a client.

), }, { icon: "audit", title: "Customer data stays masked", body: (

Names appear as codenames such as Cobalt Beacon, and the same name always gets the same codename. Emails and phone numbers are partly hidden, addresses fully. Log lines are only partly masked, so never copy personal details out of them. If you see unmasked customer data, stop and tell the Watson owner and your lead.

), }, ]; } function SetupStep({ step, number, onNav }) { const level = SETUP_LEVELS[step.level] || SETUP_LEVELS.optional; return (
  • {step.title} {step.done ? " (done)" : " (to do)"}

    {step.done ? "Done" : level.label}

    {step.summary}

    {/* The tour's action is written for agents; here its button says it. */} {step.action && step.page !== "help" &&

    {step.action}

    } {step.commands?.map((c) => (
                {c}
              
    ))} {step.link && ( {step.link.label} (opens in a new tab) )} {!step.done && step.page === "integrations" && ( onNav("integrations")}> Open Setup & connections )} {!step.done && step.page === "help" && ( { document .getElementById("tour") ?.scrollIntoView({ block: "start" }); document.getElementById("tour-step-heading")?.focus(); }} > Start the tour )}
  • ); } function Tour({ setup, onNav, onFinish }) { const steps = tourSteps(setup); const [index, setIndex] = React.useState(0); const [saving, setSaving] = React.useState(false); const [finished, setFinished] = React.useState(false); const [error, setError] = React.useState(null); const heading = React.useRef(null); const moved = React.useRef(false); React.useEffect(() => { if (moved.current) heading.current?.focus(); }, [index]); const go = (n) => { moved.current = true; setFinished(false); setIndex(n); }; const finish = async () => { setSaving(true); setError(null); try { await onFinish(); setFinished(true); } catch (e) { setError(e.message || "Watson could not save that. Try again."); } finally { setSaving(false); } }; const step = steps[index]; const last = index === steps.length - 1; return (

    How to use Watson

    {steps.length} short steps, from opening an investigation to reporting back.

      {steps.map((s, n) => (
    1. ))}

    Step {index + 1} of {steps.length}

    {step.title}

    {step.body} {step.page && ( { e.preventDefault(); onNav(step.page); }} > {step.link} )}
    go(index - 1)} disabled={index === 0} > Back {last ? ( {saving ? "Saving…" : "Finish the tour"} ) : ( go(index + 1)}> Next )}
    {finished && "You're set up. Help at the top of every page opens this page again."}
    {error && }
    ); } function GetSetUpPage({ setup, onNav, onSetupChange, tour }) { // #help/tour (Help > How to use Watson) opens on the tour. App leaves focus // alone for that route so this can move it. const ready = !!setup; React.useEffect(() => { if (!tour || !ready) return; document.getElementById("tour")?.scrollIntoView({ block: "start" }); document .getElementById("tour-step-heading") ?.focus({ preventScroll: true }); }, [tour, ready]); const complete = (completed) => api.patch("/setup", { completed }).then((data) => { if (data?.error) throw new Error(data.error); onSetupChange(data); return data; }); const left = setupStepsLeft(setup); return ( <> onNav("integrations")}> Setup & connections {!setup ? (

    Checking your setup…

    ) : (

    Your setup

    {setup.steps_done} of {setup.steps_total} done.{" "} {setup.ready ? "You're ready to investigate." : "Connect Claude or turn on Ask Watson to start investigating."}

    {left ? `${left} to do` : "All set"}
      {setup.steps.map((s, n) => ( ))}

    Your Claude token and the apps you have connected are kept under{" "} { e.preventDefault(); onNav("integrations"); }} > Setup & connections , where you can disconnect or revoke them at any time.

    complete(true)} />
    )} ); } // The prompt on the Overview until the user finishes or hides Get set up. function GetSetUpCallout({ setup, onNav, onSetupChange }) { const [error, setError] = React.useState(null); const hide = async () => { setError(null); try { const data = await api.patch("/setup", { completed: true }); if (data?.error) throw new Error(data.error); onSetupChange(data); document.getElementById("help-toggle")?.focus(); } catch (e) { setError(e.message || "Watson could not save that. Try again."); } }; return (

    Get set up

    {setup.steps_done <= 1 ? "Welcome to Watson. Let's get you set up." : "Finish getting set up."}

    Connect Claude, turn on Ask Watson and take a two-minute tour. Your connections live under{" "} { e.preventDefault(); onNav("integrations"); }} > Setup & connections .

    onNav("help")}> Get set up onNav("help", "tour")}> Take the tour Hide
    {error && }

    {setup.steps_done} of {setup.steps_total} {" "} done

    ); }