@carlonicora/nextjs-jsonapi 1.37.0 → 1.38.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/dist/{BlockNoteEditor-GTWR6CPI.mjs → BlockNoteEditor-5CEV5TZT.mjs} +3 -3
  2. package/dist/{BlockNoteEditor-74FHJO7E.js → BlockNoteEditor-VB72JQEO.js} +13 -13
  3. package/dist/{BlockNoteEditor-74FHJO7E.js.map → BlockNoteEditor-VB72JQEO.js.map} +1 -1
  4. package/dist/billing/index.d.mts +12 -2
  5. package/dist/billing/index.d.ts +12 -2
  6. package/dist/billing/index.js +680 -452
  7. package/dist/billing/index.js.map +1 -1
  8. package/dist/billing/index.mjs +588 -360
  9. package/dist/billing/index.mjs.map +1 -1
  10. package/dist/{chunk-53IPQJVH.js → chunk-3EZX4G2E.js} +147 -23
  11. package/dist/chunk-3EZX4G2E.js.map +1 -0
  12. package/dist/{chunk-YVEK3SUS.js → chunk-BYMBRMKS.js} +454 -446
  13. package/dist/chunk-BYMBRMKS.js.map +1 -0
  14. package/dist/{chunk-P7R2DPD6.mjs → chunk-TQ5GRRTM.mjs} +125 -1
  15. package/dist/chunk-TQ5GRRTM.mjs.map +1 -0
  16. package/dist/{chunk-ZUUH4CQC.mjs → chunk-VMK2N3TQ.mjs} +13 -5
  17. package/dist/{chunk-ZUUH4CQC.mjs.map → chunk-VMK2N3TQ.mjs.map} +1 -1
  18. package/dist/client/index.js +3 -3
  19. package/dist/client/index.mjs +2 -2
  20. package/dist/components/index.js +3 -3
  21. package/dist/components/index.mjs +2 -2
  22. package/dist/contexts/index.js +3 -3
  23. package/dist/contexts/index.mjs +2 -2
  24. package/dist/core/index.d.mts +47 -3
  25. package/dist/core/index.d.ts +47 -3
  26. package/dist/core/index.js +8 -2
  27. package/dist/core/index.js.map +1 -1
  28. package/dist/core/index.mjs +7 -1
  29. package/dist/index.d.mts +2 -2
  30. package/dist/index.d.ts +2 -2
  31. package/dist/index.js +8 -2
  32. package/dist/index.js.map +1 -1
  33. package/dist/index.mjs +7 -1
  34. package/dist/server/index.js +3 -3
  35. package/dist/server/index.mjs +1 -1
  36. package/dist/{stripe-subscription.interface-DK7BJaNd.d.ts → stripe-promotion-code.interface-BcJty0rv.d.ts} +18 -1
  37. package/dist/{stripe-subscription.interface-C8uhCYIZ.d.mts → stripe-promotion-code.interface-Dnm2DJKQ.d.mts} +18 -1
  38. package/package.json +1 -1
  39. package/src/billing/index.ts +1 -0
  40. package/src/core/index.ts +1 -0
  41. package/src/core/registry/ModuleRegistry.ts +1 -0
  42. package/src/features/auth/components/forms/Login.tsx +14 -2
  43. package/src/features/billing/components/cards/SubscriptionSummaryCard.tsx +5 -16
  44. package/src/features/billing/stripe-invoice/data/stripe-invoice.interface.ts +1 -0
  45. package/src/features/billing/stripe-promotion-code/components/PromoCodeInput.tsx +108 -0
  46. package/src/features/billing/stripe-promotion-code/components/index.ts +1 -0
  47. package/src/features/billing/stripe-promotion-code/data/index.ts +3 -0
  48. package/src/features/billing/stripe-promotion-code/data/stripe-promotion-code.interface.ts +14 -0
  49. package/src/features/billing/stripe-promotion-code/data/stripe-promotion-code.service.ts +64 -0
  50. package/src/features/billing/stripe-promotion-code/data/stripe-promotion-code.ts +66 -0
  51. package/src/features/billing/stripe-promotion-code/index.ts +2 -0
  52. package/src/features/billing/stripe-promotion-code/stripe-promotion-code.module.ts +9 -0
  53. package/src/features/billing/stripe-subscription/components/lists/SubscriptionsList.tsx +20 -3
  54. package/src/features/billing/stripe-subscription/components/wizards/SubscriptionWizard.tsx +6 -0
  55. package/src/features/billing/stripe-subscription/components/wizards/WizardStepReview.tsx +131 -9
  56. package/src/features/billing/stripe-subscription/data/stripe-subscription.interface.ts +2 -0
  57. package/src/features/billing/stripe-subscription/data/stripe-subscription.ts +8 -0
  58. package/src/features/billing/stripe-subscription/hooks/useSubscriptionWizard.ts +93 -7
  59. package/src/features/index.ts +1 -0
  60. package/dist/chunk-53IPQJVH.js.map +0 -1
  61. package/dist/chunk-P7R2DPD6.mjs.map +0 -1
  62. package/dist/chunk-YVEK3SUS.js.map +0 -1
  63. /package/dist/{BlockNoteEditor-GTWR6CPI.mjs.map → BlockNoteEditor-5CEV5TZT.mjs.map} +0 -0
@@ -47,7 +47,7 @@
47
47
 
48
48
 
49
49
 
50
- var _chunkYVEK3SUSjs = require('../chunk-YVEK3SUS.js');
50
+ var _chunkBYMBRMKSjs = require('../chunk-BYMBRMKS.js');
51
51
 
52
52
 
53
53
 
@@ -61,7 +61,8 @@ var _chunk2PHWAL6Qjs = require('../chunk-2PHWAL6Q.js');
61
61
 
62
62
 
63
63
 
64
- var _chunk53IPQJVHjs = require('../chunk-53IPQJVH.js');
64
+
65
+ var _chunk3EZX4G2Ejs = require('../chunk-3EZX4G2E.js');
65
66
  require('../chunk-LXKSUWAV.js');
66
67
  require('../chunk-IBS6NI7D.js');
67
68
  require('../chunk-FM6WRAN5.js');
@@ -96,18 +97,9 @@ function formatDate(date) {
96
97
  });
97
98
  }
98
99
  _chunk7QVYU63Ejs.__name.call(void 0, formatDate, "formatDate");
99
- function formatPrice(amount, currency) {
100
- if (amount === void 0) return "N/A";
101
- const currencyCode = _optionalChain([currency, 'optionalAccess', _3 => _3.toUpperCase, 'call', _4 => _4()]) || "USD";
102
- return new Intl.NumberFormat(void 0, {
103
- style: "currency",
104
- currency: currencyCode
105
- }).format(amount / 100);
106
- }
107
- _chunk7QVYU63Ejs.__name.call(void 0, formatPrice, "formatPrice");
108
100
  function formatPlanName(subscription) {
109
- const productName = _optionalChain([subscription, 'access', _5 => _5.price, 'optionalAccess', _6 => _6.product, 'optionalAccess', _7 => _7.name]) || "";
110
- const nickname = _optionalChain([subscription, 'access', _8 => _8.price, 'optionalAccess', _9 => _9.nickname]) || "";
101
+ const productName = _optionalChain([subscription, 'access', _3 => _3.price, 'optionalAccess', _4 => _4.product, 'optionalAccess', _5 => _5.name]) || "";
102
+ const nickname = _optionalChain([subscription, 'access', _6 => _6.price, 'optionalAccess', _7 => _7.nickname]) || "";
111
103
  if (productName && nickname) {
112
104
  return `${productName} - ${nickname}`;
113
105
  }
@@ -121,41 +113,41 @@ function SubscriptionSummaryCard({
121
113
  onManageClick
122
114
  }) {
123
115
  if (loading) {
124
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.Card, { children: [
125
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
126
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.CardTitle, { className: "text-sm font-medium", children: "Subscriptions" }),
116
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.Card, { children: [
117
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
118
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.CardTitle, { className: "text-sm font-medium", children: "Subscriptions" }),
127
119
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
128
120
  ] }),
129
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.CardContent, { children: [
130
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Skeleton, { className: "h-6 w-32 mb-2" }),
131
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Skeleton, { className: "h-4 w-24 mb-1" }),
132
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Skeleton, { className: "h-4 w-40" })
121
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.CardContent, { children: [
122
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Skeleton, { className: "h-6 w-32 mb-2" }),
123
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Skeleton, { className: "h-4 w-24 mb-1" }),
124
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Skeleton, { className: "h-4 w-40" })
133
125
  ] })
134
126
  ] });
135
127
  }
136
128
  if (error) {
137
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.Card, { children: [
138
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
139
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.CardTitle, { className: "text-sm font-medium", children: "Subscriptions" }),
129
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.Card, { children: [
130
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
131
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.CardTitle, { className: "text-sm font-medium", children: "Subscriptions" }),
140
132
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
141
133
  ] }),
142
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-destructive", children: error }) })
134
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-destructive", children: error }) })
143
135
  ] });
144
136
  }
145
137
  const activeSubscriptions = subscriptions.filter(
146
138
  (sub) => sub.status === "active" /* ACTIVE */ || sub.status === "trialing" /* TRIALING */
147
139
  );
148
140
  const primarySubscription = activeSubscriptions[0];
149
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
150
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
151
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.CardTitle, { className: "text-sm font-medium", children: "Subscriptions" }),
141
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
142
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
143
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.CardTitle, { className: "text-sm font-medium", children: "Subscriptions" }),
152
144
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
153
145
  ] }),
154
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.CardContent, { children: subscriptions.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
146
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.CardContent, { children: subscriptions.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
155
147
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No active plan" }),
156
148
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Subscribe to get started" }),
157
149
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
158
- _chunkYVEK3SUSjs.Button,
150
+ _chunkBYMBRMKSjs.Button,
159
151
  {
160
152
  variant: "outline",
161
153
  size: "sm",
@@ -174,21 +166,14 @@ function SubscriptionSummaryCard({
174
166
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
175
167
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: formatPlanName(primarySubscription) }),
176
168
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
177
- _chunkYVEK3SUSjs.Badge,
169
+ _chunkBYMBRMKSjs.Badge,
178
170
  {
179
171
  variant: primarySubscription.cancelAtPeriodEnd ? "secondary" : getStatusBadgeVariant(primarySubscription.status),
180
172
  children: primarySubscription.cancelAtPeriodEnd ? "Canceling" : primarySubscription.status
181
173
  }
182
174
  )
183
175
  ] }),
184
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm text-muted-foreground", children: [
185
- formatPrice(_optionalChain([primarySubscription, 'access', _10 => _10.price, 'optionalAccess', _11 => _11.unitAmount]), _optionalChain([primarySubscription, 'access', _12 => _12.price, 'optionalAccess', _13 => _13.currency])),
186
- _optionalChain([primarySubscription, 'access', _14 => _14.price, 'optionalAccess', _15 => _15.recurring]) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { children: [
187
- "/",
188
- primarySubscription.price.recurring.interval
189
- ] })
190
- ] }),
191
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: primarySubscription.cancelAtPeriodEnd ? `Cancels on ${formatDate(primarySubscription.currentPeriodEnd)}` : `Renews on ${formatDate(primarySubscription.currentPeriodEnd)}` }),
176
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: !_optionalChain([primarySubscription, 'access', _8 => _8.price, 'optionalAccess', _9 => _9.isTrial]) ? `Ends on ${formatDate(primarySubscription.currentPeriodEnd)}` : primarySubscription.cancelAtPeriodEnd ? `Cancels on ${formatDate(primarySubscription.currentPeriodEnd)}` : `Renews on ${formatDate(primarySubscription.currentPeriodEnd)}` }),
192
177
  activeSubscriptions.length > 1 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-xs text-muted-foreground", children: [
193
178
  "+",
194
179
  activeSubscriptions.length - 1,
@@ -223,37 +208,37 @@ function PaymentMethodSummaryCard({
223
208
  onManageClick
224
209
  }) {
225
210
  if (loading) {
226
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.Card, { children: [
227
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
228
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.CardTitle, { className: "text-sm font-medium", children: "Payment Method" }),
211
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.Card, { children: [
212
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
213
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.CardTitle, { className: "text-sm font-medium", children: "Payment Method" }),
229
214
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
230
215
  ] }),
231
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.CardContent, { children: [
232
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Skeleton, { className: "h-6 w-32 mb-2" }),
233
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Skeleton, { className: "h-4 w-24" })
216
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.CardContent, { children: [
217
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Skeleton, { className: "h-6 w-32 mb-2" }),
218
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Skeleton, { className: "h-4 w-24" })
234
219
  ] })
235
220
  ] });
236
221
  }
237
222
  if (error) {
238
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.Card, { children: [
239
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
240
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.CardTitle, { className: "text-sm font-medium", children: "Payment Method" }),
223
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.Card, { children: [
224
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
225
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.CardTitle, { className: "text-sm font-medium", children: "Payment Method" }),
241
226
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
242
227
  ] }),
243
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-destructive", children: error }) })
228
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-destructive", children: error }) })
244
229
  ] });
245
230
  }
246
231
  const defaultMethod = paymentMethods.find((pm) => pm.id === defaultPaymentMethodId) || paymentMethods[0];
247
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
248
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
249
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.CardTitle, { className: "text-sm font-medium", children: "Payment Method" }),
232
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
233
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
234
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.CardTitle, { className: "text-sm font-medium", children: "Payment Method" }),
250
235
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
251
236
  ] }),
252
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.CardContent, { children: paymentMethods.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
237
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.CardContent, { children: paymentMethods.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
253
238
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No payment method" }),
254
239
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Add a card to enable subscriptions" }),
255
240
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
256
- _chunkYVEK3SUSjs.Button,
241
+ _chunkBYMBRMKSjs.Button,
257
242
  {
258
243
  variant: "outline",
259
244
  size: "sm",
@@ -268,7 +253,7 @@ function PaymentMethodSummaryCard({
268
253
  ]
269
254
  }
270
255
  )
271
- ] }) : _optionalChain([defaultMethod, 'optionalAccess', _16 => _16.card]) ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
256
+ ] }) : _optionalChain([defaultMethod, 'optionalAccess', _10 => _10.card]) ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
272
257
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-xl font-bold", children: [
273
258
  getCardBrandIcon(defaultMethod.card.brand),
274
259
  " ****",
@@ -286,7 +271,7 @@ function PaymentMethodSummaryCard({
286
271
  " more card(s)"
287
272
  ] })
288
273
  ] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
289
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: _optionalChain([defaultMethod, 'optionalAccess', _17 => _17.type]) || "Payment Method" }),
274
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: _optionalChain([defaultMethod, 'optionalAccess', _11 => _11.type]) || "Payment Method" }),
290
275
  paymentMethods.length > 1 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-xs text-muted-foreground", children: [
291
276
  "+",
292
277
  paymentMethods.length - 1,
@@ -303,7 +288,7 @@ var _react = require('react');
303
288
 
304
289
  function formatBalance(balance, currency) {
305
290
  if (balance === void 0 || balance === 0) return "$0.00";
306
- const currencyCode = _optionalChain([currency, 'optionalAccess', _18 => _18.toUpperCase, 'call', _19 => _19()]) || "USD";
291
+ const currencyCode = _optionalChain([currency, 'optionalAccess', _12 => _12.toUpperCase, 'call', _13 => _13()]) || "USD";
307
292
  const displayBalance = -balance;
308
293
  return new Intl.NumberFormat(void 0, {
309
294
  style: "currency",
@@ -317,7 +302,7 @@ function CustomerInfoCard({ customer, loading, error }) {
317
302
  e.stopPropagation();
318
303
  setPortalLoading(true);
319
304
  try {
320
- const { url } = await _chunk53IPQJVHjs.StripeCustomerService.createPortalSession();
305
+ const { url } = await _chunk3EZX4G2Ejs.StripeCustomerService.createPortalSession();
321
306
  window.open(url, "_blank");
322
307
  } catch (err) {
323
308
  console.error("[CustomerInfoCard] Failed to create portal session:", err);
@@ -326,52 +311,52 @@ function CustomerInfoCard({ customer, loading, error }) {
326
311
  }
327
312
  }, "handlePortalClick");
328
313
  if (loading) {
329
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.Card, { children: [
330
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
331
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.CardTitle, { className: "text-sm font-medium", children: "Billing Account" }),
314
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.Card, { children: [
315
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
316
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.CardTitle, { className: "text-sm font-medium", children: "Billing Account" }),
332
317
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
333
318
  ] }),
334
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.CardContent, { children: [
335
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Skeleton, { className: "h-6 w-32 mb-2" }),
336
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Skeleton, { className: "h-4 w-48 mb-1" }),
337
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Skeleton, { className: "h-4 w-24" })
319
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.CardContent, { children: [
320
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Skeleton, { className: "h-6 w-32 mb-2" }),
321
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Skeleton, { className: "h-4 w-48 mb-1" }),
322
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Skeleton, { className: "h-4 w-24" })
338
323
  ] })
339
324
  ] });
340
325
  }
341
326
  if (error) {
342
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.Card, { children: [
343
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
344
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.CardTitle, { className: "text-sm font-medium", children: "Billing Account" }),
327
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.Card, { children: [
328
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
329
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.CardTitle, { className: "text-sm font-medium", children: "Billing Account" }),
345
330
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
346
331
  ] }),
347
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-destructive", children: error }) })
332
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-destructive", children: error }) })
348
333
  ] });
349
334
  }
350
335
  if (!customer) {
351
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.Card, { children: [
352
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
353
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.CardTitle, { className: "text-sm font-medium", children: "Billing Account" }),
336
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.Card, { children: [
337
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
338
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.CardTitle, { className: "text-sm font-medium", children: "Billing Account" }),
354
339
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
355
340
  ] }),
356
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.CardContent, { children: [
341
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.CardContent, { children: [
357
342
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "Not set up" }),
358
343
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Billing account will be created when you subscribe" })
359
344
  ] })
360
345
  ] });
361
346
  }
362
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.Card, { children: [
363
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
364
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.CardTitle, { className: "text-sm font-medium", children: "Billing Account" }),
347
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.Card, { children: [
348
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
349
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.CardTitle, { className: "text-sm font-medium", children: "Billing Account" }),
365
350
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
366
351
  ] }),
367
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
352
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
368
353
  customer.name && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: customer.name }),
369
354
  customer.email && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: customer.email }),
370
355
  customer.balance !== void 0 && customer.balance !== 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm", children: [
371
356
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground", children: "Credit Balance: " }),
372
357
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: customer.balance < 0 ? "text-green-600" : "text-destructive", children: formatBalance(customer.balance, customer.currency) })
373
358
  ] }),
374
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.Button, { variant: "outline", size: "sm", className: "mt-2", onClick: handlePortalClick, disabled: portalLoading, children: [
359
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.Button, { variant: "outline", size: "sm", className: "mt-2", onClick: handlePortalClick, disabled: portalLoading, children: [
375
360
  portalLoading ? "Loading..." : "Manage in Stripe Portal",
376
361
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ExternalLink, { className: "h-4 w-4 ml-1" })
377
362
  ] })
@@ -406,7 +391,7 @@ function formatDate2(date) {
406
391
  }
407
392
  _chunk7QVYU63Ejs.__name.call(void 0, formatDate2, "formatDate");
