@carlonicora/nextjs-jsonapi 2.5.0 → 3.0.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 (88) hide show
  1. package/dist/{BlockNoteEditor-TIMGYKAA.js → BlockNoteEditor-CDTU6DRN.js} +19 -19
  2. package/dist/{BlockNoteEditor-TIMGYKAA.js.map → BlockNoteEditor-CDTU6DRN.js.map} +1 -1
  3. package/dist/{BlockNoteEditor-YFJMXJEU.mjs → BlockNoteEditor-VVAY73V2.mjs} +4 -4
  4. package/dist/billing/index.d.mts +127 -46
  5. package/dist/billing/index.d.ts +127 -46
  6. package/dist/billing/index.js +1243 -1084
  7. package/dist/billing/index.js.map +1 -1
  8. package/dist/billing/index.mjs +983 -824
  9. package/dist/billing/index.mjs.map +1 -1
  10. package/dist/{chunk-RTOC53EZ.js → chunk-53B6NPGA.js} +34 -4
  11. package/dist/chunk-53B6NPGA.js.map +1 -0
  12. package/dist/{chunk-G4YS52SO.mjs → chunk-J54546YC.mjs} +1596 -1416
  13. package/dist/chunk-J54546YC.mjs.map +1 -0
  14. package/dist/{chunk-OTEDZ6YW.js → chunk-JKGEJGSD.js} +7 -7
  15. package/dist/{chunk-OTEDZ6YW.js.map → chunk-JKGEJGSD.js.map} +1 -1
  16. package/dist/{chunk-DJWNNV52.mjs → chunk-PHEFWL6L.mjs} +2 -2
  17. package/dist/{chunk-FS4RVV3K.mjs → chunk-TWXKAY34.mjs} +33 -3
  18. package/dist/chunk-TWXKAY34.mjs.map +1 -0
  19. package/dist/{chunk-7HKJNUW7.js → chunk-UGNLKDI6.js} +1000 -820
  20. package/dist/chunk-UGNLKDI6.js.map +1 -0
  21. package/dist/client/index.js +4 -4
  22. package/dist/client/index.mjs +3 -3
  23. package/dist/components/index.js +4 -4
  24. package/dist/components/index.mjs +3 -3
  25. package/dist/contexts/index.js +4 -4
  26. package/dist/contexts/index.mjs +3 -3
  27. package/dist/core/index.d.mts +17 -1
  28. package/dist/core/index.d.ts +17 -1
  29. package/dist/core/index.js +6 -2
  30. package/dist/core/index.js.map +1 -1
  31. package/dist/core/index.mjs +5 -1
  32. package/dist/features/help/index.js +37 -37
  33. package/dist/features/help/index.mjs +3 -3
  34. package/dist/features/tokenusage/index.js +101 -101
  35. package/dist/features/tokenusage/index.mjs +3 -3
  36. package/dist/index.d.mts +1 -1
  37. package/dist/index.d.ts +1 -1
  38. package/dist/index.js +7 -3
  39. package/dist/index.js.map +1 -1
  40. package/dist/index.mjs +6 -2
  41. package/dist/server/index.js +3 -3
  42. package/dist/server/index.mjs +1 -1
  43. package/package.json +1 -1
  44. package/src/client/index.ts +4 -0
  45. package/src/features/administration/components/AdminIndexContainer.tsx +1 -1
  46. package/src/features/administration/components/__tests__/AdminIndexContainer.spec.tsx +1 -1
  47. package/src/features/billing/contexts/PriceContext.tsx +202 -0
  48. package/src/features/billing/contexts/ProductContext.tsx +185 -0
  49. package/src/features/billing/contexts/__tests__/PriceContext.spec.tsx +89 -0
  50. package/src/features/billing/contexts/__tests__/ProductContext.spec.tsx +81 -0
  51. package/src/features/billing/contexts/index.ts +2 -1
  52. package/src/features/billing/i18n-keys.ts +88 -0
  53. package/src/features/billing/stripe-price/components/containers/PriceContainer.tsx +21 -0
  54. package/src/features/billing/stripe-price/components/containers/index.ts +1 -0
  55. package/src/features/billing/stripe-price/components/details/PriceDetails.tsx +131 -0
  56. package/src/features/billing/stripe-price/components/details/index.ts +1 -0
  57. package/src/features/billing/stripe-price/components/forms/PriceArchiver.tsx +55 -0
  58. package/src/features/billing/stripe-price/components/forms/PriceEditor.tsx +307 -374
  59. package/src/features/billing/stripe-price/components/forms/index.ts +3 -1
  60. package/src/features/billing/stripe-price/components/index.ts +2 -0
  61. package/src/features/billing/stripe-price/components/lists/PricesList.tsx +49 -267
  62. package/src/features/billing/stripe-price/data/index.ts +1 -0
  63. package/src/features/billing/stripe-price/data/stripe-price.fields.ts +8 -0
  64. package/src/features/billing/stripe-price/hooks/useStripePriceTableStructure.tsx +119 -0
  65. package/src/features/billing/stripe-price/stripe-price.module.ts +5 -1
  66. package/src/features/billing/stripe-product/components/containers/ProductContainer.tsx +45 -0
  67. package/src/features/billing/stripe-product/components/containers/ProductsListContainer.tsx +27 -0
  68. package/src/features/billing/stripe-product/components/containers/index.ts +2 -2
  69. package/src/features/billing/stripe-product/components/details/ProductDetails.tsx +45 -0
  70. package/src/features/billing/stripe-product/components/details/index.ts +1 -0
  71. package/src/features/billing/stripe-product/components/forms/ProductArchiver.tsx +55 -0
  72. package/src/features/billing/stripe-product/components/forms/ProductEditor.tsx +92 -81
  73. package/src/features/billing/stripe-product/components/forms/index.ts +3 -1
  74. package/src/features/billing/stripe-product/components/index.ts +1 -0
  75. package/src/features/billing/stripe-product/components/lists/ProductsList.tsx +45 -187
  76. package/src/features/billing/stripe-product/data/index.ts +1 -0
  77. package/src/features/billing/stripe-product/data/stripe-product.fields.ts +6 -0
  78. package/src/features/billing/stripe-product/hooks/useStripeProductTableStructure.tsx +80 -0
  79. package/src/features/billing/stripe-product/stripe-product.module.ts +5 -1
  80. package/dist/chunk-7HKJNUW7.js.map +0 -1
  81. package/dist/chunk-FS4RVV3K.mjs.map +0 -1
  82. package/dist/chunk-G4YS52SO.mjs.map +0 -1
  83. package/dist/chunk-RTOC53EZ.js.map +0 -1
  84. package/src/features/billing/contexts/BillingContext.tsx +0 -95
  85. package/src/features/billing/stripe-product/components/containers/ProductsAdminContainer.tsx +0 -98
  86. package/src/features/billing/stripe-product/components/containers/ProductsAdminPageContainer.tsx +0 -27
  87. /package/dist/{BlockNoteEditor-YFJMXJEU.mjs.map → BlockNoteEditor-VVAY73V2.mjs.map} +0 -0
  88. /package/dist/{chunk-DJWNNV52.mjs.map → chunk-PHEFWL6L.mjs.map} +0 -0
@@ -50,11 +50,9 @@
50
50
 
51
51
 
52
52
 
53
- var _chunk7HKJNUW7js = require('../chunk-7HKJNUW7.js');
54
53
 
55
54
 
56
55
 
57
- var _chunkOTEDZ6YWjs = require('../chunk-OTEDZ6YW.js');
58
56
 
59
57
 
60
58
 
@@ -64,9 +62,25 @@ var _chunkOTEDZ6YWjs = require('../chunk-OTEDZ6YW.js');
64
62
 
65
63
 
66
64
 
65
+ var _chunkUGNLKDI6js = require('../chunk-UGNLKDI6.js');
67
66
 
68
67
 
69
- var _chunkRTOC53EZjs = require('../chunk-RTOC53EZ.js');
68
+
69
+
70
+ var _chunkJKGEJGSDjs = require('../chunk-JKGEJGSD.js');
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+
80
+
81
+
82
+
83
+ var _chunk53B6NPGAjs = require('../chunk-53B6NPGA.js');
70
84
  require('../chunk-LXKSUWAV.js');
71
85
  require('../chunk-IBS6NI7D.js');
72
86
  require('../chunk-FPO4DLZN.js');
@@ -117,41 +131,41 @@ function SubscriptionSummaryCard({
117
131
  onManageClick
118
132
  }) {
119
133
  if (loading) {
120
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Card, { children: [
121
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
122
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardTitle, { children: "Subscriptions" }),
134
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.Card, { children: [
135
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
136
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.CardTitle, { children: "Subscriptions" }),
123
137
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
124
138
  ] }),
125
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.CardContent, { children: [
126
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Skeleton, { className: "h-6 w-32 mb-2" }),
127
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Skeleton, { className: "h-4 w-24 mb-1" }),
128
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Skeleton, { className: "h-4 w-40" })
139
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.CardContent, { children: [
140
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Skeleton, { className: "h-6 w-32 mb-2" }),
141
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Skeleton, { className: "h-4 w-24 mb-1" }),
142
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Skeleton, { className: "h-4 w-40" })
129
143
  ] })
130
144
  ] });
131
145
  }
132
146
  if (error) {
133
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Card, { children: [
134
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
135
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardTitle, { children: "Subscriptions" }),
147
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.Card, { children: [
148
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
149
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.CardTitle, { children: "Subscriptions" }),
136
150
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
137
151
  ] }),
138
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
152
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
139
153
  ] });
140
154
  }
141
155
  const activeSubscriptions = subscriptions.filter(
142
156
  (sub) => sub.status === "active" /* ACTIVE */ || sub.status === "trialing" /* TRIALING */
143
157
  );
144
158
  const primarySubscription = activeSubscriptions[0];
145
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
146
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
147
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardTitle, { children: "Subscriptions" }),
159
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
160
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
161
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.CardTitle, { children: "Subscriptions" }),
148
162
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
149
163
  ] }),
150
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardContent, { children: subscriptions.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
164
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.CardContent, { children: subscriptions.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
151
165
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No active plan" }),
152
166
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Subscribe to get started" }),
153
167
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
154
- _chunk7HKJNUW7js.Button,
168
+ _chunkUGNLKDI6js.Button,
155
169
  {
156
170
  variant: "outline",
157
171
  size: "sm",
@@ -170,7 +184,7 @@ function SubscriptionSummaryCard({
170
184
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
171
185
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: formatPlanName(primarySubscription) }),
172
186
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
173
- _chunk7HKJNUW7js.Badge,
187
+ _chunkUGNLKDI6js.Badge,
174
188
  {
175
189
  variant: primarySubscription.cancelAtPeriodEnd ? "secondary" : getStatusBadgeVariant(primarySubscription.status),
176
190
  children: primarySubscription.cancelAtPeriodEnd ? "Canceling" : primarySubscription.status
@@ -212,37 +226,37 @@ function PaymentMethodSummaryCard({
212
226
  onManageClick
213
227
  }) {
214
228
  if (loading) {
215
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Card, { children: [
216
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
217
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardTitle, { children: "Payment Method" }),
229
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.Card, { children: [
230
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
231
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.CardTitle, { children: "Payment Method" }),
218
232
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
219
233
  ] }),
220
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.CardContent, { children: [
221
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Skeleton, { className: "h-6 w-32 mb-2" }),
222
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Skeleton, { className: "h-4 w-24" })
234
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.CardContent, { children: [
235
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Skeleton, { className: "h-6 w-32 mb-2" }),
236
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Skeleton, { className: "h-4 w-24" })
223
237
  ] })
224
238
  ] });
225
239
  }
226
240
  if (error) {
227
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Card, { children: [
228
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
229
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardTitle, { children: "Payment Method" }),
241
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.Card, { children: [
242
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
243
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.CardTitle, { children: "Payment Method" }),
230
244
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
231
245
  ] }),
232
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
246
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
233
247
  ] });
234
248
  }
235
249
  const defaultMethod = paymentMethods.find((pm) => pm.id === defaultPaymentMethodId) || paymentMethods[0];
236
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
237
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
238
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardTitle, { children: "Payment Method" }),
250
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
251
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
252
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.CardTitle, { children: "Payment Method" }),
239
253
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
240
254
  ] }),
241
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardContent, { children: paymentMethods.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
255
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.CardContent, { children: paymentMethods.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
242
256
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No payment method" }),
243
257
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Add a card to enable subscriptions" }),
244
258
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
245
- _chunk7HKJNUW7js.Button,
259
+ _chunkUGNLKDI6js.Button,
246
260
  {
247
261
  variant: "outline",
248
262
  size: "sm",
@@ -306,7 +320,7 @@ function CustomerInfoCard({ customer, loading, error }) {
306
320
  e.stopPropagation();
307
321
  setPortalLoading(true);
308
322
  try {
309
- const { url } = await _chunkRTOC53EZjs.StripeCustomerService.createPortalSession();
323
+ const { url } = await _chunk53B6NPGAjs.StripeCustomerService.createPortalSession();
310
324
  window.open(url, "_blank");
311
325
  } catch (err) {
312
326
  console.error("[CustomerInfoCard] Failed to create portal session:", err);
@@ -315,52 +329,52 @@ function CustomerInfoCard({ customer, loading, error }) {
315
329
  }
316
330
  }, "handlePortalClick");
317
331
  if (loading) {
318
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Card, { children: [
319
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
320
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardTitle, { children: "Billing Account" }),
332
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.Card, { children: [
333
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
334
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.CardTitle, { children: "Billing Account" }),
321
335
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
322
336
  ] }),
323
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.CardContent, { children: [
324
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Skeleton, { className: "h-6 w-32 mb-2" }),
325
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Skeleton, { className: "h-4 w-48 mb-1" }),
326
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Skeleton, { className: "h-4 w-24" })
337
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.CardContent, { children: [
338
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Skeleton, { className: "h-6 w-32 mb-2" }),
339
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Skeleton, { className: "h-4 w-48 mb-1" }),
340
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Skeleton, { className: "h-4 w-24" })
327
341
  ] })
328
342
  ] });
329
343
  }
330
344
  if (error) {
331
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Card, { children: [
332
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
333
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardTitle, { children: "Billing Account" }),
345
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.Card, { children: [
346
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
347
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.CardTitle, { children: "Billing Account" }),
334
348
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
335
349
  ] }),
336
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
350
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
337
351
  ] });
338
352
  }
339
353
  if (!customer) {
340
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Card, { children: [
341
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
342
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardTitle, { children: "Billing Account" }),
354
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.Card, { children: [
355
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
356
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.CardTitle, { children: "Billing Account" }),
343
357
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
344
358
  ] }),
345
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.CardContent, { children: [
359
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.CardContent, { children: [
346
360
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "Not set up" }),
347
361
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Billing account will be created when you subscribe" })
348
362
  ] })
349
363
  ] });
350
364
  }
351
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Card, { children: [
352
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
353
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardTitle, { children: "Billing Account" }),
365
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.Card, { children: [
366
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
367
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.CardTitle, { children: "Billing Account" }),
354
368
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
355
369
  ] }),
356
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
370
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
357
371
  customer.name && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: customer.name }),
358
372
  customer.email && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: customer.email }),
359
373
  customer.balance !== void 0 && customer.balance !== 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm", children: [
360
374
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground", children: "Credit Balance: " }),
361
375
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: customer.balance < 0 ? "text-success" : "text-destructive", children: formatBalance(customer.balance, customer.currency) })
362
376
  ] }),
363
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Button, { variant: "outline", size: "sm", className: "mt-2", onClick: handlePortalClick, disabled: portalLoading, children: [
377
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.Button, { variant: "outline", size: "sm", className: "mt-2", onClick: handlePortalClick, disabled: portalLoading, children: [
364
378
  portalLoading ? "Loading..." : "Manage in Stripe Portal",
365
379
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ExternalLink, { className: "h-4 w-4 ml-1" })
366
380
  ] })
@@ -404,42 +418,42 @@ function formatAmount(amount, currency) {
404
418
  _chunk7QVYU63Ejs.__name.call(void 0, formatAmount, "formatAmount");
405
419
  function InvoicesSummaryCard({ invoices, loading, error, onViewAllClick }) {
406
420
  if (loading) {
407
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Card, { children: [
408
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
409
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardTitle, { children: "Recent Invoices" }),
421
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.Card, { children: [
422
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
423
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.CardTitle, { children: "Recent Invoices" }),
410
424
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
411
425
  ] }),
412
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.CardContent, { children: [
413
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Skeleton, { className: "h-6 w-24 mb-2" }),
414
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Skeleton, { className: "h-4 w-32 mb-1" }),
415
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Skeleton, { className: "h-4 w-20" })
426
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.CardContent, { children: [
427
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Skeleton, { className: "h-6 w-24 mb-2" }),
428
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Skeleton, { className: "h-4 w-32 mb-1" }),
429
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Skeleton, { className: "h-4 w-20" })
416
430
  ] })
417
431
  ] });
418
432
  }
419
433
  if (error) {
420
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Card, { children: [
421
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
422
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardTitle, { children: "Recent Invoices" }),
434
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.Card, { children: [
435
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
436
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.CardTitle, { children: "Recent Invoices" }),
423
437
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
424
438
  ] }),
425
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
439
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
426
440
  ] });
427
441
  }
428
442
  const latestInvoice = invoices[0];
429
443
  const paidInvoices = invoices.filter((inv) => inv.status === "paid" /* PAID */);
430
444
  const openInvoices = invoices.filter((inv) => inv.status === "open" /* OPEN */);
431
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewAllClick, children: [
432
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
433
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardTitle, { children: "Recent Invoices" }),
445
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewAllClick, children: [
446
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
447
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.CardTitle, { children: "Recent Invoices" }),
434
448
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
435
449
  ] }),
436
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardContent, { children: invoices.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
450
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.CardContent, { children: invoices.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
437
451
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No invoices yet" }),
438
452
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Invoices will appear after your first billing cycle" })
439
453
  ] }) : latestInvoice ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
440
454
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
441
455
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: formatAmount(latestInvoice.total, latestInvoice.currency) }),
442
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Badge, { variant: getStatusBadgeVariant2(latestInvoice.status), children: latestInvoice.status })
456
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Badge, { variant: getStatusBadgeVariant2(latestInvoice.status), children: latestInvoice.status })
443
457
  ] }),
444
458
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: latestInvoice.stripeInvoiceNumber || `Invoice from ${formatDate2(latestInvoice.periodStart)}` }),
445
459
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-4 text-xs text-muted-foreground", children: [
@@ -479,24 +493,24 @@ function BillingUsageSummaryCard({
479
493
  onViewDetailsClick
480
494
  }) {
481
495
  if (loading) {
482
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Card, { children: [
483
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
484
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardTitle, { children: "Usage This Month" }),
496
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.Card, { children: [
497
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
498
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.CardTitle, { children: "Usage This Month" }),
485
499
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
486
500
  ] }),
487
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.CardContent, { children: [
488
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Skeleton, { className: "h-6 w-24 mb-2" }),
489
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Skeleton, { className: "h-4 w-32" })
501
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.CardContent, { children: [
502
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Skeleton, { className: "h-6 w-24 mb-2" }),
503
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Skeleton, { className: "h-4 w-32" })
490
504
  ] })
491
505
  ] });
492
506
  }
493
507
  if (error) {
494
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Card, { children: [
495
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
496
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardTitle, { children: "Usage This Month" }),
508
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.Card, { children: [
509
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
510
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.CardTitle, { children: "Usage This Month" }),
497
511
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
498
512
  ] }),
499
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
513
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
500
514
  ] });
501
515
  }
502
516
  const totalUsage = Object.values(summaries).reduce((acc, summary) => {
@@ -504,12 +518,12 @@ function BillingUsageSummaryCard({
504
518
  }, 0);
505
519
  const primaryMeter = meters.find((m) => _optionalChain([summaries, 'access', _17 => _17[m.id], 'optionalAccess', _18 => _18.aggregatedValue]));
506
520
  const primarySummary = primaryMeter ? summaries[primaryMeter.id] : null;
507
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewDetailsClick, children: [
508
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
509
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardTitle, { children: "Usage This Month" }),
521
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewDetailsClick, children: [
522
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
523
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.CardTitle, { children: "Usage This Month" }),
510
524
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
511
525
  ] }),
512
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardContent, { children: meters.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
526
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.CardContent, { children: meters.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
513
527
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No meters" }),
514
528
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "No usage meters are configured" })
515
529
  ] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
@@ -561,7 +575,7 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
561
575
  const fetchSetupIntent = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
562
576
  setLoading(true);
563
577
  try {
564
- const intent = await _chunkRTOC53EZjs.StripeCustomerService.createSetupIntent();
578
+ const intent = await _chunk53B6NPGAjs.StripeCustomerService.createSetupIntent();
565
579
  setSetupIntent(intent);
566
580
  } catch (err) {
567
581
  console.error("[PaymentMethodForm] Failed to create setup intent:", err);
@@ -599,7 +613,7 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
599
613
  return;
600
614
  }
601
615
  if (setAsDefault && _optionalChain([confirmedSetupIntent, 'optionalAccess', _19 => _19.payment_method])) {
602
- await _chunkRTOC53EZjs.StripeCustomerService.setDefaultPaymentMethod({
616
+ await _chunk53B6NPGAjs.StripeCustomerService.setDefaultPaymentMethod({
603
617
  paymentMethodId: typeof confirmedSetupIntent.payment_method === "string" ? confirmedSetupIntent.payment_method : confirmedSetupIntent.payment_method.id
604
618
  });
605
619
  }
@@ -615,7 +629,7 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
615
629
  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: "Loading payment form..." }) });
616
630
  }
617
631
  if (!setupIntent && error) {
618
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.AlertDescription, { children: error }) });
632
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.AlertDescription, { children: error }) });
619
633
  }
620
634
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: handleSubmit, className: "flex flex-col gap-y-4", children: [
621
635
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rounded-md border border-gray-300 p-3", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -638,13 +652,13 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
638
652
  }
639
653
  ) }),
640
654
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
641
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Checkbox, { id: "setAsDefault", checked: setAsDefault, onCheckedChange: (checked) => setSetAsDefault(!!checked) }),
642
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Label, { htmlFor: "setAsDefault", className: "cursor-pointer font-normal", children: "Set as default payment method" })
655
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Checkbox, { id: "setAsDefault", checked: setAsDefault, onCheckedChange: (checked) => setSetAsDefault(!!checked) }),
656
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Label, { htmlFor: "setAsDefault", className: "cursor-pointer font-normal", children: "Set as default payment method" })
643
657
  ] }),
