Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
A one-time Simple mode popup for everyone, and the mode on app_active (#3688)
Milind Soni3dc872825073
diff --git a/apps/docs/content/docs/security/analytics.mdx b/apps/docs/content/docs/security/analytics.mdxindex 7ed7046abb..34ae7b1e8f 100644--- a/apps/docs/content/docs/security/analytics.mdx+++ b/apps/docs/content/docs/security/analytics.mdx@@ -136,7 +136,7 @@ use their own Boat key, and how many bots run on cloud computers, without sendin| --- | --- | --- || `app_first_open` | The first time this app page starts with analytics on | `platform`: `desktop`, `browser` || `app_opened` | Each time this app page starts with analytics on | `platform`: `desktop`, `browser` |-| `app_active` | Once a day you use the app: when this app page starts, comes into view or is focused, or when a check every ten minutes finds a new day while the page is in view and focused. At most once per day by your computer's date for each app page, and never while the page is hidden | `platform`: `desktop`, `browser` |+| `app_active` | Once a day you use the app: when this app page starts, comes into view or is focused, or when a check every ten minutes finds a new day while the page is in view and focused. At most once per day by your computer's date for each app page, and never while the page is hidden | `platform`: `desktop`, `browser`; `mode`: `simple`, `advanced`, the look this app page is in when it counts the day || `$identify` | PostHog's own event, sent before a `cloud_pro_popup` `upgrade`, `manage` or `see_plans` counted on this computer's page for someone signed in to MausBot Cloud (not while the app has kept no analytics choice of its own and serves that page on a port other than its first), to tie your events to that email. When your events were already tied to an email, PostHog sends its `$set` event with the new one instead | `$set`: `email`, your Cloud account's email; `$anon_distinct_id`: the random id your events had before || `onboarding_step` | A first-run screen is shown | `step`: `meet`, `chief`; `replay`: true/false || `onboarding_completed` | The first run ends in the chat | `reason`: `completed`; `at`: the screen it ended on; `replay`: true/false |@@ -169,6 +169,7 @@ use their own Boat key, and how many bots run on cloud computers, without sendin| `cloud_welcome_step` | A step of a new Cloud's welcome is shown | `step`: `bring`, `engine`, `files`, `done` || `cloud_welcome_ended` | A new Cloud's welcome ends | `reason`: `done`, `skipped`; `at`: the step it ended on || `product_hunt_card` | You act on the Product Hunt card | `action`: `upvote`, `not_now`, `close` |+| `simple_mode_prompt` | The Simple mode popup, shown once in each browser after an update when nothing else is on screen, is shown, its Simple mode switch is flipped, or it is closed (Done, the X, Escape or a click outside) | `action`: `shown`, `toggled`, `closed`; `mode`: `simple`, `advanced`, the mode it was shown or closed in, or the one a flip turned on |`api_key_saved` reports `ok` for a key the server checks with its provider before saving it (Boat, Composio,ElevenLabs, Fish Audio), and for a model provider key whose test passed right after saving. A key nothing checks beforediff --git a/docs/analytics.md b/docs/analytics.mdindex f693e5d4c0..c1e9ee9382 100644--- a/docs/analytics.md+++ b/docs/analytics.md@@ -132,7 +132,7 @@ use their own Boat key, and how many bots run on cloud computers, without sendin| --- | --- | --- || `app_first_open` | The first time this app page starts with analytics on | `platform`: `desktop`, `browser` || `app_opened` | Each time this app page starts with analytics on | `platform`: `desktop`, `browser` |-| `app_active` | Once a day you use the app: when this app page starts, comes into view or is focused, or when a check every ten minutes finds a new day while the page is in view and focused. At most once per day by your computer's date for each app page, and never while the page is hidden | `platform`: `desktop`, `browser` |+| `app_active` | Once a day you use the app: when this app page starts, comes into view or is focused, or when a check every ten minutes finds a new day while the page is in view and focused. At most once per day by your computer's date for each app page, and never while the page is hidden | `platform`: `desktop`, `browser`; `mode`: `simple`, `advanced`, the look this app page is in when it counts the day || `$identify` | PostHog's own event, sent before a `cloud_pro_popup` `upgrade`, `manage` or `see_plans` counted on this computer's page for someone signed in to MausBot Cloud (not while the app has kept no analytics choice of its own and serves that page on a port other than its first), to tie your events to that email. When your events were already tied to an email, PostHog sends its `$set` event with the new one instead | `$set`: `email`, your Cloud account's email; `$anon_distinct_id`: the random id your events had before || `onboarding_step` | A first-run screen is shown | `step`: `meet`, `chief`; `replay`: true/false || `onboarding_completed` | The first run ends in the chat | `reason`: `completed`; `at`: the screen it ended on; `replay`: true/false |@@ -165,6 +165,7 @@ use their own Boat key, and how many bots run on cloud computers, without sendin| `cloud_welcome_step` | A step of a new Cloud's welcome is shown | `step`: `bring`, `engine`, `files`, `done` || `cloud_welcome_ended` | A new Cloud's welcome ends | `reason`: `done`, `skipped`; `at`: the step it ended on || `product_hunt_card` | You act on the Product Hunt card | `action`: `upvote`, `not_now`, `close` |+| `simple_mode_prompt` | The Simple mode popup, shown once in each browser after an update when nothing else is on screen, is shown, its Simple mode switch is flipped, or it is closed (Done, the X, Escape or a click outside) | `action`: `shown`, `toggled`, `closed`; `mode`: `simple`, `advanced`, the mode it was shown or closed in, or the one a flip turned on |`api_key_saved` reports `ok` for a key the server checks with its provider before saving it (Boat, Composio,ElevenLabs, Fish Audio), and for a model provider key whose test passed right after saving. A key nothing checks beforediff --git a/docs/verification/evidence/simple-mode-popup/after-dark.jpg b/docs/verification/evidence/simple-mode-popup/after-dark.jpgnew file mode 100644index 0000000000..798c59bb12Binary files /dev/null and b/docs/verification/evidence/simple-mode-popup/after-dark.jpg differdiff --git a/docs/verification/evidence/simple-mode-popup/after-light.jpg b/docs/verification/evidence/simple-mode-popup/after-light.jpgnew file mode 100644index 0000000000..4ca48efcceBinary files /dev/null and b/docs/verification/evidence/simple-mode-popup/after-light.jpg differdiff --git a/docs/verification/evidence/simple-mode-popup/before-dark.jpg b/docs/verification/evidence/simple-mode-popup/before-dark.jpgnew file mode 100644index 0000000000..a5dd1c502fBinary files /dev/null and b/docs/verification/evidence/simple-mode-popup/before-dark.jpg differdiff --git a/docs/verification/evidence/simple-mode-popup/before-light.jpg b/docs/verification/evidence/simple-mode-popup/before-light.jpgnew file mode 100644index 0000000000..81d08647ceBinary files /dev/null and b/docs/verification/evidence/simple-mode-popup/before-light.jpg differdiff --git a/docs/verification/evidence/simple-mode-popup/simple-dark.jpg b/docs/verification/evidence/simple-mode-popup/simple-dark.jpgnew file mode 100644index 0000000000..a6544df308Binary files /dev/null and b/docs/verification/evidence/simple-mode-popup/simple-dark.jpg differdiff --git a/docs/verification/evidence/simple-mode-popup/simple-light.jpg b/docs/verification/evidence/simple-mode-popup/simple-light.jpgnew file mode 100644index 0000000000..c76e9dfcabBinary files /dev/null and b/docs/verification/evidence/simple-mode-popup/simple-light.jpg differdiff --git a/docs/verification/evidence/simple-mode-popup/toggled-dark.jpg b/docs/verification/evidence/simple-mode-popup/toggled-dark.jpgnew file mode 100644index 0000000000..3368470dd5Binary files /dev/null and b/docs/verification/evidence/simple-mode-popup/toggled-dark.jpg differdiff --git a/docs/verification/evidence/simple-mode-popup/toggled-light.jpg b/docs/verification/evidence/simple-mode-popup/toggled-light.jpgnew file mode 100644index 0000000000..3a9bd9726bBinary files /dev/null and b/docs/verification/evidence/simple-mode-popup/toggled-light.jpg differdiff --git a/scripts/testing/threads-preview.tsx b/scripts/testing/threads-preview.tsxindex d7f9b3724e..6e04b794e6 100644--- a/scripts/testing/threads-preview.tsx+++ b/scripts/testing/threads-preview.tsx@@ -2,6 +2,7 @@ import { createRoot } from "react-dom/client";import App from "../../src/App";import { setAnalyticsEnabled, setEmailGateDone } from "../../src/lib/analytics";import { setAdvancedMode } from "../../src/lib/interface-mode";+import { markSimpleModePromptSeen } from "../../src/lib/simple-mode-prompt";import { applySkinChoice, readSkinChoice } from "../../src/lib/skins";import "../../src/styles.css";@@ -15,5 +16,7 @@ setAnalyticsEnabled(false);// ?onboarding=1 plays a brand-new install, and a new install opens in Simple mode.if (new URLSearchParams(location.search).has("onboarding")) setAdvancedMode(false);else setEmailGateDone("skipped");+// Every launch is a new browser, so the once-per-browser Simple mode popup shows only with ?simpleModePrompt=1.+if (!new URLSearchParams(location.search).has("simpleModePrompt")) markSimpleModePromptSeen();applySkinChoice(readSkinChoice());createRoot(document.getElementById("root")!).render(<App />);diff --git a/src/components/AppNotices.test.ts b/src/components/AppNotices.test.tsindex 681f84b255..c98e8b2123 100644--- a/src/components/AppNotices.test.ts+++ b/src/components/AppNotices.test.ts@@ -34,6 +34,8 @@ vi.mock("@/components/EngineLibrary", () => ({ engineReady: (instance: { snapshoimport { AppNotices } from "./AppNotices";import { CLOUD_PRO_UPDATE_NOTICE, PRODUCT_HUNT_NOTICE, PRODUCT_HUNT_UNTIL, PRODUCT_HUNT_URL, CLOUD_INTRO, localDay, STAR_NOTICE } from "@/lib/notices";import { identifyEmail, track } from "@/lib/analytics";+import { ADVANCED_MODE_KEY, setAdvancedMode } from "@/lib/interface-mode";+import { SIMPLE_MODE_PROMPT_KEY } from "@/lib/simple-mode-prompt";import { api } from "@/state/store";const DAY = 86_400_000, NOW = new Date(2026, 9, 9, 12).getTime();@@ -124,7 +126,7 @@ const press = (label: string) => {const FIRST_REPLY = [{ tasks: [{ threadId: "first", usage: { turns: 1 } }] }];let session: Map<string, string>;const returning = () => { f.state.bots = [{ tasks: [{ threadId: "t", createdAt: 1, usage: { turns: 2 } }] }]; };-const launchCardsSeen = () => { desk.saved = { seen: [CLOUD_PRO_UPDATE_NOTICE] }; storage.set(PRODUCT_HUNT_NOTICE, "1"); };+const launchCardsSeen = () => { desk.saved = { seen: [CLOUD_PRO_UPDATE_NOTICE] }; storage.set(PRODUCT_HUNT_NOTICE, "1"); storage.set(SIMPLE_MODE_PROMPT_KEY, "1"); };const hints = () => f.state.config.onboarding.hintsSeen as string[];beforeEach(() => {@@ -556,7 +558,7 @@ describe("the Cloud Pro popup after the update", () => {expect(popupEvents("see_plans")).toEqual([event("see_plans", "none", true, "local")]);expect(lastOrder(vi.mocked(identifyEmail))).toBeLessThan(lastOrder(vi.mocked(track)));expect(render()).toBe("");- storage.clear(); storage.set(PRODUCT_HUNT_NOTICE, "1");+ storage.clear(); storage.set(PRODUCT_HUNT_NOTICE, "1"); storage.set(SIMPLE_MODE_PROMPT_KEY, "1");expect(await launch(), "the desktop keeps it, not the page's storage").not.toContain(POPUP);vi.clearAllMocks(); fresh(); await launch();@@ -1008,3 +1010,93 @@ describe("main's Use my Mac popup, once the moment is right", () => {expect(asked).toEqual(["en"]);});});++describe("the Simple mode popup after the update", () => {+ const TITLE = "Try the new Simple mode", ON = "You're on Simple mode", POPUP = "MausBot Cloud Pro";+ let modal: boolean;+ const prompts = () => vi.mocked(track).mock.calls.filter(([event]) => event === "simple_mode_prompt").map(([, props]) => props);++ beforeEach(() => {+ modal = false;+ vi.stubGlobal("document", { activeElement: null, body: null, documentElement: { dataset: {} }, getElementById: () => null, querySelector: () => null,+ querySelectorAll: () => modal ? [{ closest: () => null, checkVisibility: () => true }] : [] });+ setAdvancedMode(true);+ storage.delete(SIMPLE_MODE_PROMPT_KEY);+ });++ it("shows once in each browser, claims the launch, and never comes back once it is closed", async () => {+ const html = await launch();+ expect(html).toContain(TITLE);+ for (const part of ['role="dialog"', 'aria-modal="true"', 'role="switch"', 'aria-checked="false"', "Switch any time in Settings → General."]) expect(html).toContain(part);+ expect(prompts()).toEqual([{ action: "shown", mode: "advanced" }]);+ expect(launchDialogShown()).toBe("notices");+ expect(await settle(), "shown is counted once").toContain(TITLE);+ expect(prompts()).toHaveLength(1);+ press("Done"); await flush();+ expect(render(), "nothing else in this launch after it").toBe("");+ expect(storage.get(SIMPLE_MODE_PROMPT_KEY)).toBe("1");+ expect(prompts()).toEqual([{ action: "shown", mode: "advanced" }, { action: "closed", mode: "advanced" }]);+ session.clear();+ expect(await launch()).not.toContain(TITLE);+ expect(prompts()).toHaveLength(2);+ });++ it("changes the mode live from the popup, both ways, while its words stay", async () => {+ await launch();+ press("Simple mode"); await flush();+ expect(storage.get(ADVANCED_MODE_KEY)).toBe("0");+ const on = render();+ expect(on).toContain('aria-checked="true"'); expect(on).toContain(TITLE);+ press("Simple mode"); await flush();+ expect(storage.get(ADVANCED_MODE_KEY)).toBe("1");+ expect(render()).toContain('aria-checked="false"');+ expect(prompts().slice(1)).toEqual([{ action: "toggled", mode: "simple" }, { action: "toggled", mode: "advanced" }]);+ expect(storage.has(SIMPLE_MODE_PROMPT_KEY), "flipping never closes it").toBe(false);+ });++ it("tells someone already on Simple mode so, with the switch on", async () => {+ setAdvancedMode(false);+ const html = await launch();+ expect(html).toContain(ON); expect(html).toContain('aria-checked="true"');+ expect(prompts()).toEqual([{ action: "shown", mode: "simple" }]);+ });++ it("asks on the Cloud's own page and in a plain browser too, not only on this computer's", async () => {+ snapshot = { status: "none" }; viewer = { hosted: false, canSave: true, cloudHome: true }; f.state.config.cloudHome = true;+ f.state.config.onboarding.hintsSeen = [...withTourFinished(undefined), "cloud-setup-hidden"]; showWindow(MY_CLOUD);+ expect(await launch()).toContain(TITLE);+ vi.stubGlobal("window", { addEventListener: vi.fn(), removeEventListener: vi.fn() });+ viewer = { hosted: true, canSave: true }; f.state.config.cloudHome = false;+ expect(await launch()).toContain(TITLE);+ });++ it("waits during the welcome, the tour, Settings, the quiet first chat, another dialog or a call, and skips the launch its welcome finished in", async () => {+ const waits: Array<() => void> = [+ () => { f.state.welcomeOpen = true; }, () => { f.state.tourOpen = true; }, () => { f.state.appSettingsOpen = true; }, () => { modal = true; },+ () => { f.state.liveCall = { status: "live" }; }, () => { f.state.config.onboarding.completedAt = undefined; },+ () => { f.state.config.onboarding.hintsSeen = [...withTourFinished(undefined), MET_CHIEF_HINT]; f.state.bots = [{ tasks: [{ threadId: "first", usage: { turns: 0 } }] }]; },+ ];+ for (const wait of waits) {+ const saved = structuredClone(f.state); wait();+ expect(await launch(), wait.toString()).not.toContain(TITLE);+ f.state = saved; modal = false;+ }+ expect(prompts()).toEqual([]);+ markWelcomeFinished();+ expect(await launch(), "the launch the welcome finished in").not.toContain(TITLE);+ session.clear();+ expect(await launch()).toContain(TITLE);+ expect(storage.has(SIMPLE_MODE_PROMPT_KEY)).toBe(false);+ });++ it("is one popup at a time: it comes before the Cloud Pro popup, which waits for a later launch", async () => {+ desk.saved = null; storage.delete(CLOUD_PRO_UPDATE_NOTICE);+ const first = await launch();+ expect(first).toContain(TITLE); expect(first).not.toContain(POPUP);+ press("Done"); await flush();+ expect(render()).toBe("");+ session.clear();+ const later = await launch();+ expect(later).toContain(POPUP); expect(later).not.toContain(TITLE);+ });+});diff --git a/src/components/AppNotices.tsx b/src/components/AppNotices.tsxindex eaf352c788..6bcb6ea53b 100644--- a/src/components/AppNotices.tsx+++ b/src/components/AppNotices.tsx@@ -10,7 +10,8 @@ import { buyOfferAllowed, cloudNoticeKind, cloudPlanView, cloudTrialNotice, clouimport { jobRoutine, useCloudIntent } from "@/lib/cloud-intent";import { CLOUD_INTENT_GIVEN, cloudSetupStage } from "@/lib/cloud-setup";import { cornerPopupWaits, firstReplyPending } from "@/lib/corner-popup";-import { CLOUD_INTRO, CLOUD_NOTICE, CLOUD_PRO_UPDATE_NOTICE, CLOUD_TRIAL_NOTICE, dismissNotice, introShown, introStage, nextNotice, noticeSeen, PRODUCT_HUNT_NOTICE, PRODUCT_HUNT_UNTIL, PRODUCT_HUNT_URL, STAR_NOTICE, UPDATES_CONSENT_NOTICE, USE_MY_COMPUTER_NOTICE, usedBefore } from "@/lib/notices";+import { CLOUD_INTRO, CLOUD_NOTICE, CLOUD_PRO_UPDATE_NOTICE, CLOUD_TRIAL_NOTICE, dismissNotice, introShown, introStage, nextNotice, noticeSeen, PRODUCT_HUNT_NOTICE, PRODUCT_HUNT_UNTIL, PRODUCT_HUNT_URL, SIMPLE_MODE_NOTICE, STAR_NOTICE, UPDATES_CONSENT_NOTICE, USE_MY_COMPUTER_NOTICE, usedBefore } from "@/lib/notices";+import { useSimpleModePromptSeen } from "@/lib/simple-mode-prompt";import { cloudSignInDue, onboardingCloudOffered, welcomeFinishedThisLaunch, type WelcomeViewer } from "@/lib/onboarding";import { launchDialogShown, markLaunchDialog } from "@/lib/launch-dialogs";import { useUpdaterState } from "@/lib/updater";@@ -27,6 +28,7 @@ import { LinkButton, NoticeCard, NoticeToast, NotNowButton } from "./NoticeCard"import { localDesktopPage } from "./onboarding/WelcomeGate";import { UpdatesConsentDialog, updatesConsentBridge, useUpdatesConsent } from "./UpdatesConsent";import { useMausBotWelcomeDue } from "./MausBotWelcome";+import { reportSimpleModePrompt, SimpleModePrompt } from "./SimpleModePrompt";function StarCard({ onDismiss }: { onDismiss: () => void }) {return <NoticeCard titleId="github-star-title" notice="github-star" icon={Star} title={t("star.title")} onDismiss={onDismiss}>@@ -72,6 +74,7 @@ export function AppNotices({ quiet = false, viewer = null, now = Date.now }: { qconst [failed, setFailed] = useState(false);const [busy, setBusy] = useState(false);const [popupShown, setPopupShown] = useState(false);+ const [simpleShown, setSimpleShown] = useState(false);const consentHere = (local || viewer?.cloudHome === true) && brandStatus().source !== "file";const consent = useUpdatesConsent(consentHere ? updatesConsentBridge() : undefined);const [consentDone, setConsentDone] = useState(false);@@ -131,6 +134,9 @@ export function AppNotices({ quiet = false, viewer = null, now = Date.now }: { qconst consentDue = consent.state?.available === true && consent.state.due && !consentDone;const consentBlocked = useOtherDialogOpen(consentDue) || Boolean(state.liveCall && state.liveCall.status !== "ended");const consentFact = !consentHere || consentDone ? false : consent.state === undefined ? null : consentDue ? (consentBlocked ? null : true) : false;+ // Every page with the app's chrome, desktop or Cloud, new install or not: once per browser, as the mode is.+ const simpleDue = !useSimpleModePromptSeen();+ const simpleBlocked = useOtherDialogOpen(simpleDue) || Boolean(state.liveCall && state.liveCall.status !== "ended");const trial = plan?.trial;const key = trial ? trialKey(trial) : null;@@ -161,9 +167,11 @@ export function AppNotices({ quiet = false, viewer = null, now = Date.now }: { qconst consentNow = consentWaits === true || consentFact === false ? false : consentWaits === null || mausBotFirst ? null : consentFact;// After a closed popup only the product-updates question may follow in this launch; nothing else does.// Main's Use my Mac popup is full-screen too: it waits and skips a launch as the Cloud Pro popup does.- const notice = waits ? null : closed ? (consentNow === true ? UPDATES_CONSENT_NOTICE : null) : cards || popupHere || consentHere || Boolean(lending?.ask) ? nextNotice({+ const notice = waits ? null : closed ? (consentNow === true ? UPDATES_CONSENT_NOTICE : null) : cards || popupHere || consentHere || Boolean(lending?.ask) || simpleDue ? nextNotice({[USE_MY_COMPUTER_NOTICE]: moving || macDue === false || afterWelcome === true ? false: macDue === null || moving === null || afterWelcome === null || mausBotFirst || macBlocked ? null : true,+ // As the Cloud Pro popup: never in the launch whose welcome just finished, nor over MausBot's first-launch card.+ [SIMPLE_MODE_NOTICE]: !simpleDue || afterWelcome === true ? false : afterWelcome === null || mausBotFirst || simpleBlocked ? null : true,[CLOUD_PRO_UPDATE_NOTICE]: !popupPending || moving || afterWelcome === true ? false: afterWelcome === null || mausBotFirst || popupState === "loading" || moving === null || (popupView !== null && popupBlocked) ? null : popupView !== null,[UPDATES_CONSENT_NOTICE]: consentNow,@@ -181,7 +189,7 @@ export function AppNotices({ quiet = false, viewer = null, now = Date.now }: { quseEffect(() => {if (!shownKey) return;// The popups and the question own this launch: MausBot's first-launch card waits for a later one.- if (shownKey === USE_MY_COMPUTER_NOTICE || shownKey === CLOUD_PRO_UPDATE_NOTICE || shownKey === UPDATES_CONSENT_NOTICE) markLaunchDialog("notices");+ if (shownKey === USE_MY_COMPUTER_NOTICE || shownKey === SIMPLE_MODE_NOTICE || shownKey === CLOUD_PRO_UPDATE_NOTICE || shownKey === UPDATES_CONSENT_NOTICE) markLaunchDialog("notices");if (shownKey === CLOUD_INTRO) {setIntroOpen(true);track("cloud_card_shown", { variant: view?.kind === "signed-out" ? "signed_out" : "free" });@@ -194,6 +202,9 @@ export function AppNotices({ quiet = false, viewer = null, now = Date.now }: { q// Main draws this popup itself: the page only says now, and waits for it to be answered or put off.setMacAsking(true);void lending?.ask?.(activeLocale()).catch(() => {}).finally(() => { setMacAsked(true); close(); });+ } else if (shownKey === SIMPLE_MODE_NOTICE && !simpleShown) {+ setSimpleShown(true);+ reportSimpleModePrompt("shown");} else if (shownKey === CLOUD_PRO_UPDATE_NOTICE && !popupShown && popupView) {setPopupShown(true);void desktop?.shown(CLOUD_PRO_UPDATE_NOTICE).then(first => { if (first) reportCloudProPopup("shown", popupView, page); }, () => {});@@ -209,6 +220,8 @@ export function AppNotices({ quiet = false, viewer = null, now = Date.now }: { qif (toast) return <NoticeToast text={toast} onDone={() => setToast(null)} />;if (!notice) return null;+ if (notice === SIMPLE_MODE_NOTICE) return <SimpleModePrompt onClose={close} />;+if (notice === CLOUD_PRO_UPDATE_NOTICE && popupView && desktop) {const report = (action: CloudProPopupAction) => reportCloudProPopup(action, popupView, page);const end = () => { void desktop.seen(CLOUD_PRO_UPDATE_NOTICE).catch(() => {}); close(); };diff --git a/src/components/CloudProPopup.tsx b/src/components/CloudProPopup.tsxindex 86b57974d2..9053c53762 100644--- a/src/components/CloudProPopup.tsx+++ b/src/components/CloudProPopup.tsx@@ -113,7 +113,7 @@ const OTHER_DIALOGS = '[role="dialog"], [role="alertdialog"], [aria-modal="true"/** Any dialog on screen counts, modal or not, and the card that says a new Cloud is set up; never the queue's own popups. */export function otherDialogOpen(): boolean {- return [...document.querySelectorAll<HTMLElement>(OTHER_DIALOGS)].some(element => !element.closest(`${POPUP}, ${UPDATES_CONSENT_POPUP}`) && element.checkVisibility());+ return [...document.querySelectorAll<HTMLElement>(OTHER_DIALOGS)].some(element => !element.closest(`${POPUP}, ${UPDATES_CONSENT_POPUP}, [data-simple-mode-prompt]`) && element.checkVisibility());}export function useOtherDialogOpen(watch: boolean): boolean {diff --git a/src/components/SimpleModePrompt.test.ts b/src/components/SimpleModePrompt.test.tsnew file mode 100644index 0000000000..6209002bd8--- /dev/null+++ b/src/components/SimpleModePrompt.test.ts@@ -0,0 +1,134 @@+// @vitest-environment happy-dom+// The Simple mode popup: a switch that changes the app behind it as it is flipped, closed for good by Done, ×, Escape or+// a click outside.+import { act, createElement, Fragment } from "react";+import { createRoot, type Root } from "react-dom/client";+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";+import { setLocale } from "@/lib/i18n";+import { ADVANCED_MODE_KEY, readAdvancedMode, setAdvancedMode, useAdvancedMode } from "@/lib/interface-mode";+import { SIMPLE_MODE_PROMPT_KEY, simpleModePromptSeen } from "@/lib/simple-mode-prompt";++const analytics = vi.hoisted(() => ({ track: vi.fn() }));+vi.mock("@/lib/analytics", () => analytics);+const { SimpleModePrompt } = await import("./SimpleModePrompt");++(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true;+let host: HTMLDivElement, root: Root, opener: HTMLButtonElement;+const onClose = vi.fn();+const dialog = () => host.querySelector<HTMLElement>("[data-simple-mode-prompt]");+const toggle = () => host.querySelector<HTMLButtonElement>("[data-simple-mode-switch]")!;+const button = (label: string) => [...host.querySelectorAll<HTMLButtonElement>("button")].find((node) => node.textContent === label || node.getAttribute("aria-label") === label)!;+const show = async () => { await act(async () => { root.render(createElement(SimpleModePrompt, { onClose })); }); };+const key = async (name: string, shiftKey = false) => {+ await act(async () => { document.activeElement!.dispatchEvent(new KeyboardEvent("keydown", { key: name, shiftKey, bubbles: true, cancelable: true })); });+};+const events = () => analytics.track.mock.calls.filter(([event]) => event === "simple_mode_prompt").map(([, props]) => props);++const memoryStorage = () => {+ const values = new Map<string, string>();+ return { getItem: (k: string) => values.get(k) ?? null, setItem: (k: string, v: string) => void values.set(k, String(v)), removeItem: (k: string) => void values.delete(k), clear: () => values.clear() };+};++beforeEach(() => {+ setLocale("en");+ vi.stubGlobal("localStorage", memoryStorage());+ analytics.track.mockReset();+ onClose.mockReset();+ opener = document.createElement("button");+ document.body.append(opener);+ opener.focus();+ host = document.createElement("div");+ document.body.append(host);+ root = createRoot(host);+});+afterEach(async () => {+ await act(async () => root.unmount());+ host.remove();+ opener.remove();+ vi.unstubAllGlobals();+});++describe("the Simple mode popup", () => {+ it("invites someone on Advanced mode to try it, with the switch off", async () => {+ setAdvancedMode(true);+ await show();+ expect(dialog()?.getAttribute("role")).toBe("dialog");+ expect(dialog()?.getAttribute("aria-modal")).toBe("true");+ expect(host.querySelector("h2")?.textContent).toBe("Try the new Simple mode");+ expect(host.textContent).toContain("A calmer screen, with every feature still there.");+ expect(host.textContent).toContain("Switch any time in Settings → General.");+ expect(toggle().getAttribute("role")).toBe("switch");+ expect(toggle().getAttribute("aria-checked")).toBe("false");+ expect(document.activeElement, "focus starts on the title, so no key flips the switch by accident").toBe(host.querySelector("h2"));+ });++ it("tells someone already on it so, with the switch on", async () => {+ setAdvancedMode(false);+ await show();+ expect(host.querySelector("h2")?.textContent).toBe("You're on Simple mode");+ expect(toggle().getAttribute("aria-checked")).toBe("true");+ });++ it("changes the app the moment it is flipped, both ways, and keeps its words while it does", async () => {+ setAdvancedMode(true);+ const App = () => createElement("div", { "data-app": useAdvancedMode() ? "advanced" : "simple" });+ const app = () => host.querySelector<HTMLElement>("[data-app]")?.dataset.app;+ await act(async () => { root.render(createElement(Fragment, null, createElement(App), createElement(SimpleModePrompt, { onClose }))); });+ await act(async () => { toggle().click(); });+ expect(readAdvancedMode()).toBe(false);+ expect(localStorage.getItem(ADVANCED_MODE_KEY)).toBe("0");+ expect(app(), "the app behind it switches as it is flipped").toBe("simple");+ expect(toggle().getAttribute("aria-checked")).toBe("true");+ expect(host.querySelector("h2")?.textContent).toBe("Try the new Simple mode");+ await act(async () => { toggle().click(); });+ expect(readAdvancedMode()).toBe(true);+ expect(app()).toBe("advanced");+ expect(toggle().getAttribute("aria-checked")).toBe("false");+ expect(events()).toEqual([{ action: "toggled", mode: "simple" }, { action: "toggled", mode: "advanced" }]);+ expect(onClose, "flipping never closes it").not.toHaveBeenCalled();+ });++ it("follows the mode when another tab changes it", async () => {+ setAdvancedMode(true);+ await show();+ localStorage.setItem(ADVANCED_MODE_KEY, "0");+ await act(async () => { window.dispatchEvent(new StorageEvent("storage", { key: ADVANCED_MODE_KEY, storageArea: localStorage })); });+ expect(toggle().getAttribute("aria-checked")).toBe("true");+ });++ it.each(["Done", "Close", "Escape", "outside"])("closes for good with %s, saying the mode it ends in", async (how) => {+ setAdvancedMode(false);+ await show();+ if (how === "Escape") await key("Escape");+ else if (how === "outside") await act(async () => { dialog()!.parentElement!.dispatchEvent(new MouseEvent("mousedown", { bubbles: true })); });+ else await act(async () => { button(how).click(); });+ expect(onClose).toHaveBeenCalledOnce();+ expect(simpleModePromptSeen()).toBe(true);+ expect(localStorage.getItem(SIMPLE_MODE_PROMPT_KEY)).toBe("1");+ expect(events()).toEqual([{ action: "closed", mode: "simple" }]);+ });++ it("keeps the keyboard inside while it is open, and gives focus back when it closes", async () => {+ setAdvancedMode(true);+ await show();+ await key("Tab");+ expect(document.activeElement).toBe(toggle());+ await key("Tab");+ expect(document.activeElement).toBe(button("Done"));+ await key("Tab");+ expect(document.activeElement).toBe(button("Close"));+ await key("Tab");+ expect(document.activeElement, "round to the first again").toBe(toggle());+ await key("Tab", true);+ expect(document.activeElement).toBe(button("Close"));+ await act(async () => root.unmount());+ root = createRoot(host);+ expect(document.activeElement).toBe(opener);+ });++ it("lets motion go for anyone who asks for less", async () => {+ await show();+ expect(dialog()!.className).toContain("motion-reduce:animate-none");+ expect(toggle().className).toContain("motion-reduce:transition-none");+ });+});diff --git a/src/components/SimpleModePrompt.tsx b/src/components/SimpleModePrompt.tsxnew file mode 100644index 0000000000..e9fbd90ecc--- /dev/null+++ b/src/components/SimpleModePrompt.tsx@@ -0,0 +1,103 @@+import { useEffect, useState } from "react";+import { X } from "lucide-react";+import { track } from "@/lib/analytics";+import { cn } from "@/lib/cn";+import { t } from "@/lib/i18n";+import { readAdvancedMode, setAdvancedMode, useAdvancedMode } from "@/lib/interface-mode";+import { markSimpleModePromptSeen } from "@/lib/simple-mode-prompt";++export const SIMPLE_MODE_PROMPT = "[data-simple-mode-prompt]";+const TITLE = "simple-mode-prompt-title";++export function reportSimpleModePrompt(action: "shown" | "toggled" | "closed", advanced = readAdvancedMode()): void {+ track("simple_mode_prompt", { action, mode: advanced ? "advanced" : "simple" });+}++/** Once per browser (AppNotices): a switch for Simple mode that changes the app behind it as it is flipped. Done, ×,+ * Escape and a click outside close it for good. The mode stays in Settings → General. */+export function SimpleModePrompt({ onClose }: { onClose: () => void }) {+ const advanced = useAdvancedMode();+ const simple = !advanced;+ // Its words stay those it opened with; the switch follows the mode, here or from another tab.+ const [openedSimple] = useState(simple);+ const close = () => {+ reportSimpleModePrompt("closed", advanced);+ markSimpleModePromptSeen();+ onClose();+ };+ const flip = () => {+ setAdvancedMode(simple);+ reportSimpleModePrompt("toggled", simple);+ };++ useEffect(() => {+ const opener = document.activeElement as HTMLElement | null;+ document.getElementById(TITLE)?.focus();+ return () => {+ if (opener?.isConnected && opener !== document.body) opener.focus();+ };+ }, []);+ // Focus stays inside while it is open; Escape closes it.+ useEffect(() => {+ const onKey = (event: KeyboardEvent) => {+ const root = document.querySelector<HTMLElement>(SIMPLE_MODE_PROMPT);+ if (!root) return;+ if (event.key === "Escape") {+ event.preventDefault();+ event.stopPropagation();+ close();+ return;+ }+ if (event.key !== "Tab") return;+ const controls = [...root.querySelectorAll<HTMLElement>("button:not([disabled])")];+ if (!controls.length) return;+ event.preventDefault();+ const at = controls.indexOf(document.activeElement as HTMLElement), step = event.shiftKey ? -1 : 1;+ controls[at === -1 ? (step > 0 ? 0 : controls.length - 1) : (at + step + controls.length) % controls.length]!.focus();+ };+ window.addEventListener("keydown", onKey, true);+ return () => window.removeEventListener("keydown", onKey, true);+ });++ return (+ <div className="ui-scrim ui-scrim-light fixed inset-0 z-50 flex items-center justify-center p-4 motion-reduce:animate-none"+ onMouseDown={(event) => { if (event.target === event.currentTarget) close(); }}>+ <div role="dialog" aria-modal="true" aria-labelledby={TITLE} aria-describedby="simple-mode-prompt-body" data-simple-mode-prompt=""+ className="ui-modal animate-pop-in relative w-[min(440px,calc(100vw-32px))] rounded-[16px] border-0 px-6 pb-5 pt-6 text-ink motion-reduce:animate-none">+ {/* Focus lands on the title, which is no control: it shows no ring. */}+ <h2 id={TITLE} tabIndex={-1} className="pe-8 text-[17px] font-medium leading-6 tracking-[-0.008em] outline-none!">+ {t(openedSimple ? "simpleModePrompt.titleOn" : "simpleModePrompt.title")}+ </h2>+ <p id="simple-mode-prompt-body" className="mt-2 text-[14px] leading-5 text-ink-secondary">{t("simpleModePrompt.body")}</p>+ <button+ type="button"+ role="switch"+ aria-checked={simple}+ aria-labelledby="simple-mode-switch-label"+ aria-describedby="simple-mode-switch-hint"+ data-simple-mode-switch=""+ onClick={flip}+ className="mt-5 flex min-h-14 w-full items-center gap-4 rounded-[12px] bg-ink/[0.04] px-4 py-3 text-left transition-colors hover:bg-ink/[0.07] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus motion-reduce:transition-none"+ >+ <span className="min-w-0 flex-1">+ <span id="simple-mode-switch-label" className="block text-[15px] font-medium leading-5">{t("simpleModePrompt.switch")}</span>+ <span id="simple-mode-switch-hint" className="mt-0.5 block text-[13px] leading-[18px] text-ink-secondary">{t("simpleModePrompt.switchHint")}</span>+ </span>+ <span aria-hidden="true" className={cn("relative h-7 w-12 shrink-0 rounded-full transition-colors motion-reduce:transition-none",+ simple ? "bg-accent" : "bg-ink/[0.14] ring-1 ring-inset ring-ink/40")}>+ <span className={cn("absolute top-0.5 size-6 rounded-full bg-white shadow-sm transition-[left] motion-reduce:transition-none",+ simple ? "left-[22px]" : "left-0.5")} />+ </span>+ </button>+ <p className="mt-3 text-[13px] leading-[18px] text-ink-tertiary">{t("simpleModePrompt.where")}</p>+ <div className="mt-5 flex justify-end">+ <button type="button" data-primary="" onClick={close}+ className="ui-button ui-button-pill min-w-[88px] border-transparent bg-ink text-app hover:bg-ink/90 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus">+ {t("common.done")}+ </button>+ </div>+ <button type="button" onClick={close} aria-label={t("common.close")} className="ui-icon-button absolute end-3 top-3"><X size={16} /></button>+ </div>+ </div>+ );+}diff --git a/src/lib/analytics.test.ts b/src/lib/analytics.test.tsindex 6713601607..468057f610 100644--- a/src/lib/analytics.test.ts+++ b/src/lib/analytics.test.ts@@ -379,6 +379,7 @@ describe("app_active", () => {beforeEach(() => {vi.useFakeTimers({ toFake: ["setInterval", "clearInterval", "Date"] });vi.setSystemTime(new Date(2026, 9, 23, 9, 0));+ store.set("omb-advanced-mode", "0");page = openPage();});afterEach(() => {@@ -390,7 +391,7 @@ describe("app_active", () => {it("is sent once a day, however often the app loads or comes back into view", async () => {await page.load();expect(ph.calls).toEqual([...OPENED, "capture app_active"]);- expect(active()).toEqual([{ event: "app_active", props: { platform: "browser" } }]);+ expect(active()).toEqual([{ event: "app_active", props: { platform: "browser", mode: "simple" } }]);expect(ph.registered).toEqual([{ app_version: appVersion(), surface: "server" }]);expect(store.get(DAY)).toBe("2026-10-23");@@ -408,6 +409,15 @@ describe("app_active", () => {expect(ph.calls.filter((call) => call === "capture app_opened")).toHaveLength(3);});+ it("says which mode the page is in that day, Simple or Advanced", async () => {+ await page.load();+ expect(active()).toEqual([{ event: "app_active", props: { platform: "browser", mode: "simple" } }]);+ store.set("omb-advanced-mode", "1");+ vi.setSystemTime(new Date(2026, 9, 24, 9, 0));+ await page.load();+ expect(active()[1]).toEqual({ event: "app_active", props: { platform: "browser", mode: "advanced" } });+ });+it("is sent again after midnight by the ten-minute check, then not again that day", async () => {vi.setSystemTime(new Date(2026, 9, 23, 23, 55));await page.load();diff --git a/src/lib/analytics.ts b/src/lib/analytics.tsindex 9a617eaea4..d323348f68 100644--- a/src/lib/analytics.ts+++ b/src/lib/analytics.ts@@ -3,6 +3,7 @@import type { CaptureResult, PostHog } from "posthog-js";import { DESKTOP_PORTS } from "../../electron/desktop-ports.mjs";import { appVersion } from "@/lib/app-links";+import { readAdvancedMode } from "@/lib/interface-mode";const TOKEN = "phc_m2hP39w8y2gLPvHgDvSXAu6xcZ3agjf4ruL56rGcMZEe";@@ -156,7 +157,7 @@ function claimActiveDay(day: string): boolean {function sendAppActive() {if (!client || !analyticsEnabled() || globalThis.document?.visibilityState !== "visible") return;- if (claimActiveDay(localDay())) client.capture("app_active", { platform: pagePlatform() });+ if (claimActiveDay(localDay())) client.capture("app_active", { platform: pagePlatform(), mode: readAdvancedMode() ? "advanced" : "simple" });}function watchActiveDays() {diff --git a/src/lib/notices.test.ts b/src/lib/notices.test.tsindex 25e7487fd9..70b7dd3190 100644--- a/src/lib/notices.test.ts+++ b/src/lib/notices.test.ts@@ -2,7 +2,7 @@ import { afterEach, beforeEach, expect, it, vi } from "vitest";import { EMPTY_ONBOARDING, type OnboardingStatus } from "@/lib/onboarding";import { withTourReset } from "@/lib/guided-tour";import { CLOUD_INTRO, CLOUD_NOTICE, CLOUD_PRO_UPDATE_NOTICE, CLOUD_TRIAL_NOTICE, dismissNotice, introShown, introStage, localDay, nextNotice, noticeSeen, NOTICES,- OLD_PRO_DISMISSALS, PRODUCT_HUNT_NOTICE, STAR_NOTICE, UPDATES_CONSENT_NOTICE, USE_MY_COMPUTER_NOTICE, usedBefore, type NoticeFacts } from "./notices";+ OLD_PRO_DISMISSALS, PRODUCT_HUNT_NOTICE, SIMPLE_MODE_NOTICE, STAR_NOTICE, UPDATES_CONSENT_NOTICE, USE_MY_COMPUTER_NOTICE, usedBefore, type NoticeFacts } from "./notices";let storage: Map<string, string>;beforeEach(() => {@@ -13,16 +13,18 @@ afterEach(() => vi.unstubAllGlobals());const record = (hintsSeen: string[] = []): OnboardingStatus => ({ ...EMPTY_ONBOARDING, completedAt: "2026-09-01", version: 1, hintsSeen });const facts = (intro: boolean | null, trial: boolean | null, cloud: boolean | null, star: boolean | null, launch: boolean | null = false, popup: boolean | null = false,- consent: boolean | null = false, useMac: boolean | null = false): NoticeFacts =>- ({ [USE_MY_COMPUTER_NOTICE]: useMac, [CLOUD_PRO_UPDATE_NOTICE]: popup, [UPDATES_CONSENT_NOTICE]: consent, [PRODUCT_HUNT_NOTICE]: launch, [CLOUD_INTRO]: intro, [CLOUD_TRIAL_NOTICE]: trial, [CLOUD_NOTICE]: cloud, [STAR_NOTICE]: star });+ consent: boolean | null = false, useMac: boolean | null = false, simple: boolean | null = false): NoticeFacts =>+ ({ [USE_MY_COMPUTER_NOTICE]: useMac, [SIMPLE_MODE_NOTICE]: simple, [CLOUD_PRO_UPDATE_NOTICE]: popup, [UPDATES_CONSENT_NOTICE]: consent, [PRODUCT_HUNT_NOTICE]: launch, [CLOUD_INTRO]: intro, [CLOUD_TRIAL_NOTICE]: trial, [CLOUD_NOTICE]: cloud, [STAR_NOTICE]: star });const none = () => false;const DAY = 86_400_000, NOON = new Date(2026, 9, 9, 12).getTime();-it("is one queue: the Use my Mac popup first, then the Cloud Pro popup, the product-updates question, the launch card, the card after the update, the trial's notice, the My Cloud card, the star", () => {- expect(nextNotice(facts(true, true, true, true, true, true, true, true), none)).toBe(USE_MY_COMPUTER_NOTICE);+it("is one queue: the Use my Mac popup first, then the Simple mode popup, the Cloud Pro popup, the product-updates question, the launch card, the card after the update, the trial's notice, the My Cloud card, the star", () => {+ expect(nextNotice(facts(true, true, true, true, true, true, true, true, true), none)).toBe(USE_MY_COMPUTER_NOTICE);+ expect(nextNotice(facts(true, true, true, true, true, true, true, true, true), id => id === USE_MY_COMPUTER_NOTICE)).toBe(SIMPLE_MODE_NOTICE);+ expect(nextNotice(facts(true, true, true, true, true, true, true, false, null), none), "nothing shows while the Simple mode popup waits").toBeNull();expect(nextNotice(facts(true, true, true, true, true, true, true, null), none), "nothing shows before main says whether Use my Mac is due").toBeNull();expect(nextNotice(facts(true, true, true, true, true, true, true, true), id => id === USE_MY_COMPUTER_NOTICE)).toBe(CLOUD_PRO_UPDATE_NOTICE);- expect(NOTICES).toEqual([USE_MY_COMPUTER_NOTICE, CLOUD_PRO_UPDATE_NOTICE, UPDATES_CONSENT_NOTICE, PRODUCT_HUNT_NOTICE, CLOUD_INTRO, CLOUD_TRIAL_NOTICE, CLOUD_NOTICE, STAR_NOTICE]);+ expect(NOTICES).toEqual([USE_MY_COMPUTER_NOTICE, SIMPLE_MODE_NOTICE, CLOUD_PRO_UPDATE_NOTICE, UPDATES_CONSENT_NOTICE, PRODUCT_HUNT_NOTICE, CLOUD_INTRO, CLOUD_TRIAL_NOTICE, CLOUD_NOTICE, STAR_NOTICE]);expect(nextNotice(facts(true, true, true, true, true, true, true), none)).toBe(CLOUD_PRO_UPDATE_NOTICE);expect(nextNotice(facts(true, true, true, true, true, true, true), id => id === CLOUD_PRO_UPDATE_NOTICE)).toBe(UPDATES_CONSENT_NOTICE);expect(nextNotice(facts(true, true, true, true, true, null, true), none)).toBeNull();diff --git a/src/lib/notices.ts b/src/lib/notices.tsindex 9ee59c4eca..e9f231b0bb 100644--- a/src/lib/notices.ts+++ b/src/lib/notices.ts@@ -4,6 +4,8 @@ import { hintSeen, hintSeenPatch, type OnboardingStatus } from "@/lib/onboardingexport const USE_MY_COMPUTER_NOTICE = "use-my-computer";export const CLOUD_PRO_UPDATE_NOTICE = "cloud-pro-update-2026-10";export const UPDATES_CONSENT_NOTICE = "updates-consent";+/** The Simple mode popup, once per browser (simple-mode-prompt.ts keeps whether it was closed). */+export const SIMPLE_MODE_NOTICE = "simple-mode-prompt";export const CLOUD_INTRO = "cloud-trial-intro-v1";export const CLOUD_TRIAL_NOTICE = "cloud-trial-notice";export const CLOUD_NOTICE = "cloud-notice";@@ -12,9 +14,9 @@ export const PRODUCT_HUNT_NOTICE = "product-hunt-launch-2026-10";export const PRODUCT_HUNT_URL = "https://www.producthunt.com/products/mausbot";export const PRODUCT_HUNT_UNTIL = Date.UTC(2026, 10, 1);-export type NoticeId = typeof USE_MY_COMPUTER_NOTICE | typeof CLOUD_PRO_UPDATE_NOTICE | typeof UPDATES_CONSENT_NOTICE | typeof PRODUCT_HUNT_NOTICE | typeof CLOUD_INTRO | typeof CLOUD_TRIAL_NOTICE | typeof CLOUD_NOTICE | typeof STAR_NOTICE;+export type NoticeId = typeof USE_MY_COMPUTER_NOTICE | typeof SIMPLE_MODE_NOTICE | typeof CLOUD_PRO_UPDATE_NOTICE | typeof UPDATES_CONSENT_NOTICE | typeof PRODUCT_HUNT_NOTICE | typeof CLOUD_INTRO | typeof CLOUD_TRIAL_NOTICE | typeof CLOUD_NOTICE | typeof STAR_NOTICE;-export const NOTICES: readonly NoticeId[] = [USE_MY_COMPUTER_NOTICE, CLOUD_PRO_UPDATE_NOTICE, UPDATES_CONSENT_NOTICE, PRODUCT_HUNT_NOTICE, CLOUD_INTRO, CLOUD_TRIAL_NOTICE, CLOUD_NOTICE, STAR_NOTICE];+export const NOTICES: readonly NoticeId[] = [USE_MY_COMPUTER_NOTICE, SIMPLE_MODE_NOTICE, CLOUD_PRO_UPDATE_NOTICE, UPDATES_CONSENT_NOTICE, PRODUCT_HUNT_NOTICE, CLOUD_INTRO, CLOUD_TRIAL_NOTICE, CLOUD_NOTICE, STAR_NOTICE];export type NoticeFacts = Record<NoticeId, boolean | null>;diff --git a/src/lib/simple-mode-prompt.test.ts b/src/lib/simple-mode-prompt.test.tsnew file mode 100644index 0000000000..009a44251a--- /dev/null+++ b/src/lib/simple-mode-prompt.test.ts@@ -0,0 +1,35 @@+// Whether this browser has closed the Simple mode popup: kept in its own storage, as the mode is.+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";++let storage: Map<string, string>;+const load = async () => {+ vi.resetModules();+ return import("./simple-mode-prompt");+};++beforeEach(() => {+ storage = new Map();+ vi.stubGlobal("localStorage", { getItem: (key: string) => storage.get(key) ?? null, setItem: (key: string, value: string) => void storage.set(key, value) });+});+afterEach(() => vi.unstubAllGlobals());++describe("the Simple mode popup's seen flag", () => {+ it("is unset in a browser that never closed it, and set for good once it is closed", async () => {+ const prompt = await load();+ expect(prompt.SIMPLE_MODE_PROMPT_KEY).toBe("omb-simple-mode-prompt");+ expect(prompt.simpleModePromptSeen()).toBe(false);+ prompt.markSimpleModePromptSeen();+ expect(storage.get("omb-simple-mode-prompt")).toBe("1");+ expect((await load()).simpleModePromptSeen(), "a later launch reads it back").toBe(true);+ });++ it("never asks a browser whose storage it cannot read, and stays closed for the session where it cannot write", async () => {+ vi.stubGlobal("localStorage", { getItem: () => { throw new Error("blocked"); }, setItem: () => { throw new Error("blocked"); } });+ expect((await load()).simpleModePromptSeen()).toBe(true);+ vi.stubGlobal("localStorage", { getItem: () => null, setItem: () => { throw new Error("full"); } });+ const prompt = await load();+ expect(prompt.simpleModePromptSeen()).toBe(false);+ prompt.markSimpleModePromptSeen();+ expect(prompt.simpleModePromptSeen()).toBe(true);+ });+});diff --git a/src/lib/simple-mode-prompt.ts b/src/lib/simple-mode-prompt.tsnew file mode 100644index 0000000000..856f8e9d54--- /dev/null+++ b/src/lib/simple-mode-prompt.ts@@ -0,0 +1,47 @@+import { useSyncExternalStore } from "react";++/** The Simple mode popup was closed in this browser. Kept per browser, next to the mode it is about (interface-mode's+ * omb-advanced-mode), since each browser keeps its own mode. */+export const SIMPLE_MODE_PROMPT_KEY = "omb-simple-mode-prompt";++/** Where this page cannot write its storage, its memory stands in, so the popup still closes for the session. */+let closedHere = false;+const listeners = new Set<() => void>();++export function simpleModePromptSeen(): boolean {+ if (closedHere) return true;+ try {+ return globalThis.localStorage?.getItem(SIMPLE_MODE_PROMPT_KEY) === "1";+ } catch {+ // Storage this page cannot read would ask again at every launch.+ return true;+ }+}++export function markSimpleModePromptSeen(): void {+ try {+ globalThis.localStorage?.setItem(SIMPLE_MODE_PROMPT_KEY, "1");+ } catch {+ closedHere = true;+ }+ for (const listener of listeners) listener();+}++function onStorage(event: StorageEvent) {+ if (event.key !== SIMPLE_MODE_PROMPT_KEY && event.key !== null) return;+ for (const listener of listeners) listener();+}++function subscribe(listener: () => void): () => void {+ listeners.add(listener);+ if (listeners.size === 1 && typeof window !== "undefined") window.addEventListener("storage", onStorage);+ return () => {+ listeners.delete(listener);+ if (listeners.size === 0 && typeof window !== "undefined") window.removeEventListener("storage", onStorage);+ };+}++/** Closed in this browser, in this tab or another. */+export function useSimpleModePromptSeen(): boolean {+ return useSyncExternalStore(subscribe, simpleModePromptSeen, () => true);+}diff --git a/src/locales/en.json b/src/locales/en.jsonindex e1baab9dff..a689c9367f 100644--- a/src/locales/en.json+++ b/src/locales/en.json@@ -1282,6 +1282,12 @@"updatesConsent.emailHint": "Optional. Leave it empty and we'll use your MausBot Cloud email once you sign in.","updatesConsent.badEmail": "Enter a valid email address.","updatesConsent.failed": "That didn't save. Try again.",+ "simpleModePrompt.title": "Try the new Simple mode",+ "simpleModePrompt.titleOn": "You're on Simple mode",+ "simpleModePrompt.body": "A calmer screen, with every feature still there.",+ "simpleModePrompt.switch": "Simple mode",+ "simpleModePrompt.switchHint": "Flip it to see the difference right away.",+ "simpleModePrompt.where": "Switch any time in Settings → General.","settings.openAtLogin.title": "Open at login","settings.openAtLogin.subtitle": "Open OpenMausBot when you sign in to this computer, so your bots and routines are ready without opening it yourself.","settings.openAtLogin.failed": "Could not change this. Try again, or check Login Items in your system settings.",diff --git a/src/styles.css b/src/styles.cssindex 0f838f136b..e8c29870bc 100644--- a/src/styles.css+++ b/src/styles.css@@ -1354,6 +1354,11 @@ body {@container style(--code-color-scheme: dark) {.ui-scrim { background: rgb(0 0 0 / 0.7); }}+ /* A lighter dim, for a dialog about the app behind it, which should still show through as it changes. */+ .ui-scrim-light { background: rgb(0 0 0 / 0.2); }+ @container style(--code-color-scheme: dark) {+ .ui-scrim-light { background: rgb(0 0 0 / 0.4); }+ }@media (prefers-reduced-motion: reduce) {.ui-button,.ui-icon-button,