408
393
  function formatAmount(amount, currency) {
409
- const currencyCode = _optionalChain([currency, 'optionalAccess', _20 => _20.toUpperCase, 'call', _21 => _21()]) || "USD";
394
+ const currencyCode = _optionalChain([currency, 'optionalAccess', _14 => _14.toUpperCase, 'call', _15 => _15()]) || "USD";
410
395
  return new Intl.NumberFormat(void 0, {
411
396
  style: "currency",
412
397
  currency: currencyCode
@@ -415,42 +400,42 @@ function formatAmount(amount, currency) {
415
400
  _chunk7QVYU63Ejs.__name.call(void 0, formatAmount, "formatAmount");
416
401
  function InvoicesSummaryCard({ invoices, loading, error, onViewAllClick }) {
417
402
  if (loading) {
418
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.Card, { children: [
419
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
420
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.CardTitle, { className: "text-sm font-medium", children: "Recent Invoices" }),
403
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.Card, { children: [
404
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
405
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.CardTitle, { className: "text-sm font-medium", children: "Recent Invoices" }),
421
406
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
422
407
  ] }),
423
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.CardContent, { children: [
424
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Skeleton, { className: "h-6 w-24 mb-2" }),
425
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Skeleton, { className: "h-4 w-32 mb-1" }),
426
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Skeleton, { className: "h-4 w-20" })
408
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.CardContent, { children: [
409
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Skeleton, { className: "h-6 w-24 mb-2" }),
410
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Skeleton, { className: "h-4 w-32 mb-1" }),
411
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Skeleton, { className: "h-4 w-20" })
427
412
  ] })
428
413
  ] });
429
414
  }
430
415
  if (error) {
431
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.Card, { children: [
432
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
433
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.CardTitle, { className: "text-sm font-medium", children: "Recent Invoices" }),
416
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.Card, { children: [
417
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
418
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.CardTitle, { className: "text-sm font-medium", children: "Recent Invoices" }),
434
419
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
435
420
  ] }),
436
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-destructive", children: error }) })
421
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-destructive", children: error }) })
437
422
  ] });
438
423
  }
439
424
  const latestInvoice = invoices[0];
440
425
  const paidInvoices = invoices.filter((inv) => inv.status === "paid" /* PAID */);
441
426
  const openInvoices = invoices.filter((inv) => inv.status === "open" /* OPEN */);
442
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewAllClick, children: [
443
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
444
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.CardTitle, { className: "text-sm font-medium", children: "Recent Invoices" }),
427
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewAllClick, children: [
428
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
429
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.CardTitle, { className: "text-sm font-medium", children: "Recent Invoices" }),
445
430
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
446
431
  ] }),
447
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.CardContent, { children: invoices.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
432
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.CardContent, { children: invoices.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
448
433
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No invoices yet" }),
449
434
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Invoices will appear after your first billing cycle" })
450
435
  ] }) : latestInvoice ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
451
436
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
452
437
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: formatAmount(latestInvoice.total, latestInvoice.currency) }),
453
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Badge, { variant: getStatusBadgeVariant2(latestInvoice.status), children: latestInvoice.status })
438
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Badge, { variant: getStatusBadgeVariant2(latestInvoice.status), children: latestInvoice.status })
454
439
  ] }),
455
440
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: latestInvoice.stripeInvoiceNumber || `Invoice from ${formatDate2(latestInvoice.periodStart)}` }),
456
441
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-4 text-xs text-muted-foreground", children: [
@@ -490,37 +475,37 @@ function BillingUsageSummaryCard({
490
475
  onViewDetailsClick
491
476
  }) {
492
477
  if (loading) {
493
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.Card, { children: [
494
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
495
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.CardTitle, { className: "text-sm font-medium", children: "Usage This Month" }),
478
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.Card, { children: [
479
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
480
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.CardTitle, { className: "text-sm font-medium", children: "Usage This Month" }),
496
481
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
497
482
  ] }),
498
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.CardContent, { children: [
499
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Skeleton, { className: "h-6 w-24 mb-2" }),
500
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Skeleton, { className: "h-4 w-32" })
483
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.CardContent, { children: [
484
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Skeleton, { className: "h-6 w-24 mb-2" }),
485
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Skeleton, { className: "h-4 w-32" })
501
486
  ] })
502
487
  ] });
503
488
  }
504
489
  if (error) {
505
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.Card, { children: [
506
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
507
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.CardTitle, { className: "text-sm font-medium", children: "Usage This Month" }),
490
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.Card, { children: [
491
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
492
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.CardTitle, { className: "text-sm font-medium", children: "Usage This Month" }),
508
493
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
509
494
  ] }),
510
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-destructive", children: error }) })
495
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-destructive", children: error }) })
511
496
  ] });
512
497
  }
513
498
  const totalUsage = Object.values(summaries).reduce((acc, summary) => {
514
- return acc + (_optionalChain([summary, 'optionalAccess', _22 => _22.aggregatedValue]) || 0);
499
+ return acc + (_optionalChain([summary, 'optionalAccess', _16 => _16.aggregatedValue]) || 0);
515
500
  }, 0);
516
- const primaryMeter = meters.find((m) => _optionalChain([summaries, 'access', _23 => _23[m.id], 'optionalAccess', _24 => _24.aggregatedValue]));
501
+ const primaryMeter = meters.find((m) => _optionalChain([summaries, 'access', _17 => _17[m.id], 'optionalAccess', _18 => _18.aggregatedValue]));
517
502
  const primarySummary = primaryMeter ? summaries[primaryMeter.id] : null;
518
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewDetailsClick, children: [
519
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
520
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.CardTitle, { className: "text-sm font-medium", children: "Usage This Month" }),
503
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewDetailsClick, children: [
504
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
505
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.CardTitle, { className: "text-sm font-medium", children: "Usage This Month" }),
521
506
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
522
507
  ] }),
523
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.CardContent, { children: meters.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
508
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.CardContent, { children: meters.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
524
509
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No meters" }),
525
510
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "No usage meters are configured" })
526
511
  ] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
@@ -572,7 +557,7 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
572
557
  const fetchSetupIntent = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
573
558
  setLoading(true);
574
559
  try {
575
- const intent = await _chunk53IPQJVHjs.StripeCustomerService.createSetupIntent();
560
+ const intent = await _chunk3EZX4G2Ejs.StripeCustomerService.createSetupIntent();
576
561
  setSetupIntent(intent);
577
562
  } catch (err) {
578
563
  console.error("[PaymentMethodForm] Failed to create setup intent:", err);
@@ -609,8 +594,8 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
609
594
  setIsSubmitting(false);
610
595
  return;
611
596
  }
612
- if (setAsDefault && _optionalChain([confirmedSetupIntent, 'optionalAccess', _25 => _25.payment_method])) {
613
- await _chunk53IPQJVHjs.StripeCustomerService.setDefaultPaymentMethod({
597
+ if (setAsDefault && _optionalChain([confirmedSetupIntent, 'optionalAccess', _19 => _19.payment_method])) {
598
+ await _chunk3EZX4G2Ejs.StripeCustomerService.setDefaultPaymentMethod({
614
599
  paymentMethodId: typeof confirmedSetupIntent.payment_method === "string" ? confirmedSetupIntent.payment_method : confirmedSetupIntent.payment_method.id
615
600
  });
616
601
  }
@@ -626,7 +611,7 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
626
611
  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..." }) });
627
612
  }
628
613
  if (!setupIntent && error) {
629
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.AlertDescription, { children: error }) });
614
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.AlertDescription, { children: error }) });
630
615
  }
631
616
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: handleSubmit, className: "flex flex-col gap-y-4", children: [
632
617
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rounded-md border border-gray-300 p-3", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -649,13 +634,13 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
649
634
  }
650
635
  ) }),
651
636
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
652
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Checkbox, { id: "setAsDefault", checked: setAsDefault, onCheckedChange: (checked) => setSetAsDefault(!!checked) }),
653
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Label, { htmlFor: "setAsDefault", className: "text-sm font-normal", children: "Set as default payment method" })
637
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Checkbox, { id: "setAsDefault", checked: setAsDefault, onCheckedChange: (checked) => setSetAsDefault(!!checked) }),
638
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Label, { htmlFor: "setAsDefault", className: "text-sm font-normal", children: "Set as default payment method" })
654
639
  ] }),
655
- error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.AlertDescription, { children: error }) }),
640
+ error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.AlertDescription, { children: error }) }),
656
641
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-x-2", children: [
657
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Button, { type: "button", variant: "outline", onClick: onCancel, disabled: isSubmitting || isLoading, children: "Cancel" }),
658
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Button, { type: "submit", disabled: !stripe || isSubmitting || isLoading, children: isSubmitting ? "Processing..." : "Add Card" })
642
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Button, { type: "button", variant: "outline", onClick: onCancel, disabled: isSubmitting || isLoading, children: "Cancel" }),
643
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Button, { type: "submit", disabled: !stripe || isSubmitting || isLoading, children: isSubmitting ? "Processing..." : "Add Card" })
659
644
  ] })
660
645
  ] });
661
646
  }
@@ -671,10 +656,10 @@ function PaymentMethodEditor({ open, onOpenChange, onSuccess }) {
671
656
  const handleCancel = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
672
657
  onOpenChange(false);
673
658
  }, "handleCancel");
674
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.DialogContent, { className: "max-w-md", children: [
675
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.DialogHeader, { children: [
676
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.DialogTitle, { children: "Add Payment Method" }),
677
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.DialogDescription, { children: "Add a new payment method to your account. Your card information is securely processed by Stripe." })
659
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.DialogContent, { className: "max-w-md", children: [
660
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.DialogHeader, { children: [
661
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.DialogTitle, { children: "Add Payment Method" }),
662
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.DialogDescription, { children: "Add a new payment method to your account. Your card information is securely processed by Stripe." })
678
663
  ] }),
679
664
  open && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodForm, { onSuccess: handleSuccess, onCancel: handleCancel })
680
665
  ] }) });
@@ -698,7 +683,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
698
683
  _react.useEffect.call(void 0, () => {
699
684
  const loadCustomer = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
700
685
  try {
701
- const fetchedCustomer = await _chunk53IPQJVHjs.StripeCustomerService.getCustomer();
686
+ const fetchedCustomer = await _chunk3EZX4G2Ejs.StripeCustomerService.getCustomer();
702
687
  setCustomer(fetchedCustomer);
703
688
  } catch (error) {
704
689
  console.error("[PaymentMethodCard] Failed to load customer:", error);
@@ -706,16 +691,16 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
706
691
  }, "loadCustomer");
707
692
  loadCustomer();
708
693
  }, []);
709
- const isDefault = _optionalChain([customer, 'optionalAccess', _26 => _26.defaultPaymentMethodId]) === paymentMethod.id;
710
- const brand = _optionalChain([paymentMethod, 'access', _27 => _27.card, 'optionalAccess', _28 => _28.brand]) || "card";
711
- const last4 = _optionalChain([paymentMethod, 'access', _29 => _29.card, 'optionalAccess', _30 => _30.last4]) || "****";
712
- const expMonth = _optionalChain([paymentMethod, 'access', _31 => _31.card, 'optionalAccess', _32 => _32.expMonth]) || 0;
713
- const expYear = _optionalChain([paymentMethod, 'access', _33 => _33.card, 'optionalAccess', _34 => _34.expYear]) || 0;
694
+ const isDefault = _optionalChain([customer, 'optionalAccess', _20 => _20.defaultPaymentMethodId]) === paymentMethod.id;
695
+ const brand = _optionalChain([paymentMethod, 'access', _21 => _21.card, 'optionalAccess', _22 => _22.brand]) || "card";
696
+ const last4 = _optionalChain([paymentMethod, 'access', _23 => _23.card, 'optionalAccess', _24 => _24.last4]) || "****";
697
+ const expMonth = _optionalChain([paymentMethod, 'access', _25 => _25.card, 'optionalAccess', _26 => _26.expMonth]) || 0;
698
+ const expYear = _optionalChain([paymentMethod, 'access', _27 => _27.card, 'optionalAccess', _28 => _28.expYear]) || 0;
714
699
  const brandIcon = brandIcons[brand.toLowerCase()] || "\u{1F4B3}";
715
700
  const handleSetDefault = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
716
701
  setLoading(true);
717
702
  try {
718
- await _chunk53IPQJVHjs.StripeCustomerService.setDefaultPaymentMethod({ paymentMethodId: paymentMethod.id });
703
+ await _chunk3EZX4G2Ejs.StripeCustomerService.setDefaultPaymentMethod({ paymentMethodId: paymentMethod.id });
719
704
  onUpdate();
720
705
  } catch (error) {
721
706
  console.error("[PaymentMethodCard] Failed to set as default:", error);
@@ -726,7 +711,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
726
711
  const handleRemove = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
727
712
  setLoading(true);
728
713
  try {
729
- await _chunk53IPQJVHjs.StripeCustomerService.removePaymentMethod({ paymentMethodId: paymentMethod.id });
714
+ await _chunk3EZX4G2Ejs.StripeCustomerService.removePaymentMethod({ paymentMethodId: paymentMethod.id });
730
715
  setShowRemoveDialog(false);
731
716
  onUpdate();
732
717
  } catch (error) {
@@ -735,16 +720,16 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
735
720
  }
736
721
  }, "handleRemove");
737
722
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
738
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.Card, { className: "relative", children: [
739
- isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Badge, { className: "absolute right-2 top-2 bg-green-100 text-green-800 hover:bg-green-100", children: "Default" }),
740
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.CardHeader, { className: "flex flex-row items-center justify-between pb-2", children: [
723
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.Card, { className: "relative", children: [
724
+ isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Badge, { className: "absolute right-2 top-2 bg-green-100 text-green-800 hover:bg-green-100", children: "Default" }),
725
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.CardHeader, { className: "flex flex-row items-center justify-between pb-2", children: [
741
726
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
742
727
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-2xl", children: brandIcon }),
743
728
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium capitalize", children: brand })
744
729
  ] }),
745
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.DropdownMenu, { children: [
746
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.DropdownMenuTrigger, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
747
- _chunkYVEK3SUSjs.Button,
730
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.DropdownMenu, { children: [
731
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.DropdownMenuTrigger, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
732
+ _chunkBYMBRMKSjs.Button,
748
733
  {
749
734
  render: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {}),
750
735
  nativeButton: false,
@@ -755,13 +740,13 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
755
740
  children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.MoreVertical, { className: "h-4 w-4" })
756
741
  }
757
742
  ) }),
758
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.DropdownMenuContent, { align: "end", children: [
759
- !isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.DropdownMenuItem, { onClick: handleSetDefault, disabled: loading, children: "Set as Default" }),
760
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.DropdownMenuItem, { onClick: () => setShowRemoveDialog(true), disabled: loading, className: "text-red-600", children: "Remove" })
743
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.DropdownMenuContent, { align: "end", children: [
744
+ !isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.DropdownMenuItem, { onClick: handleSetDefault, disabled: loading, children: "Set as Default" }),
745
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.DropdownMenuItem, { onClick: () => setShowRemoveDialog(true), disabled: loading, className: "text-red-600", children: "Remove" })
761
746
  ] })
762
747
  ] })
763
748
  ] }),
764
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-1", children: [
749
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-1", children: [
765
750
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-lg font-semibold", children: [
766
751
  "\u2022\u2022\u2022\u2022 ",
767
752
  last4
@@ -774,17 +759,17 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
774
759
  ] })
775
760
  ] }) })
776
761
  ] }),
777
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.AlertDialog, { open: showRemoveDialog, onOpenChange: setShowRemoveDialog, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.AlertDialogContent, { children: [
778
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.AlertDialogHeader, { children: [
779
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.AlertDialogTitle, { children: "Remove Payment Method" }),
780
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.AlertDialogDescription, { children: [
762
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.AlertDialog, { open: showRemoveDialog, onOpenChange: setShowRemoveDialog, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.AlertDialogContent, { children: [
763
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.AlertDialogHeader, { children: [
764
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.AlertDialogTitle, { children: "Remove Payment Method" }),
765
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.AlertDialogDescription, { children: [
781
766
  "Are you sure you want to remove this payment method? This action cannot be undone.",
782
767
  isDefault && " This is your default payment method."
783
768
  ] })
784
769
  ] }),
785
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.AlertDialogFooter, { children: [
786
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.AlertDialogCancel, { disabled: loading, children: "Cancel" }),
787
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.AlertDialogAction, { onClick: handleRemove, disabled: loading, className: "bg-red-600 hover:bg-red-700", children: loading ? "Removing..." : "Remove" })
770
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.AlertDialogFooter, { children: [
771
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.AlertDialogCancel, { disabled: loading, children: "Cancel" }),
772
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.AlertDialogAction, { onClick: handleRemove, disabled: loading, className: "bg-red-600 hover:bg-red-700", children: loading ? "Removing..." : "Remove" })
788
773
  ] })
789
774
  ] }) })
790
775
  ] });
@@ -807,7 +792,7 @@ function PaymentMethodsContainer() {
807
792
  const loadPaymentMethods = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
808
793
  setLoading(true);
809
794
  try {
810
- const fetchedPaymentMethods = await _chunk53IPQJVHjs.StripeCustomerService.listPaymentMethods();
795
+ const fetchedPaymentMethods = await _chunk3EZX4G2Ejs.StripeCustomerService.listPaymentMethods();
811
796
  setPaymentMethods(fetchedPaymentMethods);
812
797
  } catch (error) {
813
798
  console.error("[PaymentMethodsContainer] Failed to load payment methods:", error);
@@ -827,14 +812,14 @@ function PaymentMethodsContainer() {
827
812
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8" }),
828
813
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-3xl font-bold", children: "Payment Methods" })
829
814
  ] }),
830
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Button, { onClick: () => setShowAddPaymentMethod(true), children: "Add Payment Method" })
815
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Button, { onClick: () => setShowAddPaymentMethod(true), children: "Add Payment Method" })
831
816
  ] }),
832
817
  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: [
833
818
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-16 w-16 text-muted-foreground" }),
834
819
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
835
820
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "mb-2 text-xl font-semibold", children: "No payment methods" }),
836
821
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mb-4 text-muted-foreground", children: "Add a payment method to enable subscriptions and secure checkout." }),
837
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Button, { onClick: () => setShowAddPaymentMethod(true), children: "Add Your First Card" })
822
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Button, { onClick: () => setShowAddPaymentMethod(true), children: "Add Your First Card" })
838
823
  ] })
839
824
  ] }),
840
825
  paymentMethods.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodsList, { paymentMethods, onUpdate: loadPaymentMethods }),
@@ -962,14 +947,14 @@ function InvoiceDetails({
962
947
  }
963
948
  return invoice.stripeInvoiceId.slice(-8);
964
949
  }, "getInvoiceNumber");
965
- const productName = _optionalChain([invoice, 'access', _35 => _35.subscription, 'optionalAccess', _36 => _36.price, 'optionalAccess', _37 => _37.product, 'optionalAccess', _38 => _38.name]) || "Subscription";
966
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.DialogContent, { className: "max-w-2xl", children: [
967
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.DialogHeader, { children: [
968
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.DialogTitle, { children: [
950
+ const productName = _optionalChain([invoice, 'access', _29 => _29.subscription, 'optionalAccess', _30 => _30.price, 'optionalAccess', _31 => _31.product, 'optionalAccess', _32 => _32.name]) || "Subscription";
951
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.DialogContent, { className: "max-w-2xl", children: [
952
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.DialogHeader, { children: [
953
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.DialogTitle, { children: [
969
954
  "Invoice ",
970
955
  getInvoiceNumber()
971
956
  ] }),
972
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.DialogDescription, { children: formatDate3(invoice.periodStart) })
957
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.DialogDescription, { children: formatDate3(invoice.periodStart) })
973
958
  ] }),
974
959
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
975
960
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
@@ -1034,15 +1019,15 @@ function InvoiceDetails({
1034
1019
  ] })
1035
1020
  ] }),
1036
1021
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2 pt-4 border-t", children: [
1037
- invoice.stripePdfUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.Button, { variant: "outline", onClick: handleDownloadPDF, children: [
1022
+ invoice.stripePdfUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.Button, { variant: "outline", onClick: handleDownloadPDF, children: [
1038
1023
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Download, { className: "mr-2 h-4 w-4" }),
1039
1024
  "Download PDF"
1040
1025
  ] }),
