Repository navigation
feat(web): show "No active plan" instead of a used-up quota while the plan has ended, and keep the buttons opening the plan dialog - #1614
Merged
gkhngyk merged 37 commits intoOct 28, 2026
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]>
… plan has ended, and keep the buttons opening the plan dialog With ansvisor#1611, an ended workspace's quota reads come back as `noPlan` with 0 limits. isNoPlan(quota, isLocked) keeps those from reading as used up: Site Audit, Prompts, the content usage card, Improve and the opportunity panel say "No active plan" instead of a red 0/0 or "limit reached", and their buttons stay clickable so the guard opens the dialog. The AI bot report shows the workspace's own data instead of the Starter upsell. Setup's suggestions name the onboarding daily limit (429) on their own. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…upsell and one lock rule while the plan has ended From the pre-push review: the Prompts row menu still looks up an open content suggestion with no plan; an ended Starter workspace keeps the bot report's upsell (its old plan has no report), read from the plan the web already knows; auditBlock, bulkSuggestBlock and the bot states take isLocked as the pages do; the audit settings and the content usage tooltip don't speak of a plan that renews; setup's prompt step keeps its own "add your own" line. Improve's unreachable no-plan branch is gone. Tests for the onboarding limit and the quota meter. 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]>
…-plan-display 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]>
…-plan-display Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Oct 27, 2026
Merged
feat(billing): show the plans in the read-only dialog, with Monthly or Annual and a promo code
#1604
Merged
Merged
Collaborator
Author
|
Merged #1612's new head in (8c8f1ea), no conflicts. Checks on the chain's tops: typecheck on every branch; at #1614, |
This was referenced Oct 27, 2026
Merged
# 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
# Conflicts: # web/src/app/[locale]/(onboarding)/dashboard/onboarding/page.tsx # web/src/lib/ai-brand-setup.test.ts # web/src/lib/ai-brand-setup.ts
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]>
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
…play # Conflicts: # web/src/app/[locale]/(onboarding)/dashboard/onboarding/page.tsx
Collaborator
Author
…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.
… test Main's "What do you work on?" step brought menu access's server actions into the onboarding page, and with them the service client, which the test can't build without its keys: the file failed to load.
gkhngyk
approved these changes
Oct 28, 2026
gkhngyk
left a comment
Contributor
There was a problem hiding this comment.
Looks good with e2ce275: it carries #1612's test, and the onboarding page test now mocks @/lib/actions/menu-access, since main's work-areas step pulls in the admin client, which doesn't load in tests.
What I checked:
- Own change.
origin/pr/1612..8c8f1eae: 42 files, web only, no migration (7a0d064, f660b0a and the merges of #1612). - One rule.
isNoPlan(quota, isLocked)is true when the server sendsnoPlanor the workspace is locked, and every place that used to read 0 of 0 as "used up" now asks it first: Site Audit (Run, both bulk bars, the overview card's "—" and "No active plan", the settings dialog's line, the empty-pool message), Prompts (the analyses line, the Analyze banner, the bulk Suggest block, the row menu), Content (the usage card, + New, the opportunity panel's briefs line), Traffic (auditBlock) and the AI bot report. Where it's true, the buttons stay clickable and their guards open the dialog. On an active plannoPlannever comes andisLockedis false, so every branch is as before. - The AI bot report. Without an active plan both caps read 0, so the lock is now decided by the plan the workspace was on (
PLANS[planId].limits.maxBotEventsPerMonth === 0): a former Starter keeps its Upgrade; a former Growth sees its connections and stored rows, and Create connection opens the dialog (#1612's guard). The usage line says "This month: N detailed rows · No active plan" rather than "of 0". - The row menu's open suggestion. A prompt with a written content suggestion still shows "Open content suggestion" while locked: the menu reads it when the quota is used up or there's no plan, and opening costs nothing.
- Setup's daily limit.
failure()turns only a 429 withcode: 'onboarding_daily_limit'intoSetupDailyLimitError, which matches the API'sONBOARDING_LIMIT_REACHEDon main. Each step then says the suggestions are used up for today and hides Try again; any other failure reads as before. - Copy. "No active plan" is muted, never red. The content usage tooltip drops "Both reset on {date}…" when there's no renewal. The two setup lines read well.
- Merge state on main (8356ba3). Besides the conflicts from #1599, #1606, #1609 and #1612, this PR's own files conflict in:
web/src/lib/ai-brand-setup.ts(#1661 sends the prompts call in batches of 20 topics): put this PR'sthrow await failure(res, 'Failed to generate prompts')inside main's per-batch call, where main hasthrow new Error(…). A batch past the limit then rejects the wholePromise.allwithSetupDailyLimitError, which is what the step reads.web/src/lib/ai-brand-setup.test.ts: add/add (#1661 added a test file at the same path). Keep both sets of tests in one file, or move this PR's toai-brand-setup.daily-limit.test.ts.(onboarding)/dashboard/onboarding/page.tsx(#1661'sBRAND_SETUP_LIMITS, #1707'stWelcome): keep both imports and bothuseTranslationslines.dashboard/content/page.tsx(#1672): keep both imports.
- Your note on Prompts' "Plan & usage" fold is done on main by #1671 (an ended workspace shows its own plan there).
- Tests. On 0f142e99, the PR's 17 test files pass, and the chat tests.
tsc --noEmit: no errors.
Merge after #1612.
8 of 10 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Read-only, part F: the web reads #1611's answers, so an ended workspace sees "No active plan" instead of a used-up quota, and its buttons still open the plan dialog.
With #1611, an ended workspace's quota reads come back with
noPlan: trueand every limit 0. Without this PR the web read that as "used up":The AI bot report also read the 0 cap as "comes with Growth" and showed sample data and the upsell, hiding the workspace's own data. On an active plan, and self-hosted, nothing changes:
noPlannever comes and the workspace isn't locked.Stacked on #1612 (C3), on #1609, #1606 and #1599. Pairs with #1611: until it's live, these reads still answer 402 and the quotas stay empty, as today. This PR's own change is its commits after #1612's: 7a0d064, f660b0a (the pre-push review's fixes) and 8a2f84a (#1612's last commit merged in). Web only.
One rule:
isNoPlan(quota, isLocked)(web/src/lib/billing/no-plan.ts) is true when the server saysnoPlanor the workspace is locked. Where it's true, a quota doesn't count as used up. One muted line says "No active plan" (readOnly.noPlan), never red. The pure helpers (auditBlock,bulkSuggestBlock, the bot states) takeisLockedtoo, so every place follows the same rule.Where:
onboarding_daily_limit) gets its own line in the topics, prompts and competitors steps: "Setup suggestions are used up for today. Try again tomorrow, or add your own."Related issue
None. The web side of #1611 (your #1589 follow-up 1), and the product decision (Ansvisor, 2026-10-27).
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/lib/billing src/lib/ai-bots.test.ts src/lib/ai-brand-setup.test.ts "src/app/[locale]/(dashboard)/dashboard/audit" "src/app/[locale]/(dashboard)/dashboard/traffic" "src/app/[locale]/(onboarding)"Checked in the browser at 1024 px, light and dark, against the dev DB, with #1611's API and this web, both in cloud mode. The demo organization was set to a cancelled Growth plan, then put back.
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,357 tests): the Library's "fifty at a time" test failed under load and its 43 tests pass alone;yarn build.For you, @gkhngyk:
/api/prompts/usage, which this stack doesn't touch. I'll look at it in its own PR.past_duereads "No active plan" too, while the dialog says "Update payment method". A separate line for that case can follow if you want one.🤖 Generated with Claude Code