@carlonicora/nextjs-jsonapi 5.5.0 → 5.6.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 (152) hide show
  1. package/dist/{BlockNoteEditor-THBJH2UR.js → BlockNoteEditor-AE3ZTEEH.js} +19 -19
  2. package/dist/{BlockNoteEditor-THBJH2UR.js.map → BlockNoteEditor-AE3ZTEEH.js.map} +1 -1
  3. package/dist/{BlockNoteEditor-GVQCKRMU.mjs → BlockNoteEditor-NEYG5L6W.mjs} +4 -4
  4. package/dist/{BlockNoteViewer-U6E3DS4F.mjs → BlockNoteViewer-3OUT5UFY.mjs} +2 -2
  5. package/dist/{BlockNoteViewer-VZOVKTFO.js → BlockNoteViewer-4CFKQM7U.js} +3 -3
  6. package/dist/{BlockNoteViewer-VZOVKTFO.js.map → BlockNoteViewer-4CFKQM7U.js.map} +1 -1
  7. package/dist/billing/index.d.mts +186 -25
  8. package/dist/billing/index.d.ts +186 -25
  9. package/dist/billing/index.js +1148 -587
  10. package/dist/billing/index.js.map +1 -1
  11. package/dist/billing/index.mjs +785 -224
  12. package/dist/billing/index.mjs.map +1 -1
  13. package/dist/{chunk-WPYT4UKJ.js → chunk-3I5AAJXV.js} +3 -3
  14. package/dist/{chunk-WPYT4UKJ.js.map → chunk-3I5AAJXV.js.map} +1 -1
  15. package/dist/{chunk-YDYVJM4I.js → chunk-53BAULDP.js} +4 -4
  16. package/dist/{chunk-YDYVJM4I.js.map → chunk-53BAULDP.js.map} +1 -1
  17. package/dist/{chunk-3CGROPF3.mjs → chunk-BTPUYUQ3.mjs} +2 -2
  18. package/dist/{chunk-VC5A3AUZ.mjs → chunk-EYA2F6AN.mjs} +696 -4
  19. package/dist/chunk-EYA2F6AN.mjs.map +1 -0
  20. package/dist/{chunk-G6UE6MEP.js → chunk-HKZAESS6.js} +896 -204
  21. package/dist/chunk-HKZAESS6.js.map +1 -0
  22. package/dist/{chunk-W7F5BDSV.mjs → chunk-KQHBONL4.mjs} +2 -2
  23. package/dist/{chunk-TY5FYP3G.js → chunk-LQ4DK4JF.js} +1919 -1056
  24. package/dist/chunk-LQ4DK4JF.js.map +1 -0
  25. package/dist/{chunk-S4YJ5WCW.js → chunk-RL3PL3KV.js} +8 -8
  26. package/dist/{chunk-S4YJ5WCW.js.map → chunk-RL3PL3KV.js.map} +1 -1
  27. package/dist/{chunk-X5WIUUNG.mjs → chunk-SFYPXCK4.mjs} +3237 -2374
  28. package/dist/chunk-SFYPXCK4.mjs.map +1 -0
  29. package/dist/{chunk-6SQYXUVP.mjs → chunk-Y7RR57EW.mjs} +2 -2
  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 +242 -3
  37. package/dist/core/index.d.ts +242 -3
  38. package/dist/core/index.js +34 -2
  39. package/dist/core/index.js.map +1 -1
  40. package/dist/core/index.mjs +33 -1
  41. package/dist/email-automations/index.js +92 -92
  42. package/dist/email-automations/index.mjs +3 -3
  43. package/dist/features/analytics/index.js +121 -121
  44. package/dist/features/analytics/index.mjs +4 -4
  45. package/dist/features/analytics/server.js +4 -4
  46. package/dist/features/analytics/server.mjs +2 -2
  47. package/dist/features/blog/index.js +150 -150
  48. package/dist/features/blog/index.mjs +3 -3
  49. package/dist/features/blog/server.js +16 -16
  50. package/dist/features/blog/server.mjs +1 -1
  51. package/dist/features/help/index.js +37 -37
  52. package/dist/features/help/index.mjs +3 -3
  53. package/dist/features/tokenusage/index.js +124 -124
  54. package/dist/features/tokenusage/index.mjs +4 -4
  55. package/dist/{stripe-promotion-code.interface-C3qqh3mi.d.ts → format-options-BtX3o0Yu.d.ts} +104 -1
  56. package/dist/{stripe-promotion-code.interface-ClZ7DxS9.d.mts → format-options-D6c7FNDi.d.mts} +104 -1
  57. package/dist/index.d.mts +2 -2
  58. package/dist/index.d.ts +2 -2
  59. package/dist/index.js +35 -3
  60. package/dist/index.js.map +1 -1
  61. package/dist/index.mjs +34 -2
  62. package/dist/server/index.js +3 -3
  63. package/dist/server/index.mjs +2 -2
  64. package/messages/en.json +125 -3
  65. package/messages/it.json +125 -3
  66. package/package.json +1 -1
  67. package/scripts/validate-messages.mjs +1 -0
  68. package/src/billing/index.ts +1 -0
  69. package/src/client/index.ts +4 -0
  70. package/src/core/index.ts +1 -0
  71. package/src/core/registry/ModuleRegistry.ts +3 -0
  72. package/src/features/billing/components/cards/InvoicesSummaryCard.tsx +3 -2
  73. package/src/features/billing/components/cards/SubscriptionSummaryCard.tsx +4 -3
  74. package/src/features/billing/components/containers/BillingDashboardContainer.tsx +22 -5
  75. package/src/features/billing/components/utils/__tests__/discount.spec.ts +59 -0
  76. package/src/features/billing/components/utils/__tests__/url.spec.ts +32 -0
  77. package/src/features/billing/components/utils/discount.ts +38 -0
  78. package/src/features/billing/components/utils/index.ts +2 -0
  79. package/src/features/billing/components/utils/url.ts +12 -0
  80. package/src/features/billing/contexts/CouponContext.tsx +211 -0
  81. package/src/features/billing/contexts/index.ts +1 -0
  82. package/src/features/billing/i18n-keys.ts +79 -0
  83. package/src/features/billing/stripe-coupon/components/containers/CouponContainer.tsx +38 -0
  84. package/src/features/billing/stripe-coupon/components/containers/index.ts +1 -0
  85. package/src/features/billing/stripe-coupon/components/details/CouponDetails.tsx +69 -0
  86. package/src/features/billing/stripe-coupon/components/details/index.ts +1 -0
  87. package/src/features/billing/stripe-coupon/components/forms/CouponCodeEditor.tsx +79 -0
  88. package/src/features/billing/stripe-coupon/components/forms/CouponCodeFields.tsx +192 -0
  89. package/src/features/billing/stripe-coupon/components/forms/CouponEditor.tsx +333 -0
  90. package/src/features/billing/stripe-coupon/components/forms/CouponRefresher.tsx +45 -0
  91. package/src/features/billing/stripe-coupon/components/forms/index.ts +6 -0
  92. package/src/features/billing/stripe-coupon/components/index.ts +5 -0
  93. package/src/features/billing/stripe-coupon/components/lists/CouponCodesList.tsx +61 -0
  94. package/src/features/billing/stripe-coupon/components/lists/CouponsList.tsx +67 -0
  95. package/src/features/billing/stripe-coupon/components/lists/index.ts +2 -0
  96. package/src/features/billing/stripe-coupon/components/widgets/CouponCodeActions.tsx +80 -0
  97. package/src/features/billing/stripe-coupon/components/widgets/index.ts +1 -0
  98. package/src/features/billing/stripe-coupon/data/__tests__/stripe-coupon-models.spec.ts +114 -0
  99. package/src/features/billing/stripe-coupon/data/index.ts +10 -0
  100. package/src/features/billing/stripe-coupon/data/stripe-coupon-code.fields.ts +8 -0
  101. package/src/features/billing/stripe-coupon/data/stripe-coupon-code.interface.ts +44 -0
  102. package/src/features/billing/stripe-coupon/data/stripe-coupon-code.service.ts +92 -0
  103. package/src/features/billing/stripe-coupon/data/stripe-coupon-code.ts +132 -0
  104. package/src/features/billing/stripe-coupon/data/stripe-coupon-offer.interface.ts +17 -0
  105. package/src/features/billing/stripe-coupon/data/stripe-coupon-offer.ts +70 -0
  106. package/src/features/billing/stripe-coupon/data/stripe-coupon.fields.ts +7 -0
  107. package/src/features/billing/stripe-coupon/data/stripe-coupon.interface.ts +51 -0
  108. package/src/features/billing/stripe-coupon/data/stripe-coupon.service.ts +93 -0
  109. package/src/features/billing/stripe-coupon/data/stripe-coupon.ts +165 -0
  110. package/src/features/billing/stripe-coupon/hooks/useStripeCouponCodeTableStructure.tsx +154 -0
  111. package/src/features/billing/stripe-coupon/hooks/useStripeCouponTableStructure.tsx +113 -0
  112. package/src/features/billing/stripe-coupon/index.ts +5 -0
  113. package/src/features/billing/stripe-coupon/stripe-coupon-code.module.ts +14 -0
  114. package/src/features/billing/stripe-coupon/stripe-coupon-offer.module.ts +10 -0
  115. package/src/features/billing/stripe-coupon/stripe-coupon.module.ts +18 -0
  116. package/src/features/billing/stripe-coupon/utils/__tests__/coupon-places.spec.ts +19 -0
  117. package/src/features/billing/stripe-coupon/utils/__tests__/to-promotion-code-result.spec.ts +41 -0
  118. package/src/features/billing/stripe-coupon/utils/coupon-places.ts +23 -0
  119. package/src/features/billing/stripe-coupon/utils/format-coupon-discount.ts +36 -0
  120. package/src/features/billing/stripe-coupon/utils/index.ts +3 -0
  121. package/src/features/billing/stripe-coupon/utils/to-promotion-code-result.ts +23 -0
  122. package/src/features/billing/stripe-customer/components/forms/PaymentMethodForm.tsx +24 -8
  123. package/src/features/billing/stripe-product/components/containers/ProductsListContainer.tsx +21 -6
  124. package/src/features/billing/stripe-promotion-code/components/PromoCodeInput.tsx +60 -19
  125. package/src/features/billing/stripe-promotion-code/data/stripe-promotion-code.interface.ts +2 -0
  126. package/src/features/billing/stripe-subscription/components/containers/SubscriptionsContainer.tsx +24 -5
  127. package/src/features/billing/stripe-subscription/components/lists/SubscriptionsList.tsx +21 -2
  128. package/src/features/billing/stripe-subscription/components/wizards/SubscriptionWizard.tsx +1 -1
  129. package/src/features/billing/stripe-subscription/components/wizards/WizardStepPaymentMethod.tsx +1 -1
  130. package/src/features/billing/stripe-subscription/components/wizards/WizardStepReview.tsx +60 -49
  131. package/src/features/billing/stripe-subscription/components/wizards/__tests__/review-card.spec.ts +34 -0
  132. package/src/features/billing/stripe-subscription/components/wizards/review-card.ts +24 -0
  133. package/src/features/billing/stripe-subscription/data/__tests__/stripe-subscription.discount.spec.ts +67 -0
  134. package/src/features/billing/stripe-subscription/data/stripe-subscription.interface.ts +14 -0
  135. package/src/features/billing/stripe-subscription/data/stripe-subscription.service.ts +39 -0
  136. package/src/features/billing/stripe-subscription/data/stripe-subscription.ts +21 -0
  137. package/src/features/billing/stripe-subscription/hooks/__tests__/wizard-payment.spec.ts +48 -0
  138. package/src/features/billing/stripe-subscription/hooks/__tests__/wizard-promotion.spec.ts +132 -0
  139. package/src/features/billing/stripe-subscription/hooks/useSubscriptionWizard.ts +138 -12
  140. package/src/features/billing/stripe-subscription/hooks/wizard-payment.ts +30 -0
  141. package/src/features/billing/stripe-subscription/hooks/wizard-promotion.ts +54 -0
  142. package/src/features/user/contexts/CurrentUserContext.tsx +25 -0
  143. package/src/features/user/contexts/__tests__/CurrentUserContext.spec.tsx +121 -2
  144. package/dist/chunk-G6UE6MEP.js.map +0 -1
  145. package/dist/chunk-TY5FYP3G.js.map +0 -1
  146. package/dist/chunk-VC5A3AUZ.mjs.map +0 -1
  147. package/dist/chunk-X5WIUUNG.mjs.map +0 -1
  148. /package/dist/{BlockNoteEditor-GVQCKRMU.mjs.map → BlockNoteEditor-NEYG5L6W.mjs.map} +0 -0
  149. /package/dist/{BlockNoteViewer-U6E3DS4F.mjs.map → BlockNoteViewer-3OUT5UFY.mjs.map} +0 -0
  150. /package/dist/{chunk-3CGROPF3.mjs.map → chunk-BTPUYUQ3.mjs.map} +0 -0
  151. /package/dist/{chunk-W7F5BDSV.mjs.map → chunk-KQHBONL4.mjs.map} +0 -0
  152. /package/dist/{chunk-6SQYXUVP.mjs.map → chunk-Y7RR57EW.mjs.map} +0 -0
@@ -65,10 +65,23 @@
65
65
 
66
66
 
67
67
 
68
- var _chunkTY5FYP3Gjs = require('../chunk-TY5FYP3G.js');
69
68
 
70
69
 
71
- var _chunkS4YJ5WCWjs = require('../chunk-S4YJ5WCW.js');
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+
80
+
81
+ var _chunkLQ4DK4JFjs = require('../chunk-LQ4DK4JF.js');
82
+
83
+
84
+ var _chunkRL3PL3KVjs = require('../chunk-RL3PL3KV.js');
72
85
 
73
86
 
74
87
  var _chunkG4JR3SFVjs = require('../chunk-G4JR3SFV.js');
@@ -89,7 +102,14 @@ var _chunkG4JR3SFVjs = require('../chunk-G4JR3SFV.js');
89
102
 
90
103
 
91
104
 
92
- var _chunkG6UE6MEPjs = require('../chunk-G6UE6MEP.js');
105
+
106
+
107
+
108
+
109
+
110
+
111
+
112
+ var _chunkHKZAESS6js = require('../chunk-HKZAESS6.js');
93
113
  require('../chunk-GHE4VT2R.js');
94
114
  require('../chunk-LXKSUWAV.js');
95
115
  require('../chunk-JTPRJNT2.js');
@@ -102,7 +122,7 @@ var _chunk7QVYU63Ejs = require('../chunk-7QVYU63E.js');
102
122
  var _nextintl = require('next-intl');
103
123
  var _lucidereact = require('lucide-react');
104
124
  var _jsxruntime = require('react/jsx-runtime');
105
- var SUBSCRIPTION_STATUSES = Object.values(_chunkG6UE6MEPjs.SubscriptionStatus);
125
+ var SUBSCRIPTION_STATUSES = Object.values(_chunkHKZAESS6js.SubscriptionStatus);
106
126
  function getStatusBadgeVariant(status) {
107
127
  switch (status) {
108
128
  case "active" /* ACTIVE */:
@@ -134,43 +154,43 @@ function SubscriptionSummaryCard({
134
154
  onManageClick
135
155
  }) {
136
156
  const t = _nextintl.useTranslations.call(void 0, );
137
- const fmt = _chunkTY5FYP3Gjs.useBillingFormatOptions.call(void 0, );
157
+ const fmt = _chunkLQ4DK4JFjs.useBillingFormatOptions.call(void 0, );
138
158
  if (loading) {
139
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.Card, { children: [
140
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
141
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardTitle, { children: t("billing.ui.subscriptions.title") }),
159
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.Card, { children: [
160
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
161
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.CardTitle, { children: t("billing.ui.subscriptions.title") }),
142
162
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
143
163
  ] }),
144
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.CardContent, { children: [
145
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Skeleton, { className: "h-6 w-32 mb-2" }),
146
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Skeleton, { className: "h-4 w-24 mb-1" }),
147
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Skeleton, { className: "h-4 w-40" })
164
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.CardContent, { children: [
165
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Skeleton, { className: "h-6 w-32 mb-2" }),
166
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Skeleton, { className: "h-4 w-24 mb-1" }),
167
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Skeleton, { className: "h-4 w-40" })
148
168
  ] })
149
169
  ] });
150
170
  }
151
171
  if (error) {
152
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.Card, { children: [
153
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
154
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardTitle, { children: t("billing.ui.subscriptions.title") }),
172
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.Card, { children: [
173
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
174
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.CardTitle, { children: t("billing.ui.subscriptions.title") }),
155
175
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
156
176
  ] }),
157
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
177
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
158
178
  ] });
159
179
  }
160
180
  const activeSubscriptions = subscriptions.filter(
161
181
  (sub) => sub.status === "active" /* ACTIVE */ || sub.status === "trialing" /* TRIALING */
162
182
  );
163
183
  const primarySubscription = activeSubscriptions[0];
164
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
165
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
166
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardTitle, { children: t("billing.ui.subscriptions.title") }),
184
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
185
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
186
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.CardTitle, { children: t("billing.ui.subscriptions.title") }),
167
187
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
168
188
  ] }),
169
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardContent, { children: subscriptions.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
189
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.CardContent, { children: !primarySubscription ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
170
190
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: t("billing.ui.cards.subscriptions.empty_title") }),
171
191
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.subscriptions.empty_description") }),
172
192
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
173
- _chunkTY5FYP3Gjs.Button,
193
+ _chunkLQ4DK4JFjs.Button,
174
194
  {
175
195
  variant: "outline",
176
196
  size: "sm",
@@ -185,11 +205,11 @@ function SubscriptionSummaryCard({
185
205
  ]
186
206
  }
187
207
  )
188
- ] }) : primarySubscription ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
208
+ ] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
189
209
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
190
210
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: formatPlanName(primarySubscription, t("billing.ui.cards.subscriptions.fallback_name")) }),
191
211
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
192
- _chunkTY5FYP3Gjs.Badge,
212
+ _chunkLQ4DK4JFjs.Badge,
193
213
  {
194
214
  variant: primarySubscription.cancelAtPeriodEnd ? "secondary" : getStatusBadgeVariant(primarySubscription.status),
195
215
  children: primarySubscription.cancelAtPeriodEnd ? t("billing.ui.cards.subscriptions.canceling") : SUBSCRIPTION_STATUSES.includes(primarySubscription.status) ? t(`billing.ui.subscription_status.${primarySubscription.status}`) : primarySubscription.status
@@ -197,14 +217,14 @@ function SubscriptionSummaryCard({
197
217
  )
198
218
  ] }),
199
219
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: !_optionalChain([primarySubscription, 'access', _8 => _8.price, 'optionalAccess', _9 => _9.isTrial]) ? t("billing.ui.cards.subscriptions.ends_on", {
200
- date: _chunkTY5FYP3Gjs.formatDate.call(void 0, primarySubscription.currentPeriodEnd, fmt)
220
+ date: _chunkLQ4DK4JFjs.formatDate.call(void 0, primarySubscription.currentPeriodEnd, fmt)
201
221
  }) : primarySubscription.cancelAtPeriodEnd ? t("billing.ui.cards.subscriptions.cancels_on", {
202
- date: _chunkTY5FYP3Gjs.formatDate.call(void 0, primarySubscription.currentPeriodEnd, fmt)
222
+ date: _chunkLQ4DK4JFjs.formatDate.call(void 0, primarySubscription.currentPeriodEnd, fmt)
203
223
  }) : t("billing.ui.cards.subscriptions.renews_on", {
204
- date: _chunkTY5FYP3Gjs.formatDate.call(void 0, primarySubscription.currentPeriodEnd, fmt)
224
+ date: _chunkLQ4DK4JFjs.formatDate.call(void 0, primarySubscription.currentPeriodEnd, fmt)
205
225
  }) }),
206
226
  activeSubscriptions.length > 1 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.subscriptions.more", { count: activeSubscriptions.length - 1 }) })
207
- ] }) : null })
227
+ ] }) })
208
228
  ] });
209
229
  }
210
230
  _chunk7QVYU63Ejs.__name.call(void 0, SubscriptionSummaryCard, "SubscriptionSummaryCard");
@@ -235,37 +255,37 @@ function PaymentMethodSummaryCard({
235
255
  }) {
236
256
  const t = _nextintl.useTranslations.call(void 0, );
237
257
  if (loading) {
238
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.Card, { children: [
239
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
240
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardTitle, { children: t("billing.ui.payment_method.title") }),
258
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.Card, { children: [
259
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
260
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.CardTitle, { children: t("billing.ui.payment_method.title") }),
241
261
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
242
262
  ] }),
243
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.CardContent, { children: [
244
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Skeleton, { className: "h-6 w-32 mb-2" }),
245
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Skeleton, { className: "h-4 w-24" })
263
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.CardContent, { children: [
264
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Skeleton, { className: "h-6 w-32 mb-2" }),
265
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Skeleton, { className: "h-4 w-24" })
246
266
  ] })
247
267
  ] });
248
268
  }
249
269
  if (error) {
250
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.Card, { children: [
251
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
252
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardTitle, { children: t("billing.ui.payment_method.title") }),
270
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.Card, { children: [
271
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
272
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.CardTitle, { children: t("billing.ui.payment_method.title") }),
253
273
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
254
274
  ] }),
255
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
275
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
256
276
  ] });
257
277
  }
258
278
  const defaultMethod = paymentMethods.find((pm) => pm.id === defaultPaymentMethodId) || paymentMethods[0];
259
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
260
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
261
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardTitle, { children: t("billing.ui.payment_method.title") }),
279
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
280
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
281
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.CardTitle, { children: t("billing.ui.payment_method.title") }),
262
282
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
263
283
  ] }),
264
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardContent, { children: paymentMethods.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
284
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.CardContent, { children: paymentMethods.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
265
285
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: t("billing.ui.cards.payment_method.empty_title") }),
266
286
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.payment_method.empty_description") }),
267
287
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
268
- _chunkTY5FYP3Gjs.Button,
288
+ _chunkLQ4DK4JFjs.Button,
269
289
  {
270
290
  variant: "outline",
271
291
  size: "sm",
@@ -314,13 +334,13 @@ function formatBalance(balance, currency, locale) {
314
334
  _chunk7QVYU63Ejs.__name.call(void 0, formatBalance, "formatBalance");
315
335
  function CustomerInfoCard({ customer, loading, error }) {
316
336
  const t = _nextintl.useTranslations.call(void 0, );
317
- const locale = _chunkG6UE6MEPjs.useI18nLocale.call(void 0, );
337
+ const locale = _chunkHKZAESS6js.useI18nLocale.call(void 0, );
318
338
  const [portalLoading, setPortalLoading] = _react.useState.call(void 0, false);
319
339
  const handlePortalClick = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async (e) => {
320
340
  e.stopPropagation();
321
341
  setPortalLoading(true);
322
342
  try {
323
- const { url } = await _chunkG6UE6MEPjs.StripeCustomerService.createPortalSession();
343
+ const { url } = await _chunkHKZAESS6js.StripeCustomerService.createPortalSession();
324
344
  window.open(url, "_blank");
325
345
  } catch (err) {
326
346
  console.error("[CustomerInfoCard] Failed to create portal session:", err);
@@ -329,45 +349,45 @@ function CustomerInfoCard({ customer, loading, error }) {
329
349
  }
330
350
  }, "handlePortalClick");
331
351
  if (loading) {
332
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.Card, { children: [
333
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
334
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardTitle, { children: t("billing.ui.cards.customer.title") }),
352
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.Card, { children: [
353
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
354
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.CardTitle, { children: t("billing.ui.cards.customer.title") }),
335
355
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
336
356
  ] }),
337
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.CardContent, { children: [
338
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Skeleton, { className: "h-6 w-32 mb-2" }),
339
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Skeleton, { className: "h-4 w-48 mb-1" }),
340
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Skeleton, { className: "h-4 w-24" })
357
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.CardContent, { children: [
358
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Skeleton, { className: "h-6 w-32 mb-2" }),
359
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Skeleton, { className: "h-4 w-48 mb-1" }),
360
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Skeleton, { className: "h-4 w-24" })
341
361
  ] })
342
362
  ] });
343
363
  }
344
364
  if (error) {
345
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.Card, { children: [
346
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
347
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardTitle, { children: t("billing.ui.cards.customer.title") }),
365
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.Card, { children: [
366
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
367
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.CardTitle, { children: t("billing.ui.cards.customer.title") }),
348
368
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
349
369
  ] }),
350
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
370
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
351
371
  ] });
352
372
  }
353
373
  if (!customer) {
354
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.Card, { children: [
355
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
356
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardTitle, { children: t("billing.ui.cards.customer.title") }),
374
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.Card, { children: [
375
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
376
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.CardTitle, { children: t("billing.ui.cards.customer.title") }),
357
377
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
358
378
  ] }),
359
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.CardContent, { children: [
379
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.CardContent, { children: [
360
380
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: t("billing.ui.cards.customer.not_set_up") }),
361
381
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.customer.not_set_up_description") })
362
382
  ] })
363
383
  ] });
364
384
  }
365
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.Card, { children: [
366
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
367
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardTitle, { children: t("billing.ui.cards.customer.title") }),
385
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.Card, { children: [
386
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
387
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.CardTitle, { children: t("billing.ui.cards.customer.title") }),
368
388
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
369
389
  ] }),
370
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
390
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
371
391
  customer.name && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: customer.name }),
372
392
  customer.email && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: customer.email }),
373
393
  customer.balance !== void 0 && customer.balance !== 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm", children: [
@@ -377,7 +397,7 @@ function CustomerInfoCard({ customer, loading, error }) {
377
397
  ] }),
378
398
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: customer.balance < 0 ? "text-success" : "text-destructive", children: formatBalance(customer.balance, customer.currency, locale) })
379
399
  ] }),
380
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.Button, { variant: "outline", size: "sm", className: "mt-2", onClick: handlePortalClick, disabled: portalLoading, children: [
400
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.Button, { variant: "outline", size: "sm", className: "mt-2", onClick: handlePortalClick, disabled: portalLoading, children: [
381
401
  portalLoading ? t("common.loading") : t("billing.ui.cards.customer.manage_portal"),
382
402
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ExternalLink, { className: "h-4 w-4 ms-1" })
383
403
  ] })
@@ -390,7 +410,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, CustomerInfoCard, "CustomerInfoCard");
390
410
 
391
411
 
392
412
 
393
- var INVOICE_STATUSES = Object.values(_chunkG6UE6MEPjs.InvoiceStatus);
413
+ var INVOICE_STATUSES = Object.values(_chunkHKZAESS6js.InvoiceStatus);
394
414
  function getStatusBadgeVariant2(status) {
395
415
  switch (status) {
396
416
  case "paid" /* PAID */:
@@ -415,46 +435,46 @@ function formatAmount(amount, currency, locale) {
415
435
  _chunk7QVYU63Ejs.__name.call(void 0, formatAmount, "formatAmount");
416
436
  function InvoicesSummaryCard({ invoices, loading, error, onViewAllClick }) {
417
437
  const t = _nextintl.useTranslations.call(void 0, );
418
- const fmt = _chunkTY5FYP3Gjs.useBillingFormatOptions.call(void 0, );
438
+ const fmt = _chunkLQ4DK4JFjs.useBillingFormatOptions.call(void 0, );
419
439
  if (loading) {
420
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.Card, { children: [
421
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
422
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardTitle, { children: t("billing.ui.cards.invoices.title") }),
440
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.Card, { children: [
441
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
442
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.CardTitle, { children: t("billing.ui.cards.invoices.title") }),
423
443
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
424
444
  ] }),
425
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.CardContent, { children: [
426
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Skeleton, { className: "h-6 w-24 mb-2" }),
427
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Skeleton, { className: "h-4 w-32 mb-1" }),
428
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Skeleton, { className: "h-4 w-20" })
445
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.CardContent, { children: [
446
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Skeleton, { className: "h-6 w-24 mb-2" }),
447
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Skeleton, { className: "h-4 w-32 mb-1" }),
448
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Skeleton, { className: "h-4 w-20" })
429
449
  ] })
430
450
  ] });
431
451
  }
432
452
  if (error) {
433
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.Card, { children: [
434
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
435
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardTitle, { children: t("billing.ui.cards.invoices.title") }),
453
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.Card, { children: [
454
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
455
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.CardTitle, { children: t("billing.ui.cards.invoices.title") }),
436
456
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
437
457
  ] }),
438
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
458
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
439
459
  ] });
440
460
  }
441
- const latestInvoice = invoices[0];
461
+ const latestInvoice = _nullishCoalesce(invoices.find((inv) => inv.status !== "void" /* VOID */), () => ( invoices[0]));
442
462
  const paidInvoices = invoices.filter((inv) => inv.status === "paid" /* PAID */);
443
463
  const openInvoices = invoices.filter((inv) => inv.status === "open" /* OPEN */);
444
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewAllClick, children: [
445
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
446
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardTitle, { children: t("billing.ui.cards.invoices.title") }),
464
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewAllClick, children: [
465
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
466
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.CardTitle, { children: t("billing.ui.cards.invoices.title") }),
447
467
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
448
468
  ] }),
449
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardContent, { children: invoices.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
469
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.CardContent, { children: invoices.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
450
470
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: t("billing.ui.invoices.empty_title") }),
451
471
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.invoices.empty_description") })
452
472
  ] }) : latestInvoice ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
453
473
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
454
474
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: formatAmount(latestInvoice.total, latestInvoice.currency, fmt.locale) }),
455
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Badge, { variant: getStatusBadgeVariant2(latestInvoice.status), children: INVOICE_STATUSES.includes(latestInvoice.status) ? t(`billing.ui.invoice_status.${latestInvoice.status}`) : latestInvoice.status })
475
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Badge, { variant: getStatusBadgeVariant2(latestInvoice.status), children: INVOICE_STATUSES.includes(latestInvoice.status) ? t(`billing.ui.invoice_status.${latestInvoice.status}`) : latestInvoice.status })
456
476
  ] }),
457
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: latestInvoice.stripeInvoiceNumber || t("billing.ui.cards.invoices.invoice_from", { date: _chunkTY5FYP3Gjs.formatDate.call(void 0, latestInvoice.periodStart, fmt) }) }),
477
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: latestInvoice.stripeInvoiceNumber || t("billing.ui.cards.invoices.invoice_from", { date: _chunkLQ4DK4JFjs.formatDate.call(void 0, latestInvoice.periodStart, fmt) }) }),
458
478
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-4 text-xs text-muted-foreground", children: [
459
479
  paidInvoices.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: t("billing.ui.cards.invoices.paid_count", { count: paidInvoices.length }) }),