1041
- invoice.status === "open" /* OPEN */ && invoice.attempted && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.Button, { variant: "default", onClick: handleRetryPayment, children: [
1026
+ invoice.status === "open" /* OPEN */ && invoice.attempted && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.Button, { variant: "default", onClick: handleRetryPayment, children: [
1042
1027
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RefreshCw, { className: "mr-2 h-4 w-4" }),
1043
1028
  "Retry Payment"
1044
1029
  ] }),
1045
- invoice.stripeHostedInvoiceUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.Button, { variant: "outline", onClick: handleViewInStripe, children: [
1030
+ invoice.stripeHostedInvoiceUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.Button, { variant: "outline", onClick: handleViewInStripe, children: [
1046
1031
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ExternalLink, { className: "mr-2 h-4 w-4" }),
1047
1032
  "View in Stripe"
1048
1033
  ] })
@@ -1066,30 +1051,30 @@ function InvoicesList({ invoices, onInvoicesChange }) {
1066
1051
  return invoice.stripeInvoiceId.slice(-8);
1067
1052
  }, "getInvoiceNumber");
1068
1053
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
1069
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.Table, { children: [
1070
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.TableRow, { children: [
1071
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.TableHead, { children: "Invoice #" }),
1072
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.TableHead, { children: "Date" }),
1073
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.TableHead, { children: "Status" }),
1074
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.TableHead, { className: "text-right", children: "Amount" }),
1075
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.TableHead, { children: "Period" })
1054
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.Table, { children: [
1055
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.TableRow, { children: [
1056
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.TableHead, { children: "Invoice #" }),
1057
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.TableHead, { children: "Date" }),
1058
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.TableHead, { children: "Status" }),
1059
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.TableHead, { className: "text-right", children: "Amount" }),
1060
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.TableHead, { children: "Period" })
1076
1061
  ] }) }),
1077
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.TableBody, { children: invoices.map((invoice) => {
1062
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.TableBody, { children: invoices.map((invoice) => {
1078
1063
  const invoiceNumber = getInvoiceNumber(invoice);
1079
1064
  const date = formatDate3(invoice.periodStart);
1080
1065
  const amount = formatCurrency(invoice.total, invoice.currency);
1081
1066
  const period = `${formatDate3(invoice.periodStart)} - ${formatDate3(invoice.periodEnd)}`;
1082
1067
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1083
- _chunkYVEK3SUSjs.TableRow,
1068
+ _chunkBYMBRMKSjs.TableRow,
1084
1069
  {
1085
1070
  onClick: () => handleRowClick(invoice),
1086
1071
  className: "cursor-pointer hover:bg-muted/50",
1087
1072
  children: [
1088
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.TableCell, { className: "font-medium", children: invoiceNumber }),
1089
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.TableCell, { className: "text-muted-foreground text-sm", children: date }),
1090
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InvoiceStatusBadge, { status: invoice.status }) }),
1091
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.TableCell, { className: "text-right font-medium", children: amount }),
1092
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.TableCell, { className: "text-muted-foreground text-sm", children: period })
1073
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.TableCell, { className: "font-medium", children: invoiceNumber }),
1074
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.TableCell, { className: "text-muted-foreground text-sm", children: date }),
1075
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InvoiceStatusBadge, { status: invoice.status }) }),
1076
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.TableCell, { className: "text-right font-medium", children: amount }),
1077
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.TableCell, { className: "text-muted-foreground text-sm", children: period })
1093
1078
  ]
1094
1079
  },
1095
1080
  invoice.id
@@ -1122,7 +1107,7 @@ function InvoicesContainer() {
1122
1107
  setLoading(true);
1123
1108
  try {
1124
1109
  const params = statusFilter !== "all" ? { status: statusFilter } : void 0;
1125
- const data = await _chunk53IPQJVHjs.StripeInvoiceService.listInvoices(params);
1110
+ const data = await _chunk3EZX4G2Ejs.StripeInvoiceService.listInvoices(params);
1126
1111
  setInvoices(data);
1127
1112
  } catch (error) {
1128
1113
  console.error("[InvoicesContainer] Failed to load invoices:", error);
@@ -1138,12 +1123,12 @@ function InvoicesContainer() {
1138
1123
  setStatusFilter(value);
1139
1124
  }, "handleFilterChange");
1140
1125
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-4", children: [
1141
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Tabs, { value: statusFilter, onValueChange: handleFilterChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.TabsList, { children: [
1142
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.TabsTrigger, { value: "all", children: "All" }),
1143
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.TabsTrigger, { value: "paid" /* PAID */, children: "Paid" }),
1144
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.TabsTrigger, { value: "open" /* OPEN */, children: "Open" }),
1145
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.TabsTrigger, { value: "void" /* VOID */, children: "Void" }),
1146
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.TabsTrigger, { value: "uncollectible" /* UNCOLLECTIBLE */, children: "Uncollectible" })
1126
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Tabs, { value: statusFilter, onValueChange: handleFilterChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.TabsList, { children: [
1127
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.TabsTrigger, { value: "all", children: "All" }),
1128
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.TabsTrigger, { value: "paid" /* PAID */, children: "Paid" }),
1129
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.TabsTrigger, { value: "open" /* OPEN */, children: "Open" }),
1130
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.TabsTrigger, { value: "void" /* VOID */, children: "Void" }),
1131
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.TabsTrigger, { value: "uncollectible" /* UNCOLLECTIBLE */, children: "Uncollectible" })
1147
1132
  ] }) }),
1148
1133
  loading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-center py-8 text-muted-foreground", children: "Loading invoices..." }),
1149
1134
  !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: [
@@ -1190,7 +1175,7 @@ function CancelSubscriptionDialog({
1190
1175
  const onSubmit = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async (_values) => {
1191
1176
  setIsSubmitting(true);
1192
1177
  try {
1193
- await _chunk53IPQJVHjs.StripeSubscriptionService.cancelSubscription({
1178
+ await _chunk3EZX4G2Ejs.StripeSubscriptionService.cancelSubscription({
1194
1179
  id: subscription.id,
1195
1180
  cancelImmediately: false
1196
1181
  });
@@ -1203,19 +1188,19 @@ function CancelSubscriptionDialog({
1203
1188
  }
1204
1189
  }, "onSubmit");
1205
1190
  const periodEndDate = formatDate3(subscription.currentPeriodEnd);
1206
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.DialogContent, { className: "max-w-md", children: [
1207
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.DialogHeader, { children: [
1208
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.DialogTitle, { children: "Cancel Subscription" }),
1209
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.DialogDescription, { children: "Are you sure you want to cancel this subscription? This action cannot be undone." })
1191
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.DialogContent, { className: "max-w-md", children: [
1192
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.DialogHeader, { children: [
1193
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.DialogTitle, { children: "Cancel Subscription" }),
1194
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.DialogDescription, { children: "Are you sure you want to cancel this subscription? This action cannot be undone." })
1210
1195
  ] }),
1211
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-col gap-y-4", children: [
1196
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-col gap-y-4", children: [
1212
1197
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-blue-50 border border-blue-200 rounded-lg p-3 text-sm text-blue-800", children: [
1213
1198
  "Your subscription will remain active until ",
1214
1199
  periodEndDate,
1215
1200
  ". You can continue using the service until then."
1216
1201
  ] }),
1217
1202
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1218
- _chunkYVEK3SUSjs.FormTextarea,
1203
+ _chunkBYMBRMKSjs.FormTextarea,
1219
1204
  {
1220
1205
  form,
1221
1206
  id: "reason",
@@ -1225,8 +1210,8 @@ function CancelSubscriptionDialog({
1225
1210
  }
1226
1211
  ),
1227
1212
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-x-2 justify-end pt-2", children: [
1228
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Button, { type: "button", variant: "outline", onClick: () => onOpenChange(false), disabled: isSubmitting, children: "Keep Subscription" }),
1229
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Button, { type: "submit", variant: "destructive", disabled: isSubmitting, children: isSubmitting ? "Canceling..." : "Confirm Cancellation" })
1213
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Button, { type: "button", variant: "outline", onClick: () => onOpenChange(false), disabled: isSubmitting, children: "Keep Subscription" }),
1214
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Button, { type: "submit", variant: "destructive", disabled: isSubmitting, children: isSubmitting ? "Canceling..." : "Confirm Cancellation" })
1230
1215
  ] })
1231
1216
  ] }) })
1232
1217
  ] }) });
@@ -1283,10 +1268,10 @@ _chunk7QVYU63Ejs.__name.call(void 0, SubscriptionStatusBadge, "SubscriptionStatu
1283
1268
 
1284
1269
  function formatPlanName2(price) {
1285
1270
  if (!price) return "N/A";
1286
- const productName = _optionalChain([price, 'access', _39 => _39.product, 'optionalAccess', _40 => _40.name]) || "";
1271
+ const productName = _optionalChain([price, 'access', _33 => _33.product, 'optionalAccess', _34 => _34.name]) || "";
1287
1272
  const nickname = price.nickname || "";
1288
1273
  let interval = "";
1289
- if (_optionalChain([price, 'access', _41 => _41.recurring, 'optionalAccess', _42 => _42.interval])) {
1274
+ if (_optionalChain([price, 'access', _35 => _35.recurring, 'optionalAccess', _36 => _36.interval])) {
1290
1275
  const intervalMap = {
1291
1276
  day: "Daily",
1292
1277
  week: "Weekly",
@@ -1301,7 +1286,7 @@ function formatPlanName2(price) {
1301
1286
  }
1302
1287
  _chunk7QVYU63Ejs.__name.call(void 0, formatPlanName2, "formatPlanName");
1303
1288
  function formatBillingAmount(price) {
1304
- if (!_optionalChain([price, 'optionalAccess', _43 => _43.unitAmount])) return "N/A";
1289
+ if (!_optionalChain([price, 'optionalAccess', _37 => _37.unitAmount])) return "N/A";
1305
1290
  return formatCurrency(price.unitAmount, price.currency);
1306
1291
  }
1307
1292
  _chunk7QVYU63Ejs.__name.call(void 0, formatBillingAmount, "formatBillingAmount");
@@ -1317,7 +1302,7 @@ function SubscriptionDetails({
1317
1302
  const handlePause = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
1318
1303
  setIsProcessing(true);
1319
1304
  try {
1320
- await _chunk53IPQJVHjs.StripeSubscriptionService.pauseSubscription({ subscriptionId: subscription.id });
1305
+ await _chunk3EZX4G2Ejs.StripeSubscriptionService.pauseSubscription({ subscriptionId: subscription.id });
1321
1306
  onSubscriptionChange();
1322
1307
  } catch (error) {
1323
1308
  console.error("[SubscriptionDetails] Failed to pause subscription:", error);
@@ -1328,7 +1313,7 @@ function SubscriptionDetails({
1328
1313
  const handleResume = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
1329
1314
  setIsProcessing(true);
1330
1315
  try {
1331
- await _chunk53IPQJVHjs.StripeSubscriptionService.resumeSubscription({ subscriptionId: subscription.id });
1316
+ await _chunk3EZX4G2Ejs.StripeSubscriptionService.resumeSubscription({ subscriptionId: subscription.id });
1332
1317
  onSubscriptionChange();
1333
1318
  } catch (error) {
1334
1319
  console.error("[SubscriptionDetails] Failed to resume subscription:", error);
@@ -1338,7 +1323,7 @@ function SubscriptionDetails({
1338
1323
  }, "handleResume");
1339
1324
  const handleManageViaPortal = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
1340
1325
  try {
1341
- const { url } = await _chunk53IPQJVHjs.StripeCustomerService.createPortalSession();
1326
+ const { url } = await _chunk3EZX4G2Ejs.StripeCustomerService.createPortalSession();
1342
1327
  window.open(url, "_blank");
1343
1328
  } catch (error) {
1344
1329
  console.error("[SubscriptionDetails] Failed to create portal session:", error);
@@ -1348,10 +1333,10 @@ function SubscriptionDetails({
1348
1333
  const canResume = subscription.status === "paused" /* PAUSED */;
1349
1334
  const canCancel = subscription.status === "active" /* ACTIVE */ || subscription.status === "trialing" /* TRIALING */ || subscription.status === "paused" /* PAUSED */;
1350
1335
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
1351
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.DialogContent, { className: "max-w-2xl", children: [
1352
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.DialogHeader, { children: [
1353
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.DialogTitle, { children: "Subscription Details" }),
1354
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.DialogDescription, { children: "View and manage your subscription" })
1336
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.DialogContent, { className: "max-w-2xl", children: [
1337
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.DialogHeader, { children: [
1338
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.DialogTitle, { children: "Subscription Details" }),
1339
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.DialogDescription, { children: "View and manage your subscription" })
1355
1340
  ] }),
1356
1341
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
1357
1342
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
@@ -1393,11 +1378,11 @@ function SubscriptionDetails({
1393
1378
  "."
1394
1379
  ] }) }),
1395
1380
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2 pt-4 border-t", children: [
1396
- onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Button, { variant: "default", onClick: () => onChangePlan(subscription), children: "Change Plan" }),
1397
- canPause && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Button, { variant: "outline", onClick: handlePause, disabled: isProcessing, children: isProcessing ? "Pausing..." : "Pause" }),
1398
- canResume && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Button, { variant: "outline", onClick: handleResume, disabled: isProcessing, children: isProcessing ? "Resuming..." : "Resume" }),
1399
- canCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Button, { variant: "destructive", onClick: () => setShowCancel(true), children: "Cancel" }),
1400
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Button, { variant: "outline", onClick: handleManageViaPortal, children: "Manage via Portal" })
1381
+ onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Button, { variant: "default", onClick: () => onChangePlan(subscription), children: "Change Plan" }),
1382
+ canPause && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Button, { variant: "outline", onClick: handlePause, disabled: isProcessing, children: isProcessing ? "Pausing..." : "Pause" }),
1383
+ canResume && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Button, { variant: "outline", onClick: handleResume, disabled: isProcessing, children: isProcessing ? "Resuming..." : "Resume" }),
1384
+ canCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Button, { variant: "destructive", onClick: () => setShowCancel(true), children: "Cancel" }),
1385
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Button, { variant: "outline", onClick: handleManageViaPortal, children: "Manage via Portal" })
1401
1386
  ] })
1402
1387
  ] })
1403
1388
  ] }) }),
@@ -1421,10 +1406,10 @@ _chunk7QVYU63Ejs.__name.call(void 0, SubscriptionDetails, "SubscriptionDetails")
1421
1406
 
1422
1407
  function formatPlanName3(price) {
1423
1408
  if (!price) return "N/A";
1424
- const productName = _optionalChain([price, 'access', _44 => _44.product, 'optionalAccess', _45 => _45.name]) || "";
1409
+ const productName = _optionalChain([price, 'access', _38 => _38.product, 'optionalAccess', _39 => _39.name]) || "";
1425
1410
  const nickname = price.nickname || "";
1426
1411
  let interval = "";
1427
- if (_optionalChain([price, 'access', _46 => _46.recurring, 'optionalAccess', _47 => _47.interval])) {
1412
+ if (_optionalChain([price, 'access', _40 => _40.recurring, 'optionalAccess', _41 => _41.interval])) {
1428
1413
  const intervalMap = {
1429
1414
  day: "Daily",
1430
1415
  week: "Weekly",
@@ -1444,33 +1429,46 @@ function SubscriptionsList({ subscriptions, onSubscriptionsChange, onChangePlan
1444
1429
  setSelectedSub(subscription);
1445
1430
  }, "handleRowClick");
1446
1431
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
1447
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.Table, { children: [
1448
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.TableRow, { children: [
1449
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.TableHead, { children: "Status" }),
1450
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.TableHead, { children: "Plan" }),
1451
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.TableHead, { children: "Period" }),
1452
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.TableHead, { className: "text-right", children: "Amount" })
1432
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.Table, { children: [
1433
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.TableRow, { children: [
1434
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.TableHead, { children: "Status" }),
1435
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.TableHead, { children: "Plan" }),
1436
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.TableHead, { children: "Period" }),
1437
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.TableHead, { className: "text-right", children: "Amount" }),
1438
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.TableHead, { className: "text-right", children: "Actions" })
1453
1439
  ] }) }),
1454
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.TableBody, { children: subscriptions.map((subscription) => {
1440
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.TableBody, { children: subscriptions.map((subscription) => {
1455
1441
  const price = subscription.price;
1456
- const amount = _optionalChain([price, 'optionalAccess', _48 => _48.unitAmount]) ? formatCurrency(price.unitAmount, price.currency) : "N/A";
1442
+ const amount = _optionalChain([price, 'optionalAccess', _42 => _42.unitAmount]) ? formatCurrency(price.unitAmount, price.currency) : "0";
1457
1443
  const period = `${formatDate3(subscription.currentPeriodStart)} - ${formatDate3(subscription.currentPeriodEnd)}`;
1458
1444
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1459
- _chunkYVEK3SUSjs.TableRow,
1445
+ _chunkBYMBRMKSjs.TableRow,
1460
1446
  {
1461
1447
  onClick: () => handleRowClick(subscription),
1462
1448
  className: "cursor-pointer hover:bg-muted/50",
1463
1449
  children: [
1464
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1450
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1465
1451
  SubscriptionStatusBadge,
1466
1452
  {
1467
1453
  status: subscription.status,
1468
1454
  cancelAtPeriodEnd: subscription.cancelAtPeriodEnd
1469
1455
  }
1470
1456
  ) }),
1471
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.TableCell, { className: "font-medium", children: formatPlanName3(price) }),
1472
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.TableCell, { className: "text-muted-foreground text-sm", children: period }),
1473
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.TableCell, { className: "text-right font-medium", children: amount })
1457
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.TableCell, { className: "font-medium", children: formatPlanName3(price) }),
1458
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.TableCell, { className: "text-muted-foreground text-sm", children: period }),
1459
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.TableCell, { className: "text-right font-medium", children: amount }),
1460
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.TableCell, { className: "text-right", children: (subscription.status === "active" /* ACTIVE */ || subscription.status === "trialing" /* TRIALING */) && onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1461
+ _chunkBYMBRMKSjs.Button,
1462
+ {
1463
+ size: "sm",
1464
+ variant: "outline",
1465
+ onClick: (e) => {
1466
+ e.stopPropagation();
1467
+ onChangePlan(subscription);
1468
+ },
1469
+ children: "Upgrade"
1470
+ }
1471
+ ) })
1474
1472
  ]
1475
1473
  },
1476
1474
  subscription.id
@@ -1505,7 +1503,7 @@ function SubscriptionsContainer({ onOpenWizard, hasActiveRecurringSubscription }
1505
1503
  const loadSubscriptions = _react.useCallback.call(void 0, async () => {
1506
1504
  setLoading(true);
1507
1505
  try {
1508
- const fetchedSubscriptions = await _chunk53IPQJVHjs.StripeSubscriptionService.listSubscriptions();
1506
+ const fetchedSubscriptions = await _chunk3EZX4G2Ejs.StripeSubscriptionService.listSubscriptions();
1509
1507
  setSubscriptions(fetchedSubscriptions);
1510
1508
  } catch (error) {
1511
1509
  console.error("[SubscriptionsContainer] Failed to load subscriptions:", error);
@@ -1528,7 +1526,7 @@ function SubscriptionsContainer({ onOpenWizard, hasActiveRecurringSubscription }
1528
1526
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8" }),
1529
1527
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-3xl font-bold", children: "Subscriptions" })
1530
1528
  ] }),
1531
- subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _49 => _49()]), children: hasActiveRecurringSubscription ? "Purchase Add-ons" : "Subscribe to a Plan" })
1529
+ subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _43 => _43()]), children: hasActiveRecurringSubscription ? "Purchase Add-ons" : "Subscribe to a Plan" })
1532
1530
  ] }),
