@carlonicora/nextjs-jsonapi 3.2.0 → 3.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AssistantMessageInterface-Dh0BpbP2.d.ts → AssistantMessageInterface-0zyVingf.d.ts} +1 -1
- package/dist/{AssistantMessageInterface-Ce8FcllX.d.mts → AssistantMessageInterface-ddyG114R.d.mts} +1 -1
- package/dist/{BlockNoteEditor-RGOOSDA2.mjs → BlockNoteEditor-G5A34EXN.mjs} +4 -4
- package/dist/{BlockNoteEditor-G2OSGAKK.js → BlockNoteEditor-JLMXCPGB.js} +19 -19
- package/dist/{BlockNoteEditor-G2OSGAKK.js.map → BlockNoteEditor-JLMXCPGB.js.map} +1 -1
- package/dist/{auth.interface-COmBjh89.d.ts → auth.interface-B6ZQLGjS.d.ts} +1 -1
- package/dist/{auth.interface-CkmZqat3.d.mts → auth.interface-jYD8Gc4P.d.mts} +1 -1
- package/dist/billing/index.js +420 -399
- package/dist/billing/index.js.map +1 -1
- package/dist/billing/index.mjs +25 -4
- package/dist/billing/index.mjs.map +1 -1
- package/dist/{chunk-B6WAWPN3.js → chunk-5AKDE5UW.js} +755 -755
- package/dist/{chunk-B6WAWPN3.js.map → chunk-5AKDE5UW.js.map} +1 -1
- package/dist/{chunk-ZMYZFQN3.mjs → chunk-LCMVARSP.mjs} +2 -2
- package/dist/{chunk-RFOZWANP.mjs → chunk-O4LTJAAM.mjs} +4 -4
- package/dist/{chunk-CGJW7ZZM.mjs → chunk-PGARO3JT.mjs} +7 -1
- package/dist/chunk-PGARO3JT.mjs.map +1 -0
- package/dist/{chunk-H7DOSB7W.js → chunk-UYENG3GT.js} +7 -7
- package/dist/{chunk-H7DOSB7W.js.map → chunk-UYENG3GT.js.map} +1 -1
- package/dist/{chunk-YUXCJ35V.js → chunk-YKFXQOQA.js} +7 -1
- package/dist/chunk-YKFXQOQA.js.map +1 -0
- package/dist/client/index.d.mts +2 -2
- package/dist/client/index.d.ts +2 -2
- package/dist/client/index.js +4 -4
- package/dist/client/index.mjs +3 -3
- package/dist/components/index.d.mts +3 -3
- package/dist/components/index.d.ts +3 -3
- package/dist/components/index.js +4 -4
- package/dist/components/index.mjs +3 -3
- package/dist/contexts/index.d.mts +3 -3
- package/dist/contexts/index.d.ts +3 -3
- package/dist/contexts/index.js +4 -4
- package/dist/contexts/index.mjs +3 -3
- package/dist/core/index.d.mts +9 -7
- package/dist/core/index.d.ts +9 -7
- package/dist/core/index.js +2 -2
- package/dist/core/index.mjs +1 -1
- package/dist/features/help/index.js +37 -37
- package/dist/features/help/index.mjs +3 -3
- package/dist/features/tokenusage/index.js +101 -101
- package/dist/features/tokenusage/index.mjs +3 -3
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +3 -3
- package/dist/index.mjs +2 -2
- package/dist/{notification.interface-CG1vqoxg.d.mts → notification.interface-BWOCvKRP.d.mts} +6 -0
- package/dist/{notification.interface--27exGde.d.ts → notification.interface-DYF56CtE.d.ts} +6 -0
- package/dist/{s3.service-Dt6MfuHr.d.mts → s3.service-D_dswjgz.d.mts} +2 -2
- package/dist/{s3.service-CpwA3sl_.d.ts → s3.service-DserU9VK.d.ts} +2 -2
- package/dist/server/index.d.mts +3 -3
- package/dist/server/index.d.ts +3 -3
- package/dist/server/index.js +3 -3
- package/dist/server/index.mjs +1 -1
- package/dist/{useSocket-M3YY0aTS.d.mts → useSocket-BZG9oX-L.d.mts} +1 -1
- package/dist/{useSocket-DgGAQW6h.d.ts → useSocket-CiyTtYFj.d.ts} +1 -1
- package/package.json +2 -2
- package/src/features/billing/stripe-price/components/forms/PriceEditor.tsx +25 -1
- package/src/features/company/data/company.interface.ts +7 -0
- package/src/features/company/data/company.test.ts +40 -0
- package/src/features/company/data/company.ts +7 -0
- package/dist/chunk-CGJW7ZZM.mjs.map +0 -1
- package/dist/chunk-YUXCJ35V.js.map +0 -1
- /package/dist/{BlockNoteEditor-RGOOSDA2.mjs.map → BlockNoteEditor-G5A34EXN.mjs.map} +0 -0
- /package/dist/{chunk-ZMYZFQN3.mjs.map → chunk-LCMVARSP.mjs.map} +0 -0
- /package/dist/{chunk-RFOZWANP.mjs.map → chunk-O4LTJAAM.mjs.map} +0 -0
package/dist/billing/index.js
CHANGED
|
@@ -62,12 +62,12 @@
|
|
|
62
62
|
|
|
63
63
|
|
|
64
64
|
|
|
65
|
-
var
|
|
65
|
+
var _chunk5AKDE5UWjs = require('../chunk-5AKDE5UW.js');
|
|
66
66
|
|
|
67
67
|
|
|
68
68
|
|
|
69
69
|
|
|
70
|
-
var
|
|
70
|
+
var _chunkUYENG3GTjs = require('../chunk-UYENG3GT.js');
|
|
71
71
|
|
|
72
72
|
|
|
73
73
|
|
|
@@ -80,7 +80,7 @@ var _chunkH7DOSB7Wjs = require('../chunk-H7DOSB7W.js');
|
|
|
80
80
|
|
|
81
81
|
|
|
82
82
|
|
|
83
|
-
var
|
|
83
|
+
var _chunkYKFXQOQAjs = require('../chunk-YKFXQOQA.js');
|
|
84
84
|
require('../chunk-LXKSUWAV.js');
|
|
85
85
|
require('../chunk-IBS6NI7D.js');
|
|
86
86
|
require('../chunk-PFAZPP54.js');
|
|
@@ -131,41 +131,41 @@ function SubscriptionSummaryCard({
|
|
|
131
131
|
onManageClick
|
|
132
132
|
}) {
|
|
133
133
|
if (loading) {
|
|
134
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
135
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
136
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
134
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.Card, { children: [
|
|
135
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
136
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.CardTitle, { children: "Subscriptions" }),
|
|
137
137
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
138
138
|
] }),
|
|
139
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
140
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
141
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
142
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
139
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.CardContent, { children: [
|
|
140
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
141
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Skeleton, { className: "h-4 w-24 mb-1" }),
|
|
142
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Skeleton, { className: "h-4 w-40" })
|
|
143
143
|
] })
|
|
144
144
|
] });
|
|
145
145
|
}
|
|
146
146
|
if (error) {
|
|
147
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
148
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
149
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
147
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.Card, { children: [
|
|
148
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
149
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.CardTitle, { children: "Subscriptions" }),
|
|
150
150
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
151
151
|
] }),
|
|
152
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
152
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
153
153
|
] });
|
|
154
154
|
}
|
|
155
155
|
const activeSubscriptions = subscriptions.filter(
|
|
156
156
|
(sub) => sub.status === "active" /* ACTIVE */ || sub.status === "trialing" /* TRIALING */
|
|
157
157
|
);
|
|
158
158
|
const primarySubscription = activeSubscriptions[0];
|
|
159
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
160
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
161
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
159
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
|
|
160
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
161
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.CardTitle, { children: "Subscriptions" }),
|
|
162
162
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
163
163
|
] }),
|
|
164
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
164
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.CardContent, { children: subscriptions.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
165
165
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No active plan" }),
|
|
166
166
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Subscribe to get started" }),
|
|
167
167
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
168
|
-
|
|
168
|
+
_chunk5AKDE5UWjs.Button,
|
|
169
169
|
{
|
|
170
170
|
variant: "outline",
|
|
171
171
|
size: "sm",
|
|
@@ -184,7 +184,7 @@ function SubscriptionSummaryCard({
|
|
|
184
184
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
185
185
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: formatPlanName(primarySubscription) }),
|
|
186
186
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
187
|
-
|
|
187
|
+
_chunk5AKDE5UWjs.Badge,
|
|
188
188
|
{
|
|
189
189
|
variant: primarySubscription.cancelAtPeriodEnd ? "secondary" : getStatusBadgeVariant(primarySubscription.status),
|
|
190
190
|
children: primarySubscription.cancelAtPeriodEnd ? "Canceling" : primarySubscription.status
|
|
@@ -226,37 +226,37 @@ function PaymentMethodSummaryCard({
|
|
|
226
226
|
onManageClick
|
|
227
227
|
}) {
|
|
228
228
|
if (loading) {
|
|
229
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
230
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
231
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
229
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.Card, { children: [
|
|
230
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
231
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.CardTitle, { children: "Payment Method" }),
|
|
232
232
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
233
233
|
] }),
|
|
234
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
235
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
236
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
234
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.CardContent, { children: [
|
|
235
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
236
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Skeleton, { className: "h-4 w-24" })
|
|
237
237
|
] })
|
|
238
238
|
] });
|
|
239
239
|
}
|
|
240
240
|
if (error) {
|
|
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, _chunk5AKDE5UWjs.Card, { children: [
|
|
242
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
243
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.CardTitle, { 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, _chunk5AKDE5UWjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
247
247
|
] });
|
|
248
248
|
}
|
|
249
249
|
const defaultMethod = paymentMethods.find((pm) => pm.id === defaultPaymentMethodId) || paymentMethods[0];
|
|
250
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
251
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
252
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
250
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
|
|
251
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
252
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.CardTitle, { children: "Payment Method" }),
|
|
253
253
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
254
254
|
] }),
|
|
255
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
255
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.CardContent, { children: paymentMethods.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
256
256
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No payment method" }),
|
|
257
257
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Add a card to enable subscriptions" }),
|
|
258
258
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
259
|
-
|
|
259
|
+
_chunk5AKDE5UWjs.Button,
|
|
260
260
|
{
|
|
261
261
|
variant: "outline",
|
|
262
262
|
size: "sm",
|
|
@@ -320,7 +320,7 @@ function CustomerInfoCard({ customer, loading, error }) {
|
|
|
320
320
|
e.stopPropagation();
|
|
321
321
|
setPortalLoading(true);
|
|
322
322
|
try {
|
|
323
|
-
const { url } = await
|
|
323
|
+
const { url } = await _chunkYKFXQOQAjs.StripeCustomerService.createPortalSession();
|
|
324
324
|
window.open(url, "_blank");
|
|
325
325
|
} catch (err) {
|
|
326
326
|
console.error("[CustomerInfoCard] Failed to create portal session:", err);
|
|
@@ -329,52 +329,52 @@ function CustomerInfoCard({ customer, loading, error }) {
|
|
|
329
329
|
}
|
|
330
330
|
}, "handlePortalClick");
|
|
331
331
|
if (loading) {
|
|
332
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
333
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
334
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
332
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.Card, { children: [
|
|
333
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
334
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.CardTitle, { children: "Billing Account" }),
|
|
335
335
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
336
336
|
] }),
|
|
337
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
338
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
339
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
340
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
337
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.CardContent, { children: [
|
|
338
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
339
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Skeleton, { className: "h-4 w-48 mb-1" }),
|
|
340
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Skeleton, { className: "h-4 w-24" })
|
|
341
341
|
] })
|
|
342
342
|
] });
|
|
343
343
|
}
|
|
344
344
|
if (error) {
|
|
345
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
346
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
347
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
345
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.Card, { children: [
|
|
346
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
347
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.CardTitle, { children: "Billing Account" }),
|
|
348
348
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
349
349
|
] }),
|
|
350
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
350
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
351
351
|
] });
|
|
352
352
|
}
|
|
353
353
|
if (!customer) {
|
|
354
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
355
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
356
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
354
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.Card, { children: [
|
|
355
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
356
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.CardTitle, { children: "Billing Account" }),
|
|
357
357
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
358
358
|
] }),
|
|
359
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
359
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.CardContent, { children: [
|
|
360
360
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "Not set up" }),
|
|
361
361
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Billing account will be created when you subscribe" })
|
|
362
362
|
] })
|
|
363
363
|
] });
|
|
364
364
|
}
|
|
365
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
366
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
367
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
365
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.Card, { children: [
|
|
366
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
367
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.CardTitle, { children: "Billing Account" }),
|
|
368
368
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
369
369
|
] }),
|
|
370
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
370
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
371
371
|
customer.name && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: customer.name }),
|
|
372
372
|
customer.email && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: customer.email }),
|
|
373
373
|
customer.balance !== void 0 && customer.balance !== 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm", children: [
|
|
374
374
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground", children: "Credit Balance: " }),
|
|
375
375
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: customer.balance < 0 ? "text-success" : "text-destructive", children: formatBalance(customer.balance, customer.currency) })
|
|
376
376
|
] }),
|
|
377
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
377
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.Button, { variant: "outline", size: "sm", className: "mt-2", onClick: handlePortalClick, disabled: portalLoading, children: [
|
|
378
378
|
portalLoading ? "Loading..." : "Manage in Stripe Portal",
|
|
379
379
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ExternalLink, { className: "h-4 w-4 ml-1" })
|
|
380
380
|
] })
|
|
@@ -418,42 +418,42 @@ function formatAmount(amount, currency) {
|
|
|
418
418
|
_chunk7QVYU63Ejs.__name.call(void 0, formatAmount, "formatAmount");
|
|
419
419
|
function InvoicesSummaryCard({ invoices, loading, error, onViewAllClick }) {
|
|
420
420
|
if (loading) {
|
|
421
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
422
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
423
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
421
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.Card, { children: [
|
|
422
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
423
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.CardTitle, { children: "Recent Invoices" }),
|
|
424
424
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
425
425
|
] }),
|
|
426
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
427
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
428
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
429
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
426
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.CardContent, { children: [
|
|
427
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Skeleton, { className: "h-6 w-24 mb-2" }),
|
|
428
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Skeleton, { className: "h-4 w-32 mb-1" }),
|
|
429
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Skeleton, { className: "h-4 w-20" })
|
|
430
430
|
] })
|
|
431
431
|
] });
|
|
432
432
|
}
|
|
433
433
|
if (error) {
|
|
434
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
435
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
436
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
434
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.Card, { children: [
|
|
435
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
436
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.CardTitle, { children: "Recent Invoices" }),
|
|
437
437
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
438
438
|
] }),
|
|
439
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
439
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
440
440
|
] });
|
|
441
441
|
}
|
|
442
442
|
const latestInvoice = invoices[0];
|
|
443
443
|
const paidInvoices = invoices.filter((inv) => inv.status === "paid" /* PAID */);
|
|
444
444
|
const openInvoices = invoices.filter((inv) => inv.status === "open" /* OPEN */);
|
|
445
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
446
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
447
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
445
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewAllClick, children: [
|
|
446
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
447
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.CardTitle, { children: "Recent Invoices" }),
|
|
448
448
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
449
449
|
] }),
|
|
450
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
450
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.CardContent, { children: invoices.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
451
451
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No invoices yet" }),
|
|
452
452
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Invoices will appear after your first billing cycle" })
|
|
453
453
|
] }) : latestInvoice ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
454
454
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
455
455
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: formatAmount(latestInvoice.total, latestInvoice.currency) }),
|
|
456
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
456
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Badge, { variant: getStatusBadgeVariant2(latestInvoice.status), children: latestInvoice.status })
|
|
457
457
|
] }),
|
|
458
458
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: latestInvoice.stripeInvoiceNumber || `Invoice from ${formatDate2(latestInvoice.periodStart)}` }),
|
|
459
459
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-4 text-xs text-muted-foreground", children: [
|
|
@@ -493,24 +493,24 @@ function BillingUsageSummaryCard({
|
|
|
493
493
|
onViewDetailsClick
|
|
494
494
|
}) {
|
|
495
495
|
if (loading) {
|
|
496
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
497
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
498
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
496
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.Card, { children: [
|
|
497
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
498
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.CardTitle, { children: "Usage This Month" }),
|
|
499
499
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
500
500
|
] }),
|
|
501
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
502
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
503
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
501
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.CardContent, { children: [
|
|
502
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Skeleton, { className: "h-6 w-24 mb-2" }),
|
|
503
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Skeleton, { className: "h-4 w-32" })
|
|
504
504
|
] })
|
|
505
505
|
] });
|
|
506
506
|
}
|
|
507
507
|
if (error) {
|
|
508
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
509
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
510
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
508
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.Card, { children: [
|
|
509
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
510
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.CardTitle, { children: "Usage This Month" }),
|
|
511
511
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
512
512
|
] }),
|
|
513
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
513
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
514
514
|
] });
|
|
515
515
|
}
|
|
516
516
|
const totalUsage = Object.values(summaries).reduce((acc, summary) => {
|
|
@@ -518,12 +518,12 @@ function BillingUsageSummaryCard({
|
|
|
518
518
|
}, 0);
|
|
519
519
|
const primaryMeter = meters.find((m) => _optionalChain([summaries, 'access', _17 => _17[m.id], 'optionalAccess', _18 => _18.aggregatedValue]));
|
|
520
520
|
const primarySummary = primaryMeter ? summaries[primaryMeter.id] : null;
|
|
521
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
522
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
523
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
521
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewDetailsClick, children: [
|
|
522
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
523
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.CardTitle, { children: "Usage This Month" }),
|
|
524
524
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
525
525
|
] }),
|
|
526
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
526
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.CardContent, { children: meters.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
527
527
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No meters" }),
|
|
528
528
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "No usage meters are configured" })
|
|
529
529
|
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
@@ -575,7 +575,7 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
|
|
|
575
575
|
const fetchSetupIntent = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
576
576
|
setLoading(true);
|
|
577
577
|
try {
|
|
578
|
-
const intent = await
|
|
578
|
+
const intent = await _chunkYKFXQOQAjs.StripeCustomerService.createSetupIntent();
|
|
579
579
|
setSetupIntent(intent);
|
|
580
580
|
} catch (err) {
|
|
581
581
|
console.error("[PaymentMethodForm] Failed to create setup intent:", err);
|
|
@@ -613,7 +613,7 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
|
|
|
613
613
|
return;
|
|
614
614
|
}
|
|
615
615
|
if (setAsDefault && _optionalChain([confirmedSetupIntent, 'optionalAccess', _19 => _19.payment_method])) {
|
|
616
|
-
await
|
|
616
|
+
await _chunkYKFXQOQAjs.StripeCustomerService.setDefaultPaymentMethod({
|
|
617
617
|
paymentMethodId: typeof confirmedSetupIntent.payment_method === "string" ? confirmedSetupIntent.payment_method : confirmedSetupIntent.payment_method.id
|
|
618
618
|
});
|
|
619
619
|
}
|
|
@@ -629,7 +629,7 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
|
|
|
629
629
|
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..." }) });
|
|
630
630
|
}
|
|
631
631
|
if (!setupIntent && error) {
|
|
632
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
632
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.AlertDescription, { children: error }) });
|
|
633
633
|
}
|
|
634
634
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: handleSubmit, className: "flex flex-col gap-y-4", children: [
|
|
635
635
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rounded-md border border-gray-300 p-3", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -652,13 +652,13 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
|
|
|
652
652
|
}
|
|
653
653
|
) }),
|
|
654
654
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
655
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
656
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
655
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Checkbox, { id: "setAsDefault", checked: setAsDefault, onCheckedChange: (checked) => setSetAsDefault(!!checked) }),
|
|
656
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Label, { htmlFor: "setAsDefault", className: "cursor-pointer font-normal", children: "Set as default payment method" })
|
|
657
657
|
] }),
|
|
658
|
-
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
658
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.AlertDescription, { children: error }) }),
|
|
659
659
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-x-2", children: [
|
|
660
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
661
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
660
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Button, { type: "button", variant: "outline", onClick: onCancel, disabled: isSubmitting || isLoading, children: "Cancel" }),
|
|
661
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Button, { type: "submit", disabled: !stripe || isSubmitting || isLoading, children: isSubmitting ? "Processing..." : "Add Card" })
|
|
662
662
|
] })
|
|
663
663
|
] });
|
|
664
664
|
}
|
|
@@ -674,10 +674,10 @@ function PaymentMethodEditor({ open, onOpenChange, onSuccess }) {
|
|
|
674
674
|
const handleCancel = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
675
675
|
onOpenChange(false);
|
|
676
676
|
}, "handleCancel");
|
|
677
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
678
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
679
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
680
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
677
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.DialogContent, { className: "max-w-md", children: [
|
|
678
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.DialogHeader, { children: [
|
|
679
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.DialogTitle, { children: "Add Payment Method" }),
|
|
680
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.DialogDescription, { children: "Add a new payment method to your account. Your card information is securely processed by Stripe." })
|
|
681
681
|
] }),
|
|
682
682
|
open && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodForm, { onSuccess: handleSuccess, onCancel: handleCancel })
|
|
683
683
|
] }) });
|
|
@@ -701,7 +701,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
701
701
|
_react.useEffect.call(void 0, () => {
|
|
702
702
|
const loadCustomer = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
703
703
|
try {
|
|
704
|
-
const fetchedCustomer = await
|
|
704
|
+
const fetchedCustomer = await _chunkYKFXQOQAjs.StripeCustomerService.getCustomer();
|
|
705
705
|
setCustomer(fetchedCustomer);
|
|
706
706
|
} catch (error) {
|
|
707
707
|
console.error("[PaymentMethodCard] Failed to load customer:", error);
|
|
@@ -718,7 +718,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
718
718
|
const handleSetDefault = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
719
719
|
setLoading(true);
|
|
720
720
|
try {
|
|
721
|
-
await
|
|
721
|
+
await _chunkYKFXQOQAjs.StripeCustomerService.setDefaultPaymentMethod({ paymentMethodId: paymentMethod.id });
|
|
722
722
|
onUpdate();
|
|
723
723
|
} catch (error) {
|
|
724
724
|
console.error("[PaymentMethodCard] Failed to set as default:", error);
|
|
@@ -729,7 +729,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
729
729
|
const handleRemove = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
730
730
|
setLoading(true);
|
|
731
731
|
try {
|
|
732
|
-
await
|
|
732
|
+
await _chunkYKFXQOQAjs.StripeCustomerService.removePaymentMethod({ paymentMethodId: paymentMethod.id });
|
|
733
733
|
setShowRemoveDialog(false);
|
|
734
734
|
onUpdate();
|
|
735
735
|
} catch (error) {
|
|
@@ -738,16 +738,16 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
738
738
|
}
|
|
739
739
|
}, "handleRemove");
|
|
740
740
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
741
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
742
|
-
isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
743
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
741
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.Card, { className: "relative", children: [
|
|
742
|
+
isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Badge, { variant: "softGreen", className: "absolute right-2 top-2", children: "Default" }),
|
|
743
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.CardHeader, { className: "flex flex-row items-center justify-between pb-2", children: [
|
|
744
744
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
745
745
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-2xl", children: brandIcon }),
|
|
746
746
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium capitalize", children: brand })
|
|
747
747
|
] }),
|
|
748
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
749
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
750
|
-
|
|
748
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.DropdownMenu, { children: [
|
|
749
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.DropdownMenuTrigger, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
750
|
+
_chunk5AKDE5UWjs.Button,
|
|
751
751
|
{
|
|
752
752
|
render: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {}),
|
|
753
753
|
nativeButton: false,
|
|
@@ -758,10 +758,10 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
758
758
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.MoreVertical, { className: "h-4 w-4" })
|
|
759
759
|
}
|
|
760
760
|
) }),
|
|
761
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
762
|
-
!isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
761
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.DropdownMenuContent, { align: "end", children: [
|
|
762
|
+
!isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.DropdownMenuItem, { onClick: handleSetDefault, disabled: loading, children: "Set as Default" }),
|
|
763
763
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
764
|
-
|
|
764
|
+
_chunk5AKDE5UWjs.DropdownMenuItem,
|
|
765
765
|
{
|
|
766
766
|
onClick: () => setShowRemoveDialog(true),
|
|
767
767
|
disabled: loading,
|
|
@@ -772,7 +772,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
772
772
|
] })
|
|
773
773
|
] })
|
|
774
774
|
] }),
|
|
775
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
775
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-1", children: [
|
|
776
776
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-lg font-semibold", children: [
|
|
777
777
|
"\u2022\u2022\u2022\u2022 ",
|
|
778
778
|
last4
|
|
@@ -785,17 +785,17 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
785
785
|
] })
|
|
786
786
|
] }) })
|
|
787
787
|
] }),
|
|
788
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
789
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
790
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
791
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
788
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.AlertDialog, { open: showRemoveDialog, onOpenChange: setShowRemoveDialog, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.AlertDialogContent, { children: [
|
|
789
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.AlertDialogHeader, { children: [
|
|
790
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.AlertDialogTitle, { children: "Remove Payment Method" }),
|
|
791
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.AlertDialogDescription, { children: [
|
|
792
792
|
"Are you sure you want to remove this payment method? This action cannot be undone.",
|
|
793
793
|
isDefault && " This is your default payment method."
|
|
794
794
|
] })
|
|
795
795
|
] }),
|
|
796
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
797
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
798
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
796
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.AlertDialogFooter, { children: [
|
|
797
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.AlertDialogCancel, { disabled: loading, children: "Cancel" }),
|
|
798
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.AlertDialogAction, { onClick: handleRemove, disabled: loading, className: "bg-red-600 hover:bg-red-700", children: loading ? "Removing..." : "Remove" })
|
|
799
799
|
] })
|
|
800
800
|
] }) })
|
|
801
801
|
] });
|
|
@@ -818,7 +818,7 @@ function PaymentMethodsContainer() {
|
|
|
818
818
|
const loadPaymentMethods = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
819
819
|
setLoading(true);
|
|
820
820
|
try {
|
|
821
|
-
const fetchedPaymentMethods = await
|
|
821
|
+
const fetchedPaymentMethods = await _chunkYKFXQOQAjs.StripeCustomerService.listPaymentMethods();
|
|
822
822
|
setPaymentMethods(fetchedPaymentMethods);
|
|
823
823
|
} catch (error) {
|
|
824
824
|
console.error("[PaymentMethodsContainer] Failed to load payment methods:", error);
|
|
@@ -838,14 +838,14 @@ function PaymentMethodsContainer() {
|
|
|
838
838
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8" }),
|
|
839
839
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: "Payment Methods" })
|
|
840
840
|
] }),
|
|
841
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
841
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Button, { onClick: () => setShowAddPaymentMethod(true), children: "Add Payment Method" })
|
|
842
842
|
] }),
|
|
843
843
|
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: [
|
|
844
844
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-16 w-16 text-muted-foreground" }),
|
|
845
845
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
846
846
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "mb-2 text-sm font-medium", children: "No payment methods" }),
|
|
847
847
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mb-4 text-muted-foreground", children: "Add a payment method to enable subscriptions and secure checkout." }),
|
|
848
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
848
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Button, { onClick: () => setShowAddPaymentMethod(true), children: "Add Your First Card" })
|
|
849
849
|
] })
|
|
850
850
|
] }),
|
|
851
851
|
paymentMethods.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodsList, { paymentMethods, onUpdate: loadPaymentMethods }),
|
|
@@ -913,7 +913,7 @@ var statusConfig = {
|
|
|
913
913
|
};
|
|
914
914
|
function InvoiceStatusBadge({ status }) {
|
|
915
915
|
const config = statusConfig[status] || statusConfig["draft" /* DRAFT */];
|
|
916
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
916
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Badge, { variant: config.variant, children: config.label });
|
|
917
917
|
}
|
|
918
918
|
_chunk7QVYU63Ejs.__name.call(void 0, InvoiceStatusBadge, "InvoiceStatusBadge");
|
|
919
919
|
|
|
@@ -944,13 +944,13 @@ function InvoiceDetails({
|
|
|
944
944
|
return invoice.stripeInvoiceId.slice(-8);
|
|
945
945
|
}, "getInvoiceNumber");
|
|
946
946
|
const productName = _optionalChain([invoice, 'access', _29 => _29.subscription, 'optionalAccess', _30 => _30.price, 'optionalAccess', _31 => _31.product, 'optionalAccess', _32 => _32.name]) || "Subscription";
|
|
947
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
948
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
949
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
947
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.DialogContent, { className: "max-w-2xl", children: [
|
|
948
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.DialogHeader, { children: [
|
|
949
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.DialogTitle, { children: [
|
|
950
950
|
"Invoice ",
|
|
951
951
|
getInvoiceNumber()
|
|
952
952
|
] }),
|
|
953
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
953
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.DialogDescription, { children: formatDate3(invoice.periodStart) })
|
|
954
954
|
] }),
|
|
955
955
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
956
956
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
@@ -988,42 +988,42 @@ function InvoiceDetails({
|
|
|
988
988
|
] }) }),
|
|
989
989
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "tbody", { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "tr", { className: "border-t", children: [
|
|
990
990
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "td", { className: "p-3", children: productName }),
|
|
991
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "td", { className: "p-3 text-right", children:
|
|
991
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "td", { className: "p-3 text-right", children: _chunk5AKDE5UWjs.formatCurrency.call(void 0, invoice.subtotal, invoice.currency) })
|
|
992
992
|
] }) })
|
|
993
993
|
] }) })
|
|
994
994
|
] }),
|
|
995
995
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2 border-t pt-4", children: [
|
|
996
996
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
997
997
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: "Subtotal:" }),
|
|
998
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children:
|
|
998
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children: _chunk5AKDE5UWjs.formatCurrency.call(void 0, invoice.subtotal, invoice.currency) })
|
|
999
999
|
] }),
|
|
1000
1000
|
invoice.tax !== void 0 && invoice.tax > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1001
1001
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: "Tax:" }),
|
|
1002
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children:
|
|
1002
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children: _chunk5AKDE5UWjs.formatCurrency.call(void 0, invoice.tax, invoice.currency) })
|
|
1003
1003
|
] }),
|
|
1004
1004
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between text-lg font-semibold border-t pt-2", children: [
|
|
1005
1005
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Total:" }),
|
|
1006
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children:
|
|
1006
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _chunk5AKDE5UWjs.formatCurrency.call(void 0, invoice.total, invoice.currency) })
|
|
1007
1007
|
] }),
|
|
1008
1008
|
invoice.amountPaid > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1009
1009
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: "Amount Paid:" }),
|
|
1010
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-success", children:
|
|
1010
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-success", children: _chunk5AKDE5UWjs.formatCurrency.call(void 0, invoice.amountPaid, invoice.currency) })
|
|
1011
1011
|
] }),
|
|
1012
1012
|
invoice.amountRemaining > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1013
1013
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: "Amount Due:" }),
|
|
1014
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-destructive", children:
|
|
1014
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-destructive", children: _chunk5AKDE5UWjs.formatCurrency.call(void 0, invoice.amountRemaining, invoice.currency) })
|
|
1015
1015
|
] })
|
|
1016
1016
|
] }),
|
|
1017
1017
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2 pt-4 border-t", children: [
|
|
1018
|
-
invoice.stripePdfUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1018
|
+
invoice.stripePdfUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.Button, { variant: "outline", onClick: handleDownloadPDF, children: [
|
|
1019
1019
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Download, { className: "mr-2 h-4 w-4" }),
|
|
1020
1020
|
"Download PDF"
|
|
1021
1021
|
] }),
|
|
1022
|
-
invoice.status === "open" /* OPEN */ && invoice.attempted && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1022
|
+
invoice.status === "open" /* OPEN */ && invoice.attempted && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.Button, { variant: "default", onClick: handleRetryPayment, children: [
|
|
1023
1023
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RefreshCw, { className: "mr-2 h-4 w-4" }),
|
|
1024
1024
|
"Retry Payment"
|
|
1025
1025
|
] }),
|
|
1026
|
-
invoice.stripeHostedInvoiceUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1026
|
+
invoice.stripeHostedInvoiceUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.Button, { variant: "outline", onClick: handleViewInStripe, children: [
|
|
1027
1027
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ExternalLink, { className: "mr-2 h-4 w-4" }),
|
|
1028
1028
|
"View in Stripe"
|
|
1029
1029
|
] })
|
|
@@ -1047,30 +1047,30 @@ function InvoicesList({ invoices, onInvoicesChange }) {
|
|
|
1047
1047
|
return invoice.stripeInvoiceId.slice(-8);
|
|
1048
1048
|
}, "getInvoiceNumber");
|
|
1049
1049
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1050
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1051
|
-
/* @__PURE__ */ _jsxruntime.jsx.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,
|
|
1050
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.Table, { children: [
|
|
1051
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.TableRow, { children: [
|
|
1052
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.TableHead, { children: "Invoice #" }),
|
|
1053
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.TableHead, { children: "Date" }),
|
|
1054
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.TableHead, { children: "Status" }),
|
|
1055
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.TableHead, { className: "text-right", children: "Amount" }),
|
|
1056
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.TableHead, { children: "Period" })
|
|
1057
1057
|
] }) }),
|
|
1058
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1058
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.TableBody, { children: invoices.map((invoice) => {
|
|
1059
1059
|
const invoiceNumber = getInvoiceNumber(invoice);
|
|
1060
1060
|
const date = formatDate3(invoice.periodStart);
|
|
1061
|
-
const amount =
|
|
1061
|
+
const amount = _chunk5AKDE5UWjs.formatCurrency.call(void 0, invoice.total, invoice.currency);
|
|
1062
1062
|
const period = `${formatDate3(invoice.periodStart)} - ${formatDate3(invoice.periodEnd)}`;
|
|
1063
1063
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1064
|
-
|
|
1064
|
+
_chunk5AKDE5UWjs.TableRow,
|
|
1065
1065
|
{
|
|
1066
1066
|
onClick: () => handleRowClick(invoice),
|
|
1067
1067
|
className: "cursor-pointer hover:bg-muted/50",
|
|
1068
1068
|
children: [
|
|
1069
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1070
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1071
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1072
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1073
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1069
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.TableCell, { className: "font-medium", children: invoiceNumber }),
|
|
1070
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.TableCell, { className: "text-muted-foreground text-xs", children: date }),
|
|
1071
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InvoiceStatusBadge, { status: invoice.status }) }),
|
|
1072
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.TableCell, { className: "text-right font-medium", children: amount }),
|
|
1073
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.TableCell, { className: "text-muted-foreground text-xs", children: period })
|
|
1074
1074
|
]
|
|
1075
1075
|
},
|
|
1076
1076
|
invoice.id
|
|
@@ -1103,7 +1103,7 @@ function InvoicesContainer() {
|
|
|
1103
1103
|
setLoading(true);
|
|
1104
1104
|
try {
|
|
1105
1105
|
const params = statusFilter !== "all" ? { status: statusFilter } : void 0;
|
|
1106
|
-
const data = await
|
|
1106
|
+
const data = await _chunkYKFXQOQAjs.StripeInvoiceService.listInvoices(params);
|
|
1107
1107
|
setInvoices(data);
|
|
1108
1108
|
} catch (error) {
|
|
1109
1109
|
console.error("[InvoicesContainer] Failed to load invoices:", error);
|
|
@@ -1119,12 +1119,12 @@ function InvoicesContainer() {
|
|
|
1119
1119
|
setStatusFilter(value);
|
|
1120
1120
|
}, "handleFilterChange");
|
|
1121
1121
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-4", children: [
|
|
1122
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
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,
|
|
1122
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Tabs, { value: statusFilter, onValueChange: handleFilterChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.TabsList, { children: [
|
|
1123
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.TabsTrigger, { value: "all", children: "All" }),
|
|
1124
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.TabsTrigger, { value: "paid" /* PAID */, children: "Paid" }),
|
|
1125
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.TabsTrigger, { value: "open" /* OPEN */, children: "Open" }),
|
|
1126
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.TabsTrigger, { value: "void" /* VOID */, children: "Void" }),
|
|
1127
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.TabsTrigger, { value: "uncollectible" /* UNCOLLECTIBLE */, children: "Uncollectible" })
|
|
1128
1128
|
] }) }),
|
|
1129
1129
|
loading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-center py-8 text-muted-foreground", children: "Loading invoices..." }),
|
|
1130
1130
|
!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: [
|
|
@@ -1171,7 +1171,7 @@ function CancelSubscriptionDialog({
|
|
|
1171
1171
|
const onSubmit = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async (_values) => {
|
|
1172
1172
|
setIsSubmitting(true);
|
|
1173
1173
|
try {
|
|
1174
|
-
await
|
|
1174
|
+
await _chunkYKFXQOQAjs.StripeSubscriptionService.cancelSubscription({
|
|
1175
1175
|
id: subscription.id,
|
|
1176
1176
|
cancelImmediately: false
|
|
1177
1177
|
});
|
|
@@ -1184,19 +1184,19 @@ function CancelSubscriptionDialog({
|
|
|
1184
1184
|
}
|
|
1185
1185
|
}, "onSubmit");
|
|
1186
1186
|
const periodEndDate = formatDate3(subscription.currentPeriodEnd);
|
|
1187
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1188
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1189
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1190
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1187
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.DialogContent, { className: "max-w-md", children: [
|
|
1188
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.DialogHeader, { children: [
|
|
1189
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.DialogTitle, { children: "Cancel Subscription" }),
|
|
1190
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.DialogDescription, { children: "Are you sure you want to cancel this subscription? This action cannot be undone." })
|
|
1191
1191
|
] }),
|
|
1192
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1192
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-col gap-y-4", children: [
|
|
1193
1193
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-primary/10 border-primary/30 text-foreground rounded-lg border p-3 text-sm", children: [
|
|
1194
1194
|
"Your subscription will remain active until ",
|
|
1195
1195
|
periodEndDate,
|
|
1196
1196
|
". You can continue using the service until then."
|
|
1197
1197
|
] }),
|
|
1198
1198
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1199
|
-
|
|
1199
|
+
_chunk5AKDE5UWjs.FormTextarea,
|
|
1200
1200
|
{
|
|
1201
1201
|
form,
|
|
1202
1202
|
id: "reason",
|
|
@@ -1206,8 +1206,8 @@ function CancelSubscriptionDialog({
|
|
|
1206
1206
|
}
|
|
1207
1207
|
),
|
|
1208
1208
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-x-2 justify-end pt-2", children: [
|
|
1209
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1210
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1209
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Button, { type: "button", variant: "outline", onClick: () => onOpenChange(false), disabled: isSubmitting, children: "Keep Subscription" }),
|
|
1210
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Button, { type: "submit", variant: "destructive", disabled: isSubmitting, children: isSubmitting ? "Canceling..." : "Confirm Cancellation" })
|
|
1211
1211
|
] })
|
|
1212
1212
|
] }) })
|
|
1213
1213
|
] }) });
|
|
@@ -1256,7 +1256,7 @@ var cancelingConfig = {
|
|
|
1256
1256
|
};
|
|
1257
1257
|
function SubscriptionStatusBadge({ status, cancelAtPeriodEnd }) {
|
|
1258
1258
|
const config = cancelAtPeriodEnd ? cancelingConfig : statusConfig2[status] || statusConfig2["canceled" /* CANCELED */];
|
|
1259
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1259
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Badge, { variant: config.variant, children: config.label });
|
|
1260
1260
|
}
|
|
1261
1261
|
_chunk7QVYU63Ejs.__name.call(void 0, SubscriptionStatusBadge, "SubscriptionStatusBadge");
|
|
1262
1262
|
|
|
@@ -1283,7 +1283,7 @@ function formatPlanName2(price) {
|
|
|
1283
1283
|
_chunk7QVYU63Ejs.__name.call(void 0, formatPlanName2, "formatPlanName");
|
|
1284
1284
|
function formatBillingAmount(price) {
|
|
1285
1285
|
if (!_optionalChain([price, 'optionalAccess', _37 => _37.unitAmount])) return "N/A";
|
|
1286
|
-
return
|
|
1286
|
+
return _chunk5AKDE5UWjs.formatCurrency.call(void 0, price.unitAmount, price.currency);
|
|
1287
1287
|
}
|
|
1288
1288
|
_chunk7QVYU63Ejs.__name.call(void 0, formatBillingAmount, "formatBillingAmount");
|
|
1289
1289
|
function SubscriptionDetails({
|
|
@@ -1298,7 +1298,7 @@ function SubscriptionDetails({
|
|
|
1298
1298
|
const handlePause = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1299
1299
|
setIsProcessing(true);
|
|
1300
1300
|
try {
|
|
1301
|
-
await
|
|
1301
|
+
await _chunkYKFXQOQAjs.StripeSubscriptionService.pauseSubscription({ subscriptionId: subscription.id });
|
|
1302
1302
|
onSubscriptionChange();
|
|
1303
1303
|
} catch (error) {
|
|
1304
1304
|
console.error("[SubscriptionDetails] Failed to pause subscription:", error);
|
|
@@ -1309,7 +1309,7 @@ function SubscriptionDetails({
|
|
|
1309
1309
|
const handleResume = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1310
1310
|
setIsProcessing(true);
|
|
1311
1311
|
try {
|
|
1312
|
-
await
|
|
1312
|
+
await _chunkYKFXQOQAjs.StripeSubscriptionService.resumeSubscription({ subscriptionId: subscription.id });
|
|
1313
1313
|
onSubscriptionChange();
|
|
1314
1314
|
} catch (error) {
|
|
1315
1315
|
console.error("[SubscriptionDetails] Failed to resume subscription:", error);
|
|
@@ -1319,7 +1319,7 @@ function SubscriptionDetails({
|
|
|
1319
1319
|
}, "handleResume");
|
|
1320
1320
|
const handleManageViaPortal = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1321
1321
|
try {
|
|
1322
|
-
const { url } = await
|
|
1322
|
+
const { url } = await _chunkYKFXQOQAjs.StripeCustomerService.createPortalSession();
|
|
1323
1323
|
window.open(url, "_blank");
|
|
1324
1324
|
} catch (error) {
|
|
1325
1325
|
console.error("[SubscriptionDetails] Failed to create portal session:", error);
|
|
@@ -1329,10 +1329,10 @@ function SubscriptionDetails({
|
|
|
1329
1329
|
const canResume = subscription.status === "paused" /* PAUSED */;
|
|
1330
1330
|
const canCancel = subscription.status === "active" /* ACTIVE */ || subscription.status === "trialing" /* TRIALING */ || subscription.status === "paused" /* PAUSED */;
|
|
1331
1331
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1332
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1333
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1334
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1335
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1332
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.DialogContent, { className: "max-w-2xl", children: [
|
|
1333
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.DialogHeader, { children: [
|
|
1334
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.DialogTitle, { children: "Subscription Details" }),
|
|
1335
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.DialogDescription, { children: "View and manage your subscription" })
|
|
1336
1336
|
] }),
|
|
1337
1337
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
1338
1338
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
@@ -1374,11 +1374,11 @@ function SubscriptionDetails({
|
|
|
1374
1374
|
"."
|
|
1375
1375
|
] }) }),
|
|
1376
1376
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2 pt-4 border-t", children: [
|
|
1377
|
-
onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1378
|
-
canPause && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1379
|
-
canResume && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1380
|
-
canCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1381
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1377
|
+
onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Button, { variant: "default", onClick: () => onChangePlan(subscription), children: "Change Plan" }),
|
|
1378
|
+
canPause && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Button, { variant: "outline", onClick: handlePause, disabled: isProcessing, children: isProcessing ? "Pausing..." : "Pause" }),
|
|
1379
|
+
canResume && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Button, { variant: "outline", onClick: handleResume, disabled: isProcessing, children: isProcessing ? "Resuming..." : "Resume" }),
|
|
1380
|
+
canCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Button, { variant: "destructive", onClick: () => setShowCancel(true), children: "Cancel" }),
|
|
1381
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Button, { variant: "outline", onClick: handleManageViaPortal, children: "Manage via Portal" })
|
|
1382
1382
|
] })
|
|
1383
1383
|
] })
|
|
1384
1384
|
] }) }),
|
|
@@ -1425,36 +1425,36 @@ function SubscriptionsList({ subscriptions, onSubscriptionsChange, onChangePlan
|
|
|
1425
1425
|
setSelectedSub(subscription);
|
|
1426
1426
|
}, "handleRowClick");
|
|
1427
1427
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1428
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1429
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1430
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1431
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1432
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1433
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1434
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1428
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.Table, { children: [
|
|
1429
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.TableRow, { children: [
|
|
1430
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.TableHead, { children: "Status" }),
|
|
1431
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.TableHead, { children: "Plan" }),
|
|
1432
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.TableHead, { children: "Period" }),
|
|
1433
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.TableHead, { className: "text-right", children: "Amount" }),
|
|
1434
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.TableHead, { className: "text-right", children: "Actions" })
|
|
1435
1435
|
] }) }),
|
|
1436
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1436
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.TableBody, { children: subscriptions.map((subscription) => {
|
|
1437
1437
|
const price = subscription.price;
|
|
1438
|
-
const amount = _optionalChain([price, 'optionalAccess', _42 => _42.unitAmount]) ?
|
|
1438
|
+
const amount = _optionalChain([price, 'optionalAccess', _42 => _42.unitAmount]) ? _chunk5AKDE5UWjs.formatCurrency.call(void 0, price.unitAmount, price.currency) : "0";
|
|
1439
1439
|
const period = `${formatDate3(subscription.currentPeriodStart)} - ${formatDate3(subscription.currentPeriodEnd)}`;
|
|
1440
1440
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1441
|
-
|
|
1441
|
+
_chunk5AKDE5UWjs.TableRow,
|
|
1442
1442
|
{
|
|
1443
1443
|
onClick: () => handleRowClick(subscription),
|
|
1444
1444
|
className: "cursor-pointer hover:bg-muted/50",
|
|
1445
1445
|
children: [
|
|
1446
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1446
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1447
1447
|
SubscriptionStatusBadge,
|
|
1448
1448
|
{
|
|
1449
1449
|
status: subscription.status,
|
|
1450
1450
|
cancelAtPeriodEnd: subscription.cancelAtPeriodEnd
|
|
1451
1451
|
}
|
|
1452
1452
|
) }),
|
|
1453
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1454
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1455
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1456
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1457
|
-
|
|
1453
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.TableCell, { className: "font-medium", children: formatPlanName3(price) }),
|
|
1454
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.TableCell, { className: "text-muted-foreground text-sm", children: period }),
|
|
1455
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.TableCell, { className: "text-right font-medium", children: amount }),
|
|
1456
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.TableCell, { className: "text-right", children: (subscription.status === "active" /* ACTIVE */ || subscription.status === "trialing" /* TRIALING */) && onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1457
|
+
_chunk5AKDE5UWjs.Button,
|
|
1458
1458
|
{
|
|
1459
1459
|
size: "sm",
|
|
1460
1460
|
variant: "outline",
|
|
@@ -1499,7 +1499,7 @@ function SubscriptionsContainer({ onOpenWizard, hasActiveRecurringSubscription }
|
|
|
1499
1499
|
const loadSubscriptions = _react.useCallback.call(void 0, async () => {
|
|
1500
1500
|
setLoading(true);
|
|
1501
1501
|
try {
|
|
1502
|
-
const fetchedSubscriptions = await
|
|
1502
|
+
const fetchedSubscriptions = await _chunkYKFXQOQAjs.StripeSubscriptionService.listSubscriptions();
|
|
1503
1503
|
setSubscriptions(fetchedSubscriptions);
|
|
1504
1504
|
} catch (error) {
|
|
1505
1505
|
console.error("[SubscriptionsContainer] Failed to load subscriptions:", error);
|
|
@@ -1522,7 +1522,7 @@ function SubscriptionsContainer({ onOpenWizard, hasActiveRecurringSubscription }
|
|
|
1522
1522
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8" }),
|
|
1523
1523
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: "Subscriptions" })
|
|
1524
1524
|
] }),
|
|
1525
|
-
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1525
|
+
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _43 => _43()]), children: hasActiveRecurringSubscription ? "Purchase Add-ons" : "Subscribe to a Plan" })
|
|
1526
1526
|
] }),
|
|
1527
1527
|
criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BillingAlertBanner, { subscription }, subscription.id)),
|
|
1528
1528
|
subscriptions.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col items-center justify-center py-12 space-y-4", children: [
|
|
@@ -1530,7 +1530,7 @@ function SubscriptionsContainer({ onOpenWizard, hasActiveRecurringSubscription }
|
|
|
1530
1530
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
1531
1531
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium mb-2", children: "No Active Subscriptions" }),
|
|
1532
1532
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground mb-6", children: "Choose a subscription plan to get started with our services." }),
|
|
1533
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1533
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _44 => _44()]), children: "Subscribe to a Plan" })
|
|
1534
1534
|
] })
|
|
1535
1535
|
] }),
|
|
1536
1536
|
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -1551,9 +1551,9 @@ function IntervalToggle({ value, onChange, hasMonthly, hasYearly }) {
|
|
|
1551
1551
|
if (!hasMonthly || !hasYearly) {
|
|
1552
1552
|
return null;
|
|
1553
1553
|
}
|
|
1554
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1555
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1556
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1554
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Tabs, { value, onValueChange: (v) => onChange(v), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.TabsList, { children: [
|
|
1555
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.TabsTrigger, { value: "month", children: "Monthly" }),
|
|
1556
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.TabsTrigger, { value: "year", children: "Yearly" })
|
|
1557
1557
|
] }) });
|
|
1558
1558
|
}
|
|
1559
1559
|
_chunk7QVYU63Ejs.__name.call(void 0, IntervalToggle, "IntervalToggle");
|
|
@@ -1571,8 +1571,8 @@ function PricingCard({
|
|
|
1571
1571
|
}) {
|
|
1572
1572
|
const description = price.description || price.nickname || "Standard";
|
|
1573
1573
|
const features = price.features || [];
|
|
1574
|
-
const formattedPrice =
|
|
1575
|
-
const interval =
|
|
1574
|
+
const formattedPrice = _chunk5AKDE5UWjs.formatCurrency.call(void 0, price.unitAmount, price.currency);
|
|
1575
|
+
const interval = _chunk5AKDE5UWjs.formatInterval.call(void 0, price);
|
|
1576
1576
|
const handleKeyDown = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (e) => {
|
|
1577
1577
|
if ((e.key === "Enter" || e.key === " ") && !isDisabled && !isCurrentPlan) {
|
|
1578
1578
|
e.preventDefault();
|
|
@@ -1585,7 +1585,7 @@ function PricingCard({
|
|
|
1585
1585
|
}
|
|
1586
1586
|
}, "handleClick");
|
|
1587
1587
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1588
|
-
|
|
1588
|
+
_chunk5AKDE5UWjs.Card,
|
|
1589
1589
|
{
|
|
1590
1590
|
role: "radio",
|
|
1591
1591
|
"aria-checked": isSelected,
|
|
@@ -1593,7 +1593,7 @@ function PricingCard({
|
|
|
1593
1593
|
tabIndex: isDisabled ? -1 : 0,
|
|
1594
1594
|
onKeyDown: handleKeyDown,
|
|
1595
1595
|
onClick: handleClick,
|
|
1596
|
-
className:
|
|
1596
|
+
className: _chunkYKFXQOQAjs.cn.call(void 0,
|
|
1597
1597
|
"relative cursor-pointer transition-all duration-200 flex flex-col h-full",
|
|
1598
1598
|
"focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
1599
1599
|
isCurrentPlan && "bg-muted/30",
|
|
@@ -1603,9 +1603,9 @@ function PricingCard({
|
|
|
1603
1603
|
isLoading && "pointer-events-none"
|
|
1604
1604
|
),
|
|
1605
1605
|
children: [
|
|
1606
|
-
isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1607
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1608
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1606
|
+
isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Badge, { variant: "secondary", className: "absolute top-2 right-2", children: "Current" }),
|
|
1607
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.CardHeader, { className: "pb-2", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium", children: description }) }),
|
|
1608
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.CardContent, { className: "pb-4 grow", children: [
|
|
1609
1609
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mb-4", children: [
|
|
1610
1610
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-3xl font-bold", children: formattedPrice }),
|
|
1611
1611
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground ml-1", children: interval })
|
|
@@ -1615,8 +1615,8 @@ function PricingCard({
|
|
|
1615
1615
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-muted-foreground", children: feature })
|
|
1616
1616
|
] }, index)) })
|
|
1617
1617
|
] }),
|
|
1618
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1619
|
-
|
|
1618
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.CardFooter, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1619
|
+
_chunk5AKDE5UWjs.Button,
|
|
1620
1620
|
{
|
|
1621
1621
|
variant: isCurrentPlan ? "secondary" : isSelected ? "default" : "outline",
|
|
1622
1622
|
className: "w-full",
|
|
@@ -1644,7 +1644,7 @@ function ProductPricingRow({
|
|
|
1644
1644
|
return null;
|
|
1645
1645
|
}
|
|
1646
1646
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-3", children: [
|
|
1647
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1647
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.SectionHeader, { children: product.name }),
|
|
1648
1648
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1649
1649
|
"div",
|
|
1650
1650
|
{
|
|
@@ -1744,15 +1744,15 @@ function ProductPricingList({
|
|
|
1744
1744
|
_chunk7QVYU63Ejs.__name.call(void 0, ProductPricingList, "ProductPricingList");
|
|
1745
1745
|
function ProductPricingListSkeleton() {
|
|
1746
1746
|
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: [
|
|
1747
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1747
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Skeleton, { className: "h-6 w-32" }),
|
|
1748
1748
|
/* @__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: [
|
|
1749
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1750
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1749
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Skeleton, { className: "h-6 w-24" }),
|
|
1750
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Skeleton, { className: "h-8 w-32" }),
|
|
1751
1751
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
1752
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1753
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1752
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Skeleton, { className: "h-4 w-full" }),
|
|
1753
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Skeleton, { className: "h-4 w-3/4" })
|
|
1754
1754
|
] }),
|
|
1755
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1755
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Skeleton, { className: "h-10 w-full" })
|
|
1756
1756
|
] }, cardIndex)) })
|
|
1757
1757
|
] }, rowIndex)) });
|
|
1758
1758
|
}
|
|
@@ -1766,18 +1766,18 @@ function ProrationPreview({ preview }) {
|
|
|
1766
1766
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
1767
1767
|
preview.lineItems.map((item, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between text-sm", children: [
|
|
1768
1768
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground", children: item.description }),
|
|
1769
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `font-medium ${item.amount < 0 ? "text-success" : "text-foreground"}`, children:
|
|
1769
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `font-medium ${item.amount < 0 ? "text-success" : "text-foreground"}`, children: _chunk5AKDE5UWjs.formatCurrency.call(void 0, item.amount, preview.currency) })
|
|
1770
1770
|
] }, index)),
|
|
1771
1771
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border-primary/30 mt-2 border-t pt-2", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between font-semibold", children: [
|
|
1772
1772
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-foreground", children: "Net Due Today" }),
|
|
1773
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-foreground", children:
|
|
1773
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-foreground", children: _chunk5AKDE5UWjs.formatCurrency.call(void 0, preview.immediateCharge, preview.currency) })
|
|
1774
1774
|
] }) }),
|
|
1775
1775
|
preview.lineItems.length > 0 && preview.lineItems[0].period && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-muted-foreground mt-2 text-xs", children: [
|
|
1776
1776
|
"Next invoice on ",
|
|
1777
1777
|
formatDate3(preview.lineItems[0].period.end),
|
|
1778
1778
|
" for",
|
|
1779
1779
|
" ",
|
|
1780
|
-
|
|
1780
|
+
_chunk5AKDE5UWjs.formatCurrency.call(void 0, preview.amountDue, preview.currency)
|
|
1781
1781
|
] })
|
|
1782
1782
|
] })
|
|
1783
1783
|
] });
|
|
@@ -1799,16 +1799,16 @@ function SubscriptionConfirmation({ price, isLoading, onConfirm, onCancel }) {
|
|
|
1799
1799
|
productDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-sm text-muted-foreground", children: productDescription })
|
|
1800
1800
|
] }),
|
|
1801
1801
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-lg font-semibold", children: [
|
|
1802
|
-
|
|
1803
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-normal text-muted-foreground", children:
|
|
1802
|
+
_chunk5AKDE5UWjs.formatCurrency.call(void 0, price.unitAmount, price.currency),
|
|
1803
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-normal text-muted-foreground", children: _chunk5AKDE5UWjs.formatInterval.call(void 0, price) })
|
|
1804
1804
|
] }),
|
|
1805
1805
|
features.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "space-y-1", children: features.map((feature, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2 text-sm ", children: [
|
|
1806
1806
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Check, { className: "h-4 w-4 text-primary" }),
|
|
1807
1807
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: feature })
|
|
1808
1808
|
] }, index)) }),
|
|
1809
1809
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-3 pt-2 border-t border-accent/30", children: [
|
|
1810
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1811
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1810
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Button, { variant: "outline", onClick: onCancel, disabled: isLoading, children: "Cancel" }),
|
|
1811
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Button, { onClick: onConfirm, disabled: isLoading, children: isLoading ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1812
1812
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "h-4 w-4 animate-spin mr-2" }),
|
|
1813
1813
|
"Processing..."
|
|
1814
1814
|
] }) : "Subscribe" })
|
|
@@ -1879,7 +1879,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
1879
1879
|
onCloseRef.current = onClose;
|
|
1880
1880
|
const checkPaymentMethod = _react.useCallback.call(void 0, async () => {
|
|
1881
1881
|
try {
|
|
1882
|
-
const methods = await
|
|
1882
|
+
const methods = await _chunkYKFXQOQAjs.StripeCustomerService.listPaymentMethods();
|
|
1883
1883
|
dispatch({ type: "SET_HAS_PAYMENT_METHOD", hasMethod: methods.length > 0 });
|
|
1884
1884
|
} catch (error) {
|
|
1885
1885
|
console.error("[useSubscriptionWizard] Failed to check payment methods:", error);
|
|
@@ -1903,7 +1903,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
1903
1903
|
const isTrialUpgrade = _optionalChain([subscription, 'optionalAccess', _55 => _55.status]) === "trialing" /* TRIALING */;
|
|
1904
1904
|
dispatch({ type: "SET_IS_TRIAL_SUBSCRIPTION", isTrial: isTrialUpgrade });
|
|
1905
1905
|
if (isTrialUpgrade && !state.hasPaymentMethod) {
|
|
1906
|
-
const methods = await
|
|
1906
|
+
const methods = await _chunkYKFXQOQAjs.StripeCustomerService.listPaymentMethods();
|
|
1907
1907
|
if (methods.length === 0) {
|
|
1908
1908
|
dispatch({ type: "SET_STEP", step: "payment-method" });
|
|
1909
1909
|
dispatch({
|
|
@@ -1914,7 +1914,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
1914
1914
|
}
|
|
1915
1915
|
}
|
|
1916
1916
|
if (subscription && state.selectedPrice.id !== _optionalChain([subscription, 'access', _56 => _56.price, 'optionalAccess', _57 => _57.id])) {
|
|
1917
|
-
const preview = await
|
|
1917
|
+
const preview = await _chunkYKFXQOQAjs.StripeSubscriptionService.getProrationPreview({
|
|
1918
1918
|
subscriptionId: subscription.id,
|
|
1919
1919
|
newPriceId: state.selectedPrice.id
|
|
1920
1920
|
});
|
|
@@ -1939,14 +1939,14 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
1939
1939
|
newPriceId: state.selectedPrice.id,
|
|
1940
1940
|
promotionCode: _optionalChain([state, 'access', _59 => _59.promotionCode, 'optionalAccess', _60 => _60.promotionCodeId])
|
|
1941
1941
|
};
|
|
1942
|
-
await
|
|
1942
|
+
await _chunkYKFXQOQAjs.StripeSubscriptionService.changePlan(changePlanParams);
|
|
1943
1943
|
} else {
|
|
1944
1944
|
const createParams = {
|
|
1945
1945
|
id: _uuid.v4.call(void 0, ),
|
|
1946
1946
|
priceId: state.selectedPrice.id,
|
|
1947
1947
|
promotionCode: _optionalChain([state, 'access', _61 => _61.promotionCode, 'optionalAccess', _62 => _62.promotionCodeId])
|
|
1948
1948
|
};
|
|
1949
|
-
await
|
|
1949
|
+
await _chunkYKFXQOQAjs.StripeSubscriptionService.createSubscription(createParams);
|
|
1950
1950
|
}
|
|
1951
1951
|
onSuccessRef.current();
|
|
1952
1952
|
onCloseRef.current();
|
|
@@ -1980,7 +1980,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
1980
1980
|
dispatch({ type: "SET_VALIDATING_PROMO_CODE", isValidating: true });
|
|
1981
1981
|
dispatch({ type: "SET_PROMO_CODE_ERROR", error: null });
|
|
1982
1982
|
try {
|
|
1983
|
-
const result = await
|
|
1983
|
+
const result = await _chunkYKFXQOQAjs.StripePromotionCodeService.validatePromotionCode({
|
|
1984
1984
|
code,
|
|
1985
1985
|
stripePriceId: _optionalChain([state, 'access', _70 => _70.selectedPrice, 'optionalAccess', _71 => _71.id])
|
|
1986
1986
|
});
|
|
@@ -2087,7 +2087,7 @@ function WizardStepPlanSelection({
|
|
|
2087
2087
|
_react.useEffect.call(void 0, () => {
|
|
2088
2088
|
const loadProducts = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2089
2089
|
try {
|
|
2090
|
-
const fetchedProducts = await
|
|
2090
|
+
const fetchedProducts = await _chunkYKFXQOQAjs.StripeProductService.listProducts({ active: true });
|
|
2091
2091
|
setProducts(fetchedProducts);
|
|
2092
2092
|
} catch (error) {
|
|
2093
2093
|
console.error("[WizardStepPlanSelection] Failed to load products:", error);
|
|
@@ -2138,7 +2138,7 @@ function WizardStepPlanSelection({
|
|
|
2138
2138
|
onSelectPrice: handleSelectPrice
|
|
2139
2139
|
}
|
|
2140
2140
|
),
|
|
2141
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex justify-end pt-4 border-t", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2141
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex justify-end pt-4 border-t", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Button, { onClick: onNext, disabled: !selectedPrice || isProcessing, children: isProcessing ? "Loading..." : "Next: Review" }) })
|
|
2142
2142
|
] });
|
|
2143
2143
|
}
|
|
2144
2144
|
_chunk7QVYU63Ejs.__name.call(void 0, WizardStepPlanSelection, "WizardStepPlanSelection");
|
|
@@ -2199,7 +2199,7 @@ function PromoCodeInput({
|
|
|
2199
2199
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success text-sm", children: formatDiscount(appliedCode) })
|
|
2200
2200
|
] }),
|
|
2201
2201
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2202
|
-
|
|
2202
|
+
_chunk5AKDE5UWjs.Button,
|
|
2203
2203
|
{
|
|
2204
2204
|
variant: "ghost",
|
|
2205
2205
|
size: "sm",
|
|
@@ -2216,7 +2216,7 @@ function PromoCodeInput({
|
|
|
2216
2216
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
2217
2217
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
|
|
2218
2218
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2219
|
-
|
|
2219
|
+
_chunk5AKDE5UWjs.Input,
|
|
2220
2220
|
{
|
|
2221
2221
|
placeholder: "Enter promo code",
|
|
2222
2222
|
value: code,
|
|
@@ -2226,7 +2226,7 @@ function PromoCodeInput({
|
|
|
2226
2226
|
className: "flex-1"
|
|
2227
2227
|
}
|
|
2228
2228
|
),
|
|
2229
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2229
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Button, { variant: "outline", onClick: handleApply, disabled: disabled || isValidating || !code.trim(), children: isValidating ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "h-4 w-4 animate-spin" }) : "Apply" })
|
|
2230
2230
|
] }),
|
|
2231
2231
|
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error })
|
|
2232
2232
|
] });
|
|
@@ -2291,14 +2291,14 @@ function WizardStepReview({
|
|
|
2291
2291
|
return `${promotionCode.discountValue}% off`;
|
|
2292
2292
|
}
|
|
2293
2293
|
if (promotionCode.discountType === "amount_off" && promotionCode.discountValue) {
|
|
2294
|
-
return `${
|
|
2294
|
+
return `${_chunk5AKDE5UWjs.formatCurrency.call(void 0, promotionCode.discountValue, promotionCode.currency || selectedPrice.currency)} off`;
|
|
2295
2295
|
}
|
|
2296
2296
|
return null;
|
|
2297
2297
|
}, "getDiscountDescription");
|
|
2298
2298
|
const discountDescription = getDiscountDescription();
|
|
2299
2299
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
2300
2300
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-muted/50 rounded-lg p-4 space-y-3", children: [
|
|
2301
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2301
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.SectionHeader, { children: "Selected Plan" }),
|
|
2302
2302
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between items-center", children: [
|
|
2303
2303
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
2304
2304
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-medium", children: _optionalChain([selectedPrice, 'access', _92 => _92.product, 'optionalAccess', _93 => _93.name]) }),
|
|
@@ -2306,10 +2306,10 @@ function WizardStepReview({
|
|
|
2306
2306
|
] }),
|
|
2307
2307
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-right", children: [
|
|
2308
2308
|
discountedPrice !== null ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2309
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground line-through", children:
|
|
2310
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-success text-lg font-semibold", children:
|
|
2311
|
-
discountDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2312
|
-
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-semibold text-lg", children:
|
|
2309
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground line-through", children: _chunk5AKDE5UWjs.formatCurrency.call(void 0, selectedPrice.unitAmount || 0, selectedPrice.currency) }),
|
|
2310
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-success text-lg font-semibold", children: _chunk5AKDE5UWjs.formatCurrency.call(void 0, discountedPrice, selectedPrice.currency) }),
|
|
2311
|
+
discountDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Badge, { variant: "softGreen", children: discountDescription })
|
|
2312
|
+
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-semibold text-lg", children: _chunk5AKDE5UWjs.formatCurrency.call(void 0, selectedPrice.unitAmount || 0, selectedPrice.currency) }),
|
|
2313
2313
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: formatInterval2(selectedPrice) })
|
|
2314
2314
|
] })
|
|
2315
2315
|
] })
|
|
@@ -2324,9 +2324,9 @@ function WizardStepReview({
|
|
|
2324
2324
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between text-sm", children: [
|
|
2325
2325
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `${isTrialUpgrade ? "text-warning" : "text-muted-foreground"}`, children: isTrialUpgrade ? "Amount to charge now:" : "Amount due now:" }),
|
|
2326
2326
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `font-medium ${isTrialUpgrade ? "text-warning" : "text-foreground"}`, children: discountedImmediateCharge !== null ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2327
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "line-through text-muted-foreground mr-2", children:
|
|
2328
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success", children:
|
|
2329
|
-
] }) :
|
|
2327
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "line-through text-muted-foreground mr-2", children: _chunk5AKDE5UWjs.formatCurrency.call(void 0, prorationPreview.immediateCharge, prorationPreview.currency) }),
|
|
2328
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success", children: _chunk5AKDE5UWjs.formatCurrency.call(void 0, discountedImmediateCharge, prorationPreview.currency) })
|
|
2329
|
+
] }) : _chunk5AKDE5UWjs.formatCurrency.call(void 0, prorationPreview.immediateCharge, prorationPreview.currency) })
|
|
2330
2330
|
] })
|
|
2331
2331
|
]
|
|
2332
2332
|
}
|
|
@@ -2350,15 +2350,15 @@ function WizardStepReview({
|
|
|
2350
2350
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "font-medium", children: "Payment Method" }),
|
|
2351
2351
|
/* @__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" })
|
|
2352
2352
|
] }),
|
|
2353
|
-
!hasPaymentMethod && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2353
|
+
!hasPaymentMethod && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Button, { variant: "outline", onClick: onAddPaymentMethod, children: "Add Payment Method" })
|
|
2354
2354
|
] }) }),
|
|
2355
|
-
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2355
|
+
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.Alert, { variant: "destructive", children: [
|
|
2356
2356
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.AlertCircle, { className: "h-4 w-4" }),
|
|
2357
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2357
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.AlertDescription, { children: error })
|
|
2358
2358
|
] }),
|
|
2359
2359
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between pt-4 border-t", children: [
|
|
2360
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2361
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2360
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Button, { variant: "outline", onClick: onBack, disabled: isProcessing, children: "Back" }),
|
|
2361
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Button, { onClick: hasPaymentMethod ? onConfirm : onAddPaymentMethod, disabled: isProcessing, children: isProcessing ? "Processing..." : hasPaymentMethod ? isChangingPlan ? "Confirm Plan Change" : "Subscribe Now" : "Add Payment Method" })
|
|
2362
2362
|
] })
|
|
2363
2363
|
] });
|
|
2364
2364
|
}
|
|
@@ -2369,7 +2369,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, WizardStepReview, "WizardStepReview");
|
|
|
2369
2369
|
function WizardStepPaymentMethod({ onBack, onSuccess, isProcessing }) {
|
|
2370
2370
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
2371
2371
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
2372
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2372
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.SectionHeader, { children: "Add Payment Method" }),
|
|
2373
2373
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: "Enter your card details to complete your subscription" })
|
|
2374
2374
|
] }),
|
|
2375
2375
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodForm, { onSuccess, onCancel: onBack, isLoading: isProcessing })
|
|
@@ -2411,10 +2411,10 @@ function SubscriptionWizard({
|
|
|
2411
2411
|
const isChangePlanMode = !!subscription;
|
|
2412
2412
|
const dialogTitle = subscription ? "Change Subscription Plan" : isPurchasingAddons ? "Purchase Add-ons" : "Subscribe to a Plan";
|
|
2413
2413
|
const dialogDescription = subscription ? "Select a new plan for your subscription" : isPurchasingAddons ? "Select one-time products to purchase" : "Choose a subscription plan to get started";
|
|
2414
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2415
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2416
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2417
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2414
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.DialogContent, { className: "max-w-2xl", children: [
|
|
2415
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.DialogHeader, { children: [
|
|
2416
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.DialogTitle, { children: dialogTitle }),
|
|
2417
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.DialogDescription, { children: dialogDescription })
|
|
2418
2418
|
] }),
|
|
2419
2419
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, WizardProgressIndicator, { currentStep: state.step }),
|
|
2420
2420
|
state.step === "plan-selection" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -2497,15 +2497,15 @@ function UsageSummaryCard({ meter, summary }) {
|
|
|
2497
2497
|
const progressWidth = percentage !== null ? Math.min(percentage, 100) : 0;
|
|
2498
2498
|
const displayName = meter.displayName || meter.eventName;
|
|
2499
2499
|
const hasLimit = limit !== null && limit !== void 0;
|
|
2500
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2501
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2500
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.Card, { children: [
|
|
2501
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.CardHeader, { className: "flex flex-row items-center gap-x-3 pb-3", children: [
|
|
2502
2502
|
/* @__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" }) }),
|
|
2503
2503
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col", children: [
|
|
2504
2504
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium", children: displayName }),
|
|
2505
2505
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-xs", children: meter.id })
|
|
2506
2506
|
] })
|
|
2507
2507
|
] }),
|
|
2508
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2508
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.CardContent, { className: "flex flex-col gap-y-4", children: [
|
|
2509
2509
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
2510
2510
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-3xl font-bold", children: currentUsage.toLocaleString() }),
|
|
2511
2511
|
hasLimit && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-muted-foreground text-sm", children: [
|
|
@@ -2552,14 +2552,14 @@ function UsageContainer() {
|
|
|
2552
2552
|
const loadUsageData = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2553
2553
|
setLoading(true);
|
|
2554
2554
|
try {
|
|
2555
|
-
const fetchedSubscriptions = await
|
|
2555
|
+
const fetchedSubscriptions = await _chunkYKFXQOQAjs.StripeSubscriptionService.listSubscriptions();
|
|
2556
2556
|
setSubscriptions(fetchedSubscriptions);
|
|
2557
2557
|
const hasMeteredSubscriptions2 = fetchedSubscriptions.some((sub) => _optionalChain([sub, 'access', _99 => _99.price, 'optionalAccess', _100 => _100.recurring, 'optionalAccess', _101 => _101.usageType]) === "metered");
|
|
2558
2558
|
if (!hasMeteredSubscriptions2) {
|
|
2559
2559
|
setLoading(false);
|
|
2560
2560
|
return;
|
|
2561
2561
|
}
|
|
2562
|
-
const fetchedMeters = await
|
|
2562
|
+
const fetchedMeters = await _chunkYKFXQOQAjs.StripeUsageService.listMeters();
|
|
2563
2563
|
setMeters(fetchedMeters);
|
|
2564
2564
|
const summariesMap = {};
|
|
2565
2565
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -2567,7 +2567,7 @@ function UsageContainer() {
|
|
|
2567
2567
|
const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
|
|
2568
2568
|
for (const meter of fetchedMeters) {
|
|
2569
2569
|
try {
|
|
2570
|
-
const meterSummaries = await
|
|
2570
|
+
const meterSummaries = await _chunkYKFXQOQAjs.StripeUsageService.getMeterSummaries({
|
|
2571
2571
|
meterId: meter.id,
|
|
2572
2572
|
startTime: startOfMonth,
|
|
2573
2573
|
endTime: endOfMonth
|
|
@@ -2632,22 +2632,22 @@ function UsageHistoryTable({ usageRecords }) {
|
|
|
2632
2632
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rounded-lg border p-8 text-center", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground", children: "No usage history available." }) });
|
|
2633
2633
|
}
|
|
2634
2634
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
2635
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2636
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-clip rounded-lg border", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2637
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2638
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2639
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2640
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2641
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2635
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.SectionHeader, { level: 2, children: "Usage History" }),
|
|
2636
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-clip rounded-lg border", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.Table, { children: [
|
|
2637
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.TableRow, { children: [
|
|
2638
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.TableHead, { children: "Date & Time" }),
|
|
2639
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.TableHead, { children: "Meter Event" }),
|
|
2640
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.TableHead, { className: "text-right", children: "Quantity" }),
|
|
2641
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.TableHead, { children: "Event ID" })
|
|
2642
2642
|
] }) }),
|
|
2643
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2643
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.TableBody, { children: usageRecords.map((record) => {
|
|
2644
2644
|
const dateTime = formatDateTime(record.timestamp);
|
|
2645
2645
|
const quantity = record.quantity.toLocaleString();
|
|
2646
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2647
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2648
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2649
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2650
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2646
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.TableRow, { children: [
|
|
2647
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.TableCell, { className: "font-medium", children: dateTime }),
|
|
2648
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.TableCell, { className: "text-muted-foreground", children: record.meterEventName }),
|
|
2649
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.TableCell, { className: "text-right font-medium", children: quantity }),
|
|
2650
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.TableCell, { className: "text-muted-foreground text-sm tabular-nums", children: record.stripeEventId })
|
|
2651
2651
|
] }, record.id);
|
|
2652
2652
|
}) })
|
|
2653
2653
|
] }) })
|
|
@@ -2658,8 +2658,8 @@ _chunk7QVYU63Ejs.__name.call(void 0, UsageHistoryTable, "UsageHistoryTable");
|
|
|
2658
2658
|
// src/features/billing/components/modals/BillingDetailModal.tsx
|
|
2659
2659
|
|
|
2660
2660
|
function BillingDetailModal({ open, onOpenChange, title, children, className }) {
|
|
2661
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2662
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2661
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.DialogContent, { className: _nullishCoalesce(className, () => ( "max-w-4xl max-h-[90vh] overflow-y-auto")), children: [
|
|
2662
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.DialogHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.DialogTitle, { children: title }) }),
|
|
2663
2663
|
children
|
|
2664
2664
|
] }) });
|
|
2665
2665
|
}
|
|
@@ -2676,7 +2676,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
|
|
|
2676
2676
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-destructive text-sm font-medium", children: "Payment Failed" }),
|
|
2677
2677
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive mt-1 text-sm", children: "Your last payment failed. Please update your payment method to avoid service interruption." })
|
|
2678
2678
|
] }),
|
|
2679
|
-
onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2679
|
+
onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Button, { variant: "outline", size: "sm", onClick: onUpdatePayment, className: "text-destructive border-red-300", children: "Update Payment Method" })
|
|
2680
2680
|
] });
|
|
2681
2681
|
}
|
|
2682
2682
|
if (subscription.status === "trialing" /* TRIALING */ && subscription.trialEnd) {
|
|
@@ -2696,7 +2696,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
|
|
|
2696
2696
|
". Add a payment method to continue your subscription."
|
|
2697
2697
|
] })
|
|
2698
2698
|
] }),
|
|
2699
|
-
onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2699
|
+
onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Button, { variant: "outline", size: "sm", onClick: onAddPayment, className: "text-warning border-yellow-300", children: "Add Payment Method" })
|
|
2700
2700
|
] });
|
|
2701
2701
|
}
|
|
2702
2702
|
}
|
|
@@ -2747,7 +2747,7 @@ function BillingDashboardContainer() {
|
|
|
2747
2747
|
setNoCustomerExists(false);
|
|
2748
2748
|
let customer = null;
|
|
2749
2749
|
try {
|
|
2750
|
-
customer = await
|
|
2750
|
+
customer = await _chunkYKFXQOQAjs.StripeCustomerService.getCustomer();
|
|
2751
2751
|
setData((prev) => ({ ...prev, customer }));
|
|
2752
2752
|
setErrors((prev) => ({ ...prev, customer: null }));
|
|
2753
2753
|
setNoCustomerExists(false);
|
|
@@ -2773,7 +2773,7 @@ function BillingDashboardContainer() {
|
|
|
2773
2773
|
}
|
|
2774
2774
|
const fetchSubscriptions = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2775
2775
|
try {
|
|
2776
|
-
const subscriptions2 = await
|
|
2776
|
+
const subscriptions2 = await _chunkYKFXQOQAjs.StripeSubscriptionService.listSubscriptions();
|
|
2777
2777
|
setData((prev) => ({ ...prev, subscriptions: subscriptions2 }));
|
|
2778
2778
|
setErrors((prev) => ({ ...prev, subscriptions: null }));
|
|
2779
2779
|
return subscriptions2;
|
|
@@ -2787,7 +2787,7 @@ function BillingDashboardContainer() {
|
|
|
2787
2787
|
}, "fetchSubscriptions");
|
|
2788
2788
|
const fetchPaymentMethods = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2789
2789
|
try {
|
|
2790
|
-
const paymentMethods = await
|
|
2790
|
+
const paymentMethods = await _chunkYKFXQOQAjs.StripeCustomerService.listPaymentMethods();
|
|
2791
2791
|
setData((prev) => ({ ...prev, paymentMethods }));
|
|
2792
2792
|
setErrors((prev) => ({ ...prev, paymentMethods: null }));
|
|
2793
2793
|
} catch (error) {
|
|
@@ -2799,7 +2799,7 @@ function BillingDashboardContainer() {
|
|
|
2799
2799
|
}, "fetchPaymentMethods");
|
|
2800
2800
|
const fetchInvoices = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2801
2801
|
try {
|
|
2802
|
-
const invoices = await
|
|
2802
|
+
const invoices = await _chunkYKFXQOQAjs.StripeInvoiceService.listInvoices();
|
|
2803
2803
|
setData((prev) => ({ ...prev, invoices }));
|
|
2804
2804
|
setErrors((prev) => ({ ...prev, invoices: null }));
|
|
2805
2805
|
} catch (error) {
|
|
@@ -2822,7 +2822,7 @@ function BillingDashboardContainer() {
|
|
|
2822
2822
|
const handleCreateCustomer = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2823
2823
|
setCreatingCustomer(true);
|
|
2824
2824
|
try {
|
|
2825
|
-
await
|
|
2825
|
+
await _chunkYKFXQOQAjs.StripeCustomerService.createCustomer();
|
|
2826
2826
|
setNoCustomerExists(false);
|
|
2827
2827
|
await fetchAllData();
|
|
2828
2828
|
} catch (error) {
|
|
@@ -2834,7 +2834,7 @@ function BillingDashboardContainer() {
|
|
|
2834
2834
|
}, "handleCreateCustomer");
|
|
2835
2835
|
const fetchUsageData = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2836
2836
|
try {
|
|
2837
|
-
const meters = await
|
|
2837
|
+
const meters = await _chunkYKFXQOQAjs.StripeUsageService.listMeters();
|
|
2838
2838
|
setData((prev) => ({ ...prev, meters }));
|
|
2839
2839
|
const summariesMap = {};
|
|
2840
2840
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -2842,7 +2842,7 @@ function BillingDashboardContainer() {
|
|
|
2842
2842
|
const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
|
|
2843
2843
|
for (const meter of meters) {
|
|
2844
2844
|
try {
|
|
2845
|
-
const meterSummaries = await
|
|
2845
|
+
const meterSummaries = await _chunkYKFXQOQAjs.StripeUsageService.getMeterSummaries({
|
|
2846
2846
|
meterId: meter.id,
|
|
2847
2847
|
startTime: startOfMonth,
|
|
2848
2848
|
endTime: endOfMonth
|
|
@@ -2920,18 +2920,18 @@ function BillingDashboardContainer() {
|
|
|
2920
2920
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-8 w-8" }),
|
|
2921
2921
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: "Billing" })
|
|
2922
2922
|
] }),
|
|
2923
|
-
isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2924
|
-
noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2925
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2923
|
+
isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.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" }) }) }),
|
|
2924
|
+
noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.Card, { children: [
|
|
2925
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.CardHeader, { className: "text-center", children: [
|
|
2926
2926
|
/* @__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" }) }),
|
|
2927
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2928
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2927
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.CardTitle, { children: "Set Up Billing" }),
|
|
2928
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.CardDescription, { children: "Your company doesn't have a billing account yet. Set one up to manage subscriptions, payment methods, and view invoices." })
|
|
2929
2929
|
] }),
|
|
2930
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2930
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.CardContent, { className: "flex justify-center pb-8", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Button, { onClick: handleCreateCustomer, disabled: creatingCustomer, size: "lg", children: creatingCustomer ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2931
2931
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
2932
2932
|
"Setting up..."
|
|
2933
2933
|
] }) : "Set Up Billing Account" }) }),
|
|
2934
|
-
errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2934
|
+
errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.CardContent, { className: "pt-0", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-center text-destructive text-xs/relaxed", children: errors.customer }) })
|
|
2935
2935
|
] }),
|
|
2936
2936
|
!noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2937
2937
|
criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -3073,7 +3073,7 @@ function getStripePromise(publishableKey) {
|
|
|
3073
3073
|
}
|
|
3074
3074
|
_chunk7QVYU63Ejs.__name.call(void 0, getStripePromise, "getStripePromise");
|
|
3075
3075
|
function StripeProvider({ children }) {
|
|
3076
|
-
const publishableKey =
|
|
3076
|
+
const publishableKey = _chunkUYENG3GTjs.getStripePublishableKey.call(void 0, );
|
|
3077
3077
|
const stripePromise = _react.useMemo.call(void 0, () => getStripePromise(publishableKey), [publishableKey]);
|
|
3078
3078
|
const options = _react.useMemo.call(void 0, () => ({}), []);
|
|
3079
3079
|
if (!publishableKey) {
|
|
@@ -3083,7 +3083,7 @@ function StripeProvider({ children }) {
|
|
|
3083
3083
|
}
|
|
3084
3084
|
_chunk7QVYU63Ejs.__name.call(void 0, StripeProvider, "StripeProvider");
|
|
3085
3085
|
function isStripeConfigured() {
|
|
3086
|
-
return !!
|
|
3086
|
+
return !!_chunkUYENG3GTjs.getStripePublishableKey.call(void 0, );
|
|
3087
3087
|
}
|
|
3088
3088
|
_chunk7QVYU63Ejs.__name.call(void 0, isStripeConfigured, "isStripeConfigured");
|
|
3089
3089
|
|
|
@@ -3103,12 +3103,12 @@ function PriceArchiver({ price }) {
|
|
|
3103
3103
|
const isArchived = !price.active;
|
|
3104
3104
|
const scope = isArchived ? "restore" : "archive";
|
|
3105
3105
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
3106
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3106
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.Button, { variant: "outline", size: "sm", onClick: () => setOpen(true), children: [
|
|
3107
3107
|
isArchived ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RotateCcwIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ArchiveIcon, {}),
|
|
3108
3108
|
t(`billing.admin.prices.${scope}.confirm`)
|
|
3109
3109
|
] }),
|
|
3110
3110
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3111
|
-
|
|
3111
|
+
_chunk5AKDE5UWjs.ConfirmDialog,
|
|
3112
3112
|
{
|
|
3113
3113
|
open,
|
|
3114
3114
|
onOpenChange: setOpen,
|
|
@@ -3122,7 +3122,7 @@ function PriceArchiver({ price }) {
|
|
|
3122
3122
|
if (isArchived) await restorePrice(price.id);
|
|
3123
3123
|
else await archivePrice(price.id);
|
|
3124
3124
|
} catch (error) {
|
|
3125
|
-
|
|
3125
|
+
_chunk5AKDE5UWjs.errorToast.call(void 0, { title: t(`billing.admin.prices.${scope}.title`), error });
|
|
3126
3126
|
throw error;
|
|
3127
3127
|
}
|
|
3128
3128
|
}
|
|
@@ -3153,14 +3153,14 @@ function PriceEditorInternal({
|
|
|
3153
3153
|
onDialogOpenChange
|
|
3154
3154
|
}) {
|
|
3155
3155
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
3156
|
-
const router =
|
|
3156
|
+
const router = _chunkUYENG3GTjs.useI18nRouter.call(void 0, );
|
|
3157
3157
|
const { createPrice, updatePrice, productId: contextProductId } = usePriceContext();
|
|
3158
3158
|
const [allFeatures, setAllFeatures] = _react.useState.call(void 0, []);
|
|
3159
3159
|
const isEdit = !!price;
|
|
3160
3160
|
const targetProductId = _nullishCoalesce(_nullishCoalesce(productId, () => ( _optionalChain([price, 'optionalAccess', _117 => _117.product, 'optionalAccess', _118 => _118.id]))), () => ( contextProductId));
|
|
3161
3161
|
_react.useEffect.call(void 0, () => {
|
|
3162
3162
|
const fetchFeatures = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3163
|
-
setAllFeatures(await
|
|
3163
|
+
setAllFeatures(await _chunkYKFXQOQAjs.FeatureService.findMany({}));
|
|
3164
3164
|
}, "fetchFeatures");
|
|
3165
3165
|
void fetchFeatures();
|
|
3166
3166
|
}, []);
|
|
@@ -3181,7 +3181,28 @@ function PriceEditorInternal({
|
|
|
3181
3181
|
isTrial: _zod3.z.boolean(),
|
|
3182
3182
|
description: _zod3.z.string().optional(),
|
|
3183
3183
|
features: _zod3.z.array(_zod3.z.string()),
|
|
3184
|
-
|
|
3184
|
+
// Normalised, not a bare `z.string()`: the field renders as
|
|
3185
|
+
// `<FormInput type="number">`, which hands back a number, so a plain
|
|
3186
|
+
// string schema rejects every value with "expected string, received
|
|
3187
|
+
// number".
|
|
3188
|
+
//
|
|
3189
|
+
// Normalised by hand rather than with `z.coerce.string()`, because
|
|
3190
|
+
// zod 4's coercion is `String(input)` — a cleared number input yields
|
|
3191
|
+
// NaN, which would become the TRUTHY string "NaN" and reach
|
|
3192
|
+
// `parseInt` as a NaN token.
|
|
3193
|
+
//
|
|
3194
|
+
// Deliberately NOT converted to the `z.preprocess(... z.number())`
|
|
3195
|
+
// idiom used by unitAmount/intervalCount above. The whole token
|
|
3196
|
+
// pipeline is string-based — seeded with `.toString()` and read back
|
|
3197
|
+
// with `values.token ? parseInt(...)` on both submit branches — and a
|
|
3198
|
+
// number pipeline would make `0` FALSY, silently dropping the token
|
|
3199
|
+
// from the payload. A price with no token is "tokens not configured"
|
|
3200
|
+
// (AI stays enabled), so that would make a zero-token / no-AI plan
|
|
3201
|
+
// impossible to create from this form.
|
|
3202
|
+
token: _zod3.z.preprocess(
|
|
3203
|
+
(value) => value === void 0 || value === null || value === "" || typeof value === "number" && Number.isNaN(value) ? "" : String(value),
|
|
3204
|
+
_zod3.z.string()
|
|
3205
|
+
),
|
|
3185
3206
|
featureIds: _zod3.z.array(_zod3.z.string())
|
|
3186
3207
|
}),
|
|
3187
3208
|
[t]
|
|
@@ -3225,13 +3246,13 @@ function PriceEditorInternal({
|
|
|
3225
3246
|
{ id: "metered", text: t("billing.admin.prices.usage.metered") }
|
|
3226
3247
|
];
|
|
3227
3248
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3228
|
-
|
|
3249
|
+
_chunk5AKDE5UWjs.EditorSheet,
|
|
3229
3250
|
{
|
|
3230
3251
|
form,
|
|
3231
3252
|
entityType: t("billing.admin.prices.entity"),
|
|
3232
3253
|
entityName: price ? priceLabel(price) : void 0,
|
|
3233
3254
|
isEdit,
|
|
3234
|
-
module:
|
|
3255
|
+
module: _chunkYKFXQOQAjs.Modules.StripePrice,
|
|
3235
3256
|
size: "lg",
|
|
3236
3257
|
propagateChanges,
|
|
3237
3258
|
onSuccess,
|
|
@@ -3280,13 +3301,13 @@ function PriceEditorInternal({
|
|
|
3280
3301
|
dialogOpen,
|
|
3281
3302
|
onDialogOpenChange,
|
|
3282
3303
|
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
3283
|
-
isEdit && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3284
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3285
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3304
|
+
isEdit && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.Alert, { children: [
|
|
3305
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.AlertTitle, { children: t("billing.admin.prices.immutability.title") }),
|
|
3306
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.AlertDescription, { children: t("billing.admin.prices.immutability.description") })
|
|
3286
3307
|
] }),
|
|
3287
3308
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
|
|
3288
3309
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3289
|
-
|
|
3310
|
+
_chunk5AKDE5UWjs.FormInput,
|
|
3290
3311
|
{
|
|
3291
3312
|
form,
|
|
3292
3313
|
id: "unitAmount",
|
|
@@ -3298,7 +3319,7 @@ function PriceEditorInternal({
|
|
|
3298
3319
|
}
|
|
3299
3320
|
),
|
|
3300
3321
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3301
|
-
|
|
3322
|
+
_chunk5AKDE5UWjs.FormSelect,
|
|
3302
3323
|
{
|
|
3303
3324
|
form,
|
|
3304
3325
|
id: "currency",
|
|
@@ -3309,7 +3330,7 @@ function PriceEditorInternal({
|
|
|
3309
3330
|
)
|
|
3310
3331
|
] }),
|
|
3311
3332
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3312
|
-
|
|
3333
|
+
_chunk5AKDE5UWjs.FormSelect,
|
|
3313
3334
|
{
|
|
3314
3335
|
form,
|
|
3315
3336
|
id: "interval",
|
|
@@ -3320,7 +3341,7 @@ function PriceEditorInternal({
|
|
|
3320
3341
|
),
|
|
3321
3342
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
|
|
3322
3343
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3323
|
-
|
|
3344
|
+
_chunk5AKDE5UWjs.FormInput,
|
|
3324
3345
|
{
|
|
3325
3346
|
form,
|
|
3326
3347
|
id: "intervalCount",
|
|
@@ -3331,7 +3352,7 @@ function PriceEditorInternal({
|
|
|
3331
3352
|
}
|
|
3332
3353
|
),
|
|
3333
3354
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3334
|
-
|
|
3355
|
+
_chunk5AKDE5UWjs.FormSelect,
|
|
3335
3356
|
{
|
|
3336
3357
|
form,
|
|
3337
3358
|
id: "usageType",
|
|
@@ -3342,7 +3363,7 @@ function PriceEditorInternal({
|
|
|
3342
3363
|
)
|
|
3343
3364
|
] }),
|
|
3344
3365
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3345
|
-
|
|
3366
|
+
_chunk5AKDE5UWjs.FormInput,
|
|
3346
3367
|
{
|
|
3347
3368
|
form,
|
|
3348
3369
|
id: "nickname",
|
|
@@ -3351,7 +3372,7 @@ function PriceEditorInternal({
|
|
|
3351
3372
|
}
|
|
3352
3373
|
),
|
|
3353
3374
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3354
|
-
|
|
3375
|
+
_chunk5AKDE5UWjs.FormTextarea,
|
|
3355
3376
|
{
|
|
3356
3377
|
form,
|
|
3357
3378
|
id: "description",
|
|
@@ -3361,7 +3382,7 @@ function PriceEditorInternal({
|
|
|
3361
3382
|
}
|
|
3362
3383
|
),
|
|
3363
3384
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3364
|
-
|
|
3385
|
+
_chunk5AKDE5UWjs.FormInput,
|
|
3365
3386
|
{
|
|
3366
3387
|
form,
|
|
3367
3388
|
id: "token",
|
|
@@ -3371,10 +3392,10 @@ function PriceEditorInternal({
|
|
|
3371
3392
|
}
|
|
3372
3393
|
),
|
|
3373
3394
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-2", children: [
|
|
3374
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3395
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.FieldLabel, { children: t("billing.admin.prices.fields.features") }),
|
|
3375
3396
|
form.watch("features").map((_, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
|
|
3376
3397
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3377
|
-
|
|
3398
|
+
_chunk5AKDE5UWjs.Input,
|
|
3378
3399
|
{
|
|
3379
3400
|
...form.register(`features.${index}`),
|
|
3380
3401
|
placeholder: t("billing.admin.prices.placeholders.feature", { index: index + 1 }),
|
|
@@ -3382,7 +3403,7 @@ function PriceEditorInternal({
|
|
|
3382
3403
|
}
|
|
3383
3404
|
),
|
|
3384
3405
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3385
|
-
|
|
3406
|
+
_chunk5AKDE5UWjs.Button,
|
|
3386
3407
|
{
|
|
3387
3408
|
type: "button",
|
|
3388
3409
|
variant: "outline",
|
|
@@ -3397,7 +3418,7 @@ function PriceEditorInternal({
|
|
|
3397
3418
|
)
|
|
3398
3419
|
] }, index)),
|
|
3399
3420
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3400
|
-
|
|
3421
|
+
_chunk5AKDE5UWjs.Button,
|
|
3401
3422
|
{
|
|
3402
3423
|
type: "button",
|
|
3403
3424
|
variant: "outline",
|
|
@@ -3412,12 +3433,12 @@ function PriceEditorInternal({
|
|
|
3412
3433
|
)
|
|
3413
3434
|
] }),
|
|
3414
3435
|
isRecurring && allFeatures.length > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-2", children: [
|
|
3415
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3436
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.FieldLabel, { children: t("billing.admin.prices.fields.platformFeatures") }),
|
|
3416
3437
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex max-h-48 flex-col gap-y-2 overflow-y-auto rounded-md border p-4", children: allFeatures.map((feature) => {
|
|
3417
3438
|
const isChecked = form.watch("featureIds").includes(feature.id);
|
|
3418
3439
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
3419
3440
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3420
|
-
|
|
3441
|
+
_chunk5AKDE5UWjs.Checkbox,
|
|
3421
3442
|
{
|
|
3422
3443
|
id: `feature-${feature.id}`,
|
|
3423
3444
|
checked: isChecked,
|
|
@@ -3433,13 +3454,13 @@ function PriceEditorInternal({
|
|
|
3433
3454
|
}
|
|
3434
3455
|
}
|
|
3435
3456
|
),
|
|
3436
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3457
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.FieldLabel, { htmlFor: `feature-${feature.id}`, children: feature.name }),
|
|
3437
3458
|
feature.isCore && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.admin.prices.help.core") })
|
|
3438
3459
|
] }, feature.id);
|
|
3439
3460
|
}) })
|
|
3440
3461
|
] }),
|
|
3441
3462
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3442
|
-
|
|
3463
|
+
_chunk5AKDE5UWjs.FormCheckbox,
|
|
3443
3464
|
{
|
|
3444
3465
|
form,
|
|
3445
3466
|
id: "isTrial",
|
|
@@ -3482,7 +3503,7 @@ var defaultContextValue = {
|
|
|
3482
3503
|
productId: void 0
|
|
3483
3504
|
};
|
|
3484
3505
|
function priceLabel(price) {
|
|
3485
|
-
return _nullishCoalesce(price.nickname, () => ( `${
|
|
3506
|
+
return _nullishCoalesce(price.nickname, () => ( `${_chunk5AKDE5UWjs.formatCurrency.call(void 0, price.unitAmount, price.currency)} ${_chunk5AKDE5UWjs.formatInterval.call(void 0, price)}`.trim()));
|
|
3486
3507
|
}
|
|
3487
3508
|
_chunk7QVYU63Ejs.__name.call(void 0, priceLabel, "priceLabel");
|
|
3488
3509
|
var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
@@ -3492,21 +3513,21 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3492
3513
|
productId: productIdProp
|
|
3493
3514
|
}) => {
|
|
3494
3515
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
3495
|
-
const generateUrl =
|
|
3496
|
-
const { hasRole } =
|
|
3516
|
+
const generateUrl = _chunk5AKDE5UWjs.usePageUrlGenerator.call(void 0, );
|
|
3517
|
+
const { hasRole } = _chunk5AKDE5UWjs.useCurrentUserContext.call(void 0, );
|
|
3497
3518
|
const [price, setPrice] = _react.useState.call(void 0,
|
|
3498
|
-
dehydratedPrice ?
|
|
3519
|
+
dehydratedPrice ? _chunkYKFXQOQAjs.rehydrate.call(void 0, _chunkYKFXQOQAjs.Modules.StripePrice, dehydratedPrice) : void 0
|
|
3499
3520
|
);
|
|
3500
3521
|
const [priceVersion, setPriceVersion] = _react.useState.call(void 0, 0);
|
|
3501
3522
|
const refreshPrices = _react.useCallback.call(void 0, () => setPriceVersion((value2) => value2 + 1), []);
|
|
3502
3523
|
const productId = _nullishCoalesce(productIdProp, () => ( _optionalChain([price, 'optionalAccess', _138 => _138.product, 'optionalAccess', _139 => _139.id])));
|
|
3503
3524
|
const reloadPrice = _react.useCallback.call(void 0, async () => {
|
|
3504
3525
|
if (!_optionalChain([price, 'optionalAccess', _140 => _140.id])) return;
|
|
3505
|
-
setPrice(await
|
|
3526
|
+
setPrice(await _chunkYKFXQOQAjs.StripePriceService.getPrice({ id: price.id }));
|
|
3506
3527
|
}, [_optionalChain([price, 'optionalAccess', _141 => _141.id])]);
|
|
3507
3528
|
const createPrice = _react.useCallback.call(void 0,
|
|
3508
3529
|
async (input) => {
|
|
3509
|
-
const saved = await
|
|
3530
|
+
const saved = await _chunkYKFXQOQAjs.StripePriceService.createPrice(input);
|
|
3510
3531
|
refreshPrices();
|
|
3511
3532
|
return saved;
|
|
3512
3533
|
},
|
|
@@ -3514,7 +3535,7 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3514
3535
|
);
|
|
3515
3536
|
const updatePrice = _react.useCallback.call(void 0,
|
|
3516
3537
|
async (input) => {
|
|
3517
|
-
const saved = await
|
|
3538
|
+
const saved = await _chunkYKFXQOQAjs.StripePriceService.updatePrice(input);
|
|
3518
3539
|
setPrice(saved);
|
|
3519
3540
|
refreshPrices();
|
|
3520
3541
|
return saved;
|
|
@@ -3525,7 +3546,7 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3525
3546
|
async (id) => {
|
|
3526
3547
|
const target = _nullishCoalesce(id, () => ( _optionalChain([price, 'optionalAccess', _142 => _142.id])));
|
|
3527
3548
|
if (!target) return;
|
|
3528
|
-
await
|
|
3549
|
+
await _chunkYKFXQOQAjs.StripePriceService.archivePrice({ id: target });
|
|
3529
3550
|
await reloadPrice();
|
|
3530
3551
|
refreshPrices();
|
|
3531
3552
|
},
|
|
@@ -3535,7 +3556,7 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3535
3556
|
async (id) => {
|
|
3536
3557
|
const target = _nullishCoalesce(id, () => ( _optionalChain([price, 'optionalAccess', _144 => _144.id])));
|
|
3537
3558
|
if (!target) return;
|
|
3538
|
-
await
|
|
3559
|
+
await _chunkYKFXQOQAjs.StripePriceService.reactivatePrice({ id: target });
|
|
3539
3560
|
await reloadPrice();
|
|
3540
3561
|
refreshPrices();
|
|
3541
3562
|
},
|
|
@@ -3559,12 +3580,12 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3559
3580
|
if (!publishChrome) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceContext.Provider, { value, children });
|
|
3560
3581
|
const breadcrumb = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
3561
3582
|
const items = [
|
|
3562
|
-
{ name: t("billing.admin.products.title"), href: generateUrl({ page:
|
|
3583
|
+
{ name: t("billing.admin.products.title"), href: generateUrl({ page: _chunkYKFXQOQAjs.Modules.StripeProduct }) }
|
|
3563
3584
|
];
|
|
3564
3585
|
if (_optionalChain([price, 'optionalAccess', _146 => _146.product]))
|
|
3565
3586
|
items.push({
|
|
3566
3587
|
name: price.product.name,
|
|
3567
|
-
href: generateUrl({ page:
|
|
3588
|
+
href: generateUrl({ page: _chunkYKFXQOQAjs.Modules.StripeProduct, id: price.product.id })
|
|
3568
3589
|
});
|
|
3569
3590
|
if (price) items.push({ name: priceLabel(price) });
|
|
3570
3591
|
return items;
|
|
@@ -3573,7 +3594,7 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3573
3594
|
const response = { type: t("billing.admin.prices.title") };
|
|
3574
3595
|
if (!price) return response;
|
|
3575
3596
|
response.element = priceLabel(price);
|
|
3576
|
-
if (hasRole(
|
|
3597
|
+
if (hasRole(_chunkUYENG3GTjs.getRoleId.call(void 0, ).Administrator)) {
|
|
3577
3598
|
response.functions = [
|
|
3578
3599
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceArchiver, { price }, "priceArchiver"),
|
|
3579
3600
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceEditor, { price, propagateChanges: setPrice }, "priceEditor")
|
|
@@ -3581,7 +3602,7 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3581
3602
|
}
|
|
3582
3603
|
return response;
|
|
3583
3604
|
}, "title");
|
|
3584
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3605
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceContext.Provider, { value, children }) });
|
|
3585
3606
|
}, "PriceProvider");
|
|
3586
3607
|
var usePriceContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => _nullishCoalesce(_react.useContext.call(void 0, PriceContext), () => ( defaultContextValue)), "usePriceContext");
|
|
3587
3608
|
|
|
@@ -3601,12 +3622,12 @@ function ProductArchiver({ product }) {
|
|
|
3601
3622
|
const isArchived = !product.active;
|
|
3602
3623
|
const scope = isArchived ? "restore" : "archive";
|
|
3603
3624
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
3604
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3625
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5AKDE5UWjs.Button, { variant: "outline", size: "sm", onClick: () => setOpen(true), children: [
|
|
3605
3626
|
isArchived ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RotateCcwIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ArchiveIcon, {}),
|
|
3606
3627
|
t(`billing.admin.products.${scope}.confirm`)
|
|
3607
3628
|
] }),
|
|
3608
3629
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3609
|
-
|
|
3630
|
+
_chunk5AKDE5UWjs.ConfirmDialog,
|
|
3610
3631
|
{
|
|
3611
3632
|
open,
|
|
3612
3633
|
onOpenChange: setOpen,
|
|
@@ -3620,7 +3641,7 @@ function ProductArchiver({ product }) {
|
|
|
3620
3641
|
if (isArchived) await restoreProduct(product.id);
|
|
3621
3642
|
else await archiveProduct(product.id);
|
|
3622
3643
|
} catch (error) {
|
|
3623
|
-
|
|
3644
|
+
_chunk5AKDE5UWjs.errorToast.call(void 0, { title: t(`billing.admin.products.${scope}.title`), error });
|
|
3624
3645
|
throw error;
|
|
3625
3646
|
}
|
|
3626
3647
|
}
|
|
@@ -3649,7 +3670,7 @@ function ProductEditorInternal({
|
|
|
3649
3670
|
onDialogOpenChange
|
|
3650
3671
|
}) {
|
|
3651
3672
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
3652
|
-
const router =
|
|
3673
|
+
const router = _chunkUYENG3GTjs.useI18nRouter.call(void 0, );
|
|
3653
3674
|
const { createProduct, updateProduct } = useProductContext();
|
|
3654
3675
|
const isEdit = !!product;
|
|
3655
3676
|
const formSchema2 = _react.useMemo.call(void 0,
|
|
@@ -3673,13 +3694,13 @@ function ProductEditorInternal({
|
|
|
3673
3694
|
defaultValues: getDefaultValues()
|
|
3674
3695
|
});
|
|
3675
3696
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3676
|
-
|
|
3697
|
+
_chunk5AKDE5UWjs.EditorSheet,
|
|
3677
3698
|
{
|
|
3678
3699
|
form,
|
|
3679
3700
|
entityType: t("billing.admin.products.entity"),
|
|
3680
3701
|
entityName: _optionalChain([product, 'optionalAccess', _150 => _150.name]),
|
|
3681
3702
|
isEdit,
|
|
3682
|
-
module:
|
|
3703
|
+
module: _chunkYKFXQOQAjs.Modules.StripeProduct,
|
|
3683
3704
|
size: "md",
|
|
3684
3705
|
propagateChanges,
|
|
3685
3706
|
onSuccess,
|
|
@@ -3696,7 +3717,7 @@ function ProductEditorInternal({
|
|
|
3696
3717
|
onDialogOpenChange,
|
|
3697
3718
|
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
3698
3719
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3699
|
-
|
|
3720
|
+
_chunk5AKDE5UWjs.FormInput,
|
|
3700
3721
|
{
|
|
3701
3722
|
form,
|
|
3702
3723
|
id: "name",
|
|
@@ -3706,7 +3727,7 @@ function ProductEditorInternal({
|
|
|
3706
3727
|
}
|
|
3707
3728
|
),
|
|
3708
3729
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3709
|
-
|
|
3730
|
+
_chunk5AKDE5UWjs.FormTextarea,
|
|
3710
3731
|
{
|
|
3711
3732
|
form,
|
|
3712
3733
|
id: "description",
|
|
@@ -3750,20 +3771,20 @@ var defaultContextValue2 = {
|
|
|
3750
3771
|
};
|
|
3751
3772
|
var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ children, dehydratedProduct, publishChrome = true }) => {
|
|
3752
3773
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
3753
|
-
const generateUrl =
|
|
3754
|
-
const { hasRole } =
|
|
3774
|
+
const generateUrl = _chunk5AKDE5UWjs.usePageUrlGenerator.call(void 0, );
|
|
3775
|
+
const { hasRole } = _chunk5AKDE5UWjs.useCurrentUserContext.call(void 0, );
|
|
3755
3776
|
const [product, setProduct] = _react.useState.call(void 0,
|
|
3756
|
-
dehydratedProduct ?
|
|
3777
|
+
dehydratedProduct ? _chunkYKFXQOQAjs.rehydrate.call(void 0, _chunkYKFXQOQAjs.Modules.StripeProduct, dehydratedProduct) : void 0
|
|
3757
3778
|
);
|
|
3758
3779
|
const [catalogueVersion, setCatalogueVersion] = _react.useState.call(void 0, 0);
|
|
3759
3780
|
const refreshCatalogue = _react.useCallback.call(void 0, () => setCatalogueVersion((value2) => value2 + 1), []);
|
|
3760
3781
|
const reloadProduct = _react.useCallback.call(void 0, async () => {
|
|
3761
3782
|
if (!_optionalChain([product, 'optionalAccess', _151 => _151.id])) return;
|
|
3762
|
-
setProduct(await
|
|
3783
|
+
setProduct(await _chunkYKFXQOQAjs.StripeProductService.getProduct({ id: product.id }));
|
|
3763
3784
|
}, [_optionalChain([product, 'optionalAccess', _152 => _152.id])]);
|
|
3764
3785
|
const createProduct = _react.useCallback.call(void 0,
|
|
3765
3786
|
async (input) => {
|
|
3766
|
-
const saved = await
|
|
3787
|
+
const saved = await _chunkYKFXQOQAjs.StripeProductService.createProduct(input);
|
|
3767
3788
|
refreshCatalogue();
|
|
3768
3789
|
return saved;
|
|
3769
3790
|
},
|
|
@@ -3771,7 +3792,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
3771
3792
|
);
|
|
3772
3793
|
const updateProduct = _react.useCallback.call(void 0,
|
|
3773
3794
|
async (input) => {
|
|
3774
|
-
const saved = await
|
|
3795
|
+
const saved = await _chunkYKFXQOQAjs.StripeProductService.updateProduct(input);
|
|
3775
3796
|
setProduct(saved);
|
|
3776
3797
|
refreshCatalogue();
|
|
3777
3798
|
return saved;
|
|
@@ -3782,7 +3803,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
3782
3803
|
async (id) => {
|
|
3783
3804
|
const target = _nullishCoalesce(id, () => ( _optionalChain([product, 'optionalAccess', _153 => _153.id])));
|
|
3784
3805
|
if (!target) return;
|
|
3785
|
-
await
|
|
3806
|
+
await _chunkYKFXQOQAjs.StripeProductService.archiveProduct({ id: target });
|
|
3786
3807
|
await reloadProduct();
|
|
3787
3808
|
refreshCatalogue();
|
|
3788
3809
|
},
|
|
@@ -3792,7 +3813,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
3792
3813
|
async (id) => {
|
|
3793
3814
|
const target = _nullishCoalesce(id, () => ( _optionalChain([product, 'optionalAccess', _155 => _155.id])));
|
|
3794
3815
|
if (!target) return;
|
|
3795
|
-
await
|
|
3816
|
+
await _chunkYKFXQOQAjs.StripeProductService.reactivateProduct({ id: target });
|
|
3796
3817
|
await reloadProduct();
|
|
3797
3818
|
refreshCatalogue();
|
|
3798
3819
|
},
|
|
@@ -3827,7 +3848,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
3827
3848
|
{
|
|
3828
3849
|
name: t("billing.admin.products.title"),
|
|
3829
3850
|
// Linked only when it is NOT the current page.
|
|
3830
|
-
...product ? { href: generateUrl({ page:
|
|
3851
|
+
...product ? { href: generateUrl({ page: _chunkYKFXQOQAjs.Modules.StripeProduct }) } : {}
|
|
3831
3852
|
}
|
|
3832
3853
|
];
|
|
3833
3854
|
if (product) items.push({ name: product.name });
|
|
@@ -3837,7 +3858,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
3837
3858
|
const response = { type: t("billing.admin.products.title") };
|
|
3838
3859
|
if (!product) return response;
|
|
3839
3860
|
response.element = product.name;
|
|
3840
|
-
if (hasRole(
|
|
3861
|
+
if (hasRole(_chunkUYENG3GTjs.getRoleId.call(void 0, ).Administrator)) {
|
|
3841
3862
|
response.functions = [
|
|
3842
3863
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductArchiver, { product }, "productArchiver"),
|
|
3843
3864
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductEditor, { product, propagateChanges: setProduct }, "productEditor")
|
|
@@ -3845,7 +3866,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
3845
3866
|
}
|
|
3846
3867
|
return response;
|
|
3847
3868
|
}, "title");
|
|
3848
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3869
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductContext.Provider, { value, children }) });
|
|
3849
3870
|
}, "ProductProvider");
|
|
3850
3871
|
var useProductContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => _nullishCoalesce(_react.useContext.call(void 0, ProductContext), () => ( defaultContextValue2)), "useProductContext");
|
|
3851
3872
|
|
|
@@ -3854,56 +3875,56 @@ var useProductContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ()
|
|
|
3854
3875
|
|
|
3855
3876
|
function PriceDetails() {
|
|
3856
3877
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
3857
|
-
const generateUrl =
|
|
3878
|
+
const generateUrl = _chunk5AKDE5UWjs.usePageUrlGenerator.call(void 0, );
|
|
3858
3879
|
const { price } = usePriceContext();
|
|
3859
3880
|
if (!price) return null;
|
|
3860
3881
|
const isRecurring = price.priceType === "recurring";
|
|
3861
3882
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-8", children: [
|
|
3862
3883
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
3863
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3884
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.SectionHeader, { children: t("billing.admin.prices.title") }),
|
|
3864
3885
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
3865
3886
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3866
|
-
|
|
3887
|
+
_chunk5AKDE5UWjs.DetailField,
|
|
3867
3888
|
{
|
|
3868
3889
|
label: t("billing.admin.prices.fields.product"),
|
|
3869
|
-
value: price.product ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3890
|
+
value: price.product ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Link, { href: generateUrl({ page: _chunkYKFXQOQAjs.Modules.StripeProduct, id: price.product.id }), children: price.product.name }) : "\u2014"
|
|
3870
3891
|
}
|
|
3871
3892
|
),
|
|
3872
3893
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3873
|
-
|
|
3894
|
+
_chunk5AKDE5UWjs.DetailField,
|
|
3874
3895
|
{
|
|
3875
3896
|
label: t("billing.admin.prices.fields.status"),
|
|
3876
3897
|
value: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex flex-wrap items-center gap-1", children: [
|
|
3877
|
-
price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3878
|
-
price.isTrial && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3898
|
+
price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Badge, { variant: "softGreen", children: t("billing.admin.prices.status.active") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Badge, { variant: "softGray", children: t("billing.admin.prices.status.archived") }),
|
|
3899
|
+
price.isTrial && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Badge, { variant: "softBlue", children: t("billing.admin.prices.badge.trial") })
|
|
3879
3900
|
] })
|
|
3880
3901
|
}
|
|
3881
3902
|
),
|
|
3882
3903
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3883
|
-
|
|
3904
|
+
_chunk5AKDE5UWjs.DetailField,
|
|
3884
3905
|
{
|
|
3885
3906
|
label: t("billing.admin.prices.fields.amount"),
|
|
3886
|
-
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children:
|
|
3907
|
+
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _chunk5AKDE5UWjs.formatCurrency.call(void 0, price.unitAmount, price.currency) })
|
|
3887
3908
|
}
|
|
3888
3909
|
),
|
|
3889
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3910
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.DetailField, { label: t("billing.admin.prices.fields.currency"), value: price.currency.toUpperCase() }),
|
|
3890
3911
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3891
|
-
|
|
3912
|
+
_chunk5AKDE5UWjs.DetailField,
|
|
3892
3913
|
{
|
|
3893
3914
|
label: t("billing.admin.prices.fields.type"),
|
|
3894
3915
|
value: isRecurring ? t("billing.admin.prices.type.recurring") : t("billing.admin.prices.type.oneTime")
|
|
3895
3916
|
}
|
|
3896
3917
|
),
|
|
3897
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3918
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.DetailField, { label: t("billing.admin.prices.fields.billing"), value: _chunk5AKDE5UWjs.formatInterval.call(void 0, price) }),
|
|
3898
3919
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3899
|
-
|
|
3920
|
+
_chunk5AKDE5UWjs.DetailField,
|
|
3900
3921
|
{
|
|
3901
3922
|
label: t("billing.admin.prices.fields.intervalCount"),
|
|
3902
3923
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _nullishCoalesce(_optionalChain([price, 'access', _157 => _157.recurring, 'optionalAccess', _158 => _158.intervalCount]), () => ( 1)) })
|
|
3903
3924
|
}
|
|
3904
3925
|
),
|
|
3905
3926
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3906
|
-
|
|
3927
|
+
_chunk5AKDE5UWjs.DetailField,
|
|
3907
3928
|
{
|
|
3908
3929
|
label: t("billing.admin.prices.fields.usageType"),
|
|
3909
3930
|
value: _optionalChain([price, 'access', _159 => _159.recurring, 'optionalAccess', _160 => _160.usageType]) === "metered" ? t("billing.admin.prices.usage.metered") : t("billing.admin.prices.usage.licensed")
|
|
@@ -3912,24 +3933,24 @@ function PriceDetails() {
|
|
|
3912
3933
|
] })
|
|
3913
3934
|
] }),
|
|
3914
3935
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
3915
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3936
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.SectionHeader, { children: t("billing.admin.prices.fields.platformFeatures") }),
|
|
3916
3937
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
3917
3938
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3918
|
-
|
|
3939
|
+
_chunk5AKDE5UWjs.DetailField,
|
|
3919
3940
|
{
|
|
3920
3941
|
label: t("billing.admin.prices.fields.token"),
|
|
3921
3942
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _nullishCoalesce(price.token, () => ( "\u2014")) })
|
|
3922
3943
|
}
|
|
3923
3944
|
),
|
|
3924
3945
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3925
|
-
|
|
3946
|
+
_chunk5AKDE5UWjs.DetailField,
|
|
3926
3947
|
{
|
|
3927
3948
|
label: t("billing.admin.prices.fields.stripeId"),
|
|
3928
3949
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: price.stripePriceId })
|
|
3929
3950
|
}
|
|
3930
3951
|
),
|
|
3931
3952
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3932
|
-
|
|
3953
|
+
_chunk5AKDE5UWjs.DetailField,
|
|
3933
3954
|
{
|
|
3934
3955
|
label: t("billing.admin.prices.fields.description"),
|
|
3935
3956
|
value: _nullishCoalesce(price.description, () => ( "\u2014")),
|
|
@@ -3937,7 +3958,7 @@ function PriceDetails() {
|
|
|
3937
3958
|
}
|
|
3938
3959
|
),
|
|
3939
3960
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3940
|
-
|
|
3961
|
+
_chunk5AKDE5UWjs.DetailField,
|
|
3941
3962
|
{
|
|
3942
3963
|
label: t("billing.admin.prices.fields.features"),
|
|
3943
3964
|
className: "md:col-span-2",
|
|
@@ -3945,11 +3966,11 @@ function PriceDetails() {
|
|
|
3945
3966
|
}
|
|
3946
3967
|
),
|
|
3947
3968
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3948
|
-
|
|
3969
|
+
_chunk5AKDE5UWjs.DetailField,
|
|
3949
3970
|
{
|
|
3950
3971
|
label: t("billing.admin.prices.fields.platformFeatures"),
|
|
3951
3972
|
className: "md:col-span-2",
|
|
3952
|
-
value: price.priceFeatures.length > 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "flex flex-wrap items-center gap-1", children: price.priceFeatures.map((feature) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3973
|
+
value: price.priceFeatures.length > 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "flex flex-wrap items-center gap-1", children: price.priceFeatures.map((feature) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Badge, { variant: "softGray", children: feature.name }, feature.id)) }) : "\u2014"
|
|
3953
3974
|
}
|
|
3954
3975
|
)
|
|
3955
3976
|
] })
|
|
@@ -3963,7 +3984,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, PriceDetails, "PriceDetails");
|
|
|
3963
3984
|
function PriceContainer() {
|
|
3964
3985
|
const { price } = usePriceContext();
|
|
3965
3986
|
if (!price) return null;
|
|
3966
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3987
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.RoundPageContainer, { module: _chunkYKFXQOQAjs.Modules.StripePrice, id: price.id, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceDetails, {}) });
|
|
3967
3988
|
}
|
|
3968
3989
|
_chunk7QVYU63Ejs.__name.call(void 0, PriceContainer, "PriceContainer");
|
|
3969
3990
|
|
|
@@ -3975,17 +3996,17 @@ _chunk7QVYU63Ejs.__name.call(void 0, PriceContainer, "PriceContainer");
|
|
|
3975
3996
|
function PricesList({ productId, fullWidth }) {
|
|
3976
3997
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
3977
3998
|
const { priceVersion } = usePriceContext();
|
|
3978
|
-
const data =
|
|
3979
|
-
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) =>
|
|
3999
|
+
const data = _chunk5AKDE5UWjs.useDataListRetriever.call(void 0, {
|
|
4000
|
+
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunkYKFXQOQAjs.StripePriceService.listPrices({ ...params, productId }), "retriever"),
|
|
3980
4001
|
retrieverParams: {},
|
|
3981
|
-
module:
|
|
4002
|
+
module: _chunkYKFXQOQAjs.Modules.StripePrice
|
|
3982
4003
|
});
|
|
3983
4004
|
_react.useEffect.call(void 0, () => {
|
|
3984
4005
|
if (priceVersion > 0) void data.refresh();
|
|
3985
4006
|
}, [priceVersion]);
|
|
3986
4007
|
const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceEditor, { productId }, "create-price")];
|
|
3987
4008
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3988
|
-
|
|
4009
|
+
_chunk5AKDE5UWjs.ContentListTable,
|
|
3989
4010
|
{
|
|
3990
4011
|
data,
|
|
3991
4012
|
fields: [
|
|
@@ -3995,12 +4016,12 @@ function PricesList({ productId, fullWidth }) {
|
|
|
3995
4016
|
"token" /* token */,
|
|
3996
4017
|
"status" /* status */
|
|
3997
4018
|
],
|
|
3998
|
-
tableGeneratorType:
|
|
4019
|
+
tableGeneratorType: _chunkYKFXQOQAjs.Modules.StripePrice,
|
|
3999
4020
|
functions,
|
|
4000
4021
|
fullWidth,
|
|
4001
4022
|
title: t("billing.admin.prices.title"),
|
|
4002
4023
|
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4003
|
-
|
|
4024
|
+
_chunk5AKDE5UWjs.EmptyState,
|
|
4004
4025
|
{
|
|
4005
4026
|
icon: _lucidereact.DollarSignIcon,
|
|
4006
4027
|
title: t("billing.admin.prices.empty.title"),
|
|
@@ -4023,18 +4044,18 @@ function ProductDetails() {
|
|
|
4023
4044
|
const { product } = useProductContext();
|
|
4024
4045
|
if (!product) return null;
|
|
4025
4046
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4026
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4047
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.SectionHeader, { children: t("billing.admin.products.tabs.details") }),
|
|
4027
4048
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
4028
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4049
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.DetailField, { label: t("billing.admin.products.fields.name"), value: product.name }),
|
|
4029
4050
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4030
|
-
|
|
4051
|
+
_chunk5AKDE5UWjs.DetailField,
|
|
4031
4052
|
{
|
|
4032
4053
|
label: t("billing.admin.products.fields.status"),
|
|
4033
|
-
value: product.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4054
|
+
value: product.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Badge, { variant: "softGreen", children: t("billing.admin.products.status.active") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.Badge, { variant: "softGray", children: t("billing.admin.products.status.archived") })
|
|
4034
4055
|
}
|
|
4035
4056
|
),
|
|
4036
4057
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4037
|
-
|
|
4058
|
+
_chunk5AKDE5UWjs.DetailField,
|
|
4038
4059
|
{
|
|
4039
4060
|
label: t("billing.admin.products.fields.description"),
|
|
4040
4061
|
value: _nullishCoalesce(product.description, () => ( "\u2014")),
|
|
@@ -4042,14 +4063,14 @@ function ProductDetails() {
|
|
|
4042
4063
|
}
|
|
4043
4064
|
),
|
|
4044
4065
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4045
|
-
|
|
4066
|
+
_chunk5AKDE5UWjs.DetailField,
|
|
4046
4067
|
{
|
|
4047
4068
|
label: t("billing.admin.products.fields.prices"),
|
|
4048
4069
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: product.stripePrices.length })
|
|
4049
4070
|
}
|
|
4050
4071
|
),
|
|
4051
4072
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4052
|
-
|
|
4073
|
+
_chunk5AKDE5UWjs.DetailField,
|
|
4053
4074
|
{
|
|
4054
4075
|
label: t("billing.admin.products.fields.stripeId"),
|
|
4055
4076
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: product.stripeProductId })
|
|
@@ -4067,9 +4088,9 @@ function ProductContainer() {
|
|
|
4067
4088
|
const { product } = useProductContext();
|
|
4068
4089
|
if (!product) return null;
|
|
4069
4090
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4070
|
-
|
|
4091
|
+
_chunk5AKDE5UWjs.RoundPageContainer,
|
|
4071
4092
|
{
|
|
4072
|
-
module:
|
|
4093
|
+
module: _chunkYKFXQOQAjs.Modules.StripeProduct,
|
|
4073
4094
|
id: product.id,
|
|
4074
4095
|
tabs: [
|
|
4075
4096
|
{
|
|
@@ -4078,7 +4099,7 @@ function ProductContainer() {
|
|
|
4078
4099
|
content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductDetails, {})
|
|
4079
4100
|
},
|
|
4080
4101
|
{
|
|
4081
|
-
key:
|
|
4102
|
+
key: _chunkYKFXQOQAjs.Modules.StripePrice,
|
|
4082
4103
|
label: t("billing.admin.prices.title"),
|
|
4083
4104
|
// publishChrome={false}: SharedProvider REPLACES its value for the
|
|
4084
4105
|
// subtree (SharedContext.tsx:35-37), so a nested provider publishing
|
|
@@ -4102,26 +4123,26 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductContainer, "ProductContainer");
|
|
|
4102
4123
|
function ProductsList({ fullWidth } = {}) {
|
|
4103
4124
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4104
4125
|
const { catalogueVersion } = useProductContext();
|
|
4105
|
-
const data =
|
|
4106
|
-
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) =>
|
|
4126
|
+
const data = _chunk5AKDE5UWjs.useDataListRetriever.call(void 0, {
|
|
4127
|
+
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunkYKFXQOQAjs.StripeProductService.listProducts(params), "retriever"),
|
|
4107
4128
|
retrieverParams: {},
|
|
4108
|
-
module:
|
|
4129
|
+
module: _chunkYKFXQOQAjs.Modules.StripeProduct
|
|
4109
4130
|
});
|
|
4110
4131
|
_react.useEffect.call(void 0, () => {
|
|
4111
4132
|
if (catalogueVersion > 0) void data.refresh();
|
|
4112
4133
|
}, [catalogueVersion]);
|
|
4113
4134
|
const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductEditor, {}, "create-product")];
|
|
4114
4135
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4115
|
-
|
|
4136
|
+
_chunk5AKDE5UWjs.ContentListTable,
|
|
4116
4137
|
{
|
|
4117
4138
|
data,
|
|
4118
4139
|
fields: ["name" /* name */, "status" /* status */, "prices" /* prices */],
|
|
4119
|
-
tableGeneratorType:
|
|
4140
|
+
tableGeneratorType: _chunkYKFXQOQAjs.Modules.StripeProduct,
|
|
4120
4141
|
functions,
|
|
4121
4142
|
fullWidth,
|
|
4122
4143
|
title: t("billing.admin.products.title"),
|
|
4123
4144
|
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4124
|
-
|
|
4145
|
+
_chunk5AKDE5UWjs.EmptyState,
|
|
4125
4146
|
{
|
|
4126
4147
|
icon: _lucidereact.PackageIcon,
|
|
4127
4148
|
title: t("billing.admin.products.empty.title"),
|
|
@@ -4136,7 +4157,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductsList, "ProductsList");
|
|
|
4136
4157
|
// src/features/billing/stripe-product/components/containers/ProductsListContainer.tsx
|
|
4137
4158
|
|
|
4138
4159
|
function ProductsListContainer() {
|
|
4139
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductProvider, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4160
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductProvider, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5AKDE5UWjs.RoundPageContainer, { module: _chunkYKFXQOQAjs.Modules.StripeProduct, fullWidth: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductsList, { fullWidth: true }) }) });
|
|
4140
4161
|
}
|
|
4141
4162
|
_chunk7QVYU63Ejs.__name.call(void 0, ProductsListContainer, "ProductsListContainer");
|
|
4142
4163
|
|
|
@@ -4194,5 +4215,5 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductsListContainer, "ProductsListContain
|
|
|
4194
4215
|
|
|
4195
4216
|
|
|
4196
4217
|
|
|
4197
|
-
exports.BillingAlertBanner = BillingAlertBanner; exports.BillingDashboardContainer = BillingDashboardContainer; exports.BillingDetailModal = BillingDetailModal; exports.BillingUsageSummaryCard = BillingUsageSummaryCard; exports.CancelSubscriptionDialog = CancelSubscriptionDialog; exports.CustomerInfoCard = CustomerInfoCard; exports.IntervalToggle = IntervalToggle; exports.InvoiceDetails = InvoiceDetails; exports.InvoiceStatusBadge = InvoiceStatusBadge; exports.InvoicesContainer = InvoicesContainer; exports.InvoicesList = InvoicesList; exports.InvoicesSummaryCard = InvoicesSummaryCard; exports.PaymentMethodCard = PaymentMethodCard; exports.PaymentMethodEditor = PaymentMethodEditor; exports.PaymentMethodForm = PaymentMethodForm; exports.PaymentMethodSummaryCard = PaymentMethodSummaryCard; exports.PaymentMethodsContainer = PaymentMethodsContainer; exports.PaymentMethodsList = PaymentMethodsList; exports.PriceArchiver = PriceArchiver; exports.PriceContainer = PriceContainer; exports.PriceDetails = PriceDetails; exports.PriceEditor = PriceEditor; exports.PriceProvider = PriceProvider; exports.PricesList = PricesList; exports.PricingCard = PricingCard; exports.ProductArchiver = ProductArchiver; exports.ProductContainer = ProductContainer; exports.ProductDetails = ProductDetails; exports.ProductEditor = ProductEditor; exports.ProductPricingList = ProductPricingList; exports.ProductPricingRow = ProductPricingRow; exports.ProductProvider = ProductProvider; exports.ProductsList = ProductsList; exports.ProductsListContainer = ProductsListContainer; exports.PromoCodeInput = PromoCodeInput; exports.ProrationPreview = ProrationPreview; exports.StripeProvider = StripeProvider; exports.SubscriptionConfirmation = SubscriptionConfirmation; exports.SubscriptionDetails = SubscriptionDetails; exports.SubscriptionStatusBadge = SubscriptionStatusBadge; exports.SubscriptionSummaryCard = SubscriptionSummaryCard; exports.SubscriptionsContainer = SubscriptionsContainer; exports.SubscriptionsList = SubscriptionsList; exports.UsageContainer = UsageContainer; exports.UsageHistoryTable = UsageHistoryTable; exports.UsageSummaryCard = UsageSummaryCard; exports.UsageSummaryCards = UsageSummaryCards; exports.formatCurrency =
|
|
4218
|
+
exports.BillingAlertBanner = BillingAlertBanner; exports.BillingDashboardContainer = BillingDashboardContainer; exports.BillingDetailModal = BillingDetailModal; exports.BillingUsageSummaryCard = BillingUsageSummaryCard; exports.CancelSubscriptionDialog = CancelSubscriptionDialog; exports.CustomerInfoCard = CustomerInfoCard; exports.IntervalToggle = IntervalToggle; exports.InvoiceDetails = InvoiceDetails; exports.InvoiceStatusBadge = InvoiceStatusBadge; exports.InvoicesContainer = InvoicesContainer; exports.InvoicesList = InvoicesList; exports.InvoicesSummaryCard = InvoicesSummaryCard; exports.PaymentMethodCard = PaymentMethodCard; exports.PaymentMethodEditor = PaymentMethodEditor; exports.PaymentMethodForm = PaymentMethodForm; exports.PaymentMethodSummaryCard = PaymentMethodSummaryCard; exports.PaymentMethodsContainer = PaymentMethodsContainer; exports.PaymentMethodsList = PaymentMethodsList; exports.PriceArchiver = PriceArchiver; exports.PriceContainer = PriceContainer; exports.PriceDetails = PriceDetails; exports.PriceEditor = PriceEditor; exports.PriceProvider = PriceProvider; exports.PricesList = PricesList; exports.PricingCard = PricingCard; exports.ProductArchiver = ProductArchiver; exports.ProductContainer = ProductContainer; exports.ProductDetails = ProductDetails; exports.ProductEditor = ProductEditor; exports.ProductPricingList = ProductPricingList; exports.ProductPricingRow = ProductPricingRow; exports.ProductProvider = ProductProvider; exports.ProductsList = ProductsList; exports.ProductsListContainer = ProductsListContainer; exports.PromoCodeInput = PromoCodeInput; exports.ProrationPreview = ProrationPreview; exports.StripeProvider = StripeProvider; exports.SubscriptionConfirmation = SubscriptionConfirmation; exports.SubscriptionDetails = SubscriptionDetails; exports.SubscriptionStatusBadge = SubscriptionStatusBadge; exports.SubscriptionSummaryCard = SubscriptionSummaryCard; exports.SubscriptionsContainer = SubscriptionsContainer; exports.SubscriptionsList = SubscriptionsList; exports.UsageContainer = UsageContainer; exports.UsageHistoryTable = UsageHistoryTable; exports.UsageSummaryCard = UsageSummaryCard; exports.UsageSummaryCards = UsageSummaryCards; exports.formatCurrency = _chunk5AKDE5UWjs.formatCurrency; exports.formatDate = formatDate3; exports.formatInterval = _chunk5AKDE5UWjs.formatInterval; exports.isStripeConfigured = isStripeConfigured; exports.priceLabel = priceLabel; exports.usePriceContext = usePriceContext; exports.useProductContext = useProductContext;
|
|
4198
4219
|
//# sourceMappingURL=index.js.map
|