@carlonicora/nextjs-jsonapi 5.6.0 → 5.7.1

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 (91) hide show
  1. package/dist/{BlockNoteEditor-AE3ZTEEH.js → BlockNoteEditor-ARUXU5AV.js} +19 -19
  2. package/dist/{BlockNoteEditor-AE3ZTEEH.js.map → BlockNoteEditor-ARUXU5AV.js.map} +1 -1
  3. package/dist/{BlockNoteEditor-NEYG5L6W.mjs → BlockNoteEditor-MNNISNVN.mjs} +4 -4
  4. package/dist/{BlockNoteViewer-3OUT5UFY.mjs → BlockNoteViewer-BVVN6D3T.mjs} +2 -2
  5. package/dist/{BlockNoteViewer-4CFKQM7U.js → BlockNoteViewer-SD3ZFIXD.js} +3 -3
  6. package/dist/{BlockNoteViewer-4CFKQM7U.js.map → BlockNoteViewer-SD3ZFIXD.js.map} +1 -1
  7. package/dist/billing/index.d.mts +33 -43
  8. package/dist/billing/index.d.ts +33 -43
  9. package/dist/billing/index.js +591 -574
  10. package/dist/billing/index.js.map +1 -1
  11. package/dist/billing/index.mjs +30 -13
  12. package/dist/billing/index.mjs.map +1 -1
  13. package/dist/{chunk-SFYPXCK4.mjs → chunk-2FNSDBJG.mjs} +641 -536
  14. package/dist/chunk-2FNSDBJG.mjs.map +1 -0
  15. package/dist/{chunk-3I5AAJXV.js → chunk-2TXE57LE.js} +3 -3
  16. package/dist/{chunk-3I5AAJXV.js.map → chunk-2TXE57LE.js.map} +1 -1
  17. package/dist/{chunk-LQ4DK4JF.js → chunk-2WK35GO2.js} +1317 -1212
  18. package/dist/chunk-2WK35GO2.js.map +1 -0
  19. package/dist/{chunk-HKZAESS6.js → chunk-5TH2DSAH.js} +17 -12
  20. package/dist/chunk-5TH2DSAH.js.map +1 -0
  21. package/dist/{chunk-EYA2F6AN.mjs → chunk-FK26NX3S.mjs} +16 -11
  22. package/dist/chunk-FK26NX3S.mjs.map +1 -0
  23. package/dist/{chunk-53BAULDP.js → chunk-IJME5SAM.js} +4 -4
  24. package/dist/{chunk-53BAULDP.js.map → chunk-IJME5SAM.js.map} +1 -1
  25. package/dist/{chunk-KQHBONL4.mjs → chunk-OKCV4GPJ.mjs} +2 -2
  26. package/dist/{chunk-BTPUYUQ3.mjs → chunk-RGQYFSJF.mjs} +2 -2
  27. package/dist/{chunk-Y7RR57EW.mjs → chunk-WCHLCOZG.mjs} +2 -2
  28. package/dist/{chunk-RL3PL3KV.js → chunk-XOSC3FFP.js} +8 -8
  29. package/dist/{chunk-RL3PL3KV.js.map → chunk-XOSC3FFP.js.map} +1 -1
  30. package/dist/client/index.js +4 -4
  31. package/dist/client/index.mjs +3 -3
  32. package/dist/components/index.js +4 -4
  33. package/dist/components/index.mjs +3 -3
  34. package/dist/contexts/index.js +4 -4
  35. package/dist/contexts/index.mjs +3 -3
  36. package/dist/core/index.d.mts +9 -3
  37. package/dist/core/index.d.ts +9 -3
  38. package/dist/core/index.js +10 -2
  39. package/dist/core/index.js.map +1 -1
  40. package/dist/core/index.mjs +9 -1
  41. package/dist/{format-options-D6c7FNDi.d.mts → currency-DT_dveBx.d.mts} +41 -8
  42. package/dist/{format-options-BtX3o0Yu.d.ts → currency-pK9eRYRC.d.ts} +41 -8
  43. package/dist/email-automations/index.js +92 -92
  44. package/dist/email-automations/index.mjs +3 -3
  45. package/dist/features/analytics/index.js +121 -121
  46. package/dist/features/analytics/index.mjs +4 -4
  47. package/dist/features/analytics/server.js +4 -4
  48. package/dist/features/analytics/server.mjs +2 -2
  49. package/dist/features/blog/index.js +150 -150
  50. package/dist/features/blog/index.mjs +3 -3
  51. package/dist/features/blog/server.js +16 -16
  52. package/dist/features/blog/server.mjs +1 -1
  53. package/dist/features/help/index.js +37 -37
  54. package/dist/features/help/index.mjs +3 -3
  55. package/dist/features/tokenusage/index.js +124 -124
  56. package/dist/features/tokenusage/index.mjs +4 -4
  57. package/dist/index.d.mts +2 -2
  58. package/dist/index.d.ts +2 -2
  59. package/dist/index.js +11 -3
  60. package/dist/index.js.map +1 -1
  61. package/dist/index.mjs +10 -2
  62. package/dist/server/index.js +3 -3
  63. package/dist/server/index.mjs +2 -2
  64. package/package.json +1 -1
  65. package/src/core/index.ts +3 -0
  66. package/src/features/billing/contexts/CouponContext.tsx +0 -2
  67. package/src/features/billing/stripe-coupon/components/containers/CouponContainer.tsx +2 -2
  68. package/src/features/billing/stripe-coupon/components/details/CouponDetails.tsx +5 -2
  69. package/src/features/billing/stripe-coupon/components/forms/CouponCodeEditor.tsx +6 -5
  70. package/src/features/billing/stripe-coupon/components/forms/CouponCodeFields.tsx +67 -45
  71. package/src/features/billing/stripe-coupon/components/forms/CouponEditor.tsx +294 -212
  72. package/src/features/billing/stripe-coupon/components/widgets/CouponCodeActions.tsx +4 -3
  73. package/src/features/billing/stripe-coupon/data/stripe-coupon.interface.ts +11 -7
  74. package/src/features/billing/stripe-coupon/data/stripe-coupon.ts +6 -4
  75. package/src/features/billing/stripe-coupon/hooks/useStripeCouponCodeTableStructure.tsx +14 -7
  76. package/src/features/billing/stripe-coupon/hooks/useStripeCouponTableStructure.tsx +2 -2
  77. package/src/features/billing/stripe-coupon/stripe-coupon-code.module.ts +3 -2
  78. package/src/features/billing/stripe-coupon/stripe-coupon.module.ts +11 -4
  79. package/src/features/billing/stripe-coupon/utils/__tests__/coupon-page-module.spec.ts +32 -0
  80. package/src/features/billing/stripe-coupon/utils/coupon-page-module.ts +13 -0
  81. package/src/features/billing/stripe-promotion-code/components/PromoCodeInput.tsx +1 -1
  82. package/src/features/billing/stripe-subscription/hooks/wizard-promotion.ts +15 -8
  83. package/dist/chunk-EYA2F6AN.mjs.map +0 -1
  84. package/dist/chunk-HKZAESS6.js.map +0 -1
  85. package/dist/chunk-LQ4DK4JF.js.map +0 -1
  86. package/dist/chunk-SFYPXCK4.mjs.map +0 -1
  87. /package/dist/{BlockNoteEditor-NEYG5L6W.mjs.map → BlockNoteEditor-MNNISNVN.mjs.map} +0 -0
  88. /package/dist/{BlockNoteViewer-3OUT5UFY.mjs.map → BlockNoteViewer-BVVN6D3T.mjs.map} +0 -0
  89. /package/dist/{chunk-KQHBONL4.mjs.map → chunk-OKCV4GPJ.mjs.map} +0 -0
  90. /package/dist/{chunk-BTPUYUQ3.mjs.map → chunk-RGQYFSJF.mjs.map} +0 -0
  91. /package/dist/{chunk-Y7RR57EW.mjs.map → chunk-WCHLCOZG.mjs.map} +0 -0