460
480
  openInvoices.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-warning", children: t("billing.ui.cards.invoices.open_count", { count: openInvoices.length }) }),
@@ -487,26 +507,26 @@ function BillingUsageSummaryCard({
487
507
  onViewDetailsClick
488
508
  }) {
489
509
  const t = _nextintl.useTranslations.call(void 0, );
490
- const locale = _chunkG6UE6MEPjs.useI18nLocale.call(void 0, );
510
+ const locale = _chunkHKZAESS6js.useI18nLocale.call(void 0, );
491
511
  if (loading) {
492
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.Card, { children: [
493
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
494
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardTitle, { children: t("billing.ui.cards.usage.title") }),
512
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.Card, { children: [
513
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
514
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.CardTitle, { children: t("billing.ui.cards.usage.title") }),
495
515
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
496
516
  ] }),
497
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.CardContent, { children: [
498
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Skeleton, { className: "h-6 w-24 mb-2" }),
499
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Skeleton, { className: "h-4 w-32" })
517
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.CardContent, { children: [
518
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Skeleton, { className: "h-6 w-24 mb-2" }),
519
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Skeleton, { className: "h-4 w-32" })
500
520
  ] })
501
521
  ] });
502
522
  }
503
523
  if (error) {
504
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.Card, { children: [
505
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
506
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardTitle, { children: t("billing.ui.cards.usage.title") }),
524
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.Card, { children: [
525
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
526
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.CardTitle, { children: t("billing.ui.cards.usage.title") }),
507
527
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
508
528
  ] }),
509
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
529
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
510
530
  ] });
511
531
  }
512
532
  const totalUsage = Object.values(summaries).reduce((acc, summary) => {
@@ -514,12 +534,12 @@ function BillingUsageSummaryCard({
514
534
  }, 0);
515
535
  const primaryMeter = meters.find((m) => _optionalChain([summaries, 'access', _17 => _17[m.id], 'optionalAccess', _18 => _18.aggregatedValue]));
516
536
  const primarySummary = primaryMeter ? summaries[primaryMeter.id] : null;
517
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewDetailsClick, children: [
518
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
519
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardTitle, { children: t("billing.ui.cards.usage.title") }),
537
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewDetailsClick, children: [
538
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
539
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.CardTitle, { children: t("billing.ui.cards.usage.title") }),
520
540
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
521
541
  ] }),
522
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardContent, { children: meters.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
542
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.CardContent, { children: meters.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
523
543
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: t("billing.ui.cards.usage.no_meters") }),
524
544
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.usage.no_meters_description") })
525
545
  ] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
@@ -558,7 +578,12 @@ var _navigation = require('next/navigation');
558
578
  var _reactstripejs = require('@stripe/react-stripe-js');
559
579
 
560
580
 
561
- function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
581
+ function PaymentMethodForm({
582
+ onSuccess,
583
+ onCancel,
584
+ isLoading = false,
585
+ alwaysSetDefault = false
586
+ }) {
562
587
  const t = _nextintl.useTranslations.call(void 0, );
563
588
  const stripe = _reactstripejs.useStripe.call(void 0, );
564
589
  const elements = _reactstripejs.useElements.call(void 0, );
@@ -571,7 +596,7 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
571
596
  const fetchSetupIntent = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
572
597
  setLoading(true);
573
598
  try {
574
- const intent = await _chunkG6UE6MEPjs.StripeCustomerService.createSetupIntent();
599
+ const intent = await _chunkHKZAESS6js.StripeCustomerService.createSetupIntent();
575
600
  setSetupIntent(intent);
576
601
  } catch (err) {
577
602
  console.error("[PaymentMethodForm] Failed to create setup intent:", err);
@@ -608,8 +633,8 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
608
633
  setIsSubmitting(false);
609
634
  return;
610
635
  }
611
- if (setAsDefault && _optionalChain([confirmedSetupIntent, 'optionalAccess', _19 => _19.payment_method])) {
612
- await _chunkG6UE6MEPjs.StripeCustomerService.setDefaultPaymentMethod({
636
+ if ((alwaysSetDefault || setAsDefault) && _optionalChain([confirmedSetupIntent, 'optionalAccess', _19 => _19.payment_method])) {
637
+ await _chunkHKZAESS6js.StripeCustomerService.setDefaultPaymentMethod({
613
638
  paymentMethodId: typeof confirmedSetupIntent.payment_method === "string" ? confirmedSetupIntent.payment_method : confirmedSetupIntent.payment_method.id
614
639
  });
615
640
  }
@@ -625,7 +650,7 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
625
650
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex items-center justify-center py-8", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground", children: t("billing.ui.payment_form.loading") }) });
626
651
  }
627
652
  if (!setupIntent && error) {
628
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.AlertDescription, { children: error }) });
653
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.AlertDescription, { children: error }) });
629
654
  }
630
655
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: handleSubmit, className: "flex flex-col gap-y-4", children: [
631
656
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rounded-md border border-gray-300 p-3", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -647,14 +672,21 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
647
672
  }
648
673
  }
649
674
  ) }),
650
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
651
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Checkbox, { id: "setAsDefault", checked: setAsDefault, onCheckedChange: (checked) => setSetAsDefault(!!checked) }),
652
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Label, { htmlFor: "setAsDefault", className: "cursor-pointer font-normal", children: t("billing.ui.payment_form.set_default") })
675
+ !alwaysSetDefault && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
676
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
677
+ _chunkLQ4DK4JFjs.Checkbox,
678
+ {
679
+ id: "setAsDefault",
680
+ checked: setAsDefault,
681
+ onCheckedChange: (checked) => setSetAsDefault(!!checked)
682
+ }
683
+ ),
684
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Label, { htmlFor: "setAsDefault", className: "cursor-pointer font-normal", children: t("billing.ui.payment_form.set_default") })
653
685
  ] }),
654
- error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.AlertDescription, { children: error }) }),
686
+ error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.AlertDescription, { children: error }) }),
655
687
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-x-2", children: [
656
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Button, { type: "button", variant: "outline", onClick: onCancel, disabled: isSubmitting || isLoading, children: t("ui.buttons.cancel") }),
657
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Button, { type: "submit", disabled: !stripe || isSubmitting || isLoading, children: isSubmitting ? t("billing.ui.wizard.review.processing") : t("billing.ui.cards.payment_method.add_card") })
688
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Button, { type: "button", variant: "outline", onClick: onCancel, disabled: isSubmitting || isLoading, children: t("ui.buttons.cancel") }),
689
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Button, { type: "submit", disabled: !stripe || isSubmitting || isLoading, children: isSubmitting ? t("billing.ui.wizard.review.processing") : t("billing.ui.cards.payment_method.add_card") })
658
690
  ] })
659
691
  ] });
660
692
  }
@@ -671,10 +703,10 @@ function PaymentMethodEditor({ open, onOpenChange, onSuccess }) {
671
703
  const handleCancel = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
672
704
  onOpenChange(false);
673
705
  }, "handleCancel");
674
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.DialogContent, { className: "max-w-md", children: [
675
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.DialogHeader, { children: [
676
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.DialogTitle, { children: t("billing.ui.payment_methods.add") }),
677
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.DialogDescription, { children: t("billing.ui.payment_methods.add_description") })
706
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.DialogContent, { className: "max-w-md", children: [
707
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.DialogHeader, { children: [
708
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.DialogTitle, { children: t("billing.ui.payment_methods.add") }),
709
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.DialogDescription, { children: t("billing.ui.payment_methods.add_description") })
678
710
  ] }),
679
711
  open && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodForm, { onSuccess: handleSuccess, onCancel: handleCancel })
680
712
  ] }) });
@@ -700,7 +732,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
700
732
  _react.useEffect.call(void 0, () => {
701
733
  const loadCustomer = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
702
734
  try {
703
- const fetchedCustomer = await _chunkG6UE6MEPjs.StripeCustomerService.getCustomer();
735
+ const fetchedCustomer = await _chunkHKZAESS6js.StripeCustomerService.getCustomer();
704
736
  setCustomer(fetchedCustomer);
705
737
  } catch (error) {
706
738
  console.error("[PaymentMethodCard] Failed to load customer:", error);
@@ -717,7 +749,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
717
749
  const handleSetDefault = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
718
750
  setLoading(true);
719
751
  try {
720
- await _chunkG6UE6MEPjs.StripeCustomerService.setDefaultPaymentMethod({ paymentMethodId: paymentMethod.id });
752
+ await _chunkHKZAESS6js.StripeCustomerService.setDefaultPaymentMethod({ paymentMethodId: paymentMethod.id });
721
753
  onUpdate();
722
754
  } catch (error) {
723
755
  console.error("[PaymentMethodCard] Failed to set as default:", error);
@@ -728,7 +760,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
728
760
  const handleRemove = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
729
761
  setLoading(true);
730
762
  try {
731
- await _chunkG6UE6MEPjs.StripeCustomerService.removePaymentMethod({ paymentMethodId: paymentMethod.id });
763
+ await _chunkHKZAESS6js.StripeCustomerService.removePaymentMethod({ paymentMethodId: paymentMethod.id });
732
764
  setShowRemoveDialog(false);
733
765
  onUpdate();
734
766
  } catch (error) {
@@ -737,16 +769,16 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
737
769
  }
738
770
  }, "handleRemove");
739
771
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
740
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.Card, { className: "relative", children: [
741
- isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Badge, { variant: "softGreen", className: "absolute end-2 top-2", children: t("billing.ui.payment_methods.default") }),
742
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.CardHeader, { className: "flex flex-row items-center justify-between pb-2", children: [
772
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.Card, { className: "relative", children: [
773
+ isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Badge, { variant: "softGreen", className: "absolute end-2 top-2", children: t("billing.ui.payment_methods.default") }),
774
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.CardHeader, { className: "flex flex-row items-center justify-between pb-2", children: [
743
775
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
744
776
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-2xl", children: brandIcon }),
745
777
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium capitalize", children: brand })
746
778
  ] }),
747
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.DropdownMenu, { children: [
748
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.DropdownMenuTrigger, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
749
- _chunkTY5FYP3Gjs.Button,
779
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.DropdownMenu, { children: [
780
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.DropdownMenuTrigger, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
781
+ _chunkLQ4DK4JFjs.Button,
750
782
  {
751
783
  render: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {}),
752
784
  nativeButton: false,
@@ -757,10 +789,10 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
757
789
  children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.MoreVertical, { className: "h-4 w-4" })
758
790
  }
759
791
  ) }),
760
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.DropdownMenuContent, { align: "end", children: [
761
- !isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.DropdownMenuItem, { onClick: handleSetDefault, disabled: loading, children: t("billing.ui.payment_methods.set_default") }),
792
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.DropdownMenuContent, { align: "end", children: [
793
+ !isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.DropdownMenuItem, { onClick: handleSetDefault, disabled: loading, children: t("billing.ui.payment_methods.set_default") }),
762
794
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
763
- _chunkTY5FYP3Gjs.DropdownMenuItem,
795
+ _chunkLQ4DK4JFjs.DropdownMenuItem,
764
796
  {
765
797
  onClick: () => setShowRemoveDialog(true),
766
798
  disabled: loading,
@@ -771,7 +803,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
771
803
  ] })
772
804
  ] })
773
805
  ] }),
774
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-1", children: [
806
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-1", children: [
775
807
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-lg font-semibold", children: [
776
808
  "\u2022\u2022\u2022\u2022 ",
777
809
  last4
@@ -779,17 +811,17 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
779
811
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: t("billing.ui.payment_method.expires", { date: `${String(expMonth).padStart(2, "0")}/${expYear}` }) })
780
812
  ] }) })
781
813
  ] }),
782
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.AlertDialog, { open: showRemoveDialog, onOpenChange: setShowRemoveDialog, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.AlertDialogContent, { children: [
783
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.AlertDialogHeader, { children: [
784
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.AlertDialogTitle, { children: t("billing.ui.payment_methods.remove_title") }),
785
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.AlertDialogDescription, { children: [
814
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.AlertDialog, { open: showRemoveDialog, onOpenChange: setShowRemoveDialog, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.AlertDialogContent, { children: [
815
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.AlertDialogHeader, { children: [
816
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.AlertDialogTitle, { children: t("billing.ui.payment_methods.remove_title") }),
817
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.AlertDialogDescription, { children: [
786
818
  t("billing.ui.payment_methods.remove_description"),
787
819
  isDefault && ` ${t("billing.ui.payment_methods.remove_default_warning")}`
788
820
  ] })
789
821
  ] }),
790
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.AlertDialogFooter, { children: [
791
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.AlertDialogCancel, { disabled: loading, children: t("ui.buttons.cancel") }),
792
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.AlertDialogAction, { onClick: handleRemove, disabled: loading, className: "bg-red-600 hover:bg-red-700", children: loading ? t("billing.ui.payment_methods.removing") : t("ui.buttons.remove") })
822
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.AlertDialogFooter, { children: [
823
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.AlertDialogCancel, { disabled: loading, children: t("ui.buttons.cancel") }),
824
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.AlertDialogAction, { onClick: handleRemove, disabled: loading, className: "bg-red-600 hover:bg-red-700", children: loading ? t("billing.ui.payment_methods.removing") : t("ui.buttons.remove") })
793
825
  ] })
794
826
  ] }) })
795
827
  ] });
@@ -813,7 +845,7 @@ function PaymentMethodsContainer() {
813
845
  const loadPaymentMethods = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
814
846
  setLoading(true);
815
847
  try {
816
- const fetchedPaymentMethods = await _chunkG6UE6MEPjs.StripeCustomerService.listPaymentMethods();
848
+ const fetchedPaymentMethods = await _chunkHKZAESS6js.StripeCustomerService.listPaymentMethods();
817
849
  setPaymentMethods(fetchedPaymentMethods);
818
850
  } catch (error) {
819
851
  console.error("[PaymentMethodsContainer] Failed to load payment methods:", error);
@@ -833,14 +865,14 @@ function PaymentMethodsContainer() {
833
865
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8" }),
834
866
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: t("billing.ui.payment_methods.title") })
835
867
  ] }),
836
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Button, { onClick: () => setShowAddPaymentMethod(true), children: t("billing.ui.payment_methods.add") })
868
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Button, { onClick: () => setShowAddPaymentMethod(true), children: t("billing.ui.payment_methods.add") })
837
869
  ] }),
838
870
  paymentMethods.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col items-center justify-center gap-y-4 rounded-lg border-2 border-dashed border-gray-300 bg-muted/50 p-12", children: [
839
871
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-16 w-16 text-muted-foreground" }),
840
872
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
841
873
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "mb-2 text-sm font-medium", children: t("billing.ui.payment_methods.empty_title") }),
842
874
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mb-4 text-muted-foreground", children: t("billing.ui.payment_methods.empty_description") }),
843
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Button, { onClick: () => setShowAddPaymentMethod(true), children: t("billing.ui.payment_methods.add_first") })
875
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Button, { onClick: () => setShowAddPaymentMethod(true), children: t("billing.ui.payment_methods.add_first") })
844
876
  ] })
845
877
  ] }),
846
878
  paymentMethods.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodsList, { paymentMethods, onUpdate: loadPaymentMethods }),
@@ -896,7 +928,7 @@ var statusConfig = {
896
928
  function InvoiceStatusBadge({ status }) {
897
929
  const t = _nextintl.useTranslations.call(void 0, );
898
930
  const config = statusConfig[status] || statusConfig["draft" /* DRAFT */];
899
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Badge, { variant: config.variant, children: t(config.label) });
931
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Badge, { variant: config.variant, children: t(config.label) });
900
932
  }
901
933
  _chunk7QVYU63Ejs.__name.call(void 0, InvoiceStatusBadge, "InvoiceStatusBadge");
902
934
 
@@ -909,7 +941,7 @@ function InvoiceDetails({
909
941
  onInvoiceChange: _onInvoiceChange
910
942
  }) {
911
943
  const t = _nextintl.useTranslations.call(void 0, );
912
- const fmt = _chunkTY5FYP3Gjs.useBillingFormatOptions.call(void 0, );
944
+ const fmt = _chunkLQ4DK4JFjs.useBillingFormatOptions.call(void 0, );
913
945
  const handleDownloadPDF = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
914
946
  if (invoice.stripePdfUrl) {
915
947
  window.open(invoice.stripePdfUrl, "_blank");
@@ -929,10 +961,10 @@ function InvoiceDetails({
929
961
  return invoice.stripeInvoiceId.slice(-8);
930
962
  }, "getInvoiceNumber");
931
963
  const productName = _optionalChain([invoice, 'access', _29 => _29.subscription, 'optionalAccess', _30 => _30.price, 'optionalAccess', _31 => _31.product, 'optionalAccess', _32 => _32.name]) || t("billing.ui.cards.subscriptions.fallback_name");
932
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.DialogContent, { className: "max-w-2xl", children: [
933
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.DialogHeader, { children: [
934
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.DialogTitle, { children: t("billing.ui.invoice.title", { number: getInvoiceNumber() }) }),
935
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.DialogDescription, { children: _chunkTY5FYP3Gjs.formatDate.call(void 0, invoice.periodStart, fmt) })
964
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.DialogContent, { className: "max-w-2xl", children: [
965
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.DialogHeader, { children: [
966
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.DialogTitle, { children: t("billing.ui.invoice.title", { number: getInvoiceNumber() }) }),
967
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.DialogDescription, { children: _chunkLQ4DK4JFjs.formatDate.call(void 0, invoice.periodStart, fmt) })
936
968
  ] }),
937
969
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
938
970
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
@@ -943,18 +975,18 @@ function InvoiceDetails({
943
975
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
944
976
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.billing_period") }),
945
977
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm", children: [
946
- _chunkTY5FYP3Gjs.formatDate.call(void 0, invoice.periodStart, fmt),
978
+ _chunkLQ4DK4JFjs.formatDate.call(void 0, invoice.periodStart, fmt),
947
979
  " - ",
948
- _chunkTY5FYP3Gjs.formatDate.call(void 0, invoice.periodEnd, fmt)
980
+ _chunkLQ4DK4JFjs.formatDate.call(void 0, invoice.periodEnd, fmt)
949
981
  ] })
950
982
  ] }),
951
983
  invoice.dueDate && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
952
984
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.due_date") }),
953
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm", children: _chunkTY5FYP3Gjs.formatDate.call(void 0, invoice.dueDate, fmt) })
985
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm", children: _chunkLQ4DK4JFjs.formatDate.call(void 0, invoice.dueDate, fmt) })
954
986
  ] }),
955
987
  invoice.paidAt && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
956
988
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.paid_date") }),
957
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm", children: _chunkTY5FYP3Gjs.formatDate.call(void 0, invoice.paidAt, fmt) })
989
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm", children: _chunkLQ4DK4JFjs.formatDate.call(void 0, invoice.paidAt, fmt) })
958
990
  ] }),
959
991
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
960
992
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.attempt_count") }),
@@ -970,42 +1002,42 @@ function InvoiceDetails({
970
1002
  ] }) }),
971
1003
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "tbody", { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "tr", { className: "border-t", children: [
972
1004
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "td", { className: "p-3", children: productName }),
973
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "td", { className: "p-3 text-end", children: _chunkTY5FYP3Gjs.formatCurrency.call(void 0, invoice.subtotal, invoice.currency, fmt) })
1005
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "td", { className: "p-3 text-end", children: _chunkHKZAESS6js.formatCurrency.call(void 0, invoice.subtotal, invoice.currency, fmt) })
974
1006
  ] }) })
975
1007
  ] }) })
976
1008
  ] }),
977
1009
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2 border-t pt-4", children: [
978
1010
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
979
1011
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.subtotal") }),
980
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children: _chunkTY5FYP3Gjs.formatCurrency.call(void 0, invoice.subtotal, invoice.currency, fmt) })
1012
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children: _chunkHKZAESS6js.formatCurrency.call(void 0, invoice.subtotal, invoice.currency, fmt) })
981
1013
  ] }),
982
1014
  invoice.tax !== void 0 && invoice.tax > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
983
1015
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.tax") }),
984
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children: _chunkTY5FYP3Gjs.formatCurrency.call(void 0, invoice.tax, invoice.currency, fmt) })
1016
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children: _chunkHKZAESS6js.formatCurrency.call(void 0, invoice.tax, invoice.currency, fmt) })
985
1017
  ] }),
986
1018
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between text-lg font-semibold border-t pt-2", children: [
987
1019
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: t("billing.ui.invoice.total") }),
988
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _chunkTY5FYP3Gjs.formatCurrency.call(void 0, invoice.total, invoice.currency, fmt) })
1020
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _chunkHKZAESS6js.formatCurrency.call(void 0, invoice.total, invoice.currency, fmt) })
989
1021
  ] }),
990
1022
  invoice.amountPaid > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
991
1023
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.amount_paid") }),
992
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-success", children: _chunkTY5FYP3Gjs.formatCurrency.call(void 0, invoice.amountPaid, invoice.currency, fmt) })
1024
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-success", children: _chunkHKZAESS6js.formatCurrency.call(void 0, invoice.amountPaid, invoice.currency, fmt) })
993
1025
  ] }),
994
1026
  invoice.amountRemaining > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
995
1027
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.amount_due") }),
996
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-destructive", children: _chunkTY5FYP3Gjs.formatCurrency.call(void 0, invoice.amountRemaining, invoice.currency, fmt) })
1028
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-destructive", children: _chunkHKZAESS6js.formatCurrency.call(void 0, invoice.amountRemaining, invoice.currency, fmt) })
997
1029
  ] })
998
1030
  ] }),
999
1031
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2 pt-4 border-t", children: [
1000
- invoice.stripePdfUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.Button, { variant: "outline", onClick: handleDownloadPDF, children: [
1032
+ invoice.stripePdfUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.Button, { variant: "outline", onClick: handleDownloadPDF, children: [
1001
1033
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Download, { className: "me-2 h-4 w-4" }),
1002
1034
  t("billing.ui.invoice.download_pdf")
1003
1035
  ] }),
1004
- invoice.status === "open" /* OPEN */ && invoice.attempted && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.Button, { variant: "default", onClick: handleRetryPayment, children: [
1036
+ invoice.status === "open" /* OPEN */ && invoice.attempted && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.Button, { variant: "default", onClick: handleRetryPayment, children: [
1005
1037
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RefreshCw, { className: "me-2 h-4 w-4" }),
1006
1038
  t("billing.ui.invoice.retry_payment")
1007
1039
  ] }),
1008
- invoice.stripeHostedInvoiceUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.Button, { variant: "outline", onClick: handleViewInStripe, children: [
1040
+ invoice.stripeHostedInvoiceUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.Button, { variant: "outline", onClick: handleViewInStripe, children: [
1009
1041
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ExternalLink, { className: "me-2 h-4 w-4" }),
1010
1042
  t("billing.ui.invoice.view_in_stripe")
1011
1043
  ] })
@@ -1019,7 +1051,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, InvoiceDetails, "InvoiceDetails");
1019
1051
 
1020
1052
  function InvoicesList({ invoices, onInvoicesChange }) {
1021
1053
  const t = _nextintl.useTranslations.call(void 0, );
1022
- const fmt = _chunkTY5FYP3Gjs.useBillingFormatOptions.call(void 0, );
1054
+ const fmt = _chunkLQ4DK4JFjs.useBillingFormatOptions.call(void 0, );
1023
1055
  const [selectedInvoice, setSelectedInvoice] = _react.useState.call(void 0, null);
1024
1056
  const handleRowClick = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (invoice) => {
1025
1057
  setSelectedInvoice(invoice);
@@ -1031,30 +1063,30 @@ function InvoicesList({ invoices, onInvoicesChange }) {
1031
1063
  return invoice.stripeInvoiceId.slice(-8);
1032
1064
  }, "getInvoiceNumber");
1033
1065
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
1034
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.Table, { children: [
1035
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.TableRow, { children: [
1036
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.TableHead, { children: t("billing.ui.columns.invoice_number") }),
1037
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.TableHead, { children: t("billing.ui.columns.date") }),
1038
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.TableHead, { children: t("billing.ui.columns.status") }),
1039
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.TableHead, { className: "text-end", children: t("billing.ui.columns.amount") }),
1040
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.TableHead, { children: t("billing.ui.columns.period") })
1066
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.Table, { children: [
1067
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.TableRow, { children: [
1068
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.TableHead, { children: t("billing.ui.columns.invoice_number") }),
1069
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.TableHead, { children: t("billing.ui.columns.date") }),
1070
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.TableHead, { children: t("billing.ui.columns.status") }),
1071
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.TableHead, { className: "text-end", children: t("billing.ui.columns.amount") }),
1072
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.TableHead, { children: t("billing.ui.columns.period") })
1041
1073
  ] }) }),
1042
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.TableBody, { children: invoices.map((invoice) => {
1074
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.TableBody, { children: invoices.map((invoice) => {
1043
1075
  const invoiceNumber = getInvoiceNumber(invoice);
1044
- const date = _chunkTY5FYP3Gjs.formatDate.call(void 0, invoice.periodStart, fmt);
1045
- const amount = _chunkTY5FYP3Gjs.formatCurrency.call(void 0, invoice.total, invoice.currency, fmt);
1046
- const period = `${_chunkTY5FYP3Gjs.formatDate.call(void 0, invoice.periodStart, fmt)} - ${_chunkTY5FYP3Gjs.formatDate.call(void 0, invoice.periodEnd, fmt)}`;
1076
+ const date = _chunkLQ4DK4JFjs.formatDate.call(void 0, invoice.periodStart, fmt);
1077
+ const amount = _chunkHKZAESS6js.formatCurrency.call(void 0, invoice.total, invoice.currency, fmt);
1078
+ const period = `${_chunkLQ4DK4JFjs.formatDate.call(void 0, invoice.periodStart, fmt)} - ${_chunkLQ4DK4JFjs.formatDate.call(void 0, invoice.periodEnd, fmt)}`;
1047
1079
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1048
- _chunkTY5FYP3Gjs.TableRow,
1080
+ _chunkLQ4DK4JFjs.TableRow,
1049
1081
  {
1050
1082
  onClick: () => handleRowClick(invoice),
1051
1083
  className: "cursor-pointer hover:bg-muted/50",
1052
1084
  children: [
1053
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.TableCell, { className: "font-medium", children: invoiceNumber }),
1054
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.TableCell, { className: "text-muted-foreground text-xs", children: date }),
1055
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InvoiceStatusBadge, { status: invoice.status }) }),
1056
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.TableCell, { className: "text-end font-medium", children: amount }),
1057
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.TableCell, { className: "text-muted-foreground text-xs", children: period })
1085
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.TableCell, { className: "font-medium", children: invoiceNumber }),
1086
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.TableCell, { className: "text-muted-foreground text-xs", children: date }),
1087
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InvoiceStatusBadge, { status: invoice.status }) }),
1088
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.TableCell, { className: "text-end font-medium", children: amount }),
1089
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.TableCell, { className: "text-muted-foreground text-xs", children: period })
1058
1090
  ]
1059
1091
  },
1060
1092
  invoice.id
@@ -1088,7 +1120,7 @@ function InvoicesContainer() {
1088
1120
  setLoading(true);
1089
1121
  try {
1090
1122
  const params = statusFilter !== "all" ? { status: statusFilter } : void 0;
1091
- const data = await _chunkG6UE6MEPjs.StripeInvoiceService.listInvoices(params);
1123
+ const data = await _chunkHKZAESS6js.StripeInvoiceService.listInvoices(params);
1092
1124
  setInvoices(data);
1093
1125
  } catch (error) {
1094
1126
  console.error("[InvoicesContainer] Failed to load invoices:", error);
@@ -1104,12 +1136,12 @@ function InvoicesContainer() {
1104
1136
  setStatusFilter(value);
1105
1137
  }, "handleFilterChange");
1106
1138
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-4", children: [
1107
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Tabs, { value: statusFilter, onValueChange: handleFilterChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.TabsList, { children: [
1108
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.TabsTrigger, { value: "all", children: t("billing.ui.invoices.filter_all") }),
1109
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.TabsTrigger, { value: "paid" /* PAID */, children: t("billing.ui.invoice_status.paid") }),
1110
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.TabsTrigger, { value: "open" /* OPEN */, children: t("billing.ui.invoice_status.open") }),
1111
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.TabsTrigger, { value: "void" /* VOID */, children: t("billing.ui.invoice_status.void") }),
1112
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.TabsTrigger, { value: "uncollectible" /* UNCOLLECTIBLE */, children: t("billing.ui.invoice_status.uncollectible") })
1139
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Tabs, { value: statusFilter, onValueChange: handleFilterChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.TabsList, { children: [
1140
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.TabsTrigger, { value: "all", children: t("billing.ui.invoices.filter_all") }),
1141
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.TabsTrigger, { value: "paid" /* PAID */, children: t("billing.ui.invoice_status.paid") }),
1142
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.TabsTrigger, { value: "open" /* OPEN */, children: t("billing.ui.invoice_status.open") }),
1143
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.TabsTrigger, { value: "void" /* VOID */, children: t("billing.ui.invoice_status.void") }),
1144
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.TabsTrigger, { value: "uncollectible" /* UNCOLLECTIBLE */, children: t("billing.ui.invoice_status.uncollectible") })
1113
1145
  ] }) }),
1114
1146
  loading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-center py-8 text-muted-foreground", children: t("billing.ui.invoices.loading") }),
