@bpinternal/billing-ui 0.0.1 → 0.1.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 +39 -28
- package/dist/index.js +1826 -1777
- package/dist/index.umd.cjs +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -68,6 +68,24 @@ export declare type BadgeProps = {
|
|
|
68
68
|
|
|
69
69
|
export declare const BankIcon: ({ size, ...props }: IconProps) => JSX.Element;
|
|
70
70
|
|
|
71
|
+
export declare const BILLING_EVENTS: {
|
|
72
|
+
readonly PLAN_PICKER_VIEWED: "billing_plan_picker_viewed";
|
|
73
|
+
readonly PLAN_INTERVAL_TOGGLED: "billing_plan_interval_toggled";
|
|
74
|
+
readonly PLAN_UPGRADE_INITIATED: "billing_plan_upgrade_initiated";
|
|
75
|
+
readonly PLAN_DOWNGRADED: "billing_plan_downgraded";
|
|
76
|
+
readonly PLAN_DOWNGRADE_CANCELLED: "billing_plan_downgrade_cancelled";
|
|
77
|
+
readonly CHECKOUT_STEP_VIEWED: "billing_checkout_step_viewed";
|
|
78
|
+
readonly CHECKOUT_INTERVAL_CHANGED: "billing_checkout_interval_changed";
|
|
79
|
+
readonly PAYMENT_METHOD_SELECTED: "billing_payment_method_selected";
|
|
80
|
+
readonly PAYMENT_DETAILS_CONFIRMED: "billing_payment_details_confirmed";
|
|
81
|
+
readonly PLAN_UPGRADED: "billing_plan_upgraded";
|
|
82
|
+
readonly CHECKOUT_ERROR: "billing_checkout_error";
|
|
83
|
+
readonly PAYMENT_METHOD_UPDATED: "billing_payment_method_updated";
|
|
84
|
+
readonly BILLING_ADDRESS_UPDATED: "billing_address_updated";
|
|
85
|
+
readonly INVOICE_DOWNLOADED: "billing_invoice_downloaded";
|
|
86
|
+
readonly UPGRADE_CTA_CLICKED: "billing_upgrade_cta_clicked";
|
|
87
|
+
};
|
|
88
|
+
|
|
71
89
|
export declare type BillingAddress = {
|
|
72
90
|
lineOne: string;
|
|
73
91
|
lineTwo?: string;
|
|
@@ -77,32 +95,17 @@ export declare type BillingAddress = {
|
|
|
77
95
|
country: string;
|
|
78
96
|
};
|
|
79
97
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
plan_name: string;
|
|
92
|
-
interval: BillingInterval;
|
|
93
|
-
amount_paid: number;
|
|
94
|
-
next_cycle_amount: number;
|
|
95
|
-
previous_plan_name?: string;
|
|
96
|
-
previous_interval?: BillingInterval;
|
|
97
|
-
}) => void;
|
|
98
|
-
trackPlanDowngraded?: (props: {
|
|
99
|
-
plan_name: string;
|
|
100
|
-
interval: BillingInterval;
|
|
101
|
-
previous_plan_name?: string;
|
|
102
|
-
}) => void;
|
|
103
|
-
trackPlanDowngradeCancelled?: (props: {
|
|
104
|
-
plan_name: string;
|
|
105
|
-
}) => void;
|
|
98
|
+
/**
|
|
99
|
+
* Analytics sink the library captures billing events into. Structurally a subset
|
|
100
|
+
* of a `posthog-js` instance — pass `posthog` straight in (no adapter), or any
|
|
101
|
+
* object with a matching `capture`. The library never imports an analytics SDK,
|
|
102
|
+
* so it stays publishable and provider-agnostic. Omit it and every event no-ops.
|
|
103
|
+
*
|
|
104
|
+
* Event names + property shapes the library emits live in `BILLING_EVENTS`
|
|
105
|
+
* (./analytics) — that's the source of truth for what lands in your project.
|
|
106
|
+
*/
|
|
107
|
+
export declare type BillingAnalyticsClient = {
|
|
108
|
+
capture: (event: string, properties?: Record<string, unknown>) => void;
|
|
106
109
|
};
|
|
107
110
|
|
|
108
111
|
export declare type BillingChangeEvent = {
|
|
@@ -137,7 +140,7 @@ declare type BillingContextValue = {
|
|
|
137
140
|
locale: string;
|
|
138
141
|
isDark: boolean;
|
|
139
142
|
toast: (toast: BillingToast) => void;
|
|
140
|
-
analytics:
|
|
143
|
+
analytics: BillingAnalyticsClient;
|
|
141
144
|
featureLabels?: Record<string, (quantity: number) => string>;
|
|
142
145
|
isOutdatedBilling: boolean;
|
|
143
146
|
manageBillingUrl?: string;
|
|
@@ -149,6 +152,8 @@ declare type BillingContextValue = {
|
|
|
149
152
|
notifyBillingChange: (event: BillingChangeEvent) => void;
|
|
150
153
|
};
|
|
151
154
|
|
|
155
|
+
export declare type BillingEventName = (typeof BILLING_EVENTS)[keyof typeof BILLING_EVENTS];
|
|
156
|
+
|
|
152
157
|
export declare type BillingInterval = 'month' | 'year';
|
|
153
158
|
|
|
154
159
|
export declare const billingKeys: {
|
|
@@ -180,7 +185,13 @@ export declare type BillingProviderProps = {
|
|
|
180
185
|
locale?: string;
|
|
181
186
|
theme?: BillingTheme;
|
|
182
187
|
onToast?: (toast: BillingToast) => void;
|
|
183
|
-
|
|
188
|
+
/**
|
|
189
|
+
* Analytics sink the library captures billing-funnel events into. Pass a
|
|
190
|
+
* `posthog-js` instance directly (it satisfies the shape), or any object with
|
|
191
|
+
* a matching `capture`. Omit and every event no-ops. The event names + props
|
|
192
|
+
* the library emits are listed in `BILLING_EVENTS`.
|
|
193
|
+
*/
|
|
194
|
+
analytics?: BillingAnalyticsClient;
|
|
184
195
|
/** Override the human label shown for a plan feature key (e.g. bot_count) */
|
|
185
196
|
featureLabels?: Record<string, (quantity: number) => string>;
|
|
186
197
|
/**
|