644
- error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.AlertDescription, { children: error }) }),
658
+ error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.AlertDescription, { children: error }) }),
645
659
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-x-2", children: [
646
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { type: "button", variant: "outline", onClick: onCancel, disabled: isSubmitting || isLoading, children: "Cancel" }),
647
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { type: "submit", disabled: !stripe || isSubmitting || isLoading, children: isSubmitting ? "Processing..." : "Add Card" })
660
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Button, { type: "button", variant: "outline", onClick: onCancel, disabled: isSubmitting || isLoading, children: "Cancel" }),
661
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Button, { type: "submit", disabled: !stripe || isSubmitting || isLoading, children: isSubmitting ? "Processing..." : "Add Card" })
648
662
  ] })
649
663
  ] });
650
664
  }
@@ -660,10 +674,10 @@ function PaymentMethodEditor({ open, onOpenChange, onSuccess }) {
660
674
  const handleCancel = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
661
675
  onOpenChange(false);
662
676
  }, "handleCancel");
663
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.DialogContent, { className: "max-w-md", children: [
664
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.DialogHeader, { children: [
665
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.DialogTitle, { children: "Add Payment Method" }),
666
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.DialogDescription, { children: "Add a new payment method to your account. Your card information is securely processed by Stripe." })
677
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.DialogContent, { className: "max-w-md", children: [
678
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.DialogHeader, { children: [
679
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.DialogTitle, { children: "Add Payment Method" }),
680
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.DialogDescription, { children: "Add a new payment method to your account. Your card information is securely processed by Stripe." })
667
681
  ] }),
668
682
  open && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodForm, { onSuccess: handleSuccess, onCancel: handleCancel })
669
683
  ] }) });
@@ -687,7 +701,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
687
701
  _react.useEffect.call(void 0, () => {
688
702
  const loadCustomer = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
689
703
  try {
690
- const fetchedCustomer = await _chunkRTOC53EZjs.StripeCustomerService.getCustomer();
704
+ const fetchedCustomer = await _chunk53B6NPGAjs.StripeCustomerService.getCustomer();
691
705
  setCustomer(fetchedCustomer);
692
706
  } catch (error) {
693
707
  console.error("[PaymentMethodCard] Failed to load customer:", error);
@@ -704,7 +718,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
704
718
  const handleSetDefault = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
705
719
  setLoading(true);
706
720
  try {
707
- await _chunkRTOC53EZjs.StripeCustomerService.setDefaultPaymentMethod({ paymentMethodId: paymentMethod.id });
721
+ await _chunk53B6NPGAjs.StripeCustomerService.setDefaultPaymentMethod({ paymentMethodId: paymentMethod.id });
708
722
  onUpdate();
709
723
  } catch (error) {
710
724
  console.error("[PaymentMethodCard] Failed to set as default:", error);
@@ -715,7 +729,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
715
729
  const handleRemove = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
716
730
  setLoading(true);
717
731
  try {
718
- await _chunkRTOC53EZjs.StripeCustomerService.removePaymentMethod({ paymentMethodId: paymentMethod.id });
732
+ await _chunk53B6NPGAjs.StripeCustomerService.removePaymentMethod({ paymentMethodId: paymentMethod.id });
719
733
  setShowRemoveDialog(false);
720
734
  onUpdate();
721
735
  } catch (error) {
@@ -724,16 +738,16 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
724
738
  }
725
739
  }, "handleRemove");
726
740
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
727
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Card, { className: "relative", children: [
728
- isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Badge, { variant: "softGreen", className: "absolute right-2 top-2", children: "Default" }),
729
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.CardHeader, { className: "flex flex-row items-center justify-between pb-2", children: [
741
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.Card, { className: "relative", children: [
742
+ isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Badge, { variant: "softGreen", className: "absolute right-2 top-2", children: "Default" }),
743
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.CardHeader, { className: "flex flex-row items-center justify-between pb-2", children: [
730
744
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
731
745
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-2xl", children: brandIcon }),
732
746
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium capitalize", children: brand })
733
747
  ] }),
734
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.DropdownMenu, { children: [
735
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.DropdownMenuTrigger, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
736
- _chunk7HKJNUW7js.Button,
748
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.DropdownMenu, { children: [
749
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.DropdownMenuTrigger, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
750
+ _chunkUGNLKDI6js.Button,
737
751
  {
738
752
  render: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {}),
739
753
  nativeButton: false,
@@ -744,10 +758,10 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
744
758
  children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.MoreVertical, { className: "h-4 w-4" })
745
759
  }
746
760
  ) }),
747
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.DropdownMenuContent, { align: "end", children: [
748
- !isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.DropdownMenuItem, { onClick: handleSetDefault, disabled: loading, children: "Set as Default" }),
761
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.DropdownMenuContent, { align: "end", children: [
762
+ !isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.DropdownMenuItem, { onClick: handleSetDefault, disabled: loading, children: "Set as Default" }),
749
763
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
750
- _chunk7HKJNUW7js.DropdownMenuItem,
764
+ _chunkUGNLKDI6js.DropdownMenuItem,
751
765
  {
752
766
  onClick: () => setShowRemoveDialog(true),
753
767
  disabled: loading,
@@ -758,7 +772,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
758
772
  ] })
759
773
  ] })
760
774
  ] }),
761
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-1", children: [
775
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-1", children: [
762
776
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-lg font-semibold", children: [
763
777
  "\u2022\u2022\u2022\u2022 ",
764
778
  last4
@@ -771,17 +785,17 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
771
785
  ] })
772
786
  ] }) })
773
787
  ] }),
774
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.AlertDialog, { open: showRemoveDialog, onOpenChange: setShowRemoveDialog, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.AlertDialogContent, { children: [
775
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.AlertDialogHeader, { children: [
776
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.AlertDialogTitle, { children: "Remove Payment Method" }),
777
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.AlertDialogDescription, { children: [
788
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.AlertDialog, { open: showRemoveDialog, onOpenChange: setShowRemoveDialog, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.AlertDialogContent, { children: [
789
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.AlertDialogHeader, { children: [
790
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.AlertDialogTitle, { children: "Remove Payment Method" }),
791
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.AlertDialogDescription, { children: [
778
792
  "Are you sure you want to remove this payment method? This action cannot be undone.",
779
793
  isDefault && " This is your default payment method."
780
794
  ] })
781
795
  ] }),
782
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.AlertDialogFooter, { children: [
783
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.AlertDialogCancel, { disabled: loading, children: "Cancel" }),
784
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.AlertDialogAction, { onClick: handleRemove, disabled: loading, className: "bg-red-600 hover:bg-red-700", children: loading ? "Removing..." : "Remove" })
796
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.AlertDialogFooter, { children: [
797
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.AlertDialogCancel, { disabled: loading, children: "Cancel" }),
798
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.AlertDialogAction, { onClick: handleRemove, disabled: loading, className: "bg-red-600 hover:bg-red-700", children: loading ? "Removing..." : "Remove" })
785
799
  ] })
786
800
  ] }) })
787
801
  ] });
@@ -804,7 +818,7 @@ function PaymentMethodsContainer() {
804
818
  const loadPaymentMethods = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
805
819
  setLoading(true);
806
820
  try {
807
- const fetchedPaymentMethods = await _chunkRTOC53EZjs.StripeCustomerService.listPaymentMethods();
821
+ const fetchedPaymentMethods = await _chunk53B6NPGAjs.StripeCustomerService.listPaymentMethods();
808
822
  setPaymentMethods(fetchedPaymentMethods);
809
823
  } catch (error) {
810
824
  console.error("[PaymentMethodsContainer] Failed to load payment methods:", error);
@@ -824,14 +838,14 @@ function PaymentMethodsContainer() {
824
838
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8" }),
825
839
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: "Payment Methods" })
826
840
  ] }),
827
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { onClick: () => setShowAddPaymentMethod(true), children: "Add Payment Method" })
841
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Button, { onClick: () => setShowAddPaymentMethod(true), children: "Add Payment Method" })
828
842
  ] }),
829
843
  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: [
830
844
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-16 w-16 text-muted-foreground" }),
831
845
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
832
846
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "mb-2 text-sm font-medium", children: "No payment methods" }),
833
847
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mb-4 text-muted-foreground", children: "Add a payment method to enable subscriptions and secure checkout." }),
834
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { onClick: () => setShowAddPaymentMethod(true), children: "Add Your First Card" })
848
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Button, { onClick: () => setShowAddPaymentMethod(true), children: "Add Your First Card" })
835
849
  ] })
836
850
  ] }),
837
851
  paymentMethods.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodsList, { paymentMethods, onUpdate: loadPaymentMethods }),
@@ -853,36 +867,6 @@ _chunk7QVYU63Ejs.__name.call(void 0, PaymentMethodsContainer, "PaymentMethodsCon
853
867
  // src/features/billing/stripe-invoice/components/lists/InvoicesList.tsx
854
868
 
855
869
 
856
- // src/features/billing/components/utils/currency.ts
857
- function formatInterval(price) {
858
- if (price.priceType === "one_time" || !price.recurring) {
859
- return "one-time";
860
- }
861
- const { interval, intervalCount } = price.recurring;
862
- if (intervalCount === 1) {
863
- return `/${interval}`;
864
- }
865
- const pluralInterval = interval === "day" ? "days" : interval === "week" ? "weeks" : interval === "month" ? "months" : "years";
866
- return `/${intervalCount} ${pluralInterval}`;
867
- }
868
- _chunk7QVYU63Ejs.__name.call(void 0, formatInterval, "formatInterval");
869
- function formatCurrency(amount, currency) {
870
- if (amount === void 0) return "$0.00";
871
- const dollars = amount / 100;
872
- try {
873
- return new Intl.NumberFormat("en-US", {
874
- style: "currency",
875
- currency: currency.toUpperCase(),
876
- minimumFractionDigits: 2,
877
- maximumFractionDigits: 2
878
- }).format(dollars);
879
- } catch (error) {
880
- console.error("Error formatting currency:", error);
881
- return `$${dollars.toFixed(2)}`;
882
- }
883
- }
884
- _chunk7QVYU63Ejs.__name.call(void 0, formatCurrency, "formatCurrency");
885
-
886
870
  // src/features/billing/components/utils/date.ts
887
871
  function formatDate3(date) {
888
872
  if (!date) return "N/A";
@@ -929,7 +913,7 @@ var statusConfig = {
929
913
  };
930
914
  function InvoiceStatusBadge({ status }) {
931
915
  const config = statusConfig[status] || statusConfig["draft" /* DRAFT */];
932
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Badge, { variant: config.variant, children: config.label });
916
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Badge, { variant: config.variant, children: config.label });
933
917
  }
934
918
  _chunk7QVYU63Ejs.__name.call(void 0, InvoiceStatusBadge, "InvoiceStatusBadge");
935
919
 
@@ -960,13 +944,13 @@ function InvoiceDetails({
960
944
  return invoice.stripeInvoiceId.slice(-8);
961
945
  }, "getInvoiceNumber");
962
946
  const productName = _optionalChain([invoice, 'access', _29 => _29.subscription, 'optionalAccess', _30 => _30.price, 'optionalAccess', _31 => _31.product, 'optionalAccess', _32 => _32.name]) || "Subscription";
963
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.DialogContent, { className: "max-w-2xl", children: [
964
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.DialogHeader, { children: [
965
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.DialogTitle, { children: [
947
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.DialogContent, { className: "max-w-2xl", children: [
948
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.DialogHeader, { children: [
949
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.DialogTitle, { children: [
966
950
  "Invoice ",
967
951
  getInvoiceNumber()
968
952
  ] }),
969
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.DialogDescription, { children: formatDate3(invoice.periodStart) })
953
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.DialogDescription, { children: formatDate3(invoice.periodStart) })
970
954
  ] }),
971
955
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
972
956
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
@@ -1004,42 +988,42 @@ function InvoiceDetails({
1004
988
  ] }) }),
1005
989
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "tbody", { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "tr", { className: "border-t", children: [
1006
990
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "td", { className: "p-3", children: productName }),
1007
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "td", { className: "p-3 text-right", children: formatCurrency(invoice.subtotal, invoice.currency) })
991
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "td", { className: "p-3 text-right", children: _chunkUGNLKDI6js.formatCurrency.call(void 0, invoice.subtotal, invoice.currency) })
1008
992
  ] }) })
1009
993
  ] }) })
1010
994
  ] }),
1011
995
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2 border-t pt-4", children: [
1012
996
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
1013
997
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: "Subtotal:" }),
1014
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children: formatCurrency(invoice.subtotal, invoice.currency) })
998
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children: _chunkUGNLKDI6js.formatCurrency.call(void 0, invoice.subtotal, invoice.currency) })
1015
999
  ] }),
1016
1000
  invoice.tax !== void 0 && invoice.tax > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
1017
1001
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: "Tax:" }),
1018
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children: formatCurrency(invoice.tax, invoice.currency) })
1002
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children: _chunkUGNLKDI6js.formatCurrency.call(void 0, invoice.tax, invoice.currency) })
1019
1003
  ] }),
1020
1004
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between text-lg font-semibold border-t pt-2", children: [
1021
1005
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Total:" }),
1022
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: formatCurrency(invoice.total, invoice.currency) })
1006
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _chunkUGNLKDI6js.formatCurrency.call(void 0, invoice.total, invoice.currency) })
1023
1007
  ] }),
1024
1008
  invoice.amountPaid > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
1025
1009
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: "Amount Paid:" }),
1026
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-success", children: formatCurrency(invoice.amountPaid, invoice.currency) })
1010
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-success", children: _chunkUGNLKDI6js.formatCurrency.call(void 0, invoice.amountPaid, invoice.currency) })
1027
1011
  ] }),
1028
1012
  invoice.amountRemaining > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
1029
1013
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: "Amount Due:" }),
1030
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-destructive", children: formatCurrency(invoice.amountRemaining, invoice.currency) })
1014
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-destructive", children: _chunkUGNLKDI6js.formatCurrency.call(void 0, invoice.amountRemaining, invoice.currency) })
1031
1015
  ] })
1032
1016
  ] }),
1033
1017
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2 pt-4 border-t", children: [
1034
- invoice.stripePdfUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Button, { variant: "outline", onClick: handleDownloadPDF, children: [
1018
+ invoice.stripePdfUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.Button, { variant: "outline", onClick: handleDownloadPDF, children: [
1035
1019
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Download, { className: "mr-2 h-4 w-4" }),
1036
1020
  "Download PDF"
1037
1021
  ] }),
1038
- invoice.status === "open" /* OPEN */ && invoice.attempted && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Button, { variant: "default", onClick: handleRetryPayment, children: [
1022
+ invoice.status === "open" /* OPEN */ && invoice.attempted && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.Button, { variant: "default", onClick: handleRetryPayment, children: [
1039
1023
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RefreshCw, { className: "mr-2 h-4 w-4" }),
1040
1024
  "Retry Payment"
1041
1025
  ] }),
1042
- invoice.stripeHostedInvoiceUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Button, { variant: "outline", onClick: handleViewInStripe, children: [
1026
+ invoice.stripeHostedInvoiceUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.Button, { variant: "outline", onClick: handleViewInStripe, children: [
1043
1027
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ExternalLink, { className: "mr-2 h-4 w-4" }),
1044
1028
  "View in Stripe"
1045
1029
  ] })
@@ -1063,30 +1047,30 @@ function InvoicesList({ invoices, onInvoicesChange }) {
1063
1047
  return invoice.stripeInvoiceId.slice(-8);
1064
1048
  }, "getInvoiceNumber");
1065
1049
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
1066
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Table, { children: [
1067
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.TableRow, { children: [
1068
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableHead, { children: "Invoice #" }),
1069
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableHead, { children: "Date" }),
1070
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableHead, { children: "Status" }),
1071
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableHead, { className: "text-right", children: "Amount" }),
1072
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableHead, { children: "Period" })
1050
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.Table, { children: [
1051
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.TableRow, { children: [
1052
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.TableHead, { children: "Invoice #" }),
1053
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.TableHead, { children: "Date" }),
1054
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.TableHead, { children: "Status" }),
1055
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.TableHead, { className: "text-right", children: "Amount" }),
1056
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.TableHead, { children: "Period" })
1073
1057
  ] }) }),
1074
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableBody, { children: invoices.map((invoice) => {
1058
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.TableBody, { children: invoices.map((invoice) => {
1075
1059
  const invoiceNumber = getInvoiceNumber(invoice);
1076
1060
  const date = formatDate3(invoice.periodStart);
1077
- const amount = formatCurrency(invoice.total, invoice.currency);
1061
+ const amount = _chunkUGNLKDI6js.formatCurrency.call(void 0, invoice.total, invoice.currency);
1078
1062
  const period = `${formatDate3(invoice.periodStart)} - ${formatDate3(invoice.periodEnd)}`;
1079
1063
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1080
- _chunk7HKJNUW7js.TableRow,
1064
+ _chunkUGNLKDI6js.TableRow,
1081
1065
  {
1082
1066
  onClick: () => handleRowClick(invoice),
1083
1067
  className: "cursor-pointer hover:bg-muted/50",
1084
1068
  children: [
1085
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableCell, { className: "font-medium", children: invoiceNumber }),
1086
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableCell, { className: "text-muted-foreground text-xs", children: date }),
1087
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InvoiceStatusBadge, { status: invoice.status }) }),
1088
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableCell, { className: "text-right font-medium", children: amount }),
1089
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableCell, { className: "text-muted-foreground text-xs", children: period })
1069
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.TableCell, { className: "font-medium", children: invoiceNumber }),
1070
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.TableCell, { className: "text-muted-foreground text-xs", children: date }),
1071
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InvoiceStatusBadge, { status: invoice.status }) }),
1072
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.TableCell, { className: "text-right font-medium", children: amount }),
1073
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.TableCell, { className: "text-muted-foreground text-xs", children: period })
1090
1074
  ]
1091
1075
  },
1092
1076
  invoice.id
@@ -1119,7 +1103,7 @@ function InvoicesContainer() {
1119
1103
  setLoading(true);
1120
1104
  try {
1121
1105
  const params = statusFilter !== "all" ? { status: statusFilter } : void 0;
1122
- const data = await _chunkRTOC53EZjs.StripeInvoiceService.listInvoices(params);
1106
+ const data = await _chunk53B6NPGAjs.StripeInvoiceService.listInvoices(params);
1123
1107
  setInvoices(data);
1124
1108
  } catch (error) {
1125
1109
  console.error("[InvoicesContainer] Failed to load invoices:", error);
@@ -1135,12 +1119,12 @@ function InvoicesContainer() {
1135
1119
  setStatusFilter(value);
1136
1120
  }, "handleFilterChange");
1137
1121
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-4", children: [
1138
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Tabs, { value: statusFilter, onValueChange: handleFilterChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.TabsList, { children: [
1139
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TabsTrigger, { value: "all", children: "All" }),
1140
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TabsTrigger, { value: "paid" /* PAID */, children: "Paid" }),
1141
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TabsTrigger, { value: "open" /* OPEN */, children: "Open" }),
1142
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TabsTrigger, { value: "void" /* VOID */, children: "Void" }),
1143
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TabsTrigger, { value: "uncollectible" /* UNCOLLECTIBLE */, children: "Uncollectible" })
1122
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Tabs, { value: statusFilter, onValueChange: handleFilterChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.TabsList, { children: [
1123
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.TabsTrigger, { value: "all", children: "All" }),
1124
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.TabsTrigger, { value: "paid" /* PAID */, children: "Paid" }),
1125
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.TabsTrigger, { value: "open" /* OPEN */, children: "Open" }),
1126
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.TabsTrigger, { value: "void" /* VOID */, children: "Void" }),
1127
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.TabsTrigger, { value: "uncollectible" /* UNCOLLECTIBLE */, children: "Uncollectible" })
1144
1128
  ] }) }),
1145
1129
  loading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-center py-8 text-muted-foreground", children: "Loading invoices..." }),
1146
1130
  !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: [
@@ -1187,7 +1171,7 @@ function CancelSubscriptionDialog({
1187
1171
  const onSubmit = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async (_values) => {
1188
1172
  setIsSubmitting(true);
1189
1173
  try {
1190
- await _chunkRTOC53EZjs.StripeSubscriptionService.cancelSubscription({
1174
+ await _chunk53B6NPGAjs.StripeSubscriptionService.cancelSubscription({
1191
1175
  id: subscription.id,
1192
1176
  cancelImmediately: false
1193
1177
  });
@@ -1200,19 +1184,19 @@ function CancelSubscriptionDialog({
1200
1184
  }
1201
1185
  }, "onSubmit");
1202
1186
  const periodEndDate = formatDate3(subscription.currentPeriodEnd);
1203
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.DialogContent, { className: "max-w-md", children: [
1204
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.DialogHeader, { children: [
1205
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.DialogTitle, { children: "Cancel Subscription" }),
1206
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.DialogDescription, { children: "Are you sure you want to cancel this subscription? This action cannot be undone." })
1187
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.DialogContent, { className: "max-w-md", children: [
1188
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.DialogHeader, { children: [
1189
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.DialogTitle, { children: "Cancel Subscription" }),
1190
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.DialogDescription, { children: "Are you sure you want to cancel this subscription? This action cannot be undone." })
1207
1191
  ] }),
1208
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-col gap-y-4", children: [
1192
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-col gap-y-4", children: [
1209
1193
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-primary/10 border-primary/30 text-foreground rounded-lg border p-3 text-sm", children: [
1210
1194
  "Your subscription will remain active until ",
1211
1195
  periodEndDate,
1212
1196
  ". You can continue using the service until then."
1213
1197
  ] }),
1214
1198
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1215
- _chunk7HKJNUW7js.FormTextarea,
1199
+ _chunkUGNLKDI6js.FormTextarea,
1216
1200
  {
1217
1201
  form,
1218
1202
  id: "reason",
@@ -1222,8 +1206,8 @@ function CancelSubscriptionDialog({
1222
1206
  }
1223
1207
  ),
1224
1208
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-x-2 justify-end pt-2", children: [
1225
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { type: "button", variant: "outline", onClick: () => onOpenChange(false), disabled: isSubmitting, children: "Keep Subscription" }),
1226
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { type: "submit", variant: "destructive", disabled: isSubmitting, children: isSubmitting ? "Canceling..." : "Confirm Cancellation" })
1209
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Button, { type: "button", variant: "outline", onClick: () => onOpenChange(false), disabled: isSubmitting, children: "Keep Subscription" }),
1210
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Button, { type: "submit", variant: "destructive", disabled: isSubmitting, children: isSubmitting ? "Canceling..." : "Confirm Cancellation" })
1227
1211
  ] })
1228
1212
  ] }) })
1229
1213
  ] }) });
@@ -1272,7 +1256,7 @@ var cancelingConfig = {
1272
1256
  };