1115
1147
  !loading && invoices.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "border border-dashed border-gray-300 rounded-lg p-8 text-center", children: [
@@ -1151,7 +1183,7 @@ function CancelSubscriptionDialog({
1151
1183
  onSuccess
1152
1184
  }) {
1153
1185
  const t = _nextintl.useTranslations.call(void 0, );
1154
- const fmt = _chunkTY5FYP3Gjs.useBillingFormatOptions.call(void 0, );
1186
+ const fmt = _chunkLQ4DK4JFjs.useBillingFormatOptions.call(void 0, );
1155
1187
  const [isSubmitting, setIsSubmitting] = _react.useState.call(void 0, false);
1156
1188
  const form = _reacthookform.useForm.call(void 0, {
1157
1189
  resolver: _zod.zodResolver.call(void 0, formSchema),
@@ -1162,7 +1194,7 @@ function CancelSubscriptionDialog({
1162
1194
  const onSubmit = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async (_values) => {
1163
1195
  setIsSubmitting(true);
1164
1196
  try {
1165
- await _chunkG6UE6MEPjs.StripeSubscriptionService.cancelSubscription({
1197
+ await _chunkHKZAESS6js.StripeSubscriptionService.cancelSubscription({
1166
1198
  id: subscription.id,
1167
1199
  cancelImmediately: false
1168
1200
  });
@@ -1174,16 +1206,16 @@ function CancelSubscriptionDialog({
1174
1206
  setIsSubmitting(false);
1175
1207
  }
1176
1208
  }, "onSubmit");
1177
- const periodEndDate = _chunkTY5FYP3Gjs.formatDate.call(void 0, subscription.currentPeriodEnd, fmt);
1178
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.DialogContent, { className: "max-w-md", children: [
1179
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.DialogHeader, { children: [
1180
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.DialogTitle, { children: t("billing.ui.subscription.cancel.title") }),
1181
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.DialogDescription, { children: t("billing.ui.subscription.cancel.description") })
1209
+ const periodEndDate = _chunkLQ4DK4JFjs.formatDate.call(void 0, subscription.currentPeriodEnd, fmt);
1210
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.DialogContent, { className: "max-w-md", children: [
1211
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.DialogHeader, { children: [
1212
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.DialogTitle, { children: t("billing.ui.subscription.cancel.title") }),
1213
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.DialogDescription, { children: t("billing.ui.subscription.cancel.description") })
1182
1214
  ] }),
1183
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-col gap-y-4", children: [
1215
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-col gap-y-4", children: [
1184
1216
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "bg-primary/10 border-primary/30 text-foreground rounded-lg border p-3 text-sm", children: t("billing.ui.subscription.cancel.remains_active", { date: periodEndDate }) }),
1185
1217
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1186
- _chunkTY5FYP3Gjs.FormTextarea,
1218
+ _chunkLQ4DK4JFjs.FormTextarea,
1187
1219
  {
1188
1220
  form,
1189
1221
  id: "reason",
@@ -1193,8 +1225,8 @@ function CancelSubscriptionDialog({
1193
1225
  }
1194
1226
  ),
1195
1227
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-x-2 justify-end pt-2", children: [
1196
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Button, { type: "button", variant: "outline", onClick: () => onOpenChange(false), disabled: isSubmitting, children: t("billing.ui.subscription.cancel.keep") }),
1197
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Button, { type: "submit", variant: "destructive", disabled: isSubmitting, children: isSubmitting ? t("billing.ui.subscription.cancel.canceling") : t("billing.ui.subscription.cancel.confirm") })
1228
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Button, { type: "button", variant: "outline", onClick: () => onOpenChange(false), disabled: isSubmitting, children: t("billing.ui.subscription.cancel.keep") }),
1229
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Button, { type: "submit", variant: "destructive", disabled: isSubmitting, children: isSubmitting ? t("billing.ui.subscription.cancel.canceling") : t("billing.ui.subscription.cancel.confirm") })
1198
1230
  ] })
1199
1231
  ] }) })
1200
1232
  ] }) });
@@ -1245,7 +1277,7 @@ var cancelingConfig = {
1245
1277
  function SubscriptionStatusBadge({ status, cancelAtPeriodEnd }) {
1246
1278
  const t = _nextintl.useTranslations.call(void 0, );
1247
1279
  const config = cancelAtPeriodEnd ? cancelingConfig : statusConfig2[status] || statusConfig2["canceled" /* CANCELED */];
1248
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Badge, { variant: config.variant, children: t(config.label) });
1280
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Badge, { variant: config.variant, children: t(config.label) });
1249
1281
  }
1250
1282
  _chunk7QVYU63Ejs.__name.call(void 0, SubscriptionStatusBadge, "SubscriptionStatusBadge");
1251
1283
 
@@ -1272,7 +1304,7 @@ function formatPlanName2(price, t) {
1272
1304
  _chunk7QVYU63Ejs.__name.call(void 0, formatPlanName2, "formatPlanName");
1273
1305
  function formatBillingAmount(price, notAvailable, fmt) {
1274
1306
  if (!_optionalChain([price, 'optionalAccess', _37 => _37.unitAmount])) return notAvailable;
1275
- return _chunkTY5FYP3Gjs.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt);
1307
+ return _chunkHKZAESS6js.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt);
1276
1308
  }
1277
1309
  _chunk7QVYU63Ejs.__name.call(void 0, formatBillingAmount, "formatBillingAmount");
1278
1310
  function SubscriptionDetails({
@@ -1283,13 +1315,13 @@ function SubscriptionDetails({
1283
1315
  onChangePlan
1284
1316
  }) {
1285
1317
  const t = _nextintl.useTranslations.call(void 0, );
1286
- const fmt = _chunkTY5FYP3Gjs.useBillingFormatOptions.call(void 0, );
1318
+ const fmt = _chunkLQ4DK4JFjs.useBillingFormatOptions.call(void 0, );
1287
1319
  const [showCancel, setShowCancel] = _react.useState.call(void 0, false);
1288
1320
  const [isProcessing, setIsProcessing] = _react.useState.call(void 0, false);
1289
1321
  const handlePause = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
1290
1322
  setIsProcessing(true);
1291
1323
  try {
1292
- await _chunkG6UE6MEPjs.StripeSubscriptionService.pauseSubscription({ subscriptionId: subscription.id });
1324
+ await _chunkHKZAESS6js.StripeSubscriptionService.pauseSubscription({ subscriptionId: subscription.id });
1293
1325
  onSubscriptionChange();
1294
1326
  } catch (error) {
1295
1327
  console.error("[SubscriptionDetails] Failed to pause subscription:", error);
@@ -1300,7 +1332,7 @@ function SubscriptionDetails({
1300
1332
  const handleResume = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
1301
1333
  setIsProcessing(true);
1302
1334
  try {
1303
- await _chunkG6UE6MEPjs.StripeSubscriptionService.resumeSubscription({ subscriptionId: subscription.id });
1335
+ await _chunkHKZAESS6js.StripeSubscriptionService.resumeSubscription({ subscriptionId: subscription.id });
1304
1336
  onSubscriptionChange();
1305
1337
  } catch (error) {
1306
1338
  console.error("[SubscriptionDetails] Failed to resume subscription:", error);
@@ -1310,7 +1342,7 @@ function SubscriptionDetails({
1310
1342
  }, "handleResume");
1311
1343
  const handleManageViaPortal = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
1312
1344
  try {
1313
- const { url } = await _chunkG6UE6MEPjs.StripeCustomerService.createPortalSession();
1345
+ const { url } = await _chunkHKZAESS6js.StripeCustomerService.createPortalSession();
1314
1346
  window.open(url, "_blank");
1315
1347
  } catch (error) {
1316
1348
  console.error("[SubscriptionDetails] Failed to create portal session:", error);
@@ -1320,10 +1352,10 @@ function SubscriptionDetails({
1320
1352
  const canResume = subscription.status === "paused" /* PAUSED */;
1321
1353
  const canCancel = subscription.status === "active" /* ACTIVE */ || subscription.status === "trialing" /* TRIALING */ || subscription.status === "paused" /* PAUSED */;
1322
1354
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
1323
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.DialogContent, { className: "max-w-2xl", children: [
1324
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.DialogHeader, { children: [
1325
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.DialogTitle, { children: t("billing.ui.subscription.details_title") }),
1326
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.DialogDescription, { children: t("billing.ui.subscription.details_description") })
1355
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.DialogContent, { className: "max-w-2xl", children: [
1356
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.DialogHeader, { children: [
1357
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.DialogTitle, { children: t("billing.ui.subscription.details_title") }),
1358
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.DialogDescription, { children: t("billing.ui.subscription.details_description") })
1327
1359
  ] }),
1328
1360
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
1329
1361
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
@@ -1349,24 +1381,24 @@ function SubscriptionDetails({
1349
1381
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "space-y-2", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
1350
1382
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.subscription.current_period") }),
1351
1383
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "text-sm", children: [
1352
- _chunkTY5FYP3Gjs.formatDate.call(void 0, subscription.currentPeriodStart, fmt),
1384
+ _chunkLQ4DK4JFjs.formatDate.call(void 0, subscription.currentPeriodStart, fmt),
1353
1385
  " - ",
1354
- _chunkTY5FYP3Gjs.formatDate.call(void 0, subscription.currentPeriodEnd, fmt)
1386
+ _chunkLQ4DK4JFjs.formatDate.call(void 0, subscription.currentPeriodEnd, fmt)
1355
1387
  ] })
1356
1388
  ] }) }),
1357
1389
  subscription.trialEnd && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
1358
1390
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.subscription.trial_ends") }),
1359
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children: _chunkTY5FYP3Gjs.formatDate.call(void 0, subscription.trialEnd, fmt) })
1391
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children: _chunkLQ4DK4JFjs.formatDate.call(void 0, subscription.trialEnd, fmt) })
1360
1392
  ] }),
1361
1393
  subscription.cancelAtPeriodEnd && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "bg-warning/15 border-warning/30 rounded-lg border p-3", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-warning text-xs/relaxed", children: t("billing.ui.subscription.cancel_at_period_end", {
1362
- date: _chunkTY5FYP3Gjs.formatDate.call(void 0, subscription.currentPeriodEnd, fmt)
1394
+ date: _chunkLQ4DK4JFjs.formatDate.call(void 0, subscription.currentPeriodEnd, fmt)
1363
1395
  }) }) }),
1364
1396
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2 pt-4 border-t", children: [
1365
- onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Button, { variant: "default", onClick: () => onChangePlan(subscription), children: t("billing.ui.subscription.change_plan") }),
1366
- canPause && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Button, { variant: "outline", onClick: handlePause, disabled: isProcessing, children: isProcessing ? t("billing.ui.subscription.pausing") : t("billing.ui.subscription.pause") }),
1367
- canResume && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Button, { variant: "outline", onClick: handleResume, disabled: isProcessing, children: isProcessing ? t("billing.ui.subscription.resuming") : t("billing.ui.subscription.resume") }),
1368
- canCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Button, { variant: "destructive", onClick: () => setShowCancel(true), children: t("ui.buttons.cancel") }),
1369
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Button, { variant: "outline", onClick: handleManageViaPortal, children: t("billing.ui.subscription.manage_portal") })
1397
+ onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Button, { variant: "default", onClick: () => onChangePlan(subscription), children: t("billing.ui.subscription.change_plan") }),
1398
+ canPause && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Button, { variant: "outline", onClick: handlePause, disabled: isProcessing, children: isProcessing ? t("billing.ui.subscription.pausing") : t("billing.ui.subscription.pause") }),
1399
+ canResume && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Button, { variant: "outline", onClick: handleResume, disabled: isProcessing, children: isProcessing ? t("billing.ui.subscription.resuming") : t("billing.ui.subscription.resume") }),
1400
+ canCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Button, { variant: "destructive", onClick: () => setShowCancel(true), children: t("ui.buttons.cancel") }),
1401
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Button, { variant: "outline", onClick: handleManageViaPortal, children: t("billing.ui.subscription.manage_portal") })
1370
1402
  ] })
1371
1403
  ] })
1372
1404
  ] }) }),
@@ -1409,42 +1441,46 @@ function formatPlanName3(price, t) {
1409
1441
  _chunk7QVYU63Ejs.__name.call(void 0, formatPlanName3, "formatPlanName");
1410
1442
  function SubscriptionsList({ subscriptions, onSubscriptionsChange, onChangePlan }) {
1411
1443
  const t = _nextintl.useTranslations.call(void 0, );
1412
- const fmt = _chunkTY5FYP3Gjs.useBillingFormatOptions.call(void 0, );
1444
+ const fmt = _chunkLQ4DK4JFjs.useBillingFormatOptions.call(void 0, );
1413
1445
  const [selectedSub, setSelectedSub] = _react.useState.call(void 0, null);
1414
1446
  const handleRowClick = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (subscription) => {
1415
1447
  setSelectedSub(subscription);
1416
1448
  }, "handleRowClick");
1417
1449
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
1418
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.Table, { children: [
1419
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.TableRow, { children: [
1420
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.TableHead, { children: t("billing.ui.columns.status") }),
1421
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.TableHead, { children: t("billing.ui.columns.plan") }),
1422
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.TableHead, { children: t("billing.ui.columns.period") }),
1423
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.TableHead, { className: "text-end", children: t("billing.ui.columns.amount") }),
1424
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.TableHead, { className: "text-end", children: t("billing.ui.columns.actions") })
1450
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.Table, { children: [
1451
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.TableRow, { children: [
1452
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.TableHead, { children: t("billing.ui.columns.status") }),
1453
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.TableHead, { children: t("billing.ui.columns.plan") }),
1454
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.TableHead, { children: t("billing.ui.columns.period") }),
1455
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.TableHead, { className: "text-end", children: t("billing.ui.columns.amount") }),
1456
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.TableHead, { className: "text-end", children: t("billing.ui.columns.actions") })
1425
1457
  ] }) }),
1426
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.TableBody, { children: subscriptions.map((subscription) => {
1458
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.TableBody, { children: subscriptions.map((subscription) => {
1427
1459
  const price = subscription.price;
1428
- const amount = _optionalChain([price, 'optionalAccess', _42 => _42.unitAmount]) ? _chunkTY5FYP3Gjs.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt) : "0";
1429
- const period = `${_chunkTY5FYP3Gjs.formatDate.call(void 0, subscription.currentPeriodStart, fmt)} - ${_chunkTY5FYP3Gjs.formatDate.call(void 0, subscription.currentPeriodEnd, fmt)}`;
1460
+ const amount = _optionalChain([price, 'optionalAccess', _42 => _42.unitAmount]) ? _chunkHKZAESS6js.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt) : "0";
1461
+ const discountedAmount = price ? _chunkLQ4DK4JFjs.applyDiscount.call(void 0, price.unitAmount, _chunkLQ4DK4JFjs.subscriptionDiscount.call(void 0, subscription)) : null;
1462
+ const period = `${_chunkLQ4DK4JFjs.formatDate.call(void 0, subscription.currentPeriodStart, fmt)} - ${_chunkLQ4DK4JFjs.formatDate.call(void 0, subscription.currentPeriodEnd, fmt)}`;
1430
1463
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1431
- _chunkTY5FYP3Gjs.TableRow,
1464
+ _chunkLQ4DK4JFjs.TableRow,
1432
1465
  {
1433
1466
  onClick: () => handleRowClick(subscription),
1434
1467
  className: "cursor-pointer hover:bg-muted/50",
1435
1468
  children: [
1436
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1469
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1437
1470
  SubscriptionStatusBadge,
1438
1471
  {
1439
1472
  status: subscription.status,
1440
1473
  cancelAtPeriodEnd: subscription.cancelAtPeriodEnd
1441
1474
  }
1442
1475
  ) }),
1443
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.TableCell, { className: "font-medium", children: formatPlanName3(price, t) }),
1444
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.TableCell, { className: "text-muted-foreground text-sm", children: period }),
1445
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.TableCell, { className: "text-end font-medium", children: amount }),
1446
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.TableCell, { className: "text-end", children: (subscription.status === "active" /* ACTIVE */ || subscription.status === "trialing" /* TRIALING */) && onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1447
- _chunkTY5FYP3Gjs.Button,
1476
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.TableCell, { className: "font-medium", children: formatPlanName3(price, t) }),
1477
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.TableCell, { className: "text-muted-foreground text-sm", children: period }),
1478
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.TableCell, { className: "text-end font-medium", children: discountedAmount !== null && price ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
1479
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "line-through text-muted-foreground me-2", children: amount }),
1480
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success", children: _chunkHKZAESS6js.formatCurrency.call(void 0, discountedAmount, price.currency, fmt) })
1481
+ ] }) : amount }),
1482
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.TableCell, { className: "text-end", children: (subscription.status === "active" /* ACTIVE */ || subscription.status === "trialing" /* TRIALING */) && onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1483
+ _chunkLQ4DK4JFjs.Button,
1448
1484
  {
1449
1485
  size: "sm",
1450
1486
  variant: "outline",
@@ -1483,23 +1519,35 @@ _chunk7QVYU63Ejs.__name.call(void 0, SubscriptionsList, "SubscriptionsList");
1483
1519
 
1484
1520
  // src/features/billing/stripe-subscription/components/containers/SubscriptionsContainer.tsx
1485
1521
 
1486
- function SubscriptionsContainer({ onOpenWizard, hasActiveRecurringSubscription }) {
1522
+ function SubscriptionsContainer({
1523
+ onOpenWizard,
1524
+ hasActiveRecurringSubscription,
1525
+ subscriptions: parentSubscriptions,
1526
+ onSubscriptionsChange
1527
+ }) {
1487
1528
  const t = _nextintl.useTranslations.call(void 0, );
1488
- const [subscriptions, setSubscriptions] = _react.useState.call(void 0, []);
1489
- const [loading, setLoading] = _react.useState.call(void 0, true);
1529
+ const isControlled = parentSubscriptions !== void 0;
1530
+ const [ownSubscriptions, setSubscriptions] = _react.useState.call(void 0, []);
1531
+ const [ownLoading, setLoading] = _react.useState.call(void 0, !isControlled);
1532
+ const subscriptions = _nullishCoalesce(parentSubscriptions, () => ( ownSubscriptions));
1533
+ const loading = isControlled ? false : ownLoading;
1490
1534
  const loadSubscriptions = _react.useCallback.call(void 0, async () => {
1535
+ if (isControlled) {
1536
+ _optionalChain([onSubscriptionsChange, 'optionalCall', _43 => _43()]);
1537
+ return;
1538
+ }
1491
1539
  setLoading(true);
1492
1540
  try {
1493
- const fetchedSubscriptions = await _chunkG6UE6MEPjs.StripeSubscriptionService.listSubscriptions();
1541
+ const fetchedSubscriptions = await _chunkHKZAESS6js.StripeSubscriptionService.listSubscriptions();
1494
1542
  setSubscriptions(fetchedSubscriptions);
1495
1543
  } catch (error) {
1496
1544
  console.error("[SubscriptionsContainer] Failed to load subscriptions:", error);
1497
1545
  } finally {
1498
1546
  setLoading(false);
1499
1547
  }
1500
- }, []);
1548
+ }, [isControlled, onSubscriptionsChange]);
1501
1549
  _react.useEffect.call(void 0, () => {
1502
- loadSubscriptions();
1550
+ if (!isControlled) loadSubscriptions();
1503
1551
  }, []);
1504
1552
  const criticalSubscriptions = subscriptions.filter(
1505
1553
  (sub) => sub.status === "past_due" /* PAST_DUE */ || sub.status === "trialing" /* TRIALING */ && sub.trialEnd && new Date(sub.trialEnd).getTime() - (/* @__PURE__ */ new Date()).getTime() <= 7 * 24 * 60 * 60 * 1e3
@@ -1513,7 +1561,7 @@ function SubscriptionsContainer({ onOpenWizard, hasActiveRecurringSubscription }
1513
1561
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8" }),
1514
1562
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: t("billing.ui.subscriptions.title") })
1515
1563
  ] }),
1516
- subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _43 => _43()]), children: hasActiveRecurringSubscription ? t("billing.ui.subscriptions.purchase_addons") : t("billing.ui.subscriptions.subscribe") })
1564
+ subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _44 => _44()]), children: hasActiveRecurringSubscription ? t("billing.ui.subscriptions.purchase_addons") : t("billing.ui.subscriptions.subscribe") })
1517
1565
  ] }),
1518
1566
  criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BillingAlertBanner, { subscription }, subscription.id)),
1519
1567
  subscriptions.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col items-center justify-center py-12 space-y-4", children: [
@@ -1521,7 +1569,7 @@ function SubscriptionsContainer({ onOpenWizard, hasActiveRecurringSubscription }
1521
1569
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
1522
1570
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium mb-2", children: t("billing.ui.subscriptions.empty_title") }),
1523
1571
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground mb-6", children: t("billing.ui.subscriptions.empty_description") }),
1524
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _44 => _44()]), children: t("billing.ui.subscriptions.subscribe") })
1572
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _45 => _45()]), children: t("billing.ui.subscriptions.subscribe") })
1525
1573
  ] })
1526
1574
  ] }),
1527
1575
  subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -1529,7 +1577,7 @@ function SubscriptionsContainer({ onOpenWizard, hasActiveRecurringSubscription }
1529
1577
  {
1530
1578
  subscriptions,
1531
1579
  onSubscriptionsChange: loadSubscriptions,
1532
- onChangePlan: (sub) => _optionalChain([onOpenWizard, 'optionalCall', _45 => _45(sub)])
1580
+ onChangePlan: (sub) => _optionalChain([onOpenWizard, 'optionalCall', _46 => _46(sub)])
1533
1581
  }
1534
1582
  )
1535
1583
  ] });
@@ -1544,9 +1592,9 @@ function IntervalToggle({ value, onChange, hasMonthly, hasYearly }) {
1544
1592
  if (!hasMonthly || !hasYearly) {
1545
1593
  return null;
1546
1594
  }
1547
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Tabs, { value, onValueChange: (v) => onChange(v), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.TabsList, { children: [
1548
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.TabsTrigger, { value: "month", children: t("billing.admin.prices.interval.month") }),
1549
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.TabsTrigger, { value: "year", children: t("billing.admin.prices.interval.year") })
1595
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Tabs, { value, onValueChange: (v) => onChange(v), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.TabsList, { children: [
1596
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.TabsTrigger, { value: "month", children: t("billing.admin.prices.interval.month") }),
1597
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.TabsTrigger, { value: "year", children: t("billing.admin.prices.interval.year") })
1550
1598
  ] }) });
1551
1599
  }
1552
1600
  _chunk7QVYU63Ejs.__name.call(void 0, IntervalToggle, "IntervalToggle");
@@ -1564,11 +1612,11 @@ function PricingCard({
1564
1612
  onSelect
1565
1613
  }) {
1566
1614
  const t = _nextintl.useTranslations.call(void 0, );
1567
- const fmt = _chunkTY5FYP3Gjs.useBillingFormatOptions.call(void 0, );
1615
+ const fmt = _chunkLQ4DK4JFjs.useBillingFormatOptions.call(void 0, );
1568
1616
  const description = price.description || price.nickname || t("billing.ui.pricing.standard");
1569
1617
  const features = price.features || [];
1570
- const formattedPrice = _chunkTY5FYP3Gjs.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt);
1571
- const interval = _chunkTY5FYP3Gjs.formatInterval.call(void 0, price, fmt);
1618
+ const formattedPrice = _chunkHKZAESS6js.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt);
1619
+ const interval = _chunkHKZAESS6js.formatInterval.call(void 0, price, fmt);
1572
1620
  const handleKeyDown = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (e) => {
1573
1621
  if ((e.key === "Enter" || e.key === " ") && !isDisabled && !isCurrentPlan) {
1574
1622
  e.preventDefault();
@@ -1581,7 +1629,7 @@ function PricingCard({
1581
1629
  }
1582
1630
  }, "handleClick");
1583
1631
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1584
- _chunkTY5FYP3Gjs.Card,
1632
+ _chunkLQ4DK4JFjs.Card,
1585
1633
  {
1586
1634
  role: "radio",
1587
1635
  "aria-checked": isSelected,
@@ -1589,7 +1637,7 @@ function PricingCard({
1589
1637
  tabIndex: isDisabled ? -1 : 0,
1590
1638
  onKeyDown: handleKeyDown,
1591
1639
  onClick: handleClick,
1592
- className: _chunkG6UE6MEPjs.cn.call(void 0,
1640
+ className: _chunkHKZAESS6js.cn.call(void 0,
1593
1641
  "relative cursor-pointer transition-all duration-200 flex flex-col h-full",
1594
1642
  "focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
1595
1643
  isCurrentPlan && "bg-muted/30",
@@ -1599,9 +1647,9 @@ function PricingCard({
1599
1647
  isLoading && "pointer-events-none"
1600
1648
  ),
1601
1649
  children: [
1602
- isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Badge, { variant: "secondary", className: "absolute top-2 end-2", children: t("billing.ui.pricing.current") }),
1603
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardHeader, { className: "pb-2", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium", children: description }) }),
1604
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.CardContent, { className: "pb-4 grow", children: [
1650
+ isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Badge, { variant: "secondary", className: "absolute top-2 end-2", children: t("billing.ui.pricing.current") }),
1651
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.CardHeader, { className: "pb-2", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium", children: description }) }),
1652
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.CardContent, { className: "pb-4 grow", children: [
1605
1653
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mb-4", children: [
1606
1654
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-3xl font-bold", children: formattedPrice }),
1607
1655
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground ms-1", children: interval })
@@ -1611,8 +1659,8 @@ function PricingCard({
1611
1659
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-muted-foreground", children: feature })
1612
1660
  ] }, index)) })
1613
1661
  ] }),
1614
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardFooter, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1615
- _chunkTY5FYP3Gjs.Button,
1662
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.CardFooter, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1663
+ _chunkLQ4DK4JFjs.Button,
1616
1664
  {
1617
1665
  variant: isCurrentPlan ? "secondary" : isSelected ? "default" : "outline",
1618
1666
  className: "w-full",
@@ -1645,7 +1693,7 @@ function ProductPricingRow({
1645
1693
  return null;
1646
1694
  }
1647
1695
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-3", children: [
1648
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.SectionHeader, { children: product.name }),
1696
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.SectionHeader, { children: product.name }),
1649
1697
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1650
1698
  "div",
1651
1699
  {
@@ -1681,11 +1729,11 @@ function getFilteredPrices(prices, selectedInterval) {
1681
1729
  return prices.filter((p) => p.priceType === "one_time");
1682
1730
  }
1683
1731
  const intervalPrices = prices.filter(
1684
- (p) => p.priceType === "recurring" && _optionalChain([p, 'access', _46 => _46.recurring, 'optionalAccess', _47 => _47.interval]) === selectedInterval
1732
+ (p) => p.priceType === "recurring" && _optionalChain([p, 'access', _47 => _47.recurring, 'optionalAccess', _48 => _48.interval]) === selectedInterval
1685
1733
  );
1686
1734
  if (intervalPrices.length === 0) {
1687
1735
  const fallbackInterval = selectedInterval === "month" ? "year" : "month";
1688
- return prices.filter((p) => p.priceType === "recurring" && _optionalChain([p, 'access', _48 => _48.recurring, 'optionalAccess', _49 => _49.interval]) === fallbackInterval);
1736
+ return prices.filter((p) => p.priceType === "recurring" && _optionalChain([p, 'access', _49 => _49.recurring, 'optionalAccess', _50 => _50.interval]) === fallbackInterval);
1689
1737
  }
1690
1738
  return intervalPrices;
1691
1739
  }
@@ -1746,15 +1794,15 @@ function ProductPricingList({
1746
1794
  _chunk7QVYU63Ejs.__name.call(void 0, ProductPricingList, "ProductPricingList");
1747
1795
  function ProductPricingListSkeleton() {
1748
1796
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "space-y-6", children: [1, 2].map((rowIndex) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-3", children: [
1749
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Skeleton, { className: "h-6 w-32" }),
1797
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Skeleton, { className: "h-6 w-32" }),
1750
1798
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4", children: [1, 2, 3].map((cardIndex) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "p-4 rounded-lg border animate-pulse space-y-3", children: [
1751
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Skeleton, { className: "h-6 w-24" }),
1752
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Skeleton, { className: "h-8 w-32" }),
1799
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Skeleton, { className: "h-6 w-24" }),
1800
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Skeleton, { className: "h-8 w-32" }),
1753
1801
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
1754
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Skeleton, { className: "h-4 w-full" }),
1755
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Skeleton, { className: "h-4 w-3/4" })
1802
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Skeleton, { className: "h-4 w-full" }),
1803
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Skeleton, { className: "h-4 w-3/4" })
1756
1804
  ] }),
1757
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Skeleton, { className: "h-10 w-full" })
1805
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Skeleton, { className: "h-10 w-full" })
1758
1806
  ] }, cardIndex)) })
1759
1807
  ] }, rowIndex)) });
1760
1808
  }
@@ -1765,21 +1813,21 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductPricingListSkeleton, "ProductPricing
1765
1813
 
1766
1814
  function ProrationPreview({ preview }) {
1767
1815
  const t = _nextintl.useTranslations.call(void 0, );
1768
- const fmt = _chunkTY5FYP3Gjs.useBillingFormatOptions.call(void 0, );
1816
+ const fmt = _chunkLQ4DK4JFjs.useBillingFormatOptions.call(void 0, );
1769
1817
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-primary/10 border-primary/30 rounded-lg border p-4", children: [
1770
1818
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "text-primary mb-3 font-semibold", children: t("billing.ui.proration.title") }),
1771
1819
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
1772
1820
  preview.lineItems.map((item, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between text-sm", children: [
1773
1821
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground", children: item.description }),
1774
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `font-medium ${item.amount < 0 ? "text-success" : "text-foreground"}`, children: _chunkTY5FYP3Gjs.formatCurrency.call(void 0, item.amount, preview.currency, fmt) })
1822
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `font-medium ${item.amount < 0 ? "text-success" : "text-foreground"}`, children: _chunkHKZAESS6js.formatCurrency.call(void 0, item.amount, preview.currency, fmt) })
1775
1823
  ] }, index)),
1776
1824
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border-primary/30 mt-2 border-t pt-2", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between font-semibold", children: [
1777
1825
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-foreground", children: t("billing.ui.proration.net_due_today") }),
1778
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-foreground", children: _chunkTY5FYP3Gjs.formatCurrency.call(void 0, preview.immediateCharge, preview.currency, fmt) })
1826
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-foreground", children: _chunkHKZAESS6js.formatCurrency.call(void 0, preview.immediateCharge, preview.currency, fmt) })
1779
1827
  ] }) }),
1780
1828
  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", {
1781
- date: _chunkTY5FYP3Gjs.formatDate.call(void 0, preview.lineItems[0].period.end, fmt),
1782
- amount: _chunkTY5FYP3Gjs.formatCurrency.call(void 0, preview.amountDue, preview.currency, fmt)
1829
+ date: _chunkLQ4DK4JFjs.formatDate.call(void 0, preview.lineItems[0].period.end, fmt),
1830
+ amount: _chunkHKZAESS6js.formatCurrency.call(void 0, preview.amountDue, preview.currency, fmt)
1783
1831
  }) })
1784
1832
  ] })
1785
1833
  ] });
@@ -1792,9 +1840,9 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProrationPreview, "ProrationPreview");
1792
1840
 