@@ -1,8 +1,9 @@
1
1
  import * as React from 'react';
2
2
  import { ReactNode } from 'react';
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';
3
+ import { k as StripeSubscriptionInterface, P as PaymentMethodInterface, S as StripeCustomerInterface, a as StripeInvoiceInterface, M as MeterInterface, p as MeterSummaryInterface, F as BillingFormatOptions, r as PromotionCodeValidationResult, u as StripeCouponInterface, x as StripeCouponInput, y as StripeCouponRenameInput, A as StripeCouponCodeInput, z as StripeCouponCodeInterface, B as StripeCouponCodeFlagsInput, d as StripePriceInterface, f as StripePriceInput, g as StripeProductInterface, h as StripeProductInput, I as InvoiceStatus, b as ProrationPreviewInterface, i as SubscriptionStatus, o as StripeUsageInterface } from '../currency-DT_dveBx.mjs';
4
+ export { G as BillingTranslator, D as formatCurrency, E as formatFixed, C as formatInterval } from '../currency-DT_dveBx.mjs';
5
5
  import { J as JsonApiHydratedDataInterface } from '../ApiDataInterface-BcZeXy5X.mjs';
6
+ import { FieldValues, UseFormReturn } from 'react-hook-form';
6
7
  import { z } from 'zod';
