@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
@@ -65,11 +65,14 @@ import {
65
65
  couponCodeDefaults,
66
66
  couponCodeSchema,
67
67
  couponCurrencyOptions,
68
+ couponPageModule,
68
69
  errorToast,
69
70
  formatDate,
70
71
  optionalDate,
71
72
  optionalDecimal,
72
73
  optionalPositiveInt,
74
+ parseOptionalDecimal,
75
+ parseOptionalPositiveInt,
73
76
  promotionCodeDiscount,
74
77
  subscriptionDiscount,
75
78
  toCouponCodeInput,
@@ -78,10 +81,10 @@ import {
78
81
  useCurrentUserContext,
79
82
  useDataListRetriever,
80
83
  usePageUrlGenerator
81
- } from "../chunk-SFYPXCK4.mjs";
84
+ } from "../chunk-2FNSDBJG.mjs";
82
85
  import {
83
86
  getStripePublishableKey
84
- } from "../chunk-Y7RR57EW.mjs";
87
+ } from "../chunk-WCHLCOZG.mjs";
85
88
  import {
86
89
  getRoleId
87
90
  } from "../chunk-PW42LRSL.mjs";
@@ -109,7 +112,7 @@ import {
109
112
  toPromotionCodeResult,
110
113
  useI18nLocale,
111
114
  useI18nRouter
112
- } from "../chunk-EYA2F6AN.mjs";
115
+ } from "../chunk-FK26NX3S.mjs";
113
116
  import "../chunk-V5MI7RNB.mjs";
114
117
  import "../chunk-AUXK7QSA.mjs";
115
118
  import "../chunk-PI56A4DG.mjs";
@@ -1890,14 +1893,20 @@ function shouldLookUpAutomatic(code) {
1890
1893
  return !code || code.automatic === true;
1891
1894
  }
1892
1895
  __name(shouldLookUpAutomatic, "shouldLookUpAutomatic");
1896
+ function read(value, key) {
1897
+ return typeof value === "object" && value !== null ? Reflect.get(value, key) : void 0;
1898
+ }
1899
+ __name(read, "read");
1893
1900
  function errorStatus(error) {
1894
- return error?.status ?? error?.response?.status;
1901
+ const status = read(error, "status") ?? read(read(error, "response"), "status");
1902
+ return typeof status === "number" ? status : void 0;
1895
1903
  }
1896
1904
  __name(errorStatus, "errorStatus");
1897
1905
  function errorCode(error) {
1898
- const body = error?.body;
1899
- const first = body?.errors?.[0];
1900
- const code = first?.code ?? first?.meta?.context?.code ?? body?.code;
1906
+ const body = read(error, "body");
1907
+ const errors = read(body, "errors");
1908
+ const first = Array.isArray(errors) ? errors[0] : void 0;
1909
+ const code = read(first, "code") ?? read(read(read(first, "meta"), "context"), "code") ?? read(body, "code");
1901
1910
  return typeof code === "string" ? code : void 0;
1902
1911
  }
1903
1912
  __name(errorCode, "errorCode");
@@ -2488,7 +2497,7 @@ function PromoCodeInput({
2488
2497
  /* @__PURE__ */ jsx28("p", { className: "text-success text-sm", children: formatDuration(appliedCode) })
2489
2498
  ] }),
2490
2499
  /* @__PURE__ */ jsxs25("div", { className: "space-y-2", children: [
2491
- /* @__PURE__ */ jsx28("p", { className: "text-muted-foreground text-sm", children: t("billing.ui.promo_code.use_different") }),
2500
+ /* @__PURE__ */ jsx28("p", { className: "text-muted-foreground text-xs/relaxed", children: t("billing.ui.promo_code.use_different") }),
2492
2501
  codeInput
2493
2502
  ] })
2494
2503
  ] });
@@ -4382,9 +4391,9 @@ var seedSchema = z4.object({
4382
4391
  isTrial: z4.boolean().optional(),
4383
4392
  platformFeatures: z4.array(z4.string()).optional()
4384
4393
  });
4385
- function readOptional(read) {
4394
+ function readOptional(read2) {
4386
4395
  try {
4387
- return read();
4396
+ return read2();
4388
4397
  } catch {
4389
4398
  return void 0;
4390
4399
  }
@@ -4810,7 +4819,13 @@ function CouponDetails() {
4810
4819
  value: coupon.valid ? /* @__PURE__ */ jsx54(Badge, { variant: "softGreen", children: t("billing.admin.coupons.status.active") }) : /* @__PURE__ */ jsx54(Badge, { variant: "softGray", children: t("billing.admin.coupons.status.ended") })
4811
4820
  }
4812
4821
  ),
4813
- /* @__PURE__ */ jsx54(DetailField, { label: t("billing.admin.coupons.fields.discount"), value: formatCouponDiscount(coupon, t, fmt) }),
4822
+ /* @__PURE__ */ jsx54(
4823
+ DetailField,
4824
+ {
4825
+ label: t("billing.admin.coupons.fields.discount"),
4826
+ value: /* @__PURE__ */ jsx54("span", { className: "tabular-nums", children: formatCouponDiscount(coupon, t, fmt) })
4827
+ }
4828
+ ),
4814
4829
  /* @__PURE__ */ jsx54(
4815
4830
  DetailField,
4816
4831
  {
@@ -4832,7 +4847,7 @@ function CouponDetails() {
4832
4847
  DetailField,
4833
4848
  {
4834
4849
  label: t("billing.admin.coupons.fields.redeemBy"),
4835
- value: coupon.redeemBy ? formatDate(coupon.redeemBy, fmt) : "\u2014"
4850
+ value: /* @__PURE__ */ jsx54("span", { className: "tabular-nums", children: coupon.redeemBy ? formatDate(coupon.redeemBy, fmt) : "\u2014" })
4836
4851
  }
4837
4852
  ),
4838
4853
  /* @__PURE__ */ jsx54(
@@ -4957,7 +4972,7 @@ function CouponContainer() {
4957
4972
  return /* @__PURE__ */ jsx57(
4958
4973
  RoundPageContainer,
4959
4974
  {
4960
- module: Modules.StripeCoupon,
4975
+ module: couponPageModule(),
4961
4976
  id: coupon.id,
4962
4977
  tabs: [
4963
4978
  {
@@ -5054,6 +5069,8 @@ export {
5054
5069
  optionalDate,
5055
5070
  optionalDecimal,
5056
5071
  optionalPositiveInt,
5072
+ parseOptionalDecimal,
5073
+ parseOptionalPositiveInt,
5057
5074
  priceLabel,
5058
5075
  promotionCodeDiscount,
5059
5076
  subscriptionDiscount,