@carlonicora/nextjs-jsonapi 6.10.0 → 6.10.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.
@@ -1825,7 +1825,6 @@ function ProrationPreview({ preview }) {
1825
1825
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-foreground", children: _chunkSQTXJPREjs.formatCurrency.call(void 0, preview.immediateCharge, preview.currency, fmt) })
1826
1826
  ] }) }),
1827
1827
  preview.lineItems.length > 0 && preview.lineItems[0].period && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-muted-foreground mt-2 text-xs", children: t("billing.ui.proration.next_invoice", {
1828
- date: _chunk4UFMLTL2js.formatDate.call(void 0, preview.lineItems[0].period.end, fmt),
1829
1828
  amount: _chunkSQTXJPREjs.formatCurrency.call(void 0, preview.amountDue, preview.currency, fmt)
1830
1829
  }) })
1831
1830
  ] })
@@ -2587,6 +2586,8 @@ function WizardStepReview({
2587
2586
  const discount = _nullishCoalesce(codeDiscount, () => ( carriedDiscount));
2588
2587
  const discountedPrice = _chunk4UFMLTL2js.applyDiscount.call(void 0, selectedPrice.unitAmount, discount);
2589
2588
  const discountedImmediateCharge = _chunk4UFMLTL2js.applyDiscount.call(void 0, _optionalChain([prorationPreview, 'optionalAccess', _95 => _95.immediateCharge]), discount);
2589
+ const isProrationCredit = !isTrialUpgrade && (_nullishCoalesce(_nullishCoalesce(discountedImmediateCharge, () => ( _optionalChain([prorationPreview, 'optionalAccess', _96 => _96.immediateCharge]))), () => ( 0))) < 0;
2590
+ const prorationAmount = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (amount) => isProrationCredit ? Math.abs(amount) : amount, "prorationAmount");
2590
2591
  const getDiscountDescription = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
2591
2592
  if (!discount) return null;
2592
2593
  if (discount.discountType === "percent_off") {
@@ -2602,7 +2603,7 @@ function WizardStepReview({
2602
2603
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk4UFMLTL2js.SectionHeader, { children: t("billing.ui.wizard.review.selected_plan") }),
2603
2604
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between items-center", children: [
2604
2605
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
2605
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-medium", children: _optionalChain([selectedPrice, 'access', _96 => _96.product, 'optionalAccess', _97 => _97.name]) }),
2606
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-medium", children: _optionalChain([selectedPrice, 'access', _97 => _97.product, 'optionalAccess', _98 => _98.name]) }),
2606
2607
  selectedPrice.nickname && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: selectedPrice.nickname })
2607
2608
  ] }),
2608
2609
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-end", children: [
@@ -2622,13 +2623,13 @@ function WizardStepReview({
2622
2623
  className: `${isTrialUpgrade ? "bg-warning/15 border-warning/30" : "bg-primary/10 border-primary/30"} space-y-2 rounded-lg border p-4`,
2623
2624
  children: [
2624
2625
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: `font-medium ${isTrialUpgrade ? "text-warning" : "text-primary"}`, children: isTrialUpgrade ? t("billing.ui.wizard.review.trial_upgrade") : t("billing.ui.wizard.review.proration_summary") }),
2625
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: `text-sm ${isTrialUpgrade ? "text-warning" : "text-foreground"}`, children: isTrialUpgrade ? discountedImmediateCharge !== null ? t("billing.ui.wizard.review.trial_upgrade_description_discounted") : t("billing.ui.wizard.review.trial_upgrade_description") : t("billing.ui.wizard.review.proration_description") }),
2626
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: `text-sm ${isTrialUpgrade ? "text-warning" : "text-foreground"}`, children: isTrialUpgrade ? discountedImmediateCharge !== null ? t("billing.ui.wizard.review.trial_upgrade_description_discounted") : t("billing.ui.wizard.review.trial_upgrade_description") : isProrationCredit ? t("billing.ui.wizard.review.proration_credit_description") : t("billing.ui.wizard.review.proration_description") }),
2626
2627
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between text-sm", children: [
2627
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `${isTrialUpgrade ? "text-warning" : "text-muted-foreground"}`, children: isTrialUpgrade ? t("billing.ui.wizard.review.charge_now") : t("billing.ui.wizard.review.due_now") }),
2628
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `${isTrialUpgrade ? "text-warning" : "text-muted-foreground"}`, children: isTrialUpgrade ? t("billing.ui.wizard.review.charge_now") : isProrationCredit ? t("billing.ui.wizard.review.credit_now") : t("billing.ui.wizard.review.due_now") }),
2628
2629
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `font-medium ${isTrialUpgrade ? "text-warning" : "text-foreground"}`, children: discountedImmediateCharge !== null ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
2629
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "line-through text-muted-foreground me-2", children: _chunkSQTXJPREjs.formatCurrency.call(void 0, prorationPreview.immediateCharge, prorationPreview.currency, fmt) }),
2630
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success", children: _chunkSQTXJPREjs.formatCurrency.call(void 0, discountedImmediateCharge, prorationPreview.currency, fmt) })
2631
- ] }) : _chunkSQTXJPREjs.formatCurrency.call(void 0, prorationPreview.immediateCharge, prorationPreview.currency, fmt) })
2630
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "line-through text-muted-foreground me-2", children: _chunkSQTXJPREjs.formatCurrency.call(void 0, prorationAmount(prorationPreview.immediateCharge), prorationPreview.currency, fmt) }),
2631
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success", children: _chunkSQTXJPREjs.formatCurrency.call(void 0, prorationAmount(discountedImmediateCharge), prorationPreview.currency, fmt) })
2632
+ ] }) : _chunkSQTXJPREjs.formatCurrency.call(void 0, prorationAmount(prorationPreview.immediateCharge), prorationPreview.currency, fmt) })
2632
2633
  ] })