7
8
  import '../feature.interface-CXb1-vNq.mjs';
8
9
 
@@ -63,27 +64,6 @@ declare function StripeProvider({ children }: {
63
64
  }): React.JSX.Element;
64
65
  declare function isStripeConfigured(): boolean;
65
66
 
66
- /**
67
- * Format price recurring interval for display
68
- * @param price - Stripe price object
69
- * @param options - `t` translates the interval words; without it the output is English
70
- * @returns Formatted interval string (e.g., "/month", "/year", "/2 weeks", "one-time")
71
- */
72
- declare function formatInterval(price: StripePriceInterface, options?: BillingFormatOptions): string;
73
- /**
74
- * Format currency amount from cents to localized currency string
75
- * @param amount - Amount in cents
76
- * @param currency - Currency code (e.g., "USD", "EUR", "GBP")
77
- * @param options - `locale` drives number formatting; defaults to "en-US"
78
- * @returns Formatted currency string (e.g., "$9.99", "€9,99")
79
- */
80
- declare function formatCurrency(amount: number | undefined, currency: string, options?: BillingFormatOptions): string;
81
- /**
82
- * `value.toFixed(digits)` with the locale's decimal separator ("12.5" in English,
83
- * "12,5" in Italian). No grouping, so English output matches `toFixed` exactly.
84
- */
85
- declare function formatFixed(value: number, locale: string | undefined, digits: number): string;
86
-
87
67
  /**
88
68
  * Format a date to a localized date string
89
69
  * @param date - Date object or ISO string
@@ -392,54 +372,64 @@ declare function CouponContainer(): React.JSX.Element | null;
392
372
  declare function CouponDetails(): React.JSX.Element | null;
393
373
 
394
374
  /**
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.
375
+ * What a number or decimal `<FormInput>` holds: "" until something is typed, a
376
+ * number from `type="number"` (`+""` is 0 when cleared, NaN on garbage), a
377
+ * string from `type="decimal"` (may use a comma as the separator).
378
+ *
379
+ * The schemas below validate this raw value and never transform it, so the
380
+ * form's values have one type before and after validation. The `parse*`
381
+ * functions turn it into the number that is sent, on submit.
398
382
  */
399
- declare const optionalPositiveInt: () => z.ZodPreprocess<z.ZodOptional<z.ZodNumber>, unknown>;
383
+ type RawNumber = string | number | null | undefined;
400
384
  /**
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)`).
385
+ * Optional whole number of at least 1. 0, "" and NaN all mean "not set": every
386
+ * limit here has a floor of 1.
404
387
  */