1273
1257
  function SubscriptionStatusBadge({ status, cancelAtPeriodEnd }) {
1274
1258
  const config = cancelAtPeriodEnd ? cancelingConfig : statusConfig2[status] || statusConfig2["canceled" /* CANCELED */];
1275
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Badge, { variant: config.variant, children: config.label });
1259
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Badge, { variant: config.variant, children: config.label });
1276
1260
  }
1277
1261
  _chunk7QVYU63Ejs.__name.call(void 0, SubscriptionStatusBadge, "SubscriptionStatusBadge");
1278
1262
 
@@ -1299,7 +1283,7 @@ function formatPlanName2(price) {
1299
1283
  _chunk7QVYU63Ejs.__name.call(void 0, formatPlanName2, "formatPlanName");
1300
1284
  function formatBillingAmount(price) {
1301
1285
  if (!_optionalChain([price, 'optionalAccess', _37 => _37.unitAmount])) return "N/A";
1302
- return formatCurrency(price.unitAmount, price.currency);
1286
+ return _chunkUGNLKDI6js.formatCurrency.call(void 0, price.unitAmount, price.currency);
1303
1287
  }
1304
1288
  _chunk7QVYU63Ejs.__name.call(void 0, formatBillingAmount, "formatBillingAmount");
1305
1289
  function SubscriptionDetails({
@@ -1314,7 +1298,7 @@ function SubscriptionDetails({
1314
1298
  const handlePause = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
1315
1299
  setIsProcessing(true);
1316
1300
  try {
1317
- await _chunkRTOC53EZjs.StripeSubscriptionService.pauseSubscription({ subscriptionId: subscription.id });
1301
+ await _chunk53B6NPGAjs.StripeSubscriptionService.pauseSubscription({ subscriptionId: subscription.id });
1318
1302
  onSubscriptionChange();
1319
1303
  } catch (error) {
1320
1304
  console.error("[SubscriptionDetails] Failed to pause subscription:", error);
@@ -1325,7 +1309,7 @@ function SubscriptionDetails({
1325
1309
  const handleResume = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
1326
1310
  setIsProcessing(true);
1327
1311
  try {
1328
- await _chunkRTOC53EZjs.StripeSubscriptionService.resumeSubscription({ subscriptionId: subscription.id });
1312
+ await _chunk53B6NPGAjs.StripeSubscriptionService.resumeSubscription({ subscriptionId: subscription.id });
1329
1313
  onSubscriptionChange();
1330
1314
  } catch (error) {
1331
1315
  console.error("[SubscriptionDetails] Failed to resume subscription:", error);
@@ -1335,7 +1319,7 @@ function SubscriptionDetails({
1335
1319
  }, "handleResume");
1336
1320
  const handleManageViaPortal = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
1337
1321
  try {
1338
- const { url } = await _chunkRTOC53EZjs.StripeCustomerService.createPortalSession();
1322
+ const { url } = await _chunk53B6NPGAjs.StripeCustomerService.createPortalSession();
1339
1323
  window.open(url, "_blank");
1340
1324
  } catch (error) {
1341
1325
  console.error("[SubscriptionDetails] Failed to create portal session:", error);
@@ -1345,10 +1329,10 @@ function SubscriptionDetails({
1345
1329
  const canResume = subscription.status === "paused" /* PAUSED */;
1346
1330
  const canCancel = subscription.status === "active" /* ACTIVE */ || subscription.status === "trialing" /* TRIALING */ || subscription.status === "paused" /* PAUSED */;
1347
1331
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
1348
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.DialogContent, { className: "max-w-2xl", children: [
1349
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.DialogHeader, { children: [
1350
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.DialogTitle, { children: "Subscription Details" }),
1351
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.DialogDescription, { children: "View and manage your subscription" })
1332
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.DialogContent, { className: "max-w-2xl", children: [
1333
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.DialogHeader, { children: [
1334
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.DialogTitle, { children: "Subscription Details" }),
1335
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.DialogDescription, { children: "View and manage your subscription" })
1352
1336
  ] }),
1353
1337
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
1354
1338
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
@@ -1390,11 +1374,11 @@ function SubscriptionDetails({
1390
1374
  "."
1391
1375
  ] }) }),
1392
1376
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2 pt-4 border-t", children: [
1393
- onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { variant: "default", onClick: () => onChangePlan(subscription), children: "Change Plan" }),
1394
- canPause && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { variant: "outline", onClick: handlePause, disabled: isProcessing, children: isProcessing ? "Pausing..." : "Pause" }),
1395
- canResume && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { variant: "outline", onClick: handleResume, disabled: isProcessing, children: isProcessing ? "Resuming..." : "Resume" }),
1396
- canCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { variant: "destructive", onClick: () => setShowCancel(true), children: "Cancel" }),
1397
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { variant: "outline", onClick: handleManageViaPortal, children: "Manage via Portal" })
1377
+ onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Button, { variant: "default", onClick: () => onChangePlan(subscription), children: "Change Plan" }),
1378
+ canPause && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Button, { variant: "outline", onClick: handlePause, disabled: isProcessing, children: isProcessing ? "Pausing..." : "Pause" }),
1379
+ canResume && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Button, { variant: "outline", onClick: handleResume, disabled: isProcessing, children: isProcessing ? "Resuming..." : "Resume" }),
1380
+ canCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Button, { variant: "destructive", onClick: () => setShowCancel(true), children: "Cancel" }),
1381
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Button, { variant: "outline", onClick: handleManageViaPortal, children: "Manage via Portal" })
1398
1382
  ] })
1399
1383
  ] })
1400
1384
  ] }) }),
@@ -1441,36 +1425,36 @@ function SubscriptionsList({ subscriptions, onSubscriptionsChange, onChangePlan
1441
1425
  setSelectedSub(subscription);
1442
1426
  }, "handleRowClick");
1443
1427
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
1444
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Table, { children: [
1445
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.TableRow, { children: [
1446
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableHead, { children: "Status" }),
1447
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableHead, { children: "Plan" }),
1448
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableHead, { children: "Period" }),
1449
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableHead, { className: "text-right", children: "Amount" }),
1450
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableHead, { className: "text-right", children: "Actions" })
1428
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.Table, { children: [
1429
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.TableRow, { children: [
1430
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.TableHead, { children: "Status" }),
1431
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.TableHead, { children: "Plan" }),
1432
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.TableHead, { children: "Period" }),
1433
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.TableHead, { className: "text-right", children: "Amount" }),
1434
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.TableHead, { className: "text-right", children: "Actions" })
1451
1435
  ] }) }),
1452
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableBody, { children: subscriptions.map((subscription) => {
1436
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.TableBody, { children: subscriptions.map((subscription) => {
1453
1437
  const price = subscription.price;
1454
- const amount = _optionalChain([price, 'optionalAccess', _42 => _42.unitAmount]) ? formatCurrency(price.unitAmount, price.currency) : "0";
1438
+ const amount = _optionalChain([price, 'optionalAccess', _42 => _42.unitAmount]) ? _chunkUGNLKDI6js.formatCurrency.call(void 0, price.unitAmount, price.currency) : "0";
1455
1439
  const period = `${formatDate3(subscription.currentPeriodStart)} - ${formatDate3(subscription.currentPeriodEnd)}`;
1456
1440
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1457
- _chunk7HKJNUW7js.TableRow,
1441
+ _chunkUGNLKDI6js.TableRow,
1458
1442
  {
1459
1443
  onClick: () => handleRowClick(subscription),
1460
1444
  className: "cursor-pointer hover:bg-muted/50",
1461
1445
  children: [
1462
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1446
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1463
1447
  SubscriptionStatusBadge,
1464
1448
  {
1465
1449
  status: subscription.status,
1466
1450
  cancelAtPeriodEnd: subscription.cancelAtPeriodEnd
1467
1451
  }
1468
1452
  ) }),
1469
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableCell, { className: "font-medium", children: formatPlanName3(price) }),
1470
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableCell, { className: "text-muted-foreground text-sm", children: period }),
1471
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableCell, { className: "text-right font-medium", children: amount }),
1472
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableCell, { className: "text-right", children: (subscription.status === "active" /* ACTIVE */ || subscription.status === "trialing" /* TRIALING */) && onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1473
- _chunk7HKJNUW7js.Button,
1453
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.TableCell, { className: "font-medium", children: formatPlanName3(price) }),
1454
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.TableCell, { className: "text-muted-foreground text-sm", children: period }),
1455
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.TableCell, { className: "text-right font-medium", children: amount }),
1456
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.TableCell, { className: "text-right", children: (subscription.status === "active" /* ACTIVE */ || subscription.status === "trialing" /* TRIALING */) && onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1457
+ _chunkUGNLKDI6js.Button,
1474
1458
  {
1475
1459
  size: "sm",
1476
1460
  variant: "outline",
@@ -1515,7 +1499,7 @@ function SubscriptionsContainer({ onOpenWizard, hasActiveRecurringSubscription }
1515
1499
  const loadSubscriptions = _react.useCallback.call(void 0, async () => {
1516
1500
  setLoading(true);
1517
1501
  try {
1518
- const fetchedSubscriptions = await _chunkRTOC53EZjs.StripeSubscriptionService.listSubscriptions();
1502
+ const fetchedSubscriptions = await _chunk53B6NPGAjs.StripeSubscriptionService.listSubscriptions();
1519
1503
  setSubscriptions(fetchedSubscriptions);
1520
1504
  } catch (error) {
1521
1505
  console.error("[SubscriptionsContainer] Failed to load subscriptions:", error);
@@ -1538,7 +1522,7 @@ function SubscriptionsContainer({ onOpenWizard, hasActiveRecurringSubscription }
1538
1522
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8" }),
1539
1523
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: "Subscriptions" })
1540
1524
  ] }),
1541
- subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _43 => _43()]), children: hasActiveRecurringSubscription ? "Purchase Add-ons" : "Subscribe to a Plan" })
1525
+ subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _43 => _43()]), children: hasActiveRecurringSubscription ? "Purchase Add-ons" : "Subscribe to a Plan" })
1542
1526
  ] }),
1543
1527
  criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BillingAlertBanner, { subscription }, subscription.id)),
1544
1528
  subscriptions.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col items-center justify-center py-12 space-y-4", children: [
@@ -1546,7 +1530,7 @@ function SubscriptionsContainer({ onOpenWizard, hasActiveRecurringSubscription }
1546
1530
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
1547
1531
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium mb-2", children: "No Active Subscriptions" }),
1548
1532
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground mb-6", children: "Choose a subscription plan to get started with our services." }),
1549
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _44 => _44()]), children: "Subscribe to a Plan" })
1533
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _44 => _44()]), children: "Subscribe to a Plan" })
1550
1534
  ] })
1551
1535
  ] }),
1552
1536
  subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -1567,9 +1551,9 @@ function IntervalToggle({ value, onChange, hasMonthly, hasYearly }) {
1567
1551
  if (!hasMonthly || !hasYearly) {
1568
1552
  return null;
1569
1553
  }
1570
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Tabs, { value, onValueChange: (v) => onChange(v), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.TabsList, { children: [
1571
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TabsTrigger, { value: "month", children: "Monthly" }),
1572
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TabsTrigger, { value: "year", children: "Yearly" })
1554
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Tabs, { value, onValueChange: (v) => onChange(v), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.TabsList, { children: [
1555
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.TabsTrigger, { value: "month", children: "Monthly" }),
1556
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.TabsTrigger, { value: "year", children: "Yearly" })
1573
1557
  ] }) });
1574
1558
  }
1575
1559
  _chunk7QVYU63Ejs.__name.call(void 0, IntervalToggle, "IntervalToggle");
@@ -1587,8 +1571,8 @@ function PricingCard({
1587
1571
  }) {
1588
1572
  const description = price.description || price.nickname || "Standard";
1589
1573
  const features = price.features || [];
1590
- const formattedPrice = formatCurrency(price.unitAmount, price.currency);
1591
- const interval = formatInterval(price);
1574
+ const formattedPrice = _chunkUGNLKDI6js.formatCurrency.call(void 0, price.unitAmount, price.currency);
1575
+ const interval = _chunkUGNLKDI6js.formatInterval.call(void 0, price);
1592
1576
  const handleKeyDown = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (e) => {
1593
1577
  if ((e.key === "Enter" || e.key === " ") && !isDisabled && !isCurrentPlan) {
1594
1578
  e.preventDefault();
@@ -1601,7 +1585,7 @@ function PricingCard({
1601
1585
  }
1602
1586
  }, "handleClick");
1603
1587
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1604
- _chunk7HKJNUW7js.Card,
1588
+ _chunkUGNLKDI6js.Card,
1605
1589
  {
1606
1590
  role: "radio",
1607
1591
  "aria-checked": isSelected,
@@ -1609,7 +1593,7 @@ function PricingCard({
1609
1593
  tabIndex: isDisabled ? -1 : 0,
1610
1594
  onKeyDown: handleKeyDown,
1611
1595
  onClick: handleClick,
1612
- className: _chunkRTOC53EZjs.cn.call(void 0,
1596
+ className: _chunk53B6NPGAjs.cn.call(void 0,
1613
1597
  "relative cursor-pointer transition-all duration-200 flex flex-col h-full",
1614
1598
  "focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
1615
1599
  isCurrentPlan && "bg-muted/30",
@@ -1619,9 +1603,9 @@ function PricingCard({
1619
1603
  isLoading && "pointer-events-none"
1620
1604
  ),
1621
1605
  children: [
1622
- isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Badge, { variant: "secondary", className: "absolute top-2 right-2", children: "Current" }),
1623
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardHeader, { className: "pb-2", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium", children: description }) }),
1624
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.CardContent, { className: "pb-4 grow", children: [
1606
+ isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Badge, { variant: "secondary", className: "absolute top-2 right-2", children: "Current" }),
1607
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.CardHeader, { className: "pb-2", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium", children: description }) }),
1608
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.CardContent, { className: "pb-4 grow", children: [
1625
1609
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mb-4", children: [
1626
1610
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-3xl font-bold", children: formattedPrice }),
1627
1611
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground ml-1", children: interval })
@@ -1631,8 +1615,8 @@ function PricingCard({
1631
1615
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-muted-foreground", children: feature })
1632
1616
  ] }, index)) })
1633
1617
  ] }),
1634
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardFooter, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1635
- _chunk7HKJNUW7js.Button,
1618
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.CardFooter, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1619
+ _chunkUGNLKDI6js.Button,
1636
1620
  {
1637
1621
  variant: isCurrentPlan ? "secondary" : isSelected ? "default" : "outline",
1638
1622
  className: "w-full",
@@ -1660,7 +1644,7 @@ function ProductPricingRow({
1660
1644
  return null;
1661
1645
  }
1662
1646
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-3", children: [
1663
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.SectionHeader, { children: product.name }),
1647
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.SectionHeader, { children: product.name }),
1664
1648
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1665
1649
  "div",
1666
1650
  {
@@ -1760,15 +1744,15 @@ function ProductPricingList({
1760
1744
  _chunk7QVYU63Ejs.__name.call(void 0, ProductPricingList, "ProductPricingList");
1761
1745
  function ProductPricingListSkeleton() {
1762
1746
  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: [
1763
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Skeleton, { className: "h-6 w-32" }),
1747
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Skeleton, { className: "h-6 w-32" }),
1764
1748
  /* @__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: [
1765
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Skeleton, { className: "h-6 w-24" }),
1766
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Skeleton, { className: "h-8 w-32" }),
1749
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Skeleton, { className: "h-6 w-24" }),
1750
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Skeleton, { className: "h-8 w-32" }),
1767
1751
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
1768
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Skeleton, { className: "h-4 w-full" }),
1769
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Skeleton, { className: "h-4 w-3/4" })
1752
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Skeleton, { className: "h-4 w-full" }),
1753
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Skeleton, { className: "h-4 w-3/4" })
1770
1754
  ] }),
1771
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Skeleton, { className: "h-10 w-full" })
1755
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Skeleton, { className: "h-10 w-full" })
1772
1756
  ] }, cardIndex)) })
1773
1757
  ] }, rowIndex)) });
1774
1758
  }
@@ -1782,18 +1766,18 @@ function ProrationPreview({ preview }) {
1782
1766
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
1783
1767
  preview.lineItems.map((item, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between text-sm", children: [
1784
1768
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground", children: item.description }),
1785
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `font-medium ${item.amount < 0 ? "text-success" : "text-foreground"}`, children: formatCurrency(item.amount, preview.currency) })
1769
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `font-medium ${item.amount < 0 ? "text-success" : "text-foreground"}`, children: _chunkUGNLKDI6js.formatCurrency.call(void 0, item.amount, preview.currency) })
1786
1770
  ] }, index)),
1787
1771
  /* @__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: [
1788
1772
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-foreground", children: "Net Due Today" }),
1789
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-foreground", children: formatCurrency(preview.immediateCharge, preview.currency) })
1773
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-foreground", children: _chunkUGNLKDI6js.formatCurrency.call(void 0, preview.immediateCharge, preview.currency) })
1790
1774
  ] }) }),
1791
1775
  preview.lineItems.length > 0 && preview.lineItems[0].period && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-muted-foreground mt-2 text-xs", children: [
1792
1776
  "Next invoice on ",
1793
1777
  formatDate3(preview.lineItems[0].period.end),
1794
1778
  " for",
1795
1779
  " ",
1796
- formatCurrency(preview.amountDue, preview.currency)
1780
+ _chunkUGNLKDI6js.formatCurrency.call(void 0, preview.amountDue, preview.currency)
1797
1781
  ] })
1798
1782
  ] })
1799
1783
  ] });
@@ -1815,16 +1799,16 @@ function SubscriptionConfirmation({ price, isLoading, onConfirm, onCancel }) {
1815
1799
  productDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-sm text-muted-foreground", children: productDescription })
1816
1800
  ] }),
1817
1801
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-lg font-semibold", children: [
1818
- formatCurrency(price.unitAmount, price.currency),
1819
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-normal text-muted-foreground", children: formatInterval(price) })
1802
+ _chunkUGNLKDI6js.formatCurrency.call(void 0, price.unitAmount, price.currency),
1803
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-normal text-muted-foreground", children: _chunkUGNLKDI6js.formatInterval.call(void 0, price) })
1820
1804
  ] }),
1821
1805
  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: [
1822
1806
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Check, { className: "h-4 w-4 text-primary" }),
1823
1807
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: feature })
1824
1808
  ] }, index)) }),
1825
1809
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-3 pt-2 border-t border-accent/30", children: [
1826
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { variant: "outline", onClick: onCancel, disabled: isLoading, children: "Cancel" }),
1827
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { onClick: onConfirm, disabled: isLoading, children: isLoading ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
1810
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Button, { variant: "outline", onClick: onCancel, disabled: isLoading, children: "Cancel" }),
1811
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Button, { onClick: onConfirm, disabled: isLoading, children: isLoading ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
1828
1812
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "h-4 w-4 animate-spin mr-2" }),
1829
1813
  "Processing..."
1830
1814
  ] }) : "Subscribe" })
@@ -1895,7 +1879,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
1895
1879
  onCloseRef.current = onClose;
1896
1880
  const checkPaymentMethod = _react.useCallback.call(void 0, async () => {
1897
1881
  try {
1898
- const methods = await _chunkRTOC53EZjs.StripeCustomerService.listPaymentMethods();
1882
+ const methods = await _chunk53B6NPGAjs.StripeCustomerService.listPaymentMethods();
1899
1883
  dispatch({ type: "SET_HAS_PAYMENT_METHOD", hasMethod: methods.length > 0 });
1900
1884
  } catch (error) {
1901
1885
  console.error("[useSubscriptionWizard] Failed to check payment methods:", error);
@@ -1919,7 +1903,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
1919
1903
  const isTrialUpgrade = _optionalChain([subscription, 'optionalAccess', _55 => _55.status]) === "trialing" /* TRIALING */;
1920
1904
  dispatch({ type: "SET_IS_TRIAL_SUBSCRIPTION", isTrial: isTrialUpgrade });
1921
1905
  if (isTrialUpgrade && !state.hasPaymentMethod) {
1922
- const methods = await _chunkRTOC53EZjs.StripeCustomerService.listPaymentMethods();
1906
+ const methods = await _chunk53B6NPGAjs.StripeCustomerService.listPaymentMethods();
1923
1907
  if (methods.length === 0) {
1924
1908
  dispatch({ type: "SET_STEP", step: "payment-method" });
1925
1909
  dispatch({
@@ -1930,7 +1914,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
1930
1914
  }
1931
1915
  }
1932
1916
  if (subscription && state.selectedPrice.id !== _optionalChain([subscription, 'access', _56 => _56.price, 'optionalAccess', _57 => _57.id])) {
1933
- const preview = await _chunkRTOC53EZjs.StripeSubscriptionService.getProrationPreview({
1917
+ const preview = await _chunk53B6NPGAjs.StripeSubscriptionService.getProrationPreview({
1934
1918
  subscriptionId: subscription.id,
1935
1919
  newPriceId: state.selectedPrice.id
1936
1920
  });
@@ -1955,14 +1939,14 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
1955
1939
  newPriceId: state.selectedPrice.id,
1956
1940
  promotionCode: _optionalChain([state, 'access', _59 => _59.promotionCode, 'optionalAccess', _60 => _60.promotionCodeId])
1957
1941
  };
1958
- await _chunkRTOC53EZjs.StripeSubscriptionService.changePlan(changePlanParams);
1942
+ await _chunk53B6NPGAjs.StripeSubscriptionService.changePlan(changePlanParams);
1959
1943
  } else {
1960
1944
  const createParams = {
1961
1945
  id: _uuid.v4.call(void 0, ),
1962
1946
  priceId: state.selectedPrice.id,
1963
1947
  promotionCode: _optionalChain([state, 'access', _61 => _61.promotionCode, 'optionalAccess', _62 => _62.promotionCodeId])
1964
1948
  };
1965
- await _chunkRTOC53EZjs.StripeSubscriptionService.createSubscription(createParams);
1949
+ await _chunk53B6NPGAjs.StripeSubscriptionService.createSubscription(createParams);
1966
1950
  }
1967
1951
  onSuccessRef.current();
1968
1952
  onCloseRef.current();
@@ -1996,7 +1980,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
1996
1980
  dispatch({ type: "SET_VALIDATING_PROMO_CODE", isValidating: true });
1997
1981
  dispatch({ type: "SET_PROMO_CODE_ERROR", error: null });
1998
1982
  try {
1999
- const result = await _chunkRTOC53EZjs.StripePromotionCodeService.validatePromotionCode({
1983
+ const result = await _chunk53B6NPGAjs.StripePromotionCodeService.validatePromotionCode({
2000
1984
  code,
2001
1985
  stripePriceId: _optionalChain([state, 'access', _70 => _70.selectedPrice, 'optionalAccess', _71 => _71.id])
2002
1986
  });
@@ -2103,7 +2087,7 @@ function WizardStepPlanSelection({
2103
2087
  _react.useEffect.call(void 0, () => {
2104
2088
  const loadProducts = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
2105
2089
  try {
2106
- const fetchedProducts = await _chunkRTOC53EZjs.StripeProductService.listProducts({ active: true });
2090
+ const fetchedProducts = await _chunk53B6NPGAjs.StripeProductService.listProducts({ active: true });
2107
2091
  setProducts(fetchedProducts);
2108
2092
  } catch (error) {
2109
2093
  console.error("[WizardStepPlanSelection] Failed to load products:", error);
@@ -2154,7 +2138,7 @@ function WizardStepPlanSelection({
2154
2138
  onSelectPrice: handleSelectPrice
2155
2139
  }
2156
2140
  ),
2157
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex justify-end pt-4 border-t", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { onClick: onNext, disabled: !selectedPrice || isProcessing, children: isProcessing ? "Loading..." : "Next: Review" }) })
2141
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex justify-end pt-4 border-t", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Button, { onClick: onNext, disabled: !selectedPrice || isProcessing, children: isProcessing ? "Loading..." : "Next: Review" }) })
2158
2142
  ] });
2159
2143
  }
2160
2144
  _chunk7QVYU63Ejs.__name.call(void 0, WizardStepPlanSelection, "WizardStepPlanSelection");
@@ -2215,7 +2199,7 @@ function PromoCodeInput({
2215
2199
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success text-sm", children: formatDiscount(appliedCode) })
2216
2200
  ] }),
2217
2201
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2218
- _chunk7HKJNUW7js.Button,
2202
+ _chunkUGNLKDI6js.Button,
2219
2203
  {
2220
2204
  variant: "ghost",
2221
2205
  size: "sm",
@@ -2232,7 +2216,7 @@ function PromoCodeInput({
2232
2216
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
2233
2217
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
2234
2218
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2235
- _chunk7HKJNUW7js.Input,
2219
+ _chunkUGNLKDI6js.Input,
2236
2220
  {
2237
2221
  placeholder: "Enter promo code",
2238
2222
  value: code,
@@ -2242,7 +2226,7 @@ function PromoCodeInput({
2242
2226
  className: "flex-1"
2243
2227
  }
2244
2228
  ),
2245
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.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" }) : "Apply" })
2229
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.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" }) : "Apply" })
2246
2230
  ] }),
2247
2231
  error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error })
2248
2232
  ] });
@@ -2307,14 +2291,14 @@ function WizardStepReview({
2307
2291
  return `${promotionCode.discountValue}% off`;
2308
2292
  }
2309
2293
  if (promotionCode.discountType === "amount_off" && promotionCode.discountValue) {
2310
- return `${formatCurrency(promotionCode.discountValue, promotionCode.currency || selectedPrice.currency)} off`;
2294
+ return `${_chunkUGNLKDI6js.formatCurrency.call(void 0, promotionCode.discountValue, promotionCode.currency || selectedPrice.currency)} off`;
2311
2295
  }
2312
2296
  return null;
2313
2297
  }, "getDiscountDescription");
2314
2298
  const discountDescription = getDiscountDescription();
2315
2299
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
2316
2300
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-muted/50 rounded-lg p-4 space-y-3", children: [
2317
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.SectionHeader, { children: "Selected Plan" }),
2301
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.SectionHeader, { children: "Selected Plan" }),
2318
2302
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between items-center", children: [
2319
2303
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
2320
2304
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-medium", children: _optionalChain([selectedPrice, 'access', _92 => _92.product, 'optionalAccess', _93 => _93.name]) }),
@@ -2322,10 +2306,10 @@ function WizardStepReview({
2322
2306
  ] }),
2323
2307
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-right", children: [
2324
2308
  discountedPrice !== null ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
2325
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground line-through", children: formatCurrency(selectedPrice.unitAmount || 0, selectedPrice.currency) }),
2326
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-success text-lg font-semibold", children: formatCurrency(discountedPrice, selectedPrice.currency) }),
2327
- discountDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Badge, { variant: "softGreen", children: discountDescription })
2328
- ] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-semibold text-lg", children: formatCurrency(selectedPrice.unitAmount || 0, selectedPrice.currency) }),
2309
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground line-through", children: _chunkUGNLKDI6js.formatCurrency.call(void 0, selectedPrice.unitAmount || 0, selectedPrice.currency) }),
2310
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-success text-lg font-semibold", children: _chunkUGNLKDI6js.formatCurrency.call(void 0, discountedPrice, selectedPrice.currency) }),
2311
+ discountDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Badge, { variant: "softGreen", children: discountDescription })
2312
+ ] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-semibold text-lg", children: _chunkUGNLKDI6js.formatCurrency.call(void 0, selectedPrice.unitAmount || 0, selectedPrice.currency) }),
2329
2313
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: formatInterval2(selectedPrice) })
2330
2314
  ] })