1793
1841
  function SubscriptionConfirmation({ price, isLoading, onConfirm, onCancel }) {
1794
1842
  const t = _nextintl.useTranslations.call(void 0, );
1795
- const fmt = _chunkTY5FYP3Gjs.useBillingFormatOptions.call(void 0, );
1796
- const productName = _optionalChain([price, 'access', _50 => _50.product, 'optionalAccess', _51 => _51.name]) || price.nickname || t("billing.ui.wizard.review.selected_plan");
1797
- const productDescription = _optionalChain([price, 'access', _52 => _52.product, 'optionalAccess', _53 => _53.description]) || price.description;
1843
+ const fmt = _chunkLQ4DK4JFjs.useBillingFormatOptions.call(void 0, );
1844
+ const productName = _optionalChain([price, 'access', _51 => _51.product, 'optionalAccess', _52 => _52.name]) || price.nickname || t("billing.ui.wizard.review.selected_plan");
1845
+ const productDescription = _optionalChain([price, 'access', _53 => _53.product, 'optionalAccess', _54 => _54.description]) || price.description;
1798
1846
  const features = price.features || [];
1799
1847
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-accent/10 border border-accent/30 rounded-lg p-4", children: [
1800
1848
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "font-semibold mb-3", children: t("billing.ui.confirmation.title") }),
@@ -1804,16 +1852,16 @@ function SubscriptionConfirmation({ price, isLoading, onConfirm, onCancel }) {
1804
1852
  productDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-sm text-muted-foreground", children: productDescription })
1805
1853
  ] }),
1806
1854
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-lg font-semibold", children: [
1807
- _chunkTY5FYP3Gjs.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt),
1808
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-normal text-muted-foreground", children: _chunkTY5FYP3Gjs.formatInterval.call(void 0, price, fmt) })
1855
+ _chunkHKZAESS6js.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt),
1856
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-normal text-muted-foreground", children: _chunkHKZAESS6js.formatInterval.call(void 0, price, fmt) })
1809
1857
  ] }),
1810
1858
  features.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "space-y-1", children: features.map((feature, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2 text-sm ", children: [
1811
1859
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Check, { className: "h-4 w-4 text-primary" }),
1812
1860
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: feature })
1813
1861
  ] }, index)) }),
1814
1862
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-3 pt-2 border-t border-accent/30", children: [
1815
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Button, { variant: "outline", onClick: onCancel, disabled: isLoading, children: t("ui.buttons.cancel") }),
1816
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Button, { onClick: onConfirm, disabled: isLoading, children: isLoading ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
1863
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Button, { variant: "outline", onClick: onCancel, disabled: isLoading, children: t("ui.buttons.cancel") }),
1864
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Button, { onClick: onConfirm, disabled: isLoading, children: isLoading ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
1817
1865
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "h-4 w-4 animate-spin me-2" }),
1818
1866
  t("billing.ui.wizard.review.processing")
1819
1867
  ] }) : t("billing.ui.confirmation.subscribe") })
@@ -1831,6 +1879,115 @@ _chunk7QVYU63Ejs.__name.call(void 0, SubscriptionConfirmation, "SubscriptionConf
1831
1879
 
1832
1880
 
1833
1881
  var _uuid = require('uuid');
1882
+
1883
+ // src/features/billing/stripe-subscription/hooks/wizard-promotion.ts
1884
+ function promotionCodeToSend(code) {
1885
+ if (!code) return void 0;
1886
+ return code.promotionCodeId;
1887
+ }
1888
+ _chunk7QVYU63Ejs.__name.call(void 0, promotionCodeToSend, "promotionCodeToSend");
1889
+ function shouldLookUpAutomatic(code) {
1890
+ return !code || code.automatic === true;
1891
+ }
1892
+ _chunk7QVYU63Ejs.__name.call(void 0, shouldLookUpAutomatic, "shouldLookUpAutomatic");
1893
+ function errorStatus(error) {
1894
+ return _nullishCoalesce(_optionalChain([error, 'optionalAccess', _55 => _55.status]), () => ( _optionalChain([error, 'optionalAccess', _56 => _56.response, 'optionalAccess', _57 => _57.status])));
1895
+ }
1896
+ _chunk7QVYU63Ejs.__name.call(void 0, errorStatus, "errorStatus");
1897
+ function errorCode(error) {
1898
+ const body = _optionalChain([error, 'optionalAccess', _58 => _58.body]);
1899
+ const first = _optionalChain([body, 'optionalAccess', _59 => _59.errors, 'optionalAccess', _60 => _60[0]]);
1900
+ const code = _nullishCoalesce(_nullishCoalesce(_optionalChain([first, 'optionalAccess', _61 => _61.code]), () => ( _optionalChain([first, 'optionalAccess', _62 => _62.meta, 'optionalAccess', _63 => _63.context, 'optionalAccess', _64 => _64.code]))), () => ( _optionalChain([body, 'optionalAccess', _65 => _65.code])));
1901
+ return typeof code === "string" ? code : void 0;
1902
+ }
1903
+ _chunk7QVYU63Ejs.__name.call(void 0, errorCode, "errorCode");
1904
+ function isDiscountSoldOut(error) {
1905
+ return errorStatus(error) === 410 && errorCode(error) === "discount_sold_out";
1906
+ }
1907
+ _chunk7QVYU63Ejs.__name.call(void 0, isDiscountSoldOut, "isDiscountSoldOut");
1908
+ function isDiscountUnavailable(error) {
1909
+ return errorStatus(error) === 422 && errorCode(error) === "discount_unavailable";
1910
+ }
1911
+ _chunk7QVYU63Ejs.__name.call(void 0, isDiscountUnavailable, "isDiscountUnavailable");
1912
+
1913
+ // src/features/billing/stripe-subscription/hooks/useConfirmSubscriptionPayment.ts
1914
+
1915
+
1916
+
1917
+ function useConfirmSubscriptionPayment() {
1918
+ const stripe = _reactstripejs.useStripe.call(void 0, );
1919
+ const t = _nextintl.useTranslations.call(void 0, );
1920
+ const [isConfirming, setIsConfirming] = _react.useState.call(void 0, false);
1921
+ const confirmPayment = _react.useCallback.call(void 0,
1922
+ async (clientSecret) => {
1923
+ if (!stripe) {
1924
+ console.error("[useConfirmSubscriptionPayment] Stripe not initialized");
1925
+ return {
1926
+ success: false,
1927
+ error: t("billing.ui.payment_confirm.errors.not_initialized")
1928
+ };
1929
+ }
1930
+ if (!clientSecret) {
1931
+ console.error("[useConfirmSubscriptionPayment] No client secret provided");
1932
+ return {
1933
+ success: false,
1934
+ error: t("billing.ui.payment_confirm.errors.missing_details")
1935
+ };
1936
+ }
1937
+ setIsConfirming(true);
1938
+ try {
1939
+ const { error: stripeError, paymentIntent } = await stripe.confirmCardPayment(clientSecret);
1940
+ if (stripeError) {
1941
+ console.error("[useConfirmSubscriptionPayment] Stripe error:", stripeError);
1942
+ return {
1943
+ success: false,
1944
+ error: stripeError.message || t("billing.ui.payment_confirm.errors.failed")
1945
+ };
1946
+ }
1947
+ if (_optionalChain([paymentIntent, 'optionalAccess', _66 => _66.status]) === "succeeded") {
1948
+ return { success: true };
1949
+ }
1950
+ if (_optionalChain([paymentIntent, 'optionalAccess', _67 => _67.status]) === "requires_action") {
1951
+ return {
1952
+ success: false,
1953
+ error: t("billing.ui.payment_confirm.errors.requires_action")
1954
+ };
1955
+ }
1956
+ return {
1957
+ success: false,
1958
+ error: t("billing.ui.payment_confirm.errors.not_completed")
1959
+ };
1960
+ } catch (err) {
1961
+ console.error("[useConfirmSubscriptionPayment] Unexpected error:", err);
1962
+ return {
1963
+ success: false,
1964
+ error: err.message || t("billing.ui.payment_confirm.errors.unexpected")
1965
+ };
1966
+ } finally {
1967
+ setIsConfirming(false);
1968
+ }
1969
+ },
1970
+ [stripe, t]
1971
+ );
1972
+ return {
1973
+ confirmPayment,
1974
+ isConfirming
1975
+ };
1976
+ }
1977
+ _chunk7QVYU63Ejs.__name.call(void 0, useConfirmSubscriptionPayment, "useConfirmSubscriptionPayment");
1978
+
1979
+ // src/features/billing/stripe-subscription/hooks/wizard-payment.ts
1980
+ function clientSecretToConfirm(meta) {
1981
+ if (!_optionalChain([meta, 'optionalAccess', _68 => _68.requiresAction])) return null;
1982
+ return meta.clientSecret || null;
1983
+ }
1984
+ _chunk7QVYU63Ejs.__name.call(void 0, clientSecretToConfirm, "clientSecretToConfirm");
1985
+ function subscriptionIdToSync(answered, opened) {
1986
+ return _optionalChain([answered, 'optionalAccess', _69 => _69.id]) || _optionalChain([opened, 'optionalAccess', _70 => _70.id]) || null;
1987
+ }
1988
+ _chunk7QVYU63Ejs.__name.call(void 0, subscriptionIdToSync, "subscriptionIdToSync");
1989
+
1990
+ // src/features/billing/stripe-subscription/hooks/useSubscriptionWizard.ts
1834
1991
  var initialState = {
1835
1992
  step: "plan-selection",
1836
1993
  selectedPrice: null,
@@ -1877,10 +2034,11 @@ function wizardReducer(state, action) {
1877
2034
  _chunk7QVYU63Ejs.__name.call(void 0, wizardReducer, "wizardReducer");
1878
2035
  function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
1879
2036
  const t = _nextintl.useTranslations.call(void 0, );
1880
- const locale = _chunkG6UE6MEPjs.useI18nLocale.call(void 0, );
2037
+ const locale = _chunkHKZAESS6js.useI18nLocale.call(void 0, );
2038
+ const { confirmPayment } = useConfirmSubscriptionPayment();
1881
2039
  const [state, dispatch] = _react.useReducer.call(void 0, wizardReducer, {
1882
2040
  ...initialState,
1883
- selectedPrice: _optionalChain([subscription, 'optionalAccess', _54 => _54.price]) || null
2041
+ selectedPrice: _optionalChain([subscription, 'optionalAccess', _71 => _71.price]) || null
1884
2042
  });
1885
2043
  const onSuccessRef = _react.useRef.call(void 0, onSuccess);
1886
2044
  const onCloseRef = _react.useRef.call(void 0, onClose);
@@ -1888,7 +2046,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
1888
2046
  onCloseRef.current = onClose;
1889
2047
  const checkPaymentMethod = _react.useCallback.call(void 0, async () => {
1890
2048
  try {
1891
- const methods = await _chunkG6UE6MEPjs.StripeCustomerService.listPaymentMethods();
2049
+ const methods = await _chunkHKZAESS6js.StripeCustomerService.listPaymentMethods();
1892
2050
  dispatch({ type: "SET_HAS_PAYMENT_METHOD", hasMethod: methods.length > 0 });
1893
2051
  } catch (error) {
1894
2052
  console.error("[useSubscriptionWizard] Failed to check payment methods:", error);
@@ -1904,15 +2062,39 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
1904
2062
  const goToStep = _react.useCallback.call(void 0, (step) => {
1905
2063
  dispatch({ type: "SET_STEP", step });
1906
2064
  }, []);
2065
+ const lookUpAutomaticCode = _react.useCallback.call(void 0, async (priceId) => {
2066
+ try {
2067
+ const automaticCode = await _chunkHKZAESS6js.StripeCouponCodeService.findAutomatic({ priceId });
2068
+ dispatch({
2069
+ type: "SET_PROMOTION_CODE",
2070
+ code: automaticCode ? _chunkHKZAESS6js.toPromotionCodeResult.call(void 0, automaticCode) : null
2071
+ });
2072
+ return true;
2073
+ } catch (error) {
2074
+ console.error("[useSubscriptionWizard] Failed to look up the automatic promotion code:", error);
2075
+ dispatch({ type: "SET_PROMOTION_CODE", code: null });
2076
+ return false;
2077
+ }
2078
+ }, []);
2079
+ const refreshAutomaticCodeOrLeaveReview = _react.useCallback.call(void 0,
2080
+ async (priceId) => {
2081
+ const found = await lookUpAutomaticCode(priceId);
2082
+ if (!found) {
2083
+ dispatch({ type: "SET_STEP", step: "plan-selection" });
2084
+ dispatch({ type: "SET_ERROR", error: t("billing.ui.wizard.errors.prepare_review") });
2085
+ }
2086
+ },
2087
+ [lookUpAutomaticCode, t]
2088
+ );
1907
2089
  const goToReview = _react.useCallback.call(void 0, async () => {
1908
2090
  if (!state.selectedPrice) return;
1909
2091
  dispatch({ type: "SET_PROCESSING", isProcessing: true });
1910
2092
  try {
1911
2093
  await checkPaymentMethod();
1912
- const isTrialUpgrade = _optionalChain([subscription, 'optionalAccess', _55 => _55.status]) === "trialing" /* TRIALING */;
2094
+ const isTrialUpgrade = _optionalChain([subscription, 'optionalAccess', _72 => _72.status]) === "trialing" /* TRIALING */;
1913
2095
  dispatch({ type: "SET_IS_TRIAL_SUBSCRIPTION", isTrial: isTrialUpgrade });
1914
2096
  if (isTrialUpgrade && !state.hasPaymentMethod) {
1915
- const methods = await _chunkG6UE6MEPjs.StripeCustomerService.listPaymentMethods();
2097
+ const methods = await _chunkHKZAESS6js.StripeCustomerService.listPaymentMethods();
1916
2098
  if (methods.length === 0) {
1917
2099
  dispatch({ type: "SET_STEP", step: "payment-method" });
1918
2100
  dispatch({
@@ -1922,8 +2104,15 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
1922
2104
  return;
1923
2105
  }
1924
2106
  }
1925
- if (subscription && state.selectedPrice.id !== _optionalChain([subscription, 'access', _56 => _56.price, 'optionalAccess', _57 => _57.id])) {
1926
- const preview = await _chunkG6UE6MEPjs.StripeSubscriptionService.getProrationPreview({
2107
+ if (shouldLookUpAutomatic(state.promotionCode)) {
2108
+ const found = await lookUpAutomaticCode(state.selectedPrice.id);
2109
+ if (!found) {
2110
+ dispatch({ type: "SET_ERROR", error: t("billing.ui.wizard.errors.prepare_review") });
2111
+ return;
2112
+ }
2113
+ }
2114
+ if (subscription && state.selectedPrice.id !== _optionalChain([subscription, 'access', _73 => _73.price, 'optionalAccess', _74 => _74.id])) {
2115
+ const preview = await _chunkHKZAESS6js.StripeSubscriptionService.getProrationPreview({
1927
2116
  subscriptionId: subscription.id,
1928
2117
  newPriceId: state.selectedPrice.id
1929
2118
  });
@@ -1932,55 +2121,94 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
1932
2121
  dispatch({ type: "SET_STEP", step: "review" });
1933
2122
  } catch (error) {
1934
2123
  console.error("[useSubscriptionWizard] Error preparing review:", error);
1935
- dispatch({ type: "SET_ERROR", error: _optionalChain([error, 'optionalAccess', _58 => _58.message]) || t("billing.ui.wizard.errors.prepare_review") });
2124
+ dispatch({ type: "SET_ERROR", error: _optionalChain([error, 'optionalAccess', _75 => _75.message]) || t("billing.ui.wizard.errors.prepare_review") });
1936
2125
  } finally {
1937
2126
  dispatch({ type: "SET_PROCESSING", isProcessing: false });
1938
2127
  }
1939
- }, [state.selectedPrice, state.hasPaymentMethod, subscription, checkPaymentMethod, t]);
2128
+ }, [
2129
+ state.selectedPrice,
2130
+ state.hasPaymentMethod,
2131
+ state.promotionCode,
2132
+ subscription,
2133
+ checkPaymentMethod,
2134
+ lookUpAutomaticCode,
2135
+ t
2136
+ ]);
1940
2137
  const confirmSubscription = _react.useCallback.call(void 0, async () => {
1941
2138
  if (!state.selectedPrice) return;
1942
2139
  dispatch({ type: "SET_PROCESSING", isProcessing: true });
1943
2140
  dispatch({ type: "SET_ERROR", error: null });
1944
2141
  try {
2142
+ let result;
1945
2143
  if (subscription) {
1946
2144
  const changePlanParams = {
1947
2145
  id: subscription.id,
1948
2146
  newPriceId: state.selectedPrice.id,
1949
- promotionCode: _optionalChain([state, 'access', _59 => _59.promotionCode, 'optionalAccess', _60 => _60.promotionCodeId])
2147
+ promotionCode: promotionCodeToSend(state.promotionCode)
1950
2148
  };
1951
- await _chunkG6UE6MEPjs.StripeSubscriptionService.changePlan(changePlanParams);
2149
+ result = await _chunkHKZAESS6js.StripeSubscriptionService.changePlanWithMeta(changePlanParams);
1952
2150
  } else {
1953
2151
  const createParams = {
1954
2152
  id: _uuid.v4.call(void 0, ),
1955
2153
  priceId: state.selectedPrice.id,
1956
- promotionCode: _optionalChain([state, 'access', _61 => _61.promotionCode, 'optionalAccess', _62 => _62.promotionCodeId])
2154
+ promotionCode: promotionCodeToSend(state.promotionCode)
1957
2155
  };
1958
- await _chunkG6UE6MEPjs.StripeSubscriptionService.createSubscription(createParams);
2156
+ result = await _chunkHKZAESS6js.StripeSubscriptionService.createSubscription(createParams);
2157
+ }
2158
+ const clientSecret = clientSecretToConfirm(result.meta);
2159
+ if (clientSecret) {
2160
+ const confirmation = await confirmPayment(clientSecret);
2161
+ if (!confirmation.success) {
2162
+ console.error("[useSubscriptionWizard] Payment not confirmed:", confirmation.error);
2163
+ dispatch({
2164
+ type: "SET_ERROR",
2165
+ error: t("billing.ui.wizard.errors.payment_not_confirmed", { reason: _nullishCoalesce(confirmation.error, () => ( "")) })
2166
+ });
2167
+ return;
2168
+ }
2169
+ const subscriptionId = subscriptionIdToSync(result.subscription, subscription);
2170
+ if (subscriptionId) {
2171
+ try {
2172
+ await _chunkHKZAESS6js.StripeSubscriptionService.syncSubscription({ subscriptionId });
2173
+ } catch (syncError) {
2174
+ console.error("[useSubscriptionWizard] Subscription sync after payment failed:", syncError);
2175
+ }
2176
+ }
1959
2177
  }
1960
2178
  onSuccessRef.current();
1961
2179
  onCloseRef.current();
1962
2180
  } catch (error) {
1963
- if (_optionalChain([error, 'optionalAccess', _63 => _63.status]) === 409 || _optionalChain([error, 'optionalAccess', _64 => _64.response, 'optionalAccess', _65 => _65.status]) === 409) {
2181
+ const soldOut = isDiscountSoldOut(error);
2182
+ if (soldOut || isDiscountUnavailable(error)) {
2183
+ dispatch({
2184
+ type: "SET_ERROR",
2185
+ error: soldOut ? t("billing.ui.wizard.errors.discount_sold_out") : t("billing.ui.wizard.errors.discount_unavailable")
2186
+ });
2187
+ dispatch({ type: "SET_PROMOTION_CODE", code: null });
2188
+ await refreshAutomaticCodeOrLeaveReview(state.selectedPrice.id);
2189
+ return;
2190
+ }
2191
+ if (_optionalChain([error, 'optionalAccess', _76 => _76.status]) === 409 || _optionalChain([error, 'optionalAccess', _77 => _77.response, 'optionalAccess', _78 => _78.status]) === 409) {
1964
2192
  dispatch({
1965
2193
  type: "SET_ERROR",
1966
2194
  error: t("billing.ui.wizard.errors.already_subscribed")
1967
2195
  });
1968
2196
  return;
1969
2197
  }
1970
- if (_optionalChain([error, 'optionalAccess', _66 => _66.status]) === 402 || _optionalChain([error, 'optionalAccess', _67 => _67.response, 'optionalAccess', _68 => _68.status]) === 402) {
2198
+ if (_optionalChain([error, 'optionalAccess', _79 => _79.status]) === 402 || _optionalChain([error, 'optionalAccess', _80 => _80.response, 'optionalAccess', _81 => _81.status]) === 402) {
1971
2199
  dispatch({ type: "SET_HAS_PAYMENT_METHOD", hasMethod: false });
1972
2200
  dispatch({ type: "SET_STEP", step: "payment-method" });
1973
2201
  return;
1974
2202
  }
1975
- dispatch({ type: "SET_ERROR", error: _optionalChain([error, 'optionalAccess', _69 => _69.message]) || t("billing.ui.wizard.errors.process_subscription") });
2203
+ dispatch({ type: "SET_ERROR", error: _optionalChain([error, 'optionalAccess', _82 => _82.message]) || t("billing.ui.wizard.errors.process_subscription") });
1976
2204
  } finally {
1977
2205
  dispatch({ type: "SET_PROCESSING", isProcessing: false });
1978
2206
  }
1979
- }, [state.selectedPrice, state.promotionCode, subscription, t]);
2207
+ }, [state.selectedPrice, state.promotionCode, subscription, refreshAutomaticCodeOrLeaveReview, confirmPayment, t]);
1980
2208
  const handlePaymentMethodSuccess = _react.useCallback.call(void 0, async () => {
1981
2209
  dispatch({ type: "SET_HAS_PAYMENT_METHOD", hasMethod: true });
1982
- dispatch({ type: "SET_STEP", step: "review" });
1983
- }, []);
2210
+ await goToReview();
2211
+ }, [goToReview]);
1984
2212
  const reset = _react.useCallback.call(void 0, () => {
1985
2213
  dispatch({ type: "RESET" });
1986
2214
  }, []);
@@ -1989,9 +2217,9 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
1989
2217
  dispatch({ type: "SET_VALIDATING_PROMO_CODE", isValidating: true });
1990
2218
  dispatch({ type: "SET_PROMO_CODE_ERROR", error: null });
1991
2219
  try {
1992
- const result = await _chunkG6UE6MEPjs.StripePromotionCodeService.validatePromotionCode({
2220
+ const result = await _chunkHKZAESS6js.StripePromotionCodeService.validatePromotionCode({
1993
2221
  code,
1994
- stripePriceId: _optionalChain([state, 'access', _70 => _70.selectedPrice, 'optionalAccess', _71 => _71.id]),
2222
+ stripePriceId: _optionalChain([state, 'access', _83 => _83.selectedPrice, 'optionalAccess', _84 => _84.id]),
1995
2223
  language: locale
1996
2224
  });
1997
2225
  if (result.valid) {
@@ -2006,19 +2234,26 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
2006
2234
  console.error("[useSubscriptionWizard] Promo code validation error:", error);
2007
2235
  dispatch({
2008
2236
  type: "SET_PROMO_CODE_ERROR",
2009
- error: _optionalChain([error, 'optionalAccess', _72 => _72.message]) || t("billing.ui.wizard.errors.validate_promo_code")
2237
+ error: _optionalChain([error, 'optionalAccess', _85 => _85.message]) || t("billing.ui.wizard.errors.validate_promo_code")
2010
2238
  });
2011
2239
  } finally {
2012
2240
  dispatch({ type: "SET_VALIDATING_PROMO_CODE", isValidating: false });
2013
2241
  }
2014
2242
  },
2015
- [_optionalChain([state, 'access', _73 => _73.selectedPrice, 'optionalAccess', _74 => _74.id]), t, locale]
2243
+ [_optionalChain([state, 'access', _86 => _86.selectedPrice, 'optionalAccess', _87 => _87.id]), t, locale]
2016
2244
  );
2017
- const clearPromoCode = _react.useCallback.call(void 0, () => {
2245
+ const clearPromoCode = _react.useCallback.call(void 0, async () => {
2018
2246
  dispatch({ type: "SET_PROMOTION_CODE", code: null });
2019
2247
  dispatch({ type: "SET_PROMO_CODE_ERROR", error: null });
2020
2248
  dispatch({ type: "SET_ERROR", error: null });
2021
- }, []);
2249
+ if (!state.selectedPrice) return;
2250
+ dispatch({ type: "SET_PROCESSING", isProcessing: true });
2251
+ try {
2252
+ await refreshAutomaticCodeOrLeaveReview(state.selectedPrice.id);
2253
+ } finally {
2254
+ dispatch({ type: "SET_PROCESSING", isProcessing: false });
2255
+ }
2256
+ }, [state.selectedPrice, refreshAutomaticCodeOrLeaveReview]);
2022
2257
  const actions = _react.useMemo.call(void 0,
2023
2258
  () => ({
2024
2259
  selectPrice,
@@ -2107,7 +2342,7 @@ function WizardStepPlanSelection({
2107
2342
  _react.useEffect.call(void 0, () => {
2108
2343
  const loadProducts = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
2109
2344
  try {
2110
- const fetchedProducts = await _chunkG6UE6MEPjs.StripeProductService.listProducts({ active: true });
2345
+ const fetchedProducts = await _chunkHKZAESS6js.StripeProductService.listProducts({ active: true });
2111
2346
  setProducts(fetchedProducts);
2112
2347
  } catch (error) {
2113
2348
  console.error("[WizardStepPlanSelection] Failed to load products:", error);
@@ -2122,10 +2357,10 @@ function WizardStepPlanSelection({
2122
2357
  let hasYearly2 = false;
2123
2358
  for (const product of products) {
2124
2359
  for (const price of product.stripePrices || []) {
2125
- if (price.priceType === "recurring" && _optionalChain([price, 'access', _75 => _75.recurring, 'optionalAccess', _76 => _76.interval]) === "month") {
2360
+ if (price.priceType === "recurring" && _optionalChain([price, 'access', _88 => _88.recurring, 'optionalAccess', _89 => _89.interval]) === "month") {
2126
2361
  hasMonthly2 = true;
2127
2362
  }
2128
- if (price.priceType === "recurring" && _optionalChain([price, 'access', _77 => _77.recurring, 'optionalAccess', _78 => _78.interval]) === "year") {
2363
+ if (price.priceType === "recurring" && _optionalChain([price, 'access', _90 => _90.recurring, 'optionalAccess', _91 => _91.interval]) === "year") {
2129
2364
  hasYearly2 = true;
2130
2365
  }
2131
2366
  }
@@ -2151,14 +2386,14 @@ function WizardStepPlanSelection({
2151
2386
  products,
2152
2387
  selectedInterval,
2153
2388
  currentPriceId,
2154
- selectedPriceId: _optionalChain([selectedPrice, 'optionalAccess', _79 => _79.id]),
2389
+ selectedPriceId: _optionalChain([selectedPrice, 'optionalAccess', _92 => _92.id]),
2155
2390
  loading,
2156
2391
  hideRecurringPrices,
2157
2392
  hideOneTimePrices,
2158
2393
  onSelectPrice: handleSelectPrice
2159
2394
  }
2160
2395
  ),
2161
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex justify-end pt-4 border-t", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Button, { onClick: onNext, disabled: !selectedPrice || isProcessing, children: isProcessing ? t("common.loading") : t("billing.ui.wizard.next_review") }) })
2396
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex justify-end pt-4 border-t", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Button, { onClick: onNext, disabled: !selectedPrice || isProcessing, children: isProcessing ? t("common.loading") : t("billing.ui.wizard.next_review") }) })
2162
2397
  ] });
2163
2398
  }
2164
2399
  _chunk7QVYU63Ejs.__name.call(void 0, WizardStepPlanSelection, "WizardStepPlanSelection");
@@ -2167,6 +2402,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, WizardStepPlanSelection, "WizardStepPlanSel
2167
2402
 
2168
2403
 
2169
2404
 
2405
+
2170
2406
  // src/features/billing/stripe-promotion-code/components/PromoCodeInput.tsx
2171
2407
 
2172
2408
 
@@ -2181,8 +2417,18 @@ function PromoCodeInput({
2181
2417
  disabled = false
2182
2418
  }) {
2183
2419
  const t = _nextintl.useTranslations.call(void 0, );
2184
- const locale = _chunkG6UE6MEPjs.useI18nLocale.call(void 0, );
2420
+ const locale = _chunkHKZAESS6js.useI18nLocale.call(void 0, );
2185
2421
  const [code, setCode] = _react.useState.call(void 0, "");
2422
+ const appliedKey = _optionalChain([appliedCode, 'optionalAccess', _93 => _93.valid]) ? `${appliedCode.automatic ? "auto" : "typed"}:${_nullishCoalesce(appliedCode.code, () => ( ""))}` : null;
2423
+ const [previousAppliedKey, setPreviousAppliedKey] = _react.useState.call(void 0, appliedKey);
2424
+ if (appliedKey !== previousAppliedKey) {
2425
+ setPreviousAppliedKey(appliedKey);
2426
+ if (appliedKey !== null) setCode("");
2427
+ }
2428
+ const handleRemove = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
2429
+ setCode("");
2430
+ onRemove();
2431
+ }, "handleRemove");
2186
2432
  const handleApply = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
2187
2433
  if (code.trim()) {
2188
2434
  onApply(code.trim().toUpperCase());
@@ -2199,8 +2445,8 @@ function PromoCodeInput({
2199
2445
  return t("billing.ui.wizard.review.percent_off", { value: String(result.discountValue) });
2200
2446
  }
2201
2447
  const amount = (result.discountValue || 0) / 100;
2202
- const currency = _optionalChain([result, 'access', _80 => _80.currency, 'optionalAccess', _81 => _81.toUpperCase, 'call', _82 => _82()]) || "USD";
2203
- return t("billing.ui.wizard.review.amount_off", { amount: `${currency} ${_chunkTY5FYP3Gjs.formatFixed.call(void 0, amount, locale, 2)}` });
2448
+ const currency = _optionalChain([result, 'access', _94 => _94.currency, 'optionalAccess', _95 => _95.toUpperCase, 'call', _96 => _96()]) || "USD";
2449
+ return t("billing.ui.wizard.review.amount_off", { amount: `${currency} ${_chunkHKZAESS6js.formatFixed.call(void 0, amount, locale, 2)}` });
2204
2450
  }, "formatDiscount");
2205
2451
  const formatDuration = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (result) => {
2206
2452
  switch (result.duration) {
@@ -2214,7 +2460,40 @@ function PromoCodeInput({
2214
2460
  return "";
2215
2461
  }
2216
2462
  }, "formatDuration");
2217
- if (_optionalChain([appliedCode, 'optionalAccess', _83 => _83.valid])) {
2463
+ const codeInput = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
2464
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
2465
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2466
+ _chunkLQ4DK4JFjs.Input,
2467
+ {
2468
+ placeholder: t("billing.ui.promo_code.placeholder"),
2469
+ value: code,
2470
+ onChange: (e) => setCode(e.target.value.toUpperCase()),
2471
+ onKeyDown: handleKeyDown,
2472
+ disabled: disabled || isValidating,
2473
+ className: "flex-1"
2474
+ }
2475
+ ),
2476
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Button, { variant: "outline", onClick: handleApply, disabled: disabled || isValidating || !code.trim(), children: isValidating ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "h-4 w-4 animate-spin" }) : t("billing.ui.promo_code.apply") })
2477
+ ] }),
2478
+ error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error })
2479
+ ] });
2480
+ if (_optionalChain([appliedCode, 'optionalAccess', _97 => _97.valid]) && appliedCode.automatic) {
2481
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-3", children: [
2482
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
2483
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-success/15 border-success/30 flex items-center gap-2 rounded-lg border p-3", children: [
2484
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Check, { className: "text-success h-4 w-4" }),
2485
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success font-medium", children: t("billing.ui.promo_code.automatic_label") }),
2486
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success text-sm", children: formatDiscount(appliedCode) })
2487
+ ] }),
2488
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-success text-sm", children: formatDuration(appliedCode) })
2489
+ ] }),
2490
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
2491
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-sm", children: t("billing.ui.promo_code.use_different") }),
2492
+ codeInput
2493
+ ] })
2494
+ ] });
2495
+ }
2496
+ if (_optionalChain([appliedCode, 'optionalAccess', _98 => _98.valid])) {
2218
2497
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
2219
2498
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-success/15 border-success/30 flex items-center justify-between rounded-lg border p-3", children: [
2220
2499
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
@@ -2223,11 +2502,11 @@ function PromoCodeInput({
2223
2502
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success text-sm", children: formatDiscount(appliedCode) })
2224
2503
  ] }),
