Commit Graph
3 Commits
Author SHA1 Message Date
westfarn 19698658b1 Add subscription upgrade/change/cancel UX and account self-delete (#75) (#76)
Deploy Beta / unit-tests (push) Successful in 10s
Unit Tests / test (push) Successful in 11s
Deploy Beta / deploy-beta (push) Successful in 1m55s
## Summary
- Closes [#75](#75)
- Companion for [chat_backend#34](ai_ml_operations/chat_backend#34) (self-delete API)
- Account Billing: Upgrade / Change plan / Cancel CTAs (Stripe portal–first), plan picker when multiple public selectable plans exist, cancel confirmation with period-end messaging, complimentary users get no fake cancel
- Usage card Upgrade scrolls/focuses Billing; analytics for upgrade/change/cancel intents
- Danger Zone: email-confirmed `DELETE /user/` then logout → `/signin/`

## Test plan
- [ ] `npm test -- --watchAll=false --testPathPattern='BillingSection|DeleteAccountSection'`
- [ ] Paid Stripe user: Upgrade / Change plan / Cancel → portal (or checkout for higher selectable plan)
- [ ] Cancel confirm shows period-end access copy; scheduled cancel notice when `cancel_at_period_end`
- [ ] Backer/admin: complimentary message, no Cancel/Upgrade
- [ ] Delete account: confirm email → soft-delete → signed out at `/signin/`Reviewed-on: #76
2026-08-01 12:24:10 -07:00
westfarn 6a6e911ef8 Add Account Billing section + Stripe Customer Portal CTA (#33) (#71)
Deploy Beta / unit-tests (push) Successful in 10s
Unit Tests / test (push) Successful in 11s
Deploy Beta / deploy-beta (push) Successful in 1m58s
## Summary
- Closes [#33](#33)
- Add Billing glass cards on `/account/` (`Account2`): current plan summary + billing history from `GET /finance/invoices/` (and payments fallback)
- **Manage subscription** CTA → `POST /finance/portal/` → redirect to Stripe hosted Customer Portal (return URL `/account/`)
- Empty / unpaid users get **Complete payment** → Checkout instead of a dead portal button
- Visible errors for list/portal failures; fire `BILLING_PORTAL_OPENED`
- Depends on backend portal endpoint: [chat_backend#35](ai_ml_operations/chat_backend#35)

## Test plan
- [ ] `npm test -- --watchAll=false --testPathPattern='(BillingSection|finance\\.test)'`
- [ ] Signed-in user with paid invoices: plan + history render; Manage subscription redirects to portal URL
- [ ] User with no invoices: empty copy + Complete payment starts Checkout
- [ ] Portal/list API errors show alert text (no silent fail)
- [ ] Return from Stripe portal lands on `/account/`
- [ ] No card fields collected in-appReviewed-on: #71
2026-07-31 03:54:07 -07:00
westfarn 347fa75534 Tianji custom event tracking (auth, billing, chat) (#36) (#45)
Deploy Beta / unit-tests (push) Successful in 12s
Unit Tests / test (push) Successful in 12s
Deploy Beta / deploy-beta (push) Failing after 1m16s
## Summary

Closes #36.

Helpers / consent gating already exist from [#42](#42). This PR adds **call sites** + docs:

- `identifyAccount` + `AnalyticsSession` (identify on session; `Logout` when auth ends)
- Auth: Sign In / Sign Up / AuthCallback (SSO) success & fail
- Billing: Checkout started, Payment Success / Canceled
- Chat: Conversation Created, Message Sent (metadata only — no prompt text)
- ToS Acknowledged
- `BILLING_PORTAL_OPENED` reserved until Account portal (#33)
- Catalog: [`llm-fe/ANALYTICS.md`](llm-fe/ANALYTICS.md)

No `chat_backend` changes required.

## Test plan

- [ ] Grant consent on beta → sign in → Tianji shows Login Success + identify
- [ ] Decline consent → same actions produce no custom events (page views still ok)
- [ ] Sign up + checkout + cancel/success return URLs fire expected events
- [ ] New chat + send message → Conversation Created / Message Sent without prompt text
- [ ] Acknowledge ToS → ToS Acknowledged
- [ ] `npm run test:ci -- --testPathPattern='analytics.test|SignIn.test|SignUp.test|AuthCallback.test'`Reviewed-on: #45
2026-07-27 08:40:19 -07:00