2633
2634
  ]
2634
2635
  }
@@ -2727,7 +2728,7 @@ function SubscriptionWizard({
2727
2728
  {
2728
2729
  selectedPrice: state.selectedPrice,
2729
2730
  selectedInterval: state.selectedInterval,
2730
- currentPriceId: _optionalChain([subscription, 'optionalAccess', _98 => _98.price, 'optionalAccess', _99 => _99.id]),
2731
+ currentPriceId: _optionalChain([subscription, 'optionalAccess', _99 => _99.price, 'optionalAccess', _100 => _100.id]),
2731
2732
  hideRecurringPrices: isPurchasingAddons,
2732
2733
  hideOneTimePrices: isChangePlanMode,
2733
2734
  onSelectPrice: actions.selectPrice,
@@ -2799,7 +2800,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, formatDate2, "formatDate");
2799
2800
  function UsageSummaryCard({ meter, summary }) {
2800
2801
  const t = _nextintl.useTranslations.call(void 0, );
2801
2802
  const fmt = _chunk4UFMLTL2js.useBillingFormatOptions.call(void 0, );
2802
- const currentUsage = _nullishCoalesce(_optionalChain([summary, 'optionalAccess', _100 => _100.aggregatedValue]), () => ( 0));
2803
+ const currentUsage = _nullishCoalesce(_optionalChain([summary, 'optionalAccess', _101 => _101.aggregatedValue]), () => ( 0));
2803
2804
  const limit = meter.limit;
2804
2805
  const percentage = limit && limit > 0 ? currentUsage / limit * 100 : null;
2805
2806
  const progressColor = getProgressColor(percentage);
@@ -2857,7 +2858,7 @@ function UsageContainer() {
2857
2858
  try {
2858
2859
  const fetchedSubscriptions = await _chunkSQTXJPREjs.StripeSubscriptionService.listSubscriptions();
2859
2860
  setSubscriptions(fetchedSubscriptions);
2860
- const hasMeteredSubscriptions2 = fetchedSubscriptions.some((sub) => _optionalChain([sub, 'access', _101 => _101.price, 'optionalAccess', _102 => _102.recurring, 'optionalAccess', _103 => _103.usageType]) === "metered");
2861
+ const hasMeteredSubscriptions2 = fetchedSubscriptions.some((sub) => _optionalChain([sub, 'access', _102 => _102.price, 'optionalAccess', _103 => _103.recurring, 'optionalAccess', _104 => _104.usageType]) === "metered");
2861
2862
  if (!hasMeteredSubscriptions2) {
2862
2863
  setLoading(false);
2863
2864
  return;
@@ -2888,7 +2889,7 @@ function UsageContainer() {
2888
2889
  setLoading(false);
2889
2890
  }
2890
2891
  }, "loadUsageData");
2891
- const hasMeteredSubscriptions = subscriptions.some((sub) => _optionalChain([sub, 'access', _104 => _104.price, 'optionalAccess', _105 => _105.recurring, 'optionalAccess', _106 => _106.usageType]) === "metered");
2892
+ const hasMeteredSubscriptions = subscriptions.some((sub) => _optionalChain([sub, 'access', _105 => _105.price, 'optionalAccess', _106 => _106.recurring, 'optionalAccess', _107 => _107.usageType]) === "metered");
2892
2893
  if (!loading && !hasMeteredSubscriptions) {
2893
2894
  return null;
2894
2895
  }
@@ -3049,11 +3050,11 @@ function BillingDashboardContainer({ renderCancelDialog } = {}) {
3049
3050
  const [editingSubscription, setEditingSubscription] = _react.useState.call(void 0, null);
3050
3051
  const [pendingChangePlan, setPendingChangePlan] = _react.useState.call(void 0, false);
3051
3052
  const hasMeteredSubscriptions = _react.useCallback.call(void 0, () => {
3052
- return data.subscriptions.some((sub) => _optionalChain([sub, 'access', _107 => _107.price, 'optionalAccess', _108 => _108.recurring, 'optionalAccess', _109 => _109.usageType]) === "metered");
3053
+ return data.subscriptions.some((sub) => _optionalChain([sub, 'access', _108 => _108.price, 'optionalAccess', _109 => _109.recurring, 'optionalAccess', _110 => _110.usageType]) === "metered");
3053
3054
  }, [data.subscriptions]);
3054
3055
  const hasActiveRecurringSubscription = _react.useMemo.call(void 0, () => {
3055
3056
  return data.subscriptions.some(
3056
- (sub) => (sub.status === "active" /* ACTIVE */ || sub.status === "trialing" /* TRIALING */) && _optionalChain([sub, 'access', _110 => _110.price, 'optionalAccess', _111 => _111.priceType]) === "recurring"
3057
+ (sub) => (sub.status === "active" /* ACTIVE */ || sub.status === "trialing" /* TRIALING */) && _optionalChain([sub, 'access', _111 => _111.price, 'optionalAccess', _112 => _112.priceType]) === "recurring"
3057
3058
  );
3058
3059
  }, [data.subscriptions]);
3059
3060
  const fetchAllData = _react.useCallback.call(void 0, async () => {
@@ -3066,7 +3067,7 @@ function BillingDashboardContainer({ renderCancelDialog } = {}) {
3066
3067
  setNoCustomerExists(false);
3067
3068
  } catch (error) {
3068
3069
  console.error("[BillingDashboard] Failed to load customer:", error);
3069
- if (_optionalChain([error, 'optionalAccess', _112 => _112.status]) === 404) {
3070
+ if (_optionalChain([error, 'optionalAccess', _113 => _113.status]) === 404) {
3070
3071
  setNoCustomerExists(true);
3071
3072
  } else {
3072
3073
  setErrors((prev) => ({ ...prev, customer: "billing.ui.dashboard.errors.load_customer" }));
@@ -3124,7 +3125,7 @@ function BillingDashboardContainer({ renderCancelDialog } = {}) {
3124
3125
  }, "fetchInvoices");
3125
3126
  const [subscriptions] = await Promise.all([fetchSubscriptions(), fetchPaymentMethods(), fetchInvoices()]);
3126
3127
  const hasMetered = subscriptions.some(
3127
- (sub) => _optionalChain([sub, 'access', _113 => _113.price, 'optionalAccess', _114 => _114.recurring, 'optionalAccess', _115 => _115.usageType]) === "metered"
3128
+ (sub) => _optionalChain([sub, 'access', _114 => _114.price, 'optionalAccess', _115 => _115.recurring, 'optionalAccess', _116 => _116.usageType]) === "metered"
3128
3129
  );
3129
3130
  if (hasMetered) {
3130
3131
  await fetchUsageData();
@@ -3291,7 +3292,7 @@ function BillingDashboardContainer({ renderCancelDialog } = {}) {
3291
3292
  PaymentMethodSummaryCard,
3292
3293
  {
3293
3294
  paymentMethods: data.paymentMethods,
3294
- defaultPaymentMethodId: _optionalChain([data, 'access', _116 => _116.customer, 'optionalAccess', _117 => _117.defaultPaymentMethodId]),
3295
+ defaultPaymentMethodId: _optionalChain([data, 'access', _117 => _117.customer, 'optionalAccess', _118 => _118.defaultPaymentMethodId]),
3295
3296
  loading: loading.paymentMethods,
3296
3297
  error: errors.paymentMethods ? t(errors.paymentMethods) : void 0,
3297
3298
  onManageClick: () => setActiveModal("payment-methods")
@@ -3395,7 +3396,7 @@ function getStripePromise(publishableKey) {
3395
3396
  if (!publishableKey) {
3396
3397
  return Promise.resolve(null);
3397
3398
  }
3398
- if (_optionalChain([stripePromiseCache, 'optionalAccess', _118 => _118.key]) === publishableKey) {
3399
+ if (_optionalChain([stripePromiseCache, 'optionalAccess', _119 => _119.key]) === publishableKey) {
3399
3400
  return stripePromiseCache.promise;
3400
3401
  }
3401
3402
  const promise = _stripejs.loadStripe.call(void 0, publishableKey);
@@ -3491,7 +3492,7 @@ function PriceEditorInternal({
3491
3492
  const { createPrice, updatePrice, productId: contextProductId } = usePriceContext();
3492
3493
  const [allFeatures, setAllFeatures] = _react.useState.call(void 0, []);
3493
3494
  const isEdit = !!price;
3494
- const targetProductId = _nullishCoalesce(_nullishCoalesce(productId, () => ( _optionalChain([price, 'optionalAccess', _119 => _119.product, 'optionalAccess', _120 => _120.id]))), () => ( contextProductId));
3495
+ const targetProductId = _nullishCoalesce(_nullishCoalesce(productId, () => ( _optionalChain([price, 'optionalAccess', _120 => _120.product, 'optionalAccess', _121 => _121.id]))), () => ( contextProductId));
3495
3496
  _react.useEffect.call(void 0, () => {
3496
3497
  const fetchFeatures = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
3497
3498
  setAllFeatures(await _chunkSQTXJPREjs.FeatureService.findMany({}));
@@ -3570,22 +3571,22 @@ function PriceEditorInternal({
3570
3571
  // `.toString()`, for the same reason the schema keeps the token
3571
3572
  // pipeline string-based: a seeded `0` must survive as "0" and not be
3572
3573
  // dropped as falsy.
3573
- token: _nullishCoalesce(_optionalChain([seed, 'access', _121 => _121.token, 'optionalAccess', _122 => _122.toString, 'call', _123 => _123()]), () => ( "")),
3574
+ token: _nullishCoalesce(_optionalChain([seed, 'access', _122 => _122.token, 'optionalAccess', _123 => _123.toString, 'call', _124 => _124()]), () => ( "")),
3574
3575
  featureIds: [.../* @__PURE__ */ new Set([...resolvePlatformFeatures(seed.platformFeatures).ids, ...coreFeatureIds])]
3575
3576
  };
3576
3577
  }
3577
3578
  return {
3578
- unitAmount: _optionalChain([price, 'optionalAccess', _124 => _124.unitAmount]) ? price.unitAmount / 100 : 0,
3579
- currency: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _125 => _125.currency]), () => ( "usd")),
3580
- interval: _optionalChain([price, 'optionalAccess', _126 => _126.priceType]) === "one_time" ? "one_time" : _nullishCoalesce(_optionalChain([price, 'optionalAccess', _127 => _127.recurring, 'optionalAccess', _128 => _128.interval]), () => ( "month")),
3581
- intervalCount: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _129 => _129.recurring, 'optionalAccess', _130 => _130.intervalCount]), () => ( 1)),
3582
- usageType: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _131 => _131.recurring, 'optionalAccess', _132 => _132.usageType]), () => ( "licensed")),
3583
- nickname: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _133 => _133.nickname]), () => ( "")),
3584
- isTrial: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _134 => _134.isTrial]), () => ( false)),
3585
- description: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _135 => _135.description]), () => ( "")),
3586
- features: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _136 => _136.features]), () => ( [])),
3587
- token: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _137 => _137.token, 'optionalAccess', _138 => _138.toString, 'call', _139 => _139()]), () => ( "")),
3588
- featureIds: [.../* @__PURE__ */ new Set([..._nullishCoalesce(_optionalChain([price, 'optionalAccess', _140 => _140.priceFeatures, 'optionalAccess', _141 => _141.map, 'call', _142 => _142((f) => f.id)]), () => ( [])), ...coreFeatureIds])]
3579
+ unitAmount: _optionalChain([price, 'optionalAccess', _125 => _125.unitAmount]) ? price.unitAmount / 100 : 0,
3580
+ currency: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _126 => _126.currency]), () => ( "usd")),
3581
+ interval: _optionalChain([price, 'optionalAccess', _127 => _127.priceType]) === "one_time" ? "one_time" : _nullishCoalesce(_optionalChain([price, 'optionalAccess', _128 => _128.recurring, 'optionalAccess', _129 => _129.interval]), () => ( "month")),
3582
+ intervalCount: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _130 => _130.recurring, 'optionalAccess', _131 => _131.intervalCount]), () => ( 1)),
3583
+ usageType: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _132 => _132.recurring, 'optionalAccess', _133 => _133.usageType]), () => ( "licensed")),
3584
+ nickname: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _134 => _134.nickname]), () => ( "")),
3585
+ isTrial: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _135 => _135.isTrial]), () => ( false)),
3586
+ description: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _136 => _136.description]), () => ( "")),
3587
+ features: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _137 => _137.features]), () => ( [])),
3588
+ token: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _138 => _138.token, 'optionalAccess', _139 => _139.toString, 'call', _140 => _140()]), () => ( "")),
3589
+ featureIds: [.../* @__PURE__ */ new Set([..._nullishCoalesce(_optionalChain([price, 'optionalAccess', _141 => _141.priceFeatures, 'optionalAccess', _142 => _142.map, 'call', _143 => _143((f) => f.id)]), () => ( [])), ...coreFeatureIds])]
3589
3590
  };
