5508e15da1
add Stripe checkout, portal, webhook ingestion, and idempotent event persistence add billing lifecycle state (grace/sync/timeline/admin visibility) and stronger entitlement handling add analytics event tracking and admin summary APIs plus account/pricing UI integration
31 lines
823 B
TypeScript
31 lines
823 B
TypeScript
export type AnalyticsEventName =
|
|
| 'pricing_plan_selected'
|
|
| 'checkout_started'
|
|
| 'checkout_completed'
|
|
| 'checkout_canceled'
|
|
| 'portal_opened'
|
|
| 'quota_warning_shown'
|
|
| 'quota_exhausted_blocked'
|
|
| 'feature_gate_encountered'
|
|
| 'addon_checkout_started'
|
|
| 'addon_purchase_completed'
|
|
| 'plan_changed'
|
|
| 'payment_failed'
|
|
| 'subscription_canceled';
|
|
|
|
export type AnalyticsEventSource = 'web_app' | 'api' | 'stripe_webhook' | 'system';
|
|
|
|
export interface AnalyticsEventInput {
|
|
eventName: AnalyticsEventName;
|
|
eventSource: AnalyticsEventSource;
|
|
userId?: string | null;
|
|
workspaceId?: string | null;
|
|
planCode?: string | null;
|
|
addonCode?: string | null;
|
|
resource?: string | null;
|
|
amount?: number | null;
|
|
currency?: string | null;
|
|
metadata?: Record<string, unknown>;
|
|
occurredAt?: string;
|
|
}
|