@carlonicora/nextjs-jsonapi 5.7.0 → 5.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{BlockNoteEditor-ZHXXFWUJ.js → BlockNoteEditor-ARUXU5AV.js} +9 -9
- package/dist/{BlockNoteEditor-ZHXXFWUJ.js.map → BlockNoteEditor-ARUXU5AV.js.map} +1 -1
- package/dist/{BlockNoteEditor-R3WXUFHX.mjs → BlockNoteEditor-MNNISNVN.mjs} +2 -2
- package/dist/billing/index.js +381 -380
- package/dist/billing/index.js.map +1 -1
- package/dist/billing/index.mjs +3 -2
- package/dist/billing/index.mjs.map +1 -1
- package/dist/{chunk-CFB6FHIY.mjs → chunk-2FNSDBJG.mjs} +9 -6
- package/dist/chunk-2FNSDBJG.mjs.map +1 -0
- package/dist/{chunk-ZCOPOO7T.js → chunk-2WK35GO2.js} +10 -7
- package/dist/chunk-2WK35GO2.js.map +1 -0
- package/dist/client/index.js +2 -2
- package/dist/client/index.mjs +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 +58 -58
- package/dist/email-automations/index.mjs +1 -1
- package/dist/features/analytics/index.js +87 -87
- 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 +74 -74
- package/dist/features/tokenusage/index.mjs +1 -1
- package/package.json +1 -1
- package/src/features/billing/stripe-coupon/components/containers/CouponContainer.tsx +2 -2
- package/src/features/billing/stripe-coupon/components/forms/CouponEditor.tsx +1 -11
- package/src/features/billing/stripe-coupon/utils/__tests__/coupon-page-module.spec.ts +32 -0
- package/src/features/billing/stripe-coupon/utils/coupon-page-module.ts +13 -0
- package/dist/chunk-CFB6FHIY.mjs.map +0 -1
- package/dist/chunk-ZCOPOO7T.js.map +0 -1
- /package/dist/{BlockNoteEditor-R3WXUFHX.mjs.map → BlockNoteEditor-MNNISNVN.mjs.map} +0 -0
package/dist/billing/index.js
CHANGED
|
@@ -80,7 +80,8 @@
|
|
|
80
80
|
|
|
81
81
|
|
|
82
82
|
|
|
83
|
-
|
|
83
|
+
|
|
84
|
+
var _chunk2WK35GO2js = require('../chunk-2WK35GO2.js');
|
|
84
85
|
|
|
85
86
|
|
|
86
87
|
var _chunkXOSC3FFPjs = require('../chunk-XOSC3FFP.js');
|
|
@@ -156,43 +157,43 @@ function SubscriptionSummaryCard({
|
|
|
156
157
|
onManageClick
|
|
157
158
|
}) {
|
|
158
159
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
159
|
-
const fmt =
|
|
160
|
+
const fmt = _chunk2WK35GO2js.useBillingFormatOptions.call(void 0, );
|
|
160
161
|
if (loading) {
|
|
161
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
162
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
163
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
162
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.Card, { children: [
|
|
163
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
164
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardTitle, { children: t("billing.ui.subscriptions.title") }),
|
|
164
165
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
165
166
|
] }),
|
|
166
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
167
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
168
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
169
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
167
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.CardContent, { children: [
|
|
168
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
169
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Skeleton, { className: "h-4 w-24 mb-1" }),
|
|
170
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Skeleton, { className: "h-4 w-40" })
|
|
170
171
|
] })
|
|
171
172
|
] });
|
|
172
173
|
}
|
|
173
174
|
if (error) {
|
|
174
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
175
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
176
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
175
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.Card, { children: [
|
|
176
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
177
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardTitle, { children: t("billing.ui.subscriptions.title") }),
|
|
177
178
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
178
179
|
] }),
|
|
179
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
180
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
180
181
|
] });
|
|
181
182
|
}
|
|
182
183
|
const activeSubscriptions = subscriptions.filter(
|
|
183
184
|
(sub) => sub.status === "active" /* ACTIVE */ || sub.status === "trialing" /* TRIALING */
|
|
184
185
|
);
|
|
185
186
|
const primarySubscription = activeSubscriptions[0];
|
|
186
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
187
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
188
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
187
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
|
|
188
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
189
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardTitle, { children: t("billing.ui.subscriptions.title") }),
|
|
189
190
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
190
191
|
] }),
|
|
191
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
192
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardContent, { children: !primarySubscription ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
192
193
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: t("billing.ui.cards.subscriptions.empty_title") }),
|
|
193
194
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.subscriptions.empty_description") }),
|
|
194
195
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
195
|
-
|
|
196
|
+
_chunk2WK35GO2js.Button,
|
|
196
197
|
{
|
|
197
198
|
variant: "outline",
|
|
198
199
|
size: "sm",
|
|
@@ -211,7 +212,7 @@ function SubscriptionSummaryCard({
|
|
|
211
212
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
212
213
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: formatPlanName(primarySubscription, t("billing.ui.cards.subscriptions.fallback_name")) }),
|
|
213
214
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
214
|
-
|
|
215
|
+
_chunk2WK35GO2js.Badge,
|
|
215
216
|
{
|
|
216
217
|
variant: primarySubscription.cancelAtPeriodEnd ? "secondary" : getStatusBadgeVariant(primarySubscription.status),
|
|
217
218
|
children: primarySubscription.cancelAtPeriodEnd ? t("billing.ui.cards.subscriptions.canceling") : SUBSCRIPTION_STATUSES.includes(primarySubscription.status) ? t(`billing.ui.subscription_status.${primarySubscription.status}`) : primarySubscription.status
|
|
@@ -219,11 +220,11 @@ function SubscriptionSummaryCard({
|
|
|
219
220
|
)
|
|
220
221
|
] }),
|
|
221
222
|
/* @__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", {
|
|
222
|
-
date:
|
|
223
|
+
date: _chunk2WK35GO2js.formatDate.call(void 0, primarySubscription.currentPeriodEnd, fmt)
|
|
223
224
|
}) : primarySubscription.cancelAtPeriodEnd ? t("billing.ui.cards.subscriptions.cancels_on", {
|
|
224
|
-
date:
|
|
225
|
+
date: _chunk2WK35GO2js.formatDate.call(void 0, primarySubscription.currentPeriodEnd, fmt)
|
|
225
226
|
}) : t("billing.ui.cards.subscriptions.renews_on", {
|
|
226
|
-
date:
|
|
227
|
+
date: _chunk2WK35GO2js.formatDate.call(void 0, primarySubscription.currentPeriodEnd, fmt)
|
|
227
228
|
}) }),
|
|
228
229
|
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 }) })
|
|
229
230
|
] }) })
|
|
@@ -257,37 +258,37 @@ function PaymentMethodSummaryCard({
|
|
|
257
258
|
}) {
|
|
258
259
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
259
260
|
if (loading) {
|
|
260
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
261
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
262
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
261
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.Card, { children: [
|
|
262
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
263
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardTitle, { children: t("billing.ui.payment_method.title") }),
|
|
263
264
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
264
265
|
] }),
|
|
265
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
266
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
267
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
266
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.CardContent, { children: [
|
|
267
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
268
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Skeleton, { className: "h-4 w-24" })
|
|
268
269
|
] })
|
|
269
270
|
] });
|
|
270
271
|
}
|
|
271
272
|
if (error) {
|
|
272
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
273
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
274
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
273
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.Card, { children: [
|
|
274
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
275
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardTitle, { children: t("billing.ui.payment_method.title") }),
|
|
275
276
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
276
277
|
] }),
|
|
277
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
278
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
278
279
|
] });
|
|
279
280
|
}
|
|
280
281
|
const defaultMethod = paymentMethods.find((pm) => pm.id === defaultPaymentMethodId) || paymentMethods[0];
|
|
281
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
282
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
283
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
282
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
|
|
283
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
284
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardTitle, { children: t("billing.ui.payment_method.title") }),
|
|
284
285
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
285
286
|
] }),
|
|
286
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
287
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardContent, { children: paymentMethods.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
287
288
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: t("billing.ui.cards.payment_method.empty_title") }),
|
|
288
289
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.payment_method.empty_description") }),
|
|
289
290
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
290
|
-
|
|
291
|
+
_chunk2WK35GO2js.Button,
|
|
291
292
|
{
|
|
292
293
|
variant: "outline",
|
|
293
294
|
size: "sm",
|
|
@@ -351,45 +352,45 @@ function CustomerInfoCard({ customer, loading, error }) {
|
|
|
351
352
|
}
|
|
352
353
|
}, "handlePortalClick");
|
|
353
354
|
if (loading) {
|
|
354
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
355
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
356
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
355
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.Card, { children: [
|
|
356
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
357
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardTitle, { children: t("billing.ui.cards.customer.title") }),
|
|
357
358
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
358
359
|
] }),
|
|
359
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
360
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
361
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
362
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
360
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.CardContent, { children: [
|
|
361
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
362
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Skeleton, { className: "h-4 w-48 mb-1" }),
|
|
363
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Skeleton, { className: "h-4 w-24" })
|
|
363
364
|
] })
|
|
364
365
|
] });
|
|
365
366
|
}
|
|
366
367
|
if (error) {
|
|
367
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
368
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
369
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
368
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.Card, { children: [
|
|
369
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
370
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardTitle, { children: t("billing.ui.cards.customer.title") }),
|
|
370
371
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
371
372
|
] }),
|
|
372
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
373
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
373
374
|
] });
|
|
374
375
|
}
|
|
375
376
|
if (!customer) {
|
|
376
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
377
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
378
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
377
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.Card, { children: [
|
|
378
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
379
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardTitle, { children: t("billing.ui.cards.customer.title") }),
|
|
379
380
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
380
381
|
] }),
|
|
381
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
382
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.CardContent, { children: [
|
|
382
383
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: t("billing.ui.cards.customer.not_set_up") }),
|
|
383
384
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.customer.not_set_up_description") })
|
|
384
385
|
] })
|
|
385
386
|
] });
|
|
386
387
|
}
|
|
387
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
388
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
389
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
388
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.Card, { children: [
|
|
389
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
390
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardTitle, { children: t("billing.ui.cards.customer.title") }),
|
|
390
391
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
391
392
|
] }),
|
|
392
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
393
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
393
394
|
customer.name && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: customer.name }),
|
|
394
395
|
customer.email && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: customer.email }),
|
|
395
396
|
customer.balance !== void 0 && customer.balance !== 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm", children: [
|
|
@@ -399,7 +400,7 @@ function CustomerInfoCard({ customer, loading, error }) {
|
|
|
399
400
|
] }),
|
|
400
401
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: customer.balance < 0 ? "text-success" : "text-destructive", children: formatBalance(customer.balance, customer.currency, locale) })
|
|
401
402
|
] }),
|
|
402
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
403
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.Button, { variant: "outline", size: "sm", className: "mt-2", onClick: handlePortalClick, disabled: portalLoading, children: [
|
|
403
404
|
portalLoading ? t("common.loading") : t("billing.ui.cards.customer.manage_portal"),
|
|
404
405
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ExternalLink, { className: "h-4 w-4 ms-1" })
|
|
405
406
|
] })
|
|
@@ -437,46 +438,46 @@ function formatAmount(amount, currency, locale) {
|
|
|
437
438
|
_chunk7QVYU63Ejs.__name.call(void 0, formatAmount, "formatAmount");
|
|
438
439
|
function InvoicesSummaryCard({ invoices, loading, error, onViewAllClick }) {
|
|
439
440
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
440
|
-
const fmt =
|
|
441
|
+
const fmt = _chunk2WK35GO2js.useBillingFormatOptions.call(void 0, );
|
|
441
442
|
if (loading) {
|
|
442
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
443
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
444
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
443
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.Card, { children: [
|
|
444
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
445
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardTitle, { children: t("billing.ui.cards.invoices.title") }),
|
|
445
446
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
446
447
|
] }),
|
|
447
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
448
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
449
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
450
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
448
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.CardContent, { children: [
|
|
449
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Skeleton, { className: "h-6 w-24 mb-2" }),
|
|
450
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Skeleton, { className: "h-4 w-32 mb-1" }),
|
|
451
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Skeleton, { className: "h-4 w-20" })
|
|
451
452
|
] })
|
|
452
453
|
] });
|
|
453
454
|
}
|
|
454
455
|
if (error) {
|
|
455
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
456
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
457
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
456
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.Card, { children: [
|
|
457
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
458
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardTitle, { children: t("billing.ui.cards.invoices.title") }),
|
|
458
459
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
459
460
|
] }),
|
|
460
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
461
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
461
462
|
] });
|
|
462
463
|
}
|
|
463
464
|
const latestInvoice = _nullishCoalesce(invoices.find((inv) => inv.status !== "void" /* VOID */), () => ( invoices[0]));
|
|
464
465
|
const paidInvoices = invoices.filter((inv) => inv.status === "paid" /* PAID */);
|
|
465
466
|
const openInvoices = invoices.filter((inv) => inv.status === "open" /* OPEN */);
|
|
466
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
467
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
468
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
467
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewAllClick, children: [
|
|
468
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
469
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardTitle, { children: t("billing.ui.cards.invoices.title") }),
|
|
469
470
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
470
471
|
] }),
|
|
471
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
472
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardContent, { children: invoices.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
472
473
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: t("billing.ui.invoices.empty_title") }),
|
|
473
474
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.invoices.empty_description") })
|
|
474
475
|
] }) : latestInvoice ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
475
476
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
476
477
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: formatAmount(latestInvoice.total, latestInvoice.currency, fmt.locale) }),
|
|
477
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
478
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Badge, { variant: getStatusBadgeVariant2(latestInvoice.status), children: INVOICE_STATUSES.includes(latestInvoice.status) ? t(`billing.ui.invoice_status.${latestInvoice.status}`) : latestInvoice.status })
|
|
478
479
|
] }),
|
|
479
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: latestInvoice.stripeInvoiceNumber || t("billing.ui.cards.invoices.invoice_from", { date:
|
|
480
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: latestInvoice.stripeInvoiceNumber || t("billing.ui.cards.invoices.invoice_from", { date: _chunk2WK35GO2js.formatDate.call(void 0, latestInvoice.periodStart, fmt) }) }),
|
|
480
481
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-4 text-xs text-muted-foreground", children: [
|
|
481
482
|
paidInvoices.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: t("billing.ui.cards.invoices.paid_count", { count: paidInvoices.length }) }),
|
|
482
483
|
openInvoices.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-warning", children: t("billing.ui.cards.invoices.open_count", { count: openInvoices.length }) }),
|
|
@@ -511,24 +512,24 @@ function BillingUsageSummaryCard({
|
|
|
511
512
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
512
513
|
const locale = _chunk5TH2DSAHjs.useI18nLocale.call(void 0, );
|
|
513
514
|
if (loading) {
|
|
514
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
515
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
516
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
515
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.Card, { children: [
|
|
516
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
517
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardTitle, { children: t("billing.ui.cards.usage.title") }),
|
|
517
518
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
518
519
|
] }),
|
|
519
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
520
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
521
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
520
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.CardContent, { children: [
|
|
521
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Skeleton, { className: "h-6 w-24 mb-2" }),
|
|
522
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Skeleton, { className: "h-4 w-32" })
|
|
522
523
|
] })
|
|
523
524
|
] });
|
|
524
525
|
}
|
|
525
526
|
if (error) {
|
|
526
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
527
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
528
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
527
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.Card, { children: [
|
|
528
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
529
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardTitle, { children: t("billing.ui.cards.usage.title") }),
|
|
529
530
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
530
531
|
] }),
|
|
531
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
532
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
532
533
|
] });
|
|
533
534
|
}
|
|
534
535
|
const totalUsage = Object.values(summaries).reduce((acc, summary) => {
|
|
@@ -536,12 +537,12 @@ function BillingUsageSummaryCard({
|
|
|
536
537
|
}, 0);
|
|
537
538
|
const primaryMeter = meters.find((m) => _optionalChain([summaries, 'access', _17 => _17[m.id], 'optionalAccess', _18 => _18.aggregatedValue]));
|
|
538
539
|
const primarySummary = primaryMeter ? summaries[primaryMeter.id] : null;
|
|
539
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
540
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
541
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
540
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewDetailsClick, children: [
|
|
541
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
542
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardTitle, { children: t("billing.ui.cards.usage.title") }),
|
|
542
543
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
543
544
|
] }),
|
|
544
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
545
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardContent, { children: meters.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
545
546
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: t("billing.ui.cards.usage.no_meters") }),
|
|
546
547
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.usage.no_meters_description") })
|
|
547
548
|
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
@@ -652,7 +653,7 @@ function PaymentMethodForm({
|
|
|
652
653
|
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") }) });
|
|
653
654
|
}
|
|
654
655
|
if (!setupIntent && error) {
|
|
655
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
656
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.AlertDescription, { children: error }) });
|
|
656
657
|
}
|
|
657
658
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: handleSubmit, className: "flex flex-col gap-y-4", children: [
|
|
658
659
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rounded-md border border-gray-300 p-3", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -676,19 +677,19 @@ function PaymentMethodForm({
|
|
|
676
677
|
) }),
|
|
677
678
|
!alwaysSetDefault && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
678
679
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
679
|
-
|
|
680
|
+
_chunk2WK35GO2js.Checkbox,
|
|
680
681
|
{
|
|
681
682
|
id: "setAsDefault",
|
|
682
683
|
checked: setAsDefault,
|
|
683
684
|
onCheckedChange: (checked) => setSetAsDefault(!!checked)
|
|
684
685
|
}
|
|
685
686
|
),
|
|
686
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
687
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Label, { htmlFor: "setAsDefault", className: "cursor-pointer font-normal", children: t("billing.ui.payment_form.set_default") })
|
|
687
688
|
] }),
|
|
688
|
-
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
689
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.AlertDescription, { children: error }) }),
|
|
689
690
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-x-2", children: [
|
|
690
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
691
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
691
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Button, { type: "button", variant: "outline", onClick: onCancel, disabled: isSubmitting || isLoading, children: t("ui.buttons.cancel") }),
|
|
692
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Button, { type: "submit", disabled: !stripe || isSubmitting || isLoading, children: isSubmitting ? t("billing.ui.wizard.review.processing") : t("billing.ui.cards.payment_method.add_card") })
|
|
692
693
|
] })
|
|
693
694
|
] });
|
|
694
695
|
}
|
|
@@ -705,10 +706,10 @@ function PaymentMethodEditor({ open, onOpenChange, onSuccess }) {
|
|
|
705
706
|
const handleCancel = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
706
707
|
onOpenChange(false);
|
|
707
708
|
}, "handleCancel");
|
|
708
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
709
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
710
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
711
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
709
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.DialogContent, { className: "max-w-md", children: [
|
|
710
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.DialogHeader, { children: [
|
|
711
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.DialogTitle, { children: t("billing.ui.payment_methods.add") }),
|
|
712
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.DialogDescription, { children: t("billing.ui.payment_methods.add_description") })
|
|
712
713
|
] }),
|
|
713
714
|
open && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodForm, { onSuccess: handleSuccess, onCancel: handleCancel })
|
|
714
715
|
] }) });
|
|
@@ -771,16 +772,16 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
771
772
|
}
|
|
772
773
|
}, "handleRemove");
|
|
773
774
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
774
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
775
|
-
isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
776
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
775
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.Card, { className: "relative", children: [
|
|
776
|
+
isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Badge, { variant: "softGreen", className: "absolute end-2 top-2", children: t("billing.ui.payment_methods.default") }),
|
|
777
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.CardHeader, { className: "flex flex-row items-center justify-between pb-2", children: [
|
|
777
778
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
778
779
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-2xl", children: brandIcon }),
|
|
779
780
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium capitalize", children: brand })
|
|
780
781
|
] }),
|
|
781
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
782
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
783
|
-
|
|
782
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.DropdownMenu, { children: [
|
|
783
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.DropdownMenuTrigger, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
784
|
+
_chunk2WK35GO2js.Button,
|
|
784
785
|
{
|
|
785
786
|
render: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {}),
|
|
786
787
|
nativeButton: false,
|
|
@@ -791,10 +792,10 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
791
792
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.MoreVertical, { className: "h-4 w-4" })
|
|
792
793
|
}
|
|
793
794
|
) }),
|
|
794
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
795
|
-
!isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
795
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.DropdownMenuContent, { align: "end", children: [
|
|
796
|
+
!isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.DropdownMenuItem, { onClick: handleSetDefault, disabled: loading, children: t("billing.ui.payment_methods.set_default") }),
|
|
796
797
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
797
|
-
|
|
798
|
+
_chunk2WK35GO2js.DropdownMenuItem,
|
|
798
799
|
{
|
|
799
800
|
onClick: () => setShowRemoveDialog(true),
|
|
800
801
|
disabled: loading,
|
|
@@ -805,7 +806,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
805
806
|
] })
|
|
806
807
|
] })
|
|
807
808
|
] }),
|
|
808
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
809
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-1", children: [
|
|
809
810
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-lg font-semibold", children: [
|
|
810
811
|
"\u2022\u2022\u2022\u2022 ",
|
|
811
812
|
last4
|
|
@@ -813,17 +814,17 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
813
814
|
/* @__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}` }) })
|
|
814
815
|
] }) })
|
|
815
816
|
] }),
|
|
816
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
817
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
818
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
819
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
817
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.AlertDialog, { open: showRemoveDialog, onOpenChange: setShowRemoveDialog, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.AlertDialogContent, { children: [
|
|
818
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.AlertDialogHeader, { children: [
|
|
819
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.AlertDialogTitle, { children: t("billing.ui.payment_methods.remove_title") }),
|
|
820
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.AlertDialogDescription, { children: [
|
|
820
821
|
t("billing.ui.payment_methods.remove_description"),
|
|
821
822
|
isDefault && ` ${t("billing.ui.payment_methods.remove_default_warning")}`
|
|
822
823
|
] })
|
|
823
824
|
] }),
|
|
824
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
825
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
826
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
825
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.AlertDialogFooter, { children: [
|
|
826
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.AlertDialogCancel, { disabled: loading, children: t("ui.buttons.cancel") }),
|
|
827
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.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") })
|
|
827
828
|
] })
|
|
828
829
|
] }) })
|
|
829
830
|
] });
|
|
@@ -867,14 +868,14 @@ function PaymentMethodsContainer() {
|
|
|
867
868
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8" }),
|
|
868
869
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: t("billing.ui.payment_methods.title") })
|
|
869
870
|
] }),
|
|
870
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
871
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Button, { onClick: () => setShowAddPaymentMethod(true), children: t("billing.ui.payment_methods.add") })
|
|
871
872
|
] }),
|
|
872
873
|
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: [
|
|
873
874
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-16 w-16 text-muted-foreground" }),
|
|
874
875
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
875
876
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "mb-2 text-sm font-medium", children: t("billing.ui.payment_methods.empty_title") }),
|
|
876
877
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mb-4 text-muted-foreground", children: t("billing.ui.payment_methods.empty_description") }),
|
|
877
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
878
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Button, { onClick: () => setShowAddPaymentMethod(true), children: t("billing.ui.payment_methods.add_first") })
|
|
878
879
|
] })
|
|
879
880
|
] }),
|
|
880
881
|
paymentMethods.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodsList, { paymentMethods, onUpdate: loadPaymentMethods }),
|
|
@@ -930,7 +931,7 @@ var statusConfig = {
|
|
|
930
931
|
function InvoiceStatusBadge({ status }) {
|
|
931
932
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
932
933
|
const config = statusConfig[status] || statusConfig["draft" /* DRAFT */];
|
|
933
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
934
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Badge, { variant: config.variant, children: t(config.label) });
|
|
934
935
|
}
|
|
935
936
|
_chunk7QVYU63Ejs.__name.call(void 0, InvoiceStatusBadge, "InvoiceStatusBadge");
|
|
936
937
|
|
|
@@ -943,7 +944,7 @@ function InvoiceDetails({
|
|
|
943
944
|
onInvoiceChange: _onInvoiceChange
|
|
944
945
|
}) {
|
|
945
946
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
946
|
-
const fmt =
|
|
947
|
+
const fmt = _chunk2WK35GO2js.useBillingFormatOptions.call(void 0, );
|
|
947
948
|
const handleDownloadPDF = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
948
949
|
if (invoice.stripePdfUrl) {
|
|
949
950
|
window.open(invoice.stripePdfUrl, "_blank");
|
|
@@ -963,10 +964,10 @@ function InvoiceDetails({
|
|
|
963
964
|
return invoice.stripeInvoiceId.slice(-8);
|
|
964
965
|
}, "getInvoiceNumber");
|
|
965
966
|
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");
|
|
966
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
967
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
968
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
969
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
967
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.DialogContent, { className: "max-w-2xl", children: [
|
|
968
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.DialogHeader, { children: [
|
|
969
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.DialogTitle, { children: t("billing.ui.invoice.title", { number: getInvoiceNumber() }) }),
|
|
970
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.DialogDescription, { children: _chunk2WK35GO2js.formatDate.call(void 0, invoice.periodStart, fmt) })
|
|
970
971
|
] }),
|
|
971
972
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
972
973
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
@@ -977,18 +978,18 @@ function InvoiceDetails({
|
|
|
977
978
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
978
979
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.billing_period") }),
|
|
979
980
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm", children: [
|
|
980
|
-
|
|
981
|
+
_chunk2WK35GO2js.formatDate.call(void 0, invoice.periodStart, fmt),
|
|
981
982
|
" - ",
|
|
982
|
-
|
|
983
|
+
_chunk2WK35GO2js.formatDate.call(void 0, invoice.periodEnd, fmt)
|
|
983
984
|
] })
|
|
984
985
|
] }),
|
|
985
986
|
invoice.dueDate && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
986
987
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.due_date") }),
|
|
987
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm", children:
|
|
988
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm", children: _chunk2WK35GO2js.formatDate.call(void 0, invoice.dueDate, fmt) })
|
|
988
989
|
] }),
|
|
989
990
|
invoice.paidAt && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
990
991
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.paid_date") }),
|
|
991
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm", children:
|
|
992
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm", children: _chunk2WK35GO2js.formatDate.call(void 0, invoice.paidAt, fmt) })
|
|
992
993
|
] }),
|
|
993
994
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
994
995
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.attempt_count") }),
|
|
@@ -1031,15 +1032,15 @@ function InvoiceDetails({
|
|
|
1031
1032
|
] })
|
|
1032
1033
|
] }),
|
|
1033
1034
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2 pt-4 border-t", children: [
|
|
1034
|
-
invoice.stripePdfUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1035
|
+
invoice.stripePdfUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.Button, { variant: "outline", onClick: handleDownloadPDF, children: [
|
|
1035
1036
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Download, { className: "me-2 h-4 w-4" }),
|
|
1036
1037
|
t("billing.ui.invoice.download_pdf")
|
|
1037
1038
|
] }),
|
|
1038
|
-
invoice.status === "open" /* OPEN */ && invoice.attempted && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1039
|
+
invoice.status === "open" /* OPEN */ && invoice.attempted && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.Button, { variant: "default", onClick: handleRetryPayment, children: [
|
|
1039
1040
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RefreshCw, { className: "me-2 h-4 w-4" }),
|
|
1040
1041
|
t("billing.ui.invoice.retry_payment")
|
|
1041
1042
|
] }),
|
|
1042
|
-
invoice.stripeHostedInvoiceUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1043
|
+
invoice.stripeHostedInvoiceUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.Button, { variant: "outline", onClick: handleViewInStripe, children: [
|
|
1043
1044
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ExternalLink, { className: "me-2 h-4 w-4" }),
|
|
1044
1045
|
t("billing.ui.invoice.view_in_stripe")
|
|
1045
1046
|
] })
|
|
@@ -1053,7 +1054,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, InvoiceDetails, "InvoiceDetails");
|
|
|
1053
1054
|
|
|
1054
1055
|
function InvoicesList({ invoices, onInvoicesChange }) {
|
|
1055
1056
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1056
|
-
const fmt =
|
|
1057
|
+
const fmt = _chunk2WK35GO2js.useBillingFormatOptions.call(void 0, );
|
|
1057
1058
|
const [selectedInvoice, setSelectedInvoice] = _react.useState.call(void 0, null);
|
|
1058
1059
|
const handleRowClick = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (invoice) => {
|
|
1059
1060
|
setSelectedInvoice(invoice);
|
|
@@ -1065,30 +1066,30 @@ function InvoicesList({ invoices, onInvoicesChange }) {
|
|
|
1065
1066
|
return invoice.stripeInvoiceId.slice(-8);
|
|
1066
1067
|
}, "getInvoiceNumber");
|
|
1067
1068
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1068
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1069
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1070
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1071
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1072
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1073
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1074
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1069
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.Table, { children: [
|
|
1070
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.TableRow, { children: [
|
|
1071
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.TableHead, { children: t("billing.ui.columns.invoice_number") }),
|
|
1072
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.TableHead, { children: t("billing.ui.columns.date") }),
|
|
1073
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.TableHead, { children: t("billing.ui.columns.status") }),
|
|
1074
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.TableHead, { className: "text-end", children: t("billing.ui.columns.amount") }),
|
|
1075
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.TableHead, { children: t("billing.ui.columns.period") })
|
|
1075
1076
|
] }) }),
|
|
1076
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1077
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.TableBody, { children: invoices.map((invoice) => {
|
|
1077
1078
|
const invoiceNumber = getInvoiceNumber(invoice);
|
|
1078
|
-
const date =
|
|
1079
|
+
const date = _chunk2WK35GO2js.formatDate.call(void 0, invoice.periodStart, fmt);
|
|
1079
1080
|
const amount = _chunk5TH2DSAHjs.formatCurrency.call(void 0, invoice.total, invoice.currency, fmt);
|
|
1080
|
-
const period = `${
|
|
1081
|
+
const period = `${_chunk2WK35GO2js.formatDate.call(void 0, invoice.periodStart, fmt)} - ${_chunk2WK35GO2js.formatDate.call(void 0, invoice.periodEnd, fmt)}`;
|
|
1081
1082
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1082
|
-
|
|
1083
|
+
_chunk2WK35GO2js.TableRow,
|
|
1083
1084
|
{
|
|
1084
1085
|
onClick: () => handleRowClick(invoice),
|
|
1085
1086
|
className: "cursor-pointer hover:bg-muted/50",
|
|
1086
1087
|
children: [
|
|
1087
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1088
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1089
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1090
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1091
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1088
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.TableCell, { className: "font-medium", children: invoiceNumber }),
|
|
1089
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.TableCell, { className: "text-muted-foreground text-xs", children: date }),
|
|
1090
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InvoiceStatusBadge, { status: invoice.status }) }),
|
|
1091
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.TableCell, { className: "text-end font-medium", children: amount }),
|
|
1092
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.TableCell, { className: "text-muted-foreground text-xs", children: period })
|
|
1092
1093
|
]
|
|
1093
1094
|
},
|
|
1094
1095
|
invoice.id
|
|
@@ -1138,12 +1139,12 @@ function InvoicesContainer() {
|
|
|
1138
1139
|
setStatusFilter(value);
|
|
1139
1140
|
}, "handleFilterChange");
|
|
1140
1141
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-4", children: [
|
|
1141
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1142
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1143
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1144
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1145
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1146
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1142
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Tabs, { value: statusFilter, onValueChange: handleFilterChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.TabsList, { children: [
|
|
1143
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.TabsTrigger, { value: "all", children: t("billing.ui.invoices.filter_all") }),
|
|
1144
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.TabsTrigger, { value: "paid" /* PAID */, children: t("billing.ui.invoice_status.paid") }),
|
|
1145
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.TabsTrigger, { value: "open" /* OPEN */, children: t("billing.ui.invoice_status.open") }),
|
|
1146
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.TabsTrigger, { value: "void" /* VOID */, children: t("billing.ui.invoice_status.void") }),
|
|
1147
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.TabsTrigger, { value: "uncollectible" /* UNCOLLECTIBLE */, children: t("billing.ui.invoice_status.uncollectible") })
|
|
1147
1148
|
] }) }),
|
|
1148
1149
|
loading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-center py-8 text-muted-foreground", children: t("billing.ui.invoices.loading") }),
|
|
1149
1150
|
!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: [
|
|
@@ -1185,7 +1186,7 @@ function CancelSubscriptionDialog({
|
|
|
1185
1186
|
onSuccess
|
|
1186
1187
|
}) {
|
|
1187
1188
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1188
|
-
const fmt =
|
|
1189
|
+
const fmt = _chunk2WK35GO2js.useBillingFormatOptions.call(void 0, );
|
|
1189
1190
|
const [isSubmitting, setIsSubmitting] = _react.useState.call(void 0, false);
|
|
1190
1191
|
const form = _reacthookform.useForm.call(void 0, {
|
|
1191
1192
|
resolver: _zod.zodResolver.call(void 0, formSchema),
|
|
@@ -1208,16 +1209,16 @@ function CancelSubscriptionDialog({
|
|
|
1208
1209
|
setIsSubmitting(false);
|
|
1209
1210
|
}
|
|
1210
1211
|
}, "onSubmit");
|
|
1211
|
-
const periodEndDate =
|
|
1212
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1213
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1214
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1215
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1212
|
+
const periodEndDate = _chunk2WK35GO2js.formatDate.call(void 0, subscription.currentPeriodEnd, fmt);
|
|
1213
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.DialogContent, { className: "max-w-md", children: [
|
|
1214
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.DialogHeader, { children: [
|
|
1215
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.DialogTitle, { children: t("billing.ui.subscription.cancel.title") }),
|
|
1216
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.DialogDescription, { children: t("billing.ui.subscription.cancel.description") })
|
|
1216
1217
|
] }),
|
|
1217
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1218
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-col gap-y-4", children: [
|
|
1218
1219
|
/* @__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 }) }),
|
|
1219
1220
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1220
|
-
|
|
1221
|
+
_chunk2WK35GO2js.FormTextarea,
|
|
1221
1222
|
{
|
|
1222
1223
|
form,
|
|
1223
1224
|
id: "reason",
|
|
@@ -1227,8 +1228,8 @@ function CancelSubscriptionDialog({
|
|
|
1227
1228
|
}
|
|
1228
1229
|
),
|
|
1229
1230
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-x-2 justify-end pt-2", children: [
|
|
1230
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1231
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1231
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Button, { type: "button", variant: "outline", onClick: () => onOpenChange(false), disabled: isSubmitting, children: t("billing.ui.subscription.cancel.keep") }),
|
|
1232
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Button, { type: "submit", variant: "destructive", disabled: isSubmitting, children: isSubmitting ? t("billing.ui.subscription.cancel.canceling") : t("billing.ui.subscription.cancel.confirm") })
|
|
1232
1233
|
] })
|
|
1233
1234
|
] }) })
|
|
1234
1235
|
] }) });
|
|
@@ -1279,7 +1280,7 @@ var cancelingConfig = {
|
|
|
1279
1280
|
function SubscriptionStatusBadge({ status, cancelAtPeriodEnd }) {
|
|
1280
1281
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1281
1282
|
const config = cancelAtPeriodEnd ? cancelingConfig : statusConfig2[status] || statusConfig2["canceled" /* CANCELED */];
|
|
1282
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1283
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Badge, { variant: config.variant, children: t(config.label) });
|
|
1283
1284
|
}
|
|
1284
1285
|
_chunk7QVYU63Ejs.__name.call(void 0, SubscriptionStatusBadge, "SubscriptionStatusBadge");
|
|
1285
1286
|
|
|
@@ -1317,7 +1318,7 @@ function SubscriptionDetails({
|
|
|
1317
1318
|
onChangePlan
|
|
1318
1319
|
}) {
|
|
1319
1320
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1320
|
-
const fmt =
|
|
1321
|
+
const fmt = _chunk2WK35GO2js.useBillingFormatOptions.call(void 0, );
|
|
1321
1322
|
const [showCancel, setShowCancel] = _react.useState.call(void 0, false);
|
|
1322
1323
|
const [isProcessing, setIsProcessing] = _react.useState.call(void 0, false);
|
|
1323
1324
|
const handlePause = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
@@ -1354,10 +1355,10 @@ function SubscriptionDetails({
|
|
|
1354
1355
|
const canResume = subscription.status === "paused" /* PAUSED */;
|
|
1355
1356
|
const canCancel = subscription.status === "active" /* ACTIVE */ || subscription.status === "trialing" /* TRIALING */ || subscription.status === "paused" /* PAUSED */;
|
|
1356
1357
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1357
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1358
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1359
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1360
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1358
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.DialogContent, { className: "max-w-2xl", children: [
|
|
1359
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.DialogHeader, { children: [
|
|
1360
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.DialogTitle, { children: t("billing.ui.subscription.details_title") }),
|
|
1361
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.DialogDescription, { children: t("billing.ui.subscription.details_description") })
|
|
1361
1362
|
] }),
|
|
1362
1363
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
1363
1364
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
@@ -1383,24 +1384,24 @@ function SubscriptionDetails({
|
|
|
1383
1384
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "space-y-2", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1384
1385
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.subscription.current_period") }),
|
|
1385
1386
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "text-sm", children: [
|
|
1386
|
-
|
|
1387
|
+
_chunk2WK35GO2js.formatDate.call(void 0, subscription.currentPeriodStart, fmt),
|
|
1387
1388
|
" - ",
|
|
1388
|
-
|
|
1389
|
+
_chunk2WK35GO2js.formatDate.call(void 0, subscription.currentPeriodEnd, fmt)
|
|
1389
1390
|
] })
|
|
1390
1391
|
] }) }),
|
|
1391
1392
|
subscription.trialEnd && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1392
1393
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.subscription.trial_ends") }),
|
|
1393
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children:
|
|
1394
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children: _chunk2WK35GO2js.formatDate.call(void 0, subscription.trialEnd, fmt) })
|
|
1394
1395
|
] }),
|
|
1395
1396
|
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", {
|
|
1396
|
-
date:
|
|
1397
|
+
date: _chunk2WK35GO2js.formatDate.call(void 0, subscription.currentPeriodEnd, fmt)
|
|
1397
1398
|
}) }) }),
|
|
1398
1399
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2 pt-4 border-t", children: [
|
|
1399
|
-
onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1400
|
-
canPause && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1401
|
-
canResume && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1402
|
-
canCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1403
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1400
|
+
onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Button, { variant: "default", onClick: () => onChangePlan(subscription), children: t("billing.ui.subscription.change_plan") }),
|
|
1401
|
+
canPause && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Button, { variant: "outline", onClick: handlePause, disabled: isProcessing, children: isProcessing ? t("billing.ui.subscription.pausing") : t("billing.ui.subscription.pause") }),
|
|
1402
|
+
canResume && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Button, { variant: "outline", onClick: handleResume, disabled: isProcessing, children: isProcessing ? t("billing.ui.subscription.resuming") : t("billing.ui.subscription.resume") }),
|
|
1403
|
+
canCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Button, { variant: "destructive", onClick: () => setShowCancel(true), children: t("ui.buttons.cancel") }),
|
|
1404
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Button, { variant: "outline", onClick: handleManageViaPortal, children: t("billing.ui.subscription.manage_portal") })
|
|
1404
1405
|
] })
|
|
1405
1406
|
] })
|
|
1406
1407
|
] }) }),
|
|
@@ -1443,46 +1444,46 @@ function formatPlanName3(price, t) {
|
|
|
1443
1444
|
_chunk7QVYU63Ejs.__name.call(void 0, formatPlanName3, "formatPlanName");
|
|
1444
1445
|
function SubscriptionsList({ subscriptions, onSubscriptionsChange, onChangePlan }) {
|
|
1445
1446
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1446
|
-
const fmt =
|
|
1447
|
+
const fmt = _chunk2WK35GO2js.useBillingFormatOptions.call(void 0, );
|
|
1447
1448
|
const [selectedSub, setSelectedSub] = _react.useState.call(void 0, null);
|
|
1448
1449
|
const handleRowClick = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (subscription) => {
|
|
1449
1450
|
setSelectedSub(subscription);
|
|
1450
1451
|
}, "handleRowClick");
|
|
1451
1452
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1452
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1453
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1454
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1455
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1456
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1457
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1458
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1453
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.Table, { children: [
|
|
1454
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.TableRow, { children: [
|
|
1455
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.TableHead, { children: t("billing.ui.columns.status") }),
|
|
1456
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.TableHead, { children: t("billing.ui.columns.plan") }),
|
|
1457
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.TableHead, { children: t("billing.ui.columns.period") }),
|
|
1458
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.TableHead, { className: "text-end", children: t("billing.ui.columns.amount") }),
|
|
1459
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.TableHead, { className: "text-end", children: t("billing.ui.columns.actions") })
|
|
1459
1460
|
] }) }),
|
|
1460
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1461
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.TableBody, { children: subscriptions.map((subscription) => {
|
|
1461
1462
|
const price = subscription.price;
|
|
1462
1463
|
const amount = _optionalChain([price, 'optionalAccess', _42 => _42.unitAmount]) ? _chunk5TH2DSAHjs.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt) : "0";
|
|
1463
|
-
const discountedAmount = price ?
|
|
1464
|
-
const period = `${
|
|
1464
|
+
const discountedAmount = price ? _chunk2WK35GO2js.applyDiscount.call(void 0, price.unitAmount, _chunk2WK35GO2js.subscriptionDiscount.call(void 0, subscription)) : null;
|
|
1465
|
+
const period = `${_chunk2WK35GO2js.formatDate.call(void 0, subscription.currentPeriodStart, fmt)} - ${_chunk2WK35GO2js.formatDate.call(void 0, subscription.currentPeriodEnd, fmt)}`;
|
|
1465
1466
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1466
|
-
|
|
1467
|
+
_chunk2WK35GO2js.TableRow,
|
|
1467
1468
|
{
|
|
1468
1469
|
onClick: () => handleRowClick(subscription),
|
|
1469
1470
|
className: "cursor-pointer hover:bg-muted/50",
|
|
1470
1471
|
children: [
|
|
1471
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1472
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1472
1473
|
SubscriptionStatusBadge,
|
|
1473
1474
|
{
|
|
1474
1475
|
status: subscription.status,
|
|
1475
1476
|
cancelAtPeriodEnd: subscription.cancelAtPeriodEnd
|
|
1476
1477
|
}
|
|
1477
1478
|
) }),
|
|
1478
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1479
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1480
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1479
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.TableCell, { className: "font-medium", children: formatPlanName3(price, t) }),
|
|
1480
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.TableCell, { className: "text-muted-foreground text-sm", children: period }),
|
|
1481
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.TableCell, { className: "text-end font-medium", children: discountedAmount !== null && price ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1481
1482
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "line-through text-muted-foreground me-2", children: amount }),
|
|
1482
1483
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success", children: _chunk5TH2DSAHjs.formatCurrency.call(void 0, discountedAmount, price.currency, fmt) })
|
|
1483
1484
|
] }) : amount }),
|
|
1484
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1485
|
-
|
|
1485
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.TableCell, { className: "text-end", children: (subscription.status === "active" /* ACTIVE */ || subscription.status === "trialing" /* TRIALING */) && onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1486
|
+
_chunk2WK35GO2js.Button,
|
|
1486
1487
|
{
|
|
1487
1488
|
size: "sm",
|
|
1488
1489
|
variant: "outline",
|
|
@@ -1563,7 +1564,7 @@ function SubscriptionsContainer({
|
|
|
1563
1564
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8" }),
|
|
1564
1565
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: t("billing.ui.subscriptions.title") })
|
|
1565
1566
|
] }),
|
|
1566
|
-
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1567
|
+
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _44 => _44()]), children: hasActiveRecurringSubscription ? t("billing.ui.subscriptions.purchase_addons") : t("billing.ui.subscriptions.subscribe") })
|
|
1567
1568
|
] }),
|
|
1568
1569
|
criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BillingAlertBanner, { subscription }, subscription.id)),
|
|
1569
1570
|
subscriptions.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col items-center justify-center py-12 space-y-4", children: [
|
|
@@ -1571,7 +1572,7 @@ function SubscriptionsContainer({
|
|
|
1571
1572
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
1572
1573
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium mb-2", children: t("billing.ui.subscriptions.empty_title") }),
|
|
1573
1574
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground mb-6", children: t("billing.ui.subscriptions.empty_description") }),
|
|
1574
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1575
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _45 => _45()]), children: t("billing.ui.subscriptions.subscribe") })
|
|
1575
1576
|
] })
|
|
1576
1577
|
] }),
|
|
1577
1578
|
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -1594,9 +1595,9 @@ function IntervalToggle({ value, onChange, hasMonthly, hasYearly }) {
|
|
|
1594
1595
|
if (!hasMonthly || !hasYearly) {
|
|
1595
1596
|
return null;
|
|
1596
1597
|
}
|
|
1597
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1598
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1599
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1598
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Tabs, { value, onValueChange: (v) => onChange(v), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.TabsList, { children: [
|
|
1599
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.TabsTrigger, { value: "month", children: t("billing.admin.prices.interval.month") }),
|
|
1600
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.TabsTrigger, { value: "year", children: t("billing.admin.prices.interval.year") })
|
|
1600
1601
|
] }) });
|
|
1601
1602
|
}
|
|
1602
1603
|
_chunk7QVYU63Ejs.__name.call(void 0, IntervalToggle, "IntervalToggle");
|
|
@@ -1614,7 +1615,7 @@ function PricingCard({
|
|
|
1614
1615
|
onSelect
|
|
1615
1616
|
}) {
|
|
1616
1617
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1617
|
-
const fmt =
|
|
1618
|
+
const fmt = _chunk2WK35GO2js.useBillingFormatOptions.call(void 0, );
|
|
1618
1619
|
const description = price.description || price.nickname || t("billing.ui.pricing.standard");
|
|
1619
1620
|
const features = price.features || [];
|
|
1620
1621
|
const formattedPrice = _chunk5TH2DSAHjs.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt);
|
|
@@ -1631,7 +1632,7 @@ function PricingCard({
|
|
|
1631
1632
|
}
|
|
1632
1633
|
}, "handleClick");
|
|
1633
1634
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1634
|
-
|
|
1635
|
+
_chunk2WK35GO2js.Card,
|
|
1635
1636
|
{
|
|
1636
1637
|
role: "radio",
|
|
1637
1638
|
"aria-checked": isSelected,
|
|
@@ -1649,9 +1650,9 @@ function PricingCard({
|
|
|
1649
1650
|
isLoading && "pointer-events-none"
|
|
1650
1651
|
),
|
|
1651
1652
|
children: [
|
|
1652
|
-
isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1653
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1654
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1653
|
+
isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Badge, { variant: "secondary", className: "absolute top-2 end-2", children: t("billing.ui.pricing.current") }),
|
|
1654
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardHeader, { className: "pb-2", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium", children: description }) }),
|
|
1655
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.CardContent, { className: "pb-4 grow", children: [
|
|
1655
1656
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mb-4", children: [
|
|
1656
1657
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-3xl font-bold", children: formattedPrice }),
|
|
1657
1658
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground ms-1", children: interval })
|
|
@@ -1661,8 +1662,8 @@ function PricingCard({
|
|
|
1661
1662
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-muted-foreground", children: feature })
|
|
1662
1663
|
] }, index)) })
|
|
1663
1664
|
] }),
|
|
1664
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1665
|
-
|
|
1665
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardFooter, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1666
|
+
_chunk2WK35GO2js.Button,
|
|
1666
1667
|
{
|
|
1667
1668
|
variant: isCurrentPlan ? "secondary" : isSelected ? "default" : "outline",
|
|
1668
1669
|
className: "w-full",
|
|
@@ -1695,7 +1696,7 @@ function ProductPricingRow({
|
|
|
1695
1696
|
return null;
|
|
1696
1697
|
}
|
|
1697
1698
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-3", children: [
|
|
1698
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1699
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.SectionHeader, { children: product.name }),
|
|
1699
1700
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1700
1701
|
"div",
|
|
1701
1702
|
{
|
|
@@ -1796,15 +1797,15 @@ function ProductPricingList({
|
|
|
1796
1797
|
_chunk7QVYU63Ejs.__name.call(void 0, ProductPricingList, "ProductPricingList");
|
|
1797
1798
|
function ProductPricingListSkeleton() {
|
|
1798
1799
|
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: [
|
|
1799
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1800
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Skeleton, { className: "h-6 w-32" }),
|
|
1800
1801
|
/* @__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: [
|
|
1801
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1802
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1802
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Skeleton, { className: "h-6 w-24" }),
|
|
1803
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Skeleton, { className: "h-8 w-32" }),
|
|
1803
1804
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
1804
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1805
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1805
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Skeleton, { className: "h-4 w-full" }),
|
|
1806
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Skeleton, { className: "h-4 w-3/4" })
|
|
1806
1807
|
] }),
|
|
1807
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1808
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Skeleton, { className: "h-10 w-full" })
|
|
1808
1809
|
] }, cardIndex)) })
|
|
1809
1810
|
] }, rowIndex)) });
|
|
1810
1811
|
}
|
|
@@ -1815,7 +1816,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductPricingListSkeleton, "ProductPricing
|
|
|
1815
1816
|
|
|
1816
1817
|
function ProrationPreview({ preview }) {
|
|
1817
1818
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1818
|
-
const fmt =
|
|
1819
|
+
const fmt = _chunk2WK35GO2js.useBillingFormatOptions.call(void 0, );
|
|
1819
1820
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-primary/10 border-primary/30 rounded-lg border p-4", children: [
|
|
1820
1821
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "text-primary mb-3 font-semibold", children: t("billing.ui.proration.title") }),
|
|
1821
1822
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
@@ -1828,7 +1829,7 @@ function ProrationPreview({ preview }) {
|
|
|
1828
1829
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-foreground", children: _chunk5TH2DSAHjs.formatCurrency.call(void 0, preview.immediateCharge, preview.currency, fmt) })
|
|
1829
1830
|
] }) }),
|
|
1830
1831
|
preview.lineItems.length > 0 && preview.lineItems[0].period && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-muted-foreground mt-2 text-xs", children: t("billing.ui.proration.next_invoice", {
|
|
1831
|
-
date:
|
|
1832
|
+
date: _chunk2WK35GO2js.formatDate.call(void 0, preview.lineItems[0].period.end, fmt),
|
|
1832
1833
|
amount: _chunk5TH2DSAHjs.formatCurrency.call(void 0, preview.amountDue, preview.currency, fmt)
|
|
1833
1834
|
}) })
|
|
1834
1835
|
] })
|
|
@@ -1842,7 +1843,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProrationPreview, "ProrationPreview");
|
|
|
1842
1843
|
|
|
1843
1844
|
function SubscriptionConfirmation({ price, isLoading, onConfirm, onCancel }) {
|
|
1844
1845
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1845
|
-
const fmt =
|
|
1846
|
+
const fmt = _chunk2WK35GO2js.useBillingFormatOptions.call(void 0, );
|
|
1846
1847
|
const productName = _optionalChain([price, 'access', _51 => _51.product, 'optionalAccess', _52 => _52.name]) || price.nickname || t("billing.ui.wizard.review.selected_plan");
|
|
1847
1848
|
const productDescription = _optionalChain([price, 'access', _53 => _53.product, 'optionalAccess', _54 => _54.description]) || price.description;
|
|
1848
1849
|
const features = price.features || [];
|
|
@@ -1862,8 +1863,8 @@ function SubscriptionConfirmation({ price, isLoading, onConfirm, onCancel }) {
|
|
|
1862
1863
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: feature })
|
|
1863
1864
|
] }, index)) }),
|
|
1864
1865
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-3 pt-2 border-t border-accent/30", children: [
|
|
1865
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1866
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1866
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Button, { variant: "outline", onClick: onCancel, disabled: isLoading, children: t("ui.buttons.cancel") }),
|
|
1867
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Button, { onClick: onConfirm, disabled: isLoading, children: isLoading ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1867
1868
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "h-4 w-4 animate-spin me-2" }),
|
|
1868
1869
|
t("billing.ui.wizard.review.processing")
|
|
1869
1870
|
] }) : t("billing.ui.confirmation.subscribe") })
|
|
@@ -2401,7 +2402,7 @@ function WizardStepPlanSelection({
|
|
|
2401
2402
|
onSelectPrice: handleSelectPrice
|
|
2402
2403
|
}
|
|
2403
2404
|
),
|
|
2404
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex justify-end pt-4 border-t", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2405
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex justify-end pt-4 border-t", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Button, { onClick: onNext, disabled: !selectedPrice || isProcessing, children: isProcessing ? t("common.loading") : t("billing.ui.wizard.next_review") }) })
|
|
2405
2406
|
] });
|
|
2406
2407
|
}
|
|
2407
2408
|
_chunk7QVYU63Ejs.__name.call(void 0, WizardStepPlanSelection, "WizardStepPlanSelection");
|
|
@@ -2471,7 +2472,7 @@ function PromoCodeInput({
|
|
|
2471
2472
|
const codeInput = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
2472
2473
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
|
|
2473
2474
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2474
|
-
|
|
2475
|
+
_chunk2WK35GO2js.Input,
|
|
2475
2476
|
{
|
|
2476
2477
|
placeholder: t("billing.ui.promo_code.placeholder"),
|
|
2477
2478
|
value: code,
|
|
@@ -2481,7 +2482,7 @@ function PromoCodeInput({
|
|
|
2481
2482
|
className: "flex-1"
|
|
2482
2483
|
}
|
|
2483
2484
|
),
|
|
2484
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2485
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.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") })
|
|
2485
2486
|
] }),
|
|
2486
2487
|
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error })
|
|
2487
2488
|
] });
|
|
@@ -2510,7 +2511,7 @@ function PromoCodeInput({
|
|
|
2510
2511
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success text-sm", children: formatDiscount(appliedCode) })
|
|
2511
2512
|
] }),
|
|
2512
2513
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2513
|
-
|
|
2514
|
+
_chunk2WK35GO2js.Button,
|
|
2514
2515
|
{
|
|
2515
2516
|
variant: "ghost",
|
|
2516
2517
|
size: "sm",
|
|
@@ -2558,7 +2559,7 @@ function WizardStepReview({
|
|
|
2558
2559
|
isTrialUpgrade
|
|
2559
2560
|
}) {
|
|
2560
2561
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2561
|
-
const fmt =
|
|
2562
|
+
const fmt = _chunk2WK35GO2js.useBillingFormatOptions.call(void 0, );
|
|
2562
2563
|
const [card, setCard] = _react.useState.call(void 0, null);
|
|
2563
2564
|
_react.useEffect.call(void 0, () => {
|
|
2564
2565
|
if (!hasPaymentMethod) {
|
|
@@ -2585,11 +2586,11 @@ function WizardStepReview({
|
|
|
2585
2586
|
const interval = _optionalChain([price, 'access', _93 => _93.recurring, 'optionalAccess', _94 => _94.interval]) || "month";
|
|
2586
2587
|
return interval === "year" ? t("billing.ui.wizard.review.interval_yearly") : t("billing.ui.wizard.review.interval_monthly");
|
|
2587
2588
|
}, "formatInterval");
|
|
2588
|
-
const codeDiscount =
|
|
2589
|
-
const carriedDiscount = isChangingPlan && !codeDiscount ?
|
|
2589
|
+
const codeDiscount = _chunk2WK35GO2js.promotionCodeDiscount.call(void 0, promotionCode);
|
|
2590
|
+
const carriedDiscount = isChangingPlan && !codeDiscount ? _chunk2WK35GO2js.subscriptionDiscount.call(void 0, subscription) : null;
|
|
2590
2591
|
const discount = _nullishCoalesce(codeDiscount, () => ( carriedDiscount));
|
|
2591
|
-
const discountedPrice =
|
|
2592
|
-
const discountedImmediateCharge =
|
|
2592
|
+
const discountedPrice = _chunk2WK35GO2js.applyDiscount.call(void 0, selectedPrice.unitAmount, discount);
|
|
2593
|
+
const discountedImmediateCharge = _chunk2WK35GO2js.applyDiscount.call(void 0, _optionalChain([prorationPreview, 'optionalAccess', _95 => _95.immediateCharge]), discount);
|
|
2593
2594
|
const getDiscountDescription = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
2594
2595
|
if (!discount) return null;
|
|
2595
2596
|
if (discount.discountType === "percent_off") {
|
|
@@ -2602,7 +2603,7 @@ function WizardStepReview({
|
|
|
2602
2603
|
const discountDescription = getDiscountDescription();
|
|
2603
2604
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
2604
2605
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-muted/50 rounded-lg p-4 space-y-3", children: [
|
|
2605
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2606
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.SectionHeader, { children: t("billing.ui.wizard.review.selected_plan") }),
|
|
2606
2607
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between items-center", children: [
|
|
2607
2608
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
2608
2609
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-medium", children: _optionalChain([selectedPrice, 'access', _96 => _96.product, 'optionalAccess', _97 => _97.name]) }),
|
|
@@ -2612,7 +2613,7 @@ function WizardStepReview({
|
|
|
2612
2613
|
discountedPrice !== null ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2613
2614
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground line-through", children: _chunk5TH2DSAHjs.formatCurrency.call(void 0, selectedPrice.unitAmount || 0, selectedPrice.currency, fmt) }),
|
|
2614
2615
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-success text-lg font-semibold", children: _chunk5TH2DSAHjs.formatCurrency.call(void 0, discountedPrice, selectedPrice.currency, fmt) }),
|
|
2615
|
-
discountDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2616
|
+
discountDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Badge, { variant: "softGreen", children: discountDescription }),
|
|
2616
2617
|
carriedDiscount && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: t("billing.ui.wizard.review.discount_carries_over") })
|
|
2617
2618
|
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-semibold text-lg", children: _chunk5TH2DSAHjs.formatCurrency.call(void 0, selectedPrice.unitAmount || 0, selectedPrice.currency, fmt) }),
|
|
2618
2619
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: formatInterval2(selectedPrice) })
|
|
@@ -2655,15 +2656,15 @@ function WizardStepReview({
|
|
|
2655
2656
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "font-medium", children: t("billing.ui.payment_method.title") }),
|
|
2656
2657
|
/* @__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") })
|
|
2657
2658
|
] }),
|
|
2658
|
-
hasPaymentMethod ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2659
|
+
hasPaymentMethod ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Button, { variant: "outline", onClick: onAddPaymentMethod, disabled: isProcessing, children: t("billing.ui.wizard.review.use_another_card") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Button, { variant: "outline", onClick: onAddPaymentMethod, children: t("billing.ui.payment_methods.add") })
|
|
2659
2660
|
] }) }),
|
|
2660
|
-
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2661
|
+
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.Alert, { variant: "destructive", children: [
|
|
2661
2662
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.AlertCircle, { className: "h-4 w-4" }),
|
|
2662
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2663
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.AlertDescription, { children: error })
|
|
2663
2664
|
] }),
|
|
2664
2665
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between pt-4 border-t", children: [
|
|
2665
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2666
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2666
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Button, { variant: "outline", onClick: onBack, disabled: isProcessing, children: t("billing.ui.wizard.back") }),
|
|
2667
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.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") })
|
|
2667
2668
|
] })
|
|
2668
2669
|
] });
|
|
2669
2670
|
}
|
|
@@ -2676,7 +2677,7 @@ function WizardStepPaymentMethod({ onBack, onSuccess, isProcessing }) {
|
|
|
2676
2677
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2677
2678
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
2678
2679
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
2679
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2680
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.SectionHeader, { children: t("billing.ui.payment_methods.add") }),
|
|
2680
2681
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: t("billing.ui.wizard.payment_description") })
|
|
2681
2682
|
] }),
|
|
2682
2683
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodForm, { onSuccess, onCancel: onBack, isLoading: isProcessing, alwaysSetDefault: true })
|
|
@@ -2719,10 +2720,10 @@ function SubscriptionWizard({
|
|
|
2719
2720
|
const isChangePlanMode = !!subscription;
|
|
2720
2721
|
const dialogTitle = subscription ? t("billing.ui.wizard.change_title") : isPurchasingAddons ? t("billing.ui.subscriptions.purchase_addons") : t("billing.ui.subscriptions.subscribe");
|
|
2721
2722
|
const dialogDescription = subscription ? t("billing.ui.wizard.change_description") : isPurchasingAddons ? t("billing.ui.wizard.addons_description") : t("billing.ui.wizard.subscribe_description");
|
|
2722
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2723
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2724
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2725
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2723
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.DialogContent, { className: "max-w-2xl max-h-[90vh] overflow-y-auto", children: [
|
|
2724
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.DialogHeader, { children: [
|
|
2725
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.DialogTitle, { children: dialogTitle }),
|
|
2726
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.DialogDescription, { children: dialogDescription })
|
|
2726
2727
|
] }),
|
|
2727
2728
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, WizardProgressIndicator, { currentStep: state.step }),
|
|
2728
2729
|
state.step === "plan-selection" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -2801,7 +2802,7 @@ function formatDate2(date, { locale, t }) {
|
|
|
2801
2802
|
_chunk7QVYU63Ejs.__name.call(void 0, formatDate2, "formatDate");
|
|
2802
2803
|
function UsageSummaryCard({ meter, summary }) {
|
|
2803
2804
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2804
|
-
const fmt =
|
|
2805
|
+
const fmt = _chunk2WK35GO2js.useBillingFormatOptions.call(void 0, );
|
|
2805
2806
|
const currentUsage = _nullishCoalesce(_optionalChain([summary, 'optionalAccess', _100 => _100.aggregatedValue]), () => ( 0));
|
|
2806
2807
|
const limit = meter.limit;
|
|
2807
2808
|
const percentage = limit && limit > 0 ? currentUsage / limit * 100 : null;
|
|
@@ -2809,15 +2810,15 @@ function UsageSummaryCard({ meter, summary }) {
|
|
|
2809
2810
|
const progressWidth = percentage !== null ? Math.min(percentage, 100) : 0;
|
|
2810
2811
|
const displayName = meter.displayName || meter.eventName;
|
|
2811
2812
|
const hasLimit = limit !== null && limit !== void 0;
|
|
2812
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2813
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2813
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.Card, { children: [
|
|
2814
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.CardHeader, { className: "flex flex-row items-center gap-x-3 pb-3", children: [
|
|
2814
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" }) }),
|
|
2815
2816
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col", children: [
|
|
2816
2817
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium", children: displayName }),
|
|
2817
2818
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-xs", children: meter.id })
|
|
2818
2819
|
] })
|
|
2819
2820
|
] }),
|
|
2820
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2821
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.CardContent, { className: "flex flex-col gap-y-4", children: [
|
|
2821
2822
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
2822
2823
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-3xl font-bold", children: currentUsage.toLocaleString(fmt.locale) }),
|
|
2823
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) }) })
|
|
@@ -2936,27 +2937,27 @@ function formatDateTime(date, { locale, t }) {
|
|
|
2936
2937
|
_chunk7QVYU63Ejs.__name.call(void 0, formatDateTime, "formatDateTime");
|
|
2937
2938
|
function UsageHistoryTable({ usageRecords }) {
|
|
2938
2939
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2939
|
-
const fmt =
|
|
2940
|
+
const fmt = _chunk2WK35GO2js.useBillingFormatOptions.call(void 0, );
|
|
2940
2941
|
if (usageRecords.length === 0) {
|
|
2941
2942
|
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") }) });
|
|
2942
2943
|
}
|
|
2943
2944
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
2944
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2945
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-clip rounded-lg border", children: /* @__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,
|
|
2950
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2945
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.SectionHeader, { level: 2, children: t("billing.ui.usage.history_title") }),
|
|
2946
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-clip rounded-lg border", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.Table, { children: [
|
|
2947
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.TableRow, { children: [
|
|
2948
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.TableHead, { children: t("billing.ui.columns.date_time") }),
|
|
2949
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.TableHead, { children: t("billing.ui.columns.meter_event") }),
|
|
2950
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.TableHead, { className: "text-end", children: t("billing.ui.columns.quantity") }),
|
|
2951
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.TableHead, { children: t("billing.ui.columns.event_id") })
|
|
2951
2952
|
] }) }),
|
|
2952
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2953
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.TableBody, { children: usageRecords.map((record) => {
|
|
2953
2954
|
const dateTime = formatDateTime(record.timestamp, fmt);
|
|
2954
2955
|
const quantity = record.quantity.toLocaleString(fmt.locale);
|
|
2955
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2956
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2957
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2958
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2959
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2956
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.TableRow, { children: [
|
|
2957
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.TableCell, { className: "font-medium", children: dateTime }),
|
|
2958
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.TableCell, { className: "text-muted-foreground", children: record.meterEventName }),
|
|
2959
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.TableCell, { className: "text-end font-medium", children: quantity }),
|
|
2960
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.TableCell, { className: "text-muted-foreground text-sm tabular-nums", children: record.stripeEventId })
|
|
2960
2961
|
] }, record.id);
|
|
2961
2962
|
}) })
|
|
2962
2963
|
] }) })
|
|
@@ -2967,8 +2968,8 @@ _chunk7QVYU63Ejs.__name.call(void 0, UsageHistoryTable, "UsageHistoryTable");
|
|
|
2967
2968
|
// src/features/billing/components/modals/BillingDetailModal.tsx
|
|
2968
2969
|
|
|
2969
2970
|
function BillingDetailModal({ open, onOpenChange, title, children, className }) {
|
|
2970
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2971
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2971
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.DialogContent, { className: _nullishCoalesce(className, () => ( "max-w-4xl max-h-[90vh] overflow-y-auto")), children: [
|
|
2972
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.DialogHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.DialogTitle, { children: title }) }),
|
|
2972
2973
|
children
|
|
2973
2974
|
] }) });
|
|
2974
2975
|
}
|
|
@@ -2996,7 +2997,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
|
|
|
2996
2997
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-destructive text-sm font-medium", children: t("billing.ui.alert.payment_failed_title") }),
|
|
2997
2998
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive mt-1 text-sm", children: t("billing.ui.alert.payment_failed_description") })
|
|
2998
2999
|
] }),
|
|
2999
|
-
onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3000
|
+
onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Button, { variant: "outline", size: "sm", onClick: onUpdatePayment, className: "text-destructive border-red-300", children: t("billing.ui.alert.update_payment_method") })
|
|
3000
3001
|
] });
|
|
3001
3002
|
}
|
|
3002
3003
|
if (subscription.status === "trialing" /* TRIALING */ && subscription.trialEnd) {
|
|
@@ -3010,7 +3011,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
|
|
|
3010
3011
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-warning text-sm font-medium", children: t("billing.ui.alert.trial_ending_title") }),
|
|
3011
3012
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-warning mt-1 text-sm", children: t("billing.ui.alert.trial_ending_description", { count: daysRemaining }) })
|
|
3012
3013
|
] }),
|
|
3013
|
-
onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3014
|
+
onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Button, { variant: "outline", size: "sm", onClick: onAddPayment, className: "text-warning border-yellow-300", children: t("billing.ui.payment_methods.add") })
|
|
3014
3015
|
] });
|
|
3015
3016
|
}
|
|
3016
3017
|
}
|
|
@@ -3244,18 +3245,18 @@ function BillingDashboardContainer() {
|
|
|
3244
3245
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-8 w-8" }),
|
|
3245
3246
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: t("billing.title") })
|
|
3246
3247
|
] }),
|
|
3247
|
-
isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3248
|
-
noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3249
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3248
|
+
isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.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" }) }) }),
|
|
3249
|
+
noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.Card, { children: [
|
|
3250
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.CardHeader, { className: "text-center", children: [
|
|
3250
3251
|
/* @__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" }) }),
|
|
3251
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3252
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3252
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardTitle, { children: t("billing.ui.dashboard.setup_title") }),
|
|
3253
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardDescription, { children: t("billing.ui.dashboard.setup_description") })
|
|
3253
3254
|
] }),
|
|
3254
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3255
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardContent, { className: "flex justify-center pb-8", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Button, { onClick: handleCreateCustomer, disabled: creatingCustomer, size: "lg", children: creatingCustomer ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
3255
3256
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "me-2 h-4 w-4 animate-spin" }),
|
|
3256
3257
|
t("billing.ui.dashboard.setting_up")
|
|
3257
3258
|
] }) : t("billing.ui.dashboard.setup_button") }) }),
|
|
3258
|
-
errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3259
|
+
errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CardContent, { className: "pt-0", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-center text-destructive text-xs/relaxed", children: t(errors.customer) }) })
|
|
3259
3260
|
] }),
|
|
3260
3261
|
!noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
3261
3262
|
criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -3424,18 +3425,18 @@ _chunk7QVYU63Ejs.__name.call(void 0, isStripeConfigured, "isStripeConfigured");
|
|
|
3424
3425
|
|
|
3425
3426
|
function PriceArchiver({ price }) {
|
|
3426
3427
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
3427
|
-
const fmt =
|
|
3428
|
+
const fmt = _chunk2WK35GO2js.useBillingFormatOptions.call(void 0, );
|
|
3428
3429
|
const { archivePrice, restorePrice } = usePriceContext();
|
|
3429
3430
|
const [open, setOpen] = _react.useState.call(void 0, false);
|
|
3430
3431
|
const isArchived = !price.active;
|
|
3431
3432
|
const scope = isArchived ? "restore" : "archive";
|
|
3432
3433
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
3433
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3434
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.Button, { variant: "outline", size: "sm", onClick: () => setOpen(true), children: [
|
|
3434
3435
|
isArchived ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RotateCcwIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ArchiveIcon, {}),
|
|
3435
3436
|
t(`billing.admin.prices.${scope}.confirm`)
|
|
3436
3437
|
] }),
|
|
3437
3438
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3438
|
-
|
|
3439
|
+
_chunk2WK35GO2js.ConfirmDialog,
|
|
3439
3440
|
{
|
|
3440
3441
|
open,
|
|
3441
3442
|
onOpenChange: setOpen,
|
|
@@ -3449,7 +3450,7 @@ function PriceArchiver({ price }) {
|
|
|
3449
3450
|
if (isArchived) await restorePrice(price.id);
|
|
3450
3451
|
else await archivePrice(price.id);
|
|
3451
3452
|
} catch (error) {
|
|
3452
|
-
|
|
3453
|
+
_chunk2WK35GO2js.errorToast.call(void 0, { title: t(`billing.admin.prices.${scope}.title`), error });
|
|
3453
3454
|
throw error;
|
|
3454
3455
|
}
|
|
3455
3456
|
}
|
|
@@ -3481,7 +3482,7 @@ function PriceEditorInternal({
|
|
|
3481
3482
|
onDialogOpenChange
|
|
3482
3483
|
}) {
|
|
3483
3484
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
3484
|
-
const fmt =
|
|
3485
|
+
const fmt = _chunk2WK35GO2js.useBillingFormatOptions.call(void 0, );
|
|
3485
3486
|
const router = _chunk5TH2DSAHjs.useI18nRouter.call(void 0, );
|
|
3486
3487
|
const { createPrice, updatePrice, productId: contextProductId } = usePriceContext();
|
|
3487
3488
|
const [allFeatures, setAllFeatures] = _react.useState.call(void 0, []);
|
|
@@ -3623,7 +3624,7 @@ function PriceEditorInternal({
|
|
|
3623
3624
|
{ id: "metered", text: t("billing.admin.prices.usage.metered") }
|
|
3624
3625
|
];
|
|
3625
3626
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3626
|
-
|
|
3627
|
+
_chunk2WK35GO2js.EditorSheet,
|
|
3627
3628
|
{
|
|
3628
3629
|
form,
|
|
3629
3630
|
entityType: t("billing.admin.prices.entity"),
|
|
@@ -3678,13 +3679,13 @@ function PriceEditorInternal({
|
|
|
3678
3679
|
dialogOpen,
|
|
3679
3680
|
onDialogOpenChange,
|
|
3680
3681
|
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
3681
|
-
isEdit && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3682
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3683
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3682
|
+
isEdit && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.Alert, { children: [
|
|
3683
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.AlertTitle, { children: t("billing.admin.prices.immutability.title") }),
|
|
3684
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.AlertDescription, { children: t("billing.admin.prices.immutability.description") })
|
|
3684
3685
|
] }),
|
|
3685
3686
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
|
|
3686
3687
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3687
|
-
|
|
3688
|
+
_chunk2WK35GO2js.FormInput,
|
|
3688
3689
|
{
|
|
3689
3690
|
form,
|
|
3690
3691
|
id: "unitAmount",
|
|
@@ -3696,7 +3697,7 @@ function PriceEditorInternal({
|
|
|
3696
3697
|
}
|
|
3697
3698
|
),
|
|
3698
3699
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3699
|
-
|
|
3700
|
+
_chunk2WK35GO2js.FormSelect,
|
|
3700
3701
|
{
|
|
3701
3702
|
form,
|
|
3702
3703
|
id: "currency",
|
|
@@ -3707,7 +3708,7 @@ function PriceEditorInternal({
|
|
|
3707
3708
|
)
|
|
3708
3709
|
] }),
|
|
3709
3710
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3710
|
-
|
|
3711
|
+
_chunk2WK35GO2js.FormSelect,
|
|
3711
3712
|
{
|
|
3712
3713
|
form,
|
|
3713
3714
|
id: "interval",
|
|
@@ -3718,7 +3719,7 @@ function PriceEditorInternal({
|
|
|
3718
3719
|
),
|
|
3719
3720
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
|
|
3720
3721
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3721
|
-
|
|
3722
|
+
_chunk2WK35GO2js.FormInput,
|
|
3722
3723
|
{
|
|
3723
3724
|
form,
|
|
3724
3725
|
id: "intervalCount",
|
|
@@ -3729,7 +3730,7 @@ function PriceEditorInternal({
|
|
|
3729
3730
|
}
|
|
3730
3731
|
),
|
|
3731
3732
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3732
|
-
|
|
3733
|
+
_chunk2WK35GO2js.FormSelect,
|
|
3733
3734
|
{
|
|
3734
3735
|
form,
|
|
3735
3736
|
id: "usageType",
|
|
@@ -3740,7 +3741,7 @@ function PriceEditorInternal({
|
|
|
3740
3741
|
)
|
|
3741
3742
|
] }),
|
|
3742
3743
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3743
|
-
|
|
3744
|
+
_chunk2WK35GO2js.FormInput,
|
|
3744
3745
|
{
|
|
3745
3746
|
form,
|
|
3746
3747
|
id: "nickname",
|
|
@@ -3749,7 +3750,7 @@ function PriceEditorInternal({
|
|
|
3749
3750
|
}
|
|
3750
3751
|
),
|
|
3751
3752
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3752
|
-
|
|
3753
|
+
_chunk2WK35GO2js.FormTextarea,
|
|
3753
3754
|
{
|
|
3754
3755
|
form,
|
|
3755
3756
|
id: "description",
|
|
@@ -3759,7 +3760,7 @@ function PriceEditorInternal({
|
|
|
3759
3760
|
}
|
|
3760
3761
|
),
|
|
3761
3762
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3762
|
-
|
|
3763
|
+
_chunk2WK35GO2js.FormInput,
|
|
3763
3764
|
{
|
|
3764
3765
|
form,
|
|
3765
3766
|
id: "token",
|
|
@@ -3769,10 +3770,10 @@ function PriceEditorInternal({
|
|
|
3769
3770
|
}
|
|
3770
3771
|
),
|
|
3771
3772
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-2", children: [
|
|
3772
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3773
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.FieldLabel, { children: t("billing.admin.prices.fields.features") }),
|
|
3773
3774
|
form.watch("features").map((_, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
|
|
3774
3775
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3775
|
-
|
|
3776
|
+
_chunk2WK35GO2js.Input,
|
|
3776
3777
|
{
|
|
3777
3778
|
...form.register(`features.${index}`),
|
|
3778
3779
|
placeholder: t("billing.admin.prices.placeholders.feature", { index: index + 1 }),
|
|
@@ -3780,7 +3781,7 @@ function PriceEditorInternal({
|
|
|
3780
3781
|
}
|
|
3781
3782
|
),
|
|
3782
3783
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3783
|
-
|
|
3784
|
+
_chunk2WK35GO2js.Button,
|
|
3784
3785
|
{
|
|
3785
3786
|
type: "button",
|
|
3786
3787
|
variant: "outline",
|
|
@@ -3795,7 +3796,7 @@ function PriceEditorInternal({
|
|
|
3795
3796
|
)
|
|
3796
3797
|
] }, index)),
|
|
3797
3798
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3798
|
-
|
|
3799
|
+
_chunk2WK35GO2js.Button,
|
|
3799
3800
|
{
|
|
3800
3801
|
type: "button",
|
|
3801
3802
|
variant: "outline",
|
|
@@ -3810,12 +3811,12 @@ function PriceEditorInternal({
|
|
|
3810
3811
|
)
|
|
3811
3812
|
] }),
|
|
3812
3813
|
isRecurring && allFeatures.length > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-2", children: [
|
|
3813
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3814
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.FieldLabel, { children: t("billing.admin.prices.fields.platformFeatures") }),
|
|
3814
3815
|
/* @__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) => {
|
|
3815
3816
|
const isChecked = form.watch("featureIds").includes(feature.id);
|
|
3816
3817
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
3817
3818
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3818
|
-
|
|
3819
|
+
_chunk2WK35GO2js.Checkbox,
|
|
3819
3820
|
{
|
|
3820
3821
|
id: `feature-${feature.id}`,
|
|
3821
3822
|
checked: isChecked,
|
|
@@ -3831,13 +3832,13 @@ function PriceEditorInternal({
|
|
|
3831
3832
|
}
|
|
3832
3833
|
}
|
|
3833
3834
|
),
|
|
3834
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3835
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.FieldLabel, { htmlFor: `feature-${feature.id}`, children: feature.name }),
|
|
3835
3836
|
feature.isCore && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.admin.prices.help.core") })
|
|
3836
3837
|
] }, feature.id);
|
|
3837
3838
|
}) })
|
|
3838
3839
|
] }),
|
|
3839
3840
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3840
|
-
|
|
3841
|
+
_chunk2WK35GO2js.FormCheckbox,
|
|
3841
3842
|
{
|
|
3842
3843
|
form,
|
|
3843
3844
|
id: "isTrial",
|
|
@@ -3890,9 +3891,9 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3890
3891
|
productId: productIdProp
|
|
3891
3892
|
}) => {
|
|
3892
3893
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
3893
|
-
const fmt =
|
|
3894
|
-
const generateUrl =
|
|
3895
|
-
const { hasRole } =
|
|
3894
|
+
const fmt = _chunk2WK35GO2js.useBillingFormatOptions.call(void 0, );
|
|
3895
|
+
const generateUrl = _chunk2WK35GO2js.usePageUrlGenerator.call(void 0, );
|
|
3896
|
+
const { hasRole } = _chunk2WK35GO2js.useCurrentUserContext.call(void 0, );
|
|
3896
3897
|
const [price, setPrice] = _react.useState.call(void 0,
|
|
3897
3898
|
dehydratedPrice ? _chunk5TH2DSAHjs.rehydrate.call(void 0, _chunk5TH2DSAHjs.Modules.StripePrice, dehydratedPrice) : void 0
|
|
3898
3899
|
);
|
|
@@ -3980,7 +3981,7 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3980
3981
|
}
|
|
3981
3982
|
return response;
|
|
3982
3983
|
}, "title");
|
|
3983
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3984
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceContext.Provider, { value, children }) });
|
|
3984
3985
|
}, "PriceProvider");
|
|
3985
3986
|
var usePriceContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => _nullishCoalesce(_react.useContext.call(void 0, PriceContext), () => ( defaultContextValue)), "usePriceContext");
|
|
3986
3987
|
|
|
@@ -4000,12 +4001,12 @@ function ProductArchiver({ product }) {
|
|
|
4000
4001
|
const isArchived = !product.active;
|
|
4001
4002
|
const scope = isArchived ? "restore" : "archive";
|
|
4002
4003
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
4003
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
4004
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.Button, { variant: "outline", size: "sm", onClick: () => setOpen(true), children: [
|
|
4004
4005
|
isArchived ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RotateCcwIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ArchiveIcon, {}),
|
|
4005
4006
|
t(`billing.admin.products.${scope}.confirm`)
|
|
4006
4007
|
] }),
|
|
4007
4008
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4008
|
-
|
|
4009
|
+
_chunk2WK35GO2js.ConfirmDialog,
|
|
4009
4010
|
{
|
|
4010
4011
|
open,
|
|
4011
4012
|
onOpenChange: setOpen,
|
|
@@ -4019,7 +4020,7 @@ function ProductArchiver({ product }) {
|
|
|
4019
4020
|
if (isArchived) await restoreProduct(product.id);
|
|
4020
4021
|
else await archiveProduct(product.id);
|
|
4021
4022
|
} catch (error) {
|
|
4022
|
-
|
|
4023
|
+
_chunk2WK35GO2js.errorToast.call(void 0, { title: t(`billing.admin.products.${scope}.title`), error });
|
|
4023
4024
|
throw error;
|
|
4024
4025
|
}
|
|
4025
4026
|
}
|
|
@@ -4072,7 +4073,7 @@ function ProductEditorInternal({
|
|
|
4072
4073
|
defaultValues: getDefaultValues()
|
|
4073
4074
|
});
|
|
4074
4075
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4075
|
-
|
|
4076
|
+
_chunk2WK35GO2js.EditorSheet,
|
|
4076
4077
|
{
|
|
4077
4078
|
form,
|
|
4078
4079
|
entityType: t("billing.admin.products.entity"),
|
|
@@ -4095,7 +4096,7 @@ function ProductEditorInternal({
|
|
|
4095
4096
|
onDialogOpenChange,
|
|
4096
4097
|
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4097
4098
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4098
|
-
|
|
4099
|
+
_chunk2WK35GO2js.FormInput,
|
|
4099
4100
|
{
|
|
4100
4101
|
form,
|
|
4101
4102
|
id: "name",
|
|
@@ -4105,7 +4106,7 @@ function ProductEditorInternal({
|
|
|
4105
4106
|
}
|
|
4106
4107
|
),
|
|
4107
4108
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4108
|
-
|
|
4109
|
+
_chunk2WK35GO2js.FormTextarea,
|
|
4109
4110
|
{
|
|
4110
4111
|
form,
|
|
4111
4112
|
id: "description",
|
|
@@ -4149,8 +4150,8 @@ var defaultContextValue2 = {
|
|
|
4149
4150
|
};
|
|
4150
4151
|
var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ children, dehydratedProduct, publishChrome = true }) => {
|
|
4151
4152
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4152
|
-
const generateUrl =
|
|
4153
|
-
const { hasRole } =
|
|
4153
|
+
const generateUrl = _chunk2WK35GO2js.usePageUrlGenerator.call(void 0, );
|
|
4154
|
+
const { hasRole } = _chunk2WK35GO2js.useCurrentUserContext.call(void 0, );
|
|
4154
4155
|
const [product, setProduct] = _react.useState.call(void 0,
|
|
4155
4156
|
dehydratedProduct ? _chunk5TH2DSAHjs.rehydrate.call(void 0, _chunk5TH2DSAHjs.Modules.StripeProduct, dehydratedProduct) : void 0
|
|
4156
4157
|
);
|
|
@@ -4244,7 +4245,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
4244
4245
|
}
|
|
4245
4246
|
return response;
|
|
4246
4247
|
}, "title");
|
|
4247
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4248
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductContext.Provider, { value, children }) });
|
|
4248
4249
|
}, "ProductProvider");
|
|
4249
4250
|
var useProductContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => _nullishCoalesce(_react.useContext.call(void 0, ProductContext), () => ( defaultContextValue2)), "useProductContext");
|
|
4250
4251
|
|
|
@@ -4253,57 +4254,57 @@ var useProductContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ()
|
|
|
4253
4254
|
|
|
4254
4255
|
function PriceDetails() {
|
|
4255
4256
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4256
|
-
const fmt =
|
|
4257
|
-
const generateUrl =
|
|
4257
|
+
const fmt = _chunk2WK35GO2js.useBillingFormatOptions.call(void 0, );
|
|
4258
|
+
const generateUrl = _chunk2WK35GO2js.usePageUrlGenerator.call(void 0, );
|
|
4258
4259
|
const { price } = usePriceContext();
|
|
4259
4260
|
if (!price) return null;
|
|
4260
4261
|
const isRecurring = price.priceType === "recurring";
|
|
4261
4262
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-8", children: [
|
|
4262
4263
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4263
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4264
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.SectionHeader, { children: t("billing.admin.prices.title") }),
|
|
4264
4265
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
4265
4266
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4266
|
-
|
|
4267
|
+
_chunk2WK35GO2js.DetailField,
|
|
4267
4268
|
{
|
|
4268
4269
|
label: t("billing.admin.prices.fields.product"),
|
|
4269
|
-
value: price.product ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4270
|
+
value: price.product ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Link, { href: generateUrl({ page: _chunk5TH2DSAHjs.Modules.StripeProduct, id: price.product.id }), children: price.product.name }) : "\u2014"
|
|
4270
4271
|
}
|
|
4271
4272
|
),
|
|
4272
4273
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4273
|
-
|
|
4274
|
+
_chunk2WK35GO2js.DetailField,
|
|
4274
4275
|
{
|
|
4275
4276
|
label: t("billing.admin.prices.fields.status"),
|
|
4276
4277
|
value: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex flex-wrap items-center gap-1", children: [
|
|
4277
|
-
price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4278
|
-
price.isTrial && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4278
|
+
price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Badge, { variant: "softGreen", children: t("billing.admin.prices.status.active") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Badge, { variant: "softGray", children: t("billing.admin.prices.status.archived") }),
|
|
4279
|
+
price.isTrial && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Badge, { variant: "softBlue", children: t("billing.admin.prices.badge.trial") })
|
|
4279
4280
|
] })
|
|
4280
4281
|
}
|
|
4281
4282
|
),
|
|
4282
4283
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4283
|
-
|
|
4284
|
+
_chunk2WK35GO2js.DetailField,
|
|
4284
4285
|
{
|
|
4285
4286
|
label: t("billing.admin.prices.fields.amount"),
|
|
4286
4287
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _chunk5TH2DSAHjs.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt) })
|
|
4287
4288
|
}
|
|
4288
4289
|
),
|
|
4289
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4290
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.DetailField, { label: t("billing.admin.prices.fields.currency"), value: price.currency.toUpperCase() }),
|
|
4290
4291
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4291
|
-
|
|
4292
|
+
_chunk2WK35GO2js.DetailField,
|
|
4292
4293
|
{
|
|
4293
4294
|
label: t("billing.admin.prices.fields.type"),
|
|
4294
4295
|
value: isRecurring ? t("billing.admin.prices.type.recurring") : t("billing.admin.prices.type.oneTime")
|
|
4295
4296
|
}
|
|
4296
4297
|
),
|
|
4297
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4298
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.DetailField, { label: t("billing.admin.prices.fields.billing"), value: _chunk5TH2DSAHjs.formatInterval.call(void 0, price, fmt) }),
|
|
4298
4299
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4299
|
-
|
|
4300
|
+
_chunk2WK35GO2js.DetailField,
|
|
4300
4301
|
{
|
|
4301
4302
|
label: t("billing.admin.prices.fields.intervalCount"),
|
|
4302
4303
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _nullishCoalesce(_optionalChain([price, 'access', _162 => _162.recurring, 'optionalAccess', _163 => _163.intervalCount]), () => ( 1)) })
|
|
4303
4304
|
}
|
|
4304
4305
|
),
|
|
4305
4306
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4306
|
-
|
|
4307
|
+
_chunk2WK35GO2js.DetailField,
|
|
4307
4308
|
{
|
|
4308
4309
|
label: t("billing.admin.prices.fields.usageType"),
|
|
4309
4310
|
value: _optionalChain([price, 'access', _164 => _164.recurring, 'optionalAccess', _165 => _165.usageType]) === "metered" ? t("billing.admin.prices.usage.metered") : t("billing.admin.prices.usage.licensed")
|
|
@@ -4312,24 +4313,24 @@ function PriceDetails() {
|
|
|
4312
4313
|
] })
|
|
4313
4314
|
] }),
|
|
4314
4315
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4315
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4316
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.SectionHeader, { children: t("billing.admin.prices.fields.platformFeatures") }),
|
|
4316
4317
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
4317
4318
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4318
|
-
|
|
4319
|
+
_chunk2WK35GO2js.DetailField,
|
|
4319
4320
|
{
|
|
4320
4321
|
label: t("billing.admin.prices.fields.token"),
|
|
4321
4322
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _nullishCoalesce(price.token, () => ( "\u2014")) })
|
|
4322
4323
|
}
|
|
4323
4324
|
),
|
|
4324
4325
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4325
|
-
|
|
4326
|
+
_chunk2WK35GO2js.DetailField,
|
|
4326
4327
|
{
|
|
4327
4328
|
label: t("billing.admin.prices.fields.stripeId"),
|
|
4328
4329
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: price.stripePriceId })
|
|
4329
4330
|
}
|
|
4330
4331
|
),
|
|
4331
4332
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4332
|
-
|
|
4333
|
+
_chunk2WK35GO2js.DetailField,
|
|
4333
4334
|
{
|
|
4334
4335
|
label: t("billing.admin.prices.fields.description"),
|
|
4335
4336
|
value: _nullishCoalesce(price.description, () => ( "\u2014")),
|
|
@@ -4337,7 +4338,7 @@ function PriceDetails() {
|
|
|
4337
4338
|
}
|
|
4338
4339
|
),
|
|
4339
4340
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4340
|
-
|
|
4341
|
+
_chunk2WK35GO2js.DetailField,
|
|
4341
4342
|
{
|
|
4342
4343
|
label: t("billing.admin.prices.fields.features"),
|
|
4343
4344
|
className: "md:col-span-2",
|
|
@@ -4345,11 +4346,11 @@ function PriceDetails() {
|
|
|
4345
4346
|
}
|
|
4346
4347
|
),
|
|
4347
4348
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4348
|
-
|
|
4349
|
+
_chunk2WK35GO2js.DetailField,
|
|
4349
4350
|
{
|
|
4350
4351
|
label: t("billing.admin.prices.fields.platformFeatures"),
|
|
4351
4352
|
className: "md:col-span-2",
|
|
4352
|
-
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,
|
|
4353
|
+
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, _chunk2WK35GO2js.Badge, { variant: "softGray", children: feature.name }, feature.id)) }) : "\u2014"
|
|
4353
4354
|
}
|
|
4354
4355
|
)
|
|
4355
4356
|
] })
|
|
@@ -4363,7 +4364,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, PriceDetails, "PriceDetails");
|
|
|
4363
4364
|
function PriceContainer() {
|
|
4364
4365
|
const { price } = usePriceContext();
|
|
4365
4366
|
if (!price) return null;
|
|
4366
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4367
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.RoundPageContainer, { module: _chunk5TH2DSAHjs.Modules.StripePrice, id: price.id, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceDetails, {}) });
|
|
4367
4368
|
}
|
|
4368
4369
|
_chunk7QVYU63Ejs.__name.call(void 0, PriceContainer, "PriceContainer");
|
|
4369
4370
|
|
|
@@ -4488,7 +4489,7 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4488
4489
|
const importInputRef = _react.useRef.call(void 0, null);
|
|
4489
4490
|
const [seed, setSeed] = _react.useState.call(void 0, void 0);
|
|
4490
4491
|
const [seedNonce, setSeedNonce] = _react.useState.call(void 0, 0);
|
|
4491
|
-
const data =
|
|
4492
|
+
const data = _chunk2WK35GO2js.useDataListRetriever.call(void 0, {
|
|
4492
4493
|
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunk5TH2DSAHjs.StripePriceService.listPrices({ ...params, productId }), "retriever"),
|
|
4493
4494
|
retrieverParams: {},
|
|
4494
4495
|
module: _chunk5TH2DSAHjs.Modules.StripePrice
|
|
@@ -4526,7 +4527,7 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4526
4527
|
openSeededEditor(transfer.price);
|
|
4527
4528
|
} catch (error) {
|
|
4528
4529
|
console.error("[PricesList] price import failed", error);
|
|
4529
|
-
|
|
4530
|
+
_chunk2WK35GO2js.errorToast.call(void 0, {
|
|
4530
4531
|
title: t("billing.admin.prices.import.errors.title"),
|
|
4531
4532
|
error: t("billing.admin.prices.import.errors.invalid")
|
|
4532
4533
|
});
|
|
@@ -4545,7 +4546,7 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4545
4546
|
"create-price"
|
|
4546
4547
|
),
|
|
4547
4548
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _react.Fragment, { children: [
|
|
4548
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
4549
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2WK35GO2js.Button, { variant: "outline", size: "sm", type: "button", onClick: () => _optionalChain([importInputRef, 'access', _180 => _180.current, 'optionalAccess', _181 => _181.click, 'call', _182 => _182()]), children: [
|
|
4549
4550
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.UploadIcon, {}),
|
|
4550
4551
|
t("billing.admin.prices.actions.import")
|
|
4551
4552
|
] }),
|
|
@@ -4563,7 +4564,7 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4563
4564
|
];
|
|
4564
4565
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
4565
4566
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4566
|
-
|
|
4567
|
+
_chunk2WK35GO2js.ContentListTable,
|
|
4567
4568
|
{
|
|
4568
4569
|
data,
|
|
4569
4570
|
fields: [
|
|
@@ -4580,7 +4581,7 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4580
4581
|
fullWidth,
|
|
4581
4582
|
title: t("billing.admin.prices.title"),
|
|
4582
4583
|
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4583
|
-
|
|
4584
|
+
_chunk2WK35GO2js.EmptyState,
|
|
4584
4585
|
{
|
|
4585
4586
|
icon: _lucidereact.DollarSignIcon,
|
|
4586
4587
|
title: t("billing.admin.prices.empty.title"),
|
|
@@ -4620,18 +4621,18 @@ function ProductDetails() {
|
|
|
4620
4621
|
const { product } = useProductContext();
|
|
4621
4622
|
if (!product) return null;
|
|
4622
4623
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4623
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4624
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.SectionHeader, { children: t("billing.admin.products.tabs.details") }),
|
|
4624
4625
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
4625
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4626
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.DetailField, { label: t("billing.admin.products.fields.name"), value: product.name }),
|
|
4626
4627
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4627
|
-
|
|
4628
|
+
_chunk2WK35GO2js.DetailField,
|
|
4628
4629
|
{
|
|
4629
4630
|
label: t("billing.admin.products.fields.status"),
|
|
4630
|
-
value: product.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4631
|
+
value: product.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Badge, { variant: "softGreen", children: t("billing.admin.products.status.active") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Badge, { variant: "softGray", children: t("billing.admin.products.status.archived") })
|
|
4631
4632
|
}
|
|
4632
4633
|
),
|
|
4633
4634
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4634
|
-
|
|
4635
|
+
_chunk2WK35GO2js.DetailField,
|
|
4635
4636
|
{
|
|
4636
4637
|
label: t("billing.admin.products.fields.description"),
|
|
4637
4638
|
value: _nullishCoalesce(product.description, () => ( "\u2014")),
|
|
@@ -4639,14 +4640,14 @@ function ProductDetails() {
|
|
|
4639
4640
|
}
|
|
4640
4641
|
),
|
|
4641
4642
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4642
|
-
|
|
4643
|
+
_chunk2WK35GO2js.DetailField,
|
|
4643
4644
|
{
|
|
4644
4645
|
label: t("billing.admin.products.fields.prices"),
|
|
4645
4646
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: product.stripePrices.length })
|
|
4646
4647
|
}
|
|
4647
4648
|
),
|
|
4648
4649
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4649
|
-
|
|
4650
|
+
_chunk2WK35GO2js.DetailField,
|
|
4650
4651
|
{
|
|
4651
4652
|
label: t("billing.admin.products.fields.stripeId"),
|
|
4652
4653
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: product.stripeProductId })
|
|
@@ -4664,7 +4665,7 @@ function ProductContainer() {
|
|
|
4664
4665
|
const { product } = useProductContext();
|
|
4665
4666
|
if (!product) return null;
|
|
4666
4667
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4667
|
-
|
|
4668
|
+
_chunk2WK35GO2js.RoundPageContainer,
|
|
4668
4669
|
{
|
|
4669
4670
|
module: _chunk5TH2DSAHjs.Modules.StripeProduct,
|
|
4670
4671
|
id: product.id,
|
|
@@ -4701,8 +4702,8 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductContainer, "ProductContainer");
|
|
|
4701
4702
|
|
|
4702
4703
|
function CouponsList({ fullWidth } = {}) {
|
|
4703
4704
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4704
|
-
const { catalogueVersion } =
|
|
4705
|
-
const data =
|
|
4705
|
+
const { catalogueVersion } = _chunk2WK35GO2js.useCouponContext.call(void 0, );
|
|
4706
|
+
const data = _chunk2WK35GO2js.useDataListRetriever.call(void 0, {
|
|
4706
4707
|
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunk5TH2DSAHjs.StripeCouponService.listCoupons(params), "retriever"),
|
|
4707
4708
|
retrieverParams: {},
|
|
4708
4709
|
module: _chunk5TH2DSAHjs.Modules.StripeCoupon
|
|
@@ -4710,9 +4711,9 @@ function CouponsList({ fullWidth } = {}) {
|
|
|
4710
4711
|
_react.useEffect.call(void 0, () => {
|
|
4711
4712
|
if (catalogueVersion > 0) void data.refresh();
|
|
4712
4713
|
}, [catalogueVersion]);
|
|
4713
|
-
const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4714
|
+
const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CouponEditor, {}, "create-coupon")];
|
|
4714
4715
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4715
|
-
|
|
4716
|
+
_chunk2WK35GO2js.ContentListTable,
|
|
4716
4717
|
{
|
|
4717
4718
|
data,
|
|
4718
4719
|
fields: [
|
|
@@ -4727,7 +4728,7 @@ function CouponsList({ fullWidth } = {}) {
|
|
|
4727
4728
|
fullWidth,
|
|
4728
4729
|
title: t("billing.admin.coupons.title"),
|
|
4729
4730
|
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4730
|
-
|
|
4731
|
+
_chunk2WK35GO2js.EmptyState,
|
|
4731
4732
|
{
|
|
4732
4733
|
icon: _lucidereact.TicketPercentIcon,
|
|
4733
4734
|
title: t("billing.admin.coupons.empty.title"),
|
|
@@ -4747,7 +4748,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, CouponsList, "CouponsList");
|
|
|
4747
4748
|
function ProductsList({ fullWidth } = {}) {
|
|
4748
4749
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4749
4750
|
const { catalogueVersion } = useProductContext();
|
|
4750
|
-
const data =
|
|
4751
|
+
const data = _chunk2WK35GO2js.useDataListRetriever.call(void 0, {
|
|
4751
4752
|
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunk5TH2DSAHjs.StripeProductService.listProducts(params), "retriever"),
|
|
4752
4753
|
retrieverParams: {},
|
|
4753
4754
|
module: _chunk5TH2DSAHjs.Modules.StripeProduct
|
|
@@ -4757,7 +4758,7 @@ function ProductsList({ fullWidth } = {}) {
|
|
|
4757
4758
|
}, [catalogueVersion]);
|
|
4758
4759
|
const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductEditor, {}, "create-product")];
|
|
4759
4760
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4760
|
-
|
|
4761
|
+
_chunk2WK35GO2js.ContentListTable,
|
|
4761
4762
|
{
|
|
4762
4763
|
data,
|
|
4763
4764
|
fields: ["name" /* name */, "status" /* status */, "prices" /* prices */],
|
|
@@ -4766,7 +4767,7 @@ function ProductsList({ fullWidth } = {}) {
|
|
|
4766
4767
|
fullWidth,
|
|
4767
4768
|
title: t("billing.admin.products.title"),
|
|
4768
4769
|
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4769
|
-
|
|
4770
|
+
_chunk2WK35GO2js.EmptyState,
|
|
4770
4771
|
{
|
|
4771
4772
|
icon: _lucidereact.PackageIcon,
|
|
4772
4773
|
title: t("billing.admin.products.empty.title"),
|
|
@@ -4782,8 +4783,8 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductsList, "ProductsList");
|
|
|
4782
4783
|
|
|
4783
4784
|
function ProductsListContainer() {
|
|
4784
4785
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4785
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductProvider, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4786
|
-
|
|
4786
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductProvider, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CouponProvider, { publishChrome: false, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4787
|
+
_chunk2WK35GO2js.RoundPageContainer,
|
|
4787
4788
|
{
|
|
4788
4789
|
module: _chunk5TH2DSAHjs.Modules.StripeProduct,
|
|
4789
4790
|
tabs: [
|
|
@@ -4803,30 +4804,30 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductsListContainer, "ProductsListContain
|
|
|
4803
4804
|
|
|
4804
4805
|
function CouponDetails() {
|
|
4805
4806
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4806
|
-
const fmt =
|
|
4807
|
-
const { coupon } =
|
|
4807
|
+
const fmt = _chunk2WK35GO2js.useBillingFormatOptions.call(void 0, );
|
|
4808
|
+
const { coupon } = _chunk2WK35GO2js.useCouponContext.call(void 0, );
|
|
4808
4809
|
if (!coupon) return null;
|
|
4809
4810
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4810
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4811
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.SectionHeader, { children: t("billing.admin.products.tabs.details") }),
|
|
4811
4812
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-xs/relaxed", children: t("billing.admin.coupons.fixed_notice") }),
|
|
4812
4813
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
4813
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4814
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.DetailField, { label: t("billing.admin.coupons.fields.name"), value: coupon.name }),
|
|
4814
4815
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4815
|
-
|
|
4816
|
+
_chunk2WK35GO2js.DetailField,
|
|
4816
4817
|
{
|
|
4817
4818
|
label: t("billing.admin.coupons.fields.status"),
|
|
4818
|
-
value: coupon.valid ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4819
|
+
value: coupon.valid ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Badge, { variant: "softGreen", children: t("billing.admin.coupons.status.active") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Badge, { variant: "softGray", children: t("billing.admin.coupons.status.ended") })
|
|
4819
4820
|
}
|
|
4820
4821
|
),
|
|
4821
4822
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4822
|
-
|
|
4823
|
+
_chunk2WK35GO2js.DetailField,
|
|
4823
4824
|
{
|
|
4824
4825
|
label: t("billing.admin.coupons.fields.discount"),
|
|
4825
4826
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _chunk5TH2DSAHjs.formatCouponDiscount.call(void 0, coupon, t, fmt) })
|
|
4826
4827
|
}
|
|
4827
4828
|
),
|
|
4828
4829
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4829
|
-
|
|
4830
|
+
_chunk2WK35GO2js.DetailField,
|
|
4830
4831
|
{
|
|
4831
4832
|
label: t("billing.admin.coupons.fields.places"),
|
|
4832
4833
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: coupon.maxRedemptions !== void 0 ? t("billing.admin.coupons.places.limited", {
|
|
@@ -4836,21 +4837,21 @@ function CouponDetails() {
|
|
|
4836
4837
|
}
|
|
4837
4838
|
),
|
|
4838
4839
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4839
|
-
|
|
4840
|
+
_chunk2WK35GO2js.DetailField,
|
|
4840
4841
|
{
|
|
4841
4842
|
label: t("billing.admin.coupons.fields.products"),
|
|
4842
4843
|
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")
|
|
4843
4844
|
}
|
|
4844
4845
|
),
|
|
4845
4846
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4846
|
-
|
|
4847
|
+
_chunk2WK35GO2js.DetailField,
|
|
4847
4848
|
{
|
|
4848
4849
|
label: t("billing.admin.coupons.fields.redeemBy"),
|
|
4849
|
-
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: coupon.redeemBy ?
|
|
4850
|
+
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: coupon.redeemBy ? _chunk2WK35GO2js.formatDate.call(void 0, coupon.redeemBy, fmt) : "\u2014" })
|
|
4850
4851
|
}
|
|
4851
4852
|
),
|
|
4852
4853
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4853
|
-
|
|
4854
|
+
_chunk2WK35GO2js.DetailField,
|
|
4854
4855
|
{
|
|
4855
4856
|
label: t("billing.admin.coupons.fields.stripeId"),
|
|
4856
4857
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: coupon.stripeCouponId })
|
|
@@ -4885,15 +4886,15 @@ function CouponCodeEditorInternal({
|
|
|
4885
4886
|
}) {
|
|
4886
4887
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4887
4888
|
const router = _chunk5TH2DSAHjs.useI18nRouter.call(void 0, );
|
|
4888
|
-
const { createCode } =
|
|
4889
|
-
const formSchema2 = _react.useMemo.call(void 0, () => _zod3.z.object({ id: _zod3.z.uuidv4() }).and(
|
|
4890
|
-
const getDefaultValues = _react.useCallback.call(void 0, () => ({ id: _uuid.v4.call(void 0, ), ...
|
|
4889
|
+
const { createCode } = _chunk2WK35GO2js.useCouponContext.call(void 0, );
|
|
4890
|
+
const formSchema2 = _react.useMemo.call(void 0, () => _zod3.z.object({ id: _zod3.z.uuidv4() }).and(_chunk2WK35GO2js.couponCodeSchema.call(void 0, t)), [t]);
|
|
4891
|
+
const getDefaultValues = _react.useCallback.call(void 0, () => ({ id: _uuid.v4.call(void 0, ), ..._chunk2WK35GO2js.couponCodeDefaults.call(void 0, ) }), []);
|
|
4891
4892
|
const form = _reacthookform.useForm.call(void 0, {
|
|
4892
4893
|
resolver: _zod.zodResolver.call(void 0, formSchema2),
|
|
4893
4894
|
defaultValues: getDefaultValues()
|
|
4894
4895
|
});
|
|
4895
4896
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4896
|
-
|
|
4897
|
+
_chunk2WK35GO2js.EditorSheet,
|
|
4897
4898
|
{
|
|
4898
4899
|
form,
|
|
4899
4900
|
entityType: t("billing.admin.coupons.codes.entity"),
|
|
@@ -4903,14 +4904,14 @@ function CouponCodeEditorInternal({
|
|
|
4903
4904
|
onSuccess: _nullishCoalesce(onSuccess, () => ( (() => {
|
|
4904
4905
|
}))),
|
|
4905
4906
|
onNavigate: (url) => router.push(url),
|
|
4906
|
-
onSubmit: async (values) => await createCode({ id: values.id, couponId, ...
|
|
4907
|
+
onSubmit: async (values) => await createCode({ id: values.id, couponId, ..._chunk2WK35GO2js.toCouponCodeInput.call(void 0, values) }),
|
|
4907
4908
|
onReset: getDefaultValues,
|
|
4908
4909
|
trigger,
|
|
4909
4910
|
forceShow,
|
|
4910
4911
|
onClose,
|
|
4911
4912
|
dialogOpen,
|
|
4912
4913
|
onDialogOpenChange,
|
|
4913
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4914
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.CouponCodeFields, { form })
|
|
4914
4915
|
}
|
|
4915
4916
|
);
|
|
4916
4917
|
}
|
|
@@ -4924,8 +4925,8 @@ _chunk7QVYU63Ejs.__name.call(void 0, CouponCodeEditor, "CouponCodeEditor");
|
|
|
4924
4925
|
|
|
4925
4926
|
function CouponCodesList({ couponId }) {
|
|
4926
4927
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4927
|
-
const { catalogueVersion } =
|
|
4928
|
-
const data =
|
|
4928
|
+
const { catalogueVersion } = _chunk2WK35GO2js.useCouponContext.call(void 0, );
|
|
4929
|
+
const data = _chunk2WK35GO2js.useDataListRetriever.call(void 0, {
|
|
4929
4930
|
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunk5TH2DSAHjs.StripeCouponCodeService.listByCoupon({ ...params, couponId }), "retriever"),
|
|
4930
4931
|
retrieverParams: {},
|
|
4931
4932
|
module: _chunk5TH2DSAHjs.Modules.StripeCouponCode
|
|
@@ -4935,7 +4936,7 @@ function CouponCodesList({ couponId }) {
|
|
|
4935
4936
|
}, [catalogueVersion]);
|
|
4936
4937
|
const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, CouponCodeEditor, { couponId }, "create-code")];
|
|
4937
4938
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4938
|
-
|
|
4939
|
+
_chunk2WK35GO2js.ContentListTable,
|
|
4939
4940
|
{
|
|
4940
4941
|
data,
|
|
4941
4942
|
fields: [
|
|
@@ -4950,7 +4951,7 @@ function CouponCodesList({ couponId }) {
|
|
|
4950
4951
|
functions,
|
|
4951
4952
|
title: t("billing.admin.coupons.codes.title"),
|
|
4952
4953
|
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4953
|
-
|
|
4954
|
+
_chunk2WK35GO2js.EmptyState,
|
|
4954
4955
|
{
|
|
4955
4956
|
icon: _lucidereact.TicketIcon,
|
|
4956
4957
|
title: t("billing.admin.coupons.codes.empty.title"),
|
|
@@ -4966,12 +4967,12 @@ _chunk7QVYU63Ejs.__name.call(void 0, CouponCodesList, "CouponCodesList");
|
|
|
4966
4967
|
|
|
4967
4968
|
function CouponContainer() {
|
|
4968
4969
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4969
|
-
const { coupon } =
|
|
4970
|
+
const { coupon } = _chunk2WK35GO2js.useCouponContext.call(void 0, );
|
|
4970
4971
|
if (!coupon) return null;
|
|
4971
4972
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4972
|
-
|
|
4973
|
+
_chunk2WK35GO2js.RoundPageContainer,
|
|
4973
4974
|
{
|
|
4974
|
-
module:
|
|
4975
|
+
module: _chunk2WK35GO2js.couponPageModule.call(void 0, ),
|
|
4975
4976
|
id: coupon.id,
|
|
4976
4977
|
tabs: [
|
|
4977
4978
|
{
|
|
@@ -5078,5 +5079,5 @@ _chunk7QVYU63Ejs.__name.call(void 0, CouponContainer, "CouponContainer");
|
|
|
5078
5079
|
|
|
5079
5080
|
|
|
5080
5081
|
|
|
5081
|
-
exports.BillingAlertBanner = BillingAlertBanner; exports.BillingDashboardContainer = BillingDashboardContainer; exports.BillingDetailModal = BillingDetailModal; exports.BillingUsageSummaryCard = BillingUsageSummaryCard; exports.CancelSubscriptionDialog = CancelSubscriptionDialog; exports.CouponCodeActions =
|
|
5082
|
+
exports.BillingAlertBanner = BillingAlertBanner; exports.BillingDashboardContainer = BillingDashboardContainer; exports.BillingDetailModal = BillingDetailModal; exports.BillingUsageSummaryCard = BillingUsageSummaryCard; exports.CancelSubscriptionDialog = CancelSubscriptionDialog; exports.CouponCodeActions = _chunk2WK35GO2js.CouponCodeActions; exports.CouponCodeEditor = CouponCodeEditor; exports.CouponCodeFields = _chunk2WK35GO2js.CouponCodeFields; exports.CouponCodesList = CouponCodesList; exports.CouponContainer = CouponContainer; exports.CouponDetails = CouponDetails; exports.CouponEditor = _chunk2WK35GO2js.CouponEditor; exports.CouponProvider = _chunk2WK35GO2js.CouponProvider; exports.CouponRefresher = _chunk2WK35GO2js.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 = _chunk2WK35GO2js.applyDiscount; exports.couponCodeDefaults = _chunk2WK35GO2js.couponCodeDefaults; exports.couponCodeSchema = _chunk2WK35GO2js.couponCodeSchema; exports.couponCurrencyOptions = _chunk2WK35GO2js.couponCurrencyOptions; exports.formatCurrency = _chunk5TH2DSAHjs.formatCurrency; exports.formatDate = _chunk2WK35GO2js.formatDate; exports.formatFixed = _chunk5TH2DSAHjs.formatFixed; exports.formatInterval = _chunk5TH2DSAHjs.formatInterval; exports.isStripeConfigured = isStripeConfigured; exports.optionalDate = _chunk2WK35GO2js.optionalDate; exports.optionalDecimal = _chunk2WK35GO2js.optionalDecimal; exports.optionalPositiveInt = _chunk2WK35GO2js.optionalPositiveInt; exports.parseOptionalDecimal = _chunk2WK35GO2js.parseOptionalDecimal; exports.parseOptionalPositiveInt = _chunk2WK35GO2js.parseOptionalPositiveInt; exports.priceLabel = priceLabel; exports.promotionCodeDiscount = _chunk2WK35GO2js.promotionCodeDiscount; exports.subscriptionDiscount = _chunk2WK35GO2js.subscriptionDiscount; exports.toCouponCodeInput = _chunk2WK35GO2js.toCouponCodeInput; exports.useBillingFormatOptions = _chunk2WK35GO2js.useBillingFormatOptions; exports.useCouponContext = _chunk2WK35GO2js.useCouponContext; exports.usePriceContext = usePriceContext; exports.useProductContext = useProductContext;
|
|
5082
5083
|
//# sourceMappingURL=index.js.map
|