@carlonicora/nextjs-jsonapi 6.3.0 → 6.5.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.
Files changed (27) hide show
  1. package/dist/billing/index.d.mts +174 -157
  2. package/dist/billing/index.d.ts +174 -157
  3. package/dist/billing/index.js +31 -9
  4. package/dist/billing/index.js.map +1 -1
  5. package/dist/billing/index.mjs +31 -9
  6. package/dist/billing/index.mjs.map +1 -1
  7. package/dist/{chunk-ZDUT5JPT.mjs → chunk-DYOSXIEL.mjs} +25 -20
  8. package/dist/chunk-DYOSXIEL.mjs.map +1 -0
  9. package/dist/{chunk-V4I3XKOM.js → chunk-ELQHE2DK.js} +25 -20
  10. package/dist/chunk-ELQHE2DK.js.map +1 -0
  11. package/dist/features/analytics/index.js +10 -10
  12. package/dist/features/analytics/index.mjs +1 -1
  13. package/dist/features/tokenusage/index.d.mts +123 -1
  14. package/dist/features/tokenusage/index.d.ts +123 -1
  15. package/dist/features/tokenusage/index.js +30 -27
  16. package/dist/features/tokenusage/index.js.map +1 -1
  17. package/dist/features/tokenusage/index.mjs +4 -1
  18. package/dist/features/tokenusage/index.mjs.map +1 -1
  19. package/package.json +1 -1
  20. package/src/features/billing/components/containers/BillingDashboardContainer.tsx +3 -2
  21. package/src/features/billing/stripe-subscription/components/containers/SubscriptionsContainer.tsx +5 -0
  22. package/src/features/billing/stripe-subscription/components/details/SubscriptionDetails.tsx +44 -12
  23. package/src/features/billing/stripe-subscription/components/details/__tests__/SubscriptionDetails.spec.tsx +79 -0
  24. package/src/features/billing/stripe-subscription/components/lists/SubscriptionsList.tsx +9 -2
  25. package/src/features/tokenusage/index.ts +5 -0
  26. package/dist/chunk-V4I3XKOM.js.map +0 -1
  27. package/dist/chunk-ZDUT5JPT.mjs.map +0 -1
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { ReactNode } from 'react';
3
- import { S as StripeSubscriptionInterface, a as StripePriceInterface, b as StripePriceInput, c as StripeProductInterface, d as StripeProductInput, e as SubscriptionStatus } from '../stripe-price.interface-DGqcklFJ.js';
4
- import { P as PaymentMethodInterface, S as StripeCustomerInterface, a as StripeInvoiceInterface, M as MeterInterface, e as MeterSummaryInterface, B as BillingFormatOptions, g as PromotionCodeValidationResult, j as StripeCouponInterface, m as StripeCouponInput, n as StripeCouponRenameInput, p as StripeCouponCodeInput, o as StripeCouponCodeInterface, q as StripeCouponCodeFlagsInput, I as InvoiceStatus, b as ProrationPreviewInterface, d as StripeUsageInterface } from '../currency-CBgZkS0u.js';
3
+ import { S as StripeSubscriptionInterface, a as StripePriceInterface, c as StripeProductInterface, e as SubscriptionStatus, b as StripePriceInput, d as StripeProductInput } from '../stripe-price.interface-DGqcklFJ.js';
4
+ import { P as PaymentMethodInterface, S as StripeCustomerInterface, a as StripeInvoiceInterface, M as MeterInterface, e as MeterSummaryInterface, b as ProrationPreviewInterface, g as PromotionCodeValidationResult, B as BillingFormatOptions, j as StripeCouponInterface, m as StripeCouponInput, n as StripeCouponRenameInput, p as StripeCouponCodeInput, o as StripeCouponCodeInterface, q as StripeCouponCodeFlagsInput, I as InvoiceStatus, d as StripeUsageInterface } from '../currency-CBgZkS0u.js';
5
5
  export { u as BillingTranslator, s as formatCurrency, t as formatFixed, r as formatInterval } from '../currency-CBgZkS0u.js';
6
6
  import { J as JsonApiHydratedDataInterface } from '../ApiDataInterface-BcZeXy5X.js';
7
7
  import { FieldValues, UseFormReturn } from 'react-hook-form';
