@carlonicora/nextjs-jsonapi 1.36.1 → 1.38.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (190) hide show
  1. package/dist/{BlockNoteEditor-4MDHRUS2.js → BlockNoteEditor-3S2B36O3.js} +15 -15
  2. package/dist/{BlockNoteEditor-4MDHRUS2.js.map → BlockNoteEditor-3S2B36O3.js.map} +1 -1
  3. package/dist/{BlockNoteEditor-SZWO3MDO.mjs → BlockNoteEditor-WQUJTVJL.mjs} +5 -5
  4. package/dist/BlockNoteEditor-WQUJTVJL.mjs.map +1 -0
  5. package/dist/billing/index.d.mts +15 -5
  6. package/dist/billing/index.d.ts +15 -5
  7. package/dist/billing/index.js +750 -520
  8. package/dist/billing/index.js.map +1 -1
  9. package/dist/billing/index.mjs +665 -435
  10. package/dist/billing/index.mjs.map +1 -1
  11. package/dist/{chunk-53IPQJVH.js → chunk-3EZX4G2E.js} +147 -23
  12. package/dist/chunk-3EZX4G2E.js.map +1 -0
  13. package/dist/{chunk-I7DFEJFF.mjs → chunk-4PHADEKA.mjs} +738 -1418
  14. package/dist/chunk-4PHADEKA.mjs.map +1 -0
  15. package/dist/{chunk-E6PQQTWF.js → chunk-T2JCZYWK.js} +999 -1679
  16. package/dist/chunk-T2JCZYWK.js.map +1 -0
  17. package/dist/{chunk-P7R2DPD6.mjs → chunk-TQ5GRRTM.mjs} +125 -1
  18. package/dist/chunk-TQ5GRRTM.mjs.map +1 -0
  19. package/dist/client/index.js +3 -3
  20. package/dist/client/index.mjs +2 -2
  21. package/dist/components/index.d.mts +23 -8
  22. package/dist/components/index.d.ts +23 -8
  23. package/dist/components/index.js +3 -3
  24. package/dist/components/index.mjs +2 -2
  25. package/dist/contexts/index.d.mts +1 -1
  26. package/dist/contexts/index.d.ts +1 -1
  27. package/dist/contexts/index.js +3 -3
  28. package/dist/contexts/index.mjs +2 -2
  29. package/dist/core/index.d.mts +47 -3
  30. package/dist/core/index.d.ts +47 -3
  31. package/dist/core/index.js +8 -2
  32. package/dist/core/index.js.map +1 -1
  33. package/dist/core/index.mjs +7 -1
  34. package/dist/index.d.mts +2 -2
  35. package/dist/index.d.ts +2 -2
  36. package/dist/index.js +8 -2
  37. package/dist/index.js.map +1 -1
  38. package/dist/index.mjs +7 -1
  39. package/dist/server/index.js +3 -3
  40. package/dist/server/index.mjs +1 -1
  41. package/dist/{stripe-subscription.interface-DK7BJaNd.d.ts → stripe-promotion-code.interface-BcJty0rv.d.ts} +18 -1
  42. package/dist/{stripe-subscription.interface-C8uhCYIZ.d.mts → stripe-promotion-code.interface-Dnm2DJKQ.d.mts} +18 -1
  43. package/dist/testing/index.js.map +1 -1
  44. package/dist/testing/index.mjs.map +1 -1
  45. package/package.json +2 -2
  46. package/src/billing/index.ts +1 -0
  47. package/src/client/context/JsonApiProvider.tsx +1 -5
  48. package/src/client/hooks/__tests__/useJsonApiGet.test.tsx +9 -9
  49. package/src/client/hooks/__tests__/useJsonApiMutation.test.tsx +11 -11
  50. package/src/client/hooks/__tests__/useRehydration.test.ts +13 -34
  51. package/src/components/editors/BlockNoteEditor.tsx +2 -2
  52. package/src/components/forms/CommonEditorTrigger.tsx +1 -1
  53. package/src/components/forms/FormCheckbox.tsx +2 -12
  54. package/src/components/forms/FormDate.tsx +1 -6
  55. package/src/components/forms/FormInput.tsx +1 -1
  56. package/src/components/forms/FormPassword.tsx +1 -7
  57. package/src/components/forms/FormSelect.tsx +2 -8
  58. package/src/components/forms/FormSlider.tsx +1 -5
  59. package/src/components/forms/FormSwitch.tsx +1 -5
  60. package/src/components/forms/GdprConsentCheckbox.tsx +2 -8
  61. package/src/components/forms/PasswordInput.tsx +28 -26
  62. package/src/components/forms/__tests__/FormCheckbox.test.tsx +16 -18
  63. package/src/components/forms/__tests__/FormDate.test.tsx +14 -30
  64. package/src/components/forms/__tests__/FormInput.test.tsx +21 -37
  65. package/src/components/forms/__tests__/FormSelect.test.tsx +15 -21
  66. package/src/components/tables/ContentListTable.tsx +1 -1
  67. package/src/components/tables/__tests__/ContentListTable.test.tsx +17 -89
  68. package/src/components/tables/cells/cell.component.tsx +1 -1
  69. package/src/contexts/HeaderChildrenContext.tsx +3 -1
  70. package/src/core/endpoint/__tests__/EndpointCreator.test.ts +2 -7
  71. package/src/core/factories/__tests__/JsonApiDataFactory.test.ts +3 -3
  72. package/src/core/factories/__tests__/RehydrationFactory.test.ts +4 -6
  73. package/src/core/index.ts +1 -0
  74. package/src/core/registry/ModuleRegistry.ts +1 -0
  75. package/src/core/registry/__tests__/DataClassRegistry.test.ts +5 -15
  76. package/src/core/registry/__tests__/ModuleRegistrar.test.ts +5 -15
  77. package/src/features/auth/components/GdprConsentSection.tsx +1 -6
  78. package/src/features/auth/components/details/LandingComponent.tsx +6 -1
  79. package/src/features/auth/components/forms/AcceptInvitation.tsx +1 -1
  80. package/src/features/auth/components/forms/ResetPassword.tsx +1 -1
  81. package/src/features/billing/components/cards/PaymentMethodSummaryCard.tsx +13 -18
  82. package/src/features/billing/components/cards/SubscriptionSummaryCard.tsx +12 -17
  83. package/src/features/billing/components/modals/BillingDetailModal.tsx +2 -13
  84. package/src/features/billing/stripe-customer/components/details/PaymentMethodCard.tsx +8 -1
  85. package/src/features/billing/stripe-customer/components/forms/PaymentMethodEditor.tsx +2 -13
  86. package/src/features/billing/stripe-customer/components/forms/PaymentMethodForm.tsx +2 -12
  87. package/src/features/billing/stripe-invoice/components/details/InvoiceDetails.tsx +6 -1
  88. package/src/features/billing/stripe-invoice/data/stripe-invoice.interface.ts +1 -0
  89. package/src/features/billing/stripe-price/components/lists/PricesList.tsx +13 -5
  90. package/src/features/billing/stripe-product/components/lists/ProductsList.tsx +5 -5
  91. package/src/features/billing/stripe-promotion-code/components/PromoCodeInput.tsx +108 -0
  92. package/src/features/billing/stripe-promotion-code/components/index.ts +1 -0
  93. package/src/features/billing/stripe-promotion-code/data/index.ts +3 -0
  94. package/src/features/billing/stripe-promotion-code/data/stripe-promotion-code.interface.ts +14 -0
  95. package/src/features/billing/stripe-promotion-code/data/stripe-promotion-code.service.ts +64 -0
  96. package/src/features/billing/stripe-promotion-code/data/stripe-promotion-code.ts +66 -0
  97. package/src/features/billing/stripe-promotion-code/index.ts +2 -0
  98. package/src/features/billing/stripe-promotion-code/stripe-promotion-code.module.ts +9 -0
  99. package/src/features/billing/stripe-subscription/components/containers/SubscriptionsContainer.tsx +1 -3
  100. package/src/features/billing/stripe-subscription/components/details/SubscriptionDetails.tsx +4 -1
  101. package/src/features/billing/stripe-subscription/components/forms/CancelSubscriptionDialog.tsx +1 -1
  102. package/src/features/billing/stripe-subscription/components/lists/SubscriptionsList.tsx +24 -4
  103. package/src/features/billing/stripe-subscription/components/widgets/PricingCard.tsx +9 -2
  104. package/src/features/billing/stripe-subscription/components/widgets/SubscriptionStatusBadge.tsx +3 -1
  105. package/src/features/billing/stripe-subscription/components/wizards/SubscriptionWizard.tsx +7 -7
  106. package/src/features/billing/stripe-subscription/components/wizards/WizardProgressIndicator.tsx +2 -10
  107. package/src/features/billing/stripe-subscription/components/wizards/WizardStepPaymentMethod.tsx +3 -13
  108. package/src/features/billing/stripe-subscription/components/wizards/WizardStepReview.tsx +134 -23
  109. package/src/features/billing/stripe-subscription/data/stripe-subscription.interface.ts +2 -0
  110. package/src/features/billing/stripe-subscription/data/stripe-subscription.ts +8 -0
  111. package/src/features/billing/stripe-subscription/hooks/useSubscriptionWizard.ts +93 -7
  112. package/src/features/billing/stripe-usage/components/details/UsageSummaryCard.tsx +1 -1
  113. package/src/features/billing/stripe-usage/components/lists/UsageHistoryTable.tsx +1 -1
  114. package/src/features/company/components/details/CompanyDetails.tsx +2 -2
  115. package/src/features/company/components/forms/CompanyConfigurationSecurityForm.tsx +1 -1
  116. package/src/features/index.ts +1 -0
  117. package/src/features/notification/components/containers/NotificationsListContainer.tsx +1 -1
  118. package/src/features/notification/components/modals/NotificationModal.tsx +6 -2
  119. package/src/features/notification/contexts/NotificationContext.tsx +1 -3
  120. package/src/features/oauth/components/OAuthClientCard.tsx +15 -17
  121. package/src/features/oauth/components/OAuthClientDetail.tsx +7 -19
  122. package/src/features/oauth/components/OAuthClientForm.tsx +4 -13
  123. package/src/features/oauth/components/OAuthClientSecretDisplay.tsx +4 -20
  124. package/src/features/oauth/components/OAuthRedirectUriInput.tsx +5 -12
  125. package/src/features/oauth/components/OAuthScopeSelector.tsx +17 -23
  126. package/src/features/oauth/components/consent/OAuthConsentActions.tsx +3 -16
  127. package/src/features/oauth/components/consent/OAuthConsentHeader.tsx +3 -12
  128. package/src/features/oauth/components/consent/OAuthConsentScreen.tsx +5 -20
  129. package/src/features/oauth/components/consent/OAuthScopeList.tsx +3 -18
  130. package/src/features/onboarding/contexts/OnboardingContext.tsx +3 -3
  131. package/src/features/role/components/forms/FormRoles.tsx +1 -7
  132. package/src/features/user/components/containers/UserContainer.tsx +1 -1
  133. package/src/features/user/components/details/UserDetails.tsx +1 -1
  134. package/src/features/user/components/forms/UserDeleter.tsx +1 -1
  135. package/src/features/user/components/forms/UserEditor.tsx +1 -1
  136. package/src/features/user/components/forms/UserMultiSelect.tsx +7 -7
  137. package/src/features/user/components/lists/UserListInAdd.tsx +2 -2
  138. package/src/features/user/components/lists/UsersList.tsx +7 -1
  139. package/src/features/user/contexts/CurrentUserContext.tsx +36 -33
  140. package/src/hooks/__tests__/useDataListRetriever.test.ts +15 -21
  141. package/src/hooks/__tests__/useDebounce.test.ts +2 -7
  142. package/src/hooks/useCustomD3Graph.tsx +2 -2
  143. package/src/shadcnui/custom/multi-select.tsx +28 -2
  144. package/src/shadcnui/ui/accordion.tsx +21 -23
  145. package/src/shadcnui/ui/alert-dialog.tsx +45 -62
  146. package/src/shadcnui/ui/alert.tsx +25 -41
  147. package/src/shadcnui/ui/avatar.tsx +23 -36
  148. package/src/shadcnui/ui/badge.tsx +13 -11
  149. package/src/shadcnui/ui/breadcrumb.tsx +21 -55
  150. package/src/shadcnui/ui/button.tsx +17 -18
  151. package/src/shadcnui/ui/calendar.tsx +44 -93
  152. package/src/shadcnui/ui/carousel.tsx +72 -100
  153. package/src/shadcnui/ui/chart.tsx +102 -161
  154. package/src/shadcnui/ui/checkbox.tsx +8 -9
  155. package/src/shadcnui/ui/combobox.tsx +52 -83
  156. package/src/shadcnui/ui/command.tsx +43 -77
  157. package/src/shadcnui/ui/context-menu.tsx +47 -86
  158. package/src/shadcnui/ui/dialog.tsx +34 -60
  159. package/src/shadcnui/ui/drawer.tsx +32 -53
  160. package/src/shadcnui/ui/dropdown-menu.tsx +48 -65
  161. package/src/shadcnui/ui/field.tsx +39 -48
  162. package/src/shadcnui/ui/hover-card.tsx +9 -14
  163. package/src/shadcnui/ui/input-group.tsx +44 -55
  164. package/src/shadcnui/ui/input-otp.tsx +22 -26
  165. package/src/shadcnui/ui/input.tsx +6 -6
  166. package/src/shadcnui/ui/label.tsx +6 -6
  167. package/src/shadcnui/ui/navigation-menu.tsx +36 -60
  168. package/src/shadcnui/ui/popover.tsx +15 -38
  169. package/src/shadcnui/ui/progress.tsx +12 -29
  170. package/src/shadcnui/ui/radio-group.tsx +9 -15
  171. package/src/shadcnui/ui/resizable.tsx +14 -24
  172. package/src/shadcnui/ui/scroll-area.tsx +12 -27
  173. package/src/shadcnui/ui/select.tsx +41 -65
  174. package/src/shadcnui/ui/separator.tsx +7 -11
  175. package/src/shadcnui/ui/sheet.tsx +30 -55
  176. package/src/shadcnui/ui/sidebar.tsx +141 -189
  177. package/src/shadcnui/ui/skeleton.tsx +3 -9
  178. package/src/shadcnui/ui/slider.tsx +11 -23
  179. package/src/shadcnui/ui/switch.tsx +8 -8
  180. package/src/shadcnui/ui/tabs.tsx +14 -21
  181. package/src/shadcnui/ui/textarea.tsx +5 -5
  182. package/src/shadcnui/ui/toggle.tsx +8 -14
  183. package/src/shadcnui/ui/tooltip.tsx +11 -23
  184. package/src/testing/providers/MockJsonApiProvider.tsx +1 -5
  185. package/src/testing/utils/renderWithProviders.tsx +6 -10
  186. package/dist/BlockNoteEditor-SZWO3MDO.mjs.map +0 -1
  187. package/dist/chunk-53IPQJVH.js.map +0 -1
  188. package/dist/chunk-E6PQQTWF.js.map +0 -1
  189. package/dist/chunk-I7DFEJFF.mjs.map +0 -1
  190. package/dist/chunk-P7R2DPD6.mjs.map +0 -1
@@ -47,7 +47,7 @@
47
47
 
48
48
 
49
49
 
50
- var _chunkE6PQQTWFjs = require('../chunk-E6PQQTWF.js');
50
+ var _chunkT2JCZYWKjs = require('../chunk-T2JCZYWK.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, _chunkE6PQQTWFjs.Card, { children: [
125
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
126
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.CardTitle, { className: "text-sm font-medium", children: "Subscriptions" }),
116
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.Card, { children: [
117
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
118
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.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, _chunkE6PQQTWFjs.CardContent, { children: [
130
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Skeleton, { className: "h-6 w-32 mb-2" }),
131
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Skeleton, { className: "h-4 w-24 mb-1" }),
132
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Skeleton, { className: "h-4 w-40" })
121
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.CardContent, { children: [
122
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Skeleton, { className: "h-6 w-32 mb-2" }),
123
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Skeleton, { className: "h-4 w-24 mb-1" }),
124
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Skeleton, { className: "h-4 w-40" })
133
125
  ] })
134
126
  ] });
135
127
  }
136
128
  if (error) {
137
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.Card, { children: [
138
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
139
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.CardTitle, { className: "text-sm font-medium", children: "Subscriptions" }),
129
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.Card, { children: [
130
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
131
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.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, _chunkE6PQQTWFjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-destructive", children: error }) })
134
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.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, _chunkE6PQQTWFjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
150
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
151
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.CardTitle, { className: "text-sm font-medium", children: "Subscriptions" }),
141
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
142
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
143
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.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, _chunkE6PQQTWFjs.CardContent, { children: subscriptions.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
146
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.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
- _chunkE6PQQTWFjs.Button,
150
+ _chunkT2JCZYWKjs.Button,
159
151
  {
160
152
  variant: "outline",
161
153
  size: "sm",
@@ -173,16 +165,15 @@ function SubscriptionSummaryCard({
173
165
  ] }) : primarySubscription ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
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
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Badge, { variant: primarySubscription.cancelAtPeriodEnd ? "secondary" : getStatusBadgeVariant(primarySubscription.status), children: primarySubscription.cancelAtPeriodEnd ? "Canceling" : primarySubscription.status })
177
- ] }),
178
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm text-muted-foreground", children: [
179
- formatPrice(_optionalChain([primarySubscription, 'access', _10 => _10.price, 'optionalAccess', _11 => _11.unitAmount]), _optionalChain([primarySubscription, 'access', _12 => _12.price, 'optionalAccess', _13 => _13.currency])),
180
- _optionalChain([primarySubscription, 'access', _14 => _14.price, 'optionalAccess', _15 => _15.recurring]) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { children: [
181
- "/",
182
- primarySubscription.price.recurring.interval
183
- ] })
168
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
169
+ _chunkT2JCZYWKjs.Badge,
170
+ {
171
+ variant: primarySubscription.cancelAtPeriodEnd ? "secondary" : getStatusBadgeVariant(primarySubscription.status),
172
+ children: primarySubscription.cancelAtPeriodEnd ? "Canceling" : primarySubscription.status
173
+ }
174
+ )
184
175
  ] }),
