## 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
33 lines
1.6 KiB
Markdown
33 lines
1.6 KiB
Markdown
# Tianji product events (Hesychia)
|
|
|
|
Helpers: `llm-fe/src/llm-fe/utils/analytics.ts`
|
|
Consent gate: custom events + identify only when `hesychia_analytics_consent*` is `granted` (see #37).
|
|
Page views: always via `Tracker` / `tracker.js` on prod + beta.
|
|
|
|
## Event catalog
|
|
|
|
| Event name | Constant | Call site(s) | Payload (non-PII) |
|
|
|------------|----------|--------------|-------------------|
|
|
| Login Success | `LOGIN_SUCCESS` | SignIn, AuthCallback | `{ method: 'password' \| 'sso' }` |
|
|
| Login Failed | `LOGIN_FAILED` | SignIn, AuthCallback | `{ method }` |
|
|
| Sign Up Started | `SIGNUP_STARTED` | SignUp | — |
|
|
| Sign Up Success | `SIGNUP_SUCCESS` | SignUp, AuthCallback (`created`) | `{ method? }` |
|
|
| Sign Up Failed | `SIGNUP_FAILED` | SignUp, AuthCallback | `{ method? }` |
|
|
| Logout | `LOGOUT` | AnalyticsSession (auth → logged out) | — |
|
|
| Checkout Started | `CHECKOUT_STARTED` | SignUp, AuthCallback | `{ source }` |
|
|
| Payment Success | `PAYMENT_SUCCESS` | BillingSuccess | `{ hasSessionId }` |
|
|
| Payment Canceled | `PAYMENT_CANCELED` | BillingCancel | — |
|
|
| Conversation Created | `CONVERSATION_CREATED` | MessageContext | `{ conversationId }` |
|
|
| Message Sent | `MESSAGE_SENT` | AsyncDashboard2 | `{ hasConversation, hasAttachment }` |
|
|
| ToS Acknowledged | `TOS_ACKNOWLEDGED` | TermsOfService | — |
|
|
| Billing Portal Opened | `BILLING_PORTAL_OPENED` | BillingSection (Account) | — |
|
|
|
|
## Identify
|
|
|
|
`identifyAccount(account)` sends `{ userId: email, companyId?, isCompanyManager? }`.
|
|
No message text, document contents, or names.
|
|
|
|
## Environments
|
|
|
|
Only prod/beta (`REACT_APP_DEPLOY_ENV` or production build with Tianji website id). Local dev skips unless env set.
|