@bpinternal/billing-ui 0.20.0 → 0.22.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 +36 -5
- package/dist/index.js +6218 -5934
- package/dist/index.umd.cjs +1 -1
- package/dist/style.css +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Appearance } from '@stripe/stripe-js';
|
|
2
2
|
import { billing } from '@botpress/client';
|
|
3
3
|
import { ButtonHTMLAttributes } from 'react';
|
|
4
|
+
import { CancellationReason } from '@bpinternal/const';
|
|
4
5
|
import { ClassValue } from 'clsx';
|
|
5
6
|
import { Client } from '@botpress/client';
|
|
6
7
|
import { ComponentType } from 'react';
|
|
@@ -118,6 +119,9 @@ export declare const BILLING_EVENTS: {
|
|
|
118
119
|
readonly PLAN_UPGRADE_INITIATED: "billing_plan_upgrade_initiated";
|
|
119
120
|
readonly PLAN_DOWNGRADED: "billing_plan_downgraded";
|
|
120
121
|
readonly PLAN_DOWNGRADE_CANCELLED: "billing_plan_downgrade_cancelled";
|
|
122
|
+
readonly DOWNGRADE_CONFIRM_VIEWED: "billing_downgrade_confirm_viewed";
|
|
123
|
+
readonly DOWNGRADE_SURVEY_VIEWED: "billing_downgrade_survey_viewed";
|
|
124
|
+
readonly DOWNGRADE_SURVEY_SUBMITTED: "billing_downgrade_survey_submitted";
|
|
121
125
|
readonly CHECKOUT_STEP_VIEWED: "billing_checkout_step_viewed";
|
|
122
126
|
readonly CHECKOUT_INTERVAL_CHANGED: "billing_checkout_interval_changed";
|
|
123
127
|
readonly PAYMENT_METHOD_SELECTED: "billing_payment_method_selected";
|
|
@@ -180,12 +184,13 @@ export declare type BillingChangeEvent = {
|
|
|
180
184
|
*/
|
|
181
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'> &
|
|
182
186
|
/**
|
|
183
|
-
* `getWorkspaceMember`
|
|
184
|
-
* billing client, but
|
|
185
|
-
*
|
|
186
|
-
*
|
|
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.
|
|
187
192
|
*/
|
|
188
|
-
Pick<Client, 'getWorkspaceMember'> &
|
|
193
|
+
Pick<Client, 'getWorkspaceMember' | 'saveWorkspaceCancellationReasons'> &
|
|
189
194
|
/**
|
|
190
195
|
* Per-bot usage breakdown is OPTIONAL: those methods also live on the
|
|
191
196
|
* generic `@botpress/client`, but only a host that wants the per-bot view
|
|
@@ -327,6 +332,29 @@ export declare type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
|
327
332
|
|
|
328
333
|
export declare const CalendarIcon: ({ size, ...props }: IconProps) => JSX.Element;
|
|
329
334
|
|
|
335
|
+
/** Answers from the cancellation survey shown before a downgrade. */
|
|
336
|
+
export declare type CancellationFeedback = {
|
|
337
|
+
reason: CancellationReason;
|
|
338
|
+
comment?: string;
|
|
339
|
+
/** Plan being left. */
|
|
340
|
+
previousPlanId: string;
|
|
341
|
+
/** Plan being downgraded to. */
|
|
342
|
+
planId: string;
|
|
343
|
+
};
|
|
344
|
+
|
|
345
|
+
/** Two-step downgrade flow: what the user loses, then why they're leaving. */
|
|
346
|
+
export declare const CancellationSurveyDialog: ({ open, onOpenChange, planId, onConfirm, loading, planFeatures, }: CancellationSurveyDialogProps) => JSX.Element;
|
|
347
|
+
|
|
348
|
+
export declare type CancellationSurveyDialogProps = {
|
|
349
|
+
open: boolean;
|
|
350
|
+
onOpenChange: (open: boolean) => void;
|
|
351
|
+
/** Plan the user is downgrading to. */
|
|
352
|
+
planId: string;
|
|
353
|
+
onConfirm: (feedback: CancellationFeedback) => void;
|
|
354
|
+
loading?: boolean;
|
|
355
|
+
planFeatures?: Partial<Record<PlanKind, PlanFeatureId[]>>;
|
|
356
|
+
};
|
|
357
|
+
|
|
330
358
|
/** Minimal card-brand badge (saved-card row). Stripe's own UI shows real brand art. */
|
|
331
359
|
export declare const CardBrandBadge: ({ brand }: {
|
|
332
360
|
brand: string;
|
|
@@ -1167,6 +1195,9 @@ export declare function usePlans(): UseQueryResult<Plan[], Error>;
|
|
|
1167
1195
|
|
|
1168
1196
|
export declare const UsersIcon: ({ size, ...props }: IconProps) => JSX.Element;
|
|
1169
1197
|
|
|
1198
|
+
/** Persists the cancellation survey answers; no-op without BillingProvider's `workspaceId`. */
|
|
1199
|
+
export declare function useSaveCancellationFeedback(): UseMutationResult<void, Error, CancellationFeedback>;
|
|
1200
|
+
|
|
1170
1201
|
/** Absolute add-on quantities for the current subscription (0 removes an add-on). */
|
|
1171
1202
|
export declare function useSetAddons(): UseMutationResult<Subscription, Error, {
|
|
1172
1203
|
addons: Record<string, number>;
|