1533
1531
  criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BillingAlertBanner, { subscription }, subscription.id)),
1534
1532
  subscriptions.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col items-center justify-center py-12 space-y-4", children: [
@@ -1536,7 +1534,7 @@ function SubscriptionsContainer({ onOpenWizard, hasActiveRecurringSubscription }
1536
1534
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
1537
1535
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-xl font-semibold mb-2", children: "No Active Subscriptions" }),
1538
1536
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground mb-6", children: "Choose a subscription plan to get started with our services." }),
1539
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _50 => _50()]), children: "Subscribe to a Plan" })
1537
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _44 => _44()]), children: "Subscribe to a Plan" })
1540
1538
  ] })
1541
1539
  ] }),
1542
1540
  subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -1544,7 +1542,7 @@ function SubscriptionsContainer({ onOpenWizard, hasActiveRecurringSubscription }
1544
1542
  {
1545
1543
  subscriptions,
1546
1544
  onSubscriptionsChange: loadSubscriptions,
1547
- onChangePlan: (sub) => _optionalChain([onOpenWizard, 'optionalCall', _51 => _51(sub)])
1545
+ onChangePlan: (sub) => _optionalChain([onOpenWizard, 'optionalCall', _45 => _45(sub)])
1548
1546
  }
1549
1547
  )
1550
1548
  ] });
@@ -1557,9 +1555,9 @@ function IntervalToggle({ value, onChange, hasMonthly, hasYearly }) {
1557
1555
  if (!hasMonthly || !hasYearly) {
1558
1556
  return null;
1559
1557
  }
1560
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Tabs, { value, onValueChange: (v) => onChange(v), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.TabsList, { children: [
1561
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.TabsTrigger, { value: "month", children: "Monthly" }),
1562
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.TabsTrigger, { value: "year", children: "Yearly" })
1558
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Tabs, { value, onValueChange: (v) => onChange(v), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.TabsList, { children: [
1559
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.TabsTrigger, { value: "month", children: "Monthly" }),
1560
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.TabsTrigger, { value: "year", children: "Yearly" })
1563
1561
  ] }) });
1564
1562
  }
1565
1563
  _chunk7QVYU63Ejs.__name.call(void 0, IntervalToggle, "IntervalToggle");
@@ -1591,7 +1589,7 @@ function PricingCard({
1591
1589
  }
1592
1590
  }, "handleClick");
1593
1591
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1594
- _chunkYVEK3SUSjs.Card,
1592
+ _chunkBYMBRMKSjs.Card,
1595
1593
  {
1596
1594
  role: "radio",
1597
1595
  "aria-checked": isSelected,
@@ -1599,7 +1597,7 @@ function PricingCard({
1599
1597
  tabIndex: isDisabled ? -1 : 0,
1600
1598
  onKeyDown: handleKeyDown,
1601
1599
  onClick: handleClick,
1602
- className: _chunk53IPQJVHjs.cn.call(void 0,
1600
+ className: _chunk3EZX4G2Ejs.cn.call(void 0,
1603
1601
  "relative cursor-pointer transition-all duration-200 flex flex-col h-full",
1604
1602
  "focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
1605
1603
  isCurrentPlan && "bg-muted/30",
@@ -1609,9 +1607,9 @@ function PricingCard({
1609
1607
  isLoading && "pointer-events-none"
1610
1608
  ),
1611
1609
  children: [
1612
- isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Badge, { variant: "secondary", className: "absolute top-2 right-2", children: "Current" }),
1613
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.CardHeader, { className: "pb-2", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "font-semibold text-lg", children: description }) }),
1614
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.CardContent, { className: "pb-4 grow", children: [
1610
+ isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Badge, { variant: "secondary", className: "absolute top-2 right-2", children: "Current" }),
1611
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.CardHeader, { className: "pb-2", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "font-semibold text-lg", children: description }) }),
1612
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.CardContent, { className: "pb-4 grow", children: [
1615
1613
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mb-4", children: [
1616
1614
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-3xl font-bold", children: formattedPrice }),
1617
1615
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground ml-1", children: interval })
@@ -1621,8 +1619,8 @@ function PricingCard({
1621
1619
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-muted-foreground", children: feature })
1622
1620
  ] }, index)) })
1623
1621
  ] }),
1624
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.CardFooter, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1625
- _chunkYVEK3SUSjs.Button,
1622
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.CardFooter, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1623
+ _chunkBYMBRMKSjs.Button,
1626
1624
  {
1627
1625
  variant: isCurrentPlan ? "secondary" : isSelected ? "default" : "outline",
1628
1626
  className: "w-full",
@@ -1686,11 +1684,11 @@ function getFilteredPrices(prices, selectedInterval) {
1686
1684
  return prices.filter((p) => p.priceType === "one_time");
1687
1685
  }
1688
1686
  const intervalPrices = prices.filter(
1689
- (p) => p.priceType === "recurring" && _optionalChain([p, 'access', _52 => _52.recurring, 'optionalAccess', _53 => _53.interval]) === selectedInterval
1687
+ (p) => p.priceType === "recurring" && _optionalChain([p, 'access', _46 => _46.recurring, 'optionalAccess', _47 => _47.interval]) === selectedInterval
1690
1688
  );
1691
1689
  if (intervalPrices.length === 0) {
1692
1690
  const fallbackInterval = selectedInterval === "month" ? "year" : "month";
1693
- return prices.filter((p) => p.priceType === "recurring" && _optionalChain([p, 'access', _54 => _54.recurring, 'optionalAccess', _55 => _55.interval]) === fallbackInterval);
1691
+ return prices.filter((p) => p.priceType === "recurring" && _optionalChain([p, 'access', _48 => _48.recurring, 'optionalAccess', _49 => _49.interval]) === fallbackInterval);
1694
1692
  }
1695
1693
  return intervalPrices;
1696
1694
  }
@@ -1750,15 +1748,15 @@ function ProductPricingList({
1750
1748
  _chunk7QVYU63Ejs.__name.call(void 0, ProductPricingList, "ProductPricingList");
1751
1749
  function ProductPricingListSkeleton() {
1752
1750
  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: [
1753
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Skeleton, { className: "h-6 w-32" }),
1751
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Skeleton, { className: "h-6 w-32" }),
1754
1752
  /* @__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: [
1755
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Skeleton, { className: "h-6 w-24" }),
1756
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Skeleton, { className: "h-8 w-32" }),
1753
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Skeleton, { className: "h-6 w-24" }),
1754
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Skeleton, { className: "h-8 w-32" }),
1757
1755
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
1758
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Skeleton, { className: "h-4 w-full" }),
1759
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Skeleton, { className: "h-4 w-3/4" })
1756
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Skeleton, { className: "h-4 w-full" }),
1757
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Skeleton, { className: "h-4 w-3/4" })
1760
1758
  ] }),
1761
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Skeleton, { className: "h-10 w-full" })
1759
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Skeleton, { className: "h-10 w-full" })
1762
1760
  ] }, cardIndex)) })
1763
1761
  ] }, rowIndex)) });
1764
1762
  }
@@ -1794,8 +1792,8 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProrationPreview, "ProrationPreview");
1794
1792
 
1795
1793
 
1796
1794
  function SubscriptionConfirmation({ price, isLoading, onConfirm, onCancel }) {
1797
- const productName = _optionalChain([price, 'access', _56 => _56.product, 'optionalAccess', _57 => _57.name]) || price.nickname || "Selected Plan";
1798
- const productDescription = _optionalChain([price, 'access', _58 => _58.product, 'optionalAccess', _59 => _59.description]) || price.description;
1795
+ const productName = _optionalChain([price, 'access', _50 => _50.product, 'optionalAccess', _51 => _51.name]) || price.nickname || "Selected Plan";
1796
+ const productDescription = _optionalChain([price, 'access', _52 => _52.product, 'optionalAccess', _53 => _53.description]) || price.description;
1799
1797
  const features = price.features || [];
1800
1798
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-accent/10 border border-accent/30 rounded-lg p-4", children: [
1801
1799
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "font-semibold mb-3", children: "Confirm Your Subscription" }),
@@ -1813,8 +1811,8 @@ function SubscriptionConfirmation({ price, isLoading, onConfirm, onCancel }) {
1813
1811
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: feature })
1814
1812
  ] }, index)) }),
1815
1813
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-3 pt-2 border-t border-accent/30", children: [
1816
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Button, { variant: "outline", onClick: onCancel, disabled: isLoading, children: "Cancel" }),
1817
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Button, { onClick: onConfirm, disabled: isLoading, children: isLoading ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
1814
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Button, { variant: "outline", onClick: onCancel, disabled: isLoading, children: "Cancel" }),
1815
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Button, { onClick: onConfirm, disabled: isLoading, children: isLoading ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
1818
1816
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "h-4 w-4 animate-spin mr-2" }),
1819
1817
  "Processing..."
1820
1818
  ] }) : "Subscribe" })
@@ -1837,7 +1835,11 @@ var initialState = {
1837
1835
  hasPaymentMethod: false,
1838
1836
  isProcessing: false,
1839
1837
  error: null,
1840
- prorationPreview: null
1838
+ prorationPreview: null,
1839
+ promotionCode: null,
1840
+ isValidatingPromoCode: false,
1841
+ promoCodeError: null,
1842
+ isTrialSubscription: false
1841
1843
  };
1842
1844
  function wizardReducer(state, action) {
1843
1845
  switch (action.type) {
@@ -1855,6 +1857,14 @@ function wizardReducer(state, action) {
1855
1857
  return { ...state, error: action.error };
1856
1858
  case "SET_PRORATION_PREVIEW":
1857
1859
  return { ...state, prorationPreview: action.preview };
1860
+ case "SET_PROMOTION_CODE":
1861
+ return { ...state, promotionCode: action.code, promoCodeError: null };
1862
+ case "SET_VALIDATING_PROMO_CODE":
1863
+ return { ...state, isValidatingPromoCode: action.isValidating };
1864
+ case "SET_PROMO_CODE_ERROR":
1865
+ return { ...state, promoCodeError: action.error };
1866
+ case "SET_IS_TRIAL_SUBSCRIPTION":
1867
+ return { ...state, isTrialSubscription: action.isTrial };
1858
1868
  case "RESET":
1859
1869
  return initialState;
1860
1870
  default:
@@ -1865,7 +1875,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, wizardReducer, "wizardReducer");
1865
1875
  function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
1866
1876
  const [state, dispatch] = _react.useReducer.call(void 0, wizardReducer, {
1867
1877
  ...initialState,
1868
- selectedPrice: _optionalChain([subscription, 'optionalAccess', _60 => _60.price]) || null
1878
+ selectedPrice: _optionalChain([subscription, 'optionalAccess', _54 => _54.price]) || null
1869
1879
  });
1870
1880
  const onSuccessRef = _react.useRef.call(void 0, onSuccess);
1871
1881
  const onCloseRef = _react.useRef.call(void 0, onClose);
@@ -1873,7 +1883,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
1873
1883
  onCloseRef.current = onClose;
1874
1884
  const checkPaymentMethod = _react.useCallback.call(void 0, async () => {
1875
1885
  try {
1876
- const methods = await _chunk53IPQJVHjs.StripeCustomerService.listPaymentMethods();
1886
+ const methods = await _chunk3EZX4G2Ejs.StripeCustomerService.listPaymentMethods();
1877
1887
  dispatch({ type: "SET_HAS_PAYMENT_METHOD", hasMethod: methods.length > 0 });
1878
1888
  } catch (error) {
1879
1889
  console.error("[useSubscriptionWizard] Failed to check payment methods:", error);
@@ -1894,8 +1904,21 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
1894
1904
  dispatch({ type: "SET_PROCESSING", isProcessing: true });
1895
1905
  try {
1896
1906
  await checkPaymentMethod();
1897
- if (subscription && state.selectedPrice.id !== _optionalChain([subscription, 'access', _61 => _61.price, 'optionalAccess', _62 => _62.id])) {
1898
- const preview = await _chunk53IPQJVHjs.StripeSubscriptionService.getProrationPreview({
1907
+ const isTrialUpgrade = _optionalChain([subscription, 'optionalAccess', _55 => _55.status]) === "trialing" /* TRIALING */;
1908
+ dispatch({ type: "SET_IS_TRIAL_SUBSCRIPTION", isTrial: isTrialUpgrade });
1909
+ if (isTrialUpgrade && !state.hasPaymentMethod) {
1910
+ const methods = await _chunk3EZX4G2Ejs.StripeCustomerService.listPaymentMethods();
1911
+ if (methods.length === 0) {
1912
+ dispatch({ type: "SET_STEP", step: "payment-method" });
1913
+ dispatch({
1914
+ type: "SET_ERROR",
1915
+ error: "A payment method is required to upgrade from your trial."
1916
+ });
1917
+ return;
1918
+ }
1919
+ }
1920
+ if (subscription && state.selectedPrice.id !== _optionalChain([subscription, 'access', _56 => _56.price, 'optionalAccess', _57 => _57.id])) {
1921
+ const preview = await _chunk3EZX4G2Ejs.StripeSubscriptionService.getProrationPreview({
1899
1922
  subscriptionId: subscription.id,
1900
1923
  newPriceId: state.selectedPrice.id
1901
1924
  });
@@ -1904,48 +1927,57 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
1904
1927
  dispatch({ type: "SET_STEP", step: "review" });
1905
1928
  } catch (error) {
1906
1929
  console.error("[useSubscriptionWizard] Error preparing review:", error);
1907
- dispatch({ type: "SET_ERROR", error: _optionalChain([error, 'optionalAccess', _63 => _63.message]) || "Failed to prepare review" });
1930
+ dispatch({ type: "SET_ERROR", error: _optionalChain([error, 'optionalAccess', _58 => _58.message]) || "Failed to prepare review" });
1908
1931
  } finally {
1909
1932
  dispatch({ type: "SET_PROCESSING", isProcessing: false });
1910
1933
  }
1911
- }, [state.selectedPrice, subscription, checkPaymentMethod]);
1934
+ }, [state.selectedPrice, state.hasPaymentMethod, subscription, checkPaymentMethod]);
1912
1935
  const confirmSubscription = _react.useCallback.call(void 0, async () => {
1913
1936
  if (!state.selectedPrice) return;
1937
+ console.log("[useSubscriptionWizard] confirmSubscription called");
1938
+ console.log("[useSubscriptionWizard] state.promotionCode:", JSON.stringify(state.promotionCode, null, 2));
1939
+ console.log("[useSubscriptionWizard] promotionCodeId to send:", _optionalChain([state, 'access', _59 => _59.promotionCode, 'optionalAccess', _60 => _60.promotionCodeId]));
1914
1940
  dispatch({ type: "SET_PROCESSING", isProcessing: true });
1915
1941
  dispatch({ type: "SET_ERROR", error: null });
1916
1942
  try {
1917
1943
  if (subscription) {
1918
- await _chunk53IPQJVHjs.StripeSubscriptionService.changePlan({
1944
+ const changePlanParams = {
1919
1945
  id: subscription.id,
1920
- newPriceId: state.selectedPrice.id
1921
- });
1946
+ newPriceId: state.selectedPrice.id,
1947
+ promotionCode: _optionalChain([state, 'access', _61 => _61.promotionCode, 'optionalAccess', _62 => _62.promotionCodeId])
1948
+ };
1949
+ console.log("[useSubscriptionWizard] changePlan params:", JSON.stringify(changePlanParams, null, 2));
1950
+ await _chunk3EZX4G2Ejs.StripeSubscriptionService.changePlan(changePlanParams);
1922
1951
  } else {
1923
- await _chunk53IPQJVHjs.StripeSubscriptionService.createSubscription({
1952
+ const createParams = {
1924
1953
  id: _uuid.v4.call(void 0, ),
1925
- priceId: state.selectedPrice.id
1926
- });
1954
+ priceId: state.selectedPrice.id,
1955
+ promotionCode: _optionalChain([state, 'access', _63 => _63.promotionCode, 'optionalAccess', _64 => _64.promotionCodeId])
1956
+ };
1957
+ console.log("[useSubscriptionWizard] createSubscription params:", JSON.stringify(createParams, null, 2));
1958
+ await _chunk3EZX4G2Ejs.StripeSubscriptionService.createSubscription(createParams);
1927
1959
  }
1928
1960
  onSuccessRef.current();
1929
1961
  onCloseRef.current();
1930
1962
  } catch (error) {
1931
1963
  console.error("[useSubscriptionWizard] Subscription error:", error);
1932
- if (_optionalChain([error, 'optionalAccess', _64 => _64.status]) === 409 || _optionalChain([error, 'optionalAccess', _65 => _65.response, 'optionalAccess', _66 => _66.status]) === 409) {
1964
+ if (_optionalChain([error, 'optionalAccess', _65 => _65.status]) === 409 || _optionalChain([error, 'optionalAccess', _66 => _66.response, 'optionalAccess', _67 => _67.status]) === 409) {
1933
1965
  dispatch({
1934
1966
  type: "SET_ERROR",
1935
1967
  error: "You already have an active subscription. Please change your existing plan instead."
1936
1968
  });
1937
1969
  return;
1938
1970
  }
1939
- if (_optionalChain([error, 'optionalAccess', _67 => _67.status]) === 402 || _optionalChain([error, 'optionalAccess', _68 => _68.response, 'optionalAccess', _69 => _69.status]) === 402) {
1971
+ if (_optionalChain([error, 'optionalAccess', _68 => _68.status]) === 402 || _optionalChain([error, 'optionalAccess', _69 => _69.response, 'optionalAccess', _70 => _70.status]) === 402) {
1940
1972
  dispatch({ type: "SET_HAS_PAYMENT_METHOD", hasMethod: false });
1941
1973
  dispatch({ type: "SET_STEP", step: "payment-method" });
1942
1974
  return;
1943
1975
  }
1944
- dispatch({ type: "SET_ERROR", error: _optionalChain([error, 'optionalAccess', _70 => _70.message]) || "Failed to process subscription" });
1976
+ dispatch({ type: "SET_ERROR", error: _optionalChain([error, 'optionalAccess', _71 => _71.message]) || "Failed to process subscription" });
1945
1977
  } finally {
1946
1978
  dispatch({ type: "SET_PROCESSING", isProcessing: false });
1947
1979
  }
1948
- }, [state.selectedPrice, subscription]);
1980
+ }, [state.selectedPrice, state.promotionCode, subscription]);
1949
1981
  const handlePaymentMethodSuccess = _react.useCallback.call(void 0, async () => {
1950
1982
  dispatch({ type: "SET_HAS_PAYMENT_METHOD", hasMethod: true });
1951
1983
  dispatch({ type: "SET_STEP", step: "review" });
@@ -1953,6 +1985,34 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
1953
1985
  const reset = _react.useCallback.call(void 0, () => {
1954
1986
  dispatch({ type: "RESET" });
1955
1987
  }, []);
1988
+ const validatePromoCode = _react.useCallback.call(void 0,
1989
+ async (code) => {
1990
+ dispatch({ type: "SET_VALIDATING_PROMO_CODE", isValidating: true });
1991
+ dispatch({ type: "SET_PROMO_CODE_ERROR", error: null });
1992
+ try {
1993
+ const result = await _chunk3EZX4G2Ejs.StripePromotionCodeService.validatePromotionCode({
1994
+ code,
1995
+ stripePriceId: _optionalChain([state, 'access', _72 => _72.selectedPrice, 'optionalAccess', _73 => _73.id])
1996
+ });
1997
+ if (result.valid) {
1998
+ dispatch({ type: "SET_PROMOTION_CODE", code: result });
1999
+ } else {
2000
+ dispatch({ type: "SET_PROMO_CODE_ERROR", error: result.errorMessage || "Invalid promotion code" });
2001
+ }
2002
+ } catch (error) {
2003
+ console.error("[useSubscriptionWizard] Promo code validation error:", error);
2004
+ dispatch({ type: "SET_PROMO_CODE_ERROR", error: _optionalChain([error, 'optionalAccess', _74 => _74.message]) || "Failed to validate promotion code" });
2005
+ } finally {
2006
+ dispatch({ type: "SET_VALIDATING_PROMO_CODE", isValidating: false });
2007
+ }
2008
+ },
2009
+ [_optionalChain([state, 'access', _75 => _75.selectedPrice, 'optionalAccess', _76 => _76.id])]
2010
+ );
2011
+ const clearPromoCode = _react.useCallback.call(void 0, () => {
2012
+ dispatch({ type: "SET_PROMOTION_CODE", code: null });
2013
+ dispatch({ type: "SET_PROMO_CODE_ERROR", error: null });
2014
+ dispatch({ type: "SET_ERROR", error: null });
2015
+ }, []);
1956
2016
  const actions = _react.useMemo.call(void 0,
1957
2017
  () => ({
1958
2018
  selectPrice,
@@ -1962,7 +2022,9 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
1962
2022
  confirmSubscription,
1963
2023
  handlePaymentMethodSuccess,
1964
2024
  checkPaymentMethod,
1965
- reset
2025
+ reset,
2026
+ validatePromoCode,
2027
+ clearPromoCode
1966
2028
  }),
1967
2029
  [
1968
2030
  selectPrice,
@@ -1972,7 +2034,9 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
1972
2034
  confirmSubscription,
1973
2035
  handlePaymentMethodSuccess,
1974
2036
  checkPaymentMethod,
1975
- reset
2037
+ reset,
2038
+ validatePromoCode,
2039
+ clearPromoCode
1976
2040
  ]
1977
2041
  );
1978
2042
  return {
@@ -2033,7 +2097,7 @@ function WizardStepPlanSelection({
2033
2097
  _react.useEffect.call(void 0, () => {
2034
2098
  const loadProducts = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
2035
2099
  try {
2036
- const fetchedProducts = await _chunk53IPQJVHjs.StripeProductService.listProducts({ active: true });
2100
+ const fetchedProducts = await _chunk3EZX4G2Ejs.StripeProductService.listProducts({ active: true });
2037
2101
  setProducts(fetchedProducts);
2038
2102
  } catch (error) {
2039
2103
  console.error("[WizardStepPlanSelection] Failed to load products:", error);
@@ -2048,10 +2112,10 @@ function WizardStepPlanSelection({
2048
2112
  let hasYearly2 = false;
2049
2113
  for (const product of products) {
2050
2114
  for (const price of product.stripePrices || []) {
2051
- if (price.priceType === "recurring" && _optionalChain([price, 'access', _71 => _71.recurring, 'optionalAccess', _72 => _72.interval]) === "month") {
2115
+ if (price.priceType === "recurring" && _optionalChain([price, 'access', _77 => _77.recurring, 'optionalAccess', _78 => _78.interval]) === "month") {
2052
2116
  hasMonthly2 = true;
2053
2117
  }
2054
- if (price.priceType === "recurring" && _optionalChain([price, 'access', _73 => _73.recurring, 'optionalAccess', _74 => _74.interval]) === "year") {
2118
+ if (price.priceType === "recurring" && _optionalChain([price, 'access', _79 => _79.recurring, 'optionalAccess', _80 => _80.interval]) === "year") {
2055
2119
  hasYearly2 = true;
2056
2120
  }
2057
2121
  }
@@ -2077,14 +2141,14 @@ function WizardStepPlanSelection({
2077
2141
  products,
2078
2142
  selectedInterval,
2079
2143
  currentPriceId,
2080
- selectedPriceId: _optionalChain([selectedPrice, 'optionalAccess', _75 => _75.id]),
2144
+ selectedPriceId: _optionalChain([selectedPrice, 'optionalAccess', _81 => _81.id]),
2081
2145
  loading,
2082
2146
  hideRecurringPrices,
2083
2147
  hideOneTimePrices,
2084
2148
  onSelectPrice: handleSelectPrice
2085
2149
  }
2086
2150
  ),
2087
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex justify-end pt-4 border-t", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Button, { onClick: onNext, disabled: !selectedPrice || isProcessing, children: isProcessing ? "Loading..." : "Next: Review" }) })
2151
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex justify-end pt-4 border-t", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Button, { onClick: onNext, disabled: !selectedPrice || isProcessing, children: isProcessing ? "Loading..." : "Next: Review" }) })
2088
2152
  ] });
2089
2153
  }
2090
2154
  _chunk7QVYU63Ejs.__name.call(void 0, WizardStepPlanSelection, "WizardStepPlanSelection");
@@ -2092,6 +2156,95 @@ _chunk7QVYU63Ejs.__name.call(void 0, WizardStepPlanSelection, "WizardStepPlanSel
2092
2156
  // src/features/billing/stripe-subscription/components/wizards/WizardStepReview.tsx
2093
2157
 
2094
2158
 
2159
+ // src/features/billing/stripe-promotion-code/components/PromoCodeInput.tsx
2160
+
2161
+
2162
+
2163
+ function PromoCodeInput({
2164
+ appliedCode,
2165
+ isValidating,
2166
+ error,
2167
+ onApply,
2168
+ onRemove,
2169
+ disabled = false
2170
+ }) {
2171
+ const [code, setCode] = _react.useState.call(void 0, "");
2172
+ const handleApply = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
2173
+ if (code.trim()) {
2174
+ onApply(code.trim().toUpperCase());
2175
+ }
2176
+ }, "handleApply");
2177
+ const handleKeyDown = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (e) => {
2178
+ if (e.key === "Enter") {
2179
+ e.preventDefault();
2180
+ handleApply();
2181
+ }
2182
+ }, "handleKeyDown");
2183
+ const formatDiscount = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (result) => {
2184
+ if (result.discountType === "percent_off") {
2185
+ return `${result.discountValue}% off`;
2186
+ }
2187
+ const amount = (result.discountValue || 0) / 100;
2188
+ const currency = _optionalChain([result, 'access', _82 => _82.currency, 'optionalAccess', _83 => _83.toUpperCase, 'call', _84 => _84()]) || "USD";
2189
+ return `${currency} ${amount.toFixed(2)} off`;
2190
+ }, "formatDiscount");
2191
+ const formatDuration = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (result) => {
2192
+ switch (result.duration) {
2193
+ case "forever":
2194
+ return "Applied to all payments";
2195
+ case "once":
2196
+ return "Applied to first payment only";
2197
+ case "repeating":
2198
+ return `Applied for ${result.durationInMonths} months`;
2199
+ default:
2200
+ return "";
2201
+ }
2202
+ }, "formatDuration");
2203
+ if (_optionalChain([appliedCode, 'optionalAccess', _85 => _85.valid])) {
2204
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
2205
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center justify-between p-3 bg-green-50 border border-green-200 rounded-lg", children: [
2206
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
2207
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Check, { className: "h-4 w-4 text-green-600" }),
2208
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "font-medium text-green-800", children: appliedCode.code }),
2209
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-green-600", children: formatDiscount(appliedCode) })
2210
+ ] }),
2211
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2212
+ _chunkBYMBRMKSjs.Button,
2213
+ {
2214
+ variant: "ghost",
2215
+ size: "sm",
2216
+ onClick: onRemove,
2217
+ disabled,
2218
+ className: "text-green-700 hover:text-green-900 hover:bg-green-100",
2219
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.X, { className: "h-4 w-4" })
2220
+ }
2221
+ )
2222
+ ] }),
2223
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-green-600", children: formatDuration(appliedCode) })
2224
+ ] });
2225
+ }
2226
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
2227
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
2228
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2229
+ _chunkBYMBRMKSjs.Input,
2230
+ {
2231
+ placeholder: "Enter promo code",
2232
+ value: code,
2233
+ onChange: (e) => setCode(e.target.value.toUpperCase()),
2234
+ onKeyDown: handleKeyDown,
2235
+ disabled: disabled || isValidating,
2236
+ className: "flex-1"
2237
+ }
2238
+ ),
2239
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.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" })
2240
+ ] }),
2241
+ error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-red-500", children: error })
2242
+ ] });
2243
+ }
2244
+ _chunk7QVYU63Ejs.__name.call(void 0, PromoCodeInput, "PromoCodeInput");
2245
+
2246
+ // src/features/billing/stripe-subscription/components/wizards/WizardStepReview.tsx
2247
+
2095
2248
  function WizardStepReview({
2096
2249
  selectedPrice,
2097
2250
  subscription,
@@ -2101,53 +2254,121 @@ function WizardStepReview({
2101
2254
  isProcessing,
2102
2255
  onBack,
2103
2256
  onAddPaymentMethod,
2104
- onConfirm
2257
+ onConfirm,
2258
+ promotionCode,
2259
+ isValidatingPromoCode,
2260
+ promoCodeError,
2261
+ onApplyPromoCode,
2262
+ onRemovePromoCode,
2263
+ isTrialUpgrade
2105
2264
  }) {
2106
2265
  if (!selectedPrice) {
2107
2266
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-center py-8 text-muted-foreground", children: "No plan selected. Please go back and select a plan." });
2108
2267
  }
2109
- const isChangingPlan = subscription && _optionalChain([subscription, 'access', _76 => _76.price, 'optionalAccess', _77 => _77.id]) !== selectedPrice.id;
2268
+ const isChangingPlan = subscription && _optionalChain([subscription, 'access', _86 => _86.price, 'optionalAccess', _87 => _87.id]) !== selectedPrice.id;
2110
2269
  const formatInterval2 = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (price) => {
2111
2270
  if (price.priceType === "one_time") return "one-time";
2112
- const interval = _optionalChain([price, 'access', _78 => _78.recurring, 'optionalAccess', _79 => _79.interval]) || "month";
2271
+ const interval = _optionalChain([price, 'access', _88 => _88.recurring, 'optionalAccess', _89 => _89.interval]) || "month";
2113
2272
  return interval === "year" ? "yearly" : "monthly";
2114
2273
  }, "formatInterval");
2274
+ const calculateDiscountedPrice = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
2275
+ if (!_optionalChain([promotionCode, 'optionalAccess', _90 => _90.valid]) || !selectedPrice.unitAmount) return null;
2276
+ const originalPrice = selectedPrice.unitAmount;
2277
+ if (promotionCode.discountType === "percent_off" && promotionCode.discountValue) {
2278
+ return originalPrice * (1 - promotionCode.discountValue / 100);
2279
+ }
2280
+ if (promotionCode.discountType === "amount_off" && promotionCode.discountValue) {
2281
+ return Math.max(0, originalPrice - promotionCode.discountValue);
2282
+ }
2283
+ return null;
2284
+ }, "calculateDiscountedPrice");
2285
+ const discountedPrice = calculateDiscountedPrice();
2286
+ const calculateDiscountedImmediateCharge = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
2287
+ if (!_optionalChain([promotionCode, 'optionalAccess', _91 => _91.valid]) || !_optionalChain([prorationPreview, 'optionalAccess', _92 => _92.immediateCharge])) return null;
2288
+ const originalCharge = prorationPreview.immediateCharge;
2289
+ if (promotionCode.discountType === "percent_off" && promotionCode.discountValue) {
2290
+ return originalCharge * (1 - promotionCode.discountValue / 100);
2291
+ }
2292
+ if (promotionCode.discountType === "amount_off" && promotionCode.discountValue) {
2293
+ return Math.max(0, originalCharge - promotionCode.discountValue);
2294
+ }
2295
+ return null;
2296
+ }, "calculateDiscountedImmediateCharge");
2297
+ const discountedImmediateCharge = calculateDiscountedImmediateCharge();
2298
+ const getDiscountDescription = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
2299
+ if (!_optionalChain([promotionCode, 'optionalAccess', _93 => _93.valid])) return null;
2300
+ if (promotionCode.discountType === "percent_off" && promotionCode.discountValue) {
2301
+ return `${promotionCode.discountValue}% off`;
2302
+ }
2303
+ if (promotionCode.discountType === "amount_off" && promotionCode.discountValue) {
2304
+ return `${formatCurrency(promotionCode.discountValue, promotionCode.currency || selectedPrice.currency)} off`;
2305
+ }
2306
+ return null;
2307
+ }, "getDiscountDescription");
2308
+ const discountDescription = getDiscountDescription();
2115
2309
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
2116
2310
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-muted/50 rounded-lg p-4 space-y-3", children: [
2117
2311
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "font-semibold text-lg", children: "Selected Plan" }),
2118
2312
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between items-center", children: [
2119
2313
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
2120
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-medium", children: _optionalChain([selectedPrice, 'access', _80 => _80.product, 'optionalAccess', _81 => _81.name]) }),
2314
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-medium", children: _optionalChain([selectedPrice, 'access', _94 => _94.product, 'optionalAccess', _95 => _95.name]) }),
2121
2315
  selectedPrice.nickname && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: selectedPrice.nickname })
