Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Teams: a What's new for everyone, and an Announcements page with a dot (#6375)

Milind Sonif6ae819f5ed6
diff --git a/apps/docs/content/docs/security/analytics.mdx b/apps/docs/content/docs/security/analytics.mdx
index 28926bc6e2..4df44bc12e 100644
--- a/apps/docs/content/docs/security/analytics.mdx
+++ b/apps/docs/content/docs/security/analytics.mdx
@@ -149,9 +149,9 @@ use their own Boat key, and how many bots run on cloud computers, without sendin
| `app_snapshot` | Once a day, as described above | The properties in the snapshot table |
| `cloud_card_shown` | The MausBot Cloud card is shown | `variant`: `signed_out`, `free` |
| `cloud_card_action` | You act on the MausBot Cloud card | `action`: `start`, `howto`, `signin`, `not_now`, `close` |
-| `whats_new` | The What's new popup (once per person after an update, on this computer's page): a slide comes on screen, counted once per slide each time the popup is up, or you act on it | `action`: `seen`, `next`, `back` (the slide changed, by its buttons, its dots or the arrow keys), `get_pro` (Get Pro, which opens Add a Cloud), `see_cloud` (See the new Cloud, which opens the Cloud website), `start_team` (Start a Team, which opens the Team plan's checkout on the Cloud website, or Add a Cloud for someone with a plan of their own), `not_now`, `close` (the X, Escape or a click outside); `slide`: the slide it happened on: `pro` (the new MausBot Cloud), `team` (Team); `audience`: `no_plan` (both slides), `own_plan` (a Cloud plan of one's own: the Team slide only); `signed_in`: true/false, signed in to MausBot Cloud in the app; `campaign`: the popup's campaign, `whats-new-2026-11` |
+| `whats_new` | The What's new popups (each once per person after an update, and again from Announcements): the earlier one on this computer's page, a slide comes on screen, counted once per slide each time the popup is up, or you act on it; the Teams one on every page, it comes on screen or you act on it | `action`: `seen`, `next`, `back` (the slide changed, by its buttons, its dots or the arrow keys), `get_pro` (Get Pro, which opens Add a Cloud), `see_cloud` (See the new Cloud, which opens the Cloud website), `start_team` (Start a Team, which opens the Team plan's checkout on the Cloud website, or Add a Cloud for someone with a plan of their own), `invite` (Invite your team, which opens the team's People page on MausBot Cloud), `got_it`, `not_now`, `close` (the X, Escape or a click outside); `slide`: the slide it happened on: `pro` (the new MausBot Cloud), `team` (Team), `teams` (the Teams popup); `audience`: `no_plan` (both slides), `own_plan` (a Cloud plan of one's own: the Team slide only), and for the Teams popup `team_admin` (a Team Cloud's Owner or Admin), `team_member` (a Team Cloud's member, or a desktop signed in to a team), `no_team` (everyone else); `signed_in`: true/false, signed in to MausBot Cloud in the app (the earlier popup only); `campaign`: the popup's campaign, `whats-new-2026-11` or `teams-2026-11` |
| `cloud_howto` | The "Show me how" tip ends | `result`: `no_button`, `skipped`, `closed` |
-| `cloud_dialog_shown` | The Add a Cloud dialog opens | `source`: `app_card`, `app_howto`, `app_menu`, `app_settings`, `app_routines`, `app_whats_new_pro` (Get Pro in the What's new popup), `app_whats_new_team` (Start a Team in it, for someone with a plan of their own), `app_onboarding` (Try Cloud under MausBot's first messages); `view`: the dialog's first screen |
+| `cloud_dialog_shown` | The Add a Cloud dialog opens | `source`: `app_card`, `app_howto`, `app_menu`, `app_settings`, `app_routines`, `app_whats_new_pro` (Get Pro in the What's new popup), `app_whats_new_team` (Start a Team in it or in the Teams popup, for someone with a plan of their own), `app_onboarding` (Try Cloud under MausBot's first messages); `view`: the dialog's first screen |
| `cloud_dialog_view` | The Add a Cloud dialog reaches a step | `view`: `received`, `starting`, `ready` |
| `cloud_signin` | Signing in to MausBot Cloud inside the Add a Cloud dialog takes a step | `step`: `code_sent` (a sign-in code was emailed), `signed_in`, `browser` (Continue in browser); `source`: as for `cloud_dialog_shown` |
| `cloud_checkout_opened` | A Cloud checkout opens in the browser | `plan`: Cloud plan; `trial`: true/false; `source`: as for `cloud_dialog_shown` |
diff --git a/docs/analytics.md b/docs/analytics.md
index 6eabfa35a2..dde7b59d54 100644
--- a/docs/analytics.md
+++ b/docs/analytics.md
@@ -145,9 +145,9 @@ use their own Boat key, and how many bots run on cloud computers, without sendin
| `app_snapshot` | Once a day, as described above | The properties in the snapshot table |
| `cloud_card_shown` | The MausBot Cloud card is shown | `variant`: `signed_out`, `free` |
| `cloud_card_action` | You act on the MausBot Cloud card | `action`: `start`, `howto`, `signin`, `not_now`, `close` |
-| `whats_new` | The What's new popup (once per person after an update, on this computer's page): a slide comes on screen, counted once per slide each time the popup is up, or you act on it | `action`: `seen`, `next`, `back` (the slide changed, by its buttons, its dots or the arrow keys), `get_pro` (Get Pro, which opens Add a Cloud), `see_cloud` (See the new Cloud, which opens the Cloud website), `start_team` (Start a Team, which opens the Team plan's checkout on the Cloud website, or Add a Cloud for someone with a plan of their own), `not_now`, `close` (the X, Escape or a click outside); `slide`: the slide it happened on: `pro` (the new MausBot Cloud), `team` (Team); `audience`: `no_plan` (both slides), `own_plan` (a Cloud plan of one's own: the Team slide only); `signed_in`: true/false, signed in to MausBot Cloud in the app; `campaign`: the popup's campaign, `whats-new-2026-11` |
+| `whats_new` | The What's new popups (each once per person after an update, and again from Announcements): the earlier one on this computer's page, a slide comes on screen, counted once per slide each time the popup is up, or you act on it; the Teams one on every page, it comes on screen or you act on it | `action`: `seen`, `next`, `back` (the slide changed, by its buttons, its dots or the arrow keys), `get_pro` (Get Pro, which opens Add a Cloud), `see_cloud` (See the new Cloud, which opens the Cloud website), `start_team` (Start a Team, which opens the Team plan's checkout on the Cloud website, or Add a Cloud for someone with a plan of their own), `invite` (Invite your team, which opens the team's People page on MausBot Cloud), `got_it`, `not_now`, `close` (the X, Escape or a click outside); `slide`: the slide it happened on: `pro` (the new MausBot Cloud), `team` (Team), `teams` (the Teams popup); `audience`: `no_plan` (both slides), `own_plan` (a Cloud plan of one's own: the Team slide only), and for the Teams popup `team_admin` (a Team Cloud's Owner or Admin), `team_member` (a Team Cloud's member, or a desktop signed in to a team), `no_team` (everyone else); `signed_in`: true/false, signed in to MausBot Cloud in the app (the earlier popup only); `campaign`: the popup's campaign, `whats-new-2026-11` or `teams-2026-11` |
| `cloud_howto` | The "Show me how" tip ends | `result`: `no_button`, `skipped`, `closed` |
-| `cloud_dialog_shown` | The Add a Cloud dialog opens | `source`: `app_card`, `app_howto`, `app_menu`, `app_settings`, `app_routines`, `app_whats_new_pro` (Get Pro in the What's new popup), `app_whats_new_team` (Start a Team in it, for someone with a plan of their own), `app_onboarding` (Try Cloud under MausBot's first messages); `view`: the dialog's first screen |
+| `cloud_dialog_shown` | The Add a Cloud dialog opens | `source`: `app_card`, `app_howto`, `app_menu`, `app_settings`, `app_routines`, `app_whats_new_pro` (Get Pro in the What's new popup), `app_whats_new_team` (Start a Team in it or in the Teams popup, for someone with a plan of their own), `app_onboarding` (Try Cloud under MausBot's first messages); `view`: the dialog's first screen |
| `cloud_dialog_view` | The Add a Cloud dialog reaches a step | `view`: `received`, `starting`, `ready` |
| `cloud_signin` | Signing in to MausBot Cloud inside the Add a Cloud dialog takes a step | `step`: `code_sent` (a sign-in code was emailed), `signed_in`, `browser` (Continue in browser); `source`: as for `cloud_dialog_shown` |
| `cloud_checkout_opened` | A Cloud checkout opens in the browser | `plan`: Cloud plan; `trial`: true/false; `source`: as for `cloud_dialog_shown` |
diff --git a/docs/announcements.md b/docs/announcements.md
index fb134c77ac..39fc26023a 100644
--- a/docs/announcements.md
+++ b/docs/announcements.md
@@ -172,6 +172,35 @@ that use it.
- **Invalid is ignored.** A card that fails validation, has no `ends` or is past it is skipped; a file that fails as a
whole is ignored and the last good copy kept. At most 20 cards and 64 KB are read.
+## The Announcements page
+
+Profile menu → **Announcements** lists, newest first, everything announced to this person here: the app's own popups and
+cards, and the current cards from this file. It lists what was *for* them by each one's own rules (a branded build has
+none, a desktop an organization runs has no promotions, a sponsor's card skips a Team Cloud's members), whether or not
+they saw it and whenever it ran; an offer whose time is over says **Ended** in place of its button. A popup's row opens
+the popup again; a card's row has the card's own buttons.
+
+A red dot on the profile button and on the menu's Announcements row means something here is newer than the last time the
+person opened the page, and they have not seen it. Opening the page clears it. The time they last opened it is kept the
+way the notices are kept: in the browser, in the desktop's own record for every page of its window, and in the place's
+record as an `announcements-read-<ms>` hint, the newest only (on a Team Cloud, in that person's own record). Someone who
+never opened it counts as having read everything up to the last announcement before the Teams one, so people who used the
+app before see the dot for Teams alone.
+
+A card from this file is dated by its `starts`, else by the file's `updatedAt` (which `GET /api/announcements` hands over
+with the cards). Give a card `starts` when its date matters.
+
+### Adding an announcement
+
+- **A card, without a release:** add it to `announcements/announcements.json` as above. It is listed and raises the dot by
+ itself.
+- **A popup or card built into a release:** add its component and notice to the queue (`src/lib/notices.ts`,
+ `src/components/AppNotices.tsx`), then add one entry to `BUILT_IN_ANNOUNCEMENTS` in `src/lib/announcement-history.ts`:
+ its notice id, its date, its title and body keys, its mark, whom it is for (`for`, from the same facts as its notice's
+ own rules), and either the popup it reopens (`{ modal }`, drawn by `AnnouncementsPage`'s replay) or its buttons
+ (`{ buttons }`: open a page, write an email, open Add a Cloud). Give an offer its `until` to show Ended after it. Its
+ date newer than the person's last look is what raises the dot.
+
## Turning it off
- **`OMB_DISABLE_ANNOUNCEMENTS=1`** in the server's environment stops the download and every remote card on that server's
diff --git a/docs/team-cloud.md b/docs/team-cloud.md
index b39572d816..8d622a9e3c 100644
--- a/docs/team-cloud.md
+++ b/docs/team-cloud.md
@@ -144,7 +144,8 @@ keeps people apart on it. The bot box ([bot-box.md](bot-box.md)) is what makes t
`people/<person>/welcome.json` (`GET /api/me` `welcome: { invitedBy, welcomedAt, hints }`, `PUT /api/me/welcome {
welcomed: true }`). Only the Owner, who set the team up, gets the Cloud's own welcome and its setup list (the session's
`team.role`); its record (shown, done, hidden: `TEAM_PERSONAL_HINTS`) is each person's, kept in the same file (the Owner
- also keeps what the team's record said before). An empty team starts fresh: the Owner's own MausBot and the team's first
+ also keeps what the team's record said before). So are whether they saw the Teams What's new and when they last opened
+ Announcements (`announcements-read-<ms>`, the newest kept), which every member saves with `PUT /api/me/welcome { hints }`. An empty team starts fresh: the Owner's own MausBot and the team's first
bot don't count as bots already there. The finished list ("Acme is ready") shows once: it is recorded as done as it
shows, names the first bot ("Say hi to Poppy", never a Chief of Staff) and offers Invite people, the team's People page
on MausBot Cloud.
diff --git a/docs/verification/evidence/teams-whats-new/after-menu-dot-desktop-dark.jpg b/docs/verification/evidence/teams-whats-new/after-menu-dot-desktop-dark.jpg
new file mode 100644
index 0000000000..07d328859e
Binary files /dev/null and b/docs/verification/evidence/teams-whats-new/after-menu-dot-desktop-dark.jpg differ
diff --git a/docs/verification/evidence/teams-whats-new/after-menu-dot-desktop-light.jpg b/docs/verification/evidence/teams-whats-new/after-menu-dot-desktop-light.jpg
new file mode 100644
index 0000000000..d45a08ed28
Binary files /dev/null and b/docs/verification/evidence/teams-whats-new/after-menu-dot-desktop-light.jpg differ
diff --git a/docs/verification/evidence/teams-whats-new/after-modal-desktop-dark.jpg b/docs/verification/evidence/teams-whats-new/after-modal-desktop-dark.jpg
new file mode 100644
index 0000000000..b2a7304e3f
Binary files /dev/null and b/docs/verification/evidence/teams-whats-new/after-modal-desktop-dark.jpg differ
diff --git a/docs/verification/evidence/teams-whats-new/after-modal-desktop-light.jpg b/docs/verification/evidence/teams-whats-new/after-modal-desktop-light.jpg
new file mode 100644
index 0000000000..5889ceb364
Binary files /dev/null and b/docs/verification/evidence/teams-whats-new/after-modal-desktop-light.jpg differ
diff --git a/docs/verification/evidence/teams-whats-new/after-modal-phone-dark.jpg b/docs/verification/evidence/teams-whats-new/after-modal-phone-dark.jpg
new file mode 100644
index 0000000000..5a5f955ab9
Binary files /dev/null and b/docs/verification/evidence/teams-whats-new/after-modal-phone-dark.jpg differ
diff --git a/docs/verification/evidence/teams-whats-new/after-modal-phone-light.jpg b/docs/verification/evidence/teams-whats-new/after-modal-phone-light.jpg
new file mode 100644
index 0000000000..5461caf8d9
Binary files /dev/null and b/docs/verification/evidence/teams-whats-new/after-modal-phone-light.jpg differ
diff --git a/docs/verification/evidence/teams-whats-new/after-page-desktop-dark.jpg b/docs/verification/evidence/teams-whats-new/after-page-desktop-dark.jpg
new file mode 100644
index 0000000000..8214df4a63
Binary files /dev/null and b/docs/verification/evidence/teams-whats-new/after-page-desktop-dark.jpg differ
diff --git a/docs/verification/evidence/teams-whats-new/after-page-desktop-light.jpg b/docs/verification/evidence/teams-whats-new/after-page-desktop-light.jpg
new file mode 100644
index 0000000000..dfc3ffcf4f
Binary files /dev/null and b/docs/verification/evidence/teams-whats-new/after-page-desktop-light.jpg differ
diff --git a/docs/verification/evidence/teams-whats-new/after-page-phone-dark.jpg b/docs/verification/evidence/teams-whats-new/after-page-phone-dark.jpg
new file mode 100644
index 0000000000..2d551276cc
Binary files /dev/null and b/docs/verification/evidence/teams-whats-new/after-page-phone-dark.jpg differ
diff --git a/docs/verification/evidence/teams-whats-new/after-page-phone-light.jpg b/docs/verification/evidence/teams-whats-new/after-page-phone-light.jpg
new file mode 100644
index 0000000000..d6bdaa2698
Binary files /dev/null and b/docs/verification/evidence/teams-whats-new/after-page-phone-light.jpg differ
diff --git a/docs/verification/evidence/teams-whats-new/after-page-reopened-desktop-light.jpg b/docs/verification/evidence/teams-whats-new/after-page-reopened-desktop-light.jpg
new file mode 100644
index 0000000000..a7acb1ccca
Binary files /dev/null and b/docs/verification/evidence/teams-whats-new/after-page-reopened-desktop-light.jpg differ
diff --git a/docs/verification/evidence/teams-whats-new/before-desktop-dark.jpg b/docs/verification/evidence/teams-whats-new/before-desktop-dark.jpg
new file mode 100644
index 0000000000..99e192d070
Binary files /dev/null and b/docs/verification/evidence/teams-whats-new/before-desktop-dark.jpg differ
diff --git a/docs/verification/evidence/teams-whats-new/before-desktop-light.jpg b/docs/verification/evidence/teams-whats-new/before-desktop-light.jpg
new file mode 100644
index 0000000000..5fa10a5484
Binary files /dev/null and b/docs/verification/evidence/teams-whats-new/before-desktop-light.jpg differ
diff --git a/docs/verification/evidence/teams-whats-new/before-menu-desktop-dark.jpg b/docs/verification/evidence/teams-whats-new/before-menu-desktop-dark.jpg
new file mode 100644
index 0000000000..da1d16ed0a
Binary files /dev/null and b/docs/verification/evidence/teams-whats-new/before-menu-desktop-dark.jpg differ
diff --git a/docs/verification/evidence/teams-whats-new/before-menu-desktop-light.jpg b/docs/verification/evidence/teams-whats-new/before-menu-desktop-light.jpg
new file mode 100644
index 0000000000..85e386b803
Binary files /dev/null and b/docs/verification/evidence/teams-whats-new/before-menu-desktop-light.jpg differ
diff --git a/docs/verification/evidence/teams-whats-new/before-phone-dark.jpg b/docs/verification/evidence/teams-whats-new/before-phone-dark.jpg
new file mode 100644
index 0000000000..463cfe69fa
Binary files /dev/null and b/docs/verification/evidence/teams-whats-new/before-phone-dark.jpg differ
diff --git a/docs/verification/evidence/teams-whats-new/before-phone-light.jpg b/docs/verification/evidence/teams-whats-new/before-phone-light.jpg
new file mode 100644
index 0000000000..5515b2bded
Binary files /dev/null and b/docs/verification/evidence/teams-whats-new/before-phone-light.jpg differ
diff --git a/electron/desktop-prefs.d.mts b/electron/desktop-prefs.d.mts
index 7ed68a617e..c8013b7d94 100644
--- a/electron/desktop-prefs.d.mts
+++ b/electron/desktop-prefs.d.mts
@@ -32,8 +32,8 @@ export interface DesktopLanguageBridge {
}
export interface DesktopPrefs {
seen(): string[];
- /** One of DESKTOP_NOTICES, or an announcement card's mark (`announcement:<id>`, `announcement-sponsor:<day>`); anything
- * else is not kept. */
+ /** One of DESKTOP_NOTICES, an announcement card's mark (`announcement:<id>`, `announcement-sponsor:<day>`), or when
+ * Announcements was last opened (`announcements-read-<ms>`, the newest kept); anything else is not kept. */
markSeen(id: string): void;
analytics(): boolean | null;
setAnalytics(enabled: boolean): void;
diff --git a/electron/desktop-prefs.mjs b/electron/desktop-prefs.mjs
index 86446a6ab7..ed1e07901f 100644
--- a/electron/desktop-prefs.mjs
+++ b/electron/desktop-prefs.mjs
@@ -12,17 +12,21 @@ import { accountFullName } from "./system-name.mjs";
export { DESKTOP_PORTS } from "./desktop-ports.mjs";
/** The only notices a page may record, so no page can write anything else into the file. */
-export const DESKTOP_NOTICES = Object.freeze(["whats-new-2026-11", "boat-credit-2026-11", "grok-move-2026-11", "modelgo-offer-2026-11"]);
+export const DESKTOP_NOTICES = Object.freeze(["whats-new-2026-11", "boat-credit-2026-11", "grok-move-2026-11", "modelgo-offer-2026-11", "teams-2026-11"]);
const WHATS_NEW = DESKTOP_NOTICES[0];
/** A card from the project's announcements file someone closed (src/lib/announcements.ts), and the last day a sponsor's
* card was shown: kept beside the fixed notices, the newest few only. */
const ANNOUNCEMENT_SEEN = /^announcement:[a-z0-9][a-z0-9-]{2,39}$/;
const ANNOUNCEMENT_SPONSOR_DAY = /^announcement-sponsor:\d{4}-\d{2}-\d{2}$/;
+/** When the person last opened Announcements (shared/cloud-hints.ts ANNOUNCEMENTS_READ_HINT): the newest one only. */
+const ANNOUNCEMENTS_READ = /^announcements-read-(\d{1,16})$/;
const MAX_ANNOUNCEMENTS_SEEN = 40;
+const readAt = id => Number(ANNOUNCEMENTS_READ.exec(id)[1]);
const keptAnnouncements = list => {
const marks = list.filter(id => typeof id === "string" && ANNOUNCEMENT_SEEN.test(id));
const days = list.filter(id => typeof id === "string" && ANNOUNCEMENT_SPONSOR_DAY.test(id)).sort();
- return [...new Set(marks)].slice(-MAX_ANNOUNCEMENTS_SEEN).concat(days.slice(-1));
+ const read = list.filter(id => typeof id === "string" && ANNOUNCEMENTS_READ.test(id)).sort((a, b) => readAt(a) - readAt(b));
+ return [...new Set(marks)].slice(-MAX_ANNOUNCEMENTS_SEEN).concat(days.slice(-1), read.slice(-1));
};
/** A locale code such as "de" or "pt-br", or "" for following the system. */
const LANGUAGE = /^(?:[a-z]{2,3}(?:-[a-z0-9]{2,8}){0,2})?$/i;
@@ -98,7 +102,7 @@ export function createDesktopPrefs({ read, write }) {
const saved = current();
if (saved.seen.includes(id)) return;
if (DESKTOP_NOTICES.includes(id)) save({ ...saved, seen: [...saved.seen, id] });
- else if (typeof id === "string" && (ANNOUNCEMENT_SEEN.test(id) || ANNOUNCEMENT_SPONSOR_DAY.test(id))) {
+ else if (typeof id === "string" && (ANNOUNCEMENT_SEEN.test(id) || ANNOUNCEMENT_SPONSOR_DAY.test(id) || ANNOUNCEMENTS_READ.test(id))) {
const fixed = saved.seen.filter(seen => DESKTOP_NOTICES.includes(seen));
save({ ...saved, seen: [...fixed, ...keptAnnouncements([...saved.seen, id])] });
}
diff --git a/electron/desktop-prefs.node-test.mjs b/electron/desktop-prefs.node-test.mjs
index 826fbe8d6d..29337f1002 100644
--- a/electron/desktop-prefs.node-test.mjs
+++ b/electron/desktop-prefs.node-test.mjs
@@ -26,7 +26,7 @@ test("a page on an older release keeps working with the longer list: its own ids
});
test("What's new, Boat's credit offer and the Grok Bot move are the notices a page can record; seen and analytics survive a restart; a broken record never stops the app", () => {
- assert.deepEqual([...DESKTOP_NOTICES], [POPUP, BOAT, GROK, MODELGO]);
+ assert.deepEqual([...DESKTOP_NOTICES], [POPUP, BOAT, GROK, MODELGO, "teams-2026-11"]);
let saved = null;
const writes = [];
const prefs = createDesktopPrefs({ read: () => saved, write: value => { writes.push(value); saved = structuredClone(value); } });
@@ -70,6 +70,18 @@ test("an announcement card's mark and the last sponsor day are kept beside the f
assert.deepEqual(restarted.seen(), prefs.seen(), "survives a restart");
});
+test("the Teams What's new is one the desktop keeps, and of when Announcements was last opened only the newest", () => {
+ let saved = { seen: [POPUP] };
+ const prefs = createDesktopPrefs({ read: () => saved, write: value => { saved = structuredClone(value); } });
+ prefs.markSeen("teams-2026-11");
+ prefs.markSeen("announcements-read-1763380800000"); prefs.markSeen("announcements-read-1763467200000"); prefs.markSeen("announcements-read-1763300000000");
+ assert.deepEqual(prefs.seen(), [POPUP, "teams-2026-11", "announcements-read-1763467200000"]);
+ for (const id of ["announcements-read-", "announcements-read-x", `announcements-read-${"9".repeat(17)}`, "announcements-read-1:2"]) prefs.markSeen(id);
+ assert.deepEqual(prefs.seen(), [POPUP, "teams-2026-11", "announcements-read-1763467200000"], "nothing else of that shape");
+ prefs.markSeen("announcement:phone-app");
+ assert.deepEqual(createDesktopPrefs({ read: () => saved, write: () => {} }).seen(), [POPUP, "teams-2026-11", "announcement:phone-app", "announcements-read-1763467200000"], "survives a restart");
+});
+
test("a write that fails leaves the last whole record on disk, analytics opt-out included", () => {
const dir = mkdtempSync(path.join(tmpdir(), "desktop-prefs-"));
try {
diff --git a/packages/phone-protocol/src/cloud-hints.ts b/packages/phone-protocol/src/cloud-hints.ts
index d0733e6a3f..cce827cbd3 100644
--- a/packages/phone-protocol/src/cloud-hints.ts
+++ b/packages/phone-protocol/src/cloud-hints.ts
@@ -6,13 +6,38 @@ export const CLOUD_WELCOME_DONE = "cloud-welcome-done";
export const TEAM_LEFT_REFUSAL = "unauthorized: you are no longer in this team";
/** On a Team Cloud, the welcome's own record (shown, done, hidden) is each person's: one admin finishing it ends it for
- * nobody else. Its steps (an AI connected, files) stay the team's, since they are facts about the team's Cloud. */
-export const TEAM_PERSONAL_HINTS: ReadonlySet<string> = new Set(["cloud-welcome-shown", CLOUD_WELCOME_DONE, "cloud-setup-hidden"]);
+ * nobody else. Its steps (an AI connected, files) stay the team's, since they are facts about the team's Cloud. So is
+ * whether they saw the Teams What's new (src/lib/notices.ts TEAMS_NOTICE). */
+export const TEAM_PERSONAL_HINTS: ReadonlySet<string> = new Set(["cloud-welcome-shown", CLOUD_WELCOME_DONE, "cloud-setup-hidden", "teams-2026-11"]);
+
+/** When the person last opened Announcements, in epoch milliseconds: `announcements-read-<ms>`. A record keeps one, the
+ * newest; on a Team Cloud it is each person's. */
+export const ANNOUNCEMENTS_READ_HINT = /^announcements-read-(\d{1,16})$/;
+
+export function teamPersonalHint(hint: string): boolean {
+ return TEAM_PERSONAL_HINTS.has(hint) || ANNOUNCEMENTS_READ_HINT.test(hint);
+}
+
+/** The newest `announcements-read-<ms>` among `hints`, or null. */
+export function announcementsReadAt(hints: readonly string[]): number | null {
+ let newest: number | null = null;
+ for (const hint of hints) {
+ const at = Number(ANNOUNCEMENTS_READ_HINT.exec(hint)?.[1] ?? NaN);
+ if (Number.isSafeInteger(at) && (newest === null || at > newest)) newest = at;
+ }
+ return newest;
+}
+
+/** `hints` keeping only the newest read mark among them. */
+export function newestReadMarkOnly(hints: readonly string[]): string[] {
+ const newest = announcementsReadAt(hints);
+ return hints.filter((hint) => !ANNOUNCEMENTS_READ_HINT.test(hint) || hint === `announcements-read-${newest}`);
+}
/**
* The onboarding record one person on a team reads: the team's, without the welcome's own hints, plus theirs. The Owner
* also keeps what the team's record already said, which was theirs before the record was per person.
*/
export function personalHints(teamHints: readonly string[], own: readonly string[], owner: boolean): string[] {
- return [...new Set([...teamHints.filter((hint) => owner || !TEAM_PERSONAL_HINTS.has(hint)), ...own.filter((hint) => TEAM_PERSONAL_HINTS.has(hint))])];
+ return newestReadMarkOnly([...new Set([...teamHints.filter((hint) => owner || !teamPersonalHint(hint)), ...own.filter(teamPersonalHint)])]);
}
diff --git a/scripts/bench-desktop.ts b/scripts/bench-desktop.ts
index 011bab2336..13db407bbd 100644
--- a/scripts/bench-desktop.ts
+++ b/scripts/bench-desktop.ts
@@ -49,7 +49,7 @@ const { values } = parseArgs({
const only = new Set((values.only ?? PHASES.join(",")).split(",").map((phase) => phase.trim()).filter(Boolean));
for (const phase of only) if (!(PHASES as readonly string[]).includes(phase)) throw new Error(`unknown phase ${phase}; phases: ${PHASES.join(", ")}`);
const IDLE_MS = Number(values["idle-seconds"]) * 1000;
-const STORAGE = { "omb-analytics-opt-out": "1", "omb-email-gate": "skipped", "omb-simple-mode-prompt": "1", "grok-move-2026-11": "1", "modelgo-offer-2026-11": "1", "omb-advanced-mode": values.advanced ? "1" : "0" };
+const STORAGE = { "omb-analytics-opt-out": "1", "omb-email-gate": "skipped", "omb-simple-mode-prompt": "1", "grok-move-2026-11": "1", "teams-2026-11": "1", "modelgo-offer-2026-11": "1", "omb-advanced-mode": values.advanced ? "1" : "0" };
const log = (line: string) => process.stderr.write(`bench-desktop: ${line}\n`);
const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
const round = (value: number, digits = 1) => Math.round(value * 10 ** digits) / 10 ** digits;
diff --git a/scripts/testing/lend-automatically-preview.tsx b/scripts/testing/lend-automatically-preview.tsx
index 070ec1ae82..96cb9737ea 100644
--- a/scripts/testing/lend-automatically-preview.tsx
+++ b/scripts/testing/lend-automatically-preview.tsx
@@ -4,7 +4,7 @@ import { setAnalyticsEnabled, setEmailGateDone } from "../../src/lib/analytics";
import { CLOUD_SETUP_HIDDEN, CLOUD_WELCOME_DONE } from "../../src/lib/cloud-setup";
import { withTourFinished } from "../../src/lib/guided-tour";
import { setAdvancedMode } from "../../src/lib/interface-mode";
-import { GROK_MOVE_NOTICE, MODELGO_OFFER_NOTICE } from "../../src/lib/notices";
+import { GROK_MOVE_NOTICE, MODELGO_OFFER_NOTICE, TEAMS_NOTICE } from "../../src/lib/notices";
import { markSimpleModePromptSeen } from "../../src/lib/simple-mode-prompt";
import { applySkin, type SkinId } from "../../src/lib/skins";
import "../../src/styles.css";
@@ -19,6 +19,7 @@ setAnalyticsEnabled(false);
setEmailGateDone("skipped");
markSimpleModePromptSeen();
localStorage.setItem(GROK_MOVE_NOTICE, "1");
+localStorage.setItem(TEAMS_NOTICE, "1");
localStorage.setItem(MODELGO_OFFER_NOTICE, "1");
setAdvancedMode(true);
applySkin((params.get("skin") ?? "midnight") as SkinId);
diff --git a/scripts/testing/rail-preview.tsx b/scripts/testing/rail-preview.tsx
index 6b407a91cc..e07ab50926 100644
--- a/scripts/testing/rail-preview.tsx
+++ b/scripts/testing/rail-preview.tsx
@@ -8,7 +8,7 @@ import { setAnalyticsEnabled, setEmailGateDone } from "../../src/lib/analytics";
import { setAdvancedMode } from "../../src/lib/interface-mode";
import { NOTICES } from "../../src/lib/notices";
import { setSidebarDensity, SIDEBAR_WIDTH_KEY, SIMPLE_SIDEBAR_WIDTH_KEY } from "../../src/lib/sidebar-preferences";
-import { GROK_MOVE_NOTICE } from "../../src/lib/notices";
+import { GROK_MOVE_NOTICE, TEAMS_NOTICE } from "../../src/lib/notices";
import { markSimpleModePromptSeen } from "../../src/lib/simple-mode-prompt";
import { applySkin, type SkinId } from "../../src/lib/skins";
import "../../src/styles.css";
@@ -37,6 +37,7 @@ setAnalyticsEnabled(false);
setEmailGateDone("skipped");
markSimpleModePromptSeen();
localStorage.setItem(GROK_MOVE_NOTICE, "1");
+localStorage.setItem(TEAMS_NOTICE, "1");
try {
for (const notice of NOTICES) localStorage.setItem(notice, "1");
for (const width of [SIDEBAR_WIDTH_KEY, SIMPLE_SIDEBAR_WIDTH_KEY]) localStorage.removeItem(width);
diff --git a/scripts/testing/sidebar-groups-preview.tsx b/scripts/testing/sidebar-groups-preview.tsx
index a6fe139473..0e1c29fe86 100644
--- a/scripts/testing/sidebar-groups-preview.tsx
+++ b/scripts/testing/sidebar-groups-preview.tsx
@@ -2,7 +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 { GROK_MOVE_NOTICE, MODELGO_OFFER_NOTICE } from "../../src/lib/notices";
+import { GROK_MOVE_NOTICE, MODELGO_OFFER_NOTICE, TEAMS_NOTICE } from "../../src/lib/notices";
import { markSimpleModePromptSeen } from "../../src/lib/simple-mode-prompt";
import { applySkin, type SkinId } from "../../src/lib/skins";
import "../../src/styles.css";
@@ -14,6 +14,7 @@ setAnalyticsEnabled(false);
setEmailGateDone("skipped");
markSimpleModePromptSeen();
localStorage.setItem(GROK_MOVE_NOTICE, "1");
+localStorage.setItem(TEAMS_NOTICE, "1");
localStorage.setItem(MODELGO_OFFER_NOTICE, "1");
setAdvancedMode(params.get("mode") !== "simple");
applySkin((params.get("skin") ?? "daylight") as SkinId);
diff --git a/scripts/testing/team-access-preview.tsx b/scripts/testing/team-access-preview.tsx
index d0a4a64e95..0d2f5fdc22 100644
--- a/scripts/testing/team-access-preview.tsx
+++ b/scripts/testing/team-access-preview.tsx
@@ -4,7 +4,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 { GROK_MOVE_NOTICE, MODELGO_OFFER_NOTICE } from "../../src/lib/notices";
+import { GROK_MOVE_NOTICE, MODELGO_OFFER_NOTICE, TEAMS_NOTICE } from "../../src/lib/notices";
import { markSimpleModePromptSeen } from "../../src/lib/simple-mode-prompt";
import { applySkinChoice, SKIN_IDS, type SkinId } from "../../src/lib/skins";
import "../../src/styles.css";
@@ -15,6 +15,7 @@ setAnalyticsEnabled(false);
setEmailGateDone("skipped");
markSimpleModePromptSeen();
localStorage.setItem(GROK_MOVE_NOTICE, "1");
+localStorage.setItem(TEAMS_NOTICE, "1");
localStorage.setItem(MODELGO_OFFER_NOTICE, "1");
setAdvancedMode(params.get("mode") === "advanced");
applySkinChoice(SKIN_IDS.includes(skin as SkinId) ? (skin as SkinId) : "daylight");
diff --git a/scripts/testing/threads-preview.tsx b/scripts/testing/threads-preview.tsx
index 8acc631aed..af78002504 100644
--- a/scripts/testing/threads-preview.tsx
+++ b/scripts/testing/threads-preview.tsx
@@ -3,7 +3,7 @@ import App from "../../src/App";
import { setAnalyticsEnabled, setEmailGateDone } from "../../src/lib/analytics";
import { ADVANCED_MODE_KEY, setAdvancedMode } from "../../src/lib/interface-mode";
import { languageChoice, setLanguageChoice } from "../../src/lib/language-preference";
-import { BOAT_OFFER_NOTICE, GROK_MOVE_NOTICE, MODELGO_OFFER_NOTICE } from "../../src/lib/notices";
+import { BOAT_OFFER_NOTICE, GROK_MOVE_NOTICE, MODELGO_OFFER_NOTICE, TEAMS_NOTICE } from "../../src/lib/notices";
import { markSimpleModePromptSeen } from "../../src/lib/simple-mode-prompt";
import { applySkinChoice, readSkinChoice } from "../../src/lib/skins";
import "../../src/styles.css";
@@ -25,6 +25,8 @@ if (!new URLSearchParams(location.search).has("onboarding")) setEmailGateDone("s
if (!new URLSearchParams(location.search).has("simpleModePrompt")) markSimpleModePromptSeen();
// The same for the once-per-person Move from Grok Bot popup, with ?grokMovePopup=1.
if (!new URLSearchParams(location.search).has("grokMovePopup")) localStorage.setItem(GROK_MOVE_NOTICE, "1");
+// And for the once-per-person Teams What's new, with ?teamsPopup=1.
+if (!new URLSearchParams(location.search).has("teamsPopup")) localStorage.setItem(TEAMS_NOTICE, "1");
// And for the once-per-person ModelGo sponsor card, with ?modelgoOffer=1: it sits over the sidebar's foot, where tests click.
if (!new URLSearchParams(location.search).has("modelgoOffer")) localStorage.setItem(MODELGO_OFFER_NOTICE, "1");
if (!new URLSearchParams(location.search).has("boatOffer")) localStorage.setItem(BOAT_OFFER_NOTICE, "1");
diff --git a/scripts/testing/web-app-ui.e2e.test.ts b/scripts/testing/web-app-ui.e2e.test.ts
index dbebe8037c..63da275ddd 100644
--- a/scripts/testing/web-app-ui.e2e.test.ts
+++ b/scripts/testing/web-app-ui.e2e.test.ts
@@ -80,7 +80,7 @@ async function connect(url: string) {
return value.result.value;
};
await request("Page.enable");
- await request("Page.addScriptToEvaluateOnNewDocument", { source: "localStorage.setItem('omb-analytics-opt-out','1');localStorage.setItem('omb-email-gate','skipped');localStorage.setItem('grok-move-2026-11','1');localStorage.setItem('modelgo-offer-2026-11','1');" });
+ await request("Page.addScriptToEvaluateOnNewDocument", { source: "localStorage.setItem('omb-analytics-opt-out','1');localStorage.setItem('omb-email-gate','skipped');localStorage.setItem('grok-move-2026-11','1');localStorage.setItem('teams-2026-11','1');localStorage.setItem('modelgo-offer-2026-11','1');" });
await request("Runtime.enable");
await request("Emulation.setTouchEmulationEnabled", { enabled: true, maxTouchPoints: 1 });
await request("Emulation.setDeviceMetricsOverride", { width: 390, height: 844, deviceScaleFactor: 1, mobile: true });
diff --git a/server/routes/announcements.ts b/server/routes/announcements.ts
index f85e45447d..31acd59bf1 100644
--- a/server/routes/announcements.ts
+++ b/server/routes/announcements.ts
@@ -3,12 +3,14 @@ import { PASS, type RouteHandler } from "./table.ts";
export const ANNOUNCEMENTS_PATH = "/api/announcements";
-/** GET /api/announcements: the project's announcement cards whose time has not passed, for every signed-in page alike
- * (request-auth.ts lets a Team Cloud's members read it). Each page decides for itself which card, if any, it shows.
- * Asking refreshes this server's copy when it is an hour old; it never fails for want of the network. */
+/** GET /api/announcements: the project's announcement cards whose time has not passed, and when their file last changed
+ * (`updatedAt`, the date Announcements gives a card without `starts`), for every signed-in page alike (request-auth.ts lets
+ * a Team Cloud's members read it). Each page decides for itself which card, if any, it shows. Asking refreshes this
+ * server's copy when it is an hour old; it never fails for want of the network. */
export const announcementRoutes: RouteHandler = async ({ res, path, method, json }) => {
if (path !== ANNOUNCEMENTS_PATH) return PASS;
if (method !== "GET") return json(res, 405, { error: "Use GET." });
const store = announcementStore();
- return json(res, 200, { cards: await store.cardsForPage(), ...(store.disabled ? { disabled: true } : {}) });
+ const cards = await store.cardsForPage();
+ return json(res, 200, store.disabled ? { cards, disabled: true } : { cards, updatedAt: store.current().updatedAt });
};
diff --git a/server/routes/config.ts b/server/routes/config.ts
index 57e2a906db..d0d6f775cc 100644
--- a/server/routes/config.ts
+++ b/server/routes/config.ts
@@ -28,7 +28,7 @@ import {
import type { InstanceConfigMap, ModelSelection } from "../contracts.ts";
import type { RequestAuth } from "../request-auth.ts";
import { parseConfigPatchForPerson } from "../decider/config-errors.ts";
-import { TEAM_PERSONAL_HINTS } from "../../shared/cloud-hints.ts";
+import { teamPersonalHint } from "../../shared/cloud-hints.ts";
import { DECIDER_KEY_ERROR, deciderIncludedHere, deciderPatchKey, deciderSavePatch, deciderBorrowedKey, type Decider } from "../decider/index.ts";
import type { ProviderRegistry } from "../harness/registry.ts";
import { HOSTED_PROVIDER_SETTINGS_ERROR } from "../hosted-models.ts";
@@ -147,11 +147,11 @@ export function createConfigRoutes(deps: ConfigRouteDeps): RouteHandler {
}
}
if (patch.onboarding?.hintsSeen && ownHints) {
- const mine = patch.onboarding.hintsSeen.filter((hint) => TEAM_PERSONAL_HINTS.has(hint));
+ const mine = patch.onboarding.hintsSeen.filter(teamPersonalHint);
if (mine.length && ownHints(auth, mine)) {
// The team's record keeps what it had of these; only this person's changes.
- const kept = (cfg.onboarding?.hintsSeen ?? []).filter((hint) => TEAM_PERSONAL_HINTS.has(hint));
- patch.onboarding = { ...patch.onboarding, hintsSeen: [...new Set([...patch.onboarding.hintsSeen.filter((hint) => !TEAM_PERSONAL_HINTS.has(hint)), ...kept])] };
+ const kept = (cfg.onboarding?.hintsSeen ?? []).filter(teamPersonalHint);
+ patch.onboarding = { ...patch.onboarding, hintsSeen: [...new Set([...patch.onboarding.hintsSeen.filter((hint) => !teamPersonalHint(hint)), ...kept])] };
}
}
if (CLOUD_HOME && (patch.signIn?.admins?.length || patch.signIn?.members?.length)) {
diff --git a/server/team-welcome.e2e.test.ts b/server/team-welcome.e2e.test.ts
index 8e57990c54..69ef207b81 100644
--- a/server/team-welcome.e2e.test.ts
+++ b/server/team-welcome.e2e.test.ts
@@ -96,3 +96,19 @@ it("a User's copy of a team bot carries what the welcome's one line reads, and a
const expired = await team.as("omb_sess_" + "x".repeat(43), "GET", "/api/auth/session");
expect(expired.body.error).not.toBe(TEAM_LEFT_REFUSAL);
});
+
+it("the Teams What's new and the last look at Announcements are each person's own, a member's included", async () => {
+ const cleo = (await team.pair(CLEO)).token!, bob = (await team.pair(BOB)).token!;
+ const hints = async (token: string) => ((await team.as(token, "GET", "/api/config")).body.onboarding as { hintsSeen: string[] }).hintsSeen;
+ expect((await team.as(cleo, "PUT", "/api/config", { onboarding: { hintsSeen: ["teams-2026-11"] } })).status, "a member cannot change the team's record").toBe(403);
+ expect((await team.as(cleo, "PUT", "/api/me/welcome", { hints: ["teams-2026-11", "announcements-read-1763380800000"] })).status).toBe(200);
+ expect((await team.as(cleo, "PUT", "/api/me/welcome", { hints: ["announcements-read-1763467200000"] })).status).toBe(200);
+ const cleos = await hints(cleo);
+ expect(cleos).toEqual(expect.arrayContaining(["teams-2026-11", "announcements-read-1763467200000"]));
+ expect(cleos.filter((hint) => hint.startsWith("announcements-read-")), "the newest only").toEqual(["announcements-read-1763467200000"]);
+ expect(await hints(bob), "nobody else's").not.toEqual(expect.arrayContaining(["teams-2026-11"]));
+ const saved = await team.as(bob, "PUT", "/api/config", { onboarding: { hintsSeen: [...await hints(bob), "teams-2026-11", "announcements-read-1763380800000"] } });
+ expect(saved.status, JSON.stringify(saved.body)).toBe(200);
+ expect(await hints(bob)).toEqual(expect.arrayContaining(["teams-2026-11", "announcements-read-1763380800000"]));
+ expect((await hints(cleo)).filter((hint) => hint.startsWith("announcements-read-")), "an admin's save stays theirs").toEqual(["announcements-read-1763467200000"]);
+});
diff --git a/server/team-welcome.test.ts b/server/team-welcome.test.ts
new file mode 100644
index 0000000000..fd64b292db
--- /dev/null
+++ b/server/team-welcome.test.ts
@@ -0,0 +1,22 @@
+import { mkdtempSync } from "node:fs";
+import { tmpdir } from "node:os";
+import { join } from "node:path";
+import { afterEach, expect, it } from "vitest";
+import { createTeamWelcomeStore } from "./team-welcome.ts";
+import { removeTempDir } from "./testing/cleanup.ts";
+
+const PERSON = `p_${"a".repeat(22)}`;
+let dir: string | null = null;
+afterEach(async () => { if (dir) await removeTempDir(dir); dir = null; });
+
+it("keeps one Announcements read mark per person, the newest, beside their other hints", () => {
+ dir = mkdtempSync(join(tmpdir(), "team-welcome-"));
+ const store = createTeamWelcomeStore(dir);
+ store.save(PERSON, { hints: ["cloud-welcome-done", "teams-2026-11", "announcements-read-1763380800000"] });
+ store.save(PERSON, { hints: ["announcements-read-1763467200000"] });
+ expect(store.read(PERSON).hints).toEqual(["cloud-welcome-done", "teams-2026-11", "announcements-read-1763467200000"]);
+ store.save(PERSON, { hints: ["announcements-read-1763300000000"] });
+ expect(store.read(PERSON).hints, "an older one changes nothing").toEqual(["cloud-welcome-done", "teams-2026-11", "announcements-read-1763467200000"]);
+ for (let index = 0; index < 80; index++) store.save(PERSON, { hints: [`announcements-read-${1763467200001 + index}`] });
+ expect(store.read(PERSON).hints, "never fills the record").toEqual(["cloud-welcome-done", "teams-2026-11", "announcements-read-1763467200080"]);
+});
diff --git a/server/team-welcome.ts b/server/team-welcome.ts
index 56bb76d442..90f4ffc886 100644
--- a/server/team-welcome.ts
+++ b/server/team-welcome.ts
@@ -7,6 +7,7 @@ import { join } from "node:path";
import { z } from "zod";
import { writeFileAtomic } from "./atomic.ts";
import { teamMemberEmail } from "./cloud-team.ts";
+import { newestReadMarkOnly } from "../shared/cloud-hints.ts";
const PERSON = /^p_[\w-]{22}$/;
/** A welcome step's id, as the app's onboarding hints are written. */
@@ -63,7 +64,7 @@ export function createTeamWelcomeStore(dataDir: string): TeamWelcomeStore {
},
save(person, change, now = Date.now()) {
const kept = load(person);
- const hints = [...new Set([...(kept.hints ?? []), ...(change.hints ?? []).filter((hint) => WELCOME_HINT.test(hint))])].slice(0, MAX_HINTS);
+ const hints = newestReadMarkOnly([...new Set([...(kept.hints ?? []), ...(change.hints ?? []).filter((hint) => WELCOME_HINT.test(hint))])]).slice(0, MAX_HINTS);
const next = { ...kept, ...(change.welcomed && !kept.welcomedAt ? { welcomedAt: now } : {}), ...(hints.length ? { hints } : {}) };
if (JSON.stringify(next) !== JSON.stringify(kept)) write(person, next);
return view(next);
diff --git a/src/App.tsx b/src/App.tsx
index c32135d75a..c040d00e52 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -23,7 +23,7 @@ import { ForkPanel } from "@/components/ForkPanel";
import { SIDEBAR_AND_PANEL_FIT, SIDEBAR_INLINE, TWO_SIDE_PANELS_FIT, useMediaQuery } from "@/lib/use-media-query";
import { preloadConnectedApps } from "@/lib/connected-apps";
import {
- ActivityPanel, BotSettingsDialog, CloudAddDialog, ComputerPanel, FilesView, InspectorPanel, KeyboardShortcutsModal, LocalVmWorkspace,
+ ActivityPanel, AnnouncementsPage, BotSettingsDialog, CloudAddDialog, ComputerPanel, FilesView, InspectorPanel, KeyboardShortcutsModal, LocalVmWorkspace,
PluginsPanel, preloadScreens, PublishedAppsPage, RemoteAgentSettingsPanel, RemoteDesktopPanel, RoomPanel, SettingsModal, TeamFilesPage, TeamMapPage, TriggersPage,
} from "@/components/lazy-screens";
import { useAdvancedMode } from "@/lib/interface-mode";
@@ -383,6 +383,8 @@ function Shell({ viewer }: { viewer: WelcomeViewer | null }) {
<WebPanelPage />
) : state.activeView === "published-apps" ? (
<PublishedAppsPage />
+ ) : state.activeView === "announcements" ? (
+ <AnnouncementsPage />
) : state.activeView === "team-files" && state.config?.team ? (
<TeamFilesPage />
) : state.activeView === "routines" ? (
diff --git a/src/components/AnnouncementCard.tsx b/src/components/AnnouncementCard.tsx
index 3dd368000c..5d9baab033 100644
--- a/src/components/AnnouncementCard.tsx
+++ b/src/components/AnnouncementCard.tsx
@@ -12,8 +12,8 @@ import { ClaudeMark, CodexMark, CopilotMark, DeepSeekMark, GreenferenceMark, Gro
export type AnnouncementButton = "primary" | "secondary";
-const KIND_ICON: Record<AnnouncementKind, ComponentType<IconProps>> = { sponsor: Sparkles, product: Megaphone, tip: Lightbulb };
-const MARK: Record<AnnouncementMark, ComponentType<IconProps>> = {
+export const KIND_ICON: Record<AnnouncementKind, ComponentType<IconProps>> = { sponsor: Sparkles, product: Megaphone, tip: Lightbulb };
+export const MARK: Record<AnnouncementMark, ComponentType<IconProps>> = {
claude: ClaudeMark, codex: CodexMark, grok: GrokMark, kimi: KimiMark, modelgo: ModelgoMark, greenference: GreenferenceMark,
deepseek: DeepSeekMark, copilot: CopilotMark, kiro: KiroMark,
};
diff --git a/src/components/AppNotices.test.ts b/src/components/AppNotices.test.ts
index 622e948e01..6ff191f353 100644
--- a/src/components/AppNotices.test.ts
+++ b/src/components/AppNotices.test.ts
@@ -38,7 +38,7 @@ vi.mock("@/components/EngineLibrary", () => ({ engineReady: (instance: { snapsho
instance.snapshot.state === "available" && instance.snapshot.authenticated !== false }));
import { AppNotices } from "./AppNotices";
import { TwoPlacesCard } from "./TwoPlacesCard";
-import { BOAT_OFFER_NOTICE, CLOUD_INTRO, GROK_MOVE_NOTICE, launchNotice, localDay, MODELGO_OFFER_NOTICE, PRODUCT_HUNT_NOTICE, PRODUCT_HUNT_UNTIL, PRODUCT_HUNT_URL, STAR_NOTICE, WHATS_NEW_NOTICE } from "@/lib/notices";
+import { BOAT_OFFER_NOTICE, CLOUD_INTRO, GROK_MOVE_NOTICE, launchNotice, localDay, MODELGO_OFFER_NOTICE, PRODUCT_HUNT_NOTICE, PRODUCT_HUNT_UNTIL, PRODUCT_HUNT_URL, STAR_NOTICE, TEAMS_NOTICE, WHATS_NEW_NOTICE } from "@/lib/notices";
import { BOAT_OFFER, boatClaimMailto } from "@/lib/boat-offer";
import { track } from "@/lib/analytics";
import { ADVANCED_MODE_KEY, setAdvancedMode } from "@/lib/interface-mode";
@@ -46,6 +46,7 @@ import { SIMPLE_MODE_PROMPT_KEY } from "@/lib/simple-mode-prompt";
import { ADVANCED_BACK_KEY } from "@/lib/new-look";
import { api } from "@/state/store";
import { forgetAnnouncementCards, seenKey } from "@/lib/announcements";
+import { CLOUD_WELCOME_DONE } from "../../shared/cloud-hints";
const DAY = 86_400_000, NOW = new Date(2026, 9, 9, 12).getTime();
const plans = [
@@ -137,7 +138,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: [WHATS_NEW_NOTICE] }; storage.set(MODELGO_OFFER_NOTICE, "1"); storage.set(GROK_MOVE_NOTICE, "1"); storage.set(PRODUCT_HUNT_NOTICE, "1"); storage.set(SIMPLE_MODE_PROMPT_KEY, "1"); storage.set(BOAT_OFFER_NOTICE, "1"); };
+const launchCardsSeen = () => { desk.saved = { seen: [WHATS_NEW_NOTICE] }; storage.set(TEAMS_NOTICE, "1"); storage.set(MODELGO_OFFER_NOTICE, "1"); storage.set(GROK_MOVE_NOTICE, "1"); storage.set(PRODUCT_HUNT_NOTICE, "1"); storage.set(SIMPLE_MODE_PROMPT_KEY, "1"); storage.set(BOAT_OFFER_NOTICE, "1"); };
const hints = () => f.state.config.onboarding.hintsSeen as string[];
beforeEach(() => {
@@ -1809,3 +1810,131 @@ describe("Update MausBot on your phone", () => {
expect(await launch(), "a live call").toBe("");
});
});
+
+describe("the Teams What's new", () => {
+ const TITLE = "MausBot is better with your team", GROK = "Move from Grok Bot";
+ const POINTS = ["One shared bot for everyone: set it up once, everyone uses it.", "Team files and templates everyone&#x27;s bots can use.",
+ "Private chats stay private, even from admins.", "$40 a month for 2 people, $20 for each extra person."];
+ const TEAM = { id: "team-acme", name: "Acme", cloudPage: "https://admin.openmausbot.com/cloud" };
+ const steps = () => vi.mocked(track).mock.calls.filter(([event, props]) => event === "whats_new" && (props as { slide: string }).slide === "teams")
+ .map(([, props]) => (props as { action: string }).action);
+ let firstScreen: boolean;
+ const desktopMarks = () => (desk.saved as { seen?: string[] } | null)?.seen ?? [];
+ const keptForGood = async () => {
+ expect(render()).toBe("");
+ expect(storage.get(TEAMS_NOTICE)).toBe("1");
+ expect(await launch(), "a reload is the same launch").not.toContain(TITLE);
+ expect(await relaunch(), "nor any later one").not.toContain(TITLE);
+ };
+ const onTeamCloud = (role: "owner" | "admin" | "member", page: "desktop" | "browser") => {
+ if (page === "desktop") { showWindow(MY_CLOUD); (window as unknown as { open: unknown }).open = vi.fn(); }
+ else vi.stubGlobal("window", { addEventListener: vi.fn(), removeEventListener: vi.fn(), open: vi.fn() });
+ viewer = { hosted: true, canSave: role !== "member", cloudHome: true, teamRole: role };
+ f.state.config = { ...f.state.config, cloudHome: true, team: TEAM };
+ vi.mocked(api).mockImplementation(async (path, init) => {
+ if (path === "/api/me/welcome") return { welcome: { hints: JSON.parse(String((init as RequestInit).body)).hints } };
+ if (path === "/api/config" && !init) return { ...f.state.config, onboarding: { ...f.state.config.onboarding, hintsSeen: [...hints(), TEAMS_NOTICE] } };
+ throw new Error(`a member cannot write ${path}`);
+ });
+ };
+ const wrote = (path: string) => vi.mocked(api).mock.calls.filter(([called, init]) => called === path && (init as RequestInit | undefined)?.method === "PUT")
+ .map(([, init]) => JSON.parse(String((init as RequestInit).body)));
+
+ beforeEach(() => {
+ storage.delete(TEAMS_NOTICE); firstScreen = false;
+ vi.stubGlobal("document", { activeElement: null, body: null, documentElement: { dataset: {} }, getElementById: () => null, querySelector: () => null,
+ querySelectorAll: (selector: string) => firstScreen && selector.includes("[data-team-welcome]") ? [{ closest: () => null, checkVisibility: () => true }] : [] });
+ });
+
+ it("this computer with no Cloud plan: once, ahead of every other notice, its points and price, Start a team on the website's Team checkout", async () => {
+ returning(); desk.saved = null; storage.delete(GROK_MOVE_NOTICE); storage.delete(STAR_NOTICE);
+ const html = await launch();
+ for (const text of [TITLE, ...POINTS, "Start a team", "Not now"]) expect(html).toContain(text);
+ for (const part of ['role="dialog"', 'aria-modal="true"', 'aria-labelledby="teams-popup-title"', 'data-teams-popup="start"', "teams-card-in", "teams-face-in"]) expect(html).toContain(part);
+ for (const other of [GROK, "Meet the new MausBot Cloud", STAR]) expect(html).not.toContain(other);
+ expect(launchNotice(), "it takes the launch").toBe(TEAMS_NOTICE);
+ expect(launchDialogShown(), "MausBot's card waits for a later launch").toBe("notices");
+ expect(steps()).toContain("seen");
+ expect(vi.mocked(track)).toHaveBeenCalledWith("whats_new", { action: "seen", slide: "teams", audience: "no_team", campaign: TEAMS_NOTICE });
+ press("Start a team"); await flush();
+ expect(window.ogb?.openExternal).toHaveBeenCalledWith("https://cloud.openmausbot.com/pro/buy?plan=team&src=app_whats_new_teams");
+ expect(steps().at(-1)).toBe("start_team");
+ expect(hints()).toContain(TEAMS_NOTICE); expect(desktopMarks()).toContain(TEAMS_NOTICE);
+ expect(render(), "nothing else that launch").toBe("");
+ const next = await relaunch();
+ expect(next, "the others keep their order after it").toContain(GROK); expect(next).not.toContain(TITLE);
+ });
+
+ it("a Cloud plan of one's own on this desktop: Start a team opens the app's own Add a Cloud; a desktop already in a team is only told", async () => {
+ account = paid();
+ expect(await launch()).toContain(TITLE);
+ press("Start a team"); await flush();
+ expect(f.dispatch).toHaveBeenCalledWith({ type: "openCloudAdd", source: "app_whats_new_team" });
+ expect(window.ogb?.openExternal).not.toHaveBeenCalled();
+ await keptForGood();
+ storage.delete(TEAMS_NOTICE); desk = desktopMachine(); f.state.config.onboarding.hintsSeen = withTourFinished(undefined);
+ account = paid({ teams: [{ id: "t1", name: "Design Studio", role: "member", machine: null }] } as Partial<CloudAccountState>);
+ const html = await relaunch();
+ expect(html).toContain("Got it"); expect(html).not.toContain("Start a team"); expect(html).not.toContain("Not now");
+ });
+
+ it("a Team Cloud's admin in the desktop's window: Invite your team opens the team's People page; kept in their own record, not the team's", async () => {
+ onTeamCloud("admin", "desktop");
+ const html = await launch();
+ for (const text of [TITLE, "Invite your team", "Not now"]) expect(html).toContain(text);
+ expect(html).not.toContain("Start a team");
+ press("Invite your team"); await flush();
+ expect(window.open, "a Cloud's page opens links as a browser does").toHaveBeenCalledWith("https://admin.openmausbot.com/cloud/team/team-acme/people?do=invite", "_blank", "noopener,noreferrer");
+ expect(vi.mocked(track)).toHaveBeenCalledWith("whats_new", { action: "invite", slide: "teams", audience: "team_admin", campaign: TEAMS_NOTICE });
+ expect(wrote("/api/me/welcome")).toEqual([{ hints: [TEAMS_NOTICE] }]);
+ expect(wrote("/api/config"), "never the team's record").toEqual([]);
+ expect(desk.saved?.seen).toContain(TEAMS_NOTICE);
+ await keptForGood();
+ });
+
+ it("a Team Cloud's member in a browser: Got it, and nothing to sell", async () => {
+ onTeamCloud("member", "browser");
+ const html = await launch();
+ expect(html).toContain(TITLE); expect(html).toContain("Got it");
+ for (const gone of ["Invite your team", "Start a team", "Not now"]) expect(html).not.toContain(gone);
+ press("Got it"); await flush();
+ expect(steps()).toContain("seen"); expect(steps().filter(step => step !== "seen")).toEqual(["got_it"]);
+ expect(wrote("/api/me/welcome")).toEqual([{ hints: [TEAMS_NOTICE] }]);
+ await keptForGood();
+ });
+
+ it("everyone else in a browser, a personal Cloud's page included: Start a team on the website; × closes it for good", async () => {
+ vi.stubGlobal("window", { addEventListener: vi.fn(), removeEventListener: vi.fn(), open: vi.fn() });
+ viewer = { hosted: true, canSave: true, cloudHome: true };
+ f.state.config = { ...f.state.config, cloudHome: true, onboarding: { ...f.state.config.onboarding, hintsSeen: [...hints(), CLOUD_WELCOME_DONE] } };
+ const html = await launch();
+ expect(html).toContain("Start a team"); expect(html).toContain("Not now");
+ press("Close"); await flush();
+ expect(steps().at(-1)).toBe("close");
+ await keptForGood();
+ });
+
+ it("never on a branded build, nor a desktop an organization runs", async () => {
+ f.brand = "file";
+ expect(await launch()).not.toContain(TITLE);
+ f.brand = "default";
+ (window.ogb as Record<string, unknown>).organization = { state: async () => ({ status: "signed-in", organization: { name: "Acme" } }), onState: () => () => {} };
+ expect(await relaunch()).not.toContain(TITLE);
+ expect(steps()).toEqual([]);
+ });
+
+ it("never during onboarding: not with the welcome or the tour open, before a first reply, over a first run's own screens or in the launch the welcome finished; then once", async () => {
+ f.state.tourOpen = true;
+ expect(await launch(), "the tour").not.toContain(TITLE);
+ f.state.tourOpen = false; f.state.welcomeOpen = true;
+ expect(await launch(), "the welcome").not.toContain(TITLE);
+ f.state.welcomeOpen = false; f.state.bots = [{ tasks: [{ threadId: "first" }] }];
+ expect(await launch(), "before a first reply").not.toContain(TITLE);
+ f.state.bots = structuredClone(FIRST_REPLY); firstScreen = true;
+ expect(await launch(), "a team's welcome to a new member").not.toContain(TITLE);
+ firstScreen = false; markWelcomeFinished();
+ expect(await launch(), "the launch the welcome finished in").not.toContain(TITLE);
+ expect(steps()).toEqual([]);
+ expect(await relaunch(), "the next launch").toContain(TITLE);
+ });
+});
diff --git a/src/components/AppNotices.tsx b/src/components/AppNotices.tsx
index 592d001783..1ff4b604d0 100644
--- a/src/components/AppNotices.tsx
+++ b/src/components/AppNotices.tsx
@@ -14,7 +14,9 @@ import { buyOfferAllowed, cloudNoticeKind, cloudPlanView, cloudTrialNotice, clou
import { jobRoutine, useCloudIntent } from "@/lib/cloud-intent";
import { CLOUD_INTENT_GIVEN, cloudSetupStage } from "@/lib/cloud-setup";
import { cornerPopupWaits, firstChatQuiet, firstReplyPending } from "@/lib/corner-popup";
-import { ANNOUNCEMENT_NOTICE, BOAT_OFFER_NOTICE, CLOUD_INTRO, CLOUD_NOTICE, CLOUD_TRIAL_NOTICE, dismissNotice, dismissNotices, GROK_MOVE_NOTICE, introShown, introStage, launchNotice, markLaunchNotice, MODELGO_OFFER_NOTICE, nextNotice, noticeSeen, PHONE_UPDATE_NOTICE, phoneUpdateHint, PRODUCT_HUNT_NOTICE, PRODUCT_HUNT_UNTIL, PRODUCT_HUNT_URL, SIMPLE_MODE_NOTICE, STAR_NOTICE, TWO_PLACES_NOTICE, UPDATES_CONSENT_NOTICE, usedBefore, WHATS_NEW_NOTICE } from "@/lib/notices";
+import { ANNOUNCEMENT_NOTICE, BOAT_OFFER_NOTICE, CLOUD_INTRO, CLOUD_NOTICE, CLOUD_TRIAL_NOTICE, dismissNotice, dismissNotices, GROK_MOVE_NOTICE, introShown, introStage, launchNotice, markLaunchNotice, MODELGO_OFFER_NOTICE, nextNotice, noticeSeen, PHONE_UPDATE_NOTICE, phoneUpdateHint, PRODUCT_HUNT_NOTICE, PRODUCT_HUNT_UNTIL, PRODUCT_HUNT_URL, SIMPLE_MODE_NOTICE, STAR_NOTICE, TEAMS_NOTICE, TWO_PLACES_NOTICE, UPDATES_CONSENT_NOTICE, usedBefore, WHATS_NEW_NOTICE } from "@/lib/notices";
+import { rememberNoticeSeen } from "@/lib/announcement-history";
+import { reportTeams, teamsAction } from "@/lib/teams-whats-new";
import { useTwoPlaces } from "@/lib/two-places";
import { SIMPLE_ONLY } from "@/lib/simple-only";
import { useAdvancedBackDue, useNewLookDue } from "@/lib/new-look";
@@ -45,6 +47,7 @@ import { NewLookNotice, reportNewLook } from "./NewLookNotice";
import { PhoneUpdateCard, phonesToTell, useRetiredLinkPhones } from "./PhoneUpdateNotice";
import { reportSimpleModePrompt, SimpleModePrompt } from "./SimpleModePrompt";
import { TwoPlacesCard } from "./TwoPlacesCard";
+import { TeamsPopup } from "./whats-new/TeamsPopup";
import { WhatsNewPopup } from "./whats-new/WhatsNewPopup";
function StarCard({ onDismiss }: { onDismiss: () => void }) {
@@ -226,6 +229,14 @@ export function AppNotices({ quiet = false, viewer = null, now = Date.now }: { q
sponsors: !providersRestricted(state.config?.managedPolicy) && sponsorsHere,
});
const announcement = picked && picked !== "wait" ? picked : null;
+ // Teams: everyone once, ahead of every other notice, on every page but a branded build's or an organization's desktop;
+ // as the What's new popup, never in the launch a welcome or MausBot's card took, before a first reply, over a first
+ // run's own screens or another dialog, during a live call or a move.
+ const teamsSeen = noticeSeen(record, TEAMS_NOTICE) || Boolean(desktopState?.seen.includes(TEAMS_NOTICE));
+ const teamsHere = !branded && organization !== true && !teamsSeen;
+ const teamsBlocked = useOtherDialogOpen(teamsHere, true) || Boolean(state.liveCall && state.liveCall.status !== "ended");
+ const teamsNow = !teamsHere || moving || afterWelcome === true ? false
+ : organization === null || !viewer || (desktop && !desktopState) || afterWelcome === null || mausBotFirst || moving === null || teamsBlocked ? null : true;
const announcementNow = !picked || moving || welcomeFinishedThisLaunch() || launchDialogShown() === "mausbot" ? false
: picked === "wait" || !viewer || organization === null || moving === null || firstChat === null || mausBotFirst || (state.liveCall && state.liveCall.status !== "ended") || (desktop && !desktopState) ? null : true;
const remembering = { desktop, liveIds: new Set(remoteCards.map(card => card.id)), save: (hintsSeen: string[]) => void api("/api/config", { method: "PUT", body: JSON.stringify({ onboarding: { hintsSeen } }) })
@@ -238,7 +249,8 @@ export function AppNotices({ quiet = false, viewer = null, now = Date.now }: { q
// FOLLOWERS); nothing else does.
const notice = waits ? null
: firstChatQuiet(state) ? (grokNow === true && (launch === null || launch === GROK_MOVE_NOTICE) ? GROK_MOVE_NOTICE : null)
- : cards || whatsNewHere || consentHere || simpleDue || boatHere || modelgoHere || announcementNow !== false || twoFact !== false || grokNow !== false || phoneNow !== false ? nextNotice({
+ : teamsHere || cards || whatsNewHere || consentHere || simpleDue || boatHere || modelgoHere || announcementNow !== false || twoFact !== false || grokNow !== false || phoneNow !== false ? nextNotice({
+ [TEAMS_NOTICE]: teamsNow,
[GROK_MOVE_NOTICE]: grokNow,
[PHONE_UPDATE_NOTICE]: phoneNow,
// As the What's new popup: never in the launch whose welcome just finished, nor over MausBot's first-launch card.
@@ -258,7 +270,7 @@ export function AppNotices({ quiet = false, viewer = null, now = Date.now }: { q
: organization === null || moving === null || afterWelcome === null || mausBotFirst || (desktop && !desktopState) ? null : !organization,
[ANNOUNCEMENT_NOTICE]: announcementNow,
[STAR_NOTICE]: !bridge || moving || brandStatus().source === "file" || !usedBefore(state.bots) ? false : moving === null ? null : true,
- }, id => id === CLOUD_INTRO ? stage === "done" && !introOpen
+ }, id => id === TEAMS_NOTICE ? teamsSeen : id === CLOUD_INTRO ? stage === "done" && !introOpen
: id === STAR_NOTICE || id === PRODUCT_HUNT_NOTICE || id === BOAT_OFFER_NOTICE || id === MODELGO_OFFER_NOTICE ? noticeSeen(record, id) : false, launch, closed) : null;
const shownKey = notice === CLOUD_TRIAL_NOTICE ? key : notice === ANNOUNCEMENT_NOTICE ? `${notice}:${announcement?.id}` : notice;
@@ -266,7 +278,7 @@ export function AppNotices({ quiet = false, viewer = null, now = Date.now }: { q
if (!shownKey || !notice) return;
markLaunchNotice(notice);
// The popups and the question own this launch: MausBot's first-launch card waits for a later one.
- if (shownKey === GROK_MOVE_NOTICE || shownKey === SIMPLE_MODE_NOTICE || shownKey === WHATS_NEW_NOTICE || shownKey === UPDATES_CONSENT_NOTICE) markLaunchDialog("notices");
+ if (shownKey === TEAMS_NOTICE || shownKey === GROK_MOVE_NOTICE || shownKey === SIMPLE_MODE_NOTICE || shownKey === WHATS_NEW_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" });
@@ -315,6 +327,12 @@ export function AppNotices({ quiet = false, viewer = null, now = Date.now }: { q
return <GrokMovePopup onDone={done} />;
}
+ if (notice === TEAMS_NOTICE) {
+ const action = teamsAction({ team: state.config?.team, viewer, account, canAddCloud: Boolean(bridge) });
+ const done = () => { close(); rememberNoticeSeen(TEAMS_NOTICE, record, { team, desktop, saved: config => dispatch({ type: "configStatus", config }) }); };
+ return <TeamsPopup action={action} onStep={step => reportTeams(step, action)} onDone={done} onStart={() => dispatch({ type: "openCloudAdd", source: WHATS_NEW_SOURCES.team })} />;
+ }
+
if (notice === PHONE_UPDATE_NOTICE && retiredPhones?.length) {
const done = () => { close(); const patch = dismissNotices(record, retiredPhones.map(phone => phoneUpdateHint(phone.id)));
if (patch) void api("/api/config", { method: "PUT", body: JSON.stringify(patch) }).then(config => dispatch({ type: "configStatus", config })).catch(() => {}); };
diff --git a/src/components/SidebarProfileMenu.test.ts b/src/components/SidebarProfileMenu.test.ts
index 0bf468fac1..9d4a83635a 100644
--- a/src/components/SidebarProfileMenu.test.ts
+++ b/src/components/SidebarProfileMenu.test.ts
@@ -338,6 +338,39 @@ describe("profileMenuItems", () => {
});
});
+describe("Announcements in the profile menu", () => {
+ const noop = () => {};
+ const build = (patch: Partial<Parameters<typeof profileMenuItems>[0]> = {}) => profileMenuItems({
+ phone: { key: "phone-devices", label: "Phone & devices", onSelect: noop },
+ update: null,
+ header: { name: "Ada", line: "Not signed in", avatar: null, onOpen: noop },
+ plan: { key: "plan", label: "Plan & billing", onSelect: noop },
+ onSettings: noop, onShortcuts: noop, onAbout: noop, onHelp: noop, onFeedback: noop,
+ ...patch,
+ });
+
+ it("sits first in Help's group, in Simple and in Advanced, red-dotted while one is new, lit while its page is open", () => {
+ const open = vi.fn();
+ const advanced = build({ announcements: { unread: true, active: false, onSelect: open } });
+ expect(advanced.map((item) => item.key)).toEqual(["account", "phone-devices", "settings", "plan", "announcements", "support"]);
+ expect(advanced.find((item) => item.key === "announcements")).toMatchObject({ label: "Announcements", attention: true, active: false, separatorBefore: true });
+ advanced.find((item) => item.key === "announcements")!.onSelect();
+ expect(open).toHaveBeenCalledOnce();
+ const simple = build({ simple: { tools: toolMenuItems({ activeView: "announcements", automationsNeedYou: false, onAutomations: noop, onTeamMap: noop }) },
+ announcements: { unread: false, active: true, onSelect: noop } });
+ expect(simple.map((item) => item.key)).toEqual(["account", "phone-devices", "settings", "automations", "team-map", "plan", "announcements", "support"]);
+ expect(simple.find((item) => item.key === "announcements")).toMatchObject({ attention: false, active: true, separatorBefore: true });
+ });
+
+ it("raises the avatar's dot red, and names it on the button, while an announcement is new", () => {
+ expect(accountDot({ automationsNeedYou: false, update: null, move: null, announcements: true })).toBe("danger");
+ expect(accountDot({ automationsNeedYou: false, update: "news", move: null, announcements: true })).toBe("danger");
+ expect(accountDot({ automationsNeedYou: false, update: null, move: null, announcements: false })).toBeNull();
+ expect(accountLabel("Ada", { automationsNeedYou: false, update: null, announcements: true })).toBe("Ada · New announcements");
+ expect(accountLabel("Ada", { automationsNeedYou: false, update: null })).toBe("Ada");
+ });
+});
+
describe("Simple mode's account menu", () => {
const noop = () => {};
const tools = toolMenuItems({ activeView: "routines", automationsNeedYou: true, onAutomations: noop, onTeamMap: noop });
diff --git a/src/components/SidebarProfileMenu.tsx b/src/components/SidebarProfileMenu.tsx
index 61d247cf49..6fd943b725 100644
--- a/src/components/SidebarProfileMenu.tsx
+++ b/src/components/SidebarProfileMenu.tsx
@@ -15,6 +15,7 @@ import {
LifeBuoy,
Loader2,
LogOut,
+ Megaphone,
MessageSquare,
Sparkles,
FolderTree,
@@ -58,6 +59,7 @@ import { FEEDBACK_URL, HELP_CENTER_URL, RELEASES_URL, appVersion, openExternalLi
import { pageIsThisComputer } from "@/lib/companion-bridge";
import { cloudPlanLabel } from "@/lib/cloud-plan";
import { shortcutLabel } from "./ShortcutHint";
+import { useAnnouncements } from "./announcements/use-announcements";
import { useOtherServerName } from "@/lib/other-server";
import { isOwnerOrAdmin, profileForSession, readSessionState, type SessionState } from "@/lib/session";
import {
@@ -332,20 +334,25 @@ export function toolMenuItems({ activeView, automationsNeedYou, onAutomations, o
/** The account button's name: the person, then whatever its dot is raised for, then the move to My Cloud while it goes.
* A failing move and automations that need the person share one segment. */
-export function accountLabel(name: string, { automationsNeedYou, update, move = null }: { automationsNeedYou: boolean; update: string | null; move?: AccountMoveKind | null }): string {
+export function accountLabel(name: string, { automationsNeedYou, update, move = null, announcements = false }: {
+ automationsNeedYou: boolean; update: string | null; move?: AccountMoveKind | null; announcements?: boolean;
+}): string {
const needsYou = move === "failed"
? t(automationsNeedYou ? "sidebar.account.moveAndAutomationsNeedYou" : "sidebar.account.moveNeedsYou")
: automationsNeedYou ? t("sidebar.account.automationsNeedYou") : "";
- return [name, needsYou, move === "sending" ? t("sidebar.account.moving") : "", update ?? ""].filter(Boolean).join(" · ");
+ return [name, needsYou, move === "sending" ? t("sidebar.account.moving") : "", update ?? "", announcements ? t("announcements.new") : ""].filter(Boolean).join(" · ");
}
export type AccountDot = "danger" | "accent";
const DOT_COLOR: Record<AccountDot, string> = { danger: "bg-danger", accent: "bg-accent" };
-/** The avatar's dot: red while automations, a failed update or the failing move to My Cloud need the person, the accent
- * for an update; none for the move on its way or done (what it brought waits in the menu). */
-export function accountDot({ automationsNeedYou, update, move }: { automationsNeedYou: boolean; update: "failed" | "news" | null; move: AccountMoveKind | null }): AccountDot | null {
- if (automationsNeedYou || update === "failed" || move === "failed") return "danger";
+/** The avatar's dot: red while automations, a failed update or the failing move to My Cloud need the person, or while
+ * an announcement is new to them; the accent for an update; none for the move on its way or done (what it brought waits
+ * in the menu). */
+export function accountDot({ automationsNeedYou, update, move, announcements = false }: {
+ automationsNeedYou: boolean; update: "failed" | "news" | null; move: AccountMoveKind | null; announcements?: boolean;
+}): AccountDot | null {
+ if (automationsNeedYou || update === "failed" || move === "failed" || announcements) return "danger";
return update ? "accent" : null;
}
@@ -445,6 +452,7 @@ export function profileMenuItems({
onHelp,
onFeedback,
onWhatsNew,
+ announcements = null,
signOut = null,
signOutElsewhere = null,
}: {
@@ -466,6 +474,8 @@ export function profileMenuItems({
onHelp: () => void;
onFeedback: () => void;
onWhatsNew?: () => void;
+ /** Announcements, with its red dot while one is new to the person */
+ announcements?: { unread: boolean; onSelect: () => void; active: boolean } | null;
/** the last row while someone is signed in, where signing out can work from this page */
signOut?: (() => void) | null;
/** a Cloud's page in the desktop window: Sign out happens on This computer, and this row goes there */
@@ -489,6 +499,8 @@ export function profileMenuItems({
const account: SidebarMenuItem = { key: "account", label: header.name, subtitle: header.line, icon: header.avatar, large: true, chevron: true, onSelect: header.onOpen };
const settings: SidebarMenuItem = { key: "settings", label: t("sidebar.menu.settings"), icon: <SettingsIcon size={16} />, trailing: settingsKeyHint(), onSelect: onSettings };
const support: SidebarMenuItem = { key: "support", label: t("sidebar.menu.helpShort"), icon: <LifeBuoy size={16} />, submenu: help, onSelect: () => {} };
+ const news: SidebarMenuItem | null = announcements ? { key: "announcements", label: t("announcements.title"), icon: <Megaphone size={16} />, active: announcements.active,
+ attention: announcements.unread, onSelect: announcements.onSelect } : null;
const present = (...items: Array<SidebarMenuItem | null | false>) => items.filter((item): item is SidebarMenuItem => Boolean(item));
const out: SidebarMenuItem[] = [...accounts.filter((item) => item.key !== "accounts-sign-out"),
...(signOut ? [{ key: "sign-out", label: t("accounts.signOut"), icon: <LogOut size={16} />, onSelect: signOut }]
@@ -498,8 +510,8 @@ export function profileMenuItems({
: accounts.filter((item) => item.key === "accounts-sign-out"))];
// Plan & billing follows Settings (Simple's own places sit between them); both modes end with Help, then Sign out.
const groups = simple
- ? [move, present(raised), [account], present(phone, settings), simple.tools, present(plan, switchPlace), [support], out]
- : [move, present(raised), [account], present(phone, settings, plan), present(switchPlace, support), out];
+ ? [move, present(raised), [account], present(phone, settings), simple.tools, present(plan, switchPlace), present(news, support), out]
+ : [move, present(raised), [account], present(phone, settings, plan), present(switchPlace, news, support), out];
return groups.filter((group) => group.length > 0)
.flatMap((group, at) => group.map((item, index) => (at > 0 && index === 0 ? { ...item, separatorBefore: true } : item)));
}
@@ -568,6 +580,7 @@ export function SidebarProfileMenu({ iconOnly = false, rail = false, circle = fa
const openSettings = (section: AppSettingsSection) => dispatch({ type: "toggleAppSettings", open: true, section });
const move = useAccountMove(state.config?.cloudHome === true, { onOpen: () => openSettings("plan"), onPairPhone: () => dispatch(phonePairingSettingsAction()) });
const accounts = useAccounts();
+ const news = useAnnouncements();
const openSource = desktop && !window.ogb?.cloudAccount && !window.ogb?.cloudPlan;
const planLine = !desktop ? undefined : cloudUsage ? t("sidebar.menu.plan.used", { plan: summary.plan ?? cloudPlanLabel(planSnapshot?.tier), percent: cloudUsage.value.replace(/\D+/g, "") })
: summary.signedIn === false || summary.plan === t("settings.account.free") ? t("sidebar.menu.plan.free") : summary.plan ?? undefined;
@@ -609,6 +622,7 @@ export function SidebarProfileMenu({ iconOnly = false, rail = false, circle = fa
onHelp: () => void openExternalLink(HELP_CENTER_URL),
onFeedback: () => void openExternalLink(FEEDBACK_URL),
onWhatsNew: () => void openExternalLink(RELEASES_URL),
+ announcements: { unread: news.unread, active: state.activeView === "announcements", onSelect: () => dispatch({ type: "showAnnouncements" }) },
// Every Sign out asks first: "Sign out of MausBot?" and what keeps running.
signOut: accounts.view?.active ? null
: !desktop && session?.kind === "session" ? () => setSigningOut("browser")
@@ -621,10 +635,10 @@ export function SidebarProfileMenu({ iconOnly = false, rail = false, circle = fa
const needsYou = account?.automationsNeedYou === true;
const initials = profileInitials(profile);
const nameless = simple && initials === "?" ? <UserRound size={18} strokeWidth={1.75} aria-hidden /> : undefined;
- const label = accountLabel(name, { automationsNeedYou: needsYou, update: simple && noteworthy && update ? update.label : null, move: move.kind });
- const dot = accountDot({ automationsNeedYou: needsYou, update: noteworthy ? (update.phase === "error" ? "failed" : "news") : null, move: move.kind });
- // Advanced's full row has its own update badge: its avatar's dot is the move's alone.
- const moveDot = accountDot({ automationsNeedYou: false, update: null, move: move.kind });
+ const label = accountLabel(name, { automationsNeedYou: needsYou, update: simple && noteworthy && update ? update.label : null, move: move.kind, announcements: news.unread });
+ const dot = accountDot({ automationsNeedYou: needsYou, update: noteworthy ? (update.phase === "error" ? "failed" : "news") : null, move: move.kind, announcements: news.unread });
+ // Advanced's full row has its own update badge: its avatar's dot is the move's and the announcements' alone.
+ const moveDot = accountDot({ automationsNeedYou: false, update: null, move: move.kind, announcements: news.unread });
return (
<>
diff --git a/src/components/announcements/AnnouncementsPage.test.ts b/src/components/announcements/AnnouncementsPage.test.ts
new file mode 100644
index 0000000000..e5e1c21aa7
--- /dev/null
+++ b/src/components/announcements/AnnouncementsPage.test.ts
@@ -0,0 +1,129 @@
+// @vitest-environment happy-dom
+import { act, createElement } from "react";
+import { createRoot, type Root } from "react-dom/client";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import { announcementHistory, type HistoryFacts } from "@/lib/announcement-history";
+import { setLocale } from "@/lib/i18n";
+import { TEAMS_NOTICE } from "@/lib/notices";
+import type { AnnouncementCard } from "../../../shared/announcements";
+import type { Announcements } from "./use-announcements";
+
+const f = vi.hoisted(() => ({ found: null as unknown as Announcements, dispatch: vi.fn(), state: { config: {} as Record<string, unknown> }, remembered: vi.fn() }));
+vi.mock("./use-announcements", () => ({ useAnnouncements: () => f.found }));
+vi.mock("@/state/store", () => ({ useStore: () => ({ state: f.state, dispatch: f.dispatch }), api: vi.fn() }));
+vi.mock("@/lib/analytics", () => ({ track: vi.fn() }));
+vi.mock("@/components/Avatar", () => ({ MausAvatar: () => null }));
+vi.mock("../lazy-screens", () => ({ GrokMoveDialog: () => createElement("div", { "data-grok-move-dialog": "" }) }));
+vi.mock("@/lib/announcement-history", async original => ({ ...await original<typeof import("@/lib/announcement-history")>(), rememberNoticeSeen: f.remembered }));
+const { AnnouncementsPage } = await import("./AnnouncementsPage");
+const { track } = await import("@/lib/analytics");
+
+(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true;
+const NOW = Date.parse("2026-11-18T10:00:00Z");
+const browser: HistoryFacts = { branded: false, organization: false, cloudSale: false, cloudCards: false, remote: false, team: false, canSave: true, sponsors: true, modelgo: true };
+const desktop: HistoryFacts = { ...browser, cloudSale: true, cloudCards: true };
+const card: AnnouncementCard = { id: "phone-app-2026-11", kind: "product", title: { en: "MausBot on your phone", "pt-br": "MausBot no seu celular" }, body: "Chat with your bots anywhere.",
+ primary: { label: "Open", action: { open: "my_cloud" } }, starts: "2026-11-20T00:00:00Z", ends: "2027-01-01T00:00:00Z" } as AnnouncementCard;
+const markRead = vi.fn();
+const found = (facts: HistoryFacts, extra: Partial<Announcements> = {}): Announcements => ({
+ items: announcementHistory({ facts, cards: [card], feedUpdatedAt: null, now: NOW }), unread: false, markRead,
+ person: { record: undefined, desktopSeen: [] }, writer: { team: false, saved: vi.fn() }, viewer: { hosted: false, canSave: true }, account: null, cloudBridge: false, ...extra,
+});
+
+let host: HTMLDivElement, root: Root | null = null;
+async function open() {
+ root = createRoot(host);
+ await act(async () => { root!.render(createElement(AnnouncementsPage)); });
+ await act(async () => { await Promise.resolve(); });
+}
+const rows = () => [...document.querySelectorAll<HTMLElement>("[data-announcement-item]")];
+const click = async (element: Element | null | undefined) => { expect(element).toBeTruthy(); await act(async () => { (element as HTMLElement).click(); await Promise.resolve(); }); };
+
+beforeEach(() => {
+ setLocale("en"); vi.clearAllMocks(); f.state = { config: {} };
+ host = document.createElement("div"); document.body.append(host);
+ vi.stubGlobal("open", vi.fn());
+});
+afterEach(async () => { await act(async () => root?.unmount()); root = null; host.remove(); vi.unstubAllGlobals(); });
+
+describe("Announcements", () => {
+ it("lists everything announced here, newest first, each with its date, words and buttons; an offer that ended says so", async () => {
+ f.found = found(desktop);
+ await open();
+ expect(document.querySelector("h1")?.textContent).toBe("Announcements");
+ expect(rows().map(row => row.dataset.announcementItem)).toEqual([card.id, TEAMS_NOTICE, "modelgo-offer-2026-11", "grok-move-2026-11", "whats-new-2026-11",
+ "boat-credit-2026-11", "product-hunt-launch-2026-10", "cloud-trial-intro-v1"]);
+ const teams = rows()[1]!;
+ expect(teams.querySelector("time")?.getAttribute("datetime")).toBe("2026-11-17T00:00:00.000Z");
+ expect(teams.textContent).toContain("Nov 17, 2026");
+ expect(teams.textContent).toContain("MausBot is better with your team");
+ expect(teams.textContent).toContain("Show again");
+ const hunt = rows().find(row => row.dataset.announcementItem === "product-hunt-launch-2026-10")!;
+ expect(hunt.querySelector("[data-announcement-ended]")?.textContent).toBe("Ended");
+ expect(hunt.querySelector("button"), "no button to an offer that is over").toBeNull();
+ const boat = rows().find(row => row.dataset.announcementItem === "boat-credit-2026-11")!;
+ expect([...boat.querySelectorAll("button")].map(button => button.textContent)).toEqual(["Get Boat", "I bought it: claim my $50"]);
+ expect(rows().find(row => row.dataset.announcementItem === "whats-new-2026-11")?.textContent, "the earlier What's new reopens only when it has something for this account")
+ .not.toContain("Show again");
+ });
+
+ it("each button does what its own notice did", async () => {
+ f.found = found(desktop);
+ await open();
+ const row = (id: string) => rows().find(each => each.dataset.announcementItem === id)!;
+ await click([...row("modelgo-offer-2026-11").querySelectorAll("button")].find(button => button.textContent === "Get a ModelGo key"));
+ expect(window.open).toHaveBeenCalledWith(expect.stringContaining("modelgo"), "_blank", "noopener,noreferrer");
+ await click(row("cloud-trial-intro-v1").querySelector("button"));
+ expect(f.dispatch).toHaveBeenCalledWith({ type: "openCloudAdd", source: "app_card" });
+ await click(row(card.id).querySelector("button"));
+ expect(f.dispatch).toHaveBeenCalledWith({ type: "toggleAppSettings", open: true, section: "cloudAccount" });
+ });
+
+ it("opening it clears the red dot; with no dot there is nothing to write", async () => {
+ f.found = found(browser);
+ await open();
+ expect(markRead).not.toHaveBeenCalled();
+ await act(async () => root?.unmount()); root = null;
+ f.found = found(browser, { unread: true });
+ await open();
+ expect(markRead).toHaveBeenCalledTimes(1);
+ });
+
+ it("a popup's row opens the popup again, outside the notice queue; closing it marks it seen when it wasn't", async () => {
+ f.found = found(browser);
+ await open();
+ await click(rows().find(row => row.dataset.announcementItem === TEAMS_NOTICE)?.querySelector("button"));
+ const popup = document.querySelector("[data-teams-popup]");
+ expect(popup?.getAttribute("data-teams-popup")).toBe("start");
+ expect(track).toHaveBeenCalledWith("whats_new", { action: "seen", slide: "teams", audience: "no_team", campaign: TEAMS_NOTICE });
+ await click([...popup!.querySelectorAll("button")].find(button => button.textContent === "Not now"));
+ expect(document.querySelector("[data-teams-popup]")).toBeNull();
+ expect(f.remembered).toHaveBeenCalledWith(TEAMS_NOTICE, undefined, expect.objectContaining({ team: false }));
+
+ await click(rows().find(row => row.dataset.announcementItem === "grok-move-2026-11")?.querySelector("button"));
+ await click(document.querySelector("[data-grok-move-popup] [data-primary]"));
+ expect(document.querySelector("[data-grok-move-dialog]"), "Let's start opens the move, as from the popup").not.toBeNull();
+ });
+
+ it("on a Team Cloud: its admin's popup invites, a member's only tells; a member's list is Teams alone", async () => {
+ f.state = { config: { team: { id: "team-acme", name: "Acme", cloudPage: "https://admin.openmausbot.com/cloud" } } };
+ f.found = found({ ...browser, team: true, canSave: false, sponsors: false }, { viewer: { hosted: true, canSave: false, teamRole: "member" } });
+ await open();
+ expect(rows().map(row => row.dataset.announcementItem)).toEqual([card.id, TEAMS_NOTICE]);
+ await click(rows()[1]!.querySelector("button"));
+ expect(document.querySelector("[data-teams-popup]")?.getAttribute("data-teams-popup")).toBe("got-it");
+ await act(async () => root?.unmount()); root = null;
+ f.found = found({ ...browser, team: true }, { viewer: { hosted: true, canSave: true, teamRole: "admin" } });
+ await open();
+ await click(rows().find(row => row.dataset.announcementItem === TEAMS_NOTICE)?.querySelector("button"));
+ expect(document.querySelector("[data-teams-popup]")?.getAttribute("data-teams-popup")).toBe("invite");
+ });
+
+ it("shows a card's words in the person's language", async () => {
+ setLocale("pt-br");
+ f.found = found(browser);
+ await open();
+ expect(rows()[0]!.textContent).toContain("MausBot no seu celular");
+ expect(document.querySelector("h1")?.textContent).toBe("Anúncios");
+ });
+});
diff --git a/src/components/announcements/AnnouncementsPage.tsx b/src/components/announcements/AnnouncementsPage.tsx
new file mode 100644
index 0000000000..a2adf0cfde
--- /dev/null
+++ b/src/components/announcements/AnnouncementsPage.tsx
@@ -0,0 +1,175 @@
+import { useEffect, useRef, useState, type ComponentType, type ReactNode } from "react";
+import { Cloud, Gift, Megaphone, Rocket, UsersRound } from "lucide-react";
+import type { CloudOffer } from "../../../electron/cloud-home.mjs";
+import { itemSeen, rememberNoticeSeen, type HistoryAction, type HistoryItem, type HistoryMark, type HistoryModal } from "@/lib/announcement-history";
+import { openEmailDraft, openExternalLink } from "@/lib/app-links";
+import { cn } from "@/lib/cn";
+import { activeLocale, t } from "@/lib/i18n";
+import { reportTeams, teamsAction } from "@/lib/teams-whats-new";
+import { reportWhatsNew, WHATS_NEW_SOURCES, whatsNewView, type WhatsNewView } from "@/lib/whats-new";
+import { useStore } from "@/state/store";
+import { localized, type AnnouncementAction, type AnnouncementPlace } from "../../../shared/announcements";
+import { announcementPlaceAction, KIND_ICON, MARK } from "../AnnouncementCard";
+import { GrokBotMark } from "../GrokBotMark";
+import { GrokMovePopup } from "../GrokMovePopup";
+import { GrokMoveDialog } from "../lazy-screens";
+import { PRIMARY_BUTTON } from "../NoticeCard";
+import { ModelgoMark, type IconProps } from "../ProviderIcons";
+import { TOOL_PAGE_TITLE, ToolPage, ToolPageHeader } from "../ToolPageShell";
+import { TeamsPopup } from "../whats-new/TeamsPopup";
+import { WhatsNewPopup } from "../whats-new/WhatsNewPopup";
+import { useAnnouncements, type Announcements } from "./use-announcements";
+
+const BUILT_IN_MARK: Record<HistoryMark, ComponentType<IconProps>> = {
+ teams: UsersRound, cloud: Cloud, boat: Gift, modelgo: ModelgoMark, grok: GrokBotMark, "product-hunt": Rocket,
+};
+const QUIET_BUTTON = "ui-button min-h-9 gap-1.5 px-3 py-1.5";
+
+/** A button that opens what an announcement's own notice opens, never anything else. */
+export interface AnnouncementRun {
+ url: (url: string) => void;
+ email: (url: string) => void;
+ place: (place: AnnouncementPlace) => void;
+ cloudAdd: (action: Extract<HistoryAction, { cloud_add: unknown }>["cloud_add"]) => void;
+ cloudHowTo: () => void;
+}
+
+function run(action: HistoryAction | AnnouncementAction, to: AnnouncementRun) {
+ if ("open_url" in action) to.url(action.open_url);
+ else if ("email" in action) to.email(action.email);
+ else if ("open" in action) to.place(action.open);
+ else if ("cloud_add" in action) to.cloudAdd(action.cloud_add);
+ else to.cloudHowTo();
+}
+
+const dateText = (at: number, locale: string) => {
+ try { return new Intl.DateTimeFormat(locale, { dateStyle: "medium", timeZone: "UTC" }).format(at); } catch { return new Date(at).toISOString().slice(0, 10); }
+};
+
+function Mark({ item }: { item: HistoryItem }) {
+ const Icon = item.source === "built-in" ? BUILT_IN_MARK[item.entry.mark] : item.card.image && "mark" in item.card.image ? MARK[item.card.image.mark] : KIND_ICON[item.card.kind];
+ return <span aria-hidden="true" className="flex size-9 shrink-0 items-center justify-center rounded-xl bg-ink/[0.05] text-ink-secondary"><Icon size={18} /></span>;
+}
+
+/** One announcement: its date, mark, title and line or two, and its own buttons; a popup's row opens the popup again. */
+function Row({ item, locale, onModal, canReopen, to }: {
+ item: HistoryItem; locale: string; onModal: (modal: HistoryModal) => void; canReopen: (modal: HistoryModal) => boolean; to: AnnouncementRun;
+}) {
+ const title = item.source === "built-in" ? t(item.entry.title) : localized(item.card.title, locale);
+ const body = item.source === "built-in" ? t(item.entry.body) : localized(item.card.body, locale);
+ const words = <>
+ <time dateTime={new Date(item.at).toISOString()} className="block text-[12px] leading-4 text-ink-tertiary">{dateText(item.at, locale)}</time>
+ <span className="mt-0.5 block text-[14px] font-medium leading-5 text-ink">{title}</span>
+ <span className="mt-0.5 line-clamp-2 block text-[13px] leading-[18px] text-ink-secondary">{body}</span>
+ </>;
+ const modal = item.source === "built-in" && "modal" in item.entry.open ? item.entry.open.modal : null;
+ if (modal && canReopen(modal)) {
+ return <li data-announcement-item={item.id}>
+ <button type="button" onClick={() => onModal(modal)} className="flex w-full items-start gap-3 rounded-xl px-3 py-3 text-start transition-colors hover:bg-ink/[0.04] focus-visible:outline-2 focus-visible:outline-focus">
+ <Mark item={item} />
+ <span className="min-w-0 flex-1">{words}</span>
+ <span className="ui-button ui-button-sm pointer-events-none mt-4 shrink-0 rounded-full px-3 text-[12px]">{t("announcements.showAgain")}</span>
+ </button>
+ </li>;
+ }
+ let buttons: ReactNode = null;
+ if (item.source === "built-in" && item.ended) buttons = <span data-announcement-ended className="rounded-full bg-ink/[0.06] px-2.5 py-1 text-[12px] text-ink-secondary">{t("announcements.ended")}</span>;
+ else if (item.source === "built-in" && "buttons" in item.entry.open) {
+ buttons = item.entry.open.buttons.map((button, index) => <button key={button.label} type="button" className={index === 0 ? PRIMARY_BUTTON : QUIET_BUTTON}
+ onClick={() => run(button.action, to)}>{t(button.label)}</button>);
+ } else if (item.source === "feed") {
+ buttons = [item.card.primary, item.card.secondary].flatMap((button, index) => button ? [<button key={index} type="button" className={index === 0 ? PRIMARY_BUTTON : QUIET_BUTTON}
+ onClick={() => run(button.action, to)}>{localized(button.label, locale)}</button>] : []);
+ }
+ return <li data-announcement-item={item.id} className="flex items-start gap-3 px-3 py-3">
+ <Mark item={item} />
+ <div className="min-w-0 flex-1">
+ {words}
+ {buttons && <div className="mt-2.5 flex flex-wrap items-center gap-2">{buttons}</div>}
+ </div>
+ </li>;
+}
+
+/** The list itself, as the page draws it: newest first. */
+export function AnnouncementList({ items, locale = activeLocale(), onModal, canReopen = () => true, to }: {
+ items: readonly HistoryItem[]; locale?: string; onModal: (modal: HistoryModal) => void; canReopen?: (modal: HistoryModal) => boolean; to: AnnouncementRun;
+}) {
+ if (!items.length) {
+ return <section aria-label={t("announcements.empty")} className="px-6 py-16 text-center">
+ <div className="mx-auto mb-4 flex size-12 items-center justify-center rounded-2xl bg-accent/10 text-accent"><Megaphone size={22} /></div>
+ <p className="text-[14px] text-ink-secondary">{t("announcements.empty")}</p>
+ </section>;
+ }
+ return <ul aria-label={t("announcements.title")} className="flex flex-col divide-y divide-hairline/40 rounded-2xl border border-hairline/50 bg-card/40">
+ {items.map(item => <Row key={`${item.source}:${item.id}`} item={item} locale={locale} onModal={onModal} canReopen={canReopen} to={to} />)}
+ </ul>;
+}
+
+/** The earlier What's new needs this desktop's Cloud account and the Admin's offer to say anything; null when it has nothing
+ * for this account. */
+function useWhatsNewView(found: Announcements, listed: boolean): WhatsNewView | null {
+ const bridge = found.cloudBridge ? window.ogb?.cloudAccount : undefined;
+ const [offer, setOffer] = useState<CloudOffer | null | undefined>(undefined);
+ useEffect(() => {
+ if (!listed || !bridge?.offer) return;
+ let active = true;
+ void bridge.offer().then(next => { if (active) setOffer(next); }, () => { if (active) setOffer(null); });
+ return () => { active = false; };
+ }, [listed, bridge]);
+ const view = listed && bridge?.offer ? whatsNewView(found.account, offer) : "none";
+ return typeof view === "object" ? view : null;
+}
+
+/** A popup from the list, opened again outside the notice queue: nothing about the queue's launch changes. */
+function Replay({ modal, found, whatsNew, onClose }: { modal: HistoryModal; found: Announcements; whatsNew: WhatsNewView | null; onClose: () => void }) {
+ const { state, dispatch } = useStore();
+ const [moving, setMoving] = useState(false);
+ const item = found.items.find(entry => entry.source === "built-in" && "modal" in entry.entry.open && entry.entry.open.modal === modal);
+ const done = () => {
+ if (item && !itemSeen(item, found.person)) rememberNoticeSeen(item.id, found.person.record, found.writer);
+ onClose();
+ };
+ if (modal === "teams") {
+ const action = teamsAction({ team: state.config?.team, viewer: found.viewer, account: found.account, canAddCloud: found.cloudBridge });
+ return <TeamsPopup action={action} onStep={step => reportTeams(step, action)} onDone={done}
+ onStart={() => dispatch({ type: "openCloudAdd", source: WHATS_NEW_SOURCES.team })} />;
+ }
+ if (modal === "whats-new") {
+ if (!whatsNew) return null;
+ return <WhatsNewPopup view={whatsNew} report={(action, slide) => reportWhatsNew(action, slide, whatsNew)} onDone={done}
+ onBuy={slide => dispatch({ type: "openCloudAdd", source: WHATS_NEW_SOURCES[slide] })} />;
+ }
+ if (moving) return <GrokMoveDialog onClose={onClose} />;
+ return <GrokMovePopup onDone={action => { if (action === "start") setMoving(true); else done(); }} />;
+}
+
+/** Everything announced to this person, newest first. Opening it clears the red dot (here and on their other pages). */
+export function AnnouncementsPage() {
+ const { dispatch } = useStore();
+ const found = useAnnouncements();
+ const [open, setOpen] = useState<HistoryModal | null>(null);
+ const back = useRef<HTMLButtonElement>(null);
+ const whatsNew = useWhatsNewView(found, found.items.some(item => item.source === "built-in" && "modal" in item.entry.open && item.entry.open.modal === "whats-new"));
+ useEffect(() => { back.current?.focus({ preventScroll: true }); }, []);
+ useEffect(() => { if (found.unread) found.markRead(); }, [found.unread]);
+ const to: AnnouncementRun = {
+ url: url => void openExternalLink(url).catch(() => undefined),
+ email: url => void openEmailDraft(url).catch(() => undefined),
+ place: place => dispatch(announcementPlaceAction(place)),
+ cloudAdd: source => dispatch({ type: "openCloudAdd", source }),
+ cloudHowTo: () => dispatch({ type: "cloudHowTo", open: true }),
+ };
+ return (
+ <ToolPage label={t("announcements.title")}>
+ <ToolPageHeader backLabel={t("automations.back")} onBack={() => dispatch({ type: "showChat" })} backRef={back}>
+ <h1 className={TOOL_PAGE_TITLE}>{t("announcements.title")}</h1>
+ </ToolPageHeader>
+ <div className="min-h-0 flex-1 overflow-y-auto" data-announcements={found.items.length}>
+ <div className={cn("mx-auto w-full max-w-2xl p-4 sm:p-6")}>
+ <AnnouncementList items={found.items} onModal={setOpen} canReopen={modal => modal !== "whats-new" || whatsNew !== null} to={to} />
+ </div>
+ </div>
+ {open && <Replay modal={open} found={found} whatsNew={whatsNew} onClose={() => setOpen(null)} />}
+ </ToolPage>
+ );
+}
diff --git a/src/components/announcements/use-announcements.test.ts b/src/components/announcements/use-announcements.test.ts
new file mode 100644
index 0000000000..8ab7c9e864
--- /dev/null
+++ b/src/components/announcements/use-announcements.test.ts
@@ -0,0 +1,81 @@
+// @vitest-environment happy-dom
+import { act, createElement } from "react";
+import { createRoot, type Root } from "react-dom/client";
+import { afterEach, beforeEach, expect, it, vi } from "vitest";
+import { EMPTY_ONBOARDING } from "@/lib/onboarding";
+import { TEAMS_NOTICE } from "@/lib/notices";
+
+const f = vi.hoisted(() => ({ state: {} as Record<string, unknown>, dispatch: vi.fn(), session: {} as Record<string, unknown>, cards: [] as unknown[] }));
+vi.mock("@/state/store", () => ({
+ useStore: () => ({ state: f.state, dispatch: f.dispatch }),
+ api: vi.fn(async (path: string, init?: RequestInit) => {
+ if (path === "/api/auth/session") return f.session;
+ if (path === "/api/announcements") return { cards: f.cards, updatedAt: "2026-11-11T00:00:00Z" };
+ if (path === "/api/config" && init?.method === "PUT") return { ...(f.state.config as object), onboarding: JSON.parse(String(init.body)).onboarding };
+ if (path === "/api/me/welcome") return { welcome: {} };
+ return f.state.config;
+ }),
+}));
+vi.mock("@/lib/analytics", () => ({ track: vi.fn() }));
+const { useAnnouncements } = await import("./use-announcements");
+const { forgetAnnouncementCards } = await import("@/lib/announcements");
+const { api } = await import("@/state/store");
+
+(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true;
+let host: HTMLDivElement, root: Root | null = null;
+let found: ReturnType<typeof useAnnouncements>;
+function Probe() { found = useAnnouncements(() => Date.parse("2026-11-18T10:00:00Z")); return null; }
+const mount = async () => {
+ root = createRoot(host);
+ await act(async () => { root!.render(createElement(Probe)); });
+ for (let i = 0; i < 3; i++) await act(async () => { await Promise.resolve(); });
+};
+const config = (hintsSeen: string[], extra: Record<string, unknown> = {}) => ({ onboarding: { ...EMPTY_ONBOARDING, completedAt: "2026-09-01", version: 1, hintsSeen }, ...extra });
+
+let storage: Map<string, string>;
+beforeEach(() => {
+ storage = new Map();
+ vi.stubGlobal("localStorage", { getItem: (key: string) => storage.get(key) ?? null, setItem: (key: string, value: string) => storage.set(key, value), clear: () => storage.clear() });
+ forgetAnnouncementCards(); vi.clearAllMocks(); f.cards = [];
+ f.session = { hosted: true, scopes: ["admin"] };
+ f.state = { connected: true, bots: [{ tasks: [{ threadId: "t", createdAt: 1, usage: { turns: 2 } }] }], groups: [], routines: [], routinesLoadState: "ready", config: config([]) };
+ f.dispatch.mockImplementation((action: { type: string; config?: unknown }) => { if (action.type === "configStatus") f.state = { ...f.state, config: action.config }; });
+ host = document.createElement("div"); document.body.append(host);
+});
+afterEach(async () => { await act(async () => root?.unmount()); root = null; host?.remove(); vi.unstubAllGlobals(); });
+
+it("someone who used the app before has the dot for Teams alone, and opening Announcements clears it here and in their record", async () => {
+ await mount();
+ expect(found.items[0]?.id).toBe(TEAMS_NOTICE);
+ expect(found.unread).toBe(true);
+ await act(async () => { found.markRead(); await Promise.resolve(); });
+ expect(found.unread).toBe(false);
+ const put = vi.mocked(api).mock.calls.find(([path, init]) => path === "/api/config" && (init as RequestInit | undefined)?.method === "PUT");
+ expect(JSON.parse(String((put![1] as RequestInit).body)).onboarding.hintsSeen).toEqual([`announcements-read-${Date.parse("2026-11-18T10:00:00Z")}`]);
+ localStorage.clear();
+ await act(async () => { root!.render(createElement(Probe)); });
+ expect(found.unread, "the place's record keeps it for their other devices").toBe(false);
+});
+
+it("no dot once the Teams popup was seen, nor before the session is known", async () => {
+ f.state = { ...f.state, config: config([TEAMS_NOTICE]) };
+ await mount();
+ expect(found.unread).toBe(false);
+ await act(async () => root?.unmount());
+ f.session = new Promise(() => {}) as never;
+ f.state = { ...f.state, config: config([]) };
+ await mount();
+ expect(found.unread, "waits for who is looking").toBe(false);
+});
+
+it("a Team Cloud's member: Teams is theirs, the dot too, and clearing it writes their own record", async () => {
+ f.session = { hosted: true, scopes: ["client"], team: { role: "member" } };
+ f.state = { ...f.state, config: config([], { team: { id: "t", name: "Acme" }, cloudHome: true }) };
+ await mount();
+ expect(found.items.map(item => item.id)).toEqual([TEAMS_NOTICE]);
+ expect(found.unread).toBe(true);
+ await act(async () => { found.markRead(); await Promise.resolve(); });
+ expect(vi.mocked(api).mock.calls.some(([path]) => path === "/api/me/welcome")).toBe(true);
+ expect(vi.mocked(api).mock.calls.some(([path, init]) => path === "/api/config" && (init as RequestInit | undefined)?.method === "PUT"), "never the team's record").toBe(false);
+ expect(found.unread).toBe(false);
+});
diff --git a/src/components/announcements/use-announcements.ts b/src/components/announcements/use-announcements.ts
new file mode 100644
index 0000000000..da9adbd42e
--- /dev/null
+++ b/src/components/announcements/use-announcements.ts
@@ -0,0 +1,97 @@
+import { useEffect, useState } from "react";
+import type { CloudAccountState } from "../../../electron/cloud-account.mjs";
+import { announcementHistory, announcementsUnread, markAnnouncementsRead, useAnnouncementRecord, type HistoryFacts, type HistoryItem, type PersonRecord,
+ type RecordWriter } from "@/lib/announcement-history";
+import { announcementConditions, announcementFeedUpdatedAt, announcementPlan, announcementPlatform, announcementSurface, cardsForPerson, providersRestricted,
+ SPONSOR_CARDS_FOR_TEAM_MEMBERS, useAnnouncementCards } from "@/lib/announcements";
+import { appVersion } from "@/lib/app-links";
+import { brandStatus } from "@/lib/brand";
+import { cloudPlanView } from "@/lib/cloud-plan";
+import { activeLocale } from "@/lib/i18n";
+import { modelgoOfferable } from "@/lib/modelgo-offer";
+import { usedBefore } from "@/lib/notices";
+import type { WelcomeViewer } from "@/lib/onboarding";
+import { useStore } from "@/state/store";
+import { useDesktopNotices } from "../desktop-notices";
+import { localDesktopPage, useWelcomeViewer } from "../onboarding/WelcomeGate";
+
+/** An organization runs this desktop: null while main answers; false in a browser. */
+function useOrganization(): boolean | null {
+ const [organization, setOrganization] = useState<boolean | null>(window.ogb?.organization ? null : false);
+ useEffect(() => {
+ const org = window.ogb?.organization;
+ if (!org) return;
+ let active = true;
+ const read = (next: { status: string; organization?: unknown }) => { if (active) setOrganization(next.status !== "signed-out" && Boolean(next.organization)); };
+ const unsubscribe = org.onState(read);
+ void org.state().then(read, () => { if (active) setOrganization(false); });
+ return () => { active = false; unsubscribe(); };
+ }, []);
+ return organization;
+}
+
+function useCloudAccount(bridge: NonNullable<Window["ogb"]>["cloudAccount"]): CloudAccountState | null {
+ const [account, setAccount] = useState<CloudAccountState | null>(null);
+ useEffect(() => {
+ if (!bridge) return;
+ let active = true;
+ const unsubscribe = bridge.onState(next => { if (active) setAccount(next); });
+ void bridge.state().then(next => { if (active) setAccount(next); }).catch(() => {});
+ return () => { active = false; unsubscribe(); };
+ }, [bridge]);
+ return account;
+}
+
+export interface Announcements {
+ items: HistoryItem[];
+ /** The red dot: false until everything it depends on has loaded. */
+ unread: boolean;
+ markRead: () => void;
+ person: PersonRecord;
+ writer: RecordWriter;
+ viewer: WelcomeViewer | null;
+ /** This desktop's MausBot Cloud sign-in, on its own page. */
+ account: CloudAccountState | null;
+ /** The app's Add a Cloud and Cloud sign-in are here: This computer's page. */
+ cloudBridge: boolean;
+}
+
+/** Every announcement this person could have had here, and whether one is new to them. */
+export function useAnnouncements(now: () => number = Date.now): Announcements {
+ const { state, dispatch } = useStore();
+ useAnnouncementRecord();
+ const viewer = useWelcomeViewer();
+ const remote = window.ogb?.remoteClient?.active === true;
+ const local = localDesktopPage();
+ const bridge = !remote && local ? window.ogb?.cloudAccount : undefined;
+ const desktop = remote ? undefined : window.ogb?.desktopNotices;
+ const desktopState = useDesktopNotices(desktop);
+ const organization = useOrganization();
+ const account = useCloudAccount(bridge);
+ const branded = brandStatus().source === "file";
+ const team = Boolean(state.config?.team);
+ const canSave = viewer?.canSave !== false;
+ const cloudHome = Boolean(state.config?.cloudHome || viewer?.cloudHome);
+ const sponsors = SPONSOR_CARDS_FOR_TEAM_MEMBERS || !team || viewer?.canSave === true;
+ const facts: HistoryFacts = {
+ branded, organization, remote, team, canSave, sponsors,
+ cloudSale: Boolean(bridge && desktop), cloudCards: Boolean(bridge || (!remote && cloudHome && window.ogb?.cloudPlan)),
+ modelgo: modelgoOfferable(state.config?.managedPolicy),
+ };
+ const surface = announcementSurface(local, cloudHome);
+ const cards = cardsForPerson(useAnnouncementCards(!branded), {
+ facts: { nowMs: now(), version: appVersion(), platform: announcementPlatform(globalThis.navigator?.userAgent), surface,
+ plan: announcementPlan(surface, bridge ? cloudPlanView(account) : null, team), people: usedBefore(state.bots) ? "existing" : "new", locale: activeLocale(),
+ conditions: announcementConditions(state) },
+ branded, admin: canSave, sponsors: !providersRestricted(state.config?.managedPolicy) && sponsors,
+ });
+ const items = announcementHistory({ facts, cards, feedUpdatedAt: announcementFeedUpdatedAt(), now: now() });
+ const record = state.config?.onboarding;
+ const person: PersonRecord = { record, desktopSeen: desktopState?.seen ?? [] };
+ const ready = viewer !== null && organization !== null && (!desktop || desktopState !== null) && state.config !== null;
+ const writer: RecordWriter = { team, desktop, saved: config => dispatch({ type: "configStatus", config }) };
+ return {
+ items, unread: ready && announcementsUnread(items, person), person, writer, viewer, account, cloudBridge: Boolean(bridge),
+ markRead: () => markAnnouncementsRead(now(), record, writer),
+ };
+}
diff --git a/src/components/desktop-notices.ts b/src/components/desktop-notices.ts
new file mode 100644
index 0000000000..4e5d844045
--- /dev/null
+++ b/src/components/desktop-notices.ts
@@ -0,0 +1,14 @@
+import { useEffect, useState } from "react";
+import type { DesktopNoticesBridge, DesktopNoticesState } from "../../electron/desktop-prefs.mjs";
+
+/** null until main answers; a page main refuses has nothing due. */
+export function useDesktopNotices(desktop: DesktopNoticesBridge | undefined): DesktopNoticesState | null {
+ const [answer, setAnswer] = useState<DesktopNoticesState | null>(null);
+ useEffect(() => {
+ if (!desktop) return;
+ let active = true;
+ void desktop.state().then(next => { if (active) setAnswer(next); }, () => { if (active) setAnswer({ seen: [], cloud: false }); });
+ return () => { active = false; };
+ }, [desktop]);
+ return desktop ? answer : null;
+}
diff --git a/src/components/lazy-screens.test.ts b/src/components/lazy-screens.test.ts
index f1419a62b0..fd5b3001b0 100644
--- a/src/components/lazy-screens.test.ts
+++ b/src/components/lazy-screens.test.ts
@@ -155,7 +155,7 @@ describe("preloadScreens", () => {
it("a page on this machine fetches nothing ahead: each screen loads when it opens", () => {
vi.useFakeTimers();
const preloads = stubPreloads();
- expect(preloads.length).toBe(23);
+ expect(preloads.length).toBe(24);
for (const host of ["127.0.0.1", "localhost", "[::1]"]) preloadScreens(host);
vi.runAllTimers();
for (const preload of preloads) expect(preload).not.toHaveBeenCalled();
@@ -200,7 +200,7 @@ describe("preloadScreens", () => {
preloadScreens("cloud.example");
for (const preload of preloads) expect(preload).not.toHaveBeenCalled();
await vi.advanceTimersByTimeAsync(60_000);
- const rarelyOpened = [screens.CloudAddDialog, screens.GrokMoveDialog, screens.PhoneAppDialog, screens.ShareDepartmentDialog, screens.ImportDialog, screens.TeamLibraryPanel, screens.TeamFilesPage];
+ const rarelyOpened = [screens.CloudAddDialog, screens.GrokMoveDialog, screens.PhoneAppDialog, screens.ShareDepartmentDialog, screens.ImportDialog, screens.TeamLibraryPanel, screens.TeamFilesPage, screens.AnnouncementsPage];
const stubbed = Object.values(screens).filter((value): value is ReturnType<typeof lazyScreen> => typeof value === "function" && "preload" in value);
for (const screen of stubbed) expect(screen.preload).toHaveBeenCalledTimes(rarelyOpened.includes(screen as never) ? 0 : 1);
expect(preloads.length).toBe(stubbed.length);
diff --git a/src/components/lazy-screens.tsx b/src/components/lazy-screens.tsx
index f8b04dc220..847f742185 100644
--- a/src/components/lazy-screens.tsx
+++ b/src/components/lazy-screens.tsx
@@ -81,6 +81,7 @@ export const TriggersPage = lazyScreen("TriggersPage", async () => (await import
export const SettingsModal = lazyScreen("SettingsModal", async () => (await import("./SettingsModal")).SettingsModal);
export const TeamMapPage = lazyScreen("TeamMapPage", async () => (await import("./TeamMapPage")).TeamMapPage);
export const PublishedAppsPage = lazyScreen("PublishedAppsPage", async () => (await import("./published-apps/PublishedAppsPage")).PublishedAppsPage);
+export const AnnouncementsPage = lazyScreen("AnnouncementsPage", async () => (await import("./announcements/AnnouncementsPage")).AnnouncementsPage);
// Rarely opened, so never fetched ahead. The team library is what brings the YAML parser in.
export const CloudAddDialog = lazyScreen("CloudAddDialog", async () => (await import("./CloudAddDialog")).CloudAddDialog);
diff --git a/src/components/notice-dialogs.ts b/src/components/notice-dialogs.ts
index 43253f64a2..05fdffd7a2 100644
--- a/src/components/notice-dialogs.ts
+++ b/src/components/notice-dialogs.ts
@@ -1,37 +1,31 @@
import { useEffect, useState } from "react";
-import type { DesktopNoticesBridge, DesktopNoticesState } from "../../electron/desktop-prefs.mjs";
import { GROK_MOVE_POPUP } from "./GrokMovePopup";
import { NEW_LOOK_NOTICE } from "./NewLookNotice";
import { SIMPLE_MODE_PROMPT } from "./SimpleModePrompt";
import { UPDATES_CONSENT_POPUP } from "./UpdatesConsent";
+import { TEAMS_POPUP } from "./whats-new/TeamsPopup";
import { WHATS_NEW_POPUP } from "./whats-new/WhatsNewPopup";
-/** null until main answers; a page main refuses has nothing due. */
-export function useDesktopNotices(desktop: DesktopNoticesBridge | undefined): DesktopNoticesState | null {
- const [answer, setAnswer] = useState<DesktopNoticesState | null>(null);
- useEffect(() => {
- if (!desktop) return;
- let active = true;
- void desktop.state().then(next => { if (active) setAnswer(next); }, () => { if (active) setAnswer({ seen: [], cloud: false }); });
- return () => { active = false; };
- }, [desktop]);
- return desktop ? answer : null;
-}
+export { useDesktopNotices } from "./desktop-notices";
const OTHER_DIALOGS = '[role="dialog"], [role="alertdialog"], [aria-modal="true"], [data-tour-card], [data-cloud-setup-ready]';
-const QUEUE_POPUPS = [GROK_MOVE_POPUP, WHATS_NEW_POPUP, UPDATES_CONSENT_POPUP, SIMPLE_MODE_PROMPT, NEW_LOOK_NOTICE].join(", ");
+const QUEUE_POPUPS = [TEAMS_POPUP, GROK_MOVE_POPUP, WHATS_NEW_POPUP, UPDATES_CONSENT_POPUP, SIMPLE_MODE_PROMPT, NEW_LOOK_NOTICE].join(", ");
+/** A first run's own screens on a Cloud: its welcome, its first ask and a team's welcome to a new member. */
+const FIRST_SCREENS = "[data-cloud-welcome], [data-cloud-intent], [data-team-welcome]";
-/** 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(QUEUE_POPUPS) && element.checkVisibility());
+/** 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.
+ * `firstScreens`: a first run's own screens count too. */
+export function otherDialogOpen(firstScreens = false): boolean {
+ const selector = firstScreens ? `${OTHER_DIALOGS}, ${FIRST_SCREENS}` : OTHER_DIALOGS;
+ return [...document.querySelectorAll<HTMLElement>(selector)].some(element => !element.closest(QUEUE_POPUPS) && element.checkVisibility());
}
-export function useOtherDialogOpen(watch: boolean): boolean {
+export function useOtherDialogOpen(watch: boolean, firstScreens = false): boolean {
const [, setOpen] = useState(false);
useEffect(() => {
if (!watch) return;
- const timer = setInterval(() => setOpen(otherDialogOpen()), 1_000);
+ const timer = setInterval(() => setOpen(otherDialogOpen(firstScreens)), 1_000);
return () => clearInterval(timer);
- }, [watch]);
- return watch && otherDialogOpen();
+ }, [watch, firstScreens]);
+ return watch && otherDialogOpen(firstScreens);
}
diff --git a/src/components/whats-new/TeamsPopup.test.ts b/src/components/whats-new/TeamsPopup.test.ts
new file mode 100644
index 0000000000..7b9b2170a3
--- /dev/null
+++ b/src/components/whats-new/TeamsPopup.test.ts
@@ -0,0 +1,92 @@
+// @vitest-environment happy-dom
+import { readFileSync } from "node:fs";
+import { join } from "node:path";
+import { act, createElement } 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 type { TeamsAction } from "@/lib/teams-whats-new";
+
+const avatars = vi.hoisted(() => [] as Array<{ animated?: boolean }>);
+vi.mock("@/components/Avatar", () => ({ MausAvatar: (props: { animated?: boolean }) => { avatars.push(props); return null; } }));
+const { TeamsPopup, TEAMS_POPUP } = await import("./TeamsPopup");
+
+(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true;
+let host: HTMLDivElement, root: Root | null = null;
+const onStep = vi.fn(), onStart = vi.fn(), onDone = vi.fn();
+async function show(action: TeamsAction) {
+ root = createRoot(host);
+ await act(async () => { root!.render(createElement(TeamsPopup, { action, onStep, onStart, onDone })); });
+ return document.querySelector<HTMLElement>(TEAMS_POPUP)!;
+}
+const key = async (name: string, shiftKey = false) => {
+ await act(async () => { window.dispatchEvent(new KeyboardEvent("keydown", { key: name, shiftKey, bubbles: true, cancelable: true })); });
+};
+const buttons = (popup: HTMLElement) => [...popup.querySelectorAll("button")].map(button => button.textContent || button.getAttribute("aria-label"));
+
+beforeEach(() => {
+ setLocale("en"); avatars.length = 0; vi.clearAllMocks();
+ delete document.documentElement.dataset.reducedMotion;
+ host = document.createElement("div"); document.body.append(host);
+});
+afterEach(async () => { await act(async () => root?.unmount()); root = null; host.remove(); });
+
+describe("the Teams popup", () => {
+ it("each audience has its own buttons: invite for a team's admins, Got it for its members, Start a team and Not now for everyone else", async () => {
+ let popup = await show({ kind: "start", inApp: true, url: "https://cloud.example/pro/buy" });
+ expect(popup.getAttribute("role")).toBe("dialog");
+ expect(popup.textContent).toContain("MausBot is better with your team");
+ expect(popup.textContent).toContain("$40 a month for 2 people, $20 for each extra person.");
+ expect(buttons(popup)).toEqual(["Start a team", "Not now", "Close"]);
+ expect(document.activeElement?.textContent, "focus starts at its main button").toBe("Start a team");
+ await act(async () => { (popup.querySelector("[data-primary] button") as HTMLElement).click(); });
+ expect(onStart).toHaveBeenCalled();
+ expect(onStep.mock.calls.map(([step]) => step)).toEqual(["seen", "start_team"]);
+ expect(onDone).toHaveBeenCalledTimes(1);
+ await act(async () => root?.unmount()); root = null;
+
+ popup = await show({ kind: "got-it" });
+ expect(buttons(popup)).toEqual(["Got it", "Close"]);
+ await act(async () => root?.unmount()); root = null;
+ popup = await show({ kind: "invite", url: "https://admin.example/cloud/team/t/people?do=invite" });
+ expect(buttons(popup)).toEqual(["Invite your team", "Not now", "Close"]);
+ });
+
+ it("Escape closes it, and Tab keeps focus inside", async () => {
+ const popup = await show({ kind: "start", inApp: false, url: "https://cloud.example/pro/buy" });
+ const list = [...popup.querySelectorAll<HTMLElement>("button")];
+ list.at(-1)!.focus();
+ await key("Tab");
+ expect(document.activeElement).toBe(list[0]);
+ await key("Tab", true);
+ expect(document.activeElement).toBe(list.at(-1));
+ await key("Escape");
+ expect(onStep).toHaveBeenLastCalledWith("close");
+ expect(onDone).toHaveBeenCalledTimes(1);
+ });
+
+ it("the card grows in and four teammates join the bot one after another, all within about 600 ms", async () => {
+ const popup = await show({ kind: "got-it" });
+ expect(popup.className).toContain("teams-card-in");
+ const faces = [...popup.querySelectorAll<HTMLElement>("[data-teams-face]")];
+ expect(faces.map(face => face.dataset.teamsFace)).toEqual(["Ada", "Ben", "Cleo", "Dara"]);
+ expect(faces.map(face => face.style.getPropertyValue("--face"))).toEqual(["0", "1", "2", "3"]);
+ for (const face of faces) expect(face.className).toContain("teams-face-in");
+ expect(avatars.at(-1)?.animated).toBe(true);
+ const css = readFileSync(join(process.cwd(), "src", "styles.css"), "utf8").replace(/\r\n/g, "\n");
+ const ms = (pattern: RegExp) => Number(pattern.exec(css)![1]);
+ const card = ms(/\.teams-card-in \{ animation: teams-card-in (\d+)ms/), face = ms(/\.teams-face-in \{ animation: teams-face-in (\d+)ms/);
+ const [, start, step] = /animation-delay: calc\((\d+)ms \+ var\(--face, 0\) \* (\d+)ms\)/.exec(css)!.map(Number);
+ expect(Math.max(card, start! + 3 * step! + face)).toBeLessThanOrEqual(650);
+ expect(css, "each rests visible").toMatch(/@keyframes teams-face-in \{\n from \{ opacity: 0;[^}]*\}\n to \{ opacity: 1;/);
+ });
+
+ it("with reduced motion nothing moves: no entrance, no faces flying in, a still bot", async () => {
+ const css = readFileSync(join(process.cwd(), "src", "styles.css"), "utf8").replace(/\r\n/g, "\n");
+ expect(css).toMatch(/@media \(prefers-reduced-motion: reduce\) \{\n \.teams-card-in, \.teams-face-in \{ animation: none; \}/);
+ expect(css).toMatch(/:root\[data-reduced-motion="true"\] \.teams-card-in,\n:root\[data-reduced-motion="true"\] \.teams-face-in \{\n animation: none !important;/);
+ document.documentElement.dataset.reducedMotion = "true";
+ await show({ kind: "got-it" });
+ expect(avatars.at(-1)?.animated).toBe(false);
+ });
+});
diff --git a/src/components/whats-new/TeamsPopup.tsx b/src/components/whats-new/TeamsPopup.tsx
new file mode 100644
index 0000000000..92ac5b09d3
--- /dev/null
+++ b/src/components/whats-new/TeamsPopup.tsx
@@ -0,0 +1,117 @@
+import { useEffect, type CSSProperties } from "react";
+import { Bot, FolderOpen, Lock, X } from "lucide-react";
+import { MausAvatar } from "@/components/Avatar";
+import { cn } from "@/lib/cn";
+import { t } from "@/lib/i18n";
+import type { MausColor } from "@/lib/mascot";
+import { reducedMotion } from "@/lib/onboarding";
+import type { TeamsAction, TeamsStep } from "@/lib/teams-whats-new";
+import type { LocaleKey } from "@/locales";
+import { CLOSE, PRIMARY, SHEET } from "../cloud-buy/parts";
+import { LinkButton, NotNowButton } from "../NoticeCard";
+
+export const TEAMS_POPUP = "[data-teams-popup]";
+const TITLE = "teams-popup-title";
+
+const POINTS: readonly { icon: typeof Bot; text: LocaleKey }[] = [
+ { icon: Bot, text: "teamsNew.sharedBot" },
+ { icon: FolderOpen, text: "teamsNew.files" },
+ { icon: Lock, text: "teamsNew.private" },
+];
+/** Made-up teammates who join the one shared bot, two on each side; each comes in from further out. */
+const FACES: readonly { name: string; color: MausColor; x: number; y: number }[] = [
+ { name: "Ada", color: "purple", x: -92, y: -26 },
+ { name: "Ben", color: "teal", x: -76, y: 30 },
+ { name: "Cleo", color: "coral", x: 92, y: -26 },
+ { name: "Dara", color: "blue", x: 76, y: 30 },
+];
+
+const focusLost = (focus: Element | null) => !focus || focus === document.body || !focus.isConnected;
+
+/** One bot in the middle and four teammates joining it, one after another while motion is allowed (styles.css
+ * teams-face-in); still and complete without it. */
+function TeamsPicture() {
+ const animated = !reducedMotion();
+ return <div aria-hidden="true" data-teams-picture="" className="relative h-[132px] shrink-0 overflow-hidden bg-ink/[0.035] [@media(max-height:560px)]:hidden">
+ <div className="absolute left-1/2 top-1/2 size-0">
+ <span className="absolute -left-[60px] -top-[60px] size-[120px] rounded-full bg-[radial-gradient(circle,color-mix(in_srgb,var(--color-accent)_16%,transparent),transparent_70%)]" />
+ <span className="absolute -left-7 -top-7"><MausAvatar color="chrome" size={56} state="idle" animated={animated} trackPointer={false} /></span>
+ {FACES.map((face, index) => <span key={face.name} data-teams-face={face.name}
+ className="teams-face-in absolute flex size-9 items-center justify-center rounded-full text-[14px] font-semibold ring-2 ring-app"
+ style={{ left: face.x - 18, top: face.y - 18, color: `var(--identity-${face.color})`, background: `color-mix(in srgb, var(--identity-${face.color}) 22%, var(--color-card))`,
+ "--face": index, "--from-x": `${Math.sign(face.x) * 14}px` } as CSSProperties}>{face.name[0]}</span>)}
+ </div>
+ </div>;
+}
+
+/**
+ * "MausBot is better with your team": once per person after this release (AppNotices), and again from Announcements.
+ * Focus starts at its main button and stays inside; Escape, ×, a click outside and every button end it.
+ */
+export function TeamsPopup({ action, onStep, onStart, onDone }: {
+ action: TeamsAction;
+ onStep: (step: TeamsStep) => void;
+ /** Start a team in the app's own Add a Cloud (action.inApp). */
+ onStart: () => void;
+ onDone: () => void;
+}) {
+ const end = (step: TeamsStep) => { onStep(step); onDone(); };
+ useEffect(() => {
+ onStep("seen");
+ const opener = document.activeElement as HTMLElement | null, mine = document.querySelector(TEAMS_POPUP);
+ mine?.querySelector<HTMLElement>("[data-primary] button, button[data-primary]")?.focus();
+ return () => {
+ const focus = document.activeElement;
+ if ((focusLost(focus) || mine?.contains(focus)) && opener?.isConnected && opener !== document.body) opener.focus();
+ };
+ }, []);
+ useEffect(() => {
+ const onKey = (event: KeyboardEvent) => {
+ const popup = document.querySelector(TEAMS_POPUP), focus = document.activeElement;
+ if (!popup || (!popup.contains(focus) && !focusLost(focus))) return;
+ if (event.key === "Escape") { event.preventDefault(); event.stopPropagation(); end("close"); return; }
+ if (event.key !== "Tab") return;
+ const list = [...popup.querySelectorAll<HTMLElement>("button:not([disabled])")];
+ if (!list.length) return;
+ event.preventDefault();
+ const at = list.indexOf(focus as HTMLElement), step = event.shiftKey ? -1 : 1;
+ list[at === -1 ? (step > 0 ? 0 : list.length - 1) : (at + step + list.length) % list.length]!.focus();
+ };
+ window.addEventListener("keydown", onKey, true);
+ return () => window.removeEventListener("keydown", onKey, true);
+ });
+
+ const main = action.kind === "invite"
+ ? <LinkButton url={action.url} label={t("teamsNew.invite")} className={cn(PRIMARY, "ui-button-lg gap-1.5")} onOpened={() => end("invite")} />
+ : action.kind === "got-it"
+ ? <button type="button" className={cn(PRIMARY, "ui-button-lg")} onClick={() => end("got_it")}>{t("teamsNew.gotIt")}</button>
+ : action.inApp
+ ? <button type="button" className={cn(PRIMARY, "ui-button-lg")} onClick={() => { onStart(); end("start_team"); }}>{t("teamsNew.start")}</button>
+ : <LinkButton url={action.url} label={t("teamsNew.start")} className={cn(PRIMARY, "ui-button-lg gap-1.5")} onOpened={() => end("start_team")} />;
+
+ return <div className="ui-scrim fixed inset-0 z-50 flex items-center justify-center p-4 sm:p-6" onMouseDown={event => { if (event.target === event.currentTarget) end("close"); }}>
+ <div role="dialog" aria-modal="true" aria-labelledby={TITLE} data-teams-popup={action.kind} tabIndex={-1}
+ className={cn(SHEET, "teams-card-in relative flex max-h-full w-full max-w-[460px] flex-col overflow-hidden outline-none")}>
+ <div className="flex min-h-0 flex-col overflow-y-auto">
+ <TeamsPicture />
+ <div className="flex flex-col px-6 pb-5 pt-5">
+ <p className="text-[12px] font-medium uppercase leading-4 tracking-[0.06em] text-ink-tertiary">{t("whatsNew.eyebrow")}</p>
+ <h2 id={TITLE} className="mt-1 text-[19px] font-semibold leading-6 tracking-[-0.012em] text-ink [text-wrap:balance]">{t("teamsNew.title")}</h2>
+ <ul className="mt-3 flex flex-col gap-2 text-[14px] leading-5 text-ink">
+ {POINTS.map(({ icon: Icon, text }) => <li key={text} className="flex items-start gap-2.5">
+ <span className="mt-px flex size-[18px] shrink-0 items-center justify-center text-ink-secondary"><Icon size={16} strokeWidth={1.75} aria-hidden="true" /></span>
+ <span className="[text-wrap:pretty]">{t(text)}</span>
+ </li>)}
+ </ul>
+ <p data-teams-price className="mt-3 text-[13px] leading-[18px] text-ink-secondary">{t("teamsNew.price")}</p>
+ <div className="mt-5 flex flex-wrap items-center gap-3">
+ <div data-primary="">{main}</div>
+ {action.kind !== "got-it" && <NotNowButton onClick={() => end("not_now")} />}
+ </div>
+ </div>
+ </div>
+ <button type="button" onClick={() => end("close")} aria-label={t("cloudAdd.close")}
+ className={cn(CLOSE, "absolute end-3 top-3 z-10 bg-app/80 backdrop-blur-sm")}><X size={16} /></button>
+ </div>
+ </div>;
+}
diff --git a/src/lib/announcement-history.test.ts b/src/lib/announcement-history.test.ts
new file mode 100644
index 0000000000..e8ff33db6b
--- /dev/null
+++ b/src/lib/announcement-history.test.ts
@@ -0,0 +1,147 @@
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+vi.mock("@/state/store", () => ({ api: vi.fn() }));
+import { api } from "@/state/store";
+import { EMPTY_ONBOARDING, type OnboardingStatus } from "@/lib/onboarding";
+import { BOAT_OFFER_NOTICE, CLOUD_INTRO, GROK_MOVE_NOTICE, MODELGO_OFFER_NOTICE, PRODUCT_HUNT_NOTICE, PRODUCT_HUNT_UNTIL, TEAMS_NOTICE, WHATS_NEW_NOTICE } from "@/lib/notices";
+import { announcementHistory, announcementsReadAt, announcementsUnread, BUILT_IN_ANNOUNCEMENTS, markAnnouncementsRead, READ_BASELINE, readMark, rememberNoticeSeen,
+ type HistoryFacts, type PersonRecord } from "./announcement-history";
+import { announcementsReadAt as readMarkOf, newestReadMarkOnly, personalHints, teamPersonalHint } from "../../shared/cloud-hints";
+import type { AnnouncementCard } from "../../shared/announcements";
+
+const NOW = Date.parse("2026-11-18T10:00:00Z");
+const desktopHere: HistoryFacts = { branded: false, organization: false, cloudSale: true, cloudCards: true, remote: false, team: false, canSave: true, sponsors: true, modelgo: true };
+const record = (hintsSeen: string[] = []): OnboardingStatus => ({ ...EMPTY_ONBOARDING, completedAt: "2026-09-01", version: 1, hintsSeen });
+const card = (id: string, extra: Partial<AnnouncementCard> = {}): AnnouncementCard => ({ id, kind: "product", title: `Card ${id}`, body: "Words",
+ primary: { label: "Open", action: { open_url: "https://example.com" } }, ends: "2027-01-01T00:00:00Z", ...extra } as AnnouncementCard);
+const ids = (facts: HistoryFacts, cards: AnnouncementCard[] = [], feedUpdatedAt: number | null = null) =>
+ announcementHistory({ facts, cards, feedUpdatedAt, now: NOW }).map(item => item.id);
+
+let storage: Map<string, string>;
+beforeEach(() => {
+ storage = new Map();
+ vi.stubGlobal("localStorage", { getItem: (key: string) => storage.get(key) ?? null, setItem: (key: string, value: string) => storage.set(key, value) });
+ vi.mocked(api).mockReset();
+});
+afterEach(() => vi.unstubAllGlobals());
+
+describe("the built-in announcements", () => {
+ it("are one registry, each with its notice id, a date and its words, newest first, Teams at the top", () => {
+ expect(ids(desktopHere)).toEqual([TEAMS_NOTICE, MODELGO_OFFER_NOTICE, GROK_MOVE_NOTICE, WHATS_NEW_NOTICE, BOAT_OFFER_NOTICE, PRODUCT_HUNT_NOTICE, CLOUD_INTRO]);
+ for (const entry of BUILT_IN_ANNOUNCEMENTS) expect(Number.isFinite(Date.parse(entry.date)), entry.id).toBe(true);
+ expect(BUILT_IN_ANNOUNCEMENTS.find(entry => entry.id === TEAMS_NOTICE)?.open).toEqual({ modal: "teams" });
+ });
+
+ it("list only what was for this person here, by each one's own rules", () => {
+ expect(ids({ ...desktopHere, branded: true }), "a branded build: nothing").toEqual([]);
+ expect(ids({ ...desktopHere, organization: true }), "an organization's desktop: only the sponsor offers it allows")
+ .toEqual([MODELGO_OFFER_NOTICE, BOAT_OFFER_NOTICE]);
+ expect(ids({ ...desktopHere, organization: null }), "while that is read, nothing else").toEqual([MODELGO_OFFER_NOTICE, BOAT_OFFER_NOTICE]);
+ const browser: HistoryFacts = { ...desktopHere, cloudSale: false, cloudCards: false };
+ expect(ids(browser), "a browser: no Cloud sales").toEqual([TEAMS_NOTICE, MODELGO_OFFER_NOTICE, GROK_MOVE_NOTICE, BOAT_OFFER_NOTICE]);
+ const member: HistoryFacts = { ...browser, team: true, canSave: false, sponsors: false };
+ expect(ids(member), "a Team Cloud's member: Teams alone").toEqual([TEAMS_NOTICE]);
+ expect(ids({ ...member, canSave: true, sponsors: true }), "its admin: the sponsor offers too, never the Grok Bot move")
+ .toEqual([TEAMS_NOTICE, MODELGO_OFFER_NOTICE, BOAT_OFFER_NOTICE]);
+ });
+
+ it("an offer whose time is over is Ended; one still running is not", () => {
+ const items = announcementHistory({ facts: desktopHere, cards: [], feedUpdatedAt: null, now: NOW });
+ const ended = (id: string) => items.find(item => item.id === id)?.source === "built-in" && (items.find(item => item.id === id) as { ended: boolean }).ended;
+ expect(NOW).toBeGreaterThan(PRODUCT_HUNT_UNTIL);
+ expect(ended(PRODUCT_HUNT_NOTICE)).toBe(true);
+ expect(ended(BOAT_OFFER_NOTICE)).toBe(false);
+ expect(ended(MODELGO_OFFER_NOTICE)).toBe(false);
+ });
+
+ it("a card from the file sits by its starts, else by when the file changed, among them", () => {
+ const cards = [card("later", { starts: "2026-11-20T00:00:00Z" }), card("undated"), card("old", { starts: "2026-10-20T00:00:00Z" })];
+ expect(ids(desktopHere, cards, Date.parse("2026-11-12T00:00:00Z")))
+ .toEqual(["later", TEAMS_NOTICE, "undated", MODELGO_OFFER_NOTICE, GROK_MOVE_NOTICE, WHATS_NEW_NOTICE, BOAT_OFFER_NOTICE, "old", PRODUCT_HUNT_NOTICE, CLOUD_INTRO]);
+ });
+});
+
+describe("the red dot", () => {
+ const items = (cards: AnnouncementCard[] = []) => announcementHistory({ facts: desktopHere, cards, feedUpdatedAt: null, now: NOW });
+ const person = (hints: string[] = [], desktopSeen: string[] = []): PersonRecord => ({ record: record(hints), desktopSeen });
+
+ it("first run: everything up to the last announcement before Teams counts as read, so someone who used the app before has the dot for Teams alone", () => {
+ expect(READ_BASELINE).toBe(Date.parse("2026-11-11"));
+ expect(announcementsReadAt(person())).toBe(READ_BASELINE);
+ expect(announcementsUnread(items(), person())).toBe(true);
+ const withoutTeams = items().filter(item => item.id !== TEAMS_NOTICE);
+ expect(announcementsUnread(withoutTeams, person()), "nothing older raises it").toBe(false);
+ });
+
+ it("goes once they saw the Teams popup, wherever it was recorded", () => {
+ expect(announcementsUnread(items(), person([TEAMS_NOTICE]))).toBe(false);
+ expect(announcementsUnread(items(), person([], [TEAMS_NOTICE])), "this desktop's record").toBe(false);
+ storage.set(TEAMS_NOTICE, "1");
+ expect(announcementsUnread(items(), person()), "this browser").toBe(false);
+ });
+
+ it("comes back for something newer than their last look that they have not seen", () => {
+ const later = card("phone-app", { starts: "2026-11-25T00:00:00Z" });
+ const read = person([TEAMS_NOTICE, readMark(Date.parse("2026-11-20T00:00:00Z"))]);
+ expect(announcementsUnread(items(), read)).toBe(false);
+ expect(announcementsUnread(items([later]), read)).toBe(true);
+ expect(announcementsUnread(items([later]), person([TEAMS_NOTICE, readMark(Date.parse("2026-11-20T00:00:00Z")), "announcement:phone-app"])), "a card they closed").toBe(false);
+ });
+
+ it("the newest of the browser's, the desktop's and the place's record counts", () => {
+ storage.set("omb.announcements.read-at", String(Date.parse("2026-11-19T00:00:00Z")));
+ expect(announcementsReadAt(person([readMark(Date.parse("2026-11-18T00:00:00Z"))], [readMark(Date.parse("2026-11-21T00:00:00Z"))]))).toBe(Date.parse("2026-11-21T00:00:00Z"));
+ expect(announcementsReadAt(person([readMark(Date.parse("2026-11-22T00:00:00Z"))]))).toBe(Date.parse("2026-11-22T00:00:00Z"));
+ });
+});
+
+describe("opening Announcements and seeing a popup", () => {
+ const desktop = { seen: vi.fn(async () => {}) };
+ beforeEach(() => desktop.seen.mockClear());
+
+ it("on a page of one's own: the place's record keeps one read mark, the newest, beside its other hints, and the desktop's record keeps it too", async () => {
+ vi.mocked(api).mockResolvedValue({ saved: true });
+ const saved = vi.fn();
+ markAnnouncementsRead(NOW, record(["tour-finished", readMark(1)]), { team: false, desktop, saved });
+ await Promise.resolve(); await Promise.resolve();
+ expect(storage.get("omb.announcements.read-at")).toBe(String(NOW));
+ expect(desktop.seen).toHaveBeenCalledWith(readMark(NOW));
+ expect(vi.mocked(api).mock.calls).toEqual([["/api/config", { method: "PUT", body: JSON.stringify({ onboarding: { hintsSeen: ["tour-finished", readMark(NOW)] } }) }]]);
+ expect(saved).toHaveBeenCalledWith({ saved: true });
+ expect(announcementsReadAt({ record: undefined, desktopSeen: [] })).toBe(NOW);
+ });
+
+ it("on a Team Cloud: the person's own record, which members may write too, then the place's record read back", async () => {
+ vi.mocked(api).mockImplementation(async path => (path === "/api/config" ? { onboarding: { hintsSeen: [readMark(NOW)] } } : { welcome: {} }));
+ const saved = vi.fn();
+ markAnnouncementsRead(NOW, record(["teams-2026-11"]), { team: true, saved });
+ for (let i = 0; i < 5; i++) await Promise.resolve();
+ expect(vi.mocked(api).mock.calls).toEqual([["/api/me/welcome", { method: "PUT", body: JSON.stringify({ hints: [readMark(NOW)] }) }], ["/api/config"]]);
+ expect(saved).toHaveBeenCalledWith({ onboarding: { hintsSeen: [readMark(NOW)] } });
+ vi.mocked(api).mockClear();
+ rememberNoticeSeen(TEAMS_NOTICE, record(), { team: true, desktop, saved });
+ expect(vi.mocked(api).mock.calls[0]).toEqual(["/api/me/welcome", { method: "PUT", body: JSON.stringify({ hints: [TEAMS_NOTICE] }) }]);
+ expect(storage.get(TEAMS_NOTICE)).toBe("1");
+ expect(desktop.seen).toHaveBeenCalledWith(TEAMS_NOTICE);
+ });
+
+ it("a failed save leaves the browser's record, and nothing throws", async () => {
+ vi.mocked(api).mockRejectedValue(new Error("offline"));
+ expect(() => markAnnouncementsRead(NOW, record(), { team: false, saved: vi.fn() })).not.toThrow();
+ await Promise.resolve();
+ expect(storage.get("omb.announcements.read-at")).toBe(String(NOW));
+ });
+});
+
+describe("a Team Cloud's personal record", () => {
+ it("keeps the Teams popup and the read mark each person's own, the newest read mark only", () => {
+ expect(teamPersonalHint(TEAMS_NOTICE)).toBe(true);
+ expect(teamPersonalHint(readMark(NOW))).toBe(true);
+ expect(teamPersonalHint("announcements-read-x")).toBe(false);
+ expect(teamPersonalHint(GROK_MOVE_NOTICE), "other notices stay the team's").toBe(false);
+ expect(newestReadMarkOnly(["a", readMark(5), readMark(9), "b", readMark(7)])).toEqual(["a", readMark(9), "b"]);
+ expect(readMarkOf(["a"])).toBeNull();
+ const own = [TEAMS_NOTICE, readMark(9)], team = ["tour-finished", TEAMS_NOTICE, readMark(3)];
+ expect(personalHints(team, own, false), "a member reads the team's steps and their own marks").toEqual(["tour-finished", TEAMS_NOTICE, readMark(9)]);
+ expect(personalHints(team, [], false), "nobody else's").toEqual(["tour-finished"]);
+ });
+});
diff --git a/src/lib/announcement-history.ts b/src/lib/announcement-history.ts
new file mode 100644
index 0000000000..666ff29ad1
--- /dev/null
+++ b/src/lib/announcement-history.ts
@@ -0,0 +1,169 @@
+// Announcements: everything the app has announced to people, newest first, and the red dot while one is newer than the
+// person last looked. The built-in ones are listed here, one entry each (docs/announcements.md says how to add one); the
+// cards from the project's announcements file come from src/lib/announcements.ts.
+import { useSyncExternalStore } from "react";
+import { BOAT_OFFER, boatClaimMailto } from "@/lib/boat-offer";
+import type { CloudSource } from "@/lib/cloud-plan";
+import type { OnboardingStatus } from "@/lib/onboarding";
+import { BOAT_OFFER_NOTICE, CLOUD_INTRO, dismissNotice, GROK_MOVE_NOTICE, MODELGO_OFFER_NOTICE, noticeSeen, PRODUCT_HUNT_NOTICE, PRODUCT_HUNT_UNTIL, PRODUCT_HUNT_URL,
+ TEAMS_NOTICE, WHATS_NEW_NOTICE } from "@/lib/notices";
+import type { LocaleKey } from "@/locales";
+import type { ConfigStatus } from "@/state/config-status";
+import { api } from "@/state/store";
+import { ANNOUNCEMENTS_READ_HINT, announcementsReadAt as readMarkOf } from "../../shared/cloud-hints";
+import { MODELGO_URL } from "../../shared/modelgo";
+import type { AnnouncementCard } from "../../shared/announcements";
+
+/** What decides whom a built-in announcement was for, by its own rules (never whether they saw it, nor its dates). */
+export interface HistoryFacts {
+ /** A branded build: none of them. */
+ branded: boolean;
+ /** An organization runs this desktop; null while that is read. */
+ organization: boolean | null;
+ /** This desktop's own page, which sells MausBot Cloud (its Cloud sign-in). */
+ cloudSale: boolean;
+ /** This page shows the Cloud's own cards: This computer's page with its sign-in, or a Cloud's page in the desktop. */
+ cloudCards: boolean;
+ /** The desktop app connected to another computer as its client. */
+ remote: boolean;
+ /** A Team Cloud's page. */
+ team: boolean;
+ /** This person may change this place's settings. */
+ canSave: boolean;
+ /** A sponsor's card may reach this person (src/lib/announcements.ts SPONSOR_CARDS_FOR_TEAM_MEMBERS). */
+ sponsors: boolean;
+ /** ModelGo may be offered here (src/lib/modelgo-offer.ts modelgoOfferable). */
+ modelgo: boolean;
+}
+
+export type HistoryMark = "teams" | "cloud" | "boat" | "modelgo" | "grok" | "product-hunt";
+/** A popup the Announcements page opens again. */
+export type HistoryModal = "teams" | "whats-new" | "grok-move";
+export type HistoryAction = { open_url: string } | { email: string } | { cloud_add: CloudSource } | { cloud_how_to: true };
+export interface HistoryButton { label: LocaleKey; action: HistoryAction }
+
+export interface BuiltInAnnouncement {
+ /** Its notice id (src/lib/notices.ts), which also keeps whether the person saw it. */
+ id: string;
+ /** When it first reached people: an ISO date (UTC midnight) or date and time. */
+ date: string;
+ title: LocaleKey;
+ body: LocaleKey;
+ mark: HistoryMark;
+ for(facts: HistoryFacts): boolean;
+ /** A popup opens again; a card shows its buttons, the first one primary. */
+ open: { modal: HistoryModal } | { buttons: readonly HistoryButton[] };
+ /** An offer's end (epoch ms): after it, Ended in place of its buttons. */
+ until?: number | null;
+}
+
+const everywhere = (facts: HistoryFacts) => !facts.branded && facts.organization === false;
+
+export const BUILT_IN_ANNOUNCEMENTS: readonly BuiltInAnnouncement[] = [
+ { id: TEAMS_NOTICE, date: "2026-11-17", title: "teamsNew.title", body: "teamsNew.sharedBot", mark: "teams", for: everywhere, open: { modal: "teams" } },
+ { id: MODELGO_OFFER_NOTICE, date: "2026-11-11", title: "modelgoOffer.title", body: "modelgoOffer.line", mark: "modelgo", for: facts => facts.sponsors && facts.modelgo && !facts.branded,
+ open: { buttons: [{ label: "modelgoOffer.getKey", action: { open_url: MODELGO_URL } }] } },
+ { id: GROK_MOVE_NOTICE, date: "2026-11-04", title: "settings.import.grokTitle", body: "grokMove.popup.body", mark: "grok",
+ for: facts => everywhere(facts) && !facts.remote && facts.canSave && !facts.team, open: { modal: "grok-move" } },
+ { id: WHATS_NEW_NOTICE, date: "2026-10-31", title: "whatsNew.cloud.title", body: "whatsNew.cloud.body", mark: "cloud",
+ for: facts => everywhere(facts) && facts.cloudSale, open: { modal: "whats-new" } },
+ { id: BOAT_OFFER_NOTICE, date: "2026-10-31", title: "boatOffer.title", body: "boatOffer.body", mark: "boat", for: facts => facts.sponsors && !facts.branded,
+ open: { buttons: [{ label: "boatOffer.get", action: { open_url: BOAT_OFFER.url } }, { label: "boatOffer.claim", action: { email: boatClaimMailto() } }] }, until: BOAT_OFFER.until },
+ { id: PRODUCT_HUNT_NOTICE, date: "2026-10-13", title: "productHunt.title", body: "productHunt.body", mark: "product-hunt",
+ for: facts => everywhere(facts) && facts.cloudCards, open: { buttons: [{ label: "productHunt.button", action: { open_url: PRODUCT_HUNT_URL } }] }, until: PRODUCT_HUNT_UNTIL },
+ { id: CLOUD_INTRO, date: "2026-10-09", title: "cloudIntro.title", body: "cloudIntro.body", mark: "cloud", for: facts => everywhere(facts) && facts.cloudSale,
+ open: { buttons: [{ label: "cloudIntro.start", action: { cloud_add: "app_card" } }, { label: "cloudIntro.howTo", action: { cloud_how_to: true } }] } },
+];
+
+/** Where the person stands before they ever open Announcements: everything up to the newest announcement before Teams
+ * counts as read, so only Teams raises the dot for people who used the app before it. */
+export const READ_BASELINE = Date.parse("2026-11-11");
+
+export type HistoryItem =
+ | { source: "built-in"; id: string; at: number; entry: BuiltInAnnouncement; ended: boolean }
+ | { source: "feed"; id: string; at: number; card: AnnouncementCard };
+
+/** Newest first; a feed card is dated by its `starts`, else by when its file last changed, else now. */
+export function announcementHistory({ facts, cards, feedUpdatedAt, now }: {
+ facts: HistoryFacts; cards: readonly AnnouncementCard[]; feedUpdatedAt: number | null; now: number;
+}): HistoryItem[] {
+ const builtIn: HistoryItem[] = BUILT_IN_ANNOUNCEMENTS.filter(entry => entry.for(facts)).map(entry => ({
+ source: "built-in", id: entry.id, at: Date.parse(entry.date), entry, ended: typeof entry.until === "number" && now >= entry.until,
+ }));
+ const feed: HistoryItem[] = cards.map(card => ({ source: "feed", id: card.id, at: card.starts ? Date.parse(card.starts) : feedUpdatedAt ?? now, card }));
+ return [...builtIn, ...feed].map((item, order) => ({ item, order })).sort((a, b) => b.item.at - a.item.at || a.order - b.order).map(({ item }) => item);
+}
+
+// ---- When the person last opened Announcements: this browser, this desktop's record for every page of its window, and
+// the place's record (on a Team Cloud, the person's own). The newest of them counts.
+
+const READ_KEY = "omb.announcements.read-at";
+const stored = (key: string): string | null => { try { return localStorage.getItem(key); } catch { return null; } };
+const store = (key: string, value: string) => { try { localStorage.setItem(key, value); } catch {} };
+
+let version = 0;
+const listeners = new Set<() => void>();
+const changed = () => { version++; for (const listener of listeners) listener(); };
+const subscribe = (listener: () => void) => { listeners.add(listener); return () => { listeners.delete(listener); }; };
+/** Re-renders when this page records something here (localStorage does not tell it). */
+export function useAnnouncementRecord(): number {
+ return useSyncExternalStore(subscribe, () => version, () => version);
+}
+
+export const readMark = (at: number) => `announcements-read-${Math.floor(at)}`;
+
+export interface PersonRecord {
+ record: OnboardingStatus | undefined;
+ /** This desktop's record (DesktopNoticesState.seen); empty in a browser. */
+ desktopSeen: readonly string[];
+}
+
+export function announcementsReadAt({ record, desktopSeen }: PersonRecord): number {
+ const local = Number(stored(READ_KEY));
+ const marks = [Number.isSafeInteger(local) && local > 0 ? local : null, readMarkOf(record?.hintsSeen ?? []), readMarkOf(desktopSeen)].filter((at): at is number => at !== null);
+ return marks.length ? Math.max(...marks) : READ_BASELINE;
+}
+
+export function itemSeen(item: HistoryItem, { record, desktopSeen }: PersonRecord): boolean {
+ const key = item.source === "feed" ? `announcement:${item.id}` : item.id;
+ return noticeSeen(record, key) || desktopSeen.includes(key);
+}
+
+/** The dot: something here is newer than the person's last look and they have not seen it. */
+export function announcementsUnread(items: readonly HistoryItem[], person: PersonRecord): boolean {
+ const readAt = announcementsReadAt(person);
+ return items.some(item => item.at > readAt && !itemSeen(item, person));
+}
+
+export interface RecordWriter {
+ /** A Team Cloud's page: the person's own record (PUT /api/me/welcome), as members cannot change the team's. */
+ team: boolean;
+ desktop?: { seen(id: string): Promise<void> };
+ /** The place's new record, once saved. */
+ saved: (config: ConfigStatus) => void;
+}
+
+function savePersonal(hint: string, hintsSeen: string[] | null, writer: RecordWriter): void {
+ void writer.desktop?.seen(hint).catch(() => {});
+ const saving = writer.team
+ ? api("/api/me/welcome", { method: "PUT", body: JSON.stringify({ hints: [hint] }) }).then(() => api<ConfigStatus>("/api/config"))
+ : hintsSeen ? api<ConfigStatus>("/api/config", { method: "PUT", body: JSON.stringify({ onboarding: { hintsSeen } }) }) : null;
+ void saving?.then(writer.saved).catch(() => {});
+}
+
+/** The person opened Announcements now: the dot goes, here and on their other pages. */
+export function markAnnouncementsRead(now: number, record: OnboardingStatus | undefined, writer: RecordWriter): void {
+ const mark = readMark(now), hints = record?.hintsSeen ?? [];
+ store(READ_KEY, String(Math.floor(now)));
+ const next = [...hints.filter(hint => !ANNOUNCEMENTS_READ_HINT.test(hint)), mark];
+ savePersonal(mark, next.length > 100 ? null : next, writer);
+ changed();
+}
+
+/** The person closed (or used) a built-in popup that is theirs alone, as the Teams one is on a Team Cloud. */
+export function rememberNoticeSeen(id: string, record: OnboardingStatus | undefined, writer: RecordWriter): void {
+ const patch = dismissNotice(record, id);
+ savePersonal(id, writer.team ? [] : patch?.onboarding.hintsSeen ?? null, writer);
+ changed();
+}
+
diff --git a/src/lib/announcements.ts b/src/lib/announcements.ts
index 6a9f83e59d..a19c7eabd7 100644
--- a/src/lib/announcements.ts
+++ b/src/lib/announcements.ts
@@ -36,6 +36,7 @@ export const sponsorDayKey = (day: string) => `${SPONSOR_DAY_PREFIX}${day}`;
// ---- The cards this server hands over: asked at launch, then about hourly while the app is in use.
let cards: AnnouncementCard[] = [];
+let updatedAt: number | null = null;
let askedAt: number | null = null;
let answered = false;
let asking = false;
@@ -54,7 +55,11 @@ function ask(now: number): void {
if (asking || (askedAt !== null && now >= askedAt && now - askedAt < (answered ? ANNOUNCEMENT_REFRESH_MS : RETRY_MS))) return;
asking = true;
askedAt = now;
- void api("/api/announcements").then((answer) => { cards = readCards(answer); answered = true; }, () => {})
+ void api("/api/announcements").then((answer) => {
+ cards = readCards(answer); answered = true;
+ const date = Date.parse(String((answer as { updatedAt?: unknown } | null)?.updatedAt ?? ""));
+ updatedAt = Number.isFinite(date) ? date : null;
+ }, () => {})
.finally(() => { asking = false; for (const listener of listeners) listener(); });
}
@@ -69,9 +74,14 @@ export function useAnnouncementCards(enabled: boolean, now: () => number = Date.
return enabled ? current : [];
}
+/** When the cards' file last changed (epoch ms), as the server said; null before it answers or from an older server. */
+export function announcementFeedUpdatedAt(): number | null {
+ return updatedAt;
+}
+
/** Tests: start from a page that has asked nothing. */
export function forgetAnnouncementCards(): void {
- cards = []; askedAt = null; answered = false; asking = false;
+ cards = []; updatedAt = null; askedAt = null; answered = false; asking = false;
}
// ---- What this page knows.
@@ -236,6 +246,15 @@ export function pickAnnouncement(list: readonly AnnouncementCard[], context: Pic
return null;
}
+/** Every card that is for this person here, whether or not they saw it: what Announcements lists. */
+export function cardsForPerson(list: readonly AnnouncementCard[], context: Omit<PickContext, "seen">): AnnouncementCard[] {
+ if (context.branded) return [];
+ const now = context.facts.nowMs;
+ return list.filter((card) => !(card.starts && Date.parse(card.starts) > now) && Date.parse(card.ends) > now
+ && (card.kind !== "sponsor" || context.sponsors) && (context.admin || !cardPlaces(card).some((place) => ADMIN_PLACES.has(place)))
+ && audienceMatches(card.audience, context.facts) === true);
+}
+
export type AnnouncementAction = "shown" | "primary" | "secondary" | "close";
/** One event per card and step, under the same analytics switch as every other event. The id is the card's own, from
diff --git a/src/lib/notices.test.ts b/src/lib/notices.test.ts
index 6fea085098..c1f19bdcaa 100644
--- a/src/lib/notices.test.ts
+++ b/src/lib/notices.test.ts
@@ -3,7 +3,7 @@ import { EMPTY_ONBOARDING, type OnboardingStatus } from "@/lib/onboarding";
import { withTourReset } from "@/lib/guided-tour";
import { DESKTOP_NOTICES } from "../../electron/desktop-prefs.mjs";
import { ANNOUNCEMENT_NOTICE, BOAT_OFFER_NOTICE, CLOUD_INTRO, CLOUD_NOTICE, CLOUD_TRIAL_NOTICE, dismissNotice, dismissNotices, FOLLOWERS, GROK_MOVE_NOTICE, introShown, introStage, launchNotice, localDay, markLaunchNotice, MODELGO_OFFER_NOTICE, MUST_ACT,
- nextNotice, noticeSeen, NOTICES, OLD_PRO_DISMISSALS, PHONE_UPDATE_NOTICE, phoneUpdateHint, PRODUCT_HUNT_NOTICE, SIMPLE_MODE_NOTICE, STAR_NOTICE, TWO_PLACES_NOTICE, UPDATES_CONSENT_NOTICE, usedBefore, WHATS_NEW_NOTICE, type NoticeFacts,
+ nextNotice, noticeSeen, NOTICES, OLD_PRO_DISMISSALS, PHONE_UPDATE_NOTICE, phoneUpdateHint, PRODUCT_HUNT_NOTICE, SIMPLE_MODE_NOTICE, STAR_NOTICE, TEAMS_NOTICE, TWO_PLACES_NOTICE, UPDATES_CONSENT_NOTICE, usedBefore, WHATS_NEW_NOTICE, type NoticeFacts,
type NoticeId } from "./notices";
let storage: Map<string, string>, session: Map<string, string>;
@@ -17,8 +17,8 @@ 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, simple: boolean | null = false, boat: boolean | null = false, two: boolean | null = false, grok: boolean | null = false, modelgo: boolean | null = false,
- phone: boolean | null = false, announcement: boolean | null = false): NoticeFacts =>
- ({ [GROK_MOVE_NOTICE]: grok, [PHONE_UPDATE_NOTICE]: phone, [SIMPLE_MODE_NOTICE]: simple, [WHATS_NEW_NOTICE]: popup, [UPDATES_CONSENT_NOTICE]: consent, [TWO_PLACES_NOTICE]: two, [PRODUCT_HUNT_NOTICE]: launch, [CLOUD_INTRO]: intro, [CLOUD_TRIAL_NOTICE]: trial, [CLOUD_NOTICE]: cloud,
+ phone: boolean | null = false, announcement: boolean | null = false, teams: boolean | null = false): NoticeFacts =>
+ ({ [TEAMS_NOTICE]: teams, [GROK_MOVE_NOTICE]: grok, [PHONE_UPDATE_NOTICE]: phone, [SIMPLE_MODE_NOTICE]: simple, [WHATS_NEW_NOTICE]: popup, [UPDATES_CONSENT_NOTICE]: consent, [TWO_PLACES_NOTICE]: two, [PRODUCT_HUNT_NOTICE]: launch, [CLOUD_INTRO]: intro, [CLOUD_TRIAL_NOTICE]: trial, [CLOUD_NOTICE]: cloud,
[MODELGO_OFFER_NOTICE]: modelgo, [BOAT_OFFER_NOTICE]: boat, [ANNOUNCEMENT_NOTICE]: announcement, [STAR_NOTICE]: star });
const none = () => false;
const DAY = 86_400_000, NOON = new Date(2026, 9, 9, 12).getTime();
@@ -37,7 +37,7 @@ it("is one queue: the Simple mode popup first, then What's new, the product-upda
expect(nextNotice(facts(true, true, true, true, true, true, true, true), none)).toBe(SIMPLE_MODE_NOTICE);
expect(nextNotice(facts(true, true, true, true, true, true, true, null), none), "nothing shows while the Simple mode popup waits").toBeNull();
expect(nextNotice(facts(true, true, true, true, true, true, true, true), id => id === SIMPLE_MODE_NOTICE)).toBe(WHATS_NEW_NOTICE);
- expect(NOTICES).toEqual([GROK_MOVE_NOTICE, PHONE_UPDATE_NOTICE, SIMPLE_MODE_NOTICE, WHATS_NEW_NOTICE, UPDATES_CONSENT_NOTICE, TWO_PLACES_NOTICE, PRODUCT_HUNT_NOTICE, CLOUD_INTRO, CLOUD_TRIAL_NOTICE, CLOUD_NOTICE, MODELGO_OFFER_NOTICE, BOAT_OFFER_NOTICE, ANNOUNCEMENT_NOTICE, STAR_NOTICE]);
+ expect(NOTICES).toEqual([TEAMS_NOTICE, GROK_MOVE_NOTICE, PHONE_UPDATE_NOTICE, SIMPLE_MODE_NOTICE, WHATS_NEW_NOTICE, UPDATES_CONSENT_NOTICE, TWO_PLACES_NOTICE, PRODUCT_HUNT_NOTICE, CLOUD_INTRO, CLOUD_TRIAL_NOTICE, CLOUD_NOTICE, MODELGO_OFFER_NOTICE, BOAT_OFFER_NOTICE, ANNOUNCEMENT_NOTICE, STAR_NOTICE]);
expect(nextNotice(facts(true, true, true, true, true, false, false, false, false, true), none), "bots in two places come before any promotion").toBe(TWO_PLACES_NOTICE);
expect(nextNotice(facts(true, true, true, true, true, false, true, false, false, true), none), "after the product-updates question").toBe(UPDATES_CONSENT_NOTICE);
expect(nextNotice(facts(true, true, true, true, true, false, false, false, false, null), none), "nothing lower shows while main hasn't answered").toBeNull();
@@ -69,7 +69,19 @@ it("is one queue: the Simple mode popup first, then What's new, the product-upda
});
it("Boat's credit offer and the Grok Bot move are ones the desktop keeps for its every page, as What's new is", () => {
- expect(DESKTOP_NOTICES).toEqual([WHATS_NEW_NOTICE, BOAT_OFFER_NOTICE, GROK_MOVE_NOTICE, MODELGO_OFFER_NOTICE]);
+ expect(DESKTOP_NOTICES).toEqual([WHATS_NEW_NOTICE, BOAT_OFFER_NOTICE, GROK_MOVE_NOTICE, MODELGO_OFFER_NOTICE, TEAMS_NOTICE]);
+});
+
+it("the Teams What's new goes ahead of every notice, holds the queue while it waits, and the rest keep their order after it", () => {
+ const all = (teams: boolean | null) => facts(true, true, true, true, true, true, true, true, true, true, true, true, true, true, teams);
+ expect(TEAMS_NOTICE).toBe("teams-2026-11");
+ expect(nextNotice(all(true), none)).toBe(TEAMS_NOTICE);
+ expect(nextNotice(all(null), none), "nothing shows while it waits").toBeNull();
+ expect(nextNotice(all(false), none)).toBe(GROK_MOVE_NOTICE);
+ expect(nextNotice(all(true), id => id === TEAMS_NOTICE), "seen: the queue as before").toBe(GROK_MOVE_NOTICE);
+ expect(nextNotice(all(true), id => id === TEAMS_NOTICE, TEAMS_NOTICE), "closed this launch: only the followers may come").toBe(UPDATES_CONSENT_NOTICE);
+ expect(nextNotice(all(true), none, TEAMS_NOTICE, true), "closed in this page, before it is saved").toBe(UPDATES_CONSENT_NOTICE);
+ expect(nextNotice(all(true), none, GROK_MOVE_NOTICE), "a launch another notice took keeps it for the next").toBe(GROK_MOVE_NOTICE);
});
it("one notice a launch: What's new goes first and Boat's credit offer waits for a later launch; only the product-updates question may follow", () => {
diff --git a/src/lib/notices.ts b/src/lib/notices.ts
index d61518c961..acddddd19e 100644
--- a/src/lib/notices.ts
+++ b/src/lib/notices.ts
@@ -1,5 +1,8 @@
import { hintSeen, hintSeenPatch, type OnboardingStatus } from "@/lib/onboarding";
+/** "MausBot is better with your team": every person sees it once, on every surface but a branded build or an organization's
+ * desktop, ahead of every other notice. On a Team Cloud its record is each person's (TEAM_PERSONAL_HINTS). */
+export const TEAMS_NOTICE = "teams-2026-11";
/** The What's new popup's campaign: each person sees it once. A new id shows it once more. */
export const WHATS_NEW_NOTICE = "whats-new-2026-11";
export const UPDATES_CONSENT_NOTICE = "updates-consent";
@@ -32,6 +35,7 @@ export const ANNOUNCEMENT_NOTICE = "announcement";
* come after it there. The rest wait for later launches, in this order.
*/
export const NOTICES = [
+ TEAMS_NOTICE,
GROK_MOVE_NOTICE,
PHONE_UPDATE_NOTICE,
SIMPLE_MODE_NOTICE,
diff --git a/src/lib/teams-whats-new.ts b/src/lib/teams-whats-new.ts
new file mode 100644
index 0000000000..3b677c4b12
--- /dev/null
+++ b/src/lib/teams-whats-new.ts
@@ -0,0 +1,49 @@
+import type { CloudAccountState } from "../../electron/cloud-account.mjs";
+import { track } from "@/lib/analytics";
+import { teamPeoplePage } from "@/lib/app-links";
+import { TEAMS_NOTICE } from "@/lib/notices";
+import { startTeamUrl, whatsNewAudience } from "@/lib/whats-new";
+import type { WelcomeViewer } from "@/lib/onboarding";
+
+/** The Team plan's checkout on the Cloud website, tagged for this popup on the Cloud's funnel. */
+export const TEAMS_SOURCE = "app_whats_new_teams";
+export const startTeamsUrl = (staging = false) => startTeamUrl(staging).replace(/src=[^&]*/, `src=${TEAMS_SOURCE}`);
+
+/** What the Teams popup offers this person: on a Team Cloud, its Owner and Admins invite people from the team's People
+ * page and its members are only told, as is a desktop whose Cloud sign-in is already in a team; everyone else starts a
+ * team, in the app's own Add a Cloud when they have a Cloud plan of their own on this desktop (the website's Get Team
+ * only tells them to write in), else on the website. */
+export type TeamsAction =
+ | { kind: "invite"; url: string }
+ | { kind: "got-it" }
+ | { kind: "start"; inApp: boolean; url: string };
+
+export function teamsAction({ team, viewer, account, canAddCloud }: {
+ team: { id: string; cloudPage?: string } | null | undefined;
+ viewer: Pick<WelcomeViewer, "canSave" | "teamRole"> | null;
+ /** This desktop's MausBot Cloud sign-in, on its own page; null elsewhere. */
+ account: CloudAccountState | null;
+ /** The app's Add a Cloud can open here. */
+ canAddCloud: boolean;
+}): TeamsAction {
+ if (team) {
+ const admin = viewer?.teamRole === "owner" || viewer?.teamRole === "admin" || (viewer?.teamRole === undefined && viewer?.canSave === true);
+ const url = admin ? teamPeoplePage(team, "invite") : null;
+ return url ? { kind: "invite", url } : { kind: "got-it" };
+ }
+ const audience = account === null ? null : whatsNewAudience(account);
+ if (audience === "team") return { kind: "got-it" };
+ return { kind: "start", inApp: canAddCloud && audience === "own", url: startTeamsUrl(account?.staging === true) };
+}
+
+export type TeamsStep = "seen" | "invite" | "start_team" | "got_it" | "not_now" | "close";
+type TeamsAudience = "team_admin" | "team_member" | "no_team";
+
+export function teamsAudience(action: TeamsAction): TeamsAudience {
+ return action.kind === "invite" ? "team_admin" : action.kind === "got-it" ? "team_member" : "no_team";
+}
+
+/** The `whats_new` event, as the earlier popup counts its steps, under this popup's campaign. */
+export function reportTeams(action: TeamsStep, shown: TeamsAction) {
+ track("whats_new", { action, slide: "teams", audience: teamsAudience(shown), campaign: TEAMS_NOTICE });
+}
diff --git a/src/locales/de.json b/src/locales/de.json
index 71675ce966..17318033ef 100644
--- a/src/locales/de.json
+++ b/src/locales/de.json
@@ -4010,6 +4010,8 @@
"server.rooms.linkedFailed": "{bot} konnte von {place} aus nicht antworten.",
"server.rooms.linkedMissing": "{bot} gibt es auf {place} nicht mehr und kann hier deshalb nicht antworten. Entferne diesen Bot aus den Mitgliedern dieses Raums.",
"server.rooms.linkedEnded": "{place} hat sich 30 Tage lang nicht verbunden, deshalb wurde die Verbindung dorthin beendet. Nicht mehr in diesem Raum: {bots}.",
+ "announcements.title": "Ankündigungen",
+ "announcements.new": "Neue Ankündigungen",
"room.members.far.place": "auf {place}",
"room.members.far.off": "Verbindung ist aus",
"room.members.far.missing": "Nicht mehr verfügbar",
diff --git a/src/locales/en.json b/src/locales/en.json
index 92c4c7ee9f..50ebdf475a 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -572,6 +572,19 @@
"whatsNew.team.start": "Start a Team",
"whatsNew.team.support": "Support",
"whatsNew.team.sales": "Sales",
+ "teamsNew.title": "MausBot is better with your team",
+ "teamsNew.sharedBot": "One shared bot for everyone: set it up once, everyone uses it.",
+ "teamsNew.files": "Team files and templates everyone's bots can use.",
+ "teamsNew.private": "Private chats stay private, even from admins.",
+ "teamsNew.price": "$40 a month for 2 people, $20 for each extra person.",
+ "teamsNew.invite": "Invite your team",
+ "teamsNew.gotIt": "Got it",
+ "teamsNew.start": "Start a team",
+ "announcements.title": "Announcements",
+ "announcements.showAgain": "Show again",
+ "announcements.ended": "Ended",
+ "announcements.empty": "Nothing has been announced here yet.",
+ "announcements.new": "New announcements",
"cloudHowTo.title": "Add a Cloud from here",
"cloudHowTo.body": "Click this menu, then choose Add a Cloud. It's also where you switch between this computer and the Cloud.",
"cloudHowTo.skip": "Skip",
diff --git a/src/locales/es.json b/src/locales/es.json
index c7d2109bc4..961653dcd1 100644
--- a/src/locales/es.json
+++ b/src/locales/es.json
@@ -6270,6 +6270,8 @@
"common.ok": "Aceptar",
"connectedWorkspaces.localTitle": "Entornos en este ordenador",
"connectedWorkspaces.newEnvironment": "Nuevo entorno",
+ "announcements.title": "Anuncios",
+ "announcements.new": "Anuncios nuevos",
"policy.teamRemoteBlocked": "Gestionado por {organization}: abrir esta nube en un teléfono está desactivado. Pregunta a un admin del equipo.",
"remote.status.pairedMany": "{count} dispositivos vinculados",
"remote.status.pairedOne": "1 dispositivo vinculado",
diff --git a/src/locales/fr.json b/src/locales/fr.json
index 723eb7437e..4c5ee60b18 100644
--- a/src/locales/fr.json
+++ b/src/locales/fr.json
@@ -3620,6 +3620,8 @@
"common.ok": "OK",
"connectedWorkspaces.localTitle": "Environnements sur cet ordinateur",
"connectedWorkspaces.newEnvironment": "Nouvel environnement",
+ "announcements.title": "Annonces",
+ "announcements.new": "Nouvelles annonces",
"newBot.defaults": "Valeurs par défaut des nouveaux bots",
"newBot.edit": "Modifier",
"notifications.title": "Notifications",
diff --git a/src/locales/hi.json b/src/locales/hi.json
index ddb24a7bd5..689d56b7c8 100644
--- a/src/locales/hi.json
+++ b/src/locales/hi.json
@@ -3474,6 +3474,8 @@
"common.ok": "ठीक है",
"connectedWorkspaces.localTitle": "इस कंप्यूटर पर एनवायरनमेंट",
"connectedWorkspaces.newEnvironment": "नया एनवायरनमेंट",
+ "announcements.title": "घोषणाएँ",
+ "announcements.new": "नई घोषणाएँ",
"newBot.defaults": "नए बॉट्स के डिफ़ॉल्ट",
"newBot.edit": "संपादित करें",
"notifications.title": "सूचनाएँ",
diff --git a/src/locales/it.json b/src/locales/it.json
index 393073f135..4da7491e5f 100644
--- a/src/locales/it.json
+++ b/src/locales/it.json
@@ -6843,6 +6843,8 @@
"common.ok": "OK",
"connectedWorkspaces.localTitle": "Ambienti su questo computer",
"connectedWorkspaces.newEnvironment": "Nuovo ambiente",
+ "announcements.title": "Annunci",
+ "announcements.new": "Nuovi annunci",
"policy.teamRemoteBlocked": "Gestito da {organization}: aprire questo Cloud sul telefono è disattivato. Chiedi a un admin del team.",
"remote.status.pairedMany": "{count} dispositivi abbinati",
"remote.status.pairedOne": "1 dispositivo abbinato",
diff --git a/src/locales/ja.json b/src/locales/ja.json
index 1032b4a184..51d4c21b0a 100644
--- a/src/locales/ja.json
+++ b/src/locales/ja.json
@@ -7389,6 +7389,8 @@
"email.needsGoogle": "Gmail ではここでアプリ パスワード(2 段階認証プロセスを有効にしたもの)が必要です。または Google でサインインしてください。",
"email.needsMicrosoft": "Outlook はここでメールのパスワードを受け付けません。Microsoft でサインインしてください。",
"email.needsAppPassword": "{provider} ではここでアプリ パスワードが必要です。通常のパスワードは使えません。",
+ "announcements.title": "お知らせ",
+ "announcements.new": "新しいお知らせ",
"serverError.mailbox.outgoingFields": "送信サーバーを確認してください: mail.example.com のような名前、1〜65535 のポート、SSL/TLS または STARTTLS。",
"native.menu.newLocal": "このコンピューターに新しいワークスペース…",
"server.meetings.card.title": "会議メモ",
diff --git a/src/locales/ko.json b/src/locales/ko.json
index 640376e6c1..612e167f54 100644
--- a/src/locales/ko.json
+++ b/src/locales/ko.json
@@ -7043,6 +7043,8 @@
"email.needsGoogle": "Gmail은 여기서 앱 비밀번호(2단계 인증 사용 시)가 필요합니다. 또는 Google로 로그인하세요.",
"email.needsMicrosoft": "Outlook은 여기서 메일 비밀번호를 받지 않습니다. Microsoft로 로그인하세요.",
"email.needsAppPassword": "{provider}은(는) 여기서 일반 비밀번호가 아닌 앱 비밀번호가 필요합니다.",
+ "announcements.title": "공지사항",
+ "announcements.new": "새 공지사항",
"serverError.mailbox.outgoingFields": "보내는 서버를 확인하세요: mail.example.com 같은 이름, 1~65535 사이의 포트, SSL/TLS 또는 STARTTLS.",
"rail.addAny": "봇을 위한 공간 추가",
"rail.searchAny": "공간 찾기",
diff --git a/src/locales/pl.json b/src/locales/pl.json
index 01e98d1585..955bfe71e3 100644
--- a/src/locales/pl.json
+++ b/src/locales/pl.json
@@ -6971,6 +6971,8 @@
"accounts.manage": "Konto i wylogowanie",
"connectedWorkspaces.localTitle": "Środowiska na tym komputerze",
"connectedWorkspaces.newEnvironment": "Nowe środowisko",
+ "announcements.title": "Ogłoszenia",
+ "announcements.new": "Nowe ogłoszenia",
"defaultBot.hidden": "{name} nie ma już na pasku bocznym. Pokaż go znowu w Ustawienia (Na pasku bocznym).",
"defaultBot.demote": "Zmień w zwykłego bota",
"defaultBot.demoteHint": "Usuwa wbudowaną ochronę: potem można go zarchiwizować lub usunąć jak każdego innego bota.",
diff --git a/src/locales/pt-br.json b/src/locales/pt-br.json
index 78e6231276..d617321bee 100644
--- a/src/locales/pt-br.json
+++ b/src/locales/pt-br.json
@@ -548,6 +548,19 @@
"whatsNew.team.start": "Criar uma equipe",
"whatsNew.team.support": "Suporte",
"whatsNew.team.sales": "Vendas",
+ "teamsNew.title": "O MausBot é melhor com a sua equipe",
+ "teamsNew.sharedBot": "Um bot compartilhado para todos: configure uma vez e todo mundo usa.",
+ "teamsNew.files": "Arquivos e modelos da equipe que os bots de todos podem usar.",
+ "teamsNew.private": "Conversas privadas continuam privadas, até para os administradores.",
+ "teamsNew.price": "US$ 40 por mês para 2 pessoas, US$ 20 para cada pessoa a mais.",
+ "teamsNew.invite": "Convide sua equipe",
+ "teamsNew.gotIt": "Entendi",
+ "teamsNew.start": "Criar uma equipe",
+ "announcements.title": "Anúncios",
+ "announcements.showAgain": "Mostrar de novo",
+ "announcements.ended": "Encerrado",
+ "announcements.empty": "Nada foi anunciado aqui ainda.",
+ "announcements.new": "Novos anúncios",
"cloudHowTo.title": "Adicione um Cloud por aqui",
"cloudHowTo.body": "Clique neste menu e escolha “Adicionar um Cloud”. É também onde você alterna entre este computador e o Cloud.",
"cloudHowTo.skip": "Pular",
diff --git a/src/locales/ru.json b/src/locales/ru.json
index 92d8140ad4..25685dc3cc 100644
--- a/src/locales/ru.json
+++ b/src/locales/ru.json
@@ -7032,6 +7032,8 @@
"accounts.manage": "Аккаунт и выход",
"connectedWorkspaces.localTitle": "Окружения на этом компьютере",
"connectedWorkspaces.newEnvironment": "Новое окружение",
+ "announcements.title": "Объявления",
+ "announcements.new": "Новые объявления",
"policy.teamRemoteBlocked": "Управляет {organization}: открывать это облако на телефоне запрещено. Обратитесь к администратору команды.",
"remote.status.pairedMany": "Подключено устройств: {count}",
"remote.status.pairedOne": "Подключено 1 устройство",
diff --git a/src/locales/tr.json b/src/locales/tr.json
index fe48ef5091..60cf3661b8 100644
--- a/src/locales/tr.json
+++ b/src/locales/tr.json
@@ -5767,6 +5767,8 @@
"common.ok": "Tamam",
"connectedWorkspaces.localTitle": "Bu bilgisayardaki ortamlar",
"connectedWorkspaces.newEnvironment": "Yeni ortam",
+ "announcements.title": "Duyurular",
+ "announcements.new": "Yeni duyurular",
"policy.teamRemoteBlocked": "{organization} yönetiyor: bu Cloud'u telefonda açmak kapalı. Bir ekip yöneticisine sor.",
"remote.status.pairedMany": "{count} cihaz eşlendi",
"remote.status.pairedOne": "1 cihaz eşlendi",
diff --git a/src/locales/uk.json b/src/locales/uk.json
index 5113d5cda2..05910dd363 100644
--- a/src/locales/uk.json
+++ b/src/locales/uk.json
@@ -3908,6 +3908,8 @@
"common.ok": "OK",
"connectedWorkspaces.localTitle": "Середовища на цьому комп’ютері",
"connectedWorkspaces.newEnvironment": "Нове середовище",
+ "announcements.title": "Оголошення",
+ "announcements.new": "Нові оголошення",
"newBot.defaults": "Типові налаштування нових ботів",
"newBot.edit": "Редагувати",
"notifications.title": "Сповіщення",
diff --git a/src/locales/vi.json b/src/locales/vi.json
index 11300b45b1..e38c189880 100644
--- a/src/locales/vi.json
+++ b/src/locales/vi.json
@@ -5767,6 +5767,8 @@
"common.ok": "OK",
"connectedWorkspaces.localTitle": "Môi trường trên máy tính này",
"connectedWorkspaces.newEnvironment": "Môi trường mới",
+ "announcements.title": "Thông báo",
+ "announcements.new": "Thông báo mới",
"policy.teamRemoteBlocked": "Do {organization} quản lý: mở Cloud này trên điện thoại đã bị tắt. Hãy hỏi quản trị viên nhóm.",
"remote.status.pairedMany": "Đã ghép {count} thiết bị",
"remote.status.pairedOne": "Đã ghép 1 thiết bị",
diff --git a/src/locales/zh-tw.json b/src/locales/zh-tw.json
index 4596654fa9..e1793bdff0 100644
--- a/src/locales/zh-tw.json
+++ b/src/locales/zh-tw.json
@@ -10122,6 +10122,8 @@
"server.burst.cancelled": "平行處理已取消。",
"server.burst.partFailed": "未完成({reason})",
"server.burst.partsHeader": "這次平行處理的各部分結果(依完成順序):{task}",
+ "announcements.title": "公告",
+ "announcements.new": "新公告",
"composer.command.burstDesc": "同時執行一項工作的多個部分,再彙整結果",
"burst.title": "平行處理:{task}",
"burst.plan": "{count} 個任務 · {model} · 同時 {parallel} 個 · 約 {minutes} 分鐘",
diff --git a/src/locales/zh.json b/src/locales/zh.json
index b283918d57..560afb64b6 100644
--- a/src/locales/zh.json
+++ b/src/locales/zh.json
@@ -10056,6 +10056,8 @@
"server.rooms.linkedFailed": "{bot} 无法从 {place} 回复。",
"server.rooms.linkedMissing": "{bot} 已不在 {place} 上,所以无法在这里回复。请把它从这个群组聊天的成员中移除。",
"server.rooms.linkedEnded": "{place} 已有 30 天没有连接,与它的连接已结束。已不在这个群组聊天中:{bots}。",
+ "announcements.title": "公告",
+ "announcements.new": "新公告",
"room.members.far.place": "位于 {place}",
"room.members.far.off": "连接已关闭",
"room.members.far.missing": "已不可用"
diff --git a/src/state/store.tsx b/src/state/store.tsx
index 95070973ef..61b6c6a992 100644
--- a/src/state/store.tsx
+++ b/src/state/store.tsx
@@ -507,7 +507,7 @@ export interface AppState {
liveCallVersion: number;
liveCallLookupSeq: number;
selectedId: string;
- activeView: "chat" | "team-map" | "routines" | "files" | "web-panel" | "published-apps" | "team-files";
+ activeView: "chat" | "team-map" | "routines" | "files" | "web-panel" | "published-apps" | "team-files" | "announcements";
/** Folders a finished move left on this computer, for Files to offer sharing. */
filesSuggest: string[] | null; webPanelId?: string;
routines: Routine[];
@@ -590,7 +590,7 @@ export type Action =
| { type: "botsOrdered"; botIds: string[] } | { type: "groupsOrdered"; groupIds: string[] }
| { type: "sectionDeleted"; section: string; sections: string[] }
| { type: "showRoutines"; section?: "schedule" | "logs"; view?: "calendar" | "list"; botId?: string; routineId?: string; runStatus?: RoutineRunStatusFilter }
- | { type: "showTeamMap" } | { type: "showPublishedApps" } | { type: "showTeamFiles" } | { type: "showWebPanel"; id: string }
+ | { type: "showTeamMap" } | { type: "showPublishedApps" } | { type: "showTeamFiles" } | { type: "showAnnouncements" } | { type: "showWebPanel"; id: string }
| { type: "showFiles"; suggest?: string[] }
| { type: "showChat" }
| { type: "routinesHydrated"; routines: Routine[]; runs: RoutineRun[]; since?: number }
@@ -943,10 +943,10 @@ export function reducer(state: AppState, action: Action): AppState {
case "forkPanelMessage": case "forkPanelActive": case "closeForkPanel":
return reduceForkPanel(state, action);
case "showTeamMap":
- case "showFiles": case "showWebPanel": case "showPublishedApps": case "showTeamFiles":
+ case "showFiles": case "showWebPanel": case "showPublishedApps": case "showTeamFiles": case "showAnnouncements":
return {
...state,
- activeView: action.type === "showFiles" ? "files" : action.type === "showWebPanel" ? "web-panel" : action.type === "showPublishedApps" ? "published-apps" : action.type === "showTeamFiles" ? "team-files" : "team-map",
+ activeView: action.type === "showFiles" ? "files" : action.type === "showWebPanel" ? "web-panel" : action.type === "showPublishedApps" ? "published-apps" : action.type === "showTeamFiles" ? "team-files" : action.type === "showAnnouncements" ? "announcements" : "team-map",
filesSuggest: action.type === "showFiles" && action.suggest?.length ? action.suggest : null, webPanelId: action.type === "showWebPanel" ? action.id : state.webPanelId,
settingsOpen: false, computerOpen: false, inspectorOpen: false, activityOpen: false, appSettingsOpen: false, pluginsOpen: false,
};
@@ -2194,7 +2194,7 @@ export function StoreProvider({ children }: { children: ReactNode }) {
};
const wrapped: React.Dispatch<Action> = (action) => {
- store.flushFrames(); if (["select", "newTask", "switchTask", "newGroupTask", "switchGroupTask", "showChat", "showRoutines", "showTeamMap", "showFiles", "showWebPanel", "showPublishedApps", "showTeamFiles"].includes(action.type)) selectionRevision.current++;
+ store.flushFrames(); if (["select", "newTask", "switchTask", "newGroupTask", "switchGroupTask", "showChat", "showRoutines", "showTeamMap", "showFiles", "showWebPanel", "showPublishedApps", "showTeamFiles", "showAnnouncements"].includes(action.type)) selectionRevision.current++;
// Pin before any await or optimistic state change.
action = pinBotThreadAction(action, stateRef.current.bots);
if (action.type === "taskSwitched") action = { ...action, bot: withTaskWrites(action.bot) as Bot };
diff --git a/src/styles.css b/src/styles.css
index 968252967b..b5816f264e 100644
--- a/src/styles.css
+++ b/src/styles.css
@@ -3630,3 +3630,23 @@ button:disabled.bg-danger {
-webkit-mask-image: linear-gradient(to left, #000 calc(100% - 28px), transparent);
mask-image: linear-gradient(to left, #000 calc(100% - 28px), transparent);
}
+
+/* The Teams What's new: the card fades in growing slightly, then the four teammates join the bot one after another,
+ about 600 ms in all. Each rests visible, so without motion everything is simply there. */
+.teams-card-in { animation: teams-card-in 220ms cubic-bezier(0.22, 1, 0.36, 1) both; }
+.teams-face-in { animation: teams-face-in 200ms cubic-bezier(0.22, 1, 0.36, 1) both; animation-delay: calc(180ms + var(--face, 0) * 70ms); }
+@keyframes teams-card-in {
+ from { opacity: 0; transform: scale(0.96); }
+ to { opacity: 1; transform: scale(1); }
+}
+@keyframes teams-face-in {
+ from { opacity: 0; transform: translateX(var(--from-x, 0)) scale(0.6); }
+ to { opacity: 1; transform: translateX(0) scale(1); }
+}
+@media (prefers-reduced-motion: reduce) {
+ .teams-card-in, .teams-face-in { animation: none; }
+}
+:root[data-reduced-motion="true"] .teams-card-in,
+:root[data-reduced-motion="true"] .teams-face-in {
+ animation: none !important;
+}