@carlonicora/nextjs-jsonapi 1.35.0 → 1.36.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-O2GEMLA5.mjs → BlockNoteEditor-KFUTQVUK.mjs} +3 -3
- package/dist/{BlockNoteEditor-3NFHRHR5.js → BlockNoteEditor-N3J42SBY.js} +13 -13
- package/dist/{BlockNoteEditor-3NFHRHR5.js.map → BlockNoteEditor-N3J42SBY.js.map} +1 -1
- package/dist/billing/index.js +333 -333
- package/dist/billing/index.mjs +2 -2
- package/dist/{chunk-NJXGCB7Q.mjs → chunk-DLJTN632.mjs} +134 -62
- package/dist/chunk-DLJTN632.mjs.map +1 -0
- package/dist/{chunk-IZKIM7U5.js → chunk-NNCTRU4O.js} +21 -1
- package/dist/chunk-NNCTRU4O.js.map +1 -0
- package/dist/{chunk-T4UAULVP.js → chunk-S2RZBQP4.js} +723 -651
- package/dist/chunk-S2RZBQP4.js.map +1 -0
- package/dist/{chunk-FJUMCH77.mjs → chunk-YZV24UWN.mjs} +21 -1
- package/dist/{chunk-FJUMCH77.mjs.map → chunk-YZV24UWN.mjs.map} +1 -1
- package/dist/client/index.js +3 -3
- package/dist/client/index.mjs +2 -2
- package/dist/components/index.js +3 -3
- package/dist/components/index.mjs +2 -2
- package/dist/contexts/index.d.mts +3 -1
- package/dist/contexts/index.d.ts +3 -1
- package/dist/contexts/index.js +3 -3
- package/dist/contexts/index.mjs +2 -2
- package/dist/core/index.d.mts +2 -2
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.js +2 -2
- package/dist/core/index.mjs +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/index.mjs +1 -1
- package/dist/{s3.service-DcqkGrKD.d.ts → s3.service-DXkDoMf1.d.ts} +3 -0
- package/dist/{s3.service-ag6M_7GO.d.mts → s3.service-hnTPVTm2.d.mts} +3 -0
- 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/package.json +1 -1
- package/src/features/company/components/forms/CompanyDeleter.tsx +157 -70
- package/src/features/company/contexts/CompanyContext.tsx +1 -1
- package/src/features/company/data/company.service.ts +23 -0
- package/src/features/user/contexts/CurrentUserContext.tsx +19 -13
- package/dist/chunk-IZKIM7U5.js.map +0 -1
- package/dist/chunk-NJXGCB7Q.mjs.map +0 -1
- package/dist/chunk-T4UAULVP.js.map +0 -1
- /package/dist/{BlockNoteEditor-O2GEMLA5.mjs.map → BlockNoteEditor-KFUTQVUK.mjs.map} +0 -0
package/dist/billing/index.js
CHANGED
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
|
|
50
|
-
var
|
|
50
|
+
var _chunkS2RZBQP4js = require('../chunk-S2RZBQP4.js');
|
|
51
51
|
|
|
52
52
|
|
|
53
53
|
|
|
@@ -61,7 +61,7 @@ var _chunk2PHWAL6Qjs = require('../chunk-2PHWAL6Q.js');
|
|
|
61
61
|
|
|
62
62
|
|
|
63
63
|
|
|
64
|
-
var
|
|
64
|
+
var _chunkNNCTRU4Ojs = require('../chunk-NNCTRU4O.js');
|
|
65
65
|
require('../chunk-LXKSUWAV.js');
|
|
66
66
|
require('../chunk-IBS6NI7D.js');
|
|
67
67
|
require('../chunk-FM6WRAN5.js');
|
|
@@ -121,41 +121,41 @@ function SubscriptionSummaryCard({
|
|
|
121
121
|
onManageClick
|
|
122
122
|
}) {
|
|
123
123
|
if (loading) {
|
|
124
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
125
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
126
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
124
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.Card, { children: [
|
|
125
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
126
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.CardTitle, { className: "text-sm font-medium", children: "Subscriptions" }),
|
|
127
127
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
128
128
|
] }),
|
|
129
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
130
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
131
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
132
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
129
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.CardContent, { children: [
|
|
130
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
131
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Skeleton, { className: "h-4 w-24 mb-1" }),
|
|
132
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Skeleton, { className: "h-4 w-40" })
|
|
133
133
|
] })
|
|
134
134
|
] });
|
|
135
135
|
}
|
|
136
136
|
if (error) {
|
|
137
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
138
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
139
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
137
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.Card, { children: [
|
|
138
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
139
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.CardTitle, { className: "text-sm font-medium", children: "Subscriptions" }),
|
|
140
140
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
141
141
|
] }),
|
|
142
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
142
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-destructive", children: error }) })
|
|
143
143
|
] });
|
|
144
144
|
}
|
|
145
145
|
const activeSubscriptions = subscriptions.filter(
|
|
146
146
|
(sub) => sub.status === "active" /* ACTIVE */ || sub.status === "trialing" /* TRIALING */
|
|
147
147
|
);
|
|
148
148
|
const primarySubscription = activeSubscriptions[0];
|
|
149
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
150
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
151
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
149
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
|
|
150
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
151
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.CardTitle, { className: "text-sm font-medium", children: "Subscriptions" }),
|
|
152
152
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
153
153
|
] }),
|
|
154
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
154
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.CardContent, { children: subscriptions.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
155
155
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No active plan" }),
|
|
156
156
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Subscribe to get started" }),
|
|
157
157
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
158
|
-
|
|
158
|
+
_chunkS2RZBQP4js.Button,
|
|
159
159
|
{
|
|
160
160
|
variant: "outline",
|
|
161
161
|
size: "sm",
|
|
@@ -173,7 +173,7 @@ function SubscriptionSummaryCard({
|
|
|
173
173
|
] }) : primarySubscription ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
174
174
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
175
175
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: formatPlanName(primarySubscription) }),
|
|
176
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
176
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Badge, { variant: primarySubscription.cancelAtPeriodEnd ? "secondary" : getStatusBadgeVariant(primarySubscription.status), children: primarySubscription.cancelAtPeriodEnd ? "Canceling" : primarySubscription.status })
|
|
177
177
|
] }),
|
|
178
178
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm text-muted-foreground", children: [
|
|
179
179
|
formatPrice(_optionalChain([primarySubscription, 'access', _10 => _10.price, 'optionalAccess', _11 => _11.unitAmount]), _optionalChain([primarySubscription, 'access', _12 => _12.price, 'optionalAccess', _13 => _13.currency])),
|
|
@@ -217,36 +217,36 @@ function PaymentMethodSummaryCard({
|
|
|
217
217
|
onManageClick
|
|
218
218
|
}) {
|
|
219
219
|
if (loading) {
|
|
220
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
221
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
222
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
220
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.Card, { children: [
|
|
221
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
222
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.CardTitle, { className: "text-sm font-medium", children: "Payment Method" }),
|
|
223
223
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
224
224
|
] }),
|
|
225
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
226
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
227
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
225
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.CardContent, { children: [
|
|
226
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
227
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Skeleton, { className: "h-4 w-24" })
|
|
228
228
|
] })
|
|
229
229
|
] });
|
|
230
230
|
}
|
|
231
231
|
if (error) {
|
|
232
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
233
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
234
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
232
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.Card, { children: [
|
|
233
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
234
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.CardTitle, { className: "text-sm font-medium", children: "Payment Method" }),
|
|
235
235
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
236
236
|
] }),
|
|
237
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
237
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-destructive", children: error }) })
|
|
238
238
|
] });
|
|
239
239
|
}
|
|
240
240
|
const defaultMethod = paymentMethods.find((pm) => pm.id === defaultPaymentMethodId) || paymentMethods[0];
|
|
241
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
242
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
243
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
241
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
|
|
242
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
243
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.CardTitle, { className: "text-sm font-medium", children: "Payment Method" }),
|
|
244
244
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
245
245
|
] }),
|
|
246
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
246
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.CardContent, { children: paymentMethods.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
247
247
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No payment method" }),
|
|
248
248
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Add a card to enable subscriptions" }),
|
|
249
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
249
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.Button, { variant: "outline", size: "sm", className: "mt-2", onClick: (e) => {
|
|
250
250
|
e.stopPropagation();
|
|
251
251
|
onManageClick();
|
|
252
252
|
}, children: [
|
|
@@ -302,7 +302,7 @@ function CustomerInfoCard({ customer, loading, error }) {
|
|
|
302
302
|
e.stopPropagation();
|
|
303
303
|
setPortalLoading(true);
|
|
304
304
|
try {
|
|
305
|
-
const { url } = await
|
|
305
|
+
const { url } = await _chunkNNCTRU4Ojs.StripeCustomerService.createPortalSession();
|
|
306
306
|
window.open(url, "_blank");
|
|
307
307
|
} catch (err) {
|
|
308
308
|
console.error("[CustomerInfoCard] Failed to create portal session:", err);
|
|
@@ -311,52 +311,52 @@ function CustomerInfoCard({ customer, loading, error }) {
|
|
|
311
311
|
}
|
|
312
312
|
}, "handlePortalClick");
|
|
313
313
|
if (loading) {
|
|
314
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
315
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
316
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
314
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.Card, { children: [
|
|
315
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
316
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.CardTitle, { className: "text-sm font-medium", children: "Billing Account" }),
|
|
317
317
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
318
318
|
] }),
|
|
319
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
320
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
321
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
322
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
319
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.CardContent, { children: [
|
|
320
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
321
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Skeleton, { className: "h-4 w-48 mb-1" }),
|
|
322
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Skeleton, { className: "h-4 w-24" })
|
|
323
323
|
] })
|
|
324
324
|
] });
|
|
325
325
|
}
|
|
326
326
|
if (error) {
|
|
327
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
328
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
329
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
327
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.Card, { children: [
|
|
328
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
329
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.CardTitle, { className: "text-sm font-medium", children: "Billing Account" }),
|
|
330
330
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
331
331
|
] }),
|
|
332
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
332
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-destructive", children: error }) })
|
|
333
333
|
] });
|
|
334
334
|
}
|
|
335
335
|
if (!customer) {
|
|
336
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
337
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
338
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
336
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.Card, { children: [
|
|
337
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
338
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.CardTitle, { className: "text-sm font-medium", children: "Billing Account" }),
|
|
339
339
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
340
340
|
] }),
|
|
341
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
341
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.CardContent, { children: [
|
|
342
342
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "Not set up" }),
|
|
343
343
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Billing account will be created when you subscribe" })
|
|
344
344
|
] })
|
|
345
345
|
] });
|
|
346
346
|
}
|
|
347
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
348
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
349
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
347
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.Card, { children: [
|
|
348
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
349
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.CardTitle, { className: "text-sm font-medium", children: "Billing Account" }),
|
|
350
350
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
351
351
|
] }),
|
|
352
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
352
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
353
353
|
customer.name && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: customer.name }),
|
|
354
354
|
customer.email && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: customer.email }),
|
|
355
355
|
customer.balance !== void 0 && customer.balance !== 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm", children: [
|
|
356
356
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground", children: "Credit Balance: " }),
|
|
357
357
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: customer.balance < 0 ? "text-green-600" : "text-destructive", children: formatBalance(customer.balance, customer.currency) })
|
|
358
358
|
] }),
|
|
359
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
359
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.Button, { variant: "outline", size: "sm", className: "mt-2", onClick: handlePortalClick, disabled: portalLoading, children: [
|
|
360
360
|
portalLoading ? "Loading..." : "Manage in Stripe Portal",
|
|
361
361
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ExternalLink, { className: "h-4 w-4 ml-1" })
|
|
362
362
|
] })
|
|
@@ -400,42 +400,42 @@ function formatAmount(amount, currency) {
|
|
|
400
400
|
_chunk7QVYU63Ejs.__name.call(void 0, formatAmount, "formatAmount");
|
|
401
401
|
function InvoicesSummaryCard({ invoices, loading, error, onViewAllClick }) {
|
|
402
402
|
if (loading) {
|
|
403
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
404
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
405
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
403
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.Card, { children: [
|
|
404
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
405
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.CardTitle, { className: "text-sm font-medium", children: "Recent Invoices" }),
|
|
406
406
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
407
407
|
] }),
|
|
408
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
409
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
410
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
411
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
408
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.CardContent, { children: [
|
|
409
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Skeleton, { className: "h-6 w-24 mb-2" }),
|
|
410
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Skeleton, { className: "h-4 w-32 mb-1" }),
|
|
411
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Skeleton, { className: "h-4 w-20" })
|
|
412
412
|
] })
|
|
413
413
|
] });
|
|
414
414
|
}
|
|
415
415
|
if (error) {
|
|
416
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
417
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
418
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
416
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.Card, { children: [
|
|
417
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
418
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.CardTitle, { className: "text-sm font-medium", children: "Recent Invoices" }),
|
|
419
419
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
420
420
|
] }),
|
|
421
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
421
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-destructive", children: error }) })
|
|
422
422
|
] });
|
|
423
423
|
}
|
|
424
424
|
const latestInvoice = invoices[0];
|
|
425
425
|
const paidInvoices = invoices.filter((inv) => inv.status === "paid" /* PAID */);
|
|
426
426
|
const openInvoices = invoices.filter((inv) => inv.status === "open" /* OPEN */);
|
|
427
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
428
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
429
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
427
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewAllClick, children: [
|
|
428
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
429
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.CardTitle, { className: "text-sm font-medium", children: "Recent Invoices" }),
|
|
430
430
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
431
431
|
] }),
|
|
432
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
432
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.CardContent, { children: invoices.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
433
433
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No invoices yet" }),
|
|
434
434
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Invoices will appear after your first billing cycle" })
|
|
435
435
|
] }) : latestInvoice ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
436
436
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
437
437
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: formatAmount(latestInvoice.total, latestInvoice.currency) }),
|
|
438
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
438
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Badge, { variant: getStatusBadgeVariant2(latestInvoice.status), children: latestInvoice.status })
|
|
439
439
|
] }),
|
|
440
440
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: latestInvoice.stripeInvoiceNumber || `Invoice from ${formatDate2(latestInvoice.periodStart)}` }),
|
|
441
441
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-4 text-xs text-muted-foreground", children: [
|
|
@@ -475,24 +475,24 @@ function BillingUsageSummaryCard({
|
|
|
475
475
|
onViewDetailsClick
|
|
476
476
|
}) {
|
|
477
477
|
if (loading) {
|
|
478
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
479
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
480
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
478
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.Card, { children: [
|
|
479
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
480
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.CardTitle, { className: "text-sm font-medium", children: "Usage This Month" }),
|
|
481
481
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
482
482
|
] }),
|
|
483
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
484
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
485
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
483
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.CardContent, { children: [
|
|
484
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Skeleton, { className: "h-6 w-24 mb-2" }),
|
|
485
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Skeleton, { className: "h-4 w-32" })
|
|
486
486
|
] })
|
|
487
487
|
] });
|
|
488
488
|
}
|
|
489
489
|
if (error) {
|
|
490
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
491
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
492
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
490
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.Card, { children: [
|
|
491
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
492
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.CardTitle, { className: "text-sm font-medium", children: "Usage This Month" }),
|
|
493
493
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
494
494
|
] }),
|
|
495
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
495
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-destructive", children: error }) })
|
|
496
496
|
] });
|
|
497
497
|
}
|
|
498
498
|
const totalUsage = Object.values(summaries).reduce((acc, summary) => {
|
|
@@ -500,12 +500,12 @@ function BillingUsageSummaryCard({
|
|
|
500
500
|
}, 0);
|
|
501
501
|
const primaryMeter = meters.find((m) => _optionalChain([summaries, 'access', _23 => _23[m.id], 'optionalAccess', _24 => _24.aggregatedValue]));
|
|
502
502
|
const primarySummary = primaryMeter ? summaries[primaryMeter.id] : null;
|
|
503
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
504
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
505
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
503
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewDetailsClick, children: [
|
|
504
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
505
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.CardTitle, { className: "text-sm font-medium", children: "Usage This Month" }),
|
|
506
506
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
507
507
|
] }),
|
|
508
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
508
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.CardContent, { children: meters.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
509
509
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No meters" }),
|
|
510
510
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "No usage meters are configured" })
|
|
511
511
|
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
@@ -557,7 +557,7 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
|
|
|
557
557
|
const fetchSetupIntent = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
558
558
|
setLoading(true);
|
|
559
559
|
try {
|
|
560
|
-
const intent = await
|
|
560
|
+
const intent = await _chunkNNCTRU4Ojs.StripeCustomerService.createSetupIntent();
|
|
561
561
|
setSetupIntent(intent);
|
|
562
562
|
} catch (err) {
|
|
563
563
|
console.error("[PaymentMethodForm] Failed to create setup intent:", err);
|
|
@@ -595,7 +595,7 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
|
|
|
595
595
|
return;
|
|
596
596
|
}
|
|
597
597
|
if (setAsDefault && _optionalChain([confirmedSetupIntent, 'optionalAccess', _25 => _25.payment_method])) {
|
|
598
|
-
await
|
|
598
|
+
await _chunkNNCTRU4Ojs.StripeCustomerService.setDefaultPaymentMethod({
|
|
599
599
|
paymentMethodId: typeof confirmedSetupIntent.payment_method === "string" ? confirmedSetupIntent.payment_method : confirmedSetupIntent.payment_method.id
|
|
600
600
|
});
|
|
601
601
|
}
|
|
@@ -611,7 +611,7 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
|
|
|
611
611
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex items-center justify-center py-8", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground", children: "Loading payment form..." }) });
|
|
612
612
|
}
|
|
613
613
|
if (!setupIntent && error) {
|
|
614
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
614
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.AlertDescription, { children: error }) });
|
|
615
615
|
}
|
|
616
616
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: handleSubmit, className: "flex flex-col gap-y-4", children: [
|
|
617
617
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rounded-md border border-gray-300 p-3", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -635,19 +635,19 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
|
|
|
635
635
|
) }),
|
|
636
636
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
637
637
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
638
|
-
|
|
638
|
+
_chunkS2RZBQP4js.Checkbox,
|
|
639
639
|
{
|
|
640
640
|
id: "setAsDefault",
|
|
641
641
|
checked: setAsDefault,
|
|
642
642
|
onCheckedChange: (checked) => setSetAsDefault(!!checked)
|
|
643
643
|
}
|
|
644
644
|
),
|
|
645
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
645
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Label, { htmlFor: "setAsDefault", className: "text-sm font-normal", children: "Set as default payment method" })
|
|
646
646
|
] }),
|
|
647
|
-
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
647
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.AlertDescription, { children: error }) }),
|
|
648
648
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-x-2", children: [
|
|
649
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
650
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
649
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Button, { type: "button", variant: "outline", onClick: onCancel, disabled: isSubmitting || isLoading, children: "Cancel" }),
|
|
650
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Button, { type: "submit", disabled: !stripe || isSubmitting || isLoading, children: isSubmitting ? "Processing..." : "Add Card" })
|
|
651
651
|
] })
|
|
652
652
|
] });
|
|
653
653
|
}
|
|
@@ -663,10 +663,10 @@ function PaymentMethodEditor({ open, onOpenChange, onSuccess }) {
|
|
|
663
663
|
const handleCancel = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
664
664
|
onOpenChange(false);
|
|
665
665
|
}, "handleCancel");
|
|
666
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
667
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
668
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
669
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
666
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.DialogContent, { className: "max-w-md", children: [
|
|
667
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.DialogHeader, { children: [
|
|
668
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.DialogTitle, { children: "Add Payment Method" }),
|
|
669
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.DialogDescription, { children: "Add a new payment method to your account. Your card information is securely processed by Stripe." })
|
|
670
670
|
] }),
|
|
671
671
|
open && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
672
672
|
PaymentMethodForm,
|
|
@@ -696,7 +696,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
696
696
|
_react.useEffect.call(void 0, () => {
|
|
697
697
|
const loadCustomer = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
698
698
|
try {
|
|
699
|
-
const fetchedCustomer = await
|
|
699
|
+
const fetchedCustomer = await _chunkNNCTRU4Ojs.StripeCustomerService.getCustomer();
|
|
700
700
|
setCustomer(fetchedCustomer);
|
|
701
701
|
} catch (error) {
|
|
702
702
|
console.error("[PaymentMethodCard] Failed to load customer:", error);
|
|
@@ -713,7 +713,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
713
713
|
const handleSetDefault = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
714
714
|
setLoading(true);
|
|
715
715
|
try {
|
|
716
|
-
await
|
|
716
|
+
await _chunkNNCTRU4Ojs.StripeCustomerService.setDefaultPaymentMethod({ paymentMethodId: paymentMethod.id });
|
|
717
717
|
onUpdate();
|
|
718
718
|
} catch (error) {
|
|
719
719
|
console.error("[PaymentMethodCard] Failed to set as default:", error);
|
|
@@ -724,7 +724,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
724
724
|
const handleRemove = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
725
725
|
setLoading(true);
|
|
726
726
|
try {
|
|
727
|
-
await
|
|
727
|
+
await _chunkNNCTRU4Ojs.StripeCustomerService.removePaymentMethod({ paymentMethodId: paymentMethod.id });
|
|
728
728
|
setShowRemoveDialog(false);
|
|
729
729
|
onUpdate();
|
|
730
730
|
} catch (error) {
|
|
@@ -733,22 +733,22 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
733
733
|
}
|
|
734
734
|
}, "handleRemove");
|
|
735
735
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
736
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
737
|
-
isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
738
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
736
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.Card, { className: "relative", children: [
|
|
737
|
+
isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Badge, { className: "absolute right-2 top-2 bg-green-100 text-green-800 hover:bg-green-100", children: "Default" }),
|
|
738
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.CardHeader, { className: "flex flex-row items-center justify-between pb-2", children: [
|
|
739
739
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
740
740
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-2xl", children: brandIcon }),
|
|
741
741
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium capitalize", children: brand })
|
|
742
742
|
] }),
|
|
743
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
744
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
745
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
746
|
-
!isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
747
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
743
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.DropdownMenu, { children: [
|
|
744
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.DropdownMenuTrigger, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Button, { render: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {}), nativeButton: false, variant: "ghost", size: "sm", disabled: loading, className: "h-8 w-8 p-0", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.MoreVertical, { className: "h-4 w-4" }) }) }),
|
|
745
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.DropdownMenuContent, { align: "end", children: [
|
|
746
|
+
!isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.DropdownMenuItem, { onClick: handleSetDefault, disabled: loading, children: "Set as Default" }),
|
|
747
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.DropdownMenuItem, { onClick: () => setShowRemoveDialog(true), disabled: loading, className: "text-red-600", children: "Remove" })
|
|
748
748
|
] })
|
|
749
749
|
] })
|
|
750
750
|
] }),
|
|
751
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
751
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-1", children: [
|
|
752
752
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-lg font-semibold", children: [
|
|
753
753
|
"\u2022\u2022\u2022\u2022 ",
|
|
754
754
|
last4
|
|
@@ -761,17 +761,17 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
761
761
|
] })
|
|
762
762
|
] }) })
|
|
763
763
|
] }),
|
|
764
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
765
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
766
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
767
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
764
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.AlertDialog, { open: showRemoveDialog, onOpenChange: setShowRemoveDialog, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.AlertDialogContent, { children: [
|
|
765
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.AlertDialogHeader, { children: [
|
|
766
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.AlertDialogTitle, { children: "Remove Payment Method" }),
|
|
767
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.AlertDialogDescription, { children: [
|
|
768
768
|
"Are you sure you want to remove this payment method? This action cannot be undone.",
|
|
769
769
|
isDefault && " This is your default payment method."
|
|
770
770
|
] })
|
|
771
771
|
] }),
|
|
772
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
773
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
774
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
772
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.AlertDialogFooter, { children: [
|
|
773
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.AlertDialogCancel, { disabled: loading, children: "Cancel" }),
|
|
774
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.AlertDialogAction, { onClick: handleRemove, disabled: loading, className: "bg-red-600 hover:bg-red-700", children: loading ? "Removing..." : "Remove" })
|
|
775
775
|
] })
|
|
776
776
|
] }) })
|
|
777
777
|
] });
|
|
@@ -794,7 +794,7 @@ function PaymentMethodsContainer() {
|
|
|
794
794
|
const loadPaymentMethods = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
795
795
|
setLoading(true);
|
|
796
796
|
try {
|
|
797
|
-
const fetchedPaymentMethods = await
|
|
797
|
+
const fetchedPaymentMethods = await _chunkNNCTRU4Ojs.StripeCustomerService.listPaymentMethods();
|
|
798
798
|
setPaymentMethods(fetchedPaymentMethods);
|
|
799
799
|
} catch (error) {
|
|
800
800
|
console.error("[PaymentMethodsContainer] Failed to load payment methods:", error);
|
|
@@ -814,14 +814,14 @@ function PaymentMethodsContainer() {
|
|
|
814
814
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8" }),
|
|
815
815
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-3xl font-bold", children: "Payment Methods" })
|
|
816
816
|
] }),
|
|
817
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
817
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Button, { onClick: () => setShowAddPaymentMethod(true), children: "Add Payment Method" })
|
|
818
818
|
] }),
|
|
819
819
|
paymentMethods.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col items-center justify-center gap-y-4 rounded-lg border-2 border-dashed border-gray-300 bg-muted/50 p-12", children: [
|
|
820
820
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-16 w-16 text-muted-foreground" }),
|
|
821
821
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
822
822
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "mb-2 text-xl font-semibold", children: "No payment methods" }),
|
|
823
823
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mb-4 text-muted-foreground", children: "Add a payment method to enable subscriptions and secure checkout." }),
|
|
824
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
824
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Button, { onClick: () => setShowAddPaymentMethod(true), children: "Add Your First Card" })
|
|
825
825
|
] })
|
|
826
826
|
] }),
|
|
827
827
|
paymentMethods.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodsList, { paymentMethods, onUpdate: loadPaymentMethods }),
|
|
@@ -945,13 +945,13 @@ function InvoiceDetails({ invoice, open, onOpenChange, onInvoiceChange }) {
|
|
|
945
945
|
return invoice.stripeInvoiceId.slice(-8);
|
|
946
946
|
}, "getInvoiceNumber");
|
|
947
947
|
const productName = _optionalChain([invoice, 'access', _35 => _35.subscription, 'optionalAccess', _36 => _36.price, 'optionalAccess', _37 => _37.product, 'optionalAccess', _38 => _38.name]) || "Subscription";
|
|
948
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
949
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
950
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
948
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.DialogContent, { className: "max-w-2xl", children: [
|
|
949
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.DialogHeader, { children: [
|
|
950
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.DialogTitle, { children: [
|
|
951
951
|
"Invoice ",
|
|
952
952
|
getInvoiceNumber()
|
|
953
953
|
] }),
|
|
954
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
954
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.DialogDescription, { children: formatDate3(invoice.periodStart) })
|
|
955
955
|
] }),
|
|
956
956
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
957
957
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
@@ -1016,15 +1016,15 @@ function InvoiceDetails({ invoice, open, onOpenChange, onInvoiceChange }) {
|
|
|
1016
1016
|
] })
|
|
1017
1017
|
] }),
|
|
1018
1018
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2 pt-4 border-t", children: [
|
|
1019
|
-
invoice.stripePdfUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1019
|
+
invoice.stripePdfUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.Button, { variant: "outline", onClick: handleDownloadPDF, children: [
|
|
1020
1020
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Download, { className: "mr-2 h-4 w-4" }),
|
|
1021
1021
|
"Download PDF"
|
|
1022
1022
|
] }),
|
|
1023
|
-
invoice.status === "open" /* OPEN */ && invoice.attempted && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1023
|
+
invoice.status === "open" /* OPEN */ && invoice.attempted && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.Button, { variant: "default", onClick: handleRetryPayment, children: [
|
|
1024
1024
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RefreshCw, { className: "mr-2 h-4 w-4" }),
|
|
1025
1025
|
"Retry Payment"
|
|
1026
1026
|
] }),
|
|
1027
|
-
invoice.stripeHostedInvoiceUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1027
|
+
invoice.stripeHostedInvoiceUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.Button, { variant: "outline", onClick: handleViewInStripe, children: [
|
|
1028
1028
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ExternalLink, { className: "mr-2 h-4 w-4" }),
|
|
1029
1029
|
"View in Stripe"
|
|
1030
1030
|
] })
|
|
@@ -1048,30 +1048,30 @@ function InvoicesList({ invoices, onInvoicesChange }) {
|
|
|
1048
1048
|
return invoice.stripeInvoiceId.slice(-8);
|
|
1049
1049
|
}, "getInvoiceNumber");
|
|
1050
1050
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1051
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1052
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1053
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1054
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1055
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1056
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1057
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1051
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.Table, { children: [
|
|
1052
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.TableRow, { children: [
|
|
1053
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.TableHead, { children: "Invoice #" }),
|
|
1054
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.TableHead, { children: "Date" }),
|
|
1055
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.TableHead, { children: "Status" }),
|
|
1056
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.TableHead, { className: "text-right", children: "Amount" }),
|
|
1057
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.TableHead, { children: "Period" })
|
|
1058
1058
|
] }) }),
|
|
1059
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1059
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.TableBody, { children: invoices.map((invoice) => {
|
|
1060
1060
|
const invoiceNumber = getInvoiceNumber(invoice);
|
|
1061
1061
|
const date = formatDate3(invoice.periodStart);
|
|
1062
1062
|
const amount = formatCurrency(invoice.total, invoice.currency);
|
|
1063
1063
|
const period = `${formatDate3(invoice.periodStart)} - ${formatDate3(invoice.periodEnd)}`;
|
|
1064
1064
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1065
|
-
|
|
1065
|
+
_chunkS2RZBQP4js.TableRow,
|
|
1066
1066
|
{
|
|
1067
1067
|
onClick: () => handleRowClick(invoice),
|
|
1068
1068
|
className: "cursor-pointer hover:bg-muted/50",
|
|
1069
1069
|
children: [
|
|
1070
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1071
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1072
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1073
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1074
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1070
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.TableCell, { className: "font-medium", children: invoiceNumber }),
|
|
1071
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.TableCell, { className: "text-muted-foreground text-sm", children: date }),
|
|
1072
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InvoiceStatusBadge, { status: invoice.status }) }),
|
|
1073
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.TableCell, { className: "text-right font-medium", children: amount }),
|
|
1074
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.TableCell, { className: "text-muted-foreground text-sm", children: period })
|
|
1075
1075
|
]
|
|
1076
1076
|
},
|
|
1077
1077
|
invoice.id
|
|
@@ -1104,7 +1104,7 @@ function InvoicesContainer() {
|
|
|
1104
1104
|
setLoading(true);
|
|
1105
1105
|
try {
|
|
1106
1106
|
const params = statusFilter !== "all" ? { status: statusFilter } : void 0;
|
|
1107
|
-
const data = await
|
|
1107
|
+
const data = await _chunkNNCTRU4Ojs.StripeInvoiceService.listInvoices(params);
|
|
1108
1108
|
setInvoices(data);
|
|
1109
1109
|
} catch (error) {
|
|
1110
1110
|
console.error("[InvoicesContainer] Failed to load invoices:", error);
|
|
@@ -1120,12 +1120,12 @@ function InvoicesContainer() {
|
|
|
1120
1120
|
setStatusFilter(value);
|
|
1121
1121
|
}, "handleFilterChange");
|
|
1122
1122
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-4", children: [
|
|
1123
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1124
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1125
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1126
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1127
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1128
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1123
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Tabs, { value: statusFilter, onValueChange: handleFilterChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.TabsList, { children: [
|
|
1124
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.TabsTrigger, { value: "all", children: "All" }),
|
|
1125
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.TabsTrigger, { value: "paid" /* PAID */, children: "Paid" }),
|
|
1126
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.TabsTrigger, { value: "open" /* OPEN */, children: "Open" }),
|
|
1127
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.TabsTrigger, { value: "void" /* VOID */, children: "Void" }),
|
|
1128
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.TabsTrigger, { value: "uncollectible" /* UNCOLLECTIBLE */, children: "Uncollectible" })
|
|
1129
1129
|
] }) }),
|
|
1130
1130
|
loading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-center py-8 text-muted-foreground", children: "Loading invoices..." }),
|
|
1131
1131
|
!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: [
|
|
@@ -1172,7 +1172,7 @@ function CancelSubscriptionDialog({
|
|
|
1172
1172
|
const onSubmit = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async (values) => {
|
|
1173
1173
|
setIsSubmitting(true);
|
|
1174
1174
|
try {
|
|
1175
|
-
await
|
|
1175
|
+
await _chunkNNCTRU4Ojs.StripeSubscriptionService.cancelSubscription({
|
|
1176
1176
|
id: subscription.id,
|
|
1177
1177
|
cancelImmediately: false
|
|
1178
1178
|
});
|
|
@@ -1185,19 +1185,19 @@ function CancelSubscriptionDialog({
|
|
|
1185
1185
|
}
|
|
1186
1186
|
}, "onSubmit");
|
|
1187
1187
|
const periodEndDate = formatDate3(subscription.currentPeriodEnd);
|
|
1188
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1189
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1190
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1191
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1188
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.DialogContent, { className: "max-w-md", children: [
|
|
1189
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.DialogHeader, { children: [
|
|
1190
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.DialogTitle, { children: "Cancel Subscription" }),
|
|
1191
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.DialogDescription, { children: "Are you sure you want to cancel this subscription? This action cannot be undone." })
|
|
1192
1192
|
] }),
|
|
1193
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1193
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-col gap-y-4", children: [
|
|
1194
1194
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-blue-50 border border-blue-200 rounded-lg p-3 text-sm text-blue-800", children: [
|
|
1195
1195
|
"Your subscription will remain active until ",
|
|
1196
1196
|
periodEndDate,
|
|
1197
1197
|
". You can continue using the service until then."
|
|
1198
1198
|
] }),
|
|
1199
1199
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1200
|
-
|
|
1200
|
+
_chunkS2RZBQP4js.FormTextarea,
|
|
1201
1201
|
{
|
|
1202
1202
|
form,
|
|
1203
1203
|
id: "reason",
|
|
@@ -1207,8 +1207,8 @@ function CancelSubscriptionDialog({
|
|
|
1207
1207
|
}
|
|
1208
1208
|
),
|
|
1209
1209
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-x-2 justify-end pt-2", children: [
|
|
1210
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1211
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1210
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Button, { type: "button", variant: "outline", onClick: () => onOpenChange(false), disabled: isSubmitting, children: "Keep Subscription" }),
|
|
1211
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Button, { type: "submit", variant: "destructive", disabled: isSubmitting, children: isSubmitting ? "Canceling..." : "Confirm Cancellation" })
|
|
1212
1212
|
] })
|
|
1213
1213
|
] }) })
|
|
1214
1214
|
] }) });
|
|
@@ -1299,7 +1299,7 @@ function SubscriptionDetails({
|
|
|
1299
1299
|
const handlePause = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1300
1300
|
setIsProcessing(true);
|
|
1301
1301
|
try {
|
|
1302
|
-
await
|
|
1302
|
+
await _chunkNNCTRU4Ojs.StripeSubscriptionService.pauseSubscription({ subscriptionId: subscription.id });
|
|
1303
1303
|
onSubscriptionChange();
|
|
1304
1304
|
} catch (error) {
|
|
1305
1305
|
console.error("[SubscriptionDetails] Failed to pause subscription:", error);
|
|
@@ -1310,7 +1310,7 @@ function SubscriptionDetails({
|
|
|
1310
1310
|
const handleResume = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1311
1311
|
setIsProcessing(true);
|
|
1312
1312
|
try {
|
|
1313
|
-
await
|
|
1313
|
+
await _chunkNNCTRU4Ojs.StripeSubscriptionService.resumeSubscription({ subscriptionId: subscription.id });
|
|
1314
1314
|
onSubscriptionChange();
|
|
1315
1315
|
} catch (error) {
|
|
1316
1316
|
console.error("[SubscriptionDetails] Failed to resume subscription:", error);
|
|
@@ -1320,7 +1320,7 @@ function SubscriptionDetails({
|
|
|
1320
1320
|
}, "handleResume");
|
|
1321
1321
|
const handleManageViaPortal = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1322
1322
|
try {
|
|
1323
|
-
const { url } = await
|
|
1323
|
+
const { url } = await _chunkNNCTRU4Ojs.StripeCustomerService.createPortalSession();
|
|
1324
1324
|
window.open(url, "_blank");
|
|
1325
1325
|
} catch (error) {
|
|
1326
1326
|
console.error("[SubscriptionDetails] Failed to create portal session:", error);
|
|
@@ -1330,10 +1330,10 @@ function SubscriptionDetails({
|
|
|
1330
1330
|
const canResume = subscription.status === "paused" /* PAUSED */;
|
|
1331
1331
|
const canCancel = subscription.status === "active" /* ACTIVE */ || subscription.status === "trialing" /* TRIALING */ || subscription.status === "paused" /* PAUSED */;
|
|
1332
1332
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1333
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1334
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1335
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1336
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1333
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.DialogContent, { className: "max-w-2xl", children: [
|
|
1334
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.DialogHeader, { children: [
|
|
1335
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.DialogTitle, { children: "Subscription Details" }),
|
|
1336
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.DialogDescription, { children: "View and manage your subscription" })
|
|
1337
1337
|
] }),
|
|
1338
1338
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
1339
1339
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
@@ -1369,11 +1369,11 @@ function SubscriptionDetails({
|
|
|
1369
1369
|
"."
|
|
1370
1370
|
] }) }),
|
|
1371
1371
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2 pt-4 border-t", children: [
|
|
1372
|
-
onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1373
|
-
canPause && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1374
|
-
canResume && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1375
|
-
canCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1376
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1372
|
+
onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Button, { variant: "default", onClick: () => onChangePlan(subscription), children: "Change Plan" }),
|
|
1373
|
+
canPause && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Button, { variant: "outline", onClick: handlePause, disabled: isProcessing, children: isProcessing ? "Pausing..." : "Pause" }),
|
|
1374
|
+
canResume && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Button, { variant: "outline", onClick: handleResume, disabled: isProcessing, children: isProcessing ? "Resuming..." : "Resume" }),
|
|
1375
|
+
canCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Button, { variant: "destructive", onClick: () => setShowCancel(true), children: "Cancel" }),
|
|
1376
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Button, { variant: "outline", onClick: handleManageViaPortal, children: "Manage via Portal" })
|
|
1377
1377
|
] })
|
|
1378
1378
|
] })
|
|
1379
1379
|
] }) }),
|
|
@@ -1420,27 +1420,27 @@ function SubscriptionsList({ subscriptions, onSubscriptionsChange, onChangePlan
|
|
|
1420
1420
|
setSelectedSub(subscription);
|
|
1421
1421
|
}, "handleRowClick");
|
|
1422
1422
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1423
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1424
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1425
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1426
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1427
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1428
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1423
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.Table, { children: [
|
|
1424
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.TableRow, { children: [
|
|
1425
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.TableHead, { children: "Status" }),
|
|
1426
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.TableHead, { children: "Plan" }),
|
|
1427
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.TableHead, { children: "Period" }),
|
|
1428
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.TableHead, { className: "text-right", children: "Amount" })
|
|
1429
1429
|
] }) }),
|
|
1430
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1430
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.TableBody, { children: subscriptions.map((subscription) => {
|
|
1431
1431
|
const price = subscription.price;
|
|
1432
1432
|
const amount = _optionalChain([price, 'optionalAccess', _48 => _48.unitAmount]) ? formatCurrency(price.unitAmount, price.currency) : "N/A";
|
|
1433
1433
|
const period = `${formatDate3(subscription.currentPeriodStart)} - ${formatDate3(subscription.currentPeriodEnd)}`;
|
|
1434
1434
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1435
|
-
|
|
1435
|
+
_chunkS2RZBQP4js.TableRow,
|
|
1436
1436
|
{
|
|
1437
1437
|
onClick: () => handleRowClick(subscription),
|
|
1438
1438
|
className: "cursor-pointer hover:bg-muted/50",
|
|
1439
1439
|
children: [
|
|
1440
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1441
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1442
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1443
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1440
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SubscriptionStatusBadge, { status: subscription.status, cancelAtPeriodEnd: subscription.cancelAtPeriodEnd }) }),
|
|
1441
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.TableCell, { className: "font-medium", children: formatPlanName3(price) }),
|
|
1442
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.TableCell, { className: "text-muted-foreground text-sm", children: period }),
|
|
1443
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.TableCell, { className: "text-right font-medium", children: amount })
|
|
1444
1444
|
]
|
|
1445
1445
|
},
|
|
1446
1446
|
subscription.id
|
|
@@ -1475,7 +1475,7 @@ function SubscriptionsContainer({ onOpenWizard, hasActiveRecurringSubscription }
|
|
|
1475
1475
|
const loadSubscriptions = _react.useCallback.call(void 0, async () => {
|
|
1476
1476
|
setLoading(true);
|
|
1477
1477
|
try {
|
|
1478
|
-
const fetchedSubscriptions = await
|
|
1478
|
+
const fetchedSubscriptions = await _chunkNNCTRU4Ojs.StripeSubscriptionService.listSubscriptions();
|
|
1479
1479
|
setSubscriptions(fetchedSubscriptions);
|
|
1480
1480
|
} catch (error) {
|
|
1481
1481
|
console.error("[SubscriptionsContainer] Failed to load subscriptions:", error);
|
|
@@ -1498,7 +1498,7 @@ function SubscriptionsContainer({ onOpenWizard, hasActiveRecurringSubscription }
|
|
|
1498
1498
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8" }),
|
|
1499
1499
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-3xl font-bold", children: "Subscriptions" })
|
|
1500
1500
|
] }),
|
|
1501
|
-
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1501
|
+
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _49 => _49()]), children: hasActiveRecurringSubscription ? "Purchase Add-ons" : "Subscribe to a Plan" })
|
|
1502
1502
|
] }),
|
|
1503
1503
|
criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BillingAlertBanner, { subscription }, subscription.id)),
|
|
1504
1504
|
subscriptions.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col items-center justify-center py-12 space-y-4", children: [
|
|
@@ -1506,7 +1506,7 @@ function SubscriptionsContainer({ onOpenWizard, hasActiveRecurringSubscription }
|
|
|
1506
1506
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
1507
1507
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-xl font-semibold mb-2", children: "No Active Subscriptions" }),
|
|
1508
1508
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground mb-6", children: "Choose a subscription plan to get started with our services." }),
|
|
1509
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1509
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _50 => _50()]), children: "Subscribe to a Plan" })
|
|
1510
1510
|
] })
|
|
1511
1511
|
] }),
|
|
1512
1512
|
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -1527,9 +1527,9 @@ function IntervalToggle({ value, onChange, hasMonthly, hasYearly }) {
|
|
|
1527
1527
|
if (!hasMonthly || !hasYearly) {
|
|
1528
1528
|
return null;
|
|
1529
1529
|
}
|
|
1530
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1531
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1532
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1530
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Tabs, { value, onValueChange: (v) => onChange(v), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.TabsList, { children: [
|
|
1531
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.TabsTrigger, { value: "month", children: "Monthly" }),
|
|
1532
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.TabsTrigger, { value: "year", children: "Yearly" })
|
|
1533
1533
|
] }) });
|
|
1534
1534
|
}
|
|
1535
1535
|
_chunk7QVYU63Ejs.__name.call(void 0, IntervalToggle, "IntervalToggle");
|
|
@@ -1554,7 +1554,7 @@ function PricingCard({ price, isCurrentPlan = false, isSelected = false, isDisab
|
|
|
1554
1554
|
}
|
|
1555
1555
|
}, "handleClick");
|
|
1556
1556
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1557
|
-
|
|
1557
|
+
_chunkS2RZBQP4js.Card,
|
|
1558
1558
|
{
|
|
1559
1559
|
role: "radio",
|
|
1560
1560
|
"aria-checked": isSelected,
|
|
@@ -1562,7 +1562,7 @@ function PricingCard({ price, isCurrentPlan = false, isSelected = false, isDisab
|
|
|
1562
1562
|
tabIndex: isDisabled ? -1 : 0,
|
|
1563
1563
|
onKeyDown: handleKeyDown,
|
|
1564
1564
|
onClick: handleClick,
|
|
1565
|
-
className:
|
|
1565
|
+
className: _chunkNNCTRU4Ojs.cn.call(void 0,
|
|
1566
1566
|
"relative cursor-pointer transition-all duration-200 flex flex-col h-full",
|
|
1567
1567
|
"focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
1568
1568
|
isCurrentPlan && "bg-muted/30",
|
|
@@ -1572,9 +1572,9 @@ function PricingCard({ price, isCurrentPlan = false, isSelected = false, isDisab
|
|
|
1572
1572
|
isLoading && "pointer-events-none"
|
|
1573
1573
|
),
|
|
1574
1574
|
children: [
|
|
1575
|
-
isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1576
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1577
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1575
|
+
isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Badge, { variant: "secondary", className: "absolute top-2 right-2", children: "Current" }),
|
|
1576
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.CardHeader, { className: "pb-2", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "font-semibold text-lg", children: description }) }),
|
|
1577
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.CardContent, { className: "pb-4 grow", children: [
|
|
1578
1578
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mb-4", children: [
|
|
1579
1579
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-3xl font-bold", children: formattedPrice }),
|
|
1580
1580
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground ml-1", children: interval })
|
|
@@ -1584,8 +1584,8 @@ function PricingCard({ price, isCurrentPlan = false, isSelected = false, isDisab
|
|
|
1584
1584
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-muted-foreground", children: feature })
|
|
1585
1585
|
] }, index)) })
|
|
1586
1586
|
] }),
|
|
1587
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1588
|
-
|
|
1587
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.CardFooter, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1588
|
+
_chunkS2RZBQP4js.Button,
|
|
1589
1589
|
{
|
|
1590
1590
|
variant: isCurrentPlan ? "secondary" : isSelected ? "default" : "outline",
|
|
1591
1591
|
className: "w-full",
|
|
@@ -1713,15 +1713,15 @@ function ProductPricingList({
|
|
|
1713
1713
|
_chunk7QVYU63Ejs.__name.call(void 0, ProductPricingList, "ProductPricingList");
|
|
1714
1714
|
function ProductPricingListSkeleton() {
|
|
1715
1715
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "space-y-6", children: [1, 2].map((rowIndex) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-3", children: [
|
|
1716
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1716
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Skeleton, { className: "h-6 w-32" }),
|
|
1717
1717
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4", children: [1, 2, 3].map((cardIndex) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "p-4 rounded-lg border animate-pulse space-y-3", children: [
|
|
1718
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1719
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1718
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Skeleton, { className: "h-6 w-24" }),
|
|
1719
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Skeleton, { className: "h-8 w-32" }),
|
|
1720
1720
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
1721
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1722
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1721
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Skeleton, { className: "h-4 w-full" }),
|
|
1722
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Skeleton, { className: "h-4 w-3/4" })
|
|
1723
1723
|
] }),
|
|
1724
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1724
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Skeleton, { className: "h-10 w-full" })
|
|
1725
1725
|
] }, cardIndex)) })
|
|
1726
1726
|
] }, rowIndex)) });
|
|
1727
1727
|
}
|
|
@@ -1776,8 +1776,8 @@ function SubscriptionConfirmation({ price, isLoading, onConfirm, onCancel }) {
|
|
|
1776
1776
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: feature })
|
|
1777
1777
|
] }, index)) }),
|
|
1778
1778
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-3 pt-2 border-t border-accent/30", children: [
|
|
1779
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1780
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1779
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Button, { variant: "outline", onClick: onCancel, disabled: isLoading, children: "Cancel" }),
|
|
1780
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Button, { onClick: onConfirm, disabled: isLoading, children: isLoading ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1781
1781
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "h-4 w-4 animate-spin mr-2" }),
|
|
1782
1782
|
"Processing..."
|
|
1783
1783
|
] }) : "Subscribe" })
|
|
@@ -1836,7 +1836,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
1836
1836
|
onCloseRef.current = onClose;
|
|
1837
1837
|
const checkPaymentMethod = _react.useCallback.call(void 0, async () => {
|
|
1838
1838
|
try {
|
|
1839
|
-
const methods = await
|
|
1839
|
+
const methods = await _chunkNNCTRU4Ojs.StripeCustomerService.listPaymentMethods();
|
|
1840
1840
|
dispatch({ type: "SET_HAS_PAYMENT_METHOD", hasMethod: methods.length > 0 });
|
|
1841
1841
|
} catch (error) {
|
|
1842
1842
|
console.error("[useSubscriptionWizard] Failed to check payment methods:", error);
|
|
@@ -1858,7 +1858,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
1858
1858
|
try {
|
|
1859
1859
|
await checkPaymentMethod();
|
|
1860
1860
|
if (subscription && state.selectedPrice.id !== _optionalChain([subscription, 'access', _61 => _61.price, 'optionalAccess', _62 => _62.id])) {
|
|
1861
|
-
const preview = await
|
|
1861
|
+
const preview = await _chunkNNCTRU4Ojs.StripeSubscriptionService.getProrationPreview({
|
|
1862
1862
|
subscriptionId: subscription.id,
|
|
1863
1863
|
newPriceId: state.selectedPrice.id
|
|
1864
1864
|
});
|
|
@@ -1878,12 +1878,12 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
1878
1878
|
dispatch({ type: "SET_ERROR", error: null });
|
|
1879
1879
|
try {
|
|
1880
1880
|
if (subscription) {
|
|
1881
|
-
await
|
|
1881
|
+
await _chunkNNCTRU4Ojs.StripeSubscriptionService.changePlan({
|
|
1882
1882
|
id: subscription.id,
|
|
1883
1883
|
newPriceId: state.selectedPrice.id
|
|
1884
1884
|
});
|
|
1885
1885
|
} else {
|
|
1886
|
-
await
|
|
1886
|
+
await _chunkNNCTRU4Ojs.StripeSubscriptionService.createSubscription({
|
|
1887
1887
|
id: _uuid.v4.call(void 0, ),
|
|
1888
1888
|
priceId: state.selectedPrice.id
|
|
1889
1889
|
});
|
|
@@ -2007,7 +2007,7 @@ function WizardStepPlanSelection({
|
|
|
2007
2007
|
_react.useEffect.call(void 0, () => {
|
|
2008
2008
|
const loadProducts = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2009
2009
|
try {
|
|
2010
|
-
const fetchedProducts = await
|
|
2010
|
+
const fetchedProducts = await _chunkNNCTRU4Ojs.StripeProductService.listProducts({ active: true });
|
|
2011
2011
|
setProducts(fetchedProducts);
|
|
2012
2012
|
} catch (error) {
|
|
2013
2013
|
console.error("[WizardStepPlanSelection] Failed to load products:", error);
|
|
@@ -2058,7 +2058,7 @@ function WizardStepPlanSelection({
|
|
|
2058
2058
|
onSelectPrice: handleSelectPrice
|
|
2059
2059
|
}
|
|
2060
2060
|
),
|
|
2061
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex justify-end pt-4 border-t", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2061
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex justify-end pt-4 border-t", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Button, { onClick: onNext, disabled: !selectedPrice || isProcessing, children: isProcessing ? "Loading..." : "Next: Review" }) })
|
|
2062
2062
|
] });
|
|
2063
2063
|
}
|
|
2064
2064
|
_chunk7QVYU63Ejs.__name.call(void 0, WizardStepPlanSelection, "WizardStepPlanSelection");
|
|
@@ -2113,16 +2113,16 @@ function WizardStepReview({
|
|
|
2113
2113
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "font-medium", children: "Payment Method" }),
|
|
2114
2114
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: hasPaymentMethod ? "A payment method is on file" : "No payment method on file" })
|
|
2115
2115
|
] }),
|
|
2116
|
-
!hasPaymentMethod && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2116
|
+
!hasPaymentMethod && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Button, { variant: "outline", onClick: onAddPaymentMethod, children: "Add Payment Method" })
|
|
2117
2117
|
] }) }),
|
|
2118
|
-
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2118
|
+
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.Alert, { variant: "destructive", children: [
|
|
2119
2119
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.AlertCircle, { className: "h-4 w-4" }),
|
|
2120
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2120
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.AlertDescription, { children: error })
|
|
2121
2121
|
] }),
|
|
2122
2122
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between pt-4 border-t", children: [
|
|
2123
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2123
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Button, { variant: "outline", onClick: onBack, disabled: isProcessing, children: "Back" }),
|
|
2124
2124
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2125
|
-
|
|
2125
|
+
_chunkS2RZBQP4js.Button,
|
|
2126
2126
|
{
|
|
2127
2127
|
onClick: hasPaymentMethod ? onConfirm : onAddPaymentMethod,
|
|
2128
2128
|
disabled: isProcessing,
|
|
@@ -2192,10 +2192,10 @@ function SubscriptionWizard({
|
|
|
2192
2192
|
const isChangePlanMode = !!subscription;
|
|
2193
2193
|
const dialogTitle = subscription ? "Change Subscription Plan" : isPurchasingAddons ? "Purchase Add-ons" : "Subscribe to a Plan";
|
|
2194
2194
|
const dialogDescription = subscription ? "Select a new plan for your subscription" : isPurchasingAddons ? "Select one-time products to purchase" : "Choose a subscription plan to get started";
|
|
2195
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2196
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2197
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2198
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2195
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.DialogContent, { className: "max-w-2xl", children: [
|
|
2196
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.DialogHeader, { children: [
|
|
2197
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.DialogTitle, { children: dialogTitle }),
|
|
2198
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.DialogDescription, { children: dialogDescription })
|
|
2199
2199
|
] }),
|
|
2200
2200
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, WizardProgressIndicator, { currentStep: state.step }),
|
|
2201
2201
|
state.step === "plan-selection" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -2272,15 +2272,15 @@ function UsageSummaryCard({ meter, summary }) {
|
|
|
2272
2272
|
const progressWidth = percentage !== null ? Math.min(percentage, 100) : 0;
|
|
2273
2273
|
const displayName = meter.displayName || meter.eventName;
|
|
2274
2274
|
const hasLimit = limit !== null && limit !== void 0;
|
|
2275
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2276
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2275
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.Card, { children: [
|
|
2276
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.CardHeader, { className: "flex flex-row items-center gap-x-3 pb-3", children: [
|
|
2277
2277
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex h-10 w-10 items-center justify-center rounded-lg bg-blue-100 text-blue-600", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-5 w-5" }) }),
|
|
2278
2278
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col", children: [
|
|
2279
2279
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "font-semibold", children: displayName }),
|
|
2280
2280
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-gray-500", children: meter.id })
|
|
2281
2281
|
] })
|
|
2282
2282
|
] }),
|
|
2283
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2283
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.CardContent, { className: "flex flex-col gap-y-4", children: [
|
|
2284
2284
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
2285
2285
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-3xl font-bold", children: currentUsage.toLocaleString() }),
|
|
2286
2286
|
hasLimit && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm text-gray-500", children: [
|
|
@@ -2327,14 +2327,14 @@ function UsageContainer() {
|
|
|
2327
2327
|
const loadUsageData = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2328
2328
|
setLoading(true);
|
|
2329
2329
|
try {
|
|
2330
|
-
const fetchedSubscriptions = await
|
|
2330
|
+
const fetchedSubscriptions = await _chunkNNCTRU4Ojs.StripeSubscriptionService.listSubscriptions();
|
|
2331
2331
|
setSubscriptions(fetchedSubscriptions);
|
|
2332
2332
|
const hasMeteredSubscriptions2 = fetchedSubscriptions.some((sub) => _optionalChain([sub, 'access', _87 => _87.price, 'optionalAccess', _88 => _88.recurring, 'optionalAccess', _89 => _89.usageType]) === "metered");
|
|
2333
2333
|
if (!hasMeteredSubscriptions2) {
|
|
2334
2334
|
setLoading(false);
|
|
2335
2335
|
return;
|
|
2336
2336
|
}
|
|
2337
|
-
const fetchedMeters = await
|
|
2337
|
+
const fetchedMeters = await _chunkNNCTRU4Ojs.StripeUsageService.listMeters();
|
|
2338
2338
|
setMeters(fetchedMeters);
|
|
2339
2339
|
const summariesMap = {};
|
|
2340
2340
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -2342,7 +2342,7 @@ function UsageContainer() {
|
|
|
2342
2342
|
const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
|
|
2343
2343
|
for (const meter of fetchedMeters) {
|
|
2344
2344
|
try {
|
|
2345
|
-
const meterSummaries = await
|
|
2345
|
+
const meterSummaries = await _chunkNNCTRU4Ojs.StripeUsageService.getMeterSummaries({
|
|
2346
2346
|
meterId: meter.id,
|
|
2347
2347
|
startTime: startOfMonth,
|
|
2348
2348
|
endTime: endOfMonth
|
|
@@ -2408,21 +2408,21 @@ function UsageHistoryTable({ usageRecords }) {
|
|
|
2408
2408
|
}
|
|
2409
2409
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
2410
2410
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h2", { className: "text-xl font-semibold", children: "Usage History" }),
|
|
2411
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-clip rounded-lg border", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2412
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2413
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2414
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2415
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2416
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2411
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-clip rounded-lg border", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.Table, { children: [
|
|
2412
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.TableRow, { children: [
|
|
2413
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.TableHead, { children: "Date & Time" }),
|
|
2414
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.TableHead, { children: "Meter Event" }),
|
|
2415
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.TableHead, { className: "text-right", children: "Quantity" }),
|
|
2416
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.TableHead, { children: "Event ID" })
|
|
2417
2417
|
] }) }),
|
|
2418
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2418
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.TableBody, { children: usageRecords.map((record) => {
|
|
2419
2419
|
const dateTime = formatDateTime(record.timestamp);
|
|
2420
2420
|
const quantity = record.quantity.toLocaleString();
|
|
2421
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2422
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2423
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2424
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2425
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2421
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.TableRow, { children: [
|
|
2422
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.TableCell, { className: "font-medium", children: dateTime }),
|
|
2423
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.TableCell, { className: "text-muted-foreground", children: record.meterEventName }),
|
|
2424
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.TableCell, { className: "text-right font-medium", children: quantity }),
|
|
2425
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.TableCell, { className: "text-muted-foreground text-sm font-mono", children: record.stripeEventId })
|
|
2426
2426
|
] }, record.id);
|
|
2427
2427
|
}) })
|
|
2428
2428
|
] }) })
|
|
@@ -2439,8 +2439,8 @@ function BillingDetailModal({
|
|
|
2439
2439
|
children,
|
|
2440
2440
|
className
|
|
2441
2441
|
}) {
|
|
2442
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2443
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2442
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.DialogContent, { className: _nullishCoalesce(className, () => ( "max-w-4xl max-h-[90vh] overflow-y-auto")), children: [
|
|
2443
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.DialogHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.DialogTitle, { children: title }) }),
|
|
2444
2444
|
children
|
|
2445
2445
|
] }) });
|
|
2446
2446
|
}
|
|
@@ -2457,7 +2457,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
|
|
|
2457
2457
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "font-semibold text-red-900", children: "Payment Failed" }),
|
|
2458
2458
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-red-700 mt-1", children: "Your last payment failed. Please update your payment method to avoid service interruption." })
|
|
2459
2459
|
] }),
|
|
2460
|
-
onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2460
|
+
onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Button, { variant: "outline", size: "sm", onClick: onUpdatePayment, className: "border-red-300 text-red-700", children: "Update Payment Method" })
|
|
2461
2461
|
] });
|
|
2462
2462
|
}
|
|
2463
2463
|
if (subscription.status === "trialing" /* TRIALING */ && subscription.trialEnd) {
|
|
@@ -2477,7 +2477,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
|
|
|
2477
2477
|
". Add a payment method to continue your subscription."
|
|
2478
2478
|
] })
|
|
2479
2479
|
] }),
|
|
2480
|
-
onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2480
|
+
onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Button, { variant: "outline", size: "sm", onClick: onAddPayment, className: "border-yellow-300 text-yellow-700", children: "Add Payment Method" })
|
|
2481
2481
|
] });
|
|
2482
2482
|
}
|
|
2483
2483
|
}
|
|
@@ -2528,7 +2528,7 @@ function BillingDashboardContainer() {
|
|
|
2528
2528
|
setNoCustomerExists(false);
|
|
2529
2529
|
let customer = null;
|
|
2530
2530
|
try {
|
|
2531
|
-
customer = await
|
|
2531
|
+
customer = await _chunkNNCTRU4Ojs.StripeCustomerService.getCustomer();
|
|
2532
2532
|
setData((prev) => ({ ...prev, customer }));
|
|
2533
2533
|
setErrors((prev) => ({ ...prev, customer: null }));
|
|
2534
2534
|
setNoCustomerExists(false);
|
|
@@ -2553,7 +2553,7 @@ function BillingDashboardContainer() {
|
|
|
2553
2553
|
if (customer) {
|
|
2554
2554
|
const fetchSubscriptions = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2555
2555
|
try {
|
|
2556
|
-
const subscriptions2 = await
|
|
2556
|
+
const subscriptions2 = await _chunkNNCTRU4Ojs.StripeSubscriptionService.listSubscriptions();
|
|
2557
2557
|
setData((prev) => ({ ...prev, subscriptions: subscriptions2 }));
|
|
2558
2558
|
setErrors((prev) => ({ ...prev, subscriptions: null }));
|
|
2559
2559
|
return subscriptions2;
|
|
@@ -2567,7 +2567,7 @@ function BillingDashboardContainer() {
|
|
|
2567
2567
|
}, "fetchSubscriptions");
|
|
2568
2568
|
const fetchPaymentMethods = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2569
2569
|
try {
|
|
2570
|
-
const paymentMethods = await
|
|
2570
|
+
const paymentMethods = await _chunkNNCTRU4Ojs.StripeCustomerService.listPaymentMethods();
|
|
2571
2571
|
setData((prev) => ({ ...prev, paymentMethods }));
|
|
2572
2572
|
setErrors((prev) => ({ ...prev, paymentMethods: null }));
|
|
2573
2573
|
} catch (error) {
|
|
@@ -2579,7 +2579,7 @@ function BillingDashboardContainer() {
|
|
|
2579
2579
|
}, "fetchPaymentMethods");
|
|
2580
2580
|
const fetchInvoices = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2581
2581
|
try {
|
|
2582
|
-
const invoices = await
|
|
2582
|
+
const invoices = await _chunkNNCTRU4Ojs.StripeInvoiceService.listInvoices();
|
|
2583
2583
|
setData((prev) => ({ ...prev, invoices }));
|
|
2584
2584
|
setErrors((prev) => ({ ...prev, invoices: null }));
|
|
2585
2585
|
} catch (error) {
|
|
@@ -2603,7 +2603,7 @@ function BillingDashboardContainer() {
|
|
|
2603
2603
|
const handleCreateCustomer = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2604
2604
|
setCreatingCustomer(true);
|
|
2605
2605
|
try {
|
|
2606
|
-
await
|
|
2606
|
+
await _chunkNNCTRU4Ojs.StripeCustomerService.createCustomer();
|
|
2607
2607
|
setNoCustomerExists(false);
|
|
2608
2608
|
await fetchAllData();
|
|
2609
2609
|
} catch (error) {
|
|
@@ -2615,7 +2615,7 @@ function BillingDashboardContainer() {
|
|
|
2615
2615
|
}, "handleCreateCustomer");
|
|
2616
2616
|
const fetchUsageData = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2617
2617
|
try {
|
|
2618
|
-
const meters = await
|
|
2618
|
+
const meters = await _chunkNNCTRU4Ojs.StripeUsageService.listMeters();
|
|
2619
2619
|
setData((prev) => ({ ...prev, meters }));
|
|
2620
2620
|
const summariesMap = {};
|
|
2621
2621
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -2623,7 +2623,7 @@ function BillingDashboardContainer() {
|
|
|
2623
2623
|
const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
|
|
2624
2624
|
for (const meter of meters) {
|
|
2625
2625
|
try {
|
|
2626
|
-
const meterSummaries = await
|
|
2626
|
+
const meterSummaries = await _chunkNNCTRU4Ojs.StripeUsageService.getMeterSummaries({
|
|
2627
2627
|
meterId: meter.id,
|
|
2628
2628
|
startTime: startOfMonth,
|
|
2629
2629
|
endTime: endOfMonth
|
|
@@ -2701,18 +2701,18 @@ function BillingDashboardContainer() {
|
|
|
2701
2701
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-8 w-8" }),
|
|
2702
2702
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-3xl font-bold", children: "Billing" })
|
|
2703
2703
|
] }),
|
|
2704
|
-
isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2705
|
-
noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2706
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2704
|
+
isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.CardContent, { className: "flex items-center justify-center py-12", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "h-8 w-8 animate-spin text-muted-foreground" }) }) }),
|
|
2705
|
+
noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.Card, { children: [
|
|
2706
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.CardHeader, { className: "text-center", children: [
|
|
2707
2707
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-primary/10", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8 text-primary" }) }),
|
|
2708
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2709
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2708
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.CardTitle, { children: "Set Up Billing" }),
|
|
2709
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.CardDescription, { children: "Your company doesn't have a billing account yet. Set one up to manage subscriptions, payment methods, and view invoices." })
|
|
2710
2710
|
] }),
|
|
2711
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2711
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.CardContent, { className: "flex justify-center pb-8", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Button, { onClick: handleCreateCustomer, disabled: creatingCustomer, size: "lg", children: creatingCustomer ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2712
2712
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
2713
2713
|
"Setting up..."
|
|
2714
2714
|
] }) : "Set Up Billing Account" }) }),
|
|
2715
|
-
errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2715
|
+
errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.CardContent, { className: "pt-0", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-center text-sm text-destructive", children: errors.customer }) })
|
|
2716
2716
|
] }),
|
|
2717
2717
|
!noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2718
2718
|
criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -2882,7 +2882,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
2882
2882
|
_react.useEffect.call(void 0, () => {
|
|
2883
2883
|
const fetchFeatures = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2884
2884
|
try {
|
|
2885
|
-
const features = await
|
|
2885
|
+
const features = await _chunkNNCTRU4Ojs.FeatureService.findMany({});
|
|
2886
2886
|
setAllFeatures(features);
|
|
2887
2887
|
} catch (error) {
|
|
2888
2888
|
console.error("[PriceEditor] Failed to fetch features:", error);
|
|
@@ -2960,7 +2960,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
2960
2960
|
try {
|
|
2961
2961
|
const unitAmountInCents = Math.round(values.unitAmount * 100);
|
|
2962
2962
|
if (isEditMode) {
|
|
2963
|
-
await
|
|
2963
|
+
await _chunkNNCTRU4Ojs.StripePriceService.updatePrice({
|
|
2964
2964
|
id: price.id,
|
|
2965
2965
|
nickname: values.nickname || void 0,
|
|
2966
2966
|
description: values.description || void 0,
|
|
@@ -3002,7 +3002,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3002
3002
|
createInput.featureIds = values.featureIds;
|
|
3003
3003
|
}
|
|
3004
3004
|
}
|
|
3005
|
-
await
|
|
3005
|
+
await _chunkNNCTRU4Ojs.StripePriceService.createPrice(createInput);
|
|
3006
3006
|
}
|
|
3007
3007
|
onSuccess();
|
|
3008
3008
|
onOpenChange(false);
|
|
@@ -3028,10 +3028,10 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3028
3028
|
{ id: "licensed", text: "Licensed (per unit)" },
|
|
3029
3029
|
{ id: "metered", text: "Metered (usage-based)" }
|
|
3030
3030
|
];
|
|
3031
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3032
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3033
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3034
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3031
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.DialogContent, { className: "max-w-2xl", children: [
|
|
3032
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.DialogHeader, { children: [
|
|
3033
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.DialogTitle, { children: isEditMode ? "Edit Price" : "Create Price" }),
|
|
3034
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.DialogDescription, { children: isEditMode ? "Update the price details. Note: Only nickname and active status can be changed." : "Create a new price for this product" })
|
|
3035
3035
|
] }),
|
|
3036
3036
|
isEditMode && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-blue-50 border border-blue-200 rounded-lg p-4 flex gap-x-3", children: [
|
|
3037
3037
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.AlertCircle, { className: "h-5 w-5 text-blue-600 flex-shrink-0 mt-0.5" }),
|
|
@@ -3040,10 +3040,10 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3040
3040
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { children: "Due to Stripe's architecture, only the nickname and active status can be modified after creation. To change amount, currency, or billing interval, create a new price." })
|
|
3041
3041
|
] })
|
|
3042
3042
|
] }),
|
|
3043
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3043
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-col gap-y-4", children: [
|
|
3044
3044
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
|
|
3045
3045
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3046
|
-
|
|
3046
|
+
_chunkS2RZBQP4js.FormInput,
|
|
3047
3047
|
{
|
|
3048
3048
|
form,
|
|
3049
3049
|
id: "unitAmount",
|
|
@@ -3053,10 +3053,10 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3053
3053
|
isRequired: true
|
|
3054
3054
|
}
|
|
3055
3055
|
),
|
|
3056
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3056
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.FormSelect, { form, id: "currency", name: "Currency", values: currencyOptions, disabled: isEditMode })
|
|
3057
3057
|
] }),
|
|
3058
3058
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3059
|
-
|
|
3059
|
+
_chunkS2RZBQP4js.FormSelect,
|
|
3060
3060
|
{
|
|
3061
3061
|
form,
|
|
3062
3062
|
id: "interval",
|
|
@@ -3067,7 +3067,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3067
3067
|
),
|
|
3068
3068
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
|
|
3069
3069
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3070
|
-
|
|
3070
|
+
_chunkS2RZBQP4js.FormInput,
|
|
3071
3071
|
{
|
|
3072
3072
|
form,
|
|
3073
3073
|
id: "intervalCount",
|
|
@@ -3078,7 +3078,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3078
3078
|
}
|
|
3079
3079
|
),
|
|
3080
3080
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3081
|
-
|
|
3081
|
+
_chunkS2RZBQP4js.FormSelect,
|
|
3082
3082
|
{
|
|
3083
3083
|
form,
|
|
3084
3084
|
id: "usageType",
|
|
@@ -3089,7 +3089,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3089
3089
|
)
|
|
3090
3090
|
] }),
|
|
3091
3091
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3092
|
-
|
|
3092
|
+
_chunkS2RZBQP4js.FormInput,
|
|
3093
3093
|
{
|
|
3094
3094
|
form,
|
|
3095
3095
|
id: "nickname",
|
|
@@ -3098,7 +3098,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3098
3098
|
}
|
|
3099
3099
|
),
|
|
3100
3100
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3101
|
-
|
|
3101
|
+
_chunkS2RZBQP4js.FormTextarea,
|
|
3102
3102
|
{
|
|
3103
3103
|
form,
|
|
3104
3104
|
id: "description",
|
|
@@ -3107,13 +3107,13 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3107
3107
|
className: "min-h-24"
|
|
3108
3108
|
}
|
|
3109
3109
|
),
|
|
3110
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3110
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.FormInput, { form, id: "token", name: "Token (optional)", placeholder: "Enter token value" }),
|
|
3111
3111
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
3112
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3112
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Label, { children: "Features (optional)" }),
|
|
3113
3113
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
3114
3114
|
form.watch("features").map((_, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
|
|
3115
3115
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3116
|
-
|
|
3116
|
+
_chunkS2RZBQP4js.Input,
|
|
3117
3117
|
{
|
|
3118
3118
|
...form.register(`features.${index}`),
|
|
3119
3119
|
placeholder: `Feature ${index + 1}`,
|
|
@@ -3121,7 +3121,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3121
3121
|
}
|
|
3122
3122
|
),
|
|
3123
3123
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3124
|
-
|
|
3124
|
+
_chunkS2RZBQP4js.Button,
|
|
3125
3125
|
{
|
|
3126
3126
|
type: "button",
|
|
3127
3127
|
variant: "outline",
|
|
@@ -3138,7 +3138,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3138
3138
|
)
|
|
3139
3139
|
] }, index)),
|
|
3140
3140
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3141
|
-
|
|
3141
|
+
_chunkS2RZBQP4js.Button,
|
|
3142
3142
|
{
|
|
3143
3143
|
type: "button",
|
|
3144
3144
|
variant: "outline",
|
|
@@ -3157,7 +3157,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3157
3157
|
] })
|
|
3158
3158
|
] }),
|
|
3159
3159
|
isRecurring && allFeatures.length > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
3160
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3160
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Label, { children: "Platform Features" }),
|
|
3161
3161
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-md p-4 space-y-2 max-h-48 overflow-y-auto", children: allFeatures.map((feature) => {
|
|
3162
3162
|
const isCore = feature.isCore;
|
|
3163
3163
|
const isChecked = form.watch("featureIds").includes(feature.id);
|
|
@@ -3199,9 +3199,9 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3199
3199
|
] }, feature.id);
|
|
3200
3200
|
}) })
|
|
3201
3201
|
] }),
|
|
3202
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3202
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.FormCheckbox, { form, id: "active", name: "Active" }),
|
|
3203
3203
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3204
|
-
|
|
3204
|
+
_chunkS2RZBQP4js.FormCheckbox,
|
|
3205
3205
|
{
|
|
3206
3206
|
form,
|
|
3207
3207
|
id: "isTrial",
|
|
@@ -3209,7 +3209,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3209
3209
|
description: "Mark this as the trial subscription plan (only one price should be marked as trial)"
|
|
3210
3210
|
}
|
|
3211
3211
|
),
|
|
3212
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3212
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.CommonEditorButtons, { isEdit: isEditMode, form, disabled: isSubmitting, setOpen: onOpenChange })
|
|
3213
3213
|
] }) })
|
|
3214
3214
|
] }) });
|
|
3215
3215
|
}
|
|
@@ -3231,7 +3231,7 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3231
3231
|
const loadPrices = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3232
3232
|
setLoading(true);
|
|
3233
3233
|
try {
|
|
3234
|
-
const fetchedPrices = await
|
|
3234
|
+
const fetchedPrices = await _chunkNNCTRU4Ojs.StripePriceService.listPrices({ productId });
|
|
3235
3235
|
setPrices(fetchedPrices);
|
|
3236
3236
|
} catch (error) {
|
|
3237
3237
|
console.error("[PricesList] Failed to load prices:", error);
|
|
@@ -3248,7 +3248,7 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3248
3248
|
}
|
|
3249
3249
|
setArchivingPriceId(priceToArchive.id);
|
|
3250
3250
|
try {
|
|
3251
|
-
await
|
|
3251
|
+
await _chunkNNCTRU4Ojs.StripePriceService.archivePrice({ id: priceToArchive.id });
|
|
3252
3252
|
setPriceToArchive(null);
|
|
3253
3253
|
await loadPrices();
|
|
3254
3254
|
onPricesChange();
|
|
@@ -3264,7 +3264,7 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3264
3264
|
}
|
|
3265
3265
|
setReactivatingPriceId(priceToReactivate.id);
|
|
3266
3266
|
try {
|
|
3267
|
-
await
|
|
3267
|
+
await _chunkNNCTRU4Ojs.StripePriceService.reactivatePrice({ id: priceToReactivate.id });
|
|
3268
3268
|
setPriceToReactivate(null);
|
|
3269
3269
|
await loadPrices();
|
|
3270
3270
|
onPricesChange();
|
|
@@ -3295,12 +3295,12 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3295
3295
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-4", children: [
|
|
3296
3296
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center justify-between mb-4", children: [
|
|
3297
3297
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "text-lg font-semibold", children: "Prices" }),
|
|
3298
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3298
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Button, { size: "sm", onClick: () => setShowCreatePrice(true), children: "Add Price" })
|
|
3299
3299
|
] }),
|
|
3300
3300
|
prices.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-background flex flex-col items-center justify-center gap-y-3 rounded-lg border border-dashed p-8", children: [
|
|
3301
3301
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.DollarSign, { className: "text-muted-foreground h-12 w-12" }),
|
|
3302
3302
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-sm", children: "No prices yet. Add a price to enable subscriptions." }),
|
|
3303
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3303
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Button, { size: "sm", onClick: () => setShowCreatePrice(true), children: "Add Price" })
|
|
3304
3304
|
] }),
|
|
3305
3305
|
prices.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4", children: prices.map((price) => {
|
|
3306
3306
|
const isArchiving = archivingPriceId === price.id;
|
|
@@ -3309,9 +3309,9 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3309
3309
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-start justify-between mb-3", children: [
|
|
3310
3310
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.DollarSign, { className: "h-5 w-5 text-primary" }),
|
|
3311
3311
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-1", children: [
|
|
3312
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3312
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Button, { variant: "ghost", size: "sm", onClick: () => setEditingPrice(price), className: "h-8 w-8 p-0", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Edit, { className: "h-4 w-4" }) }),
|
|
3313
3313
|
price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3314
|
-
|
|
3314
|
+
_chunkS2RZBQP4js.Button,
|
|
3315
3315
|
{
|
|
3316
3316
|
variant: "ghost",
|
|
3317
3317
|
size: "sm",
|
|
@@ -3321,7 +3321,7 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3321
3321
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Archive, { className: "h-4 w-4" })
|
|
3322
3322
|
}
|
|
3323
3323
|
) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3324
|
-
|
|
3324
|
+
_chunkS2RZBQP4js.Button,
|
|
3325
3325
|
{
|
|
3326
3326
|
variant: "ghost",
|
|
3327
3327
|
size: "sm",
|
|
@@ -3372,20 +3372,20 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3372
3372
|
}
|
|
3373
3373
|
}
|
|
3374
3374
|
),
|
|
3375
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3376
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3377
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3378
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3375
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.AlertDialog, { open: !!priceToArchive, onOpenChange: (open) => !open && setPriceToArchive(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.AlertDialogContent, { children: [
|
|
3376
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.AlertDialogHeader, { children: [
|
|
3377
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.AlertDialogTitle, { children: "Archive Price" }),
|
|
3378
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.AlertDialogDescription, { children: [
|
|
3379
3379
|
"Are you sure you want to archive the price for",
|
|
3380
3380
|
" ",
|
|
3381
3381
|
priceToArchive && `${formatCurrency(priceToArchive.unitAmount, priceToArchive.currency)} ${formatInterval2(priceToArchive)}`,
|
|
3382
3382
|
"? This will prevent new subscriptions but existing ones will continue."
|
|
3383
3383
|
] })
|
|
3384
3384
|
] }),
|
|
3385
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3386
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3385
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.AlertDialogFooter, { children: [
|
|
3386
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.AlertDialogCancel, { disabled: !!archivingPriceId, children: "Cancel" }),
|
|
3387
3387
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3388
|
-
|
|
3388
|
+
_chunkS2RZBQP4js.AlertDialogAction,
|
|
3389
3389
|
{
|
|
3390
3390
|
onClick: handleArchive,
|
|
3391
3391
|
disabled: !!archivingPriceId,
|
|
@@ -3395,20 +3395,20 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3395
3395
|
)
|
|
3396
3396
|
] })
|
|
3397
3397
|
] }) }),
|
|
3398
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3399
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3400
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3401
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3398
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.AlertDialog, { open: !!priceToReactivate, onOpenChange: (open) => !open && setPriceToReactivate(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.AlertDialogContent, { children: [
|
|
3399
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.AlertDialogHeader, { children: [
|
|
3400
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.AlertDialogTitle, { children: "Reactivate Price" }),
|
|
3401
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.AlertDialogDescription, { children: [
|
|
3402
3402
|
"Are you sure you want to reactivate the price for",
|
|
3403
3403
|
" ",
|
|
3404
3404
|
priceToReactivate && `${formatCurrency(priceToReactivate.unitAmount, priceToReactivate.currency)} ${formatInterval2(priceToReactivate)}`,
|
|
3405
3405
|
"? This will allow new subscriptions again."
|
|
3406
3406
|
] })
|
|
3407
3407
|
] }),
|
|
3408
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3409
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3408
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.AlertDialogFooter, { children: [
|
|
3409
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.AlertDialogCancel, { disabled: !!reactivatingPriceId, children: "Cancel" }),
|
|
3410
3410
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3411
|
-
|
|
3411
|
+
_chunkS2RZBQP4js.AlertDialogAction,
|
|
3412
3412
|
{
|
|
3413
3413
|
onClick: handleReactivate,
|
|
3414
3414
|
disabled: !!reactivatingPriceId,
|
|
@@ -3452,14 +3452,14 @@ function ProductEditor({ product, open, onOpenChange, onSuccess }) {
|
|
|
3452
3452
|
setIsSubmitting(true);
|
|
3453
3453
|
try {
|
|
3454
3454
|
if (product) {
|
|
3455
|
-
await
|
|
3455
|
+
await _chunkNNCTRU4Ojs.StripeProductService.updateProduct({
|
|
3456
3456
|
id: product.id,
|
|
3457
3457
|
name: values.name,
|
|
3458
3458
|
description: values.description,
|
|
3459
3459
|
active: values.active
|
|
3460
3460
|
});
|
|
3461
3461
|
} else {
|
|
3462
|
-
await
|
|
3462
|
+
await _chunkNNCTRU4Ojs.StripeProductService.createProduct({
|
|
3463
3463
|
id: _uuid.v4.call(void 0, ),
|
|
3464
3464
|
name: values.name,
|
|
3465
3465
|
description: values.description,
|
|
@@ -3474,15 +3474,15 @@ function ProductEditor({ product, open, onOpenChange, onSuccess }) {
|
|
|
3474
3474
|
setIsSubmitting(false);
|
|
3475
3475
|
}
|
|
3476
3476
|
}, "onSubmit");
|
|
3477
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3478
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3479
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3480
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3477
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.DialogContent, { className: "max-w-2xl", children: [
|
|
3478
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.DialogHeader, { children: [
|
|
3479
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.DialogTitle, { children: product ? "Edit Product" : "Create Product" }),
|
|
3480
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.DialogDescription, { children: product ? `Update the details for ${product.name}` : "Create a new product to offer to your customers" })
|
|
3481
3481
|
] }),
|
|
3482
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3483
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3482
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-col gap-y-4", children: [
|
|
3483
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.FormInput, { form, id: "name", name: "Product Name", placeholder: "Enter product name", isRequired: true }),
|
|
3484
3484
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3485
|
-
|
|
3485
|
+
_chunkS2RZBQP4js.FormTextarea,
|
|
3486
3486
|
{
|
|
3487
3487
|
form,
|
|
3488
3488
|
id: "description",
|
|
@@ -3491,8 +3491,8 @@ function ProductEditor({ product, open, onOpenChange, onSuccess }) {
|
|
|
3491
3491
|
className: "min-h-32"
|
|
3492
3492
|
}
|
|
3493
3493
|
),
|
|
3494
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3495
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3494
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.FormCheckbox, { form, id: "active", name: "Active" }),
|
|
3495
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.CommonEditorButtons, { isEdit: !!product, form, disabled: isSubmitting, setOpen: onOpenChange })
|
|
3496
3496
|
] }) })
|
|
3497
3497
|
] }) });
|
|
3498
3498
|
}
|
|
@@ -3515,7 +3515,7 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3515
3515
|
}
|
|
3516
3516
|
setArchivingProductId(productToArchive.id);
|
|
3517
3517
|
try {
|
|
3518
|
-
const archivedProduct = await
|
|
3518
|
+
const archivedProduct = await _chunkNNCTRU4Ojs.StripeProductService.archiveProduct({ id: productToArchive.id });
|
|
3519
3519
|
setProductToArchive(null);
|
|
3520
3520
|
onProductsChange();
|
|
3521
3521
|
} catch (error) {
|
|
@@ -3530,7 +3530,7 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3530
3530
|
}
|
|
3531
3531
|
setReactivatingProductId(productToReactivate.id);
|
|
3532
3532
|
try {
|
|
3533
|
-
const reactivatedProduct = await
|
|
3533
|
+
const reactivatedProduct = await _chunkNNCTRU4Ojs.StripeProductService.reactivateProduct({ id: productToReactivate.id });
|
|
3534
3534
|
setProductToReactivate(null);
|
|
3535
3535
|
onProductsChange();
|
|
3536
3536
|
} catch (error) {
|
|
@@ -3559,12 +3559,12 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3559
3559
|
] })
|
|
3560
3560
|
] }),
|
|
3561
3561
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
3562
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3562
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.Button, { variant: "outline", size: "sm", onClick: () => setEditingProduct(product), children: [
|
|
3563
3563
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Edit, { className: "h-4 w-4 mr-1" }),
|
|
3564
3564
|
"Edit"
|
|
3565
3565
|
] }),
|
|
3566
3566
|
product.active ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3567
|
-
|
|
3567
|
+
_chunkS2RZBQP4js.Button,
|
|
3568
3568
|
{
|
|
3569
3569
|
variant: "outline",
|
|
3570
3570
|
size: "sm",
|
|
@@ -3576,7 +3576,7 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3576
3576
|
]
|
|
3577
3577
|
}
|
|
3578
3578
|
) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3579
|
-
|
|
3579
|
+
_chunkS2RZBQP4js.Button,
|
|
3580
3580
|
{
|
|
3581
3581
|
variant: "outline",
|
|
3582
3582
|
size: "sm",
|
|
@@ -3588,7 +3588,7 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3588
3588
|
]
|
|
3589
3589
|
}
|
|
3590
3590
|
),
|
|
3591
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3591
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Button, { variant: "ghost", size: "sm", onClick: () => toggleExpand(product.id), children: isExpanded ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ChevronUp, { className: "h-5 w-5" }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ChevronDown, { className: "h-5 w-5" }) })
|
|
3592
3592
|
] })
|
|
3593
3593
|
] }),
|
|
3594
3594
|
isExpanded && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border-t bg-muted/30 p-6", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PricesList, { productId: product.id, onPricesChange: onProductsChange }) })
|
|
@@ -3606,19 +3606,19 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3606
3606
|
}
|
|
3607
3607
|
}
|
|
3608
3608
|
),
|
|
3609
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3610
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3611
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3612
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3609
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.AlertDialog, { open: !!productToArchive, onOpenChange: (open) => !open && setProductToArchive(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.AlertDialogContent, { children: [
|
|
3610
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.AlertDialogHeader, { children: [
|
|
3611
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.AlertDialogTitle, { children: "Archive Product" }),
|
|
3612
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.AlertDialogDescription, { children: [
|
|
3613
3613
|
'Are you sure you want to archive "',
|
|
3614
3614
|
_optionalChain([productToArchive, 'optionalAccess', _153 => _153.name]),
|
|
3615
3615
|
'"? This will deactivate it and it will no longer be available for new subscriptions.'
|
|
3616
3616
|
] })
|
|
3617
3617
|
] }),
|
|
3618
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3619
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3618
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.AlertDialogFooter, { children: [
|
|
3619
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.AlertDialogCancel, { disabled: !!archivingProductId, children: "Cancel" }),
|
|
3620
3620
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3621
|
-
|
|
3621
|
+
_chunkS2RZBQP4js.AlertDialogAction,
|
|
3622
3622
|
{
|
|
3623
3623
|
onClick: handleArchive,
|
|
3624
3624
|
disabled: !!archivingProductId,
|
|
@@ -3628,19 +3628,19 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3628
3628
|
)
|
|
3629
3629
|
] })
|
|
3630
3630
|
] }) }),
|
|
3631
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3632
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3633
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3634
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3631
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.AlertDialog, { open: !!productToReactivate, onOpenChange: (open) => !open && setProductToReactivate(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.AlertDialogContent, { children: [
|
|
3632
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.AlertDialogHeader, { children: [
|
|
3633
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.AlertDialogTitle, { children: "Reactivate Product" }),
|
|
3634
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS2RZBQP4js.AlertDialogDescription, { children: [
|
|
3635
3635
|
'Are you sure you want to reactivate "',
|
|
3636
3636
|
_optionalChain([productToReactivate, 'optionalAccess', _154 => _154.name]),
|
|
3637
3637
|
'"? This will make it available for 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, _chunkS2RZBQP4js.AlertDialogFooter, { children: [
|
|
3641
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.AlertDialogCancel, { disabled: !!reactivatingProductId, children: "Cancel" }),
|
|
3642
3642
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3643
|
-
|
|
3643
|
+
_chunkS2RZBQP4js.AlertDialogAction,
|
|
3644
3644
|
{
|
|
3645
3645
|
onClick: handleReactivate,
|
|
3646
3646
|
disabled: !!reactivatingProductId,
|
|
@@ -3657,7 +3657,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductsList, "ProductsList");
|
|
|
3657
3657
|
// src/features/billing/stripe-product/components/containers/ProductsAdminContainer.tsx
|
|
3658
3658
|
|
|
3659
3659
|
function ProductsAdminContainer() {
|
|
3660
|
-
const { hasRole } =
|
|
3660
|
+
const { hasRole } = _chunkS2RZBQP4js.useCurrentUserContext.call(void 0, );
|
|
3661
3661
|
const [products, setProducts] = _react.useState.call(void 0, []);
|
|
3662
3662
|
const [loading, setLoading] = _react.useState.call(void 0, true);
|
|
3663
3663
|
const [showCreateProduct, setShowCreateProduct] = _react.useState.call(void 0, false);
|
|
@@ -3667,7 +3667,7 @@ function ProductsAdminContainer() {
|
|
|
3667
3667
|
const loadProducts = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3668
3668
|
setLoading(true);
|
|
3669
3669
|
try {
|
|
3670
|
-
const fetchedProducts = await
|
|
3670
|
+
const fetchedProducts = await _chunkNNCTRU4Ojs.StripeProductService.listProducts();
|
|
3671
3671
|
setProducts(fetchedProducts);
|
|
3672
3672
|
} catch (error) {
|
|
3673
3673
|
console.error("[ProductsAdminContainer] Failed to load products:", error);
|
|
@@ -3687,14 +3687,14 @@ function ProductsAdminContainer() {
|
|
|
3687
3687
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Package, { className: "h-8 w-8" }),
|
|
3688
3688
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-3xl font-bold", children: "Product & Price Management" })
|
|
3689
3689
|
] }),
|
|
3690
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3690
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Button, { onClick: () => setShowCreateProduct(true), children: "Create Product" })
|
|
3691
3691
|
] }),
|
|
3692
3692
|
products.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-muted/50 flex flex-col items-center justify-center gap-y-4 rounded-lg border-2 border-dashed p-12", children: [
|
|
3693
3693
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Package, { className: "text-muted-foreground h-16 w-16" }),
|
|
3694
3694
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
3695
3695
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "mb-2 text-xl font-semibold", children: "No products yet" }),
|
|
3696
3696
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground mb-4", children: "Create your first product to start offering subscriptions to your customers." }),
|
|
3697
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3697
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS2RZBQP4js.Button, { onClick: () => setShowCreateProduct(true), children: "Create Your First Product" })
|
|
3698
3698
|
] })
|
|
3699
3699
|
] }),
|
|
3700
3700
|
products.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductsList, { products, onProductsChange: loadProducts }),
|