2122
2316
  ] }),
2123
2317
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-right", children: [
2124
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-semibold text-lg", children: formatCurrency(selectedPrice.unitAmount || 0, selectedPrice.currency) }),
2318
+ discountedPrice !== null ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
2319
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground line-through", children: formatCurrency(selectedPrice.unitAmount || 0, selectedPrice.currency) }),
2320
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-semibold text-lg text-green-600", children: formatCurrency(discountedPrice, selectedPrice.currency) }),
2321
+ discountDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "inline-block text-xs bg-green-100 text-green-700 px-2 py-0.5 rounded-full", children: discountDescription })
2322
+ ] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-semibold text-lg", children: formatCurrency(selectedPrice.unitAmount || 0, selectedPrice.currency) }),
2125
2323
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: formatInterval2(selectedPrice) })
2126
2324
  ] })
2127
2325
  ] })
2128
2326
  ] }),
2129
- isChangingPlan && prorationPreview && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-blue-50 border border-blue-200 rounded-lg p-4 space-y-2", children: [
2130
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "font-medium text-blue-800", children: "Proration Summary" }),
2131
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-blue-700", children: "Your next charge will be adjusted to account for the plan change." }),
2132
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between text-sm", children: [
2133
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-blue-600", children: "Amount due now:" }),
2134
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "font-medium text-blue-800", children: formatCurrency(prorationPreview.immediateCharge, prorationPreview.currency) })
2135
- ] })
2327
+ isChangingPlan && prorationPreview && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
2328
+ "div",
2329
+ {
2330
+ className: `${isTrialUpgrade ? "bg-amber-50 border-amber-200" : "bg-blue-50 border-blue-200"} border rounded-lg p-4 space-y-2`,
2331
+ children: [
2332
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: `font-medium ${isTrialUpgrade ? "text-amber-800" : "text-blue-800"}`, children: isTrialUpgrade ? "Trial Upgrade" : "Proration Summary" }),
2333
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: `text-sm ${isTrialUpgrade ? "text-amber-700" : "text-blue-700"}`, children: isTrialUpgrade ? "Your trial will end immediately and you will be charged the full price." : "Your next charge will be adjusted to account for the plan change." }),
2334
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between text-sm", children: [
2335
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `${isTrialUpgrade ? "text-amber-600" : "text-blue-600"}`, children: isTrialUpgrade ? "Amount to charge now:" : "Amount due now:" }),
2336
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `font-medium ${isTrialUpgrade ? "text-amber-800" : "text-blue-800"}`, children: discountedImmediateCharge !== null ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
2337
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "line-through text-muted-foreground mr-2", children: formatCurrency(prorationPreview.immediateCharge, prorationPreview.currency) }),
2338
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-green-600", children: formatCurrency(discountedImmediateCharge, prorationPreview.currency) })
2339
+ ] }) : formatCurrency(prorationPreview.immediateCharge, prorationPreview.currency) })
2340
+ ] })
2341
+ ]
2342
+ }
2343
+ ),
2344
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "border rounded-lg p-4 space-y-3", children: [
2345
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "font-medium", children: "Promotion Code" }),
2346
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2347
+ PromoCodeInput,
2348
+ {
2349
+ appliedCode: promotionCode,
2350
+ isValidating: isValidatingPromoCode,
2351
+ error: promoCodeError,
2352
+ onApply: onApplyPromoCode,
2353
+ onRemove: onRemovePromoCode,
2354
+ disabled: isProcessing
2355
+ }
2356
+ )
2136
2357
  ] }),
