@carlonicora/nextjs-jsonapi 5.5.0 → 5.6.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/{BlockNoteEditor-THBJH2UR.js → BlockNoteEditor-AE3ZTEEH.js} +19 -19
- package/dist/{BlockNoteEditor-THBJH2UR.js.map → BlockNoteEditor-AE3ZTEEH.js.map} +1 -1
- package/dist/{BlockNoteEditor-GVQCKRMU.mjs → BlockNoteEditor-NEYG5L6W.mjs} +4 -4
- package/dist/{BlockNoteViewer-U6E3DS4F.mjs → BlockNoteViewer-3OUT5UFY.mjs} +2 -2
- package/dist/{BlockNoteViewer-VZOVKTFO.js → BlockNoteViewer-4CFKQM7U.js} +3 -3
- package/dist/{BlockNoteViewer-VZOVKTFO.js.map → BlockNoteViewer-4CFKQM7U.js.map} +1 -1
- package/dist/billing/index.d.mts +186 -25
- package/dist/billing/index.d.ts +186 -25
- package/dist/billing/index.js +1148 -587
- package/dist/billing/index.js.map +1 -1
- package/dist/billing/index.mjs +785 -224
- package/dist/billing/index.mjs.map +1 -1
- package/dist/{chunk-WPYT4UKJ.js → chunk-3I5AAJXV.js} +3 -3
- package/dist/{chunk-WPYT4UKJ.js.map → chunk-3I5AAJXV.js.map} +1 -1
- package/dist/{chunk-YDYVJM4I.js → chunk-53BAULDP.js} +4 -4
- package/dist/{chunk-YDYVJM4I.js.map → chunk-53BAULDP.js.map} +1 -1
- package/dist/{chunk-3CGROPF3.mjs → chunk-BTPUYUQ3.mjs} +2 -2
- package/dist/{chunk-VC5A3AUZ.mjs → chunk-EYA2F6AN.mjs} +696 -4
- package/dist/chunk-EYA2F6AN.mjs.map +1 -0
- package/dist/{chunk-G6UE6MEP.js → chunk-HKZAESS6.js} +896 -204
- package/dist/chunk-HKZAESS6.js.map +1 -0
- package/dist/{chunk-W7F5BDSV.mjs → chunk-KQHBONL4.mjs} +2 -2
- package/dist/{chunk-TY5FYP3G.js → chunk-LQ4DK4JF.js} +1919 -1056
- package/dist/chunk-LQ4DK4JF.js.map +1 -0
- package/dist/{chunk-S4YJ5WCW.js → chunk-RL3PL3KV.js} +8 -8
- package/dist/{chunk-S4YJ5WCW.js.map → chunk-RL3PL3KV.js.map} +1 -1
- package/dist/{chunk-X5WIUUNG.mjs → chunk-SFYPXCK4.mjs} +3237 -2374
- package/dist/chunk-SFYPXCK4.mjs.map +1 -0
- package/dist/{chunk-6SQYXUVP.mjs → chunk-Y7RR57EW.mjs} +2 -2
- package/dist/client/index.js +4 -4
- package/dist/client/index.mjs +3 -3
- package/dist/components/index.js +4 -4
- package/dist/components/index.mjs +3 -3
- package/dist/contexts/index.js +4 -4
- package/dist/contexts/index.mjs +3 -3
- package/dist/core/index.d.mts +242 -3
- package/dist/core/index.d.ts +242 -3
- package/dist/core/index.js +34 -2
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +33 -1
- package/dist/email-automations/index.js +92 -92
- package/dist/email-automations/index.mjs +3 -3
- package/dist/features/analytics/index.js +121 -121
- package/dist/features/analytics/index.mjs +4 -4
- package/dist/features/analytics/server.js +4 -4
- package/dist/features/analytics/server.mjs +2 -2
- package/dist/features/blog/index.js +150 -150
- package/dist/features/blog/index.mjs +3 -3
- package/dist/features/blog/server.js +16 -16
- package/dist/features/blog/server.mjs +1 -1
- package/dist/features/help/index.js +37 -37
- package/dist/features/help/index.mjs +3 -3
- package/dist/features/tokenusage/index.js +124 -124
- package/dist/features/tokenusage/index.mjs +4 -4
- package/dist/{stripe-promotion-code.interface-C3qqh3mi.d.ts → format-options-BtX3o0Yu.d.ts} +104 -1
- package/dist/{stripe-promotion-code.interface-ClZ7DxS9.d.mts → format-options-D6c7FNDi.d.mts} +104 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +35 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +34 -2
- package/dist/server/index.js +3 -3
- package/dist/server/index.mjs +2 -2
- package/messages/en.json +125 -3
- package/messages/it.json +125 -3
- package/package.json +1 -1
- package/scripts/validate-messages.mjs +1 -0
- package/src/billing/index.ts +1 -0
- package/src/client/index.ts +4 -0
- package/src/core/index.ts +1 -0
- package/src/core/registry/ModuleRegistry.ts +3 -0
- package/src/features/billing/components/cards/InvoicesSummaryCard.tsx +3 -2
- package/src/features/billing/components/cards/SubscriptionSummaryCard.tsx +4 -3
- package/src/features/billing/components/containers/BillingDashboardContainer.tsx +22 -5
- package/src/features/billing/components/utils/__tests__/discount.spec.ts +59 -0
- package/src/features/billing/components/utils/__tests__/url.spec.ts +32 -0
- package/src/features/billing/components/utils/discount.ts +38 -0
- package/src/features/billing/components/utils/index.ts +2 -0
- package/src/features/billing/components/utils/url.ts +12 -0
- package/src/features/billing/contexts/CouponContext.tsx +211 -0
- package/src/features/billing/contexts/index.ts +1 -0
- package/src/features/billing/i18n-keys.ts +79 -0
- package/src/features/billing/stripe-coupon/components/containers/CouponContainer.tsx +38 -0
- package/src/features/billing/stripe-coupon/components/containers/index.ts +1 -0
- package/src/features/billing/stripe-coupon/components/details/CouponDetails.tsx +69 -0
- package/src/features/billing/stripe-coupon/components/details/index.ts +1 -0
- package/src/features/billing/stripe-coupon/components/forms/CouponCodeEditor.tsx +79 -0
- package/src/features/billing/stripe-coupon/components/forms/CouponCodeFields.tsx +192 -0
- package/src/features/billing/stripe-coupon/components/forms/CouponEditor.tsx +333 -0
- package/src/features/billing/stripe-coupon/components/forms/CouponRefresher.tsx +45 -0
- package/src/features/billing/stripe-coupon/components/forms/index.ts +6 -0
- package/src/features/billing/stripe-coupon/components/index.ts +5 -0
- package/src/features/billing/stripe-coupon/components/lists/CouponCodesList.tsx +61 -0
- package/src/features/billing/stripe-coupon/components/lists/CouponsList.tsx +67 -0
- package/src/features/billing/stripe-coupon/components/lists/index.ts +2 -0
- package/src/features/billing/stripe-coupon/components/widgets/CouponCodeActions.tsx +80 -0
- package/src/features/billing/stripe-coupon/components/widgets/index.ts +1 -0
- package/src/features/billing/stripe-coupon/data/__tests__/stripe-coupon-models.spec.ts +114 -0
- package/src/features/billing/stripe-coupon/data/index.ts +10 -0
- package/src/features/billing/stripe-coupon/data/stripe-coupon-code.fields.ts +8 -0
- package/src/features/billing/stripe-coupon/data/stripe-coupon-code.interface.ts +44 -0
- package/src/features/billing/stripe-coupon/data/stripe-coupon-code.service.ts +92 -0
- package/src/features/billing/stripe-coupon/data/stripe-coupon-code.ts +132 -0
- package/src/features/billing/stripe-coupon/data/stripe-coupon-offer.interface.ts +17 -0
- package/src/features/billing/stripe-coupon/data/stripe-coupon-offer.ts +70 -0
- package/src/features/billing/stripe-coupon/data/stripe-coupon.fields.ts +7 -0
- package/src/features/billing/stripe-coupon/data/stripe-coupon.interface.ts +51 -0
- package/src/features/billing/stripe-coupon/data/stripe-coupon.service.ts +93 -0
- package/src/features/billing/stripe-coupon/data/stripe-coupon.ts +165 -0
- package/src/features/billing/stripe-coupon/hooks/useStripeCouponCodeTableStructure.tsx +154 -0
- package/src/features/billing/stripe-coupon/hooks/useStripeCouponTableStructure.tsx +113 -0
- package/src/features/billing/stripe-coupon/index.ts +5 -0
- package/src/features/billing/stripe-coupon/stripe-coupon-code.module.ts +14 -0
- package/src/features/billing/stripe-coupon/stripe-coupon-offer.module.ts +10 -0
- package/src/features/billing/stripe-coupon/stripe-coupon.module.ts +18 -0
- package/src/features/billing/stripe-coupon/utils/__tests__/coupon-places.spec.ts +19 -0
- package/src/features/billing/stripe-coupon/utils/__tests__/to-promotion-code-result.spec.ts +41 -0
- package/src/features/billing/stripe-coupon/utils/coupon-places.ts +23 -0
- package/src/features/billing/stripe-coupon/utils/format-coupon-discount.ts +36 -0
- package/src/features/billing/stripe-coupon/utils/index.ts +3 -0
- package/src/features/billing/stripe-coupon/utils/to-promotion-code-result.ts +23 -0
- package/src/features/billing/stripe-customer/components/forms/PaymentMethodForm.tsx +24 -8
- package/src/features/billing/stripe-product/components/containers/ProductsListContainer.tsx +21 -6
- package/src/features/billing/stripe-promotion-code/components/PromoCodeInput.tsx +60 -19
- package/src/features/billing/stripe-promotion-code/data/stripe-promotion-code.interface.ts +2 -0
- package/src/features/billing/stripe-subscription/components/containers/SubscriptionsContainer.tsx +24 -5
- package/src/features/billing/stripe-subscription/components/lists/SubscriptionsList.tsx +21 -2
- package/src/features/billing/stripe-subscription/components/wizards/SubscriptionWizard.tsx +1 -1
- package/src/features/billing/stripe-subscription/components/wizards/WizardStepPaymentMethod.tsx +1 -1
- package/src/features/billing/stripe-subscription/components/wizards/WizardStepReview.tsx +60 -49
- package/src/features/billing/stripe-subscription/components/wizards/__tests__/review-card.spec.ts +34 -0
- package/src/features/billing/stripe-subscription/components/wizards/review-card.ts +24 -0
- package/src/features/billing/stripe-subscription/data/__tests__/stripe-subscription.discount.spec.ts +67 -0
- package/src/features/billing/stripe-subscription/data/stripe-subscription.interface.ts +14 -0
- package/src/features/billing/stripe-subscription/data/stripe-subscription.service.ts +39 -0
- package/src/features/billing/stripe-subscription/data/stripe-subscription.ts +21 -0
- package/src/features/billing/stripe-subscription/hooks/__tests__/wizard-payment.spec.ts +48 -0
- package/src/features/billing/stripe-subscription/hooks/__tests__/wizard-promotion.spec.ts +132 -0
- package/src/features/billing/stripe-subscription/hooks/useSubscriptionWizard.ts +138 -12
- package/src/features/billing/stripe-subscription/hooks/wizard-payment.ts +30 -0
- package/src/features/billing/stripe-subscription/hooks/wizard-promotion.ts +54 -0
- package/src/features/user/contexts/CurrentUserContext.tsx +25 -0
- package/src/features/user/contexts/__tests__/CurrentUserContext.spec.tsx +121 -2
- package/dist/chunk-G6UE6MEP.js.map +0 -1
- package/dist/chunk-TY5FYP3G.js.map +0 -1
- package/dist/chunk-VC5A3AUZ.mjs.map +0 -1
- package/dist/chunk-X5WIUUNG.mjs.map +0 -1
- /package/dist/{BlockNoteEditor-GVQCKRMU.mjs.map → BlockNoteEditor-NEYG5L6W.mjs.map} +0 -0
- /package/dist/{BlockNoteViewer-U6E3DS4F.mjs.map → BlockNoteViewer-3OUT5UFY.mjs.map} +0 -0
- /package/dist/{chunk-3CGROPF3.mjs.map → chunk-BTPUYUQ3.mjs.map} +0 -0
- /package/dist/{chunk-W7F5BDSV.mjs.map → chunk-KQHBONL4.mjs.map} +0 -0
- /package/dist/{chunk-6SQYXUVP.mjs.map → chunk-Y7RR57EW.mjs.map} +0 -0
package/dist/billing/index.d.mts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { k as StripeSubscriptionInterface, P as PaymentMethodInterface, S as StripeCustomerInterface, a as StripeInvoiceInterface, M as MeterInterface, p as MeterSummaryInterface, B as BillingFormatOptions, d as StripePriceInterface, r as PromotionCodeValidationResult, u as StripeCouponInterface, v as StripeCouponInput, w as StripeCouponRenameInput, y as StripeCouponCodeInput, x as StripeCouponCodeInterface, z as StripeCouponCodeFlagsInput, f as StripePriceInput, g as StripeProductInterface, h as StripeProductInput, I as InvoiceStatus, b as ProrationPreviewInterface, i as SubscriptionStatus, o as StripeUsageInterface } from '../format-options-D6c7FNDi.mjs';
|
|
4
|
+
export { A as BillingTranslator } from '../format-options-D6c7FNDi.mjs';
|
|
4
5
|
import { J as JsonApiHydratedDataInterface } from '../ApiDataInterface-BcZeXy5X.mjs';
|
|
6
|
+
import { z } from 'zod';
|
|
5
7
|
import '../feature.interface-CXb1-vNq.mjs';
|
|
6
8
|
|
|
7
9
|
type SubscriptionSummaryCardProps = {
|
|
@@ -61,24 +63,6 @@ declare function StripeProvider({ children }: {
|
|
|
61
63
|
}): React.JSX.Element;
|
|
62
64
|
declare function isStripeConfigured(): boolean;
|
|
63
65
|
|
|
64
|
-
/** A message translator, as returned by `useTranslations()`. */
|
|
65
|
-
type BillingTranslator = (key: string, values?: Record<string, any>) => string;
|
|
66
|
-
/**
|
|
67
|
-
* What the billing formatters need from the caller's React context. The
|
|
68
|
-
* formatters are plain functions and cannot call hooks, so a component reads
|
|
69
|
-
* `useI18nLocale()` and `useTranslations()` and passes both here.
|
|
70
|
-
*
|
|
71
|
-
* Both are optional so existing callers keep their output: without a `locale`
|
|
72
|
-
* the formatters use "en-US", without `t` they return the English literals they
|
|
73
|
-
* always returned.
|
|
74
|
-
*/
|
|
75
|
-
type BillingFormatOptions = {
|
|
76
|
-
/** BCP 47 locale for `Intl` (the app's active locale, from `useI18nLocale()`). */
|
|
77
|
-
locale?: string;
|
|
78
|
-
/** Translator for the words the formatters emit. */
|
|
79
|
-
t?: BillingTranslator;
|
|
80
|
-
};
|
|
81
|
-
|
|
82
66
|
/**
|
|
83
67
|
* Format price recurring interval for display
|
|
84
68
|
* @param price - Stripe price object
|
|
@@ -112,6 +96,22 @@ declare function formatDate(date: Date | string | undefined, options?: BillingFo
|
|
|
112
96
|
/** The active locale and translator, ready to pass to the billing formatters. */
|
|
113
97
|
declare function useBillingFormatOptions(): Required<BillingFormatOptions>;
|
|
114
98
|
|
|
99
|
+
/** A discount as the billing screens apply it: a percentage, or an amount in minor units. */
|
|
100
|
+
type BillingDiscount = {
|
|
101
|
+
discountType: "percent_off" | "amount_off";
|
|
102
|
+
discountValue: number;
|
|
103
|
+
currency?: string;
|
|
104
|
+
};
|
|
105
|
+
/** The discount a valid promotion code (typed or automatic) gives, or null. */
|
|
106
|
+
declare function promotionCodeDiscount(code: PromotionCodeValidationResult | null | undefined): BillingDiscount | null;
|
|
107
|
+
/** The discount a subscription already carries in Stripe, or null. */
|
|
108
|
+
declare function subscriptionDiscount(subscription: StripeSubscriptionInterface | null | undefined): BillingDiscount | null;
|
|
109
|
+
/**
|
|
110
|
+
* The amount after the discount, in the same minor units; null when there is no
|
|
111
|
+
* discount or nothing to discount. An amount discount never goes below zero.
|
|
112
|
+
*/
|
|
113
|
+
declare function applyDiscount(amount: number | undefined, discount: BillingDiscount | null): number | null;
|
|
114
|
+
|
|
115
115
|
type BillingAlertBannerProps = {
|
|
116
116
|
subscription: StripeSubscriptionInterface;
|
|
117
117
|
onUpdatePayment?: () => void;
|
|
@@ -119,6 +119,34 @@ type BillingAlertBannerProps = {
|
|
|
119
119
|
};
|
|
120
120
|
declare function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }: BillingAlertBannerProps): React.JSX.Element | null;
|
|
121
121
|
|
|
122
|
+
interface CouponContextType {
|
|
123
|
+
coupon: StripeCouponInterface | undefined;
|
|
124
|
+
setCoupon: (value: StripeCouponInterface | undefined) => void;
|
|
125
|
+
reloadCoupon: () => Promise<void>;
|
|
126
|
+
createCoupon: (input: StripeCouponInput) => Promise<StripeCouponInterface>;
|
|
127
|
+
renameCoupon: (input: StripeCouponRenameInput) => Promise<StripeCouponInterface>;
|
|
128
|
+
refreshCounts: (id?: string) => Promise<void>;
|
|
129
|
+
createCode: (input: StripeCouponCodeInput) => Promise<StripeCouponCodeInterface>;
|
|
130
|
+
updateCodeFlags: (input: StripeCouponCodeFlagsInput) => Promise<StripeCouponCodeInterface>;
|
|
131
|
+
/** Bumped by every mutation. Mounted lists re-fetch on it. */
|
|
132
|
+
catalogueVersion: number;
|
|
133
|
+
refreshCatalogue: () => void;
|
|
134
|
+
}
|
|
135
|
+
type CouponProviderProps = {
|
|
136
|
+
children: ReactNode;
|
|
137
|
+
dehydratedCoupon?: JsonApiHydratedDataInterface;
|
|
138
|
+
/**
|
|
139
|
+
* Publish breadcrumbs + title into SharedProvider. Pass `false` when this
|
|
140
|
+
* provider is mounted INSIDE another entity's page (the Codes tab of the
|
|
141
|
+
* products page mounts CouponProvider that way): SharedProvider replaces its
|
|
142
|
+
* value for the subtree rather than merging (SharedContext.tsx:35-37), so a
|
|
143
|
+
* nested provider that publishes chrome would blank the host page's title.
|
|
144
|
+
*/
|
|
145
|
+
publishChrome?: boolean;
|
|
146
|
+
};
|
|
147
|
+
declare const CouponProvider: ({ children, dehydratedCoupon, publishChrome }: CouponProviderProps) => React.JSX.Element;
|
|
148
|
+
declare const useCouponContext: () => CouponContextType;
|
|
149
|
+
|
|
122
150
|
interface PriceContextType {
|
|
123
151
|
price: StripePriceInterface | undefined;
|
|
124
152
|
setPrice: (value: StripePriceInterface | undefined) => void;
|
|
@@ -202,8 +230,13 @@ type PaymentMethodFormProps = {
|
|
|
202
230
|
onSuccess: () => void;
|
|
203
231
|
onCancel: () => void;
|
|
204
232
|
isLoading?: boolean;
|
|
233
|
+
/**
|
|
234
|
+
* Always make the new card the customer's default and hide the checkbox. The
|
|
235
|
+
* subscription wizard needs this: the next attempt must charge the card just added.
|
|
236
|
+
*/
|
|
237
|
+
alwaysSetDefault?: boolean;
|
|
205
238
|
};
|
|
206
|
-
declare function PaymentMethodForm({ onSuccess, onCancel, isLoading }: PaymentMethodFormProps): React.JSX.Element;
|
|
239
|
+
declare function PaymentMethodForm({ onSuccess, onCancel, isLoading, alwaysSetDefault, }: PaymentMethodFormProps): React.JSX.Element;
|
|
207
240
|
|
|
208
241
|
type PaymentMethodsListProps = {
|
|
209
242
|
paymentMethods: PaymentMethodInterface[];
|
|
@@ -302,15 +335,19 @@ declare function PricesList({ productId, fullWidth }: PricesListProps): React.JS
|
|
|
302
335
|
declare function ProductContainer(): React.JSX.Element | null;
|
|
303
336
|
|
|
304
337
|
/**
|
|
305
|
-
* Page container for the administrative
|
|
338
|
+
* Page container for the administrative products page: two tabs, Products and
|
|
339
|
+
* Codes, with `sectionKey`s so the URL keeps the tab (`?section=codes`).
|
|
306
340
|
*
|
|
307
341
|
* Client component by necessity: `module={Modules.StripeProduct}` is a registry
|
|
308
342
|
* entry carrying an icon component and methods, which a Server Component cannot
|
|
309
343
|
* pass across the boundary. Routes mount this container instead — the same
|
|
310
344
|
* shape as every other list page.
|
|
311
345
|
*
|
|
312
|
-
* No `
|
|
313
|
-
*
|
|
346
|
+
* No `fullWidth`, on the page or the lists: the page keeps its title bar and
|
|
347
|
+
* each ContentListTable keeps its own bordered card in the tab (see ProductContainer). CouponProvider
|
|
348
|
+
* is nested with `publishChrome={false}`: SharedProvider REPLACES its value for
|
|
349
|
+
* the subtree (SharedContext.tsx:35-37), so a nested provider publishing chrome
|
|
350
|
+
* would blank the products page's own title.
|
|
314
351
|
*/
|
|
315
352
|
declare function ProductsListContainer(): React.JSX.Element;
|
|
316
353
|
|
|
@@ -350,11 +387,135 @@ type ProductsListProps = {
|
|
|
350
387
|
};
|
|
351
388
|
declare function ProductsList({ fullWidth }?: ProductsListProps): React.JSX.Element;
|
|
352
389
|
|
|
390
|
+
declare function CouponContainer(): React.JSX.Element | null;
|
|
391
|
+
|
|
392
|
+
declare function CouponDetails(): React.JSX.Element | null;
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* Optional whole number of at least 1. The fields render as
|
|
396
|
+
* `<FormInput type="number">`, which hands back `+""` (0) for a cleared input,
|
|
397
|
+
* so 0, "" and NaN all mean "not set" — every limit here has a floor of 1.
|
|
398
|
+
*/
|
|
399
|
+
declare const optionalPositiveInt: () => z.ZodPreprocess<z.ZodOptional<z.ZodNumber>, unknown>;
|
|
400
|
+
/**
|
|
401
|
+
* Optional decimal in MAJOR units, from `<FormInput type="decimal">` (a string
|
|
402
|
+
* that may use a comma as the separator). Converted to minor units on submit,
|
|
403
|
+
* exactly as PriceEditor does (`Math.round(value * 100)`).
|
|
404
|
+
*/
|
|
405
|
+
declare const optionalDecimal: () => z.ZodPreprocess<z.ZodOptional<z.ZodNumber>, unknown>;
|
|
406
|
+
/** Mirrors StripeCouponCodePostAttributesDTO. */
|
|
407
|
+
/**
|
|
408
|
+
* Optional point in time from `<FormDateTime allowEmpty>`, which writes "" when
|
|
409
|
+
* the value is cleared (FormDateTime.tsx:136, :241).
|
|
410
|
+
*/
|
|
411
|
+
declare const optionalDate: () => z.ZodPreprocess<z.ZodOptional<z.ZodDate>, unknown>;
|
|
412
|
+
declare const couponCodeSchema: (t: (key: string) => string) => z.ZodObject<{
|
|
413
|
+
code: z.ZodOptional<z.ZodString>;
|
|
414
|
+
firstTimeTransaction: z.ZodBoolean;
|
|
415
|
+
minimumAmount: z.ZodPreprocess<z.ZodOptional<z.ZodNumber>, unknown>;
|
|
416
|
+
minimumAmountCurrency: z.ZodString;
|
|
417
|
+
stripeCustomerId: z.ZodOptional<z.ZodString>;
|
|
418
|
+
expiresAt: z.ZodPreprocess<z.ZodOptional<z.ZodDate>, unknown>;
|
|
419
|
+
maxRedemptions: z.ZodPreprocess<z.ZodOptional<z.ZodNumber>, unknown>;
|
|
420
|
+
automatic: z.ZodBoolean;
|
|
421
|
+
}, z.core.$strip>;
|
|
422
|
+
type CouponCodeFormValues = z.infer<ReturnType<typeof couponCodeSchema>>;
|
|
423
|
+
/**
|
|
424
|
+
* Every text/number input starts as "" (never undefined): FormInput spreads
|
|
425
|
+
* `field.value` onto a Base UI input, and undefined → value flips it from
|
|
426
|
+
* uncontrolled to controlled (console warning). The schema preprocessors map
|
|
427
|
+
* "" back to undefined, so empty fields are still sent as absent.
|
|
428
|
+
*/
|
|
429
|
+
declare const couponCodeDefaults: () => z.input<ReturnType<typeof couponCodeSchema>>;
|
|
430
|
+
/** Form values → the code attributes the models serialise. Unset fields are left out. */
|
|
431
|
+
declare const toCouponCodeInput: (values: CouponCodeFormValues) => Omit<StripeCouponCodeInput, "id" | "couponId">;
|
|
432
|
+
declare const couponCurrencyOptions: {
|
|
433
|
+
id: string;
|
|
434
|
+
text: string;
|
|
435
|
+
}[];
|
|
436
|
+
type CouponCodeFieldsProps = {
|
|
437
|
+
form: any;
|
|
438
|
+
/** "" for CouponCodeEditor, "firstCode." when nested inside CouponEditor. */
|
|
439
|
+
prefix?: string;
|
|
440
|
+
};
|
|
441
|
+
/** The fields of a customer-facing code, shared by CouponEditor (first code) and CouponCodeEditor. */
|
|
442
|
+
declare function CouponCodeFields({ form, prefix }: CouponCodeFieldsProps): React.JSX.Element;
|
|
443
|
+
|
|
444
|
+
type CouponRefresherProps = {
|
|
445
|
+
coupon: StripeCouponInterface;
|
|
446
|
+
};
|
|
447
|
+
/**
|
|
448
|
+
* Re-reads the coupon and its codes from Stripe and writes the usage counts to
|
|
449
|
+
* our copy. Counts go stale only for subscriptions made outside our endpoints
|
|
450
|
+
* (the Stripe dashboard); this button fixes that.
|
|
451
|
+
*/
|
|
452
|
+
declare function CouponRefresher({ coupon }: CouponRefresherProps): React.JSX.Element;
|
|
453
|
+
|
|
454
|
+
type CouponEditorProps = {
|
|
455
|
+
coupon?: StripeCouponInterface;
|
|
456
|
+
propagateChanges?: (coupon: StripeCouponInterface) => void;
|
|
457
|
+
onSuccess?: () => void | Promise<void>;
|
|
458
|
+
trigger?: ReactNode;
|
|
459
|
+
forceShow?: boolean;
|
|
460
|
+
onClose?: () => void;
|
|
461
|
+
dialogOpen?: boolean;
|
|
462
|
+
onDialogOpenChange?: (open: boolean) => void;
|
|
463
|
+
};
|
|
464
|
+
declare function CouponEditor(props: CouponEditorProps): React.JSX.Element;
|
|
465
|
+
|
|
466
|
+
type CouponCodeEditorProps = {
|
|
467
|
+
couponId: string;
|
|
468
|
+
onSuccess?: () => void | Promise<void>;
|
|
469
|
+
trigger?: ReactNode;
|
|
470
|
+
forceShow?: boolean;
|
|
471
|
+
onClose?: () => void;
|
|
472
|
+
dialogOpen?: boolean;
|
|
473
|
+
onDialogOpenChange?: (open: boolean) => void;
|
|
474
|
+
};
|
|
475
|
+
declare function CouponCodeEditor(props: CouponCodeEditorProps): React.JSX.Element;
|
|
476
|
+
|
|
477
|
+
type CouponsListProps = {
|
|
478
|
+
/**
|
|
479
|
+
* Pass this whenever the list is the page's own content inside a
|
|
480
|
+
* `RoundPageContainer fullWidth`. Without it ContentListTable wraps itself in
|
|
481
|
+
* `rounded-md border`, drawing a second bordered card inside the page's
|
|
482
|
+
* rounded shell.
|
|
483
|
+
*/
|
|
484
|
+
fullWidth?: boolean;
|
|
485
|
+
};
|
|
486
|
+
declare function CouponsList({ fullWidth }?: CouponsListProps): React.JSX.Element;
|
|
487
|
+
|
|
488
|
+
type CouponCodesListProps = {
|
|
489
|
+
couponId: string;
|
|
490
|
+
};
|
|
491
|
+
declare function CouponCodesList({ couponId }: CouponCodesListProps): React.JSX.Element;
|
|
492
|
+
|
|
493
|
+
type CouponCodeStatus = "active" | "inactive" | "expired" | "used_up";
|
|
494
|
+
|
|
495
|
+
type CouponCodeActionsProps = {
|
|
496
|
+
code: StripeCouponCodeInterface;
|
|
497
|
+
status: CouponCodeStatus;
|
|
498
|
+
};
|
|
499
|
+
/**
|
|
500
|
+
* Row controls of a code: the "Apply automatically" switch and the deactivate /
|
|
501
|
+
* reactivate button. The button sits behind ConfirmDialog, which is controlled
|
|
502
|
+
* and trigger-less by design — the caller owns the trigger button, so none of
|
|
503
|
+
* Base UI's trigger-composition pitfalls apply (no asChild, no nested <button>).
|
|
504
|
+
*/
|
|
505
|
+
declare function CouponCodeActions({ code, status }: CouponCodeActionsProps): React.JSX.Element;
|
|
506
|
+
|
|
353
507
|
type SubscriptionsContainerProps = {
|
|
354
508
|
onOpenWizard?: (subscription?: StripeSubscriptionInterface) => void;
|
|
355
509
|
hasActiveRecurringSubscription?: boolean;
|
|
510
|
+
/**
|
|
511
|
+
* The list a parent already holds (the billing dashboard). When given, the container
|
|
512
|
+
* shows it instead of loading its own, and a change asks the parent to refresh through
|
|
513
|
+
* `onSubscriptionsChange`, so the dialog and the cards behind it never disagree.
|
|
514
|
+
*/
|
|
515
|
+
subscriptions?: StripeSubscriptionInterface[];
|
|
516
|
+
onSubscriptionsChange?: () => void;
|
|
356
517
|
};
|
|
357
|
-
declare function SubscriptionsContainer({ onOpenWizard, hasActiveRecurringSubscription }: SubscriptionsContainerProps): React.JSX.Element;
|
|
518
|
+
declare function SubscriptionsContainer({ onOpenWizard, hasActiveRecurringSubscription, subscriptions: parentSubscriptions, onSubscriptionsChange, }: SubscriptionsContainerProps): React.JSX.Element;
|
|
358
519
|
|
|
359
520
|
type SubscriptionDetailsProps = {
|
|
360
521
|
subscription: StripeSubscriptionInterface;
|
|
@@ -525,4 +686,4 @@ type PromoCodeInputProps = {
|
|
|
525
686
|
};
|
|
526
687
|
declare function PromoCodeInput({ appliedCode, isValidating, error, onApply, onRemove, disabled, }: PromoCodeInputProps): React.JSX.Element;
|
|
527
688
|
|
|
528
|
-
export { BillingAlertBanner, BillingDashboardContainer, BillingDetailModal, type BillingFormatOptions, type BillingInterval, type
|
|
689
|
+
export { BillingAlertBanner, BillingDashboardContainer, BillingDetailModal, type BillingDiscount, BillingFormatOptions, type BillingInterval, BillingUsageSummaryCard, CancelSubscriptionDialog, CouponCodeActions, CouponCodeEditor, type CouponCodeEditorProps, CouponCodeFields, type CouponCodeFormValues, CouponCodesList, CouponContainer, type CouponContextType, CouponDetails, CouponEditor, type CouponEditorProps, CouponProvider, type CouponProviderProps, CouponRefresher, CouponsList, CustomerInfoCard, IntervalToggle, type IntervalToggleProps, InvoiceDetails, InvoiceStatusBadge, InvoicesContainer, InvoicesList, InvoicesSummaryCard, PaymentMethodCard, PaymentMethodEditor, PaymentMethodForm, PaymentMethodSummaryCard, PaymentMethodsContainer, PaymentMethodsList, PriceArchiver, PriceContainer, type PriceContextType, PriceDetails, PriceEditor, type PriceEditorProps, PriceProvider, type PriceProviderProps, PricesList, PricingCard, type PricingCardProps, ProductArchiver, ProductContainer, type ProductContextType, ProductDetails, ProductEditor, type ProductEditorProps, ProductPricingList, type ProductPricingListProps, ProductPricingRow, type ProductPricingRowProps, ProductProvider, type ProductProviderProps, ProductsList, ProductsListContainer, PromoCodeInput, ProrationPreview, StripeProvider, SubscriptionConfirmation, SubscriptionDetails, SubscriptionStatusBadge, SubscriptionSummaryCard, SubscriptionWizard, type SubscriptionWizardProps, SubscriptionsContainer, SubscriptionsList, UsageContainer, UsageHistoryTable, UsageSummaryCard, UsageSummaryCards, WizardProgressIndicator, WizardStepPaymentMethod, WizardStepPlanSelection, WizardStepReview, applyDiscount, couponCodeDefaults, couponCodeSchema, couponCurrencyOptions, formatCurrency, formatDate, formatFixed, formatInterval, isStripeConfigured, optionalDate, optionalDecimal, optionalPositiveInt, priceLabel, promotionCodeDiscount, subscriptionDiscount, toCouponCodeInput, useBillingFormatOptions, useCouponContext, usePriceContext, useProductContext };
|
package/dist/billing/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { k as StripeSubscriptionInterface, P as PaymentMethodInterface, S as StripeCustomerInterface, a as StripeInvoiceInterface, M as MeterInterface, p as MeterSummaryInterface, B as BillingFormatOptions, d as StripePriceInterface, r as PromotionCodeValidationResult, u as StripeCouponInterface, v as StripeCouponInput, w as StripeCouponRenameInput, y as StripeCouponCodeInput, x as StripeCouponCodeInterface, z as StripeCouponCodeFlagsInput, f as StripePriceInput, g as StripeProductInterface, h as StripeProductInput, I as InvoiceStatus, b as ProrationPreviewInterface, i as SubscriptionStatus, o as StripeUsageInterface } from '../format-options-BtX3o0Yu.js';
|
|
4
|
+
export { A as BillingTranslator } from '../format-options-BtX3o0Yu.js';
|
|
4
5
|
import { J as JsonApiHydratedDataInterface } from '../ApiDataInterface-BcZeXy5X.js';
|
|
6
|
+
import { z } from 'zod';
|
|
5
7
|
import '../feature.interface-BO25VLlx.js';
|
|
6
8
|
|
|
7
9
|
type SubscriptionSummaryCardProps = {
|
|
@@ -61,24 +63,6 @@ declare function StripeProvider({ children }: {
|
|
|
61
63
|
}): React.JSX.Element;
|
|
62
64
|
declare function isStripeConfigured(): boolean;
|
|
63
65
|
|
|
64
|
-
/** A message translator, as returned by `useTranslations()`. */
|
|
65
|
-
type BillingTranslator = (key: string, values?: Record<string, any>) => string;
|
|
66
|
-
/**
|
|
67
|
-
* What the billing formatters need from the caller's React context. The
|
|
68
|
-
* formatters are plain functions and cannot call hooks, so a component reads
|
|
69
|
-
* `useI18nLocale()` and `useTranslations()` and passes both here.
|
|
70
|
-
*
|
|
71
|
-
* Both are optional so existing callers keep their output: without a `locale`
|
|
72
|
-
* the formatters use "en-US", without `t` they return the English literals they
|
|
73
|
-
* always returned.
|
|
74
|
-
*/
|
|
75
|
-
type BillingFormatOptions = {
|
|
76
|
-
/** BCP 47 locale for `Intl` (the app's active locale, from `useI18nLocale()`). */
|
|
77
|
-
locale?: string;
|
|
78
|
-
/** Translator for the words the formatters emit. */
|
|
79
|
-
t?: BillingTranslator;
|
|
80
|
-
};
|
|
81
|
-
|
|
82
66
|
/**
|
|
83
67
|
* Format price recurring interval for display
|
|
84
68
|
* @param price - Stripe price object
|
|
@@ -112,6 +96,22 @@ declare function formatDate(date: Date | string | undefined, options?: BillingFo
|
|
|
112
96
|
/** The active locale and translator, ready to pass to the billing formatters. */
|
|
113
97
|
declare function useBillingFormatOptions(): Required<BillingFormatOptions>;
|
|
114
98
|
|
|
99
|
+
/** A discount as the billing screens apply it: a percentage, or an amount in minor units. */
|
|
100
|
+
type BillingDiscount = {
|
|
101
|
+
discountType: "percent_off" | "amount_off";
|
|
102
|
+
discountValue: number;
|
|
103
|
+
currency?: string;
|
|
104
|
+
};
|
|
105
|
+
/** The discount a valid promotion code (typed or automatic) gives, or null. */
|
|
106
|
+
declare function promotionCodeDiscount(code: PromotionCodeValidationResult | null | undefined): BillingDiscount | null;
|
|
107
|
+
/** The discount a subscription already carries in Stripe, or null. */
|
|
108
|
+
declare function subscriptionDiscount(subscription: StripeSubscriptionInterface | null | undefined): BillingDiscount | null;
|
|
109
|
+
/**
|
|
110
|
+
* The amount after the discount, in the same minor units; null when there is no
|
|
111
|
+
* discount or nothing to discount. An amount discount never goes below zero.
|
|
112
|
+
*/
|
|
113
|
+
declare function applyDiscount(amount: number | undefined, discount: BillingDiscount | null): number | null;
|
|
114
|
+
|
|
115
115
|
type BillingAlertBannerProps = {
|
|
116
116
|
subscription: StripeSubscriptionInterface;
|
|
117
117
|
onUpdatePayment?: () => void;
|
|
@@ -119,6 +119,34 @@ type BillingAlertBannerProps = {
|
|
|
119
119
|
};
|
|
120
120
|
declare function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }: BillingAlertBannerProps): React.JSX.Element | null;
|
|
121
121
|
|
|
122
|
+
interface CouponContextType {
|
|
123
|
+
coupon: StripeCouponInterface | undefined;
|
|
124
|
+
setCoupon: (value: StripeCouponInterface | undefined) => void;
|
|
125
|
+
reloadCoupon: () => Promise<void>;
|
|
126
|
+
createCoupon: (input: StripeCouponInput) => Promise<StripeCouponInterface>;
|
|
127
|
+
renameCoupon: (input: StripeCouponRenameInput) => Promise<StripeCouponInterface>;
|
|
128
|
+
refreshCounts: (id?: string) => Promise<void>;
|
|
129
|
+
createCode: (input: StripeCouponCodeInput) => Promise<StripeCouponCodeInterface>;
|
|
130
|
+
updateCodeFlags: (input: StripeCouponCodeFlagsInput) => Promise<StripeCouponCodeInterface>;
|
|
131
|
+
/** Bumped by every mutation. Mounted lists re-fetch on it. */
|
|
132
|
+
catalogueVersion: number;
|
|
133
|
+
refreshCatalogue: () => void;
|
|
134
|
+
}
|
|
135
|
+
type CouponProviderProps = {
|
|
136
|
+
children: ReactNode;
|
|
137
|
+
dehydratedCoupon?: JsonApiHydratedDataInterface;
|
|
138
|
+
/**
|
|
139
|
+
* Publish breadcrumbs + title into SharedProvider. Pass `false` when this
|
|
140
|
+
* provider is mounted INSIDE another entity's page (the Codes tab of the
|
|
141
|
+
* products page mounts CouponProvider that way): SharedProvider replaces its
|
|
142
|
+
* value for the subtree rather than merging (SharedContext.tsx:35-37), so a
|
|
143
|
+
* nested provider that publishes chrome would blank the host page's title.
|
|
144
|
+
*/
|
|
145
|
+
publishChrome?: boolean;
|
|
146
|
+
};
|
|
147
|
+
declare const CouponProvider: ({ children, dehydratedCoupon, publishChrome }: CouponProviderProps) => React.JSX.Element;
|
|
148
|
+
declare const useCouponContext: () => CouponContextType;
|
|
149
|
+
|
|
122
150
|
interface PriceContextType {
|
|
123
151
|
price: StripePriceInterface | undefined;
|
|
124
152
|
setPrice: (value: StripePriceInterface | undefined) => void;
|
|
@@ -202,8 +230,13 @@ type PaymentMethodFormProps = {
|
|
|
202
230
|
onSuccess: () => void;
|
|
203
231
|
onCancel: () => void;
|
|
204
232
|
isLoading?: boolean;
|
|
233
|
+
/**
|
|
234
|
+
* Always make the new card the customer's default and hide the checkbox. The
|
|
235
|
+
* subscription wizard needs this: the next attempt must charge the card just added.
|
|
236
|
+
*/
|
|
237
|
+
alwaysSetDefault?: boolean;
|
|
205
238
|
};
|
|
206
|
-
declare function PaymentMethodForm({ onSuccess, onCancel, isLoading }: PaymentMethodFormProps): React.JSX.Element;
|
|
239
|
+
declare function PaymentMethodForm({ onSuccess, onCancel, isLoading, alwaysSetDefault, }: PaymentMethodFormProps): React.JSX.Element;
|
|
207
240
|
|
|
208
241
|
type PaymentMethodsListProps = {
|
|
209
242
|
paymentMethods: PaymentMethodInterface[];
|
|
@@ -302,15 +335,19 @@ declare function PricesList({ productId, fullWidth }: PricesListProps): React.JS
|
|
|
302
335
|
declare function ProductContainer(): React.JSX.Element | null;
|
|
303
336
|
|
|
304
337
|
/**
|
|
305
|
-
* Page container for the administrative
|
|
338
|
+
* Page container for the administrative products page: two tabs, Products and
|
|
339
|
+
* Codes, with `sectionKey`s so the URL keeps the tab (`?section=codes`).
|
|
306
340
|
*
|
|
307
341
|
* Client component by necessity: `module={Modules.StripeProduct}` is a registry
|
|
308
342
|
* entry carrying an icon component and methods, which a Server Component cannot
|
|
309
343
|
* pass across the boundary. Routes mount this container instead — the same
|
|
310
344
|
* shape as every other list page.
|
|
311
345
|
*
|
|
312
|
-
* No `
|
|
313
|
-
*
|
|
346
|
+
* No `fullWidth`, on the page or the lists: the page keeps its title bar and
|
|
347
|
+
* each ContentListTable keeps its own bordered card in the tab (see ProductContainer). CouponProvider
|
|
348
|
+
* is nested with `publishChrome={false}`: SharedProvider REPLACES its value for
|
|
349
|
+
* the subtree (SharedContext.tsx:35-37), so a nested provider publishing chrome
|
|
350
|
+
* would blank the products page's own title.
|
|
314
351
|
*/
|
|
315
352
|
declare function ProductsListContainer(): React.JSX.Element;
|
|
316
353
|
|
|
@@ -350,11 +387,135 @@ type ProductsListProps = {
|
|
|
350
387
|
};
|
|
351
388
|
declare function ProductsList({ fullWidth }?: ProductsListProps): React.JSX.Element;
|
|
352
389
|
|
|
390
|
+
declare function CouponContainer(): React.JSX.Element | null;
|
|
391
|
+
|
|
392
|
+
declare function CouponDetails(): React.JSX.Element | null;
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* Optional whole number of at least 1. The fields render as
|
|
396
|
+
* `<FormInput type="number">`, which hands back `+""` (0) for a cleared input,
|
|
397
|
+
* so 0, "" and NaN all mean "not set" — every limit here has a floor of 1.
|
|
398
|
+
*/
|
|
399
|
+
declare const optionalPositiveInt: () => z.ZodPreprocess<z.ZodOptional<z.ZodNumber>, unknown>;
|
|
400
|
+
/**
|
|
401
|
+
* Optional decimal in MAJOR units, from `<FormInput type="decimal">` (a string
|
|
402
|
+
* that may use a comma as the separator). Converted to minor units on submit,
|
|
403
|
+
* exactly as PriceEditor does (`Math.round(value * 100)`).
|
|
404
|
+
*/
|
|
405
|
+
declare const optionalDecimal: () => z.ZodPreprocess<z.ZodOptional<z.ZodNumber>, unknown>;
|
|
406
|
+
/** Mirrors StripeCouponCodePostAttributesDTO. */
|
|
407
|
+
/**
|
|
408
|
+
* Optional point in time from `<FormDateTime allowEmpty>`, which writes "" when
|
|
409
|
+
* the value is cleared (FormDateTime.tsx:136, :241).
|
|
410
|
+
*/
|
|
411
|
+
declare const optionalDate: () => z.ZodPreprocess<z.ZodOptional<z.ZodDate>, unknown>;
|
|
412
|
+
declare const couponCodeSchema: (t: (key: string) => string) => z.ZodObject<{
|
|
413
|
+
code: z.ZodOptional<z.ZodString>;
|
|
414
|
+
firstTimeTransaction: z.ZodBoolean;
|
|
415
|
+
minimumAmount: z.ZodPreprocess<z.ZodOptional<z.ZodNumber>, unknown>;
|
|
416
|
+
minimumAmountCurrency: z.ZodString;
|
|
417
|
+
stripeCustomerId: z.ZodOptional<z.ZodString>;
|
|
418
|
+
expiresAt: z.ZodPreprocess<z.ZodOptional<z.ZodDate>, unknown>;
|
|
419
|
+
maxRedemptions: z.ZodPreprocess<z.ZodOptional<z.ZodNumber>, unknown>;
|
|
420
|
+
automatic: z.ZodBoolean;
|
|
421
|
+
}, z.core.$strip>;
|
|
422
|
+
type CouponCodeFormValues = z.infer<ReturnType<typeof couponCodeSchema>>;
|
|
423
|
+
/**
|
|
424
|
+
* Every text/number input starts as "" (never undefined): FormInput spreads
|
|
425
|
+
* `field.value` onto a Base UI input, and undefined → value flips it from
|
|
426
|
+
* uncontrolled to controlled (console warning). The schema preprocessors map
|
|
427
|
+
* "" back to undefined, so empty fields are still sent as absent.
|
|
428
|
+
*/
|
|
429
|
+
declare const couponCodeDefaults: () => z.input<ReturnType<typeof couponCodeSchema>>;
|
|
430
|
+
/** Form values → the code attributes the models serialise. Unset fields are left out. */
|
|
431
|
+
declare const toCouponCodeInput: (values: CouponCodeFormValues) => Omit<StripeCouponCodeInput, "id" | "couponId">;
|
|
432
|
+
declare const couponCurrencyOptions: {
|
|
433
|
+
id: string;
|
|
434
|
+
text: string;
|
|
435
|
+
}[];
|
|
436
|
+
type CouponCodeFieldsProps = {
|
|
437
|
+
form: any;
|
|
438
|
+
/** "" for CouponCodeEditor, "firstCode." when nested inside CouponEditor. */
|
|
439
|
+
prefix?: string;
|
|
440
|
+
};
|
|
441
|
+
/** The fields of a customer-facing code, shared by CouponEditor (first code) and CouponCodeEditor. */
|
|
442
|
+
declare function CouponCodeFields({ form, prefix }: CouponCodeFieldsProps): React.JSX.Element;
|
|
443
|
+
|
|
444
|
+
type CouponRefresherProps = {
|
|
445
|
+
coupon: StripeCouponInterface;
|
|
446
|
+
};
|
|
447
|
+
/**
|
|
448
|
+
* Re-reads the coupon and its codes from Stripe and writes the usage counts to
|
|
449
|
+
* our copy. Counts go stale only for subscriptions made outside our endpoints
|
|
450
|
+
* (the Stripe dashboard); this button fixes that.
|
|
451
|
+
*/
|
|
452
|
+
declare function CouponRefresher({ coupon }: CouponRefresherProps): React.JSX.Element;
|
|
453
|
+
|
|
454
|
+
type CouponEditorProps = {
|
|
455
|
+
coupon?: StripeCouponInterface;
|
|
456
|
+
propagateChanges?: (coupon: StripeCouponInterface) => void;
|
|
457
|
+
onSuccess?: () => void | Promise<void>;
|
|
458
|
+
trigger?: ReactNode;
|
|
459
|
+
forceShow?: boolean;
|
|
460
|
+
onClose?: () => void;
|
|
461
|
+
dialogOpen?: boolean;
|
|
462
|
+
onDialogOpenChange?: (open: boolean) => void;
|
|
463
|
+
};
|
|
464
|
+
declare function CouponEditor(props: CouponEditorProps): React.JSX.Element;
|
|
465
|
+
|
|
466
|
+
type CouponCodeEditorProps = {
|
|
467
|
+
couponId: string;
|
|
468
|
+
onSuccess?: () => void | Promise<void>;
|
|
469
|
+
trigger?: ReactNode;
|
|
470
|
+
forceShow?: boolean;
|
|
471
|
+
onClose?: () => void;
|
|
472
|
+
dialogOpen?: boolean;
|
|
473
|
+
onDialogOpenChange?: (open: boolean) => void;
|
|
474
|
+
};
|
|
475
|
+
declare function CouponCodeEditor(props: CouponCodeEditorProps): React.JSX.Element;
|
|
476
|
+
|
|
477
|
+
type CouponsListProps = {
|
|
478
|
+
/**
|
|
479
|
+
* Pass this whenever the list is the page's own content inside a
|
|
480
|
+
* `RoundPageContainer fullWidth`. Without it ContentListTable wraps itself in
|
|
481
|
+
* `rounded-md border`, drawing a second bordered card inside the page's
|
|
482
|
+
* rounded shell.
|
|
483
|
+
*/
|
|
484
|
+
fullWidth?: boolean;
|
|
485
|
+
};
|
|
486
|
+
declare function CouponsList({ fullWidth }?: CouponsListProps): React.JSX.Element;
|
|
487
|
+
|
|
488
|
+
type CouponCodesListProps = {
|
|
489
|
+
couponId: string;
|
|
490
|
+
};
|
|
491
|
+
declare function CouponCodesList({ couponId }: CouponCodesListProps): React.JSX.Element;
|
|
492
|
+
|
|
493
|
+
type CouponCodeStatus = "active" | "inactive" | "expired" | "used_up";
|
|
494
|
+
|
|
495
|
+
type CouponCodeActionsProps = {
|
|
496
|
+
code: StripeCouponCodeInterface;
|
|
497
|
+
status: CouponCodeStatus;
|
|
498
|
+
};
|
|
499
|
+
/**
|
|
500
|
+
* Row controls of a code: the "Apply automatically" switch and the deactivate /
|
|
501
|
+
* reactivate button. The button sits behind ConfirmDialog, which is controlled
|
|
502
|
+
* and trigger-less by design — the caller owns the trigger button, so none of
|
|
503
|
+
* Base UI's trigger-composition pitfalls apply (no asChild, no nested <button>).
|
|
504
|
+
*/
|
|
505
|
+
declare function CouponCodeActions({ code, status }: CouponCodeActionsProps): React.JSX.Element;
|
|
506
|
+
|
|
353
507
|
type SubscriptionsContainerProps = {
|
|
354
508
|
onOpenWizard?: (subscription?: StripeSubscriptionInterface) => void;
|
|
355
509
|
hasActiveRecurringSubscription?: boolean;
|
|
510
|
+
/**
|
|
511
|
+
* The list a parent already holds (the billing dashboard). When given, the container
|
|
512
|
+
* shows it instead of loading its own, and a change asks the parent to refresh through
|
|
513
|
+
* `onSubscriptionsChange`, so the dialog and the cards behind it never disagree.
|
|
514
|
+
*/
|
|
515
|
+
subscriptions?: StripeSubscriptionInterface[];
|
|
516
|
+
onSubscriptionsChange?: () => void;
|
|
356
517
|
};
|
|
357
|
-
declare function SubscriptionsContainer({ onOpenWizard, hasActiveRecurringSubscription }: SubscriptionsContainerProps): React.JSX.Element;
|
|
518
|
+
declare function SubscriptionsContainer({ onOpenWizard, hasActiveRecurringSubscription, subscriptions: parentSubscriptions, onSubscriptionsChange, }: SubscriptionsContainerProps): React.JSX.Element;
|
|
358
519
|
|
|
359
520
|
type SubscriptionDetailsProps = {
|
|
360
521
|
subscription: StripeSubscriptionInterface;
|
|
@@ -525,4 +686,4 @@ type PromoCodeInputProps = {
|
|
|
525
686
|
};
|
|
526
687
|
declare function PromoCodeInput({ appliedCode, isValidating, error, onApply, onRemove, disabled, }: PromoCodeInputProps): React.JSX.Element;
|
|
527
688
|
|
|
528
|
-
export { BillingAlertBanner, BillingDashboardContainer, BillingDetailModal, type BillingFormatOptions, type BillingInterval, type
|
|
689
|
+
export { BillingAlertBanner, BillingDashboardContainer, BillingDetailModal, type BillingDiscount, BillingFormatOptions, type BillingInterval, BillingUsageSummaryCard, CancelSubscriptionDialog, CouponCodeActions, CouponCodeEditor, type CouponCodeEditorProps, CouponCodeFields, type CouponCodeFormValues, CouponCodesList, CouponContainer, type CouponContextType, CouponDetails, CouponEditor, type CouponEditorProps, CouponProvider, type CouponProviderProps, CouponRefresher, CouponsList, CustomerInfoCard, IntervalToggle, type IntervalToggleProps, InvoiceDetails, InvoiceStatusBadge, InvoicesContainer, InvoicesList, InvoicesSummaryCard, PaymentMethodCard, PaymentMethodEditor, PaymentMethodForm, PaymentMethodSummaryCard, PaymentMethodsContainer, PaymentMethodsList, PriceArchiver, PriceContainer, type PriceContextType, PriceDetails, PriceEditor, type PriceEditorProps, PriceProvider, type PriceProviderProps, PricesList, PricingCard, type PricingCardProps, ProductArchiver, ProductContainer, type ProductContextType, ProductDetails, ProductEditor, type ProductEditorProps, ProductPricingList, type ProductPricingListProps, ProductPricingRow, type ProductPricingRowProps, ProductProvider, type ProductProviderProps, ProductsList, ProductsListContainer, PromoCodeInput, ProrationPreview, StripeProvider, SubscriptionConfirmation, SubscriptionDetails, SubscriptionStatusBadge, SubscriptionSummaryCard, SubscriptionWizard, type SubscriptionWizardProps, SubscriptionsContainer, SubscriptionsList, UsageContainer, UsageHistoryTable, UsageSummaryCard, UsageSummaryCards, WizardProgressIndicator, WizardStepPaymentMethod, WizardStepPlanSelection, WizardStepReview, applyDiscount, couponCodeDefaults, couponCodeSchema, couponCurrencyOptions, formatCurrency, formatDate, formatFixed, formatInterval, isStripeConfigured, optionalDate, optionalDecimal, optionalPositiveInt, priceLabel, promotionCodeDiscount, subscriptionDiscount, toCouponCodeInput, useBillingFormatOptions, useCouponContext, usePriceContext, useProductContext };
|