2331
2315
  ] })
@@ -2340,9 +2324,9 @@ function WizardStepReview({
2340
2324
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between text-sm", children: [
2341
2325
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `${isTrialUpgrade ? "text-warning" : "text-muted-foreground"}`, children: isTrialUpgrade ? "Amount to charge now:" : "Amount due now:" }),
2342
2326
  /* @__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: [
2343
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "line-through text-muted-foreground mr-2", children: formatCurrency(prorationPreview.immediateCharge, prorationPreview.currency) }),
2344
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success", children: formatCurrency(discountedImmediateCharge, prorationPreview.currency) })
2345
- ] }) : formatCurrency(prorationPreview.immediateCharge, prorationPreview.currency) })
2327
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "line-through text-muted-foreground mr-2", children: _chunkUGNLKDI6js.formatCurrency.call(void 0, prorationPreview.immediateCharge, prorationPreview.currency) }),
2328
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success", children: _chunkUGNLKDI6js.formatCurrency.call(void 0, discountedImmediateCharge, prorationPreview.currency) })
2329
+ ] }) : _chunkUGNLKDI6js.formatCurrency.call(void 0, prorationPreview.immediateCharge, prorationPreview.currency) })
2346
2330
  ] })
2347
2331
  ]
2348
2332
  }
@@ -2366,15 +2350,15 @@ function WizardStepReview({
2366
2350
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "font-medium", children: "Payment Method" }),
2367
2351
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: hasPaymentMethod ? "A payment method is on file" : "No payment method on file" })
2368
2352
  ] }),
2369
- !hasPaymentMethod && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { variant: "outline", onClick: onAddPaymentMethod, children: "Add Payment Method" })
2353
+ !hasPaymentMethod && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Button, { variant: "outline", onClick: onAddPaymentMethod, children: "Add Payment Method" })
2370
2354
  ] }) }),
2371
- error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Alert, { variant: "destructive", children: [
2355
+ error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.Alert, { variant: "destructive", children: [
2372
2356
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.AlertCircle, { className: "h-4 w-4" }),
2373
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.AlertDescription, { children: error })
2357
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.AlertDescription, { children: error })
2374
2358
  ] }),
2375
2359
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between pt-4 border-t", children: [
2376
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { variant: "outline", onClick: onBack, disabled: isProcessing, children: "Back" }),
2377
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { onClick: hasPaymentMethod ? onConfirm : onAddPaymentMethod, disabled: isProcessing, children: isProcessing ? "Processing..." : hasPaymentMethod ? isChangingPlan ? "Confirm Plan Change" : "Subscribe Now" : "Add Payment Method" })
2360
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Button, { variant: "outline", onClick: onBack, disabled: isProcessing, children: "Back" }),
2361
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Button, { onClick: hasPaymentMethod ? onConfirm : onAddPaymentMethod, disabled: isProcessing, children: isProcessing ? "Processing..." : hasPaymentMethod ? isChangingPlan ? "Confirm Plan Change" : "Subscribe Now" : "Add Payment Method" })
2378
2362
  ] })
2379
2363
  ] });
2380
2364
  }
@@ -2385,7 +2369,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, WizardStepReview, "WizardStepReview");
2385
2369
  function WizardStepPaymentMethod({ onBack, onSuccess, isProcessing }) {
2386
2370
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
2387
2371
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
2388
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.SectionHeader, { children: "Add Payment Method" }),
2372
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.SectionHeader, { children: "Add Payment Method" }),
2389
2373
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: "Enter your card details to complete your subscription" })
2390
2374
  ] }),
2391
2375
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodForm, { onSuccess, onCancel: onBack, isLoading: isProcessing })
@@ -2427,10 +2411,10 @@ function SubscriptionWizard({
2427
2411
  const isChangePlanMode = !!subscription;
2428
2412
  const dialogTitle = subscription ? "Change Subscription Plan" : isPurchasingAddons ? "Purchase Add-ons" : "Subscribe to a Plan";
2429
2413
  const dialogDescription = subscription ? "Select a new plan for your subscription" : isPurchasingAddons ? "Select one-time products to purchase" : "Choose a subscription plan to get started";
2430
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.DialogContent, { className: "max-w-2xl", children: [
2431
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.DialogHeader, { children: [
2432
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.DialogTitle, { children: dialogTitle }),
2433
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.DialogDescription, { children: dialogDescription })
2414
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.DialogContent, { className: "max-w-2xl", children: [
2415
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.DialogHeader, { children: [
2416
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.DialogTitle, { children: dialogTitle }),
2417
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.DialogDescription, { children: dialogDescription })
2434
2418
  ] }),
2435
2419
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, WizardProgressIndicator, { currentStep: state.step }),
2436
2420
  state.step === "plan-selection" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -2513,15 +2497,15 @@ function UsageSummaryCard({ meter, summary }) {
2513
2497
  const progressWidth = percentage !== null ? Math.min(percentage, 100) : 0;
2514
2498
  const displayName = meter.displayName || meter.eventName;
2515
2499
  const hasLimit = limit !== null && limit !== void 0;
2516
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Card, { children: [
2517
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.CardHeader, { className: "flex flex-row items-center gap-x-3 pb-3", children: [
2500
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.Card, { children: [
2501
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.CardHeader, { className: "flex flex-row items-center gap-x-3 pb-3", children: [
2518
2502
  /* @__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" }) }),
2519
2503
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col", children: [
2520
2504
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium", children: displayName }),
2521
2505
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-xs", children: meter.id })
2522
2506
  ] })
2523
2507
  ] }),
2524
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.CardContent, { className: "flex flex-col gap-y-4", children: [
2508
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.CardContent, { className: "flex flex-col gap-y-4", children: [
2525
2509
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
2526
2510
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-3xl font-bold", children: currentUsage.toLocaleString() }),
2527
2511
  hasLimit && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-muted-foreground text-sm", children: [
@@ -2568,14 +2552,14 @@ function UsageContainer() {
2568
2552
  const loadUsageData = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
2569
2553
  setLoading(true);
2570
2554
  try {
2571
- const fetchedSubscriptions = await _chunkRTOC53EZjs.StripeSubscriptionService.listSubscriptions();
2555
+ const fetchedSubscriptions = await _chunk53B6NPGAjs.StripeSubscriptionService.listSubscriptions();
2572
2556
  setSubscriptions(fetchedSubscriptions);
2573
2557
  const hasMeteredSubscriptions2 = fetchedSubscriptions.some((sub) => _optionalChain([sub, 'access', _99 => _99.price, 'optionalAccess', _100 => _100.recurring, 'optionalAccess', _101 => _101.usageType]) === "metered");
2574
2558
  if (!hasMeteredSubscriptions2) {
2575
2559
  setLoading(false);
2576
2560
  return;
2577
2561
  }
2578
- const fetchedMeters = await _chunkRTOC53EZjs.StripeUsageService.listMeters();
2562
+ const fetchedMeters = await _chunk53B6NPGAjs.StripeUsageService.listMeters();
2579
2563
  setMeters(fetchedMeters);
2580
2564
  const summariesMap = {};
2581
2565
  const now = /* @__PURE__ */ new Date();
@@ -2583,7 +2567,7 @@ function UsageContainer() {
2583
2567
  const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
2584
2568
  for (const meter of fetchedMeters) {
2585
2569
  try {
2586
- const meterSummaries = await _chunkRTOC53EZjs.StripeUsageService.getMeterSummaries({
2570
+ const meterSummaries = await _chunk53B6NPGAjs.StripeUsageService.getMeterSummaries({
2587
2571
  meterId: meter.id,
2588
2572
  startTime: startOfMonth,
2589
2573
  endTime: endOfMonth
@@ -2648,22 +2632,22 @@ function UsageHistoryTable({ usageRecords }) {
2648
2632
  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: "No usage history available." }) });
2649
2633
  }
2650
2634
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
2651
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.SectionHeader, { level: 2, children: "Usage History" }),
2652
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-clip rounded-lg border", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Table, { children: [
2653
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.TableRow, { children: [
2654
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableHead, { children: "Date & Time" }),
2655
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableHead, { children: "Meter Event" }),
2656
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableHead, { className: "text-right", children: "Quantity" }),
2657
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableHead, { children: "Event ID" })
2635
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.SectionHeader, { level: 2, children: "Usage History" }),
2636
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-clip rounded-lg border", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.Table, { children: [
2637
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.TableRow, { children: [
2638
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.TableHead, { children: "Date & Time" }),
2639
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.TableHead, { children: "Meter Event" }),
2640
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.TableHead, { className: "text-right", children: "Quantity" }),
2641
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.TableHead, { children: "Event ID" })
2658
2642
  ] }) }),
2659
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableBody, { children: usageRecords.map((record) => {
2643
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.TableBody, { children: usageRecords.map((record) => {
2660
2644
  const dateTime = formatDateTime(record.timestamp);
2661
2645
  const quantity = record.quantity.toLocaleString();
2662
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.TableRow, { children: [
2663
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableCell, { className: "font-medium", children: dateTime }),
2664
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableCell, { className: "text-muted-foreground", children: record.meterEventName }),
2665
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableCell, { className: "text-right font-medium", children: quantity }),
2666
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableCell, { className: "text-muted-foreground text-sm tabular-nums", children: record.stripeEventId })
2646
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.TableRow, { children: [
2647
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.TableCell, { className: "font-medium", children: dateTime }),
2648
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.TableCell, { className: "text-muted-foreground", children: record.meterEventName }),
2649
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.TableCell, { className: "text-right font-medium", children: quantity }),
2650
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.TableCell, { className: "text-muted-foreground text-sm tabular-nums", children: record.stripeEventId })
2667
2651
  ] }, record.id);
2668
2652
  }) })
2669
2653
  ] }) })
@@ -2674,8 +2658,8 @@ _chunk7QVYU63Ejs.__name.call(void 0, UsageHistoryTable, "UsageHistoryTable");
2674
2658
  // src/features/billing/components/modals/BillingDetailModal.tsx
2675
2659
 
2676
2660
  function BillingDetailModal({ open, onOpenChange, title, children, className }) {
2677
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.DialogContent, { className: _nullishCoalesce(className, () => ( "max-w-4xl max-h-[90vh] overflow-y-auto")), children: [
2678
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.DialogHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.DialogTitle, { children: title }) }),
2661
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.DialogContent, { className: _nullishCoalesce(className, () => ( "max-w-4xl max-h-[90vh] overflow-y-auto")), children: [
2662
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.DialogHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.DialogTitle, { children: title }) }),
2679
2663
  children
2680
2664
  ] }) });
2681
2665
  }
@@ -2692,7 +2676,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
2692
2676
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-destructive text-sm font-medium", children: "Payment Failed" }),
2693
2677
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive mt-1 text-sm", children: "Your last payment failed. Please update your payment method to avoid service interruption." })
2694
2678
  ] }),
2695
- onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { variant: "outline", size: "sm", onClick: onUpdatePayment, className: "text-destructive border-red-300", children: "Update Payment Method" })
2679
+ onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Button, { variant: "outline", size: "sm", onClick: onUpdatePayment, className: "text-destructive border-red-300", children: "Update Payment Method" })
2696
2680
  ] });
2697
2681
  }
2698
2682
  if (subscription.status === "trialing" /* TRIALING */ && subscription.trialEnd) {
@@ -2712,7 +2696,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
2712
2696
  ". Add a payment method to continue your subscription."
2713
2697
  ] })
2714
2698
  ] }),
2715
- onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { variant: "outline", size: "sm", onClick: onAddPayment, className: "text-warning border-yellow-300", children: "Add Payment Method" })
2699
+ onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Button, { variant: "outline", size: "sm", onClick: onAddPayment, className: "text-warning border-yellow-300", children: "Add Payment Method" })
2716
2700
  ] });
2717
2701
  }
2718
2702
  }