2137
2358
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg p-4", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between items-center", children: [
2138
2359
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
2139
2360
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "font-medium", children: "Payment Method" }),
2140
2361
  /* @__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" })
2141
2362
  ] }),
2142
- !hasPaymentMethod && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Button, { variant: "outline", onClick: onAddPaymentMethod, children: "Add Payment Method" })
2363
+ !hasPaymentMethod && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Button, { variant: "outline", onClick: onAddPaymentMethod, children: "Add Payment Method" })
2143
2364
  ] }) }),
2144
- error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.Alert, { variant: "destructive", children: [
2365
+ error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.Alert, { variant: "destructive", children: [
2145
2366
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.AlertCircle, { className: "h-4 w-4" }),
2146
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.AlertDescription, { children: error })
2367
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.AlertDescription, { children: error })
2147
2368
  ] }),
2148
2369
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between pt-4 border-t", children: [
2149
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Button, { variant: "outline", onClick: onBack, disabled: isProcessing, children: "Back" }),
2150
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Button, { onClick: hasPaymentMethod ? onConfirm : onAddPaymentMethod, disabled: isProcessing, children: isProcessing ? "Processing..." : hasPaymentMethod ? isChangingPlan ? "Confirm Plan Change" : "Subscribe Now" : "Add Payment Method" })
2370
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Button, { variant: "outline", onClick: onBack, disabled: isProcessing, children: "Back" }),
2371
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Button, { onClick: hasPaymentMethod ? onConfirm : onAddPaymentMethod, disabled: isProcessing, children: isProcessing ? "Processing..." : hasPaymentMethod ? isChangingPlan ? "Confirm Plan Change" : "Subscribe Now" : "Add Payment Method" })
2151
2372
  ] })
2152
2373
  ] });
2153
2374
  }
@@ -2200,10 +2421,10 @@ function SubscriptionWizard({
2200
2421
  const isChangePlanMode = !!subscription;
2201
2422
  const dialogTitle = subscription ? "Change Subscription Plan" : isPurchasingAddons ? "Purchase Add-ons" : "Subscribe to a Plan";
2202
2423
  const dialogDescription = subscription ? "Select a new plan for your subscription" : isPurchasingAddons ? "Select one-time products to purchase" : "Choose a subscription plan to get started";
2203
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.DialogContent, { className: "max-w-2xl", children: [
2204
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.DialogHeader, { children: [
2205
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.DialogTitle, { children: dialogTitle }),
2206
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.DialogDescription, { children: dialogDescription })
2424
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.DialogContent, { className: "max-w-2xl", children: [
2425
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.DialogHeader, { children: [
2426
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.DialogTitle, { children: dialogTitle }),
2427
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.DialogDescription, { children: dialogDescription })
2207
2428
  ] }),
2208
2429
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, WizardProgressIndicator, { currentStep: state.step }),
2209
2430
  state.step === "plan-selection" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -2211,7 +2432,7 @@ function SubscriptionWizard({
2211
2432
  {
2212
2433
  selectedPrice: state.selectedPrice,
2213
2434
  selectedInterval: state.selectedInterval,
2214
- currentPriceId: _optionalChain([subscription, 'optionalAccess', _82 => _82.price, 'optionalAccess', _83 => _83.id]),
2435
+ currentPriceId: _optionalChain([subscription, 'optionalAccess', _96 => _96.price, 'optionalAccess', _97 => _97.id]),
2215
2436
  hideRecurringPrices: isPurchasingAddons,
2216
2437
  hideOneTimePrices: isChangePlanMode,
2217
2438
  onSelectPrice: actions.selectPrice,
@@ -2231,7 +2452,13 @@ function SubscriptionWizard({
2231
2452
  isProcessing: state.isProcessing,
2232
2453
  onBack: () => actions.goToStep("plan-selection"),
2233
2454
  onAddPaymentMethod: () => actions.goToStep("payment-method"),
2234
- onConfirm: actions.confirmSubscription
2455
+ onConfirm: actions.confirmSubscription,
2456
+ promotionCode: state.promotionCode,
2457
+ isValidatingPromoCode: state.isValidatingPromoCode,
2458
+ promoCodeError: state.promoCodeError,
2459
+ onApplyPromoCode: actions.validatePromoCode,
2460
+ onRemovePromoCode: actions.clearPromoCode,
2461
+ isTrialUpgrade: state.isTrialSubscription
2235
2462
  }
2236
2463
  ),
2237
2464
  state.step === "payment-method" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -2273,22 +2500,22 @@ function formatDate4(date) {
2273
2500
  }
2274
2501
  _chunk7QVYU63Ejs.__name.call(void 0, formatDate4, "formatDate");
2275
2502
  function UsageSummaryCard({ meter, summary }) {
2276
- const currentUsage = _nullishCoalesce(_optionalChain([summary, 'optionalAccess', _84 => _84.aggregatedValue]), () => ( 0));
2503
+ const currentUsage = _nullishCoalesce(_optionalChain([summary, 'optionalAccess', _98 => _98.aggregatedValue]), () => ( 0));
2277
2504
  const limit = meter.limit;
2278
2505
  const percentage = limit && limit > 0 ? currentUsage / limit * 100 : null;
2279
2506
  const progressColor = getProgressColor(percentage);
2280
2507
  const progressWidth = percentage !== null ? Math.min(percentage, 100) : 0;
2281
2508
  const displayName = meter.displayName || meter.eventName;
2282
2509
  const hasLimit = limit !== null && limit !== void 0;
2283
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.Card, { children: [
2284
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.CardHeader, { className: "flex flex-row items-center gap-x-3 pb-3", children: [
2510
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.Card, { children: [
2511
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.CardHeader, { className: "flex flex-row items-center gap-x-3 pb-3", children: [
2285
2512
  /* @__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" }) }),
2286
2513
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col", children: [
2287
2514
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "font-semibold", children: displayName }),
2288
2515
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-gray-500", children: meter.id })
2289
2516
  ] })
2290
2517
  ] }),
2291
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.CardContent, { className: "flex flex-col gap-y-4", children: [
2518
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.CardContent, { className: "flex flex-col gap-y-4", children: [
2292
2519
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
2293
2520
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-3xl font-bold", children: currentUsage.toLocaleString() }),
2294
2521
  hasLimit && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm text-gray-500", children: [
@@ -2300,7 +2527,7 @@ function UsageSummaryCard({ meter, summary }) {
2300
2527
  hasLimit ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-2", children: [
2301
2528
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-2 w-full overflow-hidden rounded-full bg-gray-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: `h-full transition-all ${progressColor}`, style: { width: `${progressWidth}%` } }) }),
2302
2529
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm text-gray-500", children: [
2303
- _optionalChain([percentage, 'optionalAccess', _85 => _85.toFixed, 'call', _86 => _86(1)]),
2530
+ _optionalChain([percentage, 'optionalAccess', _99 => _99.toFixed, 'call', _100 => _100(1)]),
2304
2531
  "% used"
2305
2532
  ] })
2306
2533
  ] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-gray-500", children: "No limit set" }),
@@ -2335,14 +2562,14 @@ function UsageContainer() {
2335
2562
  const loadUsageData = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
2336
2563
  setLoading(true);
2337
2564
  try {
2338
- const fetchedSubscriptions = await _chunk53IPQJVHjs.StripeSubscriptionService.listSubscriptions();
2565
+ const fetchedSubscriptions = await _chunk3EZX4G2Ejs.StripeSubscriptionService.listSubscriptions();
2339
2566
  setSubscriptions(fetchedSubscriptions);
2340
- const hasMeteredSubscriptions2 = fetchedSubscriptions.some((sub) => _optionalChain([sub, 'access', _87 => _87.price, 'optionalAccess', _88 => _88.recurring, 'optionalAccess', _89 => _89.usageType]) === "metered");
2567
+ const hasMeteredSubscriptions2 = fetchedSubscriptions.some((sub) => _optionalChain([sub, 'access', _101 => _101.price, 'optionalAccess', _102 => _102.recurring, 'optionalAccess', _103 => _103.usageType]) === "metered");
2341
2568
  if (!hasMeteredSubscriptions2) {
2342
2569
  setLoading(false);
2343
2570
  return;
2344
2571
  }
2345
- const fetchedMeters = await _chunk53IPQJVHjs.StripeUsageService.listMeters();
2572
+ const fetchedMeters = await _chunk3EZX4G2Ejs.StripeUsageService.listMeters();
2346
2573
  setMeters(fetchedMeters);
2347
2574
  const summariesMap = {};
2348
2575
  const now = /* @__PURE__ */ new Date();
@@ -2350,7 +2577,7 @@ function UsageContainer() {
2350
2577
  const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
2351
2578
  for (const meter of fetchedMeters) {
2352
2579
  try {
2353
- const meterSummaries = await _chunk53IPQJVHjs.StripeUsageService.getMeterSummaries({
2580
+ const meterSummaries = await _chunk3EZX4G2Ejs.StripeUsageService.getMeterSummaries({
2354
2581
  meterId: meter.id,
2355
2582
  startTime: startOfMonth,
2356
2583
  endTime: endOfMonth
@@ -2368,7 +2595,7 @@ function UsageContainer() {
2368
2595
  setLoading(false);
2369
2596
  }
2370
2597
  }, "loadUsageData");
2371
- const hasMeteredSubscriptions = subscriptions.some((sub) => _optionalChain([sub, 'access', _90 => _90.price, 'optionalAccess', _91 => _91.recurring, 'optionalAccess', _92 => _92.usageType]) === "metered");
2598
+ const hasMeteredSubscriptions = subscriptions.some((sub) => _optionalChain([sub, 'access', _104 => _104.price, 'optionalAccess', _105 => _105.recurring, 'optionalAccess', _106 => _106.usageType]) === "metered");
2372
2599
  if (!loading && !hasMeteredSubscriptions) {
2373
2600
  return null;
2374
2601
  }
@@ -2416,21 +2643,21 @@ function UsageHistoryTable({ usageRecords }) {
2416
2643
  }
2417
2644
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
2418
2645
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h2", { className: "text-xl font-semibold", children: "Usage History" }),
2419
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-clip rounded-lg border", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.Table, { children: [
2420
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.TableRow, { children: [
2421
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.TableHead, { children: "Date & Time" }),
2422
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.TableHead, { children: "Meter Event" }),
2423
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.TableHead, { className: "text-right", children: "Quantity" }),
2424
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.TableHead, { children: "Event ID" })
2646
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-clip rounded-lg border", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.Table, { children: [
2647
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.TableRow, { children: [
2648
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.TableHead, { children: "Date & Time" }),
2649
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.TableHead, { children: "Meter Event" }),
2650
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.TableHead, { className: "text-right", children: "Quantity" }),
2651
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.TableHead, { children: "Event ID" })
2425
2652
  ] }) }),
2426
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.TableBody, { children: usageRecords.map((record) => {
2653
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.TableBody, { children: usageRecords.map((record) => {
2427
2654
  const dateTime = formatDateTime(record.timestamp);
2428
2655
  const quantity = record.quantity.toLocaleString();
2429
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.TableRow, { children: [
2430
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.TableCell, { className: "font-medium", children: dateTime }),
2431
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.TableCell, { className: "text-muted-foreground", children: record.meterEventName }),
2432
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.TableCell, { className: "text-right font-medium", children: quantity }),
2433
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.TableCell, { className: "text-muted-foreground text-sm font-mono", children: record.stripeEventId })
2656
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.TableRow, { children: [
2657
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.TableCell, { className: "font-medium", children: dateTime }),
2658
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.TableCell, { className: "text-muted-foreground", children: record.meterEventName }),
2659
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.TableCell, { className: "text-right font-medium", children: quantity }),
2660
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.TableCell, { className: "text-muted-foreground text-sm font-mono", children: record.stripeEventId })
2434
2661
  ] }, record.id);
2435
2662
  }) })
2436
2663
  ] }) })
@@ -2441,8 +2668,8 @@ _chunk7QVYU63Ejs.__name.call(void 0, UsageHistoryTable, "UsageHistoryTable");
2441
2668
  // src/features/billing/components/modals/BillingDetailModal.tsx
2442
2669
 
2443
2670
  function BillingDetailModal({ open, onOpenChange, title, children, className }) {
2444
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.DialogContent, { className: _nullishCoalesce(className, () => ( "max-w-4xl max-h-[90vh] overflow-y-auto")), children: [
2445
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.DialogHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.DialogTitle, { children: title }) }),
2671
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.DialogContent, { className: _nullishCoalesce(className, () => ( "max-w-4xl max-h-[90vh] overflow-y-auto")), children: [
2672
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.DialogHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.DialogTitle, { children: title }) }),
2446
2673
  children
2447
2674
  ] }) });
2448
2675
  }
@@ -2459,7 +2686,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
2459
2686
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "font-semibold text-red-900", children: "Payment Failed" }),
2460
2687
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-red-700 mt-1", children: "Your last payment failed. Please update your payment method to avoid service interruption." })
2461
2688
  ] }),
2462
- onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Button, { variant: "outline", size: "sm", onClick: onUpdatePayment, className: "border-red-300 text-red-700", children: "Update Payment Method" })
2689
+ onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Button, { variant: "outline", size: "sm", onClick: onUpdatePayment, className: "border-red-300 text-red-700", children: "Update Payment Method" })
2463
2690
  ] });
2464
2691
  }
2465
2692
  if (subscription.status === "trialing" /* TRIALING */ && subscription.trialEnd) {
@@ -2479,7 +2706,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
2479
2706
  ". Add a payment method to continue your subscription."
2480
2707
  ] })
2481
2708
  ] }),
2482
- onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Button, { variant: "outline", size: "sm", onClick: onAddPayment, className: "border-yellow-300 text-yellow-700", children: "Add Payment Method" })
2709
+ onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Button, { variant: "outline", size: "sm", onClick: onAddPayment, className: "border-yellow-300 text-yellow-700", children: "Add Payment Method" })
2483
2710
  ] });
2484
2711
  }
2485
2712
  }
@@ -2519,18 +2746,18 @@ function BillingDashboardContainer() {
2519
2746
  const [showWizard, setShowWizard] = _react.useState.call(void 0, false);
2520
2747
  const [editingSubscription, setEditingSubscription] = _react.useState.call(void 0, null);
2521
2748
  const hasMeteredSubscriptions = _react.useCallback.call(void 0, () => {
2522
- return data.subscriptions.some((sub) => _optionalChain([sub, 'access', _93 => _93.price, 'optionalAccess', _94 => _94.recurring, 'optionalAccess', _95 => _95.usageType]) === "metered");
2749
+ return data.subscriptions.some((sub) => _optionalChain([sub, 'access', _107 => _107.price, 'optionalAccess', _108 => _108.recurring, 'optionalAccess', _109 => _109.usageType]) === "metered");
2523
2750
  }, [data.subscriptions]);
2524
2751
  const hasActiveRecurringSubscription = _react.useMemo.call(void 0, () => {
2525
2752
  return data.subscriptions.some(
2526
- (sub) => (sub.status === "active" /* ACTIVE */ || sub.status === "trialing" /* TRIALING */) && _optionalChain([sub, 'access', _96 => _96.price, 'optionalAccess', _97 => _97.priceType]) === "recurring"
2753
+ (sub) => (sub.status === "active" /* ACTIVE */ || sub.status === "trialing" /* TRIALING */) && _optionalChain([sub, 'access', _110 => _110.price, 'optionalAccess', _111 => _111.priceType]) === "recurring"
2527
2754
  );
2528
2755
  }, [data.subscriptions]);
2529
2756
  const fetchAllData = _react.useCallback.call(void 0, async () => {
2530
2757
  setNoCustomerExists(false);
2531
2758
  let customer = null;
2532
2759
  try {
2533
- customer = await _chunk53IPQJVHjs.StripeCustomerService.getCustomer();
2760
+ customer = await _chunk3EZX4G2Ejs.StripeCustomerService.getCustomer();
2534
2761
  setData((prev) => ({ ...prev, customer }));
2535
2762
  setErrors((prev) => ({ ...prev, customer: null }));
2536
2763
  setNoCustomerExists(false);
@@ -2555,7 +2782,7 @@ function BillingDashboardContainer() {
2555
2782
  if (customer) {
2556
2783
  const fetchSubscriptions = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
2557
2784
  try {
2558
- const subscriptions2 = await _chunk53IPQJVHjs.StripeSubscriptionService.listSubscriptions();
2785
+ const subscriptions2 = await _chunk3EZX4G2Ejs.StripeSubscriptionService.listSubscriptions();
2559
2786
  setData((prev) => ({ ...prev, subscriptions: subscriptions2 }));
2560
2787
  setErrors((prev) => ({ ...prev, subscriptions: null }));
2561
2788
  return subscriptions2;
@@ -2569,7 +2796,7 @@ function BillingDashboardContainer() {
2569
2796
  }, "fetchSubscriptions");
2570
2797
  const fetchPaymentMethods = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
2571
2798
  try {
2572
- const paymentMethods = await _chunk53IPQJVHjs.StripeCustomerService.listPaymentMethods();
2799
+ const paymentMethods = await _chunk3EZX4G2Ejs.StripeCustomerService.listPaymentMethods();
2573
2800
  setData((prev) => ({ ...prev, paymentMethods }));
2574
2801
  setErrors((prev) => ({ ...prev, paymentMethods: null }));
2575
2802
  } catch (error) {
@@ -2581,7 +2808,7 @@ function BillingDashboardContainer() {
2581
2808
  }, "fetchPaymentMethods");
2582
2809
  const fetchInvoices = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
2583
2810
  try {
2584
- const invoices = await _chunk53IPQJVHjs.StripeInvoiceService.listInvoices();
2811
+ const invoices = await _chunk3EZX4G2Ejs.StripeInvoiceService.listInvoices();
2585
2812
  setData((prev) => ({ ...prev, invoices }));
2586
2813
  setErrors((prev) => ({ ...prev, invoices: null }));
2587
2814
  } catch (error) {
@@ -2593,7 +2820,7 @@ function BillingDashboardContainer() {
2593
2820
  }, "fetchInvoices");
2594
2821
  const [subscriptions] = await Promise.all([fetchSubscriptions(), fetchPaymentMethods(), fetchInvoices()]);
2595
2822
  const hasMetered = subscriptions.some(
2596
- (sub) => _optionalChain([sub, 'access', _98 => _98.price, 'optionalAccess', _99 => _99.recurring, 'optionalAccess', _100 => _100.usageType]) === "metered"
2823
+ (sub) => _optionalChain([sub, 'access', _112 => _112.price, 'optionalAccess', _113 => _113.recurring, 'optionalAccess', _114 => _114.usageType]) === "metered"
2597
2824
  );
2598
2825
  if (hasMetered) {
2599
2826
  await fetchUsageData();
@@ -2605,7 +2832,7 @@ function BillingDashboardContainer() {
2605
2832
  const handleCreateCustomer = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
2606
2833
  setCreatingCustomer(true);
2607
2834
  try {
2608
- await _chunk53IPQJVHjs.StripeCustomerService.createCustomer();
2835
+ await _chunk3EZX4G2Ejs.StripeCustomerService.createCustomer();
2609
2836
  setNoCustomerExists(false);
2610
2837
  await fetchAllData();
2611
2838
  } catch (error) {
@@ -2617,7 +2844,7 @@ function BillingDashboardContainer() {
2617
2844
  }, "handleCreateCustomer");
2618
2845
  const fetchUsageData = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
2619
2846
  try {
2620
- const meters = await _chunk53IPQJVHjs.StripeUsageService.listMeters();
2847
+ const meters = await _chunk3EZX4G2Ejs.StripeUsageService.listMeters();
2621
2848
  setData((prev) => ({ ...prev, meters }));
2622
2849
  const summariesMap = {};
2623
2850
  const now = /* @__PURE__ */ new Date();
@@ -2625,7 +2852,7 @@ function BillingDashboardContainer() {
2625
2852
  const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
2626
2853
  for (const meter of meters) {
2627
2854
  try {
2628
- const meterSummaries = await _chunk53IPQJVHjs.StripeUsageService.getMeterSummaries({
2855
+ const meterSummaries = await _chunk3EZX4G2Ejs.StripeUsageService.getMeterSummaries({
2629
2856
  meterId: meter.id,
2630
2857
  startTime: startOfMonth,
2631
2858
  endTime: endOfMonth
@@ -2703,18 +2930,18 @@ function BillingDashboardContainer() {
2703
2930
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-8 w-8" }),
2704
2931
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-3xl font-bold", children: "Billing" })
2705
2932
  ] }),
2706
- isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.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" }) }) }),
2707
- noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.Card, { children: [
2708
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.CardHeader, { className: "text-center", children: [
2933
+ isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.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" }) }) }),
2934
+ noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.Card, { children: [
2935
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.CardHeader, { className: "text-center", children: [
2709
2936
  /* @__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" }) }),
2710
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.CardTitle, { children: "Set Up Billing" }),
2711
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.CardDescription, { children: "Your company doesn't have a billing account yet. Set one up to manage subscriptions, payment methods, and view invoices." })
2937
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.CardTitle, { children: "Set Up Billing" }),
2938
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.CardDescription, { children: "Your company doesn't have a billing account yet. Set one up to manage subscriptions, payment methods, and view invoices." })
2712
2939
  ] }),
2713
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.CardContent, { className: "flex justify-center pb-8", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Button, { onClick: handleCreateCustomer, disabled: creatingCustomer, size: "lg", children: creatingCustomer ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
2940
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.CardContent, { className: "flex justify-center pb-8", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Button, { onClick: handleCreateCustomer, disabled: creatingCustomer, size: "lg", children: creatingCustomer ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
2714
2941
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "mr-2 h-4 w-4 animate-spin" }),
2715
2942
  "Setting up..."
2716
2943
  ] }) : "Set Up Billing Account" }) }),
2717
- errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.CardContent, { className: "pt-0", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-center text-sm text-destructive", children: errors.customer }) })
2944
+ errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.CardContent, { className: "pt-0", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-center text-sm text-destructive", children: errors.customer }) })
2718
2945
  ] }),
2719
2946
  !noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
2720
2947
  criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -2746,7 +2973,7 @@ function BillingDashboardContainer() {
2746
2973
  PaymentMethodSummaryCard,
2747
2974
  {
2748
2975
  paymentMethods: data.paymentMethods,
2749
- defaultPaymentMethodId: _optionalChain([data, 'access', _101 => _101.customer, 'optionalAccess', _102 => _102.defaultPaymentMethodId]),
2976
+ defaultPaymentMethodId: _optionalChain([data, 'access', _115 => _115.customer, 'optionalAccess', _116 => _116.defaultPaymentMethodId]),
2750
2977
  loading: loading.paymentMethods,
2751
2978
  error: errors.paymentMethods || void 0,
2752
2979
  onManageClick: () => setActiveModal("payment-methods")
@@ -2847,7 +3074,7 @@ function getStripePromise(publishableKey) {
2847
3074
  if (!publishableKey) {
2848
3075
  return Promise.resolve(null);
2849
3076
  }
2850
- if (_optionalChain([stripePromiseCache, 'optionalAccess', _103 => _103.key]) === publishableKey) {
3077
+ if (_optionalChain([stripePromiseCache, 'optionalAccess', _117 => _117.key]) === publishableKey) {
2851
3078
  return stripePromiseCache.promise;
2852
3079
  }
2853
3080
  const promise = _stripejs.loadStripe.call(void 0, publishableKey);
@@ -2884,7 +3111,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
2884
3111
  _react.useEffect.call(void 0, () => {
2885
3112
  const fetchFeatures = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
2886
3113
  try {
2887
- const features = await _chunk53IPQJVHjs.FeatureService.findMany({});
3114
+ const features = await _chunk3EZX4G2Ejs.FeatureService.findMany({});
2888
3115
  setAllFeatures(features);
2889
3116
  } catch (error) {
2890
3117
  console.error("[PriceEditor] Failed to fetch features:", error);
@@ -2913,23 +3140,23 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
2913
3140
  featureIds: _zod3.z.array(_zod3.z.string())
2914
3141
  });
2915
3142
  const isEditMode = !!price;
2916
- const defaultUnitAmount = _optionalChain([price, 'optionalAccess', _104 => _104.unitAmount]) ? price.unitAmount / 100 : 0;
3143
+ const defaultUnitAmount = _optionalChain([price, 'optionalAccess', _118 => _118.unitAmount]) ? price.unitAmount / 100 : 0;
2917
3144
  const coreFeatureIds = allFeatures.filter((f) => f.isCore).map((f) => f.id);
2918
- const defaultFeatureIds = [.../* @__PURE__ */ new Set([..._nullishCoalesce(_optionalChain([price, 'optionalAccess', _105 => _105.priceFeatures, 'optionalAccess', _106 => _106.map, 'call', _107 => _107((f) => f.id)]), () => ( [])), ...coreFeatureIds])];
3145
+ const defaultFeatureIds = [.../* @__PURE__ */ new Set([..._nullishCoalesce(_optionalChain([price, 'optionalAccess', _119 => _119.priceFeatures, 'optionalAccess', _120 => _120.map, 'call', _121 => _121((f) => f.id)]), () => ( [])), ...coreFeatureIds])];
2919
3146
  const form = _reacthookform.useForm.call(void 0, {
2920
3147
  resolver: _zod.zodResolver.call(void 0, formSchema2),
2921
3148
  defaultValues: {
2922
3149
  unitAmount: defaultUnitAmount,
2923
- currency: _optionalChain([price, 'optionalAccess', _108 => _108.currency]) || "usd",
2924
- interval: _optionalChain([price, 'optionalAccess', _109 => _109.priceType]) === "one_time" ? "one_time" : _optionalChain([price, 'optionalAccess', _110 => _110.recurring, 'optionalAccess', _111 => _111.interval]) || "month",
2925
- intervalCount: _optionalChain([price, 'optionalAccess', _112 => _112.recurring, 'optionalAccess', _113 => _113.intervalCount]) || 1,
2926
- usageType: _optionalChain([price, 'optionalAccess', _114 => _114.recurring, 'optionalAccess', _115 => _115.usageType]) || "licensed",
2927
- nickname: _optionalChain([price, 'optionalAccess', _116 => _116.nickname]) || "",
2928
- active: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _117 => _117.active]), () => ( true)),
2929
- isTrial: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _118 => _118.isTrial]), () => ( false)),
2930
- description: _optionalChain([price, 'optionalAccess', _119 => _119.description]) || "",
2931
- features: _optionalChain([price, 'optionalAccess', _120 => _120.features]) || [],
2932
- token: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _121 => _121.token, 'optionalAccess', _122 => _122.toString, 'call', _123 => _123()]), () => ( "")),
3150
+ currency: _optionalChain([price, 'optionalAccess', _122 => _122.currency]) || "usd",
3151
+ interval: _optionalChain([price, 'optionalAccess', _123 => _123.priceType]) === "one_time" ? "one_time" : _optionalChain([price, 'optionalAccess', _124 => _124.recurring, 'optionalAccess', _125 => _125.interval]) || "month",
3152
+ intervalCount: _optionalChain([price, 'optionalAccess', _126 => _126.recurring, 'optionalAccess', _127 => _127.intervalCount]) || 1,
3153
+ usageType: _optionalChain([price, 'optionalAccess', _128 => _128.recurring, 'optionalAccess', _129 => _129.usageType]) || "licensed",
3154
+ nickname: _optionalChain([price, 'optionalAccess', _130 => _130.nickname]) || "",
3155
+ active: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _131 => _131.active]), () => ( true)),
3156
+ isTrial: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _132 => _132.isTrial]), () => ( false)),
3157
+ description: _optionalChain([price, 'optionalAccess', _133 => _133.description]) || "",
3158
+ features: _optionalChain([price, 'optionalAccess', _134 => _134.features]) || [],
3159
+ token: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _135 => _135.token, 'optionalAccess', _136 => _136.toString, 'call', _137 => _137()]), () => ( "")),
2933
3160
  featureIds: defaultFeatureIds
2934
3161
  }
2935
3162
  });
@@ -2937,24 +3164,24 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
2937
3164
  if (open) {
2938
3165
  const currentCoreFeatureIds = allFeatures.filter((f) => f.isCore).map((f) => f.id);
2939
3166
  const resetFeatureIds = [
2940
- .../* @__PURE__ */ new Set([..._nullishCoalesce(_optionalChain([price, 'optionalAccess', _124 => _124.priceFeatures, 'optionalAccess', _125 => _125.map, 'call', _126 => _126((f) => f.id)]), () => ( [])), ...currentCoreFeatureIds])
3167
+ .../* @__PURE__ */ new Set([..._nullishCoalesce(_optionalChain([price, 'optionalAccess', _138 => _138.priceFeatures, 'optionalAccess', _139 => _139.map, 'call', _140 => _140((f) => f.id)]), () => ( [])), ...currentCoreFeatureIds])
2941
3168
  ];
2942
3169
  form.reset({
2943
- unitAmount: _optionalChain([price, 'optionalAccess', _127 => _127.unitAmount]) ? price.unitAmount / 100 : 0,
2944
- currency: _optionalChain([price, 'optionalAccess', _128 => _128.currency]) || "usd",
2945
- interval: _optionalChain([price, 'optionalAccess', _129 => _129.priceType]) === "one_time" ? "one_time" : _optionalChain([price, 'optionalAccess', _130 => _130.recurring, 'optionalAccess', _131 => _131.interval]) || "month",
2946
- intervalCount: _optionalChain([price, 'optionalAccess', _132 => _132.recurring, 'optionalAccess', _133 => _133.intervalCount]) || 1,
2947
- usageType: _optionalChain([price, 'optionalAccess', _134 => _134.recurring, 'optionalAccess', _135 => _135.usageType]) || "licensed",
2948
- nickname: _optionalChain([price, 'optionalAccess', _136 => _136.nickname]) || "",
2949
- active: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _137 => _137.active]), () => ( true)),
2950
- isTrial: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _138 => _138.isTrial]), () => ( false)),
2951
- description: _optionalChain([price, 'optionalAccess', _139 => _139.description]) || "",
2952
- features: _optionalChain([price, 'optionalAccess', _140 => _140.features]) || [],
2953
- token: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _141 => _141.token, 'optionalAccess', _142 => _142.toString, 'call', _143 => _143()]), () => ( "")),
3170
+ unitAmount: _optionalChain([price, 'optionalAccess', _141 => _141.unitAmount]) ? price.unitAmount / 100 : 0,
3171
+ currency: _optionalChain([price, 'optionalAccess', _142 => _142.currency]) || "usd",
3172
+ interval: _optionalChain([price, 'optionalAccess', _143 => _143.priceType]) === "one_time" ? "one_time" : _optionalChain([price, 'optionalAccess', _144 => _144.recurring, 'optionalAccess', _145 => _145.interval]) || "month",
3173
+ intervalCount: _optionalChain([price, 'optionalAccess', _146 => _146.recurring, 'optionalAccess', _147 => _147.intervalCount]) || 1,
3174
+ usageType: _optionalChain([price, 'optionalAccess', _148 => _148.recurring, 'optionalAccess', _149 => _149.usageType]) || "licensed",
3175
+ nickname: _optionalChain([price, 'optionalAccess', _150 => _150.nickname]) || "",
3176
+ active: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _151 => _151.active]), () => ( true)),
3177
+ isTrial: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _152 => _152.isTrial]), () => ( false)),
3178
+ description: _optionalChain([price, 'optionalAccess', _153 => _153.description]) || "",
3179
+ features: _optionalChain([price, 'optionalAccess', _154 => _154.features]) || [],
3180
+ token: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _155 => _155.token, 'optionalAccess', _156 => _156.toString, 'call', _157 => _157()]), () => ( "")),
2954
3181
  featureIds: resetFeatureIds
