@bpinternal/billing-ui 0.23.0 → 0.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -29,11 +29,11 @@ export declare type Addon = Awaited<ReturnType<BillingClient['listAddons']>>[num
29
29
  export declare function addonDisplayName(name: string): string;
30
30
 
31
31
  /**
32
- * "Now → New" resource totals once the selected add-on quantities are applied.
33
- * new = plan base feature + Σ (quantity × add-on increment) across add-ons that grant it.
34
- * Only returns rows that actually change, so the preview stays focused.
32
+ * "Now → New" resource totals: plan base + add-ons owned now (`currentQuantities`) vs. plan base +
33
+ * the selected add-on quantities (`quantities`). One row per resource an add-on grants, even when
34
+ * unchanged (e.g. reverting a scheduled downgrade).
35
35
  */
36
- export declare function addonLimitsPreview(plan: Plan, addons: Addon[] | undefined, quantities: Record<string, number>): LimitPreviewRow[];
36
+ export declare function addonLimitsPreview(plan: Plan, addons: Addon[] | undefined, quantities: Record<string, number>, currentQuantities?: Record<string, number>): LimitPreviewRow[];
37
37
 
38
38
  /**
39
39
  * Add-on price for a given plan. Smaug keys add-on prices by plan id
@@ -64,17 +64,17 @@ export declare type AddonsSummaryCardProps = {
64
64
 
65
65
  export declare const AgentsIcon: ({ size, ...props }: IconProps) => JSX.Element;
66
66
 
67
- export declare const ArrowRightIcon: ({ size, ...props }: IconProps) => JSX.Element;
68
-
69
- export declare const AutoRechargeDialog: ({ open, onOpenChange, onSuccess, onUpgrade }: AutoRechargeDialogProps) => JSX.Element | null;
67
+ export declare const AiCreditsDialog: ({ open, onOpenChange, onSuccess, onUpgrade }: AiCreditsDialogProps) => JSX.Element | null;
70
68
 
71
- export declare type AutoRechargeDialogProps = {
69
+ export declare type AiCreditsDialogProps = {
72
70
  open: boolean;
73
71
  onOpenChange: (open: boolean) => void;
74
72
  onSuccess?: () => void;
75
73
  onUpgrade?: () => void;
76
74
  };
77
75
 
76
+ export declare const ArrowRightIcon: ({ size, ...props }: IconProps) => JSX.Element;
77
+
78
78
  export declare type AutoRechargeSetting = AutoRechargeSettings[string];
79
79
 
80
80
  export declare type AutoRechargeSettingInput = {
@@ -92,7 +92,7 @@ export declare type AutoRechargeSettings = Awaited<ReturnType<BillingClient['get
92
92
  /**
93
93
  * Clickable summary of auto-recharge for the AI-spend credit wallet (on/off,
94
94
  * and the recharge amount + monthly limit when on). Acts as a preview button
95
- * that opens `AutoRechargeDialog` — the settings themselves are edited there,
95
+ * that opens `AiCreditsDialog` — the settings themselves are edited there,
96
96
  * not inline.
97
97
  */
98
98
  export declare const AutoRechargeSummaryCard: ({ onManage, className }: AutoRechargeSummaryCardProps) => JSX.Element | null;
@@ -106,7 +106,7 @@ export declare type AutoRechargeSummaryCardProps = {
106
106
  export declare const Badge: ({ variant, children, className }: BadgeProps) => JSX.Element;
107
107
 
108
108
  export declare type BadgeProps = {
109
- variant?: 'accent' | 'neutral' | 'success';
109
+ variant?: 'accent' | 'neutral' | 'success' | 'danger';
110
110
  children: ReactNode;
111
111
  className?: string;
112
112
  };
@@ -170,7 +170,7 @@ export declare type BillingAnalyticsClient = {
170
170
  };
171
171
 
172
172
  export declare type BillingChangeEvent = {
173
- type: 'subscription' | 'addons' | 'payment-method' | 'billing-address' | 'auto-recharge' | 'pending-upgrade';
173
+ type: 'subscription' | 'addons' | 'payment-method' | 'billing-address' | 'auto-recharge' | 'pending-upgrade' | 'credit-grant';
174
174
  };
175
175
 
176
176
  /**
@@ -182,7 +182,7 @@ export declare type BillingChangeEvent = {
182
182
  * this interface over your own backend proxy (e.g. tRPC) — the shapes are the
183
183
  * official wire shapes, the transport is yours.
184
184
  */
185
- export declare type BillingClient = Pick<billing.Client, 'listPlans' | 'listAddons' | 'getSubscription' | 'previewSubscriptionUpdate' | 'setPlan' | 'setAddons' | 'getPaymentMethod' | 'createPaymentMethodIntent' | 'setPaymentMethod' | 'getCustomer' | 'setCustomer' | 'listInvoices' | 'getBillingReadonly' | 'getWorkspaceUsages' | 'getAutoRechargeSettings' | 'setAutoRechargeSettings' | 'payInvoice' | 'cancelPendingSubscriptionUpgrade'> &
185
+ export declare type BillingClient = Pick<billing.Client, 'listPlans' | 'listAddons' | 'getSubscription' | 'previewSubscriptionUpdate' | 'setPlan' | 'setAddons' | 'getPaymentMethod' | 'createPaymentMethodIntent' | 'setPaymentMethod' | 'getCustomer' | 'setCustomer' | 'listInvoices' | 'getBillingReadonly' | 'getWorkspaceUsages' | 'getAutoRechargeSettings' | 'setAutoRechargeSettings' | 'payInvoice' | 'cancelPendingSubscriptionUpgrade' | 'listCreditGrants' | 'createCreditGrant'> &
186
186
  /**
187
187
  * `getWorkspaceMember` and `saveWorkspaceCancellationReasons` live on the
188
188
  * generic `@botpress/client`, not the billing client, but are REQUIRED here:
@@ -243,6 +243,7 @@ export declare const billingKeys: {
243
243
  autoRecharge: (scope: string) => readonly ["bpb", string, "auto-recharge"];
244
244
  usages: (scope: string, period: string) => readonly ["bpb", string, "usages", string];
245
245
  bots: (scope: string) => readonly ["bpb", string, "bots"];
246
+ creditGrants: (scope: string) => readonly ["bpb", string, "credit-grants", "paged"];
246
247
  usageByBot: (scope: string, type: string, period: string) => readonly ["bpb", string, "usage-by-bot", string, string];
247
248
  };
248
249
 
@@ -1170,6 +1171,9 @@ export declare function useCreatePaymentMethodIntent(): UseMutationResult<{
1170
1171
 
1171
1172
  export declare function useCustomer(options?: QueryOptions): UseQueryResult<Customer, Error>;
1172
1173
 
1174
+ /** Whether a payment needs attention: a pending plan/add-on upgrade or a failed auto-recharge. */
1175
+ export declare function useHasPaymentFailure(options?: QueryOptions): boolean;
1176
+
1173
1177
  /** Whether the subscription has a plan/add-on change awaiting payment confirmation. */
1174
1178
  export declare function useHasPendingUpgrade(options?: QueryOptions): boolean;
1175
1179