@@ -48,7 +48,177 @@ type BillingUsageSummaryCardProps = {
48
48
  };
49
49
  declare function BillingUsageSummaryCard({ meters, summaries, loading, error, onViewDetailsClick, }: BillingUsageSummaryCardProps): React.JSX.Element;
50
50
 
51
- declare function BillingDashboardContainer(): React.JSX.Element;
51
+ /** Props an app receives when it replaces the library cancel dialog. */
52
+ type CancelDialogRenderProps = {
53
+ subscription: StripeSubscriptionInterface;
54
+ open: boolean;
55
+ onOpenChange: (open: boolean) => void;
56
+ onSuccess: () => void;
57
+ /** Opens the plan-change wizard for this subscription and closes the details. Undefined when the host gave no onChangePlan. */
58
+ openChangePlan?: () => void;
59
+ };
60
+ /** Optional replacement for the library cancel dialog. Absent, the library renders CancelSubscriptionDialog. */
61
+ type RenderCancelDialog = (props: CancelDialogRenderProps) => ReactNode;
62
+ type SubscriptionDetailsProps = {
63
+ subscription: StripeSubscriptionInterface;
64
+ open: boolean;
65
+ onOpenChange: (open: boolean) => void;
66
+ onSubscriptionChange: () => void;
67
+ onChangePlan?: (subscription: StripeSubscriptionInterface) => void;
68
+ renderCancelDialog?: RenderCancelDialog;
69
+ };
70
+ declare function SubscriptionDetails({ subscription, open, onOpenChange, onSubscriptionChange, onChangePlan, renderCancelDialog, }: SubscriptionDetailsProps): React.JSX.Element;
71
+
72
+ type SubscriptionsContainerProps = {
73
+ onOpenWizard?: (subscription?: StripeSubscriptionInterface) => void;
74
+ hasActiveRecurringSubscription?: boolean;
75
+ /**
76
+ * The list a parent already holds (the billing dashboard). When given, the container
77
+ * shows it instead of loading its own, and a change asks the parent to refresh through
78
+ * `onSubscriptionsChange`, so the dialog and the cards behind it never disagree.
79
+ */
80
+ subscriptions?: StripeSubscriptionInterface[];
81
+ onSubscriptionsChange?: () => void;
82
+ /** Replaces the library cancel dialog; absent, the library dialog renders. */
83
+ renderCancelDialog?: RenderCancelDialog;
84
+ };
85
+ declare function SubscriptionsContainer({ onOpenWizard, hasActiveRecurringSubscription, subscriptions: parentSubscriptions, onSubscriptionsChange, renderCancelDialog, }: SubscriptionsContainerProps): React.JSX.Element;
86
+
87
+ type CancelSubscriptionDialogProps = {
88
+ subscription: StripeSubscriptionInterface;
89
+ open: boolean;
90
+ onOpenChange: (open: boolean) => void;
91
+ onSuccess: () => void;
92
+ };
93
+ declare function CancelSubscriptionDialog({ subscription, open, onOpenChange, onSuccess, }: CancelSubscriptionDialogProps): React.JSX.Element;
94
+
95
+ type SubscriptionsListProps = {
96
+ subscriptions: StripeSubscriptionInterface[];
97
+ onSubscriptionsChange: () => void;
98
+ onChangePlan?: (subscription: StripeSubscriptionInterface) => void;
99
+ renderCancelDialog?: RenderCancelDialog;
100
+ };
101
+ declare function SubscriptionsList({ subscriptions, onSubscriptionsChange, onChangePlan, renderCancelDialog, }: SubscriptionsListProps): React.JSX.Element;
102
+
103
+ type BillingInterval = "month" | "year";
104
+ type IntervalToggleProps = {
105
+ value: BillingInterval;
106
+ onChange: (interval: BillingInterval) => void;
107
+ hasMonthly: boolean;
108
+ hasYearly: boolean;
109
+ };
110
+ declare function IntervalToggle({ value, onChange, hasMonthly, hasYearly }: IntervalToggleProps): React.JSX.Element | null;
111
+
112
+ type PricingCardProps = {
113
+ price: StripePriceInterface;
114
+ isCurrentPlan?: boolean;
115
+ isSelected?: boolean;
116
+ isDisabled?: boolean;
117
+ isLoading?: boolean;
118
+ onSelect: (price: StripePriceInterface) => void;
119
+ };
120
+ declare function PricingCard({ price, isCurrentPlan, isSelected, isDisabled, isLoading, onSelect, }: PricingCardProps): React.JSX.Element;
121
+
122
+ type ProductPricingListProps = {
123
+ products: StripeProductInterface[];
124
+ selectedInterval: BillingInterval;
125
+ currentPriceId?: string;
126
+ selectedPriceId?: string;
127
+ loadingPriceId?: string;
128
+ loading?: boolean;
129
+ onSelectPrice: (price: StripePriceInterface) => void;
130
+ hideRecurringPrices?: boolean;
131
+ hideOneTimePrices?: boolean;
132
+ };
133
+ declare function ProductPricingList({ products, selectedInterval, currentPriceId, selectedPriceId, loadingPriceId, loading, onSelectPrice, hideRecurringPrices, hideOneTimePrices, }: ProductPricingListProps): React.JSX.Element;
134
+
135
+ type ProductPricingRowProps = {
136
+ product: StripeProductInterface;
137
+ prices: StripePriceInterface[];
138
+ currentPriceId?: string;
139
+ selectedPriceId?: string;
140
+ loadingPriceId?: string;
141
+ onSelectPrice: (price: StripePriceInterface) => void;
142
+ };
143
+ declare function ProductPricingRow({ product, prices, currentPriceId, selectedPriceId, loadingPriceId, onSelectPrice, }: ProductPricingRowProps): React.JSX.Element | null;
144
+
145
+ type ProrationPreviewProps = {
146
+ preview: ProrationPreviewInterface;
147
+ };
148
+ declare function ProrationPreview({ preview }: ProrationPreviewProps): React.JSX.Element;
149
+
150
+ type SubscriptionStatusBadgeProps = {
151
+ status: SubscriptionStatus;
152
+ cancelAtPeriodEnd?: boolean;
153
+ };
154
+ declare function SubscriptionStatusBadge({ status, cancelAtPeriodEnd }: SubscriptionStatusBadgeProps): React.JSX.Element;
155
+
156
+ type SubscriptionConfirmationProps = {
157
+ price: StripePriceInterface;
158
+ isLoading: boolean;
159
+ onConfirm: () => void;
160
+ onCancel: () => void;
161
+ };
162
+ declare function SubscriptionConfirmation({ price, isLoading, onConfirm, onCancel }: SubscriptionConfirmationProps): React.JSX.Element;
163
+
164
+ type SubscriptionWizardProps = {
165
+ open: boolean;
166
+ onOpenChange: (open: boolean) => void;
167
+ onSuccess: () => void;
168
+ hasActiveRecurringSubscription: boolean;
169
+ subscription?: StripeSubscriptionInterface;
170
+ };
171
+ declare function SubscriptionWizard({ open, onOpenChange, onSuccess, hasActiveRecurringSubscription, subscription, }: SubscriptionWizardProps): React.JSX.Element;
172
+
173
+ type WizardStep = "plan-selection" | "review" | "payment-method";
174
+
175
+ type WizardProgressIndicatorProps = {
176
+ currentStep: WizardStep;
177
+ };
178
+ declare function WizardProgressIndicator({ currentStep }: WizardProgressIndicatorProps): React.JSX.Element;
179
+
180
+ type WizardStepPlanSelectionProps = {
181
+ selectedPrice: StripePriceInterface | null;
182
+ selectedInterval: BillingInterval;
183
+ currentPriceId?: string;
184
+ hideRecurringPrices: boolean;
185
+ hideOneTimePrices: boolean;
186
+ onSelectPrice: (price: StripePriceInterface) => void;
187
+ onIntervalChange: (interval: BillingInterval) => void;
188
+ onNext: () => void;
189
+ isProcessing: boolean;
190
+ };
191
+ declare function WizardStepPlanSelection({ selectedPrice, selectedInterval, currentPriceId, hideRecurringPrices, hideOneTimePrices, onSelectPrice, onIntervalChange, onNext, isProcessing, }: WizardStepPlanSelectionProps): React.JSX.Element;
192
+
193
+ type WizardStepReviewProps = {
194
+ selectedPrice: StripePriceInterface | null;
195
+ subscription?: StripeSubscriptionInterface;
196
+ prorationPreview: ProrationPreviewInterface | null;
197
+ hasPaymentMethod: boolean;
198
+ error: string | null;
199
+ isProcessing: boolean;
200
+ onBack: () => void;
201
+ onAddPaymentMethod: () => void;
202
+ onConfirm: () => void;
203
+ promotionCode: PromotionCodeValidationResult | null;
204
+ isValidatingPromoCode: boolean;
205
+ promoCodeError: string | null;
206
+ onApplyPromoCode: (code: string) => void;
207
+ onRemovePromoCode: () => void;
208
+ isTrialUpgrade: boolean;
209
+ };
210
+ declare function WizardStepReview({ selectedPrice, subscription, prorationPreview, hasPaymentMethod, error, isProcessing, onBack, onAddPaymentMethod, onConfirm, promotionCode, isValidatingPromoCode, promoCodeError, onApplyPromoCode, onRemovePromoCode, isTrialUpgrade, }: WizardStepReviewProps): React.JSX.Element;
211
+
212
+ type WizardStepPaymentMethodProps = {
213
+ onBack: () => void;
214
+ onSuccess: () => void;
215
+ isProcessing: boolean;
216
+ };
217
+ declare function WizardStepPaymentMethod({ onBack, onSuccess, isProcessing }: WizardStepPaymentMethodProps): React.JSX.Element;
218
+
219
+ declare function BillingDashboardContainer({ renderCancelDialog }?: {
220
+ renderCancelDialog?: RenderCancelDialog;
221
+ }): React.JSX.Element;
52
222
 
