@carlonicora/nextjs-jsonapi 1.138.0 → 1.139.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-L36KO77V.js → BlockNoteEditor-C7GK6NBI.js} +19 -19
- package/dist/{BlockNoteEditor-L36KO77V.js.map → BlockNoteEditor-C7GK6NBI.js.map} +1 -1
- package/dist/{BlockNoteEditor-JEHEQJAW.mjs → BlockNoteEditor-XVVV2CUL.mjs} +4 -4
- package/dist/billing/index.js +357 -357
- package/dist/billing/index.mjs +3 -3
- package/dist/{chunk-W73JBOIR.js → chunk-AWOOIQLF.js} +14 -2
- package/dist/chunk-AWOOIQLF.js.map +1 -0
- package/dist/{chunk-FPTJAORV.js → chunk-FYJKTQCU.js} +738 -740
- package/dist/chunk-FYJKTQCU.js.map +1 -0
- package/dist/{chunk-DVOBOFCF.mjs → chunk-GF4OWZKE.mjs} +13 -1
- package/dist/chunk-GF4OWZKE.mjs.map +1 -0
- package/dist/{chunk-JLC2YP35.mjs → chunk-GTBHGR3F.mjs} +15 -17
- package/dist/chunk-GTBHGR3F.mjs.map +1 -0
- package/dist/{chunk-M5IAN7IR.mjs → chunk-PKSCKISS.mjs} +2 -2
- package/dist/{chunk-C2LEIBUK.js → chunk-XN6CXBNO.js} +7 -7
- package/dist/{chunk-C2LEIBUK.js.map → chunk-XN6CXBNO.js.map} +1 -1
- package/dist/client/index.d.mts +2 -2
- package/dist/client/index.d.ts +2 -2
- package/dist/client/index.js +4 -4
- package/dist/client/index.mjs +3 -3
- package/dist/components/index.d.mts +1 -1
- package/dist/components/index.d.ts +1 -1
- 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 +2 -2
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.js +6 -2
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +5 -1
- package/dist/features/help/index.js +37 -37
- package/dist/features/help/index.mjs +3 -3
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -2
- package/dist/{s3.service-gcEjq8gF.d.ts → s3.service-BrmeMjtk.d.ts} +3 -1
- package/dist/{s3.service-CBqyDZyz.d.mts → s3.service-CXKV_OT-.d.mts} +3 -1
- package/dist/server/index.d.mts +1 -1
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.js +3 -3
- package/dist/server/index.mjs +1 -1
- package/dist/{useDataListRetriever-BqJSFBck.d.mts → useDataListRetriever-WEXL4bqB.d.mts} +1 -0
- package/dist/{useDataListRetriever-BqJSFBck.d.ts → useDataListRetriever-WEXL4bqB.d.ts} +1 -0
- package/package.json +1 -1
- package/src/core/abstracts/AbstractService.ts +15 -0
- package/src/hooks/useDataListRetriever.ts +9 -1
- package/src/shadcnui/ui/progress.tsx +2 -7
- package/dist/chunk-DVOBOFCF.mjs.map +0 -1
- package/dist/chunk-FPTJAORV.js.map +0 -1
- package/dist/chunk-JLC2YP35.mjs.map +0 -1
- package/dist/chunk-W73JBOIR.js.map +0 -1
- /package/dist/{BlockNoteEditor-JEHEQJAW.mjs.map → BlockNoteEditor-XVVV2CUL.mjs.map} +0 -0
- /package/dist/{chunk-M5IAN7IR.mjs.map → chunk-PKSCKISS.mjs.map} +0 -0
package/dist/billing/index.js
CHANGED
|
@@ -48,11 +48,11 @@
|
|
|
48
48
|
|
|
49
49
|
|
|
50
50
|
|
|
51
|
-
var
|
|
51
|
+
var _chunkFYJKTQCUjs = require('../chunk-FYJKTQCU.js');
|
|
52
52
|
|
|
53
53
|
|
|
54
54
|
|
|
55
|
-
var
|
|
55
|
+
var _chunkXN6CXBNOjs = require('../chunk-XN6CXBNO.js');
|
|
56
56
|
|
|
57
57
|
|
|
58
58
|
|
|
@@ -63,7 +63,7 @@ var _chunkC2LEIBUKjs = require('../chunk-C2LEIBUK.js');
|
|
|
63
63
|
|
|
64
64
|
|
|
65
65
|
|
|
66
|
-
var
|
|
66
|
+
var _chunkAWOOIQLFjs = require('../chunk-AWOOIQLF.js');
|
|
67
67
|
require('../chunk-LXKSUWAV.js');
|
|
68
68
|
require('../chunk-IBS6NI7D.js');
|
|
69
69
|
require('../chunk-QWCAOLBD.js');
|
|
@@ -114,41 +114,41 @@ function SubscriptionSummaryCard({
|
|
|
114
114
|
onManageClick
|
|
115
115
|
}) {
|
|
116
116
|
if (loading) {
|
|
117
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
118
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
119
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
117
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.Card, { children: [
|
|
118
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
119
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.CardTitle, { children: "Subscriptions" }),
|
|
120
120
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
121
121
|
] }),
|
|
122
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
123
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
124
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
125
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
122
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.CardContent, { children: [
|
|
123
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
124
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Skeleton, { className: "h-4 w-24 mb-1" }),
|
|
125
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Skeleton, { className: "h-4 w-40" })
|
|
126
126
|
] })
|
|
127
127
|
] });
|
|
128
128
|
}
|
|
129
129
|
if (error) {
|
|
130
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
131
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
132
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
130
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.Card, { children: [
|
|
131
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
132
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.CardTitle, { children: "Subscriptions" }),
|
|
133
133
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
134
134
|
] }),
|
|
135
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
135
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
136
136
|
] });
|
|
137
137
|
}
|
|
138
138
|
const activeSubscriptions = subscriptions.filter(
|
|
139
139
|
(sub) => sub.status === "active" /* ACTIVE */ || sub.status === "trialing" /* TRIALING */
|
|
140
140
|
);
|
|
141
141
|
const primarySubscription = activeSubscriptions[0];
|
|
142
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
143
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
144
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
142
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
|
|
143
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
144
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.CardTitle, { children: "Subscriptions" }),
|
|
145
145
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
146
146
|
] }),
|
|
147
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
147
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.CardContent, { children: subscriptions.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
148
148
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No active plan" }),
|
|
149
149
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Subscribe to get started" }),
|
|
150
150
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
151
|
-
|
|
151
|
+
_chunkFYJKTQCUjs.Button,
|
|
152
152
|
{
|
|
153
153
|
variant: "outline",
|
|
154
154
|
size: "sm",
|
|
@@ -167,7 +167,7 @@ function SubscriptionSummaryCard({
|
|
|
167
167
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
168
168
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: formatPlanName(primarySubscription) }),
|
|
169
169
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
170
|
-
|
|
170
|
+
_chunkFYJKTQCUjs.Badge,
|
|
171
171
|
{
|
|
172
172
|
variant: primarySubscription.cancelAtPeriodEnd ? "secondary" : getStatusBadgeVariant(primarySubscription.status),
|
|
173
173
|
children: primarySubscription.cancelAtPeriodEnd ? "Canceling" : primarySubscription.status
|
|
@@ -209,37 +209,37 @@ function PaymentMethodSummaryCard({
|
|
|
209
209
|
onManageClick
|
|
210
210
|
}) {
|
|
211
211
|
if (loading) {
|
|
212
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
213
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
214
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
212
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.Card, { children: [
|
|
213
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
214
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.CardTitle, { children: "Payment Method" }),
|
|
215
215
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
216
216
|
] }),
|
|
217
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
218
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
219
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
217
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.CardContent, { children: [
|
|
218
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
219
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Skeleton, { className: "h-4 w-24" })
|
|
220
220
|
] })
|
|
221
221
|
] });
|
|
222
222
|
}
|
|
223
223
|
if (error) {
|
|
224
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
225
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
226
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
224
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.Card, { children: [
|
|
225
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
226
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.CardTitle, { children: "Payment Method" }),
|
|
227
227
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
228
228
|
] }),
|
|
229
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
229
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
230
230
|
] });
|
|
231
231
|
}
|
|
232
232
|
const defaultMethod = paymentMethods.find((pm) => pm.id === defaultPaymentMethodId) || paymentMethods[0];
|
|
233
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
234
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
235
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
233
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
|
|
234
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
235
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.CardTitle, { children: "Payment Method" }),
|
|
236
236
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
237
237
|
] }),
|
|
238
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
238
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.CardContent, { children: paymentMethods.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
239
239
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No payment method" }),
|
|
240
240
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Add a card to enable subscriptions" }),
|
|
241
241
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
242
|
-
|
|
242
|
+
_chunkFYJKTQCUjs.Button,
|
|
243
243
|
{
|
|
244
244
|
variant: "outline",
|
|
245
245
|
size: "sm",
|
|
@@ -303,7 +303,7 @@ function CustomerInfoCard({ customer, loading, error }) {
|
|
|
303
303
|
e.stopPropagation();
|
|
304
304
|
setPortalLoading(true);
|
|
305
305
|
try {
|
|
306
|
-
const { url } = await
|
|
306
|
+
const { url } = await _chunkAWOOIQLFjs.StripeCustomerService.createPortalSession();
|
|
307
307
|
window.open(url, "_blank");
|
|
308
308
|
} catch (err) {
|
|
309
309
|
console.error("[CustomerInfoCard] Failed to create portal session:", err);
|
|
@@ -312,52 +312,52 @@ function CustomerInfoCard({ customer, loading, error }) {
|
|
|
312
312
|
}
|
|
313
313
|
}, "handlePortalClick");
|
|
314
314
|
if (loading) {
|
|
315
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
316
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
317
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
315
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.Card, { children: [
|
|
316
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
317
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.CardTitle, { children: "Billing Account" }),
|
|
318
318
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
319
319
|
] }),
|
|
320
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
321
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
322
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
323
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
320
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.CardContent, { children: [
|
|
321
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
322
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Skeleton, { className: "h-4 w-48 mb-1" }),
|
|
323
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Skeleton, { className: "h-4 w-24" })
|
|
324
324
|
] })
|
|
325
325
|
] });
|
|
326
326
|
}
|
|
327
327
|
if (error) {
|
|
328
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
329
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
330
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
328
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.Card, { children: [
|
|
329
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
330
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.CardTitle, { children: "Billing Account" }),
|
|
331
331
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
332
332
|
] }),
|
|
333
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
333
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
334
334
|
] });
|
|
335
335
|
}
|
|
336
336
|
if (!customer) {
|
|
337
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
338
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
339
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
337
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.Card, { children: [
|
|
338
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
339
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.CardTitle, { children: "Billing Account" }),
|
|
340
340
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
341
341
|
] }),
|
|
342
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
342
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.CardContent, { children: [
|
|
343
343
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "Not set up" }),
|
|
344
344
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Billing account will be created when you subscribe" })
|
|
345
345
|
] })
|
|
346
346
|
] });
|
|
347
347
|
}
|
|
348
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
349
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
350
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
348
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.Card, { children: [
|
|
349
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
350
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.CardTitle, { children: "Billing Account" }),
|
|
351
351
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
352
352
|
] }),
|
|
353
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
353
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
354
354
|
customer.name && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: customer.name }),
|
|
355
355
|
customer.email && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: customer.email }),
|
|
356
356
|
customer.balance !== void 0 && customer.balance !== 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm", children: [
|
|
357
357
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground", children: "Credit Balance: " }),
|
|
358
358
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: customer.balance < 0 ? "text-success" : "text-destructive", children: formatBalance(customer.balance, customer.currency) })
|
|
359
359
|
] }),
|
|
360
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
360
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.Button, { variant: "outline", size: "sm", className: "mt-2", onClick: handlePortalClick, disabled: portalLoading, children: [
|
|
361
361
|
portalLoading ? "Loading..." : "Manage in Stripe Portal",
|
|
362
362
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ExternalLink, { className: "h-4 w-4 ml-1" })
|
|
363
363
|
] })
|
|
@@ -401,42 +401,42 @@ function formatAmount(amount, currency) {
|
|
|
401
401
|
_chunk7QVYU63Ejs.__name.call(void 0, formatAmount, "formatAmount");
|
|
402
402
|
function InvoicesSummaryCard({ invoices, loading, error, onViewAllClick }) {
|
|
403
403
|
if (loading) {
|
|
404
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
405
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
406
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
404
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.Card, { children: [
|
|
405
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
406
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.CardTitle, { children: "Recent Invoices" }),
|
|
407
407
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
408
408
|
] }),
|
|
409
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
410
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
411
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
412
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
409
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.CardContent, { children: [
|
|
410
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Skeleton, { className: "h-6 w-24 mb-2" }),
|
|
411
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Skeleton, { className: "h-4 w-32 mb-1" }),
|
|
412
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Skeleton, { className: "h-4 w-20" })
|
|
413
413
|
] })
|
|
414
414
|
] });
|
|
415
415
|
}
|
|
416
416
|
if (error) {
|
|
417
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
418
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
419
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
417
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.Card, { children: [
|
|
418
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
419
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.CardTitle, { children: "Recent Invoices" }),
|
|
420
420
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
421
421
|
] }),
|
|
422
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
422
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
423
423
|
] });
|
|
424
424
|
}
|
|
425
425
|
const latestInvoice = invoices[0];
|
|
426
426
|
const paidInvoices = invoices.filter((inv) => inv.status === "paid" /* PAID */);
|
|
427
427
|
const openInvoices = invoices.filter((inv) => inv.status === "open" /* OPEN */);
|
|
428
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
429
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
430
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
428
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewAllClick, children: [
|
|
429
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
430
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.CardTitle, { children: "Recent Invoices" }),
|
|
431
431
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
432
432
|
] }),
|
|
433
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
433
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.CardContent, { children: invoices.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
434
434
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No invoices yet" }),
|
|
435
435
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Invoices will appear after your first billing cycle" })
|
|
436
436
|
] }) : latestInvoice ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
437
437
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
438
438
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: formatAmount(latestInvoice.total, latestInvoice.currency) }),
|
|
439
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
439
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Badge, { variant: getStatusBadgeVariant2(latestInvoice.status), children: latestInvoice.status })
|
|
440
440
|
] }),
|
|
441
441
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: latestInvoice.stripeInvoiceNumber || `Invoice from ${formatDate2(latestInvoice.periodStart)}` }),
|
|
442
442
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-4 text-xs text-muted-foreground", children: [
|
|
@@ -476,24 +476,24 @@ function BillingUsageSummaryCard({
|
|
|
476
476
|
onViewDetailsClick
|
|
477
477
|
}) {
|
|
478
478
|
if (loading) {
|
|
479
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
480
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
481
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
479
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.Card, { children: [
|
|
480
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
481
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.CardTitle, { children: "Usage This Month" }),
|
|
482
482
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
483
483
|
] }),
|
|
484
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
485
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
486
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
484
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.CardContent, { children: [
|
|
485
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Skeleton, { className: "h-6 w-24 mb-2" }),
|
|
486
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Skeleton, { className: "h-4 w-32" })
|
|
487
487
|
] })
|
|
488
488
|
] });
|
|
489
489
|
}
|
|
490
490
|
if (error) {
|
|
491
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
492
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
493
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
491
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.Card, { children: [
|
|
492
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
493
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.CardTitle, { children: "Usage This Month" }),
|
|
494
494
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
495
495
|
] }),
|
|
496
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
496
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
497
497
|
] });
|
|
498
498
|
}
|
|
499
499
|
const totalUsage = Object.values(summaries).reduce((acc, summary) => {
|
|
@@ -501,12 +501,12 @@ function BillingUsageSummaryCard({
|
|
|
501
501
|
}, 0);
|
|
502
502
|
const primaryMeter = meters.find((m) => _optionalChain([summaries, 'access', _17 => _17[m.id], 'optionalAccess', _18 => _18.aggregatedValue]));
|
|
503
503
|
const primarySummary = primaryMeter ? summaries[primaryMeter.id] : null;
|
|
504
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
505
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
506
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
504
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewDetailsClick, children: [
|
|
505
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
506
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.CardTitle, { children: "Usage This Month" }),
|
|
507
507
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
508
508
|
] }),
|
|
509
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
509
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.CardContent, { children: meters.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
510
510
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No meters" }),
|
|
511
511
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "No usage meters are configured" })
|
|
512
512
|
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
@@ -558,7 +558,7 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
|
|
|
558
558
|
const fetchSetupIntent = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
559
559
|
setLoading(true);
|
|
560
560
|
try {
|
|
561
|
-
const intent = await
|
|
561
|
+
const intent = await _chunkAWOOIQLFjs.StripeCustomerService.createSetupIntent();
|
|
562
562
|
setSetupIntent(intent);
|
|
563
563
|
} catch (err) {
|
|
564
564
|
console.error("[PaymentMethodForm] Failed to create setup intent:", err);
|
|
@@ -596,7 +596,7 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
|
|
|
596
596
|
return;
|
|
597
597
|
}
|
|
598
598
|
if (setAsDefault && _optionalChain([confirmedSetupIntent, 'optionalAccess', _19 => _19.payment_method])) {
|
|
599
|
-
await
|
|
599
|
+
await _chunkAWOOIQLFjs.StripeCustomerService.setDefaultPaymentMethod({
|
|
600
600
|
paymentMethodId: typeof confirmedSetupIntent.payment_method === "string" ? confirmedSetupIntent.payment_method : confirmedSetupIntent.payment_method.id
|
|
601
601
|
});
|
|
602
602
|
}
|
|
@@ -612,7 +612,7 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
|
|
|
612
612
|
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..." }) });
|
|
613
613
|
}
|
|
614
614
|
if (!setupIntent && error) {
|
|
615
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
615
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.AlertDescription, { children: error }) });
|
|
616
616
|
}
|
|
617
617
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: handleSubmit, className: "flex flex-col gap-y-4", children: [
|
|
618
618
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rounded-md border border-gray-300 p-3", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -635,13 +635,13 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
|
|
|
635
635
|
}
|
|
636
636
|
) }),
|
|
637
637
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
638
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
639
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
638
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Checkbox, { id: "setAsDefault", checked: setAsDefault, onCheckedChange: (checked) => setSetAsDefault(!!checked) }),
|
|
639
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Label, { htmlFor: "setAsDefault", className: "cursor-pointer font-normal", children: "Set as default payment method" })
|
|
640
640
|
] }),
|
|
641
|
-
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
641
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.AlertDescription, { children: error }) }),
|
|
642
642
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-x-2", children: [
|
|
643
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
644
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
643
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Button, { type: "button", variant: "outline", onClick: onCancel, disabled: isSubmitting || isLoading, children: "Cancel" }),
|
|
644
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Button, { type: "submit", disabled: !stripe || isSubmitting || isLoading, children: isSubmitting ? "Processing..." : "Add Card" })
|
|
645
645
|
] })
|
|
646
646
|
] });
|
|
647
647
|
}
|
|
@@ -657,10 +657,10 @@ function PaymentMethodEditor({ open, onOpenChange, onSuccess }) {
|
|
|
657
657
|
const handleCancel = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
658
658
|
onOpenChange(false);
|
|
659
659
|
}, "handleCancel");
|
|
660
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
661
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
662
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
663
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
660
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.DialogContent, { className: "max-w-md", children: [
|
|
661
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.DialogHeader, { children: [
|
|
662
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.DialogTitle, { children: "Add Payment Method" }),
|
|
663
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.DialogDescription, { children: "Add a new payment method to your account. Your card information is securely processed by Stripe." })
|
|
664
664
|
] }),
|
|
665
665
|
open && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodForm, { onSuccess: handleSuccess, onCancel: handleCancel })
|
|
666
666
|
] }) });
|
|
@@ -684,7 +684,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
684
684
|
_react.useEffect.call(void 0, () => {
|
|
685
685
|
const loadCustomer = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
686
686
|
try {
|
|
687
|
-
const fetchedCustomer = await
|
|
687
|
+
const fetchedCustomer = await _chunkAWOOIQLFjs.StripeCustomerService.getCustomer();
|
|
688
688
|
setCustomer(fetchedCustomer);
|
|
689
689
|
} catch (error) {
|
|
690
690
|
console.error("[PaymentMethodCard] Failed to load customer:", error);
|
|
@@ -701,7 +701,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
701
701
|
const handleSetDefault = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
702
702
|
setLoading(true);
|
|
703
703
|
try {
|
|
704
|
-
await
|
|
704
|
+
await _chunkAWOOIQLFjs.StripeCustomerService.setDefaultPaymentMethod({ paymentMethodId: paymentMethod.id });
|
|
705
705
|
onUpdate();
|
|
706
706
|
} catch (error) {
|
|
707
707
|
console.error("[PaymentMethodCard] Failed to set as default:", error);
|
|
@@ -712,7 +712,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
712
712
|
const handleRemove = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
713
713
|
setLoading(true);
|
|
714
714
|
try {
|
|
715
|
-
await
|
|
715
|
+
await _chunkAWOOIQLFjs.StripeCustomerService.removePaymentMethod({ paymentMethodId: paymentMethod.id });
|
|
716
716
|
setShowRemoveDialog(false);
|
|
717
717
|
onUpdate();
|
|
718
718
|
} catch (error) {
|
|
@@ -721,16 +721,16 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
721
721
|
}
|
|
722
722
|
}, "handleRemove");
|
|
723
723
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
724
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
725
|
-
isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
726
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
724
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.Card, { className: "relative", children: [
|
|
725
|
+
isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Badge, { variant: "softGreen", className: "absolute right-2 top-2", children: "Default" }),
|
|
726
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.CardHeader, { className: "flex flex-row items-center justify-between pb-2", children: [
|
|
727
727
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
728
728
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-2xl", children: brandIcon }),
|
|
729
729
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium capitalize", children: brand })
|
|
730
730
|
] }),
|
|
731
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
732
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
733
|
-
|
|
731
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.DropdownMenu, { children: [
|
|
732
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.DropdownMenuTrigger, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
733
|
+
_chunkFYJKTQCUjs.Button,
|
|
734
734
|
{
|
|
735
735
|
render: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {}),
|
|
736
736
|
nativeButton: false,
|
|
@@ -741,10 +741,10 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
741
741
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.MoreVertical, { className: "h-4 w-4" })
|
|
742
742
|
}
|
|
743
743
|
) }),
|
|
744
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
745
|
-
!isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
744
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.DropdownMenuContent, { align: "end", children: [
|
|
745
|
+
!isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.DropdownMenuItem, { onClick: handleSetDefault, disabled: loading, children: "Set as Default" }),
|
|
746
746
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
747
|
-
|
|
747
|
+
_chunkFYJKTQCUjs.DropdownMenuItem,
|
|
748
748
|
{
|
|
749
749
|
onClick: () => setShowRemoveDialog(true),
|
|
750
750
|
disabled: loading,
|
|
@@ -755,7 +755,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
755
755
|
] })
|
|
756
756
|
] })
|
|
757
757
|
] }),
|
|
758
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
758
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-1", children: [
|
|
759
759
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-lg font-semibold", children: [
|
|
760
760
|
"\u2022\u2022\u2022\u2022 ",
|
|
761
761
|
last4
|
|
@@ -768,17 +768,17 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
768
768
|
] })
|
|
769
769
|
] }) })
|
|
770
770
|
] }),
|
|
771
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
772
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
773
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
774
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
771
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.AlertDialog, { open: showRemoveDialog, onOpenChange: setShowRemoveDialog, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.AlertDialogContent, { children: [
|
|
772
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.AlertDialogHeader, { children: [
|
|
773
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.AlertDialogTitle, { children: "Remove Payment Method" }),
|
|
774
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.AlertDialogDescription, { children: [
|
|
775
775
|
"Are you sure you want to remove this payment method? This action cannot be undone.",
|
|
776
776
|
isDefault && " This is your default payment method."
|
|
777
777
|
] })
|
|
778
778
|
] }),
|
|
779
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
780
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
781
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
779
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.AlertDialogFooter, { children: [
|
|
780
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.AlertDialogCancel, { disabled: loading, children: "Cancel" }),
|
|
781
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.AlertDialogAction, { onClick: handleRemove, disabled: loading, className: "bg-red-600 hover:bg-red-700", children: loading ? "Removing..." : "Remove" })
|
|
782
782
|
] })
|
|
783
783
|
] }) })
|
|
784
784
|
] });
|
|
@@ -801,7 +801,7 @@ function PaymentMethodsContainer() {
|
|
|
801
801
|
const loadPaymentMethods = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
802
802
|
setLoading(true);
|
|
803
803
|
try {
|
|
804
|
-
const fetchedPaymentMethods = await
|
|
804
|
+
const fetchedPaymentMethods = await _chunkAWOOIQLFjs.StripeCustomerService.listPaymentMethods();
|
|
805
805
|
setPaymentMethods(fetchedPaymentMethods);
|
|
806
806
|
} catch (error) {
|
|
807
807
|
console.error("[PaymentMethodsContainer] Failed to load payment methods:", error);
|
|
@@ -821,14 +821,14 @@ function PaymentMethodsContainer() {
|
|
|
821
821
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8" }),
|
|
822
822
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: "Payment Methods" })
|
|
823
823
|
] }),
|
|
824
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
824
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Button, { onClick: () => setShowAddPaymentMethod(true), children: "Add Payment Method" })
|
|
825
825
|
] }),
|
|
826
826
|
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: [
|
|
827
827
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-16 w-16 text-muted-foreground" }),
|
|
828
828
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
829
829
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "mb-2 text-sm font-medium", children: "No payment methods" }),
|
|
830
830
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mb-4 text-muted-foreground", children: "Add a payment method to enable subscriptions and secure checkout." }),
|
|
831
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
831
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Button, { onClick: () => setShowAddPaymentMethod(true), children: "Add Your First Card" })
|
|
832
832
|
] })
|
|
833
833
|
] }),
|
|
834
834
|
paymentMethods.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodsList, { paymentMethods, onUpdate: loadPaymentMethods }),
|
|
@@ -926,7 +926,7 @@ var statusConfig = {
|
|
|
926
926
|
};
|
|
927
927
|
function InvoiceStatusBadge({ status }) {
|
|
928
928
|
const config = statusConfig[status] || statusConfig["draft" /* DRAFT */];
|
|
929
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
929
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Badge, { variant: config.variant, children: config.label });
|
|
930
930
|
}
|
|
931
931
|
_chunk7QVYU63Ejs.__name.call(void 0, InvoiceStatusBadge, "InvoiceStatusBadge");
|
|
932
932
|
|
|
@@ -957,13 +957,13 @@ function InvoiceDetails({
|
|
|
957
957
|
return invoice.stripeInvoiceId.slice(-8);
|
|
958
958
|
}, "getInvoiceNumber");
|
|
959
959
|
const productName = _optionalChain([invoice, 'access', _29 => _29.subscription, 'optionalAccess', _30 => _30.price, 'optionalAccess', _31 => _31.product, 'optionalAccess', _32 => _32.name]) || "Subscription";
|
|
960
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
961
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
962
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
960
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.DialogContent, { className: "max-w-2xl", children: [
|
|
961
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.DialogHeader, { children: [
|
|
962
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.DialogTitle, { children: [
|
|
963
963
|
"Invoice ",
|
|
964
964
|
getInvoiceNumber()
|
|
965
965
|
] }),
|
|
966
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
966
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.DialogDescription, { children: formatDate3(invoice.periodStart) })
|
|
967
967
|
] }),
|
|
968
968
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
969
969
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
@@ -1028,15 +1028,15 @@ function InvoiceDetails({
|
|
|
1028
1028
|
] })
|
|
1029
1029
|
] }),
|
|
1030
1030
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2 pt-4 border-t", children: [
|
|
1031
|
-
invoice.stripePdfUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1031
|
+
invoice.stripePdfUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.Button, { variant: "outline", onClick: handleDownloadPDF, children: [
|
|
1032
1032
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Download, { className: "mr-2 h-4 w-4" }),
|
|
1033
1033
|
"Download PDF"
|
|
1034
1034
|
] }),
|
|
1035
|
-
invoice.status === "open" /* OPEN */ && invoice.attempted && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1035
|
+
invoice.status === "open" /* OPEN */ && invoice.attempted && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.Button, { variant: "default", onClick: handleRetryPayment, children: [
|
|
1036
1036
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RefreshCw, { className: "mr-2 h-4 w-4" }),
|
|
1037
1037
|
"Retry Payment"
|
|
1038
1038
|
] }),
|
|
1039
|
-
invoice.stripeHostedInvoiceUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1039
|
+
invoice.stripeHostedInvoiceUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.Button, { variant: "outline", onClick: handleViewInStripe, children: [
|
|
1040
1040
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ExternalLink, { className: "mr-2 h-4 w-4" }),
|
|
1041
1041
|
"View in Stripe"
|
|
1042
1042
|
] })
|
|
@@ -1060,30 +1060,30 @@ function InvoicesList({ invoices, onInvoicesChange }) {
|
|
|
1060
1060
|
return invoice.stripeInvoiceId.slice(-8);
|
|
1061
1061
|
}, "getInvoiceNumber");
|
|
1062
1062
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1063
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1064
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1065
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1066
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1067
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1068
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1069
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1063
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.Table, { children: [
|
|
1064
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.TableRow, { children: [
|
|
1065
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.TableHead, { children: "Invoice #" }),
|
|
1066
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.TableHead, { children: "Date" }),
|
|
1067
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.TableHead, { children: "Status" }),
|
|
1068
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.TableHead, { className: "text-right", children: "Amount" }),
|
|
1069
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.TableHead, { children: "Period" })
|
|
1070
1070
|
] }) }),
|
|
1071
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1071
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.TableBody, { children: invoices.map((invoice) => {
|
|
1072
1072
|
const invoiceNumber = getInvoiceNumber(invoice);
|
|
1073
1073
|
const date = formatDate3(invoice.periodStart);
|
|
1074
1074
|
const amount = formatCurrency(invoice.total, invoice.currency);
|
|
1075
1075
|
const period = `${formatDate3(invoice.periodStart)} - ${formatDate3(invoice.periodEnd)}`;
|
|
1076
1076
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1077
|
-
|
|
1077
|
+
_chunkFYJKTQCUjs.TableRow,
|
|
1078
1078
|
{
|
|
1079
1079
|
onClick: () => handleRowClick(invoice),
|
|
1080
1080
|
className: "cursor-pointer hover:bg-muted/50",
|
|
1081
1081
|
children: [
|
|
1082
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1083
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1084
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1085
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1086
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1082
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.TableCell, { className: "font-medium", children: invoiceNumber }),
|
|
1083
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.TableCell, { className: "text-muted-foreground text-xs", children: date }),
|
|
1084
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InvoiceStatusBadge, { status: invoice.status }) }),
|
|
1085
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.TableCell, { className: "text-right font-medium", children: amount }),
|
|
1086
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.TableCell, { className: "text-muted-foreground text-xs", children: period })
|
|
1087
1087
|
]
|
|
1088
1088
|
},
|
|
1089
1089
|
invoice.id
|
|
@@ -1116,7 +1116,7 @@ function InvoicesContainer() {
|
|
|
1116
1116
|
setLoading(true);
|
|
1117
1117
|
try {
|
|
1118
1118
|
const params = statusFilter !== "all" ? { status: statusFilter } : void 0;
|
|
1119
|
-
const data = await
|
|
1119
|
+
const data = await _chunkAWOOIQLFjs.StripeInvoiceService.listInvoices(params);
|
|
1120
1120
|
setInvoices(data);
|
|
1121
1121
|
} catch (error) {
|
|
1122
1122
|
console.error("[InvoicesContainer] Failed to load invoices:", error);
|
|
@@ -1132,12 +1132,12 @@ function InvoicesContainer() {
|
|
|
1132
1132
|
setStatusFilter(value);
|
|
1133
1133
|
}, "handleFilterChange");
|
|
1134
1134
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-4", children: [
|
|
1135
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1136
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1137
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1138
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1139
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1140
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1135
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Tabs, { value: statusFilter, onValueChange: handleFilterChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.TabsList, { children: [
|
|
1136
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.TabsTrigger, { value: "all", children: "All" }),
|
|
1137
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.TabsTrigger, { value: "paid" /* PAID */, children: "Paid" }),
|
|
1138
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.TabsTrigger, { value: "open" /* OPEN */, children: "Open" }),
|
|
1139
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.TabsTrigger, { value: "void" /* VOID */, children: "Void" }),
|
|
1140
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.TabsTrigger, { value: "uncollectible" /* UNCOLLECTIBLE */, children: "Uncollectible" })
|
|
1141
1141
|
] }) }),
|
|
1142
1142
|
loading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-center py-8 text-muted-foreground", children: "Loading invoices..." }),
|
|
1143
1143
|
!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: [
|
|
@@ -1184,7 +1184,7 @@ function CancelSubscriptionDialog({
|
|
|
1184
1184
|
const onSubmit = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async (_values) => {
|
|
1185
1185
|
setIsSubmitting(true);
|
|
1186
1186
|
try {
|
|
1187
|
-
await
|
|
1187
|
+
await _chunkAWOOIQLFjs.StripeSubscriptionService.cancelSubscription({
|
|
1188
1188
|
id: subscription.id,
|
|
1189
1189
|
cancelImmediately: false
|
|
1190
1190
|
});
|
|
@@ -1197,19 +1197,19 @@ function CancelSubscriptionDialog({
|
|
|
1197
1197
|
}
|
|
1198
1198
|
}, "onSubmit");
|
|
1199
1199
|
const periodEndDate = formatDate3(subscription.currentPeriodEnd);
|
|
1200
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1201
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1202
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1203
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1200
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.DialogContent, { className: "max-w-md", children: [
|
|
1201
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.DialogHeader, { children: [
|
|
1202
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.DialogTitle, { children: "Cancel Subscription" }),
|
|
1203
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.DialogDescription, { children: "Are you sure you want to cancel this subscription? This action cannot be undone." })
|
|
1204
1204
|
] }),
|
|
1205
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1205
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-col gap-y-4", children: [
|
|
1206
1206
|
/* @__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: [
|
|
1207
1207
|
"Your subscription will remain active until ",
|
|
1208
1208
|
periodEndDate,
|
|
1209
1209
|
". You can continue using the service until then."
|
|
1210
1210
|
] }),
|
|
1211
1211
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1212
|
-
|
|
1212
|
+
_chunkFYJKTQCUjs.FormTextarea,
|
|
1213
1213
|
{
|
|
1214
1214
|
form,
|
|
1215
1215
|
id: "reason",
|
|
@@ -1219,8 +1219,8 @@ function CancelSubscriptionDialog({
|
|
|
1219
1219
|
}
|
|
1220
1220
|
),
|
|
1221
1221
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-x-2 justify-end pt-2", children: [
|
|
1222
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1223
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1222
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Button, { type: "button", variant: "outline", onClick: () => onOpenChange(false), disabled: isSubmitting, children: "Keep Subscription" }),
|
|
1223
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Button, { type: "submit", variant: "destructive", disabled: isSubmitting, children: isSubmitting ? "Canceling..." : "Confirm Cancellation" })
|
|
1224
1224
|
] })
|
|
1225
1225
|
] }) })
|
|
1226
1226
|
] }) });
|
|
@@ -1269,7 +1269,7 @@ var cancelingConfig = {
|
|
|
1269
1269
|
};
|
|
1270
1270
|
function SubscriptionStatusBadge({ status, cancelAtPeriodEnd }) {
|
|
1271
1271
|
const config = cancelAtPeriodEnd ? cancelingConfig : statusConfig2[status] || statusConfig2["canceled" /* CANCELED */];
|
|
1272
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1272
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Badge, { variant: config.variant, children: config.label });
|
|
1273
1273
|
}
|
|
1274
1274
|
_chunk7QVYU63Ejs.__name.call(void 0, SubscriptionStatusBadge, "SubscriptionStatusBadge");
|
|
1275
1275
|
|
|
@@ -1311,7 +1311,7 @@ function SubscriptionDetails({
|
|
|
1311
1311
|
const handlePause = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1312
1312
|
setIsProcessing(true);
|
|
1313
1313
|
try {
|
|
1314
|
-
await
|
|
1314
|
+
await _chunkAWOOIQLFjs.StripeSubscriptionService.pauseSubscription({ subscriptionId: subscription.id });
|
|
1315
1315
|
onSubscriptionChange();
|
|
1316
1316
|
} catch (error) {
|
|
1317
1317
|
console.error("[SubscriptionDetails] Failed to pause subscription:", error);
|
|
@@ -1322,7 +1322,7 @@ function SubscriptionDetails({
|
|
|
1322
1322
|
const handleResume = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1323
1323
|
setIsProcessing(true);
|
|
1324
1324
|
try {
|
|
1325
|
-
await
|
|
1325
|
+
await _chunkAWOOIQLFjs.StripeSubscriptionService.resumeSubscription({ subscriptionId: subscription.id });
|
|
1326
1326
|
onSubscriptionChange();
|
|
1327
1327
|
} catch (error) {
|
|
1328
1328
|
console.error("[SubscriptionDetails] Failed to resume subscription:", error);
|
|
@@ -1332,7 +1332,7 @@ function SubscriptionDetails({
|
|
|
1332
1332
|
}, "handleResume");
|
|
1333
1333
|
const handleManageViaPortal = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1334
1334
|
try {
|
|
1335
|
-
const { url } = await
|
|
1335
|
+
const { url } = await _chunkAWOOIQLFjs.StripeCustomerService.createPortalSession();
|
|
1336
1336
|
window.open(url, "_blank");
|
|
1337
1337
|
} catch (error) {
|
|
1338
1338
|
console.error("[SubscriptionDetails] Failed to create portal session:", error);
|
|
@@ -1342,10 +1342,10 @@ function SubscriptionDetails({
|
|
|
1342
1342
|
const canResume = subscription.status === "paused" /* PAUSED */;
|
|
1343
1343
|
const canCancel = subscription.status === "active" /* ACTIVE */ || subscription.status === "trialing" /* TRIALING */ || subscription.status === "paused" /* PAUSED */;
|
|
1344
1344
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1345
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1346
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1347
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1348
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1345
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.DialogContent, { className: "max-w-2xl", children: [
|
|
1346
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.DialogHeader, { children: [
|
|
1347
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.DialogTitle, { children: "Subscription Details" }),
|
|
1348
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.DialogDescription, { children: "View and manage your subscription" })
|
|
1349
1349
|
] }),
|
|
1350
1350
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
1351
1351
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
@@ -1387,11 +1387,11 @@ function SubscriptionDetails({
|
|
|
1387
1387
|
"."
|
|
1388
1388
|
] }) }),
|
|
1389
1389
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2 pt-4 border-t", children: [
|
|
1390
|
-
onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1391
|
-
canPause && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1392
|
-
canResume && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1393
|
-
canCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1394
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1390
|
+
onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Button, { variant: "default", onClick: () => onChangePlan(subscription), children: "Change Plan" }),
|
|
1391
|
+
canPause && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Button, { variant: "outline", onClick: handlePause, disabled: isProcessing, children: isProcessing ? "Pausing..." : "Pause" }),
|
|
1392
|
+
canResume && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Button, { variant: "outline", onClick: handleResume, disabled: isProcessing, children: isProcessing ? "Resuming..." : "Resume" }),
|
|
1393
|
+
canCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Button, { variant: "destructive", onClick: () => setShowCancel(true), children: "Cancel" }),
|
|
1394
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Button, { variant: "outline", onClick: handleManageViaPortal, children: "Manage via Portal" })
|
|
1395
1395
|
] })
|
|
1396
1396
|
] })
|
|
1397
1397
|
] }) }),
|
|
@@ -1438,36 +1438,36 @@ function SubscriptionsList({ subscriptions, onSubscriptionsChange, onChangePlan
|
|
|
1438
1438
|
setSelectedSub(subscription);
|
|
1439
1439
|
}, "handleRowClick");
|
|
1440
1440
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1441
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1442
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
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,
|
|
1447
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1441
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.Table, { children: [
|
|
1442
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.TableRow, { children: [
|
|
1443
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.TableHead, { children: "Status" }),
|
|
1444
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.TableHead, { children: "Plan" }),
|
|
1445
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.TableHead, { children: "Period" }),
|
|
1446
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.TableHead, { className: "text-right", children: "Amount" }),
|
|
1447
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.TableHead, { className: "text-right", children: "Actions" })
|
|
1448
1448
|
] }) }),
|
|
1449
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1449
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.TableBody, { children: subscriptions.map((subscription) => {
|
|
1450
1450
|
const price = subscription.price;
|
|
1451
1451
|
const amount = _optionalChain([price, 'optionalAccess', _42 => _42.unitAmount]) ? formatCurrency(price.unitAmount, price.currency) : "0";
|
|
1452
1452
|
const period = `${formatDate3(subscription.currentPeriodStart)} - ${formatDate3(subscription.currentPeriodEnd)}`;
|
|
1453
1453
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1454
|
-
|
|
1454
|
+
_chunkFYJKTQCUjs.TableRow,
|
|
1455
1455
|
{
|
|
1456
1456
|
onClick: () => handleRowClick(subscription),
|
|
1457
1457
|
className: "cursor-pointer hover:bg-muted/50",
|
|
1458
1458
|
children: [
|
|
1459
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1459
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1460
1460
|
SubscriptionStatusBadge,
|
|
1461
1461
|
{
|
|
1462
1462
|
status: subscription.status,
|
|
1463
1463
|
cancelAtPeriodEnd: subscription.cancelAtPeriodEnd
|
|
1464
1464
|
}
|
|
1465
1465
|
) }),
|
|
1466
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1467
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1468
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1469
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1470
|
-
|
|
1466
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.TableCell, { className: "font-medium", children: formatPlanName3(price) }),
|
|
1467
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.TableCell, { className: "text-muted-foreground text-sm", children: period }),
|
|
1468
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.TableCell, { className: "text-right font-medium", children: amount }),
|
|
1469
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.TableCell, { className: "text-right", children: (subscription.status === "active" /* ACTIVE */ || subscription.status === "trialing" /* TRIALING */) && onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1470
|
+
_chunkFYJKTQCUjs.Button,
|
|
1471
1471
|
{
|
|
1472
1472
|
size: "sm",
|
|
1473
1473
|
variant: "outline",
|
|
@@ -1512,7 +1512,7 @@ function SubscriptionsContainer({ onOpenWizard, hasActiveRecurringSubscription }
|
|
|
1512
1512
|
const loadSubscriptions = _react.useCallback.call(void 0, async () => {
|
|
1513
1513
|
setLoading(true);
|
|
1514
1514
|
try {
|
|
1515
|
-
const fetchedSubscriptions = await
|
|
1515
|
+
const fetchedSubscriptions = await _chunkAWOOIQLFjs.StripeSubscriptionService.listSubscriptions();
|
|
1516
1516
|
setSubscriptions(fetchedSubscriptions);
|
|
1517
1517
|
} catch (error) {
|
|
1518
1518
|
console.error("[SubscriptionsContainer] Failed to load subscriptions:", error);
|
|
@@ -1535,7 +1535,7 @@ function SubscriptionsContainer({ onOpenWizard, hasActiveRecurringSubscription }
|
|
|
1535
1535
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8" }),
|
|
1536
1536
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: "Subscriptions" })
|
|
1537
1537
|
] }),
|
|
1538
|
-
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1538
|
+
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _43 => _43()]), children: hasActiveRecurringSubscription ? "Purchase Add-ons" : "Subscribe to a Plan" })
|
|
1539
1539
|
] }),
|
|
1540
1540
|
criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BillingAlertBanner, { subscription }, subscription.id)),
|
|
1541
1541
|
subscriptions.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col items-center justify-center py-12 space-y-4", children: [
|
|
@@ -1543,7 +1543,7 @@ function SubscriptionsContainer({ onOpenWizard, hasActiveRecurringSubscription }
|
|
|
1543
1543
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
1544
1544
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium mb-2", children: "No Active Subscriptions" }),
|
|
1545
1545
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground mb-6", children: "Choose a subscription plan to get started with our services." }),
|
|
1546
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1546
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _44 => _44()]), children: "Subscribe to a Plan" })
|
|
1547
1547
|
] })
|
|
1548
1548
|
] }),
|
|
1549
1549
|
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -1564,9 +1564,9 @@ function IntervalToggle({ value, onChange, hasMonthly, hasYearly }) {
|
|
|
1564
1564
|
if (!hasMonthly || !hasYearly) {
|
|
1565
1565
|
return null;
|
|
1566
1566
|
}
|
|
1567
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1568
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1569
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1567
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Tabs, { value, onValueChange: (v) => onChange(v), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.TabsList, { children: [
|
|
1568
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.TabsTrigger, { value: "month", children: "Monthly" }),
|
|
1569
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.TabsTrigger, { value: "year", children: "Yearly" })
|
|
1570
1570
|
] }) });
|
|
1571
1571
|
}
|
|
1572
1572
|
_chunk7QVYU63Ejs.__name.call(void 0, IntervalToggle, "IntervalToggle");
|
|
@@ -1598,7 +1598,7 @@ function PricingCard({
|
|
|
1598
1598
|
}
|
|
1599
1599
|
}, "handleClick");
|
|
1600
1600
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1601
|
-
|
|
1601
|
+
_chunkFYJKTQCUjs.Card,
|
|
1602
1602
|
{
|
|
1603
1603
|
role: "radio",
|
|
1604
1604
|
"aria-checked": isSelected,
|
|
@@ -1606,7 +1606,7 @@ function PricingCard({
|
|
|
1606
1606
|
tabIndex: isDisabled ? -1 : 0,
|
|
1607
1607
|
onKeyDown: handleKeyDown,
|
|
1608
1608
|
onClick: handleClick,
|
|
1609
|
-
className:
|
|
1609
|
+
className: _chunkAWOOIQLFjs.cn.call(void 0,
|
|
1610
1610
|
"relative cursor-pointer transition-all duration-200 flex flex-col h-full",
|
|
1611
1611
|
"focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
1612
1612
|
isCurrentPlan && "bg-muted/30",
|
|
@@ -1616,9 +1616,9 @@ function PricingCard({
|
|
|
1616
1616
|
isLoading && "pointer-events-none"
|
|
1617
1617
|
),
|
|
1618
1618
|
children: [
|
|
1619
|
-
isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1620
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1621
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1619
|
+
isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Badge, { variant: "secondary", className: "absolute top-2 right-2", children: "Current" }),
|
|
1620
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.CardHeader, { className: "pb-2", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium", children: description }) }),
|
|
1621
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.CardContent, { className: "pb-4 grow", children: [
|
|
1622
1622
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mb-4", children: [
|
|
1623
1623
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-3xl font-bold", children: formattedPrice }),
|
|
1624
1624
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground ml-1", children: interval })
|
|
@@ -1628,8 +1628,8 @@ function PricingCard({
|
|
|
1628
1628
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-muted-foreground", children: feature })
|
|
1629
1629
|
] }, index)) })
|
|
1630
1630
|
] }),
|
|
1631
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1632
|
-
|
|
1631
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.CardFooter, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1632
|
+
_chunkFYJKTQCUjs.Button,
|
|
1633
1633
|
{
|
|
1634
1634
|
variant: isCurrentPlan ? "secondary" : isSelected ? "default" : "outline",
|
|
1635
1635
|
className: "w-full",
|
|
@@ -1657,7 +1657,7 @@ function ProductPricingRow({
|
|
|
1657
1657
|
return null;
|
|
1658
1658
|
}
|
|
1659
1659
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-3", children: [
|
|
1660
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1660
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.SectionHeader, { children: product.name }),
|
|
1661
1661
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1662
1662
|
"div",
|
|
1663
1663
|
{
|
|
@@ -1757,15 +1757,15 @@ function ProductPricingList({
|
|
|
1757
1757
|
_chunk7QVYU63Ejs.__name.call(void 0, ProductPricingList, "ProductPricingList");
|
|
1758
1758
|
function ProductPricingListSkeleton() {
|
|
1759
1759
|
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: [
|
|
1760
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1760
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Skeleton, { className: "h-6 w-32" }),
|
|
1761
1761
|
/* @__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: [
|
|
1762
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1763
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1762
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Skeleton, { className: "h-6 w-24" }),
|
|
1763
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Skeleton, { className: "h-8 w-32" }),
|
|
1764
1764
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
1765
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1766
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1765
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Skeleton, { className: "h-4 w-full" }),
|
|
1766
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Skeleton, { className: "h-4 w-3/4" })
|
|
1767
1767
|
] }),
|
|
1768
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1768
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Skeleton, { className: "h-10 w-full" })
|
|
1769
1769
|
] }, cardIndex)) })
|
|
1770
1770
|
] }, rowIndex)) });
|
|
1771
1771
|
}
|
|
@@ -1820,8 +1820,8 @@ function SubscriptionConfirmation({ price, isLoading, onConfirm, onCancel }) {
|
|
|
1820
1820
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: feature })
|
|
1821
1821
|
] }, index)) }),
|
|
1822
1822
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-3 pt-2 border-t border-accent/30", children: [
|
|
1823
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1824
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1823
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Button, { variant: "outline", onClick: onCancel, disabled: isLoading, children: "Cancel" }),
|
|
1824
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Button, { onClick: onConfirm, disabled: isLoading, children: isLoading ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1825
1825
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "h-4 w-4 animate-spin mr-2" }),
|
|
1826
1826
|
"Processing..."
|
|
1827
1827
|
] }) : "Subscribe" })
|
|
@@ -1892,7 +1892,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
1892
1892
|
onCloseRef.current = onClose;
|
|
1893
1893
|
const checkPaymentMethod = _react.useCallback.call(void 0, async () => {
|
|
1894
1894
|
try {
|
|
1895
|
-
const methods = await
|
|
1895
|
+
const methods = await _chunkAWOOIQLFjs.StripeCustomerService.listPaymentMethods();
|
|
1896
1896
|
dispatch({ type: "SET_HAS_PAYMENT_METHOD", hasMethod: methods.length > 0 });
|
|
1897
1897
|
} catch (error) {
|
|
1898
1898
|
console.error("[useSubscriptionWizard] Failed to check payment methods:", error);
|
|
@@ -1916,7 +1916,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
1916
1916
|
const isTrialUpgrade = _optionalChain([subscription, 'optionalAccess', _55 => _55.status]) === "trialing" /* TRIALING */;
|
|
1917
1917
|
dispatch({ type: "SET_IS_TRIAL_SUBSCRIPTION", isTrial: isTrialUpgrade });
|
|
1918
1918
|
if (isTrialUpgrade && !state.hasPaymentMethod) {
|
|
1919
|
-
const methods = await
|
|
1919
|
+
const methods = await _chunkAWOOIQLFjs.StripeCustomerService.listPaymentMethods();
|
|
1920
1920
|
if (methods.length === 0) {
|
|
1921
1921
|
dispatch({ type: "SET_STEP", step: "payment-method" });
|
|
1922
1922
|
dispatch({
|
|
@@ -1927,7 +1927,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
1927
1927
|
}
|
|
1928
1928
|
}
|
|
1929
1929
|
if (subscription && state.selectedPrice.id !== _optionalChain([subscription, 'access', _56 => _56.price, 'optionalAccess', _57 => _57.id])) {
|
|
1930
|
-
const preview = await
|
|
1930
|
+
const preview = await _chunkAWOOIQLFjs.StripeSubscriptionService.getProrationPreview({
|
|
1931
1931
|
subscriptionId: subscription.id,
|
|
1932
1932
|
newPriceId: state.selectedPrice.id
|
|
1933
1933
|
});
|
|
@@ -1952,14 +1952,14 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
1952
1952
|
newPriceId: state.selectedPrice.id,
|
|
1953
1953
|
promotionCode: _optionalChain([state, 'access', _59 => _59.promotionCode, 'optionalAccess', _60 => _60.promotionCodeId])
|
|
1954
1954
|
};
|
|
1955
|
-
await
|
|
1955
|
+
await _chunkAWOOIQLFjs.StripeSubscriptionService.changePlan(changePlanParams);
|
|
1956
1956
|
} else {
|
|
1957
1957
|
const createParams = {
|
|
1958
1958
|
id: _uuid.v4.call(void 0, ),
|
|
1959
1959
|
priceId: state.selectedPrice.id,
|
|
1960
1960
|
promotionCode: _optionalChain([state, 'access', _61 => _61.promotionCode, 'optionalAccess', _62 => _62.promotionCodeId])
|
|
1961
1961
|
};
|
|
1962
|
-
await
|
|
1962
|
+
await _chunkAWOOIQLFjs.StripeSubscriptionService.createSubscription(createParams);
|
|
1963
1963
|
}
|
|
1964
1964
|
onSuccessRef.current();
|
|
1965
1965
|
onCloseRef.current();
|
|
@@ -1993,7 +1993,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
1993
1993
|
dispatch({ type: "SET_VALIDATING_PROMO_CODE", isValidating: true });
|
|
1994
1994
|
dispatch({ type: "SET_PROMO_CODE_ERROR", error: null });
|
|
1995
1995
|
try {
|
|
1996
|
-
const result = await
|
|
1996
|
+
const result = await _chunkAWOOIQLFjs.StripePromotionCodeService.validatePromotionCode({
|
|
1997
1997
|
code,
|
|
1998
1998
|
stripePriceId: _optionalChain([state, 'access', _70 => _70.selectedPrice, 'optionalAccess', _71 => _71.id])
|
|
1999
1999
|
});
|
|
@@ -2100,7 +2100,7 @@ function WizardStepPlanSelection({
|
|
|
2100
2100
|
_react.useEffect.call(void 0, () => {
|
|
2101
2101
|
const loadProducts = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2102
2102
|
try {
|
|
2103
|
-
const fetchedProducts = await
|
|
2103
|
+
const fetchedProducts = await _chunkAWOOIQLFjs.StripeProductService.listProducts({ active: true });
|
|
2104
2104
|
setProducts(fetchedProducts);
|
|
2105
2105
|
} catch (error) {
|
|
2106
2106
|
console.error("[WizardStepPlanSelection] Failed to load products:", error);
|
|
@@ -2151,7 +2151,7 @@ function WizardStepPlanSelection({
|
|
|
2151
2151
|
onSelectPrice: handleSelectPrice
|
|
2152
2152
|
}
|
|
2153
2153
|
),
|
|
2154
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex justify-end pt-4 border-t", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2154
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex justify-end pt-4 border-t", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Button, { onClick: onNext, disabled: !selectedPrice || isProcessing, children: isProcessing ? "Loading..." : "Next: Review" }) })
|
|
2155
2155
|
] });
|
|
2156
2156
|
}
|
|
2157
2157
|
_chunk7QVYU63Ejs.__name.call(void 0, WizardStepPlanSelection, "WizardStepPlanSelection");
|
|
@@ -2212,7 +2212,7 @@ function PromoCodeInput({
|
|
|
2212
2212
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success text-sm", children: formatDiscount(appliedCode) })
|
|
2213
2213
|
] }),
|
|
2214
2214
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2215
|
-
|
|
2215
|
+
_chunkFYJKTQCUjs.Button,
|
|
2216
2216
|
{
|
|
2217
2217
|
variant: "ghost",
|
|
2218
2218
|
size: "sm",
|
|
@@ -2229,7 +2229,7 @@ function PromoCodeInput({
|
|
|
2229
2229
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
2230
2230
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
|
|
2231
2231
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2232
|
-
|
|
2232
|
+
_chunkFYJKTQCUjs.Input,
|
|
2233
2233
|
{
|
|
2234
2234
|
placeholder: "Enter promo code",
|
|
2235
2235
|
value: code,
|
|
@@ -2239,7 +2239,7 @@ function PromoCodeInput({
|
|
|
2239
2239
|
className: "flex-1"
|
|
2240
2240
|
}
|
|
2241
2241
|
),
|
|
2242
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2242
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Button, { variant: "outline", onClick: handleApply, disabled: disabled || isValidating || !code.trim(), children: isValidating ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "h-4 w-4 animate-spin" }) : "Apply" })
|
|
2243
2243
|
] }),
|
|
2244
2244
|
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error })
|
|
2245
2245
|
] });
|
|
@@ -2311,7 +2311,7 @@ function WizardStepReview({
|
|
|
2311
2311
|
const discountDescription = getDiscountDescription();
|
|
2312
2312
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
2313
2313
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-muted/50 rounded-lg p-4 space-y-3", children: [
|
|
2314
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2314
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.SectionHeader, { children: "Selected Plan" }),
|
|
2315
2315
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between items-center", children: [
|
|
2316
2316
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
2317
2317
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-medium", children: _optionalChain([selectedPrice, 'access', _92 => _92.product, 'optionalAccess', _93 => _93.name]) }),
|
|
@@ -2321,7 +2321,7 @@ function WizardStepReview({
|
|
|
2321
2321
|
discountedPrice !== null ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2322
2322
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground line-through", children: formatCurrency(selectedPrice.unitAmount || 0, selectedPrice.currency) }),
|
|
2323
2323
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-success text-lg font-semibold", children: formatCurrency(discountedPrice, selectedPrice.currency) }),
|
|
2324
|
-
discountDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2324
|
+
discountDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Badge, { variant: "softGreen", children: discountDescription })
|
|
2325
2325
|
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-semibold text-lg", children: formatCurrency(selectedPrice.unitAmount || 0, selectedPrice.currency) }),
|
|
2326
2326
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: formatInterval2(selectedPrice) })
|
|
2327
2327
|
] })
|
|
@@ -2363,15 +2363,15 @@ function WizardStepReview({
|
|
|
2363
2363
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "font-medium", children: "Payment Method" }),
|
|
2364
2364
|
/* @__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" })
|
|
2365
2365
|
] }),
|
|
2366
|
-
!hasPaymentMethod && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2366
|
+
!hasPaymentMethod && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Button, { variant: "outline", onClick: onAddPaymentMethod, children: "Add Payment Method" })
|
|
2367
2367
|
] }) }),
|
|
2368
|
-
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2368
|
+
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.Alert, { variant: "destructive", children: [
|
|
2369
2369
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.AlertCircle, { className: "h-4 w-4" }),
|
|
2370
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2370
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.AlertDescription, { children: error })
|
|
2371
2371
|
] }),
|
|
2372
2372
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between pt-4 border-t", children: [
|
|
2373
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2374
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2373
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Button, { variant: "outline", onClick: onBack, disabled: isProcessing, children: "Back" }),
|
|
2374
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Button, { onClick: hasPaymentMethod ? onConfirm : onAddPaymentMethod, disabled: isProcessing, children: isProcessing ? "Processing..." : hasPaymentMethod ? isChangingPlan ? "Confirm Plan Change" : "Subscribe Now" : "Add Payment Method" })
|
|
2375
2375
|
] })
|
|
2376
2376
|
] });
|
|
2377
2377
|
}
|
|
@@ -2382,7 +2382,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, WizardStepReview, "WizardStepReview");
|
|
|
2382
2382
|
function WizardStepPaymentMethod({ onBack, onSuccess, isProcessing }) {
|
|
2383
2383
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
2384
2384
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
2385
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2385
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.SectionHeader, { children: "Add Payment Method" }),
|
|
2386
2386
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: "Enter your card details to complete your subscription" })
|
|
2387
2387
|
] }),
|
|
2388
2388
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodForm, { onSuccess, onCancel: onBack, isLoading: isProcessing })
|
|
@@ -2424,10 +2424,10 @@ function SubscriptionWizard({
|
|
|
2424
2424
|
const isChangePlanMode = !!subscription;
|
|
2425
2425
|
const dialogTitle = subscription ? "Change Subscription Plan" : isPurchasingAddons ? "Purchase Add-ons" : "Subscribe to a Plan";
|
|
2426
2426
|
const dialogDescription = subscription ? "Select a new plan for your subscription" : isPurchasingAddons ? "Select one-time products to purchase" : "Choose a subscription plan to get started";
|
|
2427
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2428
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2429
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2430
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2427
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.DialogContent, { className: "max-w-2xl", children: [
|
|
2428
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.DialogHeader, { children: [
|
|
2429
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.DialogTitle, { children: dialogTitle }),
|
|
2430
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.DialogDescription, { children: dialogDescription })
|
|
2431
2431
|
] }),
|
|
2432
2432
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, WizardProgressIndicator, { currentStep: state.step }),
|
|
2433
2433
|
state.step === "plan-selection" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -2510,15 +2510,15 @@ function UsageSummaryCard({ meter, summary }) {
|
|
|
2510
2510
|
const progressWidth = percentage !== null ? Math.min(percentage, 100) : 0;
|
|
2511
2511
|
const displayName = meter.displayName || meter.eventName;
|
|
2512
2512
|
const hasLimit = limit !== null && limit !== void 0;
|
|
2513
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2514
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2513
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.Card, { children: [
|
|
2514
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.CardHeader, { className: "flex flex-row items-center gap-x-3 pb-3", children: [
|
|
2515
2515
|
/* @__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" }) }),
|
|
2516
2516
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col", children: [
|
|
2517
2517
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium", children: displayName }),
|
|
2518
2518
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-xs", children: meter.id })
|
|
2519
2519
|
] })
|
|
2520
2520
|
] }),
|
|
2521
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2521
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.CardContent, { className: "flex flex-col gap-y-4", children: [
|
|
2522
2522
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
2523
2523
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-3xl font-bold", children: currentUsage.toLocaleString() }),
|
|
2524
2524
|
hasLimit && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-muted-foreground text-sm", children: [
|
|
@@ -2565,14 +2565,14 @@ function UsageContainer() {
|
|
|
2565
2565
|
const loadUsageData = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2566
2566
|
setLoading(true);
|
|
2567
2567
|
try {
|
|
2568
|
-
const fetchedSubscriptions = await
|
|
2568
|
+
const fetchedSubscriptions = await _chunkAWOOIQLFjs.StripeSubscriptionService.listSubscriptions();
|
|
2569
2569
|
setSubscriptions(fetchedSubscriptions);
|
|
2570
2570
|
const hasMeteredSubscriptions2 = fetchedSubscriptions.some((sub) => _optionalChain([sub, 'access', _99 => _99.price, 'optionalAccess', _100 => _100.recurring, 'optionalAccess', _101 => _101.usageType]) === "metered");
|
|
2571
2571
|
if (!hasMeteredSubscriptions2) {
|
|
2572
2572
|
setLoading(false);
|
|
2573
2573
|
return;
|
|
2574
2574
|
}
|
|
2575
|
-
const fetchedMeters = await
|
|
2575
|
+
const fetchedMeters = await _chunkAWOOIQLFjs.StripeUsageService.listMeters();
|
|
2576
2576
|
setMeters(fetchedMeters);
|
|
2577
2577
|
const summariesMap = {};
|
|
2578
2578
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -2580,7 +2580,7 @@ function UsageContainer() {
|
|
|
2580
2580
|
const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
|
|
2581
2581
|
for (const meter of fetchedMeters) {
|
|
2582
2582
|
try {
|
|
2583
|
-
const meterSummaries = await
|
|
2583
|
+
const meterSummaries = await _chunkAWOOIQLFjs.StripeUsageService.getMeterSummaries({
|
|
2584
2584
|
meterId: meter.id,
|
|
2585
2585
|
startTime: startOfMonth,
|
|
2586
2586
|
endTime: endOfMonth
|
|
@@ -2645,22 +2645,22 @@ function UsageHistoryTable({ usageRecords }) {
|
|
|
2645
2645
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rounded-lg border p-8 text-center", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground", children: "No usage history available." }) });
|
|
2646
2646
|
}
|
|
2647
2647
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
2648
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2649
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-clip rounded-lg border", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2650
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2651
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2652
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2653
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2654
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2648
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.SectionHeader, { level: 2, children: "Usage History" }),
|
|
2649
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-clip rounded-lg border", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.Table, { children: [
|
|
2650
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.TableRow, { children: [
|
|
2651
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.TableHead, { children: "Date & Time" }),
|
|
2652
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.TableHead, { children: "Meter Event" }),
|
|
2653
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.TableHead, { className: "text-right", children: "Quantity" }),
|
|
2654
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.TableHead, { children: "Event ID" })
|
|
2655
2655
|
] }) }),
|
|
2656
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2656
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.TableBody, { children: usageRecords.map((record) => {
|
|
2657
2657
|
const dateTime = formatDateTime(record.timestamp);
|
|
2658
2658
|
const quantity = record.quantity.toLocaleString();
|
|
2659
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2660
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2661
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2662
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2663
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2659
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.TableRow, { children: [
|
|
2660
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.TableCell, { className: "font-medium", children: dateTime }),
|
|
2661
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.TableCell, { className: "text-muted-foreground", children: record.meterEventName }),
|
|
2662
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.TableCell, { className: "text-right font-medium", children: quantity }),
|
|
2663
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.TableCell, { className: "text-muted-foreground text-sm tabular-nums", children: record.stripeEventId })
|
|
2664
2664
|
] }, record.id);
|
|
2665
2665
|
}) })
|
|
2666
2666
|
] }) })
|
|
@@ -2671,8 +2671,8 @@ _chunk7QVYU63Ejs.__name.call(void 0, UsageHistoryTable, "UsageHistoryTable");
|
|
|
2671
2671
|
// src/features/billing/components/modals/BillingDetailModal.tsx
|
|
2672
2672
|
|
|
2673
2673
|
function BillingDetailModal({ open, onOpenChange, title, children, className }) {
|
|
2674
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2675
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2674
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.DialogContent, { className: _nullishCoalesce(className, () => ( "max-w-4xl max-h-[90vh] overflow-y-auto")), children: [
|
|
2675
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.DialogHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.DialogTitle, { children: title }) }),
|
|
2676
2676
|
children
|
|
2677
2677
|
] }) });
|
|
2678
2678
|
}
|
|
@@ -2689,7 +2689,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
|
|
|
2689
2689
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-destructive text-sm font-medium", children: "Payment Failed" }),
|
|
2690
2690
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive mt-1 text-sm", children: "Your last payment failed. Please update your payment method to avoid service interruption." })
|
|
2691
2691
|
] }),
|
|
2692
|
-
onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2692
|
+
onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Button, { variant: "outline", size: "sm", onClick: onUpdatePayment, className: "text-destructive border-red-300", children: "Update Payment Method" })
|
|
2693
2693
|
] });
|
|
2694
2694
|
}
|
|
2695
2695
|
if (subscription.status === "trialing" /* TRIALING */ && subscription.trialEnd) {
|
|
@@ -2709,7 +2709,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
|
|
|
2709
2709
|
". Add a payment method to continue your subscription."
|
|
2710
2710
|
] })
|
|
2711
2711
|
] }),
|
|
2712
|
-
onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2712
|
+
onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Button, { variant: "outline", size: "sm", onClick: onAddPayment, className: "text-warning border-yellow-300", children: "Add Payment Method" })
|
|
2713
2713
|
] });
|
|
2714
2714
|
}
|
|
2715
2715
|
}
|
|
@@ -2760,7 +2760,7 @@ function BillingDashboardContainer() {
|
|
|
2760
2760
|
setNoCustomerExists(false);
|
|
2761
2761
|
let customer = null;
|
|
2762
2762
|
try {
|
|
2763
|
-
customer = await
|
|
2763
|
+
customer = await _chunkAWOOIQLFjs.StripeCustomerService.getCustomer();
|
|
2764
2764
|
setData((prev) => ({ ...prev, customer }));
|
|
2765
2765
|
setErrors((prev) => ({ ...prev, customer: null }));
|
|
2766
2766
|
setNoCustomerExists(false);
|
|
@@ -2785,7 +2785,7 @@ function BillingDashboardContainer() {
|
|
|
2785
2785
|
if (customer) {
|
|
2786
2786
|
const fetchSubscriptions = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2787
2787
|
try {
|
|
2788
|
-
const subscriptions2 = await
|
|
2788
|
+
const subscriptions2 = await _chunkAWOOIQLFjs.StripeSubscriptionService.listSubscriptions();
|
|
2789
2789
|
setData((prev) => ({ ...prev, subscriptions: subscriptions2 }));
|
|
2790
2790
|
setErrors((prev) => ({ ...prev, subscriptions: null }));
|
|
2791
2791
|
return subscriptions2;
|
|
@@ -2799,7 +2799,7 @@ function BillingDashboardContainer() {
|
|
|
2799
2799
|
}, "fetchSubscriptions");
|
|
2800
2800
|
const fetchPaymentMethods = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2801
2801
|
try {
|
|
2802
|
-
const paymentMethods = await
|
|
2802
|
+
const paymentMethods = await _chunkAWOOIQLFjs.StripeCustomerService.listPaymentMethods();
|
|
2803
2803
|
setData((prev) => ({ ...prev, paymentMethods }));
|
|
2804
2804
|
setErrors((prev) => ({ ...prev, paymentMethods: null }));
|
|
2805
2805
|
} catch (error) {
|
|
@@ -2811,7 +2811,7 @@ function BillingDashboardContainer() {
|
|
|
2811
2811
|
}, "fetchPaymentMethods");
|
|
2812
2812
|
const fetchInvoices = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2813
2813
|
try {
|
|
2814
|
-
const invoices = await
|
|
2814
|
+
const invoices = await _chunkAWOOIQLFjs.StripeInvoiceService.listInvoices();
|
|
2815
2815
|
setData((prev) => ({ ...prev, invoices }));
|
|
2816
2816
|
setErrors((prev) => ({ ...prev, invoices: null }));
|
|
2817
2817
|
} catch (error) {
|
|
@@ -2835,7 +2835,7 @@ function BillingDashboardContainer() {
|
|
|
2835
2835
|
const handleCreateCustomer = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2836
2836
|
setCreatingCustomer(true);
|
|
2837
2837
|
try {
|
|
2838
|
-
await
|
|
2838
|
+
await _chunkAWOOIQLFjs.StripeCustomerService.createCustomer();
|
|
2839
2839
|
setNoCustomerExists(false);
|
|
2840
2840
|
await fetchAllData();
|
|
2841
2841
|
} catch (error) {
|
|
@@ -2847,7 +2847,7 @@ function BillingDashboardContainer() {
|
|
|
2847
2847
|
}, "handleCreateCustomer");
|
|
2848
2848
|
const fetchUsageData = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2849
2849
|
try {
|
|
2850
|
-
const meters = await
|
|
2850
|
+
const meters = await _chunkAWOOIQLFjs.StripeUsageService.listMeters();
|
|
2851
2851
|
setData((prev) => ({ ...prev, meters }));
|
|
2852
2852
|
const summariesMap = {};
|
|
2853
2853
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -2855,7 +2855,7 @@ function BillingDashboardContainer() {
|
|
|
2855
2855
|
const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
|
|
2856
2856
|
for (const meter of meters) {
|
|
2857
2857
|
try {
|
|
2858
|
-
const meterSummaries = await
|
|
2858
|
+
const meterSummaries = await _chunkAWOOIQLFjs.StripeUsageService.getMeterSummaries({
|
|
2859
2859
|
meterId: meter.id,
|
|
2860
2860
|
startTime: startOfMonth,
|
|
2861
2861
|
endTime: endOfMonth
|
|
@@ -2933,18 +2933,18 @@ function BillingDashboardContainer() {
|
|
|
2933
2933
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-8 w-8" }),
|
|
2934
2934
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: "Billing" })
|
|
2935
2935
|
] }),
|
|
2936
|
-
isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2937
|
-
noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2938
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2936
|
+
isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.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" }) }) }),
|
|
2937
|
+
noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.Card, { children: [
|
|
2938
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.CardHeader, { className: "text-center", children: [
|
|
2939
2939
|
/* @__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" }) }),
|
|
2940
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2941
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2940
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.CardTitle, { children: "Set Up Billing" }),
|
|
2941
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.CardDescription, { children: "Your company doesn't have a billing account yet. Set one up to manage subscriptions, payment methods, and view invoices." })
|
|
2942
2942
|
] }),
|
|
2943
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2943
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.CardContent, { className: "flex justify-center pb-8", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Button, { onClick: handleCreateCustomer, disabled: creatingCustomer, size: "lg", children: creatingCustomer ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2944
2944
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
2945
2945
|
"Setting up..."
|
|
2946
2946
|
] }) : "Set Up Billing Account" }) }),
|
|
2947
|
-
errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2947
|
+
errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.CardContent, { className: "pt-0", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-center text-destructive text-xs/relaxed", children: errors.customer }) })
|
|
2948
2948
|
] }),
|
|
2949
2949
|
!noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2950
2950
|
criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -3086,7 +3086,7 @@ function getStripePromise(publishableKey) {
|
|
|
3086
3086
|
}
|
|
3087
3087
|
_chunk7QVYU63Ejs.__name.call(void 0, getStripePromise, "getStripePromise");
|
|
3088
3088
|
function StripeProvider({ children }) {
|
|
3089
|
-
const publishableKey =
|
|
3089
|
+
const publishableKey = _chunkXN6CXBNOjs.getStripePublishableKey.call(void 0, );
|
|
3090
3090
|
const stripePromise = _react.useMemo.call(void 0, () => getStripePromise(publishableKey), [publishableKey]);
|
|
3091
3091
|
const options = _react.useMemo.call(void 0, () => ({}), []);
|
|
3092
3092
|
if (!publishableKey) {
|
|
@@ -3096,7 +3096,7 @@ function StripeProvider({ children }) {
|
|
|
3096
3096
|
}
|
|
3097
3097
|
_chunk7QVYU63Ejs.__name.call(void 0, StripeProvider, "StripeProvider");
|
|
3098
3098
|
function isStripeConfigured() {
|
|
3099
|
-
return !!
|
|
3099
|
+
return !!_chunkXN6CXBNOjs.getStripePublishableKey.call(void 0, );
|
|
3100
3100
|
}
|
|
3101
3101
|
_chunk7QVYU63Ejs.__name.call(void 0, isStripeConfigured, "isStripeConfigured");
|
|
3102
3102
|
|
|
@@ -3114,7 +3114,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3114
3114
|
_react.useEffect.call(void 0, () => {
|
|
3115
3115
|
const fetchFeatures = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3116
3116
|
try {
|
|
3117
|
-
const features = await
|
|
3117
|
+
const features = await _chunkAWOOIQLFjs.FeatureService.findMany({});
|
|
3118
3118
|
setAllFeatures(features);
|
|
3119
3119
|
} catch (error) {
|
|
3120
3120
|
console.error("[PriceEditor] Failed to fetch features:", error);
|
|
@@ -3192,7 +3192,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3192
3192
|
try {
|
|
3193
3193
|
const unitAmountInCents = Math.round(values.unitAmount * 100);
|
|
3194
3194
|
if (isEditMode) {
|
|
3195
|
-
await
|
|
3195
|
+
await _chunkAWOOIQLFjs.StripePriceService.updatePrice({
|
|
3196
3196
|
id: price.id,
|
|
3197
3197
|
nickname: values.nickname || void 0,
|
|
3198
3198
|
description: values.description || void 0,
|
|
@@ -3234,7 +3234,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3234
3234
|
createInput.featureIds = values.featureIds;
|
|
3235
3235
|
}
|
|
3236
3236
|
}
|
|
3237
|
-
await
|
|
3237
|
+
await _chunkAWOOIQLFjs.StripePriceService.createPrice(createInput);
|
|
3238
3238
|
}
|
|
3239
3239
|
onSuccess();
|
|
3240
3240
|
onOpenChange(false);
|
|
@@ -3260,10 +3260,10 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3260
3260
|
{ id: "licensed", text: "Licensed (per unit)" },
|
|
3261
3261
|
{ id: "metered", text: "Metered (usage-based)" }
|
|
3262
3262
|
];
|
|
3263
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3264
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3265
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3266
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3263
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.DialogContent, { className: "max-w-2xl", children: [
|
|
3264
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.DialogHeader, { children: [
|
|
3265
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.DialogTitle, { children: isEditMode ? "Edit Price" : "Create Price" }),
|
|
3266
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.DialogDescription, { children: isEditMode ? "Update the price details. Note: Only nickname and active status can be changed." : "Create a new price for this product" })
|
|
3267
3267
|
] }),
|
|
3268
3268
|
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: [
|
|
3269
3269
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.AlertCircle, { className: "h-5 w-5 text-blue-600 flex-shrink-0 mt-0.5" }),
|
|
@@ -3272,10 +3272,10 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3272
3272
|
/* @__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." })
|
|
3273
3273
|
] })
|
|
3274
3274
|
] }),
|
|
3275
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3275
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-col gap-y-4", children: [
|
|
3276
3276
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
|
|
3277
3277
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3278
|
-
|
|
3278
|
+
_chunkFYJKTQCUjs.FormInput,
|
|
3279
3279
|
{
|
|
3280
3280
|
form,
|
|
3281
3281
|
id: "unitAmount",
|
|
@@ -3285,10 +3285,10 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3285
3285
|
isRequired: true
|
|
3286
3286
|
}
|
|
3287
3287
|
),
|
|
3288
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3288
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.FormSelect, { form, id: "currency", name: "Currency", values: currencyOptions, disabled: isEditMode })
|
|
3289
3289
|
] }),
|
|
3290
3290
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3291
|
-
|
|
3291
|
+
_chunkFYJKTQCUjs.FormSelect,
|
|
3292
3292
|
{
|
|
3293
3293
|
form,
|
|
3294
3294
|
id: "interval",
|
|
@@ -3299,7 +3299,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3299
3299
|
),
|
|
3300
3300
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
|
|
3301
3301
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3302
|
-
|
|
3302
|
+
_chunkFYJKTQCUjs.FormInput,
|
|
3303
3303
|
{
|
|
3304
3304
|
form,
|
|
3305
3305
|
id: "intervalCount",
|
|
@@ -3310,7 +3310,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3310
3310
|
}
|
|
3311
3311
|
),
|
|
3312
3312
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3313
|
-
|
|
3313
|
+
_chunkFYJKTQCUjs.FormSelect,
|
|
3314
3314
|
{
|
|
3315
3315
|
form,
|
|
3316
3316
|
id: "usageType",
|
|
@@ -3321,7 +3321,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3321
3321
|
)
|
|
3322
3322
|
] }),
|
|
3323
3323
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3324
|
-
|
|
3324
|
+
_chunkFYJKTQCUjs.FormInput,
|
|
3325
3325
|
{
|
|
3326
3326
|
form,
|
|
3327
3327
|
id: "nickname",
|
|
@@ -3330,7 +3330,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3330
3330
|
}
|
|
3331
3331
|
),
|
|
3332
3332
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3333
|
-
|
|
3333
|
+
_chunkFYJKTQCUjs.FormTextarea,
|
|
3334
3334
|
{
|
|
3335
3335
|
form,
|
|
3336
3336
|
id: "description",
|
|
@@ -3339,13 +3339,13 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3339
3339
|
className: "min-h-24"
|
|
3340
3340
|
}
|
|
3341
3341
|
),
|
|
3342
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3342
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.FormInput, { form, id: "token", name: "Token (optional)", placeholder: "Enter token value" }),
|
|
3343
3343
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
3344
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3344
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Label, { children: "Features (optional)" }),
|
|
3345
3345
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
3346
3346
|
form.watch("features").map((_, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
|
|
3347
3347
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3348
|
-
|
|
3348
|
+
_chunkFYJKTQCUjs.Input,
|
|
3349
3349
|
{
|
|
3350
3350
|
...form.register(`features.${index}`),
|
|
3351
3351
|
placeholder: `Feature ${index + 1}`,
|
|
@@ -3353,7 +3353,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3353
3353
|
}
|
|
3354
3354
|
),
|
|
3355
3355
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3356
|
-
|
|
3356
|
+
_chunkFYJKTQCUjs.Button,
|
|
3357
3357
|
{
|
|
3358
3358
|
type: "button",
|
|
3359
3359
|
variant: "outline",
|
|
@@ -3370,7 +3370,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3370
3370
|
)
|
|
3371
3371
|
] }, index)),
|
|
3372
3372
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3373
|
-
|
|
3373
|
+
_chunkFYJKTQCUjs.Button,
|
|
3374
3374
|
{
|
|
3375
3375
|
type: "button",
|
|
3376
3376
|
variant: "outline",
|
|
@@ -3389,7 +3389,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3389
3389
|
] })
|
|
3390
3390
|
] }),
|
|
3391
3391
|
isRecurring && allFeatures.length > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
3392
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3392
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Label, { children: "Platform Features" }),
|
|
3393
3393
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-md p-4 space-y-2 max-h-48 overflow-y-auto", children: allFeatures.map((feature) => {
|
|
3394
3394
|
const isCore = feature.isCore;
|
|
3395
3395
|
const isChecked = form.watch("featureIds").includes(feature.id);
|
|
@@ -3431,9 +3431,9 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3431
3431
|
] }, feature.id);
|
|
3432
3432
|
}) })
|
|
3433
3433
|
] }),
|
|
3434
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3434
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.FormCheckbox, { form, id: "active", name: "Active" }),
|
|
3435
3435
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3436
|
-
|
|
3436
|
+
_chunkFYJKTQCUjs.FormCheckbox,
|
|
3437
3437
|
{
|
|
3438
3438
|
form,
|
|
3439
3439
|
id: "isTrial",
|
|
@@ -3441,7 +3441,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3441
3441
|
description: "Mark this as the trial subscription plan (only one price should be marked as trial)"
|
|
3442
3442
|
}
|
|
3443
3443
|
),
|
|
3444
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3444
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.CommonEditorButtons, { isEdit: isEditMode, form, disabled: isSubmitting, setOpen: onOpenChange })
|
|
3445
3445
|
] }) })
|
|
3446
3446
|
] }) });
|
|
3447
3447
|
}
|
|
@@ -3463,7 +3463,7 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3463
3463
|
const loadPrices = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3464
3464
|
setLoading(true);
|
|
3465
3465
|
try {
|
|
3466
|
-
const fetchedPrices = await
|
|
3466
|
+
const fetchedPrices = await _chunkAWOOIQLFjs.StripePriceService.listPrices({ productId });
|
|
3467
3467
|
setPrices(fetchedPrices);
|
|
3468
3468
|
} catch (error) {
|
|
3469
3469
|
console.error("[PricesList] Failed to load prices:", error);
|
|
@@ -3480,7 +3480,7 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3480
3480
|
}
|
|
3481
3481
|
setArchivingPriceId(priceToArchive.id);
|
|
3482
3482
|
try {
|
|
3483
|
-
await
|
|
3483
|
+
await _chunkAWOOIQLFjs.StripePriceService.archivePrice({ id: priceToArchive.id });
|
|
3484
3484
|
setPriceToArchive(null);
|
|
3485
3485
|
await loadPrices();
|
|
3486
3486
|
onPricesChange();
|
|
@@ -3496,7 +3496,7 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3496
3496
|
}
|
|
3497
3497
|
setReactivatingPriceId(priceToReactivate.id);
|
|
3498
3498
|
try {
|
|
3499
|
-
await
|
|
3499
|
+
await _chunkAWOOIQLFjs.StripePriceService.reactivatePrice({ id: priceToReactivate.id });
|
|
3500
3500
|
setPriceToReactivate(null);
|
|
3501
3501
|
await loadPrices();
|
|
3502
3502
|
onPricesChange();
|
|
@@ -3527,12 +3527,12 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3527
3527
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-4", children: [
|
|
3528
3528
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center justify-between mb-4", children: [
|
|
3529
3529
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "text-lg font-semibold", children: "Prices" }),
|
|
3530
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3530
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Button, { size: "sm", onClick: () => setShowCreatePrice(true), children: "Add Price" })
|
|
3531
3531
|
] }),
|
|
3532
3532
|
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: [
|
|
3533
3533
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.DollarSign, { className: "text-muted-foreground h-12 w-12" }),
|
|
3534
3534
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-sm", children: "No prices yet. Add a price to enable subscriptions." }),
|
|
3535
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3535
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Button, { size: "sm", onClick: () => setShowCreatePrice(true), children: "Add Price" })
|
|
3536
3536
|
] }),
|
|
3537
3537
|
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) => {
|
|
3538
3538
|
const isArchiving = archivingPriceId === price.id;
|
|
@@ -3541,9 +3541,9 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3541
3541
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-start justify-between mb-3", children: [
|
|
3542
3542
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.DollarSign, { className: "h-5 w-5 text-primary" }),
|
|
3543
3543
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-1", children: [
|
|
3544
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3544
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.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" }) }),
|
|
3545
3545
|
price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3546
|
-
|
|
3546
|
+
_chunkFYJKTQCUjs.Button,
|
|
3547
3547
|
{
|
|
3548
3548
|
variant: "ghost",
|
|
3549
3549
|
size: "sm",
|
|
@@ -3553,7 +3553,7 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3553
3553
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Archive, { className: "h-4 w-4" })
|
|
3554
3554
|
}
|
|
3555
3555
|
) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3556
|
-
|
|
3556
|
+
_chunkFYJKTQCUjs.Button,
|
|
3557
3557
|
{
|
|
3558
3558
|
variant: "ghost",
|
|
3559
3559
|
size: "sm",
|
|
@@ -3572,9 +3572,9 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3572
3572
|
] }) }),
|
|
3573
3573
|
_optionalChain([price, 'access', _158 => _158.metadata, 'optionalAccess', _159 => _159.nickname]) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm font-medium mb-2", children: price.metadata.nickname }),
|
|
3574
3574
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2", children: [
|
|
3575
|
-
price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3576
|
-
_optionalChain([price, 'access', _160 => _160.recurring, 'optionalAccess', _161 => _161.usageType]) === "metered" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3577
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3575
|
+
price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Badge, { variant: "softGreen", children: "Active" }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Badge, { variant: "softGray", children: "Inactive" }),
|
|
3576
|
+
_optionalChain([price, 'access', _160 => _160.recurring, 'optionalAccess', _161 => _161.usageType]) === "metered" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Badge, { variant: "softBlue", children: "Metered" }),
|
|
3577
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Badge, { variant: "softGray", className: "uppercase", children: price.currency })
|
|
3578
3578
|
] })
|
|
3579
3579
|
] }, price.id);
|
|
3580
3580
|
}) }),
|
|
@@ -3604,20 +3604,20 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3604
3604
|
}
|
|
3605
3605
|
}
|
|
3606
3606
|
),
|
|
3607
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3608
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3609
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3610
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3607
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.AlertDialog, { open: !!priceToArchive, onOpenChange: (open) => !open && setPriceToArchive(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.AlertDialogContent, { children: [
|
|
3608
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.AlertDialogHeader, { children: [
|
|
3609
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.AlertDialogTitle, { children: "Archive Price" }),
|
|
3610
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.AlertDialogDescription, { children: [
|
|
3611
3611
|
"Are you sure you want to archive the price for",
|
|
3612
3612
|
" ",
|
|
3613
3613
|
priceToArchive && `${formatCurrency(priceToArchive.unitAmount, priceToArchive.currency)} ${formatInterval2(priceToArchive)}`,
|
|
3614
3614
|
"? This will prevent new subscriptions but existing ones will continue."
|
|
3615
3615
|
] })
|
|
3616
3616
|
] }),
|
|
3617
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3618
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3617
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.AlertDialogFooter, { children: [
|
|
3618
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.AlertDialogCancel, { disabled: !!archivingPriceId, children: "Cancel" }),
|
|
3619
3619
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3620
|
-
|
|
3620
|
+
_chunkFYJKTQCUjs.AlertDialogAction,
|
|
3621
3621
|
{
|
|
3622
3622
|
onClick: handleArchive,
|
|
3623
3623
|
disabled: !!archivingPriceId,
|
|
@@ -3627,20 +3627,20 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3627
3627
|
)
|
|
3628
3628
|
] })
|
|
3629
3629
|
] }) }),
|
|
3630
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3631
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3632
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3633
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3630
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.AlertDialog, { open: !!priceToReactivate, onOpenChange: (open) => !open && setPriceToReactivate(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.AlertDialogContent, { children: [
|
|
3631
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.AlertDialogHeader, { children: [
|
|
3632
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.AlertDialogTitle, { children: "Reactivate Price" }),
|
|
3633
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.AlertDialogDescription, { children: [
|
|
3634
3634
|
"Are you sure you want to reactivate the price for",
|
|
3635
3635
|
" ",
|
|
3636
3636
|
priceToReactivate && `${formatCurrency(priceToReactivate.unitAmount, priceToReactivate.currency)} ${formatInterval2(priceToReactivate)}`,
|
|
3637
3637
|
"? This will allow new subscriptions again."
|
|
3638
3638
|
] })
|
|
3639
3639
|
] }),
|
|
3640
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3641
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3640
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.AlertDialogFooter, { children: [
|
|
3641
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.AlertDialogCancel, { disabled: !!reactivatingPriceId, children: "Cancel" }),
|
|
3642
3642
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3643
|
-
|
|
3643
|
+
_chunkFYJKTQCUjs.AlertDialogAction,
|
|
3644
3644
|
{
|
|
3645
3645
|
onClick: handleReactivate,
|
|
3646
3646
|
disabled: !!reactivatingPriceId,
|
|
@@ -3684,14 +3684,14 @@ function ProductEditor({ product, open, onOpenChange, onSuccess }) {
|
|
|
3684
3684
|
setIsSubmitting(true);
|
|
3685
3685
|
try {
|
|
3686
3686
|
if (product) {
|
|
3687
|
-
await
|
|
3687
|
+
await _chunkAWOOIQLFjs.StripeProductService.updateProduct({
|
|
3688
3688
|
id: product.id,
|
|
3689
3689
|
name: values.name,
|
|
3690
3690
|
description: values.description,
|
|
3691
3691
|
active: values.active
|
|
3692
3692
|
});
|
|
3693
3693
|
} else {
|
|
3694
|
-
await
|
|
3694
|
+
await _chunkAWOOIQLFjs.StripeProductService.createProduct({
|
|
3695
3695
|
id: _uuid.v4.call(void 0, ),
|
|
3696
3696
|
name: values.name,
|
|
3697
3697
|
description: values.description,
|
|
@@ -3706,15 +3706,15 @@ function ProductEditor({ product, open, onOpenChange, onSuccess }) {
|
|
|
3706
3706
|
setIsSubmitting(false);
|
|
3707
3707
|
}
|
|
3708
3708
|
}, "onSubmit");
|
|
3709
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3710
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3711
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3712
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3709
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.DialogContent, { className: "max-w-2xl", children: [
|
|
3710
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.DialogHeader, { children: [
|
|
3711
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.DialogTitle, { children: product ? "Edit Product" : "Create Product" }),
|
|
3712
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.DialogDescription, { children: product ? `Update the details for ${product.name}` : "Create a new product to offer to your customers" })
|
|
3713
3713
|
] }),
|
|
3714
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3715
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3714
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-col gap-y-4", children: [
|
|
3715
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.FormInput, { form, id: "name", name: "Product Name", placeholder: "Enter product name", isRequired: true }),
|
|
3716
3716
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3717
|
-
|
|
3717
|
+
_chunkFYJKTQCUjs.FormTextarea,
|
|
3718
3718
|
{
|
|
3719
3719
|
form,
|
|
3720
3720
|
id: "description",
|
|
@@ -3723,8 +3723,8 @@ function ProductEditor({ product, open, onOpenChange, onSuccess }) {
|
|
|
3723
3723
|
className: "min-h-32"
|
|
3724
3724
|
}
|
|
3725
3725
|
),
|
|
3726
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3727
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3726
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.FormCheckbox, { form, id: "active", name: "Active" }),
|
|
3727
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.CommonEditorButtons, { isEdit: !!product, form, disabled: isSubmitting, setOpen: onOpenChange })
|
|
3728
3728
|
] }) })
|
|
3729
3729
|
] }) });
|
|
3730
3730
|
}
|
|
@@ -3747,7 +3747,7 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3747
3747
|
}
|
|
3748
3748
|
setArchivingProductId(productToArchive.id);
|
|
3749
3749
|
try {
|
|
3750
|
-
const _archivedProduct = await
|
|
3750
|
+
const _archivedProduct = await _chunkAWOOIQLFjs.StripeProductService.archiveProduct({ id: productToArchive.id });
|
|
3751
3751
|
setProductToArchive(null);
|
|
3752
3752
|
onProductsChange();
|
|
3753
3753
|
} catch (_error) {
|
|
@@ -3762,7 +3762,7 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3762
3762
|
}
|
|
3763
3763
|
setReactivatingProductId(productToReactivate.id);
|
|
3764
3764
|
try {
|
|
3765
|
-
const _reactivatedProduct = await
|
|
3765
|
+
const _reactivatedProduct = await _chunkAWOOIQLFjs.StripeProductService.reactivateProduct({ id: productToReactivate.id });
|
|
3766
3766
|
setProductToReactivate(null);
|
|
3767
3767
|
onProductsChange();
|
|
3768
3768
|
} catch (_error) {
|
|
@@ -3785,18 +3785,18 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3785
3785
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex-1", children: [
|
|
3786
3786
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
3787
3787
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium", children: product.name }),
|
|
3788
|
-
product.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3788
|
+
product.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Badge, { variant: "softGreen", children: "Active" }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Badge, { variant: "softGray", children: "Inactive" })
|
|
3789
3789
|
] }),
|
|
3790
3790
|
product.description && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-sm mt-1", children: product.description })
|
|
3791
3791
|
] })
|
|
3792
3792
|
] }),
|
|
3793
3793
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
3794
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3794
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.Button, { variant: "outline", size: "sm", onClick: () => setEditingProduct(product), children: [
|
|
3795
3795
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Edit, { className: "h-4 w-4 mr-1" }),
|
|
3796
3796
|
"Edit"
|
|
3797
3797
|
] }),
|
|
3798
3798
|
product.active ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3799
|
-
|
|
3799
|
+
_chunkFYJKTQCUjs.Button,
|
|
3800
3800
|
{
|
|
3801
3801
|
variant: "outline",
|
|
3802
3802
|
size: "sm",
|
|
@@ -3808,7 +3808,7 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3808
3808
|
]
|
|
3809
3809
|
}
|
|
3810
3810
|
) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3811
|
-
|
|
3811
|
+
_chunkFYJKTQCUjs.Button,
|
|
3812
3812
|
{
|
|
3813
3813
|
variant: "outline",
|
|
3814
3814
|
size: "sm",
|
|
@@ -3820,7 +3820,7 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3820
3820
|
]
|
|
3821
3821
|
}
|
|
3822
3822
|
),
|
|
3823
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3823
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.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" }) })
|
|
3824
3824
|
] })
|
|
3825
3825
|
] }),
|
|
3826
3826
|
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 }) })
|
|
@@ -3838,19 +3838,19 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3838
3838
|
}
|
|
3839
3839
|
}
|
|
3840
3840
|
),
|
|
3841
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3842
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3843
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3844
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3841
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.AlertDialog, { open: !!productToArchive, onOpenChange: (open) => !open && setProductToArchive(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.AlertDialogContent, { children: [
|
|
3842
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.AlertDialogHeader, { children: [
|
|
3843
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.AlertDialogTitle, { children: "Archive Product" }),
|
|
3844
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.AlertDialogDescription, { children: [
|
|
3845
3845
|
'Are you sure you want to archive "',
|
|
3846
3846
|
_optionalChain([productToArchive, 'optionalAccess', _165 => _165.name]),
|
|
3847
3847
|
'"? This will deactivate it and it will no longer be available for new subscriptions.'
|
|
3848
3848
|
] })
|
|
3849
3849
|
] }),
|
|
3850
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3851
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3850
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.AlertDialogFooter, { children: [
|
|
3851
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.AlertDialogCancel, { disabled: !!archivingProductId, children: "Cancel" }),
|
|
3852
3852
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3853
|
-
|
|
3853
|
+
_chunkFYJKTQCUjs.AlertDialogAction,
|
|
3854
3854
|
{
|
|
3855
3855
|
onClick: handleArchive,
|
|
3856
3856
|
disabled: !!archivingProductId,
|
|
@@ -3860,19 +3860,19 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3860
3860
|
)
|
|
3861
3861
|
] })
|
|
3862
3862
|
] }) }),
|
|
3863
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3864
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3865
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3866
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3863
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.AlertDialog, { open: !!productToReactivate, onOpenChange: (open) => !open && setProductToReactivate(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.AlertDialogContent, { children: [
|
|
3864
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.AlertDialogHeader, { children: [
|
|
3865
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.AlertDialogTitle, { children: "Reactivate Product" }),
|
|
3866
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.AlertDialogDescription, { children: [
|
|
3867
3867
|
'Are you sure you want to reactivate "',
|
|
3868
3868
|
_optionalChain([productToReactivate, 'optionalAccess', _166 => _166.name]),
|
|
3869
3869
|
'"? This will make it available for new subscriptions again.'
|
|
3870
3870
|
] })
|
|
3871
3871
|
] }),
|
|
3872
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3873
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3872
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkFYJKTQCUjs.AlertDialogFooter, { children: [
|
|
3873
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.AlertDialogCancel, { disabled: !!reactivatingProductId, children: "Cancel" }),
|
|
3874
3874
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3875
|
-
|
|
3875
|
+
_chunkFYJKTQCUjs.AlertDialogAction,
|
|
3876
3876
|
{
|
|
3877
3877
|
onClick: handleReactivate,
|
|
3878
3878
|
disabled: !!reactivatingProductId,
|
|
@@ -3889,17 +3889,17 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductsList, "ProductsList");
|
|
|
3889
3889
|
// src/features/billing/stripe-product/components/containers/ProductsAdminContainer.tsx
|
|
3890
3890
|
|
|
3891
3891
|
function ProductsAdminContainer() {
|
|
3892
|
-
const { hasRole } =
|
|
3892
|
+
const { hasRole } = _chunkFYJKTQCUjs.useCurrentUserContext.call(void 0, );
|
|
3893
3893
|
const [products, setProducts] = _react.useState.call(void 0, []);
|
|
3894
3894
|
const [loading, setLoading] = _react.useState.call(void 0, true);
|
|
3895
3895
|
const [showCreateProduct, setShowCreateProduct] = _react.useState.call(void 0, false);
|
|
3896
|
-
if (!hasRole(
|
|
3896
|
+
if (!hasRole(_chunkXN6CXBNOjs.getRoleId.call(void 0, ).Administrator)) {
|
|
3897
3897
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex h-64 items-center justify-center", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: "Permission denied. Administrator access required." }) });
|
|
3898
3898
|
}
|
|
3899
3899
|
const loadProducts = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3900
3900
|
setLoading(true);
|
|
3901
3901
|
try {
|
|
3902
|
-
const fetchedProducts = await
|
|
3902
|
+
const fetchedProducts = await _chunkAWOOIQLFjs.StripeProductService.listProducts();
|
|
3903
3903
|
setProducts(fetchedProducts);
|
|
3904
3904
|
} catch (error) {
|
|
3905
3905
|
console.error("[ProductsAdminContainer] Failed to load products:", error);
|
|
@@ -3919,14 +3919,14 @@ function ProductsAdminContainer() {
|
|
|
3919
3919
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Package, { className: "h-8 w-8" }),
|
|
3920
3920
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: "Product & Price Management" })
|
|
3921
3921
|
] }),
|
|
3922
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3922
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Button, { onClick: () => setShowCreateProduct(true), children: "Create Product" })
|
|
3923
3923
|
] }),
|
|
3924
3924
|
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: [
|
|
3925
3925
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Package, { className: "text-muted-foreground h-16 w-16" }),
|
|
3926
3926
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
3927
3927
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "mb-2 text-sm font-medium", children: "No products yet" }),
|
|
3928
3928
|
/* @__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." }),
|
|
3929
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3929
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFYJKTQCUjs.Button, { onClick: () => setShowCreateProduct(true), children: "Create Your First Product" })
|
|
3930
3930
|
] })
|
|
3931
3931
|
] }),
|
|
3932
3932
|
products.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductsList, { products, onProductsChange: loadProducts }),
|