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