53
223
  type BillingDetailModalProps = {
54
224
  open: boolean;
@@ -495,159 +665,6 @@ type CouponCodeActionsProps = {
495
665
  */
496
666
  declare function CouponCodeActions({ code, status }: CouponCodeActionsProps): React.JSX.Element;
497
667
 
498
- type SubscriptionsContainerProps = {
499
- onOpenWizard?: (subscription?: StripeSubscriptionInterface) => void;
500
- hasActiveRecurringSubscription?: boolean;
501
- /**
502
- * The list a parent already holds (the billing dashboard). When given, the container
503
- * shows it instead of loading its own, and a change asks the parent to refresh through
504
- * `onSubscriptionsChange`, so the dialog and the cards behind it never disagree.
505
- */
506
- subscriptions?: StripeSubscriptionInterface[];
507
- onSubscriptionsChange?: () => void;
508
- };
509
- declare function SubscriptionsContainer({ onOpenWizard, hasActiveRecurringSubscription, subscriptions: parentSubscriptions, onSubscriptionsChange, }: SubscriptionsContainerProps): React.JSX.Element;
510
-
511
- type SubscriptionDetailsProps = {
512
- subscription: StripeSubscriptionInterface;
513
- open: boolean;
514
- onOpenChange: (open: boolean) => void;
515
- onSubscriptionChange: () => void;
516
- onChangePlan?: (subscription: StripeSubscriptionInterface) => void;
517
- };
518
- declare function SubscriptionDetails({ subscription, open, onOpenChange, onSubscriptionChange, onChangePlan, }: SubscriptionDetailsProps): React.JSX.Element;
519
-
520
- type CancelSubscriptionDialogProps = {
521
- subscription: StripeSubscriptionInterface;
522
- open: boolean;
523
- onOpenChange: (open: boolean) => void;
524
- onSuccess: () => void;
525
- };
526
- declare function CancelSubscriptionDialog({ subscription, open, onOpenChange, onSuccess, }: CancelSubscriptionDialogProps): React.JSX.Element;
527
-
528
- type SubscriptionsListProps = {
529
- subscriptions: StripeSubscriptionInterface[];
530
- onSubscriptionsChange: () => void;
531
- onChangePlan?: (subscription: StripeSubscriptionInterface) => void;
532
- };
533
- declare function SubscriptionsList({ subscriptions, onSubscriptionsChange, onChangePlan }: SubscriptionsListProps): React.JSX.Element;
534
-
535
- type BillingInterval = "month" | "year";
536
- type IntervalToggleProps = {
537
- value: BillingInterval;
538
- onChange: (interval: BillingInterval) => void;
539
- hasMonthly: boolean;
540
- hasYearly: boolean;
541
- };
542
- declare function IntervalToggle({ value, onChange, hasMonthly, hasYearly }: IntervalToggleProps): React.JSX.Element | null;
543
-
544
- type PricingCardProps = {
545
- price: StripePriceInterface;
546
- isCurrentPlan?: boolean;
547
- isSelected?: boolean;
548
- isDisabled?: boolean;
549
- isLoading?: boolean;
550
- onSelect: (price: StripePriceInterface) => void;
551
- };
552
- declare function PricingCard({ price, isCurrentPlan, isSelected, isDisabled, isLoading, onSelect, }: PricingCardProps): React.JSX.Element;
553
-
554
- type ProductPricingListProps = {
555
- products: StripeProductInterface[];
556
- selectedInterval: BillingInterval;
557
- currentPriceId?: string;
558
- selectedPriceId?: string;
559
- loadingPriceId?: string;
560
- loading?: boolean;
561
- onSelectPrice: (price: StripePriceInterface) => void;
562
- hideRecurringPrices?: boolean;
563
- hideOneTimePrices?: boolean;
564
- };
565
- declare function ProductPricingList({ products, selectedInterval, currentPriceId, selectedPriceId, loadingPriceId, loading, onSelectPrice, hideRecurringPrices, hideOneTimePrices, }: ProductPricingListProps): React.JSX.Element;
566
-
567
- type ProductPricingRowProps = {
568
- product: StripeProductInterface;
569
- prices: StripePriceInterface[];
570
- currentPriceId?: string;
571
- selectedPriceId?: string;
572
- loadingPriceId?: string;
573
- onSelectPrice: (price: StripePriceInterface) => void;
574
- };
575
- declare function ProductPricingRow({ product, prices, currentPriceId, selectedPriceId, loadingPriceId, onSelectPrice, }: ProductPricingRowProps): React.JSX.Element | null;
576
-
577
- type ProrationPreviewProps = {
578
- preview: ProrationPreviewInterface;
579
- };
580
- declare function ProrationPreview({ preview }: ProrationPreviewProps): React.JSX.Element;
581
-
582
- type SubscriptionStatusBadgeProps = {
583
- status: SubscriptionStatus;
584
- cancelAtPeriodEnd?: boolean;
585
- };
586
- declare function SubscriptionStatusBadge({ status, cancelAtPeriodEnd }: SubscriptionStatusBadgeProps): React.JSX.Element;
587
-
588
- type SubscriptionConfirmationProps = {
589
- price: StripePriceInterface;
590
- isLoading: boolean;
591
- onConfirm: () => void;
592
- onCancel: () => void;
593
- };
594
- declare function SubscriptionConfirmation({ price, isLoading, onConfirm, onCancel }: SubscriptionConfirmationProps): React.JSX.Element;
595
-
596
- type SubscriptionWizardProps = {
597
- open: boolean;
598
- onOpenChange: (open: boolean) => void;
599
- onSuccess: () => void;
600
- hasActiveRecurringSubscription: boolean;
601
- subscription?: StripeSubscriptionInterface;
602
- };
603
- declare function SubscriptionWizard({ open, onOpenChange, onSuccess, hasActiveRecurringSubscription, subscription, }: SubscriptionWizardProps): React.JSX.Element;
604
-
605
- type WizardStep = "plan-selection" | "review" | "payment-method";
606
-
607
- type WizardProgressIndicatorProps = {
608
- currentStep: WizardStep;
609
- };
610
- declare function WizardProgressIndicator({ currentStep }: WizardProgressIndicatorProps): React.JSX.Element;
611
-
612
- type WizardStepPlanSelectionProps = {
613
- selectedPrice: StripePriceInterface | null;
614
- selectedInterval: BillingInterval;
615
- currentPriceId?: string;
616
- hideRecurringPrices: boolean;
617
- hideOneTimePrices: boolean;
618
- onSelectPrice: (price: StripePriceInterface) => void;
619
- onIntervalChange: (interval: BillingInterval) => void;
620
- onNext: () => void;
621
- isProcessing: boolean;
622
- };
623
- declare function WizardStepPlanSelection({ selectedPrice, selectedInterval, currentPriceId, hideRecurringPrices, hideOneTimePrices, onSelectPrice, onIntervalChange, onNext, isProcessing, }: WizardStepPlanSelectionProps): React.JSX.Element;
624
-
625
- type WizardStepReviewProps = {
626
- selectedPrice: StripePriceInterface | null;
627
- subscription?: StripeSubscriptionInterface;
628
- prorationPreview: ProrationPreviewInterface | null;
629
- hasPaymentMethod: boolean;
630
- error: string | null;
631
- isProcessing: boolean;
632
- onBack: () => void;
633
- onAddPaymentMethod: () => void;
634
- onConfirm: () => void;
635
- promotionCode: PromotionCodeValidationResult | null;
636
- isValidatingPromoCode: boolean;
637
- promoCodeError: string | null;
638
- onApplyPromoCode: (code: string) => void;
639
- onRemovePromoCode: () => void;
640
- isTrialUpgrade: boolean;
641
- };
642
- declare function WizardStepReview({ selectedPrice, subscription, prorationPreview, hasPaymentMethod, error, isProcessing, onBack, onAddPaymentMethod, onConfirm, promotionCode, isValidatingPromoCode, promoCodeError, onApplyPromoCode, onRemovePromoCode, isTrialUpgrade, }: WizardStepReviewProps): React.JSX.Element;
643
-
644
- type WizardStepPaymentMethodProps = {
645
- onBack: () => void;
646
- onSuccess: () => void;
647
- isProcessing: boolean;
648
- };
649
- declare function WizardStepPaymentMethod({ onBack, onSuccess, isProcessing }: WizardStepPaymentMethodProps): React.JSX.Element;
650
-
651
668
  declare function UsageContainer(): React.JSX.Element | null;
652
669
 
653
670
  type UsageSummaryCardProps = {
@@ -677,4 +694,4 @@ type PromoCodeInputProps = {
677
694
  };
678
695
  declare function PromoCodeInput({ appliedCode, isValidating, error, onApply, onRemove, disabled, }: PromoCodeInputProps): React.JSX.Element;
679
696
 
680
- 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, formatDate, isStripeConfigured, optionalDate, optionalDecimal, optionalPositiveInt, parseOptionalDecimal, parseOptionalPositiveInt, priceLabel, promotionCodeDiscount, subscriptionDiscount, toCouponCodeInput, useBillingFormatOptions, useCouponContext, usePriceContext, useProductContext };
697
+ export { BillingAlertBanner, BillingDashboardContainer, BillingDetailModal, type BillingDiscount, BillingFormatOptions, type BillingInterval, BillingUsageSummaryCard, type CancelDialogRenderProps, 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, type RenderCancelDialog, StripeProvider, SubscriptionConfirmation, SubscriptionDetails, SubscriptionStatusBadge, SubscriptionSummaryCard, SubscriptionWizard, type SubscriptionWizardProps, SubscriptionsContainer, SubscriptionsList, UsageContainer, UsageHistoryTable, UsageSummaryCard, UsageSummaryCards, WizardProgressIndicator, WizardStepPaymentMethod, WizardStepPlanSelection, WizardStepReview, applyDiscount, couponCodeDefaults, couponCodeSchema, couponCurrencyOptions, formatDate, isStripeConfigured, optionalDate, optionalDecimal, optionalPositiveInt, parseOptionalDecimal, parseOptionalPositiveInt, priceLabel, promotionCodeDiscount, subscriptionDiscount, toCouponCodeInput, useBillingFormatOptions, useCouponContext, usePriceContext, useProductContext };
@@ -1317,7 +1317,8 @@ function SubscriptionDetails({
1317
1317
  open,
1318
1318
  onOpenChange,
1319
1319
  onSubscriptionChange,
1320
- onChangePlan
1320
+ onChangePlan,
1321
+ renderCancelDialog
1321
1322
  }) {
1322
1323
  const t = _nextintl.useTranslations.call(void 0, );
1323
1324
  const fmt = _chunkY7JIQNM6js.useBillingFormatOptions.call(void 0, );
@@ -1380,7 +1381,19 @@ function SubscriptionDetails({
1380
1381
  ] })
1381
1382
  ] })