405
- declare const optionalDecimal: () => z.ZodPreprocess<z.ZodOptional<z.ZodNumber>, unknown>;
406
- /** Mirrors StripeCouponCodePostAttributesDTO. */
388
+ declare function parseOptionalPositiveInt(value: RawNumber): number | undefined;
389
+ /**
390
+ * Optional decimal in MAJOR units. Converted to minor units on submit, exactly
391
+ * as PriceEditor does (`Math.round(value * 100)`).
392
+ */
393
+ declare function parseOptionalDecimal(value: RawNumber): number | undefined;
394
+ declare const optionalPositiveInt: () => z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
395
+ declare const optionalDecimal: () => z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
407
396
  /**
408
397
  * Optional point in time from `<FormDateTime allowEmpty>`, which writes "" when
409
398
  * the value is cleared (FormDateTime.tsx:136, :241).
410
399
  */
411
- declare const optionalDate: () => z.ZodPreprocess<z.ZodOptional<z.ZodDate>, unknown>;
400
+ declare const optionalDate: () => z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodDate, z.ZodLiteral<"">]>>>;
401
+ /** Mirrors StripeCouponCodePostAttributesDTO. */
412
402
  declare const couponCodeSchema: (t: (key: string) => string) => z.ZodObject<{
413
403
  code: z.ZodOptional<z.ZodString>;
414
404
  firstTimeTransaction: z.ZodBoolean;
415
- minimumAmount: z.ZodPreprocess<z.ZodOptional<z.ZodNumber>, unknown>;
405
+ minimumAmount: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
416
406
  minimumAmountCurrency: z.ZodString;
417
407
  stripeCustomerId: z.ZodOptional<z.ZodString>;
418
- expiresAt: z.ZodPreprocess<z.ZodOptional<z.ZodDate>, unknown>;
419
- maxRedemptions: z.ZodPreprocess<z.ZodOptional<z.ZodNumber>, unknown>;
408
+ expiresAt: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodDate, z.ZodLiteral<"">]>>>;
409
+ maxRedemptions: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
420
410
  automatic: z.ZodBoolean;
421
411
  }, z.core.$strip>;
422
412
  type CouponCodeFormValues = z.infer<ReturnType<typeof couponCodeSchema>>;
423
413
  /**
424
414
  * Every text/number input starts as "" (never undefined): FormInput spreads
425
415
  * `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.
416
+ * uncontrolled to controlled (console warning). The parse functions map ""
417
+ * to undefined, so empty fields are still sent as absent.
428
418
  */
429
- declare const couponCodeDefaults: () => z.input<ReturnType<typeof couponCodeSchema>>;
419
+ declare const couponCodeDefaults: () => CouponCodeFormValues;
430
420
  /** Form values → the code attributes the models serialise. Unset fields are left out. */
431
421
  declare const toCouponCodeInput: (values: CouponCodeFormValues) => Omit<StripeCouponCodeInput, "id" | "couponId">;
432
422
  declare const couponCurrencyOptions: {
433
423
  id: string;
434
424
  text: string;
435
425
  }[];
436
- type CouponCodeFieldsProps = {
437
- form: any;
426
+ type CouponCodeFieldsProps<T extends FieldValues> = {
427
+ form: UseFormReturn<T>;
438
428
  /** "" for CouponCodeEditor, "firstCode." when nested inside CouponEditor. */
439
429
  prefix?: string;
440
430
  };
441
431
  /** The fields of a customer-facing code, shared by CouponEditor (first code) and CouponCodeEditor. */
442
- declare function CouponCodeFields({ form, prefix }: CouponCodeFieldsProps): React.JSX.Element;
432
+ declare function CouponCodeFields<T extends FieldValues>({ form, prefix }: CouponCodeFieldsProps<T>): React.JSX.Element;
443
433
 
444
434
  type CouponRefresherProps = {
445
435
  coupon: StripeCouponInterface;
@@ -686,4 +676,4 @@ type PromoCodeInputProps = {
686
676
  };
687
677
  declare function PromoCodeInput({ appliedCode, isValidating, error, onApply, onRemove, disabled, }: PromoCodeInputProps): React.JSX.Element;
688
678
 
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 };
679
+ 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 };
@@ -1,8 +1,9 @@
1
1
  import * as React from 'react';