3590
3591
  }, [price, seed, allFeatures, resolvePlatformFeatures]);
3591
3592
  const form = _reacthookform.useForm.call(void 0, {
@@ -3903,11 +3904,11 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
3903
3904
  );
3904
3905
  const [priceVersion, setPriceVersion] = _react.useState.call(void 0, 0);
3905
3906
  const refreshPrices = _react.useCallback.call(void 0, () => setPriceVersion((value2) => value2 + 1), []);
3906
- const productId = _nullishCoalesce(productIdProp, () => ( _optionalChain([price, 'optionalAccess', _143 => _143.product, 'optionalAccess', _144 => _144.id])));
3907
+ const productId = _nullishCoalesce(productIdProp, () => ( _optionalChain([price, 'optionalAccess', _144 => _144.product, 'optionalAccess', _145 => _145.id])));
3907
3908
  const reloadPrice = _react.useCallback.call(void 0, async () => {
3908
- if (!_optionalChain([price, 'optionalAccess', _145 => _145.id])) return;
3909
+ if (!_optionalChain([price, 'optionalAccess', _146 => _146.id])) return;
3909
3910
  setPrice(await _chunkSQTXJPREjs.StripePriceService.getPrice({ id: price.id }));
3910
- }, [_optionalChain([price, 'optionalAccess', _146 => _146.id])]);
3911
+ }, [_optionalChain([price, 'optionalAccess', _147 => _147.id])]);
3911
3912
  const createPrice = _react.useCallback.call(void 0,
3912
3913
  async (input) => {
3913
3914
  const saved = await _chunkSQTXJPREjs.StripePriceService.createPrice(input);
@@ -3927,23 +3928,23 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
3927
3928
  );
3928
3929
  const archivePrice = _react.useCallback.call(void 0,
3929
3930
  async (id) => {
3930
- const target = _nullishCoalesce(id, () => ( _optionalChain([price, 'optionalAccess', _147 => _147.id])));
3931
+ const target = _nullishCoalesce(id, () => ( _optionalChain([price, 'optionalAccess', _148 => _148.id])));
3931
3932
  if (!target) return;
3932
3933
  await _chunkSQTXJPREjs.StripePriceService.archivePrice({ id: target });
3933
3934
  await reloadPrice();
3934
3935
  refreshPrices();
3935
3936
  },
3936
- [_optionalChain([price, 'optionalAccess', _148 => _148.id]), reloadPrice, refreshPrices]
3937
+ [_optionalChain([price, 'optionalAccess', _149 => _149.id]), reloadPrice, refreshPrices]
3937
3938
  );
3938
3939
  const restorePrice = _react.useCallback.call(void 0,
3939
3940
  async (id) => {
3940
- const target = _nullishCoalesce(id, () => ( _optionalChain([price, 'optionalAccess', _149 => _149.id])));
3941
+ const target = _nullishCoalesce(id, () => ( _optionalChain([price, 'optionalAccess', _150 => _150.id])));
3941
3942
  if (!target) return;
3942
3943
  await _chunkSQTXJPREjs.StripePriceService.reactivatePrice({ id: target });
3943
3944
  await reloadPrice();
3944
3945
  refreshPrices();
3945
3946
  },
3946
- [_optionalChain([price, 'optionalAccess', _150 => _150.id]), reloadPrice, refreshPrices]
3947
+ [_optionalChain([price, 'optionalAccess', _151 => _151.id]), reloadPrice, refreshPrices]
3947
3948
  );
3948
3949
  const value = _react.useMemo.call(void 0,
3949
3950
  () => ({
@@ -3965,7 +3966,7 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
3965
3966
  const items = [
3966
3967
  { name: t("billing.admin.products.title"), href: generateUrl({ page: _chunkSQTXJPREjs.Modules.StripeProduct }) }
3967
3968
  ];
3968
- if (_optionalChain([price, 'optionalAccess', _151 => _151.product]))
3969
+ if (_optionalChain([price, 'optionalAccess', _152 => _152.product]))
3969
3970
  items.push({
3970
3971
  name: price.product.name,
3971
3972
  href: generateUrl({ page: _chunkSQTXJPREjs.Modules.StripeProduct, id: price.product.id })
@@ -4066,9 +4067,9 @@ function ProductEditorInternal({
4066
4067
  );
4067
4068
  const getDefaultValues = _react.useCallback.call(void 0,
4068
4069
  () => ({
4069
- id: _nullishCoalesce(_optionalChain([product, 'optionalAccess', _152 => _152.id]), () => ( _uuid.v4.call(void 0, ))),
4070
- name: _nullishCoalesce(_optionalChain([product, 'optionalAccess', _153 => _153.name]), () => ( "")),
4071
- description: _nullishCoalesce(_optionalChain([product, 'optionalAccess', _154 => _154.description]), () => ( ""))
4070
+ id: _nullishCoalesce(_optionalChain([product, 'optionalAccess', _153 => _153.id]), () => ( _uuid.v4.call(void 0, ))),
4071
+ name: _nullishCoalesce(_optionalChain([product, 'optionalAccess', _154 => _154.name]), () => ( "")),
4072
+ description: _nullishCoalesce(_optionalChain([product, 'optionalAccess', _155 => _155.description]), () => ( ""))
4072
4073
  }),
4073
4074
  [product]
4074
4075
  );
@@ -4081,7 +4082,7 @@ function ProductEditorInternal({
4081
4082
  {
4082
4083
  form,
4083
4084
  entityType: t("billing.admin.products.entity"),
4084
- entityName: _optionalChain([product, 'optionalAccess', _155 => _155.name]),
4085
+ entityName: _optionalChain([product, 'optionalAccess', _156 => _156.name]),
4085
4086
  isEdit,
4086
4087
  module: _chunkSQTXJPREjs.Modules.StripeProduct,
4087
4088
  size: "md",
@@ -4162,9 +4163,9 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
4162
4163
  const [catalogueVersion, setCatalogueVersion] = _react.useState.call(void 0, 0);
4163
4164
  const refreshCatalogue = _react.useCallback.call(void 0, () => setCatalogueVersion((value2) => value2 + 1), []);
4164
4165
  const reloadProduct = _react.useCallback.call(void 0, async () => {
4165
- if (!_optionalChain([product, 'optionalAccess', _156 => _156.id])) return;
4166
+ if (!_optionalChain([product, 'optionalAccess', _157 => _157.id])) return;
4166
4167
  setProduct(await _chunkSQTXJPREjs.StripeProductService.getProduct({ id: product.id }));
4167
- }, [_optionalChain([product, 'optionalAccess', _157 => _157.id])]);
4168
+ }, [_optionalChain([product, 'optionalAccess', _158 => _158.id])]);
4168
4169
  const createProduct = _react.useCallback.call(void 0,
4169
4170
  async (input) => {
4170
4171
  const saved = await _chunkSQTXJPREjs.StripeProductService.createProduct(input);
@@ -4184,23 +4185,23 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
4184
4185
  );
4185
4186
  const archiveProduct = _react.useCallback.call(void 0,
4186
4187
  async (id) => {
4187
- const target = _nullishCoalesce(id, () => ( _optionalChain([product, 'optionalAccess', _158 => _158.id])));
4188
+ const target = _nullishCoalesce(id, () => ( _optionalChain([product, 'optionalAccess', _159 => _159.id])));
4188
4189
  if (!target) return;
4189
4190
  await _chunkSQTXJPREjs.StripeProductService.archiveProduct({ id: target });
4190
4191
  await reloadProduct();
4191
4192
  refreshCatalogue();
4192
4193
  },
4193
- [_optionalChain([product, 'optionalAccess', _159 => _159.id]), reloadProduct, refreshCatalogue]
4194
+ [_optionalChain([product, 'optionalAccess', _160 => _160.id]), reloadProduct, refreshCatalogue]
4194
4195
  );
4195
4196
  const restoreProduct = _react.useCallback.call(void 0,
4196
4197
  async (id) => {
4197
- const target = _nullishCoalesce(id, () => ( _optionalChain([product, 'optionalAccess', _160 => _160.id])));
4198
+ const target = _nullishCoalesce(id, () => ( _optionalChain([product, 'optionalAccess', _161 => _161.id])));
4198
4199
  if (!target) return;
4199
4200
  await _chunkSQTXJPREjs.StripeProductService.reactivateProduct({ id: target });
4200
4201
  await reloadProduct();
4201
4202
  refreshCatalogue();
4202
4203
  },
4203
- [_optionalChain([product, 'optionalAccess', _161 => _161.id]), reloadProduct, refreshCatalogue]
4204
+ [_optionalChain([product, 'optionalAccess', _162 => _162.id]), reloadProduct, refreshCatalogue]
4204
4205
  );
4205
4206
  const value = _react.useMemo.call(void 0,
4206
4207
  () => ({
@@ -4304,14 +4305,14 @@ function PriceDetails() {
4304
4305
  _chunk4UFMLTL2js.DetailField,
4305
4306
  {
4306
4307
  label: t("billing.admin.prices.fields.intervalCount"),
4307
- value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _nullishCoalesce(_optionalChain([price, 'access', _162 => _162.recurring, 'optionalAccess', _163 => _163.intervalCount]), () => ( 1)) })
4308
+ value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _nullishCoalesce(_optionalChain([price, 'access', _163 => _163.recurring, 'optionalAccess', _164 => _164.intervalCount]), () => ( 1)) })
4308
4309
  }
4309
4310
  ),
4310
4311
  isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4311
4312
  _chunk4UFMLTL2js.DetailField,
4312
4313
  {
4313
4314
  label: t("billing.admin.prices.fields.usageType"),
4314
- value: _optionalChain([price, 'access', _164 => _164.recurring, 'optionalAccess', _165 => _165.usageType]) === "metered" ? t("billing.admin.prices.usage.metered") : t("billing.admin.prices.usage.licensed")
4315
+ value: _optionalChain([price, 'access', _165 => _165.recurring, 'optionalAccess', _166 => _166.usageType]) === "metered" ? t("billing.admin.prices.usage.metered") : t("billing.admin.prices.usage.licensed")
4315
4316
  }
4316
4317
  )
4317
4318
  ] })
@@ -4412,25 +4413,25 @@ function priceToSeed(price) {
4412
4413
  const priceType = readOptional(() => price.priceType);
4413
4414
  const currency = readOptional(() => price.currency);
4414
4415
  const recurring = price.recurring;
4415
- const interval = priceType === "one_time" ? "one_time" : _nullishCoalesce(_optionalChain([recurring, 'optionalAccess', _166 => _166.interval]), () => ( "month"));
4416
+ const interval = priceType === "one_time" ? "one_time" : _nullishCoalesce(_optionalChain([recurring, 'optionalAccess', _167 => _167.interval]), () => ( "month"));
4416
4417
  const seed = {
4417
4418
  unitAmount: _nullishCoalesce(price.unitAmount, () => ( 0)),
4418
4419
  currency: _nullishCoalesce(currency, () => ( "usd")),
4419
4420
  interval
4420
4421
  };
4421
4422
  if (interval !== "one_time") {
4422
- if (typeof _optionalChain([recurring, 'optionalAccess', _167 => _167.intervalCount]) === "number") seed.intervalCount = recurring.intervalCount;
4423
- if (_optionalChain([recurring, 'optionalAccess', _168 => _168.usageType])) seed.usageType = recurring.usageType;
4423
+ if (typeof _optionalChain([recurring, 'optionalAccess', _168 => _168.intervalCount]) === "number") seed.intervalCount = recurring.intervalCount;
4424
+ if (_optionalChain([recurring, 'optionalAccess', _169 => _169.usageType])) seed.usageType = recurring.usageType;
4424
4425
  }
4425
- const nickname = _optionalChain([price, 'access', _169 => _169.nickname, 'optionalAccess', _170 => _170.trim, 'call', _171 => _171()]);
4426
+ const nickname = _optionalChain([price, 'access', _170 => _170.nickname, 'optionalAccess', _171 => _171.trim, 'call', _172 => _172()]);
4426
4427
  if (nickname) seed.nickname = nickname;
4427
- const description = _optionalChain([price, 'access', _172 => _172.description, 'optionalAccess', _173 => _173.trim, 'call', _174 => _174()]);
4428
+ const description = _optionalChain([price, 'access', _173 => _173.description, 'optionalAccess', _174 => _174.trim, 'call', _175 => _175()]);
4428
4429
  if (description) seed.description = description;
4429
4430
  const features = nonEmptyStrings(price.features);
4430
4431
  if (features.length > 0) seed.features = features;
4431
4432
  if (typeof price.token === "number" && !Number.isNaN(price.token)) seed.token = price.token;
4432
4433
  if (typeof price.isTrial === "boolean") seed.isTrial = price.isTrial;
4433
- const platformFeatures = nonEmptyStrings(_optionalChain([price, 'access', _175 => _175.priceFeatures, 'optionalAccess', _176 => _176.map, 'call', _177 => _177((feature) => feature.name)]));
4434
+ const platformFeatures = nonEmptyStrings(_optionalChain([price, 'access', _176 => _176.priceFeatures, 'optionalAccess', _177 => _177.map, 'call', _178 => _178((feature) => feature.name)]));
4434
4435
  if (platformFeatures.length > 0) seed.platformFeatures = platformFeatures;
4435
4436
  return seed;
4436
4437
  }
@@ -4523,7 +4524,7 @@ function PricesList({ productId, fullWidth }) {
4523
4524
  const onImportFileChange = _react.useCallback.call(void 0,
4524
4525
  async (event) => {
4525
4526
  const input = event.target;
4526
- const file = _optionalChain([input, 'access', _178 => _178.files, 'optionalAccess', _179 => _179[0]]);
4527
+ const file = _optionalChain([input, 'access', _179 => _179.files, 'optionalAccess', _180 => _180[0]]);
4527
4528
  input.value = "";
4528
4529
  if (!file) return;
4529
4530
  try {
@@ -4550,7 +4551,7 @@ function PricesList({ productId, fullWidth }) {
4550
4551
  "create-price"
4551
4552
  ),
4552
4553
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _react.Fragment, { children: [
4553
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk4UFMLTL2js.Button, { variant: "outline", size: "sm", type: "button", onClick: () => _optionalChain([importInputRef, 'access', _180 => _180.current, 'optionalAccess', _181 => _181.click, 'call', _182 => _182()]), children: [
4554
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk4UFMLTL2js.Button, { variant: "outline", size: "sm", type: "button", onClick: () => _optionalChain([importInputRef, 'access', _181 => _181.current, 'optionalAccess', _182 => _182.click, 'call', _183 => _183()]), children: [
4554
4555
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.UploadIcon, {}),
4555
4556
  t("billing.admin.prices.actions.import")
4556
4557
  ] }),