2225
2504
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2226
- _chunkTY5FYP3Gjs.Button,
2505
+ _chunkLQ4DK4JFjs.Button,
2227
2506
  {
2228
2507
  variant: "ghost",
2229
2508
  size: "sm",
2230
- onClick: onRemove,
2509
+ onClick: handleRemove,
2231
2510
  disabled,
2232
2511
  className: "text-success hover:bg-success/25 hover:text-success",
2233
2512
  children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.X, { className: "h-4 w-4" })
@@ -2237,26 +2516,20 @@ function PromoCodeInput({
2237
2516
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-success text-sm", children: formatDuration(appliedCode) })
2238
2517
  ] });
2239
2518
  }
2240
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
2241
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
2242
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2243
- _chunkTY5FYP3Gjs.Input,
2244
- {
2245
- placeholder: t("billing.ui.promo_code.placeholder"),
2246
- value: code,
2247
- onChange: (e) => setCode(e.target.value.toUpperCase()),
2248
- onKeyDown: handleKeyDown,
2249
- disabled: disabled || isValidating,
2250
- className: "flex-1"
2251
- }
2252
- ),
2253
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Button, { variant: "outline", onClick: handleApply, disabled: disabled || isValidating || !code.trim(), children: isValidating ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "h-4 w-4 animate-spin" }) : t("billing.ui.promo_code.apply") })
2254
- ] }),
2255
- error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error })
2256
- ] });
2519
+ return codeInput;
2257
2520
  }
2258
2521
  _chunk7QVYU63Ejs.__name.call(void 0, PromoCodeInput, "PromoCodeInput");
2259
2522
 
2523
+ // src/features/billing/stripe-subscription/components/wizards/review-card.ts
2524
+ function reviewCard(methods, defaultPaymentMethodId) {
2525
+ if (!methods || methods.length === 0) return null;
2526
+ const method = defaultPaymentMethodId && methods.find((m) => m.id === defaultPaymentMethodId) || methods[0];
2527
+ if (!_optionalChain([method, 'access', _99 => _99.card, 'optionalAccess', _100 => _100.last4])) return null;
2528
+ const brand = method.card.brand ? method.card.brand.charAt(0).toUpperCase() + method.card.brand.slice(1) : method.type.charAt(0).toUpperCase() + method.type.slice(1);
2529
+ return { brand, last4: method.card.last4 };
2530
+ }
2531
+ _chunk7QVYU63Ejs.__name.call(void 0, reviewCard, "reviewCard");
2532
+
2260
2533
  // src/features/billing/stripe-subscription/components/wizards/WizardStepReview.tsx
2261
2534
 
2262
2535
  function WizardStepReview({
@@ -2277,67 +2550,63 @@ function WizardStepReview({
2277
2550
  isTrialUpgrade
2278
2551
  }) {
2279
2552
  const t = _nextintl.useTranslations.call(void 0, );
2280
- const fmt = _chunkTY5FYP3Gjs.useBillingFormatOptions.call(void 0, );
2553
+ const fmt = _chunkLQ4DK4JFjs.useBillingFormatOptions.call(void 0, );
2554
+ const [card, setCard] = _react.useState.call(void 0, null);
2555
+ _react.useEffect.call(void 0, () => {
2556
+ if (!hasPaymentMethod) {
2557
+ setCard(null);
2558
+ return;
2559
+ }
2560
+ let cancelled = false;
2561
+ Promise.all([_chunkHKZAESS6js.StripeCustomerService.listPaymentMethods(), _chunkHKZAESS6js.StripeCustomerService.getCustomer()]).then(([methods, customer]) => {
2562
+ if (!cancelled) setCard(reviewCard(methods, _optionalChain([customer, 'optionalAccess', _101 => _101.defaultPaymentMethodId])));
2563
+ }).catch((err) => {
2564
+ console.error("[WizardStepReview] Failed to load the card on file:", err);
2565
+ if (!cancelled) setCard(null);
2566
+ });
2567
+ return () => {
2568
+ cancelled = true;
2569
+ };
2570
+ }, [hasPaymentMethod]);
2281
2571
  if (!selectedPrice) {
2282
2572
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-center py-8 text-muted-foreground", children: t("billing.ui.wizard.review.no_plan") });
2283
2573
  }
2284
- const isChangingPlan = subscription && _optionalChain([subscription, 'access', _84 => _84.price, 'optionalAccess', _85 => _85.id]) !== selectedPrice.id;
2574
+ const isChangingPlan = subscription && _optionalChain([subscription, 'access', _102 => _102.price, 'optionalAccess', _103 => _103.id]) !== selectedPrice.id;
2285
2575
  const formatInterval2 = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (price) => {
2286
2576
  if (price.priceType === "one_time") return t("billing.ui.wizard.review.interval_one_time");
2287
- const interval = _optionalChain([price, 'access', _86 => _86.recurring, 'optionalAccess', _87 => _87.interval]) || "month";
2577
+ const interval = _optionalChain([price, 'access', _104 => _104.recurring, 'optionalAccess', _105 => _105.interval]) || "month";
2288
2578
  return interval === "year" ? t("billing.ui.wizard.review.interval_yearly") : t("billing.ui.wizard.review.interval_monthly");
2289
2579
  }, "formatInterval");
2290
- const calculateDiscountedPrice = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
2291
- if (!_optionalChain([promotionCode, 'optionalAccess', _88 => _88.valid]) || !selectedPrice.unitAmount) return null;
2292
- const originalPrice = selectedPrice.unitAmount;
2293
- if (promotionCode.discountType === "percent_off" && promotionCode.discountValue) {
2294
- return originalPrice * (1 - promotionCode.discountValue / 100);
2295
- }
2296
- if (promotionCode.discountType === "amount_off" && promotionCode.discountValue) {
2297
- return Math.max(0, originalPrice - promotionCode.discountValue);
2298
- }
2299
- return null;
2300
- }, "calculateDiscountedPrice");
2301
- const discountedPrice = calculateDiscountedPrice();
2302
- const calculateDiscountedImmediateCharge = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
2303
- if (!_optionalChain([promotionCode, 'optionalAccess', _89 => _89.valid]) || !_optionalChain([prorationPreview, 'optionalAccess', _90 => _90.immediateCharge])) return null;
2304
- const originalCharge = prorationPreview.immediateCharge;
2305
- if (promotionCode.discountType === "percent_off" && promotionCode.discountValue) {
2306
- return originalCharge * (1 - promotionCode.discountValue / 100);
2307
- }
2308
- if (promotionCode.discountType === "amount_off" && promotionCode.discountValue) {
2309
- return Math.max(0, originalCharge - promotionCode.discountValue);
2310
- }
2311
- return null;
2312
- }, "calculateDiscountedImmediateCharge");
2313
- const discountedImmediateCharge = calculateDiscountedImmediateCharge();
2580
+ const codeDiscount = _chunkLQ4DK4JFjs.promotionCodeDiscount.call(void 0, promotionCode);
2581
+ const carriedDiscount = isChangingPlan && !codeDiscount ? _chunkLQ4DK4JFjs.subscriptionDiscount.call(void 0, subscription) : null;
2582
+ const discount = _nullishCoalesce(codeDiscount, () => ( carriedDiscount));
2583
+ const discountedPrice = _chunkLQ4DK4JFjs.applyDiscount.call(void 0, selectedPrice.unitAmount, discount);
2584
+ const discountedImmediateCharge = _chunkLQ4DK4JFjs.applyDiscount.call(void 0, _optionalChain([prorationPreview, 'optionalAccess', _106 => _106.immediateCharge]), discount);
2314
2585
  const getDiscountDescription = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
2315
- if (!_optionalChain([promotionCode, 'optionalAccess', _91 => _91.valid])) return null;
2316
- if (promotionCode.discountType === "percent_off" && promotionCode.discountValue) {
2317
- return t("billing.ui.wizard.review.percent_off", { value: promotionCode.discountValue });
2318
- }
2319
- if (promotionCode.discountType === "amount_off" && promotionCode.discountValue) {
2320
- return t("billing.ui.wizard.review.amount_off", {
2321
- amount: _chunkTY5FYP3Gjs.formatCurrency.call(void 0, promotionCode.discountValue, promotionCode.currency || selectedPrice.currency, fmt)
2322
- });
2586
+ if (!discount) return null;
2587
+ if (discount.discountType === "percent_off") {
2588
+ return t("billing.ui.wizard.review.percent_off", { value: discount.discountValue });
2323
2589
  }
2324
- return null;
2590
+ return t("billing.ui.wizard.review.amount_off", {
2591
+ amount: _chunkHKZAESS6js.formatCurrency.call(void 0, discount.discountValue, discount.currency || selectedPrice.currency, fmt)
2592
+ });
2325
2593
  }, "getDiscountDescription");
2326
2594
  const discountDescription = getDiscountDescription();
2327
2595
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
2328
2596
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-muted/50 rounded-lg p-4 space-y-3", children: [
2329
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.SectionHeader, { children: t("billing.ui.wizard.review.selected_plan") }),
2597
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.SectionHeader, { children: t("billing.ui.wizard.review.selected_plan") }),
2330
2598
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between items-center", children: [
2331
2599
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
2332
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-medium", children: _optionalChain([selectedPrice, 'access', _92 => _92.product, 'optionalAccess', _93 => _93.name]) }),
2600
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-medium", children: _optionalChain([selectedPrice, 'access', _107 => _107.product, 'optionalAccess', _108 => _108.name]) }),
2333
2601
  selectedPrice.nickname && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: selectedPrice.nickname })
2334
2602
  ] }),
2335
2603
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-end", children: [
2336
2604
  discountedPrice !== null ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
2337
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground line-through", children: _chunkTY5FYP3Gjs.formatCurrency.call(void 0, selectedPrice.unitAmount || 0, selectedPrice.currency, fmt) }),
2338
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-success text-lg font-semibold", children: _chunkTY5FYP3Gjs.formatCurrency.call(void 0, discountedPrice, selectedPrice.currency, fmt) }),
2339
- discountDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Badge, { variant: "softGreen", children: discountDescription })
2340
- ] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-semibold text-lg", children: _chunkTY5FYP3Gjs.formatCurrency.call(void 0, selectedPrice.unitAmount || 0, selectedPrice.currency, fmt) }),
2605
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground line-through", children: _chunkHKZAESS6js.formatCurrency.call(void 0, selectedPrice.unitAmount || 0, selectedPrice.currency, fmt) }),
2606
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-success text-lg font-semibold", children: _chunkHKZAESS6js.formatCurrency.call(void 0, discountedPrice, selectedPrice.currency, fmt) }),
2607
+ discountDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Badge, { variant: "softGreen", children: discountDescription }),
2608
+ carriedDiscount && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: t("billing.ui.wizard.review.discount_carries_over") })
2609
+ ] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-semibold text-lg", children: _chunkHKZAESS6js.formatCurrency.call(void 0, selectedPrice.unitAmount || 0, selectedPrice.currency, fmt) }),
2341
2610
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: formatInterval2(selectedPrice) })
2342
2611
  ] })
2343
2612
  ] })
@@ -2348,13 +2617,13 @@ function WizardStepReview({
2348
2617
  className: `${isTrialUpgrade ? "bg-warning/15 border-warning/30" : "bg-primary/10 border-primary/30"} space-y-2 rounded-lg border p-4`,
2349
2618
  children: [
2350
2619
  /* @__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") }),
2351
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: `text-sm ${isTrialUpgrade ? "text-warning" : "text-foreground"}`, children: isTrialUpgrade ? t("billing.ui.wizard.review.trial_upgrade_description") : t("billing.ui.wizard.review.proration_description") }),
2620
+ /* @__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") }),
2352
2621
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between text-sm", children: [
2353
2622
  /* @__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") }),
2354
2623
  /* @__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: [
2355
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "line-through text-muted-foreground me-2", children: _chunkTY5FYP3Gjs.formatCurrency.call(void 0, prorationPreview.immediateCharge, prorationPreview.currency, fmt) }),
2356
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success", children: _chunkTY5FYP3Gjs.formatCurrency.call(void 0, discountedImmediateCharge, prorationPreview.currency, fmt) })
2357
- ] }) : _chunkTY5FYP3Gjs.formatCurrency.call(void 0, prorationPreview.immediateCharge, prorationPreview.currency, fmt) })
2624
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "line-through text-muted-foreground me-2", children: _chunkHKZAESS6js.formatCurrency.call(void 0, prorationPreview.immediateCharge, prorationPreview.currency, fmt) }),
2625
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success", children: _chunkHKZAESS6js.formatCurrency.call(void 0, discountedImmediateCharge, prorationPreview.currency, fmt) })
2626
+ ] }) : _chunkHKZAESS6js.formatCurrency.call(void 0, prorationPreview.immediateCharge, prorationPreview.currency, fmt) })
2358
2627
  ] })
2359
2628
  ]
2360
2629
  }
@@ -2376,17 +2645,17 @@ function WizardStepReview({
2376
2645
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg p-4", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between items-center", children: [
2377
2646
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
2378
2647
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "font-medium", children: t("billing.ui.payment_method.title") }),
2379
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: hasPaymentMethod ? t("billing.ui.wizard.review.payment_on_file") : t("billing.ui.wizard.review.no_payment_on_file") })
2648
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: hasPaymentMethod ? card ? t("billing.ui.wizard.review.card_on_file", { brand: card.brand, last4: card.last4 }) : t("billing.ui.wizard.review.payment_on_file") : t("billing.ui.wizard.review.no_payment_on_file") })
2380
2649
  ] }),
2381
- !hasPaymentMethod && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Button, { variant: "outline", onClick: onAddPaymentMethod, children: t("billing.ui.payment_methods.add") })
2650
+ hasPaymentMethod ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Button, { variant: "outline", onClick: onAddPaymentMethod, disabled: isProcessing, children: t("billing.ui.wizard.review.use_another_card") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Button, { variant: "outline", onClick: onAddPaymentMethod, children: t("billing.ui.payment_methods.add") })
2382
2651
  ] }) }),
2383
- error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.Alert, { variant: "destructive", children: [
2652
+ error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.Alert, { variant: "destructive", children: [
2384
2653
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.AlertCircle, { className: "h-4 w-4" }),
2385
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.AlertDescription, { children: error })
2654
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.AlertDescription, { children: error })
2386
2655
  ] }),
2387
2656
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between pt-4 border-t", children: [
2388
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Button, { variant: "outline", onClick: onBack, disabled: isProcessing, children: t("billing.ui.wizard.back") }),
2389
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Button, { onClick: hasPaymentMethod ? onConfirm : onAddPaymentMethod, disabled: isProcessing, children: isProcessing ? t("billing.ui.wizard.review.processing") : hasPaymentMethod ? isChangingPlan ? t("billing.ui.wizard.review.confirm_change") : t("billing.ui.wizard.review.subscribe_now") : t("billing.ui.payment_methods.add") })
2657
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Button, { variant: "outline", onClick: onBack, disabled: isProcessing, children: t("billing.ui.wizard.back") }),
2658
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Button, { onClick: hasPaymentMethod ? onConfirm : onAddPaymentMethod, disabled: isProcessing, children: isProcessing ? t("billing.ui.wizard.review.processing") : hasPaymentMethod ? isChangingPlan ? t("billing.ui.wizard.review.confirm_change") : t("billing.ui.wizard.review.subscribe_now") : t("billing.ui.payment_methods.add") })
2390
2659
  ] })
2391
2660
  ] });
2392
2661
  }
@@ -2399,10 +2668,10 @@ function WizardStepPaymentMethod({ onBack, onSuccess, isProcessing }) {
2399
2668
  const t = _nextintl.useTranslations.call(void 0, );
2400
2669
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
2401
2670
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
2402
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.SectionHeader, { children: t("billing.ui.payment_methods.add") }),
2671
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.SectionHeader, { children: t("billing.ui.payment_methods.add") }),
2403
2672
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: t("billing.ui.wizard.payment_description") })
2404
2673
  ] }),
2405
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodForm, { onSuccess, onCancel: onBack, isLoading: isProcessing })
2674
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodForm, { onSuccess, onCancel: onBack, isLoading: isProcessing, alwaysSetDefault: true })
2406
2675
  ] });
2407
2676
  }
2408
2677
  _chunk7QVYU63Ejs.__name.call(void 0, WizardStepPaymentMethod, "WizardStepPaymentMethod");
@@ -2442,10 +2711,10 @@ function SubscriptionWizard({
2442
2711
  const isChangePlanMode = !!subscription;
2443
2712
  const dialogTitle = subscription ? t("billing.ui.wizard.change_title") : isPurchasingAddons ? t("billing.ui.subscriptions.purchase_addons") : t("billing.ui.subscriptions.subscribe");
2444
2713
  const dialogDescription = subscription ? t("billing.ui.wizard.change_description") : isPurchasingAddons ? t("billing.ui.wizard.addons_description") : t("billing.ui.wizard.subscribe_description");
2445
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.DialogContent, { className: "max-w-2xl", children: [
2446
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.DialogHeader, { children: [
2447
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.DialogTitle, { children: dialogTitle }),
2448
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.DialogDescription, { children: dialogDescription })
2714
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.DialogContent, { className: "max-w-2xl max-h-[90vh] overflow-y-auto", children: [
2715
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.DialogHeader, { children: [
2716
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.DialogTitle, { children: dialogTitle }),
2717
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.DialogDescription, { children: dialogDescription })
2449
2718
  ] }),
2450
2719
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, WizardProgressIndicator, { currentStep: state.step }),
2451
2720
  state.step === "plan-selection" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -2453,7 +2722,7 @@ function SubscriptionWizard({
2453
2722
  {
2454
2723
  selectedPrice: state.selectedPrice,
2455
2724
  selectedInterval: state.selectedInterval,
2456
- currentPriceId: _optionalChain([subscription, 'optionalAccess', _94 => _94.price, 'optionalAccess', _95 => _95.id]),
2725
+ currentPriceId: _optionalChain([subscription, 'optionalAccess', _109 => _109.price, 'optionalAccess', _110 => _110.id]),
2457
2726
  hideRecurringPrices: isPurchasingAddons,
2458
2727
  hideOneTimePrices: isChangePlanMode,
2459
2728
  onSelectPrice: actions.selectPrice,
@@ -2524,23 +2793,23 @@ function formatDate2(date, { locale, t }) {
2524
2793
  _chunk7QVYU63Ejs.__name.call(void 0, formatDate2, "formatDate");
2525
2794
  function UsageSummaryCard({ meter, summary }) {
2526
2795
  const t = _nextintl.useTranslations.call(void 0, );
2527
- const fmt = _chunkTY5FYP3Gjs.useBillingFormatOptions.call(void 0, );
2528
- const currentUsage = _nullishCoalesce(_optionalChain([summary, 'optionalAccess', _96 => _96.aggregatedValue]), () => ( 0));
2796
+ const fmt = _chunkLQ4DK4JFjs.useBillingFormatOptions.call(void 0, );
2797
+ const currentUsage = _nullishCoalesce(_optionalChain([summary, 'optionalAccess', _111 => _111.aggregatedValue]), () => ( 0));
2529
2798
  const limit = meter.limit;
2530
2799
  const percentage = limit && limit > 0 ? currentUsage / limit * 100 : null;
2531
2800
  const progressColor = getProgressColor(percentage);
2532
2801
  const progressWidth = percentage !== null ? Math.min(percentage, 100) : 0;
2533
2802
  const displayName = meter.displayName || meter.eventName;
2534
2803
  const hasLimit = limit !== null && limit !== void 0;
2535
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.Card, { children: [
2536
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.CardHeader, { className: "flex flex-row items-center gap-x-3 pb-3", children: [
2804
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.Card, { children: [
2805
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.CardHeader, { className: "flex flex-row items-center gap-x-3 pb-3", children: [
2537
2806
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex h-10 w-10 items-center justify-center rounded-lg bg-blue-100 text-blue-600", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-5 w-5" }) }),
2538
2807
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col", children: [
2539
2808
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium", children: displayName }),
2540
2809
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-xs", children: meter.id })
2541
2810
  ] })
2542
2811
  ] }),
2543
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.CardContent, { className: "flex flex-col gap-y-4", children: [
2812
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.CardContent, { className: "flex flex-col gap-y-4", children: [
2544
2813
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
2545
2814
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-3xl font-bold", children: currentUsage.toLocaleString(fmt.locale) }),
2546
2815
  hasLimit && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-sm", children: t("billing.ui.usage.of_limit_used", { limit: limit.toLocaleString(fmt.locale) }) })
@@ -2548,7 +2817,7 @@ function UsageSummaryCard({ meter, summary }) {
2548
2817
  hasLimit ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-2", children: [
2549
2818
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-2 w-full overflow-hidden rounded-full bg-gray-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: `h-full transition-all ${progressColor}`, style: { width: `${progressWidth}%` } }) }),
2550
2819
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-sm", children: t("billing.ui.usage.percent_used", {
2551
- value: percentage !== null ? _chunkTY5FYP3Gjs.formatFixed.call(void 0, percentage, fmt.locale, 1) : ""
2820
+ value: percentage !== null ? _chunkHKZAESS6js.formatFixed.call(void 0, percentage, fmt.locale, 1) : ""
2552
2821
  }) })
2553
2822
  ] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-sm", children: t("billing.ui.usage.no_limit") }),
2554
2823
  summary && summary.start && summary.end && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border-t pt-3", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-xs", children: t("billing.ui.usage.period", {
@@ -2581,14 +2850,14 @@ function UsageContainer() {
2581
2850
  const loadUsageData = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
2582
2851
  setLoading(true);
2583
2852
  try {
2584
- const fetchedSubscriptions = await _chunkG6UE6MEPjs.StripeSubscriptionService.listSubscriptions();
2853
+ const fetchedSubscriptions = await _chunkHKZAESS6js.StripeSubscriptionService.listSubscriptions();
2585
2854
  setSubscriptions(fetchedSubscriptions);
2586
- const hasMeteredSubscriptions2 = fetchedSubscriptions.some((sub) => _optionalChain([sub, 'access', _97 => _97.price, 'optionalAccess', _98 => _98.recurring, 'optionalAccess', _99 => _99.usageType]) === "metered");
2855
+ const hasMeteredSubscriptions2 = fetchedSubscriptions.some((sub) => _optionalChain([sub, 'access', _112 => _112.price, 'optionalAccess', _113 => _113.recurring, 'optionalAccess', _114 => _114.usageType]) === "metered");
2587
2856
  if (!hasMeteredSubscriptions2) {
2588
2857
  setLoading(false);
2589
2858
  return;
2590
2859
  }
2591
- const fetchedMeters = await _chunkG6UE6MEPjs.StripeUsageService.listMeters();
2860
+ const fetchedMeters = await _chunkHKZAESS6js.StripeUsageService.listMeters();
2592
2861
  setMeters(fetchedMeters);
2593
2862
  const summariesMap = {};
2594
2863
  const now = /* @__PURE__ */ new Date();
@@ -2596,7 +2865,7 @@ function UsageContainer() {
2596
2865
  const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
2597
2866
  for (const meter of fetchedMeters) {
2598
2867
  try {
2599
- const meterSummaries = await _chunkG6UE6MEPjs.StripeUsageService.getMeterSummaries({
2868
+ const meterSummaries = await _chunkHKZAESS6js.StripeUsageService.getMeterSummaries({
2600
2869
  meterId: meter.id,
2601
2870
  startTime: startOfMonth,
2602
2871
  endTime: endOfMonth
@@ -2614,7 +2883,7 @@ function UsageContainer() {
2614
2883
  setLoading(false);
2615
2884
  }
2616
2885
  }, "loadUsageData");
2617
- const hasMeteredSubscriptions = subscriptions.some((sub) => _optionalChain([sub, 'access', _100 => _100.price, 'optionalAccess', _101 => _101.recurring, 'optionalAccess', _102 => _102.usageType]) === "metered");
2886
+ const hasMeteredSubscriptions = subscriptions.some((sub) => _optionalChain([sub, 'access', _115 => _115.price, 'optionalAccess', _116 => _116.recurring, 'optionalAccess', _117 => _117.usageType]) === "metered");
2618
2887
  if (!loading && !hasMeteredSubscriptions) {
2619
2888
  return null;
2620
2889
  }
@@ -2659,27 +2928,27 @@ function formatDateTime(date, { locale, t }) {
2659
2928
  _chunk7QVYU63Ejs.__name.call(void 0, formatDateTime, "formatDateTime");
2660
2929
  function UsageHistoryTable({ usageRecords }) {
2661
2930
  const t = _nextintl.useTranslations.call(void 0, );
2662
- const fmt = _chunkTY5FYP3Gjs.useBillingFormatOptions.call(void 0, );
2931
+ const fmt = _chunkLQ4DK4JFjs.useBillingFormatOptions.call(void 0, );
2663
2932
  if (usageRecords.length === 0) {
2664
2933
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rounded-lg border p-8 text-center", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground", children: t("billing.ui.usage.history_empty") }) });
2665
2934
  }
2666
2935
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
2667
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.SectionHeader, { level: 2, children: t("billing.ui.usage.history_title") }),
2668
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-clip rounded-lg border", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.Table, { children: [
2669
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.TableRow, { children: [
2670
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.TableHead, { children: t("billing.ui.columns.date_time") }),
2671
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.TableHead, { children: t("billing.ui.columns.meter_event") }),
2672
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.TableHead, { className: "text-end", children: t("billing.ui.columns.quantity") }),
2673
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.TableHead, { children: t("billing.ui.columns.event_id") })
2936
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.SectionHeader, { level: 2, children: t("billing.ui.usage.history_title") }),
2937
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-clip rounded-lg border", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.Table, { children: [
2938
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.TableRow, { children: [
2939
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.TableHead, { children: t("billing.ui.columns.date_time") }),
2940
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.TableHead, { children: t("billing.ui.columns.meter_event") }),
2941
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.TableHead, { className: "text-end", children: t("billing.ui.columns.quantity") }),
2942
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.TableHead, { children: t("billing.ui.columns.event_id") })
2674
2943
  ] }) }),
2675
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.TableBody, { children: usageRecords.map((record) => {
2944
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.TableBody, { children: usageRecords.map((record) => {
2676
2945
  const dateTime = formatDateTime(record.timestamp, fmt);
2677
2946
  const quantity = record.quantity.toLocaleString(fmt.locale);
2678
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.TableRow, { children: [
2679
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.TableCell, { className: "font-medium", children: dateTime }),
2680
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.TableCell, { className: "text-muted-foreground", children: record.meterEventName }),
2681
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.TableCell, { className: "text-end font-medium", children: quantity }),
2682
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.TableCell, { className: "text-muted-foreground text-sm tabular-nums", children: record.stripeEventId })
2947
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.TableRow, { children: [
2948
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.TableCell, { className: "font-medium", children: dateTime }),
2949
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.TableCell, { className: "text-muted-foreground", children: record.meterEventName }),
2950
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.TableCell, { className: "text-end font-medium", children: quantity }),
2951
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.TableCell, { className: "text-muted-foreground text-sm tabular-nums", children: record.stripeEventId })
2683
2952
  ] }, record.id);
2684
2953
  }) })
2685
2954
  ] }) })
@@ -2690,13 +2959,22 @@ _chunk7QVYU63Ejs.__name.call(void 0, UsageHistoryTable, "UsageHistoryTable");
2690
2959
  // src/features/billing/components/modals/BillingDetailModal.tsx
2691
2960
 
2692
2961
  function BillingDetailModal({ open, onOpenChange, title, children, className }) {
2693
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.DialogContent, { className: _nullishCoalesce(className, () => ( "max-w-4xl max-h-[90vh] overflow-y-auto")), children: [
2694
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.DialogHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.DialogTitle, { children: title }) }),
2962
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.DialogContent, { className: _nullishCoalesce(className, () => ( "max-w-4xl max-h-[90vh] overflow-y-auto")), children: [
2963
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.DialogHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.DialogTitle, { children: title }) }),
2695
2964
  children
2696
2965
  ] }) });
2697
2966
  }
2698
2967
  _chunk7QVYU63Ejs.__name.call(void 0, BillingDetailModal, "BillingDetailModal");
2699
2968
 
2969
+ // src/features/billing/components/utils/url.ts
2970
+ function urlWithoutParam(params) {
2971
+ const query = new URLSearchParams(params.search);
2972
+ query.delete(params.param);
2973
+ const remaining = query.toString();
2974
+ return `${params.pathname}${remaining ? `?${remaining}` : ""}${_nullishCoalesce(params.hash, () => ( ""))}`;
2975
+ }
2976
+ _chunk7QVYU63Ejs.__name.call(void 0, urlWithoutParam, "urlWithoutParam");
2977
+
2700
2978
  // src/features/billing/components/widgets/BillingAlertBanner.tsx
2701
2979
 
2702
2980
 
@@ -2710,7 +2988,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
2710
2988
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-destructive text-sm font-medium", children: t("billing.ui.alert.payment_failed_title") }),
2711
2989
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive mt-1 text-sm", children: t("billing.ui.alert.payment_failed_description") })
2712
2990
  ] }),
2713
- onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Button, { variant: "outline", size: "sm", onClick: onUpdatePayment, className: "text-destructive border-red-300", children: t("billing.ui.alert.update_payment_method") })
2991
+ onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Button, { variant: "outline", size: "sm", onClick: onUpdatePayment, className: "text-destructive border-red-300", children: t("billing.ui.alert.update_payment_method") })
2714
2992
  ] });
