@bpinternal/billing-ui 0.21.0 → 0.23.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
@@ -184,25 +184,20 @@ export declare type BillingChangeEvent = {
184
184
  */
185
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'> &
186
186
  /**
187
- * `getWorkspaceMember` lives on the generic `@botpress/client`, not the
188
- * billing client, but is REQUIRED here: `useIsAuthorized` depends on it to
189
- * check the caller's workspace membership. Every host must pass a client
190
- * object that also exposes it. Still type-only — no runtime dep.
187
+ * `getWorkspaceMember` and `saveWorkspaceCancellationReasons` live on the
188
+ * generic `@botpress/client`, not the billing client, but are REQUIRED here:
189
+ * `useIsAuthorized` checks the caller's workspace membership, and the
190
+ * downgrade flow saves the cancellation survey answers. Every host must pass
191
+ * a client object that also exposes them. Still type-only — no runtime dep.
191
192
  */
192
- Pick<Client, 'getWorkspaceMember'> &
193
+ Pick<Client, 'getWorkspaceMember' | 'saveWorkspaceCancellationReasons'> &
193
194
  /**
194
195
  * Per-bot usage breakdown is OPTIONAL: those methods also live on the
195
196
  * generic `@botpress/client`, but only a host that wants the per-bot view
196
197
  * needs to pass a client exposing them. Omit them and the UsageDashboard
197
198
  * hides the per-bot section.
198
199
  */
199
- Partial<Pick<Client, 'breakDownWorkspaceUsageByBot' | 'listBots'>> & {
200
- /**
201
- * Persists the cancellation survey answers. Not part of the billing engine,
202
- * so every host implements it over its own backend
203
- */
204
- saveCancellationFeedback: (feedback: CancellationFeedback) => Promise<void>;
205
- };
200
+ Partial<Pick<Client, 'breakDownWorkspaceUsageByBot' | 'listBots'>>;
206
201
 
207
202
  export declare type BillingColorScheme = 'default' | 'neutral';
208
203
 
@@ -268,7 +263,8 @@ export declare type BillingProviderProps = {
268
263
  * Analytics sink the library captures billing-funnel events into. Pass a
269
264
  * `posthog-js` instance directly (it satisfies the shape), or any object with
270
265
  * a matching `capture`. Omit and every event no-ops. The event names + props
271
- * the library emits are listed in `BILLING_EVENTS`.
266
+ * the library emits are listed in `BILLING_EVENTS`. Every event also carries
267
+ * `workspace_billing_version`, `workspace_plan` and `workspace_is_paid` when known.
272
268
  */
273
269
  analytics?: BillingAnalyticsClient;
274
270
  /** Override the human label shown for a plan feature key (e.g. bot_count) */
@@ -1200,7 +1196,7 @@ export declare function usePlans(): UseQueryResult<Plan[], Error>;
1200
1196
 
1201
1197
  export declare const UsersIcon: ({ size, ...props }: IconProps) => JSX.Element;
1202
1198
 
1203
- /** Persists the cancellation survey answers. */
1199
+ /** Persists the cancellation survey answers; no-op without BillingProvider's `workspaceId`. */
1204
1200
  export declare function useSaveCancellationFeedback(): UseMutationResult<void, Error, CancellationFeedback>;
1205
1201
 
1206
1202
  /** Absolute add-on quantities for the current subscription (0 removes an add-on). */