1382
1383
  ] }) }),
1383
- showCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1384
+ showCancel && (renderCancelDialog ? renderCancelDialog({
1385
+ subscription,
1386
+ open: showCancel,
1387
+ onOpenChange: setShowCancel,
1388
+ onSuccess: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
1389
+ onSubscriptionChange();
1390
+ setShowCancel(false);
1391
+ }, "onSuccess"),
1392
+ openChangePlan: onChangePlan ? () => {
1393
+ onChangePlan(subscription);
1394
+ onOpenChange(false);
1395
+ } : void 0
1396
+ }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1384
1397
  CancelSubscriptionDialog,
1385
1398
  {
1386
1399
  subscription,
@@ -1391,7 +1404,7 @@ function SubscriptionDetails({
1391
1404
  setShowCancel(false);
1392
1405
  }
1393
1406
  }
1394
- )
1407
+ ))
1395
1408
  ] });
1396
1409
  }
1397
1410
  _chunk7QVYU63Ejs.__name.call(void 0, SubscriptionDetails, "SubscriptionDetails");
@@ -1417,7 +1430,12 @@ function formatPlanName3(price, t) {
1417
1430
  return interval ? `${planLabel} (${interval})` : planLabel || t("billing.ui.not_available");
1418
1431
  }
1419
1432
  _chunk7QVYU63Ejs.__name.call(void 0, formatPlanName3, "formatPlanName");
