@carlonicora/nextjs-jsonapi 5.6.0 → 5.7.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 (87) hide show
  1. package/dist/{BlockNoteEditor-NEYG5L6W.mjs → BlockNoteEditor-R3WXUFHX.mjs} +4 -4
  2. package/dist/{BlockNoteEditor-AE3ZTEEH.js → BlockNoteEditor-ZHXXFWUJ.js} +19 -19
  3. package/dist/{BlockNoteEditor-AE3ZTEEH.js.map → BlockNoteEditor-ZHXXFWUJ.js.map} +1 -1
  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 +590 -574
  10. package/dist/billing/index.js.map +1 -1
  11. package/dist/billing/index.mjs +28 -12
  12. package/dist/billing/index.mjs.map +1 -1
  13. package/dist/{chunk-3I5AAJXV.js → chunk-2TXE57LE.js} +3 -3
  14. package/dist/{chunk-3I5AAJXV.js.map → chunk-2TXE57LE.js.map} +1 -1
  15. package/dist/{chunk-HKZAESS6.js → chunk-5TH2DSAH.js} +17 -12
  16. package/dist/chunk-5TH2DSAH.js.map +1 -0
  17. package/dist/{chunk-SFYPXCK4.mjs → chunk-CFB6FHIY.mjs} +638 -536
  18. package/dist/{chunk-SFYPXCK4.mjs.map → chunk-CFB6FHIY.mjs.map} +1 -1
  19. package/dist/{chunk-EYA2F6AN.mjs → chunk-FK26NX3S.mjs} +16 -11
  20. package/dist/chunk-FK26NX3S.mjs.map +1 -0
  21. package/dist/{chunk-53BAULDP.js → chunk-IJME5SAM.js} +4 -4
  22. package/dist/{chunk-53BAULDP.js.map → chunk-IJME5SAM.js.map} +1 -1
  23. package/dist/{chunk-KQHBONL4.mjs → chunk-OKCV4GPJ.mjs} +2 -2
  24. package/dist/{chunk-BTPUYUQ3.mjs → chunk-RGQYFSJF.mjs} +2 -2
  25. package/dist/{chunk-Y7RR57EW.mjs → chunk-WCHLCOZG.mjs} +2 -2
  26. package/dist/{chunk-RL3PL3KV.js → chunk-XOSC3FFP.js} +8 -8
  27. package/dist/{chunk-RL3PL3KV.js.map → chunk-XOSC3FFP.js.map} +1 -1
  28. package/dist/{chunk-LQ4DK4JF.js → chunk-ZCOPOO7T.js} +1314 -1212
  29. package/dist/chunk-ZCOPOO7T.js.map +1 -0
  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/details/CouponDetails.tsx +5 -2
  68. package/src/features/billing/stripe-coupon/components/forms/CouponCodeEditor.tsx +6 -5
  69. package/src/features/billing/stripe-coupon/components/forms/CouponCodeFields.tsx +67 -45
  70. package/src/features/billing/stripe-coupon/components/forms/CouponEditor.tsx +304 -212
  71. package/src/features/billing/stripe-coupon/components/widgets/CouponCodeActions.tsx +4 -3
  72. package/src/features/billing/stripe-coupon/data/stripe-coupon.interface.ts +11 -7
  73. package/src/features/billing/stripe-coupon/data/stripe-coupon.ts +6 -4
  74. package/src/features/billing/stripe-coupon/hooks/useStripeCouponCodeTableStructure.tsx +14 -7
  75. package/src/features/billing/stripe-coupon/hooks/useStripeCouponTableStructure.tsx +2 -2
  76. package/src/features/billing/stripe-coupon/stripe-coupon-code.module.ts +3 -2
  77. package/src/features/billing/stripe-coupon/stripe-coupon.module.ts +11 -4
  78. package/src/features/billing/stripe-promotion-code/components/PromoCodeInput.tsx +1 -1
  79. package/src/features/billing/stripe-subscription/hooks/wizard-promotion.ts +15 -8
  80. package/dist/chunk-EYA2F6AN.mjs.map +0 -1
  81. package/dist/chunk-HKZAESS6.js.map +0 -1
  82. package/dist/chunk-LQ4DK4JF.js.map +0 -1
  83. /package/dist/{BlockNoteEditor-NEYG5L6W.mjs.map → BlockNoteEditor-R3WXUFHX.mjs.map} +0 -0
  84. /package/dist/{BlockNoteViewer-3OUT5UFY.mjs.map → BlockNoteViewer-BVVN6D3T.mjs.map} +0 -0
  85. /package/dist/{chunk-KQHBONL4.mjs.map → chunk-OKCV4GPJ.mjs.map} +0 -0
  86. /package/dist/{chunk-BTPUYUQ3.mjs.map → chunk-RGQYFSJF.mjs.map} +0 -0
  87. /package/dist/{chunk-Y7RR57EW.mjs.map → chunk-WCHLCOZG.mjs.map} +0 -0