@@ -2763,7 +2747,7 @@ function BillingDashboardContainer() {
2763
2747
  setNoCustomerExists(false);
2764
2748
  let customer = null;
2765
2749
  try {
2766
- customer = await _chunkRTOC53EZjs.StripeCustomerService.getCustomer();
2750
+ customer = await _chunk53B6NPGAjs.StripeCustomerService.getCustomer();
2767
2751
  setData((prev) => ({ ...prev, customer }));
2768
2752
  setErrors((prev) => ({ ...prev, customer: null }));
2769
2753
  setNoCustomerExists(false);
@@ -2789,7 +2773,7 @@ function BillingDashboardContainer() {
2789
2773
  }
2790
2774
  const fetchSubscriptions = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
2791
2775
  try {
2792
- const subscriptions2 = await _chunkRTOC53EZjs.StripeSubscriptionService.listSubscriptions();
2776
+ const subscriptions2 = await _chunk53B6NPGAjs.StripeSubscriptionService.listSubscriptions();
2793
2777
  setData((prev) => ({ ...prev, subscriptions: subscriptions2 }));
2794
2778
  setErrors((prev) => ({ ...prev, subscriptions: null }));
2795
2779
  return subscriptions2;
@@ -2803,7 +2787,7 @@ function BillingDashboardContainer() {
2803
2787
  }, "fetchSubscriptions");
2804
2788
  const fetchPaymentMethods = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
2805
2789
  try {
2806
- const paymentMethods = await _chunkRTOC53EZjs.StripeCustomerService.listPaymentMethods();
2790
+ const paymentMethods = await _chunk53B6NPGAjs.StripeCustomerService.listPaymentMethods();
2807
2791
  setData((prev) => ({ ...prev, paymentMethods }));
2808
2792
  setErrors((prev) => ({ ...prev, paymentMethods: null }));
2809
2793
  } catch (error) {
@@ -2815,7 +2799,7 @@ function BillingDashboardContainer() {
2815
2799
  }, "fetchPaymentMethods");
2816
2800
  const fetchInvoices = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
2817
2801
  try {
2818
- const invoices = await _chunkRTOC53EZjs.StripeInvoiceService.listInvoices();
2802
+ const invoices = await _chunk53B6NPGAjs.StripeInvoiceService.listInvoices();
2819
2803
  setData((prev) => ({ ...prev, invoices }));
2820
2804
  setErrors((prev) => ({ ...prev, invoices: null }));
2821
2805
  } catch (error) {
@@ -2838,7 +2822,7 @@ function BillingDashboardContainer() {
2838
2822
  const handleCreateCustomer = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
2839
2823
  setCreatingCustomer(true);
2840
2824
  try {
2841
- await _chunkRTOC53EZjs.StripeCustomerService.createCustomer();
2825
+ await _chunk53B6NPGAjs.StripeCustomerService.createCustomer();
2842
2826
  setNoCustomerExists(false);
2843
2827
  await fetchAllData();
2844
2828
  } catch (error) {
@@ -2850,7 +2834,7 @@ function BillingDashboardContainer() {
2850
2834
  }, "handleCreateCustomer");
2851
2835
  const fetchUsageData = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
2852
2836
  try {
2853
- const meters = await _chunkRTOC53EZjs.StripeUsageService.listMeters();
2837
+ const meters = await _chunk53B6NPGAjs.StripeUsageService.listMeters();
2854
2838
  setData((prev) => ({ ...prev, meters }));
2855
2839
  const summariesMap = {};
2856
2840
  const now = /* @__PURE__ */ new Date();
@@ -2858,7 +2842,7 @@ function BillingDashboardContainer() {
2858
2842
  const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
2859
2843
  for (const meter of meters) {
2860
2844
  try {
2861
- const meterSummaries = await _chunkRTOC53EZjs.StripeUsageService.getMeterSummaries({
2845
+ const meterSummaries = await _chunk53B6NPGAjs.StripeUsageService.getMeterSummaries({
2862
2846
  meterId: meter.id,
2863
2847
  startTime: startOfMonth,
2864
2848
  endTime: endOfMonth
@@ -2936,18 +2920,18 @@ function BillingDashboardContainer() {
2936
2920
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-8 w-8" }),
2937
2921
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: "Billing" })
2938
2922
  ] }),
2939
- isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.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" }) }) }),
2940
- noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Card, { children: [
2941
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.CardHeader, { className: "text-center", children: [
2923
+ isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.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" }) }) }),
2924
+ noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.Card, { children: [
2925
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.CardHeader, { className: "text-center", children: [
2942
2926
  /* @__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" }) }),
2943
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardTitle, { children: "Set Up Billing" }),
2944
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardDescription, { children: "Your company doesn't have a billing account yet. Set one up to manage subscriptions, payment methods, and view invoices." })
2927
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.CardTitle, { children: "Set Up Billing" }),
2928
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.CardDescription, { children: "Your company doesn't have a billing account yet. Set one up to manage subscriptions, payment methods, and view invoices." })
2945
2929
  ] }),
2946
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardContent, { className: "flex justify-center pb-8", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { onClick: handleCreateCustomer, disabled: creatingCustomer, size: "lg", children: creatingCustomer ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
2930
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.CardContent, { className: "flex justify-center pb-8", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Button, { onClick: handleCreateCustomer, disabled: creatingCustomer, size: "lg", children: creatingCustomer ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
2947
2931
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "mr-2 h-4 w-4 animate-spin" }),
2948
2932
  "Setting up..."
2949
2933
  ] }) : "Set Up Billing Account" }) }),
2950
- errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardContent, { className: "pt-0", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-center text-destructive text-xs/relaxed", children: errors.customer }) })
2934
+ errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.CardContent, { className: "pt-0", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-center text-destructive text-xs/relaxed", children: errors.customer }) })
2951
2935
  ] }),
2952
2936
  !noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
2953
2937
  criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -3089,7 +3073,7 @@ function getStripePromise(publishableKey) {
3089
3073
  }
3090
3074
  _chunk7QVYU63Ejs.__name.call(void 0, getStripePromise, "getStripePromise");
3091
3075
  function StripeProvider({ children }) {
3092
- const publishableKey = _chunkOTEDZ6YWjs.getStripePublishableKey.call(void 0, );
3076
+ const publishableKey = _chunkJKGEJGSDjs.getStripePublishableKey.call(void 0, );
3093
3077
  const stripePromise = _react.useMemo.call(void 0, () => getStripePromise(publishableKey), [publishableKey]);
3094
3078
  const options = _react.useMemo.call(void 0, () => ({}), []);
3095
3079
  if (!publishableKey) {
@@ -3099,127 +3083,54 @@ function StripeProvider({ children }) {
3099
3083
  }
3100
3084
  _chunk7QVYU63Ejs.__name.call(void 0, StripeProvider, "StripeProvider");
3101
3085
  function isStripeConfigured() {
3102
- return !!_chunkOTEDZ6YWjs.getStripePublishableKey.call(void 0, );
3086
+ return !!_chunkJKGEJGSDjs.getStripePublishableKey.call(void 0, );
3103
3087
  }
3104
3088
  _chunk7QVYU63Ejs.__name.call(void 0, isStripeConfigured, "isStripeConfigured");
3105
3089
 
3106
- // src/features/billing/contexts/BillingContext.tsx
3090
+ // src/features/billing/contexts/PriceContext.tsx
3107
3091
  var _nextintl = require('next-intl');
3108
3092
 
3109
3093
 
3110
- // src/features/billing/stripe-product/components/forms/ProductEditor.tsx
3111
-
3112
-
3094
+ // src/features/billing/stripe-price/components/forms/PriceArchiver.tsx
3113
3095
 
3114
3096
 
3115
3097
 
3116
3098
 
3117
- function ProductEditor({ product, open, onOpenChange, onSuccess }) {
3118
- const [isSubmitting, setIsSubmitting] = _react.useState.call(void 0, false);
3119
- const formSchema2 = _zod3.z.object({
3120
- name: _zod3.z.string().min(1, { message: "Product name is required" }),
3121
- description: _zod3.z.string().min(1, { message: "Description is required" }),
3122
- active: _zod3.z.boolean()
3123
- });
3124
- const form = _reacthookform.useForm.call(void 0, {
3125
- resolver: _zod.zodResolver.call(void 0, formSchema2),
3126
- defaultValues: {
3127
- name: _optionalChain([product, 'optionalAccess', _117 => _117.name]) || "",
3128
- description: _optionalChain([product, 'optionalAccess', _118 => _118.description]) || "",
3129
- active: _nullishCoalesce(_optionalChain([product, 'optionalAccess', _119 => _119.active]), () => ( true))
3130
- }
3131
- });
3132
- const onSubmit = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async (values) => {
3133
- setIsSubmitting(true);
3134
- try {
3135
- if (product) {
3136
- await _chunkRTOC53EZjs.StripeProductService.updateProduct({
3137
- id: product.id,
3138
- name: values.name,
3139
- description: values.description,
3140
- active: values.active
3141
- });
3142
- } else {
3143
- await _chunkRTOC53EZjs.StripeProductService.createProduct({
3144
- id: _uuid.v4.call(void 0, ),
3145
- name: values.name,
3146
- description: values.description,
3147
- active: values.active
3148
- });
3149
- }
3150
- onSuccess();
3151
- onOpenChange(false);
3152
- } catch (error) {
3153
- console.error("[ProductEditor] Failed to save product:", error);
3154
- } finally {
3155
- setIsSubmitting(false);
3156
- }
3157
- }, "onSubmit");
3158
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.DialogContent, { className: "max-w-2xl", children: [
3159
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.DialogHeader, { children: [
3160
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.DialogTitle, { children: product ? "Edit Product" : "Create Product" }),
3161
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.DialogDescription, { children: product ? `Update the details for ${product.name}` : "Create a new product to offer to your customers" })
3099
+ function PriceArchiver({ price }) {
3100
+ const t = _nextintl.useTranslations.call(void 0, );
3101
+ const { archivePrice, restorePrice } = usePriceContext();
3102
+ const [open, setOpen] = _react.useState.call(void 0, false);
3103
+ const isArchived = !price.active;
3104
+ const scope = isArchived ? "restore" : "archive";
3105
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
3106
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.Button, { variant: "outline", size: "sm", onClick: () => setOpen(true), children: [
3107
+ isArchived ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RotateCcwIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ArchiveIcon, {}),
3108
+ t(`billing.admin.prices.${scope}.confirm`)
3162
3109
  ] }),
3163
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-col gap-y-4", children: [
3164
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.FormInput, { form, id: "name", name: "Product Name", placeholder: "Enter product name", isRequired: true }),
3165
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3166
- _chunk7HKJNUW7js.FormTextarea,
3167
- {
3168
- form,
3169
- id: "description",
3170
- name: "Description",
3171
- placeholder: "Enter product description",
3172
- className: "min-h-32"
3110
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3111
+ _chunkUGNLKDI6js.ConfirmDialog,
3112
+ {
3113
+ open,
3114
+ onOpenChange: setOpen,
3115
+ title: t(`billing.admin.prices.${scope}.title`),
3116
+ description: t(`billing.admin.prices.${scope}.description`, { label: priceLabel(price) }),
3117
+ confirmLabel: t(`billing.admin.prices.${scope}.confirm`),
3118
+ cancelLabel: t("ui.buttons.cancel"),
3119
+ destructive: !isArchived,
3120
+ onConfirm: async () => {
3121
+ try {
3122
+ if (isArchived) await restorePrice(price.id);
3123
+ else await archivePrice(price.id);
3124
+ } catch (error) {
3125
+ _chunkUGNLKDI6js.errorToast.call(void 0, { title: t(`billing.admin.prices.${scope}.title`), error });
3126
+ throw error;
3127
+ }
3173
3128
  }
3174
- ),
3175
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.FormCheckbox, { form, id: "active", name: "Active" }),
3176
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CommonEditorButtons, { isEdit: !!product, form, disabled: isSubmitting, setOpen: onOpenChange })
3177
- ] }) })
3178
- ] }) });
3129
+ }
3130
+ )
3131
+ ] });
3179
3132
  }
3180
- _chunk7QVYU63Ejs.__name.call(void 0, ProductEditor, "ProductEditor");
3181
-
3182
- // src/features/billing/contexts/BillingContext.tsx
3183
-
3184
- var BillingContext = _react.createContext.call(void 0, void 0);
3185
- var BillingProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ children }) => {
3186
- const t = _nextintl.useTranslations.call(void 0, );
3187
- const { hasRole } = _chunk7HKJNUW7js.useCurrentUserContext.call(void 0, );
3188
- const [showCreateProduct, setShowCreateProduct] = _react.useState.call(void 0, false);
3189
- const [refreshToken, setRefreshToken] = _react.useState.call(void 0, 0);
3190
- const refresh = _react.useCallback.call(void 0, () => setRefreshToken((value) => value + 1), []);
3191
- const breadcrumbs = [{ name: t(`billing.admin.products.title`) }];
3192
- const title = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
3193
- const response = { type: t(`billing.admin.products.title`) };
3194
- if (hasRole(_chunkOTEDZ6YWjs.getRoleId.call(void 0, ).Administrator)) {
3195
- response.functions = [
3196
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { onClick: () => setShowCreateProduct(true), children: t(`billing.admin.products.create`) }, "productEditorTrigger"),
3197
- showCreateProduct ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3198
- ProductEditor,
3199
- {
3200
- open: showCreateProduct,
3201
- onOpenChange: setShowCreateProduct,
3202
- onSuccess: () => {
3203
- setShowCreateProduct(false);
3204
- refresh();
3205
- }
3206
- },
3207
- "productEditor"
3208
- ) : null
3209
- ];
3210
- }
3211
- return response;
3212
- }, "title");
3213
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.SharedProvider, { value: { breadcrumbs, title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BillingContext.Provider, { value: { refreshToken, refresh }, children }) });
3214
- }, "BillingProvider");
3215
- var useBillingContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
3216
- const context = _react.useContext.call(void 0, BillingContext);
3217
- if (context === void 0) {
3218
- throw new Error("useBillingContext must be used within a BillingProvider");
3219
- }
3220
- return context;
3221
- }, "useBillingContext");
3222
- var useOptionalBillingContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => _react.useContext.call(void 0, BillingContext), "useOptionalBillingContext");
3133
+ _chunk7QVYU63Ejs.__name.call(void 0, PriceArchiver, "PriceArchiver");
3223
3134
 
3224
3135
  // src/features/billing/stripe-price/components/forms/PriceEditor.tsx
3225
3136
 
@@ -3229,764 +3140,1012 @@ var useOptionalBillingContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(voi
3229
3140
 
3230
3141
 
3231
3142
 
3232
- function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
3233
- const [isSubmitting, setIsSubmitting] = _react.useState.call(void 0, false);
3143
+
3144
+ function PriceEditorInternal({
3145
+ productId,
3146
+ price,
3147
+ propagateChanges,
3148
+ onSuccess,
3149
+ trigger,
3150
+ forceShow,
3151
+ onClose,
3152
+ dialogOpen,
3153
+ onDialogOpenChange
3154
+ }) {
3155
+ const t = _nextintl.useTranslations.call(void 0, );
3156
+ const router = _chunkJKGEJGSDjs.useI18nRouter.call(void 0, );
3157
+ const { createPrice, updatePrice, productId: contextProductId } = usePriceContext();
3234
3158
  const [allFeatures, setAllFeatures] = _react.useState.call(void 0, []);
3159
+ const isEdit = !!price;
3160
+ const targetProductId = _nullishCoalesce(_nullishCoalesce(productId, () => ( _optionalChain([price, 'optionalAccess', _117 => _117.product, 'optionalAccess', _118 => _118.id]))), () => ( contextProductId));
3235
3161
  _react.useEffect.call(void 0, () => {
3236
3162
  const fetchFeatures = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
3237
- try {
3238
- const features = await _chunkRTOC53EZjs.FeatureService.findMany({});
3239
- setAllFeatures(features);
3240
- } catch (error) {
3241
- console.error("[PriceEditor] Failed to fetch features:", error);
3242
- }
3163
+ setAllFeatures(await _chunk53B6NPGAjs.FeatureService.findMany({}));
3243
3164
  }, "fetchFeatures");
3244
- fetchFeatures();
3165
+ void fetchFeatures();
3245
3166
  }, []);
3246
- const formSchema2 = _zod3.z.object({
3247
- unitAmount: _zod3.z.preprocess(
3248
- (val) => typeof val === "string" ? parseFloat(val) : val,
3249
- _zod3.z.number().min(0, { message: "Amount must be 0 or greater" })
3250
- ),
3251
- currency: _zod3.z.string().min(1, { message: "Currency is required" }),
3252
- interval: _zod3.z.enum(["one_time", "day", "week", "month", "year"]),
3253
- intervalCount: _zod3.z.preprocess(
3254
- (val) => val === "" || val === void 0 ? void 0 : typeof val === "string" ? parseInt(val, 10) : val,
3255
- _zod3.z.number().min(1).optional()
3256
- ),
3257
- usageType: _zod3.z.enum(["licensed", "metered"]).optional(),
3258
- nickname: _zod3.z.string().optional(),
3259
- active: _zod3.z.boolean(),
3260
- isTrial: _zod3.z.boolean(),
3261
- description: _zod3.z.string().optional(),
3262
- features: _zod3.z.array(_zod3.z.string()),
3263
- token: _zod3.z.string(),
3264
- featureIds: _zod3.z.array(_zod3.z.string())
3265
- });
3266
- const isEditMode = !!price;
3267
- const defaultUnitAmount = _optionalChain([price, 'optionalAccess', _120 => _120.unitAmount]) ? price.unitAmount / 100 : 0;
3268
- const coreFeatureIds = allFeatures.filter((f) => f.isCore).map((f) => f.id);
3269
- const defaultFeatureIds = [.../* @__PURE__ */ new Set([..._nullishCoalesce(_optionalChain([price, 'optionalAccess', _121 => _121.priceFeatures, 'optionalAccess', _122 => _122.map, 'call', _123 => _123((f) => f.id)]), () => ( [])), ...coreFeatureIds])];
3167
+ const formSchema2 = _react.useMemo.call(void 0,
3168
+ () => _zod3.z.object({
3169
+ unitAmount: _zod3.z.preprocess(
3170
+ (value) => typeof value === "string" ? parseFloat(value) : value,
3171
+ _zod3.z.number().min(0, { message: t("billing.admin.prices.errors.amount") })
3172
+ ),
3173
+ currency: _zod3.z.string().min(1, { message: t("billing.admin.prices.errors.currency") }),
3174
+ interval: _zod3.z.enum(["one_time", "day", "week", "month", "year"]),
3175
+ intervalCount: _zod3.z.preprocess(
3176
+ (value) => value === "" || value === void 0 ? void 0 : typeof value === "string" ? parseInt(value, 10) : value,
3177
+ _zod3.z.number().min(1).optional()
3178
+ ),
3179
+ usageType: _zod3.z.enum(["licensed", "metered"]).optional(),
3180
+ nickname: _zod3.z.string().optional(),
3181
+ isTrial: _zod3.z.boolean(),
3182
+ description: _zod3.z.string().optional(),
3183
+ features: _zod3.z.array(_zod3.z.string()),
3184
+ token: _zod3.z.string(),
3185
+ featureIds: _zod3.z.array(_zod3.z.string())
3186
+ }),
3187
+ [t]
3188
+ );
3189
+ const getDefaultValues = _react.useCallback.call(void 0, () => {
3190
+ const coreFeatureIds = allFeatures.filter((feature) => feature.isCore).map((feature) => feature.id);
3191
+ return {
3192
+ unitAmount: _optionalChain([price, 'optionalAccess', _119 => _119.unitAmount]) ? price.unitAmount / 100 : 0,
3193
+ currency: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _120 => _120.currency]), () => ( "usd")),
3194
+ interval: _optionalChain([price, 'optionalAccess', _121 => _121.priceType]) === "one_time" ? "one_time" : _nullishCoalesce(_optionalChain([price, 'optionalAccess', _122 => _122.recurring, 'optionalAccess', _123 => _123.interval]), () => ( "month")),
3195
+ intervalCount: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _124 => _124.recurring, 'optionalAccess', _125 => _125.intervalCount]), () => ( 1)),
3196
+ usageType: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _126 => _126.recurring, 'optionalAccess', _127 => _127.usageType]), () => ( "licensed")),
3197
+ nickname: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _128 => _128.nickname]), () => ( "")),
3198
+ isTrial: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _129 => _129.isTrial]), () => ( false)),
3199
+ description: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _130 => _130.description]), () => ( "")),
3200
+ features: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _131 => _131.features]), () => ( [])),
3201
+ token: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _132 => _132.token, 'optionalAccess', _133 => _133.toString, 'call', _134 => _134()]), () => ( "")),
3202
+ featureIds: [.../* @__PURE__ */ new Set([..._nullishCoalesce(_optionalChain([price, 'optionalAccess', _135 => _135.priceFeatures, 'optionalAccess', _136 => _136.map, 'call', _137 => _137((f) => f.id)]), () => ( [])), ...coreFeatureIds])]
3203
+ };
3204
+ }, [price, allFeatures]);
3270
3205
  const form = _reacthookform.useForm.call(void 0, {
3271
3206
  resolver: _zod.zodResolver.call(void 0, formSchema2),
3272
- defaultValues: {
3273
- unitAmount: defaultUnitAmount,
3274
- currency: _optionalChain([price, 'optionalAccess', _124 => _124.currency]) || "usd",
3275
- interval: _optionalChain([price, 'optionalAccess', _125 => _125.priceType]) === "one_time" ? "one_time" : _optionalChain([price, 'optionalAccess', _126 => _126.recurring, 'optionalAccess', _127 => _127.interval]) || "month",
3276
- intervalCount: _optionalChain([price, 'optionalAccess', _128 => _128.recurring, 'optionalAccess', _129 => _129.intervalCount]) || 1,
3277
- usageType: _optionalChain([price, 'optionalAccess', _130 => _130.recurring, 'optionalAccess', _131 => _131.usageType]) || "licensed",
3278
- nickname: _optionalChain([price, 'optionalAccess', _132 => _132.nickname]) || "",
3279
- active: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _133 => _133.active]), () => ( true)),
3280
- isTrial: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _134 => _134.isTrial]), () => ( false)),
3281
- description: _optionalChain([price, 'optionalAccess', _135 => _135.description]) || "",
3282
- features: _optionalChain([price, 'optionalAccess', _136 => _136.features]) || [],
3283
- token: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _137 => _137.token, 'optionalAccess', _138 => _138.toString, 'call', _139 => _139()]), () => ( "")),
3284
- featureIds: defaultFeatureIds
3285
- }
3207
+ defaultValues: getDefaultValues()
3286
3208
  });
3287
- _react.useEffect.call(void 0, () => {
3288
- if (open) {
3289
- const currentCoreFeatureIds = allFeatures.filter((f) => f.isCore).map((f) => f.id);
3290
- const resetFeatureIds = [
3291
- .../* @__PURE__ */ new Set([..._nullishCoalesce(_optionalChain([price, 'optionalAccess', _140 => _140.priceFeatures, 'optionalAccess', _141 => _141.map, 'call', _142 => _142((f) => f.id)]), () => ( [])), ...currentCoreFeatureIds])
3292
- ];
3293
- form.reset({
3294
- unitAmount: _optionalChain([price, 'optionalAccess', _143 => _143.unitAmount]) ? price.unitAmount / 100 : 0,
3295
- currency: _optionalChain([price, 'optionalAccess', _144 => _144.currency]) || "usd",
3296
- interval: _optionalChain([price, 'optionalAccess', _145 => _145.priceType]) === "one_time" ? "one_time" : _optionalChain([price, 'optionalAccess', _146 => _146.recurring, 'optionalAccess', _147 => _147.interval]) || "month",
3297
- intervalCount: _optionalChain([price, 'optionalAccess', _148 => _148.recurring, 'optionalAccess', _149 => _149.intervalCount]) || 1,
3298
- usageType: _optionalChain([price, 'optionalAccess', _150 => _150.recurring, 'optionalAccess', _151 => _151.usageType]) || "licensed",
3299
- nickname: _optionalChain([price, 'optionalAccess', _152 => _152.nickname]) || "",
3300
- active: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _153 => _153.active]), () => ( true)),
3301
- isTrial: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _154 => _154.isTrial]), () => ( false)),
3302
- description: _optionalChain([price, 'optionalAccess', _155 => _155.description]) || "",
3303
- features: _optionalChain([price, 'optionalAccess', _156 => _156.features]) || [],
3304
- token: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _157 => _157.token, 'optionalAccess', _158 => _158.toString, 'call', _159 => _159()]), () => ( "")),
3305
- featureIds: resetFeatureIds
3306
- });
3307
- }
3308
- }, [open, _optionalChain([price, 'optionalAccess', _160 => _160.id]), allFeatures]);
3309
3209
  const watchInterval = form.watch("interval");
3310
3210
  const isRecurring = watchInterval !== "one_time";
3311
- const onSubmit = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async (values) => {
3312
- setIsSubmitting(true);
3313
- try {
3314
- const unitAmountInCents = Math.round(values.unitAmount * 100);
3315
- if (isEditMode) {
3316
- await _chunkRTOC53EZjs.StripePriceService.updatePrice({
3317
- id: price.id,
3318
- nickname: values.nickname || void 0,
3319
- description: values.description || void 0,
3320
- features: values.features.filter((f) => f.trim()) || void 0,
3321
- token: values.token ? parseInt(values.token, 10) : void 0,
3322
- // Only include isTrial and featureIds for recurring prices
3323
- ..._optionalChain([price, 'optionalAccess', _161 => _161.priceType]) === "recurring" ? { isTrial: values.isTrial, featureIds: values.featureIds } : {}
3324
- });
3325
- } else {
3326
- const createInput = {
3327
- id: _uuid.v4.call(void 0, ),
3328
- productId,
3329
- currency: values.currency,
3330
- unitAmount: unitAmountInCents
3331
- };
3332
- if (isRecurring) {
3333
- createInput.recurring = {
3334
- interval: values.interval,
3335
- intervalCount: values.intervalCount || 1,
3336
- usageType: values.usageType || "licensed"
3337
- };
3338
- }
3339
- if (values.nickname) {
3340
- createInput.nickname = values.nickname;
3341
- }
3342
- if (values.description) {
3343
- createInput.description = values.description;
3344
- }
3345
- const filteredFeatures = values.features.filter((f) => f.trim());
3346
- if (filteredFeatures.length > 0) {
3347
- createInput.features = filteredFeatures;
3348
- }
3349
- if (values.token) {
3350
- createInput.token = parseInt(values.token, 10);
3351
- }
3352
- if (isRecurring) {
3353
- createInput.isTrial = values.isTrial;
3354
- if (values.featureIds.length > 0) {
3355
- createInput.featureIds = values.featureIds;
3356
- }
3357
- }
3358
- await _chunkRTOC53EZjs.StripePriceService.createPrice(createInput);
3359
- }
3360
- onSuccess();
3361
- onOpenChange(false);
3362
- } catch (error) {
3363
- console.error("[PriceEditor] Failed to save price:", error);
3364
- } finally {
3365
- setIsSubmitting(false);
3366
- }
3367
- }, "onSubmit");
3368
3211
  const currencyOptions = [
3369
3212
  { id: "usd", text: "USD ($)" },
3370
3213
  { id: "eur", text: "EUR (\u20AC)" },
3371
3214
  { id: "gbp", text: "GBP (\xA3)" }
3372
3215
  ];
3373
3216
  const intervalOptions = [
3374
- { id: "one_time", text: "One-time" },
3375
- { id: "day", text: "Daily" },
3376
- { id: "week", text: "Weekly" },
3377
- { id: "month", text: "Monthly" },
3378
- { id: "year", text: "Yearly" }
3217
+ { id: "one_time", text: t("billing.admin.prices.interval.one_time") },
3218
+ { id: "day", text: t("billing.admin.prices.interval.day") },
3219
+ { id: "week", text: t("billing.admin.prices.interval.week") },
3220
+ { id: "month", text: t("billing.admin.prices.interval.month") },
3221
+ { id: "year", text: t("billing.admin.prices.interval.year") }
3379
3222
  ];
3380
3223
  const usageTypeOptions = [
3381
- { id: "licensed", text: "Licensed (per unit)" },
3382
- { id: "metered", text: "Metered (usage-based)" }
3224
+ { id: "licensed", text: t("billing.admin.prices.usage.licensed") },
3225
+ { id: "metered", text: t("billing.admin.prices.usage.metered") }
3383
3226
  ];
