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