@carlonicora/nextjs-jsonapi 2.2.3 → 2.4.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-QTIDATPF.js → BlockNoteEditor-7WGCH2KB.js} +27 -26
- package/dist/BlockNoteEditor-7WGCH2KB.js.map +1 -0
- package/dist/{BlockNoteEditor-ADT6II2V.mjs → BlockNoteEditor-GWAV5ESO.mjs} +12 -11
- package/dist/BlockNoteEditor-GWAV5ESO.mjs.map +1 -0
- package/dist/billing/index.d.mts +40 -1
- package/dist/billing/index.d.ts +40 -1
- package/dist/billing/index.js +519 -462
- package/dist/billing/index.js.map +1 -1
- package/dist/billing/index.mjs +298 -241
- package/dist/billing/index.mjs.map +1 -1
- package/dist/{chunk-7DJOQTNN.mjs → chunk-3LVSA7IM.mjs} +2 -2
- package/dist/{chunk-F3BPNQDB.js → chunk-GYGMEDVS.js} +1135 -952
- package/dist/chunk-GYGMEDVS.js.map +1 -0
- package/dist/{chunk-DLTMYGLR.mjs → chunk-LCCRUWWY.mjs} +13 -1
- package/dist/chunk-LCCRUWWY.mjs.map +1 -0
- package/dist/{chunk-YEPE2HT6.mjs → chunk-M2EGUO2F.mjs} +2538 -2355
- package/dist/chunk-M2EGUO2F.mjs.map +1 -0
- package/dist/{chunk-LANOKEFZ.js → chunk-TOKHHZSP.js} +7 -7
- package/dist/{chunk-LANOKEFZ.js.map → chunk-TOKHHZSP.js.map} +1 -1
- package/dist/{chunk-KSU6CCW6.js → chunk-V66AZWPG.js} +14 -2
- package/dist/chunk-V66AZWPG.js.map +1 -0
- package/dist/client/index.d.mts +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.js +4 -4
- package/dist/client/index.mjs +3 -3
- package/dist/components/index.d.mts +129 -4
- package/dist/components/index.d.ts +129 -4
- package/dist/components/index.js +16 -4
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +15 -3
- package/dist/{content.fields-xH3TGvVk.d.mts → content.fields-1AlHDtDb.d.mts} +1 -0
- package/dist/{content.fields-xH3TGvVk.d.ts → content.fields-1AlHDtDb.d.ts} +1 -0
- package/dist/contexts/index.d.mts +22 -1
- package/dist/contexts/index.d.ts +22 -1
- package/dist/contexts/index.js +8 -4
- package/dist/contexts/index.js.map +1 -1
- package/dist/contexts/index.mjs +7 -3
- package/dist/core/index.d.mts +12 -2
- package/dist/core/index.d.ts +12 -2
- package/dist/core/index.js +4 -2
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +3 -1
- package/dist/features/help/index.js +37 -37
- package/dist/features/help/index.mjs +3 -3
- package/dist/features/tokenusage/index.js +71 -71
- package/dist/features/tokenusage/index.mjs +3 -3
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -2
- package/dist/server/index.js +3 -3
- package/dist/server/index.mjs +1 -1
- package/package.json +1 -1
- package/src/billing/index.ts +1 -0
- package/src/components/editors/BlockNoteEditor.tsx +12 -6
- package/src/components/index.ts +1 -0
- package/src/contexts/index.ts +1 -0
- package/src/features/administration/components/AdminIndexContainer.tsx +150 -0
- package/src/features/administration/components/__tests__/AdminIndexContainer.spec.tsx +96 -0
- package/src/features/administration/components/index.ts +1 -0
- package/src/features/administration/contexts/AdministrationContext.tsx +47 -0
- package/src/features/administration/contexts/index.ts +1 -0
- package/src/features/administration/data/admin-section.types.ts +30 -0
- package/src/features/administration/i18n-keys.ts +26 -0
- package/src/features/administration/index.ts +3 -0
- package/src/features/assistant/components/containers/AssistantPageContainer.tsx +8 -1
- package/src/features/billing/contexts/BillingContext.tsx +95 -0
- package/src/features/billing/contexts/index.ts +1 -0
- package/src/features/billing/index.ts +1 -0
- package/src/features/billing/stripe-product/components/containers/ProductsAdminContainer.tsx +39 -27
- package/src/features/billing/stripe-product/components/containers/ProductsAdminPageContainer.tsx +27 -0
- package/src/features/billing/stripe-product/components/containers/index.ts +1 -0
- package/src/features/company/components/containers/CompaniesListContainer.tsx +25 -0
- package/src/features/company/components/containers/index.ts +1 -0
- package/src/features/company/components/lists/CompaniesList.tsx +12 -1
- package/src/features/company/contexts/CompanyContext.tsx +13 -1
- package/src/features/company/data/entity-ai-status.ts +13 -0
- package/src/features/company/data/index.ts +1 -0
- package/src/features/user/components/containers/PlatformUsersContainer.tsx +23 -0
- package/src/features/user/components/containers/index.ts +1 -0
- package/src/features/user/components/lists/PlatformUsersList.tsx +45 -0
- package/src/features/user/components/lists/index.ts +1 -0
- package/src/features/user/data/user.fields.ts +1 -0
- package/src/features/user/hooks/useUserTableStructure.tsx +17 -0
- package/dist/BlockNoteEditor-ADT6II2V.mjs.map +0 -1
- package/dist/BlockNoteEditor-QTIDATPF.js.map +0 -1
- package/dist/chunk-DLTMYGLR.mjs.map +0 -1
- package/dist/chunk-F3BPNQDB.js.map +0 -1
- package/dist/chunk-KSU6CCW6.js.map +0 -1
- package/dist/chunk-YEPE2HT6.mjs.map +0 -1
- /package/dist/{chunk-7DJOQTNN.mjs.map → chunk-3LVSA7IM.mjs.map} +0 -0
package/dist/billing/index.js
CHANGED
|
@@ -48,13 +48,13 @@
|
|
|
48
48
|
|
|
49
49
|
|
|
50
50
|
|
|
51
|
-
var _chunkF3BPNQDBjs = require('../chunk-F3BPNQDB.js');
|
|
52
51
|
|
|
53
52
|
|
|
53
|
+
var _chunkGYGMEDVSjs = require('../chunk-GYGMEDVS.js');
|
|
54
54
|
|
|
55
|
-
var _chunkLANOKEFZjs = require('../chunk-LANOKEFZ.js');
|
|
56
55
|
|
|
57
56
|
|
|
57
|
+
var _chunkTOKHHZSPjs = require('../chunk-TOKHHZSP.js');
|
|
58
58
|
|
|
59
59
|
|
|
60
60
|
|
|
@@ -63,7 +63,10 @@ var _chunkLANOKEFZjs = require('../chunk-LANOKEFZ.js');
|
|
|
63
63
|
|
|
64
64
|
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
var _chunkV66AZWPGjs = require('../chunk-V66AZWPG.js');
|
|
67
70
|
require('../chunk-LXKSUWAV.js');
|
|
68
71
|
require('../chunk-IBS6NI7D.js');
|
|
69
72
|
require('../chunk-FPO4DLZN.js');
|
|
@@ -114,41 +117,41 @@ function SubscriptionSummaryCard({
|
|
|
114
117
|
onManageClick
|
|
115
118
|
}) {
|
|
116
119
|
if (loading) {
|
|
117
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
118
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
119
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
120
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.Card, { children: [
|
|
121
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
122
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.CardTitle, { children: "Subscriptions" }),
|
|
120
123
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
121
124
|
] }),
|
|
122
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
123
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
124
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
125
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
125
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.CardContent, { children: [
|
|
126
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
127
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Skeleton, { className: "h-4 w-24 mb-1" }),
|
|
128
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Skeleton, { className: "h-4 w-40" })
|
|
126
129
|
] })
|
|
127
130
|
] });
|
|
128
131
|
}
|
|
129
132
|
if (error) {
|
|
130
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
131
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
132
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
133
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.Card, { children: [
|
|
134
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
135
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.CardTitle, { children: "Subscriptions" }),
|
|
133
136
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
134
137
|
] }),
|
|
135
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
138
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
136
139
|
] });
|
|
137
140
|
}
|
|
138
141
|
const activeSubscriptions = subscriptions.filter(
|
|
139
142
|
(sub) => sub.status === "active" /* ACTIVE */ || sub.status === "trialing" /* TRIALING */
|
|
140
143
|
);
|
|
141
144
|
const primarySubscription = activeSubscriptions[0];
|
|
142
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
143
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
144
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
145
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
|
|
146
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
147
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.CardTitle, { children: "Subscriptions" }),
|
|
145
148
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
146
149
|
] }),
|
|
147
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
150
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.CardContent, { children: subscriptions.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
148
151
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No active plan" }),
|
|
149
152
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Subscribe to get started" }),
|
|
150
153
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
151
|
-
|
|
154
|
+
_chunkGYGMEDVSjs.Button,
|
|
152
155
|
{
|
|
153
156
|
variant: "outline",
|
|
154
157
|
size: "sm",
|
|
@@ -167,7 +170,7 @@ function SubscriptionSummaryCard({
|
|
|
167
170
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
168
171
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: formatPlanName(primarySubscription) }),
|
|
169
172
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
170
|
-
|
|
173
|
+
_chunkGYGMEDVSjs.Badge,
|
|
171
174
|
{
|
|
172
175
|
variant: primarySubscription.cancelAtPeriodEnd ? "secondary" : getStatusBadgeVariant(primarySubscription.status),
|
|
173
176
|
children: primarySubscription.cancelAtPeriodEnd ? "Canceling" : primarySubscription.status
|
|
@@ -209,37 +212,37 @@ function PaymentMethodSummaryCard({
|
|
|
209
212
|
onManageClick
|
|
210
213
|
}) {
|
|
211
214
|
if (loading) {
|
|
212
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
213
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
214
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
215
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.Card, { children: [
|
|
216
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
217
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.CardTitle, { children: "Payment Method" }),
|
|
215
218
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
216
219
|
] }),
|
|
217
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
218
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
219
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
220
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.CardContent, { children: [
|
|
221
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
222
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Skeleton, { className: "h-4 w-24" })
|
|
220
223
|
] })
|
|
221
224
|
] });
|
|
222
225
|
}
|
|
223
226
|
if (error) {
|
|
224
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
225
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
226
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
227
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.Card, { children: [
|
|
228
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
229
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.CardTitle, { children: "Payment Method" }),
|
|
227
230
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
228
231
|
] }),
|
|
229
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
232
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
230
233
|
] });
|
|
231
234
|
}
|
|
232
235
|
const defaultMethod = paymentMethods.find((pm) => pm.id === defaultPaymentMethodId) || paymentMethods[0];
|
|
233
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
234
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
235
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
236
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
|
|
237
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
238
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.CardTitle, { children: "Payment Method" }),
|
|
236
239
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
237
240
|
] }),
|
|
238
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
241
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.CardContent, { children: paymentMethods.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
239
242
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No payment method" }),
|
|
240
243
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Add a card to enable subscriptions" }),
|
|
241
244
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
242
|
-
|
|
245
|
+
_chunkGYGMEDVSjs.Button,
|
|
243
246
|
{
|
|
244
247
|
variant: "outline",
|
|
245
248
|
size: "sm",
|
|
@@ -303,7 +306,7 @@ function CustomerInfoCard({ customer, loading, error }) {
|
|
|
303
306
|
e.stopPropagation();
|
|
304
307
|
setPortalLoading(true);
|
|
305
308
|
try {
|
|
306
|
-
const { url } = await
|
|
309
|
+
const { url } = await _chunkV66AZWPGjs.StripeCustomerService.createPortalSession();
|
|
307
310
|
window.open(url, "_blank");
|
|
308
311
|
} catch (err) {
|
|
309
312
|
console.error("[CustomerInfoCard] Failed to create portal session:", err);
|
|
@@ -312,52 +315,52 @@ function CustomerInfoCard({ customer, loading, error }) {
|
|
|
312
315
|
}
|
|
313
316
|
}, "handlePortalClick");
|
|
314
317
|
if (loading) {
|
|
315
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
316
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
317
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
318
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.Card, { children: [
|
|
319
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
320
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.CardTitle, { children: "Billing Account" }),
|
|
318
321
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
319
322
|
] }),
|
|
320
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
321
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
322
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
323
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
323
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.CardContent, { children: [
|
|
324
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
325
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Skeleton, { className: "h-4 w-48 mb-1" }),
|
|
326
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Skeleton, { className: "h-4 w-24" })
|
|
324
327
|
] })
|
|
325
328
|
] });
|
|
326
329
|
}
|
|
327
330
|
if (error) {
|
|
328
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
329
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
330
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
331
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.Card, { children: [
|
|
332
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
333
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.CardTitle, { children: "Billing Account" }),
|
|
331
334
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
332
335
|
] }),
|
|
333
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
336
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
334
337
|
] });
|
|
335
338
|
}
|
|
336
339
|
if (!customer) {
|
|
337
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
338
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
339
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
340
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.Card, { children: [
|
|
341
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
342
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.CardTitle, { children: "Billing Account" }),
|
|
340
343
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
341
344
|
] }),
|
|
342
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
345
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.CardContent, { children: [
|
|
343
346
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "Not set up" }),
|
|
344
347
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Billing account will be created when you subscribe" })
|
|
345
348
|
] })
|
|
346
349
|
] });
|
|
347
350
|
}
|
|
348
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
349
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
350
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
351
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.Card, { children: [
|
|
352
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
353
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.CardTitle, { children: "Billing Account" }),
|
|
351
354
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
352
355
|
] }),
|
|
353
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
356
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
354
357
|
customer.name && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: customer.name }),
|
|
355
358
|
customer.email && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: customer.email }),
|
|
356
359
|
customer.balance !== void 0 && customer.balance !== 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm", children: [
|
|
357
360
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground", children: "Credit Balance: " }),
|
|
358
361
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: customer.balance < 0 ? "text-success" : "text-destructive", children: formatBalance(customer.balance, customer.currency) })
|
|
359
362
|
] }),
|
|
360
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
363
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.Button, { variant: "outline", size: "sm", className: "mt-2", onClick: handlePortalClick, disabled: portalLoading, children: [
|
|
361
364
|
portalLoading ? "Loading..." : "Manage in Stripe Portal",
|
|
362
365
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ExternalLink, { className: "h-4 w-4 ml-1" })
|
|
363
366
|
] })
|
|
@@ -401,42 +404,42 @@ function formatAmount(amount, currency) {
|
|
|
401
404
|
_chunk7QVYU63Ejs.__name.call(void 0, formatAmount, "formatAmount");
|
|
402
405
|
function InvoicesSummaryCard({ invoices, loading, error, onViewAllClick }) {
|
|
403
406
|
if (loading) {
|
|
404
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
405
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
406
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
407
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.Card, { children: [
|
|
408
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
409
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.CardTitle, { children: "Recent Invoices" }),
|
|
407
410
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
408
411
|
] }),
|
|
409
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
410
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
411
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
412
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
412
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.CardContent, { children: [
|
|
413
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Skeleton, { className: "h-6 w-24 mb-2" }),
|
|
414
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Skeleton, { className: "h-4 w-32 mb-1" }),
|
|
415
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Skeleton, { className: "h-4 w-20" })
|
|
413
416
|
] })
|
|
414
417
|
] });
|
|
415
418
|
}
|
|
416
419
|
if (error) {
|
|
417
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
418
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
419
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
420
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.Card, { children: [
|
|
421
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
422
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.CardTitle, { children: "Recent Invoices" }),
|
|
420
423
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
421
424
|
] }),
|
|
422
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
425
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
423
426
|
] });
|
|
424
427
|
}
|
|
425
428
|
const latestInvoice = invoices[0];
|
|
426
429
|
const paidInvoices = invoices.filter((inv) => inv.status === "paid" /* PAID */);
|
|
427
430
|
const openInvoices = invoices.filter((inv) => inv.status === "open" /* OPEN */);
|
|
428
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
429
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
430
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
431
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewAllClick, children: [
|
|
432
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
433
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.CardTitle, { children: "Recent Invoices" }),
|
|
431
434
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
432
435
|
] }),
|
|
433
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
436
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.CardContent, { children: invoices.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
434
437
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No invoices yet" }),
|
|
435
438
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Invoices will appear after your first billing cycle" })
|
|
436
439
|
] }) : latestInvoice ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
437
440
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
438
441
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: formatAmount(latestInvoice.total, latestInvoice.currency) }),
|
|
439
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
442
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Badge, { variant: getStatusBadgeVariant2(latestInvoice.status), children: latestInvoice.status })
|
|
440
443
|
] }),
|
|
441
444
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: latestInvoice.stripeInvoiceNumber || `Invoice from ${formatDate2(latestInvoice.periodStart)}` }),
|
|
442
445
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-4 text-xs text-muted-foreground", children: [
|
|
@@ -476,24 +479,24 @@ function BillingUsageSummaryCard({
|
|
|
476
479
|
onViewDetailsClick
|
|
477
480
|
}) {
|
|
478
481
|
if (loading) {
|
|
479
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
480
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
481
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
482
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.Card, { children: [
|
|
483
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
484
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.CardTitle, { children: "Usage This Month" }),
|
|
482
485
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
483
486
|
] }),
|
|
484
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
485
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
486
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
487
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.CardContent, { children: [
|
|
488
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Skeleton, { className: "h-6 w-24 mb-2" }),
|
|
489
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Skeleton, { className: "h-4 w-32" })
|
|
487
490
|
] })
|
|
488
491
|
] });
|
|
489
492
|
}
|
|
490
493
|
if (error) {
|
|
491
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
492
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
493
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
494
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.Card, { children: [
|
|
495
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
496
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.CardTitle, { children: "Usage This Month" }),
|
|
494
497
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
495
498
|
] }),
|
|
496
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
499
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
497
500
|
] });
|
|
498
501
|
}
|
|
499
502
|
const totalUsage = Object.values(summaries).reduce((acc, summary) => {
|
|
@@ -501,12 +504,12 @@ function BillingUsageSummaryCard({
|
|
|
501
504
|
}, 0);
|
|
502
505
|
const primaryMeter = meters.find((m) => _optionalChain([summaries, 'access', _17 => _17[m.id], 'optionalAccess', _18 => _18.aggregatedValue]));
|
|
503
506
|
const primarySummary = primaryMeter ? summaries[primaryMeter.id] : null;
|
|
504
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
505
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
506
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
507
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewDetailsClick, children: [
|
|
508
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
509
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.CardTitle, { children: "Usage This Month" }),
|
|
507
510
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
508
511
|
] }),
|
|
509
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
512
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.CardContent, { children: meters.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
510
513
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No meters" }),
|
|
511
514
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "No usage meters are configured" })
|
|
512
515
|
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
@@ -558,7 +561,7 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
|
|
|
558
561
|
const fetchSetupIntent = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
559
562
|
setLoading(true);
|
|
560
563
|
try {
|
|
561
|
-
const intent = await
|
|
564
|
+
const intent = await _chunkV66AZWPGjs.StripeCustomerService.createSetupIntent();
|
|
562
565
|
setSetupIntent(intent);
|
|
563
566
|
} catch (err) {
|
|
564
567
|
console.error("[PaymentMethodForm] Failed to create setup intent:", err);
|
|
@@ -596,7 +599,7 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
|
|
|
596
599
|
return;
|
|
597
600
|
}
|
|
598
601
|
if (setAsDefault && _optionalChain([confirmedSetupIntent, 'optionalAccess', _19 => _19.payment_method])) {
|
|
599
|
-
await
|
|
602
|
+
await _chunkV66AZWPGjs.StripeCustomerService.setDefaultPaymentMethod({
|
|
600
603
|
paymentMethodId: typeof confirmedSetupIntent.payment_method === "string" ? confirmedSetupIntent.payment_method : confirmedSetupIntent.payment_method.id
|
|
601
604
|
});
|
|
602
605
|
}
|
|
@@ -612,7 +615,7 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
|
|
|
612
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..." }) });
|
|
613
616
|
}
|
|
614
617
|
if (!setupIntent && error) {
|
|
615
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
618
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.AlertDescription, { children: error }) });
|
|
616
619
|
}
|
|
617
620
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: handleSubmit, className: "flex flex-col gap-y-4", children: [
|
|
618
621
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rounded-md border border-gray-300 p-3", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -635,13 +638,13 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
|
|
|
635
638
|
}
|
|
636
639
|
) }),
|
|
637
640
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
638
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
639
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
641
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Checkbox, { id: "setAsDefault", checked: setAsDefault, onCheckedChange: (checked) => setSetAsDefault(!!checked) }),
|
|
642
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Label, { htmlFor: "setAsDefault", className: "cursor-pointer font-normal", children: "Set as default payment method" })
|
|
640
643
|
] }),
|
|
641
|
-
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
644
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.AlertDescription, { children: error }) }),
|
|
642
645
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-x-2", children: [
|
|
643
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
644
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
646
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Button, { type: "button", variant: "outline", onClick: onCancel, disabled: isSubmitting || isLoading, children: "Cancel" }),
|
|
647
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Button, { type: "submit", disabled: !stripe || isSubmitting || isLoading, children: isSubmitting ? "Processing..." : "Add Card" })
|
|
645
648
|
] })
|
|
646
649
|
] });
|
|
647
650
|
}
|
|
@@ -657,10 +660,10 @@ function PaymentMethodEditor({ open, onOpenChange, onSuccess }) {
|
|
|
657
660
|
const handleCancel = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
658
661
|
onOpenChange(false);
|
|
659
662
|
}, "handleCancel");
|
|
660
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
661
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
662
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
663
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
663
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.DialogContent, { className: "max-w-md", children: [
|
|
664
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.DialogHeader, { children: [
|
|
665
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.DialogTitle, { children: "Add Payment Method" }),
|
|
666
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.DialogDescription, { children: "Add a new payment method to your account. Your card information is securely processed by Stripe." })
|
|
664
667
|
] }),
|
|
665
668
|
open && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodForm, { onSuccess: handleSuccess, onCancel: handleCancel })
|
|
666
669
|
] }) });
|
|
@@ -684,7 +687,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
684
687
|
_react.useEffect.call(void 0, () => {
|
|
685
688
|
const loadCustomer = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
686
689
|
try {
|
|
687
|
-
const fetchedCustomer = await
|
|
690
|
+
const fetchedCustomer = await _chunkV66AZWPGjs.StripeCustomerService.getCustomer();
|
|
688
691
|
setCustomer(fetchedCustomer);
|
|
689
692
|
} catch (error) {
|
|
690
693
|
console.error("[PaymentMethodCard] Failed to load customer:", error);
|
|
@@ -701,7 +704,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
701
704
|
const handleSetDefault = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
702
705
|
setLoading(true);
|
|
703
706
|
try {
|
|
704
|
-
await
|
|
707
|
+
await _chunkV66AZWPGjs.StripeCustomerService.setDefaultPaymentMethod({ paymentMethodId: paymentMethod.id });
|
|
705
708
|
onUpdate();
|
|
706
709
|
} catch (error) {
|
|
707
710
|
console.error("[PaymentMethodCard] Failed to set as default:", error);
|
|
@@ -712,7 +715,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
712
715
|
const handleRemove = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
713
716
|
setLoading(true);
|
|
714
717
|
try {
|
|
715
|
-
await
|
|
718
|
+
await _chunkV66AZWPGjs.StripeCustomerService.removePaymentMethod({ paymentMethodId: paymentMethod.id });
|
|
716
719
|
setShowRemoveDialog(false);
|
|
717
720
|
onUpdate();
|
|
718
721
|
} catch (error) {
|
|
@@ -721,16 +724,16 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
721
724
|
}
|
|
722
725
|
}, "handleRemove");
|
|
723
726
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
724
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
725
|
-
isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
726
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
727
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.Card, { className: "relative", children: [
|
|
728
|
+
isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Badge, { variant: "softGreen", className: "absolute right-2 top-2", children: "Default" }),
|
|
729
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.CardHeader, { className: "flex flex-row items-center justify-between pb-2", children: [
|
|
727
730
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
728
731
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-2xl", children: brandIcon }),
|
|
729
732
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium capitalize", children: brand })
|
|
730
733
|
] }),
|
|
731
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
732
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
733
|
-
|
|
734
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.DropdownMenu, { children: [
|
|
735
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.DropdownMenuTrigger, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
736
|
+
_chunkGYGMEDVSjs.Button,
|
|
734
737
|
{
|
|
735
738
|
render: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {}),
|
|
736
739
|
nativeButton: false,
|
|
@@ -741,10 +744,10 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
741
744
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.MoreVertical, { className: "h-4 w-4" })
|
|
742
745
|
}
|
|
743
746
|
) }),
|
|
744
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
745
|
-
!isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
747
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.DropdownMenuContent, { align: "end", children: [
|
|
748
|
+
!isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.DropdownMenuItem, { onClick: handleSetDefault, disabled: loading, children: "Set as Default" }),
|
|
746
749
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
747
|
-
|
|
750
|
+
_chunkGYGMEDVSjs.DropdownMenuItem,
|
|
748
751
|
{
|
|
749
752
|
onClick: () => setShowRemoveDialog(true),
|
|
750
753
|
disabled: loading,
|
|
@@ -755,7 +758,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
755
758
|
] })
|
|
756
759
|
] })
|
|
757
760
|
] }),
|
|
758
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
761
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-1", children: [
|
|
759
762
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-lg font-semibold", children: [
|
|
760
763
|
"\u2022\u2022\u2022\u2022 ",
|
|
761
764
|
last4
|
|
@@ -768,17 +771,17 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
768
771
|
] })
|
|
769
772
|
] }) })
|
|
770
773
|
] }),
|
|
771
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
772
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
773
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
774
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
774
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.AlertDialog, { open: showRemoveDialog, onOpenChange: setShowRemoveDialog, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.AlertDialogContent, { children: [
|
|
775
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.AlertDialogHeader, { children: [
|
|
776
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.AlertDialogTitle, { children: "Remove Payment Method" }),
|
|
777
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.AlertDialogDescription, { children: [
|
|
775
778
|
"Are you sure you want to remove this payment method? This action cannot be undone.",
|
|
776
779
|
isDefault && " This is your default payment method."
|
|
777
780
|
] })
|
|
778
781
|
] }),
|
|
779
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
780
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
781
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
782
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.AlertDialogFooter, { children: [
|
|
783
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.AlertDialogCancel, { disabled: loading, children: "Cancel" }),
|
|
784
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.AlertDialogAction, { onClick: handleRemove, disabled: loading, className: "bg-red-600 hover:bg-red-700", children: loading ? "Removing..." : "Remove" })
|
|
782
785
|
] })
|
|
783
786
|
] }) })
|
|
784
787
|
] });
|
|
@@ -801,7 +804,7 @@ function PaymentMethodsContainer() {
|
|
|
801
804
|
const loadPaymentMethods = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
802
805
|
setLoading(true);
|
|
803
806
|
try {
|
|
804
|
-
const fetchedPaymentMethods = await
|
|
807
|
+
const fetchedPaymentMethods = await _chunkV66AZWPGjs.StripeCustomerService.listPaymentMethods();
|
|
805
808
|
setPaymentMethods(fetchedPaymentMethods);
|
|
806
809
|
} catch (error) {
|
|
807
810
|
console.error("[PaymentMethodsContainer] Failed to load payment methods:", error);
|
|
@@ -821,14 +824,14 @@ function PaymentMethodsContainer() {
|
|
|
821
824
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8" }),
|
|
822
825
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: "Payment Methods" })
|
|
823
826
|
] }),
|
|
824
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
827
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Button, { onClick: () => setShowAddPaymentMethod(true), children: "Add Payment Method" })
|
|
825
828
|
] }),
|
|
826
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: [
|
|
827
830
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-16 w-16 text-muted-foreground" }),
|
|
828
831
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
829
832
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "mb-2 text-sm font-medium", children: "No payment methods" }),
|
|
830
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." }),
|
|
831
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
834
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Button, { onClick: () => setShowAddPaymentMethod(true), children: "Add Your First Card" })
|
|
832
835
|
] })
|
|
833
836
|
] }),
|
|
834
837
|
paymentMethods.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodsList, { paymentMethods, onUpdate: loadPaymentMethods }),
|
|
@@ -926,7 +929,7 @@ var statusConfig = {
|
|
|
926
929
|
};
|
|
927
930
|
function InvoiceStatusBadge({ status }) {
|
|
928
931
|
const config = statusConfig[status] || statusConfig["draft" /* DRAFT */];
|
|
929
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
932
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Badge, { variant: config.variant, children: config.label });
|
|
930
933
|
}
|
|
931
934
|
_chunk7QVYU63Ejs.__name.call(void 0, InvoiceStatusBadge, "InvoiceStatusBadge");
|
|
932
935
|
|
|
@@ -957,13 +960,13 @@ function InvoiceDetails({
|
|
|
957
960
|
return invoice.stripeInvoiceId.slice(-8);
|
|
958
961
|
}, "getInvoiceNumber");
|
|
959
962
|
const productName = _optionalChain([invoice, 'access', _29 => _29.subscription, 'optionalAccess', _30 => _30.price, 'optionalAccess', _31 => _31.product, 'optionalAccess', _32 => _32.name]) || "Subscription";
|
|
960
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
961
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
962
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
963
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.DialogContent, { className: "max-w-2xl", children: [
|
|
964
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.DialogHeader, { children: [
|
|
965
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.DialogTitle, { children: [
|
|
963
966
|
"Invoice ",
|
|
964
967
|
getInvoiceNumber()
|
|
965
968
|
] }),
|
|
966
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
969
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.DialogDescription, { children: formatDate3(invoice.periodStart) })
|
|
967
970
|
] }),
|
|
968
971
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
969
972
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
@@ -1028,15 +1031,15 @@ function InvoiceDetails({
|
|
|
1028
1031
|
] })
|
|
1029
1032
|
] }),
|
|
1030
1033
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2 pt-4 border-t", children: [
|
|
1031
|
-
invoice.stripePdfUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1034
|
+
invoice.stripePdfUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.Button, { variant: "outline", onClick: handleDownloadPDF, children: [
|
|
1032
1035
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Download, { className: "mr-2 h-4 w-4" }),
|
|
1033
1036
|
"Download PDF"
|
|
1034
1037
|
] }),
|
|
1035
|
-
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, _chunkGYGMEDVSjs.Button, { variant: "default", onClick: handleRetryPayment, children: [
|
|
1036
1039
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RefreshCw, { className: "mr-2 h-4 w-4" }),
|
|
1037
1040
|
"Retry Payment"
|
|
1038
1041
|
] }),
|
|
1039
|
-
invoice.stripeHostedInvoiceUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1042
|
+
invoice.stripeHostedInvoiceUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.Button, { variant: "outline", onClick: handleViewInStripe, children: [
|
|
1040
1043
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ExternalLink, { className: "mr-2 h-4 w-4" }),
|
|
1041
1044
|
"View in Stripe"
|
|
1042
1045
|
] })
|
|
@@ -1060,30 +1063,30 @@ function InvoicesList({ invoices, onInvoicesChange }) {
|
|
|
1060
1063
|
return invoice.stripeInvoiceId.slice(-8);
|
|
1061
1064
|
}, "getInvoiceNumber");
|
|
1062
1065
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1063
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1064
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1065
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1066
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1067
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1068
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1069
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1066
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.Table, { children: [
|
|
1067
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.TableRow, { children: [
|
|
1068
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.TableHead, { children: "Invoice #" }),
|
|
1069
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.TableHead, { children: "Date" }),
|
|
1070
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.TableHead, { children: "Status" }),
|
|
1071
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.TableHead, { className: "text-right", children: "Amount" }),
|
|
1072
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.TableHead, { children: "Period" })
|
|
1070
1073
|
] }) }),
|
|
1071
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1074
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.TableBody, { children: invoices.map((invoice) => {
|
|
1072
1075
|
const invoiceNumber = getInvoiceNumber(invoice);
|
|
1073
1076
|
const date = formatDate3(invoice.periodStart);
|
|
1074
1077
|
const amount = formatCurrency(invoice.total, invoice.currency);
|
|
1075
1078
|
const period = `${formatDate3(invoice.periodStart)} - ${formatDate3(invoice.periodEnd)}`;
|
|
1076
1079
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1077
|
-
|
|
1080
|
+
_chunkGYGMEDVSjs.TableRow,
|
|
1078
1081
|
{
|
|
1079
1082
|
onClick: () => handleRowClick(invoice),
|
|
1080
1083
|
className: "cursor-pointer hover:bg-muted/50",
|
|
1081
1084
|
children: [
|
|
1082
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1083
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1084
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1085
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1086
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1085
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.TableCell, { className: "font-medium", children: invoiceNumber }),
|
|
1086
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.TableCell, { className: "text-muted-foreground text-xs", children: date }),
|
|
1087
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InvoiceStatusBadge, { status: invoice.status }) }),
|
|
1088
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.TableCell, { className: "text-right font-medium", children: amount }),
|
|
1089
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.TableCell, { className: "text-muted-foreground text-xs", children: period })
|
|
1087
1090
|
]
|
|
1088
1091
|
},
|
|
1089
1092
|
invoice.id
|
|
@@ -1116,7 +1119,7 @@ function InvoicesContainer() {
|
|
|
1116
1119
|
setLoading(true);
|
|
1117
1120
|
try {
|
|
1118
1121
|
const params = statusFilter !== "all" ? { status: statusFilter } : void 0;
|
|
1119
|
-
const data = await
|
|
1122
|
+
const data = await _chunkV66AZWPGjs.StripeInvoiceService.listInvoices(params);
|
|
1120
1123
|
setInvoices(data);
|
|
1121
1124
|
} catch (error) {
|
|
1122
1125
|
console.error("[InvoicesContainer] Failed to load invoices:", error);
|
|
@@ -1132,12 +1135,12 @@ function InvoicesContainer() {
|
|
|
1132
1135
|
setStatusFilter(value);
|
|
1133
1136
|
}, "handleFilterChange");
|
|
1134
1137
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-4", children: [
|
|
1135
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1136
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1137
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1138
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1139
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1140
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1138
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Tabs, { value: statusFilter, onValueChange: handleFilterChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.TabsList, { children: [
|
|
1139
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.TabsTrigger, { value: "all", children: "All" }),
|
|
1140
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.TabsTrigger, { value: "paid" /* PAID */, children: "Paid" }),
|
|
1141
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.TabsTrigger, { value: "open" /* OPEN */, children: "Open" }),
|
|
1142
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.TabsTrigger, { value: "void" /* VOID */, children: "Void" }),
|
|
1143
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.TabsTrigger, { value: "uncollectible" /* UNCOLLECTIBLE */, children: "Uncollectible" })
|
|
1141
1144
|
] }) }),
|
|
1142
1145
|
loading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-center py-8 text-muted-foreground", children: "Loading invoices..." }),
|
|
1143
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: [
|
|
@@ -1184,7 +1187,7 @@ function CancelSubscriptionDialog({
|
|
|
1184
1187
|
const onSubmit = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async (_values) => {
|
|
1185
1188
|
setIsSubmitting(true);
|
|
1186
1189
|
try {
|
|
1187
|
-
await
|
|
1190
|
+
await _chunkV66AZWPGjs.StripeSubscriptionService.cancelSubscription({
|
|
1188
1191
|
id: subscription.id,
|
|
1189
1192
|
cancelImmediately: false
|
|
1190
1193
|
});
|
|
@@ -1197,19 +1200,19 @@ function CancelSubscriptionDialog({
|
|
|
1197
1200
|
}
|
|
1198
1201
|
}, "onSubmit");
|
|
1199
1202
|
const periodEndDate = formatDate3(subscription.currentPeriodEnd);
|
|
1200
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1201
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1202
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1203
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1203
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.DialogContent, { className: "max-w-md", children: [
|
|
1204
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.DialogHeader, { children: [
|
|
1205
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.DialogTitle, { children: "Cancel Subscription" }),
|
|
1206
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.DialogDescription, { children: "Are you sure you want to cancel this subscription? This action cannot be undone." })
|
|
1204
1207
|
] }),
|
|
1205
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1208
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-col gap-y-4", children: [
|
|
1206
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: [
|
|
1207
1210
|
"Your subscription will remain active until ",
|
|
1208
1211
|
periodEndDate,
|
|
1209
1212
|
". You can continue using the service until then."
|
|
1210
1213
|
] }),
|
|
1211
1214
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1212
|
-
|
|
1215
|
+
_chunkGYGMEDVSjs.FormTextarea,
|
|
1213
1216
|
{
|
|
1214
1217
|
form,
|
|
1215
1218
|
id: "reason",
|
|
@@ -1219,8 +1222,8 @@ function CancelSubscriptionDialog({
|
|
|
1219
1222
|
}
|
|
1220
1223
|
),
|
|
1221
1224
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-x-2 justify-end pt-2", children: [
|
|
1222
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1223
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1225
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Button, { type: "button", variant: "outline", onClick: () => onOpenChange(false), disabled: isSubmitting, children: "Keep Subscription" }),
|
|
1226
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Button, { type: "submit", variant: "destructive", disabled: isSubmitting, children: isSubmitting ? "Canceling..." : "Confirm Cancellation" })
|
|
1224
1227
|
] })
|
|
1225
1228
|
] }) })
|
|
1226
1229
|
] }) });
|
|
@@ -1269,7 +1272,7 @@ var cancelingConfig = {
|
|
|
1269
1272
|
};
|
|
1270
1273
|
function SubscriptionStatusBadge({ status, cancelAtPeriodEnd }) {
|
|
1271
1274
|
const config = cancelAtPeriodEnd ? cancelingConfig : statusConfig2[status] || statusConfig2["canceled" /* CANCELED */];
|
|
1272
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1275
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Badge, { variant: config.variant, children: config.label });
|
|
1273
1276
|
}
|
|
1274
1277
|
_chunk7QVYU63Ejs.__name.call(void 0, SubscriptionStatusBadge, "SubscriptionStatusBadge");
|
|
1275
1278
|
|
|
@@ -1311,7 +1314,7 @@ function SubscriptionDetails({
|
|
|
1311
1314
|
const handlePause = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1312
1315
|
setIsProcessing(true);
|
|
1313
1316
|
try {
|
|
1314
|
-
await
|
|
1317
|
+
await _chunkV66AZWPGjs.StripeSubscriptionService.pauseSubscription({ subscriptionId: subscription.id });
|
|
1315
1318
|
onSubscriptionChange();
|
|
1316
1319
|
} catch (error) {
|
|
1317
1320
|
console.error("[SubscriptionDetails] Failed to pause subscription:", error);
|
|
@@ -1322,7 +1325,7 @@ function SubscriptionDetails({
|
|
|
1322
1325
|
const handleResume = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1323
1326
|
setIsProcessing(true);
|
|
1324
1327
|
try {
|
|
1325
|
-
await
|
|
1328
|
+
await _chunkV66AZWPGjs.StripeSubscriptionService.resumeSubscription({ subscriptionId: subscription.id });
|
|
1326
1329
|
onSubscriptionChange();
|
|
1327
1330
|
} catch (error) {
|
|
1328
1331
|
console.error("[SubscriptionDetails] Failed to resume subscription:", error);
|
|
@@ -1332,7 +1335,7 @@ function SubscriptionDetails({
|
|
|
1332
1335
|
}, "handleResume");
|
|
1333
1336
|
const handleManageViaPortal = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1334
1337
|
try {
|
|
1335
|
-
const { url } = await
|
|
1338
|
+
const { url } = await _chunkV66AZWPGjs.StripeCustomerService.createPortalSession();
|
|
1336
1339
|
window.open(url, "_blank");
|
|
1337
1340
|
} catch (error) {
|
|
1338
1341
|
console.error("[SubscriptionDetails] Failed to create portal session:", error);
|
|
@@ -1342,10 +1345,10 @@ function SubscriptionDetails({
|
|
|
1342
1345
|
const canResume = subscription.status === "paused" /* PAUSED */;
|
|
1343
1346
|
const canCancel = subscription.status === "active" /* ACTIVE */ || subscription.status === "trialing" /* TRIALING */ || subscription.status === "paused" /* PAUSED */;
|
|
1344
1347
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1345
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1346
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1347
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1348
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1348
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.DialogContent, { className: "max-w-2xl", children: [
|
|
1349
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.DialogHeader, { children: [
|
|
1350
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.DialogTitle, { children: "Subscription Details" }),
|
|
1351
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.DialogDescription, { children: "View and manage your subscription" })
|
|
1349
1352
|
] }),
|
|
1350
1353
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
1351
1354
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
@@ -1387,11 +1390,11 @@ function SubscriptionDetails({
|
|
|
1387
1390
|
"."
|
|
1388
1391
|
] }) }),
|
|
1389
1392
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2 pt-4 border-t", children: [
|
|
1390
|
-
onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1391
|
-
canPause && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1392
|
-
canResume && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1393
|
-
canCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1394
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1393
|
+
onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Button, { variant: "default", onClick: () => onChangePlan(subscription), children: "Change Plan" }),
|
|
1394
|
+
canPause && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Button, { variant: "outline", onClick: handlePause, disabled: isProcessing, children: isProcessing ? "Pausing..." : "Pause" }),
|
|
1395
|
+
canResume && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Button, { variant: "outline", onClick: handleResume, disabled: isProcessing, children: isProcessing ? "Resuming..." : "Resume" }),
|
|
1396
|
+
canCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Button, { variant: "destructive", onClick: () => setShowCancel(true), children: "Cancel" }),
|
|
1397
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Button, { variant: "outline", onClick: handleManageViaPortal, children: "Manage via Portal" })
|
|
1395
1398
|
] })
|
|
1396
1399
|
] })
|
|
1397
1400
|
] }) }),
|
|
@@ -1438,36 +1441,36 @@ function SubscriptionsList({ subscriptions, onSubscriptionsChange, onChangePlan
|
|
|
1438
1441
|
setSelectedSub(subscription);
|
|
1439
1442
|
}, "handleRowClick");
|
|
1440
1443
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1441
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1442
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1443
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1444
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1445
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1446
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1447
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1444
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.Table, { children: [
|
|
1445
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.TableRow, { children: [
|
|
1446
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.TableHead, { children: "Status" }),
|
|
1447
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.TableHead, { children: "Plan" }),
|
|
1448
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.TableHead, { children: "Period" }),
|
|
1449
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.TableHead, { className: "text-right", children: "Amount" }),
|
|
1450
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.TableHead, { className: "text-right", children: "Actions" })
|
|
1448
1451
|
] }) }),
|
|
1449
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1452
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.TableBody, { children: subscriptions.map((subscription) => {
|
|
1450
1453
|
const price = subscription.price;
|
|
1451
1454
|
const amount = _optionalChain([price, 'optionalAccess', _42 => _42.unitAmount]) ? formatCurrency(price.unitAmount, price.currency) : "0";
|
|
1452
1455
|
const period = `${formatDate3(subscription.currentPeriodStart)} - ${formatDate3(subscription.currentPeriodEnd)}`;
|
|
1453
1456
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1454
|
-
|
|
1457
|
+
_chunkGYGMEDVSjs.TableRow,
|
|
1455
1458
|
{
|
|
1456
1459
|
onClick: () => handleRowClick(subscription),
|
|
1457
1460
|
className: "cursor-pointer hover:bg-muted/50",
|
|
1458
1461
|
children: [
|
|
1459
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1462
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1460
1463
|
SubscriptionStatusBadge,
|
|
1461
1464
|
{
|
|
1462
1465
|
status: subscription.status,
|
|
1463
1466
|
cancelAtPeriodEnd: subscription.cancelAtPeriodEnd
|
|
1464
1467
|
}
|
|
1465
1468
|
) }),
|
|
1466
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1467
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1468
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1469
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1470
|
-
|
|
1469
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.TableCell, { className: "font-medium", children: formatPlanName3(price) }),
|
|
1470
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.TableCell, { className: "text-muted-foreground text-sm", children: period }),
|
|
1471
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.TableCell, { className: "text-right font-medium", children: amount }),
|
|
1472
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.TableCell, { className: "text-right", children: (subscription.status === "active" /* ACTIVE */ || subscription.status === "trialing" /* TRIALING */) && onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1473
|
+
_chunkGYGMEDVSjs.Button,
|
|
1471
1474
|
{
|
|
1472
1475
|
size: "sm",
|
|
1473
1476
|
variant: "outline",
|
|
@@ -1512,7 +1515,7 @@ function SubscriptionsContainer({ onOpenWizard, hasActiveRecurringSubscription }
|
|
|
1512
1515
|
const loadSubscriptions = _react.useCallback.call(void 0, async () => {
|
|
1513
1516
|
setLoading(true);
|
|
1514
1517
|
try {
|
|
1515
|
-
const fetchedSubscriptions = await
|
|
1518
|
+
const fetchedSubscriptions = await _chunkV66AZWPGjs.StripeSubscriptionService.listSubscriptions();
|
|
1516
1519
|
setSubscriptions(fetchedSubscriptions);
|
|
1517
1520
|
} catch (error) {
|
|
1518
1521
|
console.error("[SubscriptionsContainer] Failed to load subscriptions:", error);
|
|
@@ -1535,7 +1538,7 @@ function SubscriptionsContainer({ onOpenWizard, hasActiveRecurringSubscription }
|
|
|
1535
1538
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8" }),
|
|
1536
1539
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: "Subscriptions" })
|
|
1537
1540
|
] }),
|
|
1538
|
-
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1541
|
+
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _43 => _43()]), children: hasActiveRecurringSubscription ? "Purchase Add-ons" : "Subscribe to a Plan" })
|
|
1539
1542
|
] }),
|
|
1540
1543
|
criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BillingAlertBanner, { subscription }, subscription.id)),
|
|
1541
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: [
|
|
@@ -1543,7 +1546,7 @@ function SubscriptionsContainer({ onOpenWizard, hasActiveRecurringSubscription }
|
|
|
1543
1546
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
1544
1547
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium mb-2", children: "No Active Subscriptions" }),
|
|
1545
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." }),
|
|
1546
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1549
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _44 => _44()]), children: "Subscribe to a Plan" })
|
|
1547
1550
|
] })
|
|
1548
1551
|
] }),
|
|
1549
1552
|
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -1564,9 +1567,9 @@ function IntervalToggle({ value, onChange, hasMonthly, hasYearly }) {
|
|
|
1564
1567
|
if (!hasMonthly || !hasYearly) {
|
|
1565
1568
|
return null;
|
|
1566
1569
|
}
|
|
1567
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1568
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1569
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1570
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Tabs, { value, onValueChange: (v) => onChange(v), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.TabsList, { children: [
|
|
1571
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.TabsTrigger, { value: "month", children: "Monthly" }),
|
|
1572
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.TabsTrigger, { value: "year", children: "Yearly" })
|
|
1570
1573
|
] }) });
|
|
1571
1574
|
}
|
|
1572
1575
|
_chunk7QVYU63Ejs.__name.call(void 0, IntervalToggle, "IntervalToggle");
|
|
@@ -1598,7 +1601,7 @@ function PricingCard({
|
|
|
1598
1601
|
}
|
|
1599
1602
|
}, "handleClick");
|
|
1600
1603
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1601
|
-
|
|
1604
|
+
_chunkGYGMEDVSjs.Card,
|
|
1602
1605
|
{
|
|
1603
1606
|
role: "radio",
|
|
1604
1607
|
"aria-checked": isSelected,
|
|
@@ -1606,7 +1609,7 @@ function PricingCard({
|
|
|
1606
1609
|
tabIndex: isDisabled ? -1 : 0,
|
|
1607
1610
|
onKeyDown: handleKeyDown,
|
|
1608
1611
|
onClick: handleClick,
|
|
1609
|
-
className:
|
|
1612
|
+
className: _chunkV66AZWPGjs.cn.call(void 0,
|
|
1610
1613
|
"relative cursor-pointer transition-all duration-200 flex flex-col h-full",
|
|
1611
1614
|
"focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
1612
1615
|
isCurrentPlan && "bg-muted/30",
|
|
@@ -1616,9 +1619,9 @@ function PricingCard({
|
|
|
1616
1619
|
isLoading && "pointer-events-none"
|
|
1617
1620
|
),
|
|
1618
1621
|
children: [
|
|
1619
|
-
isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1620
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1621
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1622
|
+
isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Badge, { variant: "secondary", className: "absolute top-2 right-2", children: "Current" }),
|
|
1623
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.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, _chunkGYGMEDVSjs.CardContent, { className: "pb-4 grow", children: [
|
|
1622
1625
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mb-4", children: [
|
|
1623
1626
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-3xl font-bold", children: formattedPrice }),
|
|
1624
1627
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground ml-1", children: interval })
|
|
@@ -1628,8 +1631,8 @@ function PricingCard({
|
|
|
1628
1631
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-muted-foreground", children: feature })
|
|
1629
1632
|
] }, index)) })
|
|
1630
1633
|
] }),
|
|
1631
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1632
|
-
|
|
1634
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.CardFooter, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1635
|
+
_chunkGYGMEDVSjs.Button,
|
|
1633
1636
|
{
|
|
1634
1637
|
variant: isCurrentPlan ? "secondary" : isSelected ? "default" : "outline",
|
|
1635
1638
|
className: "w-full",
|
|
@@ -1657,7 +1660,7 @@ function ProductPricingRow({
|
|
|
1657
1660
|
return null;
|
|
1658
1661
|
}
|
|
1659
1662
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-3", children: [
|
|
1660
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1663
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.SectionHeader, { children: product.name }),
|
|
1661
1664
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1662
1665
|
"div",
|
|
1663
1666
|
{
|
|
@@ -1757,15 +1760,15 @@ function ProductPricingList({
|
|
|
1757
1760
|
_chunk7QVYU63Ejs.__name.call(void 0, ProductPricingList, "ProductPricingList");
|
|
1758
1761
|
function ProductPricingListSkeleton() {
|
|
1759
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: [
|
|
1760
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1763
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Skeleton, { className: "h-6 w-32" }),
|
|
1761
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: [
|
|
1762
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1763
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1765
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Skeleton, { className: "h-6 w-24" }),
|
|
1766
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Skeleton, { className: "h-8 w-32" }),
|
|
1764
1767
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
1765
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1766
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1768
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Skeleton, { className: "h-4 w-full" }),
|
|
1769
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Skeleton, { className: "h-4 w-3/4" })
|
|
1767
1770
|
] }),
|
|
1768
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1771
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Skeleton, { className: "h-10 w-full" })
|
|
1769
1772
|
] }, cardIndex)) })
|
|
1770
1773
|
] }, rowIndex)) });
|
|
1771
1774
|
}
|
|
@@ -1820,8 +1823,8 @@ function SubscriptionConfirmation({ price, isLoading, onConfirm, onCancel }) {
|
|
|
1820
1823
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: feature })
|
|
1821
1824
|
] }, index)) }),
|
|
1822
1825
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-3 pt-2 border-t border-accent/30", children: [
|
|
1823
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1824
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1826
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Button, { variant: "outline", onClick: onCancel, disabled: isLoading, children: "Cancel" }),
|
|
1827
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Button, { onClick: onConfirm, disabled: isLoading, children: isLoading ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1825
1828
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "h-4 w-4 animate-spin mr-2" }),
|
|
1826
1829
|
"Processing..."
|
|
1827
1830
|
] }) : "Subscribe" })
|
|
@@ -1892,7 +1895,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
1892
1895
|
onCloseRef.current = onClose;
|
|
1893
1896
|
const checkPaymentMethod = _react.useCallback.call(void 0, async () => {
|
|
1894
1897
|
try {
|
|
1895
|
-
const methods = await
|
|
1898
|
+
const methods = await _chunkV66AZWPGjs.StripeCustomerService.listPaymentMethods();
|
|
1896
1899
|
dispatch({ type: "SET_HAS_PAYMENT_METHOD", hasMethod: methods.length > 0 });
|
|
1897
1900
|
} catch (error) {
|
|
1898
1901
|
console.error("[useSubscriptionWizard] Failed to check payment methods:", error);
|
|
@@ -1916,7 +1919,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
1916
1919
|
const isTrialUpgrade = _optionalChain([subscription, 'optionalAccess', _55 => _55.status]) === "trialing" /* TRIALING */;
|
|
1917
1920
|
dispatch({ type: "SET_IS_TRIAL_SUBSCRIPTION", isTrial: isTrialUpgrade });
|
|
1918
1921
|
if (isTrialUpgrade && !state.hasPaymentMethod) {
|
|
1919
|
-
const methods = await
|
|
1922
|
+
const methods = await _chunkV66AZWPGjs.StripeCustomerService.listPaymentMethods();
|
|
1920
1923
|
if (methods.length === 0) {
|
|
1921
1924
|
dispatch({ type: "SET_STEP", step: "payment-method" });
|
|
1922
1925
|
dispatch({
|
|
@@ -1927,7 +1930,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
1927
1930
|
}
|
|
1928
1931
|
}
|
|
1929
1932
|
if (subscription && state.selectedPrice.id !== _optionalChain([subscription, 'access', _56 => _56.price, 'optionalAccess', _57 => _57.id])) {
|
|
1930
|
-
const preview = await
|
|
1933
|
+
const preview = await _chunkV66AZWPGjs.StripeSubscriptionService.getProrationPreview({
|
|
1931
1934
|
subscriptionId: subscription.id,
|
|
1932
1935
|
newPriceId: state.selectedPrice.id
|
|
1933
1936
|
});
|
|
@@ -1952,14 +1955,14 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
1952
1955
|
newPriceId: state.selectedPrice.id,
|
|
1953
1956
|
promotionCode: _optionalChain([state, 'access', _59 => _59.promotionCode, 'optionalAccess', _60 => _60.promotionCodeId])
|
|
1954
1957
|
};
|
|
1955
|
-
await
|
|
1958
|
+
await _chunkV66AZWPGjs.StripeSubscriptionService.changePlan(changePlanParams);
|
|
1956
1959
|
} else {
|
|
1957
1960
|
const createParams = {
|
|
1958
1961
|
id: _uuid.v4.call(void 0, ),
|
|
1959
1962
|
priceId: state.selectedPrice.id,
|
|
1960
1963
|
promotionCode: _optionalChain([state, 'access', _61 => _61.promotionCode, 'optionalAccess', _62 => _62.promotionCodeId])
|
|
1961
1964
|
};
|
|
1962
|
-
await
|
|
1965
|
+
await _chunkV66AZWPGjs.StripeSubscriptionService.createSubscription(createParams);
|
|
1963
1966
|
}
|
|
1964
1967
|
onSuccessRef.current();
|
|
1965
1968
|
onCloseRef.current();
|
|
@@ -1993,7 +1996,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
1993
1996
|
dispatch({ type: "SET_VALIDATING_PROMO_CODE", isValidating: true });
|
|
1994
1997
|
dispatch({ type: "SET_PROMO_CODE_ERROR", error: null });
|
|
1995
1998
|
try {
|
|
1996
|
-
const result = await
|
|
1999
|
+
const result = await _chunkV66AZWPGjs.StripePromotionCodeService.validatePromotionCode({
|
|
1997
2000
|
code,
|
|
1998
2001
|
stripePriceId: _optionalChain([state, 'access', _70 => _70.selectedPrice, 'optionalAccess', _71 => _71.id])
|
|
1999
2002
|
});
|
|
@@ -2100,7 +2103,7 @@ function WizardStepPlanSelection({
|
|
|
2100
2103
|
_react.useEffect.call(void 0, () => {
|
|
2101
2104
|
const loadProducts = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2102
2105
|
try {
|
|
2103
|
-
const fetchedProducts = await
|
|
2106
|
+
const fetchedProducts = await _chunkV66AZWPGjs.StripeProductService.listProducts({ active: true });
|
|
2104
2107
|
setProducts(fetchedProducts);
|
|
2105
2108
|
} catch (error) {
|
|
2106
2109
|
console.error("[WizardStepPlanSelection] Failed to load products:", error);
|
|
@@ -2151,7 +2154,7 @@ function WizardStepPlanSelection({
|
|
|
2151
2154
|
onSelectPrice: handleSelectPrice
|
|
2152
2155
|
}
|
|
2153
2156
|
),
|
|
2154
|
-
/* @__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, _chunkGYGMEDVSjs.Button, { onClick: onNext, disabled: !selectedPrice || isProcessing, children: isProcessing ? "Loading..." : "Next: Review" }) })
|
|
2155
2158
|
] });
|
|
2156
2159
|
}
|
|
2157
2160
|
_chunk7QVYU63Ejs.__name.call(void 0, WizardStepPlanSelection, "WizardStepPlanSelection");
|
|
@@ -2212,7 +2215,7 @@ function PromoCodeInput({
|
|
|
2212
2215
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success text-sm", children: formatDiscount(appliedCode) })
|
|
2213
2216
|
] }),
|
|
2214
2217
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2215
|
-
|
|
2218
|
+
_chunkGYGMEDVSjs.Button,
|
|
2216
2219
|
{
|
|
2217
2220
|
variant: "ghost",
|
|
2218
2221
|
size: "sm",
|
|
@@ -2229,7 +2232,7 @@ function PromoCodeInput({
|
|
|
2229
2232
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
2230
2233
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
|
|
2231
2234
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2232
|
-
|
|
2235
|
+
_chunkGYGMEDVSjs.Input,
|
|
2233
2236
|
{
|
|
2234
2237
|
placeholder: "Enter promo code",
|
|
2235
2238
|
value: code,
|
|
@@ -2239,7 +2242,7 @@ function PromoCodeInput({
|
|
|
2239
2242
|
className: "flex-1"
|
|
2240
2243
|
}
|
|
2241
2244
|
),
|
|
2242
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2245
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Button, { variant: "outline", onClick: handleApply, disabled: disabled || isValidating || !code.trim(), children: isValidating ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "h-4 w-4 animate-spin" }) : "Apply" })
|
|
2243
2246
|
] }),
|
|
2244
2247
|
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error })
|
|
2245
2248
|
] });
|
|
@@ -2311,7 +2314,7 @@ function WizardStepReview({
|
|
|
2311
2314
|
const discountDescription = getDiscountDescription();
|
|
2312
2315
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
2313
2316
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-muted/50 rounded-lg p-4 space-y-3", children: [
|
|
2314
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2317
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.SectionHeader, { children: "Selected Plan" }),
|
|
2315
2318
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between items-center", children: [
|
|
2316
2319
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
2317
2320
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-medium", children: _optionalChain([selectedPrice, 'access', _92 => _92.product, 'optionalAccess', _93 => _93.name]) }),
|
|
@@ -2321,7 +2324,7 @@ function WizardStepReview({
|
|
|
2321
2324
|
discountedPrice !== null ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2322
2325
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground line-through", children: formatCurrency(selectedPrice.unitAmount || 0, selectedPrice.currency) }),
|
|
2323
2326
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-success text-lg font-semibold", children: formatCurrency(discountedPrice, selectedPrice.currency) }),
|
|
2324
|
-
discountDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2327
|
+
discountDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Badge, { variant: "softGreen", children: discountDescription })
|
|
2325
2328
|
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-semibold text-lg", children: formatCurrency(selectedPrice.unitAmount || 0, selectedPrice.currency) }),
|
|
2326
2329
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: formatInterval2(selectedPrice) })
|
|
2327
2330
|
] })
|
|
@@ -2363,15 +2366,15 @@ function WizardStepReview({
|
|
|
2363
2366
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "font-medium", children: "Payment Method" }),
|
|
2364
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" })
|
|
2365
2368
|
] }),
|
|
2366
|
-
!hasPaymentMethod && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2369
|
+
!hasPaymentMethod && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Button, { variant: "outline", onClick: onAddPaymentMethod, children: "Add Payment Method" })
|
|
2367
2370
|
] }) }),
|
|
2368
|
-
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2371
|
+
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.Alert, { variant: "destructive", children: [
|
|
2369
2372
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.AlertCircle, { className: "h-4 w-4" }),
|
|
2370
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2373
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.AlertDescription, { children: error })
|
|
2371
2374
|
] }),
|
|
2372
2375
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between pt-4 border-t", children: [
|
|
2373
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2374
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2376
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Button, { variant: "outline", onClick: onBack, disabled: isProcessing, children: "Back" }),
|
|
2377
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Button, { onClick: hasPaymentMethod ? onConfirm : onAddPaymentMethod, disabled: isProcessing, children: isProcessing ? "Processing..." : hasPaymentMethod ? isChangingPlan ? "Confirm Plan Change" : "Subscribe Now" : "Add Payment Method" })
|
|
2375
2378
|
] })
|
|
2376
2379
|
] });
|
|
2377
2380
|
}
|
|
@@ -2382,7 +2385,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, WizardStepReview, "WizardStepReview");
|
|
|
2382
2385
|
function WizardStepPaymentMethod({ onBack, onSuccess, isProcessing }) {
|
|
2383
2386
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
2384
2387
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
2385
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2388
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.SectionHeader, { children: "Add Payment Method" }),
|
|
2386
2389
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: "Enter your card details to complete your subscription" })
|
|
2387
2390
|
] }),
|
|
2388
2391
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodForm, { onSuccess, onCancel: onBack, isLoading: isProcessing })
|
|
@@ -2424,10 +2427,10 @@ function SubscriptionWizard({
|
|
|
2424
2427
|
const isChangePlanMode = !!subscription;
|
|
2425
2428
|
const dialogTitle = subscription ? "Change Subscription Plan" : isPurchasingAddons ? "Purchase Add-ons" : "Subscribe to a Plan";
|
|
2426
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";
|
|
2427
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2428
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2429
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2430
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2430
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.DialogContent, { className: "max-w-2xl", children: [
|
|
2431
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.DialogHeader, { children: [
|
|
2432
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.DialogTitle, { children: dialogTitle }),
|
|
2433
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.DialogDescription, { children: dialogDescription })
|
|
2431
2434
|
] }),
|
|
2432
2435
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, WizardProgressIndicator, { currentStep: state.step }),
|
|
2433
2436
|
state.step === "plan-selection" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -2510,15 +2513,15 @@ function UsageSummaryCard({ meter, summary }) {
|
|
|
2510
2513
|
const progressWidth = percentage !== null ? Math.min(percentage, 100) : 0;
|
|
2511
2514
|
const displayName = meter.displayName || meter.eventName;
|
|
2512
2515
|
const hasLimit = limit !== null && limit !== void 0;
|
|
2513
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2514
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2516
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.Card, { children: [
|
|
2517
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.CardHeader, { className: "flex flex-row items-center gap-x-3 pb-3", children: [
|
|
2515
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" }) }),
|
|
2516
2519
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col", children: [
|
|
2517
2520
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium", children: displayName }),
|
|
2518
2521
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-xs", children: meter.id })
|
|
2519
2522
|
] })
|
|
2520
2523
|
] }),
|
|
2521
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2524
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.CardContent, { className: "flex flex-col gap-y-4", children: [
|
|
2522
2525
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
2523
2526
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-3xl font-bold", children: currentUsage.toLocaleString() }),
|
|
2524
2527
|
hasLimit && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-muted-foreground text-sm", children: [
|
|
@@ -2565,14 +2568,14 @@ function UsageContainer() {
|
|
|
2565
2568
|
const loadUsageData = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2566
2569
|
setLoading(true);
|
|
2567
2570
|
try {
|
|
2568
|
-
const fetchedSubscriptions = await
|
|
2571
|
+
const fetchedSubscriptions = await _chunkV66AZWPGjs.StripeSubscriptionService.listSubscriptions();
|
|
2569
2572
|
setSubscriptions(fetchedSubscriptions);
|
|
2570
2573
|
const hasMeteredSubscriptions2 = fetchedSubscriptions.some((sub) => _optionalChain([sub, 'access', _99 => _99.price, 'optionalAccess', _100 => _100.recurring, 'optionalAccess', _101 => _101.usageType]) === "metered");
|
|
2571
2574
|
if (!hasMeteredSubscriptions2) {
|
|
2572
2575
|
setLoading(false);
|
|
2573
2576
|
return;
|
|
2574
2577
|
}
|
|
2575
|
-
const fetchedMeters = await
|
|
2578
|
+
const fetchedMeters = await _chunkV66AZWPGjs.StripeUsageService.listMeters();
|
|
2576
2579
|
setMeters(fetchedMeters);
|
|
2577
2580
|
const summariesMap = {};
|
|
2578
2581
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -2580,7 +2583,7 @@ function UsageContainer() {
|
|
|
2580
2583
|
const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
|
|
2581
2584
|
for (const meter of fetchedMeters) {
|
|
2582
2585
|
try {
|
|
2583
|
-
const meterSummaries = await
|
|
2586
|
+
const meterSummaries = await _chunkV66AZWPGjs.StripeUsageService.getMeterSummaries({
|
|
2584
2587
|
meterId: meter.id,
|
|
2585
2588
|
startTime: startOfMonth,
|
|
2586
2589
|
endTime: endOfMonth
|
|
@@ -2645,22 +2648,22 @@ function UsageHistoryTable({ usageRecords }) {
|
|
|
2645
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." }) });
|
|
2646
2649
|
}
|
|
2647
2650
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
2648
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2649
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-clip rounded-lg border", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2650
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2651
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2652
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2653
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2654
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2651
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.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, _chunkGYGMEDVSjs.Table, { children: [
|
|
2653
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.TableRow, { children: [
|
|
2654
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.TableHead, { children: "Date & Time" }),
|
|
2655
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.TableHead, { children: "Meter Event" }),
|
|
2656
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.TableHead, { className: "text-right", children: "Quantity" }),
|
|
2657
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.TableHead, { children: "Event ID" })
|
|
2655
2658
|
] }) }),
|
|
2656
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2659
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.TableBody, { children: usageRecords.map((record) => {
|
|
2657
2660
|
const dateTime = formatDateTime(record.timestamp);
|
|
2658
2661
|
const quantity = record.quantity.toLocaleString();
|
|
2659
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2660
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2661
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2662
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2663
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2662
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.TableRow, { children: [
|
|
2663
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.TableCell, { className: "font-medium", children: dateTime }),
|
|
2664
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.TableCell, { className: "text-muted-foreground", children: record.meterEventName }),
|
|
2665
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.TableCell, { className: "text-right font-medium", children: quantity }),
|
|
2666
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.TableCell, { className: "text-muted-foreground text-sm tabular-nums", children: record.stripeEventId })
|
|
2664
2667
|
] }, record.id);
|
|
2665
2668
|
}) })
|
|
2666
2669
|
] }) })
|
|
@@ -2671,8 +2674,8 @@ _chunk7QVYU63Ejs.__name.call(void 0, UsageHistoryTable, "UsageHistoryTable");
|
|
|
2671
2674
|
// src/features/billing/components/modals/BillingDetailModal.tsx
|
|
2672
2675
|
|
|
2673
2676
|
function BillingDetailModal({ open, onOpenChange, title, children, className }) {
|
|
2674
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2675
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2677
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.DialogContent, { className: _nullishCoalesce(className, () => ( "max-w-4xl max-h-[90vh] overflow-y-auto")), children: [
|
|
2678
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.DialogHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.DialogTitle, { children: title }) }),
|
|
2676
2679
|
children
|
|
2677
2680
|
] }) });
|
|
2678
2681
|
}
|
|
@@ -2689,7 +2692,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
|
|
|
2689
2692
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-destructive text-sm font-medium", children: "Payment Failed" }),
|
|
2690
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." })
|
|
2691
2694
|
] }),
|
|
2692
|
-
onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2695
|
+
onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Button, { variant: "outline", size: "sm", onClick: onUpdatePayment, className: "text-destructive border-red-300", children: "Update Payment Method" })
|
|
2693
2696
|
] });
|
|
2694
2697
|
}
|
|
2695
2698
|
if (subscription.status === "trialing" /* TRIALING */ && subscription.trialEnd) {
|
|
@@ -2709,7 +2712,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
|
|
|
2709
2712
|
". Add a payment method to continue your subscription."
|
|
2710
2713
|
] })
|
|
2711
2714
|
] }),
|
|
2712
|
-
onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2715
|
+
onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Button, { variant: "outline", size: "sm", onClick: onAddPayment, className: "text-warning border-yellow-300", children: "Add Payment Method" })
|
|
2713
2716
|
] });
|
|
2714
2717
|
}
|
|
2715
2718
|
}
|
|
@@ -2760,7 +2763,7 @@ function BillingDashboardContainer() {
|
|
|
2760
2763
|
setNoCustomerExists(false);
|
|
2761
2764
|
let customer = null;
|
|
2762
2765
|
try {
|
|
2763
|
-
customer = await
|
|
2766
|
+
customer = await _chunkV66AZWPGjs.StripeCustomerService.getCustomer();
|
|
2764
2767
|
setData((prev) => ({ ...prev, customer }));
|
|
2765
2768
|
setErrors((prev) => ({ ...prev, customer: null }));
|
|
2766
2769
|
setNoCustomerExists(false);
|
|
@@ -2786,7 +2789,7 @@ function BillingDashboardContainer() {
|
|
|
2786
2789
|
}
|
|
2787
2790
|
const fetchSubscriptions = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2788
2791
|
try {
|
|
2789
|
-
const subscriptions2 = await
|
|
2792
|
+
const subscriptions2 = await _chunkV66AZWPGjs.StripeSubscriptionService.listSubscriptions();
|
|
2790
2793
|
setData((prev) => ({ ...prev, subscriptions: subscriptions2 }));
|
|
2791
2794
|
setErrors((prev) => ({ ...prev, subscriptions: null }));
|
|
2792
2795
|
return subscriptions2;
|
|
@@ -2800,7 +2803,7 @@ function BillingDashboardContainer() {
|
|
|
2800
2803
|
}, "fetchSubscriptions");
|
|
2801
2804
|
const fetchPaymentMethods = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2802
2805
|
try {
|
|
2803
|
-
const paymentMethods = await
|
|
2806
|
+
const paymentMethods = await _chunkV66AZWPGjs.StripeCustomerService.listPaymentMethods();
|
|
2804
2807
|
setData((prev) => ({ ...prev, paymentMethods }));
|
|
2805
2808
|
setErrors((prev) => ({ ...prev, paymentMethods: null }));
|
|
2806
2809
|
} catch (error) {
|
|
@@ -2812,7 +2815,7 @@ function BillingDashboardContainer() {
|
|
|
2812
2815
|
}, "fetchPaymentMethods");
|
|
2813
2816
|
const fetchInvoices = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2814
2817
|
try {
|
|
2815
|
-
const invoices = await
|
|
2818
|
+
const invoices = await _chunkV66AZWPGjs.StripeInvoiceService.listInvoices();
|
|
2816
2819
|
setData((prev) => ({ ...prev, invoices }));
|
|
2817
2820
|
setErrors((prev) => ({ ...prev, invoices: null }));
|
|
2818
2821
|
} catch (error) {
|
|
@@ -2835,7 +2838,7 @@ function BillingDashboardContainer() {
|
|
|
2835
2838
|
const handleCreateCustomer = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2836
2839
|
setCreatingCustomer(true);
|
|
2837
2840
|
try {
|
|
2838
|
-
await
|
|
2841
|
+
await _chunkV66AZWPGjs.StripeCustomerService.createCustomer();
|
|
2839
2842
|
setNoCustomerExists(false);
|
|
2840
2843
|
await fetchAllData();
|
|
2841
2844
|
} catch (error) {
|
|
@@ -2847,7 +2850,7 @@ function BillingDashboardContainer() {
|
|
|
2847
2850
|
}, "handleCreateCustomer");
|
|
2848
2851
|
const fetchUsageData = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2849
2852
|
try {
|
|
2850
|
-
const meters = await
|
|
2853
|
+
const meters = await _chunkV66AZWPGjs.StripeUsageService.listMeters();
|
|
2851
2854
|
setData((prev) => ({ ...prev, meters }));
|
|
2852
2855
|
const summariesMap = {};
|
|
2853
2856
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -2855,7 +2858,7 @@ function BillingDashboardContainer() {
|
|
|
2855
2858
|
const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
|
|
2856
2859
|
for (const meter of meters) {
|
|
2857
2860
|
try {
|
|
2858
|
-
const meterSummaries = await
|
|
2861
|
+
const meterSummaries = await _chunkV66AZWPGjs.StripeUsageService.getMeterSummaries({
|
|
2859
2862
|
meterId: meter.id,
|
|
2860
2863
|
startTime: startOfMonth,
|
|
2861
2864
|
endTime: endOfMonth
|
|
@@ -2933,18 +2936,18 @@ function BillingDashboardContainer() {
|
|
|
2933
2936
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-8 w-8" }),
|
|
2934
2937
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: "Billing" })
|
|
2935
2938
|
] }),
|
|
2936
|
-
isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2937
|
-
noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2938
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2939
|
+
isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.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, _chunkGYGMEDVSjs.Card, { children: [
|
|
2941
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.CardHeader, { className: "text-center", children: [
|
|
2939
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" }) }),
|
|
2940
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2941
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2943
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.CardTitle, { children: "Set Up Billing" }),
|
|
2944
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.CardDescription, { children: "Your company doesn't have a billing account yet. Set one up to manage subscriptions, payment methods, and view invoices." })
|
|
2942
2945
|
] }),
|
|
2943
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2946
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.CardContent, { className: "flex justify-center pb-8", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Button, { onClick: handleCreateCustomer, disabled: creatingCustomer, size: "lg", children: creatingCustomer ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2944
2947
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
2945
2948
|
"Setting up..."
|
|
2946
2949
|
] }) : "Set Up Billing Account" }) }),
|
|
2947
|
-
errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2950
|
+
errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.CardContent, { className: "pt-0", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-center text-destructive text-xs/relaxed", children: errors.customer }) })
|
|
2948
2951
|
] }),
|
|
2949
2952
|
!noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2950
2953
|
criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -3086,7 +3089,7 @@ function getStripePromise(publishableKey) {
|
|
|
3086
3089
|
}
|
|
3087
3090
|
_chunk7QVYU63Ejs.__name.call(void 0, getStripePromise, "getStripePromise");
|
|
3088
3091
|
function StripeProvider({ children }) {
|
|
3089
|
-
const publishableKey =
|
|
3092
|
+
const publishableKey = _chunkTOKHHZSPjs.getStripePublishableKey.call(void 0, );
|
|
3090
3093
|
const stripePromise = _react.useMemo.call(void 0, () => getStripePromise(publishableKey), [publishableKey]);
|
|
3091
3094
|
const options = _react.useMemo.call(void 0, () => ({}), []);
|
|
3092
3095
|
if (!publishableKey) {
|
|
@@ -3096,10 +3099,128 @@ function StripeProvider({ children }) {
|
|
|
3096
3099
|
}
|
|
3097
3100
|
_chunk7QVYU63Ejs.__name.call(void 0, StripeProvider, "StripeProvider");
|
|
3098
3101
|
function isStripeConfigured() {
|
|
3099
|
-
return !!
|
|
3102
|
+
return !!_chunkTOKHHZSPjs.getStripePublishableKey.call(void 0, );
|
|
3100
3103
|
}
|
|
3101
3104
|
_chunk7QVYU63Ejs.__name.call(void 0, isStripeConfigured, "isStripeConfigured");
|
|
3102
3105
|
|
|
3106
|
+
// src/features/billing/contexts/BillingContext.tsx
|
|
3107
|
+
var _nextintl = require('next-intl');
|
|
3108
|
+
|
|
3109
|
+
|
|
3110
|
+
// src/features/billing/stripe-product/components/forms/ProductEditor.tsx
|
|
3111
|
+
|
|
3112
|
+
|
|
3113
|
+
|
|
3114
|
+
|
|
3115
|
+
|
|
3116
|
+
|
|
3117
|
+
function ProductEditor({ product, open, onOpenChange, onSuccess }) {
|
|
3118
|
+
const [isSubmitting, setIsSubmitting] = _react.useState.call(void 0, false);
|
|
3119
|
+
const formSchema2 = _zod3.z.object({
|
|
3120
|
+
name: _zod3.z.string().min(1, { message: "Product name is required" }),
|
|
3121
|
+
description: _zod3.z.string().min(1, { message: "Description is required" }),
|
|
3122
|
+
active: _zod3.z.boolean()
|
|
3123
|
+
});
|
|
3124
|
+
const form = _reacthookform.useForm.call(void 0, {
|
|
3125
|
+
resolver: _zod.zodResolver.call(void 0, formSchema2),
|
|
3126
|
+
defaultValues: {
|
|
3127
|
+
name: _optionalChain([product, 'optionalAccess', _117 => _117.name]) || "",
|
|
3128
|
+
description: _optionalChain([product, 'optionalAccess', _118 => _118.description]) || "",
|
|
3129
|
+
active: _nullishCoalesce(_optionalChain([product, 'optionalAccess', _119 => _119.active]), () => ( true))
|
|
3130
|
+
}
|
|
3131
|
+
});
|
|
3132
|
+
const onSubmit = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async (values) => {
|
|
3133
|
+
setIsSubmitting(true);
|
|
3134
|
+
try {
|
|
3135
|
+
if (product) {
|
|
3136
|
+
await _chunkV66AZWPGjs.StripeProductService.updateProduct({
|
|
3137
|
+
id: product.id,
|
|
3138
|
+
name: values.name,
|
|
3139
|
+
description: values.description,
|
|
3140
|
+
active: values.active
|
|
3141
|
+
});
|
|
3142
|
+
} else {
|
|
3143
|
+
await _chunkV66AZWPGjs.StripeProductService.createProduct({
|
|
3144
|
+
id: _uuid.v4.call(void 0, ),
|
|
3145
|
+
name: values.name,
|
|
3146
|
+
description: values.description,
|
|
3147
|
+
active: values.active
|
|
3148
|
+
});
|
|
3149
|
+
}
|
|
3150
|
+
onSuccess();
|
|
3151
|
+
onOpenChange(false);
|
|
3152
|
+
} catch (error) {
|
|
3153
|
+
console.error("[ProductEditor] Failed to save product:", error);
|
|
3154
|
+
} finally {
|
|
3155
|
+
setIsSubmitting(false);
|
|
3156
|
+
}
|
|
3157
|
+
}, "onSubmit");
|
|
3158
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.DialogContent, { className: "max-w-2xl", children: [
|
|
3159
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.DialogHeader, { children: [
|
|
3160
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.DialogTitle, { children: product ? "Edit Product" : "Create Product" }),
|
|
3161
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.DialogDescription, { children: product ? `Update the details for ${product.name}` : "Create a new product to offer to your customers" })
|
|
3162
|
+
] }),
|
|
3163
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.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, _chunkGYGMEDVSjs.FormInput, { form, id: "name", name: "Product Name", placeholder: "Enter product name", isRequired: true }),
|
|
3165
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3166
|
+
_chunkGYGMEDVSjs.FormTextarea,
|
|
3167
|
+
{
|
|
3168
|
+
form,
|
|
3169
|
+
id: "description",
|
|
3170
|
+
name: "Description",
|
|
3171
|
+
placeholder: "Enter product description",
|
|
3172
|
+
className: "min-h-32"
|
|
3173
|
+
}
|
|
3174
|
+
),
|
|
3175
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.FormCheckbox, { form, id: "active", name: "Active" }),
|
|
3176
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.CommonEditorButtons, { isEdit: !!product, form, disabled: isSubmitting, setOpen: onOpenChange })
|
|
3177
|
+
] }) })
|
|
3178
|
+
] }) });
|
|
3179
|
+
}
|
|
3180
|
+
_chunk7QVYU63Ejs.__name.call(void 0, ProductEditor, "ProductEditor");
|
|
3181
|
+
|
|
3182
|
+
// src/features/billing/contexts/BillingContext.tsx
|
|
3183
|
+
|
|
3184
|
+
var BillingContext = _react.createContext.call(void 0, void 0);
|
|
3185
|
+
var BillingProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ children }) => {
|
|
3186
|
+
const t = _nextintl.useTranslations.call(void 0, );
|
|
3187
|
+
const { hasRole } = _chunkGYGMEDVSjs.useCurrentUserContext.call(void 0, );
|
|
3188
|
+
const [showCreateProduct, setShowCreateProduct] = _react.useState.call(void 0, false);
|
|
3189
|
+
const [refreshToken, setRefreshToken] = _react.useState.call(void 0, 0);
|
|
3190
|
+
const refresh = _react.useCallback.call(void 0, () => setRefreshToken((value) => value + 1), []);
|
|
3191
|
+
const breadcrumbs = [{ name: t(`billing.admin.products.title`) }];
|
|
3192
|
+
const title = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
3193
|
+
const response = { type: t(`billing.admin.products.title`) };
|
|
3194
|
+
if (hasRole(_chunkTOKHHZSPjs.getRoleId.call(void 0, ).Administrator)) {
|
|
3195
|
+
response.functions = [
|
|
3196
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Button, { onClick: () => setShowCreateProduct(true), children: t(`billing.admin.products.create`) }, "productEditorTrigger"),
|
|
3197
|
+
showCreateProduct ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3198
|
+
ProductEditor,
|
|
3199
|
+
{
|
|
3200
|
+
open: showCreateProduct,
|
|
3201
|
+
onOpenChange: setShowCreateProduct,
|
|
3202
|
+
onSuccess: () => {
|
|
3203
|
+
setShowCreateProduct(false);
|
|
3204
|
+
refresh();
|
|
3205
|
+
}
|
|
3206
|
+
},
|
|
3207
|
+
"productEditor"
|
|
3208
|
+
) : null
|
|
3209
|
+
];
|
|
3210
|
+
}
|
|
3211
|
+
return response;
|
|
3212
|
+
}, "title");
|
|
3213
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.SharedProvider, { value: { breadcrumbs, title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BillingContext.Provider, { value: { refreshToken, refresh }, children }) });
|
|
3214
|
+
}, "BillingProvider");
|
|
3215
|
+
var useBillingContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
3216
|
+
const context = _react.useContext.call(void 0, BillingContext);
|
|
3217
|
+
if (context === void 0) {
|
|
3218
|
+
throw new Error("useBillingContext must be used within a BillingProvider");
|
|
3219
|
+
}
|
|
3220
|
+
return context;
|
|
3221
|
+
}, "useBillingContext");
|
|
3222
|
+
var useOptionalBillingContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => _react.useContext.call(void 0, BillingContext), "useOptionalBillingContext");
|
|
3223
|
+
|
|
3103
3224
|
// src/features/billing/stripe-price/components/forms/PriceEditor.tsx
|
|
3104
3225
|
|
|
3105
3226
|
|
|
@@ -3114,7 +3235,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3114
3235
|
_react.useEffect.call(void 0, () => {
|
|
3115
3236
|
const fetchFeatures = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3116
3237
|
try {
|
|
3117
|
-
const features = await
|
|
3238
|
+
const features = await _chunkV66AZWPGjs.FeatureService.findMany({});
|
|
3118
3239
|
setAllFeatures(features);
|
|
3119
3240
|
} catch (error) {
|
|
3120
3241
|
console.error("[PriceEditor] Failed to fetch features:", error);
|
|
@@ -3143,23 +3264,23 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3143
3264
|
featureIds: _zod3.z.array(_zod3.z.string())
|
|
3144
3265
|
});
|
|
3145
3266
|
const isEditMode = !!price;
|
|
3146
|
-
const defaultUnitAmount = _optionalChain([price, 'optionalAccess',
|
|
3267
|
+
const defaultUnitAmount = _optionalChain([price, 'optionalAccess', _120 => _120.unitAmount]) ? price.unitAmount / 100 : 0;
|
|
3147
3268
|
const coreFeatureIds = allFeatures.filter((f) => f.isCore).map((f) => f.id);
|
|
3148
|
-
const defaultFeatureIds = [.../* @__PURE__ */ new Set([..._nullishCoalesce(_optionalChain([price, 'optionalAccess',
|
|
3269
|
+
const defaultFeatureIds = [.../* @__PURE__ */ new Set([..._nullishCoalesce(_optionalChain([price, 'optionalAccess', _121 => _121.priceFeatures, 'optionalAccess', _122 => _122.map, 'call', _123 => _123((f) => f.id)]), () => ( [])), ...coreFeatureIds])];
|
|
3149
3270
|
const form = _reacthookform.useForm.call(void 0, {
|
|
3150
3271
|
resolver: _zod.zodResolver.call(void 0, formSchema2),
|
|
3151
3272
|
defaultValues: {
|
|
3152
3273
|
unitAmount: defaultUnitAmount,
|
|
3153
|
-
currency: _optionalChain([price, 'optionalAccess',
|
|
3154
|
-
interval: _optionalChain([price, 'optionalAccess',
|
|
3155
|
-
intervalCount: _optionalChain([price, 'optionalAccess',
|
|
3156
|
-
usageType: _optionalChain([price, 'optionalAccess',
|
|
3157
|
-
nickname: _optionalChain([price, 'optionalAccess',
|
|
3158
|
-
active: _nullishCoalesce(_optionalChain([price, 'optionalAccess',
|
|
3159
|
-
isTrial: _nullishCoalesce(_optionalChain([price, 'optionalAccess',
|
|
3160
|
-
description: _optionalChain([price, 'optionalAccess',
|
|
3161
|
-
features: _optionalChain([price, 'optionalAccess',
|
|
3162
|
-
token: _nullishCoalesce(_optionalChain([price, 'optionalAccess',
|
|
3274
|
+
currency: _optionalChain([price, 'optionalAccess', _124 => _124.currency]) || "usd",
|
|
3275
|
+
interval: _optionalChain([price, 'optionalAccess', _125 => _125.priceType]) === "one_time" ? "one_time" : _optionalChain([price, 'optionalAccess', _126 => _126.recurring, 'optionalAccess', _127 => _127.interval]) || "month",
|
|
3276
|
+
intervalCount: _optionalChain([price, 'optionalAccess', _128 => _128.recurring, 'optionalAccess', _129 => _129.intervalCount]) || 1,
|
|
3277
|
+
usageType: _optionalChain([price, 'optionalAccess', _130 => _130.recurring, 'optionalAccess', _131 => _131.usageType]) || "licensed",
|
|
3278
|
+
nickname: _optionalChain([price, 'optionalAccess', _132 => _132.nickname]) || "",
|
|
3279
|
+
active: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _133 => _133.active]), () => ( true)),
|
|
3280
|
+
isTrial: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _134 => _134.isTrial]), () => ( false)),
|
|
3281
|
+
description: _optionalChain([price, 'optionalAccess', _135 => _135.description]) || "",
|
|
3282
|
+
features: _optionalChain([price, 'optionalAccess', _136 => _136.features]) || [],
|
|
3283
|
+
token: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _137 => _137.token, 'optionalAccess', _138 => _138.toString, 'call', _139 => _139()]), () => ( "")),
|
|
3163
3284
|
featureIds: defaultFeatureIds
|
|
3164
3285
|
}
|
|
3165
3286
|
});
|
|
@@ -3167,24 +3288,24 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3167
3288
|
if (open) {
|
|
3168
3289
|
const currentCoreFeatureIds = allFeatures.filter((f) => f.isCore).map((f) => f.id);
|
|
3169
3290
|
const resetFeatureIds = [
|
|
3170
|
-
.../* @__PURE__ */ new Set([..._nullishCoalesce(_optionalChain([price, 'optionalAccess',
|
|
3291
|
+
.../* @__PURE__ */ new Set([..._nullishCoalesce(_optionalChain([price, 'optionalAccess', _140 => _140.priceFeatures, 'optionalAccess', _141 => _141.map, 'call', _142 => _142((f) => f.id)]), () => ( [])), ...currentCoreFeatureIds])
|
|
3171
3292
|
];
|
|
3172
3293
|
form.reset({
|
|
3173
|
-
unitAmount: _optionalChain([price, 'optionalAccess',
|
|
3174
|
-
currency: _optionalChain([price, 'optionalAccess',
|
|
3175
|
-
interval: _optionalChain([price, 'optionalAccess',
|
|
3176
|
-
intervalCount: _optionalChain([price, 'optionalAccess',
|
|
3177
|
-
usageType: _optionalChain([price, 'optionalAccess',
|
|
3178
|
-
nickname: _optionalChain([price, 'optionalAccess',
|
|
3179
|
-
active: _nullishCoalesce(_optionalChain([price, 'optionalAccess',
|
|
3180
|
-
isTrial: _nullishCoalesce(_optionalChain([price, 'optionalAccess',
|
|
3181
|
-
description: _optionalChain([price, 'optionalAccess',
|
|
3182
|
-
features: _optionalChain([price, 'optionalAccess',
|
|
3183
|
-
token: _nullishCoalesce(_optionalChain([price, 'optionalAccess',
|
|
3294
|
+
unitAmount: _optionalChain([price, 'optionalAccess', _143 => _143.unitAmount]) ? price.unitAmount / 100 : 0,
|
|
3295
|
+
currency: _optionalChain([price, 'optionalAccess', _144 => _144.currency]) || "usd",
|
|
3296
|
+
interval: _optionalChain([price, 'optionalAccess', _145 => _145.priceType]) === "one_time" ? "one_time" : _optionalChain([price, 'optionalAccess', _146 => _146.recurring, 'optionalAccess', _147 => _147.interval]) || "month",
|
|
3297
|
+
intervalCount: _optionalChain([price, 'optionalAccess', _148 => _148.recurring, 'optionalAccess', _149 => _149.intervalCount]) || 1,
|
|
3298
|
+
usageType: _optionalChain([price, 'optionalAccess', _150 => _150.recurring, 'optionalAccess', _151 => _151.usageType]) || "licensed",
|
|
3299
|
+
nickname: _optionalChain([price, 'optionalAccess', _152 => _152.nickname]) || "",
|
|
3300
|
+
active: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _153 => _153.active]), () => ( true)),
|
|
3301
|
+
isTrial: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _154 => _154.isTrial]), () => ( false)),
|
|
3302
|
+
description: _optionalChain([price, 'optionalAccess', _155 => _155.description]) || "",
|
|
3303
|
+
features: _optionalChain([price, 'optionalAccess', _156 => _156.features]) || [],
|
|
3304
|
+
token: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _157 => _157.token, 'optionalAccess', _158 => _158.toString, 'call', _159 => _159()]), () => ( "")),
|
|
3184
3305
|
featureIds: resetFeatureIds
|
|
3185
3306
|
});
|
|
3186
3307
|
}
|
|
3187
|
-
}, [open, _optionalChain([price, 'optionalAccess',
|
|
3308
|
+
}, [open, _optionalChain([price, 'optionalAccess', _160 => _160.id]), allFeatures]);
|
|
3188
3309
|
const watchInterval = form.watch("interval");
|
|
3189
3310
|
const isRecurring = watchInterval !== "one_time";
|
|
3190
3311
|
const onSubmit = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async (values) => {
|
|
@@ -3192,14 +3313,14 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3192
3313
|
try {
|
|
3193
3314
|
const unitAmountInCents = Math.round(values.unitAmount * 100);
|
|
3194
3315
|
if (isEditMode) {
|
|
3195
|
-
await
|
|
3316
|
+
await _chunkV66AZWPGjs.StripePriceService.updatePrice({
|
|
3196
3317
|
id: price.id,
|
|
3197
3318
|
nickname: values.nickname || void 0,
|
|
3198
3319
|
description: values.description || void 0,
|
|
3199
3320
|
features: values.features.filter((f) => f.trim()) || void 0,
|
|
3200
3321
|
token: values.token ? parseInt(values.token, 10) : void 0,
|
|
3201
3322
|
// Only include isTrial and featureIds for recurring prices
|
|
3202
|
-
..._optionalChain([price, 'optionalAccess',
|
|
3323
|
+
..._optionalChain([price, 'optionalAccess', _161 => _161.priceType]) === "recurring" ? { isTrial: values.isTrial, featureIds: values.featureIds } : {}
|
|
3203
3324
|
});
|
|
3204
3325
|
} else {
|
|
3205
3326
|
const createInput = {
|
|
@@ -3234,7 +3355,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3234
3355
|
createInput.featureIds = values.featureIds;
|
|
3235
3356
|
}
|
|
3236
3357
|
}
|
|
3237
|
-
await
|
|
3358
|
+
await _chunkV66AZWPGjs.StripePriceService.createPrice(createInput);
|
|
3238
3359
|
}
|
|
3239
3360
|
onSuccess();
|
|
3240
3361
|
onOpenChange(false);
|
|
@@ -3260,10 +3381,10 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3260
3381
|
{ id: "licensed", text: "Licensed (per unit)" },
|
|
3261
3382
|
{ id: "metered", text: "Metered (usage-based)" }
|
|
3262
3383
|
];
|
|
3263
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3264
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3265
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3266
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3384
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.DialogContent, { className: "max-w-2xl", children: [
|
|
3385
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.DialogHeader, { children: [
|
|
3386
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.DialogTitle, { children: isEditMode ? "Edit Price" : "Create Price" }),
|
|
3387
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.DialogDescription, { children: isEditMode ? "Update the price details. Note: Only nickname and active status can be changed." : "Create a new price for this product" })
|
|
3267
3388
|
] }),
|
|
3268
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: [
|
|
3269
3390
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.AlertCircle, { className: "text-primary mt-0.5 h-5 w-5 flex-shrink-0" }),
|
|
@@ -3272,10 +3393,10 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3272
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." })
|
|
3273
3394
|
] })
|
|
3274
3395
|
] }),
|
|
3275
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3396
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-col gap-y-4", children: [
|
|
3276
3397
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
|
|
3277
3398
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3278
|
-
|
|
3399
|
+
_chunkGYGMEDVSjs.FormInput,
|
|
3279
3400
|
{
|
|
3280
3401
|
form,
|
|
3281
3402
|
id: "unitAmount",
|
|
@@ -3285,10 +3406,10 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3285
3406
|
isRequired: true
|
|
3286
3407
|
}
|
|
3287
3408
|
),
|
|
3288
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3409
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.FormSelect, { form, id: "currency", name: "Currency", values: currencyOptions, disabled: isEditMode })
|
|
3289
3410
|
] }),
|
|
3290
3411
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3291
|
-
|
|
3412
|
+
_chunkGYGMEDVSjs.FormSelect,
|
|
3292
3413
|
{
|
|
3293
3414
|
form,
|
|
3294
3415
|
id: "interval",
|
|
@@ -3299,7 +3420,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3299
3420
|
),
|
|
3300
3421
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
|
|
3301
3422
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3302
|
-
|
|
3423
|
+
_chunkGYGMEDVSjs.FormInput,
|
|
3303
3424
|
{
|
|
3304
3425
|
form,
|
|
3305
3426
|
id: "intervalCount",
|
|
@@ -3310,7 +3431,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3310
3431
|
}
|
|
3311
3432
|
),
|
|
3312
3433
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3313
|
-
|
|
3434
|
+
_chunkGYGMEDVSjs.FormSelect,
|
|
3314
3435
|
{
|
|
3315
3436
|
form,
|
|
3316
3437
|
id: "usageType",
|
|
@@ -3321,7 +3442,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3321
3442
|
)
|
|
3322
3443
|
] }),
|
|
3323
3444
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3324
|
-
|
|
3445
|
+
_chunkGYGMEDVSjs.FormInput,
|
|
3325
3446
|
{
|
|
3326
3447
|
form,
|
|
3327
3448
|
id: "nickname",
|
|
@@ -3330,7 +3451,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3330
3451
|
}
|
|
3331
3452
|
),
|
|
3332
3453
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3333
|
-
|
|
3454
|
+
_chunkGYGMEDVSjs.FormTextarea,
|
|
3334
3455
|
{
|
|
3335
3456
|
form,
|
|
3336
3457
|
id: "description",
|
|
@@ -3339,13 +3460,13 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3339
3460
|
className: "min-h-24"
|
|
3340
3461
|
}
|
|
3341
3462
|
),
|
|
3342
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3463
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.FormInput, { form, id: "token", name: "Token (optional)", placeholder: "Enter token value" }),
|
|
3343
3464
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
3344
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3465
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Label, { children: "Features (optional)" }),
|
|
3345
3466
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
3346
3467
|
form.watch("features").map((_, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
|
|
3347
3468
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3348
|
-
|
|
3469
|
+
_chunkGYGMEDVSjs.Input,
|
|
3349
3470
|
{
|
|
3350
3471
|
...form.register(`features.${index}`),
|
|
3351
3472
|
placeholder: `Feature ${index + 1}`,
|
|
@@ -3353,7 +3474,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3353
3474
|
}
|
|
3354
3475
|
),
|
|
3355
3476
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3356
|
-
|
|
3477
|
+
_chunkGYGMEDVSjs.Button,
|
|
3357
3478
|
{
|
|
3358
3479
|
type: "button",
|
|
3359
3480
|
variant: "outline",
|
|
@@ -3370,7 +3491,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3370
3491
|
)
|
|
3371
3492
|
] }, index)),
|
|
3372
3493
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3373
|
-
|
|
3494
|
+
_chunkGYGMEDVSjs.Button,
|
|
3374
3495
|
{
|
|
3375
3496
|
type: "button",
|
|
3376
3497
|
variant: "outline",
|
|
@@ -3389,7 +3510,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3389
3510
|
] })
|
|
3390
3511
|
] }),
|
|
3391
3512
|
isRecurring && allFeatures.length > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
3392
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3513
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Label, { children: "Platform Features" }),
|
|
3393
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) => {
|
|
3394
3515
|
const isCore = feature.isCore;
|
|
3395
3516
|
const isChecked = form.watch("featureIds").includes(feature.id);
|
|
@@ -3431,9 +3552,9 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3431
3552
|
] }, feature.id);
|
|
3432
3553
|
}) })
|
|
3433
3554
|
] }),
|
|
3434
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3555
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.FormCheckbox, { form, id: "active", name: "Active" }),
|
|
3435
3556
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3436
|
-
|
|
3557
|
+
_chunkGYGMEDVSjs.FormCheckbox,
|
|
3437
3558
|
{
|
|
3438
3559
|
form,
|
|
3439
3560
|
id: "isTrial",
|
|
@@ -3441,7 +3562,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3441
3562
|
description: "Mark this as the trial subscription plan (only one price should be marked as trial)"
|
|
3442
3563
|
}
|
|
3443
3564
|
),
|
|
3444
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3565
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.CommonEditorButtons, { isEdit: isEditMode, form, disabled: isSubmitting, setOpen: onOpenChange })
|
|
3445
3566
|
] }) })
|
|
3446
3567
|
] }) });
|
|
3447
3568
|
}
|
|
@@ -3463,7 +3584,7 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3463
3584
|
const loadPrices = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3464
3585
|
setLoading(true);
|
|
3465
3586
|
try {
|
|
3466
|
-
const fetchedPrices = await
|
|
3587
|
+
const fetchedPrices = await _chunkV66AZWPGjs.StripePriceService.listPrices({ productId });
|
|
3467
3588
|
setPrices(fetchedPrices);
|
|
3468
3589
|
} catch (error) {
|
|
3469
3590
|
console.error("[PricesList] Failed to load prices:", error);
|
|
@@ -3480,7 +3601,7 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3480
3601
|
}
|
|
3481
3602
|
setArchivingPriceId(priceToArchive.id);
|
|
3482
3603
|
try {
|
|
3483
|
-
await
|
|
3604
|
+
await _chunkV66AZWPGjs.StripePriceService.archivePrice({ id: priceToArchive.id });
|
|
3484
3605
|
setPriceToArchive(null);
|
|
3485
3606
|
await loadPrices();
|
|
3486
3607
|
onPricesChange();
|
|
@@ -3496,7 +3617,7 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3496
3617
|
}
|
|
3497
3618
|
setReactivatingPriceId(priceToReactivate.id);
|
|
3498
3619
|
try {
|
|
3499
|
-
await
|
|
3620
|
+
await _chunkV66AZWPGjs.StripePriceService.reactivatePrice({ id: priceToReactivate.id });
|
|
3500
3621
|
setPriceToReactivate(null);
|
|
3501
3622
|
await loadPrices();
|
|
3502
3623
|
onPricesChange();
|
|
@@ -3527,12 +3648,12 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3527
3648
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-4", children: [
|
|
3528
3649
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center justify-between mb-4", children: [
|
|
3529
3650
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "text-lg font-semibold", children: "Prices" }),
|
|
3530
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3651
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Button, { size: "sm", onClick: () => setShowCreatePrice(true), children: "Add Price" })
|
|
3531
3652
|
] }),
|
|
3532
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: [
|
|
3533
3654
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.DollarSign, { className: "text-muted-foreground h-12 w-12" }),
|
|
3534
3655
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-sm", children: "No prices yet. Add a price to enable subscriptions." }),
|
|
3535
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3656
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Button, { size: "sm", onClick: () => setShowCreatePrice(true), children: "Add Price" })
|
|
3536
3657
|
] }),
|
|
3537
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) => {
|
|
3538
3659
|
const isArchiving = archivingPriceId === price.id;
|
|
@@ -3541,9 +3662,9 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3541
3662
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-start justify-between mb-3", children: [
|
|
3542
3663
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.DollarSign, { className: "h-5 w-5 text-primary" }),
|
|
3543
3664
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-1", children: [
|
|
3544
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3665
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Button, { variant: "ghost", size: "sm", onClick: () => setEditingPrice(price), className: "h-8 w-8 p-0", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Edit, { className: "h-4 w-4" }) }),
|
|
3545
3666
|
price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3546
|
-
|
|
3667
|
+
_chunkGYGMEDVSjs.Button,
|
|
3547
3668
|
{
|
|
3548
3669
|
variant: "ghost",
|
|
3549
3670
|
size: "sm",
|
|
@@ -3553,7 +3674,7 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3553
3674
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Archive, { className: "h-4 w-4" })
|
|
3554
3675
|
}
|
|
3555
3676
|
) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3556
|
-
|
|
3677
|
+
_chunkGYGMEDVSjs.Button,
|
|
3557
3678
|
{
|
|
3558
3679
|
variant: "ghost",
|
|
3559
3680
|
size: "sm",
|
|
@@ -3570,11 +3691,11 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3570
3691
|
" ",
|
|
3571
3692
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-sm font-normal", children: formatInterval2(price) })
|
|
3572
3693
|
] }) }),
|
|
3573
|
-
_optionalChain([price, 'access',
|
|
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 }),
|
|
3574
3695
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2", children: [
|
|
3575
|
-
price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3576
|
-
_optionalChain([price, 'access',
|
|
3577
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3696
|
+
price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Badge, { variant: "softGreen", children: "Active" }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Badge, { variant: "softGray", children: "Inactive" }),
|
|
3697
|
+
_optionalChain([price, 'access', _164 => _164.recurring, 'optionalAccess', _165 => _165.usageType]) === "metered" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Badge, { variant: "softBlue", children: "Metered" }),
|
|
3698
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Badge, { variant: "softGray", className: "uppercase", children: price.currency })
|
|
3578
3699
|
] })
|
|
3579
3700
|
] }, price.id);
|
|
3580
3701
|
}) }),
|
|
@@ -3604,20 +3725,20 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3604
3725
|
}
|
|
3605
3726
|
}
|
|
3606
3727
|
),
|
|
3607
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3608
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3609
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3610
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3728
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.AlertDialog, { open: !!priceToArchive, onOpenChange: (open) => !open && setPriceToArchive(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.AlertDialogContent, { children: [
|
|
3729
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.AlertDialogHeader, { children: [
|
|
3730
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.AlertDialogTitle, { children: "Archive Price" }),
|
|
3731
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.AlertDialogDescription, { children: [
|
|
3611
3732
|
"Are you sure you want to archive the price for",
|
|
3612
3733
|
" ",
|
|
3613
3734
|
priceToArchive && `${formatCurrency(priceToArchive.unitAmount, priceToArchive.currency)} ${formatInterval2(priceToArchive)}`,
|
|
3614
3735
|
"? This will prevent new subscriptions but existing ones will continue."
|
|
3615
3736
|
] })
|
|
3616
3737
|
] }),
|
|
3617
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3618
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3738
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.AlertDialogFooter, { children: [
|
|
3739
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.AlertDialogCancel, { disabled: !!archivingPriceId, children: "Cancel" }),
|
|
3619
3740
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3620
|
-
|
|
3741
|
+
_chunkGYGMEDVSjs.AlertDialogAction,
|
|
3621
3742
|
{
|
|
3622
3743
|
onClick: handleArchive,
|
|
3623
3744
|
disabled: !!archivingPriceId,
|
|
@@ -3627,20 +3748,20 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3627
3748
|
)
|
|
3628
3749
|
] })
|
|
3629
3750
|
] }) }),
|
|
3630
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3631
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3632
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3633
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3751
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.AlertDialog, { open: !!priceToReactivate, onOpenChange: (open) => !open && setPriceToReactivate(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.AlertDialogContent, { children: [
|
|
3752
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.AlertDialogHeader, { children: [
|
|
3753
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.AlertDialogTitle, { children: "Reactivate Price" }),
|
|
3754
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.AlertDialogDescription, { children: [
|
|
3634
3755
|
"Are you sure you want to reactivate the price for",
|
|
3635
3756
|
" ",
|
|
3636
3757
|
priceToReactivate && `${formatCurrency(priceToReactivate.unitAmount, priceToReactivate.currency)} ${formatInterval2(priceToReactivate)}`,
|
|
3637
3758
|
"? This will allow new subscriptions again."
|
|
3638
3759
|
] })
|
|
3639
3760
|
] }),
|
|
3640
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3641
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3761
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.AlertDialogFooter, { children: [
|
|
3762
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.AlertDialogCancel, { disabled: !!reactivatingPriceId, children: "Cancel" }),
|
|
3642
3763
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3643
|
-
|
|
3764
|
+
_chunkGYGMEDVSjs.AlertDialogAction,
|
|
3644
3765
|
{
|
|
3645
3766
|
onClick: handleReactivate,
|
|
3646
3767
|
disabled: !!reactivatingPriceId,
|
|
@@ -3658,78 +3779,6 @@ _chunk7QVYU63Ejs.__name.call(void 0, PricesList, "PricesList");
|
|
|
3658
3779
|
|
|
3659
3780
|
|
|
3660
3781
|
|
|
3661
|
-
// src/features/billing/stripe-product/components/forms/ProductEditor.tsx
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
function ProductEditor({ product, open, onOpenChange, onSuccess }) {
|
|
3669
|
-
const [isSubmitting, setIsSubmitting] = _react.useState.call(void 0, false);
|
|
3670
|
-
const formSchema2 = _zod3.z.object({
|
|
3671
|
-
name: _zod3.z.string().min(1, { message: "Product name is required" }),
|
|
3672
|
-
description: _zod3.z.string().min(1, { message: "Description is required" }),
|
|
3673
|
-
active: _zod3.z.boolean()
|
|
3674
|
-
});
|
|
3675
|
-
const form = _reacthookform.useForm.call(void 0, {
|
|
3676
|
-
resolver: _zod.zodResolver.call(void 0, formSchema2),
|
|
3677
|
-
defaultValues: {
|
|
3678
|
-
name: _optionalChain([product, 'optionalAccess', _163 => _163.name]) || "",
|
|
3679
|
-
description: _optionalChain([product, 'optionalAccess', _164 => _164.description]) || "",
|
|
3680
|
-
active: _nullishCoalesce(_optionalChain([product, 'optionalAccess', _165 => _165.active]), () => ( true))
|
|
3681
|
-
}
|
|
3682
|
-
});
|
|
3683
|
-
const onSubmit = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async (values) => {
|
|
3684
|
-
setIsSubmitting(true);
|
|
3685
|
-
try {
|
|
3686
|
-
if (product) {
|
|
3687
|
-
await _chunkKSU6CCW6js.StripeProductService.updateProduct({
|
|
3688
|
-
id: product.id,
|
|
3689
|
-
name: values.name,
|
|
3690
|
-
description: values.description,
|
|
3691
|
-
active: values.active
|
|
3692
|
-
});
|
|
3693
|
-
} else {
|
|
3694
|
-
await _chunkKSU6CCW6js.StripeProductService.createProduct({
|
|
3695
|
-
id: _uuid.v4.call(void 0, ),
|
|
3696
|
-
name: values.name,
|
|
3697
|
-
description: values.description,
|
|
3698
|
-
active: values.active
|
|
3699
|
-
});
|
|
3700
|
-
}
|
|
3701
|
-
onSuccess();
|
|
3702
|
-
onOpenChange(false);
|
|
3703
|
-
} catch (error) {
|
|
3704
|
-
console.error("[ProductEditor] Failed to save product:", error);
|
|
3705
|
-
} finally {
|
|
3706
|
-
setIsSubmitting(false);
|
|
3707
|
-
}
|
|
3708
|
-
}, "onSubmit");
|
|
3709
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkF3BPNQDBjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkF3BPNQDBjs.DialogContent, { className: "max-w-2xl", children: [
|
|
3710
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkF3BPNQDBjs.DialogHeader, { children: [
|
|
3711
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkF3BPNQDBjs.DialogTitle, { children: product ? "Edit Product" : "Create Product" }),
|
|
3712
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkF3BPNQDBjs.DialogDescription, { children: product ? `Update the details for ${product.name}` : "Create a new product to offer to your customers" })
|
|
3713
|
-
] }),
|
|
3714
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkF3BPNQDBjs.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-col gap-y-4", children: [
|
|
3715
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkF3BPNQDBjs.FormInput, { form, id: "name", name: "Product Name", placeholder: "Enter product name", isRequired: true }),
|
|
3716
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3717
|
-
_chunkF3BPNQDBjs.FormTextarea,
|
|
3718
|
-
{
|
|
3719
|
-
form,
|
|
3720
|
-
id: "description",
|
|
3721
|
-
name: "Description",
|
|
3722
|
-
placeholder: "Enter product description",
|
|
3723
|
-
className: "min-h-32"
|
|
3724
|
-
}
|
|
3725
|
-
),
|
|
3726
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkF3BPNQDBjs.FormCheckbox, { form, id: "active", name: "Active" }),
|
|
3727
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkF3BPNQDBjs.CommonEditorButtons, { isEdit: !!product, form, disabled: isSubmitting, setOpen: onOpenChange })
|
|
3728
|
-
] }) })
|
|
3729
|
-
] }) });
|
|
3730
|
-
}
|
|
3731
|
-
_chunk7QVYU63Ejs.__name.call(void 0, ProductEditor, "ProductEditor");
|
|
3732
|
-
|
|
3733
3782
|
// src/features/billing/stripe-product/components/lists/ProductsList.tsx
|
|
3734
3783
|
|
|
3735
3784
|
|
|
@@ -3747,7 +3796,7 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3747
3796
|
}
|
|
3748
3797
|
setArchivingProductId(productToArchive.id);
|
|
3749
3798
|
try {
|
|
3750
|
-
const _archivedProduct = await
|
|
3799
|
+
const _archivedProduct = await _chunkV66AZWPGjs.StripeProductService.archiveProduct({ id: productToArchive.id });
|
|
3751
3800
|
setProductToArchive(null);
|
|
3752
3801
|
onProductsChange();
|
|
3753
3802
|
} catch (_error) {
|
|
@@ -3762,7 +3811,7 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3762
3811
|
}
|
|
3763
3812
|
setReactivatingProductId(productToReactivate.id);
|
|
3764
3813
|
try {
|
|
3765
|
-
const _reactivatedProduct = await
|
|
3814
|
+
const _reactivatedProduct = await _chunkV66AZWPGjs.StripeProductService.reactivateProduct({ id: productToReactivate.id });
|
|
3766
3815
|
setProductToReactivate(null);
|
|
3767
3816
|
onProductsChange();
|
|
3768
3817
|
} catch (_error) {
|
|
@@ -3785,18 +3834,18 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3785
3834
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex-1", children: [
|
|
3786
3835
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
3787
3836
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium", children: product.name }),
|
|
3788
|
-
product.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3837
|
+
product.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Badge, { variant: "softGreen", children: "Active" }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Badge, { variant: "softGray", children: "Inactive" })
|
|
3789
3838
|
] }),
|
|
3790
3839
|
product.description && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-sm mt-1", children: product.description })
|
|
3791
3840
|
] })
|
|
3792
3841
|
] }),
|
|
3793
3842
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
3794
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3843
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.Button, { variant: "outline", size: "sm", onClick: () => setEditingProduct(product), children: [
|
|
3795
3844
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Edit, { className: "h-4 w-4 mr-1" }),
|
|
3796
3845
|
"Edit"
|
|
3797
3846
|
] }),
|
|
3798
3847
|
product.active ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3799
|
-
|
|
3848
|
+
_chunkGYGMEDVSjs.Button,
|
|
3800
3849
|
{
|
|
3801
3850
|
variant: "outline",
|
|
3802
3851
|
size: "sm",
|
|
@@ -3808,7 +3857,7 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3808
3857
|
]
|
|
3809
3858
|
}
|
|
3810
3859
|
) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3811
|
-
|
|
3860
|
+
_chunkGYGMEDVSjs.Button,
|
|
3812
3861
|
{
|
|
3813
3862
|
variant: "outline",
|
|
3814
3863
|
size: "sm",
|
|
@@ -3820,7 +3869,7 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3820
3869
|
]
|
|
3821
3870
|
}
|
|
3822
3871
|
),
|
|
3823
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3872
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.Button, { variant: "ghost", size: "sm", onClick: () => toggleExpand(product.id), children: isExpanded ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ChevronUp, { className: "h-5 w-5" }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ChevronDown, { className: "h-5 w-5" }) })
|
|
3824
3873
|
] })
|
|
3825
3874
|
] }),
|
|
3826
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 }) })
|
|
@@ -3838,19 +3887,19 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3838
3887
|
}
|
|
3839
3888
|
}
|
|
3840
3889
|
),
|
|
3841
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3842
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3843
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3844
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3890
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.AlertDialog, { open: !!productToArchive, onOpenChange: (open) => !open && setProductToArchive(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.AlertDialogContent, { children: [
|
|
3891
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.AlertDialogHeader, { children: [
|
|
3892
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.AlertDialogTitle, { children: "Archive Product" }),
|
|
3893
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.AlertDialogDescription, { children: [
|
|
3845
3894
|
'Are you sure you want to archive "',
|
|
3846
3895
|
_optionalChain([productToArchive, 'optionalAccess', _166 => _166.name]),
|
|
3847
3896
|
'"? This will deactivate it and it will no longer be available for new subscriptions.'
|
|
3848
3897
|
] })
|
|
3849
3898
|
] }),
|
|
3850
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3851
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3899
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.AlertDialogFooter, { children: [
|
|
3900
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.AlertDialogCancel, { disabled: !!archivingProductId, children: "Cancel" }),
|
|
3852
3901
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3853
|
-
|
|
3902
|
+
_chunkGYGMEDVSjs.AlertDialogAction,
|
|
3854
3903
|
{
|
|
3855
3904
|
onClick: handleArchive,
|
|
3856
3905
|
disabled: !!archivingProductId,
|
|
@@ -3860,19 +3909,19 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3860
3909
|
)
|
|
3861
3910
|
] })
|
|
3862
3911
|
] }) }),
|
|
3863
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3864
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3865
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3866
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3912
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.AlertDialog, { open: !!productToReactivate, onOpenChange: (open) => !open && setProductToReactivate(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.AlertDialogContent, { children: [
|
|
3913
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.AlertDialogHeader, { children: [
|
|
3914
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.AlertDialogTitle, { children: "Reactivate Product" }),
|
|
3915
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.AlertDialogDescription, { children: [
|
|
3867
3916
|
'Are you sure you want to reactivate "',
|
|
3868
3917
|
_optionalChain([productToReactivate, 'optionalAccess', _167 => _167.name]),
|
|
3869
3918
|
'"? This will make it available for new subscriptions again.'
|
|
3870
3919
|
] })
|
|
3871
3920
|
] }),
|
|
3872
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3873
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3921
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkGYGMEDVSjs.AlertDialogFooter, { children: [
|
|
3922
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.AlertDialogCancel, { disabled: !!reactivatingProductId, children: "Cancel" }),
|
|
3874
3923
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3875
|
-
|
|
3924
|
+
_chunkGYGMEDVSjs.AlertDialogAction,
|
|
3876
3925
|
{
|
|
3877
3926
|
onClick: handleReactivate,
|
|
3878
3927
|
disabled: !!reactivatingProductId,
|
|
@@ -3889,17 +3938,18 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductsList, "ProductsList");
|
|
|
3889
3938
|
// src/features/billing/stripe-product/components/containers/ProductsAdminContainer.tsx
|
|
3890
3939
|
|
|
3891
3940
|
function ProductsAdminContainer() {
|
|
3892
|
-
const { hasRole } =
|
|
3941
|
+
const { hasRole } = _chunkGYGMEDVSjs.useCurrentUserContext.call(void 0, );
|
|
3942
|
+
const billing = useOptionalBillingContext();
|
|
3893
3943
|
const [products, setProducts] = _react.useState.call(void 0, []);
|
|
3894
3944
|
const [loading, setLoading] = _react.useState.call(void 0, true);
|
|
3895
3945
|
const [showCreateProduct, setShowCreateProduct] = _react.useState.call(void 0, false);
|
|
3896
|
-
if (!hasRole(
|
|
3946
|
+
if (!hasRole(_chunkTOKHHZSPjs.getRoleId.call(void 0, ).Administrator)) {
|
|
3897
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." }) });
|
|
3898
3948
|
}
|
|
3899
3949
|
const loadProducts = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3900
3950
|
setLoading(true);
|
|
3901
3951
|
try {
|
|
3902
|
-
const fetchedProducts = await
|
|
3952
|
+
const fetchedProducts = await _chunkV66AZWPGjs.StripeProductService.listProducts();
|
|
3903
3953
|
setProducts(fetchedProducts);
|
|
3904
3954
|
} catch (error) {
|
|
3905
3955
|
console.error("[ProductsAdminContainer] Failed to load products:", error);
|
|
@@ -3909,32 +3959,39 @@ function ProductsAdminContainer() {
|
|
|
3909
3959
|
}, "loadProducts");
|
|
3910
3960
|
_react.useEffect.call(void 0, () => {
|
|
3911
3961
|
loadProducts();
|
|
3912
|
-
}, []);
|
|
3962
|
+
}, [_optionalChain([billing, 'optionalAccess', _168 => _168.refreshToken])]);
|
|
3913
3963
|
if (loading) {
|
|
3914
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..." }) });
|
|
3915
3965
|
}
|
|
3916
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col
|
|
3917
|
-
/* @__PURE__ */ _jsxruntime.
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
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, _chunkGYGMEDVSjs.Button, { onClick: () => setShowCreateProduct(true), children: "Create Product" }) }),
|
|
3968
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-6 px-4 pb-4", children: [
|
|
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
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Package, { className: "text-muted-foreground h-16 w-16" }),
|
|
3971
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
3972
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "mb-2 text-sm font-medium", children: "No products yet" }),
|
|
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, _chunkGYGMEDVSjs.Button, { onClick: () => setShowCreateProduct(true), children: "Create Your First Product" })
|
|
3975
|
+
] })
|
|
3921
3976
|
] }),
|
|
3922
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Package, { className: "text-muted-foreground h-16 w-16" }),
|
|
3926
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
3927
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "mb-2 text-sm font-medium", children: "No products yet" }),
|
|
3928
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground mb-4", children: "Create your first product to start offering subscriptions to your customers." }),
|
|
3929
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkF3BPNQDBjs.Button, { onClick: () => setShowCreateProduct(true), children: "Create Your First Product" })
|
|
3930
|
-
] })
|
|
3931
|
-
] }),
|
|
3932
|
-
products.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductsList, { products, onProductsChange: loadProducts }),
|
|
3933
|
-
showCreateProduct && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductEditor, { open: showCreateProduct, onOpenChange: setShowCreateProduct, onSuccess: loadProducts })
|
|
3977
|
+
products.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductsList, { products, onProductsChange: loadProducts }),
|
|
3978
|
+
showCreateProduct && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductEditor, { open: showCreateProduct, onOpenChange: setShowCreateProduct, onSuccess: loadProducts })
|
|
3979
|
+
] })
|
|
3934
3980
|
] });
|
|
3935
3981
|
}
|
|
3936
3982
|
_chunk7QVYU63Ejs.__name.call(void 0, ProductsAdminContainer, "ProductsAdminContainer");
|
|
3937
3983
|
|
|
3984
|
+
// src/features/billing/stripe-product/components/containers/ProductsAdminPageContainer.tsx
|
|
3985
|
+
|
|
3986
|
+
function ProductsAdminPageContainer() {
|
|
3987
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BillingProvider, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkGYGMEDVSjs.RoundPageContainer, { module: _chunkV66AZWPGjs.Modules.StripeProduct, fullWidth: true, forceHeader: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductsAdminContainer, {}) }) });
|
|
3988
|
+
}
|
|
3989
|
+
_chunk7QVYU63Ejs.__name.call(void 0, ProductsAdminPageContainer, "ProductsAdminPageContainer");
|
|
3990
|
+
|
|
3991
|
+
|
|
3992
|
+
|
|
3993
|
+
|
|
3994
|
+
|
|
3938
3995
|
|
|
3939
3996
|
|
|
3940
3997
|
|
|
@@ -3978,5 +4035,5 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductsAdminContainer, "ProductsAdminConta
|
|
|
3978
4035
|
|
|
3979
4036
|
|
|
3980
4037
|
|
|
3981
|
-
exports.BillingAlertBanner = BillingAlertBanner; exports.BillingDashboardContainer = BillingDashboardContainer; exports.BillingDetailModal = BillingDetailModal; exports.BillingUsageSummaryCard = BillingUsageSummaryCard; exports.CancelSubscriptionDialog = CancelSubscriptionDialog; exports.CustomerInfoCard = CustomerInfoCard; exports.IntervalToggle = IntervalToggle; exports.InvoiceDetails = InvoiceDetails; exports.InvoiceStatusBadge = InvoiceStatusBadge; exports.InvoicesContainer = InvoicesContainer; exports.InvoicesList = InvoicesList; exports.InvoicesSummaryCard = InvoicesSummaryCard; exports.PaymentMethodCard = PaymentMethodCard; exports.PaymentMethodEditor = PaymentMethodEditor; exports.PaymentMethodForm = PaymentMethodForm; exports.PaymentMethodSummaryCard = PaymentMethodSummaryCard; exports.PaymentMethodsContainer = PaymentMethodsContainer; exports.PaymentMethodsList = PaymentMethodsList; exports.PriceEditor = PriceEditor; exports.PricesList = PricesList; exports.PricingCard = PricingCard; exports.ProductEditor = ProductEditor; exports.ProductPricingList = ProductPricingList; exports.ProductPricingRow = ProductPricingRow; exports.ProductsAdminContainer = ProductsAdminContainer; exports.ProductsList = ProductsList; exports.PromoCodeInput = PromoCodeInput; exports.ProrationPreview = ProrationPreview; exports.StripeProvider = StripeProvider; exports.SubscriptionConfirmation = SubscriptionConfirmation; exports.SubscriptionDetails = SubscriptionDetails; exports.SubscriptionStatusBadge = SubscriptionStatusBadge; exports.SubscriptionSummaryCard = SubscriptionSummaryCard; exports.SubscriptionsContainer = SubscriptionsContainer; exports.SubscriptionsList = SubscriptionsList; exports.UsageContainer = UsageContainer; exports.UsageHistoryTable = UsageHistoryTable; exports.UsageSummaryCard = UsageSummaryCard; exports.UsageSummaryCards = UsageSummaryCards; exports.formatCurrency = formatCurrency; exports.formatDate = formatDate3; exports.formatInterval = formatInterval; exports.isStripeConfigured = isStripeConfigured;
|
|
4038
|
+
exports.BillingAlertBanner = BillingAlertBanner; exports.BillingDashboardContainer = BillingDashboardContainer; exports.BillingDetailModal = BillingDetailModal; exports.BillingProvider = BillingProvider; exports.BillingUsageSummaryCard = BillingUsageSummaryCard; exports.CancelSubscriptionDialog = CancelSubscriptionDialog; exports.CustomerInfoCard = CustomerInfoCard; exports.IntervalToggle = IntervalToggle; exports.InvoiceDetails = InvoiceDetails; exports.InvoiceStatusBadge = InvoiceStatusBadge; exports.InvoicesContainer = InvoicesContainer; exports.InvoicesList = InvoicesList; exports.InvoicesSummaryCard = InvoicesSummaryCard; exports.PaymentMethodCard = PaymentMethodCard; exports.PaymentMethodEditor = PaymentMethodEditor; exports.PaymentMethodForm = PaymentMethodForm; exports.PaymentMethodSummaryCard = PaymentMethodSummaryCard; exports.PaymentMethodsContainer = PaymentMethodsContainer; exports.PaymentMethodsList = PaymentMethodsList; exports.PriceEditor = PriceEditor; exports.PricesList = PricesList; exports.PricingCard = PricingCard; exports.ProductEditor = ProductEditor; exports.ProductPricingList = ProductPricingList; exports.ProductPricingRow = ProductPricingRow; exports.ProductsAdminContainer = ProductsAdminContainer; exports.ProductsAdminPageContainer = ProductsAdminPageContainer; exports.ProductsList = ProductsList; exports.PromoCodeInput = PromoCodeInput; exports.ProrationPreview = ProrationPreview; exports.StripeProvider = StripeProvider; exports.SubscriptionConfirmation = SubscriptionConfirmation; exports.SubscriptionDetails = SubscriptionDetails; exports.SubscriptionStatusBadge = SubscriptionStatusBadge; exports.SubscriptionSummaryCard = SubscriptionSummaryCard; exports.SubscriptionsContainer = SubscriptionsContainer; exports.SubscriptionsList = SubscriptionsList; exports.UsageContainer = UsageContainer; exports.UsageHistoryTable = UsageHistoryTable; exports.UsageSummaryCard = UsageSummaryCard; exports.UsageSummaryCards = UsageSummaryCards; exports.formatCurrency = formatCurrency; exports.formatDate = formatDate3; exports.formatInterval = formatInterval; exports.isStripeConfigured = isStripeConfigured; exports.useBillingContext = useBillingContext; exports.useOptionalBillingContext = useOptionalBillingContext;
|
|
3982
4039
|
//# sourceMappingURL=index.js.map
|