3384
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.DialogContent, { className: "max-w-2xl", children: [
3385
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.DialogHeader, { children: [
3386
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.DialogTitle, { children: isEditMode ? "Edit Price" : "Create Price" }),
3387
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.DialogDescription, { children: isEditMode ? "Update the price details. Note: Only nickname and active status can be changed." : "Create a new price for this product" })
3388
- ] }),
3389
- isEditMode && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-primary/10 border-primary/30 flex gap-x-3 rounded-lg border p-4", children: [
3390
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.AlertCircle, { className: "text-primary mt-0.5 h-5 w-5 flex-shrink-0" }),
3391
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-foreground text-sm", children: [
3392
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-semibold mb-1", children: "Stripe Price Immutability" }),
3393
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { children: "Due to Stripe's architecture, only the nickname and active status can be modified after creation. To change amount, currency, or billing interval, create a new price." })
3394
- ] })
3395
- ] }),
3396
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-col gap-y-4", children: [
3397
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
3227
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3228
+ _chunkUGNLKDI6js.EditorSheet,
3229
+ {
3230
+ form,
3231
+ entityType: t("billing.admin.prices.entity"),
3232
+ entityName: price ? priceLabel(price) : void 0,
3233
+ isEdit,
3234
+ module: _chunk53B6NPGAjs.Modules.StripePrice,
3235
+ size: "lg",
3236
+ propagateChanges,
3237
+ onSuccess,
3238
+ onNavigate: (url) => router.push(url),
3239
+ onSubmit: async (values) => {
3240
+ const trimmedFeatures = values.features.filter((feature) => feature.trim());
3241
+ if (isEdit) {
3242
+ const patch = {
3243
+ id: price.id,
3244
+ nickname: values.nickname || void 0,
3245
+ description: values.description || void 0,
3246
+ features: trimmedFeatures.length > 0 ? trimmedFeatures : void 0,
3247
+ token: values.token ? parseInt(values.token, 10) : void 0,
3248
+ // Stripe one-time prices carry neither a trial flag nor platform
3249
+ // features, so those two only travel for recurring prices.
3250
+ ...price.priceType === "recurring" ? { isTrial: values.isTrial, featureIds: values.featureIds } : {}
3251
+ };
3252
+ return await updatePrice(patch);
3253
+ }
3254
+ if (!targetProductId) throw new Error("PriceEditor requires a productId to create a price");
3255
+ const payload = {
3256
+ id: _uuid.v4.call(void 0, ),
3257
+ productId: targetProductId,
3258
+ currency: values.currency,
3259
+ unitAmount: Math.round(values.unitAmount * 100)
3260
+ };
3261
+ if (isRecurring) {
3262
+ payload.recurring = {
3263
+ interval: values.interval,
3264
+ intervalCount: _nullishCoalesce(values.intervalCount, () => ( 1)),
3265
+ usageType: _nullishCoalesce(values.usageType, () => ( "licensed"))
3266
+ };
3267
+ payload.isTrial = values.isTrial;
3268
+ if (values.featureIds.length > 0) payload.featureIds = values.featureIds;
3269
+ }
3270
+ if (values.nickname) payload.nickname = values.nickname;
3271
+ if (values.description) payload.description = values.description;
3272
+ if (trimmedFeatures.length > 0) payload.features = trimmedFeatures;
3273
+ if (values.token) payload.token = parseInt(values.token, 10);
3274
+ return await createPrice(payload);
3275
+ },
3276
+ onReset: getDefaultValues,
3277
+ trigger,
3278
+ forceShow,
3279
+ onClose,
3280
+ dialogOpen,
3281
+ onDialogOpenChange,
3282
+ children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
3283
+ isEdit && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.Alert, { children: [
3284
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.AlertTitle, { children: t("billing.admin.prices.immutability.title") }),
3285
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.AlertDescription, { children: t("billing.admin.prices.immutability.description") })
3286
+ ] }),
3287
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
3288
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3289
+ _chunkUGNLKDI6js.FormInput,
3290
+ {
3291
+ form,
3292
+ id: "unitAmount",
3293
+ type: "decimal",
3294
+ name: t("billing.admin.prices.fields.amount"),
3295
+ placeholder: t("billing.admin.prices.placeholders.amount"),
3296
+ disabled: isEdit,
3297
+ isRequired: true
3298
+ }
3299
+ ),
3300
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3301
+ _chunkUGNLKDI6js.FormSelect,
3302
+ {
3303
+ form,
3304
+ id: "currency",
3305
+ name: t("billing.admin.prices.fields.currency"),
3306
+ values: currencyOptions,
3307
+ disabled: isEdit
3308
+ }
3309
+ )
3310
+ ] }),
3398
3311
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3399
- _chunk7HKJNUW7js.FormInput,
3312
+ _chunkUGNLKDI6js.FormSelect,
3400
3313
  {
3401
3314
  form,
3402
- id: "unitAmount",
3403
- name: "Amount (in dollars)",
3404
- placeholder: "9.99",
3405
- disabled: isEditMode,
3406
- isRequired: true
3315
+ id: "interval",
3316
+ name: t("billing.admin.prices.fields.interval"),
3317
+ values: intervalOptions,
3318
+ disabled: isEdit
3407
3319
  }
3408
3320
  ),
3409
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.FormSelect, { form, id: "currency", name: "Currency", values: currencyOptions, disabled: isEditMode })
3410
- ] }),
3411
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3412
- _chunk7HKJNUW7js.FormSelect,
3413
- {
3414
- form,
3415
- id: "interval",
3416
- name: "Billing Interval",
3417
- values: intervalOptions,
3418
- disabled: isEditMode
3419
- }
3420
- ),
3421
- isRecurring && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
3321
+ isRecurring && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
3322
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3323
+ _chunkUGNLKDI6js.FormInput,
3324
+ {
3325
+ form,
3326
+ id: "intervalCount",
3327
+ type: "number",
3328
+ name: t("billing.admin.prices.fields.intervalCount"),
3329
+ placeholder: t("billing.admin.prices.placeholders.intervalCount"),
3330
+ disabled: isEdit
3331
+ }
3332
+ ),
3333
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3334
+ _chunkUGNLKDI6js.FormSelect,
3335
+ {
3336
+ form,
3337
+ id: "usageType",
3338
+ name: t("billing.admin.prices.fields.usageType"),
3339
+ values: usageTypeOptions,
3340
+ disabled: isEdit
3341
+ }
3342
+ )
3343
+ ] }),
3422
3344
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3423
- _chunk7HKJNUW7js.FormInput,
3345
+ _chunkUGNLKDI6js.FormInput,
3424
3346
  {
3425
3347
  form,
3426
- id: "intervalCount",
3427
- name: "Interval Count",
3428
- placeholder: "1",
3429
- type: "number",
3430
- disabled: isEditMode
3348
+ id: "nickname",
3349
+ name: t("billing.admin.prices.fields.nickname"),
3350
+ placeholder: t("billing.admin.prices.placeholders.nickname")
3431
3351
  }
3432
3352
  ),
3433
3353
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3434
- _chunk7HKJNUW7js.FormSelect,
3354
+ _chunkUGNLKDI6js.FormTextarea,
3435
3355
  {
3436
3356
  form,
3437
- id: "usageType",
3438
- name: "Usage Type",
3439
- values: usageTypeOptions,
3440
- disabled: isEditMode
3357
+ id: "description",
3358
+ name: t("billing.admin.prices.fields.description"),
3359
+ placeholder: t("billing.admin.prices.placeholders.description"),
3360
+ className: "min-h-24"
3441
3361
  }
3442
- )
3443
- ] }),
3444
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3445
- _chunk7HKJNUW7js.FormInput,
3446
- {
3447
- form,
3448
- id: "nickname",
3449
- name: "Nickname (optional)",
3450
- placeholder: "e.g., Standard Plan, Pro Tier"
3451
- }
3452
- ),
3453
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3454
- _chunk7HKJNUW7js.FormTextarea,
3455
- {
3456
- form,
3457
- id: "description",
3458
- name: "Description (optional)",
3459
- placeholder: "Describe what this price tier includes...",
3460
- className: "min-h-24"
3461
- }
3462
- ),
3463
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.FormInput, { form, id: "token", name: "Token (optional)", placeholder: "Enter token value" }),
3464
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
3465
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Label, { children: "Features (optional)" }),
3466
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
3362
+ ),
3363
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3364
+ _chunkUGNLKDI6js.FormInput,
3365
+ {
3366
+ form,
3367
+ id: "token",
3368
+ type: "number",
3369
+ name: t("billing.admin.prices.fields.token"),
3370
+ placeholder: t("billing.admin.prices.placeholders.token")
3371
+ }
3372
+ ),
3373
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-2", children: [
3374
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.FieldLabel, { children: t("billing.admin.prices.fields.features") }),
3467
3375
  form.watch("features").map((_, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
3468
3376
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3469
- _chunk7HKJNUW7js.Input,
3377
+ _chunkUGNLKDI6js.Input,
3470
3378
  {
3471
3379
  ...form.register(`features.${index}`),
3472
- placeholder: `Feature ${index + 1}`,
3380
+ placeholder: t("billing.admin.prices.placeholders.feature", { index: index + 1 }),
3473
3381
  className: "flex-1"
3474
3382
  }
3475
3383
  ),
3476
3384
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3477
- _chunk7HKJNUW7js.Button,
3385
+ _chunkUGNLKDI6js.Button,
3478
3386
  {
3479
3387
  type: "button",
3480
3388
  variant: "outline",
3481
3389
  size: "icon",
3482
- onClick: () => {
3483
- const currentFeatures = form.getValues("features");
3484
- form.setValue(
3485
- "features",
3486
- currentFeatures.filter((_2, i) => i !== index)
3487
- );
3488
- },
3489
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.XIcon, { className: "h-4 w-4" })
3390
+ "aria-label": t("billing.admin.prices.actions.removeFeature"),
3391
+ onClick: () => form.setValue(
3392
+ "features",
3393
+ form.getValues("features").filter((_2, i) => i !== index)
3394
+ ),
3395
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.XIcon, {})
3490
3396
  }
3491
3397
  )
3492
3398
  ] }, index)),
3493
3399
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
3494
- _chunk7HKJNUW7js.Button,
3400
+ _chunkUGNLKDI6js.Button,
3495
3401
  {
3496
3402
  type: "button",
3497
3403
  variant: "outline",
3498
3404
  size: "sm",
3499
- onClick: () => {
3500
- const currentFeatures = form.getValues("features");
3501
- form.setValue("features", [...currentFeatures, ""]);
3502
- },
3503
- className: "mt-2",
3405
+ className: "self-start",
3406
+ onClick: () => form.setValue("features", [...form.getValues("features"), ""]),
3504
3407
  children: [
3505
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.PlusIcon, { className: "h-4 w-4 mr-2" }),
3506
- "Add Feature"
3408
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.PlusIcon, {}),
3409
+ t("billing.admin.prices.actions.addFeature")
3507
3410
  ]
3508
3411
  }
3509
3412
  )
3510
- ] })
3511
- ] }),
3512
- isRecurring && allFeatures.length > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
3513
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Label, { children: "Platform Features" }),
3514
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-md p-4 space-y-2 max-h-48 overflow-y-auto", children: allFeatures.map((feature) => {
3515
- const isCore = feature.isCore;
3516
- const isChecked = form.watch("featureIds").includes(feature.id);
3517
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center space-x-2", children: [
3518
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3519
- "input",
3520
- {
3521
- type: "checkbox",
3522
- id: `feature-${feature.id}`,
3523
- checked: isChecked,
3524
- disabled: isCore,
3525
- onChange: (e) => {
3526
- const currentIds = form.getValues("featureIds");
3527
- if (e.target.checked) {
3528
- form.setValue("featureIds", [...currentIds, feature.id]);
3529
- } else {
3530
- if (!isCore) {
3413
+ ] }),
3414
+ isRecurring && allFeatures.length > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-2", children: [
3415
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.FieldLabel, { children: t("billing.admin.prices.fields.platformFeatures") }),
3416
+ /* @__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) => {
3417
+ const isChecked = form.watch("featureIds").includes(feature.id);
3418
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
3419
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3420
+ _chunkUGNLKDI6js.Checkbox,
3421
+ {
3422
+ id: `feature-${feature.id}`,
3423
+ checked: isChecked,
3424
+ disabled: feature.isCore,
3425
+ onCheckedChange: (checked) => {
3426
+ const current = form.getValues("featureIds");
3427
+ if (checked) form.setValue("featureIds", [.../* @__PURE__ */ new Set([...current, feature.id])]);
3428
+ else if (!feature.isCore)
3531
3429
  form.setValue(
3532
3430
  "featureIds",
3533
- currentIds.filter((id) => id !== feature.id)
3431
+ current.filter((id) => id !== feature.id)
3534
3432
  );
3535
- }
3536
3433
  }
3537
- },
3538
- className: "h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary disabled:opacity-50"
3539
- }
3540
- ),
3541
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
3542
- "label",
3543
- {
3544
- htmlFor: `feature-${feature.id}`,
3545
- className: `text-sm ${isCore ? "text-muted-foreground" : ""}`,
3546
- children: [
3547
- feature.name,
3548
- isCore && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "ml-2 text-xs text-muted-foreground", children: "(Core - Required)" })
3549
- ]
3550
- }
3551
- )
3552
- ] }, feature.id);
3553
- }) })
3554
- ] }),
3555
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.FormCheckbox, { form, id: "active", name: "Active" }),
3556
- isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3557
- _chunk7HKJNUW7js.FormCheckbox,
3558
- {
3559
- form,
3560
- id: "isTrial",
3561
- name: "Trial Price",
3562
- description: "Mark this as the trial subscription plan (only one price should be marked as trial)"
3563
- }
3564
- ),
3565
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CommonEditorButtons, { isEdit: isEditMode, form, disabled: isSubmitting, setOpen: onOpenChange })
3566
- ] }) })
3567
- ] }) });
3434
+ }
3435
+ ),
3436
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.FieldLabel, { htmlFor: `feature-${feature.id}`, children: feature.name }),
3437
+ feature.isCore && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.admin.prices.help.core") })
3438
+ ] }, feature.id);
3439
+ }) })
3440
+ ] }),
3441
+ isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3442
+ _chunkUGNLKDI6js.FormCheckbox,
3443
+ {
3444
+ form,
3445
+ id: "isTrial",
3446
+ name: t("billing.admin.prices.fields.trial"),
3447
+ description: t("billing.admin.prices.help.trial")
3448
+ }
3449
+ )
3450
+ ] })
3451
+ }
3452
+ );
3453
+ }
3454
+ _chunk7QVYU63Ejs.__name.call(void 0, PriceEditorInternal, "PriceEditorInternal");
3455
+ function PriceEditor(props) {
3456
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceEditorInternal, { ...props });
3568
3457
  }
3569
3458
  _chunk7QVYU63Ejs.__name.call(void 0, PriceEditor, "PriceEditor");
3570
3459
 
3571
- // src/features/billing/stripe-price/components/lists/PricesList.tsx
3460
+ // src/features/billing/contexts/PriceContext.tsx
3461
+
3462
+ var PriceContext = _react.createContext.call(void 0, void 0);
3463
+ var defaultContextValue = {
3464
+ price: void 0,
3465
+ setPrice: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
3466
+ }, "setPrice"),
3467
+ reloadPrice: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
3468
+ }, "reloadPrice"),
3469
+ createPrice: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
3470
+ throw new Error("createPrice requires a PriceProvider");
3471
+ }, "createPrice"),
3472
+ updatePrice: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
3473
+ throw new Error("updatePrice requires a PriceProvider");
3474
+ }, "updatePrice"),
3475
+ archivePrice: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
3476
+ }, "archivePrice"),
3477
+ restorePrice: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
3478
+ }, "restorePrice"),
3479
+ priceVersion: 0,
3480
+ refreshPrices: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
3481
+ }, "refreshPrices"),
3482
+ productId: void 0
3483
+ };
3484
+ function priceLabel(price) {
3485
+ return _nullishCoalesce(price.nickname, () => ( `${_chunkUGNLKDI6js.formatCurrency.call(void 0, price.unitAmount, price.currency)} ${_chunkUGNLKDI6js.formatInterval.call(void 0, price)}`.trim()));
3486
+ }
3487
+ _chunk7QVYU63Ejs.__name.call(void 0, priceLabel, "priceLabel");
3488
+ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
3489
+ children,
3490
+ dehydratedPrice,
3491
+ publishChrome = true,
3492
+ productId: productIdProp
3493
+ }) => {
3494
+ const t = _nextintl.useTranslations.call(void 0, );
3495
+ const generateUrl = _chunkUGNLKDI6js.usePageUrlGenerator.call(void 0, );
3496
+ const { hasRole } = _chunkUGNLKDI6js.useCurrentUserContext.call(void 0, );
3497
+ const [price, setPrice] = _react.useState.call(void 0,
3498
+ dehydratedPrice ? _chunk53B6NPGAjs.rehydrate.call(void 0, _chunk53B6NPGAjs.Modules.StripePrice, dehydratedPrice) : void 0
3499
+ );
3500
+ const [priceVersion, setPriceVersion] = _react.useState.call(void 0, 0);
3501
+ const refreshPrices = _react.useCallback.call(void 0, () => setPriceVersion((value2) => value2 + 1), []);
3502
+ const productId = _nullishCoalesce(productIdProp, () => ( _optionalChain([price, 'optionalAccess', _138 => _138.product, 'optionalAccess', _139 => _139.id])));
3503
+ const reloadPrice = _react.useCallback.call(void 0, async () => {
3504
+ if (!_optionalChain([price, 'optionalAccess', _140 => _140.id])) return;
3505
+ setPrice(await _chunk53B6NPGAjs.StripePriceService.getPrice({ id: price.id }));
3506
+ }, [_optionalChain([price, 'optionalAccess', _141 => _141.id])]);
3507
+ const createPrice = _react.useCallback.call(void 0,
3508
+ async (input) => {
3509
+ const saved = await _chunk53B6NPGAjs.StripePriceService.createPrice(input);
3510
+ refreshPrices();
3511
+ return saved;
3512
+ },
3513
+ [refreshPrices]
3514
+ );
3515
+ const updatePrice = _react.useCallback.call(void 0,
3516
+ async (input) => {
3517
+ const saved = await _chunk53B6NPGAjs.StripePriceService.updatePrice(input);
3518
+ setPrice(saved);
3519
+ refreshPrices();
3520
+ return saved;
3521
+ },
3522
+ [refreshPrices]
3523
+ );
3524
+ const archivePrice = _react.useCallback.call(void 0,
3525
+ async (id) => {
3526
+ const target = _nullishCoalesce(id, () => ( _optionalChain([price, 'optionalAccess', _142 => _142.id])));
3527
+ if (!target) return;
3528
+ await _chunk53B6NPGAjs.StripePriceService.archivePrice({ id: target });
3529
+ await reloadPrice();
3530
+ refreshPrices();
3531
+ },
3532
+ [_optionalChain([price, 'optionalAccess', _143 => _143.id]), reloadPrice, refreshPrices]
3533
+ );
3534
+ const restorePrice = _react.useCallback.call(void 0,
3535
+ async (id) => {
3536
+ const target = _nullishCoalesce(id, () => ( _optionalChain([price, 'optionalAccess', _144 => _144.id])));
3537
+ if (!target) return;
3538
+ await _chunk53B6NPGAjs.StripePriceService.reactivatePrice({ id: target });
3539
+ await reloadPrice();
3540
+ refreshPrices();
3541
+ },
3542
+ [_optionalChain([price, 'optionalAccess', _145 => _145.id]), reloadPrice, refreshPrices]
3543
+ );
3544
+ const value = _react.useMemo.call(void 0,
3545
+ () => ({
3546
+ price,
3547
+ setPrice,
3548
+ reloadPrice,
3549
+ createPrice,
3550
+ updatePrice,
3551
+ archivePrice,
3552
+ restorePrice,
3553
+ priceVersion,
3554
+ refreshPrices,
3555
+ productId
3556
+ }),
3557
+ [price, reloadPrice, createPrice, updatePrice, archivePrice, restorePrice, priceVersion, refreshPrices, productId]
3558
+ );
3559
+ if (!publishChrome) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceContext.Provider, { value, children });
3560
+ const breadcrumb = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
3561
+ const items = [
3562
+ { name: t("billing.admin.products.title"), href: generateUrl({ page: _chunk53B6NPGAjs.Modules.StripeProduct }) }
3563
+ ];
3564
+ if (_optionalChain([price, 'optionalAccess', _146 => _146.product]))
3565
+ items.push({
3566
+ name: price.product.name,
3567
+ href: generateUrl({ page: _chunk53B6NPGAjs.Modules.StripeProduct, id: price.product.id })
3568
+ });
3569
+ if (price) items.push({ name: priceLabel(price) });
3570
+ return items;
3571
+ }, "breadcrumb");
3572
+ const title = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
3573
+ const response = { type: t("billing.admin.prices.title") };
3574
+ if (!price) return response;
3575
+ response.element = priceLabel(price);
3576
+ if (hasRole(_chunkJKGEJGSDjs.getRoleId.call(void 0, ).Administrator)) {
3577
+ response.functions = [
3578
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceArchiver, { price }, "priceArchiver"),
3579
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceEditor, { price, propagateChanges: setPrice }, "priceEditor")
3580
+ ];
3581
+ }
3582
+ return response;
3583
+ }, "title");
3584
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceContext.Provider, { value, children }) });
3585
+ }, "PriceProvider");
3586
+ var usePriceContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => _nullishCoalesce(_react.useContext.call(void 0, PriceContext), () => ( defaultContextValue)), "usePriceContext");
3572
3587
 
3588
+ // src/features/billing/contexts/ProductContext.tsx
3573
3589
 
3574
3590
 