2
2
  import { ReactNode } from 'react';
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';
3
+ import { k as StripeSubscriptionInterface, P as PaymentMethodInterface, S as StripeCustomerInterface, a as StripeInvoiceInterface, M as MeterInterface, p as MeterSummaryInterface, F as BillingFormatOptions, r as PromotionCodeValidationResult, u as StripeCouponInterface, x as StripeCouponInput, y as StripeCouponRenameInput, A as StripeCouponCodeInput, z as StripeCouponCodeInterface, B as StripeCouponCodeFlagsInput, d as StripePriceInterface, f as StripePriceInput, g as StripeProductInterface, h as StripeProductInput, I as InvoiceStatus, b as ProrationPreviewInterface, i as SubscriptionStatus, o as StripeUsageInterface } from '../currency-pK9eRYRC.js';
4
+ export { G as BillingTranslator, D as formatCurrency, E as formatFixed, C as formatInterval } from '../currency-pK9eRYRC.js';
5
5
  import { J as JsonApiHydratedDataInterface } from '../ApiDataInterface-BcZeXy5X.js';
6
+ import { FieldValues, UseFormReturn } from 'react-hook-form';
6
7
  import { z } from 'zod';
7
8
  import '../feature.interface-BO25VLlx.js';
8
9
 
@@ -63,27 +64,6 @@ declare function StripeProvider({ children }: {
63
64
  }): React.JSX.Element;
64
65
  declare function isStripeConfigured(): boolean;
65
66
 
66
- /**
67
- * Format price recurring interval for display
68
- * @param price - Stripe price object
69
- * @param options - `t` translates the interval words; without it the output is English
70
- * @returns Formatted interval string (e.g., "/month", "/year", "/2 weeks", "one-time")
71
- */
72
- declare function formatInterval(price: StripePriceInterface, options?: BillingFormatOptions): string;
73
- /**
74
- * Format currency amount from cents to localized currency string
75
- * @param amount - Amount in cents
76
- * @param currency - Currency code (e.g., "USD", "EUR", "GBP")
77
- * @param options - `locale` drives number formatting; defaults to "en-US"
78
- * @returns Formatted currency string (e.g., "$9.99", "€9,99")
79
- */
80
- declare function formatCurrency(amount: number | undefined, currency: string, options?: BillingFormatOptions): string;
81
- /**
82
- * `value.toFixed(digits)` with the locale's decimal separator ("12.5" in English,
83
- * "12,5" in Italian). No grouping, so English output matches `toFixed` exactly.
84
- */
85
- declare function formatFixed(value: number, locale: string | undefined, digits: number): string;
86
-
87
67
  /**
88
68
  * Format a date to a localized date string
89
69
  * @param date - Date object or ISO string
@@ -392,54 +372,64 @@ declare function CouponContainer(): React.JSX.Element | null;
392
372
  declare function CouponDetails(): React.JSX.Element | null;
393
373
 
394
374
  /**
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.
375
+ * What a number or decimal `<FormInput>` holds: "" until something is typed, a
376
+ * number from `type="number"` (`+""` is 0 when cleared, NaN on garbage), a
377
+ * string from `type="decimal"` (may use a comma as the separator).
378
+ *
379
+ * The schemas below validate this raw value and never transform it, so the
380
+ * form's values have one type before and after validation. The `parse*`
381
+ * functions turn it into the number that is sent, on submit.
398
382
  */
399
- declare const optionalPositiveInt: () => z.ZodPreprocess<z.ZodOptional<z.ZodNumber>, unknown>;
383
+ type RawNumber = string | number | null | undefined;
400
384
  /**
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)`).
385
+ * Optional whole number of at least 1. 0, "" and NaN all mean "not set": every
386
+ * limit here has a floor of 1.
404
387
  */
