@carlonicora/nextjs-jsonapi 1.24.3 → 1.25.1
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-OFSTXGZX.js → BlockNoteEditor-7WAWEZVW.js} +13 -13
- package/dist/{BlockNoteEditor-OFSTXGZX.js.map → BlockNoteEditor-7WAWEZVW.js.map} +1 -1
- package/dist/{BlockNoteEditor-TJNLCNIP.mjs → BlockNoteEditor-UNVKGZ2G.mjs} +3 -3
- package/dist/billing/index.js +342 -342
- package/dist/billing/index.mjs +2 -2
- package/dist/{chunk-H5JZ5E7M.mjs → chunk-6BDOZDZ3.mjs} +1247 -54
- package/dist/chunk-6BDOZDZ3.mjs.map +1 -0
- package/dist/{chunk-EJALOG7L.js → chunk-JI6BDV7L.js} +1598 -405
- package/dist/chunk-JI6BDV7L.js.map +1 -0
- package/dist/{chunk-5U4NJJOF.mjs → chunk-LNBT2YPZ.mjs} +289 -2
- package/dist/chunk-LNBT2YPZ.mjs.map +1 -0
- package/dist/{chunk-NQVPCNRS.js → chunk-O3LLMGP7.js} +290 -3
- package/dist/chunk-O3LLMGP7.js.map +1 -0
- package/dist/client/index.d.mts +96 -1
- package/dist/client/index.d.ts +96 -1
- package/dist/client/index.js +9 -3
- package/dist/client/index.js.map +1 -1
- package/dist/client/index.mjs +8 -2
- package/dist/components/index.d.mts +225 -1
- package/dist/components/index.d.ts +225 -1
- package/dist/components/index.js +25 -3
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +24 -2
- package/dist/contexts/index.js +3 -3
- package/dist/contexts/index.mjs +2 -2
- package/dist/core/index.d.mts +108 -1
- package/dist/core/index.d.ts +108 -1
- package/dist/core/index.js +14 -2
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +13 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +14 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -1
- package/dist/oauth.interface-DsZ5ecSX.d.mts +119 -0
- package/dist/oauth.interface-vL7za9Bz.d.ts +119 -0
- package/dist/server/index.js +3 -3
- package/dist/server/index.mjs +1 -1
- package/package.json +3 -2
- package/src/client/index.ts +1 -0
- package/src/components/index.ts +1 -0
- package/src/core/index.ts +3 -0
- package/src/core/registry/ModuleRegistry.ts +2 -0
- package/src/features/index.ts +1 -0
- package/src/features/oauth/atoms/index.ts +1 -0
- package/src/features/oauth/atoms/oauth.atoms.ts +131 -0
- package/src/features/oauth/components/OAuthClientCard.tsx +105 -0
- package/src/features/oauth/components/OAuthClientDetail.tsx +269 -0
- package/src/features/oauth/components/OAuthClientForm.tsx +212 -0
- package/src/features/oauth/components/OAuthClientList.tsx +127 -0
- package/src/features/oauth/components/OAuthClientSecretDisplay.tsx +127 -0
- package/src/features/oauth/components/OAuthRedirectUriInput.tsx +152 -0
- package/src/features/oauth/components/OAuthScopeSelector.tsx +123 -0
- package/src/features/oauth/components/consent/OAuthConsentActions.tsx +41 -0
- package/src/features/oauth/components/consent/OAuthConsentHeader.tsx +51 -0
- package/src/features/oauth/components/consent/OAuthConsentScreen.tsx +142 -0
- package/src/features/oauth/components/consent/OAuthScopeList.tsx +72 -0
- package/src/features/oauth/components/consent/index.ts +4 -0
- package/src/features/oauth/components/index.ts +8 -0
- package/src/features/oauth/data/index.ts +2 -0
- package/src/features/oauth/data/oauth.service.ts +191 -0
- package/src/features/oauth/data/oauth.ts +87 -0
- package/src/features/oauth/hooks/index.ts +3 -0
- package/src/features/oauth/hooks/useOAuthClient.ts +161 -0
- package/src/features/oauth/hooks/useOAuthClients.ts +111 -0
- package/src/features/oauth/hooks/useOAuthConsent.ts +125 -0
- package/src/features/oauth/index.ts +6 -0
- package/src/features/oauth/interfaces/index.ts +1 -0
- package/src/features/oauth/interfaces/oauth.interface.ts +175 -0
- package/src/features/oauth/oauth.module.ts +9 -0
- package/dist/chunk-5U4NJJOF.mjs.map +0 -1
- package/dist/chunk-EJALOG7L.js.map +0 -1
- package/dist/chunk-H5JZ5E7M.mjs.map +0 -1
- package/dist/chunk-NQVPCNRS.js.map +0 -1
- /package/dist/{BlockNoteEditor-TJNLCNIP.mjs.map → BlockNoteEditor-UNVKGZ2G.mjs.map} +0 -0
package/dist/billing/index.js
CHANGED
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
|
|
49
49
|
|
|
50
50
|
|
|
51
|
-
var
|
|
51
|
+
var _chunkJI6BDV7Ljs = require('../chunk-JI6BDV7L.js');
|
|
52
52
|
|
|
53
53
|
|
|
54
54
|
|
|
@@ -61,7 +61,7 @@ var _chunkEW6QPMN3js = require('../chunk-EW6QPMN3.js');
|
|
|
61
61
|
|
|
62
62
|
|
|
63
63
|
|
|
64
|
-
var
|
|
64
|
+
var _chunkO3LLMGP7js = require('../chunk-O3LLMGP7.js');
|
|
65
65
|
require('../chunk-LXKSUWAV.js');
|
|
66
66
|
require('../chunk-IBS6NI7D.js');
|
|
67
67
|
require('../chunk-FM6WRAN5.js');
|
|
@@ -121,41 +121,41 @@ function SubscriptionSummaryCard({
|
|
|
121
121
|
onManageClick
|
|
122
122
|
}) {
|
|
123
123
|
if (loading) {
|
|
124
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
125
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
126
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
124
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.Card, { children: [
|
|
125
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
126
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.CardTitle, { className: "text-sm font-medium", children: "Subscriptions" }),
|
|
127
127
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
128
128
|
] }),
|
|
129
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
130
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
131
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
132
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
129
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.CardContent, { children: [
|
|
130
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
131
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Skeleton, { className: "h-4 w-24 mb-1" }),
|
|
132
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Skeleton, { className: "h-4 w-40" })
|
|
133
133
|
] })
|
|
134
134
|
] });
|
|
135
135
|
}
|
|
136
136
|
if (error) {
|
|
137
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
138
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
139
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
137
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.Card, { children: [
|
|
138
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
139
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.CardTitle, { className: "text-sm font-medium", children: "Subscriptions" }),
|
|
140
140
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
141
141
|
] }),
|
|
142
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
142
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-destructive", children: error }) })
|
|
143
143
|
] });
|
|
144
144
|
}
|
|
145
145
|
const activeSubscriptions = subscriptions.filter(
|
|
146
146
|
(sub) => sub.status === "active" /* ACTIVE */ || sub.status === "trialing" /* TRIALING */
|
|
147
147
|
);
|
|
148
148
|
const primarySubscription = activeSubscriptions[0];
|
|
149
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
150
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
151
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
149
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
|
|
150
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
151
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.CardTitle, { className: "text-sm font-medium", children: "Subscriptions" }),
|
|
152
152
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
153
153
|
] }),
|
|
154
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
154
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.CardContent, { children: subscriptions.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
155
155
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No active plan" }),
|
|
156
156
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Subscribe to get started" }),
|
|
157
157
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
158
|
-
|
|
158
|
+
_chunkJI6BDV7Ljs.Button,
|
|
159
159
|
{
|
|
160
160
|
variant: "outline",
|
|
161
161
|
size: "sm",
|
|
@@ -173,7 +173,7 @@ function SubscriptionSummaryCard({
|
|
|
173
173
|
] }) : primarySubscription ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
174
174
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
175
175
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: formatPlanName(primarySubscription) }),
|
|
176
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
176
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Badge, { variant: primarySubscription.cancelAtPeriodEnd ? "secondary" : getStatusBadgeVariant(primarySubscription.status), children: primarySubscription.cancelAtPeriodEnd ? "Canceling" : primarySubscription.status })
|
|
177
177
|
] }),
|
|
178
178
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm text-muted-foreground", children: [
|
|
179
179
|
formatPrice(_optionalChain([primarySubscription, 'access', _10 => _10.price, 'optionalAccess', _11 => _11.unitAmount]), _optionalChain([primarySubscription, 'access', _12 => _12.price, 'optionalAccess', _13 => _13.currency])),
|
|
@@ -217,36 +217,36 @@ function PaymentMethodSummaryCard({
|
|
|
217
217
|
onManageClick
|
|
218
218
|
}) {
|
|
219
219
|
if (loading) {
|
|
220
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
221
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
222
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
220
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.Card, { children: [
|
|
221
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
222
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.CardTitle, { className: "text-sm font-medium", children: "Payment Method" }),
|
|
223
223
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
224
224
|
] }),
|
|
225
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
226
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
227
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
225
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.CardContent, { children: [
|
|
226
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
227
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Skeleton, { className: "h-4 w-24" })
|
|
228
228
|
] })
|
|
229
229
|
] });
|
|
230
230
|
}
|
|
231
231
|
if (error) {
|
|
232
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
233
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
234
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
232
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.Card, { children: [
|
|
233
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
234
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.CardTitle, { className: "text-sm font-medium", children: "Payment Method" }),
|
|
235
235
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
236
236
|
] }),
|
|
237
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
237
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-destructive", children: error }) })
|
|
238
238
|
] });
|
|
239
239
|
}
|
|
240
240
|
const defaultMethod = paymentMethods.find((pm) => pm.id === defaultPaymentMethodId) || paymentMethods[0];
|
|
241
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
242
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
243
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
241
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
|
|
242
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
243
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.CardTitle, { className: "text-sm font-medium", children: "Payment Method" }),
|
|
244
244
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
245
245
|
] }),
|
|
246
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
246
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.CardContent, { children: paymentMethods.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
247
247
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No payment method" }),
|
|
248
248
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Add a card to enable subscriptions" }),
|
|
249
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
249
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.Button, { variant: "outline", size: "sm", className: "mt-2", onClick: (e) => {
|
|
250
250
|
e.stopPropagation();
|
|
251
251
|
onManageClick();
|
|
252
252
|
}, children: [
|
|
@@ -302,7 +302,7 @@ function CustomerInfoCard({ customer, loading, error }) {
|
|
|
302
302
|
e.stopPropagation();
|
|
303
303
|
setPortalLoading(true);
|
|
304
304
|
try {
|
|
305
|
-
const { url } = await
|
|
305
|
+
const { url } = await _chunkO3LLMGP7js.StripeCustomerService.createPortalSession();
|
|
306
306
|
window.open(url, "_blank");
|
|
307
307
|
} catch (err) {
|
|
308
308
|
console.error("[CustomerInfoCard] Failed to create portal session:", err);
|
|
@@ -311,52 +311,52 @@ function CustomerInfoCard({ customer, loading, error }) {
|
|
|
311
311
|
}
|
|
312
312
|
}, "handlePortalClick");
|
|
313
313
|
if (loading) {
|
|
314
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
315
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
316
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
314
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.Card, { children: [
|
|
315
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
316
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.CardTitle, { className: "text-sm font-medium", children: "Billing Account" }),
|
|
317
317
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
318
318
|
] }),
|
|
319
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
320
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
321
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
322
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
319
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.CardContent, { children: [
|
|
320
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
321
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Skeleton, { className: "h-4 w-48 mb-1" }),
|
|
322
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Skeleton, { className: "h-4 w-24" })
|
|
323
323
|
] })
|
|
324
324
|
] });
|
|
325
325
|
}
|
|
326
326
|
if (error) {
|
|
327
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
328
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
329
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
327
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.Card, { children: [
|
|
328
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
329
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.CardTitle, { className: "text-sm font-medium", children: "Billing Account" }),
|
|
330
330
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
331
331
|
] }),
|
|
332
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
332
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-destructive", children: error }) })
|
|
333
333
|
] });
|
|
334
334
|
}
|
|
335
335
|
if (!customer) {
|
|
336
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
337
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
338
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
336
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.Card, { children: [
|
|
337
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
338
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.CardTitle, { className: "text-sm font-medium", children: "Billing Account" }),
|
|
339
339
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
340
340
|
] }),
|
|
341
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
341
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.CardContent, { children: [
|
|
342
342
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "Not set up" }),
|
|
343
343
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Billing account will be created when you subscribe" })
|
|
344
344
|
] })
|
|
345
345
|
] });
|
|
346
346
|
}
|
|
347
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
348
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
349
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
347
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.Card, { children: [
|
|
348
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
349
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.CardTitle, { className: "text-sm font-medium", children: "Billing Account" }),
|
|
350
350
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
351
351
|
] }),
|
|
352
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
352
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
353
353
|
customer.name && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: customer.name }),
|
|
354
354
|
customer.email && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: customer.email }),
|
|
355
355
|
customer.balance !== void 0 && customer.balance !== 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm", children: [
|
|
356
356
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground", children: "Credit Balance: " }),
|
|
357
357
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: customer.balance < 0 ? "text-green-600" : "text-destructive", children: formatBalance(customer.balance, customer.currency) })
|
|
358
358
|
] }),
|
|
359
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
359
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.Button, { variant: "outline", size: "sm", className: "mt-2", onClick: handlePortalClick, disabled: portalLoading, children: [
|
|
360
360
|
portalLoading ? "Loading..." : "Manage in Stripe Portal",
|
|
361
361
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ExternalLink, { className: "h-4 w-4 ml-1" })
|
|
362
362
|
] })
|
|
@@ -400,42 +400,42 @@ function formatAmount(amount, currency) {
|
|
|
400
400
|
_chunk7QVYU63Ejs.__name.call(void 0, formatAmount, "formatAmount");
|
|
401
401
|
function InvoicesSummaryCard({ invoices, loading, error, onViewAllClick }) {
|
|
402
402
|
if (loading) {
|
|
403
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
404
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
405
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
403
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.Card, { children: [
|
|
404
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
405
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.CardTitle, { className: "text-sm font-medium", children: "Recent Invoices" }),
|
|
406
406
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
407
407
|
] }),
|
|
408
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
409
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
410
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
411
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
408
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.CardContent, { children: [
|
|
409
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Skeleton, { className: "h-6 w-24 mb-2" }),
|
|
410
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Skeleton, { className: "h-4 w-32 mb-1" }),
|
|
411
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Skeleton, { className: "h-4 w-20" })
|
|
412
412
|
] })
|
|
413
413
|
] });
|
|
414
414
|
}
|
|
415
415
|
if (error) {
|
|
416
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
417
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
418
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
416
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.Card, { children: [
|
|
417
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
418
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.CardTitle, { className: "text-sm font-medium", children: "Recent Invoices" }),
|
|
419
419
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
420
420
|
] }),
|
|
421
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
421
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-destructive", children: error }) })
|
|
422
422
|
] });
|
|
423
423
|
}
|
|
424
424
|
const latestInvoice = invoices[0];
|
|
425
425
|
const paidInvoices = invoices.filter((inv) => inv.status === "paid" /* PAID */);
|
|
426
426
|
const openInvoices = invoices.filter((inv) => inv.status === "open" /* OPEN */);
|
|
427
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
428
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
429
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
427
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewAllClick, children: [
|
|
428
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
429
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.CardTitle, { className: "text-sm font-medium", children: "Recent Invoices" }),
|
|
430
430
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
431
431
|
] }),
|
|
432
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
432
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.CardContent, { children: invoices.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
433
433
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No invoices yet" }),
|
|
434
434
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Invoices will appear after your first billing cycle" })
|
|
435
435
|
] }) : latestInvoice ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
436
436
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
437
437
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: formatAmount(latestInvoice.total, latestInvoice.currency) }),
|
|
438
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
438
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Badge, { variant: getStatusBadgeVariant2(latestInvoice.status), children: latestInvoice.status })
|
|
439
439
|
] }),
|
|
440
440
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: latestInvoice.stripeInvoiceNumber || `Invoice from ${formatDate2(latestInvoice.periodStart)}` }),
|
|
441
441
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-4 text-xs text-muted-foreground", children: [
|
|
@@ -475,24 +475,24 @@ function BillingUsageSummaryCard({
|
|
|
475
475
|
onViewDetailsClick
|
|
476
476
|
}) {
|
|
477
477
|
if (loading) {
|
|
478
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
479
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
480
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
478
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.Card, { children: [
|
|
479
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
480
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.CardTitle, { className: "text-sm font-medium", children: "Usage This Month" }),
|
|
481
481
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
482
482
|
] }),
|
|
483
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
484
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
485
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
483
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.CardContent, { children: [
|
|
484
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Skeleton, { className: "h-6 w-24 mb-2" }),
|
|
485
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Skeleton, { className: "h-4 w-32" })
|
|
486
486
|
] })
|
|
487
487
|
] });
|
|
488
488
|
}
|
|
489
489
|
if (error) {
|
|
490
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
491
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
492
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
490
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.Card, { children: [
|
|
491
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
492
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.CardTitle, { className: "text-sm font-medium", children: "Usage This Month" }),
|
|
493
493
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
494
494
|
] }),
|
|
495
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
495
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-destructive", children: error }) })
|
|
496
496
|
] });
|
|
497
497
|
}
|
|
498
498
|
const totalUsage = Object.values(summaries).reduce((acc, summary) => {
|
|
@@ -500,12 +500,12 @@ function BillingUsageSummaryCard({
|
|
|
500
500
|
}, 0);
|
|
501
501
|
const primaryMeter = meters.find((m) => _optionalChain([summaries, 'access', _23 => _23[m.id], 'optionalAccess', _24 => _24.aggregatedValue]));
|
|
502
502
|
const primarySummary = primaryMeter ? summaries[primaryMeter.id] : null;
|
|
503
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
504
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
505
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
503
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewDetailsClick, children: [
|
|
504
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
505
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.CardTitle, { className: "text-sm font-medium", children: "Usage This Month" }),
|
|
506
506
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
507
507
|
] }),
|
|
508
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
508
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.CardContent, { children: meters.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
509
509
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No meters" }),
|
|
510
510
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "No usage meters are configured" })
|
|
511
511
|
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
@@ -556,7 +556,7 @@ function PaymentMethodEditor({ open, onOpenChange, onSuccess }) {
|
|
|
556
556
|
const fetchSetupIntent = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
557
557
|
setLoading(true);
|
|
558
558
|
try {
|
|
559
|
-
const intent = await
|
|
559
|
+
const intent = await _chunkO3LLMGP7js.StripeCustomerService.createSetupIntent();
|
|
560
560
|
setSetupIntent(intent);
|
|
561
561
|
} catch (err) {
|
|
562
562
|
console.error("[PaymentMethodEditor] Failed to create setup intent:", err);
|
|
@@ -596,7 +596,7 @@ function PaymentMethodEditor({ open, onOpenChange, onSuccess }) {
|
|
|
596
596
|
return;
|
|
597
597
|
}
|
|
598
598
|
if (setAsDefault && _optionalChain([confirmedSetupIntent, 'optionalAccess', _25 => _25.payment_method])) {
|
|
599
|
-
await
|
|
599
|
+
await _chunkO3LLMGP7js.StripeCustomerService.setDefaultPaymentMethod({
|
|
600
600
|
paymentMethodId: typeof confirmedSetupIntent.payment_method === "string" ? confirmedSetupIntent.payment_method : confirmedSetupIntent.payment_method.id
|
|
601
601
|
});
|
|
602
602
|
}
|
|
@@ -609,10 +609,10 @@ function PaymentMethodEditor({ open, onOpenChange, onSuccess }) {
|
|
|
609
609
|
setIsSubmitting(false);
|
|
610
610
|
}
|
|
611
611
|
}, "handleSubmit");
|
|
612
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
613
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
614
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
615
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
612
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.DialogContent, { className: "max-w-md", children: [
|
|
613
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.DialogHeader, { children: [
|
|
614
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.DialogTitle, { children: "Add Payment Method" }),
|
|
615
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.DialogDescription, { children: "Add a new payment method to your account. Your card information is securely processed by Stripe." })
|
|
616
616
|
] }),
|
|
617
617
|
loading && /* @__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..." }) }),
|
|
618
618
|
!loading && setupIntent && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: handleSubmit, className: "flex flex-col gap-y-4", children: [
|
|
@@ -637,22 +637,22 @@ function PaymentMethodEditor({ open, onOpenChange, onSuccess }) {
|
|
|
637
637
|
) }),
|
|
638
638
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
639
639
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
640
|
-
|
|
640
|
+
_chunkJI6BDV7Ljs.Checkbox,
|
|
641
641
|
{
|
|
642
642
|
id: "setAsDefault",
|
|
643
643
|
checked: setAsDefault,
|
|
644
644
|
onCheckedChange: (checked) => setSetAsDefault(!!checked)
|
|
645
645
|
}
|
|
646
646
|
),
|
|
647
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
647
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Label, { htmlFor: "setAsDefault", className: "text-sm font-normal", children: "Set as default payment method" })
|
|
648
648
|
] }),
|
|
649
|
-
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
649
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.AlertDescription, { children: error }) }),
|
|
650
650
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-x-2", children: [
|
|
651
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
652
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
651
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Button, { type: "button", variant: "outline", onClick: () => onOpenChange(false), disabled: isSubmitting, children: "Cancel" }),
|
|
652
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Button, { type: "submit", disabled: !stripe || isSubmitting, children: isSubmitting ? "Processing..." : "Add Card" })
|
|
653
653
|
] })
|
|
654
654
|
] }),
|
|
655
|
-
!loading && !setupIntent && error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
655
|
+
!loading && !setupIntent && error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.AlertDescription, { children: error }) })
|
|
656
656
|
] }) });
|
|
657
657
|
}
|
|
658
658
|
_chunk7QVYU63Ejs.__name.call(void 0, PaymentMethodEditor, "PaymentMethodEditor");
|
|
@@ -674,7 +674,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
674
674
|
_react.useEffect.call(void 0, () => {
|
|
675
675
|
const loadCustomer = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
676
676
|
try {
|
|
677
|
-
const fetchedCustomer = await
|
|
677
|
+
const fetchedCustomer = await _chunkO3LLMGP7js.StripeCustomerService.getCustomer();
|
|
678
678
|
setCustomer(fetchedCustomer);
|
|
679
679
|
} catch (error) {
|
|
680
680
|
console.error("[PaymentMethodCard] Failed to load customer:", error);
|
|
@@ -691,7 +691,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
691
691
|
const handleSetDefault = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
692
692
|
setLoading(true);
|
|
693
693
|
try {
|
|
694
|
-
await
|
|
694
|
+
await _chunkO3LLMGP7js.StripeCustomerService.setDefaultPaymentMethod({ paymentMethodId: paymentMethod.id });
|
|
695
695
|
onUpdate();
|
|
696
696
|
} catch (error) {
|
|
697
697
|
console.error("[PaymentMethodCard] Failed to set as default:", error);
|
|
@@ -702,7 +702,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
702
702
|
const handleRemove = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
703
703
|
setLoading(true);
|
|
704
704
|
try {
|
|
705
|
-
await
|
|
705
|
+
await _chunkO3LLMGP7js.StripeCustomerService.removePaymentMethod({ paymentMethodId: paymentMethod.id });
|
|
706
706
|
setShowRemoveDialog(false);
|
|
707
707
|
onUpdate();
|
|
708
708
|
} catch (error) {
|
|
@@ -711,22 +711,22 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
711
711
|
}
|
|
712
712
|
}, "handleRemove");
|
|
713
713
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
714
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
715
|
-
isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
716
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
714
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.Card, { className: "relative", children: [
|
|
715
|
+
isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Badge, { className: "absolute right-2 top-2 bg-green-100 text-green-800 hover:bg-green-100", children: "Default" }),
|
|
716
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.CardHeader, { className: "flex flex-row items-center justify-between pb-2", children: [
|
|
717
717
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
718
718
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-2xl", children: brandIcon }),
|
|
719
719
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium capitalize", children: brand })
|
|
720
720
|
] }),
|
|
721
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
722
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
723
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
724
|
-
!isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
725
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
721
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.DropdownMenu, { children: [
|
|
722
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.DropdownMenuTrigger, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Button, { render: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {}), nativeButton: false, variant: "ghost", size: "sm", disabled: loading, className: "h-8 w-8 p-0", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.MoreVertical, { className: "h-4 w-4" }) }) }),
|
|
723
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.DropdownMenuContent, { align: "end", children: [
|
|
724
|
+
!isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.DropdownMenuItem, { onClick: handleSetDefault, disabled: loading, children: "Set as Default" }),
|
|
725
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.DropdownMenuItem, { onClick: () => setShowRemoveDialog(true), disabled: loading, className: "text-red-600", children: "Remove" })
|
|
726
726
|
] })
|
|
727
727
|
] })
|
|
728
728
|
] }),
|
|
729
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
729
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-1", children: [
|
|
730
730
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-lg font-semibold", children: [
|
|
731
731
|
"\u2022\u2022\u2022\u2022 ",
|
|
732
732
|
last4
|
|
@@ -739,17 +739,17 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
739
739
|
] })
|
|
740
740
|
] }) })
|
|
741
741
|
] }),
|
|
742
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
743
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
744
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
745
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
742
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.AlertDialog, { open: showRemoveDialog, onOpenChange: setShowRemoveDialog, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.AlertDialogContent, { children: [
|
|
743
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.AlertDialogHeader, { children: [
|
|
744
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.AlertDialogTitle, { children: "Remove Payment Method" }),
|
|
745
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.AlertDialogDescription, { children: [
|
|
746
746
|
"Are you sure you want to remove this payment method? This action cannot be undone.",
|
|
747
747
|
isDefault && " This is your default payment method."
|
|
748
748
|
] })
|
|
749
749
|
] }),
|
|
750
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
751
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
752
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
750
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.AlertDialogFooter, { children: [
|
|
751
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.AlertDialogCancel, { disabled: loading, children: "Cancel" }),
|
|
752
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.AlertDialogAction, { onClick: handleRemove, disabled: loading, className: "bg-red-600 hover:bg-red-700", children: loading ? "Removing..." : "Remove" })
|
|
753
753
|
] })
|
|
754
754
|
] }) })
|
|
755
755
|
] });
|
|
@@ -772,7 +772,7 @@ function PaymentMethodsContainer() {
|
|
|
772
772
|
const loadPaymentMethods = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
773
773
|
setLoading(true);
|
|
774
774
|
try {
|
|
775
|
-
const fetchedPaymentMethods = await
|
|
775
|
+
const fetchedPaymentMethods = await _chunkO3LLMGP7js.StripeCustomerService.listPaymentMethods();
|
|
776
776
|
setPaymentMethods(fetchedPaymentMethods);
|
|
777
777
|
} catch (error) {
|
|
778
778
|
console.error("[PaymentMethodsContainer] Failed to load payment methods:", error);
|
|
@@ -792,14 +792,14 @@ function PaymentMethodsContainer() {
|
|
|
792
792
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8" }),
|
|
793
793
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-3xl font-bold", children: "Payment Methods" })
|
|
794
794
|
] }),
|
|
795
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
795
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Button, { onClick: () => setShowAddPaymentMethod(true), children: "Add Payment Method" })
|
|
796
796
|
] }),
|
|
797
797
|
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: [
|
|
798
798
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-16 w-16 text-muted-foreground" }),
|
|
799
799
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
800
800
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "mb-2 text-xl font-semibold", children: "No payment methods" }),
|
|
801
801
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mb-4 text-muted-foreground", children: "Add a payment method to enable subscriptions and secure checkout." }),
|
|
802
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
802
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Button, { onClick: () => setShowAddPaymentMethod(true), children: "Add Your First Card" })
|
|
803
803
|
] })
|
|
804
804
|
] }),
|
|
805
805
|
paymentMethods.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodsList, { paymentMethods, onUpdate: loadPaymentMethods }),
|
|
@@ -923,13 +923,13 @@ function InvoiceDetails({ invoice, open, onOpenChange, onInvoiceChange }) {
|
|
|
923
923
|
return invoice.stripeInvoiceId.slice(-8);
|
|
924
924
|
}, "getInvoiceNumber");
|
|
925
925
|
const productName = _optionalChain([invoice, 'access', _35 => _35.subscription, 'optionalAccess', _36 => _36.price, 'optionalAccess', _37 => _37.product, 'optionalAccess', _38 => _38.name]) || "Subscription";
|
|
926
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
927
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
928
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
926
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.DialogContent, { className: "max-w-2xl", children: [
|
|
927
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.DialogHeader, { children: [
|
|
928
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.DialogTitle, { children: [
|
|
929
929
|
"Invoice ",
|
|
930
930
|
getInvoiceNumber()
|
|
931
931
|
] }),
|
|
932
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
932
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.DialogDescription, { children: formatDate3(invoice.periodStart) })
|
|
933
933
|
] }),
|
|
934
934
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
935
935
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
@@ -994,15 +994,15 @@ function InvoiceDetails({ invoice, open, onOpenChange, onInvoiceChange }) {
|
|
|
994
994
|
] })
|
|
995
995
|
] }),
|
|
996
996
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2 pt-4 border-t", children: [
|
|
997
|
-
invoice.stripePdfUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
997
|
+
invoice.stripePdfUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.Button, { variant: "outline", onClick: handleDownloadPDF, children: [
|
|
998
998
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Download, { className: "mr-2 h-4 w-4" }),
|
|
999
999
|
"Download PDF"
|
|
1000
1000
|
] }),
|
|
1001
|
-
invoice.status === "open" /* OPEN */ && invoice.attempted && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1001
|
+
invoice.status === "open" /* OPEN */ && invoice.attempted && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.Button, { variant: "default", onClick: handleRetryPayment, children: [
|
|
1002
1002
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RefreshCw, { className: "mr-2 h-4 w-4" }),
|
|
1003
1003
|
"Retry Payment"
|
|
1004
1004
|
] }),
|
|
1005
|
-
invoice.stripeHostedInvoiceUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1005
|
+
invoice.stripeHostedInvoiceUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.Button, { variant: "outline", onClick: handleViewInStripe, children: [
|
|
1006
1006
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ExternalLink, { className: "mr-2 h-4 w-4" }),
|
|
1007
1007
|
"View in Stripe"
|
|
1008
1008
|
] })
|
|
@@ -1026,30 +1026,30 @@ function InvoicesList({ invoices, onInvoicesChange }) {
|
|
|
1026
1026
|
return invoice.stripeInvoiceId.slice(-8);
|
|
1027
1027
|
}, "getInvoiceNumber");
|
|
1028
1028
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1029
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-hidden", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1030
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1031
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1032
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1033
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1034
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1035
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1029
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-hidden", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.Table, { children: [
|
|
1030
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.TableRow, { children: [
|
|
1031
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.TableHead, { children: "Invoice #" }),
|
|
1032
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.TableHead, { children: "Date" }),
|
|
1033
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.TableHead, { children: "Status" }),
|
|
1034
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.TableHead, { className: "text-right", children: "Amount" }),
|
|
1035
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.TableHead, { children: "Period" })
|
|
1036
1036
|
] }) }),
|
|
1037
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1037
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.TableBody, { children: invoices.map((invoice) => {
|
|
1038
1038
|
const invoiceNumber = getInvoiceNumber(invoice);
|
|
1039
1039
|
const date = formatDate3(invoice.periodStart);
|
|
1040
1040
|
const amount = formatCurrency(invoice.total, invoice.currency);
|
|
1041
1041
|
const period = `${formatDate3(invoice.periodStart)} - ${formatDate3(invoice.periodEnd)}`;
|
|
1042
1042
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1043
|
-
|
|
1043
|
+
_chunkJI6BDV7Ljs.TableRow,
|
|
1044
1044
|
{
|
|
1045
1045
|
onClick: () => handleRowClick(invoice),
|
|
1046
1046
|
className: "cursor-pointer hover:bg-muted/50",
|
|
1047
1047
|
children: [
|
|
1048
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1049
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1050
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1051
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1052
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1048
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.TableCell, { className: "font-medium", children: invoiceNumber }),
|
|
1049
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.TableCell, { className: "text-muted-foreground text-sm", children: date }),
|
|
1050
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InvoiceStatusBadge, { status: invoice.status }) }),
|
|
1051
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.TableCell, { className: "text-right font-medium", children: amount }),
|
|
1052
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.TableCell, { className: "text-muted-foreground text-sm", children: period })
|
|
1053
1053
|
]
|
|
1054
1054
|
},
|
|
1055
1055
|
invoice.id
|
|
@@ -1082,7 +1082,7 @@ function InvoicesContainer() {
|
|
|
1082
1082
|
setLoading(true);
|
|
1083
1083
|
try {
|
|
1084
1084
|
const params = statusFilter !== "all" ? { status: statusFilter } : void 0;
|
|
1085
|
-
const data = await
|
|
1085
|
+
const data = await _chunkO3LLMGP7js.StripeInvoiceService.listInvoices(params);
|
|
1086
1086
|
setInvoices(data);
|
|
1087
1087
|
} catch (error) {
|
|
1088
1088
|
console.error("[InvoicesContainer] Failed to load invoices:", error);
|
|
@@ -1098,12 +1098,12 @@ function InvoicesContainer() {
|
|
|
1098
1098
|
setStatusFilter(value);
|
|
1099
1099
|
}, "handleFilterChange");
|
|
1100
1100
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-4", children: [
|
|
1101
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1102
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1103
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1104
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1105
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1106
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1101
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Tabs, { value: statusFilter, onValueChange: handleFilterChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.TabsList, { children: [
|
|
1102
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.TabsTrigger, { value: "all", children: "All" }),
|
|
1103
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.TabsTrigger, { value: "paid" /* PAID */, children: "Paid" }),
|
|
1104
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.TabsTrigger, { value: "open" /* OPEN */, children: "Open" }),
|
|
1105
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.TabsTrigger, { value: "void" /* VOID */, children: "Void" }),
|
|
1106
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.TabsTrigger, { value: "uncollectible" /* UNCOLLECTIBLE */, children: "Uncollectible" })
|
|
1107
1107
|
] }) }),
|
|
1108
1108
|
loading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-center py-8 text-muted-foreground", children: "Loading invoices..." }),
|
|
1109
1109
|
!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: [
|
|
@@ -1212,7 +1212,7 @@ function CancelSubscriptionDialog({
|
|
|
1212
1212
|
const onSubmit = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async (values) => {
|
|
1213
1213
|
setIsSubmitting(true);
|
|
1214
1214
|
try {
|
|
1215
|
-
await
|
|
1215
|
+
await _chunkO3LLMGP7js.StripeSubscriptionService.cancelSubscription({
|
|
1216
1216
|
id: subscription.id,
|
|
1217
1217
|
cancelImmediately: values.cancelImmediately
|
|
1218
1218
|
});
|
|
@@ -1225,20 +1225,20 @@ function CancelSubscriptionDialog({
|
|
|
1225
1225
|
}
|
|
1226
1226
|
}, "onSubmit");
|
|
1227
1227
|
const periodEndDate = formatDate3(subscription.currentPeriodEnd);
|
|
1228
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1229
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1230
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1231
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1228
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.DialogContent, { className: "max-w-md", children: [
|
|
1229
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.DialogHeader, { children: [
|
|
1230
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.DialogTitle, { children: "Cancel Subscription" }),
|
|
1231
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.DialogDescription, { children: "Are you sure you want to cancel this subscription? This action cannot be undone." })
|
|
1232
1232
|
] }),
|
|
1233
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1234
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1233
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-col gap-y-4", children: [
|
|
1234
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.FormCheckbox, { form, id: "cancelImmediately", name: "Cancel Immediately" }),
|
|
1235
1235
|
cancelImmediately ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "bg-red-50 border border-red-200 rounded-lg p-3 text-sm text-red-800", children: "Your subscription will be canceled immediately and you will lose access right away." }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-blue-50 border border-blue-200 rounded-lg p-3 text-sm text-blue-800", children: [
|
|
1236
1236
|
"Your subscription will remain active until ",
|
|
1237
1237
|
periodEndDate,
|
|
1238
1238
|
". You can continue using the service until then."
|
|
1239
1239
|
] }),
|
|
1240
1240
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1241
|
-
|
|
1241
|
+
_chunkJI6BDV7Ljs.FormTextarea,
|
|
1242
1242
|
{
|
|
1243
1243
|
form,
|
|
1244
1244
|
id: "reason",
|
|
@@ -1248,8 +1248,8 @@ function CancelSubscriptionDialog({
|
|
|
1248
1248
|
}
|
|
1249
1249
|
),
|
|
1250
1250
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-x-2 justify-end pt-2", children: [
|
|
1251
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1252
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1251
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Button, { type: "button", variant: "outline", onClick: () => onOpenChange(false), disabled: isSubmitting, children: "Keep Subscription" }),
|
|
1252
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Button, { type: "submit", variant: "destructive", disabled: isSubmitting, children: isSubmitting ? "Canceling..." : "Confirm Cancellation" })
|
|
1253
1253
|
] })
|
|
1254
1254
|
] }) })
|
|
1255
1255
|
] }) });
|
|
@@ -1281,7 +1281,7 @@ function PricingCard({ price, isCurrentPlan = false, isSelected = false, isDisab
|
|
|
1281
1281
|
}
|
|
1282
1282
|
}, "handleClick");
|
|
1283
1283
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1284
|
-
|
|
1284
|
+
_chunkJI6BDV7Ljs.Card,
|
|
1285
1285
|
{
|
|
1286
1286
|
role: "radio",
|
|
1287
1287
|
"aria-checked": isSelected,
|
|
@@ -1289,7 +1289,7 @@ function PricingCard({ price, isCurrentPlan = false, isSelected = false, isDisab
|
|
|
1289
1289
|
tabIndex: isDisabled ? -1 : 0,
|
|
1290
1290
|
onKeyDown: handleKeyDown,
|
|
1291
1291
|
onClick: handleClick,
|
|
1292
|
-
className:
|
|
1292
|
+
className: _chunkO3LLMGP7js.cn.call(void 0,
|
|
1293
1293
|
"relative cursor-pointer transition-all duration-200 flex flex-col h-full",
|
|
1294
1294
|
"focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
1295
1295
|
isCurrentPlan && "bg-muted/30",
|
|
@@ -1299,9 +1299,9 @@ function PricingCard({ price, isCurrentPlan = false, isSelected = false, isDisab
|
|
|
1299
1299
|
isLoading && "pointer-events-none"
|
|
1300
1300
|
),
|
|
1301
1301
|
children: [
|
|
1302
|
-
isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1303
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1304
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1302
|
+
isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Badge, { variant: "secondary", className: "absolute top-2 right-2", children: "Current" }),
|
|
1303
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.CardHeader, { className: "pb-2", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "font-semibold text-lg", children: description }) }),
|
|
1304
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.CardContent, { className: "pb-4 grow", children: [
|
|
1305
1305
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mb-4", children: [
|
|
1306
1306
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-3xl font-bold", children: formattedPrice }),
|
|
1307
1307
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground ml-1", children: interval })
|
|
@@ -1311,8 +1311,8 @@ function PricingCard({ price, isCurrentPlan = false, isSelected = false, isDisab
|
|
|
1311
1311
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-muted-foreground", children: feature })
|
|
1312
1312
|
] }, index)) })
|
|
1313
1313
|
] }),
|
|
1314
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1315
|
-
|
|
1314
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.CardFooter, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1315
|
+
_chunkJI6BDV7Ljs.Button,
|
|
1316
1316
|
{
|
|
1317
1317
|
variant: isCurrentPlan ? "secondary" : isSelected ? "default" : "outline",
|
|
1318
1318
|
className: "w-full",
|
|
@@ -1366,26 +1366,26 @@ function PricingCardsGrid({
|
|
|
1366
1366
|
_chunk7QVYU63Ejs.__name.call(void 0, PricingCardsGrid, "PricingCardsGrid");
|
|
1367
1367
|
function PricingCardsGridSkeleton() {
|
|
1368
1368
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "space-y-8", children: [1, 2].map((productIndex) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-4", children: [
|
|
1369
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1370
|
-
/* @__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,
|
|
1371
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1372
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1369
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Skeleton, { className: "h-6 w-32" }),
|
|
1370
|
+
/* @__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, _chunkJI6BDV7Ljs.Card, { className: "animate-pulse", children: [
|
|
1371
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.CardHeader, { className: "pb-2", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Skeleton, { className: "h-5 w-24" }) }),
|
|
1372
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.CardContent, { className: "pb-4", children: [
|
|
1373
1373
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mb-4", children: [
|
|
1374
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1375
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1374
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Skeleton, { className: "h-9 w-20 inline-block" }),
|
|
1375
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Skeleton, { className: "h-4 w-12 inline-block ml-2" })
|
|
1376
1376
|
] }),
|
|
1377
1377
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
1378
1378
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
1379
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1380
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1379
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Skeleton, { className: "h-4 w-4 rounded-full" }),
|
|
1380
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Skeleton, { className: "h-4 w-32" })
|
|
1381
1381
|
] }),
|
|
1382
1382
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
1383
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1384
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1383
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Skeleton, { className: "h-4 w-4 rounded-full" }),
|
|
1384
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Skeleton, { className: "h-4 w-28" })
|
|
1385
1385
|
] })
|
|
1386
1386
|
] })
|
|
1387
1387
|
] }),
|
|
1388
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1388
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.CardFooter, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Skeleton, { className: "h-9 w-full" }) })
|
|
1389
1389
|
] }, cardIndex)) })
|
|
1390
1390
|
] }, productIndex)) });
|
|
1391
1391
|
}
|
|
@@ -1449,7 +1449,7 @@ function SubscriptionEditor({
|
|
|
1449
1449
|
}
|
|
1450
1450
|
setLoadingPaymentMethods(true);
|
|
1451
1451
|
try {
|
|
1452
|
-
const paymentMethods = await
|
|
1452
|
+
const paymentMethods = await _chunkO3LLMGP7js.StripeCustomerService.listPaymentMethods();
|
|
1453
1453
|
const hasMethod = paymentMethods.length > 0;
|
|
1454
1454
|
setHasPaymentMethod(hasMethod);
|
|
1455
1455
|
} catch (error) {
|
|
@@ -1467,7 +1467,7 @@ function SubscriptionEditor({
|
|
|
1467
1467
|
const loadData = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1468
1468
|
setLoading(true);
|
|
1469
1469
|
try {
|
|
1470
|
-
const fetchedProducts = await
|
|
1470
|
+
const fetchedProducts = await _chunkO3LLMGP7js.StripeProductService.listProducts({ active: true });
|
|
1471
1471
|
const grouped = /* @__PURE__ */ new Map();
|
|
1472
1472
|
for (const product of fetchedProducts) {
|
|
1473
1473
|
if (product.stripePrices && product.stripePrices.length > 0) {
|
|
@@ -1494,7 +1494,7 @@ function SubscriptionEditor({
|
|
|
1494
1494
|
}
|
|
1495
1495
|
setLoadingProration(true);
|
|
1496
1496
|
try {
|
|
1497
|
-
const preview = await
|
|
1497
|
+
const preview = await _chunkO3LLMGP7js.StripeSubscriptionService.getProrationPreview({
|
|
1498
1498
|
subscriptionId: subscription.id,
|
|
1499
1499
|
newPriceId: selectedPriceId
|
|
1500
1500
|
});
|
|
@@ -1518,7 +1518,7 @@ function SubscriptionEditor({
|
|
|
1518
1518
|
setPaymentError(null);
|
|
1519
1519
|
setPaymentConfirmationState("idle");
|
|
1520
1520
|
try {
|
|
1521
|
-
const result = await
|
|
1521
|
+
const result = await _chunkO3LLMGP7js.StripeSubscriptionService.createSubscription({
|
|
1522
1522
|
id: _uuid.v4.call(void 0, ),
|
|
1523
1523
|
priceId
|
|
1524
1524
|
});
|
|
@@ -1532,7 +1532,7 @@ function SubscriptionEditor({
|
|
|
1532
1532
|
setLoadingPriceId(null);
|
|
1533
1533
|
return;
|
|
1534
1534
|
}
|
|
1535
|
-
await
|
|
1535
|
+
await _chunkO3LLMGP7js.StripeSubscriptionService.syncSubscription({
|
|
1536
1536
|
subscriptionId: result.subscription.id
|
|
1537
1537
|
});
|
|
1538
1538
|
}
|
|
@@ -1558,7 +1558,7 @@ function SubscriptionEditor({
|
|
|
1558
1558
|
if (!subscription || !selectedPriceId) return;
|
|
1559
1559
|
setLoadingPriceId(selectedPriceId);
|
|
1560
1560
|
try {
|
|
1561
|
-
await
|
|
1561
|
+
await _chunkO3LLMGP7js.StripeSubscriptionService.changePlan({
|
|
1562
1562
|
id: subscription.id,
|
|
1563
1563
|
newPriceId: selectedPriceId
|
|
1564
1564
|
});
|
|
@@ -1574,16 +1574,16 @@ function SubscriptionEditor({
|
|
|
1574
1574
|
setSelectedPriceId(null);
|
|
1575
1575
|
setProrationPreview(null);
|
|
1576
1576
|
}, "handleCancel");
|
|
1577
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1578
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1579
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1580
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1577
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.DialogContent, { className: "max-w-4xl max-h-[90vh] overflow-y-auto", children: [
|
|
1578
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.DialogHeader, { children: [
|
|
1579
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.DialogTitle, { children: subscription ? "Change Plan" : "Subscribe to a Plan" }),
|
|
1580
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.DialogDescription, { children: subscription ? "Select a new plan to switch to. You'll see a proration preview before confirming." : "Choose a plan to start your subscription." })
|
|
1581
1581
|
] }),
|
|
1582
|
-
loadingPaymentMethods && !subscription ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex items-center justify-center py-8", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-muted-foreground", children: "Checking payment methods..." }) }) : !hasPaymentMethod && !subscription ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1583
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1584
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1582
|
+
loadingPaymentMethods && !subscription ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex items-center justify-center py-8", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-muted-foreground", children: "Checking payment methods..." }) }) : !hasPaymentMethod && !subscription ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.Alert, { variant: "destructive", children: [
|
|
1583
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.AlertTitle, { children: "Payment Method Required" }),
|
|
1584
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.AlertDescription, { className: "mt-2", children: [
|
|
1585
1585
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mb-4", children: paymentRequiredError ? "Your subscription could not be created because no payment method is on file." : "You need to add a payment method before you can subscribe to a plan." }),
|
|
1586
|
-
onAddPaymentMethod && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1586
|
+
onAddPaymentMethod && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Button, { onClick: onAddPaymentMethod, variant: "outline", children: "Add Payment Method" })
|
|
1587
1587
|
] })
|
|
1588
1588
|
] }) : paymentConfirmationState === "confirming" || isConfirming ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col items-center justify-center py-12 space-y-4", children: [
|
|
1589
1589
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "h-8 w-8 animate-spin text-primary" }),
|
|
@@ -1597,12 +1597,12 @@ function SubscriptionEditor({
|
|
|
1597
1597
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-medium text-green-600", children: "Payment successful!" }),
|
|
1598
1598
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: "Your subscription is now active." })
|
|
1599
1599
|
] })
|
|
1600
|
-
] }) : paymentConfirmationState === "error" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "space-y-4", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1601
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1602
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1600
|
+
] }) : paymentConfirmationState === "error" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "space-y-4", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.Alert, { variant: "destructive", children: [
|
|
1601
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.AlertTitle, { children: "Payment Failed" }),
|
|
1602
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.AlertDescription, { className: "mt-2", children: [
|
|
1603
1603
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mb-4", children: paymentError || "We couldn't process your payment. Please try again." }),
|
|
1604
1604
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1605
|
-
|
|
1605
|
+
_chunkJI6BDV7Ljs.Button,
|
|
1606
1606
|
{
|
|
1607
1607
|
onClick: () => {
|
|
1608
1608
|
setPaymentConfirmationState("idle");
|
|
@@ -1631,8 +1631,8 @@ function SubscriptionEditor({
|
|
|
1631
1631
|
isEditMode && prorationPreview && !loadingProration && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-4", children: [
|
|
1632
1632
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProrationPreview, { preview: prorationPreview }),
|
|
1633
1633
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-3", children: [
|
|
1634
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1635
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1634
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Button, { variant: "outline", onClick: handleCancel, disabled: !!loadingPriceId, children: "Cancel" }),
|
|
1635
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Button, { onClick: handleConfirmPlanChange, disabled: !!loadingPriceId, children: loadingPriceId ? "Processing..." : "Confirm Plan Change" })
|
|
1636
1636
|
] })
|
|
1637
1637
|
] })
|
|
1638
1638
|
] })
|
|
@@ -1730,7 +1730,7 @@ function SubscriptionDetails({
|
|
|
1730
1730
|
const handlePause = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1731
1731
|
setIsProcessing(true);
|
|
1732
1732
|
try {
|
|
1733
|
-
await
|
|
1733
|
+
await _chunkO3LLMGP7js.StripeSubscriptionService.pauseSubscription({ subscriptionId: subscription.id });
|
|
1734
1734
|
onSubscriptionChange();
|
|
1735
1735
|
} catch (error) {
|
|
1736
1736
|
console.error("[SubscriptionDetails] Failed to pause subscription:", error);
|
|
@@ -1741,7 +1741,7 @@ function SubscriptionDetails({
|
|
|
1741
1741
|
const handleResume = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1742
1742
|
setIsProcessing(true);
|
|
1743
1743
|
try {
|
|
1744
|
-
await
|
|
1744
|
+
await _chunkO3LLMGP7js.StripeSubscriptionService.resumeSubscription({ subscriptionId: subscription.id });
|
|
1745
1745
|
onSubscriptionChange();
|
|
1746
1746
|
} catch (error) {
|
|
1747
1747
|
console.error("[SubscriptionDetails] Failed to resume subscription:", error);
|
|
@@ -1751,7 +1751,7 @@ function SubscriptionDetails({
|
|
|
1751
1751
|
}, "handleResume");
|
|
1752
1752
|
const handleManageViaPortal = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1753
1753
|
try {
|
|
1754
|
-
const { url } = await
|
|
1754
|
+
const { url } = await _chunkO3LLMGP7js.StripeCustomerService.createPortalSession();
|
|
1755
1755
|
window.open(url, "_blank");
|
|
1756
1756
|
} catch (error) {
|
|
1757
1757
|
console.error("[SubscriptionDetails] Failed to create portal session:", error);
|
|
@@ -1761,10 +1761,10 @@ function SubscriptionDetails({
|
|
|
1761
1761
|
const canResume = subscription.status === "paused" /* PAUSED */;
|
|
1762
1762
|
const canCancel = subscription.status === "active" /* ACTIVE */ || subscription.status === "trialing" /* TRIALING */ || subscription.status === "paused" /* PAUSED */;
|
|
1763
1763
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1764
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1765
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1766
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1767
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1764
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.DialogContent, { className: "max-w-2xl", children: [
|
|
1765
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.DialogHeader, { children: [
|
|
1766
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.DialogTitle, { children: "Subscription Details" }),
|
|
1767
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.DialogDescription, { children: "View and manage your subscription" })
|
|
1768
1768
|
] }),
|
|
1769
1769
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
1770
1770
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
@@ -1800,11 +1800,11 @@ function SubscriptionDetails({
|
|
|
1800
1800
|
"."
|
|
1801
1801
|
] }) }),
|
|
1802
1802
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2 pt-4 border-t", children: [
|
|
1803
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1804
|
-
canPause && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1805
|
-
canResume && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1806
|
-
canCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1807
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1803
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Button, { variant: "default", onClick: () => setShowEdit(true), children: "Change Plan" }),
|
|
1804
|
+
canPause && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Button, { variant: "outline", onClick: handlePause, disabled: isProcessing, children: isProcessing ? "Pausing..." : "Pause" }),
|
|
1805
|
+
canResume && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Button, { variant: "outline", onClick: handleResume, disabled: isProcessing, children: isProcessing ? "Resuming..." : "Resume" }),
|
|
1806
|
+
canCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Button, { variant: "destructive", onClick: () => setShowCancel(true), children: "Cancel" }),
|
|
1807
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Button, { variant: "outline", onClick: handleManageViaPortal, children: "Manage via Portal" })
|
|
1808
1808
|
] })
|
|
1809
1809
|
] })
|
|
1810
1810
|
] }) }),
|
|
@@ -1863,27 +1863,27 @@ function SubscriptionsList({ subscriptions, onSubscriptionsChange }) {
|
|
|
1863
1863
|
setSelectedSub(subscription);
|
|
1864
1864
|
}, "handleRowClick");
|
|
1865
1865
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1866
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-hidden", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1867
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1868
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1869
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1870
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1871
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1866
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-hidden", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.Table, { children: [
|
|
1867
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.TableRow, { children: [
|
|
1868
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.TableHead, { children: "Status" }),
|
|
1869
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.TableHead, { children: "Plan" }),
|
|
1870
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.TableHead, { children: "Period" }),
|
|
1871
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.TableHead, { className: "text-right", children: "Amount" })
|
|
1872
1872
|
] }) }),
|
|
1873
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1873
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.TableBody, { children: subscriptions.map((subscription) => {
|
|
1874
1874
|
const price = subscription.price;
|
|
1875
1875
|
const amount = _optionalChain([price, 'optionalAccess', _56 => _56.unitAmount]) ? formatCurrency(price.unitAmount, price.currency) : "N/A";
|
|
1876
1876
|
const period = `${formatDate3(subscription.currentPeriodStart)} - ${formatDate3(subscription.currentPeriodEnd)}`;
|
|
1877
1877
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1878
|
-
|
|
1878
|
+
_chunkJI6BDV7Ljs.TableRow,
|
|
1879
1879
|
{
|
|
1880
1880
|
onClick: () => handleRowClick(subscription),
|
|
1881
1881
|
className: "cursor-pointer hover:bg-muted/50",
|
|
1882
1882
|
children: [
|
|
1883
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1884
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1885
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1886
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1883
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SubscriptionStatusBadge, { status: subscription.status, cancelAtPeriodEnd: subscription.cancelAtPeriodEnd }) }),
|
|
1884
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.TableCell, { className: "font-medium", children: formatPlanName3(price) }),
|
|
1885
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.TableCell, { className: "text-muted-foreground text-sm", children: period }),
|
|
1886
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.TableCell, { className: "text-right font-medium", children: amount })
|
|
1887
1887
|
]
|
|
1888
1888
|
},
|
|
1889
1889
|
subscription.id
|
|
@@ -1925,7 +1925,7 @@ function SubscriptionsContainer() {
|
|
|
1925
1925
|
const loadSubscriptions = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1926
1926
|
setLoading(true);
|
|
1927
1927
|
try {
|
|
1928
|
-
const fetchedSubscriptions = await
|
|
1928
|
+
const fetchedSubscriptions = await _chunkO3LLMGP7js.StripeSubscriptionService.listSubscriptions();
|
|
1929
1929
|
setSubscriptions(fetchedSubscriptions);
|
|
1930
1930
|
} catch (error) {
|
|
1931
1931
|
console.error("[SubscriptionsContainer] Failed to load subscriptions:", error);
|
|
@@ -1936,7 +1936,7 @@ function SubscriptionsContainer() {
|
|
|
1936
1936
|
const loadPricingData = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1937
1937
|
setLoadingPricing(true);
|
|
1938
1938
|
try {
|
|
1939
|
-
const fetchedProducts = await
|
|
1939
|
+
const fetchedProducts = await _chunkO3LLMGP7js.StripeProductService.listProducts({ active: true });
|
|
1940
1940
|
const grouped = /* @__PURE__ */ new Map();
|
|
1941
1941
|
for (const product of fetchedProducts) {
|
|
1942
1942
|
if (product.stripePrices && product.stripePrices.length > 0) {
|
|
@@ -1953,7 +1953,7 @@ function SubscriptionsContainer() {
|
|
|
1953
1953
|
}, "loadPricingData");
|
|
1954
1954
|
const checkPaymentMethod = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1955
1955
|
try {
|
|
1956
|
-
const paymentMethods = await
|
|
1956
|
+
const paymentMethods = await _chunkO3LLMGP7js.StripeCustomerService.listPaymentMethods();
|
|
1957
1957
|
const hasMethod = paymentMethods.length > 0;
|
|
1958
1958
|
setHasPaymentMethod(hasMethod);
|
|
1959
1959
|
} catch (error) {
|
|
@@ -1966,7 +1966,7 @@ function SubscriptionsContainer() {
|
|
|
1966
1966
|
setPaymentError(null);
|
|
1967
1967
|
setPaymentConfirmationState("idle");
|
|
1968
1968
|
try {
|
|
1969
|
-
const result = await
|
|
1969
|
+
const result = await _chunkO3LLMGP7js.StripeSubscriptionService.createSubscription({
|
|
1970
1970
|
id: _uuid.v4.call(void 0, ),
|
|
1971
1971
|
priceId
|
|
1972
1972
|
});
|
|
@@ -1980,7 +1980,7 @@ function SubscriptionsContainer() {
|
|
|
1980
1980
|
setCreatingSubscription(false);
|
|
1981
1981
|
return;
|
|
1982
1982
|
}
|
|
1983
|
-
await
|
|
1983
|
+
await _chunkO3LLMGP7js.StripeSubscriptionService.syncSubscription({
|
|
1984
1984
|
subscriptionId: result.subscription.id
|
|
1985
1985
|
});
|
|
1986
1986
|
}
|
|
@@ -2038,7 +2038,7 @@ function SubscriptionsContainer() {
|
|
|
2038
2038
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8" }),
|
|
2039
2039
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-3xl font-bold", children: "Subscriptions" })
|
|
2040
2040
|
] }),
|
|
2041
|
-
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2041
|
+
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Button, { onClick: () => setShowCreateSubscription(true), children: "Subscribe to a Plan" })
|
|
2042
2042
|
] }),
|
|
2043
2043
|
criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BillingAlertBanner, { subscription }, subscription.id)),
|
|
2044
2044
|
subscriptions.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
@@ -2056,12 +2056,12 @@ function SubscriptionsContainer() {
|
|
|
2056
2056
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: "Your subscription is now active." })
|
|
2057
2057
|
] })
|
|
2058
2058
|
] }),
|
|
2059
|
-
paymentConfirmationState === "error" && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2060
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2061
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2059
|
+
paymentConfirmationState === "error" && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.Alert, { variant: "destructive", children: [
|
|
2060
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.AlertTitle, { children: "Payment Failed" }),
|
|
2061
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.AlertDescription, { className: "mt-2", children: [
|
|
2062
2062
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mb-4", children: paymentError || "We couldn't process your payment. Please try again." }),
|
|
2063
2063
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2064
|
-
|
|
2064
|
+
_chunkJI6BDV7Ljs.Button,
|
|
2065
2065
|
{
|
|
2066
2066
|
onClick: () => {
|
|
2067
2067
|
setPaymentConfirmationState("idle");
|
|
@@ -2155,15 +2155,15 @@ function UsageSummaryCard({ meter, summary }) {
|
|
|
2155
2155
|
const progressWidth = percentage !== null ? Math.min(percentage, 100) : 0;
|
|
2156
2156
|
const displayName = meter.displayName || meter.eventName;
|
|
2157
2157
|
const hasLimit = limit !== null && limit !== void 0;
|
|
2158
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2159
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2158
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.Card, { children: [
|
|
2159
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.CardHeader, { className: "flex flex-row items-center gap-x-3 pb-3", children: [
|
|
2160
2160
|
/* @__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" }) }),
|
|
2161
2161
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col", children: [
|
|
2162
2162
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "font-semibold", children: displayName }),
|
|
2163
2163
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-gray-500", children: meter.id })
|
|
2164
2164
|
] })
|
|
2165
2165
|
] }),
|
|
2166
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2166
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.CardContent, { className: "flex flex-col gap-y-4", children: [
|
|
2167
2167
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
2168
2168
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-3xl font-bold", children: currentUsage.toLocaleString() }),
|
|
2169
2169
|
hasLimit && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm text-gray-500", children: [
|
|
@@ -2210,14 +2210,14 @@ function UsageContainer() {
|
|
|
2210
2210
|
const loadUsageData = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2211
2211
|
setLoading(true);
|
|
2212
2212
|
try {
|
|
2213
|
-
const fetchedSubscriptions = await
|
|
2213
|
+
const fetchedSubscriptions = await _chunkO3LLMGP7js.StripeSubscriptionService.listSubscriptions();
|
|
2214
2214
|
setSubscriptions(fetchedSubscriptions);
|
|
2215
2215
|
const hasMeteredSubscriptions2 = fetchedSubscriptions.some((sub) => _optionalChain([sub, 'access', _64 => _64.price, 'optionalAccess', _65 => _65.recurring, 'optionalAccess', _66 => _66.usageType]) === "metered");
|
|
2216
2216
|
if (!hasMeteredSubscriptions2) {
|
|
2217
2217
|
setLoading(false);
|
|
2218
2218
|
return;
|
|
2219
2219
|
}
|
|
2220
|
-
const fetchedMeters = await
|
|
2220
|
+
const fetchedMeters = await _chunkO3LLMGP7js.StripeUsageService.listMeters();
|
|
2221
2221
|
setMeters(fetchedMeters);
|
|
2222
2222
|
const summariesMap = {};
|
|
2223
2223
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -2225,7 +2225,7 @@ function UsageContainer() {
|
|
|
2225
2225
|
const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
|
|
2226
2226
|
for (const meter of fetchedMeters) {
|
|
2227
2227
|
try {
|
|
2228
|
-
const meterSummaries = await
|
|
2228
|
+
const meterSummaries = await _chunkO3LLMGP7js.StripeUsageService.getMeterSummaries({
|
|
2229
2229
|
meterId: meter.id,
|
|
2230
2230
|
startTime: startOfMonth,
|
|
2231
2231
|
endTime: endOfMonth
|
|
@@ -2291,21 +2291,21 @@ function UsageHistoryTable({ usageRecords }) {
|
|
|
2291
2291
|
}
|
|
2292
2292
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
2293
2293
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h2", { className: "text-xl font-semibold", children: "Usage History" }),
|
|
2294
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-hidden rounded-lg border", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2295
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2296
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2297
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2298
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2299
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2294
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-hidden rounded-lg border", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.Table, { children: [
|
|
2295
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.TableRow, { children: [
|
|
2296
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.TableHead, { children: "Date & Time" }),
|
|
2297
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.TableHead, { children: "Meter Event" }),
|
|
2298
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.TableHead, { className: "text-right", children: "Quantity" }),
|
|
2299
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.TableHead, { children: "Event ID" })
|
|
2300
2300
|
] }) }),
|
|
2301
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2301
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.TableBody, { children: usageRecords.map((record) => {
|
|
2302
2302
|
const dateTime = formatDateTime(record.timestamp);
|
|
2303
2303
|
const quantity = record.quantity.toLocaleString();
|
|
2304
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2305
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2306
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2307
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2308
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2304
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.TableRow, { children: [
|
|
2305
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.TableCell, { className: "font-medium", children: dateTime }),
|
|
2306
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.TableCell, { className: "text-muted-foreground", children: record.meterEventName }),
|
|
2307
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.TableCell, { className: "text-right font-medium", children: quantity }),
|
|
2308
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.TableCell, { className: "text-muted-foreground text-sm font-mono", children: record.stripeEventId })
|
|
2309
2309
|
] }, record.id);
|
|
2310
2310
|
}) })
|
|
2311
2311
|
] }) })
|
|
@@ -2322,8 +2322,8 @@ function BillingDetailModal({
|
|
|
2322
2322
|
children,
|
|
2323
2323
|
className
|
|
2324
2324
|
}) {
|
|
2325
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2326
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2325
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.DialogContent, { className: _nullishCoalesce(className, () => ( "max-w-4xl max-h-[90vh] overflow-y-auto")), children: [
|
|
2326
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.DialogHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.DialogTitle, { children: title }) }),
|
|
2327
2327
|
children
|
|
2328
2328
|
] }) });
|
|
2329
2329
|
}
|
|
@@ -2340,7 +2340,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
|
|
|
2340
2340
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "font-semibold text-red-900", children: "Payment Failed" }),
|
|
2341
2341
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-red-700 mt-1", children: "Your last payment failed. Please update your payment method to avoid service interruption." })
|
|
2342
2342
|
] }),
|
|
2343
|
-
onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2343
|
+
onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Button, { variant: "outline", size: "sm", onClick: onUpdatePayment, className: "border-red-300 text-red-700", children: "Update Payment Method" })
|
|
2344
2344
|
] });
|
|
2345
2345
|
}
|
|
2346
2346
|
if (subscription.status === "trialing" /* TRIALING */ && subscription.trialEnd) {
|
|
@@ -2360,7 +2360,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
|
|
|
2360
2360
|
". Add a payment method to continue your subscription."
|
|
2361
2361
|
] })
|
|
2362
2362
|
] }),
|
|
2363
|
-
onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2363
|
+
onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Button, { variant: "outline", size: "sm", onClick: onAddPayment, className: "border-yellow-300 text-yellow-700", children: "Add Payment Method" })
|
|
2364
2364
|
] });
|
|
2365
2365
|
}
|
|
2366
2366
|
}
|
|
@@ -2403,7 +2403,7 @@ function BillingDashboardContainer() {
|
|
|
2403
2403
|
setNoCustomerExists(false);
|
|
2404
2404
|
let customer = null;
|
|
2405
2405
|
try {
|
|
2406
|
-
customer = await
|
|
2406
|
+
customer = await _chunkO3LLMGP7js.StripeCustomerService.getCustomer();
|
|
2407
2407
|
setData((prev) => ({ ...prev, customer }));
|
|
2408
2408
|
setErrors((prev) => ({ ...prev, customer: null }));
|
|
2409
2409
|
setNoCustomerExists(false);
|
|
@@ -2428,7 +2428,7 @@ function BillingDashboardContainer() {
|
|
|
2428
2428
|
if (customer) {
|
|
2429
2429
|
const fetchSubscriptions = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2430
2430
|
try {
|
|
2431
|
-
const subscriptions2 = await
|
|
2431
|
+
const subscriptions2 = await _chunkO3LLMGP7js.StripeSubscriptionService.listSubscriptions();
|
|
2432
2432
|
setData((prev) => ({ ...prev, subscriptions: subscriptions2 }));
|
|
2433
2433
|
setErrors((prev) => ({ ...prev, subscriptions: null }));
|
|
2434
2434
|
return subscriptions2;
|
|
@@ -2442,7 +2442,7 @@ function BillingDashboardContainer() {
|
|
|
2442
2442
|
}, "fetchSubscriptions");
|
|
2443
2443
|
const fetchPaymentMethods = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2444
2444
|
try {
|
|
2445
|
-
const paymentMethods = await
|
|
2445
|
+
const paymentMethods = await _chunkO3LLMGP7js.StripeCustomerService.listPaymentMethods();
|
|
2446
2446
|
setData((prev) => ({ ...prev, paymentMethods }));
|
|
2447
2447
|
setErrors((prev) => ({ ...prev, paymentMethods: null }));
|
|
2448
2448
|
} catch (error) {
|
|
@@ -2454,7 +2454,7 @@ function BillingDashboardContainer() {
|
|
|
2454
2454
|
}, "fetchPaymentMethods");
|
|
2455
2455
|
const fetchInvoices = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2456
2456
|
try {
|
|
2457
|
-
const invoices = await
|
|
2457
|
+
const invoices = await _chunkO3LLMGP7js.StripeInvoiceService.listInvoices();
|
|
2458
2458
|
setData((prev) => ({ ...prev, invoices }));
|
|
2459
2459
|
setErrors((prev) => ({ ...prev, invoices: null }));
|
|
2460
2460
|
} catch (error) {
|
|
@@ -2478,7 +2478,7 @@ function BillingDashboardContainer() {
|
|
|
2478
2478
|
const handleCreateCustomer = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2479
2479
|
setCreatingCustomer(true);
|
|
2480
2480
|
try {
|
|
2481
|
-
await
|
|
2481
|
+
await _chunkO3LLMGP7js.StripeCustomerService.createCustomer();
|
|
2482
2482
|
setNoCustomerExists(false);
|
|
2483
2483
|
await fetchAllData();
|
|
2484
2484
|
} catch (error) {
|
|
@@ -2490,7 +2490,7 @@ function BillingDashboardContainer() {
|
|
|
2490
2490
|
}, "handleCreateCustomer");
|
|
2491
2491
|
const fetchUsageData = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2492
2492
|
try {
|
|
2493
|
-
const meters = await
|
|
2493
|
+
const meters = await _chunkO3LLMGP7js.StripeUsageService.listMeters();
|
|
2494
2494
|
setData((prev) => ({ ...prev, meters }));
|
|
2495
2495
|
const summariesMap = {};
|
|
2496
2496
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -2498,7 +2498,7 @@ function BillingDashboardContainer() {
|
|
|
2498
2498
|
const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
|
|
2499
2499
|
for (const meter of meters) {
|
|
2500
2500
|
try {
|
|
2501
|
-
const meterSummaries = await
|
|
2501
|
+
const meterSummaries = await _chunkO3LLMGP7js.StripeUsageService.getMeterSummaries({
|
|
2502
2502
|
meterId: meter.id,
|
|
2503
2503
|
startTime: startOfMonth,
|
|
2504
2504
|
endTime: endOfMonth
|
|
@@ -2560,18 +2560,18 @@ function BillingDashboardContainer() {
|
|
|
2560
2560
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-8 w-8" }),
|
|
2561
2561
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-3xl font-bold", children: "Billing" })
|
|
2562
2562
|
] }),
|
|
2563
|
-
isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2564
|
-
noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2565
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2563
|
+
isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.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" }) }) }),
|
|
2564
|
+
noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.Card, { children: [
|
|
2565
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.CardHeader, { className: "text-center", children: [
|
|
2566
2566
|
/* @__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" }) }),
|
|
2567
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2568
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2567
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.CardTitle, { children: "Set Up Billing" }),
|
|
2568
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.CardDescription, { children: "Your company doesn't have a billing account yet. Set one up to manage subscriptions, payment methods, and view invoices." })
|
|
2569
2569
|
] }),
|
|
2570
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2570
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.CardContent, { className: "flex justify-center pb-8", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Button, { onClick: handleCreateCustomer, disabled: creatingCustomer, size: "lg", children: creatingCustomer ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2571
2571
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
2572
2572
|
"Setting up..."
|
|
2573
2573
|
] }) : "Set Up Billing Account" }) }),
|
|
2574
|
-
errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2574
|
+
errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.CardContent, { className: "pt-0", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-center text-sm text-destructive", children: errors.customer }) })
|
|
2575
2575
|
] }),
|
|
2576
2576
|
!noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2577
2577
|
criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -2755,7 +2755,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
2755
2755
|
try {
|
|
2756
2756
|
const unitAmountInCents = Math.round(values.unitAmount * 100);
|
|
2757
2757
|
if (isEditMode) {
|
|
2758
|
-
await
|
|
2758
|
+
await _chunkO3LLMGP7js.StripePriceService.updatePrice({
|
|
2759
2759
|
id: price.id,
|
|
2760
2760
|
nickname: values.nickname || void 0,
|
|
2761
2761
|
description: values.description || void 0,
|
|
@@ -2785,7 +2785,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
2785
2785
|
if (filteredFeatures.length > 0) {
|
|
2786
2786
|
createInput.features = filteredFeatures;
|
|
2787
2787
|
}
|
|
2788
|
-
await
|
|
2788
|
+
await _chunkO3LLMGP7js.StripePriceService.createPrice(createInput);
|
|
2789
2789
|
}
|
|
2790
2790
|
onSuccess();
|
|
2791
2791
|
onOpenChange(false);
|
|
@@ -2811,10 +2811,10 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
2811
2811
|
{ id: "licensed", text: "Licensed (per unit)" },
|
|
2812
2812
|
{ id: "metered", text: "Metered (usage-based)" }
|
|
2813
2813
|
];
|
|
2814
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2815
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2816
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2817
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2814
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.DialogContent, { className: "max-w-2xl", children: [
|
|
2815
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.DialogHeader, { children: [
|
|
2816
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.DialogTitle, { children: isEditMode ? "Edit Price" : "Create Price" }),
|
|
2817
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.DialogDescription, { children: isEditMode ? "Update the price details. Note: Only nickname and active status can be changed." : "Create a new price for this product" })
|
|
2818
2818
|
] }),
|
|
2819
2819
|
isEditMode && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-blue-50 border border-blue-200 rounded-lg p-4 flex gap-x-3", children: [
|
|
2820
2820
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.AlertCircle, { className: "h-5 w-5 text-blue-600 flex-shrink-0 mt-0.5" }),
|
|
@@ -2823,10 +2823,10 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
2823
2823
|
/* @__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." })
|
|
2824
2824
|
] })
|
|
2825
2825
|
] }),
|
|
2826
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2826
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-col gap-y-4", children: [
|
|
2827
2827
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
|
|
2828
2828
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2829
|
-
|
|
2829
|
+
_chunkJI6BDV7Ljs.FormInput,
|
|
2830
2830
|
{
|
|
2831
2831
|
form,
|
|
2832
2832
|
id: "unitAmount",
|
|
@@ -2836,10 +2836,10 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
2836
2836
|
isRequired: true
|
|
2837
2837
|
}
|
|
2838
2838
|
),
|
|
2839
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2839
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.FormSelect, { form, id: "currency", name: "Currency", values: currencyOptions, disabled: isEditMode })
|
|
2840
2840
|
] }),
|
|
2841
2841
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2842
|
-
|
|
2842
|
+
_chunkJI6BDV7Ljs.FormSelect,
|
|
2843
2843
|
{
|
|
2844
2844
|
form,
|
|
2845
2845
|
id: "interval",
|
|
@@ -2850,7 +2850,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
2850
2850
|
),
|
|
2851
2851
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
|
|
2852
2852
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2853
|
-
|
|
2853
|
+
_chunkJI6BDV7Ljs.FormInput,
|
|
2854
2854
|
{
|
|
2855
2855
|
form,
|
|
2856
2856
|
id: "intervalCount",
|
|
@@ -2861,7 +2861,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
2861
2861
|
}
|
|
2862
2862
|
),
|
|
2863
2863
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2864
|
-
|
|
2864
|
+
_chunkJI6BDV7Ljs.FormSelect,
|
|
2865
2865
|
{
|
|
2866
2866
|
form,
|
|
2867
2867
|
id: "usageType",
|
|
@@ -2872,7 +2872,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
2872
2872
|
)
|
|
2873
2873
|
] }),
|
|
2874
2874
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2875
|
-
|
|
2875
|
+
_chunkJI6BDV7Ljs.FormInput,
|
|
2876
2876
|
{
|
|
2877
2877
|
form,
|
|
2878
2878
|
id: "nickname",
|
|
@@ -2881,7 +2881,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
2881
2881
|
}
|
|
2882
2882
|
),
|
|
2883
2883
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2884
|
-
|
|
2884
|
+
_chunkJI6BDV7Ljs.FormTextarea,
|
|
2885
2885
|
{
|
|
2886
2886
|
form,
|
|
2887
2887
|
id: "description",
|
|
@@ -2891,11 +2891,11 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
2891
2891
|
}
|
|
2892
2892
|
),
|
|
2893
2893
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
2894
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2894
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Label, { children: "Features (optional)" }),
|
|
2895
2895
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
2896
2896
|
form.watch("features").map((_, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
|
|
2897
2897
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2898
|
-
|
|
2898
|
+
_chunkJI6BDV7Ljs.Input,
|
|
2899
2899
|
{
|
|
2900
2900
|
...form.register(`features.${index}`),
|
|
2901
2901
|
placeholder: `Feature ${index + 1}`,
|
|
@@ -2903,7 +2903,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
2903
2903
|
}
|
|
2904
2904
|
),
|
|
2905
2905
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2906
|
-
|
|
2906
|
+
_chunkJI6BDV7Ljs.Button,
|
|
2907
2907
|
{
|
|
2908
2908
|
type: "button",
|
|
2909
2909
|
variant: "outline",
|
|
@@ -2920,7 +2920,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
2920
2920
|
)
|
|
2921
2921
|
] }, index)),
|
|
2922
2922
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2923
|
-
|
|
2923
|
+
_chunkJI6BDV7Ljs.Button,
|
|
2924
2924
|
{
|
|
2925
2925
|
type: "button",
|
|
2926
2926
|
variant: "outline",
|
|
@@ -2938,8 +2938,8 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
2938
2938
|
)
|
|
2939
2939
|
] })
|
|
2940
2940
|
] }),
|
|
2941
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2942
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2941
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.FormCheckbox, { form, id: "active", name: "Active" }),
|
|
2942
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.CommonEditorButtons, { isEdit: isEditMode, form, disabled: isSubmitting, setOpen: onOpenChange })
|
|
2943
2943
|
] }) })
|
|
2944
2944
|
] }) });
|
|
2945
2945
|
}
|
|
@@ -2961,7 +2961,7 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
2961
2961
|
const loadPrices = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2962
2962
|
setLoading(true);
|
|
2963
2963
|
try {
|
|
2964
|
-
const fetchedPrices = await
|
|
2964
|
+
const fetchedPrices = await _chunkO3LLMGP7js.StripePriceService.listPrices({ productId });
|
|
2965
2965
|
setPrices(fetchedPrices);
|
|
2966
2966
|
} catch (error) {
|
|
2967
2967
|
console.error("[PricesList] Failed to load prices:", error);
|
|
@@ -2978,7 +2978,7 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
2978
2978
|
}
|
|
2979
2979
|
setArchivingPriceId(priceToArchive.id);
|
|
2980
2980
|
try {
|
|
2981
|
-
await
|
|
2981
|
+
await _chunkO3LLMGP7js.StripePriceService.archivePrice({ id: priceToArchive.id });
|
|
2982
2982
|
setPriceToArchive(null);
|
|
2983
2983
|
await loadPrices();
|
|
2984
2984
|
onPricesChange();
|
|
@@ -2994,7 +2994,7 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
2994
2994
|
}
|
|
2995
2995
|
setReactivatingPriceId(priceToReactivate.id);
|
|
2996
2996
|
try {
|
|
2997
|
-
await
|
|
2997
|
+
await _chunkO3LLMGP7js.StripePriceService.reactivatePrice({ id: priceToReactivate.id });
|
|
2998
2998
|
setPriceToReactivate(null);
|
|
2999
2999
|
await loadPrices();
|
|
3000
3000
|
onPricesChange();
|
|
@@ -3025,12 +3025,12 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3025
3025
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-4", children: [
|
|
3026
3026
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center justify-between mb-4", children: [
|
|
3027
3027
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "text-lg font-semibold", children: "Prices" }),
|
|
3028
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3028
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Button, { size: "sm", onClick: () => setShowCreatePrice(true), children: "Add Price" })
|
|
3029
3029
|
] }),
|
|
3030
3030
|
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: [
|
|
3031
3031
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.DollarSign, { className: "text-muted-foreground h-12 w-12" }),
|
|
3032
3032
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-sm", children: "No prices yet. Add a price to enable subscriptions." }),
|
|
3033
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3033
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Button, { size: "sm", onClick: () => setShowCreatePrice(true), children: "Add Price" })
|
|
3034
3034
|
] }),
|
|
3035
3035
|
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) => {
|
|
3036
3036
|
const isArchiving = archivingPriceId === price.id;
|
|
@@ -3039,9 +3039,9 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3039
3039
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-start justify-between mb-3", children: [
|
|
3040
3040
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.DollarSign, { className: "h-5 w-5 text-primary" }),
|
|
3041
3041
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-1", children: [
|
|
3042
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3042
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.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" }) }),
|
|
3043
3043
|
price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3044
|
-
|
|
3044
|
+
_chunkJI6BDV7Ljs.Button,
|
|
3045
3045
|
{
|
|
3046
3046
|
variant: "ghost",
|
|
3047
3047
|
size: "sm",
|
|
@@ -3051,7 +3051,7 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3051
3051
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Archive, { className: "h-4 w-4" })
|
|
3052
3052
|
}
|
|
3053
3053
|
) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3054
|
-
|
|
3054
|
+
_chunkJI6BDV7Ljs.Button,
|
|
3055
3055
|
{
|
|
3056
3056
|
variant: "ghost",
|
|
3057
3057
|
size: "sm",
|
|
@@ -3102,20 +3102,20 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3102
3102
|
}
|
|
3103
3103
|
}
|
|
3104
3104
|
),
|
|
3105
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3106
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3107
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3108
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3105
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.AlertDialog, { open: !!priceToArchive, onOpenChange: (open) => !open && setPriceToArchive(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.AlertDialogContent, { children: [
|
|
3106
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.AlertDialogHeader, { children: [
|
|
3107
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.AlertDialogTitle, { children: "Archive Price" }),
|
|
3108
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.AlertDialogDescription, { children: [
|
|
3109
3109
|
"Are you sure you want to archive the price for",
|
|
3110
3110
|
" ",
|
|
3111
3111
|
priceToArchive && `${formatCurrency(priceToArchive.unitAmount, priceToArchive.currency)} ${formatInterval2(priceToArchive)}`,
|
|
3112
3112
|
"? This will prevent new subscriptions but existing ones will continue."
|
|
3113
3113
|
] })
|
|
3114
3114
|
] }),
|
|
3115
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3116
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3115
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.AlertDialogFooter, { children: [
|
|
3116
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.AlertDialogCancel, { disabled: !!archivingPriceId, children: "Cancel" }),
|
|
3117
3117
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3118
|
-
|
|
3118
|
+
_chunkJI6BDV7Ljs.AlertDialogAction,
|
|
3119
3119
|
{
|
|
3120
3120
|
onClick: handleArchive,
|
|
3121
3121
|
disabled: !!archivingPriceId,
|
|
@@ -3125,20 +3125,20 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3125
3125
|
)
|
|
3126
3126
|
] })
|
|
3127
3127
|
] }) }),
|
|
3128
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3129
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3130
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3131
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3128
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.AlertDialog, { open: !!priceToReactivate, onOpenChange: (open) => !open && setPriceToReactivate(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.AlertDialogContent, { children: [
|
|
3129
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.AlertDialogHeader, { children: [
|
|
3130
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.AlertDialogTitle, { children: "Reactivate Price" }),
|
|
3131
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.AlertDialogDescription, { children: [
|
|
3132
3132
|
"Are you sure you want to reactivate the price for",
|
|
3133
3133
|
" ",
|
|
3134
3134
|
priceToReactivate && `${formatCurrency(priceToReactivate.unitAmount, priceToReactivate.currency)} ${formatInterval2(priceToReactivate)}`,
|
|
3135
3135
|
"? This will allow new subscriptions again."
|
|
3136
3136
|
] })
|
|
3137
3137
|
] }),
|
|
3138
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3139
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3138
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.AlertDialogFooter, { children: [
|
|
3139
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.AlertDialogCancel, { disabled: !!reactivatingPriceId, children: "Cancel" }),
|
|
3140
3140
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3141
|
-
|
|
3141
|
+
_chunkJI6BDV7Ljs.AlertDialogAction,
|
|
3142
3142
|
{
|
|
3143
3143
|
onClick: handleReactivate,
|
|
3144
3144
|
disabled: !!reactivatingPriceId,
|
|
@@ -3182,14 +3182,14 @@ function ProductEditor({ product, open, onOpenChange, onSuccess }) {
|
|
|
3182
3182
|
setIsSubmitting(true);
|
|
3183
3183
|
try {
|
|
3184
3184
|
if (product) {
|
|
3185
|
-
await
|
|
3185
|
+
await _chunkO3LLMGP7js.StripeProductService.updateProduct({
|
|
3186
3186
|
id: product.id,
|
|
3187
3187
|
name: values.name,
|
|
3188
3188
|
description: values.description,
|
|
3189
3189
|
active: values.active
|
|
3190
3190
|
});
|
|
3191
3191
|
} else {
|
|
3192
|
-
await
|
|
3192
|
+
await _chunkO3LLMGP7js.StripeProductService.createProduct({
|
|
3193
3193
|
id: _uuid.v4.call(void 0, ),
|
|
3194
3194
|
name: values.name,
|
|
3195
3195
|
description: values.description,
|
|
@@ -3204,15 +3204,15 @@ function ProductEditor({ product, open, onOpenChange, onSuccess }) {
|
|
|
3204
3204
|
setIsSubmitting(false);
|
|
3205
3205
|
}
|
|
3206
3206
|
}, "onSubmit");
|
|
3207
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3208
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3209
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3210
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3207
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.DialogContent, { className: "max-w-2xl", children: [
|
|
3208
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.DialogHeader, { children: [
|
|
3209
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.DialogTitle, { children: product ? "Edit Product" : "Create Product" }),
|
|
3210
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.DialogDescription, { children: product ? `Update the details for ${product.name}` : "Create a new product to offer to your customers" })
|
|
3211
3211
|
] }),
|
|
3212
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3213
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3212
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-col gap-y-4", children: [
|
|
3213
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.FormInput, { form, id: "name", name: "Product Name", placeholder: "Enter product name", isRequired: true }),
|
|
3214
3214
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3215
|
-
|
|
3215
|
+
_chunkJI6BDV7Ljs.FormTextarea,
|
|
3216
3216
|
{
|
|
3217
3217
|
form,
|
|
3218
3218
|
id: "description",
|
|
@@ -3221,8 +3221,8 @@ function ProductEditor({ product, open, onOpenChange, onSuccess }) {
|
|
|
3221
3221
|
className: "min-h-32"
|
|
3222
3222
|
}
|
|
3223
3223
|
),
|
|
3224
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3225
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3224
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.FormCheckbox, { form, id: "active", name: "Active" }),
|
|
3225
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.CommonEditorButtons, { isEdit: !!product, form, disabled: isSubmitting, setOpen: onOpenChange })
|
|
3226
3226
|
] }) })
|
|
3227
3227
|
] }) });
|
|
3228
3228
|
}
|
|
@@ -3245,7 +3245,7 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3245
3245
|
}
|
|
3246
3246
|
setArchivingProductId(productToArchive.id);
|
|
3247
3247
|
try {
|
|
3248
|
-
const archivedProduct = await
|
|
3248
|
+
const archivedProduct = await _chunkO3LLMGP7js.StripeProductService.archiveProduct({ id: productToArchive.id });
|
|
3249
3249
|
setProductToArchive(null);
|
|
3250
3250
|
onProductsChange();
|
|
3251
3251
|
} catch (error) {
|
|
@@ -3260,7 +3260,7 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3260
3260
|
}
|
|
3261
3261
|
setReactivatingProductId(productToReactivate.id);
|
|
3262
3262
|
try {
|
|
3263
|
-
const reactivatedProduct = await
|
|
3263
|
+
const reactivatedProduct = await _chunkO3LLMGP7js.StripeProductService.reactivateProduct({ id: productToReactivate.id });
|
|
3264
3264
|
setProductToReactivate(null);
|
|
3265
3265
|
onProductsChange();
|
|
3266
3266
|
} catch (error) {
|
|
@@ -3289,12 +3289,12 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3289
3289
|
] })
|
|
3290
3290
|
] }),
|
|
3291
3291
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
3292
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3292
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.Button, { variant: "outline", size: "sm", onClick: () => setEditingProduct(product), children: [
|
|
3293
3293
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Edit, { className: "h-4 w-4 mr-1" }),
|
|
3294
3294
|
"Edit"
|
|
3295
3295
|
] }),
|
|
3296
3296
|
product.active ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3297
|
-
|
|
3297
|
+
_chunkJI6BDV7Ljs.Button,
|
|
3298
3298
|
{
|
|
3299
3299
|
variant: "outline",
|
|
3300
3300
|
size: "sm",
|
|
@@ -3306,7 +3306,7 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3306
3306
|
]
|
|
3307
3307
|
}
|
|
3308
3308
|
) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3309
|
-
|
|
3309
|
+
_chunkJI6BDV7Ljs.Button,
|
|
3310
3310
|
{
|
|
3311
3311
|
variant: "outline",
|
|
3312
3312
|
size: "sm",
|
|
@@ -3318,7 +3318,7 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3318
3318
|
]
|
|
3319
3319
|
}
|
|
3320
3320
|
),
|
|
3321
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3321
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.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" }) })
|
|
3322
3322
|
] })
|
|
3323
3323
|
] }),
|
|
3324
3324
|
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 }) })
|
|
@@ -3336,19 +3336,19 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3336
3336
|
}
|
|
3337
3337
|
}
|
|
3338
3338
|
),
|
|
3339
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3340
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3341
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3342
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3339
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.AlertDialog, { open: !!productToArchive, onOpenChange: (open) => !open && setProductToArchive(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.AlertDialogContent, { children: [
|
|
3340
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.AlertDialogHeader, { children: [
|
|
3341
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.AlertDialogTitle, { children: "Archive Product" }),
|
|
3342
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.AlertDialogDescription, { children: [
|
|
3343
3343
|
'Are you sure you want to archive "',
|
|
3344
3344
|
_optionalChain([productToArchive, 'optionalAccess', _99 => _99.name]),
|
|
3345
3345
|
'"? This will deactivate it and it will no longer be available for new subscriptions.'
|
|
3346
3346
|
] })
|
|
3347
3347
|
] }),
|
|
3348
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3349
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3348
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.AlertDialogFooter, { children: [
|
|
3349
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.AlertDialogCancel, { disabled: !!archivingProductId, children: "Cancel" }),
|
|
3350
3350
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3351
|
-
|
|
3351
|
+
_chunkJI6BDV7Ljs.AlertDialogAction,
|
|
3352
3352
|
{
|
|
3353
3353
|
onClick: handleArchive,
|
|
3354
3354
|
disabled: !!archivingProductId,
|
|
@@ -3358,19 +3358,19 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3358
3358
|
)
|
|
3359
3359
|
] })
|
|
3360
3360
|
] }) }),
|
|
3361
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3362
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3363
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3364
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3361
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.AlertDialog, { open: !!productToReactivate, onOpenChange: (open) => !open && setProductToReactivate(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.AlertDialogContent, { children: [
|
|
3362
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.AlertDialogHeader, { children: [
|
|
3363
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.AlertDialogTitle, { children: "Reactivate Product" }),
|
|
3364
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.AlertDialogDescription, { children: [
|
|
3365
3365
|
'Are you sure you want to reactivate "',
|
|
3366
3366
|
_optionalChain([productToReactivate, 'optionalAccess', _100 => _100.name]),
|
|
3367
3367
|
'"? This will make it available for new subscriptions again.'
|
|
3368
3368
|
] })
|
|
3369
3369
|
] }),
|
|
3370
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3371
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3370
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJI6BDV7Ljs.AlertDialogFooter, { children: [
|
|
3371
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.AlertDialogCancel, { disabled: !!reactivatingProductId, children: "Cancel" }),
|
|
3372
3372
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3373
|
-
|
|
3373
|
+
_chunkJI6BDV7Ljs.AlertDialogAction,
|
|
3374
3374
|
{
|
|
3375
3375
|
onClick: handleReactivate,
|
|
3376
3376
|
disabled: !!reactivatingProductId,
|
|
@@ -3387,7 +3387,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductsList, "ProductsList");
|
|
|
3387
3387
|
// src/features/billing/stripe-product/components/containers/ProductsAdminContainer.tsx
|
|
3388
3388
|
|
|
3389
3389
|
function ProductsAdminContainer() {
|
|
3390
|
-
const { hasRole } =
|
|
3390
|
+
const { hasRole } = _chunkJI6BDV7Ljs.useCurrentUserContext.call(void 0, );
|
|
3391
3391
|
const [products, setProducts] = _react.useState.call(void 0, []);
|
|
3392
3392
|
const [loading, setLoading] = _react.useState.call(void 0, true);
|
|
3393
3393
|
const [showCreateProduct, setShowCreateProduct] = _react.useState.call(void 0, false);
|
|
@@ -3397,7 +3397,7 @@ function ProductsAdminContainer() {
|
|
|
3397
3397
|
const loadProducts = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3398
3398
|
setLoading(true);
|
|
3399
3399
|
try {
|
|
3400
|
-
const fetchedProducts = await
|
|
3400
|
+
const fetchedProducts = await _chunkO3LLMGP7js.StripeProductService.listProducts();
|
|
3401
3401
|
setProducts(fetchedProducts);
|
|
3402
3402
|
} catch (error) {
|
|
3403
3403
|
console.error("[ProductsAdminContainer] Failed to load products:", error);
|
|
@@ -3417,14 +3417,14 @@ function ProductsAdminContainer() {
|
|
|
3417
3417
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Package, { className: "h-8 w-8" }),
|
|
3418
3418
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-3xl font-bold", children: "Product & Price Management" })
|
|
3419
3419
|
] }),
|
|
3420
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3420
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Button, { onClick: () => setShowCreateProduct(true), children: "Create Product" })
|
|
3421
3421
|
] }),
|
|
3422
3422
|
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: [
|
|
3423
3423
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Package, { className: "text-muted-foreground h-16 w-16" }),
|
|
3424
3424
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
3425
3425
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "mb-2 text-xl font-semibold", children: "No products yet" }),
|
|
3426
3426
|
/* @__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." }),
|
|
3427
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3427
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJI6BDV7Ljs.Button, { onClick: () => setShowCreateProduct(true), children: "Create Your First Product" })
|
|
3428
3428
|
] })
|
|
3429
3429
|
] }),
|
|
3430
3430
|
products.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductsList, { products, onProductsChange: loadProducts }),
|