3575
- function PricesList({ productId, onPricesChange }) {
3576
- const [prices, setPrices] = _react.useState.call(void 0, []);
3577
- const [loading, setLoading] = _react.useState.call(void 0, true);
3578
- const [showCreatePrice, setShowCreatePrice] = _react.useState.call(void 0, false);
3579
- const [editingPrice, setEditingPrice] = _react.useState.call(void 0, null);
3580
- const [priceToArchive, setPriceToArchive] = _react.useState.call(void 0, null);
3581
- const [priceToReactivate, setPriceToReactivate] = _react.useState.call(void 0, null);
3582
- const [archivingPriceId, setArchivingPriceId] = _react.useState.call(void 0, null);
3583
- const [reactivatingPriceId, setReactivatingPriceId] = _react.useState.call(void 0, null);
3584
- const loadPrices = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
3585
- setLoading(true);
3586
- try {
3587
- const fetchedPrices = await _chunkRTOC53EZjs.StripePriceService.listPrices({ productId });
3588
- setPrices(fetchedPrices);
3589
- } catch (error) {
3590
- console.error("[PricesList] Failed to load prices:", error);
3591
- } finally {
3592
- setLoading(false);
3593
- }
3594
- }, "loadPrices");
3595
- _react.useEffect.call(void 0, () => {
3596
- loadPrices();
3597
- }, [productId]);
3598
- const handleArchive = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
3599
- if (!priceToArchive) {
3600
- return;
3601
- }
3602
- setArchivingPriceId(priceToArchive.id);
3603
- try {
3604
- await _chunkRTOC53EZjs.StripePriceService.archivePrice({ id: priceToArchive.id });
3605
- setPriceToArchive(null);
3606
- await loadPrices();
3607
- onPricesChange();
3608
- } catch (error) {
3609
- console.error("[PricesList] Failed to archive price:", error);
3610
- } finally {
3611
- setArchivingPriceId(null);
3612
- }
3613
- }, "handleArchive");
3614
- const handleReactivate = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
3615
- if (!priceToReactivate) {
3616
- return;
3617
- }
3618
- setReactivatingPriceId(priceToReactivate.id);
3619
- try {
3620
- await _chunkRTOC53EZjs.StripePriceService.reactivatePrice({ id: priceToReactivate.id });
3621
- setPriceToReactivate(null);
3622
- await loadPrices();
3623
- onPricesChange();
3624
- } catch (error) {
3625
- console.error("[PricesList] Failed to reactivate price:", error);
3626
- } finally {
3627
- setReactivatingPriceId(null);
3628
- }
3629
- }, "handleReactivate");
3630
- const formatInterval2 = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (price) => {
3631
- if (price.priceType === "one_time") {
3632
- return "one-time";
3633
- }
3634
- if (price.recurring) {
3635
- const count = price.recurring.intervalCount;
3636
- const interval = price.recurring.interval;
3637
- if (count === 1) {
3638
- return `/ ${interval}`;
3639
- } else {
3640
- return `/ ${count} ${interval}s`;
3641
- }
3642
- }
3643
- return "";
3644
- }, "formatInterval");
3645
- if (loading) {
3646
- 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: "Loading prices..." }) });
3647
- }
3648
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-4", children: [
3649
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center justify-between mb-4", children: [
3650
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "text-lg font-semibold", children: "Prices" }),
3651
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { size: "sm", onClick: () => setShowCreatePrice(true), children: "Add Price" })
3652
- ] }),
3653
- prices.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-background flex flex-col items-center justify-center gap-y-3 rounded-lg border border-dashed p-8", children: [
3654
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.DollarSign, { className: "text-muted-foreground h-12 w-12" }),
3655
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-sm", children: "No prices yet. Add a price to enable subscriptions." }),
3656
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { size: "sm", onClick: () => setShowCreatePrice(true), children: "Add Price" })
3591
+
3592
+ // src/features/billing/stripe-product/components/forms/ProductArchiver.tsx
3593
+
3594
+
3595
+
3596
+
3597
+ function ProductArchiver({ product }) {
3598
+ const t = _nextintl.useTranslations.call(void 0, );
3599
+ const { archiveProduct, restoreProduct } = useProductContext();
3600
+ const [open, setOpen] = _react.useState.call(void 0, false);
3601
+ const isArchived = !product.active;
3602
+ const scope = isArchived ? "restore" : "archive";
3603
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
3604
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGNLKDI6js.Button, { variant: "outline", size: "sm", onClick: () => setOpen(true), children: [
3605
+ isArchived ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RotateCcwIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ArchiveIcon, {}),
3606
+ t(`billing.admin.products.${scope}.confirm`)
3657
3607
  ] }),
3658
- prices.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4", children: prices.map((price) => {
3659
- const isArchiving = archivingPriceId === price.id;
3660
- const isReactivating = reactivatingPriceId === price.id;
3661
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "border rounded-lg bg-white p-4 hover:shadow-sm transition-shadow", children: [
3662
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-start justify-between mb-3", children: [
3663
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.DollarSign, { className: "h-5 w-5 text-primary" }),
3664
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-1", children: [
3665
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { variant: "ghost", size: "sm", onClick: () => setEditingPrice(price), className: "h-8 w-8 p-0", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Edit, { className: "h-4 w-4" }) }),
3666
- price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3667
- _chunk7HKJNUW7js.Button,
3668
- {
3669
- variant: "ghost",
3670
- size: "sm",
3671
- onClick: () => setPriceToArchive(price),
3672
- className: "h-8 w-8 p-0",
3673
- disabled: isArchiving,
3674
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Archive, { className: "h-4 w-4" })
3675
- }
3676
- ) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3677
- _chunk7HKJNUW7js.Button,
3678
- {
3679
- variant: "ghost",
3680
- size: "sm",
3681
- onClick: () => setPriceToReactivate(price),
3682
- className: "h-8 w-8 p-0",
3683
- disabled: isReactivating,
3684
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RotateCcw, { className: "h-4 w-4" })
3685
- }
3686
- )
3687
- ] })
3688
- ] }),
3689
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mb-2", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-2xl font-bold", children: [
3690
- formatCurrency(price.unitAmount, price.currency),
3691
- " ",
3692
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-sm font-normal", children: formatInterval2(price) })
3693
- ] }) }),
3694
- _optionalChain([price, 'access', _162 => _162.metadata, 'optionalAccess', _163 => _163.nickname]) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm font-medium mb-2", children: price.metadata.nickname }),
3695
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2", children: [
3696
- price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Badge, { variant: "softGreen", children: "Active" }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Badge, { variant: "softGray", children: "Inactive" }),
3697
- _optionalChain([price, 'access', _164 => _164.recurring, 'optionalAccess', _165 => _165.usageType]) === "metered" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Badge, { variant: "softBlue", children: "Metered" }),
3698
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Badge, { variant: "softGray", className: "uppercase", children: price.currency })
3699
- ] })
3700
- ] }, price.id);
3701
- }) }),
3702
- showCreatePrice && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3703
- PriceEditor,
3704
- {
3705
- productId,
3706
- open: showCreatePrice,
3707
- onOpenChange: setShowCreatePrice,
3708
- onSuccess: () => {
3709
- loadPrices();
3710
- onPricesChange();
3711
- }
3712
- }
3713
- ),
3714
- editingPrice && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3715
- PriceEditor,
3608
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3609
+ _chunkUGNLKDI6js.ConfirmDialog,
3716
3610
  {
3717
- productId,
3718
- price: editingPrice,
3719
- open: !!editingPrice,
3720
- onOpenChange: (open) => !open && setEditingPrice(null),
3721
- onSuccess: () => {
3722
- loadPrices();
3723
- onPricesChange();
3724
- setEditingPrice(null);
3611
+ open,
3612
+ onOpenChange: setOpen,
3613
+ title: t(`billing.admin.products.${scope}.title`),
3614
+ description: t(`billing.admin.products.${scope}.description`, { name: product.name }),
3615
+ confirmLabel: t(`billing.admin.products.${scope}.confirm`),
3616
+ cancelLabel: t("ui.buttons.cancel"),
3617
+ destructive: !isArchived,
3618
+ onConfirm: async () => {
3619
+ try {
3620
+ if (isArchived) await restoreProduct(product.id);
3621
+ else await archiveProduct(product.id);
3622
+ } catch (error) {
3623
+ _chunkUGNLKDI6js.errorToast.call(void 0, { title: t(`billing.admin.products.${scope}.title`), error });
3624
+ throw error;
3625
+ }
3725
3626
  }
3726
3627
  }
3727
- ),
3728
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.AlertDialog, { open: !!priceToArchive, onOpenChange: (open) => !open && setPriceToArchive(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.AlertDialogContent, { children: [
3729
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.AlertDialogHeader, { children: [
3730
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.AlertDialogTitle, { children: "Archive Price" }),
3731
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.AlertDialogDescription, { children: [
3732
- "Are you sure you want to archive the price for",
3733
- " ",
3734
- priceToArchive && `${formatCurrency(priceToArchive.unitAmount, priceToArchive.currency)} ${formatInterval2(priceToArchive)}`,
3735
- "? This will prevent new subscriptions but existing ones will continue."
3736
- ] })
3737
- ] }),
3738
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.AlertDialogFooter, { children: [
3739
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.AlertDialogCancel, { disabled: !!archivingPriceId, children: "Cancel" }),
3628
+ )
3629
+ ] });
3630
+ }
3631
+ _chunk7QVYU63Ejs.__name.call(void 0, ProductArchiver, "ProductArchiver");
3632
+
3633
+ // src/features/billing/stripe-product/components/forms/ProductEditor.tsx
3634
+
3635
+
3636
+
3637
+
3638
+
3639
+
3640
+
3641
+ function ProductEditorInternal({
3642
+ product,
3643
+ propagateChanges,
3644
+ onSuccess,
3645
+ trigger,
3646
+ forceShow,
3647
+ onClose,
3648
+ dialogOpen,
3649
+ onDialogOpenChange
3650
+ }) {
3651
+ const t = _nextintl.useTranslations.call(void 0, );
3652
+ const router = _chunkJKGEJGSDjs.useI18nRouter.call(void 0, );
3653
+ const { createProduct, updateProduct } = useProductContext();
3654
+ const isEdit = !!product;
3655
+ const formSchema2 = _react.useMemo.call(void 0,
3656
+ () => _zod3.z.object({
3657
+ id: _zod3.z.uuidv4(),
3658
+ name: _zod3.z.string().min(1, { message: t("billing.admin.products.errors.name") }),
3659
+ description: _zod3.z.string().optional()
3660
+ }),
3661
+ [t]
3662
+ );
3663
+ const getDefaultValues = _react.useCallback.call(void 0,
3664
+ () => ({
3665
+ id: _nullishCoalesce(_optionalChain([product, 'optionalAccess', _147 => _147.id]), () => ( _uuid.v4.call(void 0, ))),
3666
+ name: _nullishCoalesce(_optionalChain([product, 'optionalAccess', _148 => _148.name]), () => ( "")),
3667
+ description: _nullishCoalesce(_optionalChain([product, 'optionalAccess', _149 => _149.description]), () => ( ""))
3668
+ }),
3669
+ [product]
3670
+ );
3671
+ const form = _reacthookform.useForm.call(void 0, {
3672
+ resolver: _zod.zodResolver.call(void 0, formSchema2),
3673
+ defaultValues: getDefaultValues()
3674
+ });
3675
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3676
+ _chunkUGNLKDI6js.EditorSheet,
3677
+ {
3678
+ form,
3679
+ entityType: t("billing.admin.products.entity"),
3680
+ entityName: _optionalChain([product, 'optionalAccess', _150 => _150.name]),
3681
+ isEdit,
3682
+ module: _chunk53B6NPGAjs.Modules.StripeProduct,
3683
+ size: "md",
3684
+ propagateChanges,
3685
+ onSuccess,
3686
+ onNavigate: (url) => router.push(url),
3687
+ onSubmit: async (values) => {
3688
+ const payload = { id: values.id, name: values.name, description: values.description };
3689
+ return isEdit ? await updateProduct(payload) : await createProduct(payload);
3690
+ },
3691
+ onReset: getDefaultValues,
3692
+ trigger,
3693
+ forceShow,
3694
+ onClose,
3695
+ dialogOpen,
3696
+ onDialogOpenChange,
3697
+ children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
3740
3698
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3741
- _chunk7HKJNUW7js.AlertDialogAction,
3699
+ _chunkUGNLKDI6js.FormInput,
3742
3700
  {
3743
- onClick: handleArchive,
3744
- disabled: !!archivingPriceId,
3745
- className: "bg-red-600 hover:bg-red-700",
3746
- children: archivingPriceId ? "Archiving..." : "Archive"
3701
+ form,
3702
+ id: "name",
3703
+ name: t("billing.admin.products.fields.name"),
3704
+ placeholder: t("billing.admin.products.placeholders.name"),
3705
+ isRequired: true
3747
3706
  }
3748
- )
3749
- ] })
3750
- ] }) }),
3751
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.AlertDialog, { open: !!priceToReactivate, onOpenChange: (open) => !open && setPriceToReactivate(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.AlertDialogContent, { children: [
3752
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.AlertDialogHeader, { children: [
3753
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.AlertDialogTitle, { children: "Reactivate Price" }),
3754
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.AlertDialogDescription, { children: [
3755
- "Are you sure you want to reactivate the price for",
3756
- " ",
3757
- priceToReactivate && `${formatCurrency(priceToReactivate.unitAmount, priceToReactivate.currency)} ${formatInterval2(priceToReactivate)}`,
3758
- "? This will allow new subscriptions again."
3759
- ] })
3760
- ] }),
3761
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.AlertDialogFooter, { children: [
3762
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.AlertDialogCancel, { disabled: !!reactivatingPriceId, children: "Cancel" }),
3707
+ ),
3763
3708
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3764
- _chunk7HKJNUW7js.AlertDialogAction,
3709
+ _chunkUGNLKDI6js.FormTextarea,
3765
3710
  {
3766
- onClick: handleReactivate,
3767
- disabled: !!reactivatingPriceId,
3768
- className: "bg-green-600 hover:bg-green-700",
3769
- children: reactivatingPriceId ? "Reactivating..." : "Reactivate"
3711
+ form,
3712
+ id: "description",
3713
+ name: t("billing.admin.products.fields.description"),
3714
+ placeholder: t("billing.admin.products.placeholders.description"),
3715
+ className: "min-h-32"
3770
3716
  }
3771
3717
  )
3772
3718
  ] })
3773
- ] }) })
3774
- ] });
3719
+ }
3720
+ );
3775
3721
  }
3776
- _chunk7QVYU63Ejs.__name.call(void 0, PricesList, "PricesList");
3777
-
3778
- // src/features/billing/stripe-product/components/containers/ProductsAdminContainer.tsx
3779
-
3780
-
3722
+ _chunk7QVYU63Ejs.__name.call(void 0, ProductEditorInternal, "ProductEditorInternal");
3723
+ function ProductEditor(props) {
3724
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductEditorInternal, { ...props });
3725
+ }
3726
+ _chunk7QVYU63Ejs.__name.call(void 0, ProductEditor, "ProductEditor");
3781
3727
 
3782
- // src/features/billing/stripe-product/components/lists/ProductsList.tsx
3728
+ // src/features/billing/contexts/ProductContext.tsx
3729
+
3730
+ var ProductContext = _react.createContext.call(void 0, void 0);
3731
+ var defaultContextValue2 = {
3732
+ product: void 0,
3733
+ setProduct: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
3734
+ }, "setProduct"),
3735
+ reloadProduct: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
3736
+ }, "reloadProduct"),
3737
+ createProduct: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
3738
+ throw new Error("createProduct requires a ProductProvider");
3739
+ }, "createProduct"),
3740
+ updateProduct: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
3741
+ throw new Error("updateProduct requires a ProductProvider");
3742
+ }, "updateProduct"),
3743
+ archiveProduct: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
3744
+ }, "archiveProduct"),
3745
+ restoreProduct: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
3746
+ }, "restoreProduct"),
3747
+ catalogueVersion: 0,
3748
+ refreshCatalogue: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
3749
+ }, "refreshCatalogue")
3750
+ };
3751
+ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ children, dehydratedProduct, publishChrome = true }) => {
3752
+ const t = _nextintl.useTranslations.call(void 0, );
3753
+ const generateUrl = _chunkUGNLKDI6js.usePageUrlGenerator.call(void 0, );
3754
+ const { hasRole } = _chunkUGNLKDI6js.useCurrentUserContext.call(void 0, );
3755
+ const [product, setProduct] = _react.useState.call(void 0,
3756
+ dehydratedProduct ? _chunk53B6NPGAjs.rehydrate.call(void 0, _chunk53B6NPGAjs.Modules.StripeProduct, dehydratedProduct) : void 0
3757
+ );
3758
+ const [catalogueVersion, setCatalogueVersion] = _react.useState.call(void 0, 0);
3759
+ const refreshCatalogue = _react.useCallback.call(void 0, () => setCatalogueVersion((value2) => value2 + 1), []);
3760
+ const reloadProduct = _react.useCallback.call(void 0, async () => {
3761
+ if (!_optionalChain([product, 'optionalAccess', _151 => _151.id])) return;
3762
+ setProduct(await _chunk53B6NPGAjs.StripeProductService.getProduct({ id: product.id }));
3763
+ }, [_optionalChain([product, 'optionalAccess', _152 => _152.id])]);
3764
+ const createProduct = _react.useCallback.call(void 0,
3765
+ async (input) => {
3766
+ const saved = await _chunk53B6NPGAjs.StripeProductService.createProduct(input);
3767
+ refreshCatalogue();
3768
+ return saved;
3769
+ },
3770
+ [refreshCatalogue]
3771
+ );
3772
+ const updateProduct = _react.useCallback.call(void 0,
3773
+ async (input) => {
3774
+ const saved = await _chunk53B6NPGAjs.StripeProductService.updateProduct(input);
3775
+ setProduct(saved);
3776
+ refreshCatalogue();
3777
+ return saved;
3778
+ },
3779
+ [refreshCatalogue]
3780
+ );
3781
+ const archiveProduct = _react.useCallback.call(void 0,
3782
+ async (id) => {
3783
+ const target = _nullishCoalesce(id, () => ( _optionalChain([product, 'optionalAccess', _153 => _153.id])));
3784
+ if (!target) return;
3785
+ await _chunk53B6NPGAjs.StripeProductService.archiveProduct({ id: target });
3786
+ await reloadProduct();
3787
+ refreshCatalogue();
3788
+ },
3789
+ [_optionalChain([product, 'optionalAccess', _154 => _154.id]), reloadProduct, refreshCatalogue]
3790
+ );
3791
+ const restoreProduct = _react.useCallback.call(void 0,
3792
+ async (id) => {
3793
+ const target = _nullishCoalesce(id, () => ( _optionalChain([product, 'optionalAccess', _155 => _155.id])));
3794
+ if (!target) return;
3795
+ await _chunk53B6NPGAjs.StripeProductService.reactivateProduct({ id: target });
3796
+ await reloadProduct();
3797
+ refreshCatalogue();
3798
+ },
3799
+ [_optionalChain([product, 'optionalAccess', _156 => _156.id]), reloadProduct, refreshCatalogue]
3800
+ );
3801
+ const value = _react.useMemo.call(void 0,
3802
+ () => ({
3803
+ product,
3804
+ setProduct,
3805
+ reloadProduct,
3806
+ createProduct,
3807
+ updateProduct,
3808
+ archiveProduct,
3809
+ restoreProduct,
3810
+ catalogueVersion,
3811
+ refreshCatalogue
3812
+ }),
3813
+ [
3814
+ product,
3815
+ reloadProduct,
3816
+ createProduct,
3817
+ updateProduct,
3818
+ archiveProduct,
3819
+ restoreProduct,
3820
+ catalogueVersion,
3821
+ refreshCatalogue
3822
+ ]
3823
+ );
3824
+ if (!publishChrome) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductContext.Provider, { value, children });
3825
+ const breadcrumb = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
3826
+ const items = [
3827
+ {
3828
+ name: t("billing.admin.products.title"),
3829
+ // Linked only when it is NOT the current page.
3830
+ ...product ? { href: generateUrl({ page: _chunk53B6NPGAjs.Modules.StripeProduct }) } : {}
3831
+ }
3832
+ ];
3833
+ if (product) items.push({ name: product.name });
3834
+ return items;
3835
+ }, "breadcrumb");
3836
+ const title = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
3837
+ const response = { type: t("billing.admin.products.title") };
3838
+ if (!product) return response;
3839
+ response.element = product.name;
3840
+ if (hasRole(_chunkJKGEJGSDjs.getRoleId.call(void 0, ).Administrator)) {
3841
+ response.functions = [
3842
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductArchiver, { product }, "productArchiver"),
3843
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductEditor, { product, propagateChanges: setProduct }, "productEditor")
3844
+ ];
3845
+ }
3846
+ return response;
3847
+ }, "title");
3848
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductContext.Provider, { value, children }) });
3849
+ }, "ProductProvider");
3850
+ var useProductContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => _nullishCoalesce(_react.useContext.call(void 0, ProductContext), () => ( defaultContextValue2)), "useProductContext");
3783
3851
 
3852
+ // src/features/billing/stripe-price/components/details/PriceDetails.tsx
3784
3853
 
3785
3854
 
3786
- function ProductsList({ products, onProductsChange }) {
3787
- const [expandedProductId, setExpandedProductId] = _react.useState.call(void 0, null);
3788
- const [editingProduct, setEditingProduct] = _react.useState.call(void 0, null);
3789
- const [archivingProductId, setArchivingProductId] = _react.useState.call(void 0, null);
3790
- const [reactivatingProductId, setReactivatingProductId] = _react.useState.call(void 0, null);
3791
- const [productToArchive, setProductToArchive] = _react.useState.call(void 0, null);
3792
- const [productToReactivate, setProductToReactivate] = _react.useState.call(void 0, null);
3793
- const handleArchive = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
3794
- if (!productToArchive) {
3795
- return;
3796
- }
3797
- setArchivingProductId(productToArchive.id);
3798
- try {
3799
- const _archivedProduct = await _chunkRTOC53EZjs.StripeProductService.archiveProduct({ id: productToArchive.id });
3800
- setProductToArchive(null);
3801
- onProductsChange();
3802
- } catch (_error) {
3803
- console.error("[ProductsList] Failed to archive product:", _error);
3804
- } finally {
3805
- setArchivingProductId(null);
3806
- }
3807
- }, "handleArchive");
3808
- const handleReactivate = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
3809
- if (!productToReactivate) {
3810
- return;
3811
- }
3812
- setReactivatingProductId(productToReactivate.id);
3813
- try {
3814
- const _reactivatedProduct = await _chunkRTOC53EZjs.StripeProductService.reactivateProduct({ id: productToReactivate.id });
3815
- setProductToReactivate(null);
3816
- onProductsChange();
3817
- } catch (_error) {
3818
- } finally {
3819
- setReactivatingProductId(null);
3820
- }
3821
- }, "handleReactivate");
3822
- const toggleExpand = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (productId) => {
3823
- setExpandedProductId(expandedProductId === productId ? null : productId);
3824
- }, "toggleExpand");
3825
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-4", children: [
3826
- products.map((product) => {
3827
- const isExpanded = expandedProductId === product.id;
3828
- const isArchiving = archivingProductId === product.id;
3829
- const isReactivating = reactivatingProductId === product.id;
3830
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "border rounded-lg bg-white shadow-sm hover:shadow-md transition-shadow", children: [
3831
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center justify-between p-6", children: [
3832
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-4 flex-1", children: [
3833
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Package, { className: "h-6 w-6 text-primary" }),
3834
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex-1", children: [
3835
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
3836
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium", children: product.name }),
3837
- product.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Badge, { variant: "softGreen", children: "Active" }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Badge, { variant: "softGray", children: "Inactive" })
3838
- ] }),
3839
- product.description && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-sm mt-1", children: product.description })
3855
+ function PriceDetails() {
3856
+ const t = _nextintl.useTranslations.call(void 0, );
3857
+ const generateUrl = _chunkUGNLKDI6js.usePageUrlGenerator.call(void 0, );
3858
+ const { price } = usePriceContext();
3859
+ if (!price) return null;
3860
+ const isRecurring = price.priceType === "recurring";
3861
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-8", children: [
3862
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
3863
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.SectionHeader, { children: t("billing.admin.prices.title") }),
3864
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
3865
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3866
+ _chunkUGNLKDI6js.DetailField,
3867
+ {
3868
+ label: t("billing.admin.prices.fields.product"),
3869
+ value: price.product ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Link, { href: generateUrl({ page: _chunk53B6NPGAjs.Modules.StripeProduct, id: price.product.id }), children: price.product.name }) : "\u2014"
3870
+ }
3871
+ ),
3872
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3873
+ _chunkUGNLKDI6js.DetailField,
3874
+ {
3875
+ label: t("billing.admin.prices.fields.status"),
3876
+ value: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex flex-wrap items-center gap-1", children: [
3877
+ price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Badge, { variant: "softGreen", children: t("billing.admin.prices.status.active") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Badge, { variant: "softGray", children: t("billing.admin.prices.status.archived") }),
3878
+ price.isTrial && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Badge, { variant: "softBlue", children: t("billing.admin.prices.badge.trial") })
3840
3879
  ] })
