Skip to content

feat(customer-portal): plans page with cross-product subscription management - #1

Merged
rrader26 merged 1 commit into
mainfrom
feat/customer-portal-plan-switching
May 22, 2026
Merged

feat(customer-portal): plans page with cross-product subscription management#1
rrader26 merged 1 commit into
mainfrom
feat/customer-portal-plan-switching

Conversation

@rrader26

Copy link
Copy Markdown

Companion PR: https://github.com/ThinkfleetAI/lago-api (Phase 2A). Adds PlansPage component with current-sub list, per-product Switch/Cancel actions, and Add-a-Product cross-sell. New /plans route + sidebar card. 11 i18n strings. Requires lago-api PR merged first. 🤖 Generated with Claude Code.

…agement

End users can now manage their subscriptions self-service from the hosted
customer portal — no admin intervention or app-side Plan Selector needed.

Adds:
- PlansPage component (src/components/customerPortal/plans/PlansPage.tsx)
  groups plans by product key (extracted from code prefix: aistack-*,
  growth-*, memory-*, etc.) and renders three actions per plan:
    * Current plan badge (already subscribed)
    * Switch to this plan (within same product → in-place plan change
      via PlanUpgradeService, proration handled)
    * Add to my account (NEW subscription for a product the customer
      doesn't yet have)
  Plus per-product Cancel button with browser confirm dialog.

- New /customer-portal/:token/plans route
- New viewPlans navigator in useCustomerPortalNavigation hook
- "Plans & Subscriptions" card in main portal index linking to the page
- 11 translation strings (English base.json — other locales fall back)

Powered by 4 customer-portal-scoped GraphQL ops added to lago-api fork:
  - customerPortalAvailablePlans (query)
  - changeCustomerPortalSubscriptionPlan (mutation)
  - createCustomerPortalSubscription (mutation)
  - terminateCustomerPortalSubscription (mutation)

Phase 2 of the ThinkFleet billing integration: Lago portal becomes the
single canonical place for end-user subscription self-service across all
products in the ecosystem.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@rrader26
rrader26 merged commit 968bbf6 into main May 22, 2026
3 of 8 checks passed
rrader26 pushed a commit that referenced this pull request May 22, 2026
- Regenerate src/generated/graphql.tsx against live lago-api so the new
  customerPortal subscription hooks (Available plans query + change/create/
  terminate mutations) resolve at compile time.
- Replace window.confirm with WarningDialog (eslint no-alert rule).
- Type formatPrice's currency arg as CurrencyEnum instead of `as any`.
- Re-format with prettier.

Resolves the build failure on the PR #1 merge (build was failing because
the generated types hadn't been regenerated yet).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant