feat(desktop): add billing frontend — plans, subscription, payment flow
Sprint 1: Desktop 计费闭环 - Add 7 billing types to saas-types.ts (BillingPlan, Subscription, UsageQuota, etc.) - Add 6 billing API methods to saas-billing.ts (listPlans, getSubscription, createPayment, etc.) - Extend saas-client.ts with interface merging for billing methods - Extend saasStore with billing state/actions (plans, subscription, payment polling) - Create PricingPage component with plan cards, usage bars, and checkout modal - Add billing page entry in SettingsLayout (CreditCard icon + route) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -115,6 +115,18 @@ import { installRelayMethods } from './saas-relay';
|
||||
import { installPromptMethods } from './saas-prompt';
|
||||
import { installTelemetryMethods } from './saas-telemetry';
|
||||
import { installBillingMethods } from './saas-billing';
|
||||
export type { UsageIncrementResult } from './saas-billing';
|
||||
|
||||
// Re-export billing types for convenience
|
||||
export type {
|
||||
BillingPlan,
|
||||
Subscription,
|
||||
UsageQuota,
|
||||
SubscriptionInfo,
|
||||
CreatePaymentRequest,
|
||||
PaymentResult,
|
||||
PaymentStatus,
|
||||
} from './saas-types';
|
||||
|
||||
// === Client Implementation ===
|
||||
|
||||
@@ -448,6 +460,7 @@ installRelayMethods(SaaSClient);
|
||||
installPromptMethods(SaaSClient);
|
||||
installTelemetryMethods(SaaSClient);
|
||||
installBillingMethods(SaaSClient);
|
||||
export { installBillingMethods };
|
||||
|
||||
// === API Method Type Declarations ===
|
||||
// These methods are installed at runtime by installXxxMethods() in saas-*.ts.
|
||||
@@ -506,6 +519,12 @@ export interface SaaSClient {
|
||||
// --- Billing (saas-billing.ts) ---
|
||||
incrementUsageDimension(dimension: string, count?: number): Promise<import('./saas-billing').UsageIncrementResult>;
|
||||
reportUsageFireAndForget(dimension: string, count?: number): void;
|
||||
listPlans(): Promise<import('./saas-types').BillingPlan[]>;
|
||||
getPlan(planId: string): Promise<import('./saas-types').BillingPlan>;
|
||||
getSubscription(): Promise<import('./saas-types').SubscriptionInfo>;
|
||||
getUsage(): Promise<import('./saas-types').UsageQuota>;
|
||||
createPayment(data: import('./saas-types').CreatePaymentRequest): Promise<import('./saas-types').PaymentResult>;
|
||||
getPaymentStatus(paymentId: string): Promise<import('./saas-types').PaymentStatus>;
|
||||
}
|
||||
|
||||
// === Singleton ===
|
||||
|
||||
Reference in New Issue
Block a user