3841
- ] }),
3842
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
3843
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Button, { variant: "outline", size: "sm", onClick: () => setEditingProduct(product), children: [
3844
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Edit, { className: "h-4 w-4 mr-1" }),
3845
- "Edit"
3846
- ] }),
3847
- product.active ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
3848
- _chunk7HKJNUW7js.Button,
3849
- {
3850
- variant: "outline",
3851
- size: "sm",
3852
- onClick: () => setProductToArchive(product),
3853
- disabled: isArchiving,
3854
- children: [
3855
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Archive, { className: "h-4 w-4 mr-1" }),
3856
- isArchiving ? "Archiving..." : "Archive"
3857
- ]
3858
- }
3859
- ) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
3860
- _chunk7HKJNUW7js.Button,
3861
- {
3862
- variant: "outline",
3863
- size: "sm",
3864
- onClick: () => setProductToReactivate(product),
3865
- disabled: isReactivating,
3866
- children: [
3867
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RefreshCw, { className: "h-4 w-4 mr-1" }),
3868
- isReactivating ? "Reactivating..." : "Reactivate"
3869
- ]
3870
- }
3871
- ),
3872
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { variant: "ghost", size: "sm", onClick: () => toggleExpand(product.id), children: isExpanded ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ChevronUp, { className: "h-5 w-5" }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ChevronDown, { className: "h-5 w-5" }) })
3873
- ] })
3874
- ] }),
3875
- isExpanded && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border-t bg-muted/30 p-6", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PricesList, { productId: product.id, onPricesChange: onProductsChange }) })
3876
- ] }, product.id);
3877
- }),
3878
- editingProduct && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3879
- ProductEditor,
3880
- {
3881
- product: editingProduct,
3882
- open: !!editingProduct,
3883
- onOpenChange: (open) => !open && setEditingProduct(null),
3884
- onSuccess: () => {
3885
- onProductsChange();
3886
- setEditingProduct(null);
3887
- }
3888
- }
3889
- ),
3890
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.AlertDialog, { open: !!productToArchive, onOpenChange: (open) => !open && setProductToArchive(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.AlertDialogContent, { children: [
3891
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.AlertDialogHeader, { children: [
3892
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.AlertDialogTitle, { children: "Archive Product" }),
3893
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.AlertDialogDescription, { children: [
3894
- 'Are you sure you want to archive "',
3895
- _optionalChain([productToArchive, 'optionalAccess', _166 => _166.name]),
3896
- '"? This will deactivate it and it will no longer be available for new subscriptions.'
3897
- ] })
3898
- ] }),
3899
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.AlertDialogFooter, { children: [
3900
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.AlertDialogCancel, { disabled: !!archivingProductId, children: "Cancel" }),
3880
+ }
3881
+ ),
3882
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3883
+ _chunkUGNLKDI6js.DetailField,
3884
+ {
3885
+ label: t("billing.admin.prices.fields.amount"),
3886
+ value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _chunkUGNLKDI6js.formatCurrency.call(void 0, price.unitAmount, price.currency) })
3887
+ }
3888
+ ),
3889
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.DetailField, { label: t("billing.admin.prices.fields.currency"), value: price.currency.toUpperCase() }),
3901
3890
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3902
- _chunk7HKJNUW7js.AlertDialogAction,
3891
+ _chunkUGNLKDI6js.DetailField,
3892
+ {
3893
+ label: t("billing.admin.prices.fields.type"),
3894
+ value: isRecurring ? t("billing.admin.prices.type.recurring") : t("billing.admin.prices.type.oneTime")
3895
+ }
3896
+ ),
3897
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.DetailField, { label: t("billing.admin.prices.fields.billing"), value: _chunkUGNLKDI6js.formatInterval.call(void 0, price) }),
3898
+ isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3899
+ _chunkUGNLKDI6js.DetailField,
3903
3900
  {
3904
- onClick: handleArchive,
3905
- disabled: !!archivingProductId,
3906
- className: "bg-red-600 hover:bg-red-700",
3907
- children: archivingProductId ? "Archiving..." : "Archive"
3901
+ label: t("billing.admin.prices.fields.intervalCount"),
3902
+ value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _nullishCoalesce(_optionalChain([price, 'access', _157 => _157.recurring, 'optionalAccess', _158 => _158.intervalCount]), () => ( 1)) })
3903
+ }
3904
+ ),
3905
+ isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3906
+ _chunkUGNLKDI6js.DetailField,
3907
+ {
3908
+ label: t("billing.admin.prices.fields.usageType"),
3909
+ value: _optionalChain([price, 'access', _159 => _159.recurring, 'optionalAccess', _160 => _160.usageType]) === "metered" ? t("billing.admin.prices.usage.metered") : t("billing.admin.prices.usage.licensed")
3908
3910
  }
3909
3911
  )
3910
3912
  ] })
3911
- ] }) }),
3912
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.AlertDialog, { open: !!productToReactivate, onOpenChange: (open) => !open && setProductToReactivate(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.AlertDialogContent, { children: [
3913
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.AlertDialogHeader, { children: [
3914
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.AlertDialogTitle, { children: "Reactivate Product" }),
3915
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.AlertDialogDescription, { children: [
3916
- 'Are you sure you want to reactivate "',
3917
- _optionalChain([productToReactivate, 'optionalAccess', _167 => _167.name]),
3918
- '"? This will make it available for new subscriptions again.'
3919
- ] })
3920
- ] }),
3921
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.AlertDialogFooter, { children: [
3922
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.AlertDialogCancel, { disabled: !!reactivatingProductId, children: "Cancel" }),
3913
+ ] }),
3914
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
3915
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.SectionHeader, { children: t("billing.admin.prices.fields.platformFeatures") }),
3916
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
3923
3917
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3924
- _chunk7HKJNUW7js.AlertDialogAction,
3918
+ _chunkUGNLKDI6js.DetailField,
3925
3919
  {
3926
- onClick: handleReactivate,
3927
- disabled: !!reactivatingProductId,
3928
- className: "bg-green-600 hover:bg-green-700",
3929
- children: reactivatingProductId ? "Reactivating..." : "Reactivate"
3920
+ label: t("billing.admin.prices.fields.token"),
3921
+ value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _nullishCoalesce(price.token, () => ( "\u2014")) })
3922
+ }
3923
+ ),
3924
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3925
+ _chunkUGNLKDI6js.DetailField,
3926
+ {
3927
+ label: t("billing.admin.prices.fields.stripeId"),
3928
+ value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: price.stripePriceId })
3929
+ }
3930
+ ),
3931
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3932
+ _chunkUGNLKDI6js.DetailField,
3933
+ {
3934
+ label: t("billing.admin.prices.fields.description"),
3935
+ value: _nullishCoalesce(price.description, () => ( "\u2014")),
3936
+ className: "md:col-span-2"
3937
+ }
3938
+ ),
3939
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3940
+ _chunkUGNLKDI6js.DetailField,
3941
+ {
3942
+ label: t("billing.admin.prices.fields.features"),
3943
+ className: "md:col-span-2",
3944
+ value: price.features && price.features.length > 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "ul", { className: "flex flex-col gap-1 text-sm", children: price.features.map((feature) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "li", { children: feature }, feature)) }) : "\u2014"
3945
+ }
3946
+ ),
3947
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3948
+ _chunkUGNLKDI6js.DetailField,
3949
+ {
3950
+ label: t("billing.admin.prices.fields.platformFeatures"),
3951
+ className: "md:col-span-2",
3952
+ 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, _chunkUGNLKDI6js.Badge, { variant: "softGray", children: feature.name }, feature.id)) }) : "\u2014"
3930
3953
  }
3931
3954
  )
3932
3955
  ] })
3933
- ] }) })
3956
+ ] })
3934
3957
  ] });
3935
3958
  }
3936
- _chunk7QVYU63Ejs.__name.call(void 0, ProductsList, "ProductsList");
3959
+ _chunk7QVYU63Ejs.__name.call(void 0, PriceDetails, "PriceDetails");
3937
3960
 
3938
- // src/features/billing/stripe-product/components/containers/ProductsAdminContainer.tsx
3961
+ // src/features/billing/stripe-price/components/containers/PriceContainer.tsx
3939
3962
 
3940
- function ProductsAdminContainer() {
3941
- const { hasRole } = _chunk7HKJNUW7js.useCurrentUserContext.call(void 0, );
3942
- const billing = useOptionalBillingContext();
3943
- const [products, setProducts] = _react.useState.call(void 0, []);
3944
- const [loading, setLoading] = _react.useState.call(void 0, true);
3945
- const [showCreateProduct, setShowCreateProduct] = _react.useState.call(void 0, false);
3946
- if (!hasRole(_chunkOTEDZ6YWjs.getRoleId.call(void 0, ).Administrator)) {
3947
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex h-64 items-center justify-center", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: "Permission denied. Administrator access required." }) });
3948
- }
3949
- const loadProducts = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
3950
- setLoading(true);
3951
- try {
3952
- const fetchedProducts = await _chunkRTOC53EZjs.StripeProductService.listProducts();
3953
- setProducts(fetchedProducts);
3954
- } catch (error) {
3955
- console.error("[ProductsAdminContainer] Failed to load products:", error);
3956
- } finally {
3957
- setLoading(false);
3958
- }
3959
- }, "loadProducts");
3963
+ function PriceContainer() {
3964
+ const { price } = usePriceContext();
3965
+ if (!price) return null;
3966
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.RoundPageContainer, { module: _chunk53B6NPGAjs.Modules.StripePrice, id: price.id, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceDetails, {}) });
3967
+ }
3968
+ _chunk7QVYU63Ejs.__name.call(void 0, PriceContainer, "PriceContainer");
3969
+
3970
+ // src/features/billing/stripe-price/components/lists/PricesList.tsx
3971
+
3972
+
3973
+
3974
+
3975
+ function PricesList({ productId, fullWidth }) {
3976
+ const t = _nextintl.useTranslations.call(void 0, );
3977
+ const { priceVersion } = usePriceContext();
3978
+ const data = _chunkUGNLKDI6js.useDataListRetriever.call(void 0, {
3979
+ retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunk53B6NPGAjs.StripePriceService.listPrices({ ...params, productId }), "retriever"),
3980
+ retrieverParams: {},
3981
+ module: _chunk53B6NPGAjs.Modules.StripePrice
3982
+ });
3960
3983
  _react.useEffect.call(void 0, () => {
3961
- loadProducts();
3962
- }, [_optionalChain([billing, 'optionalAccess', _168 => _168.refreshToken])]);
3963
- if (loading) {
3964
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex h-64 items-center justify-center", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground", children: "Loading products..." }) });
3965
- }
3966
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col", children: [
3967
- !billing && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex w-full items-center justify-end px-4 pt-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { onClick: () => setShowCreateProduct(true), children: "Create Product" }) }),
3968
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-6 px-4 pb-4", children: [
3969
- products.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-muted/50 flex flex-col items-center justify-center gap-y-4 rounded-lg border-2 border-dashed p-12", children: [
3970
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Package, { className: "text-muted-foreground h-16 w-16" }),
3971
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
3972
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "mb-2 text-sm font-medium", children: "No products yet" }),
3973
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground mb-4", children: "Create your first product to start offering subscriptions to your customers." }),
3974
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { onClick: () => setShowCreateProduct(true), children: "Create Your First Product" })
3975
- ] })
3976
- ] }),
3977
- products.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductsList, { products, onProductsChange: loadProducts }),
3978
- showCreateProduct && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductEditor, { open: showCreateProduct, onOpenChange: setShowCreateProduct, onSuccess: loadProducts })
3984
+ if (priceVersion > 0) void data.refresh();
3985
+ }, [priceVersion]);
3986
+ const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceEditor, { productId }, "create-price")];
3987
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3988
+ _chunkUGNLKDI6js.ContentListTable,
3989
+ {
3990
+ data,
3991
+ fields: [
3992
+ "nickname" /* nickname */,
3993
+ "amount" /* amount */,
3994
+ "interval" /* interval */,
3995
+ "token" /* token */,
3996
+ "status" /* status */
3997
+ ],
3998
+ tableGeneratorType: _chunk53B6NPGAjs.Modules.StripePrice,
3999
+ functions,
4000
+ fullWidth,
4001
+ title: t("billing.admin.prices.title"),
4002
+ emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4003
+ _chunkUGNLKDI6js.EmptyState,
4004
+ {
4005
+ icon: _lucidereact.DollarSignIcon,
4006
+ title: t("billing.admin.prices.empty.title"),
4007
+ description: t("billing.admin.prices.empty.description")
4008
+ }
4009
+ )
4010
+ }
4011
+ );
4012
+ }
4013
+ _chunk7QVYU63Ejs.__name.call(void 0, PricesList, "PricesList");
4014
+
4015
+ // src/features/billing/stripe-product/components/containers/ProductContainer.tsx
4016
+
4017
+
4018
+ // src/features/billing/stripe-product/components/details/ProductDetails.tsx
4019
+
4020
+
4021
+ function ProductDetails() {
4022
+ const t = _nextintl.useTranslations.call(void 0, );
4023
+ const { product } = useProductContext();
4024
+ if (!product) return null;
4025
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
4026
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.SectionHeader, { children: t("billing.admin.products.tabs.details") }),
4027
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
4028
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.DetailField, { label: t("billing.admin.products.fields.name"), value: product.name }),
4029
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4030
+ _chunkUGNLKDI6js.DetailField,
4031
+ {
4032
+ label: t("billing.admin.products.fields.status"),
4033
+ value: product.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Badge, { variant: "softGreen", children: t("billing.admin.products.status.active") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.Badge, { variant: "softGray", children: t("billing.admin.products.status.archived") })
4034
+ }
4035
+ ),
4036
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4037
+ _chunkUGNLKDI6js.DetailField,
4038
+ {
4039
+ label: t("billing.admin.products.fields.description"),
4040
+ value: _nullishCoalesce(product.description, () => ( "\u2014")),
4041
+ className: "md:col-span-2"
4042
+ }
4043
+ ),
4044
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4045
+ _chunkUGNLKDI6js.DetailField,
4046
+ {
4047
+ label: t("billing.admin.products.fields.prices"),
4048
+ value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: product.stripePrices.length })
4049
+ }
4050
+ ),
4051
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4052
+ _chunkUGNLKDI6js.DetailField,
4053
+ {
4054
+ label: t("billing.admin.products.fields.stripeId"),
4055
+ value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: product.stripeProductId })
4056
+ }
4057
+ )
3979
4058
  ] })
3980
4059
  ] });
3981
4060
  }
3982
- _chunk7QVYU63Ejs.__name.call(void 0, ProductsAdminContainer, "ProductsAdminContainer");
4061
+ _chunk7QVYU63Ejs.__name.call(void 0, ProductDetails, "ProductDetails");
3983
4062
 
3984
- // src/features/billing/stripe-product/components/containers/ProductsAdminPageContainer.tsx
4063
+ // src/features/billing/stripe-product/components/containers/ProductContainer.tsx
3985
4064
 
3986
- function ProductsAdminPageContainer() {
3987
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BillingProvider, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.RoundPageContainer, { module: _chunkRTOC53EZjs.Modules.StripeProduct, fullWidth: true, forceHeader: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductsAdminContainer, {}) }) });
4065
+ function ProductContainer() {
4066
+ const t = _nextintl.useTranslations.call(void 0, );
4067
+ const { product } = useProductContext();
4068
+ if (!product) return null;
4069
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4070
+ _chunkUGNLKDI6js.RoundPageContainer,
4071
+ {
4072
+ module: _chunk53B6NPGAjs.Modules.StripeProduct,
4073
+ id: product.id,
4074
+ tabs: [
4075
+ {
4076
+ sectionKey: "details",
4077
+ label: t("billing.admin.products.tabs.details"),
4078
+ content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductDetails, {})
4079
+ },
4080
+ {
4081
+ key: _chunk53B6NPGAjs.Modules.StripePrice,
4082
+ label: t("billing.admin.prices.title"),
4083
+ // publishChrome={false}: SharedProvider REPLACES its value for the
4084
+ // subtree (SharedContext.tsx:35-37), so a nested provider publishing
4085
+ // chrome here would blank this page's own title.
4086
+ // No `fillHeight` and no `fullWidth` on the list: a ContentListTable in
4087
+ // a tab keeps its own bordered card and flows with the panel, exactly
4088
+ // as ThreatList does inside GoalContainer.
4089
+ content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceProvider, { productId: product.id, publishChrome: false, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PricesList, { productId: product.id }) })
4090
+ }
4091
+ ]
4092
+ }
4093
+ );
3988
4094
  }
3989
- _chunk7QVYU63Ejs.__name.call(void 0, ProductsAdminPageContainer, "ProductsAdminPageContainer");
4095
+ _chunk7QVYU63Ejs.__name.call(void 0, ProductContainer, "ProductContainer");
4096
+
4097
+ // src/features/billing/stripe-product/components/lists/ProductsList.tsx
4098
+
4099
+
4100
+
4101
+
4102
+ function ProductsList({ fullWidth } = {}) {
4103
+ const t = _nextintl.useTranslations.call(void 0, );
4104
+ const { catalogueVersion } = useProductContext();
4105
+ const data = _chunkUGNLKDI6js.useDataListRetriever.call(void 0, {
4106
+ retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunk53B6NPGAjs.StripeProductService.listProducts(params), "retriever"),
4107
+ retrieverParams: {},
4108
+ module: _chunk53B6NPGAjs.Modules.StripeProduct
4109
+ });
4110
+ _react.useEffect.call(void 0, () => {
4111
+ if (catalogueVersion > 0) void data.refresh();
4112
+ }, [catalogueVersion]);
4113
+ const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductEditor, {}, "create-product")];
4114
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4115
+ _chunkUGNLKDI6js.ContentListTable,
4116
+ {
4117
+ data,
4118
+ fields: ["name" /* name */, "status" /* status */, "prices" /* prices */],
4119
+ tableGeneratorType: _chunk53B6NPGAjs.Modules.StripeProduct,
4120
+ functions,
4121
+ fullWidth,
4122
+ title: t("billing.admin.products.title"),
4123
+ emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4124
+ _chunkUGNLKDI6js.EmptyState,
4125
+ {
4126
+ icon: _lucidereact.PackageIcon,
4127
+ title: t("billing.admin.products.empty.title"),
4128
+ description: t("billing.admin.products.empty.description")
4129
+ }
4130
+ )
4131
+ }
4132
+ );
4133
+ }
4134
+ _chunk7QVYU63Ejs.__name.call(void 0, ProductsList, "ProductsList");
4135
+
4136
+ // src/features/billing/stripe-product/components/containers/ProductsListContainer.tsx
4137
+
4138
+ function ProductsListContainer() {
4139
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductProvider, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGNLKDI6js.RoundPageContainer, { module: _chunk53B6NPGAjs.Modules.StripeProduct, fullWidth: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductsList, { fullWidth: true }) }) });
4140
+ }
4141
+ _chunk7QVYU63Ejs.__name.call(void 0, ProductsListContainer, "ProductsListContainer");
4142
+
4143
+
4144
+
4145
+
4146
+
4147
+
4148
+
3990
4149
 
3991
4150
 
3992
4151
 
@@ -4035,5 +4194,5 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductsAdminPageContainer, "ProductsAdminP
4035
4194
 
4036
4195
 
4037
4196
 
4038
- exports.BillingAlertBanner = BillingAlertBanner; exports.BillingDashboardContainer = BillingDashboardContainer; exports.BillingDetailModal = BillingDetailModal; exports.BillingProvider = BillingProvider; 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.PriceEditor = PriceEditor; exports.PricesList = PricesList; exports.PricingCard = PricingCard; exports.ProductEditor = ProductEditor; exports.ProductPricingList = ProductPricingList; exports.ProductPricingRow = ProductPricingRow; exports.ProductsAdminContainer = ProductsAdminContainer; exports.ProductsAdminPageContainer = ProductsAdminPageContainer; exports.ProductsList = ProductsList; exports.PromoCodeInput = PromoCodeInput; exports.ProrationPreview = ProrationPreview; exports.StripeProvider = StripeProvider; exports.SubscriptionConfirmation = SubscriptionConfirmation; exports.SubscriptionDetails = SubscriptionDetails; exports.SubscriptionStatusBadge = SubscriptionStatusBadge; exports.SubscriptionSummaryCard = SubscriptionSummaryCard; exports.SubscriptionsContainer = SubscriptionsContainer; exports.SubscriptionsList = SubscriptionsList; exports.UsageContainer = UsageContainer; exports.UsageHistoryTable = UsageHistoryTable; exports.UsageSummaryCard = UsageSummaryCard; exports.UsageSummaryCards = UsageSummaryCards; exports.formatCurrency = formatCurrency; exports.formatDate = formatDate3; exports.formatInterval = formatInterval; exports.isStripeConfigured = isStripeConfigured; exports.useBillingContext = useBillingContext; exports.useOptionalBillingContext = useOptionalBillingContext;
4197
+ 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.SubscriptionsContainer = SubscriptionsContainer; exports.SubscriptionsList = SubscriptionsList; exports.UsageContainer = UsageContainer; exports.UsageHistoryTable = UsageHistoryTable; exports.UsageSummaryCard = UsageSummaryCard; exports.UsageSummaryCards = UsageSummaryCards; exports.formatCurrency = _chunkUGNLKDI6js.formatCurrency; exports.formatDate = formatDate3; exports.formatInterval = _chunkUGNLKDI6js.formatInterval; exports.isStripeConfigured = isStripeConfigured; exports.priceLabel = priceLabel; exports.usePriceContext = usePriceContext; exports.useProductContext = useProductContext;
4039
4198
  //# sourceMappingURL=index.js.map