1420
- function SubscriptionsList({ subscriptions, onSubscriptionsChange, onChangePlan }) {
1433
+ function SubscriptionsList({
1434
+ subscriptions,
1435
+ onSubscriptionsChange,
1436
+ onChangePlan,
1437
+ renderCancelDialog
1438
+ }) {
1421
1439
  const t = _nextintl.useTranslations.call(void 0, );
1422
1440
  const fmt = _chunkY7JIQNM6js.useBillingFormatOptions.call(void 0, );
1423
1441
  const [selectedSub, setSelectedSub] = _react.useState.call(void 0, null);
@@ -1488,7 +1506,8 @@ function SubscriptionsList({ subscriptions, onSubscriptionsChange, onChangePlan
1488
1506
  onChangePlan: onChangePlan ? (sub) => {
1489
1507
  setSelectedSub(null);
1490
1508
  onChangePlan(sub);
1491
- } : void 0
1509
+ } : void 0,
1510
+ renderCancelDialog
1492
1511
  }
1493
1512
  )
1494
1513
  ] });
@@ -1501,7 +1520,8 @@ function SubscriptionsContainer({
1501
1520
  onOpenWizard,
1502
1521
  hasActiveRecurringSubscription,
1503
1522
  subscriptions: parentSubscriptions,
1504
- onSubscriptionsChange
1523
+ onSubscriptionsChange,
1524
+ renderCancelDialog
1505
1525
  }) {
1506
1526
  const t = _nextintl.useTranslations.call(void 0, );
1507
1527
  const isControlled = parentSubscriptions !== void 0;
@@ -1555,7 +1575,8 @@ function SubscriptionsContainer({
1555
1575
  {
1556
1576
  subscriptions,
1557
1577
  onSubscriptionsChange: loadSubscriptions,
1558
- onChangePlan: (sub) => _optionalChain([onOpenWizard, 'optionalCall', _46 => _46(sub)])
1578
+ onChangePlan: (sub) => _optionalChain([onOpenWizard, 'optionalCall', _46 => _46(sub)]),
1579
+ renderCancelDialog
1559
1580
  }
1560
1581
  )
1561
1582
  ] });
@@ -2996,7 +3017,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, BillingAlertBanner, "BillingAlertBanner");
2996
3017
 
2997
3018
  // src/features/billing/components/containers/BillingDashboardContainer.tsx
2998
3019
 
2999
- function BillingDashboardContainer() {
3020
+ function BillingDashboardContainer({ renderCancelDialog } = {}) {
3000
3021
  const t = _nextintl.useTranslations.call(void 0, );
3001
3022
  const [data, setData] = _react.useState.call(void 0, {
3002
3023
  customer: null,
@@ -3316,7 +3337,8 @@ function BillingDashboardContainer() {
3316
3337
  onOpenWizard: handleOpenWizard,
3317
3338
  hasActiveRecurringSubscription,
3318
3339
  subscriptions: data.subscriptions,
3319
- onSubscriptionsChange: refreshData
3340
+ onSubscriptionsChange: refreshData,
3341
+ renderCancelDialog
3320
3342
  }
3321
3343
  )
3322
3344
  }