2715
2993
  }
2716
2994
  if (subscription.status === "trialing" /* TRIALING */ && subscription.trialEnd) {
@@ -2724,7 +3002,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
2724
3002
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-warning text-sm font-medium", children: t("billing.ui.alert.trial_ending_title") }),
2725
3003
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-warning mt-1 text-sm", children: t("billing.ui.alert.trial_ending_description", { count: daysRemaining }) })
2726
3004
  ] }),
2727
- onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Button, { variant: "outline", size: "sm", onClick: onAddPayment, className: "text-warning border-yellow-300", children: t("billing.ui.payment_methods.add") })
3005
+ onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Button, { variant: "outline", size: "sm", onClick: onAddPayment, className: "text-warning border-yellow-300", children: t("billing.ui.payment_methods.add") })
2728
3006
  ] });
2729
3007
  }
2730
3008
  }
@@ -2765,24 +3043,24 @@ function BillingDashboardContainer() {
2765
3043
  const [showWizard, setShowWizard] = _react.useState.call(void 0, false);
2766
3044
  const [editingSubscription, setEditingSubscription] = _react.useState.call(void 0, null);
2767
3045
  const hasMeteredSubscriptions = _react.useCallback.call(void 0, () => {
2768
- return data.subscriptions.some((sub) => _optionalChain([sub, 'access', _103 => _103.price, 'optionalAccess', _104 => _104.recurring, 'optionalAccess', _105 => _105.usageType]) === "metered");
3046
+ return data.subscriptions.some((sub) => _optionalChain([sub, 'access', _118 => _118.price, 'optionalAccess', _119 => _119.recurring, 'optionalAccess', _120 => _120.usageType]) === "metered");
2769
3047
  }, [data.subscriptions]);
2770
3048
  const hasActiveRecurringSubscription = _react.useMemo.call(void 0, () => {
2771
3049
  return data.subscriptions.some(
2772
- (sub) => (sub.status === "active" /* ACTIVE */ || sub.status === "trialing" /* TRIALING */) && _optionalChain([sub, 'access', _106 => _106.price, 'optionalAccess', _107 => _107.priceType]) === "recurring"
3050
+ (sub) => (sub.status === "active" /* ACTIVE */ || sub.status === "trialing" /* TRIALING */) && _optionalChain([sub, 'access', _121 => _121.price, 'optionalAccess', _122 => _122.priceType]) === "recurring"
2773
3051
  );
2774
3052
  }, [data.subscriptions]);
2775
3053
  const fetchAllData = _react.useCallback.call(void 0, async () => {
2776
3054
  setNoCustomerExists(false);
2777
3055
  let customer = null;
2778
3056
  try {
2779
- customer = await _chunkG6UE6MEPjs.StripeCustomerService.getCustomer();
3057
+ customer = await _chunkHKZAESS6js.StripeCustomerService.getCustomer();
2780
3058
  setData((prev) => ({ ...prev, customer }));
2781
3059
  setErrors((prev) => ({ ...prev, customer: null }));
2782
3060
  setNoCustomerExists(false);
2783
3061
  } catch (error) {
2784
3062
  console.error("[BillingDashboard] Failed to load customer:", error);
2785
- if (_optionalChain([error, 'optionalAccess', _108 => _108.status]) === 404) {
3063
+ if (_optionalChain([error, 'optionalAccess', _123 => _123.status]) === 404) {
2786
3064
  setNoCustomerExists(true);
2787
3065
  } else {
2788
3066
  setErrors((prev) => ({ ...prev, customer: "billing.ui.dashboard.errors.load_customer" }));
@@ -2802,7 +3080,7 @@ function BillingDashboardContainer() {
2802
3080
  }
2803
3081
  const fetchSubscriptions = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
2804
3082
  try {
2805
- const subscriptions2 = await _chunkG6UE6MEPjs.StripeSubscriptionService.listSubscriptions();
3083
+ const subscriptions2 = await _chunkHKZAESS6js.StripeSubscriptionService.listSubscriptions();
2806
3084
  setData((prev) => ({ ...prev, subscriptions: subscriptions2 }));
2807
3085
  setErrors((prev) => ({ ...prev, subscriptions: null }));
2808
3086
  return subscriptions2;
@@ -2816,7 +3094,7 @@ function BillingDashboardContainer() {
2816
3094
  }, "fetchSubscriptions");
2817
3095
  const fetchPaymentMethods = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
2818
3096
  try {
2819
- const paymentMethods = await _chunkG6UE6MEPjs.StripeCustomerService.listPaymentMethods();
3097
+ const paymentMethods = await _chunkHKZAESS6js.StripeCustomerService.listPaymentMethods();
2820
3098
  setData((prev) => ({ ...prev, paymentMethods }));
2821
3099
  setErrors((prev) => ({ ...prev, paymentMethods: null }));
2822
3100
  } catch (error) {
@@ -2828,7 +3106,7 @@ function BillingDashboardContainer() {
2828
3106
  }, "fetchPaymentMethods");
2829
3107
  const fetchInvoices = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
2830
3108
  try {
2831
- const invoices = await _chunkG6UE6MEPjs.StripeInvoiceService.listInvoices();
3109
+ const invoices = await _chunkHKZAESS6js.StripeInvoiceService.listInvoices();
2832
3110
  setData((prev) => ({ ...prev, invoices }));
2833
3111
  setErrors((prev) => ({ ...prev, invoices: null }));
2834
3112
  } catch (error) {
@@ -2840,7 +3118,7 @@ function BillingDashboardContainer() {
2840
3118
  }, "fetchInvoices");
2841
3119
  const [subscriptions] = await Promise.all([fetchSubscriptions(), fetchPaymentMethods(), fetchInvoices()]);
2842
3120
  const hasMetered = subscriptions.some(
2843
- (sub) => _optionalChain([sub, 'access', _109 => _109.price, 'optionalAccess', _110 => _110.recurring, 'optionalAccess', _111 => _111.usageType]) === "metered"
3121
+ (sub) => _optionalChain([sub, 'access', _124 => _124.price, 'optionalAccess', _125 => _125.recurring, 'optionalAccess', _126 => _126.usageType]) === "metered"
2844
3122
  );
2845
3123
  if (hasMetered) {
2846
3124
  await fetchUsageData();
@@ -2851,7 +3129,7 @@ function BillingDashboardContainer() {
2851
3129
  const handleCreateCustomer = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
2852
3130
  setCreatingCustomer(true);
2853
3131
  try {
2854
- await _chunkG6UE6MEPjs.StripeCustomerService.createCustomer();
3132
+ await _chunkHKZAESS6js.StripeCustomerService.createCustomer();
2855
3133
  setNoCustomerExists(false);
2856
3134
  await fetchAllData();
2857
3135
  } catch (error) {
@@ -2863,7 +3141,7 @@ function BillingDashboardContainer() {
2863
3141
  }, "handleCreateCustomer");
2864
3142
  const fetchUsageData = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
2865
3143
  try {
2866
- const meters = await _chunkG6UE6MEPjs.StripeUsageService.listMeters();
3144
+ const meters = await _chunkHKZAESS6js.StripeUsageService.listMeters();
2867
3145
  setData((prev) => ({ ...prev, meters }));
2868
3146
  const summariesMap = {};
2869
3147
  const now = /* @__PURE__ */ new Date();
@@ -2871,7 +3149,7 @@ function BillingDashboardContainer() {
2871
3149
  const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
2872
3150
  for (const meter of meters) {
2873
3151
  try {
2874
- const meterSummaries = await _chunkG6UE6MEPjs.StripeUsageService.getMeterSummaries({
3152
+ const meterSummaries = await _chunkHKZAESS6js.StripeUsageService.getMeterSummaries({
2875
3153
  meterId: meter.id,
2876
3154
  startTime: startOfMonth,
2877
3155
  endTime: endOfMonth
@@ -2917,7 +3195,16 @@ function BillingDashboardContainer() {
2917
3195
  const action = searchParams.get("action");
2918
3196
  if (action === "subscribe") {
2919
3197
  setShowWizard(true);
2920
- window.history.replaceState({}, "", window.location.pathname);
3198
+ window.history.replaceState(
3199
+ window.history.state,
3200
+ "",
3201
+ urlWithoutParam({
3202
+ pathname: window.location.pathname,
3203
+ search: window.location.search,
3204
+ hash: window.location.hash,
3205
+ param: "action"
3206
+ })
3207
+ );
2921
3208
  }
2922
3209
  }, [searchParams]);
2923
3210
  const criticalSubscriptions = data.subscriptions.filter(
@@ -2949,18 +3236,18 @@ function BillingDashboardContainer() {
2949
3236
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-8 w-8" }),
2950
3237
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: t("billing.title") })
2951
3238
  ] }),
2952
- isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardContent, { className: "flex items-center justify-center py-12", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "h-8 w-8 animate-spin text-muted-foreground" }) }) }),
2953
- noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.Card, { children: [
2954
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.CardHeader, { className: "text-center", children: [
3239
+ isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.CardContent, { className: "flex items-center justify-center py-12", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "h-8 w-8 animate-spin text-muted-foreground" }) }) }),
3240
+ noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.Card, { children: [
3241
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.CardHeader, { className: "text-center", children: [
2955
3242
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-primary/10", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8 text-primary" }) }),
2956
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardTitle, { children: t("billing.ui.dashboard.setup_title") }),
2957
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardDescription, { children: t("billing.ui.dashboard.setup_description") })
3243
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.CardTitle, { children: t("billing.ui.dashboard.setup_title") }),
3244
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.CardDescription, { children: t("billing.ui.dashboard.setup_description") })
2958
3245
  ] }),
2959
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardContent, { className: "flex justify-center pb-8", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Button, { onClick: handleCreateCustomer, disabled: creatingCustomer, size: "lg", children: creatingCustomer ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
3246
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.CardContent, { className: "flex justify-center pb-8", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Button, { onClick: handleCreateCustomer, disabled: creatingCustomer, size: "lg", children: creatingCustomer ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
2960
3247
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "me-2 h-4 w-4 animate-spin" }),
2961
3248
  t("billing.ui.dashboard.setting_up")
2962
3249
  ] }) : t("billing.ui.dashboard.setup_button") }) }),
2963
- errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.CardContent, { className: "pt-0", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-center text-destructive text-xs/relaxed", children: t(errors.customer) }) })
3250
+ errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.CardContent, { className: "pt-0", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-center text-destructive text-xs/relaxed", children: t(errors.customer) }) })
2964
3251
  ] }),
2965
3252
  !noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
2966
3253
  criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -2992,7 +3279,7 @@ function BillingDashboardContainer() {
2992
3279
  PaymentMethodSummaryCard,
2993
3280
  {
2994
3281
  paymentMethods: data.paymentMethods,
2995
- defaultPaymentMethodId: _optionalChain([data, 'access', _112 => _112.customer, 'optionalAccess', _113 => _113.defaultPaymentMethodId]),
3282
+ defaultPaymentMethodId: _optionalChain([data, 'access', _127 => _127.customer, 'optionalAccess', _128 => _128.defaultPaymentMethodId]),
2996
3283
  loading: loading.paymentMethods,
2997
3284
  error: errors.paymentMethods ? t(errors.paymentMethods) : void 0,
2998
3285
  onManageClick: () => setActiveModal("payment-methods")
@@ -3036,7 +3323,9 @@ function BillingDashboardContainer() {
3036
3323
  SubscriptionsContainer,
3037
3324
  {
3038
3325
  onOpenWizard: handleOpenWizard,
3039
- hasActiveRecurringSubscription
3326
+ hasActiveRecurringSubscription,
3327
+ subscriptions: data.subscriptions,
3328
+ onSubscriptionsChange: refreshData
3040
3329
  }
3041
3330
  )
3042
3331
  }
@@ -3071,7 +3360,7 @@ function BillingDashboardContainer() {
3071
3360
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3072
3361
  SubscriptionWizard,
3073
3362
  {
3074
- open: showWizard,
3363
+ open: showWizard && !!data.customer,
3075
3364
  onOpenChange: (open) => !open && handleWizardClose(),
3076
3365
  onSuccess: refreshData,
3077
3366
  hasActiveRecurringSubscription,
@@ -3093,7 +3382,7 @@ function getStripePromise(publishableKey) {
3093
3382
  if (!publishableKey) {
3094
3383
  return Promise.resolve(null);
3095
3384
  }
3096
- if (_optionalChain([stripePromiseCache, 'optionalAccess', _114 => _114.key]) === publishableKey) {
3385
+ if (_optionalChain([stripePromiseCache, 'optionalAccess', _129 => _129.key]) === publishableKey) {
3097
3386
  return stripePromiseCache.promise;
3098
3387
  }
3099
3388
  const promise = _stripejs.loadStripe.call(void 0, publishableKey);
@@ -3102,7 +3391,7 @@ function getStripePromise(publishableKey) {
3102
3391
  }
3103
3392
  _chunk7QVYU63Ejs.__name.call(void 0, getStripePromise, "getStripePromise");
3104
3393
  function StripeProvider({ children }) {
3105
- const publishableKey = _chunkS4YJ5WCWjs.getStripePublishableKey.call(void 0, );
3394
+ const publishableKey = _chunkRL3PL3KVjs.getStripePublishableKey.call(void 0, );
3106
3395
  const stripePromise = _react.useMemo.call(void 0, () => getStripePromise(publishableKey), [publishableKey]);
3107
3396
  const options = _react.useMemo.call(void 0, () => ({}), []);
3108
3397
  if (!publishableKey) {
@@ -3112,7 +3401,7 @@ function StripeProvider({ children }) {
3112
3401
  }
3113
3402
  _chunk7QVYU63Ejs.__name.call(void 0, StripeProvider, "StripeProvider");
3114
3403
  function isStripeConfigured() {
3115
- return !!_chunkS4YJ5WCWjs.getStripePublishableKey.call(void 0, );
3404
+ return !!_chunkRL3PL3KVjs.getStripePublishableKey.call(void 0, );
3116
3405
  }
3117
3406
  _chunk7QVYU63Ejs.__name.call(void 0, isStripeConfigured, "isStripeConfigured");
3118
3407
 
@@ -3127,18 +3416,18 @@ _chunk7QVYU63Ejs.__name.call(void 0, isStripeConfigured, "isStripeConfigured");
3127
3416
 
3128
3417
  function PriceArchiver({ price }) {
3129
3418
  const t = _nextintl.useTranslations.call(void 0, );
3130
- const fmt = _chunkTY5FYP3Gjs.useBillingFormatOptions.call(void 0, );
3419
+ const fmt = _chunkLQ4DK4JFjs.useBillingFormatOptions.call(void 0, );
3131
3420
  const { archivePrice, restorePrice } = usePriceContext();
3132
3421
  const [open, setOpen] = _react.useState.call(void 0, false);
3133
3422
  const isArchived = !price.active;
3134
3423
  const scope = isArchived ? "restore" : "archive";
3135
3424
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
3136
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.Button, { variant: "outline", size: "sm", onClick: () => setOpen(true), children: [
3425
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.Button, { variant: "outline", size: "sm", onClick: () => setOpen(true), children: [
3137
3426
  isArchived ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RotateCcwIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ArchiveIcon, {}),
3138
3427
  t(`billing.admin.prices.${scope}.confirm`)
3139
3428
  ] }),
3140
3429
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3141
- _chunkTY5FYP3Gjs.ConfirmDialog,
3430
+ _chunkLQ4DK4JFjs.ConfirmDialog,
3142
3431
  {
3143
3432
  open,
3144
3433
  onOpenChange: setOpen,
@@ -3152,7 +3441,7 @@ function PriceArchiver({ price }) {
3152
3441
  if (isArchived) await restorePrice(price.id);
3153
3442
  else await archivePrice(price.id);
3154
3443
  } catch (error) {
3155
- _chunkTY5FYP3Gjs.errorToast.call(void 0, { title: t(`billing.admin.prices.${scope}.title`), error });
3444
+ _chunkLQ4DK4JFjs.errorToast.call(void 0, { title: t(`billing.admin.prices.${scope}.title`), error });
3156
3445
  throw error;
3157
3446
  }
3158
3447
  }
@@ -3184,15 +3473,15 @@ function PriceEditorInternal({
3184
3473
  onDialogOpenChange
3185
3474
  }) {
3186
3475
  const t = _nextintl.useTranslations.call(void 0, );
3187
- const fmt = _chunkTY5FYP3Gjs.useBillingFormatOptions.call(void 0, );
3188
- const router = _chunkG6UE6MEPjs.useI18nRouter.call(void 0, );
3476
+ const fmt = _chunkLQ4DK4JFjs.useBillingFormatOptions.call(void 0, );
3477
+ const router = _chunkHKZAESS6js.useI18nRouter.call(void 0, );
3189
3478
  const { createPrice, updatePrice, productId: contextProductId } = usePriceContext();
3190
3479
  const [allFeatures, setAllFeatures] = _react.useState.call(void 0, []);
3191
3480
  const isEdit = !!price;
3192
- const targetProductId = _nullishCoalesce(_nullishCoalesce(productId, () => ( _optionalChain([price, 'optionalAccess', _115 => _115.product, 'optionalAccess', _116 => _116.id]))), () => ( contextProductId));
3481
+ const targetProductId = _nullishCoalesce(_nullishCoalesce(productId, () => ( _optionalChain([price, 'optionalAccess', _130 => _130.product, 'optionalAccess', _131 => _131.id]))), () => ( contextProductId));
3193
3482
  _react.useEffect.call(void 0, () => {
3194
3483
  const fetchFeatures = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
3195
- setAllFeatures(await _chunkG6UE6MEPjs.FeatureService.findMany({}));
3484
+ setAllFeatures(await _chunkHKZAESS6js.FeatureService.findMany({}));
3196
3485
  }, "fetchFeatures");
3197
3486
  void fetchFeatures();
3198
3487
  }, []);
@@ -3268,22 +3557,22 @@ function PriceEditorInternal({
3268
3557
  // `.toString()`, for the same reason the schema keeps the token
3269
3558
  // pipeline string-based: a seeded `0` must survive as "0" and not be
3270
3559
  // dropped as falsy.
3271
- token: _nullishCoalesce(_optionalChain([seed, 'access', _117 => _117.token, 'optionalAccess', _118 => _118.toString, 'call', _119 => _119()]), () => ( "")),
3560
+ token: _nullishCoalesce(_optionalChain([seed, 'access', _132 => _132.token, 'optionalAccess', _133 => _133.toString, 'call', _134 => _134()]), () => ( "")),
3272
3561
  featureIds: [.../* @__PURE__ */ new Set([...resolvePlatformFeatures(seed.platformFeatures).ids, ...coreFeatureIds])]
3273
3562
  };
3274
3563
  }
3275
3564
  return {
3276
- unitAmount: _optionalChain([price, 'optionalAccess', _120 => _120.unitAmount]) ? price.unitAmount / 100 : 0,
3277
- currency: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _121 => _121.currency]), () => ( "usd")),
3278
- interval: _optionalChain([price, 'optionalAccess', _122 => _122.priceType]) === "one_time" ? "one_time" : _nullishCoalesce(_optionalChain([price, 'optionalAccess', _123 => _123.recurring, 'optionalAccess', _124 => _124.interval]), () => ( "month")),
3279
- intervalCount: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _125 => _125.recurring, 'optionalAccess', _126 => _126.intervalCount]), () => ( 1)),
3280
- usageType: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _127 => _127.recurring, 'optionalAccess', _128 => _128.usageType]), () => ( "licensed")),
3281
- nickname: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _129 => _129.nickname]), () => ( "")),
3282
- isTrial: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _130 => _130.isTrial]), () => ( false)),
3283
- description: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _131 => _131.description]), () => ( "")),
3284
- features: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _132 => _132.features]), () => ( [])),
3285
- token: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _133 => _133.token, 'optionalAccess', _134 => _134.toString, 'call', _135 => _135()]), () => ( "")),
3286
- featureIds: [.../* @__PURE__ */ new Set([..._nullishCoalesce(_optionalChain([price, 'optionalAccess', _136 => _136.priceFeatures, 'optionalAccess', _137 => _137.map, 'call', _138 => _138((f) => f.id)]), () => ( [])), ...coreFeatureIds])]
3565
+ unitAmount: _optionalChain([price, 'optionalAccess', _135 => _135.unitAmount]) ? price.unitAmount / 100 : 0,
3566
+ currency: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _136 => _136.currency]), () => ( "usd")),
3567
+ interval: _optionalChain([price, 'optionalAccess', _137 => _137.priceType]) === "one_time" ? "one_time" : _nullishCoalesce(_optionalChain([price, 'optionalAccess', _138 => _138.recurring, 'optionalAccess', _139 => _139.interval]), () => ( "month")),
3568
+ intervalCount: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _140 => _140.recurring, 'optionalAccess', _141 => _141.intervalCount]), () => ( 1)),
3569
+ usageType: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _142 => _142.recurring, 'optionalAccess', _143 => _143.usageType]), () => ( "licensed")),
3570
+ nickname: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _144 => _144.nickname]), () => ( "")),
3571
+ isTrial: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _145 => _145.isTrial]), () => ( false)),
3572
+ description: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _146 => _146.description]), () => ( "")),
3573
+ features: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _147 => _147.features]), () => ( [])),
3574
+ token: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _148 => _148.token, 'optionalAccess', _149 => _149.toString, 'call', _150 => _150()]), () => ( "")),
3575
+ featureIds: [.../* @__PURE__ */ new Set([..._nullishCoalesce(_optionalChain([price, 'optionalAccess', _151 => _151.priceFeatures, 'optionalAccess', _152 => _152.map, 'call', _153 => _153((f) => f.id)]), () => ( [])), ...coreFeatureIds])]
3287
3576
  };
3288
3577
  }, [price, seed, allFeatures, resolvePlatformFeatures]);
3289
3578
  const form = _reacthookform.useForm.call(void 0, {
@@ -3305,7 +3594,7 @@ function PriceEditorInternal({
3305
3594
  warnedUnknownFor.current = fingerprint;
3306
3595
  const { unknown } = resolvePlatformFeatures(seed.platformFeatures);
3307
3596
  if (unknown.length > 0)
3308
- _chunkG6UE6MEPjs.showToast.call(void 0, t("billing.admin.prices.import.warnings.unknownFeatures", { features: unknown.join(", ") }));
3597
+ _chunkHKZAESS6js.showToast.call(void 0, t("billing.admin.prices.import.warnings.unknownFeatures", { features: unknown.join(", ") }));
3309
3598
  }, [seed, isEdit, allFeatures, resolvePlatformFeatures, t]);
3310
3599
  const watchInterval = form.watch("interval");
3311
3600
  const isRecurring = watchInterval !== "one_time";
@@ -3326,13 +3615,13 @@ function PriceEditorInternal({
3326
3615
  { id: "metered", text: t("billing.admin.prices.usage.metered") }
3327
3616
  ];
3328
3617
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3329
- _chunkTY5FYP3Gjs.EditorSheet,
3618
+ _chunkLQ4DK4JFjs.EditorSheet,
3330
3619
  {
3331
3620
  form,
3332
3621
  entityType: t("billing.admin.prices.entity"),
3333
3622
  entityName: price ? priceLabel(price, fmt) : void 0,
3334
3623
  isEdit,
3335
- module: _chunkG6UE6MEPjs.Modules.StripePrice,
3624
+ module: _chunkHKZAESS6js.Modules.StripePrice,
3336
3625
  size: "lg",
3337
3626
  propagateChanges,
3338
3627
  onSuccess,
@@ -3381,13 +3670,13 @@ function PriceEditorInternal({
3381
3670
  dialogOpen,
3382
3671
  onDialogOpenChange,
3383
3672
  children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
3384
- isEdit && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.Alert, { children: [
3385
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.AlertTitle, { children: t("billing.admin.prices.immutability.title") }),
3386
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.AlertDescription, { children: t("billing.admin.prices.immutability.description") })
3673
+ isEdit && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.Alert, { children: [
3674
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.AlertTitle, { children: t("billing.admin.prices.immutability.title") }),
3675
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.AlertDescription, { children: t("billing.admin.prices.immutability.description") })
3387
3676
  ] }),
3388
3677
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
3389
3678
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3390
- _chunkTY5FYP3Gjs.FormInput,
3679
+ _chunkLQ4DK4JFjs.FormInput,
3391
3680
  {
3392
3681
  form,
3393
3682
  id: "unitAmount",
@@ -3399,7 +3688,7 @@ function PriceEditorInternal({
3399
3688
  }
3400
3689
  ),
3401
3690
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3402
- _chunkTY5FYP3Gjs.FormSelect,
3691
+ _chunkLQ4DK4JFjs.FormSelect,
3403
3692
  {
3404
3693
  form,
3405
3694
  id: "currency",
@@ -3410,7 +3699,7 @@ function PriceEditorInternal({
3410
3699
  )
3411
3700
  ] }),
3412
3701
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3413
- _chunkTY5FYP3Gjs.FormSelect,
3702
+ _chunkLQ4DK4JFjs.FormSelect,
3414
3703
  {
3415
3704
  form,
3416
3705
  id: "interval",
@@ -3421,7 +3710,7 @@ function PriceEditorInternal({
3421
3710
  ),
3422
3711
  isRecurring && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
3423
3712
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3424
- _chunkTY5FYP3Gjs.FormInput,
3713
+ _chunkLQ4DK4JFjs.FormInput,
3425
3714
  {
3426
3715
  form,
3427
3716
  id: "intervalCount",
@@ -3432,7 +3721,7 @@ function PriceEditorInternal({
3432
3721
  }
3433
3722
  ),
3434
3723
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3435
- _chunkTY5FYP3Gjs.FormSelect,
3724
+ _chunkLQ4DK4JFjs.FormSelect,
3436
3725
  {
3437
3726
  form,
3438
3727
  id: "usageType",
@@ -3443,7 +3732,7 @@ function PriceEditorInternal({
3443
3732
  )
3444
3733
  ] }),
3445
3734
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3446
- _chunkTY5FYP3Gjs.FormInput,
3735
+ _chunkLQ4DK4JFjs.FormInput,
3447
3736
  {
3448
3737
  form,
3449
3738
  id: "nickname",
@@ -3452,7 +3741,7 @@ function PriceEditorInternal({
3452
3741
  }
3453
3742
  ),
3454
3743
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3455
- _chunkTY5FYP3Gjs.FormTextarea,
3744
+ _chunkLQ4DK4JFjs.FormTextarea,
3456
3745
  {
3457
3746
  form,
3458
3747
  id: "description",
@@ -3462,7 +3751,7 @@ function PriceEditorInternal({
3462
3751
  }
3463
3752
  ),
3464
3753
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3465
- _chunkTY5FYP3Gjs.FormInput,
3754
+ _chunkLQ4DK4JFjs.FormInput,
3466
3755
  {
3467
3756
  form,
3468
3757
  id: "token",
@@ -3472,10 +3761,10 @@ function PriceEditorInternal({
3472
3761
  }
3473
3762
  ),
3474
3763
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-2", children: [
3475
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.FieldLabel, { children: t("billing.admin.prices.fields.features") }),
3764
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.FieldLabel, { children: t("billing.admin.prices.fields.features") }),
3476
3765
  form.watch("features").map((_, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
3477
3766
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3478
- _chunkTY5FYP3Gjs.Input,
3767
+ _chunkLQ4DK4JFjs.Input,
3479
3768
  {
3480
3769
  ...form.register(`features.${index}`),
3481
3770
  placeholder: t("billing.admin.prices.placeholders.feature", { index: index + 1 }),
@@ -3483,7 +3772,7 @@ function PriceEditorInternal({
3483
3772
  }
3484
3773
  ),
3485
3774
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3486
- _chunkTY5FYP3Gjs.Button,
3775
+ _chunkLQ4DK4JFjs.Button,
3487
3776
  {
3488
3777
  type: "button",
3489
3778
  variant: "outline",
@@ -3498,7 +3787,7 @@ function PriceEditorInternal({
3498
3787
  )
3499
3788
  ] }, index)),
3500
3789
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
3501
- _chunkTY5FYP3Gjs.Button,
3790
+ _chunkLQ4DK4JFjs.Button,
3502
3791
  {
3503
3792
  type: "button",
3504
3793
  variant: "outline",
@@ -3513,12 +3802,12 @@ function PriceEditorInternal({
3513
3802
  )
3514
3803
  ] }),
3515
3804
  isRecurring && allFeatures.length > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-2", children: [
3516
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.FieldLabel, { children: t("billing.admin.prices.fields.platformFeatures") }),
3805
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.FieldLabel, { children: t("billing.admin.prices.fields.platformFeatures") }),
3517
3806
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex max-h-48 flex-col gap-y-2 overflow-y-auto rounded-md border p-4", children: allFeatures.map((feature) => {
3518
3807
  const isChecked = form.watch("featureIds").includes(feature.id);
3519
3808
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
3520
3809
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3521
- _chunkTY5FYP3Gjs.Checkbox,
3810
+ _chunkLQ4DK4JFjs.Checkbox,
3522
3811
  {
3523
3812
  id: `feature-${feature.id}`,
3524
3813
  checked: isChecked,
@@ -3534,13 +3823,13 @@ function PriceEditorInternal({
3534
3823
  }
3535
3824
  }
3536
3825
  ),
3537
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.FieldLabel, { htmlFor: `feature-${feature.id}`, children: feature.name }),
3826
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.FieldLabel, { htmlFor: `feature-${feature.id}`, children: feature.name }),
3538
3827
  feature.isCore && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.admin.prices.help.core") })
3539
3828
  ] }, feature.id);
3540
3829
  }) })
3541
3830
  ] }),
3542
3831
  isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3543
