Repository navigation
feat(web): open the plan dialog from the remaining areas' actions, and from every way to add a brand, while the plan has ended - #1612
Conversation
…e "Choose a plan" dialog
On the cloud, an ended trial, a cancel during the trial and a cancel
after the first payment can now sign in and look around. They used to
see a full-screen "subscription expired" notice that only signed out.
Onboarding is unchanged: an admin who never started a trial still goes
to the plan step.
- The dashboard layout lets these workspaces in, read-only. A thin
banner says so, with "See plans".
- UpgradeDialogProvider and useUpgradeGate ({ guard, isLocked,
openUpgrade }) open one "Choose a plan to keep going" dialog, with the
action that was clicked as a label.
- Admins go to Billing; members are told to ask their admin.
- A failed payment (past_due, unpaid) says so and opens Stripe's
portal.
- A 402 subscription_inactive from the API opens the dialog
(use-failure-toast, api-failure's subscription class, and the
Webflow, catalog, publish and Send to CMS clients).
- Automatic calls (Library's Webflow status, the editor's link, source,
claim and page reads, Improve's read) aren't sent while locked.
- Billing: an ended subscription starts a new Checkout ("Choose
{plan}", monthly or annual). The checkout route takes admins only,
refuses a second live subscription (409), and validates its body.
Billing reads again after a change.
- MCP: list_ and get_ tools stay open; every other tool, and REST
writes, answer subscription_inactive. Chat and new conversations
answer 402, and runSiteAuditFor, generateBriefFor and
createImproveActionFor check too. A chat message refused by a 402
goes back to the input.
Self-hosted is unchanged.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
… the plan has ended
Read-only, part C1. On an ended plan, every action in Prompts, Prompt
Suggestions, Topics, Query Fan-out, Brand Visibility and Competitors
opens the "Choose a plan" dialog with the action named, and runs
nothing. On an active plan they run as before. Buttons aren't disabled.
- Tracked Prompts: add, import, edit, analyze and refresh volumes, the
bulk bar, work status and the row menu.
- Prompt and topic suggestions: generate, add, accept, dismiss.
- Manage prompts and topics: add, generate, locations, analyze, edit,
delete.
- Query Fan-out's Track; Brand Visibility's Run All, Test Single Prompt,
Opportunities' Track and Send, and pinning a competitor.
- Competitors: suggest (its dialog calls AI on opening), add, delete.
- The Positions panel: Improve's Generate and Regenerate, Send Actions,
and Create or Optimize content.
- The labels live in readOnly.actions.* ("Adding prompts needs a plan").
- volumes.ts tells the API's 402 subscription_inactive from a feature
the plan lacks, so a refused analysis opens the dialog instead of "not
part of your current plan".
- While locked, Tracked Prompts doesn't warn that volume data is
unavailable, and Query Fan-out doesn't send its intent classification.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…keep the editor read-only, while the plan has ended
Read-only, part C2. On an ended plan, every action that writes or costs
in Content Opportunities, the opportunity panel, Content Plan, Library,
New content and the Content Editor opens the "Choose a plan" dialog,
naming the action, and runs nothing.
- Opportunities: New, the bulk bar (send, done, dismiss and delete open
the dialog instead of their confirm), the row menu, the webhook
settings' Test and Save, and the panel's sends, brief, Reviewed,
Restore and Dismiss.
- Plan: New content, Start, Assign, Priority, Hide and Show. A ?start=
link starts nothing while locked.
- Library: New content (and ?new=1), status changes, archive, delete,
and single and bulk Send to CMS.
- The editor:
- Run Agent, Rewrite, Fix rules, hand-off;
- accepting or rejecting suggestions;
- Mark ready, Ready back to review, Mark published, Send to CMS,
History Restore;
- page and site type, author and reviewer;
- Quality's confirms, sources and images, and Add line or Remove;
- renaming, dropping files, the toolbar;
- the Brief's run, rewrite and edit; the Sources and Rules changes;
Your input.
- The editor itself is read-only while locked (editable: false, the
HTML view readOnly), and autosave is off (useDraftAutosave { off }):
nothing is saved, and leaving doesn't warn.
- Reading, filters, exports, Copy HTML and Stop stay open.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…d from every way to add a brand, while the plan has ended Site Audit, Action Center, Mentions, Citations, AI Referral Traffic, Shopping, Reports, Chat, brand settings and Settings now guard their actions with useUpgradeGate, as Prompts (ansvisor#1606) and Content (ansvisor#1609) do. Every way to add a brand (sidebar, /dashboard/brands, brand guard, /dashboard/brands/new) opens the dialog. Disconnects, key revokes and API key creation stay open. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ng stores open while read-only, and stop the site trust card's automatic re-read From the pre-push review: ending an access stays open, as disconnects do; a partial site trust result isn't re-read while the plan has ended, since that read scrapes. Adds tests for the audit page's Run audit and the integrations' property mapping, resets shared mocks between tests, closes the mobile menu before the dialog, and words the KPI preview for a read-only workspace. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…it too, while read-only At the limit, /dashboard/brands' Add Brand links to Billing; a read-only workspace now gets the dialog there as on every other way to add a brand. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ansvisor's decision (2026-10-27): deleting a brand only removes what the person gave us, so it stays open while the plan has ended. The API opens DELETE /brands/:id in ansvisor#1611. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…essage test main's catalog-client test (ansvisor#1583) asks for words for every StoreError code; 'subscription' opens the upgrade dialog instead of saying one, so the test leaves it out, as ansvisor#1613 does. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…y-guard-prompts Co-Authored-By: Claude Opus 5.5 <[email protected]>
…-guard-content Co-Authored-By: Claude Opus 5.5 <[email protected]>
…-guard-rest Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nd main's other new actions while the plan has ended main's new writes, with C3's guard pattern and labels: - Merchant Center (ansvisor#1583): picking and adding an account open the plan dialog ("Connecting a store needs a plan"); the server's 'subscription' refusal on Add opens it too, instead of looking up a missing settings.catalog.stores.errors.subscription message. - Category pages (ansvisor#1587): Change, Save, No page and Use the match are guarded; the catalog client reads the server's 402 subscription_inactive as 'subscription', which opens the dialog instead of the generic failure. - Brief › Shopping path (ansvisor#1591): Pick from the catalog, Pick again, Add product, Lock, Swap and Remove are guarded. - Action Center Check now (AC-010, ansvisor#1565) is guarded. New labels: changeCategoryPages, changeShoppingPath, checkTasks. Insert › Products (ansvisor#1607) already goes through the toolbar's guard and the read-only editor shows no insert menu; a test now says so. The Shopping rules (ansvisor#1610) change through the rules hook, already guarded. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…g it during render React's refs rule refuses passing add, which reads addingRef, to guard while rendering. add now opens the plan dialog itself on a read-only workspace. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Merged #1609's new head in, then guarded what main brought in since (4da9280, d6ce009): Merchant Center account pick and add (#1583), catalog category pages' Change, Save, No page and Use the match (#1587, its 402 now opens the dialog), Brief › Shopping path's actions (#1591), and the Action Center's Check now (#1565). Insert › Products was already behind the toolbar's lock (test added). The description lists them. Checks on the chain's tops: typecheck on every branch; at #1614, |
# Conflicts: # web/src/app/[locale]/(dashboard)/dashboard/brands/[id]/prompts/page.test.tsx
# Conflicts: # web/src/app/[locale]/(dashboard)/dashboard/content/library/page.test.tsx # web/src/app/[locale]/(dashboard)/dashboard/content/library/page.tsx
main's new brand page now reads BRAND_SETUP_LIMITS from ai-brand-setup (ansvisor#1661), which the test's mock left out. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The API (ansvisor#1613) leaves deleting a conversation open and the FAQ (ansvisor#1631) lists it among what still works, so the chat page asks before deleting instead of opening the plan dialog. It costs nothing, and people can always remove their own conversations. Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts: # web/src/app/[locale]/(dashboard)/layout.tsx # web/src/lib/mcp/data.ts
…ntent # Conflicts: # web/src/app/[locale]/(dashboard)/dashboard/content/_webhook-settings.tsx # web/src/app/[locale]/(dashboard)/dashboard/content/page.tsx
# Conflicts: # web/src/app/[locale]/(dashboard)/layout.tsx # web/src/components/action-center/action-drawer.tsx # web/src/components/action-center/action-table.tsx
|
Merged main forward (8356ba3) via #1609: resolved (dashboard)/layout.tsx, action-drawer.tsx and action-table.tsx (dismissing asks why through the read-only guard; Check now is guarded and follows main's pageCheckable). The Check now test's task now carries its change (#1683), and a duplicate import the merge brought in is removed. Typecheck and drawer/table tests pass. Also new here: 3b2b9a0 keeps deleting a chat open on a read-only workspace (see #1631). |
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…h its confirm The test opened the confirm only; it now presses Delete and expects the DELETE request, with no plan dialog. The file's header says deleting stays open.
gkhngyk
left a comment
There was a problem hiding this comment.
Looks good with 8251153: your 3b2b9a0 already keeps deleting a chat open, as I had done in 235158a8 (below). On top of it I added a test that presses Delete while locked and expects the DELETE request with no plan dialog (yours only opened the confirm), and fixed the file header that still said deleting opens the plan dialog.
This PR guarded the chat list's trash button: on a read-only workspace it opened the plan dialog ("Deleting chats needs a plan"). But DELETE /api/agent/conversations/[id] stays open for such a workspace (#1599 left it out of the gate, and #1613 lists it as open on purpose: deleting a conversation starts no cost), and #1631's FAQ lists "deleting an Agent Chat conversation" among what still works. So the button and the server disagreed. I made the web match the server:
agent/page.tsx: the trash button always asks its usual confirm, and Delete deletes. New chat and sending still open the dialog.en.json:readOnly.actions.deleteChatsremoved (nothing else used it).agent/page.test.tsx: the read-only test now checks that New chat and sending open the dialog (2 calls, nothing sent), and a new test deletes a conversation on a read-only workspace through its confirm (oneDELETE, the row gone). That test fails on d6ce009.
Deleting an audit or a report stays guarded, as you wrote: those match the server (audits through the API's 402, deleteReport through #1613's check).
What I checked:
- Own change.
origin/pr/1609..d6ce0099: 94 files, web only, no migration. Commits 2e2fd65, 7f1ba51, b29df54, 20913b2, 4da9280, d6ce009 and the merge of #1609. - The guards. Every handler in the description goes through
guard(fn, { action })or an explicitisLockedcheck before anything is sent, and each label exists inreadOnly.actions.*. A guard sits before each confirm (Delete in audits, reports, competitors, actions; Skip; Regenerate; Invite, which cancels the dialog's opening). The guardedonChange/onValueChange/onCheckedChangehandlers keep their controls as they were, since they're controlled. - What stays open matches the server and #1631: removing a member, revoking an invitation, creating and revoking API keys, removing an AI key, the disconnects (Search Console, Analytics, Webflow, the bot log connection, a store), deleting a brand, Billing and Account, reading and exports.
- Automatic calls while locked. The KPI preset isn't seeded, the site trust card's partial read isn't repeated (it scrapes), property auto-mapping doesn't save, the new-brand "run it?" question doesn't open, and the "page opened" mark isn't sent (its component now sits inside the dialog's provider, so it can read the lock).
- Adding a brand.
AddBrandLinkcovers the brands header, its empty state, the brand-limit link to Billing andbrand-guard's Create Brand; the sidebar and its mobile menu (closed first) open the dialog;/dashboard/brands/newreached directly can't create (step 2's Continue is guarded). Steps 3–5 need the created brand, so they're unreachable. - Paying workspaces. With
isLockedfalse everyguard()passes through, the effects run as on main, and the'subscription'codes added toCategoryPageErrorand Merchant Center's add are never returned. - Merge state on main (8356ba3). Besides the conflicts from #1599, #1606 and #1609, this PR's own files conflict in:
(dashboard)/layout.tsx:<GettingStartedPageOpened />moved insideUpgradeDialogProvider; keep it there, inside main'sMenuAccessProvidernesting (see #1599).components/action-center/action-drawer.tsxandaction-table.tsx(#1692, the dismiss reason; #1683/#1684, Check now): keep main's dismiss-reason dialog behind this PR's status guard, so a locked workspace gets the plan dialog before the reason is asked.
- Main's newer write buttons this PR doesn't reach yet (after the merge; the server refuses them through #1613, but they show a toast instead of the dialog): the Content Plan's Shopping "buying guide" create (#1617), the prompt page's demand card Track (#1651), and Settings › Menu access (#1704/#1705). Worth guarding in the merge or right after. Work areas (#1706/#1707) should stay open: see #1613.
- Tests. On 235158a8, the PR's 43 test files pass, and the chat tests above.
tsc --noEmit: no errors. eslint and prettier are clean on the files I touched.
Merge after #1609; #1614 is stacked on it (take-1614 merges this fix in).
Summary
Read-only, part C3: the remaining areas' actions, and every way to add a brand, open the plan dialog. On a workspace whose plan ended, every action that writes or costs opens #1599's "Choose a plan to keep going" dialog, naming the action, and runs nothing. The areas are Site Audit, Action Center, Mentions, Citations, AI Referral Traffic, Shopping, Reports, Chat, brand settings and Settings. On an active plan, and self-hosted, nothing changes.
Stacked on #1609 (C2), on #1606 (C1), on #1599. This PR's own change is its commits after #1609's: 2e2fd65, 7f1ba51 (the pre-push review's fixes), b29df54 (found in the browser check), 20913b2 (brand deletion stays open), and 4da9280 and d6ce009 (main's new actions, after merging main through #1609). Web only.
Same pattern as C1 and C2:
guard(handler, { action }), with labels inreadOnly.actions.*(66 new);Adding a brand, every way:
AddBrandLinkopens the dialog instead of/dashboard/brands/new. It's used for:brand-guard's Create Brand;/dashboard/brands/newreached directly: step 2's Continue, which creates the brand, opens the dialog.Guarded:
useIntegrationConnect, which Settings shares.Brought in by main since, guarded here (4da9280, d6ce009):
'subscription'answer opens it too, instead of a missing message.CategoryPageErrorgets'subscription').Left open:
COST_STOPPINGin fix(server): return a workspace's stored data on reads while its plan has ended, bound setup suggestions without a plan, and name billing's open writes #1611.DELETE /brands/:idin fix(server): return a workspace's stored data on reads while its plan has ended, bound setup suggestions without a plan, and name billing's open writes #1611.Related issue
None. Product decision (Ansvisor, 2026-10-27), including "adding a new brand, from Settings and everywhere". Follows #1599, #1606 and #1609.
Type of change
feat— New featurefix— Bug fixchore— Maintenance / dependenciesdocs— Documentation onlyrefactor— Code change that neither fixes a bug nor adds a featuretest— Adding or updating testsHow to test
cd web && yarn vitest run src/components/dashboard/add-brand-link.test.tsx src/components/layout/brand-switcher.test.tsx "src/app/[locale]/(dashboard)/dashboard/brands" "src/app/[locale]/(dashboard)/dashboard/audit" src/components/settingsChecked in the browser at 1024 px, light and dark, against the dev DB, with main's API in cloud mode and this web in cloud mode. The demo organization was set to a cancelled Growth plan, then put back. Each of these opened the dialog with its label, and the page stayed where it was:
/dashboard/brands' Add Brand, at the plan's brand limit (this check found the Billing link, fixed in b29df54);/dashboard/brands/new's step 2 Continue;Afterwards the database had no new brand, report or action status. Nothing scrolls sideways.
Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)Also run in
web/:yarn format,yarn lint(0 errors, the 7 earlier warnings);yarn typecheck;yarn test(4,321 tests);yarn build.For you, @gkhngyk:
noPlanwith 0 limits. Today they show "0/0 left", so Site Audit's Run is disabled rather than opening the dialog. A web PR on top of this one shows them as "no plan".🤖 Generated with Claude Code