185
- /* @__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)}` }),
186
177
  activeSubscriptions.length > 1 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-xs text-muted-foreground", children: [
187
178
  "+",
188
179
  activeSubscriptions.length - 1,
@@ -217,43 +208,52 @@ function PaymentMethodSummaryCard({
217
208
  onManageClick
218
209
  }) {
219
210
  if (loading) {
220
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.Card, { children: [
221
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
222
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.CardTitle, { className: "text-sm font-medium", children: "Payment Method" }),
211
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.Card, { children: [
212
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
213
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.CardTitle, { className: "text-sm font-medium", children: "Payment Method" }),
223
214
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
224
215
  ] }),
225
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.CardContent, { children: [
226
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Skeleton, { className: "h-6 w-32 mb-2" }),
227
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Skeleton, { className: "h-4 w-24" })
216
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.CardContent, { children: [
217
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Skeleton, { className: "h-6 w-32 mb-2" }),
218
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Skeleton, { className: "h-4 w-24" })
228
219
  ] })
229
220
  ] });
230
221
  }
231
222
  if (error) {
232
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.Card, { children: [
233
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
234
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.CardTitle, { className: "text-sm font-medium", children: "Payment Method" }),
223
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.Card, { children: [
224
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
225
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.CardTitle, { className: "text-sm font-medium", children: "Payment Method" }),
235
226
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
236
227
  ] }),
237
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-destructive", children: error }) })
228
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-destructive", children: error }) })
238
229
  ] });
239
230
  }
240
231
  const defaultMethod = paymentMethods.find((pm) => pm.id === defaultPaymentMethodId) || paymentMethods[0];
241
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
242
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
243
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.CardTitle, { className: "text-sm font-medium", children: "Payment Method" }),
232
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
233
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
234
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.CardTitle, { className: "text-sm font-medium", children: "Payment Method" }),
244
235
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
245
236
  ] }),
246
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.CardContent, { children: paymentMethods.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
237
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.CardContent, { children: paymentMethods.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
247
238
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No payment method" }),
248
239
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Add a card to enable subscriptions" }),
249
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.Button, { variant: "outline", size: "sm", className: "mt-2", onClick: (e) => {
250
- e.stopPropagation();
251
- onManageClick();
252
- }, children: [
253
- "Add Card",
254
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ChevronRight, { className: "h-4 w-4 ml-1" })
255
- ] })
256
- ] }) : _optionalChain([defaultMethod, 'optionalAccess', _16 => _16.card]) ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
240
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
241
+ _chunkT2JCZYWKjs.Button,
242
+ {
243
+ variant: "outline",
244
+ size: "sm",
245
+ className: "mt-2",
246
+ onClick: (e) => {
247
+ e.stopPropagation();
248
+ onManageClick();
249
+ },
250
+ children: [
251
+ "Add Card",
252
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ChevronRight, { className: "h-4 w-4 ml-1" })
253
+ ]
254
+ }
255
+ )
256
+ ] }) : _optionalChain([defaultMethod, 'optionalAccess', _10 => _10.card]) ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
257
257
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-xl font-bold", children: [
258
258
  getCardBrandIcon(defaultMethod.card.brand),
259
259
  " ****",
@@ -271,7 +271,7 @@ function PaymentMethodSummaryCard({
271
271
  " more card(s)"
272
272
  ] })
273
273
  ] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
274
- /* @__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" }),
275
275
  paymentMethods.length > 1 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-xs text-muted-foreground", children: [
276
276
  "+",
277
277
  paymentMethods.length - 1,
@@ -288,7 +288,7 @@ var _react = require('react');
288
288
 
289
289
  function formatBalance(balance, currency) {
290
290
  if (balance === void 0 || balance === 0) return "$0.00";
291
- 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";
292
292
  const displayBalance = -balance;
293
293
  return new Intl.NumberFormat(void 0, {
294
294
  style: "currency",
@@ -302,7 +302,7 @@ function CustomerInfoCard({ customer, loading, error }) {
302
302
  e.stopPropagation();
303
303
  setPortalLoading(true);
304
304
  try {
305
- const { url } = await _chunk53IPQJVHjs.StripeCustomerService.createPortalSession();
305
+ const { url } = await _chunk3EZX4G2Ejs.StripeCustomerService.createPortalSession();
306
306
  window.open(url, "_blank");
307
307
  } catch (err) {
308
308
  console.error("[CustomerInfoCard] Failed to create portal session:", err);
@@ -311,52 +311,52 @@ function CustomerInfoCard({ customer, loading, error }) {
311
311
  }
312
312
  }, "handlePortalClick");
313
313
  if (loading) {
314
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.Card, { children: [
315
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
316
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.CardTitle, { className: "text-sm font-medium", children: "Billing Account" }),
314
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.Card, { children: [
315
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
316
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.CardTitle, { className: "text-sm font-medium", children: "Billing Account" }),
317
317
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
318
318
  ] }),
319
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.CardContent, { children: [
320
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Skeleton, { className: "h-6 w-32 mb-2" }),
321
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Skeleton, { className: "h-4 w-48 mb-1" }),
322
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Skeleton, { className: "h-4 w-24" })
319
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.CardContent, { children: [
320
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Skeleton, { className: "h-6 w-32 mb-2" }),
321
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Skeleton, { className: "h-4 w-48 mb-1" }),
322
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Skeleton, { className: "h-4 w-24" })
323
323
  ] })
324
324
  ] });
325
325
  }
326
326
  if (error) {
327
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.Card, { children: [
328
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
329
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.CardTitle, { className: "text-sm font-medium", children: "Billing Account" }),
327
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.Card, { children: [
328
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
329
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.CardTitle, { className: "text-sm font-medium", children: "Billing Account" }),
330
330
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
331
331
  ] }),
332
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-destructive", children: error }) })
332
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-destructive", children: error }) })
333
333
  ] });
334
334
  }
335
335
  if (!customer) {
336
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.Card, { children: [
337
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
338
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.CardTitle, { className: "text-sm font-medium", children: "Billing Account" }),
336
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.Card, { children: [
337
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
338
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.CardTitle, { className: "text-sm font-medium", children: "Billing Account" }),
339
339
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
340
340
  ] }),
341
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.CardContent, { children: [
341
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.CardContent, { children: [
342
342
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "Not set up" }),
343
343
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Billing account will be created when you subscribe" })
344
344
  ] })
345
345
  ] });
346
346
  }
347
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.Card, { children: [
348
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
349
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.CardTitle, { className: "text-sm font-medium", children: "Billing Account" }),
347
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.Card, { children: [
348
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
349
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.CardTitle, { className: "text-sm font-medium", children: "Billing Account" }),
350
350
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
351
351
  ] }),
352
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
352
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
353
353
  customer.name && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: customer.name }),
354
354
  customer.email && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: customer.email }),
355
355
  customer.balance !== void 0 && customer.balance !== 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm", children: [
356
356
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground", children: "Credit Balance: " }),
357
357
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: customer.balance < 0 ? "text-green-600" : "text-destructive", children: formatBalance(customer.balance, customer.currency) })
358
358
  ] }),
359
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.Button, { variant: "outline", size: "sm", className: "mt-2", onClick: handlePortalClick, disabled: portalLoading, children: [
359
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.Button, { variant: "outline", size: "sm", className: "mt-2", onClick: handlePortalClick, disabled: portalLoading, children: [
360
360
  portalLoading ? "Loading..." : "Manage in Stripe Portal",
361
361
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ExternalLink, { className: "h-4 w-4 ml-1" })
362
362
  ] })
@@ -391,7 +391,7 @@ function formatDate2(date) {
391
391
  }
392
392
  _chunk7QVYU63Ejs.__name.call(void 0, formatDate2, "formatDate");
393
393
  function formatAmount(amount, currency) {
394
- 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";
395
395
  return new Intl.NumberFormat(void 0, {
396
396
  style: "currency",
397
397
  currency: currencyCode
@@ -400,42 +400,42 @@ function formatAmount(amount, currency) {
400
400
  _chunk7QVYU63Ejs.__name.call(void 0, formatAmount, "formatAmount");
401
401
  function InvoicesSummaryCard({ invoices, loading, error, onViewAllClick }) {
402
402
  if (loading) {
403
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.Card, { children: [
404
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
405
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.CardTitle, { className: "text-sm font-medium", children: "Recent Invoices" }),
403
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.Card, { children: [
404
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
405
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.CardTitle, { className: "text-sm font-medium", children: "Recent Invoices" }),
406
406
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
407
407
  ] }),
408
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.CardContent, { children: [
409
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Skeleton, { className: "h-6 w-24 mb-2" }),
410
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Skeleton, { className: "h-4 w-32 mb-1" }),
411
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Skeleton, { className: "h-4 w-20" })
408
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.CardContent, { children: [
409
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Skeleton, { className: "h-6 w-24 mb-2" }),
410
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Skeleton, { className: "h-4 w-32 mb-1" }),
411
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Skeleton, { className: "h-4 w-20" })
412
412
  ] })
413
413
  ] });
414
414
  }
415
415
  if (error) {
416
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.Card, { children: [
417
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
418
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.CardTitle, { className: "text-sm font-medium", children: "Recent Invoices" }),
416
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.Card, { children: [
417
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
418
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.CardTitle, { className: "text-sm font-medium", children: "Recent Invoices" }),
419
419
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
420
420
  ] }),
421
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-destructive", children: error }) })
421
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-destructive", children: error }) })
422
422
  ] });
423
423
  }
424
424
  const latestInvoice = invoices[0];
425
425
  const paidInvoices = invoices.filter((inv) => inv.status === "paid" /* PAID */);
426
426
  const openInvoices = invoices.filter((inv) => inv.status === "open" /* OPEN */);
427
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewAllClick, children: [
428
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
429
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.CardTitle, { className: "text-sm font-medium", children: "Recent Invoices" }),
427
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewAllClick, children: [
428
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
429
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.CardTitle, { className: "text-sm font-medium", children: "Recent Invoices" }),
430
430
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
431
431
  ] }),
432
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.CardContent, { children: invoices.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
432
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.CardContent, { children: invoices.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
433
433
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No invoices yet" }),
434
434
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Invoices will appear after your first billing cycle" })
435
435
  ] }) : latestInvoice ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
436
436
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
437
437
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: formatAmount(latestInvoice.total, latestInvoice.currency) }),
438
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Badge, { variant: getStatusBadgeVariant2(latestInvoice.status), children: latestInvoice.status })
438
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Badge, { variant: getStatusBadgeVariant2(latestInvoice.status), children: latestInvoice.status })
439
439
  ] }),
440
440
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: latestInvoice.stripeInvoiceNumber || `Invoice from ${formatDate2(latestInvoice.periodStart)}` }),
441
441
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-4 text-xs text-muted-foreground", children: [
@@ -475,37 +475,37 @@ function BillingUsageSummaryCard({
475
475
  onViewDetailsClick
476
476
  }) {
477
477
  if (loading) {
478
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.Card, { children: [
479
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
480
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.CardTitle, { className: "text-sm font-medium", children: "Usage This Month" }),
478
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.Card, { children: [
479
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
480
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.CardTitle, { className: "text-sm font-medium", children: "Usage This Month" }),
481
481
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
482
482
  ] }),
483
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.CardContent, { children: [
484
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Skeleton, { className: "h-6 w-24 mb-2" }),
485
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Skeleton, { className: "h-4 w-32" })
483
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.CardContent, { children: [
484
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Skeleton, { className: "h-6 w-24 mb-2" }),
485
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Skeleton, { className: "h-4 w-32" })
486
486
  ] })
487
487
  ] });
488
488
  }
489
489
  if (error) {
490
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.Card, { children: [
491
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
492
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.CardTitle, { className: "text-sm font-medium", children: "Usage This Month" }),
490
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.Card, { children: [
491
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
492
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.CardTitle, { className: "text-sm font-medium", children: "Usage This Month" }),
493
493
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
494
494
  ] }),
495
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-destructive", children: error }) })
495
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-destructive", children: error }) })
496
496
  ] });
497
497
  }
498
498
  const totalUsage = Object.values(summaries).reduce((acc, summary) => {
499
- return acc + (_optionalChain([summary, 'optionalAccess', _22 => _22.aggregatedValue]) || 0);
499
+ return acc + (_optionalChain([summary, 'optionalAccess', _16 => _16.aggregatedValue]) || 0);
500
500
  }, 0);
501
- 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]));
502
502
  const primarySummary = primaryMeter ? summaries[primaryMeter.id] : null;
503
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewDetailsClick, children: [
504
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
505
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.CardTitle, { className: "text-sm font-medium", children: "Usage This Month" }),
503
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewDetailsClick, children: [
504
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
505
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.CardTitle, { className: "text-sm font-medium", children: "Usage This Month" }),
506
506
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
507
507
  ] }),
508
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.CardContent, { children: meters.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
508
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.CardContent, { children: meters.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
509
509
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No meters" }),
510
510
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "No usage meters are configured" })
511
511
  ] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
@@ -557,7 +557,7 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
557
557
  const fetchSetupIntent = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
558
558
  setLoading(true);
559
559
  try {
560
- const intent = await _chunk53IPQJVHjs.StripeCustomerService.createSetupIntent();
560
+ const intent = await _chunk3EZX4G2Ejs.StripeCustomerService.createSetupIntent();
561
561
  setSetupIntent(intent);
562
562
  } catch (err) {
563
563
  console.error("[PaymentMethodForm] Failed to create setup intent:", err);
@@ -594,8 +594,8 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
594
594
  setIsSubmitting(false);
595
595
  return;
596
596
  }
597
- if (setAsDefault && _optionalChain([confirmedSetupIntent, 'optionalAccess', _25 => _25.payment_method])) {
598
- await _chunk53IPQJVHjs.StripeCustomerService.setDefaultPaymentMethod({
597
+ if (setAsDefault && _optionalChain([confirmedSetupIntent, 'optionalAccess', _19 => _19.payment_method])) {
598
+ await _chunk3EZX4G2Ejs.StripeCustomerService.setDefaultPaymentMethod({
599
599
  paymentMethodId: typeof confirmedSetupIntent.payment_method === "string" ? confirmedSetupIntent.payment_method : confirmedSetupIntent.payment_method.id
600
600
  });
601
601
  }
@@ -611,7 +611,7 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
611
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..." }) });
612
612
  }
613
613
  if (!setupIntent && error) {
614
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.AlertDescription, { children: error }) });
614
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.AlertDescription, { children: error }) });
615
615
  }
616
616
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: handleSubmit, className: "flex flex-col gap-y-4", children: [
617
617
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rounded-md border border-gray-300 p-3", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -634,20 +634,13 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
634
634
  }
635
635
  ) }),
636
636
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
637
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
638
- _chunkE6PQQTWFjs.Checkbox,
639
- {
640
- id: "setAsDefault",
641
- checked: setAsDefault,
642
- onCheckedChange: (checked) => setSetAsDefault(!!checked)
643
- }
644
- ),
645
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Label, { htmlFor: "setAsDefault", className: "text-sm font-normal", children: "Set as default payment method" })
637
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Checkbox, { id: "setAsDefault", checked: setAsDefault, onCheckedChange: (checked) => setSetAsDefault(!!checked) }),
638
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Label, { htmlFor: "setAsDefault", className: "text-sm font-normal", children: "Set as default payment method" })
646
639
  ] }),
647
- error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.AlertDescription, { children: error }) }),
640
+ error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.AlertDescription, { children: error }) }),
648
641
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-x-2", children: [
649
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Button, { type: "button", variant: "outline", onClick: onCancel, disabled: isSubmitting || isLoading, children: "Cancel" }),
650
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Button, { type: "submit", disabled: !stripe || isSubmitting || isLoading, children: isSubmitting ? "Processing..." : "Add Card" })
642
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Button, { type: "button", variant: "outline", onClick: onCancel, disabled: isSubmitting || isLoading, children: "Cancel" }),
643
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Button, { type: "submit", disabled: !stripe || isSubmitting || isLoading, children: isSubmitting ? "Processing..." : "Add Card" })
651
644
  ] })
652
645
  ] });
653
646
  }
@@ -663,18 +656,12 @@ function PaymentMethodEditor({ open, onOpenChange, onSuccess }) {
663
656
  const handleCancel = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
664
657
  onOpenChange(false);
665
658
  }, "handleCancel");