- _chunkTY5FYP3Gjs.FormCheckbox,
3832
+ _chunkLQ4DK4JFjs.FormCheckbox,
3544
3833
  {
3545
3834
  form,
3546
3835
  id: "isTrial",
@@ -3583,7 +3872,7 @@ var defaultContextValue = {
3583
3872
  productId: void 0
3584
3873
  };
3585
3874
  function priceLabel(price, fmt = {}) {
3586
- return _nullishCoalesce(price.nickname, () => ( `${_chunkTY5FYP3Gjs.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt)} ${_chunkTY5FYP3Gjs.formatInterval.call(void 0, price, fmt)}`.trim()));
3875
+ return _nullishCoalesce(price.nickname, () => ( `${_chunkHKZAESS6js.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt)} ${_chunkHKZAESS6js.formatInterval.call(void 0, price, fmt)}`.trim()));
3587
3876
  }
3588
3877
  _chunk7QVYU63Ejs.__name.call(void 0, priceLabel, "priceLabel");
3589
3878
  var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
@@ -3593,22 +3882,22 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
3593
3882
  productId: productIdProp
3594
3883
  }) => {
3595
3884
  const t = _nextintl.useTranslations.call(void 0, );
3596
- const fmt = _chunkTY5FYP3Gjs.useBillingFormatOptions.call(void 0, );
3597
- const generateUrl = _chunkTY5FYP3Gjs.usePageUrlGenerator.call(void 0, );
3598
- const { hasRole } = _chunkTY5FYP3Gjs.useCurrentUserContext.call(void 0, );
3885
+ const fmt = _chunkLQ4DK4JFjs.useBillingFormatOptions.call(void 0, );
3886
+ const generateUrl = _chunkLQ4DK4JFjs.usePageUrlGenerator.call(void 0, );
3887
+ const { hasRole } = _chunkLQ4DK4JFjs.useCurrentUserContext.call(void 0, );
3599
3888
  const [price, setPrice] = _react.useState.call(void 0,
3600
- dehydratedPrice ? _chunkG6UE6MEPjs.rehydrate.call(void 0, _chunkG6UE6MEPjs.Modules.StripePrice, dehydratedPrice) : void 0
3889
+ dehydratedPrice ? _chunkHKZAESS6js.rehydrate.call(void 0, _chunkHKZAESS6js.Modules.StripePrice, dehydratedPrice) : void 0
3601
3890
  );
3602
3891
  const [priceVersion, setPriceVersion] = _react.useState.call(void 0, 0);
3603
3892
  const refreshPrices = _react.useCallback.call(void 0, () => setPriceVersion((value2) => value2 + 1), []);
3604
- const productId = _nullishCoalesce(productIdProp, () => ( _optionalChain([price, 'optionalAccess', _139 => _139.product, 'optionalAccess', _140 => _140.id])));
3893
+ const productId = _nullishCoalesce(productIdProp, () => ( _optionalChain([price, 'optionalAccess', _154 => _154.product, 'optionalAccess', _155 => _155.id])));
3605
3894
  const reloadPrice = _react.useCallback.call(void 0, async () => {
3606
- if (!_optionalChain([price, 'optionalAccess', _141 => _141.id])) return;
3607
- setPrice(await _chunkG6UE6MEPjs.StripePriceService.getPrice({ id: price.id }));
3608
- }, [_optionalChain([price, 'optionalAccess', _142 => _142.id])]);
3895
+ if (!_optionalChain([price, 'optionalAccess', _156 => _156.id])) return;
3896
+ setPrice(await _chunkHKZAESS6js.StripePriceService.getPrice({ id: price.id }));
3897
+ }, [_optionalChain([price, 'optionalAccess', _157 => _157.id])]);
3609
3898
  const createPrice = _react.useCallback.call(void 0,
3610
3899
  async (input) => {
3611
- const saved = await _chunkG6UE6MEPjs.StripePriceService.createPrice(input);
3900
+ const saved = await _chunkHKZAESS6js.StripePriceService.createPrice(input);
3612
3901
  refreshPrices();
3613
3902
  return saved;
3614
3903
  },
@@ -3616,7 +3905,7 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
3616
3905
  );
3617
3906
  const updatePrice = _react.useCallback.call(void 0,
3618
3907
  async (input) => {
3619
- const saved = await _chunkG6UE6MEPjs.StripePriceService.updatePrice(input);
3908
+ const saved = await _chunkHKZAESS6js.StripePriceService.updatePrice(input);
3620
3909
  setPrice(saved);
3621
3910
  refreshPrices();
3622
3911
  return saved;
@@ -3625,23 +3914,23 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
3625
3914
  );
3626
3915
  const archivePrice = _react.useCallback.call(void 0,
3627
3916
  async (id) => {
3628
- const target = _nullishCoalesce(id, () => ( _optionalChain([price, 'optionalAccess', _143 => _143.id])));
3917
+ const target = _nullishCoalesce(id, () => ( _optionalChain([price, 'optionalAccess', _158 => _158.id])));
3629
3918
  if (!target) return;
3630
- await _chunkG6UE6MEPjs.StripePriceService.archivePrice({ id: target });
3919
+ await _chunkHKZAESS6js.StripePriceService.archivePrice({ id: target });
3631
3920
  await reloadPrice();
3632
3921
  refreshPrices();
3633
3922
  },
3634
- [_optionalChain([price, 'optionalAccess', _144 => _144.id]), reloadPrice, refreshPrices]
3923
+ [_optionalChain([price, 'optionalAccess', _159 => _159.id]), reloadPrice, refreshPrices]
3635
3924
  );
3636
3925
  const restorePrice = _react.useCallback.call(void 0,
3637
3926
  async (id) => {
3638
- const target = _nullishCoalesce(id, () => ( _optionalChain([price, 'optionalAccess', _145 => _145.id])));
3927
+ const target = _nullishCoalesce(id, () => ( _optionalChain([price, 'optionalAccess', _160 => _160.id])));
3639
3928
  if (!target) return;
3640
- await _chunkG6UE6MEPjs.StripePriceService.reactivatePrice({ id: target });
3929
+ await _chunkHKZAESS6js.StripePriceService.reactivatePrice({ id: target });
3641
3930
  await reloadPrice();
3642
3931
  refreshPrices();
3643
3932
  },
3644
- [_optionalChain([price, 'optionalAccess', _146 => _146.id]), reloadPrice, refreshPrices]
3933
+ [_optionalChain([price, 'optionalAccess', _161 => _161.id]), reloadPrice, refreshPrices]
3645
3934
  );
3646
3935
  const value = _react.useMemo.call(void 0,
3647
3936
  () => ({
@@ -3661,12 +3950,12 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
3661
3950
  if (!publishChrome) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceContext.Provider, { value, children });
3662
3951
  const breadcrumb = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
3663
3952
  const items = [
3664
- { name: t("billing.admin.products.title"), href: generateUrl({ page: _chunkG6UE6MEPjs.Modules.StripeProduct }) }
3953
+ { name: t("billing.admin.products.title"), href: generateUrl({ page: _chunkHKZAESS6js.Modules.StripeProduct }) }
3665
3954
  ];
3666
- if (_optionalChain([price, 'optionalAccess', _147 => _147.product]))
3955
+ if (_optionalChain([price, 'optionalAccess', _162 => _162.product]))
3667
3956
  items.push({
3668
3957
  name: price.product.name,
3669
- href: generateUrl({ page: _chunkG6UE6MEPjs.Modules.StripeProduct, id: price.product.id })
3958
+ href: generateUrl({ page: _chunkHKZAESS6js.Modules.StripeProduct, id: price.product.id })
3670
3959
  });
3671
3960
  if (price) items.push({ name: priceLabel(price, fmt) });
3672
3961
  return items;
@@ -3683,7 +3972,7 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
3683
3972
  }
3684
3973
  return response;
3685
3974
  }, "title");
3686
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceContext.Provider, { value, children }) });
3975
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceContext.Provider, { value, children }) });
3687
3976
  }, "PriceProvider");
3688
3977
  var usePriceContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => _nullishCoalesce(_react.useContext.call(void 0, PriceContext), () => ( defaultContextValue)), "usePriceContext");
3689
3978
 
@@ -3703,12 +3992,12 @@ function ProductArchiver({ product }) {
3703
3992
  const isArchived = !product.active;
3704
3993
  const scope = isArchived ? "restore" : "archive";
3705
3994
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
3706
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.Button, { variant: "outline", size: "sm", onClick: () => setOpen(true), children: [
3995
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.Button, { variant: "outline", size: "sm", onClick: () => setOpen(true), children: [
3707
3996
  isArchived ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RotateCcwIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ArchiveIcon, {}),
3708
3997
  t(`billing.admin.products.${scope}.confirm`)
3709
3998
  ] }),
3710
3999
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3711
- _chunkTY5FYP3Gjs.ConfirmDialog,
4000
+ _chunkLQ4DK4JFjs.ConfirmDialog,
3712
4001
  {
3713
4002
  open,
3714
4003
  onOpenChange: setOpen,
@@ -3722,7 +4011,7 @@ function ProductArchiver({ product }) {
3722
4011
  if (isArchived) await restoreProduct(product.id);
3723
4012
  else await archiveProduct(product.id);
3724
4013
  } catch (error) {
3725
- _chunkTY5FYP3Gjs.errorToast.call(void 0, { title: t(`billing.admin.products.${scope}.title`), error });
4014
+ _chunkLQ4DK4JFjs.errorToast.call(void 0, { title: t(`billing.admin.products.${scope}.title`), error });
3726
4015
  throw error;
3727
4016
  }
3728
4017
  }
@@ -3751,7 +4040,7 @@ function ProductEditorInternal({
3751
4040
  onDialogOpenChange
3752
4041
  }) {
3753
4042
  const t = _nextintl.useTranslations.call(void 0, );
3754
- const router = _chunkG6UE6MEPjs.useI18nRouter.call(void 0, );
4043
+ const router = _chunkHKZAESS6js.useI18nRouter.call(void 0, );
3755
4044
  const { createProduct, updateProduct } = useProductContext();
3756
4045
  const isEdit = !!product;
3757
4046
  const formSchema2 = _react.useMemo.call(void 0,
@@ -3764,9 +4053,9 @@ function ProductEditorInternal({
3764
4053
  );
3765
4054
  const getDefaultValues = _react.useCallback.call(void 0,
3766
4055
  () => ({
3767
- id: _nullishCoalesce(_optionalChain([product, 'optionalAccess', _148 => _148.id]), () => ( _uuid.v4.call(void 0, ))),
3768
- name: _nullishCoalesce(_optionalChain([product, 'optionalAccess', _149 => _149.name]), () => ( "")),
3769
- description: _nullishCoalesce(_optionalChain([product, 'optionalAccess', _150 => _150.description]), () => ( ""))
4056
+ id: _nullishCoalesce(_optionalChain([product, 'optionalAccess', _163 => _163.id]), () => ( _uuid.v4.call(void 0, ))),
4057
+ name: _nullishCoalesce(_optionalChain([product, 'optionalAccess', _164 => _164.name]), () => ( "")),
4058
+ description: _nullishCoalesce(_optionalChain([product, 'optionalAccess', _165 => _165.description]), () => ( ""))
3770
4059
  }),
3771
4060
  [product]
3772
4061
  );
@@ -3775,13 +4064,13 @@ function ProductEditorInternal({
3775
4064
  defaultValues: getDefaultValues()
3776
4065
  });
3777
4066
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3778
- _chunkTY5FYP3Gjs.EditorSheet,
4067
+ _chunkLQ4DK4JFjs.EditorSheet,
3779
4068
  {
3780
4069
  form,
3781
4070
  entityType: t("billing.admin.products.entity"),
3782
- entityName: _optionalChain([product, 'optionalAccess', _151 => _151.name]),
4071
+ entityName: _optionalChain([product, 'optionalAccess', _166 => _166.name]),
3783
4072
  isEdit,
3784
- module: _chunkG6UE6MEPjs.Modules.StripeProduct,
4073
+ module: _chunkHKZAESS6js.Modules.StripeProduct,
3785
4074
  size: "md",
3786
4075
  propagateChanges,
3787
4076
  onSuccess,
@@ -3798,7 +4087,7 @@ function ProductEditorInternal({
3798
4087
  onDialogOpenChange,
3799
4088
  children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
3800
4089
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3801
- _chunkTY5FYP3Gjs.FormInput,
4090
+ _chunkLQ4DK4JFjs.FormInput,
3802
4091
  {
3803
4092
  form,
3804
4093
  id: "name",
@@ -3808,7 +4097,7 @@ function ProductEditorInternal({
3808
4097
  }
3809
4098
  ),
3810
4099
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3811
- _chunkTY5FYP3Gjs.FormTextarea,
4100
+ _chunkLQ4DK4JFjs.FormTextarea,
3812
4101
  {
3813
4102
  form,
3814
4103
  id: "description",
@@ -3852,20 +4141,20 @@ var defaultContextValue2 = {
3852
4141
  };
3853
4142
  var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ children, dehydratedProduct, publishChrome = true }) => {
3854
4143
  const t = _nextintl.useTranslations.call(void 0, );
3855
- const generateUrl = _chunkTY5FYP3Gjs.usePageUrlGenerator.call(void 0, );
3856
- const { hasRole } = _chunkTY5FYP3Gjs.useCurrentUserContext.call(void 0, );
4144
+ const generateUrl = _chunkLQ4DK4JFjs.usePageUrlGenerator.call(void 0, );
4145
+ const { hasRole } = _chunkLQ4DK4JFjs.useCurrentUserContext.call(void 0, );
3857
4146
  const [product, setProduct] = _react.useState.call(void 0,
3858
- dehydratedProduct ? _chunkG6UE6MEPjs.rehydrate.call(void 0, _chunkG6UE6MEPjs.Modules.StripeProduct, dehydratedProduct) : void 0
4147
+ dehydratedProduct ? _chunkHKZAESS6js.rehydrate.call(void 0, _chunkHKZAESS6js.Modules.StripeProduct, dehydratedProduct) : void 0
3859
4148
  );
3860
4149
  const [catalogueVersion, setCatalogueVersion] = _react.useState.call(void 0, 0);
3861
4150
  const refreshCatalogue = _react.useCallback.call(void 0, () => setCatalogueVersion((value2) => value2 + 1), []);
3862
4151
  const reloadProduct = _react.useCallback.call(void 0, async () => {
3863
- if (!_optionalChain([product, 'optionalAccess', _152 => _152.id])) return;
3864
- setProduct(await _chunkG6UE6MEPjs.StripeProductService.getProduct({ id: product.id }));
3865
- }, [_optionalChain([product, 'optionalAccess', _153 => _153.id])]);
4152
+ if (!_optionalChain([product, 'optionalAccess', _167 => _167.id])) return;
4153
+ setProduct(await _chunkHKZAESS6js.StripeProductService.getProduct({ id: product.id }));
4154
+ }, [_optionalChain([product, 'optionalAccess', _168 => _168.id])]);
3866
4155
  const createProduct = _react.useCallback.call(void 0,
3867
4156
  async (input) => {
3868
- const saved = await _chunkG6UE6MEPjs.StripeProductService.createProduct(input);
4157
+ const saved = await _chunkHKZAESS6js.StripeProductService.createProduct(input);
3869
4158
  refreshCatalogue();
3870
4159
  return saved;
3871
4160
  },
@@ -3873,7 +4162,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
3873
4162
  );
3874
4163
  const updateProduct = _react.useCallback.call(void 0,
3875
4164
  async (input) => {
3876
- const saved = await _chunkG6UE6MEPjs.StripeProductService.updateProduct(input);
4165
+ const saved = await _chunkHKZAESS6js.StripeProductService.updateProduct(input);
3877
4166
  setProduct(saved);
3878
4167
  refreshCatalogue();
3879
4168
  return saved;
@@ -3882,23 +4171,23 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
3882
4171
  );
3883
4172
  const archiveProduct = _react.useCallback.call(void 0,
3884
4173
  async (id) => {
3885
- const target = _nullishCoalesce(id, () => ( _optionalChain([product, 'optionalAccess', _154 => _154.id])));
4174
+ const target = _nullishCoalesce(id, () => ( _optionalChain([product, 'optionalAccess', _169 => _169.id])));
3886
4175
  if (!target) return;
3887
- await _chunkG6UE6MEPjs.StripeProductService.archiveProduct({ id: target });
4176
+ await _chunkHKZAESS6js.StripeProductService.archiveProduct({ id: target });
3888
4177
  await reloadProduct();
3889
4178
  refreshCatalogue();
3890
4179
  },
3891
- [_optionalChain([product, 'optionalAccess', _155 => _155.id]), reloadProduct, refreshCatalogue]
4180
+ [_optionalChain([product, 'optionalAccess', _170 => _170.id]), reloadProduct, refreshCatalogue]
3892
4181
  );
3893
4182
  const restoreProduct = _react.useCallback.call(void 0,
3894
4183
  async (id) => {
3895
- const target = _nullishCoalesce(id, () => ( _optionalChain([product, 'optionalAccess', _156 => _156.id])));
4184
+ const target = _nullishCoalesce(id, () => ( _optionalChain([product, 'optionalAccess', _171 => _171.id])));
3896
4185
  if (!target) return;
3897
- await _chunkG6UE6MEPjs.StripeProductService.reactivateProduct({ id: target });
4186
+ await _chunkHKZAESS6js.StripeProductService.reactivateProduct({ id: target });
3898
4187
  await reloadProduct();
3899
4188
  refreshCatalogue();
3900
4189
  },
3901
- [_optionalChain([product, 'optionalAccess', _157 => _157.id]), reloadProduct, refreshCatalogue]
4190
+ [_optionalChain([product, 'optionalAccess', _172 => _172.id]), reloadProduct, refreshCatalogue]
3902
4191
  );
3903
4192
  const value = _react.useMemo.call(void 0,
3904
4193
  () => ({
@@ -3929,7 +4218,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
3929
4218
  {
3930
4219
  name: t("billing.admin.products.title"),
3931
4220
  // Linked only when it is NOT the current page.
3932
- ...product ? { href: generateUrl({ page: _chunkG6UE6MEPjs.Modules.StripeProduct }) } : {}
4221
+ ...product ? { href: generateUrl({ page: _chunkHKZAESS6js.Modules.StripeProduct }) } : {}
3933
4222
  }
3934
4223
  ];
3935
4224
  if (product) items.push({ name: product.name });
@@ -3947,7 +4236,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
3947
4236
  }
3948
4237
  return response;
3949
4238
  }, "title");
3950
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductContext.Provider, { value, children }) });
4239
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductContext.Provider, { value, children }) });
3951
4240
  }, "ProductProvider");
3952
4241
  var useProductContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => _nullishCoalesce(_react.useContext.call(void 0, ProductContext), () => ( defaultContextValue2)), "useProductContext");
3953
4242
 
@@ -3956,83 +4245,83 @@ var useProductContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ()
3956
4245
 
3957
4246
  function PriceDetails() {
3958
4247
  const t = _nextintl.useTranslations.call(void 0, );
3959
- const fmt = _chunkTY5FYP3Gjs.useBillingFormatOptions.call(void 0, );
3960
- const generateUrl = _chunkTY5FYP3Gjs.usePageUrlGenerator.call(void 0, );
4248
+ const fmt = _chunkLQ4DK4JFjs.useBillingFormatOptions.call(void 0, );
4249
+ const generateUrl = _chunkLQ4DK4JFjs.usePageUrlGenerator.call(void 0, );
3961
4250
  const { price } = usePriceContext();
3962
4251
  if (!price) return null;
3963
4252
  const isRecurring = price.priceType === "recurring";
3964
4253
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-8", children: [
3965
4254
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
3966
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.SectionHeader, { children: t("billing.admin.prices.title") }),
4255
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.SectionHeader, { children: t("billing.admin.prices.title") }),
3967
4256
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
3968
4257
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3969
- _chunkTY5FYP3Gjs.DetailField,
4258
+ _chunkLQ4DK4JFjs.DetailField,
3970
4259
  {
3971
4260
  label: t("billing.admin.prices.fields.product"),
3972
- value: price.product ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Link, { href: generateUrl({ page: _chunkG6UE6MEPjs.Modules.StripeProduct, id: price.product.id }), children: price.product.name }) : "\u2014"
4261
+ value: price.product ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Link, { href: generateUrl({ page: _chunkHKZAESS6js.Modules.StripeProduct, id: price.product.id }), children: price.product.name }) : "\u2014"
3973
4262
  }
3974
4263
  ),
3975
4264
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3976
- _chunkTY5FYP3Gjs.DetailField,
4265
+ _chunkLQ4DK4JFjs.DetailField,
3977
4266
  {
3978
4267
  label: t("billing.admin.prices.fields.status"),
3979
4268
  value: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex flex-wrap items-center gap-1", children: [
3980
- price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Badge, { variant: "softGreen", children: t("billing.admin.prices.status.active") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Badge, { variant: "softGray", children: t("billing.admin.prices.status.archived") }),
3981
- price.isTrial && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Badge, { variant: "softBlue", children: t("billing.admin.prices.badge.trial") })
4269
+ price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Badge, { variant: "softGreen", children: t("billing.admin.prices.status.active") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Badge, { variant: "softGray", children: t("billing.admin.prices.status.archived") }),
4270
+ price.isTrial && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Badge, { variant: "softBlue", children: t("billing.admin.prices.badge.trial") })
3982
4271
  ] })
3983
4272
  }
3984
4273
  ),
3985
4274
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3986
- _chunkTY5FYP3Gjs.DetailField,
4275
+ _chunkLQ4DK4JFjs.DetailField,
3987
4276
  {
3988
4277
  label: t("billing.admin.prices.fields.amount"),
3989
- value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _chunkTY5FYP3Gjs.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt) })
4278
+ value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _chunkHKZAESS6js.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt) })
3990
4279
  }
3991
4280
  ),
3992
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.DetailField, { label: t("billing.admin.prices.fields.currency"), value: price.currency.toUpperCase() }),
4281
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.DetailField, { label: t("billing.admin.prices.fields.currency"), value: price.currency.toUpperCase() }),
3993
4282
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3994
- _chunkTY5FYP3Gjs.DetailField,
4283
+ _chunkLQ4DK4JFjs.DetailField,
3995
4284
  {
3996
4285
  label: t("billing.admin.prices.fields.type"),
3997
4286
  value: isRecurring ? t("billing.admin.prices.type.recurring") : t("billing.admin.prices.type.oneTime")
3998
4287
  }
3999
4288
  ),
4000
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.DetailField, { label: t("billing.admin.prices.fields.billing"), value: _chunkTY5FYP3Gjs.formatInterval.call(void 0, price, fmt) }),
4289
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.DetailField, { label: t("billing.admin.prices.fields.billing"), value: _chunkHKZAESS6js.formatInterval.call(void 0, price, fmt) }),
4001
4290
  isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4002
- _chunkTY5FYP3Gjs.DetailField,
4291
+ _chunkLQ4DK4JFjs.DetailField,
4003
4292
  {
4004
4293
  label: t("billing.admin.prices.fields.intervalCount"),
4005
- value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _nullishCoalesce(_optionalChain([price, 'access', _158 => _158.recurring, 'optionalAccess', _159 => _159.intervalCount]), () => ( 1)) })
4294
+ value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _nullishCoalesce(_optionalChain([price, 'access', _173 => _173.recurring, 'optionalAccess', _174 => _174.intervalCount]), () => ( 1)) })
4006
4295
  }
4007
4296
  ),
4008
4297
  isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4009
- _chunkTY5FYP3Gjs.DetailField,
4298
+ _chunkLQ4DK4JFjs.DetailField,
4010
4299
  {
4011
4300
  label: t("billing.admin.prices.fields.usageType"),
4012
- value: _optionalChain([price, 'access', _160 => _160.recurring, 'optionalAccess', _161 => _161.usageType]) === "metered" ? t("billing.admin.prices.usage.metered") : t("billing.admin.prices.usage.licensed")
4301
+ value: _optionalChain([price, 'access', _175 => _175.recurring, 'optionalAccess', _176 => _176.usageType]) === "metered" ? t("billing.admin.prices.usage.metered") : t("billing.admin.prices.usage.licensed")
4013
4302
  }
4014
4303
  )
4015
4304
  ] })
4016
4305
  ] }),
4017
4306
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
4018
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.SectionHeader, { children: t("billing.admin.prices.fields.platformFeatures") }),
4307
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.SectionHeader, { children: t("billing.admin.prices.fields.platformFeatures") }),
4019
4308
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
4020
4309
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4021
- _chunkTY5FYP3Gjs.DetailField,
4310
+ _chunkLQ4DK4JFjs.DetailField,
4022
4311
  {
4023
4312
  label: t("billing.admin.prices.fields.token"),
4024
4313
  value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _nullishCoalesce(price.token, () => ( "\u2014")) })
4025
4314
  }
4026
4315
  ),
4027
4316
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4028
- _chunkTY5FYP3Gjs.DetailField,
4317
+ _chunkLQ4DK4JFjs.DetailField,
4029
4318
  {
4030
4319
  label: t("billing.admin.prices.fields.stripeId"),
4031
4320
  value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: price.stripePriceId })
4032
4321
  }
4033
4322
  ),
4034
4323
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4035
- _chunkTY5FYP3Gjs.DetailField,
4324
+ _chunkLQ4DK4JFjs.DetailField,
4036
4325
  {
4037
4326
  label: t("billing.admin.prices.fields.description"),
4038
4327
  value: _nullishCoalesce(price.description, () => ( "\u2014")),
@@ -4040,7 +4329,7 @@ function PriceDetails() {
4040
4329
  }
4041
4330
  ),
4042
4331
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4043
- _chunkTY5FYP3Gjs.DetailField,
4332
+ _chunkLQ4DK4JFjs.DetailField,
4044
4333
  {
4045
4334
  label: t("billing.admin.prices.fields.features"),
4046
4335
  className: "md:col-span-2",
@@ -4048,11 +4337,11 @@ function PriceDetails() {
4048
4337
  }
4049
4338
  ),
4050
4339
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4051
- _chunkTY5FYP3Gjs.DetailField,
4340
+ _chunkLQ4DK4JFjs.DetailField,
4052
4341
  {
4053
4342
  label: t("billing.admin.prices.fields.platformFeatures"),
4054
4343
  className: "md:col-span-2",
4055
- value: price.priceFeatures.length > 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "flex flex-wrap items-center gap-1", children: price.priceFeatures.map((feature) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Badge, { variant: "softGray", children: feature.name }, feature.id)) }) : "\u2014"
4344
+ value: price.priceFeatures.length > 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "flex flex-wrap items-center gap-1", children: price.priceFeatures.map((feature) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Badge, { variant: "softGray", children: feature.name }, feature.id)) }) : "\u2014"
4056
4345
  }
4057
4346
  )
4058
4347
  ] })
@@ -4066,7 +4355,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, PriceDetails, "PriceDetails");
4066
4355
  function PriceContainer() {
4067
4356
  const { price } = usePriceContext();
4068
4357
  if (!price) return null;
4069
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.RoundPageContainer, { module: _chunkG6UE6MEPjs.Modules.StripePrice, id: price.id, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceDetails, {}) });
4358
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.RoundPageContainer, { module: _chunkHKZAESS6js.Modules.StripePrice, id: price.id, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceDetails, {}) });
4070
4359
  }
4071
4360
  _chunk7QVYU63Ejs.__name.call(void 0, PriceContainer, "PriceContainer");
4072
4361
 
@@ -4110,25 +4399,25 @@ function priceToSeed(price) {
4110
4399
  const priceType = readOptional(() => price.priceType);
4111
4400
  const currency = readOptional(() => price.currency);
4112
4401
  const recurring = price.recurring;
4113
- const interval = priceType === "one_time" ? "one_time" : _nullishCoalesce(_optionalChain([recurring, 'optionalAccess', _162 => _162.interval]), () => ( "month"));
4402
+ const interval = priceType === "one_time" ? "one_time" : _nullishCoalesce(_optionalChain([recurring, 'optionalAccess', _177 => _177.interval]), () => ( "month"));
4114
4403
  const seed = {
4115
4404
  unitAmount: _nullishCoalesce(price.unitAmount, () => ( 0)),
4116
4405
  currency: _nullishCoalesce(currency, () => ( "usd")),
4117
4406
  interval
4118
4407
  };
4119
4408
  if (interval !== "one_time") {
4120
- if (typeof _optionalChain([recurring, 'optionalAccess', _163 => _163.intervalCount]) === "number") seed.intervalCount = recurring.intervalCount;
4121
- if (_optionalChain([recurring, 'optionalAccess', _164 => _164.usageType])) seed.usageType = recurring.usageType;
4409
+ if (typeof _optionalChain([recurring, 'optionalAccess', _178 => _178.intervalCount]) === "number") seed.intervalCount = recurring.intervalCount;
4410
+ if (_optionalChain([recurring, 'optionalAccess', _179 => _179.usageType])) seed.usageType = recurring.usageType;
4122
4411
  }
4123
- const nickname = _optionalChain([price, 'access', _165 => _165.nickname, 'optionalAccess', _166 => _166.trim, 'call', _167 => _167()]);
4412
+ const nickname = _optionalChain([price, 'access', _180 => _180.nickname, 'optionalAccess', _181 => _181.trim, 'call', _182 => _182()]);
4124
4413
  if (nickname) seed.nickname = nickname;
4125
- const description = _optionalChain([price, 'access', _168 => _168.description, 'optionalAccess', _169 => _169.trim, 'call', _170 => _170()]);
4414
+ const description = _optionalChain([price, 'access', _183 => _183.description, 'optionalAccess', _184 => _184.trim, 'call', _185 => _185()]);
4126
4415
  if (description) seed.description = description;
4127
4416
  const features = nonEmptyStrings(price.features);
4128
4417
  if (features.length > 0) seed.features = features;
4129
4418
  if (typeof price.token === "number" && !Number.isNaN(price.token)) seed.token = price.token;
4130
4419
  if (typeof price.isTrial === "boolean") seed.isTrial = price.isTrial;
4131
- const platformFeatures = nonEmptyStrings(_optionalChain([price, 'access', _171 => _171.priceFeatures, 'optionalAccess', _172 => _172.map, 'call', _173 => _173((feature) => feature.name)]));
4420
+ const platformFeatures = nonEmptyStrings(_optionalChain([price, 'access', _186 => _186.priceFeatures, 'optionalAccess', _187 => _187.map, 'call', _188 => _188((feature) => feature.name)]));
4132
4421
  if (platformFeatures.length > 0) seed.platformFeatures = platformFeatures;
4133
4422
  return seed;
4134
4423
  }
