@carlonicora/nextjs-jsonapi 6.29.1 → 6.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{BlockNoteEditor-K4HWQLPJ.js → BlockNoteEditor-FTRTY4YJ.js} +15 -15
- package/dist/{BlockNoteEditor-K4HWQLPJ.js.map → BlockNoteEditor-FTRTY4YJ.js.map} +1 -1
- package/dist/{BlockNoteEditor-TDX2RC7I.mjs → BlockNoteEditor-SQQF7OCY.mjs} +2 -2
- package/dist/billing/index.js +378 -378
- package/dist/billing/index.mjs +1 -1
- package/dist/{chunk-OVSR72CZ.mjs → chunk-MNN6MTEN.mjs} +183 -178
- package/dist/{chunk-QI4SCGPB.js.map → chunk-MNN6MTEN.mjs.map} +1 -1
- package/dist/{chunk-QI4SCGPB.js → chunk-S4FSGMKX.js} +9 -4
- package/dist/chunk-S4FSGMKX.js.map +1 -0
- package/dist/client/index.js +2 -2
- package/dist/client/index.mjs +1 -1
- package/dist/components/forms/CommonEditorButtons.d.ts.map +1 -1
- package/dist/components/index.js +2 -2
- package/dist/components/index.mjs +1 -1
- package/dist/contexts/index.js +2 -2
- package/dist/contexts/index.mjs +1 -1
- package/dist/email-automations/index.js +78 -78
- package/dist/email-automations/index.mjs +1 -1
- package/dist/features/analytics/index.js +107 -107
- package/dist/features/analytics/index.mjs +1 -1
- package/dist/features/blog/index.js +93 -93
- package/dist/features/blog/index.mjs +1 -1
- package/dist/features/help/index.js +31 -31
- package/dist/features/help/index.mjs +1 -1
- package/dist/features/tokenusage/index.js +102 -102
- package/dist/features/tokenusage/index.mjs +1 -1
- package/messages/en.json +1 -0
- package/messages/it.json +1 -0
- package/package.json +1 -1
- package/src/components/forms/CommonEditorButtons.tsx +16 -2
- package/dist/chunk-OVSR72CZ.mjs.map +0 -1
- /package/dist/{BlockNoteEditor-TDX2RC7I.mjs.map → BlockNoteEditor-SQQF7OCY.mjs.map} +0 -0
package/dist/billing/index.js
CHANGED
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
|
|
82
82
|
|
|
83
83
|
|
|
84
|
-
var
|
|
84
|
+
var _chunkS4FSGMKXjs = require('../chunk-S4FSGMKX.js');
|
|
85
85
|
require('../chunk-SYMI4IDW.js');
|
|
86
86
|
require('../chunk-3EPNHTMH.js');
|
|
87
87
|
|
|
@@ -169,43 +169,43 @@ function SubscriptionSummaryCard({
|
|
|
169
169
|
onManageClick
|
|
170
170
|
}) {
|
|
171
171
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
172
|
-
const fmt =
|
|
172
|
+
const fmt = _chunkS4FSGMKXjs.useBillingFormatOptions.call(void 0, );
|
|
173
173
|
if (loading) {
|
|
174
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
175
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
176
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
174
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.Card, { children: [
|
|
175
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
176
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.CardTitle, { children: t("billing.ui.subscriptions.title") }),
|
|
177
177
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
178
178
|
] }),
|
|
179
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
180
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
181
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
182
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
179
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.CardContent, { children: [
|
|
180
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
181
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Skeleton, { className: "h-4 w-24 mb-1" }),
|
|
182
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Skeleton, { className: "h-4 w-40" })
|
|
183
183
|
] })
|
|
184
184
|
] });
|
|
185
185
|
}
|
|
186
186
|
if (error) {
|
|
187
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
188
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
189
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
187
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.Card, { children: [
|
|
188
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
189
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.CardTitle, { children: t("billing.ui.subscriptions.title") }),
|
|
190
190
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
191
191
|
] }),
|
|
192
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
192
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
193
193
|
] });
|
|
194
194
|
}
|
|
195
195
|
const activeSubscriptions = subscriptions.filter(
|
|
196
196
|
(sub) => sub.status === "active" /* ACTIVE */ || sub.status === "trialing" /* TRIALING */ || sub.status === "past_due" /* PAST_DUE */
|
|
197
197
|
);
|
|
198
198
|
const primarySubscription = activeSubscriptions[0];
|
|
199
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
200
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
201
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
199
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
|
|
200
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
201
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.CardTitle, { children: t("billing.ui.subscriptions.title") }),
|
|
202
202
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
203
203
|
] }),
|
|
204
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
204
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.CardContent, { children: !primarySubscription ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
205
205
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: t("billing.ui.cards.subscriptions.empty_title") }),
|
|
206
206
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.subscriptions.empty_description") }),
|
|
207
207
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
208
|
-
|
|
208
|
+
_chunkS4FSGMKXjs.Button,
|
|
209
209
|
{
|
|
210
210
|
variant: "outline",
|
|
211
211
|
size: "sm",
|
|
@@ -223,8 +223,8 @@ function SubscriptionSummaryCard({
|
|
|
223
223
|
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
224
224
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
225
225
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: formatPlanName(primarySubscription, t("billing.ui.cards.subscriptions.fallback_name")) }),
|
|
226
|
-
primarySubscription.status === "past_due" /* PAST_DUE */ ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
227
|
-
|
|
226
|
+
primarySubscription.status === "past_due" /* PAST_DUE */ ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Badge, { variant: "softRed", children: t("billing.ui.cards.subscriptions.payment_failing") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
227
|
+
_chunkS4FSGMKXjs.Badge,
|
|
228
228
|
{
|
|
229
229
|
variant: primarySubscription.cancelAtPeriodEnd ? "secondary" : getStatusBadgeVariant(primarySubscription.status),
|
|
230
230
|
children: primarySubscription.cancelAtPeriodEnd ? t("billing.ui.cards.subscriptions.canceling") : SUBSCRIPTION_STATUSES.includes(primarySubscription.status) ? t(`billing.ui.subscription_status.${primarySubscription.status}`) : primarySubscription.status
|
|
@@ -232,11 +232,11 @@ function SubscriptionSummaryCard({
|
|
|
232
232
|
)
|
|
233
233
|
] }),
|
|
234
234
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: !_optionalChain([primarySubscription, 'access', _8 => _8.price, 'optionalAccess', _9 => _9.isTrial]) ? t("billing.ui.cards.subscriptions.ends_on", {
|
|
235
|
-
date:
|
|
235
|
+
date: _chunkS4FSGMKXjs.formatDate.call(void 0, primarySubscription.currentPeriodEnd, fmt)
|
|
236
236
|
}) : primarySubscription.cancelAtPeriodEnd ? t("billing.ui.cards.subscriptions.cancels_on", {
|
|
237
|
-
date:
|
|
237
|
+
date: _chunkS4FSGMKXjs.formatDate.call(void 0, primarySubscription.currentPeriodEnd, fmt)
|
|
238
238
|
}) : t("billing.ui.cards.subscriptions.renews_on", {
|
|
239
|
-
date:
|
|
239
|
+
date: _chunkS4FSGMKXjs.formatDate.call(void 0, primarySubscription.currentPeriodEnd, fmt)
|
|
240
240
|
}) }),
|
|
241
241
|
activeSubscriptions.length > 1 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.subscriptions.more", { count: activeSubscriptions.length - 1 }) })
|
|
242
242
|
] }) })
|
|
@@ -270,37 +270,37 @@ function PaymentMethodSummaryCard({
|
|
|
270
270
|
}) {
|
|
271
271
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
272
272
|
if (loading) {
|
|
273
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
274
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
275
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
273
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.Card, { children: [
|
|
274
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
275
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.CardTitle, { children: t("billing.ui.payment_method.title") }),
|
|
276
276
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
277
277
|
] }),
|
|
278
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
279
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
280
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
278
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.CardContent, { children: [
|
|
279
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
280
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Skeleton, { className: "h-4 w-24" })
|
|
281
281
|
] })
|
|
282
282
|
] });
|
|
283
283
|
}
|
|
284
284
|
if (error) {
|
|
285
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
286
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
287
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
285
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.Card, { children: [
|
|
286
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
287
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.CardTitle, { children: t("billing.ui.payment_method.title") }),
|
|
288
288
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
289
289
|
] }),
|
|
290
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
290
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
291
291
|
] });
|
|
292
292
|
}
|
|
293
293
|
const defaultMethod = paymentMethods.find((pm) => pm.id === defaultPaymentMethodId) || paymentMethods[0];
|
|
294
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
295
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
296
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
294
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
|
|
295
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
296
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.CardTitle, { children: t("billing.ui.payment_method.title") }),
|
|
297
297
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
298
298
|
] }),
|
|
299
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
299
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.CardContent, { children: paymentMethods.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
300
300
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: t("billing.ui.cards.payment_method.empty_title") }),
|
|
301
301
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.payment_method.empty_description") }),
|
|
302
302
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
303
|
-
|
|
303
|
+
_chunkS4FSGMKXjs.Button,
|
|
304
304
|
{
|
|
305
305
|
variant: "outline",
|
|
306
306
|
size: "sm",
|
|
@@ -364,45 +364,45 @@ function CustomerInfoCard({ customer, loading, error }) {
|
|
|
364
364
|
}
|
|
365
365
|
}, "handlePortalClick");
|
|
366
366
|
if (loading) {
|
|
367
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
368
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
369
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
367
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.Card, { children: [
|
|
368
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
369
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.CardTitle, { children: t("billing.ui.cards.customer.title") }),
|
|
370
370
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
371
371
|
] }),
|
|
372
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
373
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
374
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
375
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
372
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.CardContent, { children: [
|
|
373
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
374
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Skeleton, { className: "h-4 w-48 mb-1" }),
|
|
375
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Skeleton, { className: "h-4 w-24" })
|
|
376
376
|
] })
|
|
377
377
|
] });
|
|
378
378
|
}
|
|
379
379
|
if (error) {
|
|
380
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
381
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
382
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
380
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.Card, { children: [
|
|
381
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
382
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.CardTitle, { children: t("billing.ui.cards.customer.title") }),
|
|
383
383
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
384
384
|
] }),
|
|
385
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
385
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
386
386
|
] });
|
|
387
387
|
}
|
|
388
388
|
if (!customer) {
|
|
389
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
390
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
391
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
389
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.Card, { children: [
|
|
390
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
391
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.CardTitle, { children: t("billing.ui.cards.customer.title") }),
|
|
392
392
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
393
393
|
] }),
|
|
394
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
394
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.CardContent, { children: [
|
|
395
395
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: t("billing.ui.cards.customer.not_set_up") }),
|
|
396
396
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.customer.not_set_up_description") })
|
|
397
397
|
] })
|
|
398
398
|
] });
|
|
399
399
|
}
|
|
400
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
401
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
402
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
400
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.Card, { children: [
|
|
401
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
402
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.CardTitle, { children: t("billing.ui.cards.customer.title") }),
|
|
403
403
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
404
404
|
] }),
|
|
405
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
405
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
406
406
|
customer.name && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: customer.name }),
|
|
407
407
|
customer.email && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: customer.email }),
|
|
408
408
|
customer.balance !== void 0 && customer.balance !== 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm", children: [
|
|
@@ -412,7 +412,7 @@ function CustomerInfoCard({ customer, loading, error }) {
|
|
|
412
412
|
] }),
|
|
413
413
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: customer.balance < 0 ? "text-success" : "text-destructive", children: formatBalance(customer.balance, customer.currency, locale) })
|
|
414
414
|
] }),
|
|
415
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
415
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.Button, { variant: "outline", size: "sm", className: "mt-2", onClick: handlePortalClick, disabled: portalLoading, children: [
|
|
416
416
|
portalLoading ? t("common.loading") : t("billing.ui.cards.customer.manage_portal"),
|
|
417
417
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ExternalLink, { className: "h-4 w-4 ms-1" })
|
|
418
418
|
] })
|
|
@@ -450,46 +450,46 @@ function formatAmount(amount, currency, locale) {
|
|
|
450
450
|
_chunk7QVYU63Ejs.__name.call(void 0, formatAmount, "formatAmount");
|
|
451
451
|
function InvoicesSummaryCard({ invoices, loading, error, onViewAllClick }) {
|
|
452
452
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
453
|
-
const fmt =
|
|
453
|
+
const fmt = _chunkS4FSGMKXjs.useBillingFormatOptions.call(void 0, );
|
|
454
454
|
if (loading) {
|
|
455
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
456
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
457
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
455
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.Card, { children: [
|
|
456
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
457
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.CardTitle, { children: t("billing.ui.cards.invoices.title") }),
|
|
458
458
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
459
459
|
] }),
|
|
460
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
461
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
462
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
463
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
460
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.CardContent, { children: [
|
|
461
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Skeleton, { className: "h-6 w-24 mb-2" }),
|
|
462
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Skeleton, { className: "h-4 w-32 mb-1" }),
|
|
463
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Skeleton, { className: "h-4 w-20" })
|
|
464
464
|
] })
|
|
465
465
|
] });
|
|
466
466
|
}
|
|
467
467
|
if (error) {
|
|
468
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
469
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
470
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
468
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.Card, { children: [
|
|
469
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
470
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.CardTitle, { children: t("billing.ui.cards.invoices.title") }),
|
|
471
471
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
472
472
|
] }),
|
|
473
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
473
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
474
474
|
] });
|
|
475
475
|
}
|
|
476
476
|
const latestInvoice = _nullishCoalesce(invoices.find((inv) => inv.status !== "void" /* VOID */), () => ( invoices[0]));
|
|
477
477
|
const paidInvoices = invoices.filter((inv) => inv.status === "paid" /* PAID */);
|
|
478
478
|
const openInvoices = invoices.filter((inv) => inv.status === "open" /* OPEN */);
|
|
479
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
480
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
481
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
479
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewAllClick, children: [
|
|
480
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
481
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.CardTitle, { children: t("billing.ui.cards.invoices.title") }),
|
|
482
482
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
483
483
|
] }),
|
|
484
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
484
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.CardContent, { children: invoices.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
485
485
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: t("billing.ui.invoices.empty_title") }),
|
|
486
486
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.invoices.empty_description") })
|
|
487
487
|
] }) : latestInvoice ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
488
488
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
489
489
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: formatAmount(latestInvoice.total, latestInvoice.currency, fmt.locale) }),
|
|
490
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
490
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Badge, { variant: getStatusBadgeVariant2(latestInvoice.status), children: INVOICE_STATUSES.includes(latestInvoice.status) ? t(`billing.ui.invoice_status.${latestInvoice.status}`) : latestInvoice.status })
|
|
491
491
|
] }),
|
|
492
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: latestInvoice.stripeInvoiceNumber || t("billing.ui.cards.invoices.invoice_from", { date:
|
|
492
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: latestInvoice.stripeInvoiceNumber || t("billing.ui.cards.invoices.invoice_from", { date: _chunkS4FSGMKXjs.formatDate.call(void 0, latestInvoice.periodStart, fmt) }) }),
|
|
493
493
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-4 text-xs text-muted-foreground", children: [
|
|
494
494
|
paidInvoices.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: t("billing.ui.cards.invoices.paid_count", { count: paidInvoices.length }) }),
|
|
495
495
|
openInvoices.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-warning", children: t("billing.ui.cards.invoices.open_count", { count: openInvoices.length }) }),
|
|
@@ -524,24 +524,24 @@ function BillingUsageSummaryCard({
|
|
|
524
524
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
525
525
|
const locale = _chunkNP3AFULUjs.useI18nLocale.call(void 0, );
|
|
526
526
|
if (loading) {
|
|
527
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
528
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
529
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
527
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.Card, { children: [
|
|
528
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
529
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.CardTitle, { children: t("billing.ui.cards.usage.title") }),
|
|
530
530
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
531
531
|
] }),
|
|
532
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
533
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
534
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
532
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.CardContent, { children: [
|
|
533
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Skeleton, { className: "h-6 w-24 mb-2" }),
|
|
534
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Skeleton, { className: "h-4 w-32" })
|
|
535
535
|
] })
|
|
536
536
|
] });
|
|
537
537
|
}
|
|
538
538
|
if (error) {
|
|
539
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
540
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
541
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
539
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.Card, { children: [
|
|
540
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
541
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.CardTitle, { children: t("billing.ui.cards.usage.title") }),
|
|
542
542
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
543
543
|
] }),
|
|
544
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
544
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
545
545
|
] });
|
|
546
546
|
}
|
|
547
547
|
const totalUsage = Object.values(summaries).reduce((acc, summary) => {
|
|
@@ -549,12 +549,12 @@ function BillingUsageSummaryCard({
|
|
|
549
549
|
}, 0);
|
|
550
550
|
const primaryMeter = meters.find((m) => _optionalChain([summaries, 'access', _17 => _17[m.id], 'optionalAccess', _18 => _18.aggregatedValue]));
|
|
551
551
|
const primarySummary = primaryMeter ? summaries[primaryMeter.id] : null;
|
|
552
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
553
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
554
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
552
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewDetailsClick, children: [
|
|
553
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
554
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.CardTitle, { children: t("billing.ui.cards.usage.title") }),
|
|
555
555
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
556
556
|
] }),
|
|
557
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
557
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.CardContent, { children: meters.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
558
558
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: t("billing.ui.cards.usage.no_meters") }),
|
|
559
559
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.usage.no_meters_description") })
|
|
560
560
|
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
@@ -665,7 +665,7 @@ function PaymentMethodForm({
|
|
|
665
665
|
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: t("billing.ui.payment_form.loading") }) });
|
|
666
666
|
}
|
|
667
667
|
if (!setupIntent && error) {
|
|
668
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
668
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.AlertDescription, { children: error }) });
|
|
669
669
|
}
|
|
670
670
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: handleSubmit, className: "flex flex-col gap-y-4", children: [
|
|
671
671
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rounded-md border border-gray-300 p-3", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -689,19 +689,19 @@ function PaymentMethodForm({
|
|
|
689
689
|
) }),
|
|
690
690
|
!alwaysSetDefault && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
691
691
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
692
|
-
|
|
692
|
+
_chunkS4FSGMKXjs.Checkbox,
|
|
693
693
|
{
|
|
694
694
|
id: "setAsDefault",
|
|
695
695
|
checked: setAsDefault,
|
|
696
696
|
onCheckedChange: (checked) => setSetAsDefault(!!checked)
|
|
697
697
|
}
|
|
698
698
|
),
|
|
699
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
699
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Label, { htmlFor: "setAsDefault", className: "cursor-pointer font-normal", children: t("billing.ui.payment_form.set_default") })
|
|
700
700
|
] }),
|
|
701
|
-
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
701
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.AlertDescription, { children: error }) }),
|
|
702
702
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-x-2", children: [
|
|
703
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
704
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
703
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Button, { type: "button", variant: "outline", onClick: onCancel, disabled: isSubmitting || isLoading, children: t("ui.buttons.cancel") }),
|
|
704
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Button, { type: "submit", disabled: !stripe || isSubmitting || isLoading, children: isSubmitting ? t("billing.ui.wizard.review.processing") : t("billing.ui.cards.payment_method.add_card") })
|
|
705
705
|
] })
|
|
706
706
|
] });
|
|
707
707
|
}
|
|
@@ -718,10 +718,10 @@ function PaymentMethodEditor({ open, onOpenChange, onSuccess }) {
|
|
|
718
718
|
const handleCancel = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
719
719
|
onOpenChange(false);
|
|
720
720
|
}, "handleCancel");
|
|
721
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
722
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
723
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
724
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
721
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.DialogContent, { className: "max-w-md", children: [
|
|
722
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.DialogHeader, { children: [
|
|
723
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.DialogTitle, { children: t("billing.ui.payment_methods.add") }),
|
|
724
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.DialogDescription, { children: t("billing.ui.payment_methods.add_description") })
|
|
725
725
|
] }),
|
|
726
726
|
open && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodForm, { onSuccess: handleSuccess, onCancel: handleCancel })
|
|
727
727
|
] }) });
|
|
@@ -784,16 +784,16 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
784
784
|
}
|
|
785
785
|
}, "handleRemove");
|
|
786
786
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
787
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
788
|
-
isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
789
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
787
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.Card, { className: "relative", children: [
|
|
788
|
+
isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Badge, { variant: "softGreen", className: "absolute end-2 top-2", children: t("billing.ui.payment_methods.default") }),
|
|
789
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.CardHeader, { className: "flex flex-row items-center justify-between pb-2", children: [
|
|
790
790
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
791
791
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-2xl", children: brandIcon }),
|
|
792
792
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium capitalize", children: brand })
|
|
793
793
|
] }),
|
|
794
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
795
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
796
|
-
|
|
794
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.DropdownMenu, { children: [
|
|
795
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.DropdownMenuTrigger, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
796
|
+
_chunkS4FSGMKXjs.Button,
|
|
797
797
|
{
|
|
798
798
|
render: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {}),
|
|
799
799
|
nativeButton: false,
|
|
@@ -804,10 +804,10 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
804
804
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.MoreVertical, { className: "h-4 w-4" })
|
|
805
805
|
}
|
|
806
806
|
) }),
|
|
807
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
808
|
-
!isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
807
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.DropdownMenuContent, { align: "end", children: [
|
|
808
|
+
!isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.DropdownMenuItem, { onClick: handleSetDefault, disabled: loading, children: t("billing.ui.payment_methods.set_default") }),
|
|
809
809
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
810
|
-
|
|
810
|
+
_chunkS4FSGMKXjs.DropdownMenuItem,
|
|
811
811
|
{
|
|
812
812
|
onClick: () => setShowRemoveDialog(true),
|
|
813
813
|
disabled: loading,
|
|
@@ -818,7 +818,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
818
818
|
] })
|
|
819
819
|
] })
|
|
820
820
|
] }),
|
|
821
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
821
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-1", children: [
|
|
822
822
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-lg font-semibold", children: [
|
|
823
823
|
"\u2022\u2022\u2022\u2022 ",
|
|
824
824
|
last4
|
|
@@ -826,17 +826,17 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
826
826
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: t("billing.ui.payment_method.expires", { date: `${String(expMonth).padStart(2, "0")}/${expYear}` }) })
|
|
827
827
|
] }) })
|
|
828
828
|
] }),
|
|
829
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
830
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
831
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
832
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
829
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.AlertDialog, { open: showRemoveDialog, onOpenChange: setShowRemoveDialog, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.AlertDialogContent, { children: [
|
|
830
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.AlertDialogHeader, { children: [
|
|
831
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.AlertDialogTitle, { children: t("billing.ui.payment_methods.remove_title") }),
|
|
832
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.AlertDialogDescription, { children: [
|
|
833
833
|
t("billing.ui.payment_methods.remove_description"),
|
|
834
834
|
isDefault && ` ${t("billing.ui.payment_methods.remove_default_warning")}`
|
|
835
835
|
] })
|
|
836
836
|
] }),
|
|
837
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
838
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
839
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
837
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.AlertDialogFooter, { children: [
|
|
838
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.AlertDialogCancel, { disabled: loading, children: t("ui.buttons.cancel") }),
|
|
839
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.AlertDialogAction, { onClick: handleRemove, disabled: loading, className: "bg-red-600 hover:bg-red-700", children: loading ? t("billing.ui.payment_methods.removing") : t("ui.buttons.remove") })
|
|
840
840
|
] })
|
|
841
841
|
] }) })
|
|
842
842
|
] });
|
|
@@ -880,14 +880,14 @@ function PaymentMethodsContainer() {
|
|
|
880
880
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8" }),
|
|
881
881
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: t("billing.ui.payment_methods.title") })
|
|
882
882
|
] }),
|
|
883
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
883
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Button, { onClick: () => setShowAddPaymentMethod(true), children: t("billing.ui.payment_methods.add") })
|
|
884
884
|
] }),
|
|
885
885
|
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: [
|
|
886
886
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-16 w-16 text-muted-foreground" }),
|
|
887
887
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
888
888
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "mb-2 text-sm font-medium", children: t("billing.ui.payment_methods.empty_title") }),
|
|
889
889
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mb-4 text-muted-foreground", children: t("billing.ui.payment_methods.empty_description") }),
|
|
890
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
890
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Button, { onClick: () => setShowAddPaymentMethod(true), children: t("billing.ui.payment_methods.add_first") })
|
|
891
891
|
] })
|
|
892
892
|
] }),
|
|
893
893
|
paymentMethods.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodsList, { paymentMethods, onUpdate: loadPaymentMethods }),
|
|
@@ -943,7 +943,7 @@ var statusConfig = {
|
|
|
943
943
|
function InvoiceStatusBadge({ status }) {
|
|
944
944
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
945
945
|
const config = statusConfig[status] || statusConfig["draft" /* DRAFT */];
|
|
946
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
946
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Badge, { variant: config.variant, children: t(config.label) });
|
|
947
947
|
}
|
|
948
948
|
_chunk7QVYU63Ejs.__name.call(void 0, InvoiceStatusBadge, "InvoiceStatusBadge");
|
|
949
949
|
|
|
@@ -956,7 +956,7 @@ function InvoiceDetails({
|
|
|
956
956
|
onInvoiceChange: _onInvoiceChange
|
|
957
957
|
}) {
|
|
958
958
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
959
|
-
const fmt =
|
|
959
|
+
const fmt = _chunkS4FSGMKXjs.useBillingFormatOptions.call(void 0, );
|
|
960
960
|
const handleDownloadPDF = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
961
961
|
if (invoice.stripePdfUrl) {
|
|
962
962
|
window.open(invoice.stripePdfUrl, "_blank");
|
|
@@ -976,10 +976,10 @@ function InvoiceDetails({
|
|
|
976
976
|
return invoice.stripeInvoiceId.slice(-8);
|
|
977
977
|
}, "getInvoiceNumber");
|
|
978
978
|
const productName = _optionalChain([invoice, 'access', _29 => _29.subscription, 'optionalAccess', _30 => _30.price, 'optionalAccess', _31 => _31.product, 'optionalAccess', _32 => _32.name]) || t("billing.ui.cards.subscriptions.fallback_name");
|
|
979
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
980
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
981
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
982
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
979
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.DialogContent, { className: "max-w-2xl", children: [
|
|
980
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.DialogHeader, { children: [
|
|
981
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.DialogTitle, { children: t("billing.ui.invoice.title", { number: getInvoiceNumber() }) }),
|
|
982
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.DialogDescription, { children: _chunkS4FSGMKXjs.formatDate.call(void 0, invoice.periodStart, fmt) })
|
|
983
983
|
] }),
|
|
984
984
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
985
985
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
@@ -990,18 +990,18 @@ function InvoiceDetails({
|
|
|
990
990
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
991
991
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.billing_period") }),
|
|
992
992
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm", children: [
|
|
993
|
-
|
|
993
|
+
_chunkS4FSGMKXjs.formatDate.call(void 0, invoice.periodStart, fmt),
|
|
994
994
|
" - ",
|
|
995
|
-
|
|
995
|
+
_chunkS4FSGMKXjs.formatDate.call(void 0, invoice.periodEnd, fmt)
|
|
996
996
|
] })
|
|
997
997
|
] }),
|
|
998
998
|
invoice.dueDate && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
999
999
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.due_date") }),
|
|
1000
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm", children:
|
|
1000
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm", children: _chunkS4FSGMKXjs.formatDate.call(void 0, invoice.dueDate, fmt) })
|
|
1001
1001
|
] }),
|
|
1002
1002
|
invoice.paidAt && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
1003
1003
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.paid_date") }),
|
|
1004
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm", children:
|
|
1004
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm", children: _chunkS4FSGMKXjs.formatDate.call(void 0, invoice.paidAt, fmt) })
|
|
1005
1005
|
] }),
|
|
1006
1006
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
1007
1007
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.attempt_count") }),
|
|
@@ -1044,15 +1044,15 @@ function InvoiceDetails({
|
|
|
1044
1044
|
] })
|
|
1045
1045
|
] }),
|
|
1046
1046
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2 pt-4 border-t", children: [
|
|
1047
|
-
invoice.stripePdfUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1047
|
+
invoice.stripePdfUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.Button, { variant: "outline", onClick: handleDownloadPDF, children: [
|
|
1048
1048
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Download, { className: "me-2 h-4 w-4" }),
|
|
1049
1049
|
t("billing.ui.invoice.download_pdf")
|
|
1050
1050
|
] }),
|
|
1051
|
-
invoice.status === "open" /* OPEN */ && invoice.attempted && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1051
|
+
invoice.status === "open" /* OPEN */ && invoice.attempted && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.Button, { variant: "default", onClick: handleRetryPayment, children: [
|
|
1052
1052
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RefreshCw, { className: "me-2 h-4 w-4" }),
|
|
1053
1053
|
t("billing.ui.invoice.retry_payment")
|
|
1054
1054
|
] }),
|
|
1055
|
-
invoice.stripeHostedInvoiceUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1055
|
+
invoice.stripeHostedInvoiceUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.Button, { variant: "outline", onClick: handleViewInStripe, children: [
|
|
1056
1056
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ExternalLink, { className: "me-2 h-4 w-4" }),
|
|
1057
1057
|
t("billing.ui.invoice.view_in_stripe")
|
|
1058
1058
|
] })
|
|
@@ -1066,7 +1066,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, InvoiceDetails, "InvoiceDetails");
|
|
|
1066
1066
|
|
|
1067
1067
|
function InvoicesList({ invoices, onInvoicesChange }) {
|
|
1068
1068
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1069
|
-
const fmt =
|
|
1069
|
+
const fmt = _chunkS4FSGMKXjs.useBillingFormatOptions.call(void 0, );
|
|
1070
1070
|
const [selectedInvoice, setSelectedInvoice] = _react.useState.call(void 0, null);
|
|
1071
1071
|
const handleRowClick = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (invoice) => {
|
|
1072
1072
|
setSelectedInvoice(invoice);
|
|
@@ -1078,30 +1078,30 @@ function InvoicesList({ invoices, onInvoicesChange }) {
|
|
|
1078
1078
|
return invoice.stripeInvoiceId.slice(-8);
|
|
1079
1079
|
}, "getInvoiceNumber");
|
|
1080
1080
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1081
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1082
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1083
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1084
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1085
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1086
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1087
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1081
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.Table, { children: [
|
|
1082
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.TableRow, { children: [
|
|
1083
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.TableHead, { children: t("billing.ui.columns.invoice_number") }),
|
|
1084
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.TableHead, { children: t("billing.ui.columns.date") }),
|
|
1085
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.TableHead, { children: t("billing.ui.columns.status") }),
|
|
1086
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.TableHead, { className: "text-end", children: t("billing.ui.columns.amount") }),
|
|
1087
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.TableHead, { children: t("billing.ui.columns.period") })
|
|
1088
1088
|
] }) }),
|
|
1089
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1089
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.TableBody, { children: invoices.map((invoice) => {
|
|
1090
1090
|
const invoiceNumber = getInvoiceNumber(invoice);
|
|
1091
|
-
const date =
|
|
1091
|
+
const date = _chunkS4FSGMKXjs.formatDate.call(void 0, invoice.periodStart, fmt);
|
|
1092
1092
|
const amount = _chunk77JC2UCFjs.formatCurrency.call(void 0, invoice.total, invoice.currency, fmt);
|
|
1093
|
-
const period = `${
|
|
1093
|
+
const period = `${_chunkS4FSGMKXjs.formatDate.call(void 0, invoice.periodStart, fmt)} - ${_chunkS4FSGMKXjs.formatDate.call(void 0, invoice.periodEnd, fmt)}`;
|
|
1094
1094
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1095
|
-
|
|
1095
|
+
_chunkS4FSGMKXjs.TableRow,
|
|
1096
1096
|
{
|
|
1097
1097
|
onClick: () => handleRowClick(invoice),
|
|
1098
1098
|
className: "cursor-pointer hover:bg-muted/50",
|
|
1099
1099
|
children: [
|
|
1100
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1101
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1102
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1103
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1104
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1100
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.TableCell, { className: "font-medium", children: invoiceNumber }),
|
|
1101
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.TableCell, { className: "text-muted-foreground text-xs", children: date }),
|
|
1102
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InvoiceStatusBadge, { status: invoice.status }) }),
|
|
1103
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.TableCell, { className: "text-end font-medium", children: amount }),
|
|
1104
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.TableCell, { className: "text-muted-foreground text-xs", children: period })
|
|
1105
1105
|
]
|
|
1106
1106
|
},
|
|
1107
1107
|
invoice.id
|
|
@@ -1151,12 +1151,12 @@ function InvoicesContainer() {
|
|
|
1151
1151
|
setStatusFilter(value);
|
|
1152
1152
|
}, "handleFilterChange");
|
|
1153
1153
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-4", children: [
|
|
1154
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1155
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1156
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1157
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1158
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1159
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1154
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Tabs, { value: statusFilter, onValueChange: handleFilterChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.TabsList, { children: [
|
|
1155
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.TabsTrigger, { value: "all", children: t("billing.ui.invoices.filter_all") }),
|
|
1156
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.TabsTrigger, { value: "paid" /* PAID */, children: t("billing.ui.invoice_status.paid") }),
|
|
1157
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.TabsTrigger, { value: "open" /* OPEN */, children: t("billing.ui.invoice_status.open") }),
|
|
1158
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.TabsTrigger, { value: "void" /* VOID */, children: t("billing.ui.invoice_status.void") }),
|
|
1159
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.TabsTrigger, { value: "uncollectible" /* UNCOLLECTIBLE */, children: t("billing.ui.invoice_status.uncollectible") })
|
|
1160
1160
|
] }) }),
|
|
1161
1161
|
loading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-center py-8 text-muted-foreground", children: t("billing.ui.invoices.loading") }),
|
|
1162
1162
|
!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: [
|
|
@@ -1198,7 +1198,7 @@ function CancelSubscriptionDialog({
|
|
|
1198
1198
|
onSuccess
|
|
1199
1199
|
}) {
|
|
1200
1200
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1201
|
-
const fmt =
|
|
1201
|
+
const fmt = _chunkS4FSGMKXjs.useBillingFormatOptions.call(void 0, );
|
|
1202
1202
|
const [isSubmitting, setIsSubmitting] = _react.useState.call(void 0, false);
|
|
1203
1203
|
const form = _reacthookform.useForm.call(void 0, {
|
|
1204
1204
|
resolver: _zod.zodResolver.call(void 0, formSchema),
|
|
@@ -1221,16 +1221,16 @@ function CancelSubscriptionDialog({
|
|
|
1221
1221
|
setIsSubmitting(false);
|
|
1222
1222
|
}
|
|
1223
1223
|
}, "onSubmit");
|
|
1224
|
-
const periodEndDate =
|
|
1225
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1226
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1227
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1228
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1224
|
+
const periodEndDate = _chunkS4FSGMKXjs.formatDate.call(void 0, subscription.currentPeriodEnd, fmt);
|
|
1225
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.DialogContent, { className: "max-w-md", children: [
|
|
1226
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.DialogHeader, { children: [
|
|
1227
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.DialogTitle, { children: t("billing.ui.subscription.cancel.title") }),
|
|
1228
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.DialogDescription, { children: t("billing.ui.subscription.cancel.description") })
|
|
1229
1229
|
] }),
|
|
1230
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1230
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-col gap-y-4", children: [
|
|
1231
1231
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "bg-primary/10 border-primary/30 text-foreground rounded-lg border p-3 text-sm", children: t("billing.ui.subscription.cancel.remains_active", { date: periodEndDate }) }),
|
|
1232
1232
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1233
|
-
|
|
1233
|
+
_chunkS4FSGMKXjs.FormTextarea,
|
|
1234
1234
|
{
|
|
1235
1235
|
form,
|
|
1236
1236
|
id: "reason",
|
|
@@ -1240,8 +1240,8 @@ function CancelSubscriptionDialog({
|
|
|
1240
1240
|
}
|
|
1241
1241
|
),
|
|
1242
1242
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-x-2 justify-end pt-2", children: [
|
|
1243
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1244
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1243
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Button, { type: "button", variant: "outline", onClick: () => onOpenChange(false), disabled: isSubmitting, children: t("billing.ui.subscription.cancel.keep") }),
|
|
1244
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Button, { type: "submit", variant: "destructive", disabled: isSubmitting, children: isSubmitting ? t("billing.ui.subscription.cancel.canceling") : t("billing.ui.subscription.cancel.confirm") })
|
|
1245
1245
|
] })
|
|
1246
1246
|
] }) })
|
|
1247
1247
|
] }) });
|
|
@@ -1292,7 +1292,7 @@ var cancelingConfig = {
|
|
|
1292
1292
|
function SubscriptionStatusBadge({ status, cancelAtPeriodEnd }) {
|
|
1293
1293
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1294
1294
|
const config = cancelAtPeriodEnd ? cancelingConfig : statusConfig2[status] || statusConfig2["canceled" /* CANCELED */];
|
|
1295
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1295
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Badge, { variant: config.variant, children: t(config.label) });
|
|
1296
1296
|
}
|
|
1297
1297
|
_chunk7QVYU63Ejs.__name.call(void 0, SubscriptionStatusBadge, "SubscriptionStatusBadge");
|
|
1298
1298
|
|
|
@@ -1331,7 +1331,7 @@ function SubscriptionDetails({
|
|
|
1331
1331
|
renderCancelDialog
|
|
1332
1332
|
}) {
|
|
1333
1333
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1334
|
-
const fmt =
|
|
1334
|
+
const fmt = _chunkS4FSGMKXjs.useBillingFormatOptions.call(void 0, );
|
|
1335
1335
|
const [showCancel, setShowCancel] = _react.useState.call(void 0, false);
|
|
1336
1336
|
const handleManageViaPortal = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1337
1337
|
try {
|
|
@@ -1343,10 +1343,10 @@ function SubscriptionDetails({
|
|
|
1343
1343
|
}, "handleManageViaPortal");
|
|
1344
1344
|
const canCancel = subscription.status === "active" /* ACTIVE */ || subscription.status === "trialing" /* TRIALING */ || subscription.status === "paused" /* PAUSED */;
|
|
1345
1345
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1346
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1347
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1348
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1349
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1346
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.DialogContent, { className: "max-w-2xl", children: [
|
|
1347
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.DialogHeader, { children: [
|
|
1348
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.DialogTitle, { children: t("billing.ui.subscription.details_title") }),
|
|
1349
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.DialogDescription, { children: t("billing.ui.subscription.details_description") })
|
|
1350
1350
|
] }),
|
|
1351
1351
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
1352
1352
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
@@ -1372,22 +1372,22 @@ function SubscriptionDetails({
|
|
|
1372
1372
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "space-y-2", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1373
1373
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.subscription.current_period") }),
|
|
1374
1374
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "text-sm", children: [
|
|
1375
|
-
|
|
1375
|
+
_chunkS4FSGMKXjs.formatDate.call(void 0, subscription.currentPeriodStart, fmt),
|
|
1376
1376
|
" - ",
|
|
1377
|
-
|
|
1377
|
+
_chunkS4FSGMKXjs.formatDate.call(void 0, subscription.currentPeriodEnd, fmt)
|
|
1378
1378
|
] })
|
|
1379
1379
|
] }) }),
|
|
1380
1380
|
subscription.trialEnd && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1381
1381
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.subscription.trial_ends") }),
|
|
1382
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children:
|
|
1382
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children: _chunkS4FSGMKXjs.formatDate.call(void 0, subscription.trialEnd, fmt) })
|
|
1383
1383
|
] }),
|
|
1384
1384
|
subscription.cancelAtPeriodEnd && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "bg-warning/15 border-warning/30 rounded-lg border p-3", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-warning text-xs/relaxed", children: t("billing.ui.subscription.cancel_at_period_end", {
|
|
1385
|
-
date:
|
|
1385
|
+
date: _chunkS4FSGMKXjs.formatDate.call(void 0, subscription.currentPeriodEnd, fmt)
|
|
1386
1386
|
}) }) }),
|
|
1387
1387
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2 pt-4 border-t", children: [
|
|
1388
|
-
onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1389
|
-
canCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1390
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1388
|
+
onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Button, { variant: "default", onClick: () => onChangePlan(subscription), children: t("billing.ui.subscription.change_plan") }),
|
|
1389
|
+
canCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Button, { variant: "destructive", onClick: () => setShowCancel(true), children: t("ui.buttons.cancel") }),
|
|
1390
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Button, { variant: "outline", onClick: handleManageViaPortal, children: t("billing.ui.subscription.manage_portal") })
|
|
1391
1391
|
] })
|
|
1392
1392
|
] })
|
|
1393
1393
|
] }) }),
|
|
@@ -1447,46 +1447,46 @@ function SubscriptionsList({
|
|
|
1447
1447
|
renderCancelDialog
|
|
1448
1448
|
}) {
|
|
1449
1449
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1450
|
-
const fmt =
|
|
1450
|
+
const fmt = _chunkS4FSGMKXjs.useBillingFormatOptions.call(void 0, );
|
|
1451
1451
|
const [selectedSub, setSelectedSub] = _react.useState.call(void 0, null);
|
|
1452
1452
|
const handleRowClick = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (subscription) => {
|
|
1453
1453
|
setSelectedSub(subscription);
|
|
1454
1454
|
}, "handleRowClick");
|
|
1455
1455
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1456
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1457
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1458
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1459
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1460
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1461
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1462
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1456
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.Table, { children: [
|
|
1457
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.TableRow, { children: [
|
|
1458
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.TableHead, { children: t("billing.ui.columns.status") }),
|
|
1459
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.TableHead, { children: t("billing.ui.columns.plan") }),
|
|
1460
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.TableHead, { children: t("billing.ui.columns.period") }),
|
|
1461
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.TableHead, { className: "text-end", children: t("billing.ui.columns.amount") }),
|
|
1462
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.TableHead, { className: "text-end", children: t("billing.ui.columns.actions") })
|
|
1463
1463
|
] }) }),
|
|
1464
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1464
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.TableBody, { children: subscriptions.map((subscription) => {
|
|
1465
1465
|
const price = subscription.price;
|
|
1466
1466
|
const amount = _optionalChain([price, 'optionalAccess', _42 => _42.unitAmount]) ? _chunk77JC2UCFjs.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt) : "0";
|
|
1467
|
-
const discountedAmount = price ?
|
|
1468
|
-
const period = `${
|
|
1467
|
+
const discountedAmount = price ? _chunkS4FSGMKXjs.applyDiscount.call(void 0, price.unitAmount, _chunkS4FSGMKXjs.subscriptionDiscount.call(void 0, subscription)) : null;
|
|
1468
|
+
const period = `${_chunkS4FSGMKXjs.formatDate.call(void 0, subscription.currentPeriodStart, fmt)} - ${_chunkS4FSGMKXjs.formatDate.call(void 0, subscription.currentPeriodEnd, fmt)}`;
|
|
1469
1469
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1470
|
-
|
|
1470
|
+
_chunkS4FSGMKXjs.TableRow,
|
|
1471
1471
|
{
|
|
1472
1472
|
onClick: () => handleRowClick(subscription),
|
|
1473
1473
|
className: "cursor-pointer hover:bg-muted/50",
|
|
1474
1474
|
children: [
|
|
1475
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1475
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1476
1476
|
SubscriptionStatusBadge,
|
|
1477
1477
|
{
|
|
1478
1478
|
status: subscription.status,
|
|
1479
1479
|
cancelAtPeriodEnd: subscription.cancelAtPeriodEnd
|
|
1480
1480
|
}
|
|
1481
1481
|
) }),
|
|
1482
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1483
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1484
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1482
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.TableCell, { className: "font-medium", children: formatPlanName3(price, t) }),
|
|
1483
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.TableCell, { className: "text-muted-foreground text-sm", children: period }),
|
|
1484
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.TableCell, { className: "text-end font-medium", children: discountedAmount !== null && price ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1485
1485
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "line-through text-muted-foreground me-2", children: amount }),
|
|
1486
1486
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success", children: _chunk77JC2UCFjs.formatCurrency.call(void 0, discountedAmount, price.currency, fmt) })
|
|
1487
1487
|
] }) : amount }),
|
|
1488
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1489
|
-
|
|
1488
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.TableCell, { className: "text-end", children: (subscription.status === "active" /* ACTIVE */ || subscription.status === "trialing" /* TRIALING */) && onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1489
|
+
_chunkS4FSGMKXjs.Button,
|
|
1490
1490
|
{
|
|
1491
1491
|
size: "sm",
|
|
1492
1492
|
variant: "outline",
|
|
@@ -1569,7 +1569,7 @@ function SubscriptionsContainer({
|
|
|
1569
1569
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8" }),
|
|
1570
1570
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: t("billing.ui.subscriptions.title") })
|
|
1571
1571
|
] }),
|
|
1572
|
-
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1572
|
+
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _44 => _44()]), children: hasActiveRecurringSubscription ? t("billing.ui.subscriptions.purchase_addons") : t("billing.ui.subscriptions.subscribe") })
|
|
1573
1573
|
] }),
|
|
1574
1574
|
criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BillingAlertBanner, { subscription }, subscription.id)),
|
|
1575
1575
|
subscriptions.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col items-center justify-center py-12 space-y-4", children: [
|
|
@@ -1577,7 +1577,7 @@ function SubscriptionsContainer({
|
|
|
1577
1577
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
1578
1578
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium mb-2", children: t("billing.ui.subscriptions.empty_title") }),
|
|
1579
1579
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground mb-6", children: t("billing.ui.subscriptions.empty_description") }),
|
|
1580
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1580
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _45 => _45()]), children: t("billing.ui.subscriptions.subscribe") })
|
|
1581
1581
|
] })
|
|
1582
1582
|
] }),
|
|
1583
1583
|
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -1601,9 +1601,9 @@ function IntervalToggle({ value, onChange, hasMonthly, hasYearly }) {
|
|
|
1601
1601
|
if (!hasMonthly || !hasYearly) {
|
|
1602
1602
|
return null;
|
|
1603
1603
|
}
|
|
1604
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1605
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1606
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1604
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Tabs, { value, onValueChange: (v) => onChange(v), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.TabsList, { children: [
|
|
1605
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.TabsTrigger, { value: "month", children: t("billing.admin.prices.interval.month") }),
|
|
1606
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.TabsTrigger, { value: "year", children: t("billing.admin.prices.interval.year") })
|
|
1607
1607
|
] }) });
|
|
1608
1608
|
}
|
|
1609
1609
|
_chunk7QVYU63Ejs.__name.call(void 0, IntervalToggle, "IntervalToggle");
|
|
@@ -1621,7 +1621,7 @@ function PricingCard({
|
|
|
1621
1621
|
onSelect
|
|
1622
1622
|
}) {
|
|
1623
1623
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1624
|
-
const fmt =
|
|
1624
|
+
const fmt = _chunkS4FSGMKXjs.useBillingFormatOptions.call(void 0, );
|
|
1625
1625
|
const description = price.description || price.nickname || t("billing.ui.pricing.standard");
|
|
1626
1626
|
const features = price.features || [];
|
|
1627
1627
|
const formattedPrice = _chunk77JC2UCFjs.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt);
|
|
@@ -1638,7 +1638,7 @@ function PricingCard({
|
|
|
1638
1638
|
}
|
|
1639
1639
|
}, "handleClick");
|
|
1640
1640
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1641
|
-
|
|
1641
|
+
_chunkS4FSGMKXjs.Card,
|
|
1642
1642
|
{
|
|
1643
1643
|
role: "radio",
|
|
1644
1644
|
"aria-checked": isSelected,
|
|
@@ -1656,9 +1656,9 @@ function PricingCard({
|
|
|
1656
1656
|
isLoading && "pointer-events-none"
|
|
1657
1657
|
),
|
|
1658
1658
|
children: [
|
|
1659
|
-
isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1660
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1661
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1659
|
+
isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Badge, { variant: "secondary", className: "absolute top-2 end-2", children: t("billing.ui.pricing.current") }),
|
|
1660
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.CardHeader, { className: "pb-2", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium", children: description }) }),
|
|
1661
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.CardContent, { className: "pb-4 grow", children: [
|
|
1662
1662
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mb-4", children: [
|
|
1663
1663
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-3xl font-bold", children: formattedPrice }),
|
|
1664
1664
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground ms-1", children: interval })
|
|
@@ -1668,8 +1668,8 @@ function PricingCard({
|
|
|
1668
1668
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-muted-foreground", children: feature })
|
|
1669
1669
|
] }, index)) })
|
|
1670
1670
|
] }),
|
|
1671
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1672
|
-
|
|
1671
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.CardFooter, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1672
|
+
_chunkS4FSGMKXjs.Button,
|
|
1673
1673
|
{
|
|
1674
1674
|
variant: isCurrentPlan ? "secondary" : isSelected ? "default" : "outline",
|
|
1675
1675
|
className: "w-full",
|
|
@@ -1702,7 +1702,7 @@ function ProductPricingRow({
|
|
|
1702
1702
|
return null;
|
|
1703
1703
|
}
|
|
1704
1704
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-3", children: [
|
|
1705
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1705
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.SectionHeader, { children: product.name }),
|
|
1706
1706
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1707
1707
|
"div",
|
|
1708
1708
|
{
|
|
@@ -1803,15 +1803,15 @@ function ProductPricingList({
|
|
|
1803
1803
|
_chunk7QVYU63Ejs.__name.call(void 0, ProductPricingList, "ProductPricingList");
|
|
1804
1804
|
function ProductPricingListSkeleton() {
|
|
1805
1805
|
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: [
|
|
1806
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1806
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Skeleton, { className: "h-6 w-32" }),
|
|
1807
1807
|
/* @__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: [
|
|
1808
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1809
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1808
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Skeleton, { className: "h-6 w-24" }),
|
|
1809
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Skeleton, { className: "h-8 w-32" }),
|
|
1810
1810
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
1811
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1812
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1811
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Skeleton, { className: "h-4 w-full" }),
|
|
1812
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Skeleton, { className: "h-4 w-3/4" })
|
|
1813
1813
|
] }),
|
|
1814
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1814
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Skeleton, { className: "h-10 w-full" })
|
|
1815
1815
|
] }, cardIndex)) })
|
|
1816
1816
|
] }, rowIndex)) });
|
|
1817
1817
|
}
|
|
@@ -1822,7 +1822,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductPricingListSkeleton, "ProductPricing
|
|
|
1822
1822
|
|
|
1823
1823
|
function ProrationPreview({ preview }) {
|
|
1824
1824
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1825
|
-
const fmt =
|
|
1825
|
+
const fmt = _chunkS4FSGMKXjs.useBillingFormatOptions.call(void 0, );
|
|
1826
1826
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-primary/10 border-primary/30 rounded-lg border p-4", children: [
|
|
1827
1827
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "text-primary mb-3 font-semibold", children: t("billing.ui.proration.title") }),
|
|
1828
1828
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
@@ -1848,7 +1848,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProrationPreview, "ProrationPreview");
|
|
|
1848
1848
|
|
|
1849
1849
|
function SubscriptionConfirmation({ price, isLoading, onConfirm, onCancel }) {
|
|
1850
1850
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1851
|
-
const fmt =
|
|
1851
|
+
const fmt = _chunkS4FSGMKXjs.useBillingFormatOptions.call(void 0, );
|
|
1852
1852
|
const productName = _optionalChain([price, 'access', _51 => _51.product, 'optionalAccess', _52 => _52.name]) || price.nickname || t("billing.ui.wizard.review.selected_plan");
|
|
1853
1853
|
const productDescription = _optionalChain([price, 'access', _53 => _53.product, 'optionalAccess', _54 => _54.description]) || price.description;
|
|
1854
1854
|
const features = price.features || [];
|
|
@@ -1868,8 +1868,8 @@ function SubscriptionConfirmation({ price, isLoading, onConfirm, onCancel }) {
|
|
|
1868
1868
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: feature })
|
|
1869
1869
|
] }, index)) }),
|
|
1870
1870
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-3 pt-2 border-t border-accent/30", children: [
|
|
1871
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1872
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1871
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Button, { variant: "outline", onClick: onCancel, disabled: isLoading, children: t("ui.buttons.cancel") }),
|
|
1872
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Button, { onClick: onConfirm, disabled: isLoading, children: isLoading ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1873
1873
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "h-4 w-4 animate-spin me-2" }),
|
|
1874
1874
|
t("billing.ui.wizard.review.processing")
|
|
1875
1875
|
] }) : t("billing.ui.confirmation.subscribe") })
|
|
@@ -2407,7 +2407,7 @@ function WizardStepPlanSelection({
|
|
|
2407
2407
|
onSelectPrice: handleSelectPrice
|
|
2408
2408
|
}
|
|
2409
2409
|
),
|
|
2410
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex justify-end pt-4 border-t", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2410
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex justify-end pt-4 border-t", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Button, { onClick: onNext, disabled: !selectedPrice || isProcessing, children: isProcessing ? t("common.loading") : t("billing.ui.wizard.next_review") }) })
|
|
2411
2411
|
] });
|
|
2412
2412
|
}
|
|
2413
2413
|
_chunk7QVYU63Ejs.__name.call(void 0, WizardStepPlanSelection, "WizardStepPlanSelection");
|
|
@@ -2477,7 +2477,7 @@ function PromoCodeInput({
|
|
|
2477
2477
|
const codeInput = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
2478
2478
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
|
|
2479
2479
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2480
|
-
|
|
2480
|
+
_chunkS4FSGMKXjs.Input,
|
|
2481
2481
|
{
|
|
2482
2482
|
placeholder: t("billing.ui.promo_code.placeholder"),
|
|
2483
2483
|
value: code,
|
|
@@ -2487,7 +2487,7 @@ function PromoCodeInput({
|
|
|
2487
2487
|
className: "flex-1"
|
|
2488
2488
|
}
|
|
2489
2489
|
),
|
|
2490
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2490
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.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" }) : t("billing.ui.promo_code.apply") })
|
|
2491
2491
|
] }),
|
|
2492
2492
|
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error })
|
|
2493
2493
|
] });
|
|
@@ -2516,7 +2516,7 @@ function PromoCodeInput({
|
|
|
2516
2516
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success text-sm", children: formatDiscount(appliedCode) })
|
|
2517
2517
|
] }),
|
|
2518
2518
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2519
|
-
|
|
2519
|
+
_chunkS4FSGMKXjs.Button,
|
|
2520
2520
|
{
|
|
2521
2521
|
variant: "ghost",
|
|
2522
2522
|
size: "sm",
|
|
@@ -2564,7 +2564,7 @@ function WizardStepReview({
|
|
|
2564
2564
|
isTrialUpgrade
|
|
2565
2565
|
}) {
|
|
2566
2566
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2567
|
-
const fmt =
|
|
2567
|
+
const fmt = _chunkS4FSGMKXjs.useBillingFormatOptions.call(void 0, );
|
|
2568
2568
|
const [card, setCard] = _react.useState.call(void 0, null);
|
|
2569
2569
|
_react.useEffect.call(void 0, () => {
|
|
2570
2570
|
if (!hasPaymentMethod) {
|
|
@@ -2591,11 +2591,11 @@ function WizardStepReview({
|
|
|
2591
2591
|
const interval = _optionalChain([price, 'access', _93 => _93.recurring, 'optionalAccess', _94 => _94.interval]) || "month";
|
|
2592
2592
|
return interval === "year" ? t("billing.ui.wizard.review.interval_yearly") : t("billing.ui.wizard.review.interval_monthly");
|
|
2593
2593
|
}, "formatInterval");
|
|
2594
|
-
const codeDiscount =
|
|
2595
|
-
const carriedDiscount = isChangingPlan && !codeDiscount ?
|
|
2594
|
+
const codeDiscount = _chunkS4FSGMKXjs.promotionCodeDiscount.call(void 0, promotionCode);
|
|
2595
|
+
const carriedDiscount = isChangingPlan && !codeDiscount ? _chunkS4FSGMKXjs.subscriptionDiscount.call(void 0, subscription) : null;
|
|
2596
2596
|
const discount = _nullishCoalesce(codeDiscount, () => ( carriedDiscount));
|
|
2597
|
-
const discountedPrice =
|
|
2598
|
-
const discountedImmediateCharge =
|
|
2597
|
+
const discountedPrice = _chunkS4FSGMKXjs.applyDiscount.call(void 0, selectedPrice.unitAmount, discount);
|
|
2598
|
+
const discountedImmediateCharge = _chunkS4FSGMKXjs.applyDiscount.call(void 0, _optionalChain([prorationPreview, 'optionalAccess', _95 => _95.immediateCharge]), discount);
|
|
2599
2599
|
const isProrationCredit = !isTrialUpgrade && (_nullishCoalesce(_nullishCoalesce(discountedImmediateCharge, () => ( _optionalChain([prorationPreview, 'optionalAccess', _96 => _96.immediateCharge]))), () => ( 0))) < 0;
|
|
2600
2600
|
const prorationAmount = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (amount) => isProrationCredit ? Math.abs(amount) : amount, "prorationAmount");
|
|
2601
2601
|
const getDiscountDescription = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
@@ -2610,7 +2610,7 @@ function WizardStepReview({
|
|
|
2610
2610
|
const discountDescription = getDiscountDescription();
|
|
2611
2611
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
2612
2612
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-muted/50 rounded-lg p-4 space-y-3", children: [
|
|
2613
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2613
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.SectionHeader, { children: t("billing.ui.wizard.review.selected_plan") }),
|
|
2614
2614
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between items-center", children: [
|
|
2615
2615
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
2616
2616
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-medium", children: _optionalChain([selectedPrice, 'access', _97 => _97.product, 'optionalAccess', _98 => _98.name]) }),
|
|
@@ -2620,7 +2620,7 @@ function WizardStepReview({
|
|
|
2620
2620
|
discountedPrice !== null ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2621
2621
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground line-through", children: _chunk77JC2UCFjs.formatCurrency.call(void 0, selectedPrice.unitAmount || 0, selectedPrice.currency, fmt) }),
|
|
2622
2622
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-success text-lg font-semibold", children: _chunk77JC2UCFjs.formatCurrency.call(void 0, discountedPrice, selectedPrice.currency, fmt) }),
|
|
2623
|
-
discountDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2623
|
+
discountDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Badge, { variant: "softGreen", children: discountDescription }),
|
|
2624
2624
|
carriedDiscount && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: t("billing.ui.wizard.review.discount_carries_over") })
|
|
2625
2625
|
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-semibold text-lg", children: _chunk77JC2UCFjs.formatCurrency.call(void 0, selectedPrice.unitAmount || 0, selectedPrice.currency, fmt) }),
|
|
2626
2626
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: formatInterval2(selectedPrice) })
|
|
@@ -2663,15 +2663,15 @@ function WizardStepReview({
|
|
|
2663
2663
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "font-medium", children: t("billing.ui.payment_method.title") }),
|
|
2664
2664
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: hasPaymentMethod ? card ? t("billing.ui.wizard.review.card_on_file", { brand: card.brand, last4: card.last4 }) : t("billing.ui.wizard.review.payment_on_file") : t("billing.ui.wizard.review.no_payment_on_file") })
|
|
2665
2665
|
] }),
|
|
2666
|
-
hasPaymentMethod ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2666
|
+
hasPaymentMethod ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Button, { variant: "outline", onClick: onAddPaymentMethod, disabled: isProcessing, children: t("billing.ui.wizard.review.use_another_card") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Button, { variant: "outline", onClick: onAddPaymentMethod, children: t("billing.ui.payment_methods.add") })
|
|
2667
2667
|
] }) }),
|
|
2668
|
-
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2668
|
+
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.Alert, { variant: "destructive", children: [
|
|
2669
2669
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.AlertCircle, { className: "h-4 w-4" }),
|
|
2670
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2670
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.AlertDescription, { children: error })
|
|
2671
2671
|
] }),
|
|
2672
2672
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between pt-4 border-t", children: [
|
|
2673
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2674
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2673
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Button, { variant: "outline", onClick: onBack, disabled: isProcessing, children: t("billing.ui.wizard.back") }),
|
|
2674
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Button, { onClick: hasPaymentMethod ? onConfirm : onAddPaymentMethod, disabled: isProcessing, children: isProcessing ? t("billing.ui.wizard.review.processing") : hasPaymentMethod ? isChangingPlan ? t("billing.ui.wizard.review.confirm_change") : t("billing.ui.wizard.review.subscribe_now") : t("billing.ui.payment_methods.add") })
|
|
2675
2675
|
] })
|
|
2676
2676
|
] });
|
|
2677
2677
|
}
|
|
@@ -2684,7 +2684,7 @@ function WizardStepPaymentMethod({ onBack, onSuccess, isProcessing }) {
|
|
|
2684
2684
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2685
2685
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
2686
2686
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
2687
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2687
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.SectionHeader, { children: t("billing.ui.payment_methods.add") }),
|
|
2688
2688
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: t("billing.ui.wizard.payment_description") })
|
|
2689
2689
|
] }),
|
|
2690
2690
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodForm, { onSuccess, onCancel: onBack, isLoading: isProcessing, alwaysSetDefault: true })
|
|
@@ -2727,10 +2727,10 @@ function SubscriptionWizard({
|
|
|
2727
2727
|
const isChangePlanMode = !!subscription;
|
|
2728
2728
|
const dialogTitle = subscription ? t("billing.ui.wizard.change_title") : isPurchasingAddons ? t("billing.ui.subscriptions.purchase_addons") : t("billing.ui.subscriptions.subscribe");
|
|
2729
2729
|
const dialogDescription = subscription ? t("billing.ui.wizard.change_description") : isPurchasingAddons ? t("billing.ui.wizard.addons_description") : t("billing.ui.wizard.subscribe_description");
|
|
2730
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2731
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2732
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2733
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2730
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.DialogContent, { className: "max-w-2xl max-h-[90vh] overflow-y-auto", children: [
|
|
2731
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.DialogHeader, { children: [
|
|
2732
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.DialogTitle, { children: dialogTitle }),
|
|
2733
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.DialogDescription, { children: dialogDescription })
|
|
2734
2734
|
] }),
|
|
2735
2735
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, WizardProgressIndicator, { currentStep: state.step }),
|
|
2736
2736
|
state.step === "plan-selection" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -2802,7 +2802,7 @@ function formatDate2(date, { dateLocale, t }) {
|
|
|
2802
2802
|
_chunk7QVYU63Ejs.__name.call(void 0, formatDate2, "formatDate");
|
|
2803
2803
|
function UsageSummaryCard({ meter, summary }) {
|
|
2804
2804
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2805
|
-
const fmt =
|
|
2805
|
+
const fmt = _chunkS4FSGMKXjs.useBillingFormatOptions.call(void 0, );
|
|
2806
2806
|
const currentUsage = _nullishCoalesce(_optionalChain([summary, 'optionalAccess', _101 => _101.aggregatedValue]), () => ( 0));
|
|
2807
2807
|
const limit = meter.limit;
|
|
2808
2808
|
const percentage = limit && limit > 0 ? currentUsage / limit * 100 : null;
|
|
@@ -2810,15 +2810,15 @@ function UsageSummaryCard({ meter, summary }) {
|
|
|
2810
2810
|
const progressWidth = percentage !== null ? Math.min(percentage, 100) : 0;
|
|
2811
2811
|
const displayName = meter.displayName || meter.eventName;
|
|
2812
2812
|
const hasLimit = limit !== null && limit !== void 0;
|
|
2813
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2814
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2813
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.Card, { children: [
|
|
2814
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.CardHeader, { className: "flex flex-row items-center gap-x-3 pb-3", children: [
|
|
2815
2815
|
/* @__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" }) }),
|
|
2816
2816
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col", children: [
|
|
2817
2817
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium", children: displayName }),
|
|
2818
2818
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-xs", children: meter.id })
|
|
2819
2819
|
] })
|
|
2820
2820
|
] }),
|
|
2821
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2821
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.CardContent, { className: "flex flex-col gap-y-4", children: [
|
|
2822
2822
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
2823
2823
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-3xl font-bold", children: currentUsage.toLocaleString(fmt.locale) }),
|
|
2824
2824
|
hasLimit && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-sm", children: t("billing.ui.usage.of_limit_used", { limit: limit.toLocaleString(fmt.locale) }) })
|
|
@@ -2926,27 +2926,27 @@ function formatDateTime(date, { dateLocale, t }) {
|
|
|
2926
2926
|
_chunk7QVYU63Ejs.__name.call(void 0, formatDateTime, "formatDateTime");
|
|
2927
2927
|
function UsageHistoryTable({ usageRecords }) {
|
|
2928
2928
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2929
|
-
const fmt =
|
|
2929
|
+
const fmt = _chunkS4FSGMKXjs.useBillingFormatOptions.call(void 0, );
|
|
2930
2930
|
if (usageRecords.length === 0) {
|
|
2931
2931
|
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: t("billing.ui.usage.history_empty") }) });
|
|
2932
2932
|
}
|
|
2933
2933
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
2934
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2935
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-clip rounded-lg border", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2936
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2937
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2938
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2939
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2940
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2934
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.SectionHeader, { level: 2, children: t("billing.ui.usage.history_title") }),
|
|
2935
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-clip rounded-lg border", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.Table, { children: [
|
|
2936
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.TableRow, { children: [
|
|
2937
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.TableHead, { children: t("billing.ui.columns.date_time") }),
|
|
2938
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.TableHead, { children: t("billing.ui.columns.meter_event") }),
|
|
2939
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.TableHead, { className: "text-end", children: t("billing.ui.columns.quantity") }),
|
|
2940
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.TableHead, { children: t("billing.ui.columns.event_id") })
|
|
2941
2941
|
] }) }),
|
|
2942
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2942
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.TableBody, { children: usageRecords.map((record) => {
|
|
2943
2943
|
const dateTime = formatDateTime(record.timestamp, fmt);
|
|
2944
2944
|
const quantity = record.quantity.toLocaleString(fmt.locale);
|
|
2945
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2946
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2947
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2948
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2949
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2945
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.TableRow, { children: [
|
|
2946
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.TableCell, { className: "font-medium", children: dateTime }),
|
|
2947
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.TableCell, { className: "text-muted-foreground", children: record.meterEventName }),
|
|
2948
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.TableCell, { className: "text-end font-medium", children: quantity }),
|
|
2949
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.TableCell, { className: "text-muted-foreground text-sm tabular-nums", children: record.stripeEventId })
|
|
2950
2950
|
] }, record.id);
|
|
2951
2951
|
}) })
|
|
2952
2952
|
] }) })
|
|
@@ -2957,8 +2957,8 @@ _chunk7QVYU63Ejs.__name.call(void 0, UsageHistoryTable, "UsageHistoryTable");
|
|
|
2957
2957
|
// src/features/billing/components/modals/BillingDetailModal.tsx
|
|
2958
2958
|
|
|
2959
2959
|
function BillingDetailModal({ open, onOpenChange, title, children, className }) {
|
|
2960
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2961
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2960
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.DialogContent, { className: _nullishCoalesce(className, () => ( "max-w-4xl max-h-[90vh] overflow-y-auto")), children: [
|
|
2961
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.DialogHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.DialogTitle, { children: title }) }),
|
|
2962
2962
|
children
|
|
2963
2963
|
] }) });
|
|
2964
2964
|
}
|
|
@@ -2986,7 +2986,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
|
|
|
2986
2986
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-destructive text-sm font-medium", children: t("billing.ui.alert.payment_failed_title") }),
|
|
2987
2987
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive mt-1 text-sm", children: t("billing.ui.alert.payment_failed_description") })
|
|
2988
2988
|
] }),
|
|
2989
|
-
onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2989
|
+
onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Button, { variant: "outline", size: "sm", onClick: onUpdatePayment, className: "text-destructive border-red-300", children: t("billing.ui.alert.update_payment_method") })
|
|
2990
2990
|
] });
|
|
2991
2991
|
}
|
|
2992
2992
|
if (subscription.status === "trialing" /* TRIALING */ && subscription.trialEnd) {
|
|
@@ -3000,7 +3000,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
|
|
|
3000
3000
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-warning text-sm font-medium", children: t("billing.ui.alert.trial_ending_title") }),
|
|
3001
3001
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-warning mt-1 text-sm", children: t("billing.ui.alert.trial_ending_description", { count: daysRemaining }) })
|
|
3002
3002
|
] }),
|
|
3003
|
-
onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3003
|
+
onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Button, { variant: "outline", size: "sm", onClick: onAddPayment, className: "text-warning border-yellow-300", children: t("billing.ui.payment_methods.add") })
|
|
3004
3004
|
] });
|
|
3005
3005
|
}
|
|
3006
3006
|
}
|
|
@@ -3241,18 +3241,18 @@ function BillingDashboardContainer({ renderCancelDialog } = {}) {
|
|
|
3241
3241
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-8 w-8" }),
|
|
3242
3242
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: t("billing.title") })
|
|
3243
3243
|
] }),
|
|
3244
|
-
isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3245
|
-
noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3246
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3244
|
+
isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.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" }) }) }),
|
|
3245
|
+
noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.Card, { children: [
|
|
3246
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.CardHeader, { className: "text-center", children: [
|
|
3247
3247
|
/* @__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" }) }),
|
|
3248
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3249
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3248
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.CardTitle, { children: t("billing.ui.dashboard.setup_title") }),
|
|
3249
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.CardDescription, { children: t("billing.ui.dashboard.setup_description") })
|
|
3250
3250
|
] }),
|
|
3251
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3251
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.CardContent, { className: "flex justify-center pb-8", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Button, { onClick: handleCreateCustomer, disabled: creatingCustomer, size: "lg", children: creatingCustomer ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
3252
3252
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "me-2 h-4 w-4 animate-spin" }),
|
|
3253
3253
|
t("billing.ui.dashboard.setting_up")
|
|
3254
3254
|
] }) : t("billing.ui.dashboard.setup_button") }) }),
|
|
3255
|
-
errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3255
|
+
errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.CardContent, { className: "pt-0", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-center text-destructive text-xs/relaxed", children: t(errors.customer) }) })
|
|
3256
3256
|
] }),
|
|
3257
3257
|
!noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
3258
3258
|
criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -3422,18 +3422,18 @@ _chunk7QVYU63Ejs.__name.call(void 0, isStripeConfigured, "isStripeConfigured");
|
|
|
3422
3422
|
|
|
3423
3423
|
function PriceArchiver({ price }) {
|
|
3424
3424
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
3425
|
-
const fmt =
|
|
3425
|
+
const fmt = _chunkS4FSGMKXjs.useBillingFormatOptions.call(void 0, );
|
|
3426
3426
|
const { archivePrice, restorePrice } = usePriceContext();
|
|
3427
3427
|
const [open, setOpen] = _react.useState.call(void 0, false);
|
|
3428
3428
|
const isArchived = !price.active;
|
|
3429
3429
|
const scope = isArchived ? "restore" : "archive";
|
|
3430
3430
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
3431
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3431
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.Button, { variant: "outline", size: "sm", onClick: () => setOpen(true), children: [
|
|
3432
3432
|
isArchived ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RotateCcwIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ArchiveIcon, {}),
|
|
3433
3433
|
t(`billing.admin.prices.${scope}.confirm`)
|
|
3434
3434
|
] }),
|
|
3435
3435
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3436
|
-
|
|
3436
|
+
_chunkS4FSGMKXjs.ConfirmDialog,
|
|
3437
3437
|
{
|
|
3438
3438
|
open,
|
|
3439
3439
|
onOpenChange: setOpen,
|
|
@@ -3447,7 +3447,7 @@ function PriceArchiver({ price }) {
|
|
|
3447
3447
|
if (isArchived) await restorePrice(price.id);
|
|
3448
3448
|
else await archivePrice(price.id);
|
|
3449
3449
|
} catch (error) {
|
|
3450
|
-
|
|
3450
|
+
_chunkS4FSGMKXjs.errorToast.call(void 0, { title: t(`billing.admin.prices.${scope}.title`), error });
|
|
3451
3451
|
throw error;
|
|
3452
3452
|
}
|
|
3453
3453
|
}
|
|
@@ -3479,7 +3479,7 @@ function PriceEditorInternal({
|
|
|
3479
3479
|
onDialogOpenChange
|
|
3480
3480
|
}) {
|
|
3481
3481
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
3482
|
-
const fmt =
|
|
3482
|
+
const fmt = _chunkS4FSGMKXjs.useBillingFormatOptions.call(void 0, );
|
|
3483
3483
|
const router = _chunkNP3AFULUjs.useI18nRouter.call(void 0, );
|
|
3484
3484
|
const { createPrice, updatePrice, productId: contextProductId } = usePriceContext();
|
|
3485
3485
|
const [allFeatures, setAllFeatures] = _react.useState.call(void 0, []);
|
|
@@ -3621,7 +3621,7 @@ function PriceEditorInternal({
|
|
|
3621
3621
|
{ id: "metered", text: t("billing.admin.prices.usage.metered") }
|
|
3622
3622
|
];
|
|
3623
3623
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3624
|
-
|
|
3624
|
+
_chunkS4FSGMKXjs.EditorSheet,
|
|
3625
3625
|
{
|
|
3626
3626
|
form,
|
|
3627
3627
|
entityType: t("billing.admin.prices.entity"),
|
|
@@ -3676,13 +3676,13 @@ function PriceEditorInternal({
|
|
|
3676
3676
|
dialogOpen,
|
|
3677
3677
|
onDialogOpenChange,
|
|
3678
3678
|
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
3679
|
-
isEdit && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3680
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3681
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3679
|
+
isEdit && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.Alert, { children: [
|
|
3680
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.AlertTitle, { children: t("billing.admin.prices.immutability.title") }),
|
|
3681
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.AlertDescription, { children: t("billing.admin.prices.immutability.description") })
|
|
3682
3682
|
] }),
|
|
3683
3683
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
|
|
3684
3684
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3685
|
-
|
|
3685
|
+
_chunkS4FSGMKXjs.FormInput,
|
|
3686
3686
|
{
|
|
3687
3687
|
form,
|
|
3688
3688
|
id: "unitAmount",
|
|
@@ -3694,7 +3694,7 @@ function PriceEditorInternal({
|
|
|
3694
3694
|
}
|
|
3695
3695
|
),
|
|
3696
3696
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3697
|
-
|
|
3697
|
+
_chunkS4FSGMKXjs.FormSelect,
|
|
3698
3698
|
{
|
|
3699
3699
|
form,
|
|
3700
3700
|
id: "currency",
|
|
@@ -3705,7 +3705,7 @@ function PriceEditorInternal({
|
|
|
3705
3705
|
)
|
|
3706
3706
|
] }),
|
|
3707
3707
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3708
|
-
|
|
3708
|
+
_chunkS4FSGMKXjs.FormSelect,
|
|
3709
3709
|
{
|
|
3710
3710
|
form,
|
|
3711
3711
|
id: "interval",
|
|
@@ -3716,7 +3716,7 @@ function PriceEditorInternal({
|
|
|
3716
3716
|
),
|
|
3717
3717
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
|
|
3718
3718
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3719
|
-
|
|
3719
|
+
_chunkS4FSGMKXjs.FormInput,
|
|
3720
3720
|
{
|
|
3721
3721
|
form,
|
|
3722
3722
|
id: "intervalCount",
|
|
@@ -3727,7 +3727,7 @@ function PriceEditorInternal({
|
|
|
3727
3727
|
}
|
|
3728
3728
|
),
|
|
3729
3729
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3730
|
-
|
|
3730
|
+
_chunkS4FSGMKXjs.FormSelect,
|
|
3731
3731
|
{
|
|
3732
3732
|
form,
|
|
3733
3733
|
id: "usageType",
|
|
@@ -3738,7 +3738,7 @@ function PriceEditorInternal({
|
|
|
3738
3738
|
)
|
|
3739
3739
|
] }),
|
|
3740
3740
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3741
|
-
|
|
3741
|
+
_chunkS4FSGMKXjs.FormInput,
|
|
3742
3742
|
{
|
|
3743
3743
|
form,
|
|
3744
3744
|
id: "nickname",
|
|
@@ -3747,7 +3747,7 @@ function PriceEditorInternal({
|
|
|
3747
3747
|
}
|
|
3748
3748
|
),
|
|
3749
3749
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3750
|
-
|
|
3750
|
+
_chunkS4FSGMKXjs.FormTextarea,
|
|
3751
3751
|
{
|
|
3752
3752
|
form,
|
|
3753
3753
|
id: "description",
|
|
@@ -3757,7 +3757,7 @@ function PriceEditorInternal({
|
|
|
3757
3757
|
}
|
|
3758
3758
|
),
|
|
3759
3759
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3760
|
-
|
|
3760
|
+
_chunkS4FSGMKXjs.FormInput,
|
|
3761
3761
|
{
|
|
3762
3762
|
form,
|
|
3763
3763
|
id: "token",
|
|
@@ -3767,10 +3767,10 @@ function PriceEditorInternal({
|
|
|
3767
3767
|
}
|
|
3768
3768
|
),
|
|
3769
3769
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-2", children: [
|
|
3770
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3770
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.FieldLabel, { children: t("billing.admin.prices.fields.features") }),
|
|
3771
3771
|
form.watch("features").map((_, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
|
|
3772
3772
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3773
|
-
|
|
3773
|
+
_chunkS4FSGMKXjs.Input,
|
|
3774
3774
|
{
|
|
3775
3775
|
...form.register(`features.${index}`),
|
|
3776
3776
|
placeholder: t("billing.admin.prices.placeholders.feature", { index: index + 1 }),
|
|
@@ -3778,7 +3778,7 @@ function PriceEditorInternal({
|
|
|
3778
3778
|
}
|
|
3779
3779
|
),
|
|
3780
3780
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3781
|
-
|
|
3781
|
+
_chunkS4FSGMKXjs.Button,
|
|
3782
3782
|
{
|
|
3783
3783
|
type: "button",
|
|
3784
3784
|
variant: "outline",
|
|
@@ -3793,7 +3793,7 @@ function PriceEditorInternal({
|
|
|
3793
3793
|
)
|
|
3794
3794
|
] }, index)),
|
|
3795
3795
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3796
|
-
|
|
3796
|
+
_chunkS4FSGMKXjs.Button,
|
|
3797
3797
|
{
|
|
3798
3798
|
type: "button",
|
|
3799
3799
|
variant: "outline",
|
|
@@ -3808,12 +3808,12 @@ function PriceEditorInternal({
|
|
|
3808
3808
|
)
|
|
3809
3809
|
] }),
|
|
3810
3810
|
isRecurring && allFeatures.length > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-2", children: [
|
|
3811
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3811
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.FieldLabel, { children: t("billing.admin.prices.fields.platformFeatures") }),
|
|
3812
3812
|
/* @__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) => {
|
|
3813
3813
|
const isChecked = form.watch("featureIds").includes(feature.id);
|
|
3814
3814
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
3815
3815
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3816
|
-
|
|
3816
|
+
_chunkS4FSGMKXjs.Checkbox,
|
|
3817
3817
|
{
|
|
3818
3818
|
id: `feature-${feature.id}`,
|
|
3819
3819
|
checked: isChecked,
|
|
@@ -3829,13 +3829,13 @@ function PriceEditorInternal({
|
|
|
3829
3829
|
}
|
|
3830
3830
|
}
|
|
3831
3831
|
),
|
|
3832
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3832
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.FieldLabel, { htmlFor: `feature-${feature.id}`, children: feature.name }),
|
|
3833
3833
|
feature.isCore && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.admin.prices.help.core") })
|
|
3834
3834
|
] }, feature.id);
|
|
3835
3835
|
}) })
|
|
3836
3836
|
] }),
|
|
3837
3837
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3838
|
-
|
|
3838
|
+
_chunkS4FSGMKXjs.FormCheckbox,
|
|
3839
3839
|
{
|
|
3840
3840
|
form,
|
|
3841
3841
|
id: "isTrial",
|
|
@@ -3888,9 +3888,9 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3888
3888
|
productId: productIdProp
|
|
3889
3889
|
}) => {
|
|
3890
3890
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
3891
|
-
const fmt =
|
|
3892
|
-
const generateUrl =
|
|
3893
|
-
const { hasRole } =
|
|
3891
|
+
const fmt = _chunkS4FSGMKXjs.useBillingFormatOptions.call(void 0, );
|
|
3892
|
+
const generateUrl = _chunkS4FSGMKXjs.usePageUrlGenerator.call(void 0, );
|
|
3893
|
+
const { hasRole } = _chunkS4FSGMKXjs.useCurrentUserContext.call(void 0, );
|
|
3894
3894
|
const [price, setPrice] = _react.useState.call(void 0,
|
|
3895
3895
|
dehydratedPrice ? _chunk77JC2UCFjs.rehydrate.call(void 0, _chunkZ6T2575Ajs.Modules.StripePrice, dehydratedPrice) : void 0
|
|
3896
3896
|
);
|
|
@@ -3978,7 +3978,7 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3978
3978
|
}
|
|
3979
3979
|
return response;
|
|
3980
3980
|
}, "title");
|
|
3981
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3981
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceContext.Provider, { value, children }) });
|
|
3982
3982
|
}, "PriceProvider");
|
|
3983
3983
|
var usePriceContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => _nullishCoalesce(_react.useContext.call(void 0, PriceContext), () => ( defaultContextValue)), "usePriceContext");
|
|
3984
3984
|
|
|
@@ -3998,12 +3998,12 @@ function ProductArchiver({ product }) {
|
|
|
3998
3998
|
const isArchived = !product.active;
|
|
3999
3999
|
const scope = isArchived ? "restore" : "archive";
|
|
4000
4000
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
4001
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
4001
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.Button, { variant: "outline", size: "sm", onClick: () => setOpen(true), children: [
|
|
4002
4002
|
isArchived ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RotateCcwIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ArchiveIcon, {}),
|
|
4003
4003
|
t(`billing.admin.products.${scope}.confirm`)
|
|
4004
4004
|
] }),
|
|
4005
4005
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4006
|
-
|
|
4006
|
+
_chunkS4FSGMKXjs.ConfirmDialog,
|
|
4007
4007
|
{
|
|
4008
4008
|
open,
|
|
4009
4009
|
onOpenChange: setOpen,
|
|
@@ -4017,7 +4017,7 @@ function ProductArchiver({ product }) {
|
|
|
4017
4017
|
if (isArchived) await restoreProduct(product.id);
|
|
4018
4018
|
else await archiveProduct(product.id);
|
|
4019
4019
|
} catch (error) {
|
|
4020
|
-
|
|
4020
|
+
_chunkS4FSGMKXjs.errorToast.call(void 0, { title: t(`billing.admin.products.${scope}.title`), error });
|
|
4021
4021
|
throw error;
|
|
4022
4022
|
}
|
|
4023
4023
|
}
|
|
@@ -4070,7 +4070,7 @@ function ProductEditorInternal({
|
|
|
4070
4070
|
defaultValues: getDefaultValues()
|
|
4071
4071
|
});
|
|
4072
4072
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4073
|
-
|
|
4073
|
+
_chunkS4FSGMKXjs.EditorSheet,
|
|
4074
4074
|
{
|
|
4075
4075
|
form,
|
|
4076
4076
|
entityType: t("billing.admin.products.entity"),
|
|
@@ -4093,7 +4093,7 @@ function ProductEditorInternal({
|
|
|
4093
4093
|
onDialogOpenChange,
|
|
4094
4094
|
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4095
4095
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4096
|
-
|
|
4096
|
+
_chunkS4FSGMKXjs.FormInput,
|
|
4097
4097
|
{
|
|
4098
4098
|
form,
|
|
4099
4099
|
id: "name",
|
|
@@ -4103,7 +4103,7 @@ function ProductEditorInternal({
|
|
|
4103
4103
|
}
|
|
4104
4104
|
),
|
|
4105
4105
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4106
|
-
|
|
4106
|
+
_chunkS4FSGMKXjs.FormTextarea,
|
|
4107
4107
|
{
|
|
4108
4108
|
form,
|
|
4109
4109
|
id: "description",
|
|
@@ -4147,8 +4147,8 @@ var defaultContextValue2 = {
|
|
|
4147
4147
|
};
|
|
4148
4148
|
var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ children, dehydratedProduct, publishChrome = true }) => {
|
|
4149
4149
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4150
|
-
const generateUrl =
|
|
4151
|
-
const { hasRole } =
|
|
4150
|
+
const generateUrl = _chunkS4FSGMKXjs.usePageUrlGenerator.call(void 0, );
|
|
4151
|
+
const { hasRole } = _chunkS4FSGMKXjs.useCurrentUserContext.call(void 0, );
|
|
4152
4152
|
const [product, setProduct] = _react.useState.call(void 0,
|
|
4153
4153
|
dehydratedProduct ? _chunk77JC2UCFjs.rehydrate.call(void 0, _chunkZ6T2575Ajs.Modules.StripeProduct, dehydratedProduct) : void 0
|
|
4154
4154
|
);
|
|
@@ -4242,7 +4242,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
4242
4242
|
}
|
|
4243
4243
|
return response;
|
|
4244
4244
|
}, "title");
|
|
4245
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4245
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductContext.Provider, { value, children }) });
|
|
4246
4246
|
}, "ProductProvider");
|
|
4247
4247
|
var useProductContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => _nullishCoalesce(_react.useContext.call(void 0, ProductContext), () => ( defaultContextValue2)), "useProductContext");
|
|
4248
4248
|
|
|
@@ -4251,57 +4251,57 @@ var useProductContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ()
|
|
|
4251
4251
|
|
|
4252
4252
|
function PriceDetails() {
|
|
4253
4253
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4254
|
-
const fmt =
|
|
4255
|
-
const generateUrl =
|
|
4254
|
+
const fmt = _chunkS4FSGMKXjs.useBillingFormatOptions.call(void 0, );
|
|
4255
|
+
const generateUrl = _chunkS4FSGMKXjs.usePageUrlGenerator.call(void 0, );
|
|
4256
4256
|
const { price } = usePriceContext();
|
|
4257
4257
|
if (!price) return null;
|
|
4258
4258
|
const isRecurring = price.priceType === "recurring";
|
|
4259
4259
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-8", children: [
|
|
4260
4260
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4261
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4261
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.SectionHeader, { children: t("billing.admin.prices.title") }),
|
|
4262
4262
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
4263
4263
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4264
|
-
|
|
4264
|
+
_chunkS4FSGMKXjs.DetailField,
|
|
4265
4265
|
{
|
|
4266
4266
|
label: t("billing.admin.prices.fields.product"),
|
|
4267
|
-
value: price.product ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4267
|
+
value: price.product ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Link, { href: generateUrl({ page: _chunkZ6T2575Ajs.Modules.StripeProduct, id: price.product.id }), children: price.product.name }) : "\u2014"
|
|
4268
4268
|
}
|
|
4269
4269
|
),
|
|
4270
4270
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4271
|
-
|
|
4271
|
+
_chunkS4FSGMKXjs.DetailField,
|
|
4272
4272
|
{
|
|
4273
4273
|
label: t("billing.admin.prices.fields.status"),
|
|
4274
4274
|
value: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex flex-wrap items-center gap-1", children: [
|
|
4275
|
-
price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4276
|
-
price.isTrial && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4275
|
+
price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Badge, { variant: "softGreen", children: t("billing.admin.prices.status.active") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Badge, { variant: "softGray", children: t("billing.admin.prices.status.archived") }),
|
|
4276
|
+
price.isTrial && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Badge, { variant: "softBlue", children: t("billing.admin.prices.badge.trial") })
|
|
4277
4277
|
] })
|
|
4278
4278
|
}
|
|
4279
4279
|
),
|
|
4280
4280
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4281
|
-
|
|
4281
|
+
_chunkS4FSGMKXjs.DetailField,
|
|
4282
4282
|
{
|
|
4283
4283
|
label: t("billing.admin.prices.fields.amount"),
|
|
4284
4284
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _chunk77JC2UCFjs.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt) })
|
|
4285
4285
|
}
|
|
4286
4286
|
),
|
|
4287
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4287
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.DetailField, { label: t("billing.admin.prices.fields.currency"), value: price.currency.toUpperCase() }),
|
|
4288
4288
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4289
|
-
|
|
4289
|
+
_chunkS4FSGMKXjs.DetailField,
|
|
4290
4290
|
{
|
|
4291
4291
|
label: t("billing.admin.prices.fields.type"),
|
|
4292
4292
|
value: isRecurring ? t("billing.admin.prices.type.recurring") : t("billing.admin.prices.type.oneTime")
|
|
4293
4293
|
}
|
|
4294
4294
|
),
|
|
4295
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4295
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.DetailField, { label: t("billing.admin.prices.fields.billing"), value: _chunk77JC2UCFjs.formatInterval.call(void 0, price, fmt) }),
|
|
4296
4296
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4297
|
-
|
|
4297
|
+
_chunkS4FSGMKXjs.DetailField,
|
|
4298
4298
|
{
|
|
4299
4299
|
label: t("billing.admin.prices.fields.intervalCount"),
|
|
4300
4300
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _nullishCoalesce(_optionalChain([price, 'access', _163 => _163.recurring, 'optionalAccess', _164 => _164.intervalCount]), () => ( 1)) })
|
|
4301
4301
|
}
|
|
4302
4302
|
),
|
|
4303
4303
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4304
|
-
|
|
4304
|
+
_chunkS4FSGMKXjs.DetailField,
|
|
4305
4305
|
{
|
|
4306
4306
|
label: t("billing.admin.prices.fields.usageType"),
|
|
4307
4307
|
value: _optionalChain([price, 'access', _165 => _165.recurring, 'optionalAccess', _166 => _166.usageType]) === "metered" ? t("billing.admin.prices.usage.metered") : t("billing.admin.prices.usage.licensed")
|
|
@@ -4310,24 +4310,24 @@ function PriceDetails() {
|
|
|
4310
4310
|
] })
|
|
4311
4311
|
] }),
|
|
4312
4312
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4313
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4313
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.SectionHeader, { children: t("billing.admin.prices.fields.platformFeatures") }),
|
|
4314
4314
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
4315
4315
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4316
|
-
|
|
4316
|
+
_chunkS4FSGMKXjs.DetailField,
|
|
4317
4317
|
{
|
|
4318
4318
|
label: t("billing.admin.prices.fields.token"),
|
|
4319
4319
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _nullishCoalesce(price.token, () => ( "\u2014")) })
|
|
4320
4320
|
}
|
|
4321
4321
|
),
|
|
4322
4322
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4323
|
-
|
|
4323
|
+
_chunkS4FSGMKXjs.DetailField,
|
|
4324
4324
|
{
|
|
4325
4325
|
label: t("billing.admin.prices.fields.stripeId"),
|
|
4326
4326
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: price.stripePriceId })
|
|
4327
4327
|
}
|
|
4328
4328
|
),
|
|
4329
4329
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4330
|
-
|
|
4330
|
+
_chunkS4FSGMKXjs.DetailField,
|
|
4331
4331
|
{
|
|
4332
4332
|
label: t("billing.admin.prices.fields.description"),
|
|
4333
4333
|
value: _nullishCoalesce(price.description, () => ( "\u2014")),
|
|
@@ -4335,7 +4335,7 @@ function PriceDetails() {
|
|
|
4335
4335
|
}
|
|
4336
4336
|
),
|
|
4337
4337
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4338
|
-
|
|
4338
|
+
_chunkS4FSGMKXjs.DetailField,
|
|
4339
4339
|
{
|
|
4340
4340
|
label: t("billing.admin.prices.fields.features"),
|
|
4341
4341
|
className: "md:col-span-2",
|
|
@@ -4343,11 +4343,11 @@ function PriceDetails() {
|
|
|
4343
4343
|
}
|
|
4344
4344
|
),
|
|
4345
4345
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4346
|
-
|
|
4346
|
+
_chunkS4FSGMKXjs.DetailField,
|
|
4347
4347
|
{
|
|
4348
4348
|
label: t("billing.admin.prices.fields.platformFeatures"),
|
|
4349
4349
|
className: "md:col-span-2",
|
|
4350
|
-
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,
|
|
4350
|
+
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, _chunkS4FSGMKXjs.Badge, { variant: "softGray", children: feature.name }, feature.id)) }) : "\u2014"
|
|
4351
4351
|
}
|
|
4352
4352
|
)
|
|
4353
4353
|
] })
|
|
@@ -4361,7 +4361,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, PriceDetails, "PriceDetails");
|
|
|
4361
4361
|
function PriceContainer() {
|
|
4362
4362
|
const { price } = usePriceContext();
|
|
4363
4363
|
if (!price) return null;
|
|
4364
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4364
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.RoundPageContainer, { module: _chunkZ6T2575Ajs.Modules.StripePrice, id: price.id, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceDetails, {}) });
|
|
4365
4365
|
}
|
|
4366
4366
|
_chunk7QVYU63Ejs.__name.call(void 0, PriceContainer, "PriceContainer");
|
|
4367
4367
|
|
|
@@ -4486,7 +4486,7 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4486
4486
|
const importInputRef = _react.useRef.call(void 0, null);
|
|
4487
4487
|
const [seed, setSeed] = _react.useState.call(void 0, void 0);
|
|
4488
4488
|
const [seedNonce, setSeedNonce] = _react.useState.call(void 0, 0);
|
|
4489
|
-
const data =
|
|
4489
|
+
const data = _chunkS4FSGMKXjs.useDataListRetriever.call(void 0, {
|
|
4490
4490
|
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunk77JC2UCFjs.StripePriceService.listPrices({ ...params, productId }), "retriever"),
|
|
4491
4491
|
retrieverParams: {},
|
|
4492
4492
|
module: _chunkZ6T2575Ajs.Modules.StripePrice
|
|
@@ -4524,7 +4524,7 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4524
4524
|
openSeededEditor(transfer.price);
|
|
4525
4525
|
} catch (error) {
|
|
4526
4526
|
console.error("[PricesList] price import failed", error);
|
|
4527
|
-
|
|
4527
|
+
_chunkS4FSGMKXjs.errorToast.call(void 0, {
|
|
4528
4528
|
title: t("billing.admin.prices.import.errors.title"),
|
|
4529
4529
|
error: t("billing.admin.prices.import.errors.invalid")
|
|
4530
4530
|
});
|
|
@@ -4543,7 +4543,7 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4543
4543
|
"create-price"
|
|
4544
4544
|
),
|
|
4545
4545
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _react.Fragment, { children: [
|
|
4546
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
4546
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkS4FSGMKXjs.Button, { variant: "outline", size: "sm", type: "button", onClick: () => _optionalChain([importInputRef, 'access', _181 => _181.current, 'optionalAccess', _182 => _182.click, 'call', _183 => _183()]), children: [
|
|
4547
4547
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.UploadIcon, {}),
|
|
4548
4548
|
t("billing.admin.prices.actions.import")
|
|
4549
4549
|
] }),
|
|
@@ -4561,7 +4561,7 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4561
4561
|
];
|
|
4562
4562
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
4563
4563
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4564
|
-
|
|
4564
|
+
_chunkS4FSGMKXjs.ContentListTable,
|
|
4565
4565
|
{
|
|
4566
4566
|
data,
|
|
4567
4567
|
fields: [
|
|
@@ -4578,7 +4578,7 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4578
4578
|
fullWidth,
|
|
4579
4579
|
title: t("billing.admin.prices.title"),
|
|
4580
4580
|
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4581
|
-
|
|
4581
|
+
_chunkS4FSGMKXjs.EmptyState,
|
|
4582
4582
|
{
|
|
4583
4583
|
icon: _lucidereact.DollarSignIcon,
|
|
4584
4584
|
title: t("billing.admin.prices.empty.title"),
|
|
@@ -4618,18 +4618,18 @@ function ProductDetails() {
|
|
|
4618
4618
|
const { product } = useProductContext();
|
|
4619
4619
|
if (!product) return null;
|
|
4620
4620
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4621
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4621
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.SectionHeader, { children: t("billing.admin.products.tabs.details") }),
|
|
4622
4622
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
4623
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4623
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.DetailField, { label: t("billing.admin.products.fields.name"), value: product.name }),
|
|
4624
4624
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4625
|
-
|
|
4625
|
+
_chunkS4FSGMKXjs.DetailField,
|
|
4626
4626
|
{
|
|
4627
4627
|
label: t("billing.admin.products.fields.status"),
|
|
4628
|
-
value: product.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4628
|
+
value: product.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Badge, { variant: "softGreen", children: t("billing.admin.products.status.active") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Badge, { variant: "softGray", children: t("billing.admin.products.status.archived") })
|
|
4629
4629
|
}
|
|
4630
4630
|
),
|
|
4631
4631
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4632
|
-
|
|
4632
|
+
_chunkS4FSGMKXjs.DetailField,
|
|
4633
4633
|
{
|
|
4634
4634
|
label: t("billing.admin.products.fields.description"),
|
|
4635
4635
|
value: _nullishCoalesce(product.description, () => ( "\u2014")),
|
|
@@ -4637,14 +4637,14 @@ function ProductDetails() {
|
|
|
4637
4637
|
}
|
|
4638
4638
|
),
|
|
4639
4639
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4640
|
-
|
|
4640
|
+
_chunkS4FSGMKXjs.DetailField,
|
|
4641
4641
|
{
|
|
4642
4642
|
label: t("billing.admin.products.fields.prices"),
|
|
4643
4643
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: product.stripePrices.length })
|
|
4644
4644
|
}
|
|
4645
4645
|
),
|
|
4646
4646
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4647
|
-
|
|
4647
|
+
_chunkS4FSGMKXjs.DetailField,
|
|
4648
4648
|
{
|
|
4649
4649
|
label: t("billing.admin.products.fields.stripeId"),
|
|
4650
4650
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: product.stripeProductId })
|
|
@@ -4662,7 +4662,7 @@ function ProductContainer() {
|
|
|
4662
4662
|
const { product } = useProductContext();
|
|
4663
4663
|
if (!product) return null;
|
|
4664
4664
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4665
|
-
|
|
4665
|
+
_chunkS4FSGMKXjs.RoundPageContainer,
|
|
4666
4666
|
{
|
|
4667
4667
|
module: _chunkZ6T2575Ajs.Modules.StripeProduct,
|
|
4668
4668
|
id: product.id,
|
|
@@ -4699,8 +4699,8 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductContainer, "ProductContainer");
|
|
|
4699
4699
|
|
|
4700
4700
|
function CouponsList({ fullWidth } = {}) {
|
|
4701
4701
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4702
|
-
const { catalogueVersion } =
|
|
4703
|
-
const data =
|
|
4702
|
+
const { catalogueVersion } = _chunkS4FSGMKXjs.useCouponContext.call(void 0, );
|
|
4703
|
+
const data = _chunkS4FSGMKXjs.useDataListRetriever.call(void 0, {
|
|
4704
4704
|
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunk77JC2UCFjs.StripeCouponService.listCoupons(params), "retriever"),
|
|
4705
4705
|
retrieverParams: {},
|
|
4706
4706
|
module: _chunkZ6T2575Ajs.Modules.StripeCoupon
|
|
@@ -4708,9 +4708,9 @@ function CouponsList({ fullWidth } = {}) {
|
|
|
4708
4708
|
_react.useEffect.call(void 0, () => {
|
|
4709
4709
|
if (catalogueVersion > 0) void data.refresh();
|
|
4710
4710
|
}, [catalogueVersion]);
|
|
4711
|
-
const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4711
|
+
const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.CouponEditor, {}, "create-coupon")];
|
|
4712
4712
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4713
|
-
|
|
4713
|
+
_chunkS4FSGMKXjs.ContentListTable,
|
|
4714
4714
|
{
|
|
4715
4715
|
data,
|
|
4716
4716
|
fields: [
|
|
@@ -4725,7 +4725,7 @@ function CouponsList({ fullWidth } = {}) {
|
|
|
4725
4725
|
fullWidth,
|
|
4726
4726
|
title: t("billing.admin.coupons.title"),
|
|
4727
4727
|
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4728
|
-
|
|
4728
|
+
_chunkS4FSGMKXjs.EmptyState,
|
|
4729
4729
|
{
|
|
4730
4730
|
icon: _lucidereact.TicketPercentIcon,
|
|
4731
4731
|
title: t("billing.admin.coupons.empty.title"),
|
|
@@ -4745,7 +4745,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, CouponsList, "CouponsList");
|
|
|
4745
4745
|
function ProductsList({ fullWidth } = {}) {
|
|
4746
4746
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4747
4747
|
const { catalogueVersion } = useProductContext();
|
|
4748
|
-
const data =
|
|
4748
|
+
const data = _chunkS4FSGMKXjs.useDataListRetriever.call(void 0, {
|
|
4749
4749
|
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunk77JC2UCFjs.StripeProductService.listProducts(params), "retriever"),
|
|
4750
4750
|
retrieverParams: {},
|
|
4751
4751
|
module: _chunkZ6T2575Ajs.Modules.StripeProduct
|
|
@@ -4755,7 +4755,7 @@ function ProductsList({ fullWidth } = {}) {
|
|
|
4755
4755
|
}, [catalogueVersion]);
|
|
4756
4756
|
const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductEditor, {}, "create-product")];
|
|
4757
4757
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4758
|
-
|
|
4758
|
+
_chunkS4FSGMKXjs.ContentListTable,
|
|
4759
4759
|
{
|
|
4760
4760
|
data,
|
|
4761
4761
|
fields: ["name" /* name */, "status" /* status */, "prices" /* prices */],
|
|
@@ -4764,7 +4764,7 @@ function ProductsList({ fullWidth } = {}) {
|
|
|
4764
4764
|
fullWidth,
|
|
4765
4765
|
title: t("billing.admin.products.title"),
|
|
4766
4766
|
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4767
|
-
|
|
4767
|
+
_chunkS4FSGMKXjs.EmptyState,
|
|
4768
4768
|
{
|
|
4769
4769
|
icon: _lucidereact.PackageIcon,
|
|
4770
4770
|
title: t("billing.admin.products.empty.title"),
|
|
@@ -4780,8 +4780,8 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductsList, "ProductsList");
|
|
|
4780
4780
|
|
|
4781
4781
|
function ProductsListContainer() {
|
|
4782
4782
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4783
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductProvider, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4784
|
-
|
|
4783
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductProvider, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.CouponProvider, { publishChrome: false, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4784
|
+
_chunkS4FSGMKXjs.RoundPageContainer,
|
|
4785
4785
|
{
|
|
4786
4786
|
module: _chunkZ6T2575Ajs.Modules.StripeProduct,
|
|
4787
4787
|
tabs: [
|
|
@@ -4801,30 +4801,30 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductsListContainer, "ProductsListContain
|
|
|
4801
4801
|
|
|
4802
4802
|
function CouponDetails() {
|
|
4803
4803
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4804
|
-
const fmt =
|
|
4805
|
-
const { coupon } =
|
|
4804
|
+
const fmt = _chunkS4FSGMKXjs.useBillingFormatOptions.call(void 0, );
|
|
4805
|
+
const { coupon } = _chunkS4FSGMKXjs.useCouponContext.call(void 0, );
|
|
4806
4806
|
if (!coupon) return null;
|
|
4807
4807
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4808
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4808
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.SectionHeader, { children: t("billing.admin.products.tabs.details") }),
|
|
4809
4809
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-xs/relaxed", children: t("billing.admin.coupons.fixed_notice") }),
|
|
4810
4810
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
4811
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4811
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.DetailField, { label: t("billing.admin.coupons.fields.name"), value: coupon.name }),
|
|
4812
4812
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4813
|
-
|
|
4813
|
+
_chunkS4FSGMKXjs.DetailField,
|
|
4814
4814
|
{
|
|
4815
4815
|
label: t("billing.admin.coupons.fields.status"),
|
|
4816
|
-
value: coupon.valid ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4816
|
+
value: coupon.valid ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Badge, { variant: "softGreen", children: t("billing.admin.coupons.status.active") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.Badge, { variant: "softGray", children: t("billing.admin.coupons.status.ended") })
|
|
4817
4817
|
}
|
|
4818
4818
|
),
|
|
4819
4819
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4820
|
-
|
|
4820
|
+
_chunkS4FSGMKXjs.DetailField,
|
|
4821
4821
|
{
|
|
4822
4822
|
label: t("billing.admin.coupons.fields.discount"),
|
|
4823
4823
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _chunk77JC2UCFjs.formatCouponDiscount.call(void 0, coupon, t, fmt) })
|
|
4824
4824
|
}
|
|
4825
4825
|
),
|
|
4826
4826
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4827
|
-
|
|
4827
|
+
_chunkS4FSGMKXjs.DetailField,
|
|
4828
4828
|
{
|
|
4829
4829
|
label: t("billing.admin.coupons.fields.places"),
|
|
4830
4830
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: coupon.maxRedemptions !== void 0 ? t("billing.admin.coupons.places.limited", {
|
|
@@ -4834,21 +4834,21 @@ function CouponDetails() {
|
|
|
4834
4834
|
}
|
|
4835
4835
|
),
|
|
4836
4836
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4837
|
-
|
|
4837
|
+
_chunkS4FSGMKXjs.DetailField,
|
|
4838
4838
|
{
|
|
4839
4839
|
label: t("billing.admin.coupons.fields.products"),
|
|
4840
4840
|
value: coupon.stripeProductIds.length > 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: coupon.stripeProductIds.join(", ") }) : t("billing.admin.coupons.all_products")
|
|
4841
4841
|
}
|
|
4842
4842
|
),
|
|
4843
4843
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4844
|
-
|
|
4844
|
+
_chunkS4FSGMKXjs.DetailField,
|
|
4845
4845
|
{
|
|
4846
4846
|
label: t("billing.admin.coupons.fields.redeemBy"),
|
|
4847
|
-
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: coupon.redeemBy ?
|
|
4847
|
+
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: coupon.redeemBy ? _chunkS4FSGMKXjs.formatDate.call(void 0, coupon.redeemBy, fmt) : "\u2014" })
|
|
4848
4848
|
}
|
|
4849
4849
|
),
|
|
4850
4850
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4851
|
-
|
|
4851
|
+
_chunkS4FSGMKXjs.DetailField,
|
|
4852
4852
|
{
|
|
4853
4853
|
label: t("billing.admin.coupons.fields.stripeId"),
|
|
4854
4854
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: coupon.stripeCouponId })
|
|
@@ -4883,15 +4883,15 @@ function CouponCodeEditorInternal({
|
|
|
4883
4883
|
}) {
|
|
4884
4884
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4885
4885
|
const router = _chunkNP3AFULUjs.useI18nRouter.call(void 0, );
|
|
4886
|
-
const { createCode } =
|
|
4887
|
-
const formSchema2 = _react.useMemo.call(void 0, () => _zod3.z.object({ id: _zod3.z.uuidv4() }).and(
|
|
4888
|
-
const getDefaultValues = _react.useCallback.call(void 0, () => ({ id: _uuid.v4.call(void 0, ), ...
|
|
4886
|
+
const { createCode } = _chunkS4FSGMKXjs.useCouponContext.call(void 0, );
|
|
4887
|
+
const formSchema2 = _react.useMemo.call(void 0, () => _zod3.z.object({ id: _zod3.z.uuidv4() }).and(_chunkS4FSGMKXjs.couponCodeSchema.call(void 0, t)), [t]);
|
|
4888
|
+
const getDefaultValues = _react.useCallback.call(void 0, () => ({ id: _uuid.v4.call(void 0, ), ..._chunkS4FSGMKXjs.couponCodeDefaults.call(void 0, ) }), []);
|
|
4889
4889
|
const form = _reacthookform.useForm.call(void 0, {
|
|
4890
4890
|
resolver: _zod.zodResolver.call(void 0, formSchema2),
|
|
4891
4891
|
defaultValues: getDefaultValues()
|
|
4892
4892
|
});
|
|
4893
4893
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4894
|
-
|
|
4894
|
+
_chunkS4FSGMKXjs.EditorSheet,
|
|
4895
4895
|
{
|
|
4896
4896
|
form,
|
|
4897
4897
|
entityType: t("billing.admin.coupons.codes.entity"),
|
|
@@ -4901,14 +4901,14 @@ function CouponCodeEditorInternal({
|
|
|
4901
4901
|
onSuccess: _nullishCoalesce(onSuccess, () => ( (() => {
|
|
4902
4902
|
}))),
|
|
4903
4903
|
onNavigate: (url) => router.push(url),
|
|
4904
|
-
onSubmit: async (values) => await createCode({ id: values.id, couponId, ...
|
|
4904
|
+
onSubmit: async (values) => await createCode({ id: values.id, couponId, ..._chunkS4FSGMKXjs.toCouponCodeInput.call(void 0, values) }),
|
|
4905
4905
|
onReset: getDefaultValues,
|
|
4906
4906
|
trigger,
|
|
4907
4907
|
forceShow,
|
|
4908
4908
|
onClose,
|
|
4909
4909
|
dialogOpen,
|
|
4910
4910
|
onDialogOpenChange,
|
|
4911
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4911
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkS4FSGMKXjs.CouponCodeFields, { form })
|
|
4912
4912
|
}
|
|
4913
4913
|
);
|
|
4914
4914
|
}
|
|
@@ -4922,8 +4922,8 @@ _chunk7QVYU63Ejs.__name.call(void 0, CouponCodeEditor, "CouponCodeEditor");
|
|
|
4922
4922
|
|
|
4923
4923
|
function CouponCodesList({ couponId }) {
|
|
4924
4924
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4925
|
-
const { catalogueVersion } =
|
|
4926
|
-
const data =
|
|
4925
|
+
const { catalogueVersion } = _chunkS4FSGMKXjs.useCouponContext.call(void 0, );
|
|
4926
|
+
const data = _chunkS4FSGMKXjs.useDataListRetriever.call(void 0, {
|
|
4927
4927
|
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunk77JC2UCFjs.StripeCouponCodeService.listByCoupon({ ...params, couponId }), "retriever"),
|
|
4928
4928
|
retrieverParams: {},
|
|
4929
4929
|
module: _chunkZ6T2575Ajs.Modules.StripeCouponCode
|
|
@@ -4933,7 +4933,7 @@ function CouponCodesList({ couponId }) {
|
|
|
4933
4933
|
}, [catalogueVersion]);
|
|
4934
4934
|
const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, CouponCodeEditor, { couponId }, "create-code")];
|
|
4935
4935
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4936
|
-
|
|
4936
|
+
_chunkS4FSGMKXjs.ContentListTable,
|
|
4937
4937
|
{
|
|
4938
4938
|
data,
|
|
4939
4939
|
fields: [
|
|
@@ -4948,7 +4948,7 @@ function CouponCodesList({ couponId }) {
|
|
|
4948
4948
|
functions,
|
|
4949
4949
|
title: t("billing.admin.coupons.codes.title"),
|
|
4950
4950
|
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4951
|
-
|
|
4951
|
+
_chunkS4FSGMKXjs.EmptyState,
|
|
4952
4952
|
{
|
|
4953
4953
|
icon: _lucidereact.TicketIcon,
|
|
4954
4954
|
title: t("billing.admin.coupons.codes.empty.title"),
|
|
@@ -4964,12 +4964,12 @@ _chunk7QVYU63Ejs.__name.call(void 0, CouponCodesList, "CouponCodesList");
|
|
|
4964
4964
|
|
|
4965
4965
|
function CouponContainer() {
|
|
4966
4966
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4967
|
-
const { coupon } =
|
|
4967
|
+
const { coupon } = _chunkS4FSGMKXjs.useCouponContext.call(void 0, );
|
|
4968
4968
|
if (!coupon) return null;
|
|
4969
4969
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4970
|
-
|
|
4970
|
+
_chunkS4FSGMKXjs.RoundPageContainer,
|
|
4971
4971
|
{
|
|
4972
|
-
module:
|
|
4972
|
+
module: _chunkS4FSGMKXjs.couponPageModule.call(void 0, ),
|
|
4973
4973
|
id: coupon.id,
|
|
4974
4974
|
tabs: [
|
|
4975
4975
|
{
|
|
@@ -5076,5 +5076,5 @@ _chunk7QVYU63Ejs.__name.call(void 0, CouponContainer, "CouponContainer");
|
|
|
5076
5076
|
|
|
5077
5077
|
|
|
5078
5078
|
|
|
5079
|
-
exports.BillingAlertBanner = BillingAlertBanner; exports.BillingDashboardContainer = BillingDashboardContainer; exports.BillingDetailModal = BillingDetailModal; exports.BillingUsageSummaryCard = BillingUsageSummaryCard; exports.CancelSubscriptionDialog = CancelSubscriptionDialog; exports.CouponCodeActions =
|
|
5079
|
+
exports.BillingAlertBanner = BillingAlertBanner; exports.BillingDashboardContainer = BillingDashboardContainer; exports.BillingDetailModal = BillingDetailModal; exports.BillingUsageSummaryCard = BillingUsageSummaryCard; exports.CancelSubscriptionDialog = CancelSubscriptionDialog; exports.CouponCodeActions = _chunkS4FSGMKXjs.CouponCodeActions; exports.CouponCodeEditor = CouponCodeEditor; exports.CouponCodeFields = _chunkS4FSGMKXjs.CouponCodeFields; exports.CouponCodesList = CouponCodesList; exports.CouponContainer = CouponContainer; exports.CouponDetails = CouponDetails; exports.CouponEditor = _chunkS4FSGMKXjs.CouponEditor; exports.CouponProvider = _chunkS4FSGMKXjs.CouponProvider; exports.CouponRefresher = _chunkS4FSGMKXjs.CouponRefresher; exports.CouponsList = CouponsList; 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.SubscriptionWizard = SubscriptionWizard; exports.SubscriptionsContainer = SubscriptionsContainer; exports.SubscriptionsList = SubscriptionsList; exports.UsageContainer = UsageContainer; exports.UsageHistoryTable = UsageHistoryTable; exports.UsageSummaryCard = UsageSummaryCard; exports.UsageSummaryCards = UsageSummaryCards; exports.WizardProgressIndicator = WizardProgressIndicator; exports.WizardStepPaymentMethod = WizardStepPaymentMethod; exports.WizardStepPlanSelection = WizardStepPlanSelection; exports.WizardStepReview = WizardStepReview; exports.applyDiscount = _chunkS4FSGMKXjs.applyDiscount; exports.couponCodeDefaults = _chunkS4FSGMKXjs.couponCodeDefaults; exports.couponCodeSchema = _chunkS4FSGMKXjs.couponCodeSchema; exports.couponCurrencyOptions = _chunkS4FSGMKXjs.couponCurrencyOptions; exports.formatCurrency = _chunk77JC2UCFjs.formatCurrency; exports.formatDate = _chunkS4FSGMKXjs.formatDate; exports.formatFixed = _chunk77JC2UCFjs.formatFixed; exports.formatInterval = _chunk77JC2UCFjs.formatInterval; exports.isStripeConfigured = isStripeConfigured; exports.optionalDate = _chunkS4FSGMKXjs.optionalDate; exports.optionalDecimal = _chunkS4FSGMKXjs.optionalDecimal; exports.optionalPositiveInt = _chunkS4FSGMKXjs.optionalPositiveInt; exports.parseOptionalDecimal = _chunkS4FSGMKXjs.parseOptionalDecimal; exports.parseOptionalPositiveInt = _chunkS4FSGMKXjs.parseOptionalPositiveInt; exports.priceLabel = priceLabel; exports.promotionCodeDiscount = _chunkS4FSGMKXjs.promotionCodeDiscount; exports.subscriptionDiscount = _chunkS4FSGMKXjs.subscriptionDiscount; exports.toCouponCodeInput = _chunkS4FSGMKXjs.toCouponCodeInput; exports.useBillingFormatOptions = _chunkS4FSGMKXjs.useBillingFormatOptions; exports.useCouponContext = _chunkS4FSGMKXjs.useCouponContext; exports.usePriceContext = usePriceContext; exports.useProductContext = useProductContext;
|
|
5080
5080
|
//# sourceMappingURL=index.js.map
|