666
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.DialogContent, { className: "max-w-md", children: [
667
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.DialogHeader, { children: [
668
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.DialogTitle, { children: "Add Payment Method" }),
669
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.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, _chunkT2JCZYWKjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.DialogContent, { className: "max-w-md", children: [
660
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.DialogHeader, { children: [
661
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.DialogTitle, { children: "Add Payment Method" }),
662
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.DialogDescription, { children: "Add a new payment method to your account. Your card information is securely processed by Stripe." })
670
663
  ] }),
671
- open && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
672
- PaymentMethodForm,
673
- {
674
- onSuccess: handleSuccess,
675
- onCancel: handleCancel
676
- }
677
- )
664
+ open && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodForm, { onSuccess: handleSuccess, onCancel: handleCancel })
678
665
  ] }) });
679
666
  }
680
667
  _chunk7QVYU63Ejs.__name.call(void 0, PaymentMethodEditor, "PaymentMethodEditor");
@@ -696,7 +683,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
696
683
  _react.useEffect.call(void 0, () => {
697
684
  const loadCustomer = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
698
685
  try {
699
- const fetchedCustomer = await _chunk53IPQJVHjs.StripeCustomerService.getCustomer();
686
+ const fetchedCustomer = await _chunk3EZX4G2Ejs.StripeCustomerService.getCustomer();
700
687
  setCustomer(fetchedCustomer);
701
688
  } catch (error) {
702
689
  console.error("[PaymentMethodCard] Failed to load customer:", error);
@@ -704,16 +691,16 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
704
691
  }, "loadCustomer");
705
692
  loadCustomer();
706
693
  }, []);
707
- const isDefault = _optionalChain([customer, 'optionalAccess', _26 => _26.defaultPaymentMethodId]) === paymentMethod.id;
708
- const brand = _optionalChain([paymentMethod, 'access', _27 => _27.card, 'optionalAccess', _28 => _28.brand]) || "card";
709
- const last4 = _optionalChain([paymentMethod, 'access', _29 => _29.card, 'optionalAccess', _30 => _30.last4]) || "****";
710
- const expMonth = _optionalChain([paymentMethod, 'access', _31 => _31.card, 'optionalAccess', _32 => _32.expMonth]) || 0;
711
- 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;
712
699
  const brandIcon = brandIcons[brand.toLowerCase()] || "\u{1F4B3}";
713
700
  const handleSetDefault = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
714
701
  setLoading(true);
715
702
  try {
716
- await _chunk53IPQJVHjs.StripeCustomerService.setDefaultPaymentMethod({ paymentMethodId: paymentMethod.id });
703
+ await _chunk3EZX4G2Ejs.StripeCustomerService.setDefaultPaymentMethod({ paymentMethodId: paymentMethod.id });
717
704
  onUpdate();
718
705
  } catch (error) {
719
706
  console.error("[PaymentMethodCard] Failed to set as default:", error);
@@ -724,7 +711,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
724
711
  const handleRemove = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
725
712
  setLoading(true);
726
713
  try {
727
- await _chunk53IPQJVHjs.StripeCustomerService.removePaymentMethod({ paymentMethodId: paymentMethod.id });
714
+ await _chunk3EZX4G2Ejs.StripeCustomerService.removePaymentMethod({ paymentMethodId: paymentMethod.id });
728
715
  setShowRemoveDialog(false);
729
716
  onUpdate();
730
717
  } catch (error) {
@@ -733,22 +720,33 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
733
720
  }
734
721
  }, "handleRemove");
735
722
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
736
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.Card, { className: "relative", children: [
737
- isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Badge, { className: "absolute right-2 top-2 bg-green-100 text-green-800 hover:bg-green-100", children: "Default" }),
738
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.CardHeader, { className: "flex flex-row items-center justify-between pb-2", children: [
723
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.Card, { className: "relative", children: [
724
+ isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.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, _chunkT2JCZYWKjs.CardHeader, { className: "flex flex-row items-center justify-between pb-2", children: [
739
726
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
740
727
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-2xl", children: brandIcon }),
741
728
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium capitalize", children: brand })
742
729
  ] }),
743
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.DropdownMenu, { children: [
744
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.DropdownMenuTrigger, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Button, { render: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {}), nativeButton: false, variant: "ghost", size: "sm", disabled: loading, className: "h-8 w-8 p-0", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.MoreVertical, { className: "h-4 w-4" }) }) }),
745
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.DropdownMenuContent, { align: "end", children: [
746
- !isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.DropdownMenuItem, { onClick: handleSetDefault, disabled: loading, children: "Set as Default" }),
747
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.DropdownMenuItem, { onClick: () => setShowRemoveDialog(true), disabled: loading, className: "text-red-600", children: "Remove" })
730
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.DropdownMenu, { children: [
731
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.DropdownMenuTrigger, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
732
+ _chunkT2JCZYWKjs.Button,
733
+ {
734
+ render: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {}),
735
+ nativeButton: false,
736
+ variant: "ghost",
737
+ size: "sm",
738
+ disabled: loading,
739
+ className: "h-8 w-8 p-0",
740
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.MoreVertical, { className: "h-4 w-4" })
741
+ }
742
+ ) }),
743
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.DropdownMenuContent, { align: "end", children: [
744
+ !isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.DropdownMenuItem, { onClick: handleSetDefault, disabled: loading, children: "Set as Default" }),
745
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.DropdownMenuItem, { onClick: () => setShowRemoveDialog(true), disabled: loading, className: "text-red-600", children: "Remove" })
748
746
  ] })
749
747
  ] })
750
748
  ] }),
751
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-1", children: [
749
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-1", children: [
752
750
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-lg font-semibold", children: [
753
751
  "\u2022\u2022\u2022\u2022 ",
754
752
  last4
@@ -761,17 +759,17 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
761
759
  ] })
762
760
  ] }) })
763
761
  ] }),
764
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.AlertDialog, { open: showRemoveDialog, onOpenChange: setShowRemoveDialog, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.AlertDialogContent, { children: [
765
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.AlertDialogHeader, { children: [
766
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.AlertDialogTitle, { children: "Remove Payment Method" }),
767
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.AlertDialogDescription, { children: [
762
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.AlertDialog, { open: showRemoveDialog, onOpenChange: setShowRemoveDialog, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.AlertDialogContent, { children: [
763
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.AlertDialogHeader, { children: [
764
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.AlertDialogTitle, { children: "Remove Payment Method" }),
765
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.AlertDialogDescription, { children: [
768
766
  "Are you sure you want to remove this payment method? This action cannot be undone.",
769
767
  isDefault && " This is your default payment method."
770
768
  ] })
771
769
  ] }),
772
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.AlertDialogFooter, { children: [
773
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.AlertDialogCancel, { disabled: loading, children: "Cancel" }),
774
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.AlertDialogAction, { onClick: handleRemove, disabled: loading, className: "bg-red-600 hover:bg-red-700", children: loading ? "Removing..." : "Remove" })
770
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.AlertDialogFooter, { children: [
771
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.AlertDialogCancel, { disabled: loading, children: "Cancel" }),
772
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.AlertDialogAction, { onClick: handleRemove, disabled: loading, className: "bg-red-600 hover:bg-red-700", children: loading ? "Removing..." : "Remove" })
775
773
  ] })
776
774
  ] }) })
777
775
  ] });
@@ -794,7 +792,7 @@ function PaymentMethodsContainer() {
794
792
  const loadPaymentMethods = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
795
793
  setLoading(true);
796
794
  try {
797
- const fetchedPaymentMethods = await _chunk53IPQJVHjs.StripeCustomerService.listPaymentMethods();
795
+ const fetchedPaymentMethods = await _chunk3EZX4G2Ejs.StripeCustomerService.listPaymentMethods();
798
796
  setPaymentMethods(fetchedPaymentMethods);
799
797
  } catch (error) {
800
798
  console.error("[PaymentMethodsContainer] Failed to load payment methods:", error);
@@ -814,14 +812,14 @@ function PaymentMethodsContainer() {
814
812
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8" }),
815
813
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-3xl font-bold", children: "Payment Methods" })
816
814
  ] }),
817
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Button, { onClick: () => setShowAddPaymentMethod(true), children: "Add Payment Method" })
815
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Button, { onClick: () => setShowAddPaymentMethod(true), children: "Add Payment Method" })
818
816
  ] }),
819
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: [
820
818
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-16 w-16 text-muted-foreground" }),
821
819
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
822
820
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "mb-2 text-xl font-semibold", children: "No payment methods" }),
823
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." }),
824
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Button, { onClick: () => setShowAddPaymentMethod(true), children: "Add Your First Card" })
822
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Button, { onClick: () => setShowAddPaymentMethod(true), children: "Add Your First Card" })
825
823
  ] })
826
824
  ] }),
827
825
  paymentMethods.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodsList, { paymentMethods, onUpdate: loadPaymentMethods }),
@@ -925,7 +923,12 @@ _chunk7QVYU63Ejs.__name.call(void 0, InvoiceStatusBadge, "InvoiceStatusBadge");
925
923
 
926
924
  // src/features/billing/stripe-invoice/components/details/InvoiceDetails.tsx
927
925
 
928
- function InvoiceDetails({ invoice, open, onOpenChange, onInvoiceChange }) {
926
+ function InvoiceDetails({
927
+ invoice,
928
+ open,
929
+ onOpenChange,
930
+ onInvoiceChange: _onInvoiceChange
931
+ }) {
929
932
  const handleDownloadPDF = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
930
933
  if (invoice.stripePdfUrl) {
931
934
  window.open(invoice.stripePdfUrl, "_blank");
@@ -944,14 +947,14 @@ function InvoiceDetails({ invoice, open, onOpenChange, onInvoiceChange }) {
944
947
  }
945
948
  return invoice.stripeInvoiceId.slice(-8);
946
949
  }, "getInvoiceNumber");
947
- const productName = _optionalChain([invoice, 'access', _35 => _35.subscription, 'optionalAccess', _36 => _36.price, 'optionalAccess', _37 => _37.product, 'optionalAccess', _38 => _38.name]) || "Subscription";
948
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.DialogContent, { className: "max-w-2xl", children: [
949
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.DialogHeader, { children: [
950
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.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, _chunkT2JCZYWKjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.DialogContent, { className: "max-w-2xl", children: [
952
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.DialogHeader, { children: [
953
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.DialogTitle, { children: [
951
954
  "Invoice ",
952
955
  getInvoiceNumber()
953
956
  ] }),
954
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.DialogDescription, { children: formatDate3(invoice.periodStart) })
957
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.DialogDescription, { children: formatDate3(invoice.periodStart) })
955
958
  ] }),
956
959
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
957
960
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
@@ -1016,15 +1019,15 @@ function InvoiceDetails({ invoice, open, onOpenChange, onInvoiceChange }) {
1016
1019
  ] })
1017
1020
  ] }),
1018
1021
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2 pt-4 border-t", children: [
1019
- invoice.stripePdfUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.Button, { variant: "outline", onClick: handleDownloadPDF, children: [
1022
+ invoice.stripePdfUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.Button, { variant: "outline", onClick: handleDownloadPDF, children: [
1020
1023
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Download, { className: "mr-2 h-4 w-4" }),
1021
1024
  "Download PDF"
1022
1025
  ] }),
1023
- invoice.status === "open" /* OPEN */ && invoice.attempted && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.Button, { variant: "default", onClick: handleRetryPayment, children: [
1026
+ invoice.status === "open" /* OPEN */ && invoice.attempted && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.Button, { variant: "default", onClick: handleRetryPayment, children: [
1024
1027
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RefreshCw, { className: "mr-2 h-4 w-4" }),
1025
1028
  "Retry Payment"
1026
1029
  ] }),
1027
- invoice.stripeHostedInvoiceUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.Button, { variant: "outline", onClick: handleViewInStripe, children: [
1030
+ invoice.stripeHostedInvoiceUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.Button, { variant: "outline", onClick: handleViewInStripe, children: [
1028
1031
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ExternalLink, { className: "mr-2 h-4 w-4" }),
1029
1032
  "View in Stripe"
1030
1033
  ] })
@@ -1048,30 +1051,30 @@ function InvoicesList({ invoices, onInvoicesChange }) {
1048
1051
  return invoice.stripeInvoiceId.slice(-8);
1049
1052
  }, "getInvoiceNumber");
1050
1053
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
1051
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.Table, { children: [
1052
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.TableRow, { children: [
1053
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.TableHead, { children: "Invoice #" }),
1054
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.TableHead, { children: "Date" }),
1055
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.TableHead, { children: "Status" }),
1056
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.TableHead, { className: "text-right", children: "Amount" }),
1057
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.TableHead, { children: "Period" })
1054
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.Table, { children: [
1055
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.TableRow, { children: [
1056
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.TableHead, { children: "Invoice #" }),
1057
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.TableHead, { children: "Date" }),
1058
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.TableHead, { children: "Status" }),
1059
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.TableHead, { className: "text-right", children: "Amount" }),
1060
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.TableHead, { children: "Period" })
1058
1061
  ] }) }),
1059
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.TableBody, { children: invoices.map((invoice) => {
1062
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.TableBody, { children: invoices.map((invoice) => {
1060
1063
  const invoiceNumber = getInvoiceNumber(invoice);
1061
1064
  const date = formatDate3(invoice.periodStart);
1062
1065
  const amount = formatCurrency(invoice.total, invoice.currency);
1063
1066
  const period = `${formatDate3(invoice.periodStart)} - ${formatDate3(invoice.periodEnd)}`;
1064
1067
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1065
- _chunkE6PQQTWFjs.TableRow,
1068
+ _chunkT2JCZYWKjs.TableRow,
1066
1069
  {
1067
1070
  onClick: () => handleRowClick(invoice),
1068
1071
  className: "cursor-pointer hover:bg-muted/50",
1069
1072
  children: [
1070
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.TableCell, { className: "font-medium", children: invoiceNumber }),
1071
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.TableCell, { className: "text-muted-foreground text-sm", children: date }),
1072
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InvoiceStatusBadge, { status: invoice.status }) }),
1073
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.TableCell, { className: "text-right font-medium", children: amount }),
1074
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.TableCell, { className: "text-muted-foreground text-sm", children: period })
1073
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.TableCell, { className: "font-medium", children: invoiceNumber }),
1074
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.TableCell, { className: "text-muted-foreground text-sm", children: date }),
1075
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InvoiceStatusBadge, { status: invoice.status }) }),
1076
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.TableCell, { className: "text-right font-medium", children: amount }),
1077
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.TableCell, { className: "text-muted-foreground text-sm", children: period })
1075
1078
  ]
1076
1079
  },
1077
1080
  invoice.id
@@ -1104,7 +1107,7 @@ function InvoicesContainer() {
1104
1107
  setLoading(true);
1105
1108
  try {
1106
1109
  const params = statusFilter !== "all" ? { status: statusFilter } : void 0;
1107
- const data = await _chunk53IPQJVHjs.StripeInvoiceService.listInvoices(params);
1110
+ const data = await _chunk3EZX4G2Ejs.StripeInvoiceService.listInvoices(params);
1108
1111
  setInvoices(data);
1109
1112
  } catch (error) {
1110
1113
  console.error("[InvoicesContainer] Failed to load invoices:", error);
@@ -1120,12 +1123,12 @@ function InvoicesContainer() {
1120
1123
  setStatusFilter(value);
1121
1124
  }, "handleFilterChange");
1122
1125
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-4", children: [
1123
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Tabs, { value: statusFilter, onValueChange: handleFilterChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.TabsList, { children: [
1124
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.TabsTrigger, { value: "all", children: "All" }),
1125
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.TabsTrigger, { value: "paid" /* PAID */, children: "Paid" }),
1126
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.TabsTrigger, { value: "open" /* OPEN */, children: "Open" }),
1127
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.TabsTrigger, { value: "void" /* VOID */, children: "Void" }),
1128
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.TabsTrigger, { value: "uncollectible" /* UNCOLLECTIBLE */, children: "Uncollectible" })
1126
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Tabs, { value: statusFilter, onValueChange: handleFilterChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.TabsList, { children: [
1127
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.TabsTrigger, { value: "all", children: "All" }),
1128
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.TabsTrigger, { value: "paid" /* PAID */, children: "Paid" }),
1129
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.TabsTrigger, { value: "open" /* OPEN */, children: "Open" }),
1130
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.TabsTrigger, { value: "void" /* VOID */, children: "Void" }),
1131
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.TabsTrigger, { value: "uncollectible" /* UNCOLLECTIBLE */, children: "Uncollectible" })
1129
1132
  ] }) }),
1130
1133
  loading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-center py-8 text-muted-foreground", children: "Loading invoices..." }),
1131
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: [
@@ -1169,10 +1172,10 @@ function CancelSubscriptionDialog({
1169
1172
  reason: ""
1170
1173
  }
1171
1174
  });
1172
- const onSubmit = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async (values) => {
1175
+ const onSubmit = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async (_values) => {
1173
1176
  setIsSubmitting(true);
1174
1177
  try {
1175
- await _chunk53IPQJVHjs.StripeSubscriptionService.cancelSubscription({
1178
+ await _chunk3EZX4G2Ejs.StripeSubscriptionService.cancelSubscription({
1176
1179
  id: subscription.id,
1177
1180
  cancelImmediately: false
1178
1181
  });
@@ -1185,19 +1188,19 @@ function CancelSubscriptionDialog({
1185
1188
  }
1186
1189
  }, "onSubmit");
1187
1190
  const periodEndDate = formatDate3(subscription.currentPeriodEnd);
1188
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.DialogContent, { className: "max-w-md", children: [
1189
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.DialogHeader, { children: [
1190
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.DialogTitle, { children: "Cancel Subscription" }),
1191
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.DialogDescription, { children: "Are you sure you want to cancel this subscription? This action cannot be undone." })
1191
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.DialogContent, { className: "max-w-md", children: [
1192
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.DialogHeader, { children: [
1193
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.DialogTitle, { children: "Cancel Subscription" }),
1194
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.DialogDescription, { children: "Are you sure you want to cancel this subscription? This action cannot be undone." })
1192
1195
  ] }),
1193
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.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, _chunkT2JCZYWKjs.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-col gap-y-4", children: [
1194
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: [
1195
1198
  "Your subscription will remain active until ",
1196
1199
  periodEndDate,
1197
1200
  ". You can continue using the service until then."
1198
1201
  ] }),
1199
1202
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1200
- _chunkE6PQQTWFjs.FormTextarea,
1203
+ _chunkT2JCZYWKjs.FormTextarea,
1201
1204
  {
1202
1205
  form,
1203
1206
  id: "reason",
@@ -1207,8 +1210,8 @@ function CancelSubscriptionDialog({
1207
1210
  }
1208
1211
  ),
1209
1212
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-x-2 justify-end pt-2", children: [
1210
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Button, { type: "button", variant: "outline", onClick: () => onOpenChange(false), disabled: isSubmitting, children: "Keep Subscription" }),
1211
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Button, { type: "submit", variant: "destructive", disabled: isSubmitting, children: isSubmitting ? "Canceling..." : "Confirm Cancellation" })
1213
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Button, { type: "button", variant: "outline", onClick: () => onOpenChange(false), disabled: isSubmitting, children: "Keep Subscription" }),
1214
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Button, { type: "submit", variant: "destructive", disabled: isSubmitting, children: isSubmitting ? "Canceling..." : "Confirm Cancellation" })
1212
1215
  ] })
1213
1216
  ] }) })
1214
1217
  ] }) });
@@ -1265,10 +1268,10 @@ _chunk7QVYU63Ejs.__name.call(void 0, SubscriptionStatusBadge, "SubscriptionStatu
1265
1268
 
1266
1269
  function formatPlanName2(price) {
1267
1270
  if (!price) return "N/A";
1268
- 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]) || "";
1269
1272
  const nickname = price.nickname || "";
1270
1273
  let interval = "";
1271
- if (_optionalChain([price, 'access', _41 => _41.recurring, 'optionalAccess', _42 => _42.interval])) {
1274
+ if (_optionalChain([price, 'access', _35 => _35.recurring, 'optionalAccess', _36 => _36.interval])) {
1272
1275
  const intervalMap = {
1273
1276
  day: "Daily",
1274
1277
  week: "Weekly",
@@ -1283,7 +1286,7 @@ function formatPlanName2(price) {
1283
1286
  }
1284
1287
  _chunk7QVYU63Ejs.__name.call(void 0, formatPlanName2, "formatPlanName");
1285
1288
  function formatBillingAmount(price) {
1286
- if (!_optionalChain([price, 'optionalAccess', _43 => _43.unitAmount])) return "N/A";
1289
+ if (!_optionalChain([price, 'optionalAccess', _37 => _37.unitAmount])) return "N/A";
1287
1290
  return formatCurrency(price.unitAmount, price.currency);
1288
1291
  }
1289
1292
  _chunk7QVYU63Ejs.__name.call(void 0, formatBillingAmount, "formatBillingAmount");
@@ -1299,7 +1302,7 @@ function SubscriptionDetails({
1299
1302
  const handlePause = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
1300
1303
  setIsProcessing(true);
1301
1304
  try {
1302
- await _chunk53IPQJVHjs.StripeSubscriptionService.pauseSubscription({ subscriptionId: subscription.id });
1305
+ await _chunk3EZX4G2Ejs.StripeSubscriptionService.pauseSubscription({ subscriptionId: subscription.id });
1303
1306
  onSubscriptionChange();
1304
1307
  } catch (error) {
1305
1308
  console.error("[SubscriptionDetails] Failed to pause subscription:", error);
@@ -1310,7 +1313,7 @@ function SubscriptionDetails({
1310
1313
  const handleResume = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
1311
1314
  setIsProcessing(true);
1312
1315
  try {
1313
- await _chunk53IPQJVHjs.StripeSubscriptionService.resumeSubscription({ subscriptionId: subscription.id });
1316
+ await _chunk3EZX4G2Ejs.StripeSubscriptionService.resumeSubscription({ subscriptionId: subscription.id });
1314
1317
  onSubscriptionChange();
1315
1318
  } catch (error) {
1316
1319
  console.error("[SubscriptionDetails] Failed to resume subscription:", error);
@@ -1320,7 +1323,7 @@ function SubscriptionDetails({
1320
1323
  }, "handleResume");
1321
1324
  const handleManageViaPortal = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
1322
1325
  try {
1323
- const { url } = await _chunk53IPQJVHjs.StripeCustomerService.createPortalSession();
1326
+ const { url } = await _chunk3EZX4G2Ejs.StripeCustomerService.createPortalSession();
1324
1327
  window.open(url, "_blank");
1325
1328
  } catch (error) {
1326
1329
  console.error("[SubscriptionDetails] Failed to create portal session:", error);
@@ -1330,15 +1333,21 @@ function SubscriptionDetails({
1330
1333
  const canResume = subscription.status === "paused" /* PAUSED */;
1331
1334
  const canCancel = subscription.status === "active" /* ACTIVE */ || subscription.status === "trialing" /* TRIALING */ || subscription.status === "paused" /* PAUSED */;
1332
1335
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
1333
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.DialogContent, { className: "max-w-2xl", children: [
1334
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.DialogHeader, { children: [
1335
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.DialogTitle, { children: "Subscription Details" }),
1336
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.DialogDescription, { children: "View and manage your subscription" })
1336
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.DialogContent, { className: "max-w-2xl", children: [
1337
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.DialogHeader, { children: [
1338
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.DialogTitle, { children: "Subscription Details" }),
1339
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.DialogDescription, { children: "View and manage your subscription" })
1337
1340
  ] }),
1338
1341
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
1339
1342
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
1340
1343
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium text-muted-foreground", children: "Status:" }),
1341
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SubscriptionStatusBadge, { status: subscription.status, cancelAtPeriodEnd: subscription.cancelAtPeriodEnd })
1344
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1345
+ SubscriptionStatusBadge,
1346
+ {
1347
+ status: subscription.status,
1348
+ cancelAtPeriodEnd: subscription.cancelAtPeriodEnd
1349
+ }
1350
+ )
1342
1351
  ] }),
1343
1352
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
1344
1353
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
@@ -1369,11 +1378,11 @@ function SubscriptionDetails({
1369
1378
  "."
1370
1379
  ] }) }),
1371
1380
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2 pt-4 border-t", children: [
1372
- onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Button, { variant: "default", onClick: () => onChangePlan(subscription), children: "Change Plan" }),
1373
- canPause && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Button, { variant: "outline", onClick: handlePause, disabled: isProcessing, children: isProcessing ? "Pausing..." : "Pause" }),
1374
- canResume && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Button, { variant: "outline", onClick: handleResume, disabled: isProcessing, children: isProcessing ? "Resuming..." : "Resume" }),
1375
- canCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Button, { variant: "destructive", onClick: () => setShowCancel(true), children: "Cancel" }),
1376
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Button, { variant: "outline", onClick: handleManageViaPortal, children: "Manage via Portal" })
1381
+ onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Button, { variant: "default", onClick: () => onChangePlan(subscription), children: "Change Plan" }),
1382
+ canPause && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Button, { variant: "outline", onClick: handlePause, disabled: isProcessing, children: isProcessing ? "Pausing..." : "Pause" }),
1383
+ canResume && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Button, { variant: "outline", onClick: handleResume, disabled: isProcessing, children: isProcessing ? "Resuming..." : "Resume" }),
1384
+ canCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Button, { variant: "destructive", onClick: () => setShowCancel(true), children: "Cancel" }),
1385
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Button, { variant: "outline", onClick: handleManageViaPortal, children: "Manage via Portal" })
1377
1386
  ] })
1378
1387
  ] })
1379
1388
  ] }) }),
@@ -1397,10 +1406,10 @@ _chunk7QVYU63Ejs.__name.call(void 0, SubscriptionDetails, "SubscriptionDetails")
1397
1406
 
1398
1407
  function formatPlanName3(price) {
1399
1408
  if (!price) return "N/A";
1400
- 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]) || "";
1401
1410
  const nickname = price.nickname || "";
1402
1411
  let interval = "";
1403
- if (_optionalChain([price, 'access', _46 => _46.recurring, 'optionalAccess', _47 => _47.interval])) {
1412
+ if (_optionalChain([price, 'access', _40 => _40.recurring, 'optionalAccess', _41 => _41.interval])) {
1404
1413
  const intervalMap = {
1405
1414
  day: "Daily",
1406
1415
  week: "Weekly",
@@ -1420,27 +1429,46 @@ function SubscriptionsList({ subscriptions, onSubscriptionsChange, onChangePlan
1420
1429
  setSelectedSub(subscription);
1421
1430
  }, "handleRowClick");
1422
1431
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
1423
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.Table, { children: [
1424
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.TableRow, { children: [
1425
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.TableHead, { children: "Status" }),
1426
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.TableHead, { children: "Plan" }),
1427
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.TableHead, { children: "Period" }),
1428
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.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, _chunkT2JCZYWKjs.Table, { children: [
1433
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.TableRow, { children: [
1434
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.TableHead, { children: "Status" }),
1435
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.TableHead, { children: "Plan" }),
1436
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.TableHead, { children: "Period" }),
1437
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.TableHead, { className: "text-right", children: "Amount" }),
1438
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.TableHead, { className: "text-right", children: "Actions" })
1429
1439
  ] }) }),
1430
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.TableBody, { children: subscriptions.map((subscription) => {
1440
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.TableBody, { children: subscriptions.map((subscription) => {
1431
1441
  const price = subscription.price;
1432
- 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";
1433
1443
  const period = `${formatDate3(subscription.currentPeriodStart)} - ${formatDate3(subscription.currentPeriodEnd)}`;
1434
1444
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1435
- _chunkE6PQQTWFjs.TableRow,
1445
+ _chunkT2JCZYWKjs.TableRow,
1436
1446
  {
1437
1447
  onClick: () => handleRowClick(subscription),
1438
1448
  className: "cursor-pointer hover:bg-muted/50",
1439
1449
  children: [
1440
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SubscriptionStatusBadge, { status: subscription.status, cancelAtPeriodEnd: subscription.cancelAtPeriodEnd }) }),
1441
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.TableCell, { className: "font-medium", children: formatPlanName3(price) }),
1442
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.TableCell, { className: "text-muted-foreground text-sm", children: period }),
1443
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.TableCell, { className: "text-right font-medium", children: amount })
1450
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1451
+ SubscriptionStatusBadge,
1452
+ {
1453
+ status: subscription.status,
1454
+ cancelAtPeriodEnd: subscription.cancelAtPeriodEnd
1455
+ }
1456
+ ) }),
1457
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.TableCell, { className: "font-medium", children: formatPlanName3(price) }),
1458
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.TableCell, { className: "text-muted-foreground text-sm", children: period }),
1459
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.TableCell, { className: "text-right font-medium", children: amount }),
1460
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.TableCell, { className: "text-right", children: (subscription.status === "active" /* ACTIVE */ || subscription.status === "trialing" /* TRIALING */) && onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1461
+ _chunkT2JCZYWKjs.Button,
1462
+ {
1463
+ size: "sm",
1464
+ variant: "outline",
1465
+ onClick: (e) => {
1466
+ e.stopPropagation();
1467
+ onChangePlan(subscription);
1468
+ },
1469
+ children: "Upgrade"
1470
+ }
1471
+ ) })
1444
1472
  ]
1445
1473
  },
1446
1474
  subscription.id
@@ -1475,7 +1503,7 @@ function SubscriptionsContainer({ onOpenWizard, hasActiveRecurringSubscription }
1475
1503
  const loadSubscriptions = _react.useCallback.call(void 0, async () => {
1476
1504
  setLoading(true);
1477
1505
  try {
1478
- const fetchedSubscriptions = await _chunk53IPQJVHjs.StripeSubscriptionService.listSubscriptions();
1506
+ const fetchedSubscriptions = await _chunk3EZX4G2Ejs.StripeSubscriptionService.listSubscriptions();
1479
1507
  setSubscriptions(fetchedSubscriptions);
1480
1508
  } catch (error) {
1481
1509
  console.error("[SubscriptionsContainer] Failed to load subscriptions:", error);
@@ -1498,7 +1526,7 @@ function SubscriptionsContainer({ onOpenWizard, hasActiveRecurringSubscription }
1498
1526
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8" }),
1499
1527
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-3xl font-bold", children: "Subscriptions" })
1500
1528
  ] }),
1501
- subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.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, _chunkT2JCZYWKjs.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _43 => _43()]), children: hasActiveRecurringSubscription ? "Purchase Add-ons" : "Subscribe to a Plan" })
1502
1530
  ] }),
1503
1531
  criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BillingAlertBanner, { subscription }, subscription.id)),
1504
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: [
@@ -1506,7 +1534,7 @@ function SubscriptionsContainer({ onOpenWizard, hasActiveRecurringSubscription }
1506
1534
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
1507
1535
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-xl font-semibold mb-2", children: "No Active Subscriptions" }),
1508
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." }),
1509
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _50 => _50()]), children: "Subscribe to a Plan" })
1537
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _44 => _44()]), children: "Subscribe to a Plan" })
1510
1538
  ] })
1511
1539
  ] }),
1512
1540
  subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -1514,7 +1542,7 @@ function SubscriptionsContainer({ onOpenWizard, hasActiveRecurringSubscription }
1514
1542
  {
1515
1543
  subscriptions,
1516
1544
  onSubscriptionsChange: loadSubscriptions,
1517
- onChangePlan: (sub) => _optionalChain([onOpenWizard, 'optionalCall', _51 => _51(sub)])
1545
+ onChangePlan: (sub) => _optionalChain([onOpenWizard, 'optionalCall', _45 => _45(sub)])
1518
1546
  }
1519
1547
  )
1520
1548
  ] });
@@ -1527,9 +1555,9 @@ function IntervalToggle({ value, onChange, hasMonthly, hasYearly }) {
1527
1555
  if (!hasMonthly || !hasYearly) {
1528
1556
  return null;
1529
1557
  }
1530
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Tabs, { value, onValueChange: (v) => onChange(v), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.TabsList, { children: [
1531
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.TabsTrigger, { value: "month", children: "Monthly" }),
1532
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.TabsTrigger, { value: "year", children: "Yearly" })
1558
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Tabs, { value, onValueChange: (v) => onChange(v), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.TabsList, { children: [
1559
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.TabsTrigger, { value: "month", children: "Monthly" }),
1560
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.TabsTrigger, { value: "year", children: "Yearly" })
1533
1561
  ] }) });
1534
1562
  }
1535
1563
  _chunk7QVYU63Ejs.__name.call(void 0, IntervalToggle, "IntervalToggle");
@@ -1537,7 +1565,14 @@ _chunk7QVYU63Ejs.__name.call(void 0, IntervalToggle, "IntervalToggle");
1537
1565
  // src/features/billing/stripe-subscription/components/widgets/PricingCard.tsx
1538
1566
 
1539
1567
 
1540
- function PricingCard({ price, isCurrentPlan = false, isSelected = false, isDisabled = false, isLoading = false, onSelect }) {
1568
+ function PricingCard({
1569
+ price,
1570
+ isCurrentPlan = false,
1571
+ isSelected = false,
1572
+ isDisabled = false,
1573
+ isLoading = false,
1574
+ onSelect
1575
+ }) {
1541
1576
  const description = price.description || price.nickname || "Standard";
1542
1577
  const features = price.features || [];
1543
1578
  const formattedPrice = formatCurrency(price.unitAmount, price.currency);
@@ -1554,7 +1589,7 @@ function PricingCard({ price, isCurrentPlan = false, isSelected = false, isDisab
1554
1589
  }
1555
1590
  }, "handleClick");
1556
1591
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1557
- _chunkE6PQQTWFjs.Card,
1592
+ _chunkT2JCZYWKjs.Card,
1558
1593
  {
1559
1594
  role: "radio",
1560
1595
  "aria-checked": isSelected,
@@ -1562,7 +1597,7 @@ function PricingCard({ price, isCurrentPlan = false, isSelected = false, isDisab
1562
1597
  tabIndex: isDisabled ? -1 : 0,
1563
1598
  onKeyDown: handleKeyDown,
1564
1599
  onClick: handleClick,
1565
- className: _chunk53IPQJVHjs.cn.call(void 0,
1600
+ className: _chunk3EZX4G2Ejs.cn.call(void 0,
1566
1601
  "relative cursor-pointer transition-all duration-200 flex flex-col h-full",
1567
1602
  "focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
1568
1603
  isCurrentPlan && "bg-muted/30",
@@ -1572,9 +1607,9 @@ function PricingCard({ price, isCurrentPlan = false, isSelected = false, isDisab
1572
1607
  isLoading && "pointer-events-none"
1573
1608
  ),
1574
1609
  children: [
1575
- isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Badge, { variant: "secondary", className: "absolute top-2 right-2", children: "Current" }),
1576
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.CardHeader, { className: "pb-2", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "font-semibold text-lg", children: description }) }),
1577
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.CardContent, { className: "pb-4 grow", children: [
1610
+ isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Badge, { variant: "secondary", className: "absolute top-2 right-2", children: "Current" }),
1611
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.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, _chunkT2JCZYWKjs.CardContent, { className: "pb-4 grow", children: [
1578
1613
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mb-4", children: [
1579
1614
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-3xl font-bold", children: formattedPrice }),
1580
1615
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground ml-1", children: interval })
@@ -1584,8 +1619,8 @@ function PricingCard({ price, isCurrentPlan = false, isSelected = false, isDisab
1584
1619
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-muted-foreground", children: feature })
1585
1620
  ] }, index)) })
1586
1621
  ] }),
1587
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.CardFooter, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1588
- _chunkE6PQQTWFjs.Button,
1622
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.CardFooter, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1623
+ _chunkT2JCZYWKjs.Button,
1589
1624
  {
1590
1625
  variant: isCurrentPlan ? "secondary" : isSelected ? "default" : "outline",
1591
1626
  className: "w-full",
@@ -1649,11 +1684,11 @@ function getFilteredPrices(prices, selectedInterval) {
1649
1684
  return prices.filter((p) => p.priceType === "one_time");
1650
1685
  }
1651
1686
  const intervalPrices = prices.filter(
1652
- (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
1653
1688
  );
1654
1689
  if (intervalPrices.length === 0) {
1655
1690
  const fallbackInterval = selectedInterval === "month" ? "year" : "month";
1656
- 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);
1657
1692
  }
1658
1693
  return intervalPrices;
1659
1694
  }
@@ -1713,15 +1748,15 @@ function ProductPricingList({
1713
1748
  _chunk7QVYU63Ejs.__name.call(void 0, ProductPricingList, "ProductPricingList");
1714
1749
  function ProductPricingListSkeleton() {
1715
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: [
1716
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Skeleton, { className: "h-6 w-32" }),
1751
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Skeleton, { className: "h-6 w-32" }),
1717
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: [
1718
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Skeleton, { className: "h-6 w-24" }),
1719
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Skeleton, { className: "h-8 w-32" }),
1753
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Skeleton, { className: "h-6 w-24" }),
1754
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Skeleton, { className: "h-8 w-32" }),
1720
1755
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
1721
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Skeleton, { className: "h-4 w-full" }),
1722
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Skeleton, { className: "h-4 w-3/4" })
1756
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Skeleton, { className: "h-4 w-full" }),
1757
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Skeleton, { className: "h-4 w-3/4" })
1723
1758
  ] }),
1724
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Skeleton, { className: "h-10 w-full" })
1759
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Skeleton, { className: "h-10 w-full" })
1725
1760
  ] }, cardIndex)) })
1726
1761
  ] }, rowIndex)) });
1727
1762
  }
@@ -1757,8 +1792,8 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProrationPreview, "ProrationPreview");
1757
1792
 
1758
1793
 
1759
1794
  function SubscriptionConfirmation({ price, isLoading, onConfirm, onCancel }) {
1760
- const productName = _optionalChain([price, 'access', _56 => _56.product, 'optionalAccess', _57 => _57.name]) || price.nickname || "Selected Plan";
1761
- 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;
1762
1797
  const features = price.features || [];
1763
1798
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-accent/10 border border-accent/30 rounded-lg p-4", children: [
1764
1799
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "font-semibold mb-3", children: "Confirm Your Subscription" }),
@@ -1776,8 +1811,8 @@ function SubscriptionConfirmation({ price, isLoading, onConfirm, onCancel }) {
1776
1811
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: feature })
1777
1812
  ] }, index)) }),
1778
1813
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-3 pt-2 border-t border-accent/30", children: [
1779
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Button, { variant: "outline", onClick: onCancel, disabled: isLoading, children: "Cancel" }),
1780
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Button, { onClick: onConfirm, disabled: isLoading, children: isLoading ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
1814
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Button, { variant: "outline", onClick: onCancel, disabled: isLoading, children: "Cancel" }),
1815
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Button, { onClick: onConfirm, disabled: isLoading, children: isLoading ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
1781
1816
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "h-4 w-4 animate-spin mr-2" }),
1782
1817
  "Processing..."
1783
1818
  ] }) : "Subscribe" })
@@ -1800,7 +1835,11 @@ var initialState = {
1800
1835
  hasPaymentMethod: false,
1801
1836
  isProcessing: false,
1802
1837
  error: null,
1803
- prorationPreview: null
1838
+ prorationPreview: null,
1839
+ promotionCode: null,
1840
+ isValidatingPromoCode: false,
1841
+ promoCodeError: null,
1842
+ isTrialSubscription: false
1804
1843
  };
1805
1844
  function wizardReducer(state, action) {
1806
1845
  switch (action.type) {
@@ -1818,6 +1857,14 @@ function wizardReducer(state, action) {
1818
1857
  return { ...state, error: action.error };
1819
1858
  case "SET_PRORATION_PREVIEW":
1820
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 };
1821
1868
  case "RESET":
1822
1869
  return initialState;
1823
1870
  default:
@@ -1828,7 +1875,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, wizardReducer, "wizardReducer");
1828
1875
  function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
1829
1876
  const [state, dispatch] = _react.useReducer.call(void 0, wizardReducer, {
1830
1877
  ...initialState,
1831
- selectedPrice: _optionalChain([subscription, 'optionalAccess', _60 => _60.price]) || null
1878
+ selectedPrice: _optionalChain([subscription, 'optionalAccess', _54 => _54.price]) || null
1832
1879
  });
1833
1880
  const onSuccessRef = _react.useRef.call(void 0, onSuccess);
1834
1881
  const onCloseRef = _react.useRef.call(void 0, onClose);
@@ -1836,7 +1883,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
1836
1883
  onCloseRef.current = onClose;
1837
1884
  const checkPaymentMethod = _react.useCallback.call(void 0, async () => {
1838
1885
  try {
1839
- const methods = await _chunk53IPQJVHjs.StripeCustomerService.listPaymentMethods();
1886
+ const methods = await _chunk3EZX4G2Ejs.StripeCustomerService.listPaymentMethods();
1840
1887
  dispatch({ type: "SET_HAS_PAYMENT_METHOD", hasMethod: methods.length > 0 });
1841
1888
  } catch (error) {
1842
1889
  console.error("[useSubscriptionWizard] Failed to check payment methods:", error);
@@ -1857,8 +1904,21 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
1857
1904
  dispatch({ type: "SET_PROCESSING", isProcessing: true });
1858
1905
  try {
1859
1906
  await checkPaymentMethod();
1860
- if (subscription && state.selectedPrice.id !== _optionalChain([subscription, 'access', _61 => _61.price, 'optionalAccess', _62 => _62.id])) {
1861
- 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({
1862
1922
  subscriptionId: subscription.id,
1863
1923
  newPriceId: state.selectedPrice.id
1864
1924
  });
@@ -1867,48 +1927,57 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
1867
1927
  dispatch({ type: "SET_STEP", step: "review" });
1868
1928
  } catch (error) {
1869
1929
  console.error("[useSubscriptionWizard] Error preparing review:", error);
1870
- 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" });
1871
1931
  } finally {
1872
1932
  dispatch({ type: "SET_PROCESSING", isProcessing: false });
1873
1933
  }
1874
- }, [state.selectedPrice, subscription, checkPaymentMethod]);
1934
+ }, [state.selectedPrice, state.hasPaymentMethod, subscription, checkPaymentMethod]);
1875
1935
  const confirmSubscription = _react.useCallback.call(void 0, async () => {
1876
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]));
1877
1940
  dispatch({ type: "SET_PROCESSING", isProcessing: true });
1878
1941
  dispatch({ type: "SET_ERROR", error: null });
1879
1942
  try {
1880
1943
  if (subscription) {
1881
- await _chunk53IPQJVHjs.StripeSubscriptionService.changePlan({
1944
+ const changePlanParams = {
1882
1945
  id: subscription.id,
1883
- newPriceId: state.selectedPrice.id
1884
- });
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);
1885
1951
  } else {
1886
- await _chunk53IPQJVHjs.StripeSubscriptionService.createSubscription({
1952
+ const createParams = {
1887
1953
  id: _uuid.v4.call(void 0, ),
1888
- priceId: state.selectedPrice.id
1889
- });
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);
1890
1959
  }
1891
1960
  onSuccessRef.current();
1892
1961
  onCloseRef.current();
1893
1962
  } catch (error) {
1894
1963
  console.error("[useSubscriptionWizard] Subscription error:", error);
1895
- 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) {
1896
1965
  dispatch({
1897
1966
  type: "SET_ERROR",
1898
1967
  error: "You already have an active subscription. Please change your existing plan instead."
1899
1968
  });
1900
1969
  return;
1901
1970
  }
1902
- 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) {
1903
1972
  dispatch({ type: "SET_HAS_PAYMENT_METHOD", hasMethod: false });
1904
1973
  dispatch({ type: "SET_STEP", step: "payment-method" });
1905
1974
  return;
1906
1975
  }
1907
- 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" });
1908
1977
  } finally {
1909
1978
  dispatch({ type: "SET_PROCESSING", isProcessing: false });
1910
1979
  }
1911
- }, [state.selectedPrice, subscription]);
1980
+ }, [state.selectedPrice, state.promotionCode, subscription]);
1912
1981
  const handlePaymentMethodSuccess = _react.useCallback.call(void 0, async () => {
1913
1982
  dispatch({ type: "SET_HAS_PAYMENT_METHOD", hasMethod: true });
1914
1983
  dispatch({ type: "SET_STEP", step: "review" });
@@ -1916,6 +1985,34 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
1916
1985
  const reset = _react.useCallback.call(void 0, () => {
1917
1986
  dispatch({ type: "RESET" });
1918
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
+ }, []);
1919
2016
  const actions = _react.useMemo.call(void 0,
1920
2017
  () => ({
1921
2018
  selectPrice,
@@ -1925,7 +2022,9 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
1925
2022
  confirmSubscription,
1926
2023
  handlePaymentMethodSuccess,
1927
2024
  checkPaymentMethod,
1928
- reset
2025
+ reset,
2026
+ validatePromoCode,
2027
+ clearPromoCode
1929
2028
  }),
1930
2029
  [
1931
2030
  selectPrice,
@@ -1935,7 +2034,9 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
1935
2034
  confirmSubscription,
1936
2035
  handlePaymentMethodSuccess,
1937
2036
  checkPaymentMethod,
1938
- reset
2037
+ reset,
2038
+ validatePromoCode,
2039
+ clearPromoCode
1939
2040
  ]
1940
2041
  );
1941
2042
  return {
@@ -1970,19 +2071,8 @@ function WizardProgressIndicator({ currentStep }) {
1970
2071
  children: isCompleted ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Check, { className: "h-4 w-4" }) : index + 1
1971
2072
  }
1972
2073
  ),
1973
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1974
- "span",
1975
- {
1976
- className: `text-sm ${isCurrent ? "font-medium text-foreground" : "text-muted-foreground"}`,
1977
- children: step.label
1978
- }
1979
- ),
1980
- index < STEPS.length - 1 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1981
- "div",
1982
- {
1983
- className: `h-0.5 w-8 ${index < currentIndex ? "bg-primary" : "bg-muted"}`
1984
- }
1985
- )
2074
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `text-sm ${isCurrent ? "font-medium text-foreground" : "text-muted-foreground"}`, children: step.label }),
2075
+ index < STEPS.length - 1 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: `h-0.5 w-8 ${index < currentIndex ? "bg-primary" : "bg-muted"}` })
1986
2076
  ] }, step.key);
1987
2077
  }) });
1988
2078
  }
@@ -2007,7 +2097,7 @@ function WizardStepPlanSelection({
2007
2097
  _react.useEffect.call(void 0, () => {
2008
2098
  const loadProducts = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
2009
2099
  try {
2010
- const fetchedProducts = await _chunk53IPQJVHjs.StripeProductService.listProducts({ active: true });
2100
+ const fetchedProducts = await _chunk3EZX4G2Ejs.StripeProductService.listProducts({ active: true });
2011
2101
  setProducts(fetchedProducts);
2012
2102
  } catch (error) {
2013
2103
  console.error("[WizardStepPlanSelection] Failed to load products:", error);
@@ -2022,10 +2112,10 @@ function WizardStepPlanSelection({
2022
2112
  let hasYearly2 = false;
2023
2113
  for (const product of products) {
2024
2114
  for (const price of product.stripePrices || []) {
2025
- 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") {
2026
2116
  hasMonthly2 = true;
2027
2117
  }
2028
- 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") {
2029
2119
  hasYearly2 = true;
2030
2120
  }
2031
2121
  }
@@ -2051,14 +2141,14 @@ function WizardStepPlanSelection({
2051
2141
  products,
2052
2142
  selectedInterval,
2053
2143
  currentPriceId,
2054
- selectedPriceId: _optionalChain([selectedPrice, 'optionalAccess', _75 => _75.id]),
2144
+ selectedPriceId: _optionalChain([selectedPrice, 'optionalAccess', _81 => _81.id]),
2055
2145
  loading,
2056
2146
  hideRecurringPrices,
2057
2147
  hideOneTimePrices,
2058
2148
  onSelectPrice: handleSelectPrice
2059
2149
  }
2060
2150
  ),
2061
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex justify-end pt-4 border-t", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.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, _chunkT2JCZYWKjs.Button, { onClick: onNext, disabled: !selectedPrice || isProcessing, children: isProcessing ? "Loading..." : "Next: Review" }) })
2062
2152
  ] });
2063
2153
  }
2064
2154
  _chunk7QVYU63Ejs.__name.call(void 0, WizardStepPlanSelection, "WizardStepPlanSelection");
@@ -2066,6 +2156,95 @@ _chunk7QVYU63Ejs.__name.call(void 0, WizardStepPlanSelection, "WizardStepPlanSel
2066
2156
  // src/features/billing/stripe-subscription/components/wizards/WizardStepReview.tsx
2067
2157
 
2068
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
+ _chunkT2JCZYWKjs.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
+ _chunkT2JCZYWKjs.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, _chunkT2JCZYWKjs.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
+
2069
2248
  function WizardStepReview({
2070
2249
  selectedPrice,
2071
2250
  subscription,
@@ -2075,60 +2254,121 @@ function WizardStepReview({
2075
2254
  isProcessing,
2076
2255
  onBack,
2077
2256
  onAddPaymentMethod,
2078
- onConfirm
2257
+ onConfirm,
2258
+ promotionCode,
2259
+ isValidatingPromoCode,
2260
+ promoCodeError,
2261
+ onApplyPromoCode,
2262
+ onRemovePromoCode,
2263
+ isTrialUpgrade
2079
2264
  }) {
2080
2265
  if (!selectedPrice) {
2081
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." });
2082
2267
  }
2083
- 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;
2084
2269
  const formatInterval2 = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (price) => {
2085
2270
  if (price.priceType === "one_time") return "one-time";
2086
- 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";
2087
2272
  return interval === "year" ? "yearly" : "monthly";
2088
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();
2089
2309
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
2090
2310
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-muted/50 rounded-lg p-4 space-y-3", children: [
2091
2311
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "font-semibold text-lg", children: "Selected Plan" }),
2092
2312
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between items-center", children: [
2093
2313
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
2094
- /* @__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]) }),
2095
2315
  selectedPrice.nickname && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: selectedPrice.nickname })
2096
2316
  ] }),
2097
2317
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-right", children: [
2098
- /* @__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) }),
2099
2323
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: formatInterval2(selectedPrice) })
2100
2324
  ] })
2101
2325
  ] })
2102
2326
  ] }),
2103
- 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: [
2104
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "font-medium text-blue-800", children: "Proration Summary" }),
2105
- /* @__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." }),
2106
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between text-sm", children: [
2107
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-blue-600", children: "Amount due now:" }),
2108
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "font-medium text-blue-800", children: formatCurrency(prorationPreview.immediateCharge, prorationPreview.currency) })
2109
- ] })
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
+ )
2110
2357
  ] }),
2111
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: [
2112
2359
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
2113
2360
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "font-medium", children: "Payment Method" }),
2114
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" })
2115
2362
  ] }),
2116
- !hasPaymentMethod && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Button, { variant: "outline", onClick: onAddPaymentMethod, children: "Add Payment Method" })
2363
+ !hasPaymentMethod && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Button, { variant: "outline", onClick: onAddPaymentMethod, children: "Add Payment Method" })
2117
2364
  ] }) }),
2118
- error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.Alert, { variant: "destructive", children: [
2365
+ error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.Alert, { variant: "destructive", children: [
2119
2366
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.AlertCircle, { className: "h-4 w-4" }),
2120
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.AlertDescription, { children: error })
2367
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.AlertDescription, { children: error })
2121
2368
  ] }),
2122
2369
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between pt-4 border-t", children: [
2123
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Button, { variant: "outline", onClick: onBack, disabled: isProcessing, children: "Back" }),
2124
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2125
- _chunkE6PQQTWFjs.Button,
2126
- {
2127
- onClick: hasPaymentMethod ? onConfirm : onAddPaymentMethod,
2128
- disabled: isProcessing,
2129
- children: isProcessing ? "Processing..." : hasPaymentMethod ? isChangingPlan ? "Confirm Plan Change" : "Subscribe Now" : "Add Payment Method"
2130
- }
2131
- )
2370
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Button, { variant: "outline", onClick: onBack, disabled: isProcessing, children: "Back" }),
2371
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Button, { onClick: hasPaymentMethod ? onConfirm : onAddPaymentMethod, disabled: isProcessing, children: isProcessing ? "Processing..." : hasPaymentMethod ? isChangingPlan ? "Confirm Plan Change" : "Subscribe Now" : "Add Payment Method" })
2132
2372
  ] })
2133
2373
  ] });
2134
2374
  }
@@ -2136,24 +2376,13 @@ _chunk7QVYU63Ejs.__name.call(void 0, WizardStepReview, "WizardStepReview");
2136
2376
 
2137
2377
  // src/features/billing/stripe-subscription/components/wizards/WizardStepPaymentMethod.tsx
2138
2378
 
2139
- function WizardStepPaymentMethod({
2140
- onBack,
2141
- onSuccess,
2142
- isProcessing
2143
- }) {
2379
+ function WizardStepPaymentMethod({ onBack, onSuccess, isProcessing }) {
2144
2380
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
2145
2381
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
2146
2382
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "font-semibold text-lg", children: "Add Payment Method" }),
2147
2383
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: "Enter your card details to complete your subscription" })
2148
2384
  ] }),
2149
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2150
- PaymentMethodForm,
2151
- {
2152
- onSuccess,
2153
- onCancel: onBack,
2154
- isLoading: isProcessing
2155
- }
2156
- )
2385
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodForm, { onSuccess, onCancel: onBack, isLoading: isProcessing })
2157
2386
  ] });
2158
2387
  }
2159
2388
  _chunk7QVYU63Ejs.__name.call(void 0, WizardStepPaymentMethod, "WizardStepPaymentMethod");
@@ -2192,10 +2421,10 @@ function SubscriptionWizard({
2192
2421
  const isChangePlanMode = !!subscription;
2193
2422
  const dialogTitle = subscription ? "Change Subscription Plan" : isPurchasingAddons ? "Purchase Add-ons" : "Subscribe to a Plan";
2194
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";
2195
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.DialogContent, { className: "max-w-2xl", children: [
2196
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.DialogHeader, { children: [
2197
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.DialogTitle, { children: dialogTitle }),
2198
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.DialogDescription, { children: dialogDescription })
2424
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.DialogContent, { className: "max-w-2xl", children: [
2425
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.DialogHeader, { children: [
2426
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.DialogTitle, { children: dialogTitle }),
2427
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.DialogDescription, { children: dialogDescription })
2199
2428
  ] }),
2200
2429
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, WizardProgressIndicator, { currentStep: state.step }),
2201
2430
  state.step === "plan-selection" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -2203,7 +2432,7 @@ function SubscriptionWizard({
2203
2432
  {
2204
2433
  selectedPrice: state.selectedPrice,
2205
2434
  selectedInterval: state.selectedInterval,
2206
- currentPriceId: _optionalChain([subscription, 'optionalAccess', _82 => _82.price, 'optionalAccess', _83 => _83.id]),
2435
+ currentPriceId: _optionalChain([subscription, 'optionalAccess', _96 => _96.price, 'optionalAccess', _97 => _97.id]),
2207
2436
  hideRecurringPrices: isPurchasingAddons,
2208
2437
  hideOneTimePrices: isChangePlanMode,
2209
2438
  onSelectPrice: actions.selectPrice,
@@ -2223,7 +2452,13 @@ function SubscriptionWizard({
2223
2452
  isProcessing: state.isProcessing,
2224
2453
  onBack: () => actions.goToStep("plan-selection"),
2225
2454
  onAddPaymentMethod: () => actions.goToStep("payment-method"),
2226
- 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
2227
2462
  }
2228
2463
  ),
2229
2464
  state.step === "payment-method" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -2259,28 +2494,28 @@ function formatDate4(date) {
2259
2494
  month: "short",
2260
2495
  day: "numeric"
2261
2496
  }).format(new Date(date));
2262
- } catch (error) {
2497
+ } catch (_error) {
2263
2498
  return "Invalid Date";
2264
2499
  }
2265
2500
  }
2266
2501
  _chunk7QVYU63Ejs.__name.call(void 0, formatDate4, "formatDate");
2267
2502
  function UsageSummaryCard({ meter, summary }) {
2268
- const currentUsage = _nullishCoalesce(_optionalChain([summary, 'optionalAccess', _84 => _84.aggregatedValue]), () => ( 0));
2503
+ const currentUsage = _nullishCoalesce(_optionalChain([summary, 'optionalAccess', _98 => _98.aggregatedValue]), () => ( 0));
2269
2504
  const limit = meter.limit;
2270
2505
  const percentage = limit && limit > 0 ? currentUsage / limit * 100 : null;
2271
2506
  const progressColor = getProgressColor(percentage);
2272
2507
  const progressWidth = percentage !== null ? Math.min(percentage, 100) : 0;
2273
2508
  const displayName = meter.displayName || meter.eventName;
2274
2509
  const hasLimit = limit !== null && limit !== void 0;
2275
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.Card, { children: [
2276
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.CardHeader, { className: "flex flex-row items-center gap-x-3 pb-3", children: [
2510
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.Card, { children: [
2511
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.CardHeader, { className: "flex flex-row items-center gap-x-3 pb-3", children: [
2277
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" }) }),
2278
2513
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col", children: [
2279
2514
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "font-semibold", children: displayName }),
2280
2515
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-gray-500", children: meter.id })
2281
2516
  ] })
2282
2517
  ] }),
2283
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.CardContent, { className: "flex flex-col gap-y-4", children: [
2518
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.CardContent, { className: "flex flex-col gap-y-4", children: [
2284
2519
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
2285
2520
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-3xl font-bold", children: currentUsage.toLocaleString() }),
2286
2521
  hasLimit && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm text-gray-500", children: [
@@ -2292,7 +2527,7 @@ function UsageSummaryCard({ meter, summary }) {
2292
2527
  hasLimit ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-2", children: [
2293
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}%` } }) }),
2294
2529
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm text-gray-500", children: [
2295
- _optionalChain([percentage, 'optionalAccess', _85 => _85.toFixed, 'call', _86 => _86(1)]),
2530
+ _optionalChain([percentage, 'optionalAccess', _99 => _99.toFixed, 'call', _100 => _100(1)]),
2296
2531
  "% used"
2297
2532
  ] })
2298
2533
  ] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-gray-500", children: "No limit set" }),
@@ -2327,14 +2562,14 @@ function UsageContainer() {
2327
2562
  const loadUsageData = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
2328
2563
  setLoading(true);
2329
2564
  try {
2330
- const fetchedSubscriptions = await _chunk53IPQJVHjs.StripeSubscriptionService.listSubscriptions();
2565
+ const fetchedSubscriptions = await _chunk3EZX4G2Ejs.StripeSubscriptionService.listSubscriptions();
2331
2566
  setSubscriptions(fetchedSubscriptions);
2332
- 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");
2333
2568
  if (!hasMeteredSubscriptions2) {
2334
2569
  setLoading(false);
2335
2570
  return;
2336
2571
  }
2337
- const fetchedMeters = await _chunk53IPQJVHjs.StripeUsageService.listMeters();
2572
+ const fetchedMeters = await _chunk3EZX4G2Ejs.StripeUsageService.listMeters();
2338
2573
  setMeters(fetchedMeters);
2339
2574
  const summariesMap = {};
2340
2575
  const now = /* @__PURE__ */ new Date();
@@ -2342,7 +2577,7 @@ function UsageContainer() {
2342
2577
  const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
2343
2578
  for (const meter of fetchedMeters) {
2344
2579
  try {
2345
- const meterSummaries = await _chunk53IPQJVHjs.StripeUsageService.getMeterSummaries({
2580
+ const meterSummaries = await _chunk3EZX4G2Ejs.StripeUsageService.getMeterSummaries({
2346
2581
  meterId: meter.id,
2347
2582
  startTime: startOfMonth,
2348
2583
  endTime: endOfMonth
@@ -2360,7 +2595,7 @@ function UsageContainer() {
2360
2595
  setLoading(false);
2361
2596
  }
2362
2597
  }, "loadUsageData");
2363
- 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");
2364
2599
  if (!loading && !hasMeteredSubscriptions) {
2365
2600
  return null;
2366
2601
  }
@@ -2397,7 +2632,7 @@ function formatDateTime(date) {
2397
2632
  hour: "numeric",
2398
2633
  minute: "2-digit"
2399
2634
  }).format(dateObj);
2400
- } catch (error) {
2635
+ } catch (_error) {
2401
2636
  return "Invalid Date";
2402
2637
  }
2403
2638
  }
@@ -2408,21 +2643,21 @@ function UsageHistoryTable({ usageRecords }) {
2408
2643
  }
2409
2644
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
2410
2645
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h2", { className: "text-xl font-semibold", children: "Usage History" }),
2411
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-clip rounded-lg border", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.Table, { children: [
2412
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.TableRow, { children: [
2413
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.TableHead, { children: "Date & Time" }),
2414
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.TableHead, { children: "Meter Event" }),
2415
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.TableHead, { className: "text-right", children: "Quantity" }),
2416
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.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, _chunkT2JCZYWKjs.Table, { children: [
2647
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.TableRow, { children: [
2648
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.TableHead, { children: "Date & Time" }),
2649
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.TableHead, { children: "Meter Event" }),
2650
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.TableHead, { className: "text-right", children: "Quantity" }),
2651
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.TableHead, { children: "Event ID" })
2417
2652
  ] }) }),
2418
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.TableBody, { children: usageRecords.map((record) => {
2653
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.TableBody, { children: usageRecords.map((record) => {
2419
2654
  const dateTime = formatDateTime(record.timestamp);
2420
2655
  const quantity = record.quantity.toLocaleString();
2421
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.TableRow, { children: [
2422
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.TableCell, { className: "font-medium", children: dateTime }),
2423
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.TableCell, { className: "text-muted-foreground", children: record.meterEventName }),
2424
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.TableCell, { className: "text-right font-medium", children: quantity }),
2425
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.TableCell, { className: "text-muted-foreground text-sm font-mono", children: record.stripeEventId })
2656
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.TableRow, { children: [
2657
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.TableCell, { className: "font-medium", children: dateTime }),
2658
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.TableCell, { className: "text-muted-foreground", children: record.meterEventName }),
2659
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.TableCell, { className: "text-right font-medium", children: quantity }),
2660
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.TableCell, { className: "text-muted-foreground text-sm font-mono", children: record.stripeEventId })
2426
2661
  ] }, record.id);
2427
2662
  }) })
2428
2663
  ] }) })
@@ -2432,15 +2667,9 @@ _chunk7QVYU63Ejs.__name.call(void 0, UsageHistoryTable, "UsageHistoryTable");
2432
2667
 
2433
2668
  // src/features/billing/components/modals/BillingDetailModal.tsx
2434
2669
 
2435
- function BillingDetailModal({
2436
- open,
2437
- onOpenChange,
2438
- title,
2439
- children,
2440
- className
2441
- }) {
2442
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.DialogContent, { className: _nullishCoalesce(className, () => ( "max-w-4xl max-h-[90vh] overflow-y-auto")), children: [
2443
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.DialogHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.DialogTitle, { children: title }) }),
2670
+ function BillingDetailModal({ open, onOpenChange, title, children, className }) {
2671
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.DialogContent, { className: _nullishCoalesce(className, () => ( "max-w-4xl max-h-[90vh] overflow-y-auto")), children: [
2672
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.DialogHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.DialogTitle, { children: title }) }),
2444
2673
  children
2445
2674
  ] }) });
2446
2675
  }
@@ -2457,7 +2686,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
2457
2686
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "font-semibold text-red-900", children: "Payment Failed" }),
2458
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." })
2459
2688
  ] }),
2460
- onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.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, _chunkT2JCZYWKjs.Button, { variant: "outline", size: "sm", onClick: onUpdatePayment, className: "border-red-300 text-red-700", children: "Update Payment Method" })
2461
2690
  ] });
2462
2691
  }
2463
2692
  if (subscription.status === "trialing" /* TRIALING */ && subscription.trialEnd) {
@@ -2477,7 +2706,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
2477
2706
  ". Add a payment method to continue your subscription."
2478
2707
  ] })
2479
2708
  ] }),
2480
- onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.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, _chunkT2JCZYWKjs.Button, { variant: "outline", size: "sm", onClick: onAddPayment, className: "border-yellow-300 text-yellow-700", children: "Add Payment Method" })
2481
2710
  ] });
2482
2711
  }
2483
2712
  }