2955
3182
  });
2956
3183
  }
2957
- }, [open, _optionalChain([price, 'optionalAccess', _144 => _144.id]), allFeatures]);
3184
+ }, [open, _optionalChain([price, 'optionalAccess', _158 => _158.id]), allFeatures]);
2958
3185
  const watchInterval = form.watch("interval");
2959
3186
  const isRecurring = watchInterval !== "one_time";
2960
3187
  const onSubmit = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async (values) => {
@@ -2962,14 +3189,14 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
2962
3189
  try {
2963
3190
  const unitAmountInCents = Math.round(values.unitAmount * 100);
2964
3191
  if (isEditMode) {
2965
- await _chunk53IPQJVHjs.StripePriceService.updatePrice({
3192
+ await _chunk3EZX4G2Ejs.StripePriceService.updatePrice({
2966
3193
  id: price.id,
2967
3194
  nickname: values.nickname || void 0,
2968
3195
  description: values.description || void 0,
2969
3196
  features: values.features.filter((f) => f.trim()) || void 0,
2970
3197
  token: values.token ? parseInt(values.token, 10) : void 0,
2971
3198
  // Only include isTrial and featureIds for recurring prices
2972
- ..._optionalChain([price, 'optionalAccess', _145 => _145.priceType]) === "recurring" ? { isTrial: values.isTrial, featureIds: values.featureIds } : {}
3199
+ ..._optionalChain([price, 'optionalAccess', _159 => _159.priceType]) === "recurring" ? { isTrial: values.isTrial, featureIds: values.featureIds } : {}
2973
3200
  });
2974
3201
  } else {
2975
3202
  const createInput = {
@@ -3004,7 +3231,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
3004
3231
  createInput.featureIds = values.featureIds;
3005
3232
  }
3006
3233
  }
3007
- await _chunk53IPQJVHjs.StripePriceService.createPrice(createInput);
3234
+ await _chunk3EZX4G2Ejs.StripePriceService.createPrice(createInput);
3008
3235
  }
3009
3236
  onSuccess();
3010
3237
  onOpenChange(false);
@@ -3030,10 +3257,10 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
3030
3257
  { id: "licensed", text: "Licensed (per unit)" },
3031
3258
  { id: "metered", text: "Metered (usage-based)" }
3032
3259
  ];
3033
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.DialogContent, { className: "max-w-2xl", children: [
3034
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.DialogHeader, { children: [
3035
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.DialogTitle, { children: isEditMode ? "Edit Price" : "Create Price" }),
3036
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.DialogDescription, { children: isEditMode ? "Update the price details. Note: Only nickname and active status can be changed." : "Create a new price for this product" })
3260
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.DialogContent, { className: "max-w-2xl", children: [
3261
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.DialogHeader, { children: [
3262
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.DialogTitle, { children: isEditMode ? "Edit Price" : "Create Price" }),
3263
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.DialogDescription, { children: isEditMode ? "Update the price details. Note: Only nickname and active status can be changed." : "Create a new price for this product" })
3037
3264
  ] }),
3038
3265
  isEditMode && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-blue-50 border border-blue-200 rounded-lg p-4 flex gap-x-3", children: [
3039
3266
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.AlertCircle, { className: "h-5 w-5 text-blue-600 flex-shrink-0 mt-0.5" }),
@@ -3042,10 +3269,10 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
3042
3269
  /* @__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." })
3043
3270
  ] })
3044
3271
  ] }),
3045
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-col gap-y-4", children: [
3272
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-col gap-y-4", children: [
3046
3273
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
3047
3274
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3048
- _chunkYVEK3SUSjs.FormInput,
3275
+ _chunkBYMBRMKSjs.FormInput,
3049
3276
  {
3050
3277
  form,
3051
3278
  id: "unitAmount",
@@ -3055,10 +3282,10 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
3055
3282
  isRequired: true
3056
3283
  }
3057
3284
  ),
3058
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.FormSelect, { form, id: "currency", name: "Currency", values: currencyOptions, disabled: isEditMode })
3285
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.FormSelect, { form, id: "currency", name: "Currency", values: currencyOptions, disabled: isEditMode })
3059
3286
  ] }),
3060
3287
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3061
- _chunkYVEK3SUSjs.FormSelect,
3288
+ _chunkBYMBRMKSjs.FormSelect,
3062
3289
  {
3063
3290
  form,
3064
3291
  id: "interval",
@@ -3069,7 +3296,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
3069
3296
  ),
3070
3297
  isRecurring && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
3071
3298
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3072
- _chunkYVEK3SUSjs.FormInput,
3299
+ _chunkBYMBRMKSjs.FormInput,
3073
3300
  {
3074
3301
  form,
3075
3302
  id: "intervalCount",
@@ -3080,7 +3307,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
3080
3307
  }
3081
3308
  ),
3082
3309
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3083
- _chunkYVEK3SUSjs.FormSelect,
3310
+ _chunkBYMBRMKSjs.FormSelect,
3084
3311
  {
3085
3312
  form,
3086
3313
  id: "usageType",
@@ -3091,7 +3318,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
3091
3318
  )
3092
3319
  ] }),
3093
3320
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3094
- _chunkYVEK3SUSjs.FormInput,
3321
+ _chunkBYMBRMKSjs.FormInput,
3095
3322
  {
3096
3323
  form,
3097
3324
  id: "nickname",
@@ -3100,7 +3327,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
3100
3327
  }
3101
3328
  ),
3102
3329
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3103
- _chunkYVEK3SUSjs.FormTextarea,
3330
+ _chunkBYMBRMKSjs.FormTextarea,
3104
3331
  {
3105
3332
  form,
3106
3333
  id: "description",
@@ -3109,13 +3336,13 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
3109
3336
  className: "min-h-24"
3110
3337
  }
3111
3338
  ),
3112
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.FormInput, { form, id: "token", name: "Token (optional)", placeholder: "Enter token value" }),
3339
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.FormInput, { form, id: "token", name: "Token (optional)", placeholder: "Enter token value" }),
3113
3340
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
3114
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Label, { children: "Features (optional)" }),
3341
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Label, { children: "Features (optional)" }),
3115
3342
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
3116
3343
  form.watch("features").map((_, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
3117
3344
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3118
- _chunkYVEK3SUSjs.Input,
3345
+ _chunkBYMBRMKSjs.Input,
3119
3346
  {
3120
3347
  ...form.register(`features.${index}`),
3121
3348
  placeholder: `Feature ${index + 1}`,
@@ -3123,7 +3350,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
3123
3350
  }
3124
3351
  ),
3125
3352
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3126
- _chunkYVEK3SUSjs.Button,
3353
+ _chunkBYMBRMKSjs.Button,
3127
3354
  {
3128
3355
  type: "button",
3129
3356
  variant: "outline",
@@ -3140,7 +3367,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
3140
3367
  )
3141
3368
  ] }, index)),
3142
3369
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
3143
- _chunkYVEK3SUSjs.Button,
3370
+ _chunkBYMBRMKSjs.Button,
3144
3371
  {
3145
3372
  type: "button",
3146
3373
  variant: "outline",
@@ -3159,7 +3386,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
3159
3386
  ] })
3160
3387
  ] }),
3161
3388
  isRecurring && allFeatures.length > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
3162
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Label, { children: "Platform Features" }),
3389
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Label, { children: "Platform Features" }),
3163
3390
  /* @__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) => {
3164
3391
  const isCore = feature.isCore;
3165
3392
  const isChecked = form.watch("featureIds").includes(feature.id);
@@ -3201,9 +3428,9 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
3201
3428
  ] }, feature.id);
3202
3429
  }) })
3203
3430
  ] }),
3204
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.FormCheckbox, { form, id: "active", name: "Active" }),
3431
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.FormCheckbox, { form, id: "active", name: "Active" }),
3205
3432
  isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3206
- _chunkYVEK3SUSjs.FormCheckbox,
3433
+ _chunkBYMBRMKSjs.FormCheckbox,
3207
3434
  {
3208
3435
  form,
3209
3436
  id: "isTrial",
@@ -3211,7 +3438,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
3211
3438
  description: "Mark this as the trial subscription plan (only one price should be marked as trial)"
3212
3439
  }
3213
3440
  ),
3214
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.CommonEditorButtons, { isEdit: isEditMode, form, disabled: isSubmitting, setOpen: onOpenChange })
3441
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.CommonEditorButtons, { isEdit: isEditMode, form, disabled: isSubmitting, setOpen: onOpenChange })
3215
3442
  ] }) })
3216
3443
  ] }) });
3217
3444
  }
@@ -3233,7 +3460,7 @@ function PricesList({ productId, onPricesChange }) {
3233
3460
  const loadPrices = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
3234
3461
  setLoading(true);
3235
3462
  try {
3236
- const fetchedPrices = await _chunk53IPQJVHjs.StripePriceService.listPrices({ productId });
3463
+ const fetchedPrices = await _chunk3EZX4G2Ejs.StripePriceService.listPrices({ productId });
3237
3464
  setPrices(fetchedPrices);
3238
3465
  } catch (error) {
3239
3466
  console.error("[PricesList] Failed to load prices:", error);
@@ -3250,7 +3477,7 @@ function PricesList({ productId, onPricesChange }) {
3250
3477
  }
3251
3478
  setArchivingPriceId(priceToArchive.id);
3252
3479
  try {
3253
- await _chunk53IPQJVHjs.StripePriceService.archivePrice({ id: priceToArchive.id });
3480
+ await _chunk3EZX4G2Ejs.StripePriceService.archivePrice({ id: priceToArchive.id });
3254
3481
  setPriceToArchive(null);
3255
3482
  await loadPrices();
3256
3483
  onPricesChange();
@@ -3266,7 +3493,7 @@ function PricesList({ productId, onPricesChange }) {
3266
3493
  }
3267
3494
  setReactivatingPriceId(priceToReactivate.id);
3268
3495
  try {
3269
- await _chunk53IPQJVHjs.StripePriceService.reactivatePrice({ id: priceToReactivate.id });
3496
+ await _chunk3EZX4G2Ejs.StripePriceService.reactivatePrice({ id: priceToReactivate.id });
3270
3497
  setPriceToReactivate(null);
3271
3498
  await loadPrices();
3272
3499
  onPricesChange();
@@ -3297,12 +3524,12 @@ function PricesList({ productId, onPricesChange }) {
3297
3524
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-4", children: [
3298
3525
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center justify-between mb-4", children: [
3299
3526
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "text-lg font-semibold", children: "Prices" }),
3300
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Button, { size: "sm", onClick: () => setShowCreatePrice(true), children: "Add Price" })
3527
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Button, { size: "sm", onClick: () => setShowCreatePrice(true), children: "Add Price" })
3301
3528
  ] }),
3302
3529
  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: [
3303
3530
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.DollarSign, { className: "text-muted-foreground h-12 w-12" }),
3304
3531
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-sm", children: "No prices yet. Add a price to enable subscriptions." }),
3305
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Button, { size: "sm", onClick: () => setShowCreatePrice(true), children: "Add Price" })
3532
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Button, { size: "sm", onClick: () => setShowCreatePrice(true), children: "Add Price" })
3306
3533
  ] }),
3307
3534
  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) => {
3308
3535
  const isArchiving = archivingPriceId === price.id;
@@ -3311,9 +3538,9 @@ function PricesList({ productId, onPricesChange }) {
3311
3538
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-start justify-between mb-3", children: [
3312
3539
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.DollarSign, { className: "h-5 w-5 text-primary" }),
3313
3540
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-1", children: [
3314
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.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" }) }),
3541
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.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" }) }),
3315
3542
  price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3316
- _chunkYVEK3SUSjs.Button,
3543
+ _chunkBYMBRMKSjs.Button,
3317
3544
  {
3318
3545
  variant: "ghost",
3319
3546
  size: "sm",
@@ -3323,7 +3550,7 @@ function PricesList({ productId, onPricesChange }) {
3323
3550
  children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Archive, { className: "h-4 w-4" })
3324
3551
  }
3325
3552
  ) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3326
- _chunkYVEK3SUSjs.Button,
3553
+ _chunkBYMBRMKSjs.Button,
3327
3554
  {
3328
3555
  variant: "ghost",
3329
3556
  size: "sm",
@@ -3340,10 +3567,10 @@ function PricesList({ productId, onPricesChange }) {
3340
3567
  " ",
3341
3568
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-sm font-normal", children: formatInterval2(price) })
3342
3569
  ] }) }),
3343
- _optionalChain([price, 'access', _146 => _146.metadata, 'optionalAccess', _147 => _147.nickname]) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm font-medium mb-2", children: price.metadata.nickname }),
3570
+ _optionalChain([price, 'access', _160 => _160.metadata, 'optionalAccess', _161 => _161.nickname]) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm font-medium mb-2", children: price.metadata.nickname }),
3344
3571
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2", children: [
3345
3572
  price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "bg-green-100 text-green-800 text-xs px-2 py-1 rounded-full font-medium", children: "Active" }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "bg-gray-100 text-gray-800 text-xs px-2 py-1 rounded-full font-medium", children: "Inactive" }),
3346
- _optionalChain([price, 'access', _148 => _148.recurring, 'optionalAccess', _149 => _149.usageType]) === "metered" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "bg-blue-100 text-blue-800 text-xs px-2 py-1 rounded-full font-medium", children: "Metered" }),
3573
+ _optionalChain([price, 'access', _162 => _162.recurring, 'optionalAccess', _163 => _163.usageType]) === "metered" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "bg-blue-100 text-blue-800 text-xs px-2 py-1 rounded-full font-medium", children: "Metered" }),
3347
3574
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "bg-gray-100 text-gray-800 text-xs px-2 py-1 rounded-full font-medium uppercase", children: price.currency })
3348
3575
  ] })
3349
3576
  ] }, price.id);
@@ -3374,20 +3601,20 @@ function PricesList({ productId, onPricesChange }) {
3374
3601
  }
3375
3602
  }
3376
3603
  ),
3377
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.AlertDialog, { open: !!priceToArchive, onOpenChange: (open) => !open && setPriceToArchive(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.AlertDialogContent, { children: [
3378
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.AlertDialogHeader, { children: [
3379
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.AlertDialogTitle, { children: "Archive Price" }),
3380
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.AlertDialogDescription, { children: [
3604
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.AlertDialog, { open: !!priceToArchive, onOpenChange: (open) => !open && setPriceToArchive(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.AlertDialogContent, { children: [
3605
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.AlertDialogHeader, { children: [
3606
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.AlertDialogTitle, { children: "Archive Price" }),
3607
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.AlertDialogDescription, { children: [
3381
3608
  "Are you sure you want to archive the price for",
3382
3609
  " ",
3383
3610
  priceToArchive && `${formatCurrency(priceToArchive.unitAmount, priceToArchive.currency)} ${formatInterval2(priceToArchive)}`,
3384
3611
  "? This will prevent new subscriptions but existing ones will continue."
3385
3612
  ] })
3386
3613
  ] }),
3387
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.AlertDialogFooter, { children: [
3388
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.AlertDialogCancel, { disabled: !!archivingPriceId, children: "Cancel" }),
3614
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.AlertDialogFooter, { children: [
3615
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.AlertDialogCancel, { disabled: !!archivingPriceId, children: "Cancel" }),
3389
3616
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3390
- _chunkYVEK3SUSjs.AlertDialogAction,
3617
+ _chunkBYMBRMKSjs.AlertDialogAction,
3391
3618
  {
3392
3619
  onClick: handleArchive,
3393
3620
  disabled: !!archivingPriceId,
@@ -3397,20 +3624,20 @@ function PricesList({ productId, onPricesChange }) {
3397
3624
  )
3398
3625
  ] })
3399
3626
  ] }) }),
3400
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.AlertDialog, { open: !!priceToReactivate, onOpenChange: (open) => !open && setPriceToReactivate(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.AlertDialogContent, { children: [
3401
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.AlertDialogHeader, { children: [
3402
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.AlertDialogTitle, { children: "Reactivate Price" }),
3403
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.AlertDialogDescription, { children: [
3627
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.AlertDialog, { open: !!priceToReactivate, onOpenChange: (open) => !open && setPriceToReactivate(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.AlertDialogContent, { children: [
3628
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.AlertDialogHeader, { children: [
3629
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.AlertDialogTitle, { children: "Reactivate Price" }),
3630
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.AlertDialogDescription, { children: [
3404
3631
  "Are you sure you want to reactivate the price for",
3405
3632
  " ",
3406
3633
  priceToReactivate && `${formatCurrency(priceToReactivate.unitAmount, priceToReactivate.currency)} ${formatInterval2(priceToReactivate)}`,
3407
3634
  "? This will allow new subscriptions again."
3408
3635
  ] })
3409
3636
  ] }),
3410
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.AlertDialogFooter, { children: [
3411
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.AlertDialogCancel, { disabled: !!reactivatingPriceId, children: "Cancel" }),
3637
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.AlertDialogFooter, { children: [
3638
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.AlertDialogCancel, { disabled: !!reactivatingPriceId, children: "Cancel" }),
3412
3639
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3413
- _chunkYVEK3SUSjs.AlertDialogAction,
3640
+ _chunkBYMBRMKSjs.AlertDialogAction,
3414
3641
  {
3415
3642
  onClick: handleReactivate,
3416
3643
  disabled: !!reactivatingPriceId,
@@ -3445,23 +3672,23 @@ function ProductEditor({ product, open, onOpenChange, onSuccess }) {
3445
3672
  const form = _reacthookform.useForm.call(void 0, {
3446
3673
  resolver: _zod.zodResolver.call(void 0, formSchema2),
3447
3674
  defaultValues: {
3448
- name: _optionalChain([product, 'optionalAccess', _150 => _150.name]) || "",
3449
- description: _optionalChain([product, 'optionalAccess', _151 => _151.description]) || "",
3450
- active: _nullishCoalesce(_optionalChain([product, 'optionalAccess', _152 => _152.active]), () => ( true))
3675
+ name: _optionalChain([product, 'optionalAccess', _164 => _164.name]) || "",
3676
+ description: _optionalChain([product, 'optionalAccess', _165 => _165.description]) || "",
3677
+ active: _nullishCoalesce(_optionalChain([product, 'optionalAccess', _166 => _166.active]), () => ( true))
3451
3678
  }
3452
3679
  });
3453
3680
  const onSubmit = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async (values) => {
3454
3681
  setIsSubmitting(true);
3455
3682
  try {
3456
3683
  if (product) {
3457
- await _chunk53IPQJVHjs.StripeProductService.updateProduct({
3684
+ await _chunk3EZX4G2Ejs.StripeProductService.updateProduct({
3458
3685
  id: product.id,
3459
3686
  name: values.name,
3460
3687
  description: values.description,
3461
3688
  active: values.active
3462
3689
  });
3463
3690
  } else {
3464
- await _chunk53IPQJVHjs.StripeProductService.createProduct({
3691
+ await _chunk3EZX4G2Ejs.StripeProductService.createProduct({
3465
3692
  id: _uuid.v4.call(void 0, ),
3466
3693
  name: values.name,
3467
3694
  description: values.description,
@@ -3476,15 +3703,15 @@ function ProductEditor({ product, open, onOpenChange, onSuccess }) {
3476
3703
  setIsSubmitting(false);
3477
3704
  }
3478
3705
  }, "onSubmit");
3479
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.DialogContent, { className: "max-w-2xl", children: [
3480
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.DialogHeader, { children: [
3481
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.DialogTitle, { children: product ? "Edit Product" : "Create Product" }),
3482
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.DialogDescription, { children: product ? `Update the details for ${product.name}` : "Create a new product to offer to your customers" })
3706
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.DialogContent, { className: "max-w-2xl", children: [
3707
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.DialogHeader, { children: [
3708
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.DialogTitle, { children: product ? "Edit Product" : "Create Product" }),
3709
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.DialogDescription, { children: product ? `Update the details for ${product.name}` : "Create a new product to offer to your customers" })
3483
3710
  ] }),
3484
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-col gap-y-4", children: [
3485
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.FormInput, { form, id: "name", name: "Product Name", placeholder: "Enter product name", isRequired: true }),
3711
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-col gap-y-4", children: [
3712
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.FormInput, { form, id: "name", name: "Product Name", placeholder: "Enter product name", isRequired: true }),
3486
3713
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3487
- _chunkYVEK3SUSjs.FormTextarea,
3714
+ _chunkBYMBRMKSjs.FormTextarea,
3488
3715
  {
3489
3716
  form,
3490
3717
  id: "description",
@@ -3493,8 +3720,8 @@ function ProductEditor({ product, open, onOpenChange, onSuccess }) {
3493
3720
  className: "min-h-32"
3494
3721
  }
3495
3722
  ),
3496
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.FormCheckbox, { form, id: "active", name: "Active" }),
3497
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.CommonEditorButtons, { isEdit: !!product, form, disabled: isSubmitting, setOpen: onOpenChange })
3723
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.FormCheckbox, { form, id: "active", name: "Active" }),
3724
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.CommonEditorButtons, { isEdit: !!product, form, disabled: isSubmitting, setOpen: onOpenChange })
3498
3725
  ] }) })
3499
3726
  ] }) });
3500
3727
  }
@@ -3517,7 +3744,7 @@ function ProductsList({ products, onProductsChange }) {
3517
3744
  }
3518
3745
  setArchivingProductId(productToArchive.id);
3519
3746
  try {
3520
- const _archivedProduct = await _chunk53IPQJVHjs.StripeProductService.archiveProduct({ id: productToArchive.id });
3747
+ const _archivedProduct = await _chunk3EZX4G2Ejs.StripeProductService.archiveProduct({ id: productToArchive.id });
3521
3748
  setProductToArchive(null);
3522
3749
  onProductsChange();
3523
3750
  } catch (_error) {
@@ -3532,7 +3759,7 @@ function ProductsList({ products, onProductsChange }) {
3532
3759
  }
3533
3760
  setReactivatingProductId(productToReactivate.id);
3534
3761
  try {
3535
- const _reactivatedProduct = await _chunk53IPQJVHjs.StripeProductService.reactivateProduct({ id: productToReactivate.id });
3762
+ const _reactivatedProduct = await _chunk3EZX4G2Ejs.StripeProductService.reactivateProduct({ id: productToReactivate.id });
3536
3763
  setProductToReactivate(null);
3537
3764
  onProductsChange();
3538
3765
  } catch (_error) {
@@ -3561,12 +3788,12 @@ function ProductsList({ products, onProductsChange }) {
3561
3788
  ] })
3562
3789
  ] }),
3563
3790
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
3564
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.Button, { variant: "outline", size: "sm", onClick: () => setEditingProduct(product), children: [
3791
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.Button, { variant: "outline", size: "sm", onClick: () => setEditingProduct(product), children: [
3565
3792
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Edit, { className: "h-4 w-4 mr-1" }),
3566
3793
  "Edit"
3567
3794
  ] }),
3568
3795
  product.active ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
3569
- _chunkYVEK3SUSjs.Button,
3796
+ _chunkBYMBRMKSjs.Button,
3570
3797
  {
3571
3798
  variant: "outline",
3572
3799
  size: "sm",
@@ -3578,7 +3805,7 @@ function ProductsList({ products, onProductsChange }) {
3578
3805
  ]
3579
3806
  }
3580
3807
  ) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
3581
- _chunkYVEK3SUSjs.Button,
3808
+ _chunkBYMBRMKSjs.Button,
3582
3809
  {
3583
3810
  variant: "outline",
3584
3811
  size: "sm",
@@ -3590,7 +3817,7 @@ function ProductsList({ products, onProductsChange }) {
3590
3817
  ]
3591
3818
  }
3592
3819
  ),
3593
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.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" }) })
3820
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.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" }) })
3594
3821
  ] })
3595
3822
  ] }),
3596
3823
  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 }) })
@@ -3608,19 +3835,19 @@ function ProductsList({ products, onProductsChange }) {
3608
3835
  }
3609
3836
  }
3610
3837
  ),
3611
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.AlertDialog, { open: !!productToArchive, onOpenChange: (open) => !open && setProductToArchive(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.AlertDialogContent, { children: [
3612
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.AlertDialogHeader, { children: [
3613
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.AlertDialogTitle, { children: "Archive Product" }),
3614
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.AlertDialogDescription, { children: [
3838
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.AlertDialog, { open: !!productToArchive, onOpenChange: (open) => !open && setProductToArchive(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.AlertDialogContent, { children: [
3839
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.AlertDialogHeader, { children: [
3840
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.AlertDialogTitle, { children: "Archive Product" }),
3841
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.AlertDialogDescription, { children: [
3615
3842
  'Are you sure you want to archive "',
3616
- _optionalChain([productToArchive, 'optionalAccess', _153 => _153.name]),
3843
+ _optionalChain([productToArchive, 'optionalAccess', _167 => _167.name]),
3617
3844
  '"? This will deactivate it and it will no longer be available for new subscriptions.'
3618
3845
  ] })
3619
3846
  ] }),
3620
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.AlertDialogFooter, { children: [
3621
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.AlertDialogCancel, { disabled: !!archivingProductId, children: "Cancel" }),
3847
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.AlertDialogFooter, { children: [
3848
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.AlertDialogCancel, { disabled: !!archivingProductId, children: "Cancel" }),
3622
3849
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3623
- _chunkYVEK3SUSjs.AlertDialogAction,
3850
+ _chunkBYMBRMKSjs.AlertDialogAction,
3624
3851
  {
3625
3852
  onClick: handleArchive,
3626
3853
  disabled: !!archivingProductId,
@@ -3630,19 +3857,19 @@ function ProductsList({ products, onProductsChange }) {
3630
3857
  )
3631
3858
  ] })
3632
3859
  ] }) }),
3633
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.AlertDialog, { open: !!productToReactivate, onOpenChange: (open) => !open && setProductToReactivate(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.AlertDialogContent, { children: [
3634
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.AlertDialogHeader, { children: [
3635
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.AlertDialogTitle, { children: "Reactivate Product" }),
3636
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.AlertDialogDescription, { children: [
3860
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.AlertDialog, { open: !!productToReactivate, onOpenChange: (open) => !open && setProductToReactivate(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.AlertDialogContent, { children: [
3861
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.AlertDialogHeader, { children: [
3862
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.AlertDialogTitle, { children: "Reactivate Product" }),
3863
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.AlertDialogDescription, { children: [
3637
3864
  'Are you sure you want to reactivate "',
3638
- _optionalChain([productToReactivate, 'optionalAccess', _154 => _154.name]),
3865
+ _optionalChain([productToReactivate, 'optionalAccess', _168 => _168.name]),
3639
3866
  '"? This will make it available for new subscriptions again.'
3640
3867
  ] })
3641
3868
  ] }),
3642
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkYVEK3SUSjs.AlertDialogFooter, { children: [
3643
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.AlertDialogCancel, { disabled: !!reactivatingProductId, children: "Cancel" }),
3869
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBYMBRMKSjs.AlertDialogFooter, { children: [
3870
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.AlertDialogCancel, { disabled: !!reactivatingProductId, children: "Cancel" }),
3644
3871
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3645
- _chunkYVEK3SUSjs.AlertDialogAction,
3872
+ _chunkBYMBRMKSjs.AlertDialogAction,
3646
3873
  {
3647
3874
  onClick: handleReactivate,
3648
3875
  disabled: !!reactivatingProductId,
@@ -3659,7 +3886,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductsList, "ProductsList");
3659
3886
  // src/features/billing/stripe-product/components/containers/ProductsAdminContainer.tsx
3660
3887
 
3661
3888
  function ProductsAdminContainer() {
3662
- const { hasRole } = _chunkYVEK3SUSjs.useCurrentUserContext.call(void 0, );
3889
+ const { hasRole } = _chunkBYMBRMKSjs.useCurrentUserContext.call(void 0, );
3663
3890
  const [products, setProducts] = _react.useState.call(void 0, []);
3664
3891
  const [loading, setLoading] = _react.useState.call(void 0, true);
3665
3892
  const [showCreateProduct, setShowCreateProduct] = _react.useState.call(void 0, false);
@@ -3669,7 +3896,7 @@ function ProductsAdminContainer() {
3669
3896
  const loadProducts = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
3670
3897
  setLoading(true);
3671
3898
  try {
3672
- const fetchedProducts = await _chunk53IPQJVHjs.StripeProductService.listProducts();
3899
+ const fetchedProducts = await _chunk3EZX4G2Ejs.StripeProductService.listProducts();
3673
3900
  setProducts(fetchedProducts);
3674
3901
  } catch (error) {
3675
3902
  console.error("[ProductsAdminContainer] Failed to load products:", error);
@@ -3689,14 +3916,14 @@ function ProductsAdminContainer() {
3689
3916
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Package, { className: "h-8 w-8" }),
3690
3917
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-3xl font-bold", children: "Product & Price Management" })
3691
3918
  ] }),
3692
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Button, { onClick: () => setShowCreateProduct(true), children: "Create Product" })
3919
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Button, { onClick: () => setShowCreateProduct(true), children: "Create Product" })
3693
3920
  ] }),
3694
3921
  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: [
3695
3922
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Package, { className: "text-muted-foreground h-16 w-16" }),
3696
3923
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
3697
3924
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "mb-2 text-xl font-semibold", children: "No products yet" }),
3698
3925
  /* @__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." }),
3699
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkYVEK3SUSjs.Button, { onClick: () => setShowCreateProduct(true), children: "Create Your First Product" })
3926
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBYMBRMKSjs.Button, { onClick: () => setShowCreateProduct(true), children: "Create Your First Product" })
3700
3927
  ] })
3701
3928
  ] }),
3702
3929
  products.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductsList, { products, onProductsChange: loadProducts }),
@@ -3747,5 +3974,6 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductsAdminContainer, "ProductsAdminConta
3747
3974
 
3748
3975
 
3749
3976
 
3750
- 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.PriceEditor = PriceEditor; exports.PricesList = PricesList; exports.PricingCard = PricingCard; exports.ProductEditor = ProductEditor; exports.ProductPricingList = ProductPricingList; exports.ProductPricingRow = ProductPricingRow; exports.ProductsAdminContainer = ProductsAdminContainer; exports.ProductsList = ProductsList; 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;
3977
+
3978
+ 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.PriceEditor = PriceEditor; exports.PricesList = PricesList; exports.PricingCard = PricingCard; exports.ProductEditor = ProductEditor; exports.ProductPricingList = ProductPricingList; exports.ProductPricingRow = ProductPricingRow; exports.ProductsAdminContainer = ProductsAdminContainer; 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;
3751
3979
  //# sourceMappingURL=index.js.map