@carlonicora/nextjs-jsonapi 1.29.1 → 1.29.3
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.
- package/dist/{BlockNoteEditor-7BDLLHRA.js → BlockNoteEditor-CJWHJRG3.js} +17 -17
- package/dist/BlockNoteEditor-CJWHJRG3.js.map +1 -0
- package/dist/{BlockNoteEditor-F5KCNLVF.mjs → BlockNoteEditor-ZET7ANBC.mjs} +7 -7
- package/dist/BlockNoteEditor-ZET7ANBC.mjs.map +1 -0
- package/dist/billing/index.js +334 -333
- package/dist/billing/index.js.map +1 -1
- package/dist/billing/index.mjs +8 -7
- package/dist/billing/index.mjs.map +1 -1
- package/dist/{chunk-YLSLXQ3O.mjs → chunk-3HGZMKT4.mjs} +494 -524
- package/dist/chunk-3HGZMKT4.mjs.map +1 -0
- package/dist/{chunk-7M7NPKOF.js → chunk-6HQ6CPVL.js} +916 -946
- package/dist/chunk-6HQ6CPVL.js.map +1 -0
- package/dist/{chunk-DU64WMZD.mjs → chunk-NYNLJEPF.mjs} +4 -4
- package/dist/chunk-NYNLJEPF.mjs.map +1 -0
- package/dist/{chunk-J22NEVSK.js → chunk-UYBCHXXL.js} +4 -4
- package/dist/chunk-UYBCHXXL.js.map +1 -0
- package/dist/client/index.js +3 -3
- package/dist/client/index.mjs +2 -2
- package/dist/components/index.js +3 -3
- package/dist/components/index.mjs +2 -2
- package/dist/contexts/index.js +3 -3
- package/dist/contexts/index.mjs +2 -2
- package/dist/core/index.js +2 -2
- package/dist/core/index.mjs +1 -1
- package/dist/index.js +2 -2
- package/dist/index.mjs +1 -1
- package/dist/server/index.js +3 -3
- package/dist/server/index.mjs +1 -1
- package/package.json +1 -1
- package/src/components/details/AllowedUsersDetails.tsx +1 -1
- package/src/components/editors/BlockNoteEditor.tsx +5 -5
- package/src/components/forms/CommonAssociationForm.tsx +9 -9
- package/src/components/forms/CommonDeleter.tsx +14 -8
- package/src/components/forms/CommonEditorButtons.tsx +2 -2
- package/src/components/forms/CommonEditorHeader.tsx +4 -4
- package/src/components/forms/CommonEditorTrigger.tsx +1 -1
- package/src/components/forms/FileUploader.tsx +8 -8
- package/src/components/forms/FormDateTime.tsx +6 -12
- package/src/components/forms/FormInput.tsx +4 -20
- package/src/components/forms/PasswordInput.tsx +1 -1
- package/src/components/navigations/Breadcrumb.tsx +1 -1
- package/src/components/navigations/Header.tsx +2 -2
- package/src/components/navigations/RecentPagesNavigator.tsx +3 -3
- package/src/components/tables/ContentTableSearch.tsx +1 -1
- package/src/contexts/CommonContext.tsx +2 -2
- package/src/core/abstracts/AbstractService.ts +2 -2
- package/src/features/auth/components/details/LandingComponent.tsx +5 -5
- package/src/features/auth/components/forms/AcceptInvitation.tsx +16 -22
- package/src/features/auth/components/forms/ActivateAccount.tsx +8 -8
- package/src/features/auth/components/forms/ForgotPassword.tsx +9 -9
- package/src/features/auth/components/forms/Login.tsx +12 -12
- package/src/features/auth/components/forms/Register.tsx +19 -21
- package/src/features/auth/components/forms/ResetPassword.tsx +12 -18
- package/src/features/billing/stripe-subscription/hooks/useSubscriptionWizard.ts +5 -4
- package/src/features/company/components/details/TokenStatusIndicator.tsx +7 -7
- package/src/features/company/components/forms/CompanyConfigurationEditor.tsx +2 -2
- package/src/features/company/components/forms/CompanyDeleter.tsx +13 -11
- package/src/features/company/components/forms/CompanyEditor.tsx +7 -13
- package/src/features/company/components/lists/CompaniesList.tsx +1 -1
- package/src/features/company/contexts/CompanyContext.tsx +1 -1
- package/src/features/company/hooks/useCompanyTableStructure.tsx +2 -2
- package/src/features/content/components/lists/ContentsList.tsx +1 -1
- package/src/features/content/components/lists/ContentsListById.tsx +1 -1
- package/src/features/content/components/lists/RelevantContentsList.tsx +1 -1
- package/src/features/content/hooks/useContentTableStructure.tsx +5 -5
- package/src/features/notification/components/containers/NotificationsListContainer.tsx +2 -2
- package/src/features/notification/components/lists/NotificationsList.tsx +3 -3
- package/src/features/notification/components/modals/NotificationModal.tsx +3 -5
- package/src/features/notification/components/notifications/Notification.tsx +4 -4
- package/src/features/notification/contexts/NotificationContext.tsx +2 -2
- package/src/features/role/components/details/RoleDetails.tsx +1 -1
- package/src/features/role/components/forms/FormRoles.tsx +2 -2
- package/src/features/role/components/forms/RemoveUserFromRole.tsx +9 -11
- package/src/features/role/components/forms/UserRoleAdd.tsx +18 -18
- package/src/features/role/components/lists/RolesList.tsx +1 -1
- package/src/features/role/components/lists/UserRolesList.tsx +1 -1
- package/src/features/role/contexts/RoleContext.tsx +2 -2
- package/src/features/role/hooks/useRoleTableStructure.tsx +3 -3
- package/src/features/user/components/containers/UsersListContainer.tsx +2 -2
- package/src/features/user/components/details/UserDetails.tsx +6 -6
- package/src/features/user/components/forms/RoleUserAdd.tsx +8 -8
- package/src/features/user/components/forms/UserAvatarEditor.tsx +2 -2
- package/src/features/user/components/forms/UserEditor.tsx +21 -25
- package/src/features/user/components/forms/UserReactivator.tsx +7 -7
- package/src/features/user/components/forms/UserResentInvitationEmail.tsx +9 -9
- package/src/features/user/components/forms/UserSelector.tsx +4 -9
- package/src/features/user/components/lists/AdminUsersList.tsx +1 -1
- package/src/features/user/components/lists/CompanyUsersList.tsx +1 -1
- package/src/features/user/components/lists/RelevantUsersList.tsx +1 -1
- package/src/features/user/components/lists/RoleUsersList.tsx +1 -1
- package/src/features/user/components/lists/UsersList.tsx +1 -1
- package/src/features/user/components/lists/UsersListByContentIds.tsx +1 -1
- package/src/features/user/components/widgets/UserSearchPopover.tsx +3 -3
- package/src/features/user/contexts/UserContext.tsx +5 -5
- package/src/features/user/hooks/useUserTableStructure.tsx +6 -6
- package/src/utils/blocknote-diff.util.ts +1 -1
- package/dist/BlockNoteEditor-7BDLLHRA.js.map +0 -1
- package/dist/BlockNoteEditor-F5KCNLVF.mjs.map +0 -1
- package/dist/chunk-7M7NPKOF.js.map +0 -1
- package/dist/chunk-DU64WMZD.mjs.map +0 -1
- package/dist/chunk-J22NEVSK.js.map +0 -1
- package/dist/chunk-YLSLXQ3O.mjs.map +0 -1
package/dist/billing/index.js
CHANGED
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
|
|
50
|
-
var
|
|
50
|
+
var _chunk6HQ6CPVLjs = require('../chunk-6HQ6CPVL.js');
|
|
51
51
|
|
|
52
52
|
|
|
53
53
|
|
|
@@ -60,7 +60,7 @@ var _chunkEW6QPMN3js = require('../chunk-EW6QPMN3.js');
|
|
|
60
60
|
|
|
61
61
|
|
|
62
62
|
|
|
63
|
-
var
|
|
63
|
+
var _chunkUYBCHXXLjs = require('../chunk-UYBCHXXL.js');
|
|
64
64
|
require('../chunk-LXKSUWAV.js');
|
|
65
65
|
require('../chunk-IBS6NI7D.js');
|
|
66
66
|
require('../chunk-FM6WRAN5.js');
|
|
@@ -120,41 +120,41 @@ function SubscriptionSummaryCard({
|
|
|
120
120
|
onManageClick
|
|
121
121
|
}) {
|
|
122
122
|
if (loading) {
|
|
123
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
124
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
125
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
123
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.Card, { children: [
|
|
124
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
125
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.CardTitle, { className: "text-sm font-medium", children: "Subscriptions" }),
|
|
126
126
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
127
127
|
] }),
|
|
128
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
129
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
130
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
131
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
128
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.CardContent, { children: [
|
|
129
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
130
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Skeleton, { className: "h-4 w-24 mb-1" }),
|
|
131
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Skeleton, { className: "h-4 w-40" })
|
|
132
132
|
] })
|
|
133
133
|
] });
|
|
134
134
|
}
|
|
135
135
|
if (error) {
|
|
136
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
137
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
138
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
136
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.Card, { children: [
|
|
137
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
138
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.CardTitle, { className: "text-sm font-medium", children: "Subscriptions" }),
|
|
139
139
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
140
140
|
] }),
|
|
141
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
141
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-destructive", children: error }) })
|
|
142
142
|
] });
|
|
143
143
|
}
|
|
144
144
|
const activeSubscriptions = subscriptions.filter(
|
|
145
145
|
(sub) => sub.status === "active" /* ACTIVE */ || sub.status === "trialing" /* TRIALING */
|
|
146
146
|
);
|
|
147
147
|
const primarySubscription = activeSubscriptions[0];
|
|
148
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
149
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
150
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
148
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
|
|
149
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
150
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.CardTitle, { className: "text-sm font-medium", children: "Subscriptions" }),
|
|
151
151
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
152
152
|
] }),
|
|
153
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
153
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.CardContent, { children: subscriptions.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
154
154
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No active plan" }),
|
|
155
155
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Subscribe to get started" }),
|
|
156
156
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
157
|
-
|
|
157
|
+
_chunk6HQ6CPVLjs.Button,
|
|
158
158
|
{
|
|
159
159
|
variant: "outline",
|
|
160
160
|
size: "sm",
|
|
@@ -172,7 +172,7 @@ function SubscriptionSummaryCard({
|
|
|
172
172
|
] }) : primarySubscription ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
173
173
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
174
174
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: formatPlanName(primarySubscription) }),
|
|
175
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
175
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Badge, { variant: primarySubscription.cancelAtPeriodEnd ? "secondary" : getStatusBadgeVariant(primarySubscription.status), children: primarySubscription.cancelAtPeriodEnd ? "Canceling" : primarySubscription.status })
|
|
176
176
|
] }),
|
|
177
177
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm text-muted-foreground", children: [
|
|
178
178
|
formatPrice(_optionalChain([primarySubscription, 'access', _10 => _10.price, 'optionalAccess', _11 => _11.unitAmount]), _optionalChain([primarySubscription, 'access', _12 => _12.price, 'optionalAccess', _13 => _13.currency])),
|
|
@@ -216,36 +216,36 @@ function PaymentMethodSummaryCard({
|
|
|
216
216
|
onManageClick
|
|
217
217
|
}) {
|
|
218
218
|
if (loading) {
|
|
219
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
220
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
221
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
219
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.Card, { children: [
|
|
220
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
221
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.CardTitle, { className: "text-sm font-medium", children: "Payment Method" }),
|
|
222
222
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
223
223
|
] }),
|
|
224
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
225
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
226
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
224
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.CardContent, { children: [
|
|
225
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
226
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Skeleton, { className: "h-4 w-24" })
|
|
227
227
|
] })
|
|
228
228
|
] });
|
|
229
229
|
}
|
|
230
230
|
if (error) {
|
|
231
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
232
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
233
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
231
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.Card, { children: [
|
|
232
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
233
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.CardTitle, { className: "text-sm font-medium", children: "Payment Method" }),
|
|
234
234
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
235
235
|
] }),
|
|
236
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
236
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-destructive", children: error }) })
|
|
237
237
|
] });
|
|
238
238
|
}
|
|
239
239
|
const defaultMethod = paymentMethods.find((pm) => pm.id === defaultPaymentMethodId) || paymentMethods[0];
|
|
240
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
241
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
242
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
240
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
|
|
241
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
242
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.CardTitle, { className: "text-sm font-medium", children: "Payment Method" }),
|
|
243
243
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
244
244
|
] }),
|
|
245
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
245
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.CardContent, { children: paymentMethods.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
246
246
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No payment method" }),
|
|
247
247
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Add a card to enable subscriptions" }),
|
|
248
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
248
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.Button, { variant: "outline", size: "sm", className: "mt-2", onClick: (e) => {
|
|
249
249
|
e.stopPropagation();
|
|
250
250
|
onManageClick();
|
|
251
251
|
}, children: [
|
|
@@ -301,7 +301,7 @@ function CustomerInfoCard({ customer, loading, error }) {
|
|
|
301
301
|
e.stopPropagation();
|
|
302
302
|
setPortalLoading(true);
|
|
303
303
|
try {
|
|
304
|
-
const { url } = await
|
|
304
|
+
const { url } = await _chunkUYBCHXXLjs.StripeCustomerService.createPortalSession();
|
|
305
305
|
window.open(url, "_blank");
|
|
306
306
|
} catch (err) {
|
|
307
307
|
console.error("[CustomerInfoCard] Failed to create portal session:", err);
|
|
@@ -310,52 +310,52 @@ function CustomerInfoCard({ customer, loading, error }) {
|
|
|
310
310
|
}
|
|
311
311
|
}, "handlePortalClick");
|
|
312
312
|
if (loading) {
|
|
313
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
314
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
315
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
313
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.Card, { children: [
|
|
314
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
315
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.CardTitle, { className: "text-sm font-medium", children: "Billing Account" }),
|
|
316
316
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
317
317
|
] }),
|
|
318
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
319
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
320
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
321
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
318
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.CardContent, { children: [
|
|
319
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
320
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Skeleton, { className: "h-4 w-48 mb-1" }),
|
|
321
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Skeleton, { className: "h-4 w-24" })
|
|
322
322
|
] })
|
|
323
323
|
] });
|
|
324
324
|
}
|
|
325
325
|
if (error) {
|
|
326
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
327
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
328
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
326
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.Card, { children: [
|
|
327
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
328
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.CardTitle, { className: "text-sm font-medium", children: "Billing Account" }),
|
|
329
329
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
330
330
|
] }),
|
|
331
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
331
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-destructive", children: error }) })
|
|
332
332
|
] });
|
|
333
333
|
}
|
|
334
334
|
if (!customer) {
|
|
335
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
336
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
337
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
335
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.Card, { children: [
|
|
336
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
337
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.CardTitle, { className: "text-sm font-medium", children: "Billing Account" }),
|
|
338
338
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
339
339
|
] }),
|
|
340
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
340
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.CardContent, { children: [
|
|
341
341
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "Not set up" }),
|
|
342
342
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Billing account will be created when you subscribe" })
|
|
343
343
|
] })
|
|
344
344
|
] });
|
|
345
345
|
}
|
|
346
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
347
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
348
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
346
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.Card, { children: [
|
|
347
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
348
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.CardTitle, { className: "text-sm font-medium", children: "Billing Account" }),
|
|
349
349
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
350
350
|
] }),
|
|
351
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
351
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
352
352
|
customer.name && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: customer.name }),
|
|
353
353
|
customer.email && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: customer.email }),
|
|
354
354
|
customer.balance !== void 0 && customer.balance !== 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm", children: [
|
|
355
355
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground", children: "Credit Balance: " }),
|
|
356
356
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: customer.balance < 0 ? "text-green-600" : "text-destructive", children: formatBalance(customer.balance, customer.currency) })
|
|
357
357
|
] }),
|
|
358
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
358
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.Button, { variant: "outline", size: "sm", className: "mt-2", onClick: handlePortalClick, disabled: portalLoading, children: [
|
|
359
359
|
portalLoading ? "Loading..." : "Manage in Stripe Portal",
|
|
360
360
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ExternalLink, { className: "h-4 w-4 ml-1" })
|
|
361
361
|
] })
|
|
@@ -399,42 +399,42 @@ function formatAmount(amount, currency) {
|
|
|
399
399
|
_chunk7QVYU63Ejs.__name.call(void 0, formatAmount, "formatAmount");
|
|
400
400
|
function InvoicesSummaryCard({ invoices, loading, error, onViewAllClick }) {
|
|
401
401
|
if (loading) {
|
|
402
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
403
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
404
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
402
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.Card, { children: [
|
|
403
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
404
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.CardTitle, { className: "text-sm font-medium", children: "Recent Invoices" }),
|
|
405
405
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
406
406
|
] }),
|
|
407
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
408
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
409
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
410
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
407
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.CardContent, { children: [
|
|
408
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Skeleton, { className: "h-6 w-24 mb-2" }),
|
|
409
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Skeleton, { className: "h-4 w-32 mb-1" }),
|
|
410
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Skeleton, { className: "h-4 w-20" })
|
|
411
411
|
] })
|
|
412
412
|
] });
|
|
413
413
|
}
|
|
414
414
|
if (error) {
|
|
415
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
416
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
417
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
415
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.Card, { children: [
|
|
416
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
417
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.CardTitle, { className: "text-sm font-medium", children: "Recent Invoices" }),
|
|
418
418
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
419
419
|
] }),
|
|
420
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
420
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-destructive", children: error }) })
|
|
421
421
|
] });
|
|
422
422
|
}
|
|
423
423
|
const latestInvoice = invoices[0];
|
|
424
424
|
const paidInvoices = invoices.filter((inv) => inv.status === "paid" /* PAID */);
|
|
425
425
|
const openInvoices = invoices.filter((inv) => inv.status === "open" /* OPEN */);
|
|
426
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
427
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
428
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
426
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewAllClick, children: [
|
|
427
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
428
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.CardTitle, { className: "text-sm font-medium", children: "Recent Invoices" }),
|
|
429
429
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
430
430
|
] }),
|
|
431
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
431
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.CardContent, { children: invoices.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
432
432
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No invoices yet" }),
|
|
433
433
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Invoices will appear after your first billing cycle" })
|
|
434
434
|
] }) : latestInvoice ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
435
435
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
436
436
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: formatAmount(latestInvoice.total, latestInvoice.currency) }),
|
|
437
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
437
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Badge, { variant: getStatusBadgeVariant2(latestInvoice.status), children: latestInvoice.status })
|
|
438
438
|
] }),
|
|
439
439
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: latestInvoice.stripeInvoiceNumber || `Invoice from ${formatDate2(latestInvoice.periodStart)}` }),
|
|
440
440
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-4 text-xs text-muted-foreground", children: [
|
|
@@ -474,24 +474,24 @@ function BillingUsageSummaryCard({
|
|
|
474
474
|
onViewDetailsClick
|
|
475
475
|
}) {
|
|
476
476
|
if (loading) {
|
|
477
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
478
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
479
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
477
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.Card, { children: [
|
|
478
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
479
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.CardTitle, { className: "text-sm font-medium", children: "Usage This Month" }),
|
|
480
480
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
481
481
|
] }),
|
|
482
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
483
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
484
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
482
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.CardContent, { children: [
|
|
483
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Skeleton, { className: "h-6 w-24 mb-2" }),
|
|
484
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Skeleton, { className: "h-4 w-32" })
|
|
485
485
|
] })
|
|
486
486
|
] });
|
|
487
487
|
}
|
|
488
488
|
if (error) {
|
|
489
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
490
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
491
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
489
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.Card, { children: [
|
|
490
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
491
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.CardTitle, { className: "text-sm font-medium", children: "Usage This Month" }),
|
|
492
492
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
493
493
|
] }),
|
|
494
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
494
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-destructive", children: error }) })
|
|
495
495
|
] });
|
|
496
496
|
}
|
|
497
497
|
const totalUsage = Object.values(summaries).reduce((acc, summary) => {
|
|
@@ -499,12 +499,12 @@ function BillingUsageSummaryCard({
|
|
|
499
499
|
}, 0);
|
|
500
500
|
const primaryMeter = meters.find((m) => _optionalChain([summaries, 'access', _23 => _23[m.id], 'optionalAccess', _24 => _24.aggregatedValue]));
|
|
501
501
|
const primarySummary = primaryMeter ? summaries[primaryMeter.id] : null;
|
|
502
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
503
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
504
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
502
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewDetailsClick, children: [
|
|
503
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
504
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.CardTitle, { className: "text-sm font-medium", children: "Usage This Month" }),
|
|
505
505
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
506
506
|
] }),
|
|
507
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
507
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.CardContent, { children: meters.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
508
508
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No meters" }),
|
|
509
509
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "No usage meters are configured" })
|
|
510
510
|
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
@@ -556,7 +556,7 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
|
|
|
556
556
|
const fetchSetupIntent = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
557
557
|
setLoading(true);
|
|
558
558
|
try {
|
|
559
|
-
const intent = await
|
|
559
|
+
const intent = await _chunkUYBCHXXLjs.StripeCustomerService.createSetupIntent();
|
|
560
560
|
setSetupIntent(intent);
|
|
561
561
|
} catch (err) {
|
|
562
562
|
console.error("[PaymentMethodForm] Failed to create setup intent:", err);
|
|
@@ -594,7 +594,7 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
|
|
|
594
594
|
return;
|
|
595
595
|
}
|
|
596
596
|
if (setAsDefault && _optionalChain([confirmedSetupIntent, 'optionalAccess', _25 => _25.payment_method])) {
|
|
597
|
-
await
|
|
597
|
+
await _chunkUYBCHXXLjs.StripeCustomerService.setDefaultPaymentMethod({
|
|
598
598
|
paymentMethodId: typeof confirmedSetupIntent.payment_method === "string" ? confirmedSetupIntent.payment_method : confirmedSetupIntent.payment_method.id
|
|
599
599
|
});
|
|
600
600
|
}
|
|
@@ -610,7 +610,7 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
|
|
|
610
610
|
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..." }) });
|
|
611
611
|
}
|
|
612
612
|
if (!setupIntent && error) {
|
|
613
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
613
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.AlertDescription, { children: error }) });
|
|
614
614
|
}
|
|
615
615
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: handleSubmit, className: "flex flex-col gap-y-4", children: [
|
|
616
616
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rounded-md border border-gray-300 p-3", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -634,19 +634,19 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
|
|
|
634
634
|
) }),
|
|
635
635
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
636
636
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
637
|
-
|
|
637
|
+
_chunk6HQ6CPVLjs.Checkbox,
|
|
638
638
|
{
|
|
639
639
|
id: "setAsDefault",
|
|
640
640
|
checked: setAsDefault,
|
|
641
641
|
onCheckedChange: (checked) => setSetAsDefault(!!checked)
|
|
642
642
|
}
|
|
643
643
|
),
|
|
644
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
644
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Label, { htmlFor: "setAsDefault", className: "text-sm font-normal", children: "Set as default payment method" })
|
|
645
645
|
] }),
|
|
646
|
-
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
646
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.AlertDescription, { children: error }) }),
|
|
647
647
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-x-2", children: [
|
|
648
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
649
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
648
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Button, { type: "button", variant: "outline", onClick: onCancel, disabled: isSubmitting || isLoading, children: "Cancel" }),
|
|
649
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Button, { type: "submit", disabled: !stripe || isSubmitting || isLoading, children: isSubmitting ? "Processing..." : "Add Card" })
|
|
650
650
|
] })
|
|
651
651
|
] });
|
|
652
652
|
}
|
|
@@ -662,10 +662,10 @@ function PaymentMethodEditor({ open, onOpenChange, onSuccess }) {
|
|
|
662
662
|
const handleCancel = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
663
663
|
onOpenChange(false);
|
|
664
664
|
}, "handleCancel");
|
|
665
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
666
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
667
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
668
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
665
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.DialogContent, { className: "max-w-md", children: [
|
|
666
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.DialogHeader, { children: [
|
|
667
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.DialogTitle, { children: "Add Payment Method" }),
|
|
668
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.DialogDescription, { children: "Add a new payment method to your account. Your card information is securely processed by Stripe." })
|
|
669
669
|
] }),
|
|
670
670
|
open && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
671
671
|
PaymentMethodForm,
|
|
@@ -695,7 +695,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
695
695
|
_react.useEffect.call(void 0, () => {
|
|
696
696
|
const loadCustomer = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
697
697
|
try {
|
|
698
|
-
const fetchedCustomer = await
|
|
698
|
+
const fetchedCustomer = await _chunkUYBCHXXLjs.StripeCustomerService.getCustomer();
|
|
699
699
|
setCustomer(fetchedCustomer);
|
|
700
700
|
} catch (error) {
|
|
701
701
|
console.error("[PaymentMethodCard] Failed to load customer:", error);
|
|
@@ -712,7 +712,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
712
712
|
const handleSetDefault = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
713
713
|
setLoading(true);
|
|
714
714
|
try {
|
|
715
|
-
await
|
|
715
|
+
await _chunkUYBCHXXLjs.StripeCustomerService.setDefaultPaymentMethod({ paymentMethodId: paymentMethod.id });
|
|
716
716
|
onUpdate();
|
|
717
717
|
} catch (error) {
|
|
718
718
|
console.error("[PaymentMethodCard] Failed to set as default:", error);
|
|
@@ -723,7 +723,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
723
723
|
const handleRemove = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
724
724
|
setLoading(true);
|
|
725
725
|
try {
|
|
726
|
-
await
|
|
726
|
+
await _chunkUYBCHXXLjs.StripeCustomerService.removePaymentMethod({ paymentMethodId: paymentMethod.id });
|
|
727
727
|
setShowRemoveDialog(false);
|
|
728
728
|
onUpdate();
|
|
729
729
|
} catch (error) {
|
|
@@ -732,22 +732,22 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
732
732
|
}
|
|
733
733
|
}, "handleRemove");
|
|
734
734
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
735
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
736
|
-
isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
737
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
735
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.Card, { className: "relative", children: [
|
|
736
|
+
isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Badge, { className: "absolute right-2 top-2 bg-green-100 text-green-800 hover:bg-green-100", children: "Default" }),
|
|
737
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.CardHeader, { className: "flex flex-row items-center justify-between pb-2", children: [
|
|
738
738
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
739
739
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-2xl", children: brandIcon }),
|
|
740
740
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium capitalize", children: brand })
|
|
741
741
|
] }),
|
|
742
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
743
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
744
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
745
|
-
!isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
746
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
742
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.DropdownMenu, { children: [
|
|
743
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.DropdownMenuTrigger, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.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" }) }) }),
|
|
744
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.DropdownMenuContent, { align: "end", children: [
|
|
745
|
+
!isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.DropdownMenuItem, { onClick: handleSetDefault, disabled: loading, children: "Set as Default" }),
|
|
746
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.DropdownMenuItem, { onClick: () => setShowRemoveDialog(true), disabled: loading, className: "text-red-600", children: "Remove" })
|
|
747
747
|
] })
|
|
748
748
|
] })
|
|
749
749
|
] }),
|
|
750
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
750
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-1", children: [
|
|
751
751
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-lg font-semibold", children: [
|
|
752
752
|
"\u2022\u2022\u2022\u2022 ",
|
|
753
753
|
last4
|
|
@@ -760,17 +760,17 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
760
760
|
] })
|
|
761
761
|
] }) })
|
|
762
762
|
] }),
|
|
763
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
764
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
765
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
766
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
763
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.AlertDialog, { open: showRemoveDialog, onOpenChange: setShowRemoveDialog, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.AlertDialogContent, { children: [
|
|
764
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.AlertDialogHeader, { children: [
|
|
765
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.AlertDialogTitle, { children: "Remove Payment Method" }),
|
|
766
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.AlertDialogDescription, { children: [
|
|
767
767
|
"Are you sure you want to remove this payment method? This action cannot be undone.",
|
|
768
768
|
isDefault && " This is your default payment method."
|
|
769
769
|
] })
|
|
770
770
|
] }),
|
|
771
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
772
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
773
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
771
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.AlertDialogFooter, { children: [
|
|
772
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.AlertDialogCancel, { disabled: loading, children: "Cancel" }),
|
|
773
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.AlertDialogAction, { onClick: handleRemove, disabled: loading, className: "bg-red-600 hover:bg-red-700", children: loading ? "Removing..." : "Remove" })
|
|
774
774
|
] })
|
|
775
775
|
] }) })
|
|
776
776
|
] });
|
|
@@ -793,7 +793,7 @@ function PaymentMethodsContainer() {
|
|
|
793
793
|
const loadPaymentMethods = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
794
794
|
setLoading(true);
|
|
795
795
|
try {
|
|
796
|
-
const fetchedPaymentMethods = await
|
|
796
|
+
const fetchedPaymentMethods = await _chunkUYBCHXXLjs.StripeCustomerService.listPaymentMethods();
|
|
797
797
|
setPaymentMethods(fetchedPaymentMethods);
|
|
798
798
|
} catch (error) {
|
|
799
799
|
console.error("[PaymentMethodsContainer] Failed to load payment methods:", error);
|
|
@@ -813,14 +813,14 @@ function PaymentMethodsContainer() {
|
|
|
813
813
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8" }),
|
|
814
814
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-3xl font-bold", children: "Payment Methods" })
|
|
815
815
|
] }),
|
|
816
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
816
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Button, { onClick: () => setShowAddPaymentMethod(true), children: "Add Payment Method" })
|
|
817
817
|
] }),
|
|
818
818
|
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: [
|
|
819
819
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-16 w-16 text-muted-foreground" }),
|
|
820
820
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
821
821
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "mb-2 text-xl font-semibold", children: "No payment methods" }),
|
|
822
822
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mb-4 text-muted-foreground", children: "Add a payment method to enable subscriptions and secure checkout." }),
|
|
823
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
823
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Button, { onClick: () => setShowAddPaymentMethod(true), children: "Add Your First Card" })
|
|
824
824
|
] })
|
|
825
825
|
] }),
|
|
826
826
|
paymentMethods.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodsList, { paymentMethods, onUpdate: loadPaymentMethods }),
|
|
@@ -944,13 +944,13 @@ function InvoiceDetails({ invoice, open, onOpenChange, onInvoiceChange }) {
|
|
|
944
944
|
return invoice.stripeInvoiceId.slice(-8);
|
|
945
945
|
}, "getInvoiceNumber");
|
|
946
946
|
const productName = _optionalChain([invoice, 'access', _35 => _35.subscription, 'optionalAccess', _36 => _36.price, 'optionalAccess', _37 => _37.product, 'optionalAccess', _38 => _38.name]) || "Subscription";
|
|
947
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
948
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
949
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
947
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.DialogContent, { className: "max-w-2xl", children: [
|
|
948
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.DialogHeader, { children: [
|
|
949
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.DialogTitle, { children: [
|
|
950
950
|
"Invoice ",
|
|
951
951
|
getInvoiceNumber()
|
|
952
952
|
] }),
|
|
953
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
953
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.DialogDescription, { children: formatDate3(invoice.periodStart) })
|
|
954
954
|
] }),
|
|
955
955
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
956
956
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
@@ -1015,15 +1015,15 @@ function InvoiceDetails({ invoice, open, onOpenChange, onInvoiceChange }) {
|
|
|
1015
1015
|
] })
|
|
1016
1016
|
] }),
|
|
1017
1017
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2 pt-4 border-t", children: [
|
|
1018
|
-
invoice.stripePdfUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1018
|
+
invoice.stripePdfUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.Button, { variant: "outline", onClick: handleDownloadPDF, children: [
|
|
1019
1019
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Download, { className: "mr-2 h-4 w-4" }),
|
|
1020
1020
|
"Download PDF"
|
|
1021
1021
|
] }),
|
|
1022
|
-
invoice.status === "open" /* OPEN */ && invoice.attempted && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1022
|
+
invoice.status === "open" /* OPEN */ && invoice.attempted && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.Button, { variant: "default", onClick: handleRetryPayment, children: [
|
|
1023
1023
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RefreshCw, { className: "mr-2 h-4 w-4" }),
|
|
1024
1024
|
"Retry Payment"
|
|
1025
1025
|
] }),
|
|
1026
|
-
invoice.stripeHostedInvoiceUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1026
|
+
invoice.stripeHostedInvoiceUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.Button, { variant: "outline", onClick: handleViewInStripe, children: [
|
|
1027
1027
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ExternalLink, { className: "mr-2 h-4 w-4" }),
|
|
1028
1028
|
"View in Stripe"
|
|
1029
1029
|
] })
|
|
@@ -1047,30 +1047,30 @@ function InvoicesList({ invoices, onInvoicesChange }) {
|
|
|
1047
1047
|
return invoice.stripeInvoiceId.slice(-8);
|
|
1048
1048
|
}, "getInvoiceNumber");
|
|
1049
1049
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1050
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-hidden", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1051
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1052
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1053
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1054
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1055
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1056
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1050
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-hidden", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.Table, { children: [
|
|
1051
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.TableRow, { children: [
|
|
1052
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.TableHead, { children: "Invoice #" }),
|
|
1053
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.TableHead, { children: "Date" }),
|
|
1054
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.TableHead, { children: "Status" }),
|
|
1055
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.TableHead, { className: "text-right", children: "Amount" }),
|
|
1056
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.TableHead, { children: "Period" })
|
|
1057
1057
|
] }) }),
|
|
1058
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1058
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.TableBody, { children: invoices.map((invoice) => {
|
|
1059
1059
|
const invoiceNumber = getInvoiceNumber(invoice);
|
|
1060
1060
|
const date = formatDate3(invoice.periodStart);
|
|
1061
1061
|
const amount = formatCurrency(invoice.total, invoice.currency);
|
|
1062
1062
|
const period = `${formatDate3(invoice.periodStart)} - ${formatDate3(invoice.periodEnd)}`;
|
|
1063
1063
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1064
|
-
|
|
1064
|
+
_chunk6HQ6CPVLjs.TableRow,
|
|
1065
1065
|
{
|
|
1066
1066
|
onClick: () => handleRowClick(invoice),
|
|
1067
1067
|
className: "cursor-pointer hover:bg-muted/50",
|
|
1068
1068
|
children: [
|
|
1069
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1070
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1071
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1072
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1073
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1069
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.TableCell, { className: "font-medium", children: invoiceNumber }),
|
|
1070
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.TableCell, { className: "text-muted-foreground text-sm", children: date }),
|
|
1071
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InvoiceStatusBadge, { status: invoice.status }) }),
|
|
1072
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.TableCell, { className: "text-right font-medium", children: amount }),
|
|
1073
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.TableCell, { className: "text-muted-foreground text-sm", children: period })
|
|
1074
1074
|
]
|
|
1075
1075
|
},
|
|
1076
1076
|
invoice.id
|
|
@@ -1103,7 +1103,7 @@ function InvoicesContainer() {
|
|
|
1103
1103
|
setLoading(true);
|
|
1104
1104
|
try {
|
|
1105
1105
|
const params = statusFilter !== "all" ? { status: statusFilter } : void 0;
|
|
1106
|
-
const data = await
|
|
1106
|
+
const data = await _chunkUYBCHXXLjs.StripeInvoiceService.listInvoices(params);
|
|
1107
1107
|
setInvoices(data);
|
|
1108
1108
|
} catch (error) {
|
|
1109
1109
|
console.error("[InvoicesContainer] Failed to load invoices:", error);
|
|
@@ -1119,12 +1119,12 @@ function InvoicesContainer() {
|
|
|
1119
1119
|
setStatusFilter(value);
|
|
1120
1120
|
}, "handleFilterChange");
|
|
1121
1121
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-4", children: [
|
|
1122
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1123
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1124
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1125
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1126
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1127
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1122
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Tabs, { value: statusFilter, onValueChange: handleFilterChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.TabsList, { children: [
|
|
1123
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.TabsTrigger, { value: "all", children: "All" }),
|
|
1124
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.TabsTrigger, { value: "paid" /* PAID */, children: "Paid" }),
|
|
1125
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.TabsTrigger, { value: "open" /* OPEN */, children: "Open" }),
|
|
1126
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.TabsTrigger, { value: "void" /* VOID */, children: "Void" }),
|
|
1127
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.TabsTrigger, { value: "uncollectible" /* UNCOLLECTIBLE */, children: "Uncollectible" })
|
|
1128
1128
|
] }) }),
|
|
1129
1129
|
loading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-center py-8 text-muted-foreground", children: "Loading invoices..." }),
|
|
1130
1130
|
!loading && invoices.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "border border-dashed border-gray-300 rounded-lg p-8 text-center", children: [
|
|
@@ -1174,7 +1174,7 @@ function CancelSubscriptionDialog({
|
|
|
1174
1174
|
const onSubmit = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async (values) => {
|
|
1175
1175
|
setIsSubmitting(true);
|
|
1176
1176
|
try {
|
|
1177
|
-
await
|
|
1177
|
+
await _chunkUYBCHXXLjs.StripeSubscriptionService.cancelSubscription({
|
|
1178
1178
|
id: subscription.id,
|
|
1179
1179
|
cancelImmediately: values.cancelImmediately
|
|
1180
1180
|
});
|
|
@@ -1187,20 +1187,20 @@ function CancelSubscriptionDialog({
|
|
|
1187
1187
|
}
|
|
1188
1188
|
}, "onSubmit");
|
|
1189
1189
|
const periodEndDate = formatDate3(subscription.currentPeriodEnd);
|
|
1190
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1191
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1192
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1193
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1190
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.DialogContent, { className: "max-w-md", children: [
|
|
1191
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.DialogHeader, { children: [
|
|
1192
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.DialogTitle, { children: "Cancel Subscription" }),
|
|
1193
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.DialogDescription, { children: "Are you sure you want to cancel this subscription? This action cannot be undone." })
|
|
1194
1194
|
] }),
|
|
1195
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1196
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1195
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.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, _chunk6HQ6CPVLjs.FormCheckbox, { form, id: "cancelImmediately", name: "Cancel Immediately" }),
|
|
1197
1197
|
cancelImmediately ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "bg-red-50 border border-red-200 rounded-lg p-3 text-sm text-red-800", children: "Your subscription will be canceled immediately and you will lose access right away." }) : /* @__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: [
|
|
1198
1198
|
"Your subscription will remain active until ",
|
|
1199
1199
|
periodEndDate,
|
|
1200
1200
|
". You can continue using the service until then."
|
|
1201
1201
|
] }),
|
|
1202
1202
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1203
|
-
|
|
1203
|
+
_chunk6HQ6CPVLjs.FormTextarea,
|
|
1204
1204
|
{
|
|
1205
1205
|
form,
|
|
1206
1206
|
id: "reason",
|
|
@@ -1210,8 +1210,8 @@ function CancelSubscriptionDialog({
|
|
|
1210
1210
|
}
|
|
1211
1211
|
),
|
|
1212
1212
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-x-2 justify-end pt-2", children: [
|
|
1213
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1214
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1213
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Button, { type: "button", variant: "outline", onClick: () => onOpenChange(false), disabled: isSubmitting, children: "Keep Subscription" }),
|
|
1214
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Button, { type: "submit", variant: "destructive", disabled: isSubmitting, children: isSubmitting ? "Canceling..." : "Confirm Cancellation" })
|
|
1215
1215
|
] })
|
|
1216
1216
|
] }) })
|
|
1217
1217
|
] }) });
|
|
@@ -1302,7 +1302,7 @@ function SubscriptionDetails({
|
|
|
1302
1302
|
const handlePause = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1303
1303
|
setIsProcessing(true);
|
|
1304
1304
|
try {
|
|
1305
|
-
await
|
|
1305
|
+
await _chunkUYBCHXXLjs.StripeSubscriptionService.pauseSubscription({ subscriptionId: subscription.id });
|
|
1306
1306
|
onSubscriptionChange();
|
|
1307
1307
|
} catch (error) {
|
|
1308
1308
|
console.error("[SubscriptionDetails] Failed to pause subscription:", error);
|
|
@@ -1313,7 +1313,7 @@ function SubscriptionDetails({
|
|
|
1313
1313
|
const handleResume = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1314
1314
|
setIsProcessing(true);
|
|
1315
1315
|
try {
|
|
1316
|
-
await
|
|
1316
|
+
await _chunkUYBCHXXLjs.StripeSubscriptionService.resumeSubscription({ subscriptionId: subscription.id });
|
|
1317
1317
|
onSubscriptionChange();
|
|
1318
1318
|
} catch (error) {
|
|
1319
1319
|
console.error("[SubscriptionDetails] Failed to resume subscription:", error);
|
|
@@ -1323,7 +1323,7 @@ function SubscriptionDetails({
|
|
|
1323
1323
|
}, "handleResume");
|
|
1324
1324
|
const handleManageViaPortal = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1325
1325
|
try {
|
|
1326
|
-
const { url } = await
|
|
1326
|
+
const { url } = await _chunkUYBCHXXLjs.StripeCustomerService.createPortalSession();
|
|
1327
1327
|
window.open(url, "_blank");
|
|
1328
1328
|
} catch (error) {
|
|
1329
1329
|
console.error("[SubscriptionDetails] Failed to create portal session:", error);
|
|
@@ -1333,10 +1333,10 @@ function SubscriptionDetails({
|
|
|
1333
1333
|
const canResume = subscription.status === "paused" /* PAUSED */;
|
|
1334
1334
|
const canCancel = subscription.status === "active" /* ACTIVE */ || subscription.status === "trialing" /* TRIALING */ || subscription.status === "paused" /* PAUSED */;
|
|
1335
1335
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1336
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1337
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1338
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1339
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1336
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.DialogContent, { className: "max-w-2xl", children: [
|
|
1337
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.DialogHeader, { children: [
|
|
1338
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.DialogTitle, { children: "Subscription Details" }),
|
|
1339
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.DialogDescription, { children: "View and manage your subscription" })
|
|
1340
1340
|
] }),
|
|
1341
1341
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
1342
1342
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
@@ -1372,11 +1372,11 @@ function SubscriptionDetails({
|
|
|
1372
1372
|
"."
|
|
1373
1373
|
] }) }),
|
|
1374
1374
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2 pt-4 border-t", children: [
|
|
1375
|
-
onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1376
|
-
canPause && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1377
|
-
canResume && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1378
|
-
canCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1379
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1375
|
+
onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Button, { variant: "default", onClick: () => onChangePlan(subscription), children: "Change Plan" }),
|
|
1376
|
+
canPause && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Button, { variant: "outline", onClick: handlePause, disabled: isProcessing, children: isProcessing ? "Pausing..." : "Pause" }),
|
|
1377
|
+
canResume && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Button, { variant: "outline", onClick: handleResume, disabled: isProcessing, children: isProcessing ? "Resuming..." : "Resume" }),
|
|
1378
|
+
canCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Button, { variant: "destructive", onClick: () => setShowCancel(true), children: "Cancel" }),
|
|
1379
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Button, { variant: "outline", onClick: handleManageViaPortal, children: "Manage via Portal" })
|
|
1380
1380
|
] })
|
|
1381
1381
|
] })
|
|
1382
1382
|
] }) }),
|
|
@@ -1423,27 +1423,27 @@ function SubscriptionsList({ subscriptions, onSubscriptionsChange, onChangePlan
|
|
|
1423
1423
|
setSelectedSub(subscription);
|
|
1424
1424
|
}, "handleRowClick");
|
|
1425
1425
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1426
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-hidden", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1427
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1428
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1429
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1430
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1431
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1426
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-hidden", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.Table, { children: [
|
|
1427
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.TableRow, { children: [
|
|
1428
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.TableHead, { children: "Status" }),
|
|
1429
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.TableHead, { children: "Plan" }),
|
|
1430
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.TableHead, { children: "Period" }),
|
|
1431
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.TableHead, { className: "text-right", children: "Amount" })
|
|
1432
1432
|
] }) }),
|
|
1433
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1433
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.TableBody, { children: subscriptions.map((subscription) => {
|
|
1434
1434
|
const price = subscription.price;
|
|
1435
1435
|
const amount = _optionalChain([price, 'optionalAccess', _48 => _48.unitAmount]) ? formatCurrency(price.unitAmount, price.currency) : "N/A";
|
|
1436
1436
|
const period = `${formatDate3(subscription.currentPeriodStart)} - ${formatDate3(subscription.currentPeriodEnd)}`;
|
|
1437
1437
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1438
|
-
|
|
1438
|
+
_chunk6HQ6CPVLjs.TableRow,
|
|
1439
1439
|
{
|
|
1440
1440
|
onClick: () => handleRowClick(subscription),
|
|
1441
1441
|
className: "cursor-pointer hover:bg-muted/50",
|
|
1442
1442
|
children: [
|
|
1443
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1444
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1445
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1446
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1443
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SubscriptionStatusBadge, { status: subscription.status, cancelAtPeriodEnd: subscription.cancelAtPeriodEnd }) }),
|
|
1444
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.TableCell, { className: "font-medium", children: formatPlanName3(price) }),
|
|
1445
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.TableCell, { className: "text-muted-foreground text-sm", children: period }),
|
|
1446
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.TableCell, { className: "text-right font-medium", children: amount })
|
|
1447
1447
|
]
|
|
1448
1448
|
},
|
|
1449
1449
|
subscription.id
|
|
@@ -1478,7 +1478,7 @@ function SubscriptionsContainer({ onOpenWizard }) {
|
|
|
1478
1478
|
const loadSubscriptions = _react.useCallback.call(void 0, async () => {
|
|
1479
1479
|
setLoading(true);
|
|
1480
1480
|
try {
|
|
1481
|
-
const fetchedSubscriptions = await
|
|
1481
|
+
const fetchedSubscriptions = await _chunkUYBCHXXLjs.StripeSubscriptionService.listSubscriptions();
|
|
1482
1482
|
setSubscriptions(fetchedSubscriptions);
|
|
1483
1483
|
} catch (error) {
|
|
1484
1484
|
console.error("[SubscriptionsContainer] Failed to load subscriptions:", error);
|
|
@@ -1501,7 +1501,7 @@ function SubscriptionsContainer({ onOpenWizard }) {
|
|
|
1501
1501
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8" }),
|
|
1502
1502
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-3xl font-bold", children: "Subscriptions" })
|
|
1503
1503
|
] }),
|
|
1504
|
-
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1504
|
+
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _49 => _49()]), children: "Subscribe to a Plan" })
|
|
1505
1505
|
] }),
|
|
1506
1506
|
criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BillingAlertBanner, { subscription }, subscription.id)),
|
|
1507
1507
|
subscriptions.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col items-center justify-center py-12 space-y-4", children: [
|
|
@@ -1509,7 +1509,7 @@ function SubscriptionsContainer({ onOpenWizard }) {
|
|
|
1509
1509
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
1510
1510
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-xl font-semibold mb-2", children: "No Active Subscriptions" }),
|
|
1511
1511
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground mb-6", children: "Choose a subscription plan to get started with our services." }),
|
|
1512
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1512
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _50 => _50()]), children: "Subscribe to a Plan" })
|
|
1513
1513
|
] })
|
|
1514
1514
|
] }),
|
|
1515
1515
|
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -1530,9 +1530,9 @@ function IntervalToggle({ value, onChange, hasMonthly, hasYearly }) {
|
|
|
1530
1530
|
if (!hasMonthly || !hasYearly) {
|
|
1531
1531
|
return null;
|
|
1532
1532
|
}
|
|
1533
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1534
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1535
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1533
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Tabs, { value, onValueChange: (v) => onChange(v), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.TabsList, { children: [
|
|
1534
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.TabsTrigger, { value: "month", children: "Monthly" }),
|
|
1535
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.TabsTrigger, { value: "year", children: "Yearly" })
|
|
1536
1536
|
] }) });
|
|
1537
1537
|
}
|
|
1538
1538
|
_chunk7QVYU63Ejs.__name.call(void 0, IntervalToggle, "IntervalToggle");
|
|
@@ -1557,7 +1557,7 @@ function PricingCard({ price, isCurrentPlan = false, isSelected = false, isDisab
|
|
|
1557
1557
|
}
|
|
1558
1558
|
}, "handleClick");
|
|
1559
1559
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1560
|
-
|
|
1560
|
+
_chunk6HQ6CPVLjs.Card,
|
|
1561
1561
|
{
|
|
1562
1562
|
role: "radio",
|
|
1563
1563
|
"aria-checked": isSelected,
|
|
@@ -1565,7 +1565,7 @@ function PricingCard({ price, isCurrentPlan = false, isSelected = false, isDisab
|
|
|
1565
1565
|
tabIndex: isDisabled ? -1 : 0,
|
|
1566
1566
|
onKeyDown: handleKeyDown,
|
|
1567
1567
|
onClick: handleClick,
|
|
1568
|
-
className:
|
|
1568
|
+
className: _chunkUYBCHXXLjs.cn.call(void 0,
|
|
1569
1569
|
"relative cursor-pointer transition-all duration-200 flex flex-col h-full",
|
|
1570
1570
|
"focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
1571
1571
|
isCurrentPlan && "bg-muted/30",
|
|
@@ -1575,9 +1575,9 @@ function PricingCard({ price, isCurrentPlan = false, isSelected = false, isDisab
|
|
|
1575
1575
|
isLoading && "pointer-events-none"
|
|
1576
1576
|
),
|
|
1577
1577
|
children: [
|
|
1578
|
-
isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1579
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1580
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1578
|
+
isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Badge, { variant: "secondary", className: "absolute top-2 right-2", children: "Current" }),
|
|
1579
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.CardHeader, { className: "pb-2", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "font-semibold text-lg", children: description }) }),
|
|
1580
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.CardContent, { className: "pb-4 grow", children: [
|
|
1581
1581
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mb-4", children: [
|
|
1582
1582
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-3xl font-bold", children: formattedPrice }),
|
|
1583
1583
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground ml-1", children: interval })
|
|
@@ -1587,8 +1587,8 @@ function PricingCard({ price, isCurrentPlan = false, isSelected = false, isDisab
|
|
|
1587
1587
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-muted-foreground", children: feature })
|
|
1588
1588
|
] }, index)) })
|
|
1589
1589
|
] }),
|
|
1590
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1591
|
-
|
|
1590
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.CardFooter, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1591
|
+
_chunk6HQ6CPVLjs.Button,
|
|
1592
1592
|
{
|
|
1593
1593
|
variant: isCurrentPlan ? "secondary" : isSelected ? "default" : "outline",
|
|
1594
1594
|
className: "w-full",
|
|
@@ -1711,15 +1711,15 @@ function ProductPricingList({
|
|
|
1711
1711
|
_chunk7QVYU63Ejs.__name.call(void 0, ProductPricingList, "ProductPricingList");
|
|
1712
1712
|
function ProductPricingListSkeleton() {
|
|
1713
1713
|
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: [
|
|
1714
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1714
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Skeleton, { className: "h-6 w-32" }),
|
|
1715
1715
|
/* @__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: [
|
|
1716
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1717
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1716
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Skeleton, { className: "h-6 w-24" }),
|
|
1717
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Skeleton, { className: "h-8 w-32" }),
|
|
1718
1718
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
1719
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1720
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1719
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Skeleton, { className: "h-4 w-full" }),
|
|
1720
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Skeleton, { className: "h-4 w-3/4" })
|
|
1721
1721
|
] }),
|
|
1722
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1722
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Skeleton, { className: "h-10 w-full" })
|
|
1723
1723
|
] }, cardIndex)) })
|
|
1724
1724
|
] }, rowIndex)) });
|
|
1725
1725
|
}
|
|
@@ -1774,8 +1774,8 @@ function SubscriptionConfirmation({ price, isLoading, onConfirm, onCancel }) {
|
|
|
1774
1774
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: feature })
|
|
1775
1775
|
] }, index)) }),
|
|
1776
1776
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-3 pt-2 border-t border-accent/30", children: [
|
|
1777
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1778
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1777
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Button, { variant: "outline", onClick: onCancel, disabled: isLoading, children: "Cancel" }),
|
|
1778
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Button, { onClick: onConfirm, disabled: isLoading, children: isLoading ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1779
1779
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "h-4 w-4 animate-spin mr-2" }),
|
|
1780
1780
|
"Processing..."
|
|
1781
1781
|
] }) : "Subscribe" })
|
|
@@ -1790,6 +1790,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, SubscriptionConfirmation, "SubscriptionConf
|
|
|
1790
1790
|
|
|
1791
1791
|
// src/features/billing/stripe-subscription/hooks/useSubscriptionWizard.ts
|
|
1792
1792
|
|
|
1793
|
+
var _uuid = require('uuid');
|
|
1793
1794
|
var initialState = {
|
|
1794
1795
|
step: "plan-selection",
|
|
1795
1796
|
selectedPrice: null,
|
|
@@ -1833,7 +1834,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
1833
1834
|
onCloseRef.current = onClose;
|
|
1834
1835
|
const checkPaymentMethod = _react.useCallback.call(void 0, async () => {
|
|
1835
1836
|
try {
|
|
1836
|
-
const methods = await
|
|
1837
|
+
const methods = await _chunkUYBCHXXLjs.StripeCustomerService.listPaymentMethods();
|
|
1837
1838
|
dispatch({ type: "SET_HAS_PAYMENT_METHOD", hasMethod: methods.length > 0 });
|
|
1838
1839
|
} catch (error) {
|
|
1839
1840
|
console.error("[useSubscriptionWizard] Failed to check payment methods:", error);
|
|
@@ -1855,7 +1856,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
1855
1856
|
try {
|
|
1856
1857
|
await checkPaymentMethod();
|
|
1857
1858
|
if (subscription && state.selectedPrice.id !== _optionalChain([subscription, 'access', _61 => _61.price, 'optionalAccess', _62 => _62.id])) {
|
|
1858
|
-
const preview = await
|
|
1859
|
+
const preview = await _chunkUYBCHXXLjs.StripeSubscriptionService.getProrationPreview({
|
|
1859
1860
|
subscriptionId: subscription.id,
|
|
1860
1861
|
newPriceId: state.selectedPrice.id
|
|
1861
1862
|
});
|
|
@@ -1875,13 +1876,13 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
1875
1876
|
dispatch({ type: "SET_ERROR", error: null });
|
|
1876
1877
|
try {
|
|
1877
1878
|
if (subscription) {
|
|
1878
|
-
await
|
|
1879
|
+
await _chunkUYBCHXXLjs.StripeSubscriptionService.changePlan({
|
|
1879
1880
|
id: subscription.id,
|
|
1880
1881
|
newPriceId: state.selectedPrice.id
|
|
1881
1882
|
});
|
|
1882
1883
|
} else {
|
|
1883
|
-
await
|
|
1884
|
-
id:
|
|
1884
|
+
await _chunkUYBCHXXLjs.StripeSubscriptionService.createSubscription({
|
|
1885
|
+
id: _uuid.v4.call(void 0, ),
|
|
1885
1886
|
priceId: state.selectedPrice.id
|
|
1886
1887
|
});
|
|
1887
1888
|
}
|
|
@@ -2003,7 +2004,7 @@ function WizardStepPlanSelection({
|
|
|
2003
2004
|
_react.useEffect.call(void 0, () => {
|
|
2004
2005
|
const loadProducts = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2005
2006
|
try {
|
|
2006
|
-
const fetchedProducts = await
|
|
2007
|
+
const fetchedProducts = await _chunkUYBCHXXLjs.StripeProductService.listProducts({ active: true });
|
|
2007
2008
|
setProducts(fetchedProducts);
|
|
2008
2009
|
} catch (error) {
|
|
2009
2010
|
console.error("[WizardStepPlanSelection] Failed to load products:", error);
|
|
@@ -2053,7 +2054,7 @@ function WizardStepPlanSelection({
|
|
|
2053
2054
|
onSelectPrice: handleSelectPrice
|
|
2054
2055
|
}
|
|
2055
2056
|
),
|
|
2056
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex justify-end pt-4 border-t", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2057
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex justify-end pt-4 border-t", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Button, { onClick: onNext, disabled: !selectedPrice || isProcessing, children: isProcessing ? "Loading..." : "Next: Review" }) })
|
|
2057
2058
|
] });
|
|
2058
2059
|
}
|
|
2059
2060
|
_chunk7QVYU63Ejs.__name.call(void 0, WizardStepPlanSelection, "WizardStepPlanSelection");
|
|
@@ -2108,16 +2109,16 @@ function WizardStepReview({
|
|
|
2108
2109
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "font-medium", children: "Payment Method" }),
|
|
2109
2110
|
/* @__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" })
|
|
2110
2111
|
] }),
|
|
2111
|
-
!hasPaymentMethod && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2112
|
+
!hasPaymentMethod && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Button, { variant: "outline", onClick: onAddPaymentMethod, children: "Add Payment Method" })
|
|
2112
2113
|
] }) }),
|
|
2113
|
-
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2114
|
+
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.Alert, { variant: "destructive", children: [
|
|
2114
2115
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.AlertCircle, { className: "h-4 w-4" }),
|
|
2115
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2116
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.AlertDescription, { children: error })
|
|
2116
2117
|
] }),
|
|
2117
2118
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between pt-4 border-t", children: [
|
|
2118
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2119
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Button, { variant: "outline", onClick: onBack, disabled: isProcessing, children: "Back" }),
|
|
2119
2120
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2120
|
-
|
|
2121
|
+
_chunk6HQ6CPVLjs.Button,
|
|
2121
2122
|
{
|
|
2122
2123
|
onClick: hasPaymentMethod ? onConfirm : onAddPaymentMethod,
|
|
2123
2124
|
disabled: isProcessing,
|
|
@@ -2185,10 +2186,10 @@ function SubscriptionWizard({
|
|
|
2185
2186
|
}, [open, actions.reset]);
|
|
2186
2187
|
const dialogTitle = subscription ? "Change Subscription Plan" : "Subscribe to a Plan";
|
|
2187
2188
|
const dialogDescription = subscription ? "Select a new plan for your subscription" : "Choose a subscription plan to get started";
|
|
2188
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2189
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2190
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2191
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2189
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.DialogContent, { className: "max-w-2xl", children: [
|
|
2190
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.DialogHeader, { children: [
|
|
2191
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.DialogTitle, { children: dialogTitle }),
|
|
2192
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.DialogDescription, { children: dialogDescription })
|
|
2192
2193
|
] }),
|
|
2193
2194
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, WizardProgressIndicator, { currentStep: state.step }),
|
|
2194
2195
|
state.step === "plan-selection" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -2264,15 +2265,15 @@ function UsageSummaryCard({ meter, summary }) {
|
|
|
2264
2265
|
const progressWidth = percentage !== null ? Math.min(percentage, 100) : 0;
|
|
2265
2266
|
const displayName = meter.displayName || meter.eventName;
|
|
2266
2267
|
const hasLimit = limit !== null && limit !== void 0;
|
|
2267
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2268
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2268
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.Card, { children: [
|
|
2269
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.CardHeader, { className: "flex flex-row items-center gap-x-3 pb-3", children: [
|
|
2269
2270
|
/* @__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" }) }),
|
|
2270
2271
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col", children: [
|
|
2271
2272
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "font-semibold", children: displayName }),
|
|
2272
2273
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-gray-500", children: meter.id })
|
|
2273
2274
|
] })
|
|
2274
2275
|
] }),
|
|
2275
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2276
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.CardContent, { className: "flex flex-col gap-y-4", children: [
|
|
2276
2277
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
2277
2278
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-3xl font-bold", children: currentUsage.toLocaleString() }),
|
|
2278
2279
|
hasLimit && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm text-gray-500", children: [
|
|
@@ -2319,14 +2320,14 @@ function UsageContainer() {
|
|
|
2319
2320
|
const loadUsageData = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2320
2321
|
setLoading(true);
|
|
2321
2322
|
try {
|
|
2322
|
-
const fetchedSubscriptions = await
|
|
2323
|
+
const fetchedSubscriptions = await _chunkUYBCHXXLjs.StripeSubscriptionService.listSubscriptions();
|
|
2323
2324
|
setSubscriptions(fetchedSubscriptions);
|
|
2324
2325
|
const hasMeteredSubscriptions2 = fetchedSubscriptions.some((sub) => _optionalChain([sub, 'access', _87 => _87.price, 'optionalAccess', _88 => _88.recurring, 'optionalAccess', _89 => _89.usageType]) === "metered");
|
|
2325
2326
|
if (!hasMeteredSubscriptions2) {
|
|
2326
2327
|
setLoading(false);
|
|
2327
2328
|
return;
|
|
2328
2329
|
}
|
|
2329
|
-
const fetchedMeters = await
|
|
2330
|
+
const fetchedMeters = await _chunkUYBCHXXLjs.StripeUsageService.listMeters();
|
|
2330
2331
|
setMeters(fetchedMeters);
|
|
2331
2332
|
const summariesMap = {};
|
|
2332
2333
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -2334,7 +2335,7 @@ function UsageContainer() {
|
|
|
2334
2335
|
const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
|
|
2335
2336
|
for (const meter of fetchedMeters) {
|
|
2336
2337
|
try {
|
|
2337
|
-
const meterSummaries = await
|
|
2338
|
+
const meterSummaries = await _chunkUYBCHXXLjs.StripeUsageService.getMeterSummaries({
|
|
2338
2339
|
meterId: meter.id,
|
|
2339
2340
|
startTime: startOfMonth,
|
|
2340
2341
|
endTime: endOfMonth
|
|
@@ -2400,21 +2401,21 @@ function UsageHistoryTable({ usageRecords }) {
|
|
|
2400
2401
|
}
|
|
2401
2402
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
2402
2403
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h2", { className: "text-xl font-semibold", children: "Usage History" }),
|
|
2403
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-hidden rounded-lg border", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2404
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2405
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2406
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2407
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2408
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2404
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-hidden rounded-lg border", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.Table, { children: [
|
|
2405
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.TableRow, { children: [
|
|
2406
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.TableHead, { children: "Date & Time" }),
|
|
2407
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.TableHead, { children: "Meter Event" }),
|
|
2408
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.TableHead, { className: "text-right", children: "Quantity" }),
|
|
2409
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.TableHead, { children: "Event ID" })
|
|
2409
2410
|
] }) }),
|
|
2410
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2411
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.TableBody, { children: usageRecords.map((record) => {
|
|
2411
2412
|
const dateTime = formatDateTime(record.timestamp);
|
|
2412
2413
|
const quantity = record.quantity.toLocaleString();
|
|
2413
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2414
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2415
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2416
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2417
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2414
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.TableRow, { children: [
|
|
2415
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.TableCell, { className: "font-medium", children: dateTime }),
|
|
2416
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.TableCell, { className: "text-muted-foreground", children: record.meterEventName }),
|
|
2417
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.TableCell, { className: "text-right font-medium", children: quantity }),
|
|
2418
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.TableCell, { className: "text-muted-foreground text-sm font-mono", children: record.stripeEventId })
|
|
2418
2419
|
] }, record.id);
|
|
2419
2420
|
}) })
|
|
2420
2421
|
] }) })
|
|
@@ -2431,8 +2432,8 @@ function BillingDetailModal({
|
|
|
2431
2432
|
children,
|
|
2432
2433
|
className
|
|
2433
2434
|
}) {
|
|
2434
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2435
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2435
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.DialogContent, { className: _nullishCoalesce(className, () => ( "max-w-4xl max-h-[90vh] overflow-y-auto")), children: [
|
|
2436
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.DialogHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.DialogTitle, { children: title }) }),
|
|
2436
2437
|
children
|
|
2437
2438
|
] }) });
|
|
2438
2439
|
}
|
|
@@ -2449,7 +2450,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
|
|
|
2449
2450
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "font-semibold text-red-900", children: "Payment Failed" }),
|
|
2450
2451
|
/* @__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." })
|
|
2451
2452
|
] }),
|
|
2452
|
-
onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2453
|
+
onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Button, { variant: "outline", size: "sm", onClick: onUpdatePayment, className: "border-red-300 text-red-700", children: "Update Payment Method" })
|
|
2453
2454
|
] });
|
|
2454
2455
|
}
|
|
2455
2456
|
if (subscription.status === "trialing" /* TRIALING */ && subscription.trialEnd) {
|
|
@@ -2469,7 +2470,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
|
|
|
2469
2470
|
". Add a payment method to continue your subscription."
|
|
2470
2471
|
] })
|
|
2471
2472
|
] }),
|
|
2472
|
-
onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2473
|
+
onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Button, { variant: "outline", size: "sm", onClick: onAddPayment, className: "border-yellow-300 text-yellow-700", children: "Add Payment Method" })
|
|
2473
2474
|
] });
|
|
2474
2475
|
}
|
|
2475
2476
|
}
|
|
@@ -2520,7 +2521,7 @@ function BillingDashboardContainer() {
|
|
|
2520
2521
|
setNoCustomerExists(false);
|
|
2521
2522
|
let customer = null;
|
|
2522
2523
|
try {
|
|
2523
|
-
customer = await
|
|
2524
|
+
customer = await _chunkUYBCHXXLjs.StripeCustomerService.getCustomer();
|
|
2524
2525
|
setData((prev) => ({ ...prev, customer }));
|
|
2525
2526
|
setErrors((prev) => ({ ...prev, customer: null }));
|
|
2526
2527
|
setNoCustomerExists(false);
|
|
@@ -2545,7 +2546,7 @@ function BillingDashboardContainer() {
|
|
|
2545
2546
|
if (customer) {
|
|
2546
2547
|
const fetchSubscriptions = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2547
2548
|
try {
|
|
2548
|
-
const subscriptions2 = await
|
|
2549
|
+
const subscriptions2 = await _chunkUYBCHXXLjs.StripeSubscriptionService.listSubscriptions();
|
|
2549
2550
|
setData((prev) => ({ ...prev, subscriptions: subscriptions2 }));
|
|
2550
2551
|
setErrors((prev) => ({ ...prev, subscriptions: null }));
|
|
2551
2552
|
return subscriptions2;
|
|
@@ -2559,7 +2560,7 @@ function BillingDashboardContainer() {
|
|
|
2559
2560
|
}, "fetchSubscriptions");
|
|
2560
2561
|
const fetchPaymentMethods = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2561
2562
|
try {
|
|
2562
|
-
const paymentMethods = await
|
|
2563
|
+
const paymentMethods = await _chunkUYBCHXXLjs.StripeCustomerService.listPaymentMethods();
|
|
2563
2564
|
setData((prev) => ({ ...prev, paymentMethods }));
|
|
2564
2565
|
setErrors((prev) => ({ ...prev, paymentMethods: null }));
|
|
2565
2566
|
} catch (error) {
|
|
@@ -2571,7 +2572,7 @@ function BillingDashboardContainer() {
|
|
|
2571
2572
|
}, "fetchPaymentMethods");
|
|
2572
2573
|
const fetchInvoices = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2573
2574
|
try {
|
|
2574
|
-
const invoices = await
|
|
2575
|
+
const invoices = await _chunkUYBCHXXLjs.StripeInvoiceService.listInvoices();
|
|
2575
2576
|
setData((prev) => ({ ...prev, invoices }));
|
|
2576
2577
|
setErrors((prev) => ({ ...prev, invoices: null }));
|
|
2577
2578
|
} catch (error) {
|
|
@@ -2595,7 +2596,7 @@ function BillingDashboardContainer() {
|
|
|
2595
2596
|
const handleCreateCustomer = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2596
2597
|
setCreatingCustomer(true);
|
|
2597
2598
|
try {
|
|
2598
|
-
await
|
|
2599
|
+
await _chunkUYBCHXXLjs.StripeCustomerService.createCustomer();
|
|
2599
2600
|
setNoCustomerExists(false);
|
|
2600
2601
|
await fetchAllData();
|
|
2601
2602
|
} catch (error) {
|
|
@@ -2607,7 +2608,7 @@ function BillingDashboardContainer() {
|
|
|
2607
2608
|
}, "handleCreateCustomer");
|
|
2608
2609
|
const fetchUsageData = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2609
2610
|
try {
|
|
2610
|
-
const meters = await
|
|
2611
|
+
const meters = await _chunkUYBCHXXLjs.StripeUsageService.listMeters();
|
|
2611
2612
|
setData((prev) => ({ ...prev, meters }));
|
|
2612
2613
|
const summariesMap = {};
|
|
2613
2614
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -2615,7 +2616,7 @@ function BillingDashboardContainer() {
|
|
|
2615
2616
|
const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
|
|
2616
2617
|
for (const meter of meters) {
|
|
2617
2618
|
try {
|
|
2618
|
-
const meterSummaries = await
|
|
2619
|
+
const meterSummaries = await _chunkUYBCHXXLjs.StripeUsageService.getMeterSummaries({
|
|
2619
2620
|
meterId: meter.id,
|
|
2620
2621
|
startTime: startOfMonth,
|
|
2621
2622
|
endTime: endOfMonth
|
|
@@ -2693,18 +2694,18 @@ function BillingDashboardContainer() {
|
|
|
2693
2694
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-8 w-8" }),
|
|
2694
2695
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-3xl font-bold", children: "Billing" })
|
|
2695
2696
|
] }),
|
|
2696
|
-
isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2697
|
-
noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2698
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2697
|
+
isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.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" }) }) }),
|
|
2698
|
+
noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.Card, { children: [
|
|
2699
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.CardHeader, { className: "text-center", children: [
|
|
2699
2700
|
/* @__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" }) }),
|
|
2700
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2701
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2701
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.CardTitle, { children: "Set Up Billing" }),
|
|
2702
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.CardDescription, { children: "Your company doesn't have a billing account yet. Set one up to manage subscriptions, payment methods, and view invoices." })
|
|
2702
2703
|
] }),
|
|
2703
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2704
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.CardContent, { className: "flex justify-center pb-8", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Button, { onClick: handleCreateCustomer, disabled: creatingCustomer, size: "lg", children: creatingCustomer ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2704
2705
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
2705
2706
|
"Setting up..."
|
|
2706
2707
|
] }) : "Set Up Billing Account" }) }),
|
|
2707
|
-
errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2708
|
+
errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.CardContent, { className: "pt-0", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-center text-sm text-destructive", children: errors.customer }) })
|
|
2708
2709
|
] }),
|
|
2709
2710
|
!noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2710
2711
|
criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -2859,7 +2860,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, isStripeConfigured, "isStripeConfigured");
|
|
|
2859
2860
|
|
|
2860
2861
|
|
|
2861
2862
|
|
|
2862
|
-
|
|
2863
|
+
|
|
2863
2864
|
|
|
2864
2865
|
|
|
2865
2866
|
function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
@@ -2922,7 +2923,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
2922
2923
|
try {
|
|
2923
2924
|
const unitAmountInCents = Math.round(values.unitAmount * 100);
|
|
2924
2925
|
if (isEditMode) {
|
|
2925
|
-
await
|
|
2926
|
+
await _chunkUYBCHXXLjs.StripePriceService.updatePrice({
|
|
2926
2927
|
id: price.id,
|
|
2927
2928
|
nickname: values.nickname || void 0,
|
|
2928
2929
|
description: values.description || void 0,
|
|
@@ -2956,7 +2957,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
2956
2957
|
if (values.token) {
|
|
2957
2958
|
createInput.token = parseInt(values.token, 10);
|
|
2958
2959
|
}
|
|
2959
|
-
await
|
|
2960
|
+
await _chunkUYBCHXXLjs.StripePriceService.createPrice(createInput);
|
|
2960
2961
|
}
|
|
2961
2962
|
onSuccess();
|
|
2962
2963
|
onOpenChange(false);
|
|
@@ -2982,10 +2983,10 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
2982
2983
|
{ id: "licensed", text: "Licensed (per unit)" },
|
|
2983
2984
|
{ id: "metered", text: "Metered (usage-based)" }
|
|
2984
2985
|
];
|
|
2985
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2986
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2987
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2988
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2986
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.DialogContent, { className: "max-w-2xl", children: [
|
|
2987
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.DialogHeader, { children: [
|
|
2988
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.DialogTitle, { children: isEditMode ? "Edit Price" : "Create Price" }),
|
|
2989
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.DialogDescription, { children: isEditMode ? "Update the price details. Note: Only nickname and active status can be changed." : "Create a new price for this product" })
|
|
2989
2990
|
] }),
|
|
2990
2991
|
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: [
|
|
2991
2992
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.AlertCircle, { className: "h-5 w-5 text-blue-600 flex-shrink-0 mt-0.5" }),
|
|
@@ -2994,10 +2995,10 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
2994
2995
|
/* @__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." })
|
|
2995
2996
|
] })
|
|
2996
2997
|
] }),
|
|
2997
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2998
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-col gap-y-4", children: [
|
|
2998
2999
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
|
|
2999
3000
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3000
|
-
|
|
3001
|
+
_chunk6HQ6CPVLjs.FormInput,
|
|
3001
3002
|
{
|
|
3002
3003
|
form,
|
|
3003
3004
|
id: "unitAmount",
|
|
@@ -3007,10 +3008,10 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3007
3008
|
isRequired: true
|
|
3008
3009
|
}
|
|
3009
3010
|
),
|
|
3010
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3011
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.FormSelect, { form, id: "currency", name: "Currency", values: currencyOptions, disabled: isEditMode })
|
|
3011
3012
|
] }),
|
|
3012
3013
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3013
|
-
|
|
3014
|
+
_chunk6HQ6CPVLjs.FormSelect,
|
|
3014
3015
|
{
|
|
3015
3016
|
form,
|
|
3016
3017
|
id: "interval",
|
|
@@ -3021,7 +3022,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3021
3022
|
),
|
|
3022
3023
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
|
|
3023
3024
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3024
|
-
|
|
3025
|
+
_chunk6HQ6CPVLjs.FormInput,
|
|
3025
3026
|
{
|
|
3026
3027
|
form,
|
|
3027
3028
|
id: "intervalCount",
|
|
@@ -3032,7 +3033,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3032
3033
|
}
|
|
3033
3034
|
),
|
|
3034
3035
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3035
|
-
|
|
3036
|
+
_chunk6HQ6CPVLjs.FormSelect,
|
|
3036
3037
|
{
|
|
3037
3038
|
form,
|
|
3038
3039
|
id: "usageType",
|
|
@@ -3043,7 +3044,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3043
3044
|
)
|
|
3044
3045
|
] }),
|
|
3045
3046
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3046
|
-
|
|
3047
|
+
_chunk6HQ6CPVLjs.FormInput,
|
|
3047
3048
|
{
|
|
3048
3049
|
form,
|
|
3049
3050
|
id: "nickname",
|
|
@@ -3052,7 +3053,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3052
3053
|
}
|
|
3053
3054
|
),
|
|
3054
3055
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3055
|
-
|
|
3056
|
+
_chunk6HQ6CPVLjs.FormTextarea,
|
|
3056
3057
|
{
|
|
3057
3058
|
form,
|
|
3058
3059
|
id: "description",
|
|
@@ -3061,13 +3062,13 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3061
3062
|
className: "min-h-24"
|
|
3062
3063
|
}
|
|
3063
3064
|
),
|
|
3064
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3065
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.FormInput, { form, id: "token", name: "Token (optional)", placeholder: "Enter token value" }),
|
|
3065
3066
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
3066
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3067
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Label, { children: "Features (optional)" }),
|
|
3067
3068
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
3068
3069
|
form.watch("features").map((_, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
|
|
3069
3070
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3070
|
-
|
|
3071
|
+
_chunk6HQ6CPVLjs.Input,
|
|
3071
3072
|
{
|
|
3072
3073
|
...form.register(`features.${index}`),
|
|
3073
3074
|
placeholder: `Feature ${index + 1}`,
|
|
@@ -3075,7 +3076,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3075
3076
|
}
|
|
3076
3077
|
),
|
|
3077
3078
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3078
|
-
|
|
3079
|
+
_chunk6HQ6CPVLjs.Button,
|
|
3079
3080
|
{
|
|
3080
3081
|
type: "button",
|
|
3081
3082
|
variant: "outline",
|
|
@@ -3092,7 +3093,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3092
3093
|
)
|
|
3093
3094
|
] }, index)),
|
|
3094
3095
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3095
|
-
|
|
3096
|
+
_chunk6HQ6CPVLjs.Button,
|
|
3096
3097
|
{
|
|
3097
3098
|
type: "button",
|
|
3098
3099
|
variant: "outline",
|
|
@@ -3110,8 +3111,8 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3110
3111
|
)
|
|
3111
3112
|
] })
|
|
3112
3113
|
] }),
|
|
3113
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3114
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3114
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.FormCheckbox, { form, id: "active", name: "Active" }),
|
|
3115
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.CommonEditorButtons, { isEdit: isEditMode, form, disabled: isSubmitting, setOpen: onOpenChange })
|
|
3115
3116
|
] }) })
|
|
3116
3117
|
] }) });
|
|
3117
3118
|
}
|
|
@@ -3133,7 +3134,7 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3133
3134
|
const loadPrices = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3134
3135
|
setLoading(true);
|
|
3135
3136
|
try {
|
|
3136
|
-
const fetchedPrices = await
|
|
3137
|
+
const fetchedPrices = await _chunkUYBCHXXLjs.StripePriceService.listPrices({ productId });
|
|
3137
3138
|
setPrices(fetchedPrices);
|
|
3138
3139
|
} catch (error) {
|
|
3139
3140
|
console.error("[PricesList] Failed to load prices:", error);
|
|
@@ -3150,7 +3151,7 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3150
3151
|
}
|
|
3151
3152
|
setArchivingPriceId(priceToArchive.id);
|
|
3152
3153
|
try {
|
|
3153
|
-
await
|
|
3154
|
+
await _chunkUYBCHXXLjs.StripePriceService.archivePrice({ id: priceToArchive.id });
|
|
3154
3155
|
setPriceToArchive(null);
|
|
3155
3156
|
await loadPrices();
|
|
3156
3157
|
onPricesChange();
|
|
@@ -3166,7 +3167,7 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3166
3167
|
}
|
|
3167
3168
|
setReactivatingPriceId(priceToReactivate.id);
|
|
3168
3169
|
try {
|
|
3169
|
-
await
|
|
3170
|
+
await _chunkUYBCHXXLjs.StripePriceService.reactivatePrice({ id: priceToReactivate.id });
|
|
3170
3171
|
setPriceToReactivate(null);
|
|
3171
3172
|
await loadPrices();
|
|
3172
3173
|
onPricesChange();
|
|
@@ -3197,12 +3198,12 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3197
3198
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-4", children: [
|
|
3198
3199
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center justify-between mb-4", children: [
|
|
3199
3200
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "text-lg font-semibold", children: "Prices" }),
|
|
3200
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3201
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Button, { size: "sm", onClick: () => setShowCreatePrice(true), children: "Add Price" })
|
|
3201
3202
|
] }),
|
|
3202
3203
|
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: [
|
|
3203
3204
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.DollarSign, { className: "text-muted-foreground h-12 w-12" }),
|
|
3204
3205
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-sm", children: "No prices yet. Add a price to enable subscriptions." }),
|
|
3205
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3206
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Button, { size: "sm", onClick: () => setShowCreatePrice(true), children: "Add Price" })
|
|
3206
3207
|
] }),
|
|
3207
3208
|
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) => {
|
|
3208
3209
|
const isArchiving = archivingPriceId === price.id;
|
|
@@ -3211,9 +3212,9 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3211
3212
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-start justify-between mb-3", children: [
|
|
3212
3213
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.DollarSign, { className: "h-5 w-5 text-primary" }),
|
|
3213
3214
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-1", children: [
|
|
3214
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3215
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.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" }) }),
|
|
3215
3216
|
price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3216
|
-
|
|
3217
|
+
_chunk6HQ6CPVLjs.Button,
|
|
3217
3218
|
{
|
|
3218
3219
|
variant: "ghost",
|
|
3219
3220
|
size: "sm",
|
|
@@ -3223,7 +3224,7 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3223
3224
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Archive, { className: "h-4 w-4" })
|
|
3224
3225
|
}
|
|
3225
3226
|
) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3226
|
-
|
|
3227
|
+
_chunk6HQ6CPVLjs.Button,
|
|
3227
3228
|
{
|
|
3228
3229
|
variant: "ghost",
|
|
3229
3230
|
size: "sm",
|
|
@@ -3274,20 +3275,20 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3274
3275
|
}
|
|
3275
3276
|
}
|
|
3276
3277
|
),
|
|
3277
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3278
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3279
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3280
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3278
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.AlertDialog, { open: !!priceToArchive, onOpenChange: (open) => !open && setPriceToArchive(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.AlertDialogContent, { children: [
|
|
3279
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.AlertDialogHeader, { children: [
|
|
3280
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.AlertDialogTitle, { children: "Archive Price" }),
|
|
3281
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.AlertDialogDescription, { children: [
|
|
3281
3282
|
"Are you sure you want to archive the price for",
|
|
3282
3283
|
" ",
|
|
3283
3284
|
priceToArchive && `${formatCurrency(priceToArchive.unitAmount, priceToArchive.currency)} ${formatInterval2(priceToArchive)}`,
|
|
3284
3285
|
"? This will prevent new subscriptions but existing ones will continue."
|
|
3285
3286
|
] })
|
|
3286
3287
|
] }),
|
|
3287
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3288
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3288
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.AlertDialogFooter, { children: [
|
|
3289
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.AlertDialogCancel, { disabled: !!archivingPriceId, children: "Cancel" }),
|
|
3289
3290
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3290
|
-
|
|
3291
|
+
_chunk6HQ6CPVLjs.AlertDialogAction,
|
|
3291
3292
|
{
|
|
3292
3293
|
onClick: handleArchive,
|
|
3293
3294
|
disabled: !!archivingPriceId,
|
|
@@ -3297,20 +3298,20 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3297
3298
|
)
|
|
3298
3299
|
] })
|
|
3299
3300
|
] }) }),
|
|
3300
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3301
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3302
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3303
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3301
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.AlertDialog, { open: !!priceToReactivate, onOpenChange: (open) => !open && setPriceToReactivate(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.AlertDialogContent, { children: [
|
|
3302
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.AlertDialogHeader, { children: [
|
|
3303
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.AlertDialogTitle, { children: "Reactivate Price" }),
|
|
3304
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.AlertDialogDescription, { children: [
|
|
3304
3305
|
"Are you sure you want to reactivate the price for",
|
|
3305
3306
|
" ",
|
|
3306
3307
|
priceToReactivate && `${formatCurrency(priceToReactivate.unitAmount, priceToReactivate.currency)} ${formatInterval2(priceToReactivate)}`,
|
|
3307
3308
|
"? This will allow new subscriptions again."
|
|
3308
3309
|
] })
|
|
3309
3310
|
] }),
|
|
3310
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3311
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3311
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.AlertDialogFooter, { children: [
|
|
3312
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.AlertDialogCancel, { disabled: !!reactivatingPriceId, children: "Cancel" }),
|
|
3312
3313
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3313
|
-
|
|
3314
|
+
_chunk6HQ6CPVLjs.AlertDialogAction,
|
|
3314
3315
|
{
|
|
3315
3316
|
onClick: handleReactivate,
|
|
3316
3317
|
disabled: !!reactivatingPriceId,
|
|
@@ -3354,14 +3355,14 @@ function ProductEditor({ product, open, onOpenChange, onSuccess }) {
|
|
|
3354
3355
|
setIsSubmitting(true);
|
|
3355
3356
|
try {
|
|
3356
3357
|
if (product) {
|
|
3357
|
-
await
|
|
3358
|
+
await _chunkUYBCHXXLjs.StripeProductService.updateProduct({
|
|
3358
3359
|
id: product.id,
|
|
3359
3360
|
name: values.name,
|
|
3360
3361
|
description: values.description,
|
|
3361
3362
|
active: values.active
|
|
3362
3363
|
});
|
|
3363
3364
|
} else {
|
|
3364
|
-
await
|
|
3365
|
+
await _chunkUYBCHXXLjs.StripeProductService.createProduct({
|
|
3365
3366
|
id: _uuid.v4.call(void 0, ),
|
|
3366
3367
|
name: values.name,
|
|
3367
3368
|
description: values.description,
|
|
@@ -3376,15 +3377,15 @@ function ProductEditor({ product, open, onOpenChange, onSuccess }) {
|
|
|
3376
3377
|
setIsSubmitting(false);
|
|
3377
3378
|
}
|
|
3378
3379
|
}, "onSubmit");
|
|
3379
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3380
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3381
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3382
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3380
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.DialogContent, { className: "max-w-2xl", children: [
|
|
3381
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.DialogHeader, { children: [
|
|
3382
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.DialogTitle, { children: product ? "Edit Product" : "Create Product" }),
|
|
3383
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.DialogDescription, { children: product ? `Update the details for ${product.name}` : "Create a new product to offer to your customers" })
|
|
3383
3384
|
] }),
|
|
3384
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3385
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3385
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-col gap-y-4", children: [
|
|
3386
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.FormInput, { form, id: "name", name: "Product Name", placeholder: "Enter product name", isRequired: true }),
|
|
3386
3387
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3387
|
-
|
|
3388
|
+
_chunk6HQ6CPVLjs.FormTextarea,
|
|
3388
3389
|
{
|
|
3389
3390
|
form,
|
|
3390
3391
|
id: "description",
|
|
@@ -3393,8 +3394,8 @@ function ProductEditor({ product, open, onOpenChange, onSuccess }) {
|
|
|
3393
3394
|
className: "min-h-32"
|
|
3394
3395
|
}
|
|
3395
3396
|
),
|
|
3396
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3397
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3397
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.FormCheckbox, { form, id: "active", name: "Active" }),
|
|
3398
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.CommonEditorButtons, { isEdit: !!product, form, disabled: isSubmitting, setOpen: onOpenChange })
|
|
3398
3399
|
] }) })
|
|
3399
3400
|
] }) });
|
|
3400
3401
|
}
|
|
@@ -3417,7 +3418,7 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3417
3418
|
}
|
|
3418
3419
|
setArchivingProductId(productToArchive.id);
|
|
3419
3420
|
try {
|
|
3420
|
-
const archivedProduct = await
|
|
3421
|
+
const archivedProduct = await _chunkUYBCHXXLjs.StripeProductService.archiveProduct({ id: productToArchive.id });
|
|
3421
3422
|
setProductToArchive(null);
|
|
3422
3423
|
onProductsChange();
|
|
3423
3424
|
} catch (error) {
|
|
@@ -3432,7 +3433,7 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3432
3433
|
}
|
|
3433
3434
|
setReactivatingProductId(productToReactivate.id);
|
|
3434
3435
|
try {
|
|
3435
|
-
const reactivatedProduct = await
|
|
3436
|
+
const reactivatedProduct = await _chunkUYBCHXXLjs.StripeProductService.reactivateProduct({ id: productToReactivate.id });
|
|
3436
3437
|
setProductToReactivate(null);
|
|
3437
3438
|
onProductsChange();
|
|
3438
3439
|
} catch (error) {
|
|
@@ -3461,12 +3462,12 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3461
3462
|
] })
|
|
3462
3463
|
] }),
|
|
3463
3464
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
3464
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3465
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.Button, { variant: "outline", size: "sm", onClick: () => setEditingProduct(product), children: [
|
|
3465
3466
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Edit, { className: "h-4 w-4 mr-1" }),
|
|
3466
3467
|
"Edit"
|
|
3467
3468
|
] }),
|
|
3468
3469
|
product.active ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3469
|
-
|
|
3470
|
+
_chunk6HQ6CPVLjs.Button,
|
|
3470
3471
|
{
|
|
3471
3472
|
variant: "outline",
|
|
3472
3473
|
size: "sm",
|
|
@@ -3478,7 +3479,7 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3478
3479
|
]
|
|
3479
3480
|
}
|
|
3480
3481
|
) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3481
|
-
|
|
3482
|
+
_chunk6HQ6CPVLjs.Button,
|
|
3482
3483
|
{
|
|
3483
3484
|
variant: "outline",
|
|
3484
3485
|
size: "sm",
|
|
@@ -3490,7 +3491,7 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3490
3491
|
]
|
|
3491
3492
|
}
|
|
3492
3493
|
),
|
|
3493
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3494
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.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" }) })
|
|
3494
3495
|
] })
|
|
3495
3496
|
] }),
|
|
3496
3497
|
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 }) })
|
|
@@ -3508,19 +3509,19 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3508
3509
|
}
|
|
3509
3510
|
}
|
|
3510
3511
|
),
|
|
3511
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3512
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3513
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3514
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3512
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.AlertDialog, { open: !!productToArchive, onOpenChange: (open) => !open && setProductToArchive(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.AlertDialogContent, { children: [
|
|
3513
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.AlertDialogHeader, { children: [
|
|
3514
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.AlertDialogTitle, { children: "Archive Product" }),
|
|
3515
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.AlertDialogDescription, { children: [
|
|
3515
3516
|
'Are you sure you want to archive "',
|
|
3516
3517
|
_optionalChain([productToArchive, 'optionalAccess', _144 => _144.name]),
|
|
3517
3518
|
'"? This will deactivate it and it will no longer be available for new subscriptions.'
|
|
3518
3519
|
] })
|
|
3519
3520
|
] }),
|
|
3520
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3521
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3521
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.AlertDialogFooter, { children: [
|
|
3522
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.AlertDialogCancel, { disabled: !!archivingProductId, children: "Cancel" }),
|
|
3522
3523
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3523
|
-
|
|
3524
|
+
_chunk6HQ6CPVLjs.AlertDialogAction,
|
|
3524
3525
|
{
|
|
3525
3526
|
onClick: handleArchive,
|
|
3526
3527
|
disabled: !!archivingProductId,
|
|
@@ -3530,19 +3531,19 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3530
3531
|
)
|
|
3531
3532
|
] })
|
|
3532
3533
|
] }) }),
|
|
3533
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3534
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3535
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3536
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3534
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.AlertDialog, { open: !!productToReactivate, onOpenChange: (open) => !open && setProductToReactivate(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.AlertDialogContent, { children: [
|
|
3535
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.AlertDialogHeader, { children: [
|
|
3536
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.AlertDialogTitle, { children: "Reactivate Product" }),
|
|
3537
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.AlertDialogDescription, { children: [
|
|
3537
3538
|
'Are you sure you want to reactivate "',
|
|
3538
3539
|
_optionalChain([productToReactivate, 'optionalAccess', _145 => _145.name]),
|
|
3539
3540
|
'"? This will make it available for new subscriptions again.'
|
|
3540
3541
|
] })
|
|
3541
3542
|
] }),
|
|
3542
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3543
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3543
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk6HQ6CPVLjs.AlertDialogFooter, { children: [
|
|
3544
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.AlertDialogCancel, { disabled: !!reactivatingProductId, children: "Cancel" }),
|
|
3544
3545
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3545
|
-
|
|
3546
|
+
_chunk6HQ6CPVLjs.AlertDialogAction,
|
|
3546
3547
|
{
|
|
3547
3548
|
onClick: handleReactivate,
|
|
3548
3549
|
disabled: !!reactivatingProductId,
|
|
@@ -3559,7 +3560,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductsList, "ProductsList");
|
|
|
3559
3560
|
// src/features/billing/stripe-product/components/containers/ProductsAdminContainer.tsx
|
|
3560
3561
|
|
|
3561
3562
|
function ProductsAdminContainer() {
|
|
3562
|
-
const { hasRole } =
|
|
3563
|
+
const { hasRole } = _chunk6HQ6CPVLjs.useCurrentUserContext.call(void 0, );
|
|
3563
3564
|
const [products, setProducts] = _react.useState.call(void 0, []);
|
|
3564
3565
|
const [loading, setLoading] = _react.useState.call(void 0, true);
|
|
3565
3566
|
const [showCreateProduct, setShowCreateProduct] = _react.useState.call(void 0, false);
|
|
@@ -3569,7 +3570,7 @@ function ProductsAdminContainer() {
|
|
|
3569
3570
|
const loadProducts = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3570
3571
|
setLoading(true);
|
|
3571
3572
|
try {
|
|
3572
|
-
const fetchedProducts = await
|
|
3573
|
+
const fetchedProducts = await _chunkUYBCHXXLjs.StripeProductService.listProducts();
|
|
3573
3574
|
setProducts(fetchedProducts);
|
|
3574
3575
|
} catch (error) {
|
|
3575
3576
|
console.error("[ProductsAdminContainer] Failed to load products:", error);
|
|
@@ -3589,14 +3590,14 @@ function ProductsAdminContainer() {
|
|
|
3589
3590
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Package, { className: "h-8 w-8" }),
|
|
3590
3591
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-3xl font-bold", children: "Product & Price Management" })
|
|
3591
3592
|
] }),
|
|
3592
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3593
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Button, { onClick: () => setShowCreateProduct(true), children: "Create Product" })
|
|
3593
3594
|
] }),
|
|
3594
3595
|
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: [
|
|
3595
3596
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Package, { className: "text-muted-foreground h-16 w-16" }),
|
|
3596
3597
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
3597
3598
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "mb-2 text-xl font-semibold", children: "No products yet" }),
|
|
3598
3599
|
/* @__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." }),
|
|
3599
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3600
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk6HQ6CPVLjs.Button, { onClick: () => setShowCreateProduct(true), children: "Create Your First Product" })
|
|
3600
3601
|
] })
|
|
3601
3602
|
] }),
|
|
3602
3603
|
products.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductsList, { products, onProductsChange: loadProducts }),
|