@@ -4191,10 +4480,10 @@ function PricesList({ productId, fullWidth }) {
4191
4480
  const importInputRef = _react.useRef.call(void 0, null);
4192
4481
  const [seed, setSeed] = _react.useState.call(void 0, void 0);
4193
4482
  const [seedNonce, setSeedNonce] = _react.useState.call(void 0, 0);
4194
- const data = _chunkTY5FYP3Gjs.useDataListRetriever.call(void 0, {
4195
- retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunkG6UE6MEPjs.StripePriceService.listPrices({ ...params, productId }), "retriever"),
4483
+ const data = _chunkLQ4DK4JFjs.useDataListRetriever.call(void 0, {
4484
+ retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunkHKZAESS6js.StripePriceService.listPrices({ ...params, productId }), "retriever"),
4196
4485
  retrieverParams: {},
4197
- module: _chunkG6UE6MEPjs.Modules.StripePrice
4486
+ module: _chunkHKZAESS6js.Modules.StripePrice
4198
4487
  });
4199
4488
  _react.useEffect.call(void 0, () => {
4200
4489
  if (priceVersion > 0) void data.refresh();
@@ -4221,7 +4510,7 @@ function PricesList({ productId, fullWidth }) {
4221
4510
  const onImportFileChange = _react.useCallback.call(void 0,
4222
4511
  async (event) => {
4223
4512
  const input = event.target;
4224
- const file = _optionalChain([input, 'access', _174 => _174.files, 'optionalAccess', _175 => _175[0]]);
4513
+ const file = _optionalChain([input, 'access', _189 => _189.files, 'optionalAccess', _190 => _190[0]]);
4225
4514
  input.value = "";
4226
4515
  if (!file) return;
4227
4516
  try {
@@ -4229,7 +4518,7 @@ function PricesList({ productId, fullWidth }) {
4229
4518
  openSeededEditor(transfer.price);
4230
4519
  } catch (error) {
4231
4520
  console.error("[PricesList] price import failed", error);
4232
- _chunkTY5FYP3Gjs.errorToast.call(void 0, {
4521
+ _chunkLQ4DK4JFjs.errorToast.call(void 0, {
4233
4522
  title: t("billing.admin.prices.import.errors.title"),
4234
4523
  error: t("billing.admin.prices.import.errors.invalid")
4235
4524
  });
@@ -4248,7 +4537,7 @@ function PricesList({ productId, fullWidth }) {
4248
4537
  "create-price"
4249
4538
  ),
4250
4539
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _react.Fragment, { children: [
4251
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkTY5FYP3Gjs.Button, { variant: "outline", size: "sm", type: "button", onClick: () => _optionalChain([importInputRef, 'access', _176 => _176.current, 'optionalAccess', _177 => _177.click, 'call', _178 => _178()]), children: [
4540
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkLQ4DK4JFjs.Button, { variant: "outline", size: "sm", type: "button", onClick: () => _optionalChain([importInputRef, 'access', _191 => _191.current, 'optionalAccess', _192 => _192.click, 'call', _193 => _193()]), children: [
4252
4541
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.UploadIcon, {}),
4253
4542
  t("billing.admin.prices.actions.import")
4254
4543
  ] }),
@@ -4266,7 +4555,7 @@ function PricesList({ productId, fullWidth }) {
4266
4555
  ];
4267
4556
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
4268
4557
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4269
- _chunkTY5FYP3Gjs.ContentListTable,
4558
+ _chunkLQ4DK4JFjs.ContentListTable,
4270
4559
  {
4271
4560
  data,
4272
4561
  fields: [
@@ -4277,13 +4566,13 @@ function PricesList({ productId, fullWidth }) {
4277
4566
  "status" /* status */,
4278
4567
  "actions" /* actions */
4279
4568
  ],
4280
- tableGeneratorType: _chunkG6UE6MEPjs.Modules.StripePrice,
4569
+ tableGeneratorType: _chunkHKZAESS6js.Modules.StripePrice,
4281
4570
  functions,
4282
4571
  context: tableContext,
4283
4572
  fullWidth,
4284
4573
  title: t("billing.admin.prices.title"),
4285
4574
  emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4286
- _chunkTY5FYP3Gjs.EmptyState,
4575
+ _chunkLQ4DK4JFjs.EmptyState,
4287
4576
  {
4288
4577
  icon: _lucidereact.DollarSignIcon,
4289
4578
  title: t("billing.admin.prices.empty.title"),
@@ -4323,18 +4612,18 @@ function ProductDetails() {
4323
4612
  const { product } = useProductContext();
4324
4613
  if (!product) return null;
4325
4614
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
4326
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.SectionHeader, { children: t("billing.admin.products.tabs.details") }),
4615
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.SectionHeader, { children: t("billing.admin.products.tabs.details") }),
4327
4616
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
4328
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.DetailField, { label: t("billing.admin.products.fields.name"), value: product.name }),
4617
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.DetailField, { label: t("billing.admin.products.fields.name"), value: product.name }),
4329
4618
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4330
- _chunkTY5FYP3Gjs.DetailField,
4619
+ _chunkLQ4DK4JFjs.DetailField,
4331
4620
  {
4332
4621
  label: t("billing.admin.products.fields.status"),
4333
- value: product.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Badge, { variant: "softGreen", children: t("billing.admin.products.status.active") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.Badge, { variant: "softGray", children: t("billing.admin.products.status.archived") })
4622
+ value: product.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Badge, { variant: "softGreen", children: t("billing.admin.products.status.active") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Badge, { variant: "softGray", children: t("billing.admin.products.status.archived") })
4334
4623
  }
4335
4624
  ),
4336
4625
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4337
- _chunkTY5FYP3Gjs.DetailField,
4626
+ _chunkLQ4DK4JFjs.DetailField,
4338
4627
  {
4339
4628
  label: t("billing.admin.products.fields.description"),
4340
4629
  value: _nullishCoalesce(product.description, () => ( "\u2014")),
@@ -4342,14 +4631,14 @@ function ProductDetails() {
4342
4631
  }
4343
4632
  ),
4344
4633
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4345
- _chunkTY5FYP3Gjs.DetailField,
4634
+ _chunkLQ4DK4JFjs.DetailField,
4346
4635
  {
4347
4636
  label: t("billing.admin.products.fields.prices"),
4348
4637
  value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: product.stripePrices.length })
4349
4638
  }
4350
4639
  ),
4351
4640
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4352
- _chunkTY5FYP3Gjs.DetailField,
4641
+ _chunkLQ4DK4JFjs.DetailField,
4353
4642
  {
4354
4643
  label: t("billing.admin.products.fields.stripeId"),
4355
4644
  value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: product.stripeProductId })
@@ -4367,9 +4656,9 @@ function ProductContainer() {
4367
4656
  const { product } = useProductContext();
4368
4657
  if (!product) return null;
4369
4658
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4370
- _chunkTY5FYP3Gjs.RoundPageContainer,
4659
+ _chunkLQ4DK4JFjs.RoundPageContainer,
4371
4660
  {
4372
- module: _chunkG6UE6MEPjs.Modules.StripeProduct,
4661
+ module: _chunkHKZAESS6js.Modules.StripeProduct,
4373
4662
  id: product.id,
4374
4663
  tabs: [
4375
4664
  {
@@ -4378,7 +4667,7 @@ function ProductContainer() {
4378
4667
  content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductDetails, {})
4379
4668
  },
4380
4669
  {
4381
- key: _chunkG6UE6MEPjs.Modules.StripePrice,
4670
+ key: _chunkHKZAESS6js.Modules.StripePrice,
4382
4671
  label: t("billing.admin.prices.title"),
4383
4672
  // publishChrome={false}: SharedProvider REPLACES its value for the
4384
4673
  // subtree (SharedContext.tsx:35-37), so a nested provider publishing
@@ -4394,6 +4683,54 @@ function ProductContainer() {
4394
4683
  }
4395
4684
  _chunk7QVYU63Ejs.__name.call(void 0, ProductContainer, "ProductContainer");
4396
4685
 
4686
+ // src/features/billing/stripe-product/components/containers/ProductsListContainer.tsx
4687
+
4688
+
4689
+ // src/features/billing/stripe-coupon/components/lists/CouponsList.tsx
4690
+
4691
+
4692
+
4693
+
4694
+ function CouponsList({ fullWidth } = {}) {
4695
+ const t = _nextintl.useTranslations.call(void 0, );
4696
+ const { catalogueVersion } = _chunkLQ4DK4JFjs.useCouponContext.call(void 0, );
4697
+ const data = _chunkLQ4DK4JFjs.useDataListRetriever.call(void 0, {
4698
+ retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunkHKZAESS6js.StripeCouponService.listCoupons(params), "retriever"),
4699
+ retrieverParams: {},
4700
+ module: _chunkHKZAESS6js.Modules.StripeCoupon
4701
+ });
4702
+ _react.useEffect.call(void 0, () => {
4703
+ if (catalogueVersion > 0) void data.refresh();
4704
+ }, [catalogueVersion]);
4705
+ const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.CouponEditor, {}, "create-coupon")];
4706
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4707
+ _chunkLQ4DK4JFjs.ContentListTable,
4708
+ {
4709
+ data,
4710
+ fields: [
4711
+ "name" /* name */,
4712
+ "discount" /* discount */,
4713
+ "places" /* places */,
4714
+ "codes" /* codes */,
4715
+ "status" /* status */
4716
+ ],
4717
+ tableGeneratorType: _chunkHKZAESS6js.Modules.StripeCoupon,
4718
+ functions,
4719
+ fullWidth,
4720
+ title: t("billing.admin.coupons.title"),
4721
+ emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4722
+ _chunkLQ4DK4JFjs.EmptyState,
4723
+ {
4724
+ icon: _lucidereact.TicketPercentIcon,
4725
+ title: t("billing.admin.coupons.empty.title"),
4726
+ description: t("billing.admin.coupons.empty.description")
4727
+ }
4728
+ )
4729
+ }
4730
+ );
4731
+ }
4732
+ _chunk7QVYU63Ejs.__name.call(void 0, CouponsList, "CouponsList");
4733
+
4397
4734
  // src/features/billing/stripe-product/components/lists/ProductsList.tsx
4398
4735
 
4399
4736
 
@@ -4402,26 +4739,26 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductContainer, "ProductContainer");
4402
4739
  function ProductsList({ fullWidth } = {}) {
4403
4740
  const t = _nextintl.useTranslations.call(void 0, );
4404
4741
  const { catalogueVersion } = useProductContext();
4405
- const data = _chunkTY5FYP3Gjs.useDataListRetriever.call(void 0, {
4406
- retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunkG6UE6MEPjs.StripeProductService.listProducts(params), "retriever"),
4742
+ const data = _chunkLQ4DK4JFjs.useDataListRetriever.call(void 0, {
4743
+ retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunkHKZAESS6js.StripeProductService.listProducts(params), "retriever"),
4407
4744
  retrieverParams: {},
4408
- module: _chunkG6UE6MEPjs.Modules.StripeProduct
4745
+ module: _chunkHKZAESS6js.Modules.StripeProduct
4409
4746
  });
4410
4747
  _react.useEffect.call(void 0, () => {
4411
4748
  if (catalogueVersion > 0) void data.refresh();
4412
4749
  }, [catalogueVersion]);
4413
4750
  const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductEditor, {}, "create-product")];
4414
4751
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4415
- _chunkTY5FYP3Gjs.ContentListTable,
4752
+ _chunkLQ4DK4JFjs.ContentListTable,
4416
4753
  {
4417
4754
  data,
4418
4755
  fields: ["name" /* name */, "status" /* status */, "prices" /* prices */],
4419
- tableGeneratorType: _chunkG6UE6MEPjs.Modules.StripeProduct,
4756
+ tableGeneratorType: _chunkHKZAESS6js.Modules.StripeProduct,
4420
4757
  functions,
4421
4758
  fullWidth,
4422
4759
  title: t("billing.admin.products.title"),
4423
4760
  emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4424
- _chunkTY5FYP3Gjs.EmptyState,
4761
+ _chunkLQ4DK4JFjs.EmptyState,
4425
4762
  {
4426
4763
  icon: _lucidereact.PackageIcon,
4427
4764
  title: t("billing.admin.products.empty.title"),
@@ -4436,10 +4773,234 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductsList, "ProductsList");
4436
4773
  // src/features/billing/stripe-product/components/containers/ProductsListContainer.tsx
4437
4774
 
4438
4775
  function ProductsListContainer() {
4439
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductProvider, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTY5FYP3Gjs.RoundPageContainer, { module: _chunkG6UE6MEPjs.Modules.StripeProduct, fullWidth: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductsList, { fullWidth: true }) }) });
4776
+ const t = _nextintl.useTranslations.call(void 0, );
4777
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductProvider, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.CouponProvider, { publishChrome: false, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4778
+ _chunkLQ4DK4JFjs.RoundPageContainer,
4779
+ {
4780
+ module: _chunkHKZAESS6js.Modules.StripeProduct,
4781
+ tabs: [
4782
+ { sectionKey: "products", label: t("billing.admin.products.tabs.products"), content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductsList, {}) },
4783
+ { sectionKey: "codes", label: t("billing.admin.products.tabs.codes"), content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CouponsList, {}) }
4784
+ ]
4785
+ }
4786
+ ) }) });
4440
4787
  }
4441
4788
  _chunk7QVYU63Ejs.__name.call(void 0, ProductsListContainer, "ProductsListContainer");
4442
4789
 
4790
+ // src/features/billing/stripe-coupon/components/containers/CouponContainer.tsx
4791
+
4792
+
4793
+ // src/features/billing/stripe-coupon/components/details/CouponDetails.tsx
4794
+
4795
+
4796
+ function CouponDetails() {
4797
+ const t = _nextintl.useTranslations.call(void 0, );
4798
+ const fmt = _chunkLQ4DK4JFjs.useBillingFormatOptions.call(void 0, );
4799
+ const { coupon } = _chunkLQ4DK4JFjs.useCouponContext.call(void 0, );
4800
+ if (!coupon) return null;
4801
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
4802
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.SectionHeader, { children: t("billing.admin.products.tabs.details") }),
4803
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-xs/relaxed", children: t("billing.admin.coupons.fixed_notice") }),
4804
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
4805
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.DetailField, { label: t("billing.admin.coupons.fields.name"), value: coupon.name }),
4806
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4807
+ _chunkLQ4DK4JFjs.DetailField,
4808
+ {
4809
+ label: t("billing.admin.coupons.fields.status"),
4810
+ value: coupon.valid ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Badge, { variant: "softGreen", children: t("billing.admin.coupons.status.active") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.Badge, { variant: "softGray", children: t("billing.admin.coupons.status.ended") })
4811
+ }
4812
+ ),
4813
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.DetailField, { label: t("billing.admin.coupons.fields.discount"), value: _chunkHKZAESS6js.formatCouponDiscount.call(void 0, coupon, t, fmt) }),
4814
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4815
+ _chunkLQ4DK4JFjs.DetailField,
4816
+ {
4817
+ label: t("billing.admin.coupons.fields.places"),
4818
+ value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: coupon.maxRedemptions !== void 0 ? t("billing.admin.coupons.places.limited", {
4819
+ used: String(coupon.timesRedeemed),
4820
+ limit: String(coupon.maxRedemptions)
4821
+ }) : t("billing.admin.coupons.places.unlimited", { used: String(coupon.timesRedeemed) }) })
4822
+ }
4823
+ ),
4824
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4825
+ _chunkLQ4DK4JFjs.DetailField,
4826
+ {
4827
+ label: t("billing.admin.coupons.fields.products"),
4828
+ value: coupon.stripeProductIds.length > 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: coupon.stripeProductIds.join(", ") }) : t("billing.admin.coupons.all_products")
4829
+ }
4830
+ ),
4831
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4832
+ _chunkLQ4DK4JFjs.DetailField,
4833
+ {
4834
+ label: t("billing.admin.coupons.fields.redeemBy"),
4835
+ value: coupon.redeemBy ? _chunkLQ4DK4JFjs.formatDate.call(void 0, coupon.redeemBy, fmt) : "\u2014"
4836
+ }
4837
+ ),
4838
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4839
+ _chunkLQ4DK4JFjs.DetailField,
4840
+ {
4841
+ label: t("billing.admin.coupons.fields.stripeId"),
4842
+ value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: coupon.stripeCouponId })
4843
+ }
4844
+ )
4845
+ ] })
4846
+ ] });
4847
+ }
4848
+ _chunk7QVYU63Ejs.__name.call(void 0, CouponDetails, "CouponDetails");
4849
+
4850
+ // src/features/billing/stripe-coupon/components/lists/CouponCodesList.tsx
4851
+
4852
+
4853
+
4854
+
4855
+ // src/features/billing/stripe-coupon/components/forms/CouponCodeEditor.tsx
4856
+
4857
+
4858
+
4859
+
4860
+
4861
+
4862
+
4863
+ function CouponCodeEditorInternal({
4864
+ couponId,
4865
+ onSuccess,
4866
+ trigger,
4867
+ forceShow,
4868
+ onClose,
4869
+ dialogOpen,
4870
+ onDialogOpenChange
4871
+ }) {
4872
+ const t = _nextintl.useTranslations.call(void 0, );
4873
+ const router = _chunkHKZAESS6js.useI18nRouter.call(void 0, );
4874
+ const { createCode } = _chunkLQ4DK4JFjs.useCouponContext.call(void 0, );
4875
+ const formSchema2 = _react.useMemo.call(void 0, () => _zod3.z.object({ id: _zod3.z.uuidv4() }).and(_chunkLQ4DK4JFjs.couponCodeSchema.call(void 0, t)), [t]);
4876
+ const getDefaultValues = _react.useCallback.call(void 0, () => ({ id: _uuid.v4.call(void 0, ), ..._chunkLQ4DK4JFjs.couponCodeDefaults.call(void 0, ) }), []);
4877
+ const form = _reacthookform.useForm.call(void 0, {
4878
+ resolver: _zod.zodResolver.call(void 0, formSchema2),
4879
+ defaultValues: getDefaultValues()
4880
+ });
4881
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4882
+ _chunkLQ4DK4JFjs.EditorSheet,
4883
+ {
4884
+ form,
4885
+ entityType: t("billing.admin.coupons.codes.entity"),
4886
+ isEdit: false,
4887
+ module: _chunkHKZAESS6js.Modules.StripeCouponCode,
4888
+ size: "md",
4889
+ onSuccess: _nullishCoalesce(onSuccess, () => ( (() => {
4890
+ }))),
4891
+ onNavigate: (url) => router.push(url),
4892
+ onSubmit: async (values) => await createCode({ id: values.id, couponId, ..._chunkLQ4DK4JFjs.toCouponCodeInput.call(void 0, values) }),
4893
+ onReset: getDefaultValues,
4894
+ trigger,
4895
+ forceShow,
4896
+ onClose,
4897
+ dialogOpen,
4898
+ onDialogOpenChange,
4899
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkLQ4DK4JFjs.CouponCodeFields, { form })
4900
+ }
4901
+ );
4902
+ }
4903
+ _chunk7QVYU63Ejs.__name.call(void 0, CouponCodeEditorInternal, "CouponCodeEditorInternal");
4904
+ function CouponCodeEditor(props) {
4905
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CouponCodeEditorInternal, { ...props });
4906
+ }
4907
+ _chunk7QVYU63Ejs.__name.call(void 0, CouponCodeEditor, "CouponCodeEditor");
4908
+
4909
+ // src/features/billing/stripe-coupon/components/lists/CouponCodesList.tsx
4910
+
4911
+ function CouponCodesList({ couponId }) {
4912
+ const t = _nextintl.useTranslations.call(void 0, );
4913
+ const { catalogueVersion } = _chunkLQ4DK4JFjs.useCouponContext.call(void 0, );
4914
+ const data = _chunkLQ4DK4JFjs.useDataListRetriever.call(void 0, {
4915
+ retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunkHKZAESS6js.StripeCouponCodeService.listByCoupon({ ...params, couponId }), "retriever"),
4916
+ retrieverParams: {},
4917
+ module: _chunkHKZAESS6js.Modules.StripeCouponCode
4918
+ });
4919
+ _react.useEffect.call(void 0, () => {
4920
+ if (catalogueVersion > 0) void data.refresh();
4921
+ }, [catalogueVersion]);
4922
+ const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, CouponCodeEditor, { couponId }, "create-code")];
4923
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4924
+ _chunkLQ4DK4JFjs.ContentListTable,
4925
+ {
4926
+ data,
4927
+ fields: [
4928
+ "code" /* code */,
4929
+ "places" /* places */,
4930
+ "expiresAt" /* expiresAt */,
4931
+ "automatic" /* automatic */,
4932
+ "status" /* status */,
4933
+ "actions" /* actions */
4934
+ ],
4935
+ tableGeneratorType: _chunkHKZAESS6js.Modules.StripeCouponCode,
4936
+ functions,
4937
+ title: t("billing.admin.coupons.codes.title"),
4938
+ emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4939
+ _chunkLQ4DK4JFjs.EmptyState,
4940
+ {
4941
+ icon: _lucidereact.TicketIcon,
4942
+ title: t("billing.admin.coupons.codes.empty.title"),
4943
+ description: t("billing.admin.coupons.codes.empty.description")
4944
+ }
4945
+ )
4946
+ }
4947
+ );
4948
+ }
4949
+ _chunk7QVYU63Ejs.__name.call(void 0, CouponCodesList, "CouponCodesList");
4950
+
4951
+ // src/features/billing/stripe-coupon/components/containers/CouponContainer.tsx
4952
+
4953
+ function CouponContainer() {
4954
+ const t = _nextintl.useTranslations.call(void 0, );
4955
+ const { coupon } = _chunkLQ4DK4JFjs.useCouponContext.call(void 0, );
4956
+ if (!coupon) return null;
4957
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4958
+ _chunkLQ4DK4JFjs.RoundPageContainer,
4959
+ {
4960
+ module: _chunkHKZAESS6js.Modules.StripeCoupon,
4961
+ id: coupon.id,
4962
+ tabs: [
4963
+ {
4964
+ sectionKey: "details",
4965
+ label: t("billing.admin.products.tabs.details"),
4966
+ content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CouponDetails, {})
4967
+ },
4968
+ {
4969
+ sectionKey: "codes",
4970
+ label: t("billing.admin.coupons.codes.title"),
4971
+ // No `fillHeight` and no `fullWidth` on the list: a ContentListTable in
4972
+ // a tab keeps its own bordered card and flows with the panel, exactly
4973
+ // as PricesList does inside ProductContainer. The codes list reads the
4974
+ // page's own CouponProvider, so no nested provider is needed.
4975
+ content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CouponCodesList, { couponId: coupon.id })
4976
+ }
4977
+ ]
4978
+ }
4979
+ );
4980
+ }
4981
+ _chunk7QVYU63Ejs.__name.call(void 0, CouponContainer, "CouponContainer");
4982
+
4983
+
4984
+
4985
+
4986
+
4987
+
4988
+
4989
+
4990
+
4991
+
4992
+
4993
+
4994
+
4995
+
4996
+
4997
+
4998
+
4999
+
5000
+
5001
+
5002
+
5003
+
4443
5004
 
4444
5005
 
4445
5006
 
@@ -4501,5 +5062,5 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductsListContainer, "ProductsListContain
4501
5062
 
4502
5063
 
4503
5064
 
4504
- exports.BillingAlertBanner = BillingAlertBanner; exports.BillingDashboardContainer = BillingDashboardContainer; exports.BillingDetailModal = BillingDetailModal; exports.BillingUsageSummaryCard = BillingUsageSummaryCard; exports.CancelSubscriptionDialog = CancelSubscriptionDialog; exports.CustomerInfoCard = CustomerInfoCard; exports.IntervalToggle = IntervalToggle; exports.InvoiceDetails = InvoiceDetails; exports.InvoiceStatusBadge = InvoiceStatusBadge; exports.InvoicesContainer = InvoicesContainer; exports.InvoicesList = InvoicesList; exports.InvoicesSummaryCard = InvoicesSummaryCard; exports.PaymentMethodCard = PaymentMethodCard; exports.PaymentMethodEditor = PaymentMethodEditor; exports.PaymentMethodForm = PaymentMethodForm; exports.PaymentMethodSummaryCard = PaymentMethodSummaryCard; exports.PaymentMethodsContainer = PaymentMethodsContainer; exports.PaymentMethodsList = PaymentMethodsList; exports.PriceArchiver = PriceArchiver; exports.PriceContainer = PriceContainer; exports.PriceDetails = PriceDetails; exports.PriceEditor = PriceEditor; exports.PriceProvider = PriceProvider; exports.PricesList = PricesList; exports.PricingCard = PricingCard; exports.ProductArchiver = ProductArchiver; exports.ProductContainer = ProductContainer; exports.ProductDetails = ProductDetails; exports.ProductEditor = ProductEditor; exports.ProductPricingList = ProductPricingList; exports.ProductPricingRow = ProductPricingRow; exports.ProductProvider = ProductProvider; exports.ProductsList = ProductsList; exports.ProductsListContainer = ProductsListContainer; exports.PromoCodeInput = PromoCodeInput; exports.ProrationPreview = ProrationPreview; exports.StripeProvider = StripeProvider; exports.SubscriptionConfirmation = SubscriptionConfirmation; exports.SubscriptionDetails = SubscriptionDetails; exports.SubscriptionStatusBadge = SubscriptionStatusBadge; exports.SubscriptionSummaryCard = SubscriptionSummaryCard; exports.SubscriptionWizard = SubscriptionWizard; exports.SubscriptionsContainer = SubscriptionsContainer; exports.SubscriptionsList = SubscriptionsList; exports.UsageContainer = UsageContainer; exports.UsageHistoryTable = UsageHistoryTable; exports.UsageSummaryCard = UsageSummaryCard; exports.UsageSummaryCards = UsageSummaryCards; exports.WizardProgressIndicator = WizardProgressIndicator; exports.WizardStepPaymentMethod = WizardStepPaymentMethod; exports.WizardStepPlanSelection = WizardStepPlanSelection; exports.WizardStepReview = WizardStepReview; exports.formatCurrency = _chunkTY5FYP3Gjs.formatCurrency; exports.formatDate = _chunkTY5FYP3Gjs.formatDate; exports.formatFixed = _chunkTY5FYP3Gjs.formatFixed; exports.formatInterval = _chunkTY5FYP3Gjs.formatInterval; exports.isStripeConfigured = isStripeConfigured; exports.priceLabel = priceLabel; exports.useBillingFormatOptions = _chunkTY5FYP3Gjs.useBillingFormatOptions; exports.usePriceContext = usePriceContext; exports.useProductContext = useProductContext;
5065
+ exports.BillingAlertBanner = BillingAlertBanner; exports.BillingDashboardContainer = BillingDashboardContainer; exports.BillingDetailModal = BillingDetailModal; exports.BillingUsageSummaryCard = BillingUsageSummaryCard; exports.CancelSubscriptionDialog = CancelSubscriptionDialog; exports.CouponCodeActions = _chunkLQ4DK4JFjs.CouponCodeActions; exports.CouponCodeEditor = CouponCodeEditor; exports.CouponCodeFields = _chunkLQ4DK4JFjs.CouponCodeFields; exports.CouponCodesList = CouponCodesList; exports.CouponContainer = CouponContainer; exports.CouponDetails = CouponDetails; exports.CouponEditor = _chunkLQ4DK4JFjs.CouponEditor; exports.CouponProvider = _chunkLQ4DK4JFjs.CouponProvider; exports.CouponRefresher = _chunkLQ4DK4JFjs.CouponRefresher; exports.CouponsList = CouponsList; exports.CustomerInfoCard = CustomerInfoCard; exports.IntervalToggle = IntervalToggle; exports.InvoiceDetails = InvoiceDetails; exports.InvoiceStatusBadge = InvoiceStatusBadge; exports.InvoicesContainer = InvoicesContainer; exports.InvoicesList = InvoicesList; exports.InvoicesSummaryCard = InvoicesSummaryCard; exports.PaymentMethodCard = PaymentMethodCard; exports.PaymentMethodEditor = PaymentMethodEditor; exports.PaymentMethodForm = PaymentMethodForm; exports.PaymentMethodSummaryCard = PaymentMethodSummaryCard; exports.PaymentMethodsContainer = PaymentMethodsContainer; exports.PaymentMethodsList = PaymentMethodsList; exports.PriceArchiver = PriceArchiver; exports.PriceContainer = PriceContainer; exports.PriceDetails = PriceDetails; exports.PriceEditor = PriceEditor; exports.PriceProvider = PriceProvider; exports.PricesList = PricesList; exports.PricingCard = PricingCard; exports.ProductArchiver = ProductArchiver; exports.ProductContainer = ProductContainer; exports.ProductDetails = ProductDetails; exports.ProductEditor = ProductEditor; exports.ProductPricingList = ProductPricingList; exports.ProductPricingRow = ProductPricingRow; exports.ProductProvider = ProductProvider; exports.ProductsList = ProductsList; exports.ProductsListContainer = ProductsListContainer; exports.PromoCodeInput = PromoCodeInput; exports.ProrationPreview = ProrationPreview; exports.StripeProvider = StripeProvider; exports.SubscriptionConfirmation = SubscriptionConfirmation; exports.SubscriptionDetails = SubscriptionDetails; exports.SubscriptionStatusBadge = SubscriptionStatusBadge; exports.SubscriptionSummaryCard = SubscriptionSummaryCard; exports.SubscriptionWizard = SubscriptionWizard; exports.SubscriptionsContainer = SubscriptionsContainer; exports.SubscriptionsList = SubscriptionsList; exports.UsageContainer = UsageContainer; exports.UsageHistoryTable = UsageHistoryTable; exports.UsageSummaryCard = UsageSummaryCard; exports.UsageSummaryCards = UsageSummaryCards; exports.WizardProgressIndicator = WizardProgressIndicator; exports.WizardStepPaymentMethod = WizardStepPaymentMethod; exports.WizardStepPlanSelection = WizardStepPlanSelection; exports.WizardStepReview = WizardStepReview; exports.applyDiscount = _chunkLQ4DK4JFjs.applyDiscount; exports.couponCodeDefaults = _chunkLQ4DK4JFjs.couponCodeDefaults; exports.couponCodeSchema = _chunkLQ4DK4JFjs.couponCodeSchema; exports.couponCurrencyOptions = _chunkLQ4DK4JFjs.couponCurrencyOptions; exports.formatCurrency = _chunkHKZAESS6js.formatCurrency; exports.formatDate = _chunkLQ4DK4JFjs.formatDate; exports.formatFixed = _chunkHKZAESS6js.formatFixed; exports.formatInterval = _chunkHKZAESS6js.formatInterval; exports.isStripeConfigured = isStripeConfigured; exports.optionalDate = _chunkLQ4DK4JFjs.optionalDate; exports.optionalDecimal = _chunkLQ4DK4JFjs.optionalDecimal; exports.optionalPositiveInt = _chunkLQ4DK4JFjs.optionalPositiveInt; exports.priceLabel = priceLabel; exports.promotionCodeDiscount = _chunkLQ4DK4JFjs.promotionCodeDiscount; exports.subscriptionDiscount = _chunkLQ4DK4JFjs.subscriptionDiscount; exports.toCouponCodeInput = _chunkLQ4DK4JFjs.toCouponCodeInput; exports.useBillingFormatOptions = _chunkLQ4DK4JFjs.useBillingFormatOptions; exports.useCouponContext = _chunkLQ4DK4JFjs.useCouponContext; exports.usePriceContext = usePriceContext; exports.useProductContext = useProductContext;
4505
5066
  //# sourceMappingURL=index.js.map