405
- declare const optionalDecimal: () => z.ZodPreprocess<z.ZodOptional<z.ZodNumber>, unknown>;
406
- /** Mirrors StripeCouponCodePostAttributesDTO. */
388
+ declare function parseOptionalPositiveInt(value: RawNumber): number | undefined;
389
+ /**
390
+ * Optional decimal in MAJOR units. Converted to minor units on submit, exactly
391
+ * as PriceEditor does (`Math.round(value * 100)`).
392
+ */
393
+ declare function parseOptionalDecimal(value: RawNumber): number | undefined;
394
+ declare const optionalPositiveInt: () => z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
395
+ declare const optionalDecimal: () => z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
407
396
  /**
408
397
  * Optional point in time from `<FormDateTime allowEmpty>`, which writes "" when
409
398
  * the value is cleared (FormDateTime.tsx:136, :241).
410
399
  */
411
- declare const optionalDate: () => z.ZodPreprocess<z.ZodOptional<z.ZodDate>, unknown>;
400
+ declare const optionalDate: () => z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodDate, z.ZodLiteral<"">]>>>;
401
+ /** Mirrors StripeCouponCodePostAttributesDTO. */
412
402
  declare const couponCodeSchema: (t: (key: string) => string) => z.ZodObject<{
413
403
  code: z.ZodOptional<z.ZodString>;
414
404
  firstTimeTransaction: z.ZodBoolean;
415
- minimumAmount: z.ZodPreprocess<z.ZodOptional<z.ZodNumber>, unknown>;
405
+ minimumAmount: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
416
406
  minimumAmountCurrency: z.ZodString;
417
407
  stripeCustomerId: z.ZodOptional<z.ZodString>;
418
- expiresAt: z.ZodPreprocess<z.ZodOptional<z.ZodDate>, unknown>;
419
- maxRedemptions: z.ZodPreprocess<z.ZodOptional<z.ZodNumber>, unknown>;
408
+ expiresAt: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodDate, z.ZodLiteral<"">]>>>;
409
+ maxRedemptions: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
420
410
  automatic: z.ZodBoolean;
421
411
  }, z.core.$strip>;
422
412
  type CouponCodeFormValues = z.infer<ReturnType<typeof couponCodeSchema>>;
423
413
  /**
424
414
  * Every text/number input starts as "" (never undefined): FormInput spreads
425
415
  * `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.
416
+ * uncontrolled to controlled (console warning). The parse functions map ""
417
+ * to undefined, so empty fields are still sent as absent.
428
418
  */
429
- declare const couponCodeDefaults: () => z.input<ReturnType<typeof couponCodeSchema>>;
419
+ declare const couponCodeDefaults: () => CouponCodeFormValues;
430
420
  /** Form values → the code attributes the models serialise. Unset fields are left out. */
431
421
  declare const toCouponCodeInput: (values: CouponCodeFormValues) => Omit<StripeCouponCodeInput, "id" | "couponId">;
432
422
  declare const couponCurrencyOptions: {
433
423
  id: string;
434
424
  text: string;
435
425
  }[];
436
- type CouponCodeFieldsProps = {
437
- form: any;
426
+ type CouponCodeFieldsProps<T extends FieldValues> = {
427
+ form: UseFormReturn<T>;
438
428
  /** "" for CouponCodeEditor, "firstCode." when nested inside CouponEditor. */
439
429
  prefix?: string;
440
430
  };
441
431
  /** The fields of a customer-facing code, shared by CouponEditor (first code) and CouponCodeEditor. */
442
- declare function CouponCodeFields({ form, prefix }: CouponCodeFieldsProps): React.JSX.Element;
432
+ declare function CouponCodeFields<T extends FieldValues>({ form, prefix }: CouponCodeFieldsProps<T>): React.JSX.Element;
443
433
 
444
434
  type CouponRefresherProps = {
445
435
  coupon: StripeCouponInterface;
@@ -686,4 +676,4 @@ type PromoCodeInputProps = {
686
676
  };
687
677
  declare function PromoCodeInput({ appliedCode, isValidating, error, onApply, onRemove, disabled, }: PromoCodeInputProps): React.JSX.Element;
688
678
 
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 };
679
+ 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 };