@@ -146,6 +146,7 @@ import {
146
146
  S3Module,
147
147
  S3Service,
148
148
  STRIPE_COUPON_CODE_AUTOMATIC_SEGMENT,
149
+ STRIPE_COUPON_DETAIL_PAGE_URL,
149
150
  STRIPE_COUPON_REFRESH_SEGMENT,
150
151
  StripeCoupon,
151
152
  StripeCouponCode,
@@ -229,7 +230,10 @@ import {
229
230
  exists,
230
231
  formatCodiceFiscale,
231
232
  formatCouponDiscount,
233
+ formatCurrency,
232
234
  formatDate,
235
+ formatFixed,
236
+ formatInterval,
233
237
  formatLocalDate,
234
238
  formatPartitaIva,
235
239
  getClientGlobalErrorHandler,
@@ -269,7 +273,7 @@ import {
269
273
  validateCodiceFiscale,
270
274
  validateItalianTaxCode,
271
275
  validatePartitaIva
272
- } from "../chunk-EYA2F6AN.mjs";
276
+ } from "../chunk-FK26NX3S.mjs";
273
277
  import {
274
278
  DataClassRegistry,
275
279
  ENV,
@@ -437,6 +441,7 @@ export {
437
441
  S3Module,
438
442
  S3Service,
439
443
  STRIPE_COUPON_CODE_AUTOMATIC_SEGMENT,
444
+ STRIPE_COUPON_DETAIL_PAGE_URL,
440
445
  STRIPE_COUPON_REFRESH_SEGMENT,
441
446
  StripeCoupon,
442
447
  StripeCouponCode,
@@ -520,7 +525,10 @@ export {
520
525
  exists,
521
526
  formatCodiceFiscale,
522
527
  formatCouponDiscount,
528
+ formatCurrency,
523
529
  formatDate,
530
+ formatFixed,
531
+ formatInterval,
524
532
  formatLocalDate,
525
533
  formatPartitaIva,
526
534
  getBootstrapper,
@@ -270,21 +270,33 @@ interface StripeCouponInterface extends ApiDataInterface {
270
270
  get valid(): boolean;
271
271
  get codes(): StripeCouponCodeInterface[];
272
272
  }
273
+ /** The discount of a new coupon: a percentage, or a fixed amount in one currency. */
274
+ type StripeCouponDiscountInput = {
275
+ discountType: "percent_off";
276
+ percentOff: number;
277
+ } | {
278
+ discountType: "amount_off";
279
+ amountOff: number;
280
+ currency: string;
281
+ };
282
+ /** How long a new coupon's discount lasts: months only when it repeats. */
283
+ type StripeCouponDurationInput = {
284
+ duration: "once";
285
+ } | {
286
+ duration: "forever";
287
+ } | {
288
+ duration: "repeating";
289
+ durationInMonths: number;
290
+ };
273
291
  type StripeCouponInput = {
274
292
  id: string;
275
293
  name: string;
276
294
  stripeCouponId?: string;
277
- discountType: StripeCouponDiscountType;
278
- percentOff?: number;
279
- amountOff?: number;
280
- currency?: string;
281
- duration: StripeCouponDurationType;
282
- durationInMonths?: number;
283
295
  productIds?: string[];
284
296
  redeemBy?: Date;
285
297
  maxRedemptions?: number;
286
298
  firstCode: Omit<StripeCouponCodeInput, "id" | "couponId">;
287
- };
299
+ } & StripeCouponDiscountInput & StripeCouponDurationInput;
288
300
  type StripeCouponRenameInput = {
289
301
  id: string;
290
302
  name: string;
@@ -340,4 +352,25 @@ type BillingFormatOptions = {
340
352
  t?: BillingTranslator;
341
353
  };
342
354
 
343
- export { type BillingTranslator as A, type BillingFormatOptions as B, InvoiceStatus as I, type MeterInterface as M, type PaymentMethodInterface as P, type ReportUsageInput as R, type StripeCustomerInterface as S, type UsageSummaryInterface as U, type StripeInvoiceInterface as a, type ProrationPreviewInterface as b, type ProrationLineItem as c, type StripePriceInterface as d, type PriceRecurring as e, type StripePriceInput as f, type StripeProductInterface as g, type StripeProductInput as h, SubscriptionStatus as i, type StripeSubscriptionDiscount as j, type StripeSubscriptionInterface as k, type StripeSubscriptionInput as l, type StripeSubscriptionCreateMeta as m, type StripeSubscriptionCreateResponse as n, type StripeUsageInterface as o, type MeterSummaryInterface as p, type UsageRecordInterface as q, type PromotionCodeValidationResult as r, type StripeCouponDiscountType as s, type StripeCouponDurationType as t, type StripeCouponInterface as u, type StripeCouponInput as v, type StripeCouponRenameInput as w, type StripeCouponCodeInterface as x, type StripeCouponCodeInput as y, type StripeCouponCodeFlagsInput as z };
355
+ /**
356
+ * Format price recurring interval for display
357
+ * @param price - Stripe price object
358
+ * @param options - `t` translates the interval words; without it the output is English
359
+ * @returns Formatted interval string (e.g., "/month", "/year", "/2 weeks", "one-time")
360
+ */
361
+ declare function formatInterval(price: StripePriceInterface, options?: BillingFormatOptions): string;
362
+ /**
363
+ * Format currency amount from cents to localized currency string
364
+ * @param amount - Amount in cents
365
+ * @param currency - Currency code (e.g., "USD", "EUR", "GBP")
366
+ * @param options - `locale` drives number formatting; defaults to "en-US"
367
+ * @returns Formatted currency string (e.g., "$9.99", "€9,99")
368
+ */
369
+ declare function formatCurrency(amount: number | undefined, currency: string, options?: BillingFormatOptions): string;
370
+ /**
371
+ * `value.toFixed(digits)` with the locale's decimal separator ("12.5" in English,
372
+ * "12,5" in Italian). No grouping, so English output matches `toFixed` exactly.
373
+ */
374
+ declare function formatFixed(value: number, locale: string | undefined, digits: number): string;
375
+
376
+ export { type StripeCouponCodeInput as A, type StripeCouponCodeFlagsInput as B, formatInterval as C, formatCurrency as D, formatFixed as E, type BillingFormatOptions as F, type BillingTranslator as G, InvoiceStatus as I, type MeterInterface as M, type PaymentMethodInterface as P, type ReportUsageInput as R, type StripeCustomerInterface as S, type UsageSummaryInterface as U, type StripeInvoiceInterface as a, type ProrationPreviewInterface as b, type ProrationLineItem as c, type StripePriceInterface as d, type PriceRecurring as e, type StripePriceInput as f, type StripeProductInterface as g, type StripeProductInput as h, SubscriptionStatus as i, type StripeSubscriptionDiscount as j, type StripeSubscriptionInterface as k, type StripeSubscriptionInput as l, type StripeSubscriptionCreateMeta as m, type StripeSubscriptionCreateResponse as n, type StripeUsageInterface as o, type MeterSummaryInterface as p, type UsageRecordInterface as q, type PromotionCodeValidationResult as r, type StripeCouponDiscountType as s, type StripeCouponDurationType as t, type StripeCouponInterface as u, type StripeCouponDiscountInput as v, type StripeCouponDurationInput as w, type StripeCouponInput as x, type StripeCouponRenameInput as y, type StripeCouponCodeInterface as z };
@@ -270,21 +270,33 @@ interface StripeCouponInterface extends ApiDataInterface {
270
270
  get valid(): boolean;
271
271
  get codes(): StripeCouponCodeInterface[];
272
272
  }
273
+ /** The discount of a new coupon: a percentage, or a fixed amount in one currency. */
274
+ type StripeCouponDiscountInput = {
275
+ discountType: "percent_off";
276
+ percentOff: number;
277
+ } | {
278
+ discountType: "amount_off";
279
+ amountOff: number;
280
+ currency: string;
281
+ };
282
+ /** How long a new coupon's discount lasts: months only when it repeats. */
283
+ type StripeCouponDurationInput = {
284
+ duration: "once";
285
+ } | {
286
+ duration: "forever";
287
+ } | {
288
+ duration: "repeating";
289
+ durationInMonths: number;
290
+ };
273
291
  type StripeCouponInput = {
274
292
  id: string;
275
293
  name: string;
276
294
  stripeCouponId?: string;
277
- discountType: StripeCouponDiscountType;
278
- percentOff?: number;
279
- amountOff?: number;
280
- currency?: string;
281
- duration: StripeCouponDurationType;
282
- durationInMonths?: number;
283
295
  productIds?: string[];
284
296
  redeemBy?: Date;
285
297
  maxRedemptions?: number;
286
298
  firstCode: Omit<StripeCouponCodeInput, "id" | "couponId">;
287
- };
299
+ } & StripeCouponDiscountInput & StripeCouponDurationInput;
288
300
  type StripeCouponRenameInput = {
289
301
  id: string;
290
302
  name: string;
@@ -340,4 +352,25 @@ type BillingFormatOptions = {
340
352
  t?: BillingTranslator;
341
353
  };
342
354
 
343
- export { type BillingTranslator as A, type BillingFormatOptions as B, InvoiceStatus as I, type MeterInterface as M, type PaymentMethodInterface as P, type ReportUsageInput as R, type StripeCustomerInterface as S, type UsageSummaryInterface as U, type StripeInvoiceInterface as a, type ProrationPreviewInterface as b, type ProrationLineItem as c, type StripePriceInterface as d, type PriceRecurring as e, type StripePriceInput as f, type StripeProductInterface as g, type StripeProductInput as h, SubscriptionStatus as i, type StripeSubscriptionDiscount as j, type StripeSubscriptionInterface as k, type StripeSubscriptionInput as l, type StripeSubscriptionCreateMeta as m, type StripeSubscriptionCreateResponse as n, type StripeUsageInterface as o, type MeterSummaryInterface as p, type UsageRecordInterface as q, type PromotionCodeValidationResult as r, type StripeCouponDiscountType as s, type StripeCouponDurationType as t, type StripeCouponInterface as u, type StripeCouponInput as v, type StripeCouponRenameInput as w, type StripeCouponCodeInterface as x, type StripeCouponCodeInput as y, type StripeCouponCodeFlagsInput as z };
355
+ /**
356
+ * Format price recurring interval for display
357
+ * @param price - Stripe price object
358
+ * @param options - `t` translates the interval words; without it the output is English
359
+ * @returns Formatted interval string (e.g., "/month", "/year", "/2 weeks", "one-time")
360
+ */
361
+ declare function formatInterval(price: StripePriceInterface, options?: BillingFormatOptions): string;
362
+ /**
363
+ * Format currency amount from cents to localized currency string
364
+ * @param amount - Amount in cents
365
+ * @param currency - Currency code (e.g., "USD", "EUR", "GBP")
366
+ * @param options - `locale` drives number formatting; defaults to "en-US"
367
+ * @returns Formatted currency string (e.g., "$9.99", "€9,99")
368
+ */
369
+ declare function formatCurrency(amount: number | undefined, currency: string, options?: BillingFormatOptions): string;
370
+ /**
371
+ * `value.toFixed(digits)` with the locale's decimal separator ("12.5" in English,
372
+ * "12,5" in Italian). No grouping, so English output matches `toFixed` exactly.
373
+ */
374
+ declare function formatFixed(value: number, locale: string | undefined, digits: number): string;
375
+
376
+ export { type StripeCouponCodeInput as A, type StripeCouponCodeFlagsInput as B, formatInterval as C, formatCurrency as D, formatFixed as E, type BillingFormatOptions as F, type BillingTranslator as G, InvoiceStatus as I, type MeterInterface as M, type PaymentMethodInterface as P, type ReportUsageInput as R, type StripeCustomerInterface as S, type UsageSummaryInterface as U, type StripeInvoiceInterface as a, type ProrationPreviewInterface as b, type ProrationLineItem as c, type StripePriceInterface as d, type PriceRecurring as e, type StripePriceInput as f, type StripeProductInterface as g, type StripeProductInput as h, SubscriptionStatus as i, type StripeSubscriptionDiscount as j, type StripeSubscriptionInterface as k, type StripeSubscriptionInput as l, type StripeSubscriptionCreateMeta as m, type StripeSubscriptionCreateResponse as n, type StripeUsageInterface as o, type MeterSummaryInterface as p, type UsageRecordInterface as q, type PromotionCodeValidationResult as r, type StripeCouponDiscountType as s, type StripeCouponDurationType as t, type StripeCouponInterface as u, type StripeCouponDiscountInput as v, type StripeCouponDurationInput as w, type StripeCouponInput as x, type StripeCouponRenameInput as y, type StripeCouponCodeInterface as z };