@carlonicora/nextjs-jsonapi 1.29.5 → 1.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{BlockNoteEditor-C25QYFYD.mjs → BlockNoteEditor-CEJE3YHQ.mjs} +4 -4
- package/dist/{BlockNoteEditor-6U5KIP4Q.js → BlockNoteEditor-TUJ3VCS3.js} +14 -14
- package/dist/{BlockNoteEditor-6U5KIP4Q.js.map → BlockNoteEditor-TUJ3VCS3.js.map} +1 -1
- package/dist/billing/index.js +335 -335
- package/dist/billing/index.mjs +3 -3
- package/dist/{chunk-UYBCHXXL.js → chunk-5KQXRLK3.js} +25 -2
- package/dist/chunk-5KQXRLK3.js.map +1 -0
- package/dist/{chunk-CYZZ3E33.js → chunk-BHKXZF2I.js} +493 -501
- package/dist/chunk-BHKXZF2I.js.map +1 -0
- package/dist/{chunk-GR4QPP36.mjs → chunk-C62JXXUX.mjs} +1 -1
- package/dist/{chunk-EW6QPMN3.js → chunk-OR5NPUWF.js} +1 -1
- package/dist/{chunk-EW6QPMN3.js.map → chunk-OR5NPUWF.js.map} +1 -1
- package/dist/{chunk-NYNLJEPF.mjs → chunk-WQ3KF6BG.mjs} +24 -1
- package/dist/chunk-WQ3KF6BG.mjs.map +1 -0
- package/dist/{chunk-QFN6RG6A.mjs → chunk-XY6HEWHI.mjs} +28 -36
- package/dist/chunk-XY6HEWHI.mjs.map +1 -0
- package/dist/client/index.js +4 -4
- package/dist/client/index.mjs +3 -3
- package/dist/components/index.js +4 -4
- package/dist/components/index.mjs +3 -3
- package/dist/contexts/index.js +4 -4
- package/dist/contexts/index.mjs +3 -3
- package/dist/core/index.d.mts +25 -2
- package/dist/core/index.d.ts +25 -2
- package/dist/core/index.js +10 -2
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +9 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +11 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -2
- package/dist/server/index.js +3 -3
- package/dist/server/index.mjs +1 -1
- package/package.json +1 -1
- package/src/components/containers/ReactMarkdownContainer.tsx +1 -1
- package/src/components/errors/errorToast.ts +2 -4
- package/src/components/forms/CommonAssociationForm.tsx +3 -3
- package/src/components/forms/FileUploader.tsx +4 -4
- package/src/features/auth/components/forms/AcceptInvitation.tsx +2 -2
- package/src/features/auth/components/forms/ActivateAccount.tsx +2 -2
- package/src/features/auth/components/forms/ForgotPassword.tsx +1 -1
- package/src/features/auth/components/forms/Login.tsx +4 -4
- package/src/features/auth/components/forms/Register.tsx +1 -1
- package/src/features/auth/components/forms/ResetPassword.tsx +2 -2
- package/src/features/company/components/forms/CompanyConfigurationEditor.tsx +3 -3
- package/src/features/company/components/forms/CompanyDeleter.tsx +1 -1
- package/src/features/notification/components/modals/NotificationModal.tsx +2 -2
- package/src/features/role/components/forms/UserRoleAdd.tsx +2 -2
- package/src/features/user/components/forms/UserResentInvitationEmail.tsx +2 -2
- package/src/features/user/components/widgets/UserSearchPopover.tsx +1 -1
- package/src/index.ts +3 -0
- package/src/shadcnui/ui/sonner.tsx +13 -23
- package/src/utils/index.ts +3 -0
- package/src/utils/toast.ts +39 -0
- package/dist/chunk-CYZZ3E33.js.map +0 -1
- package/dist/chunk-NYNLJEPF.mjs.map +0 -1
- package/dist/chunk-QFN6RG6A.mjs.map +0 -1
- package/dist/chunk-UYBCHXXL.js.map +0 -1
- /package/dist/{BlockNoteEditor-C25QYFYD.mjs.map → BlockNoteEditor-CEJE3YHQ.mjs.map} +0 -0
- /package/dist/{chunk-GR4QPP36.mjs.map → chunk-C62JXXUX.mjs.map} +0 -0
package/dist/billing/index.js
CHANGED
|
@@ -47,11 +47,11 @@
|
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
|
|
50
|
-
var
|
|
50
|
+
var _chunkBHKXZF2Ijs = require('../chunk-BHKXZF2I.js');
|
|
51
51
|
|
|
52
52
|
|
|
53
53
|
|
|
54
|
-
var
|
|
54
|
+
var _chunkOR5NPUWFjs = require('../chunk-OR5NPUWF.js');
|
|
55
55
|
|
|
56
56
|
|
|
57
57
|
|
|
@@ -60,7 +60,7 @@ var _chunkEW6QPMN3js = require('../chunk-EW6QPMN3.js');
|
|
|
60
60
|
|
|
61
61
|
|
|
62
62
|
|
|
63
|
-
var
|
|
63
|
+
var _chunk5KQXRLK3js = require('../chunk-5KQXRLK3.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, _chunkBHKXZF2Ijs.Card, { children: [
|
|
124
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
125
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.CardContent, { children: [
|
|
129
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
130
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.Skeleton, { className: "h-4 w-24 mb-1" }),
|
|
131
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.Card, { children: [
|
|
137
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
138
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
|
|
149
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
150
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.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
|
+
_chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.Card, { children: [
|
|
220
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
221
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.CardContent, { children: [
|
|
225
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
226
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.Card, { children: [
|
|
232
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
233
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
|
|
241
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
242
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.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 _chunk5KQXRLK3js.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, _chunkBHKXZF2Ijs.Card, { children: [
|
|
314
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
315
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.CardContent, { children: [
|
|
319
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
320
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.Skeleton, { className: "h-4 w-48 mb-1" }),
|
|
321
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.Card, { children: [
|
|
327
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
328
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.Card, { children: [
|
|
336
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
337
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.Card, { children: [
|
|
347
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
348
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.Card, { children: [
|
|
403
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
404
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.CardContent, { children: [
|
|
408
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.Skeleton, { className: "h-6 w-24 mb-2" }),
|
|
409
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.Skeleton, { className: "h-4 w-32 mb-1" }),
|
|
410
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.Card, { children: [
|
|
416
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
417
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewAllClick, children: [
|
|
427
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
428
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.Card, { children: [
|
|
478
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
479
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.CardContent, { children: [
|
|
483
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.Skeleton, { className: "h-6 w-24 mb-2" }),
|
|
484
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.Card, { children: [
|
|
490
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
491
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewDetailsClick, children: [
|
|
503
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
504
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.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 _chunk5KQXRLK3js.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 _chunk5KQXRLK3js.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, _chunkBHKXZF2Ijs.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.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
|
+
_chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.Button, { type: "button", variant: "outline", onClick: onCancel, disabled: isSubmitting || isLoading, children: "Cancel" }),
|
|
649
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.DialogContent, { className: "max-w-md", children: [
|
|
666
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.DialogHeader, { children: [
|
|
667
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.DialogTitle, { children: "Add Payment Method" }),
|
|
668
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.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 _chunk5KQXRLK3js.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 _chunk5KQXRLK3js.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 _chunk5KQXRLK3js.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, _chunkBHKXZF2Ijs.Card, { className: "relative", children: [
|
|
736
|
+
isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.DropdownMenu, { children: [
|
|
743
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.DropdownMenuTrigger, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.DropdownMenuContent, { align: "end", children: [
|
|
745
|
+
!isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.DropdownMenuItem, { onClick: handleSetDefault, disabled: loading, children: "Set as Default" }),
|
|
746
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.AlertDialog, { open: showRemoveDialog, onOpenChange: setShowRemoveDialog, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.AlertDialogContent, { children: [
|
|
764
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.AlertDialogHeader, { children: [
|
|
765
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.AlertDialogTitle, { children: "Remove Payment Method" }),
|
|
766
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.AlertDialogFooter, { children: [
|
|
772
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.AlertDialogCancel, { disabled: loading, children: "Cancel" }),
|
|
773
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.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 _chunk5KQXRLK3js.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, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.DialogContent, { className: "max-w-2xl", children: [
|
|
948
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.DialogHeader, { children: [
|
|
949
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.DialogTitle, { children: [
|
|
950
950
|
"Invoice ",
|
|
951
951
|
getInvoiceNumber()
|
|
952
952
|
] }),
|
|
953
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
953
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.Table, { children: [
|
|
1051
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.TableRow, { children: [
|
|
1052
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.TableHead, { children: "Invoice #" }),
|
|
1053
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.TableHead, { children: "Date" }),
|
|
1054
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.TableHead, { children: "Status" }),
|
|
1055
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.TableHead, { className: "text-right", children: "Amount" }),
|
|
1056
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.TableHead, { children: "Period" })
|
|
1057
1057
|
] }) }),
|
|
1058
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1058
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.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
|
+
_chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.TableCell, { className: "font-medium", children: invoiceNumber }),
|
|
1070
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.TableCell, { className: "text-muted-foreground text-sm", children: date }),
|
|
1071
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InvoiceStatusBadge, { status: invoice.status }) }),
|
|
1072
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.TableCell, { className: "text-right font-medium", children: amount }),
|
|
1073
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.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 _chunk5KQXRLK3js.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, _chunkBHKXZF2Ijs.Tabs, { value: statusFilter, onValueChange: handleFilterChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.TabsList, { children: [
|
|
1123
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.TabsTrigger, { value: "all", children: "All" }),
|
|
1124
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.TabsTrigger, { value: "paid" /* PAID */, children: "Paid" }),
|
|
1125
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.TabsTrigger, { value: "open" /* OPEN */, children: "Open" }),
|
|
1126
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.TabsTrigger, { value: "void" /* VOID */, children: "Void" }),
|
|
1127
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.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 _chunk5KQXRLK3js.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, _chunkBHKXZF2Ijs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.DialogContent, { className: "max-w-md", children: [
|
|
1191
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.DialogHeader, { children: [
|
|
1192
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.DialogTitle, { children: "Cancel Subscription" }),
|
|
1193
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.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
|
+
_chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.Button, { type: "button", variant: "outline", onClick: () => onOpenChange(false), disabled: isSubmitting, children: "Keep Subscription" }),
|
|
1214
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.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 _chunk5KQXRLK3js.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 _chunk5KQXRLK3js.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 _chunk5KQXRLK3js.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, _chunkBHKXZF2Ijs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.DialogContent, { className: "max-w-2xl", children: [
|
|
1337
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.DialogHeader, { children: [
|
|
1338
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.DialogTitle, { children: "Subscription Details" }),
|
|
1339
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.Button, { variant: "default", onClick: () => onChangePlan(subscription), children: "Change Plan" }),
|
|
1376
|
+
canPause && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.Button, { variant: "outline", onClick: handlePause, disabled: isProcessing, children: isProcessing ? "Pausing..." : "Pause" }),
|
|
1377
|
+
canResume && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.Button, { variant: "outline", onClick: handleResume, disabled: isProcessing, children: isProcessing ? "Resuming..." : "Resume" }),
|
|
1378
|
+
canCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.Button, { variant: "destructive", onClick: () => setShowCancel(true), children: "Cancel" }),
|
|
1379
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.Table, { children: [
|
|
1427
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.TableRow, { children: [
|
|
1428
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.TableHead, { children: "Status" }),
|
|
1429
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.TableHead, { children: "Plan" }),
|
|
1430
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.TableHead, { children: "Period" }),
|
|
1431
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.TableHead, { className: "text-right", children: "Amount" })
|
|
1432
1432
|
] }) }),
|
|
1433
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1433
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.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
|
+
_chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SubscriptionStatusBadge, { status: subscription.status, cancelAtPeriodEnd: subscription.cancelAtPeriodEnd }) }),
|
|
1444
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.TableCell, { className: "font-medium", children: formatPlanName3(price) }),
|
|
1445
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.TableCell, { className: "text-muted-foreground text-sm", children: period }),
|
|
1446
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.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 _chunk5KQXRLK3js.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, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.Tabs, { value, onValueChange: (v) => onChange(v), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.TabsList, { children: [
|
|
1534
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.TabsTrigger, { value: "month", children: "Monthly" }),
|
|
1535
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.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
|
+
_chunkBHKXZF2Ijs.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: _chunk5KQXRLK3js.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, _chunkBHKXZF2Ijs.Badge, { variant: "secondary", className: "absolute top-2 right-2", children: "Current" }),
|
|
1579
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.CardFooter, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1591
|
+
_chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.Skeleton, { className: "h-6 w-24" }),
|
|
1717
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.Skeleton, { className: "h-4 w-full" }),
|
|
1720
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.Skeleton, { className: "h-4 w-3/4" })
|
|
1721
1721
|
] }),
|
|
1722
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1722
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.Button, { variant: "outline", onClick: onCancel, disabled: isLoading, children: "Cancel" }),
|
|
1778
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.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" })
|
|
@@ -1834,7 +1834,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
1834
1834
|
onCloseRef.current = onClose;
|
|
1835
1835
|
const checkPaymentMethod = _react.useCallback.call(void 0, async () => {
|
|
1836
1836
|
try {
|
|
1837
|
-
const methods = await
|
|
1837
|
+
const methods = await _chunk5KQXRLK3js.StripeCustomerService.listPaymentMethods();
|
|
1838
1838
|
dispatch({ type: "SET_HAS_PAYMENT_METHOD", hasMethod: methods.length > 0 });
|
|
1839
1839
|
} catch (error) {
|
|
1840
1840
|
console.error("[useSubscriptionWizard] Failed to check payment methods:", error);
|
|
@@ -1856,7 +1856,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
1856
1856
|
try {
|
|
1857
1857
|
await checkPaymentMethod();
|
|
1858
1858
|
if (subscription && state.selectedPrice.id !== _optionalChain([subscription, 'access', _61 => _61.price, 'optionalAccess', _62 => _62.id])) {
|
|
1859
|
-
const preview = await
|
|
1859
|
+
const preview = await _chunk5KQXRLK3js.StripeSubscriptionService.getProrationPreview({
|
|
1860
1860
|
subscriptionId: subscription.id,
|
|
1861
1861
|
newPriceId: state.selectedPrice.id
|
|
1862
1862
|
});
|
|
@@ -1876,12 +1876,12 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
1876
1876
|
dispatch({ type: "SET_ERROR", error: null });
|
|
1877
1877
|
try {
|
|
1878
1878
|
if (subscription) {
|
|
1879
|
-
await
|
|
1879
|
+
await _chunk5KQXRLK3js.StripeSubscriptionService.changePlan({
|
|
1880
1880
|
id: subscription.id,
|
|
1881
1881
|
newPriceId: state.selectedPrice.id
|
|
1882
1882
|
});
|
|
1883
1883
|
} else {
|
|
1884
|
-
await
|
|
1884
|
+
await _chunk5KQXRLK3js.StripeSubscriptionService.createSubscription({
|
|
1885
1885
|
id: _uuid.v4.call(void 0, ),
|
|
1886
1886
|
priceId: state.selectedPrice.id
|
|
1887
1887
|
});
|
|
@@ -2004,7 +2004,7 @@ function WizardStepPlanSelection({
|
|
|
2004
2004
|
_react.useEffect.call(void 0, () => {
|
|
2005
2005
|
const loadProducts = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2006
2006
|
try {
|
|
2007
|
-
const fetchedProducts = await
|
|
2007
|
+
const fetchedProducts = await _chunk5KQXRLK3js.StripeProductService.listProducts({ active: true });
|
|
2008
2008
|
setProducts(fetchedProducts);
|
|
2009
2009
|
} catch (error) {
|
|
2010
2010
|
console.error("[WizardStepPlanSelection] Failed to load products:", error);
|
|
@@ -2054,7 +2054,7 @@ function WizardStepPlanSelection({
|
|
|
2054
2054
|
onSelectPrice: handleSelectPrice
|
|
2055
2055
|
}
|
|
2056
2056
|
),
|
|
2057
|
-
/* @__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, _chunkBHKXZF2Ijs.Button, { onClick: onNext, disabled: !selectedPrice || isProcessing, children: isProcessing ? "Loading..." : "Next: Review" }) })
|
|
2058
2058
|
] });
|
|
2059
2059
|
}
|
|
2060
2060
|
_chunk7QVYU63Ejs.__name.call(void 0, WizardStepPlanSelection, "WizardStepPlanSelection");
|
|
@@ -2109,16 +2109,16 @@ function WizardStepReview({
|
|
|
2109
2109
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "font-medium", children: "Payment Method" }),
|
|
2110
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" })
|
|
2111
2111
|
] }),
|
|
2112
|
-
!hasPaymentMethod && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2112
|
+
!hasPaymentMethod && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.Button, { variant: "outline", onClick: onAddPaymentMethod, children: "Add Payment Method" })
|
|
2113
2113
|
] }) }),
|
|
2114
|
-
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2114
|
+
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.Alert, { variant: "destructive", children: [
|
|
2115
2115
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.AlertCircle, { className: "h-4 w-4" }),
|
|
2116
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2116
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.AlertDescription, { children: error })
|
|
2117
2117
|
] }),
|
|
2118
2118
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between pt-4 border-t", children: [
|
|
2119
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2119
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.Button, { variant: "outline", onClick: onBack, disabled: isProcessing, children: "Back" }),
|
|
2120
2120
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2121
|
-
|
|
2121
|
+
_chunkBHKXZF2Ijs.Button,
|
|
2122
2122
|
{
|
|
2123
2123
|
onClick: hasPaymentMethod ? onConfirm : onAddPaymentMethod,
|
|
2124
2124
|
disabled: isProcessing,
|
|
@@ -2186,10 +2186,10 @@ function SubscriptionWizard({
|
|
|
2186
2186
|
}, [open, actions.reset]);
|
|
2187
2187
|
const dialogTitle = subscription ? "Change Subscription Plan" : "Subscribe to a Plan";
|
|
2188
2188
|
const dialogDescription = subscription ? "Select a new plan for your subscription" : "Choose a subscription plan to get started";
|
|
2189
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2190
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2191
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2192
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2189
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.DialogContent, { className: "max-w-2xl", children: [
|
|
2190
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.DialogHeader, { children: [
|
|
2191
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.DialogTitle, { children: dialogTitle }),
|
|
2192
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.DialogDescription, { children: dialogDescription })
|
|
2193
2193
|
] }),
|
|
2194
2194
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, WizardProgressIndicator, { currentStep: state.step }),
|
|
2195
2195
|
state.step === "plan-selection" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -2265,15 +2265,15 @@ function UsageSummaryCard({ meter, summary }) {
|
|
|
2265
2265
|
const progressWidth = percentage !== null ? Math.min(percentage, 100) : 0;
|
|
2266
2266
|
const displayName = meter.displayName || meter.eventName;
|
|
2267
2267
|
const hasLimit = limit !== null && limit !== void 0;
|
|
2268
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2269
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2268
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.Card, { children: [
|
|
2269
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.CardHeader, { className: "flex flex-row items-center gap-x-3 pb-3", children: [
|
|
2270
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" }) }),
|
|
2271
2271
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col", children: [
|
|
2272
2272
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "font-semibold", children: displayName }),
|
|
2273
2273
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-gray-500", children: meter.id })
|
|
2274
2274
|
] })
|
|
2275
2275
|
] }),
|
|
2276
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2276
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.CardContent, { className: "flex flex-col gap-y-4", children: [
|
|
2277
2277
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
2278
2278
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-3xl font-bold", children: currentUsage.toLocaleString() }),
|
|
2279
2279
|
hasLimit && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm text-gray-500", children: [
|
|
@@ -2320,14 +2320,14 @@ function UsageContainer() {
|
|
|
2320
2320
|
const loadUsageData = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2321
2321
|
setLoading(true);
|
|
2322
2322
|
try {
|
|
2323
|
-
const fetchedSubscriptions = await
|
|
2323
|
+
const fetchedSubscriptions = await _chunk5KQXRLK3js.StripeSubscriptionService.listSubscriptions();
|
|
2324
2324
|
setSubscriptions(fetchedSubscriptions);
|
|
2325
2325
|
const hasMeteredSubscriptions2 = fetchedSubscriptions.some((sub) => _optionalChain([sub, 'access', _87 => _87.price, 'optionalAccess', _88 => _88.recurring, 'optionalAccess', _89 => _89.usageType]) === "metered");
|
|
2326
2326
|
if (!hasMeteredSubscriptions2) {
|
|
2327
2327
|
setLoading(false);
|
|
2328
2328
|
return;
|
|
2329
2329
|
}
|
|
2330
|
-
const fetchedMeters = await
|
|
2330
|
+
const fetchedMeters = await _chunk5KQXRLK3js.StripeUsageService.listMeters();
|
|
2331
2331
|
setMeters(fetchedMeters);
|
|
2332
2332
|
const summariesMap = {};
|
|
2333
2333
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -2335,7 +2335,7 @@ function UsageContainer() {
|
|
|
2335
2335
|
const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
|
|
2336
2336
|
for (const meter of fetchedMeters) {
|
|
2337
2337
|
try {
|
|
2338
|
-
const meterSummaries = await
|
|
2338
|
+
const meterSummaries = await _chunk5KQXRLK3js.StripeUsageService.getMeterSummaries({
|
|
2339
2339
|
meterId: meter.id,
|
|
2340
2340
|
startTime: startOfMonth,
|
|
2341
2341
|
endTime: endOfMonth
|
|
@@ -2401,21 +2401,21 @@ function UsageHistoryTable({ usageRecords }) {
|
|
|
2401
2401
|
}
|
|
2402
2402
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
2403
2403
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h2", { className: "text-xl font-semibold", children: "Usage History" }),
|
|
2404
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-hidden rounded-lg border", children: /* @__PURE__ */ _jsxruntime.jsxs.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,
|
|
2409
|
-
/* @__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, _chunkBHKXZF2Ijs.Table, { children: [
|
|
2405
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.TableRow, { children: [
|
|
2406
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.TableHead, { children: "Date & Time" }),
|
|
2407
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.TableHead, { children: "Meter Event" }),
|
|
2408
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.TableHead, { className: "text-right", children: "Quantity" }),
|
|
2409
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.TableHead, { children: "Event ID" })
|
|
2410
2410
|
] }) }),
|
|
2411
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2411
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.TableBody, { children: usageRecords.map((record) => {
|
|
2412
2412
|
const dateTime = formatDateTime(record.timestamp);
|
|
2413
2413
|
const quantity = record.quantity.toLocaleString();
|
|
2414
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2415
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2416
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2417
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2418
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2414
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.TableRow, { children: [
|
|
2415
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.TableCell, { className: "font-medium", children: dateTime }),
|
|
2416
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.TableCell, { className: "text-muted-foreground", children: record.meterEventName }),
|
|
2417
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.TableCell, { className: "text-right font-medium", children: quantity }),
|
|
2418
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.TableCell, { className: "text-muted-foreground text-sm font-mono", children: record.stripeEventId })
|
|
2419
2419
|
] }, record.id);
|
|
2420
2420
|
}) })
|
|
2421
2421
|
] }) })
|
|
@@ -2432,8 +2432,8 @@ function BillingDetailModal({
|
|
|
2432
2432
|
children,
|
|
2433
2433
|
className
|
|
2434
2434
|
}) {
|
|
2435
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2436
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2435
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.DialogContent, { className: _nullishCoalesce(className, () => ( "max-w-4xl max-h-[90vh] overflow-y-auto")), children: [
|
|
2436
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.DialogHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.DialogTitle, { children: title }) }),
|
|
2437
2437
|
children
|
|
2438
2438
|
] }) });
|
|
2439
2439
|
}
|
|
@@ -2450,7 +2450,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
|
|
|
2450
2450
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "font-semibold text-red-900", children: "Payment Failed" }),
|
|
2451
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." })
|
|
2452
2452
|
] }),
|
|
2453
|
-
onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2453
|
+
onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.Button, { variant: "outline", size: "sm", onClick: onUpdatePayment, className: "border-red-300 text-red-700", children: "Update Payment Method" })
|
|
2454
2454
|
] });
|
|
2455
2455
|
}
|
|
2456
2456
|
if (subscription.status === "trialing" /* TRIALING */ && subscription.trialEnd) {
|
|
@@ -2470,7 +2470,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
|
|
|
2470
2470
|
". Add a payment method to continue your subscription."
|
|
2471
2471
|
] })
|
|
2472
2472
|
] }),
|
|
2473
|
-
onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2473
|
+
onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.Button, { variant: "outline", size: "sm", onClick: onAddPayment, className: "border-yellow-300 text-yellow-700", children: "Add Payment Method" })
|
|
2474
2474
|
] });
|
|
2475
2475
|
}
|
|
2476
2476
|
}
|
|
@@ -2521,7 +2521,7 @@ function BillingDashboardContainer() {
|
|
|
2521
2521
|
setNoCustomerExists(false);
|
|
2522
2522
|
let customer = null;
|
|
2523
2523
|
try {
|
|
2524
|
-
customer = await
|
|
2524
|
+
customer = await _chunk5KQXRLK3js.StripeCustomerService.getCustomer();
|
|
2525
2525
|
setData((prev) => ({ ...prev, customer }));
|
|
2526
2526
|
setErrors((prev) => ({ ...prev, customer: null }));
|
|
2527
2527
|
setNoCustomerExists(false);
|
|
@@ -2546,7 +2546,7 @@ function BillingDashboardContainer() {
|
|
|
2546
2546
|
if (customer) {
|
|
2547
2547
|
const fetchSubscriptions = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2548
2548
|
try {
|
|
2549
|
-
const subscriptions2 = await
|
|
2549
|
+
const subscriptions2 = await _chunk5KQXRLK3js.StripeSubscriptionService.listSubscriptions();
|
|
2550
2550
|
setData((prev) => ({ ...prev, subscriptions: subscriptions2 }));
|
|
2551
2551
|
setErrors((prev) => ({ ...prev, subscriptions: null }));
|
|
2552
2552
|
return subscriptions2;
|
|
@@ -2560,7 +2560,7 @@ function BillingDashboardContainer() {
|
|
|
2560
2560
|
}, "fetchSubscriptions");
|
|
2561
2561
|
const fetchPaymentMethods = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2562
2562
|
try {
|
|
2563
|
-
const paymentMethods = await
|
|
2563
|
+
const paymentMethods = await _chunk5KQXRLK3js.StripeCustomerService.listPaymentMethods();
|
|
2564
2564
|
setData((prev) => ({ ...prev, paymentMethods }));
|
|
2565
2565
|
setErrors((prev) => ({ ...prev, paymentMethods: null }));
|
|
2566
2566
|
} catch (error) {
|
|
@@ -2572,7 +2572,7 @@ function BillingDashboardContainer() {
|
|
|
2572
2572
|
}, "fetchPaymentMethods");
|
|
2573
2573
|
const fetchInvoices = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2574
2574
|
try {
|
|
2575
|
-
const invoices = await
|
|
2575
|
+
const invoices = await _chunk5KQXRLK3js.StripeInvoiceService.listInvoices();
|
|
2576
2576
|
setData((prev) => ({ ...prev, invoices }));
|
|
2577
2577
|
setErrors((prev) => ({ ...prev, invoices: null }));
|
|
2578
2578
|
} catch (error) {
|
|
@@ -2596,7 +2596,7 @@ function BillingDashboardContainer() {
|
|
|
2596
2596
|
const handleCreateCustomer = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2597
2597
|
setCreatingCustomer(true);
|
|
2598
2598
|
try {
|
|
2599
|
-
await
|
|
2599
|
+
await _chunk5KQXRLK3js.StripeCustomerService.createCustomer();
|
|
2600
2600
|
setNoCustomerExists(false);
|
|
2601
2601
|
await fetchAllData();
|
|
2602
2602
|
} catch (error) {
|
|
@@ -2608,7 +2608,7 @@ function BillingDashboardContainer() {
|
|
|
2608
2608
|
}, "handleCreateCustomer");
|
|
2609
2609
|
const fetchUsageData = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2610
2610
|
try {
|
|
2611
|
-
const meters = await
|
|
2611
|
+
const meters = await _chunk5KQXRLK3js.StripeUsageService.listMeters();
|
|
2612
2612
|
setData((prev) => ({ ...prev, meters }));
|
|
2613
2613
|
const summariesMap = {};
|
|
2614
2614
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -2616,7 +2616,7 @@ function BillingDashboardContainer() {
|
|
|
2616
2616
|
const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
|
|
2617
2617
|
for (const meter of meters) {
|
|
2618
2618
|
try {
|
|
2619
|
-
const meterSummaries = await
|
|
2619
|
+
const meterSummaries = await _chunk5KQXRLK3js.StripeUsageService.getMeterSummaries({
|
|
2620
2620
|
meterId: meter.id,
|
|
2621
2621
|
startTime: startOfMonth,
|
|
2622
2622
|
endTime: endOfMonth
|
|
@@ -2694,18 +2694,18 @@ function BillingDashboardContainer() {
|
|
|
2694
2694
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-8 w-8" }),
|
|
2695
2695
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-3xl font-bold", children: "Billing" })
|
|
2696
2696
|
] }),
|
|
2697
|
-
isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2698
|
-
noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2699
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2697
|
+
isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.Card, { children: [
|
|
2699
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.CardHeader, { className: "text-center", children: [
|
|
2700
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" }) }),
|
|
2701
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2702
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2701
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.CardTitle, { children: "Set Up Billing" }),
|
|
2702
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.CardDescription, { children: "Your company doesn't have a billing account yet. Set one up to manage subscriptions, payment methods, and view invoices." })
|
|
2703
2703
|
] }),
|
|
2704
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2704
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.CardContent, { className: "flex justify-center pb-8", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.Button, { onClick: handleCreateCustomer, disabled: creatingCustomer, size: "lg", children: creatingCustomer ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2705
2705
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
2706
2706
|
"Setting up..."
|
|
2707
2707
|
] }) : "Set Up Billing Account" }) }),
|
|
2708
|
-
errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2708
|
+
errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.CardContent, { className: "pt-0", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-center text-sm text-destructive", children: errors.customer }) })
|
|
2709
2709
|
] }),
|
|
2710
2710
|
!noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2711
2711
|
criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -2841,7 +2841,7 @@ function getStripePromise(publishableKey) {
|
|
|
2841
2841
|
}
|
|
2842
2842
|
_chunk7QVYU63Ejs.__name.call(void 0, getStripePromise, "getStripePromise");
|
|
2843
2843
|
function StripeProvider({ children }) {
|
|
2844
|
-
const publishableKey =
|
|
2844
|
+
const publishableKey = _chunkOR5NPUWFjs.getStripePublishableKey.call(void 0, );
|
|
2845
2845
|
const stripePromise = _react.useMemo.call(void 0, () => getStripePromise(publishableKey), [publishableKey]);
|
|
2846
2846
|
const options = _react.useMemo.call(void 0, () => ({}), []);
|
|
2847
2847
|
if (!publishableKey) {
|
|
@@ -2851,7 +2851,7 @@ function StripeProvider({ children }) {
|
|
|
2851
2851
|
}
|
|
2852
2852
|
_chunk7QVYU63Ejs.__name.call(void 0, StripeProvider, "StripeProvider");
|
|
2853
2853
|
function isStripeConfigured() {
|
|
2854
|
-
return !!
|
|
2854
|
+
return !!_chunkOR5NPUWFjs.getStripePublishableKey.call(void 0, );
|
|
2855
2855
|
}
|
|
2856
2856
|
_chunk7QVYU63Ejs.__name.call(void 0, isStripeConfigured, "isStripeConfigured");
|
|
2857
2857
|
|
|
@@ -2923,7 +2923,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
2923
2923
|
try {
|
|
2924
2924
|
const unitAmountInCents = Math.round(values.unitAmount * 100);
|
|
2925
2925
|
if (isEditMode) {
|
|
2926
|
-
await
|
|
2926
|
+
await _chunk5KQXRLK3js.StripePriceService.updatePrice({
|
|
2927
2927
|
id: price.id,
|
|
2928
2928
|
nickname: values.nickname || void 0,
|
|
2929
2929
|
description: values.description || void 0,
|
|
@@ -2957,7 +2957,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
2957
2957
|
if (values.token) {
|
|
2958
2958
|
createInput.token = parseInt(values.token, 10);
|
|
2959
2959
|
}
|
|
2960
|
-
await
|
|
2960
|
+
await _chunk5KQXRLK3js.StripePriceService.createPrice(createInput);
|
|
2961
2961
|
}
|
|
2962
2962
|
onSuccess();
|
|
2963
2963
|
onOpenChange(false);
|
|
@@ -2983,10 +2983,10 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
2983
2983
|
{ id: "licensed", text: "Licensed (per unit)" },
|
|
2984
2984
|
{ id: "metered", text: "Metered (usage-based)" }
|
|
2985
2985
|
];
|
|
2986
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2987
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2988
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2989
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2986
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.DialogContent, { className: "max-w-2xl", children: [
|
|
2987
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.DialogHeader, { children: [
|
|
2988
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.DialogTitle, { children: isEditMode ? "Edit Price" : "Create Price" }),
|
|
2989
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.DialogDescription, { children: isEditMode ? "Update the price details. Note: Only nickname and active status can be changed." : "Create a new price for this product" })
|
|
2990
2990
|
] }),
|
|
2991
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: [
|
|
2992
2992
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.AlertCircle, { className: "h-5 w-5 text-blue-600 flex-shrink-0 mt-0.5" }),
|
|
@@ -2995,10 +2995,10 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
2995
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." })
|
|
2996
2996
|
] })
|
|
2997
2997
|
] }),
|
|
2998
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2998
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-col gap-y-4", children: [
|
|
2999
2999
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
|
|
3000
3000
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3001
|
-
|
|
3001
|
+
_chunkBHKXZF2Ijs.FormInput,
|
|
3002
3002
|
{
|
|
3003
3003
|
form,
|
|
3004
3004
|
id: "unitAmount",
|
|
@@ -3008,10 +3008,10 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3008
3008
|
isRequired: true
|
|
3009
3009
|
}
|
|
3010
3010
|
),
|
|
3011
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3011
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.FormSelect, { form, id: "currency", name: "Currency", values: currencyOptions, disabled: isEditMode })
|
|
3012
3012
|
] }),
|
|
3013
3013
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3014
|
-
|
|
3014
|
+
_chunkBHKXZF2Ijs.FormSelect,
|
|
3015
3015
|
{
|
|
3016
3016
|
form,
|
|
3017
3017
|
id: "interval",
|
|
@@ -3022,7 +3022,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3022
3022
|
),
|
|
3023
3023
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
|
|
3024
3024
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3025
|
-
|
|
3025
|
+
_chunkBHKXZF2Ijs.FormInput,
|
|
3026
3026
|
{
|
|
3027
3027
|
form,
|
|
3028
3028
|
id: "intervalCount",
|
|
@@ -3033,7 +3033,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3033
3033
|
}
|
|
3034
3034
|
),
|
|
3035
3035
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3036
|
-
|
|
3036
|
+
_chunkBHKXZF2Ijs.FormSelect,
|
|
3037
3037
|
{
|
|
3038
3038
|
form,
|
|
3039
3039
|
id: "usageType",
|
|
@@ -3044,7 +3044,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3044
3044
|
)
|
|
3045
3045
|
] }),
|
|
3046
3046
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3047
|
-
|
|
3047
|
+
_chunkBHKXZF2Ijs.FormInput,
|
|
3048
3048
|
{
|
|
3049
3049
|
form,
|
|
3050
3050
|
id: "nickname",
|
|
@@ -3053,7 +3053,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3053
3053
|
}
|
|
3054
3054
|
),
|
|
3055
3055
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3056
|
-
|
|
3056
|
+
_chunkBHKXZF2Ijs.FormTextarea,
|
|
3057
3057
|
{
|
|
3058
3058
|
form,
|
|
3059
3059
|
id: "description",
|
|
@@ -3062,13 +3062,13 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3062
3062
|
className: "min-h-24"
|
|
3063
3063
|
}
|
|
3064
3064
|
),
|
|
3065
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3065
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.FormInput, { form, id: "token", name: "Token (optional)", placeholder: "Enter token value" }),
|
|
3066
3066
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
3067
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3067
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.Label, { children: "Features (optional)" }),
|
|
3068
3068
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
3069
3069
|
form.watch("features").map((_, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
|
|
3070
3070
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3071
|
-
|
|
3071
|
+
_chunkBHKXZF2Ijs.Input,
|
|
3072
3072
|
{
|
|
3073
3073
|
...form.register(`features.${index}`),
|
|
3074
3074
|
placeholder: `Feature ${index + 1}`,
|
|
@@ -3076,7 +3076,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3076
3076
|
}
|
|
3077
3077
|
),
|
|
3078
3078
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3079
|
-
|
|
3079
|
+
_chunkBHKXZF2Ijs.Button,
|
|
3080
3080
|
{
|
|
3081
3081
|
type: "button",
|
|
3082
3082
|
variant: "outline",
|
|
@@ -3093,7 +3093,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3093
3093
|
)
|
|
3094
3094
|
] }, index)),
|
|
3095
3095
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3096
|
-
|
|
3096
|
+
_chunkBHKXZF2Ijs.Button,
|
|
3097
3097
|
{
|
|
3098
3098
|
type: "button",
|
|
3099
3099
|
variant: "outline",
|
|
@@ -3111,8 +3111,8 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3111
3111
|
)
|
|
3112
3112
|
] })
|
|
3113
3113
|
] }),
|
|
3114
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3115
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3114
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.FormCheckbox, { form, id: "active", name: "Active" }),
|
|
3115
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.CommonEditorButtons, { isEdit: isEditMode, form, disabled: isSubmitting, setOpen: onOpenChange })
|
|
3116
3116
|
] }) })
|
|
3117
3117
|
] }) });
|
|
3118
3118
|
}
|
|
@@ -3134,7 +3134,7 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3134
3134
|
const loadPrices = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3135
3135
|
setLoading(true);
|
|
3136
3136
|
try {
|
|
3137
|
-
const fetchedPrices = await
|
|
3137
|
+
const fetchedPrices = await _chunk5KQXRLK3js.StripePriceService.listPrices({ productId });
|
|
3138
3138
|
setPrices(fetchedPrices);
|
|
3139
3139
|
} catch (error) {
|
|
3140
3140
|
console.error("[PricesList] Failed to load prices:", error);
|
|
@@ -3151,7 +3151,7 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3151
3151
|
}
|
|
3152
3152
|
setArchivingPriceId(priceToArchive.id);
|
|
3153
3153
|
try {
|
|
3154
|
-
await
|
|
3154
|
+
await _chunk5KQXRLK3js.StripePriceService.archivePrice({ id: priceToArchive.id });
|
|
3155
3155
|
setPriceToArchive(null);
|
|
3156
3156
|
await loadPrices();
|
|
3157
3157
|
onPricesChange();
|
|
@@ -3167,7 +3167,7 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3167
3167
|
}
|
|
3168
3168
|
setReactivatingPriceId(priceToReactivate.id);
|
|
3169
3169
|
try {
|
|
3170
|
-
await
|
|
3170
|
+
await _chunk5KQXRLK3js.StripePriceService.reactivatePrice({ id: priceToReactivate.id });
|
|
3171
3171
|
setPriceToReactivate(null);
|
|
3172
3172
|
await loadPrices();
|
|
3173
3173
|
onPricesChange();
|
|
@@ -3198,12 +3198,12 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3198
3198
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-4", children: [
|
|
3199
3199
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center justify-between mb-4", children: [
|
|
3200
3200
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "text-lg font-semibold", children: "Prices" }),
|
|
3201
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3201
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.Button, { size: "sm", onClick: () => setShowCreatePrice(true), children: "Add Price" })
|
|
3202
3202
|
] }),
|
|
3203
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: [
|
|
3204
3204
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.DollarSign, { className: "text-muted-foreground h-12 w-12" }),
|
|
3205
3205
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-sm", children: "No prices yet. Add a price to enable subscriptions." }),
|
|
3206
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3206
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.Button, { size: "sm", onClick: () => setShowCreatePrice(true), children: "Add Price" })
|
|
3207
3207
|
] }),
|
|
3208
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) => {
|
|
3209
3209
|
const isArchiving = archivingPriceId === price.id;
|
|
@@ -3212,9 +3212,9 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3212
3212
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-start justify-between mb-3", children: [
|
|
3213
3213
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.DollarSign, { className: "h-5 w-5 text-primary" }),
|
|
3214
3214
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-1", children: [
|
|
3215
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3215
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.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" }) }),
|
|
3216
3216
|
price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3217
|
-
|
|
3217
|
+
_chunkBHKXZF2Ijs.Button,
|
|
3218
3218
|
{
|
|
3219
3219
|
variant: "ghost",
|
|
3220
3220
|
size: "sm",
|
|
@@ -3224,7 +3224,7 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3224
3224
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Archive, { className: "h-4 w-4" })
|
|
3225
3225
|
}
|
|
3226
3226
|
) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3227
|
-
|
|
3227
|
+
_chunkBHKXZF2Ijs.Button,
|
|
3228
3228
|
{
|
|
3229
3229
|
variant: "ghost",
|
|
3230
3230
|
size: "sm",
|
|
@@ -3275,20 +3275,20 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3275
3275
|
}
|
|
3276
3276
|
}
|
|
3277
3277
|
),
|
|
3278
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3279
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3280
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3281
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3278
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.AlertDialog, { open: !!priceToArchive, onOpenChange: (open) => !open && setPriceToArchive(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.AlertDialogContent, { children: [
|
|
3279
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.AlertDialogHeader, { children: [
|
|
3280
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.AlertDialogTitle, { children: "Archive Price" }),
|
|
3281
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.AlertDialogDescription, { children: [
|
|
3282
3282
|
"Are you sure you want to archive the price for",
|
|
3283
3283
|
" ",
|
|
3284
3284
|
priceToArchive && `${formatCurrency(priceToArchive.unitAmount, priceToArchive.currency)} ${formatInterval2(priceToArchive)}`,
|
|
3285
3285
|
"? This will prevent new subscriptions but existing ones will continue."
|
|
3286
3286
|
] })
|
|
3287
3287
|
] }),
|
|
3288
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3289
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3288
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.AlertDialogFooter, { children: [
|
|
3289
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.AlertDialogCancel, { disabled: !!archivingPriceId, children: "Cancel" }),
|
|
3290
3290
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3291
|
-
|
|
3291
|
+
_chunkBHKXZF2Ijs.AlertDialogAction,
|
|
3292
3292
|
{
|
|
3293
3293
|
onClick: handleArchive,
|
|
3294
3294
|
disabled: !!archivingPriceId,
|
|
@@ -3298,20 +3298,20 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3298
3298
|
)
|
|
3299
3299
|
] })
|
|
3300
3300
|
] }) }),
|
|
3301
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3302
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3303
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3304
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3301
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.AlertDialog, { open: !!priceToReactivate, onOpenChange: (open) => !open && setPriceToReactivate(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.AlertDialogContent, { children: [
|
|
3302
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.AlertDialogHeader, { children: [
|
|
3303
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.AlertDialogTitle, { children: "Reactivate Price" }),
|
|
3304
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.AlertDialogDescription, { children: [
|
|
3305
3305
|
"Are you sure you want to reactivate the price for",
|
|
3306
3306
|
" ",
|
|
3307
3307
|
priceToReactivate && `${formatCurrency(priceToReactivate.unitAmount, priceToReactivate.currency)} ${formatInterval2(priceToReactivate)}`,
|
|
3308
3308
|
"? This will allow new subscriptions again."
|
|
3309
3309
|
] })
|
|
3310
3310
|
] }),
|
|
3311
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3312
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3311
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.AlertDialogFooter, { children: [
|
|
3312
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.AlertDialogCancel, { disabled: !!reactivatingPriceId, children: "Cancel" }),
|
|
3313
3313
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3314
|
-
|
|
3314
|
+
_chunkBHKXZF2Ijs.AlertDialogAction,
|
|
3315
3315
|
{
|
|
3316
3316
|
onClick: handleReactivate,
|
|
3317
3317
|
disabled: !!reactivatingPriceId,
|
|
@@ -3355,14 +3355,14 @@ function ProductEditor({ product, open, onOpenChange, onSuccess }) {
|
|
|
3355
3355
|
setIsSubmitting(true);
|
|
3356
3356
|
try {
|
|
3357
3357
|
if (product) {
|
|
3358
|
-
await
|
|
3358
|
+
await _chunk5KQXRLK3js.StripeProductService.updateProduct({
|
|
3359
3359
|
id: product.id,
|
|
3360
3360
|
name: values.name,
|
|
3361
3361
|
description: values.description,
|
|
3362
3362
|
active: values.active
|
|
3363
3363
|
});
|
|
3364
3364
|
} else {
|
|
3365
|
-
await
|
|
3365
|
+
await _chunk5KQXRLK3js.StripeProductService.createProduct({
|
|
3366
3366
|
id: _uuid.v4.call(void 0, ),
|
|
3367
3367
|
name: values.name,
|
|
3368
3368
|
description: values.description,
|
|
@@ -3377,15 +3377,15 @@ function ProductEditor({ product, open, onOpenChange, onSuccess }) {
|
|
|
3377
3377
|
setIsSubmitting(false);
|
|
3378
3378
|
}
|
|
3379
3379
|
}, "onSubmit");
|
|
3380
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3381
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3382
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3383
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3380
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.DialogContent, { className: "max-w-2xl", children: [
|
|
3381
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.DialogHeader, { children: [
|
|
3382
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.DialogTitle, { children: product ? "Edit Product" : "Create Product" }),
|
|
3383
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.DialogDescription, { children: product ? `Update the details for ${product.name}` : "Create a new product to offer to your customers" })
|
|
3384
3384
|
] }),
|
|
3385
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3386
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3385
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.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, _chunkBHKXZF2Ijs.FormInput, { form, id: "name", name: "Product Name", placeholder: "Enter product name", isRequired: true }),
|
|
3387
3387
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3388
|
-
|
|
3388
|
+
_chunkBHKXZF2Ijs.FormTextarea,
|
|
3389
3389
|
{
|
|
3390
3390
|
form,
|
|
3391
3391
|
id: "description",
|
|
@@ -3394,8 +3394,8 @@ function ProductEditor({ product, open, onOpenChange, onSuccess }) {
|
|
|
3394
3394
|
className: "min-h-32"
|
|
3395
3395
|
}
|
|
3396
3396
|
),
|
|
3397
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3398
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3397
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.FormCheckbox, { form, id: "active", name: "Active" }),
|
|
3398
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.CommonEditorButtons, { isEdit: !!product, form, disabled: isSubmitting, setOpen: onOpenChange })
|
|
3399
3399
|
] }) })
|
|
3400
3400
|
] }) });
|
|
3401
3401
|
}
|
|
@@ -3418,7 +3418,7 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3418
3418
|
}
|
|
3419
3419
|
setArchivingProductId(productToArchive.id);
|
|
3420
3420
|
try {
|
|
3421
|
-
const archivedProduct = await
|
|
3421
|
+
const archivedProduct = await _chunk5KQXRLK3js.StripeProductService.archiveProduct({ id: productToArchive.id });
|
|
3422
3422
|
setProductToArchive(null);
|
|
3423
3423
|
onProductsChange();
|
|
3424
3424
|
} catch (error) {
|
|
@@ -3433,7 +3433,7 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3433
3433
|
}
|
|
3434
3434
|
setReactivatingProductId(productToReactivate.id);
|
|
3435
3435
|
try {
|
|
3436
|
-
const reactivatedProduct = await
|
|
3436
|
+
const reactivatedProduct = await _chunk5KQXRLK3js.StripeProductService.reactivateProduct({ id: productToReactivate.id });
|
|
3437
3437
|
setProductToReactivate(null);
|
|
3438
3438
|
onProductsChange();
|
|
3439
3439
|
} catch (error) {
|
|
@@ -3462,12 +3462,12 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3462
3462
|
] })
|
|
3463
3463
|
] }),
|
|
3464
3464
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
3465
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3465
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.Button, { variant: "outline", size: "sm", onClick: () => setEditingProduct(product), children: [
|
|
3466
3466
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Edit, { className: "h-4 w-4 mr-1" }),
|
|
3467
3467
|
"Edit"
|
|
3468
3468
|
] }),
|
|
3469
3469
|
product.active ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3470
|
-
|
|
3470
|
+
_chunkBHKXZF2Ijs.Button,
|
|
3471
3471
|
{
|
|
3472
3472
|
variant: "outline",
|
|
3473
3473
|
size: "sm",
|
|
@@ -3479,7 +3479,7 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3479
3479
|
]
|
|
3480
3480
|
}
|
|
3481
3481
|
) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3482
|
-
|
|
3482
|
+
_chunkBHKXZF2Ijs.Button,
|
|
3483
3483
|
{
|
|
3484
3484
|
variant: "outline",
|
|
3485
3485
|
size: "sm",
|
|
@@ -3491,7 +3491,7 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3491
3491
|
]
|
|
3492
3492
|
}
|
|
3493
3493
|
),
|
|
3494
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3494
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.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" }) })
|
|
3495
3495
|
] })
|
|
3496
3496
|
] }),
|
|
3497
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 }) })
|
|
@@ -3509,19 +3509,19 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3509
3509
|
}
|
|
3510
3510
|
}
|
|
3511
3511
|
),
|
|
3512
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3513
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3514
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3515
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3512
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.AlertDialog, { open: !!productToArchive, onOpenChange: (open) => !open && setProductToArchive(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.AlertDialogContent, { children: [
|
|
3513
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.AlertDialogHeader, { children: [
|
|
3514
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.AlertDialogTitle, { children: "Archive Product" }),
|
|
3515
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.AlertDialogDescription, { children: [
|
|
3516
3516
|
'Are you sure you want to archive "',
|
|
3517
3517
|
_optionalChain([productToArchive, 'optionalAccess', _144 => _144.name]),
|
|
3518
3518
|
'"? This will deactivate it and it will no longer be available for new subscriptions.'
|
|
3519
3519
|
] })
|
|
3520
3520
|
] }),
|
|
3521
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3522
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3521
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.AlertDialogFooter, { children: [
|
|
3522
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.AlertDialogCancel, { disabled: !!archivingProductId, children: "Cancel" }),
|
|
3523
3523
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3524
|
-
|
|
3524
|
+
_chunkBHKXZF2Ijs.AlertDialogAction,
|
|
3525
3525
|
{
|
|
3526
3526
|
onClick: handleArchive,
|
|
3527
3527
|
disabled: !!archivingProductId,
|
|
@@ -3531,19 +3531,19 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3531
3531
|
)
|
|
3532
3532
|
] })
|
|
3533
3533
|
] }) }),
|
|
3534
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3535
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3536
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3537
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3534
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.AlertDialog, { open: !!productToReactivate, onOpenChange: (open) => !open && setProductToReactivate(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.AlertDialogContent, { children: [
|
|
3535
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.AlertDialogHeader, { children: [
|
|
3536
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.AlertDialogTitle, { children: "Reactivate Product" }),
|
|
3537
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.AlertDialogDescription, { children: [
|
|
3538
3538
|
'Are you sure you want to reactivate "',
|
|
3539
3539
|
_optionalChain([productToReactivate, 'optionalAccess', _145 => _145.name]),
|
|
3540
3540
|
'"? This will make it available for new subscriptions again.'
|
|
3541
3541
|
] })
|
|
3542
3542
|
] }),
|
|
3543
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3544
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3543
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHKXZF2Ijs.AlertDialogFooter, { children: [
|
|
3544
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.AlertDialogCancel, { disabled: !!reactivatingProductId, children: "Cancel" }),
|
|
3545
3545
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3546
|
-
|
|
3546
|
+
_chunkBHKXZF2Ijs.AlertDialogAction,
|
|
3547
3547
|
{
|
|
3548
3548
|
onClick: handleReactivate,
|
|
3549
3549
|
disabled: !!reactivatingProductId,
|
|
@@ -3560,17 +3560,17 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductsList, "ProductsList");
|
|
|
3560
3560
|
// src/features/billing/stripe-product/components/containers/ProductsAdminContainer.tsx
|
|
3561
3561
|
|
|
3562
3562
|
function ProductsAdminContainer() {
|
|
3563
|
-
const { hasRole } =
|
|
3563
|
+
const { hasRole } = _chunkBHKXZF2Ijs.useCurrentUserContext.call(void 0, );
|
|
3564
3564
|
const [products, setProducts] = _react.useState.call(void 0, []);
|
|
3565
3565
|
const [loading, setLoading] = _react.useState.call(void 0, true);
|
|
3566
3566
|
const [showCreateProduct, setShowCreateProduct] = _react.useState.call(void 0, false);
|
|
3567
|
-
if (!hasRole(
|
|
3567
|
+
if (!hasRole(_chunkOR5NPUWFjs.getRoleId.call(void 0, ).Administrator)) {
|
|
3568
3568
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex h-64 items-center justify-center", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-red-600 font-semibold", children: "Permission denied. Administrator access required." }) });
|
|
3569
3569
|
}
|
|
3570
3570
|
const loadProducts = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3571
3571
|
setLoading(true);
|
|
3572
3572
|
try {
|
|
3573
|
-
const fetchedProducts = await
|
|
3573
|
+
const fetchedProducts = await _chunk5KQXRLK3js.StripeProductService.listProducts();
|
|
3574
3574
|
setProducts(fetchedProducts);
|
|
3575
3575
|
} catch (error) {
|
|
3576
3576
|
console.error("[ProductsAdminContainer] Failed to load products:", error);
|
|
@@ -3590,14 +3590,14 @@ function ProductsAdminContainer() {
|
|
|
3590
3590
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Package, { className: "h-8 w-8" }),
|
|
3591
3591
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-3xl font-bold", children: "Product & Price Management" })
|
|
3592
3592
|
] }),
|
|
3593
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3593
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.Button, { onClick: () => setShowCreateProduct(true), children: "Create Product" })
|
|
3594
3594
|
] }),
|
|
3595
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: [
|
|
3596
3596
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Package, { className: "text-muted-foreground h-16 w-16" }),
|
|
3597
3597
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
3598
3598
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "mb-2 text-xl font-semibold", children: "No products yet" }),
|
|
3599
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." }),
|
|
3600
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3600
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHKXZF2Ijs.Button, { onClick: () => setShowCreateProduct(true), children: "Create Your First Product" })
|
|
3601
3601
|
] })
|
|
3602
3602
|
] }),
|
|
3603
3603
|
products.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductsList, { products, onProductsChange: loadProducts }),
|