@carlonicora/nextjs-jsonapi 2.4.0 → 2.5.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-7WGCH2KB.js → BlockNoteEditor-TIMGYKAA.js} +19 -19
- package/dist/{BlockNoteEditor-7WGCH2KB.js.map → BlockNoteEditor-TIMGYKAA.js.map} +1 -1
- package/dist/{BlockNoteEditor-GWAV5ESO.mjs → BlockNoteEditor-YFJMXJEU.mjs} +4 -4
- package/dist/billing/index.js +362 -362
- package/dist/billing/index.mjs +3 -3
- package/dist/{chunk-GYGMEDVS.js → chunk-7HKJNUW7.js} +755 -746
- package/dist/chunk-7HKJNUW7.js.map +1 -0
- package/dist/{chunk-3LVSA7IM.mjs → chunk-DJWNNV52.mjs} +2 -2
- package/dist/{chunk-LCCRUWWY.mjs → chunk-FS4RVV3K.mjs} +241 -1
- package/dist/chunk-FS4RVV3K.mjs.map +1 -0
- package/dist/{chunk-M2EGUO2F.mjs → chunk-G4YS52SO.mjs} +16 -7
- package/dist/chunk-G4YS52SO.mjs.map +1 -0
- package/dist/{chunk-TOKHHZSP.js → chunk-OTEDZ6YW.js} +7 -7
- package/dist/{chunk-TOKHHZSP.js.map → chunk-OTEDZ6YW.js.map} +1 -1
- package/dist/{chunk-V66AZWPG.js → chunk-RTOC53EZ.js} +246 -6
- package/dist/chunk-RTOC53EZ.js.map +1 -0
- package/dist/client/index.js +4 -4
- package/dist/client/index.mjs +3 -3
- package/dist/components/index.d.mts +16 -1
- package/dist/components/index.d.ts +16 -1
- package/dist/components/index.js +4 -4
- package/dist/components/index.mjs +3 -3
- package/dist/{tokenusage-admin.module-5wJ_tZTj.d.ts → config-BIjrg5wd.d.ts} +39 -1
- package/dist/{tokenusage-admin.module-DQVT4O4j.d.mts → config-BRUjtCd1.d.mts} +39 -1
- package/dist/contexts/index.js +4 -4
- package/dist/contexts/index.mjs +3 -3
- package/dist/core/index.d.mts +5 -2
- package/dist/core/index.d.ts +5 -2
- package/dist/core/index.js +8 -2
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +7 -1
- package/dist/features/help/index.js +37 -37
- package/dist/features/help/index.mjs +3 -3
- package/dist/features/tokenusage/index.d.mts +413 -14
- package/dist/features/tokenusage/index.d.ts +413 -14
- package/dist/features/tokenusage/index.js +481 -120
- package/dist/features/tokenusage/index.js.map +1 -1
- package/dist/features/tokenusage/index.mjs +431 -70
- package/dist/features/tokenusage/index.mjs.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +9 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -2
- package/dist/server/index.js +3 -3
- package/dist/server/index.mjs +1 -1
- package/package.json +1 -1
- package/src/core/index.ts +10 -0
- package/src/core/registry/ModuleRegistry.ts +4 -0
- package/src/features/tokenusage/components/TokenUsageAdminContainer.tsx +20 -4
- package/src/features/tokenusage/components/TokenUsageAdminTiles.tsx +31 -18
- package/src/features/tokenusage/components/TokenUsageBreakdownTable.tsx +13 -13
- package/src/features/tokenusage/components/TokenUsageRankedBar.tsx +24 -7
- package/src/features/tokenusage/components/TokenUsageReportContainer.tsx +102 -0
- package/src/features/tokenusage/components/TokenUsageReportFilterBar.tsx +34 -0
- package/src/features/tokenusage/components/TokenUsageReportTiles.tsx +161 -0
- package/src/features/tokenusage/components/TokenUsageTimelineChart.tsx +15 -13
- package/src/features/tokenusage/components/__tests__/TokenUsageAdminTiles.spec.tsx +4 -2
- package/src/features/tokenusage/components/__tests__/TokenUsageRankedBar.spec.tsx +3 -1
- package/src/features/tokenusage/contexts/TokenUsageAdminContext.tsx +6 -3
- package/src/features/tokenusage/contexts/TokenUsageReportContext.tsx +199 -0
- package/src/features/tokenusage/data/TokenUsageReportService.ts +65 -0
- package/src/features/tokenusage/data/index.ts +9 -0
- package/src/features/tokenusage/data/tokenusage-report-breakdown.interface.ts +12 -0
- package/src/features/tokenusage/data/tokenusage-report-breakdown.ts +94 -0
- package/src/features/tokenusage/data/tokenusage-report-summary.interface.ts +12 -0
- package/src/features/tokenusage/data/tokenusage-report-summary.ts +87 -0
- package/src/features/tokenusage/data/tokenusage-report-timeline.interface.ts +13 -0
- package/src/features/tokenusage/data/tokenusage-report-timeline.ts +94 -0
- package/src/features/tokenusage/data/tokenusage-report.types.ts +51 -0
- package/src/features/tokenusage/i18n-keys.ts +28 -0
- package/src/features/tokenusage/index.ts +18 -0
- package/src/features/tokenusage/lib/config.ts +22 -0
- package/src/features/tokenusage/lib/formatters.ts +100 -0
- package/src/features/tokenusage/lib/metrics.ts +8 -26
- package/src/features/tokenusage/lib/palette.ts +41 -14
- package/src/features/tokenusage/tokenusage-admin.module.ts +4 -0
- package/src/features/tokenusage/tokenusage.modules.ts +40 -0
- package/src/shadcnui/ui/chart.tsx +30 -3
- package/dist/chunk-GYGMEDVS.js.map +0 -1
- package/dist/chunk-LCCRUWWY.mjs.map +0 -1
- package/dist/chunk-M2EGUO2F.mjs.map +0 -1
- package/dist/chunk-V66AZWPG.js.map +0 -1
- /package/dist/{BlockNoteEditor-GWAV5ESO.mjs.map → BlockNoteEditor-YFJMXJEU.mjs.map} +0 -0
- /package/dist/{chunk-3LVSA7IM.mjs.map → chunk-DJWNNV52.mjs.map} +0 -0
package/dist/billing/index.js
CHANGED
|
@@ -50,11 +50,11 @@
|
|
|
50
50
|
|
|
51
51
|
|
|
52
52
|
|
|
53
|
-
var
|
|
53
|
+
var _chunk7HKJNUW7js = require('../chunk-7HKJNUW7.js');
|
|
54
54
|
|
|
55
55
|
|
|
56
56
|
|
|
57
|
-
var
|
|
57
|
+
var _chunkOTEDZ6YWjs = require('../chunk-OTEDZ6YW.js');
|
|
58
58
|
|
|
59
59
|
|
|
60
60
|
|
|
@@ -66,7 +66,7 @@ var _chunkTOKHHZSPjs = require('../chunk-TOKHHZSP.js');
|
|
|
66
66
|
|
|
67
67
|
|
|
68
68
|
|
|
69
|
-
var
|
|
69
|
+
var _chunkRTOC53EZjs = require('../chunk-RTOC53EZ.js');
|
|
70
70
|
require('../chunk-LXKSUWAV.js');
|
|
71
71
|
require('../chunk-IBS6NI7D.js');
|
|
72
72
|
require('../chunk-FPO4DLZN.js');
|
|
@@ -117,41 +117,41 @@ function SubscriptionSummaryCard({
|
|
|
117
117
|
onManageClick
|
|
118
118
|
}) {
|
|
119
119
|
if (loading) {
|
|
120
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
121
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
122
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
120
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Card, { children: [
|
|
121
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
122
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardTitle, { children: "Subscriptions" }),
|
|
123
123
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
124
124
|
] }),
|
|
125
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
126
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
127
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
128
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
125
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.CardContent, { children: [
|
|
126
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
127
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Skeleton, { className: "h-4 w-24 mb-1" }),
|
|
128
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Skeleton, { className: "h-4 w-40" })
|
|
129
129
|
] })
|
|
130
130
|
] });
|
|
131
131
|
}
|
|
132
132
|
if (error) {
|
|
133
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
134
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
135
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
133
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Card, { children: [
|
|
134
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
135
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardTitle, { children: "Subscriptions" }),
|
|
136
136
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
137
137
|
] }),
|
|
138
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
138
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
139
139
|
] });
|
|
140
140
|
}
|
|
141
141
|
const activeSubscriptions = subscriptions.filter(
|
|
142
142
|
(sub) => sub.status === "active" /* ACTIVE */ || sub.status === "trialing" /* TRIALING */
|
|
143
143
|
);
|
|
144
144
|
const primarySubscription = activeSubscriptions[0];
|
|
145
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
146
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
147
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
145
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
|
|
146
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
147
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardTitle, { children: "Subscriptions" }),
|
|
148
148
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
149
149
|
] }),
|
|
150
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
150
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardContent, { children: subscriptions.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
151
151
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No active plan" }),
|
|
152
152
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Subscribe to get started" }),
|
|
153
153
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
154
|
-
|
|
154
|
+
_chunk7HKJNUW7js.Button,
|
|
155
155
|
{
|
|
156
156
|
variant: "outline",
|
|
157
157
|
size: "sm",
|
|
@@ -170,7 +170,7 @@ function SubscriptionSummaryCard({
|
|
|
170
170
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
171
171
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: formatPlanName(primarySubscription) }),
|
|
172
172
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
173
|
-
|
|
173
|
+
_chunk7HKJNUW7js.Badge,
|
|
174
174
|
{
|
|
175
175
|
variant: primarySubscription.cancelAtPeriodEnd ? "secondary" : getStatusBadgeVariant(primarySubscription.status),
|
|
176
176
|
children: primarySubscription.cancelAtPeriodEnd ? "Canceling" : primarySubscription.status
|
|
@@ -212,37 +212,37 @@ function PaymentMethodSummaryCard({
|
|
|
212
212
|
onManageClick
|
|
213
213
|
}) {
|
|
214
214
|
if (loading) {
|
|
215
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
216
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
217
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
215
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Card, { children: [
|
|
216
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
217
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardTitle, { children: "Payment Method" }),
|
|
218
218
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
219
219
|
] }),
|
|
220
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
221
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
222
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
220
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.CardContent, { children: [
|
|
221
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
222
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Skeleton, { className: "h-4 w-24" })
|
|
223
223
|
] })
|
|
224
224
|
] });
|
|
225
225
|
}
|
|
226
226
|
if (error) {
|
|
227
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
228
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
229
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
227
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Card, { children: [
|
|
228
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
229
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardTitle, { children: "Payment Method" }),
|
|
230
230
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
231
231
|
] }),
|
|
232
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
232
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
233
233
|
] });
|
|
234
234
|
}
|
|
235
235
|
const defaultMethod = paymentMethods.find((pm) => pm.id === defaultPaymentMethodId) || paymentMethods[0];
|
|
236
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
237
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
238
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
236
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
|
|
237
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
238
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardTitle, { children: "Payment Method" }),
|
|
239
239
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
240
240
|
] }),
|
|
241
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
241
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardContent, { children: paymentMethods.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
242
242
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No payment method" }),
|
|
243
243
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Add a card to enable subscriptions" }),
|
|
244
244
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
245
|
-
|
|
245
|
+
_chunk7HKJNUW7js.Button,
|
|
246
246
|
{
|
|
247
247
|
variant: "outline",
|
|
248
248
|
size: "sm",
|
|
@@ -306,7 +306,7 @@ function CustomerInfoCard({ customer, loading, error }) {
|
|
|
306
306
|
e.stopPropagation();
|
|
307
307
|
setPortalLoading(true);
|
|
308
308
|
try {
|
|
309
|
-
const { url } = await
|
|
309
|
+
const { url } = await _chunkRTOC53EZjs.StripeCustomerService.createPortalSession();
|
|
310
310
|
window.open(url, "_blank");
|
|
311
311
|
} catch (err) {
|
|
312
312
|
console.error("[CustomerInfoCard] Failed to create portal session:", err);
|
|
@@ -315,52 +315,52 @@ function CustomerInfoCard({ customer, loading, error }) {
|
|
|
315
315
|
}
|
|
316
316
|
}, "handlePortalClick");
|
|
317
317
|
if (loading) {
|
|
318
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
319
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
320
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
318
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Card, { children: [
|
|
319
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
320
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardTitle, { children: "Billing Account" }),
|
|
321
321
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
322
322
|
] }),
|
|
323
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
324
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
325
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
326
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
323
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.CardContent, { children: [
|
|
324
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
325
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Skeleton, { className: "h-4 w-48 mb-1" }),
|
|
326
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Skeleton, { className: "h-4 w-24" })
|
|
327
327
|
] })
|
|
328
328
|
] });
|
|
329
329
|
}
|
|
330
330
|
if (error) {
|
|
331
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
332
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
333
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
331
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Card, { children: [
|
|
332
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
333
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardTitle, { children: "Billing Account" }),
|
|
334
334
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
335
335
|
] }),
|
|
336
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
336
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
337
337
|
] });
|
|
338
338
|
}
|
|
339
339
|
if (!customer) {
|
|
340
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
341
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
342
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
340
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Card, { children: [
|
|
341
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
342
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardTitle, { children: "Billing Account" }),
|
|
343
343
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
344
344
|
] }),
|
|
345
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
345
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.CardContent, { children: [
|
|
346
346
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "Not set up" }),
|
|
347
347
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Billing account will be created when you subscribe" })
|
|
348
348
|
] })
|
|
349
349
|
] });
|
|
350
350
|
}
|
|
351
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
352
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
353
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
351
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Card, { children: [
|
|
352
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
353
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardTitle, { children: "Billing Account" }),
|
|
354
354
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
355
355
|
] }),
|
|
356
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
356
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
357
357
|
customer.name && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: customer.name }),
|
|
358
358
|
customer.email && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: customer.email }),
|
|
359
359
|
customer.balance !== void 0 && customer.balance !== 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm", children: [
|
|
360
360
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground", children: "Credit Balance: " }),
|
|
361
361
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: customer.balance < 0 ? "text-success" : "text-destructive", children: formatBalance(customer.balance, customer.currency) })
|
|
362
362
|
] }),
|
|
363
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
363
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Button, { variant: "outline", size: "sm", className: "mt-2", onClick: handlePortalClick, disabled: portalLoading, children: [
|
|
364
364
|
portalLoading ? "Loading..." : "Manage in Stripe Portal",
|
|
365
365
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ExternalLink, { className: "h-4 w-4 ml-1" })
|
|
366
366
|
] })
|
|
@@ -404,42 +404,42 @@ function formatAmount(amount, currency) {
|
|
|
404
404
|
_chunk7QVYU63Ejs.__name.call(void 0, formatAmount, "formatAmount");
|
|
405
405
|
function InvoicesSummaryCard({ invoices, loading, error, onViewAllClick }) {
|
|
406
406
|
if (loading) {
|
|
407
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
408
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
409
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
407
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Card, { children: [
|
|
408
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
409
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardTitle, { children: "Recent Invoices" }),
|
|
410
410
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
411
411
|
] }),
|
|
412
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
413
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
414
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
415
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
412
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.CardContent, { children: [
|
|
413
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Skeleton, { className: "h-6 w-24 mb-2" }),
|
|
414
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Skeleton, { className: "h-4 w-32 mb-1" }),
|
|
415
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Skeleton, { className: "h-4 w-20" })
|
|
416
416
|
] })
|
|
417
417
|
] });
|
|
418
418
|
}
|
|
419
419
|
if (error) {
|
|
420
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
421
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
422
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
420
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Card, { children: [
|
|
421
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
422
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardTitle, { children: "Recent Invoices" }),
|
|
423
423
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
424
424
|
] }),
|
|
425
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
425
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
426
426
|
] });
|
|
427
427
|
}
|
|
428
428
|
const latestInvoice = invoices[0];
|
|
429
429
|
const paidInvoices = invoices.filter((inv) => inv.status === "paid" /* PAID */);
|
|
430
430
|
const openInvoices = invoices.filter((inv) => inv.status === "open" /* OPEN */);
|
|
431
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
432
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
433
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
431
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewAllClick, children: [
|
|
432
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
433
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardTitle, { children: "Recent Invoices" }),
|
|
434
434
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
435
435
|
] }),
|
|
436
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
436
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardContent, { children: invoices.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
437
437
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No invoices yet" }),
|
|
438
438
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Invoices will appear after your first billing cycle" })
|
|
439
439
|
] }) : latestInvoice ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
440
440
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
441
441
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: formatAmount(latestInvoice.total, latestInvoice.currency) }),
|
|
442
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
442
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Badge, { variant: getStatusBadgeVariant2(latestInvoice.status), children: latestInvoice.status })
|
|
443
443
|
] }),
|
|
444
444
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: latestInvoice.stripeInvoiceNumber || `Invoice from ${formatDate2(latestInvoice.periodStart)}` }),
|
|
445
445
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-4 text-xs text-muted-foreground", children: [
|
|
@@ -479,24 +479,24 @@ function BillingUsageSummaryCard({
|
|
|
479
479
|
onViewDetailsClick
|
|
480
480
|
}) {
|
|
481
481
|
if (loading) {
|
|
482
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
483
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
484
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
482
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Card, { children: [
|
|
483
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
484
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardTitle, { children: "Usage This Month" }),
|
|
485
485
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
486
486
|
] }),
|
|
487
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
488
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
489
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
487
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.CardContent, { children: [
|
|
488
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Skeleton, { className: "h-6 w-24 mb-2" }),
|
|
489
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Skeleton, { className: "h-4 w-32" })
|
|
490
490
|
] })
|
|
491
491
|
] });
|
|
492
492
|
}
|
|
493
493
|
if (error) {
|
|
494
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
495
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
496
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
494
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Card, { children: [
|
|
495
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
496
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardTitle, { children: "Usage This Month" }),
|
|
497
497
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
498
498
|
] }),
|
|
499
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
499
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
500
500
|
] });
|
|
501
501
|
}
|
|
502
502
|
const totalUsage = Object.values(summaries).reduce((acc, summary) => {
|
|
@@ -504,12 +504,12 @@ function BillingUsageSummaryCard({
|
|
|
504
504
|
}, 0);
|
|
505
505
|
const primaryMeter = meters.find((m) => _optionalChain([summaries, 'access', _17 => _17[m.id], 'optionalAccess', _18 => _18.aggregatedValue]));
|
|
506
506
|
const primarySummary = primaryMeter ? summaries[primaryMeter.id] : null;
|
|
507
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
508
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
509
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
507
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewDetailsClick, children: [
|
|
508
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
509
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardTitle, { children: "Usage This Month" }),
|
|
510
510
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
511
511
|
] }),
|
|
512
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
512
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardContent, { children: meters.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
513
513
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No meters" }),
|
|
514
514
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "No usage meters are configured" })
|
|
515
515
|
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
@@ -561,7 +561,7 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
|
|
|
561
561
|
const fetchSetupIntent = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
562
562
|
setLoading(true);
|
|
563
563
|
try {
|
|
564
|
-
const intent = await
|
|
564
|
+
const intent = await _chunkRTOC53EZjs.StripeCustomerService.createSetupIntent();
|
|
565
565
|
setSetupIntent(intent);
|
|
566
566
|
} catch (err) {
|
|
567
567
|
console.error("[PaymentMethodForm] Failed to create setup intent:", err);
|
|
@@ -599,7 +599,7 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
|
|
|
599
599
|
return;
|
|
600
600
|
}
|
|
601
601
|
if (setAsDefault && _optionalChain([confirmedSetupIntent, 'optionalAccess', _19 => _19.payment_method])) {
|
|
602
|
-
await
|
|
602
|
+
await _chunkRTOC53EZjs.StripeCustomerService.setDefaultPaymentMethod({
|
|
603
603
|
paymentMethodId: typeof confirmedSetupIntent.payment_method === "string" ? confirmedSetupIntent.payment_method : confirmedSetupIntent.payment_method.id
|
|
604
604
|
});
|
|
605
605
|
}
|
|
@@ -615,7 +615,7 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
|
|
|
615
615
|
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..." }) });
|
|
616
616
|
}
|
|
617
617
|
if (!setupIntent && error) {
|
|
618
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
618
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.AlertDescription, { children: error }) });
|
|
619
619
|
}
|
|
620
620
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: handleSubmit, className: "flex flex-col gap-y-4", children: [
|
|
621
621
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rounded-md border border-gray-300 p-3", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -638,13 +638,13 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
|
|
|
638
638
|
}
|
|
639
639
|
) }),
|
|
640
640
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
641
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
642
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
641
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Checkbox, { id: "setAsDefault", checked: setAsDefault, onCheckedChange: (checked) => setSetAsDefault(!!checked) }),
|
|
642
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Label, { htmlFor: "setAsDefault", className: "cursor-pointer font-normal", children: "Set as default payment method" })
|
|
643
643
|
] }),
|
|
644
|
-
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
644
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.AlertDescription, { children: error }) }),
|
|
645
645
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-x-2", children: [
|
|
646
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
647
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
646
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { type: "button", variant: "outline", onClick: onCancel, disabled: isSubmitting || isLoading, children: "Cancel" }),
|
|
647
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { type: "submit", disabled: !stripe || isSubmitting || isLoading, children: isSubmitting ? "Processing..." : "Add Card" })
|
|
648
648
|
] })
|
|
649
649
|
] });
|
|
650
650
|
}
|
|
@@ -660,10 +660,10 @@ function PaymentMethodEditor({ open, onOpenChange, onSuccess }) {
|
|
|
660
660
|
const handleCancel = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
661
661
|
onOpenChange(false);
|
|
662
662
|
}, "handleCancel");
|
|
663
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
664
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
665
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
666
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
663
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.DialogContent, { className: "max-w-md", children: [
|
|
664
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.DialogHeader, { children: [
|
|
665
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.DialogTitle, { children: "Add Payment Method" }),
|
|
666
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.DialogDescription, { children: "Add a new payment method to your account. Your card information is securely processed by Stripe." })
|
|
667
667
|
] }),
|
|
668
668
|
open && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodForm, { onSuccess: handleSuccess, onCancel: handleCancel })
|
|
669
669
|
] }) });
|
|
@@ -687,7 +687,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
687
687
|
_react.useEffect.call(void 0, () => {
|
|
688
688
|
const loadCustomer = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
689
689
|
try {
|
|
690
|
-
const fetchedCustomer = await
|
|
690
|
+
const fetchedCustomer = await _chunkRTOC53EZjs.StripeCustomerService.getCustomer();
|
|
691
691
|
setCustomer(fetchedCustomer);
|
|
692
692
|
} catch (error) {
|
|
693
693
|
console.error("[PaymentMethodCard] Failed to load customer:", error);
|
|
@@ -704,7 +704,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
704
704
|
const handleSetDefault = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
705
705
|
setLoading(true);
|
|
706
706
|
try {
|
|
707
|
-
await
|
|
707
|
+
await _chunkRTOC53EZjs.StripeCustomerService.setDefaultPaymentMethod({ paymentMethodId: paymentMethod.id });
|
|
708
708
|
onUpdate();
|
|
709
709
|
} catch (error) {
|
|
710
710
|
console.error("[PaymentMethodCard] Failed to set as default:", error);
|
|
@@ -715,7 +715,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
715
715
|
const handleRemove = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
716
716
|
setLoading(true);
|
|
717
717
|
try {
|
|
718
|
-
await
|
|
718
|
+
await _chunkRTOC53EZjs.StripeCustomerService.removePaymentMethod({ paymentMethodId: paymentMethod.id });
|
|
719
719
|
setShowRemoveDialog(false);
|
|
720
720
|
onUpdate();
|
|
721
721
|
} catch (error) {
|
|
@@ -724,16 +724,16 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
724
724
|
}
|
|
725
725
|
}, "handleRemove");
|
|
726
726
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
727
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
728
|
-
isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
729
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
727
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Card, { className: "relative", children: [
|
|
728
|
+
isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Badge, { variant: "softGreen", className: "absolute right-2 top-2", children: "Default" }),
|
|
729
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.CardHeader, { className: "flex flex-row items-center justify-between pb-2", children: [
|
|
730
730
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
731
731
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-2xl", children: brandIcon }),
|
|
732
732
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium capitalize", children: brand })
|
|
733
733
|
] }),
|
|
734
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
735
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
736
|
-
|
|
734
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.DropdownMenu, { children: [
|
|
735
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.DropdownMenuTrigger, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
736
|
+
_chunk7HKJNUW7js.Button,
|
|
737
737
|
{
|
|
738
738
|
render: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {}),
|
|
739
739
|
nativeButton: false,
|
|
@@ -744,10 +744,10 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
744
744
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.MoreVertical, { className: "h-4 w-4" })
|
|
745
745
|
}
|
|
746
746
|
) }),
|
|
747
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
748
|
-
!isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
747
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.DropdownMenuContent, { align: "end", children: [
|
|
748
|
+
!isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.DropdownMenuItem, { onClick: handleSetDefault, disabled: loading, children: "Set as Default" }),
|
|
749
749
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
750
|
-
|
|
750
|
+
_chunk7HKJNUW7js.DropdownMenuItem,
|
|
751
751
|
{
|
|
752
752
|
onClick: () => setShowRemoveDialog(true),
|
|
753
753
|
disabled: loading,
|
|
@@ -758,7 +758,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
758
758
|
] })
|
|
759
759
|
] })
|
|
760
760
|
] }),
|
|
761
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
761
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-1", children: [
|
|
762
762
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-lg font-semibold", children: [
|
|
763
763
|
"\u2022\u2022\u2022\u2022 ",
|
|
764
764
|
last4
|
|
@@ -771,17 +771,17 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
771
771
|
] })
|
|
772
772
|
] }) })
|
|
773
773
|
] }),
|
|
774
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
775
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
776
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
777
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
774
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.AlertDialog, { open: showRemoveDialog, onOpenChange: setShowRemoveDialog, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.AlertDialogContent, { children: [
|
|
775
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.AlertDialogHeader, { children: [
|
|
776
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.AlertDialogTitle, { children: "Remove Payment Method" }),
|
|
777
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.AlertDialogDescription, { children: [
|
|
778
778
|
"Are you sure you want to remove this payment method? This action cannot be undone.",
|
|
779
779
|
isDefault && " This is your default payment method."
|
|
780
780
|
] })
|
|
781
781
|
] }),
|
|
782
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
783
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
784
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
782
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.AlertDialogFooter, { children: [
|
|
783
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.AlertDialogCancel, { disabled: loading, children: "Cancel" }),
|
|
784
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.AlertDialogAction, { onClick: handleRemove, disabled: loading, className: "bg-red-600 hover:bg-red-700", children: loading ? "Removing..." : "Remove" })
|
|
785
785
|
] })
|
|
786
786
|
] }) })
|
|
787
787
|
] });
|
|
@@ -804,7 +804,7 @@ function PaymentMethodsContainer() {
|
|
|
804
804
|
const loadPaymentMethods = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
805
805
|
setLoading(true);
|
|
806
806
|
try {
|
|
807
|
-
const fetchedPaymentMethods = await
|
|
807
|
+
const fetchedPaymentMethods = await _chunkRTOC53EZjs.StripeCustomerService.listPaymentMethods();
|
|
808
808
|
setPaymentMethods(fetchedPaymentMethods);
|
|
809
809
|
} catch (error) {
|
|
810
810
|
console.error("[PaymentMethodsContainer] Failed to load payment methods:", error);
|
|
@@ -824,14 +824,14 @@ function PaymentMethodsContainer() {
|
|
|
824
824
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8" }),
|
|
825
825
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: "Payment Methods" })
|
|
826
826
|
] }),
|
|
827
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
827
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { onClick: () => setShowAddPaymentMethod(true), children: "Add Payment Method" })
|
|
828
828
|
] }),
|
|
829
829
|
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: [
|
|
830
830
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-16 w-16 text-muted-foreground" }),
|
|
831
831
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
832
832
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "mb-2 text-sm font-medium", children: "No payment methods" }),
|
|
833
833
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mb-4 text-muted-foreground", children: "Add a payment method to enable subscriptions and secure checkout." }),
|
|
834
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
834
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { onClick: () => setShowAddPaymentMethod(true), children: "Add Your First Card" })
|
|
835
835
|
] })
|
|
836
836
|
] }),
|
|
837
837
|
paymentMethods.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodsList, { paymentMethods, onUpdate: loadPaymentMethods }),
|
|
@@ -929,7 +929,7 @@ var statusConfig = {
|
|
|
929
929
|
};
|
|
930
930
|
function InvoiceStatusBadge({ status }) {
|
|
931
931
|
const config = statusConfig[status] || statusConfig["draft" /* DRAFT */];
|
|
932
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
932
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Badge, { variant: config.variant, children: config.label });
|
|
933
933
|
}
|
|
934
934
|
_chunk7QVYU63Ejs.__name.call(void 0, InvoiceStatusBadge, "InvoiceStatusBadge");
|
|
935
935
|
|
|
@@ -960,13 +960,13 @@ function InvoiceDetails({
|
|
|
960
960
|
return invoice.stripeInvoiceId.slice(-8);
|
|
961
961
|
}, "getInvoiceNumber");
|
|
962
962
|
const productName = _optionalChain([invoice, 'access', _29 => _29.subscription, 'optionalAccess', _30 => _30.price, 'optionalAccess', _31 => _31.product, 'optionalAccess', _32 => _32.name]) || "Subscription";
|
|
963
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
964
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
965
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
963
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.DialogContent, { className: "max-w-2xl", children: [
|
|
964
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.DialogHeader, { children: [
|
|
965
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.DialogTitle, { children: [
|
|
966
966
|
"Invoice ",
|
|
967
967
|
getInvoiceNumber()
|
|
968
968
|
] }),
|
|
969
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
969
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.DialogDescription, { children: formatDate3(invoice.periodStart) })
|
|
970
970
|
] }),
|
|
971
971
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
972
972
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
@@ -1031,15 +1031,15 @@ function InvoiceDetails({
|
|
|
1031
1031
|
] })
|
|
1032
1032
|
] }),
|
|
1033
1033
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2 pt-4 border-t", children: [
|
|
1034
|
-
invoice.stripePdfUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1034
|
+
invoice.stripePdfUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Button, { variant: "outline", onClick: handleDownloadPDF, children: [
|
|
1035
1035
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Download, { className: "mr-2 h-4 w-4" }),
|
|
1036
1036
|
"Download PDF"
|
|
1037
1037
|
] }),
|
|
1038
|
-
invoice.status === "open" /* OPEN */ && invoice.attempted && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1038
|
+
invoice.status === "open" /* OPEN */ && invoice.attempted && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Button, { variant: "default", onClick: handleRetryPayment, children: [
|
|
1039
1039
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RefreshCw, { className: "mr-2 h-4 w-4" }),
|
|
1040
1040
|
"Retry Payment"
|
|
1041
1041
|
] }),
|
|
1042
|
-
invoice.stripeHostedInvoiceUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1042
|
+
invoice.stripeHostedInvoiceUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Button, { variant: "outline", onClick: handleViewInStripe, children: [
|
|
1043
1043
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ExternalLink, { className: "mr-2 h-4 w-4" }),
|
|
1044
1044
|
"View in Stripe"
|
|
1045
1045
|
] })
|
|
@@ -1063,30 +1063,30 @@ function InvoicesList({ invoices, onInvoicesChange }) {
|
|
|
1063
1063
|
return invoice.stripeInvoiceId.slice(-8);
|
|
1064
1064
|
}, "getInvoiceNumber");
|
|
1065
1065
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1066
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1067
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1068
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1069
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1070
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1071
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1072
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1066
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Table, { children: [
|
|
1067
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.TableRow, { children: [
|
|
1068
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableHead, { children: "Invoice #" }),
|
|
1069
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableHead, { children: "Date" }),
|
|
1070
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableHead, { children: "Status" }),
|
|
1071
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableHead, { className: "text-right", children: "Amount" }),
|
|
1072
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableHead, { children: "Period" })
|
|
1073
1073
|
] }) }),
|
|
1074
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1074
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableBody, { children: invoices.map((invoice) => {
|
|
1075
1075
|
const invoiceNumber = getInvoiceNumber(invoice);
|
|
1076
1076
|
const date = formatDate3(invoice.periodStart);
|
|
1077
1077
|
const amount = formatCurrency(invoice.total, invoice.currency);
|
|
1078
1078
|
const period = `${formatDate3(invoice.periodStart)} - ${formatDate3(invoice.periodEnd)}`;
|
|
1079
1079
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1080
|
-
|
|
1080
|
+
_chunk7HKJNUW7js.TableRow,
|
|
1081
1081
|
{
|
|
1082
1082
|
onClick: () => handleRowClick(invoice),
|
|
1083
1083
|
className: "cursor-pointer hover:bg-muted/50",
|
|
1084
1084
|
children: [
|
|
1085
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1086
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1087
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1088
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1089
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1085
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableCell, { className: "font-medium", children: invoiceNumber }),
|
|
1086
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableCell, { className: "text-muted-foreground text-xs", children: date }),
|
|
1087
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InvoiceStatusBadge, { status: invoice.status }) }),
|
|
1088
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableCell, { className: "text-right font-medium", children: amount }),
|
|
1089
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableCell, { className: "text-muted-foreground text-xs", children: period })
|
|
1090
1090
|
]
|
|
1091
1091
|
},
|
|
1092
1092
|
invoice.id
|
|
@@ -1119,7 +1119,7 @@ function InvoicesContainer() {
|
|
|
1119
1119
|
setLoading(true);
|
|
1120
1120
|
try {
|
|
1121
1121
|
const params = statusFilter !== "all" ? { status: statusFilter } : void 0;
|
|
1122
|
-
const data = await
|
|
1122
|
+
const data = await _chunkRTOC53EZjs.StripeInvoiceService.listInvoices(params);
|
|
1123
1123
|
setInvoices(data);
|
|
1124
1124
|
} catch (error) {
|
|
1125
1125
|
console.error("[InvoicesContainer] Failed to load invoices:", error);
|
|
@@ -1135,12 +1135,12 @@ function InvoicesContainer() {
|
|
|
1135
1135
|
setStatusFilter(value);
|
|
1136
1136
|
}, "handleFilterChange");
|
|
1137
1137
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-4", children: [
|
|
1138
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1139
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1140
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1141
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1142
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1143
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1138
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Tabs, { value: statusFilter, onValueChange: handleFilterChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.TabsList, { children: [
|
|
1139
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TabsTrigger, { value: "all", children: "All" }),
|
|
1140
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TabsTrigger, { value: "paid" /* PAID */, children: "Paid" }),
|
|
1141
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TabsTrigger, { value: "open" /* OPEN */, children: "Open" }),
|
|
1142
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TabsTrigger, { value: "void" /* VOID */, children: "Void" }),
|
|
1143
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TabsTrigger, { value: "uncollectible" /* UNCOLLECTIBLE */, children: "Uncollectible" })
|
|
1144
1144
|
] }) }),
|
|
1145
1145
|
loading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-center py-8 text-muted-foreground", children: "Loading invoices..." }),
|
|
1146
1146
|
!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: [
|
|
@@ -1187,7 +1187,7 @@ function CancelSubscriptionDialog({
|
|
|
1187
1187
|
const onSubmit = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async (_values) => {
|
|
1188
1188
|
setIsSubmitting(true);
|
|
1189
1189
|
try {
|
|
1190
|
-
await
|
|
1190
|
+
await _chunkRTOC53EZjs.StripeSubscriptionService.cancelSubscription({
|
|
1191
1191
|
id: subscription.id,
|
|
1192
1192
|
cancelImmediately: false
|
|
1193
1193
|
});
|
|
@@ -1200,19 +1200,19 @@ function CancelSubscriptionDialog({
|
|
|
1200
1200
|
}
|
|
1201
1201
|
}, "onSubmit");
|
|
1202
1202
|
const periodEndDate = formatDate3(subscription.currentPeriodEnd);
|
|
1203
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1204
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1205
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1206
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1203
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.DialogContent, { className: "max-w-md", children: [
|
|
1204
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.DialogHeader, { children: [
|
|
1205
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.DialogTitle, { children: "Cancel Subscription" }),
|
|
1206
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.DialogDescription, { children: "Are you sure you want to cancel this subscription? This action cannot be undone." })
|
|
1207
1207
|
] }),
|
|
1208
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1208
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-col gap-y-4", children: [
|
|
1209
1209
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-primary/10 border-primary/30 text-foreground rounded-lg border p-3 text-sm", children: [
|
|
1210
1210
|
"Your subscription will remain active until ",
|
|
1211
1211
|
periodEndDate,
|
|
1212
1212
|
". You can continue using the service until then."
|
|
1213
1213
|
] }),
|
|
1214
1214
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1215
|
-
|
|
1215
|
+
_chunk7HKJNUW7js.FormTextarea,
|
|
1216
1216
|
{
|
|
1217
1217
|
form,
|
|
1218
1218
|
id: "reason",
|
|
@@ -1222,8 +1222,8 @@ function CancelSubscriptionDialog({
|
|
|
1222
1222
|
}
|
|
1223
1223
|
),
|
|
1224
1224
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-x-2 justify-end pt-2", children: [
|
|
1225
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1226
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1225
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { type: "button", variant: "outline", onClick: () => onOpenChange(false), disabled: isSubmitting, children: "Keep Subscription" }),
|
|
1226
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { type: "submit", variant: "destructive", disabled: isSubmitting, children: isSubmitting ? "Canceling..." : "Confirm Cancellation" })
|
|
1227
1227
|
] })
|
|
1228
1228
|
] }) })
|
|
1229
1229
|
] }) });
|
|
@@ -1272,7 +1272,7 @@ var cancelingConfig = {
|
|
|
1272
1272
|
};
|
|
1273
1273
|
function SubscriptionStatusBadge({ status, cancelAtPeriodEnd }) {
|
|
1274
1274
|
const config = cancelAtPeriodEnd ? cancelingConfig : statusConfig2[status] || statusConfig2["canceled" /* CANCELED */];
|
|
1275
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1275
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Badge, { variant: config.variant, children: config.label });
|
|
1276
1276
|
}
|
|
1277
1277
|
_chunk7QVYU63Ejs.__name.call(void 0, SubscriptionStatusBadge, "SubscriptionStatusBadge");
|
|
1278
1278
|
|
|
@@ -1314,7 +1314,7 @@ function SubscriptionDetails({
|
|
|
1314
1314
|
const handlePause = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1315
1315
|
setIsProcessing(true);
|
|
1316
1316
|
try {
|
|
1317
|
-
await
|
|
1317
|
+
await _chunkRTOC53EZjs.StripeSubscriptionService.pauseSubscription({ subscriptionId: subscription.id });
|
|
1318
1318
|
onSubscriptionChange();
|
|
1319
1319
|
} catch (error) {
|
|
1320
1320
|
console.error("[SubscriptionDetails] Failed to pause subscription:", error);
|
|
@@ -1325,7 +1325,7 @@ function SubscriptionDetails({
|
|
|
1325
1325
|
const handleResume = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1326
1326
|
setIsProcessing(true);
|
|
1327
1327
|
try {
|
|
1328
|
-
await
|
|
1328
|
+
await _chunkRTOC53EZjs.StripeSubscriptionService.resumeSubscription({ subscriptionId: subscription.id });
|
|
1329
1329
|
onSubscriptionChange();
|
|
1330
1330
|
} catch (error) {
|
|
1331
1331
|
console.error("[SubscriptionDetails] Failed to resume subscription:", error);
|
|
@@ -1335,7 +1335,7 @@ function SubscriptionDetails({
|
|
|
1335
1335
|
}, "handleResume");
|
|
1336
1336
|
const handleManageViaPortal = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1337
1337
|
try {
|
|
1338
|
-
const { url } = await
|
|
1338
|
+
const { url } = await _chunkRTOC53EZjs.StripeCustomerService.createPortalSession();
|
|
1339
1339
|
window.open(url, "_blank");
|
|
1340
1340
|
} catch (error) {
|
|
1341
1341
|
console.error("[SubscriptionDetails] Failed to create portal session:", error);
|
|
@@ -1345,10 +1345,10 @@ function SubscriptionDetails({
|
|
|
1345
1345
|
const canResume = subscription.status === "paused" /* PAUSED */;
|
|
1346
1346
|
const canCancel = subscription.status === "active" /* ACTIVE */ || subscription.status === "trialing" /* TRIALING */ || subscription.status === "paused" /* PAUSED */;
|
|
1347
1347
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1348
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1349
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1350
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1351
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1348
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.DialogContent, { className: "max-w-2xl", children: [
|
|
1349
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.DialogHeader, { children: [
|
|
1350
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.DialogTitle, { children: "Subscription Details" }),
|
|
1351
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.DialogDescription, { children: "View and manage your subscription" })
|
|
1352
1352
|
] }),
|
|
1353
1353
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
1354
1354
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
@@ -1390,11 +1390,11 @@ function SubscriptionDetails({
|
|
|
1390
1390
|
"."
|
|
1391
1391
|
] }) }),
|
|
1392
1392
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2 pt-4 border-t", children: [
|
|
1393
|
-
onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1394
|
-
canPause && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1395
|
-
canResume && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1396
|
-
canCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1397
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1393
|
+
onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { variant: "default", onClick: () => onChangePlan(subscription), children: "Change Plan" }),
|
|
1394
|
+
canPause && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { variant: "outline", onClick: handlePause, disabled: isProcessing, children: isProcessing ? "Pausing..." : "Pause" }),
|
|
1395
|
+
canResume && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { variant: "outline", onClick: handleResume, disabled: isProcessing, children: isProcessing ? "Resuming..." : "Resume" }),
|
|
1396
|
+
canCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { variant: "destructive", onClick: () => setShowCancel(true), children: "Cancel" }),
|
|
1397
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { variant: "outline", onClick: handleManageViaPortal, children: "Manage via Portal" })
|
|
1398
1398
|
] })
|
|
1399
1399
|
] })
|
|
1400
1400
|
] }) }),
|
|
@@ -1441,36 +1441,36 @@ function SubscriptionsList({ subscriptions, onSubscriptionsChange, onChangePlan
|
|
|
1441
1441
|
setSelectedSub(subscription);
|
|
1442
1442
|
}, "handleRowClick");
|
|
1443
1443
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1444
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1445
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1446
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1447
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1448
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1449
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1450
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1444
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Table, { children: [
|
|
1445
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.TableRow, { children: [
|
|
1446
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableHead, { children: "Status" }),
|
|
1447
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableHead, { children: "Plan" }),
|
|
1448
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableHead, { children: "Period" }),
|
|
1449
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableHead, { className: "text-right", children: "Amount" }),
|
|
1450
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableHead, { className: "text-right", children: "Actions" })
|
|
1451
1451
|
] }) }),
|
|
1452
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1452
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableBody, { children: subscriptions.map((subscription) => {
|
|
1453
1453
|
const price = subscription.price;
|
|
1454
1454
|
const amount = _optionalChain([price, 'optionalAccess', _42 => _42.unitAmount]) ? formatCurrency(price.unitAmount, price.currency) : "0";
|
|
1455
1455
|
const period = `${formatDate3(subscription.currentPeriodStart)} - ${formatDate3(subscription.currentPeriodEnd)}`;
|
|
1456
1456
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1457
|
-
|
|
1457
|
+
_chunk7HKJNUW7js.TableRow,
|
|
1458
1458
|
{
|
|
1459
1459
|
onClick: () => handleRowClick(subscription),
|
|
1460
1460
|
className: "cursor-pointer hover:bg-muted/50",
|
|
1461
1461
|
children: [
|
|
1462
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1462
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1463
1463
|
SubscriptionStatusBadge,
|
|
1464
1464
|
{
|
|
1465
1465
|
status: subscription.status,
|
|
1466
1466
|
cancelAtPeriodEnd: subscription.cancelAtPeriodEnd
|
|
1467
1467
|
}
|
|
1468
1468
|
) }),
|
|
1469
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1470
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1471
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1472
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1473
|
-
|
|
1469
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableCell, { className: "font-medium", children: formatPlanName3(price) }),
|
|
1470
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableCell, { className: "text-muted-foreground text-sm", children: period }),
|
|
1471
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableCell, { className: "text-right font-medium", children: amount }),
|
|
1472
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableCell, { className: "text-right", children: (subscription.status === "active" /* ACTIVE */ || subscription.status === "trialing" /* TRIALING */) && onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1473
|
+
_chunk7HKJNUW7js.Button,
|
|
1474
1474
|
{
|
|
1475
1475
|
size: "sm",
|
|
1476
1476
|
variant: "outline",
|
|
@@ -1515,7 +1515,7 @@ function SubscriptionsContainer({ onOpenWizard, hasActiveRecurringSubscription }
|
|
|
1515
1515
|
const loadSubscriptions = _react.useCallback.call(void 0, async () => {
|
|
1516
1516
|
setLoading(true);
|
|
1517
1517
|
try {
|
|
1518
|
-
const fetchedSubscriptions = await
|
|
1518
|
+
const fetchedSubscriptions = await _chunkRTOC53EZjs.StripeSubscriptionService.listSubscriptions();
|
|
1519
1519
|
setSubscriptions(fetchedSubscriptions);
|
|
1520
1520
|
} catch (error) {
|
|
1521
1521
|
console.error("[SubscriptionsContainer] Failed to load subscriptions:", error);
|
|
@@ -1538,7 +1538,7 @@ function SubscriptionsContainer({ onOpenWizard, hasActiveRecurringSubscription }
|
|
|
1538
1538
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8" }),
|
|
1539
1539
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: "Subscriptions" })
|
|
1540
1540
|
] }),
|
|
1541
|
-
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1541
|
+
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _43 => _43()]), children: hasActiveRecurringSubscription ? "Purchase Add-ons" : "Subscribe to a Plan" })
|
|
1542
1542
|
] }),
|
|
1543
1543
|
criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BillingAlertBanner, { subscription }, subscription.id)),
|
|
1544
1544
|
subscriptions.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col items-center justify-center py-12 space-y-4", children: [
|
|
@@ -1546,7 +1546,7 @@ function SubscriptionsContainer({ onOpenWizard, hasActiveRecurringSubscription }
|
|
|
1546
1546
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
1547
1547
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium mb-2", children: "No Active Subscriptions" }),
|
|
1548
1548
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground mb-6", children: "Choose a subscription plan to get started with our services." }),
|
|
1549
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1549
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _44 => _44()]), children: "Subscribe to a Plan" })
|
|
1550
1550
|
] })
|
|
1551
1551
|
] }),
|
|
1552
1552
|
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -1567,9 +1567,9 @@ function IntervalToggle({ value, onChange, hasMonthly, hasYearly }) {
|
|
|
1567
1567
|
if (!hasMonthly || !hasYearly) {
|
|
1568
1568
|
return null;
|
|
1569
1569
|
}
|
|
1570
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1571
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1572
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1570
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Tabs, { value, onValueChange: (v) => onChange(v), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.TabsList, { children: [
|
|
1571
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TabsTrigger, { value: "month", children: "Monthly" }),
|
|
1572
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TabsTrigger, { value: "year", children: "Yearly" })
|
|
1573
1573
|
] }) });
|
|
1574
1574
|
}
|
|
1575
1575
|
_chunk7QVYU63Ejs.__name.call(void 0, IntervalToggle, "IntervalToggle");
|
|
@@ -1601,7 +1601,7 @@ function PricingCard({
|
|
|
1601
1601
|
}
|
|
1602
1602
|
}, "handleClick");
|
|
1603
1603
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1604
|
-
|
|
1604
|
+
_chunk7HKJNUW7js.Card,
|
|
1605
1605
|
{
|
|
1606
1606
|
role: "radio",
|
|
1607
1607
|
"aria-checked": isSelected,
|
|
@@ -1609,7 +1609,7 @@ function PricingCard({
|
|
|
1609
1609
|
tabIndex: isDisabled ? -1 : 0,
|
|
1610
1610
|
onKeyDown: handleKeyDown,
|
|
1611
1611
|
onClick: handleClick,
|
|
1612
|
-
className:
|
|
1612
|
+
className: _chunkRTOC53EZjs.cn.call(void 0,
|
|
1613
1613
|
"relative cursor-pointer transition-all duration-200 flex flex-col h-full",
|
|
1614
1614
|
"focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
1615
1615
|
isCurrentPlan && "bg-muted/30",
|
|
@@ -1619,9 +1619,9 @@ function PricingCard({
|
|
|
1619
1619
|
isLoading && "pointer-events-none"
|
|
1620
1620
|
),
|
|
1621
1621
|
children: [
|
|
1622
|
-
isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1623
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1624
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1622
|
+
isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Badge, { variant: "secondary", className: "absolute top-2 right-2", children: "Current" }),
|
|
1623
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardHeader, { className: "pb-2", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium", children: description }) }),
|
|
1624
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.CardContent, { className: "pb-4 grow", children: [
|
|
1625
1625
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mb-4", children: [
|
|
1626
1626
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-3xl font-bold", children: formattedPrice }),
|
|
1627
1627
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground ml-1", children: interval })
|
|
@@ -1631,8 +1631,8 @@ function PricingCard({
|
|
|
1631
1631
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-muted-foreground", children: feature })
|
|
1632
1632
|
] }, index)) })
|
|
1633
1633
|
] }),
|
|
1634
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1635
|
-
|
|
1634
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardFooter, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1635
|
+
_chunk7HKJNUW7js.Button,
|
|
1636
1636
|
{
|
|
1637
1637
|
variant: isCurrentPlan ? "secondary" : isSelected ? "default" : "outline",
|
|
1638
1638
|
className: "w-full",
|
|
@@ -1660,7 +1660,7 @@ function ProductPricingRow({
|
|
|
1660
1660
|
return null;
|
|
1661
1661
|
}
|
|
1662
1662
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-3", children: [
|
|
1663
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1663
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.SectionHeader, { children: product.name }),
|
|
1664
1664
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1665
1665
|
"div",
|
|
1666
1666
|
{
|
|
@@ -1760,15 +1760,15 @@ function ProductPricingList({
|
|
|
1760
1760
|
_chunk7QVYU63Ejs.__name.call(void 0, ProductPricingList, "ProductPricingList");
|
|
1761
1761
|
function ProductPricingListSkeleton() {
|
|
1762
1762
|
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: [
|
|
1763
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1763
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Skeleton, { className: "h-6 w-32" }),
|
|
1764
1764
|
/* @__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: [
|
|
1765
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1766
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1765
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Skeleton, { className: "h-6 w-24" }),
|
|
1766
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Skeleton, { className: "h-8 w-32" }),
|
|
1767
1767
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
1768
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1769
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1768
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Skeleton, { className: "h-4 w-full" }),
|
|
1769
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Skeleton, { className: "h-4 w-3/4" })
|
|
1770
1770
|
] }),
|
|
1771
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1771
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Skeleton, { className: "h-10 w-full" })
|
|
1772
1772
|
] }, cardIndex)) })
|
|
1773
1773
|
] }, rowIndex)) });
|
|
1774
1774
|
}
|
|
@@ -1823,8 +1823,8 @@ function SubscriptionConfirmation({ price, isLoading, onConfirm, onCancel }) {
|
|
|
1823
1823
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: feature })
|
|
1824
1824
|
] }, index)) }),
|
|
1825
1825
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-3 pt-2 border-t border-accent/30", children: [
|
|
1826
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1827
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1826
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { variant: "outline", onClick: onCancel, disabled: isLoading, children: "Cancel" }),
|
|
1827
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { onClick: onConfirm, disabled: isLoading, children: isLoading ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1828
1828
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "h-4 w-4 animate-spin mr-2" }),
|
|
1829
1829
|
"Processing..."
|
|
1830
1830
|
] }) : "Subscribe" })
|
|
@@ -1895,7 +1895,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
1895
1895
|
onCloseRef.current = onClose;
|
|
1896
1896
|
const checkPaymentMethod = _react.useCallback.call(void 0, async () => {
|
|
1897
1897
|
try {
|
|
1898
|
-
const methods = await
|
|
1898
|
+
const methods = await _chunkRTOC53EZjs.StripeCustomerService.listPaymentMethods();
|
|
1899
1899
|
dispatch({ type: "SET_HAS_PAYMENT_METHOD", hasMethod: methods.length > 0 });
|
|
1900
1900
|
} catch (error) {
|
|
1901
1901
|
console.error("[useSubscriptionWizard] Failed to check payment methods:", error);
|
|
@@ -1919,7 +1919,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
1919
1919
|
const isTrialUpgrade = _optionalChain([subscription, 'optionalAccess', _55 => _55.status]) === "trialing" /* TRIALING */;
|
|
1920
1920
|
dispatch({ type: "SET_IS_TRIAL_SUBSCRIPTION", isTrial: isTrialUpgrade });
|
|
1921
1921
|
if (isTrialUpgrade && !state.hasPaymentMethod) {
|
|
1922
|
-
const methods = await
|
|
1922
|
+
const methods = await _chunkRTOC53EZjs.StripeCustomerService.listPaymentMethods();
|
|
1923
1923
|
if (methods.length === 0) {
|
|
1924
1924
|
dispatch({ type: "SET_STEP", step: "payment-method" });
|
|
1925
1925
|
dispatch({
|
|
@@ -1930,7 +1930,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
1930
1930
|
}
|
|
1931
1931
|
}
|
|
1932
1932
|
if (subscription && state.selectedPrice.id !== _optionalChain([subscription, 'access', _56 => _56.price, 'optionalAccess', _57 => _57.id])) {
|
|
1933
|
-
const preview = await
|
|
1933
|
+
const preview = await _chunkRTOC53EZjs.StripeSubscriptionService.getProrationPreview({
|
|
1934
1934
|
subscriptionId: subscription.id,
|
|
1935
1935
|
newPriceId: state.selectedPrice.id
|
|
1936
1936
|
});
|
|
@@ -1955,14 +1955,14 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
1955
1955
|
newPriceId: state.selectedPrice.id,
|
|
1956
1956
|
promotionCode: _optionalChain([state, 'access', _59 => _59.promotionCode, 'optionalAccess', _60 => _60.promotionCodeId])
|
|
1957
1957
|
};
|
|
1958
|
-
await
|
|
1958
|
+
await _chunkRTOC53EZjs.StripeSubscriptionService.changePlan(changePlanParams);
|
|
1959
1959
|
} else {
|
|
1960
1960
|
const createParams = {
|
|
1961
1961
|
id: _uuid.v4.call(void 0, ),
|
|
1962
1962
|
priceId: state.selectedPrice.id,
|
|
1963
1963
|
promotionCode: _optionalChain([state, 'access', _61 => _61.promotionCode, 'optionalAccess', _62 => _62.promotionCodeId])
|
|
1964
1964
|
};
|
|
1965
|
-
await
|
|
1965
|
+
await _chunkRTOC53EZjs.StripeSubscriptionService.createSubscription(createParams);
|
|
1966
1966
|
}
|
|
1967
1967
|
onSuccessRef.current();
|
|
1968
1968
|
onCloseRef.current();
|
|
@@ -1996,7 +1996,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
1996
1996
|
dispatch({ type: "SET_VALIDATING_PROMO_CODE", isValidating: true });
|
|
1997
1997
|
dispatch({ type: "SET_PROMO_CODE_ERROR", error: null });
|
|
1998
1998
|
try {
|
|
1999
|
-
const result = await
|
|
1999
|
+
const result = await _chunkRTOC53EZjs.StripePromotionCodeService.validatePromotionCode({
|
|
2000
2000
|
code,
|
|
2001
2001
|
stripePriceId: _optionalChain([state, 'access', _70 => _70.selectedPrice, 'optionalAccess', _71 => _71.id])
|
|
2002
2002
|
});
|
|
@@ -2103,7 +2103,7 @@ function WizardStepPlanSelection({
|
|
|
2103
2103
|
_react.useEffect.call(void 0, () => {
|
|
2104
2104
|
const loadProducts = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2105
2105
|
try {
|
|
2106
|
-
const fetchedProducts = await
|
|
2106
|
+
const fetchedProducts = await _chunkRTOC53EZjs.StripeProductService.listProducts({ active: true });
|
|
2107
2107
|
setProducts(fetchedProducts);
|
|
2108
2108
|
} catch (error) {
|
|
2109
2109
|
console.error("[WizardStepPlanSelection] Failed to load products:", error);
|
|
@@ -2154,7 +2154,7 @@ function WizardStepPlanSelection({
|
|
|
2154
2154
|
onSelectPrice: handleSelectPrice
|
|
2155
2155
|
}
|
|
2156
2156
|
),
|
|
2157
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex justify-end pt-4 border-t", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2157
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex justify-end pt-4 border-t", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { onClick: onNext, disabled: !selectedPrice || isProcessing, children: isProcessing ? "Loading..." : "Next: Review" }) })
|
|
2158
2158
|
] });
|
|
2159
2159
|
}
|
|
2160
2160
|
_chunk7QVYU63Ejs.__name.call(void 0, WizardStepPlanSelection, "WizardStepPlanSelection");
|
|
@@ -2215,7 +2215,7 @@ function PromoCodeInput({
|
|
|
2215
2215
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success text-sm", children: formatDiscount(appliedCode) })
|
|
2216
2216
|
] }),
|
|
2217
2217
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2218
|
-
|
|
2218
|
+
_chunk7HKJNUW7js.Button,
|
|
2219
2219
|
{
|
|
2220
2220
|
variant: "ghost",
|
|
2221
2221
|
size: "sm",
|
|
@@ -2232,7 +2232,7 @@ function PromoCodeInput({
|
|
|
2232
2232
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
2233
2233
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
|
|
2234
2234
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2235
|
-
|
|
2235
|
+
_chunk7HKJNUW7js.Input,
|
|
2236
2236
|
{
|
|
2237
2237
|
placeholder: "Enter promo code",
|
|
2238
2238
|
value: code,
|
|
@@ -2242,7 +2242,7 @@ function PromoCodeInput({
|
|
|
2242
2242
|
className: "flex-1"
|
|
2243
2243
|
}
|
|
2244
2244
|
),
|
|
2245
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2245
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { variant: "outline", onClick: handleApply, disabled: disabled || isValidating || !code.trim(), children: isValidating ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "h-4 w-4 animate-spin" }) : "Apply" })
|
|
2246
2246
|
] }),
|
|
2247
2247
|
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error })
|
|
2248
2248
|
] });
|
|
@@ -2314,7 +2314,7 @@ function WizardStepReview({
|
|
|
2314
2314
|
const discountDescription = getDiscountDescription();
|
|
2315
2315
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
2316
2316
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-muted/50 rounded-lg p-4 space-y-3", children: [
|
|
2317
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2317
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.SectionHeader, { children: "Selected Plan" }),
|
|
2318
2318
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between items-center", children: [
|
|
2319
2319
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
2320
2320
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-medium", children: _optionalChain([selectedPrice, 'access', _92 => _92.product, 'optionalAccess', _93 => _93.name]) }),
|
|
@@ -2324,7 +2324,7 @@ function WizardStepReview({
|
|
|
2324
2324
|
discountedPrice !== null ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2325
2325
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground line-through", children: formatCurrency(selectedPrice.unitAmount || 0, selectedPrice.currency) }),
|
|
2326
2326
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-success text-lg font-semibold", children: formatCurrency(discountedPrice, selectedPrice.currency) }),
|
|
2327
|
-
discountDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2327
|
+
discountDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Badge, { variant: "softGreen", children: discountDescription })
|
|
2328
2328
|
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-semibold text-lg", children: formatCurrency(selectedPrice.unitAmount || 0, selectedPrice.currency) }),
|
|
2329
2329
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: formatInterval2(selectedPrice) })
|
|
2330
2330
|
] })
|
|
@@ -2366,15 +2366,15 @@ function WizardStepReview({
|
|
|
2366
2366
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "font-medium", children: "Payment Method" }),
|
|
2367
2367
|
/* @__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" })
|
|
2368
2368
|
] }),
|
|
2369
|
-
!hasPaymentMethod && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2369
|
+
!hasPaymentMethod && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { variant: "outline", onClick: onAddPaymentMethod, children: "Add Payment Method" })
|
|
2370
2370
|
] }) }),
|
|
2371
|
-
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2371
|
+
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Alert, { variant: "destructive", children: [
|
|
2372
2372
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.AlertCircle, { className: "h-4 w-4" }),
|
|
2373
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2373
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.AlertDescription, { children: error })
|
|
2374
2374
|
] }),
|
|
2375
2375
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between pt-4 border-t", children: [
|
|
2376
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2377
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2376
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { variant: "outline", onClick: onBack, disabled: isProcessing, children: "Back" }),
|
|
2377
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { onClick: hasPaymentMethod ? onConfirm : onAddPaymentMethod, disabled: isProcessing, children: isProcessing ? "Processing..." : hasPaymentMethod ? isChangingPlan ? "Confirm Plan Change" : "Subscribe Now" : "Add Payment Method" })
|
|
2378
2378
|
] })
|
|
2379
2379
|
] });
|
|
2380
2380
|
}
|
|
@@ -2385,7 +2385,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, WizardStepReview, "WizardStepReview");
|
|
|
2385
2385
|
function WizardStepPaymentMethod({ onBack, onSuccess, isProcessing }) {
|
|
2386
2386
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
2387
2387
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
2388
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2388
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.SectionHeader, { children: "Add Payment Method" }),
|
|
2389
2389
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: "Enter your card details to complete your subscription" })
|
|
2390
2390
|
] }),
|
|
2391
2391
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodForm, { onSuccess, onCancel: onBack, isLoading: isProcessing })
|
|
@@ -2427,10 +2427,10 @@ function SubscriptionWizard({
|
|
|
2427
2427
|
const isChangePlanMode = !!subscription;
|
|
2428
2428
|
const dialogTitle = subscription ? "Change Subscription Plan" : isPurchasingAddons ? "Purchase Add-ons" : "Subscribe to a Plan";
|
|
2429
2429
|
const dialogDescription = subscription ? "Select a new plan for your subscription" : isPurchasingAddons ? "Select one-time products to purchase" : "Choose a subscription plan to get started";
|
|
2430
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2431
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2432
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2433
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2430
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.DialogContent, { className: "max-w-2xl", children: [
|
|
2431
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.DialogHeader, { children: [
|
|
2432
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.DialogTitle, { children: dialogTitle }),
|
|
2433
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.DialogDescription, { children: dialogDescription })
|
|
2434
2434
|
] }),
|
|
2435
2435
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, WizardProgressIndicator, { currentStep: state.step }),
|
|
2436
2436
|
state.step === "plan-selection" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -2513,15 +2513,15 @@ function UsageSummaryCard({ meter, summary }) {
|
|
|
2513
2513
|
const progressWidth = percentage !== null ? Math.min(percentage, 100) : 0;
|
|
2514
2514
|
const displayName = meter.displayName || meter.eventName;
|
|
2515
2515
|
const hasLimit = limit !== null && limit !== void 0;
|
|
2516
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2517
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2516
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Card, { children: [
|
|
2517
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.CardHeader, { className: "flex flex-row items-center gap-x-3 pb-3", children: [
|
|
2518
2518
|
/* @__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" }) }),
|
|
2519
2519
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col", children: [
|
|
2520
2520
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium", children: displayName }),
|
|
2521
2521
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-xs", children: meter.id })
|
|
2522
2522
|
] })
|
|
2523
2523
|
] }),
|
|
2524
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2524
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.CardContent, { className: "flex flex-col gap-y-4", children: [
|
|
2525
2525
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
2526
2526
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-3xl font-bold", children: currentUsage.toLocaleString() }),
|
|
2527
2527
|
hasLimit && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-muted-foreground text-sm", children: [
|
|
@@ -2568,14 +2568,14 @@ function UsageContainer() {
|
|
|
2568
2568
|
const loadUsageData = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2569
2569
|
setLoading(true);
|
|
2570
2570
|
try {
|
|
2571
|
-
const fetchedSubscriptions = await
|
|
2571
|
+
const fetchedSubscriptions = await _chunkRTOC53EZjs.StripeSubscriptionService.listSubscriptions();
|
|
2572
2572
|
setSubscriptions(fetchedSubscriptions);
|
|
2573
2573
|
const hasMeteredSubscriptions2 = fetchedSubscriptions.some((sub) => _optionalChain([sub, 'access', _99 => _99.price, 'optionalAccess', _100 => _100.recurring, 'optionalAccess', _101 => _101.usageType]) === "metered");
|
|
2574
2574
|
if (!hasMeteredSubscriptions2) {
|
|
2575
2575
|
setLoading(false);
|
|
2576
2576
|
return;
|
|
2577
2577
|
}
|
|
2578
|
-
const fetchedMeters = await
|
|
2578
|
+
const fetchedMeters = await _chunkRTOC53EZjs.StripeUsageService.listMeters();
|
|
2579
2579
|
setMeters(fetchedMeters);
|
|
2580
2580
|
const summariesMap = {};
|
|
2581
2581
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -2583,7 +2583,7 @@ function UsageContainer() {
|
|
|
2583
2583
|
const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
|
|
2584
2584
|
for (const meter of fetchedMeters) {
|
|
2585
2585
|
try {
|
|
2586
|
-
const meterSummaries = await
|
|
2586
|
+
const meterSummaries = await _chunkRTOC53EZjs.StripeUsageService.getMeterSummaries({
|
|
2587
2587
|
meterId: meter.id,
|
|
2588
2588
|
startTime: startOfMonth,
|
|
2589
2589
|
endTime: endOfMonth
|
|
@@ -2648,22 +2648,22 @@ function UsageHistoryTable({ usageRecords }) {
|
|
|
2648
2648
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rounded-lg border p-8 text-center", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground", children: "No usage history available." }) });
|
|
2649
2649
|
}
|
|
2650
2650
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
2651
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2652
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-clip rounded-lg border", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2653
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2654
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2655
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2656
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2657
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2651
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.SectionHeader, { level: 2, children: "Usage History" }),
|
|
2652
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-clip rounded-lg border", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Table, { children: [
|
|
2653
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.TableRow, { children: [
|
|
2654
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableHead, { children: "Date & Time" }),
|
|
2655
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableHead, { children: "Meter Event" }),
|
|
2656
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableHead, { className: "text-right", children: "Quantity" }),
|
|
2657
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableHead, { children: "Event ID" })
|
|
2658
2658
|
] }) }),
|
|
2659
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2659
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableBody, { children: usageRecords.map((record) => {
|
|
2660
2660
|
const dateTime = formatDateTime(record.timestamp);
|
|
2661
2661
|
const quantity = record.quantity.toLocaleString();
|
|
2662
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2663
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2664
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2665
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2666
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2662
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.TableRow, { children: [
|
|
2663
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableCell, { className: "font-medium", children: dateTime }),
|
|
2664
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableCell, { className: "text-muted-foreground", children: record.meterEventName }),
|
|
2665
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableCell, { className: "text-right font-medium", children: quantity }),
|
|
2666
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.TableCell, { className: "text-muted-foreground text-sm tabular-nums", children: record.stripeEventId })
|
|
2667
2667
|
] }, record.id);
|
|
2668
2668
|
}) })
|
|
2669
2669
|
] }) })
|
|
@@ -2674,8 +2674,8 @@ _chunk7QVYU63Ejs.__name.call(void 0, UsageHistoryTable, "UsageHistoryTable");
|
|
|
2674
2674
|
// src/features/billing/components/modals/BillingDetailModal.tsx
|
|
2675
2675
|
|
|
2676
2676
|
function BillingDetailModal({ open, onOpenChange, title, children, className }) {
|
|
2677
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2678
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2677
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.DialogContent, { className: _nullishCoalesce(className, () => ( "max-w-4xl max-h-[90vh] overflow-y-auto")), children: [
|
|
2678
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.DialogHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.DialogTitle, { children: title }) }),
|
|
2679
2679
|
children
|
|
2680
2680
|
] }) });
|
|
2681
2681
|
}
|
|
@@ -2692,7 +2692,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
|
|
|
2692
2692
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-destructive text-sm font-medium", children: "Payment Failed" }),
|
|
2693
2693
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive mt-1 text-sm", children: "Your last payment failed. Please update your payment method to avoid service interruption." })
|
|
2694
2694
|
] }),
|
|
2695
|
-
onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2695
|
+
onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { variant: "outline", size: "sm", onClick: onUpdatePayment, className: "text-destructive border-red-300", children: "Update Payment Method" })
|
|
2696
2696
|
] });
|
|
2697
2697
|
}
|
|
2698
2698
|
if (subscription.status === "trialing" /* TRIALING */ && subscription.trialEnd) {
|
|
@@ -2712,7 +2712,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
|
|
|
2712
2712
|
". Add a payment method to continue your subscription."
|
|
2713
2713
|
] })
|
|
2714
2714
|
] }),
|
|
2715
|
-
onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2715
|
+
onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { variant: "outline", size: "sm", onClick: onAddPayment, className: "text-warning border-yellow-300", children: "Add Payment Method" })
|
|
2716
2716
|
] });
|
|
2717
2717
|
}
|
|
2718
2718
|
}
|
|
@@ -2763,7 +2763,7 @@ function BillingDashboardContainer() {
|
|
|
2763
2763
|
setNoCustomerExists(false);
|
|
2764
2764
|
let customer = null;
|
|
2765
2765
|
try {
|
|
2766
|
-
customer = await
|
|
2766
|
+
customer = await _chunkRTOC53EZjs.StripeCustomerService.getCustomer();
|
|
2767
2767
|
setData((prev) => ({ ...prev, customer }));
|
|
2768
2768
|
setErrors((prev) => ({ ...prev, customer: null }));
|
|
2769
2769
|
setNoCustomerExists(false);
|
|
@@ -2789,7 +2789,7 @@ function BillingDashboardContainer() {
|
|
|
2789
2789
|
}
|
|
2790
2790
|
const fetchSubscriptions = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2791
2791
|
try {
|
|
2792
|
-
const subscriptions2 = await
|
|
2792
|
+
const subscriptions2 = await _chunkRTOC53EZjs.StripeSubscriptionService.listSubscriptions();
|
|
2793
2793
|
setData((prev) => ({ ...prev, subscriptions: subscriptions2 }));
|
|
2794
2794
|
setErrors((prev) => ({ ...prev, subscriptions: null }));
|
|
2795
2795
|
return subscriptions2;
|
|
@@ -2803,7 +2803,7 @@ function BillingDashboardContainer() {
|
|
|
2803
2803
|
}, "fetchSubscriptions");
|
|
2804
2804
|
const fetchPaymentMethods = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2805
2805
|
try {
|
|
2806
|
-
const paymentMethods = await
|
|
2806
|
+
const paymentMethods = await _chunkRTOC53EZjs.StripeCustomerService.listPaymentMethods();
|
|
2807
2807
|
setData((prev) => ({ ...prev, paymentMethods }));
|
|
2808
2808
|
setErrors((prev) => ({ ...prev, paymentMethods: null }));
|
|
2809
2809
|
} catch (error) {
|
|
@@ -2815,7 +2815,7 @@ function BillingDashboardContainer() {
|
|
|
2815
2815
|
}, "fetchPaymentMethods");
|
|
2816
2816
|
const fetchInvoices = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2817
2817
|
try {
|
|
2818
|
-
const invoices = await
|
|
2818
|
+
const invoices = await _chunkRTOC53EZjs.StripeInvoiceService.listInvoices();
|
|
2819
2819
|
setData((prev) => ({ ...prev, invoices }));
|
|
2820
2820
|
setErrors((prev) => ({ ...prev, invoices: null }));
|
|
2821
2821
|
} catch (error) {
|
|
@@ -2838,7 +2838,7 @@ function BillingDashboardContainer() {
|
|
|
2838
2838
|
const handleCreateCustomer = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2839
2839
|
setCreatingCustomer(true);
|
|
2840
2840
|
try {
|
|
2841
|
-
await
|
|
2841
|
+
await _chunkRTOC53EZjs.StripeCustomerService.createCustomer();
|
|
2842
2842
|
setNoCustomerExists(false);
|
|
2843
2843
|
await fetchAllData();
|
|
2844
2844
|
} catch (error) {
|
|
@@ -2850,7 +2850,7 @@ function BillingDashboardContainer() {
|
|
|
2850
2850
|
}, "handleCreateCustomer");
|
|
2851
2851
|
const fetchUsageData = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2852
2852
|
try {
|
|
2853
|
-
const meters = await
|
|
2853
|
+
const meters = await _chunkRTOC53EZjs.StripeUsageService.listMeters();
|
|
2854
2854
|
setData((prev) => ({ ...prev, meters }));
|
|
2855
2855
|
const summariesMap = {};
|
|
2856
2856
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -2858,7 +2858,7 @@ function BillingDashboardContainer() {
|
|
|
2858
2858
|
const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
|
|
2859
2859
|
for (const meter of meters) {
|
|
2860
2860
|
try {
|
|
2861
|
-
const meterSummaries = await
|
|
2861
|
+
const meterSummaries = await _chunkRTOC53EZjs.StripeUsageService.getMeterSummaries({
|
|
2862
2862
|
meterId: meter.id,
|
|
2863
2863
|
startTime: startOfMonth,
|
|
2864
2864
|
endTime: endOfMonth
|
|
@@ -2936,18 +2936,18 @@ function BillingDashboardContainer() {
|
|
|
2936
2936
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-8 w-8" }),
|
|
2937
2937
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: "Billing" })
|
|
2938
2938
|
] }),
|
|
2939
|
-
isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2940
|
-
noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2941
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2939
|
+
isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.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" }) }) }),
|
|
2940
|
+
noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Card, { children: [
|
|
2941
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.CardHeader, { className: "text-center", children: [
|
|
2942
2942
|
/* @__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" }) }),
|
|
2943
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2944
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2943
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardTitle, { children: "Set Up Billing" }),
|
|
2944
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardDescription, { children: "Your company doesn't have a billing account yet. Set one up to manage subscriptions, payment methods, and view invoices." })
|
|
2945
2945
|
] }),
|
|
2946
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2946
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardContent, { className: "flex justify-center pb-8", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { onClick: handleCreateCustomer, disabled: creatingCustomer, size: "lg", children: creatingCustomer ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2947
2947
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
2948
2948
|
"Setting up..."
|
|
2949
2949
|
] }) : "Set Up Billing Account" }) }),
|
|
2950
|
-
errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2950
|
+
errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CardContent, { className: "pt-0", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-center text-destructive text-xs/relaxed", children: errors.customer }) })
|
|
2951
2951
|
] }),
|
|
2952
2952
|
!noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2953
2953
|
criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -3089,7 +3089,7 @@ function getStripePromise(publishableKey) {
|
|
|
3089
3089
|
}
|
|
3090
3090
|
_chunk7QVYU63Ejs.__name.call(void 0, getStripePromise, "getStripePromise");
|
|
3091
3091
|
function StripeProvider({ children }) {
|
|
3092
|
-
const publishableKey =
|
|
3092
|
+
const publishableKey = _chunkOTEDZ6YWjs.getStripePublishableKey.call(void 0, );
|
|
3093
3093
|
const stripePromise = _react.useMemo.call(void 0, () => getStripePromise(publishableKey), [publishableKey]);
|
|
3094
3094
|
const options = _react.useMemo.call(void 0, () => ({}), []);
|
|
3095
3095
|
if (!publishableKey) {
|
|
@@ -3099,7 +3099,7 @@ function StripeProvider({ children }) {
|
|
|
3099
3099
|
}
|
|
3100
3100
|
_chunk7QVYU63Ejs.__name.call(void 0, StripeProvider, "StripeProvider");
|
|
3101
3101
|
function isStripeConfigured() {
|
|
3102
|
-
return !!
|
|
3102
|
+
return !!_chunkOTEDZ6YWjs.getStripePublishableKey.call(void 0, );
|
|
3103
3103
|
}
|
|
3104
3104
|
_chunk7QVYU63Ejs.__name.call(void 0, isStripeConfigured, "isStripeConfigured");
|
|
3105
3105
|
|
|
@@ -3133,14 +3133,14 @@ function ProductEditor({ product, open, onOpenChange, onSuccess }) {
|
|
|
3133
3133
|
setIsSubmitting(true);
|
|
3134
3134
|
try {
|
|
3135
3135
|
if (product) {
|
|
3136
|
-
await
|
|
3136
|
+
await _chunkRTOC53EZjs.StripeProductService.updateProduct({
|
|
3137
3137
|
id: product.id,
|
|
3138
3138
|
name: values.name,
|
|
3139
3139
|
description: values.description,
|
|
3140
3140
|
active: values.active
|
|
3141
3141
|
});
|
|
3142
3142
|
} else {
|
|
3143
|
-
await
|
|
3143
|
+
await _chunkRTOC53EZjs.StripeProductService.createProduct({
|
|
3144
3144
|
id: _uuid.v4.call(void 0, ),
|
|
3145
3145
|
name: values.name,
|
|
3146
3146
|
description: values.description,
|
|
@@ -3155,15 +3155,15 @@ function ProductEditor({ product, open, onOpenChange, onSuccess }) {
|
|
|
3155
3155
|
setIsSubmitting(false);
|
|
3156
3156
|
}
|
|
3157
3157
|
}, "onSubmit");
|
|
3158
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3159
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3160
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3161
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3158
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.DialogContent, { className: "max-w-2xl", children: [
|
|
3159
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.DialogHeader, { children: [
|
|
3160
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.DialogTitle, { children: product ? "Edit Product" : "Create Product" }),
|
|
3161
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.DialogDescription, { children: product ? `Update the details for ${product.name}` : "Create a new product to offer to your customers" })
|
|
3162
3162
|
] }),
|
|
3163
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3164
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3163
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-col gap-y-4", children: [
|
|
3164
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.FormInput, { form, id: "name", name: "Product Name", placeholder: "Enter product name", isRequired: true }),
|
|
3165
3165
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3166
|
-
|
|
3166
|
+
_chunk7HKJNUW7js.FormTextarea,
|
|
3167
3167
|
{
|
|
3168
3168
|
form,
|
|
3169
3169
|
id: "description",
|
|
@@ -3172,8 +3172,8 @@ function ProductEditor({ product, open, onOpenChange, onSuccess }) {
|
|
|
3172
3172
|
className: "min-h-32"
|
|
3173
3173
|
}
|
|
3174
3174
|
),
|
|
3175
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3176
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3175
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.FormCheckbox, { form, id: "active", name: "Active" }),
|
|
3176
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CommonEditorButtons, { isEdit: !!product, form, disabled: isSubmitting, setOpen: onOpenChange })
|
|
3177
3177
|
] }) })
|
|
3178
3178
|
] }) });
|
|
3179
3179
|
}
|
|
@@ -3184,16 +3184,16 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductEditor, "ProductEditor");
|
|
|
3184
3184
|
var BillingContext = _react.createContext.call(void 0, void 0);
|
|
3185
3185
|
var BillingProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ children }) => {
|
|
3186
3186
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
3187
|
-
const { hasRole } =
|
|
3187
|
+
const { hasRole } = _chunk7HKJNUW7js.useCurrentUserContext.call(void 0, );
|
|
3188
3188
|
const [showCreateProduct, setShowCreateProduct] = _react.useState.call(void 0, false);
|
|
3189
3189
|
const [refreshToken, setRefreshToken] = _react.useState.call(void 0, 0);
|
|
3190
3190
|
const refresh = _react.useCallback.call(void 0, () => setRefreshToken((value) => value + 1), []);
|
|
3191
3191
|
const breadcrumbs = [{ name: t(`billing.admin.products.title`) }];
|
|
3192
3192
|
const title = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
3193
3193
|
const response = { type: t(`billing.admin.products.title`) };
|
|
3194
|
-
if (hasRole(
|
|
3194
|
+
if (hasRole(_chunkOTEDZ6YWjs.getRoleId.call(void 0, ).Administrator)) {
|
|
3195
3195
|
response.functions = [
|
|
3196
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3196
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { onClick: () => setShowCreateProduct(true), children: t(`billing.admin.products.create`) }, "productEditorTrigger"),
|
|
3197
3197
|
showCreateProduct ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3198
3198
|
ProductEditor,
|
|
3199
3199
|
{
|
|
@@ -3210,7 +3210,7 @@ var BillingProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
3210
3210
|
}
|
|
3211
3211
|
return response;
|
|
3212
3212
|
}, "title");
|
|
3213
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3213
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.SharedProvider, { value: { breadcrumbs, title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BillingContext.Provider, { value: { refreshToken, refresh }, children }) });
|
|
3214
3214
|
}, "BillingProvider");
|
|
3215
3215
|
var useBillingContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
3216
3216
|
const context = _react.useContext.call(void 0, BillingContext);
|
|
@@ -3235,7 +3235,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3235
3235
|
_react.useEffect.call(void 0, () => {
|
|
3236
3236
|
const fetchFeatures = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3237
3237
|
try {
|
|
3238
|
-
const features = await
|
|
3238
|
+
const features = await _chunkRTOC53EZjs.FeatureService.findMany({});
|
|
3239
3239
|
setAllFeatures(features);
|
|
3240
3240
|
} catch (error) {
|
|
3241
3241
|
console.error("[PriceEditor] Failed to fetch features:", error);
|
|
@@ -3313,7 +3313,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3313
3313
|
try {
|
|
3314
3314
|
const unitAmountInCents = Math.round(values.unitAmount * 100);
|
|
3315
3315
|
if (isEditMode) {
|
|
3316
|
-
await
|
|
3316
|
+
await _chunkRTOC53EZjs.StripePriceService.updatePrice({
|
|
3317
3317
|
id: price.id,
|
|
3318
3318
|
nickname: values.nickname || void 0,
|
|
3319
3319
|
description: values.description || void 0,
|
|
@@ -3355,7 +3355,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3355
3355
|
createInput.featureIds = values.featureIds;
|
|
3356
3356
|
}
|
|
3357
3357
|
}
|
|
3358
|
-
await
|
|
3358
|
+
await _chunkRTOC53EZjs.StripePriceService.createPrice(createInput);
|
|
3359
3359
|
}
|
|
3360
3360
|
onSuccess();
|
|
3361
3361
|
onOpenChange(false);
|
|
@@ -3381,10 +3381,10 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3381
3381
|
{ id: "licensed", text: "Licensed (per unit)" },
|
|
3382
3382
|
{ id: "metered", text: "Metered (usage-based)" }
|
|
3383
3383
|
];
|
|
3384
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3385
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3386
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3387
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3384
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.DialogContent, { className: "max-w-2xl", children: [
|
|
3385
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.DialogHeader, { children: [
|
|
3386
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.DialogTitle, { children: isEditMode ? "Edit Price" : "Create Price" }),
|
|
3387
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.DialogDescription, { children: isEditMode ? "Update the price details. Note: Only nickname and active status can be changed." : "Create a new price for this product" })
|
|
3388
3388
|
] }),
|
|
3389
3389
|
isEditMode && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-primary/10 border-primary/30 flex gap-x-3 rounded-lg border p-4", children: [
|
|
3390
3390
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.AlertCircle, { className: "text-primary mt-0.5 h-5 w-5 flex-shrink-0" }),
|
|
@@ -3393,10 +3393,10 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3393
3393
|
/* @__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." })
|
|
3394
3394
|
] })
|
|
3395
3395
|
] }),
|
|
3396
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3396
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-col gap-y-4", children: [
|
|
3397
3397
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
|
|
3398
3398
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3399
|
-
|
|
3399
|
+
_chunk7HKJNUW7js.FormInput,
|
|
3400
3400
|
{
|
|
3401
3401
|
form,
|
|
3402
3402
|
id: "unitAmount",
|
|
@@ -3406,10 +3406,10 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3406
3406
|
isRequired: true
|
|
3407
3407
|
}
|
|
3408
3408
|
),
|
|
3409
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3409
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.FormSelect, { form, id: "currency", name: "Currency", values: currencyOptions, disabled: isEditMode })
|
|
3410
3410
|
] }),
|
|
3411
3411
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3412
|
-
|
|
3412
|
+
_chunk7HKJNUW7js.FormSelect,
|
|
3413
3413
|
{
|
|
3414
3414
|
form,
|
|
3415
3415
|
id: "interval",
|
|
@@ -3420,7 +3420,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3420
3420
|
),
|
|
3421
3421
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
|
|
3422
3422
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3423
|
-
|
|
3423
|
+
_chunk7HKJNUW7js.FormInput,
|
|
3424
3424
|
{
|
|
3425
3425
|
form,
|
|
3426
3426
|
id: "intervalCount",
|
|
@@ -3431,7 +3431,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3431
3431
|
}
|
|
3432
3432
|
),
|
|
3433
3433
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3434
|
-
|
|
3434
|
+
_chunk7HKJNUW7js.FormSelect,
|
|
3435
3435
|
{
|
|
3436
3436
|
form,
|
|
3437
3437
|
id: "usageType",
|
|
@@ -3442,7 +3442,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3442
3442
|
)
|
|
3443
3443
|
] }),
|
|
3444
3444
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3445
|
-
|
|
3445
|
+
_chunk7HKJNUW7js.FormInput,
|
|
3446
3446
|
{
|
|
3447
3447
|
form,
|
|
3448
3448
|
id: "nickname",
|
|
@@ -3451,7 +3451,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3451
3451
|
}
|
|
3452
3452
|
),
|
|
3453
3453
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3454
|
-
|
|
3454
|
+
_chunk7HKJNUW7js.FormTextarea,
|
|
3455
3455
|
{
|
|
3456
3456
|
form,
|
|
3457
3457
|
id: "description",
|
|
@@ -3460,13 +3460,13 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3460
3460
|
className: "min-h-24"
|
|
3461
3461
|
}
|
|
3462
3462
|
),
|
|
3463
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3463
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.FormInput, { form, id: "token", name: "Token (optional)", placeholder: "Enter token value" }),
|
|
3464
3464
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
3465
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3465
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Label, { children: "Features (optional)" }),
|
|
3466
3466
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
3467
3467
|
form.watch("features").map((_, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
|
|
3468
3468
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3469
|
-
|
|
3469
|
+
_chunk7HKJNUW7js.Input,
|
|
3470
3470
|
{
|
|
3471
3471
|
...form.register(`features.${index}`),
|
|
3472
3472
|
placeholder: `Feature ${index + 1}`,
|
|
@@ -3474,7 +3474,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3474
3474
|
}
|
|
3475
3475
|
),
|
|
3476
3476
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3477
|
-
|
|
3477
|
+
_chunk7HKJNUW7js.Button,
|
|
3478
3478
|
{
|
|
3479
3479
|
type: "button",
|
|
3480
3480
|
variant: "outline",
|
|
@@ -3491,7 +3491,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3491
3491
|
)
|
|
3492
3492
|
] }, index)),
|
|
3493
3493
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3494
|
-
|
|
3494
|
+
_chunk7HKJNUW7js.Button,
|
|
3495
3495
|
{
|
|
3496
3496
|
type: "button",
|
|
3497
3497
|
variant: "outline",
|
|
@@ -3510,7 +3510,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3510
3510
|
] })
|
|
3511
3511
|
] }),
|
|
3512
3512
|
isRecurring && allFeatures.length > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
3513
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3513
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Label, { children: "Platform Features" }),
|
|
3514
3514
|
/* @__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) => {
|
|
3515
3515
|
const isCore = feature.isCore;
|
|
3516
3516
|
const isChecked = form.watch("featureIds").includes(feature.id);
|
|
@@ -3552,9 +3552,9 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3552
3552
|
] }, feature.id);
|
|
3553
3553
|
}) })
|
|
3554
3554
|
] }),
|
|
3555
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3555
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.FormCheckbox, { form, id: "active", name: "Active" }),
|
|
3556
3556
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3557
|
-
|
|
3557
|
+
_chunk7HKJNUW7js.FormCheckbox,
|
|
3558
3558
|
{
|
|
3559
3559
|
form,
|
|
3560
3560
|
id: "isTrial",
|
|
@@ -3562,7 +3562,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3562
3562
|
description: "Mark this as the trial subscription plan (only one price should be marked as trial)"
|
|
3563
3563
|
}
|
|
3564
3564
|
),
|
|
3565
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3565
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CommonEditorButtons, { isEdit: isEditMode, form, disabled: isSubmitting, setOpen: onOpenChange })
|
|
3566
3566
|
] }) })
|
|
3567
3567
|
] }) });
|
|
3568
3568
|
}
|
|
@@ -3584,7 +3584,7 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3584
3584
|
const loadPrices = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3585
3585
|
setLoading(true);
|
|
3586
3586
|
try {
|
|
3587
|
-
const fetchedPrices = await
|
|
3587
|
+
const fetchedPrices = await _chunkRTOC53EZjs.StripePriceService.listPrices({ productId });
|
|
3588
3588
|
setPrices(fetchedPrices);
|
|
3589
3589
|
} catch (error) {
|
|
3590
3590
|
console.error("[PricesList] Failed to load prices:", error);
|
|
@@ -3601,7 +3601,7 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3601
3601
|
}
|
|
3602
3602
|
setArchivingPriceId(priceToArchive.id);
|
|
3603
3603
|
try {
|
|
3604
|
-
await
|
|
3604
|
+
await _chunkRTOC53EZjs.StripePriceService.archivePrice({ id: priceToArchive.id });
|
|
3605
3605
|
setPriceToArchive(null);
|
|
3606
3606
|
await loadPrices();
|
|
3607
3607
|
onPricesChange();
|
|
@@ -3617,7 +3617,7 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3617
3617
|
}
|
|
3618
3618
|
setReactivatingPriceId(priceToReactivate.id);
|
|
3619
3619
|
try {
|
|
3620
|
-
await
|
|
3620
|
+
await _chunkRTOC53EZjs.StripePriceService.reactivatePrice({ id: priceToReactivate.id });
|
|
3621
3621
|
setPriceToReactivate(null);
|
|
3622
3622
|
await loadPrices();
|
|
3623
3623
|
onPricesChange();
|
|
@@ -3648,12 +3648,12 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3648
3648
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-4", children: [
|
|
3649
3649
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center justify-between mb-4", children: [
|
|
3650
3650
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "text-lg font-semibold", children: "Prices" }),
|
|
3651
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3651
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { size: "sm", onClick: () => setShowCreatePrice(true), children: "Add Price" })
|
|
3652
3652
|
] }),
|
|
3653
3653
|
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: [
|
|
3654
3654
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.DollarSign, { className: "text-muted-foreground h-12 w-12" }),
|
|
3655
3655
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-sm", children: "No prices yet. Add a price to enable subscriptions." }),
|
|
3656
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3656
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { size: "sm", onClick: () => setShowCreatePrice(true), children: "Add Price" })
|
|
3657
3657
|
] }),
|
|
3658
3658
|
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) => {
|
|
3659
3659
|
const isArchiving = archivingPriceId === price.id;
|
|
@@ -3662,9 +3662,9 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3662
3662
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-start justify-between mb-3", children: [
|
|
3663
3663
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.DollarSign, { className: "h-5 w-5 text-primary" }),
|
|
3664
3664
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-1", children: [
|
|
3665
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3665
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.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" }) }),
|
|
3666
3666
|
price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3667
|
-
|
|
3667
|
+
_chunk7HKJNUW7js.Button,
|
|
3668
3668
|
{
|
|
3669
3669
|
variant: "ghost",
|
|
3670
3670
|
size: "sm",
|
|
@@ -3674,7 +3674,7 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3674
3674
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Archive, { className: "h-4 w-4" })
|
|
3675
3675
|
}
|
|
3676
3676
|
) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3677
|
-
|
|
3677
|
+
_chunk7HKJNUW7js.Button,
|
|
3678
3678
|
{
|
|
3679
3679
|
variant: "ghost",
|
|
3680
3680
|
size: "sm",
|
|
@@ -3693,9 +3693,9 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3693
3693
|
] }) }),
|
|
3694
3694
|
_optionalChain([price, 'access', _162 => _162.metadata, 'optionalAccess', _163 => _163.nickname]) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm font-medium mb-2", children: price.metadata.nickname }),
|
|
3695
3695
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2", children: [
|
|
3696
|
-
price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3697
|
-
_optionalChain([price, 'access', _164 => _164.recurring, 'optionalAccess', _165 => _165.usageType]) === "metered" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3698
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3696
|
+
price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Badge, { variant: "softGreen", children: "Active" }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Badge, { variant: "softGray", children: "Inactive" }),
|
|
3697
|
+
_optionalChain([price, 'access', _164 => _164.recurring, 'optionalAccess', _165 => _165.usageType]) === "metered" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Badge, { variant: "softBlue", children: "Metered" }),
|
|
3698
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Badge, { variant: "softGray", className: "uppercase", children: price.currency })
|
|
3699
3699
|
] })
|
|
3700
3700
|
] }, price.id);
|
|
3701
3701
|
}) }),
|
|
@@ -3725,20 +3725,20 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3725
3725
|
}
|
|
3726
3726
|
}
|
|
3727
3727
|
),
|
|
3728
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3729
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3730
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3731
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3728
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.AlertDialog, { open: !!priceToArchive, onOpenChange: (open) => !open && setPriceToArchive(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.AlertDialogContent, { children: [
|
|
3729
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.AlertDialogHeader, { children: [
|
|
3730
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.AlertDialogTitle, { children: "Archive Price" }),
|
|
3731
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.AlertDialogDescription, { children: [
|
|
3732
3732
|
"Are you sure you want to archive the price for",
|
|
3733
3733
|
" ",
|
|
3734
3734
|
priceToArchive && `${formatCurrency(priceToArchive.unitAmount, priceToArchive.currency)} ${formatInterval2(priceToArchive)}`,
|
|
3735
3735
|
"? This will prevent new subscriptions but existing ones will continue."
|
|
3736
3736
|
] })
|
|
3737
3737
|
] }),
|
|
3738
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3739
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3738
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.AlertDialogFooter, { children: [
|
|
3739
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.AlertDialogCancel, { disabled: !!archivingPriceId, children: "Cancel" }),
|
|
3740
3740
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3741
|
-
|
|
3741
|
+
_chunk7HKJNUW7js.AlertDialogAction,
|
|
3742
3742
|
{
|
|
3743
3743
|
onClick: handleArchive,
|
|
3744
3744
|
disabled: !!archivingPriceId,
|
|
@@ -3748,20 +3748,20 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3748
3748
|
)
|
|
3749
3749
|
] })
|
|
3750
3750
|
] }) }),
|
|
3751
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3752
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3753
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3754
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3751
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.AlertDialog, { open: !!priceToReactivate, onOpenChange: (open) => !open && setPriceToReactivate(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.AlertDialogContent, { children: [
|
|
3752
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.AlertDialogHeader, { children: [
|
|
3753
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.AlertDialogTitle, { children: "Reactivate Price" }),
|
|
3754
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.AlertDialogDescription, { children: [
|
|
3755
3755
|
"Are you sure you want to reactivate the price for",
|
|
3756
3756
|
" ",
|
|
3757
3757
|
priceToReactivate && `${formatCurrency(priceToReactivate.unitAmount, priceToReactivate.currency)} ${formatInterval2(priceToReactivate)}`,
|
|
3758
3758
|
"? This will allow new subscriptions again."
|
|
3759
3759
|
] })
|
|
3760
3760
|
] }),
|
|
3761
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3762
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3761
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.AlertDialogFooter, { children: [
|
|
3762
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.AlertDialogCancel, { disabled: !!reactivatingPriceId, children: "Cancel" }),
|
|
3763
3763
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3764
|
-
|
|
3764
|
+
_chunk7HKJNUW7js.AlertDialogAction,
|
|
3765
3765
|
{
|
|
3766
3766
|
onClick: handleReactivate,
|
|
3767
3767
|
disabled: !!reactivatingPriceId,
|
|
@@ -3796,7 +3796,7 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3796
3796
|
}
|
|
3797
3797
|
setArchivingProductId(productToArchive.id);
|
|
3798
3798
|
try {
|
|
3799
|
-
const _archivedProduct = await
|
|
3799
|
+
const _archivedProduct = await _chunkRTOC53EZjs.StripeProductService.archiveProduct({ id: productToArchive.id });
|
|
3800
3800
|
setProductToArchive(null);
|
|
3801
3801
|
onProductsChange();
|
|
3802
3802
|
} catch (_error) {
|
|
@@ -3811,7 +3811,7 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3811
3811
|
}
|
|
3812
3812
|
setReactivatingProductId(productToReactivate.id);
|
|
3813
3813
|
try {
|
|
3814
|
-
const _reactivatedProduct = await
|
|
3814
|
+
const _reactivatedProduct = await _chunkRTOC53EZjs.StripeProductService.reactivateProduct({ id: productToReactivate.id });
|
|
3815
3815
|
setProductToReactivate(null);
|
|
3816
3816
|
onProductsChange();
|
|
3817
3817
|
} catch (_error) {
|
|
@@ -3834,18 +3834,18 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3834
3834
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex-1", children: [
|
|
3835
3835
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
3836
3836
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium", children: product.name }),
|
|
3837
|
-
product.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3837
|
+
product.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Badge, { variant: "softGreen", children: "Active" }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Badge, { variant: "softGray", children: "Inactive" })
|
|
3838
3838
|
] }),
|
|
3839
3839
|
product.description && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-sm mt-1", children: product.description })
|
|
3840
3840
|
] })
|
|
3841
3841
|
] }),
|
|
3842
3842
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
3843
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3843
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.Button, { variant: "outline", size: "sm", onClick: () => setEditingProduct(product), children: [
|
|
3844
3844
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Edit, { className: "h-4 w-4 mr-1" }),
|
|
3845
3845
|
"Edit"
|
|
3846
3846
|
] }),
|
|
3847
3847
|
product.active ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3848
|
-
|
|
3848
|
+
_chunk7HKJNUW7js.Button,
|
|
3849
3849
|
{
|
|
3850
3850
|
variant: "outline",
|
|
3851
3851
|
size: "sm",
|
|
@@ -3857,7 +3857,7 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3857
3857
|
]
|
|
3858
3858
|
}
|
|
3859
3859
|
) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3860
|
-
|
|
3860
|
+
_chunk7HKJNUW7js.Button,
|
|
3861
3861
|
{
|
|
3862
3862
|
variant: "outline",
|
|
3863
3863
|
size: "sm",
|
|
@@ -3869,7 +3869,7 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3869
3869
|
]
|
|
3870
3870
|
}
|
|
3871
3871
|
),
|
|
3872
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3872
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.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" }) })
|
|
3873
3873
|
] })
|
|
3874
3874
|
] }),
|
|
3875
3875
|
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 }) })
|
|
@@ -3887,19 +3887,19 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3887
3887
|
}
|
|
3888
3888
|
}
|
|
3889
3889
|
),
|
|
3890
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3891
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3892
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3893
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3890
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.AlertDialog, { open: !!productToArchive, onOpenChange: (open) => !open && setProductToArchive(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.AlertDialogContent, { children: [
|
|
3891
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.AlertDialogHeader, { children: [
|
|
3892
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.AlertDialogTitle, { children: "Archive Product" }),
|
|
3893
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.AlertDialogDescription, { children: [
|
|
3894
3894
|
'Are you sure you want to archive "',
|
|
3895
3895
|
_optionalChain([productToArchive, 'optionalAccess', _166 => _166.name]),
|
|
3896
3896
|
'"? This will deactivate it and it will no longer be available for new subscriptions.'
|
|
3897
3897
|
] })
|
|
3898
3898
|
] }),
|
|
3899
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3900
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3899
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.AlertDialogFooter, { children: [
|
|
3900
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.AlertDialogCancel, { disabled: !!archivingProductId, children: "Cancel" }),
|
|
3901
3901
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3902
|
-
|
|
3902
|
+
_chunk7HKJNUW7js.AlertDialogAction,
|
|
3903
3903
|
{
|
|
3904
3904
|
onClick: handleArchive,
|
|
3905
3905
|
disabled: !!archivingProductId,
|
|
@@ -3909,19 +3909,19 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3909
3909
|
)
|
|
3910
3910
|
] })
|
|
3911
3911
|
] }) }),
|
|
3912
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3913
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3914
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3915
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3912
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.AlertDialog, { open: !!productToReactivate, onOpenChange: (open) => !open && setProductToReactivate(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.AlertDialogContent, { children: [
|
|
3913
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.AlertDialogHeader, { children: [
|
|
3914
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.AlertDialogTitle, { children: "Reactivate Product" }),
|
|
3915
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.AlertDialogDescription, { children: [
|
|
3916
3916
|
'Are you sure you want to reactivate "',
|
|
3917
3917
|
_optionalChain([productToReactivate, 'optionalAccess', _167 => _167.name]),
|
|
3918
3918
|
'"? This will make it available for new subscriptions again.'
|
|
3919
3919
|
] })
|
|
3920
3920
|
] }),
|
|
3921
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3922
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3921
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.AlertDialogFooter, { children: [
|
|
3922
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.AlertDialogCancel, { disabled: !!reactivatingProductId, children: "Cancel" }),
|
|
3923
3923
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3924
|
-
|
|
3924
|
+
_chunk7HKJNUW7js.AlertDialogAction,
|
|
3925
3925
|
{
|
|
3926
3926
|
onClick: handleReactivate,
|
|
3927
3927
|
disabled: !!reactivatingProductId,
|
|
@@ -3938,18 +3938,18 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductsList, "ProductsList");
|
|
|
3938
3938
|
// src/features/billing/stripe-product/components/containers/ProductsAdminContainer.tsx
|
|
3939
3939
|
|
|
3940
3940
|
function ProductsAdminContainer() {
|
|
3941
|
-
const { hasRole } =
|
|
3941
|
+
const { hasRole } = _chunk7HKJNUW7js.useCurrentUserContext.call(void 0, );
|
|
3942
3942
|
const billing = useOptionalBillingContext();
|
|
3943
3943
|
const [products, setProducts] = _react.useState.call(void 0, []);
|
|
3944
3944
|
const [loading, setLoading] = _react.useState.call(void 0, true);
|
|
3945
3945
|
const [showCreateProduct, setShowCreateProduct] = _react.useState.call(void 0, false);
|
|
3946
|
-
if (!hasRole(
|
|
3946
|
+
if (!hasRole(_chunkOTEDZ6YWjs.getRoleId.call(void 0, ).Administrator)) {
|
|
3947
3947
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex h-64 items-center justify-center", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: "Permission denied. Administrator access required." }) });
|
|
3948
3948
|
}
|
|
3949
3949
|
const loadProducts = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3950
3950
|
setLoading(true);
|
|
3951
3951
|
try {
|
|
3952
|
-
const fetchedProducts = await
|
|
3952
|
+
const fetchedProducts = await _chunkRTOC53EZjs.StripeProductService.listProducts();
|
|
3953
3953
|
setProducts(fetchedProducts);
|
|
3954
3954
|
} catch (error) {
|
|
3955
3955
|
console.error("[ProductsAdminContainer] Failed to load products:", error);
|
|
@@ -3964,14 +3964,14 @@ function ProductsAdminContainer() {
|
|
|
3964
3964
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex h-64 items-center justify-center", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground", children: "Loading products..." }) });
|
|
3965
3965
|
}
|
|
3966
3966
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col", children: [
|
|
3967
|
-
!billing && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex w-full items-center justify-end px-4 pt-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3967
|
+
!billing && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex w-full items-center justify-end px-4 pt-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { onClick: () => setShowCreateProduct(true), children: "Create Product" }) }),
|
|
3968
3968
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-6 px-4 pb-4", children: [
|
|
3969
3969
|
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: [
|
|
3970
3970
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Package, { className: "text-muted-foreground h-16 w-16" }),
|
|
3971
3971
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
3972
3972
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "mb-2 text-sm font-medium", children: "No products yet" }),
|
|
3973
3973
|
/* @__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." }),
|
|
3974
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3974
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { onClick: () => setShowCreateProduct(true), children: "Create Your First Product" })
|
|
3975
3975
|
] })
|
|
3976
3976
|
] }),
|
|
3977
3977
|
products.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductsList, { products, onProductsChange: loadProducts }),
|
|
@@ -3984,7 +3984,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductsAdminContainer, "ProductsAdminConta
|
|
|
3984
3984
|
// src/features/billing/stripe-product/components/containers/ProductsAdminPageContainer.tsx
|
|
3985
3985
|
|
|
3986
3986
|
function ProductsAdminPageContainer() {
|
|
3987
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BillingProvider, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3987
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BillingProvider, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.RoundPageContainer, { module: _chunkRTOC53EZjs.Modules.StripeProduct, fullWidth: true, forceHeader: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductsAdminContainer, {}) }) });
|
|
3988
3988
|
}
|
|
3989
3989
|
_chunk7QVYU63Ejs.__name.call(void 0, ProductsAdminPageContainer, "ProductsAdminPageContainer");
|
|
3990
3990
|
|