@@ -2517,18 +2746,18 @@ function BillingDashboardContainer() {
2517
2746
  const [showWizard, setShowWizard] = _react.useState.call(void 0, false);
2518
2747
  const [editingSubscription, setEditingSubscription] = _react.useState.call(void 0, null);
2519
2748
  const hasMeteredSubscriptions = _react.useCallback.call(void 0, () => {
2520
- 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");
2521
2750
  }, [data.subscriptions]);
2522
2751
  const hasActiveRecurringSubscription = _react.useMemo.call(void 0, () => {
2523
2752
  return data.subscriptions.some(
2524
- (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"
2525
2754
  );
2526
2755
  }, [data.subscriptions]);
2527
2756
  const fetchAllData = _react.useCallback.call(void 0, async () => {
2528
2757
  setNoCustomerExists(false);
2529
2758
  let customer = null;
2530
2759
  try {
2531
- customer = await _chunk53IPQJVHjs.StripeCustomerService.getCustomer();
2760
+ customer = await _chunk3EZX4G2Ejs.StripeCustomerService.getCustomer();
2532
2761
  setData((prev) => ({ ...prev, customer }));
2533
2762
  setErrors((prev) => ({ ...prev, customer: null }));
2534
2763
  setNoCustomerExists(false);
@@ -2553,7 +2782,7 @@ function BillingDashboardContainer() {
2553
2782
  if (customer) {
2554
2783
  const fetchSubscriptions = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
2555
2784
  try {
2556
- const subscriptions2 = await _chunk53IPQJVHjs.StripeSubscriptionService.listSubscriptions();
2785
+ const subscriptions2 = await _chunk3EZX4G2Ejs.StripeSubscriptionService.listSubscriptions();
2557
2786
  setData((prev) => ({ ...prev, subscriptions: subscriptions2 }));
2558
2787
  setErrors((prev) => ({ ...prev, subscriptions: null }));
2559
2788
  return subscriptions2;
@@ -2567,7 +2796,7 @@ function BillingDashboardContainer() {
2567
2796
  }, "fetchSubscriptions");
2568
2797
  const fetchPaymentMethods = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
2569
2798
  try {
2570
- const paymentMethods = await _chunk53IPQJVHjs.StripeCustomerService.listPaymentMethods();
2799
+ const paymentMethods = await _chunk3EZX4G2Ejs.StripeCustomerService.listPaymentMethods();
2571
2800
  setData((prev) => ({ ...prev, paymentMethods }));
2572
2801
  setErrors((prev) => ({ ...prev, paymentMethods: null }));
2573
2802
  } catch (error) {
@@ -2579,7 +2808,7 @@ function BillingDashboardContainer() {
2579
2808
  }, "fetchPaymentMethods");
2580
2809
  const fetchInvoices = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
2581
2810
  try {
2582
- const invoices = await _chunk53IPQJVHjs.StripeInvoiceService.listInvoices();
2811
+ const invoices = await _chunk3EZX4G2Ejs.StripeInvoiceService.listInvoices();
2583
2812
  setData((prev) => ({ ...prev, invoices }));
2584
2813
  setErrors((prev) => ({ ...prev, invoices: null }));
2585
2814
  } catch (error) {
@@ -2591,7 +2820,7 @@ function BillingDashboardContainer() {
2591
2820
  }, "fetchInvoices");
2592
2821
  const [subscriptions] = await Promise.all([fetchSubscriptions(), fetchPaymentMethods(), fetchInvoices()]);
2593
2822
  const hasMetered = subscriptions.some(
2594
- (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"
2595
2824
  );
2596
2825
  if (hasMetered) {
2597
2826
  await fetchUsageData();
@@ -2603,7 +2832,7 @@ function BillingDashboardContainer() {
2603
2832
  const handleCreateCustomer = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
2604
2833
  setCreatingCustomer(true);
2605
2834
  try {
2606
- await _chunk53IPQJVHjs.StripeCustomerService.createCustomer();
2835
+ await _chunk3EZX4G2Ejs.StripeCustomerService.createCustomer();
2607
2836
  setNoCustomerExists(false);
2608
2837
  await fetchAllData();
2609
2838
  } catch (error) {
@@ -2615,7 +2844,7 @@ function BillingDashboardContainer() {
2615
2844
  }, "handleCreateCustomer");
2616
2845
  const fetchUsageData = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
2617
2846
  try {
2618
- const meters = await _chunk53IPQJVHjs.StripeUsageService.listMeters();
2847
+ const meters = await _chunk3EZX4G2Ejs.StripeUsageService.listMeters();
2619
2848
  setData((prev) => ({ ...prev, meters }));
2620
2849
  const summariesMap = {};
2621
2850
  const now = /* @__PURE__ */ new Date();
@@ -2623,7 +2852,7 @@ function BillingDashboardContainer() {
2623
2852
  const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
2624
2853
  for (const meter of meters) {
2625
2854
  try {
2626
- const meterSummaries = await _chunk53IPQJVHjs.StripeUsageService.getMeterSummaries({
2855
+ const meterSummaries = await _chunk3EZX4G2Ejs.StripeUsageService.getMeterSummaries({
2627
2856
  meterId: meter.id,
2628
2857
  startTime: startOfMonth,
2629
2858
  endTime: endOfMonth
@@ -2701,18 +2930,18 @@ function BillingDashboardContainer() {
2701
2930
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-8 w-8" }),
2702
2931
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-3xl font-bold", children: "Billing" })
2703
2932
  ] }),
2704
- isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.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" }) }) }),
2705
- noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.Card, { children: [
2706
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.CardHeader, { className: "text-center", children: [
2933
+ isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.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, _chunkT2JCZYWKjs.Card, { children: [
2935
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.CardHeader, { className: "text-center", children: [
2707
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" }) }),
2708
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.CardTitle, { children: "Set Up Billing" }),
2709
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.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, _chunkT2JCZYWKjs.CardTitle, { children: "Set Up Billing" }),
2938
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.CardDescription, { children: "Your company doesn't have a billing account yet. Set one up to manage subscriptions, payment methods, and view invoices." })
2710
2939
  ] }),
2711
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.CardContent, { className: "flex justify-center pb-8", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.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, _chunkT2JCZYWKjs.CardContent, { className: "flex justify-center pb-8", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Button, { onClick: handleCreateCustomer, disabled: creatingCustomer, size: "lg", children: creatingCustomer ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
2712
2941
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "mr-2 h-4 w-4 animate-spin" }),
2713
2942
  "Setting up..."
2714
2943
  ] }) : "Set Up Billing Account" }) }),
2715
- errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.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, _chunkT2JCZYWKjs.CardContent, { className: "pt-0", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-center text-sm text-destructive", children: errors.customer }) })
2716
2945
  ] }),
2717
2946
  !noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
2718
2947
  criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -2744,7 +2973,7 @@ function BillingDashboardContainer() {
2744
2973
  PaymentMethodSummaryCard,
2745
2974
  {
2746
2975
  paymentMethods: data.paymentMethods,
2747
- defaultPaymentMethodId: _optionalChain([data, 'access', _101 => _101.customer, 'optionalAccess', _102 => _102.defaultPaymentMethodId]),
2976
+ defaultPaymentMethodId: _optionalChain([data, 'access', _115 => _115.customer, 'optionalAccess', _116 => _116.defaultPaymentMethodId]),
2748
2977
  loading: loading.paymentMethods,
2749
2978
  error: errors.paymentMethods || void 0,
2750
2979
  onManageClick: () => setActiveModal("payment-methods")
@@ -2845,7 +3074,7 @@ function getStripePromise(publishableKey) {
2845
3074
  if (!publishableKey) {
2846
3075
  return Promise.resolve(null);
2847
3076
  }
2848
- if (_optionalChain([stripePromiseCache, 'optionalAccess', _103 => _103.key]) === publishableKey) {
3077
+ if (_optionalChain([stripePromiseCache, 'optionalAccess', _117 => _117.key]) === publishableKey) {
2849
3078
  return stripePromiseCache.promise;
2850
3079
  }
2851
3080
  const promise = _stripejs.loadStripe.call(void 0, publishableKey);
@@ -2882,7 +3111,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
2882
3111
  _react.useEffect.call(void 0, () => {
2883
3112
  const fetchFeatures = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
2884
3113
  try {
2885
- const features = await _chunk53IPQJVHjs.FeatureService.findMany({});
3114
+ const features = await _chunk3EZX4G2Ejs.FeatureService.findMany({});
2886
3115
  setAllFeatures(features);
2887
3116
  } catch (error) {
2888
3117
  console.error("[PriceEditor] Failed to fetch features:", error);
@@ -2911,23 +3140,23 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
2911
3140
  featureIds: _zod3.z.array(_zod3.z.string())
2912
3141
  });
2913
3142
  const isEditMode = !!price;
2914
- 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;
2915
3144
  const coreFeatureIds = allFeatures.filter((f) => f.isCore).map((f) => f.id);
2916
- 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])];
2917
3146
  const form = _reacthookform.useForm.call(void 0, {
2918
3147
  resolver: _zod.zodResolver.call(void 0, formSchema2),
2919
3148
  defaultValues: {
2920
3149
  unitAmount: defaultUnitAmount,
2921
- currency: _optionalChain([price, 'optionalAccess', _108 => _108.currency]) || "usd",
2922
- interval: _optionalChain([price, 'optionalAccess', _109 => _109.priceType]) === "one_time" ? "one_time" : _optionalChain([price, 'optionalAccess', _110 => _110.recurring, 'optionalAccess', _111 => _111.interval]) || "month",
2923
- intervalCount: _optionalChain([price, 'optionalAccess', _112 => _112.recurring, 'optionalAccess', _113 => _113.intervalCount]) || 1,
2924
- usageType: _optionalChain([price, 'optionalAccess', _114 => _114.recurring, 'optionalAccess', _115 => _115.usageType]) || "licensed",
2925
- nickname: _optionalChain([price, 'optionalAccess', _116 => _116.nickname]) || "",
2926
- active: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _117 => _117.active]), () => ( true)),
2927
- isTrial: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _118 => _118.isTrial]), () => ( false)),
2928
- description: _optionalChain([price, 'optionalAccess', _119 => _119.description]) || "",
2929
- features: _optionalChain([price, 'optionalAccess', _120 => _120.features]) || [],
2930
- 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()]), () => ( "")),
2931
3160
  featureIds: defaultFeatureIds
2932
3161
  }
2933
3162
  });
@@ -2935,24 +3164,24 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
2935
3164
  if (open) {
2936
3165
  const currentCoreFeatureIds = allFeatures.filter((f) => f.isCore).map((f) => f.id);
2937
3166
  const resetFeatureIds = [
2938
- .../* @__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])
2939
3168
  ];
2940
3169
  form.reset({
2941
- unitAmount: _optionalChain([price, 'optionalAccess', _127 => _127.unitAmount]) ? price.unitAmount / 100 : 0,
2942
- currency: _optionalChain([price, 'optionalAccess', _128 => _128.currency]) || "usd",
2943
- interval: _optionalChain([price, 'optionalAccess', _129 => _129.priceType]) === "one_time" ? "one_time" : _optionalChain([price, 'optionalAccess', _130 => _130.recurring, 'optionalAccess', _131 => _131.interval]) || "month",
2944
- intervalCount: _optionalChain([price, 'optionalAccess', _132 => _132.recurring, 'optionalAccess', _133 => _133.intervalCount]) || 1,
2945
- usageType: _optionalChain([price, 'optionalAccess', _134 => _134.recurring, 'optionalAccess', _135 => _135.usageType]) || "licensed",
2946
- nickname: _optionalChain([price, 'optionalAccess', _136 => _136.nickname]) || "",
2947
- active: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _137 => _137.active]), () => ( true)),
2948
- isTrial: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _138 => _138.isTrial]), () => ( false)),
2949
- description: _optionalChain([price, 'optionalAccess', _139 => _139.description]) || "",
2950
- features: _optionalChain([price, 'optionalAccess', _140 => _140.features]) || [],
2951
- 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()]), () => ( "")),
2952
3181
  featureIds: resetFeatureIds
2953
3182
  });
2954
3183
  }
2955
- }, [open, _optionalChain([price, 'optionalAccess', _144 => _144.id]), allFeatures]);
3184
+ }, [open, _optionalChain([price, 'optionalAccess', _158 => _158.id]), allFeatures]);
2956
3185
  const watchInterval = form.watch("interval");
2957
3186
  const isRecurring = watchInterval !== "one_time";
2958
3187
  const onSubmit = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async (values) => {
@@ -2960,14 +3189,14 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
2960
3189
  try {
2961
3190
  const unitAmountInCents = Math.round(values.unitAmount * 100);
2962
3191
  if (isEditMode) {
2963
- await _chunk53IPQJVHjs.StripePriceService.updatePrice({
3192
+ await _chunk3EZX4G2Ejs.StripePriceService.updatePrice({
2964
3193
  id: price.id,
2965
3194
  nickname: values.nickname || void 0,
2966
3195
  description: values.description || void 0,
2967
3196
  features: values.features.filter((f) => f.trim()) || void 0,
2968
3197
  token: values.token ? parseInt(values.token, 10) : void 0,
2969
3198
  // Only include isTrial and featureIds for recurring prices
2970
- ..._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 } : {}
2971
3200
  });
2972
3201
  } else {
2973
3202
  const createInput = {
@@ -3002,7 +3231,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
3002
3231
  createInput.featureIds = values.featureIds;
3003
3232
  }
3004
3233
  }
3005
- await _chunk53IPQJVHjs.StripePriceService.createPrice(createInput);
3234
+ await _chunk3EZX4G2Ejs.StripePriceService.createPrice(createInput);
3006
3235
  }
3007
3236
  onSuccess();
3008
3237
  onOpenChange(false);
@@ -3028,10 +3257,10 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
3028
3257
  { id: "licensed", text: "Licensed (per unit)" },
3029
3258
  { id: "metered", text: "Metered (usage-based)" }
3030
3259
  ];
3031
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.DialogContent, { className: "max-w-2xl", children: [
3032
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.DialogHeader, { children: [
3033
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.DialogTitle, { children: isEditMode ? "Edit Price" : "Create Price" }),
3034
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.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, _chunkT2JCZYWKjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.DialogContent, { className: "max-w-2xl", children: [
3261
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.DialogHeader, { children: [
3262
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.DialogTitle, { children: isEditMode ? "Edit Price" : "Create Price" }),
3263
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.DialogDescription, { children: isEditMode ? "Update the price details. Note: Only nickname and active status can be changed." : "Create a new price for this product" })
3035
3264
  ] }),
3036
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: [
3037
3266
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.AlertCircle, { className: "h-5 w-5 text-blue-600 flex-shrink-0 mt-0.5" }),
@@ -3040,10 +3269,10 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
3040
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." })
3041
3270
  ] })
3042
3271
  ] }),
3043
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.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, _chunkT2JCZYWKjs.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-col gap-y-4", children: [
3044
3273
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
3045
3274
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3046
- _chunkE6PQQTWFjs.FormInput,
3275
+ _chunkT2JCZYWKjs.FormInput,
3047
3276
  {
3048
3277
  form,
3049
3278
  id: "unitAmount",
@@ -3053,10 +3282,10 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
3053
3282
  isRequired: true
3054
3283
  }
3055
3284
  ),
3056
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.FormSelect, { form, id: "currency", name: "Currency", values: currencyOptions, disabled: isEditMode })
3285
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.FormSelect, { form, id: "currency", name: "Currency", values: currencyOptions, disabled: isEditMode })
3057
3286
  ] }),
3058
3287
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3059
- _chunkE6PQQTWFjs.FormSelect,
3288
+ _chunkT2JCZYWKjs.FormSelect,
3060
3289
  {
3061
3290
  form,
3062
3291
  id: "interval",
@@ -3067,7 +3296,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
3067
3296
  ),
3068
3297
  isRecurring && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
3069
3298
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3070
- _chunkE6PQQTWFjs.FormInput,
3299
+ _chunkT2JCZYWKjs.FormInput,
3071
3300
  {
3072
3301
  form,
3073
3302
  id: "intervalCount",
@@ -3078,7 +3307,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
3078
3307
  }
3079
3308
  ),
3080
3309
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3081
- _chunkE6PQQTWFjs.FormSelect,
3310
+ _chunkT2JCZYWKjs.FormSelect,
3082
3311
  {
3083
3312
  form,
3084
3313
  id: "usageType",
@@ -3089,7 +3318,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
3089
3318
  )
3090
3319
  ] }),
3091
3320
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3092
- _chunkE6PQQTWFjs.FormInput,
3321
+ _chunkT2JCZYWKjs.FormInput,
3093
3322
  {
3094
3323
  form,
3095
3324
  id: "nickname",
@@ -3098,7 +3327,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
3098
3327
  }
3099
3328
  ),
3100
3329
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3101
- _chunkE6PQQTWFjs.FormTextarea,
3330
+ _chunkT2JCZYWKjs.FormTextarea,
3102
3331
  {
3103
3332
  form,
3104
3333
  id: "description",
@@ -3107,13 +3336,13 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
3107
3336
  className: "min-h-24"
3108
3337
  }
3109
3338
  ),
3110
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.FormInput, { form, id: "token", name: "Token (optional)", placeholder: "Enter token value" }),
3339
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.FormInput, { form, id: "token", name: "Token (optional)", placeholder: "Enter token value" }),
3111
3340
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
3112
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Label, { children: "Features (optional)" }),
3341
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Label, { children: "Features (optional)" }),
3113
3342
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
3114
3343
  form.watch("features").map((_, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
3115
3344
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3116
- _chunkE6PQQTWFjs.Input,
3345
+ _chunkT2JCZYWKjs.Input,
3117
3346
  {
3118
3347
  ...form.register(`features.${index}`),
3119
3348
  placeholder: `Feature ${index + 1}`,
@@ -3121,7 +3350,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
3121
3350
  }
3122
3351
  ),
3123
3352
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3124
- _chunkE6PQQTWFjs.Button,
3353
+ _chunkT2JCZYWKjs.Button,
3125
3354
  {
3126
3355
  type: "button",
3127
3356
  variant: "outline",
@@ -3138,7 +3367,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
3138
3367
  )
3139
3368
  ] }, index)),
3140
3369
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
3141
- _chunkE6PQQTWFjs.Button,
3370
+ _chunkT2JCZYWKjs.Button,
3142
3371
  {
3143
3372
  type: "button",
3144
3373
  variant: "outline",
@@ -3157,7 +3386,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
3157
3386
  ] })
3158
3387
  ] }),
3159
3388
  isRecurring && allFeatures.length > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
3160
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Label, { children: "Platform Features" }),
3389
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Label, { children: "Platform Features" }),
3161
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) => {
3162
3391
  const isCore = feature.isCore;
3163
3392
  const isChecked = form.watch("featureIds").includes(feature.id);
@@ -3199,9 +3428,9 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
3199
3428
  ] }, feature.id);
3200
3429
  }) })
3201
3430
  ] }),
3202
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.FormCheckbox, { form, id: "active", name: "Active" }),
3431
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.FormCheckbox, { form, id: "active", name: "Active" }),
3203
3432
  isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3204
- _chunkE6PQQTWFjs.FormCheckbox,
3433
+ _chunkT2JCZYWKjs.FormCheckbox,
3205
3434
  {
3206
3435
  form,
3207
3436
  id: "isTrial",
@@ -3209,7 +3438,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
3209
3438
  description: "Mark this as the trial subscription plan (only one price should be marked as trial)"
3210
3439
  }
3211
3440
  ),
3212
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.CommonEditorButtons, { isEdit: isEditMode, form, disabled: isSubmitting, setOpen: onOpenChange })
3441
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.CommonEditorButtons, { isEdit: isEditMode, form, disabled: isSubmitting, setOpen: onOpenChange })
3213
3442
  ] }) })
3214
3443
  ] }) });
3215
3444
  }
@@ -3231,7 +3460,7 @@ function PricesList({ productId, onPricesChange }) {
3231
3460
  const loadPrices = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
3232
3461
  setLoading(true);
3233
3462
  try {
3234
- const fetchedPrices = await _chunk53IPQJVHjs.StripePriceService.listPrices({ productId });
3463
+ const fetchedPrices = await _chunk3EZX4G2Ejs.StripePriceService.listPrices({ productId });
3235
3464
  setPrices(fetchedPrices);
3236
3465
  } catch (error) {
3237
3466
  console.error("[PricesList] Failed to load prices:", error);
@@ -3248,7 +3477,7 @@ function PricesList({ productId, onPricesChange }) {
3248
3477
  }
3249
3478
  setArchivingPriceId(priceToArchive.id);
3250
3479
  try {
3251
- await _chunk53IPQJVHjs.StripePriceService.archivePrice({ id: priceToArchive.id });
3480
+ await _chunk3EZX4G2Ejs.StripePriceService.archivePrice({ id: priceToArchive.id });
3252
3481
  setPriceToArchive(null);
3253
3482
  await loadPrices();
3254
3483
  onPricesChange();
@@ -3264,7 +3493,7 @@ function PricesList({ productId, onPricesChange }) {
3264
3493
  }
3265
3494
  setReactivatingPriceId(priceToReactivate.id);
3266
3495
  try {
3267
- await _chunk53IPQJVHjs.StripePriceService.reactivatePrice({ id: priceToReactivate.id });
3496
+ await _chunk3EZX4G2Ejs.StripePriceService.reactivatePrice({ id: priceToReactivate.id });
3268
3497
  setPriceToReactivate(null);
3269
3498
  await loadPrices();
3270
3499
  onPricesChange();
@@ -3295,12 +3524,12 @@ function PricesList({ productId, onPricesChange }) {
3295
3524
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-4", children: [
3296
3525
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center justify-between mb-4", children: [
3297
3526
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "text-lg font-semibold", children: "Prices" }),
3298
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Button, { size: "sm", onClick: () => setShowCreatePrice(true), children: "Add Price" })
3527
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Button, { size: "sm", onClick: () => setShowCreatePrice(true), children: "Add Price" })
3299
3528
  ] }),
3300
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: [
3301
3530
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.DollarSign, { className: "text-muted-foreground h-12 w-12" }),
3302
3531
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-sm", children: "No prices yet. Add a price to enable subscriptions." }),
3303
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Button, { size: "sm", onClick: () => setShowCreatePrice(true), children: "Add Price" })
3532
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Button, { size: "sm", onClick: () => setShowCreatePrice(true), children: "Add Price" })
3304
3533
  ] }),
3305
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) => {
3306
3535
  const isArchiving = archivingPriceId === price.id;
@@ -3309,9 +3538,9 @@ function PricesList({ productId, onPricesChange }) {
3309
3538
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-start justify-between mb-3", children: [
3310
3539
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.DollarSign, { className: "h-5 w-5 text-primary" }),
3311
3540
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-1", children: [
3312
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.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, _chunkT2JCZYWKjs.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" }) }),
3313
3542
  price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3314
- _chunkE6PQQTWFjs.Button,
3543
+ _chunkT2JCZYWKjs.Button,
3315
3544
  {
3316
3545
  variant: "ghost",
3317
3546
  size: "sm",
@@ -3321,7 +3550,7 @@ function PricesList({ productId, onPricesChange }) {
3321
3550
  children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Archive, { className: "h-4 w-4" })
3322
3551
  }
3323
3552
  ) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3324
- _chunkE6PQQTWFjs.Button,
3553
+ _chunkT2JCZYWKjs.Button,
3325
3554
  {
3326
3555
  variant: "ghost",
3327
3556
  size: "sm",
@@ -3338,10 +3567,10 @@ function PricesList({ productId, onPricesChange }) {
3338
3567
  " ",
3339
3568
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-sm font-normal", children: formatInterval2(price) })
3340
3569
  ] }) }),
3341
- _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 }),
3342
3571
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2", children: [
3343
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" }),
3344
- _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" }),
3345
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 })
3346
3575
  ] })
3347
3576
  ] }, price.id);
@@ -3372,20 +3601,20 @@ function PricesList({ productId, onPricesChange }) {
3372
3601
  }
3373
3602
  }
3374
3603
  ),
3375
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.AlertDialog, { open: !!priceToArchive, onOpenChange: (open) => !open && setPriceToArchive(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.AlertDialogContent, { children: [
3376
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.AlertDialogHeader, { children: [
3377
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.AlertDialogTitle, { children: "Archive Price" }),
3378
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.AlertDialogDescription, { children: [
3604
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.AlertDialog, { open: !!priceToArchive, onOpenChange: (open) => !open && setPriceToArchive(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.AlertDialogContent, { children: [
3605
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.AlertDialogHeader, { children: [
3606
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.AlertDialogTitle, { children: "Archive Price" }),
3607
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.AlertDialogDescription, { children: [
3379
3608
  "Are you sure you want to archive the price for",
3380
3609
  " ",
3381
3610
  priceToArchive && `${formatCurrency(priceToArchive.unitAmount, priceToArchive.currency)} ${formatInterval2(priceToArchive)}`,
3382
3611
  "? This will prevent new subscriptions but existing ones will continue."
3383
3612
  ] })
3384
3613
  ] }),
3385
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.AlertDialogFooter, { children: [
3386
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.AlertDialogCancel, { disabled: !!archivingPriceId, children: "Cancel" }),
3614
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.AlertDialogFooter, { children: [
3615
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.AlertDialogCancel, { disabled: !!archivingPriceId, children: "Cancel" }),
3387
3616
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3388
- _chunkE6PQQTWFjs.AlertDialogAction,
3617
+ _chunkT2JCZYWKjs.AlertDialogAction,
3389
3618
  {
3390
3619
  onClick: handleArchive,
3391
3620
  disabled: !!archivingPriceId,
@@ -3395,20 +3624,20 @@ function PricesList({ productId, onPricesChange }) {
3395
3624
  )
3396
3625
  ] })
3397
3626
  ] }) }),
3398
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.AlertDialog, { open: !!priceToReactivate, onOpenChange: (open) => !open && setPriceToReactivate(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.AlertDialogContent, { children: [
3399
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.AlertDialogHeader, { children: [
3400
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.AlertDialogTitle, { children: "Reactivate Price" }),
3401
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.AlertDialogDescription, { children: [
3627
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.AlertDialog, { open: !!priceToReactivate, onOpenChange: (open) => !open && setPriceToReactivate(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.AlertDialogContent, { children: [
3628
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.AlertDialogHeader, { children: [
3629
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.AlertDialogTitle, { children: "Reactivate Price" }),
3630
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.AlertDialogDescription, { children: [
3402
3631
  "Are you sure you want to reactivate the price for",
3403
3632
  " ",
3404
3633
  priceToReactivate && `${formatCurrency(priceToReactivate.unitAmount, priceToReactivate.currency)} ${formatInterval2(priceToReactivate)}`,
3405
3634
  "? This will allow new subscriptions again."
3406
3635
  ] })
3407
3636
  ] }),
3408
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.AlertDialogFooter, { children: [
3409
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.AlertDialogCancel, { disabled: !!reactivatingPriceId, children: "Cancel" }),
3637
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.AlertDialogFooter, { children: [
3638
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.AlertDialogCancel, { disabled: !!reactivatingPriceId, children: "Cancel" }),
3410
3639
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3411
- _chunkE6PQQTWFjs.AlertDialogAction,
3640
+ _chunkT2JCZYWKjs.AlertDialogAction,
3412
3641
  {
3413
3642
  onClick: handleReactivate,
3414
3643
  disabled: !!reactivatingPriceId,
@@ -3443,23 +3672,23 @@ function ProductEditor({ product, open, onOpenChange, onSuccess }) {
3443
3672
  const form = _reacthookform.useForm.call(void 0, {
3444
3673
  resolver: _zod.zodResolver.call(void 0, formSchema2),
3445
3674
  defaultValues: {
3446
- name: _optionalChain([product, 'optionalAccess', _150 => _150.name]) || "",
3447
- description: _optionalChain([product, 'optionalAccess', _151 => _151.description]) || "",
3448
- 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))
3449
3678
  }
3450
3679
  });
3451
3680
  const onSubmit = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async (values) => {
3452
3681
  setIsSubmitting(true);
3453
3682
  try {
3454
3683
  if (product) {
3455
- await _chunk53IPQJVHjs.StripeProductService.updateProduct({
3684
+ await _chunk3EZX4G2Ejs.StripeProductService.updateProduct({
3456
3685
  id: product.id,
3457
3686
  name: values.name,
3458
3687
  description: values.description,
3459
3688
  active: values.active
3460
3689
  });
3461
3690
  } else {
3462
- await _chunk53IPQJVHjs.StripeProductService.createProduct({
3691
+ await _chunk3EZX4G2Ejs.StripeProductService.createProduct({
3463
3692
  id: _uuid.v4.call(void 0, ),
3464
3693
  name: values.name,
3465
3694
  description: values.description,
@@ -3474,15 +3703,15 @@ function ProductEditor({ product, open, onOpenChange, onSuccess }) {
3474
3703
  setIsSubmitting(false);
3475
3704
  }
3476
3705
  }, "onSubmit");
3477
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.DialogContent, { className: "max-w-2xl", children: [
3478
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.DialogHeader, { children: [
3479
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.DialogTitle, { children: product ? "Edit Product" : "Create Product" }),
3480
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.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, _chunkT2JCZYWKjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.DialogContent, { className: "max-w-2xl", children: [
3707
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.DialogHeader, { children: [
3708
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.DialogTitle, { children: product ? "Edit Product" : "Create Product" }),
3709
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.DialogDescription, { children: product ? `Update the details for ${product.name}` : "Create a new product to offer to your customers" })
3481
3710
  ] }),
3482
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-col gap-y-4", children: [
3483
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.FormInput, { form, id: "name", name: "Product Name", placeholder: "Enter product name", isRequired: true }),
3711
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.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, _chunkT2JCZYWKjs.FormInput, { form, id: "name", name: "Product Name", placeholder: "Enter product name", isRequired: true }),
3484
3713
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3485
- _chunkE6PQQTWFjs.FormTextarea,
3714
+ _chunkT2JCZYWKjs.FormTextarea,
3486
3715
  {
3487
3716
  form,
3488
3717
  id: "description",
@@ -3491,8 +3720,8 @@ function ProductEditor({ product, open, onOpenChange, onSuccess }) {
3491
3720
  className: "min-h-32"
3492
3721
  }
3493
3722
  ),
3494
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.FormCheckbox, { form, id: "active", name: "Active" }),
3495
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.CommonEditorButtons, { isEdit: !!product, form, disabled: isSubmitting, setOpen: onOpenChange })
3723
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.FormCheckbox, { form, id: "active", name: "Active" }),
3724
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.CommonEditorButtons, { isEdit: !!product, form, disabled: isSubmitting, setOpen: onOpenChange })
3496
3725
  ] }) })
3497
3726
  ] }) });
3498
3727
  }
@@ -3515,11 +3744,11 @@ function ProductsList({ products, onProductsChange }) {
3515
3744
  }
3516
3745
  setArchivingProductId(productToArchive.id);
3517
3746
  try {
3518
- const archivedProduct = await _chunk53IPQJVHjs.StripeProductService.archiveProduct({ id: productToArchive.id });
3747
+ const _archivedProduct = await _chunk3EZX4G2Ejs.StripeProductService.archiveProduct({ id: productToArchive.id });
3519
3748
  setProductToArchive(null);
3520
3749
  onProductsChange();
3521
- } catch (error) {
3522
- console.error("[ProductsList] Failed to archive product:", error);
3750
+ } catch (_error) {
3751
+ console.error("[ProductsList] Failed to archive product:", _error);
3523
3752
  } finally {
3524
3753
  setArchivingProductId(null);
3525
3754
  }
@@ -3530,10 +3759,10 @@ function ProductsList({ products, onProductsChange }) {
3530
3759
  }
3531
3760
  setReactivatingProductId(productToReactivate.id);
3532
3761
  try {
3533
- const reactivatedProduct = await _chunk53IPQJVHjs.StripeProductService.reactivateProduct({ id: productToReactivate.id });
3762
+ const _reactivatedProduct = await _chunk3EZX4G2Ejs.StripeProductService.reactivateProduct({ id: productToReactivate.id });
3534
3763
  setProductToReactivate(null);
3535
3764
  onProductsChange();
3536
- } catch (error) {
3765
+ } catch (_error) {
3537
3766
  } finally {
3538
3767
  setReactivatingProductId(null);
3539
3768
  }
@@ -3559,12 +3788,12 @@ function ProductsList({ products, onProductsChange }) {
3559
3788
  ] })
3560
3789
  ] }),
3561
3790
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
3562
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.Button, { variant: "outline", size: "sm", onClick: () => setEditingProduct(product), children: [
3791
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.Button, { variant: "outline", size: "sm", onClick: () => setEditingProduct(product), children: [
3563
3792
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Edit, { className: "h-4 w-4 mr-1" }),
3564
3793
  "Edit"
3565
3794
  ] }),
3566
3795
  product.active ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
3567
- _chunkE6PQQTWFjs.Button,
3796
+ _chunkT2JCZYWKjs.Button,
3568
3797
  {
3569
3798
  variant: "outline",
3570
3799
  size: "sm",
@@ -3576,7 +3805,7 @@ function ProductsList({ products, onProductsChange }) {
3576
3805
  ]
3577
3806
  }
3578
3807
  ) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
3579
- _chunkE6PQQTWFjs.Button,
3808
+ _chunkT2JCZYWKjs.Button,
3580
3809
  {
3581
3810
  variant: "outline",
3582
3811
  size: "sm",
@@ -3588,7 +3817,7 @@ function ProductsList({ products, onProductsChange }) {
3588
3817
  ]
3589
3818
  }
3590
3819
  ),
3591
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.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, _chunkT2JCZYWKjs.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" }) })
3592
3821
  ] })
3593
3822
  ] }),
3594
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 }) })
@@ -3606,19 +3835,19 @@ function ProductsList({ products, onProductsChange }) {
3606
3835
  }
3607
3836
  }
3608
3837
  ),
3609
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.AlertDialog, { open: !!productToArchive, onOpenChange: (open) => !open && setProductToArchive(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.AlertDialogContent, { children: [
3610
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.AlertDialogHeader, { children: [
3611
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.AlertDialogTitle, { children: "Archive Product" }),
3612
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.AlertDialogDescription, { children: [
3838
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.AlertDialog, { open: !!productToArchive, onOpenChange: (open) => !open && setProductToArchive(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.AlertDialogContent, { children: [
3839
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.AlertDialogHeader, { children: [
3840
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.AlertDialogTitle, { children: "Archive Product" }),
3841
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.AlertDialogDescription, { children: [
3613
3842
  'Are you sure you want to archive "',
3614
- _optionalChain([productToArchive, 'optionalAccess', _153 => _153.name]),
3843
+ _optionalChain([productToArchive, 'optionalAccess', _167 => _167.name]),
3615
3844
  '"? This will deactivate it and it will no longer be available for new subscriptions.'
3616
3845
  ] })
3617
3846
  ] }),
3618
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.AlertDialogFooter, { children: [
3619
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.AlertDialogCancel, { disabled: !!archivingProductId, children: "Cancel" }),
3847
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.AlertDialogFooter, { children: [
3848
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.AlertDialogCancel, { disabled: !!archivingProductId, children: "Cancel" }),
3620
3849
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3621
- _chunkE6PQQTWFjs.AlertDialogAction,
3850
+ _chunkT2JCZYWKjs.AlertDialogAction,
3622
3851
  {
3623
3852
  onClick: handleArchive,
3624
3853
  disabled: !!archivingProductId,
@@ -3628,19 +3857,19 @@ function ProductsList({ products, onProductsChange }) {
3628
3857
  )
3629
3858
  ] })
3630
3859
  ] }) }),
3631
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.AlertDialog, { open: !!productToReactivate, onOpenChange: (open) => !open && setProductToReactivate(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.AlertDialogContent, { children: [
3632
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.AlertDialogHeader, { children: [
3633
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.AlertDialogTitle, { children: "Reactivate Product" }),
3634
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.AlertDialogDescription, { children: [
3860
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.AlertDialog, { open: !!productToReactivate, onOpenChange: (open) => !open && setProductToReactivate(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.AlertDialogContent, { children: [
3861
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.AlertDialogHeader, { children: [
3862
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.AlertDialogTitle, { children: "Reactivate Product" }),
3863
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.AlertDialogDescription, { children: [
3635
3864
  'Are you sure you want to reactivate "',
3636
- _optionalChain([productToReactivate, 'optionalAccess', _154 => _154.name]),
3865
+ _optionalChain([productToReactivate, 'optionalAccess', _168 => _168.name]),
3637
3866
  '"? This will make it available for new subscriptions again.'
3638
3867
  ] })
3639
3868
  ] }),
3640
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkE6PQQTWFjs.AlertDialogFooter, { children: [
3641
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.AlertDialogCancel, { disabled: !!reactivatingProductId, children: "Cancel" }),
3869
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkT2JCZYWKjs.AlertDialogFooter, { children: [
3870
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.AlertDialogCancel, { disabled: !!reactivatingProductId, children: "Cancel" }),
3642
3871
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3643
- _chunkE6PQQTWFjs.AlertDialogAction,
3872
+ _chunkT2JCZYWKjs.AlertDialogAction,
3644
3873
  {
3645
3874
  onClick: handleReactivate,
3646
3875
  disabled: !!reactivatingProductId,
@@ -3657,7 +3886,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductsList, "ProductsList");
3657
3886
  // src/features/billing/stripe-product/components/containers/ProductsAdminContainer.tsx
3658
3887
 
3659
3888
  function ProductsAdminContainer() {
3660
- const { hasRole } = _chunkE6PQQTWFjs.useCurrentUserContext.call(void 0, );
3889
+ const { hasRole } = _chunkT2JCZYWKjs.useCurrentUserContext.call(void 0, );
3661
3890
  const [products, setProducts] = _react.useState.call(void 0, []);
3662
3891
  const [loading, setLoading] = _react.useState.call(void 0, true);
3663
3892
  const [showCreateProduct, setShowCreateProduct] = _react.useState.call(void 0, false);
@@ -3667,7 +3896,7 @@ function ProductsAdminContainer() {
3667
3896
  const loadProducts = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
3668
3897
  setLoading(true);
3669
3898
  try {
3670
- const fetchedProducts = await _chunk53IPQJVHjs.StripeProductService.listProducts();
3899
+ const fetchedProducts = await _chunk3EZX4G2Ejs.StripeProductService.listProducts();
3671
3900
  setProducts(fetchedProducts);
3672
3901
  } catch (error) {
3673
3902
  console.error("[ProductsAdminContainer] Failed to load products:", error);
@@ -3687,14 +3916,14 @@ function ProductsAdminContainer() {
3687
3916
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Package, { className: "h-8 w-8" }),
3688
3917
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-3xl font-bold", children: "Product & Price Management" })
3689
3918
  ] }),
3690
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Button, { onClick: () => setShowCreateProduct(true), children: "Create Product" })
3919
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Button, { onClick: () => setShowCreateProduct(true), children: "Create Product" })
3691
3920
  ] }),
3692
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: [
3693
3922
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Package, { className: "text-muted-foreground h-16 w-16" }),
3694
3923
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
3695
3924
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "mb-2 text-xl font-semibold", children: "No products yet" }),
3696
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." }),
3697
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkE6PQQTWFjs.Button, { onClick: () => setShowCreateProduct(true), children: "Create Your First Product" })
3926
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2JCZYWKjs.Button, { onClick: () => setShowCreateProduct(true), children: "Create Your First Product" })
3698
3927
  ] })
3699
3928
  ] }),
3700
3929
  products.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductsList, { products, onProductsChange: loadProducts }),
@@ -3745,5 +3974,6 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductsAdminContainer, "ProductsAdminConta
3745
3974
 
3746
3975
 
3747
3976
 
3748
- 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;
3749
3979
  //# sourceMappingURL=index.js.map