@carlonicora/nextjs-jsonapi 6.16.0 → 6.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{BlockNoteEditor-GWDYMS6R.js → BlockNoteEditor-HHTAZKRO.js} +9 -9
- package/dist/{BlockNoteEditor-GWDYMS6R.js.map → BlockNoteEditor-HHTAZKRO.js.map} +1 -1
- package/dist/{BlockNoteEditor-HNP5UAJT.mjs → BlockNoteEditor-KSOVYIOL.mjs} +2 -2
- package/dist/billing/index.js +378 -378
- package/dist/billing/index.mjs +1 -1
- package/dist/{chunk-UGDYZW4K.js → chunk-B6WMZXRY.js} +24 -5
- package/dist/chunk-B6WMZXRY.js.map +1 -0
- package/dist/{chunk-YEZGASBX.mjs → chunk-MBLF236G.mjs} +24 -5
- package/dist/chunk-MBLF236G.mjs.map +1 -0
- package/dist/client/index.js +2 -2
- package/dist/client/index.mjs +1 -1
- package/dist/components/index.d.mts +13 -2
- package/dist/components/index.d.ts +13 -2
- package/dist/components/index.js +2 -2
- package/dist/components/index.mjs +1 -1
- package/dist/contexts/index.js +2 -2
- package/dist/contexts/index.mjs +1 -1
- package/dist/email-automations/index.js +78 -78
- package/dist/email-automations/index.mjs +1 -1
- package/dist/features/analytics/index.js +96 -96
- package/dist/features/analytics/index.mjs +1 -1
- package/dist/features/blog/index.js +93 -93
- package/dist/features/blog/index.mjs +1 -1
- package/dist/features/help/index.js +31 -31
- package/dist/features/help/index.mjs +1 -1
- package/dist/features/tokenusage/index.js +102 -102
- package/dist/features/tokenusage/index.mjs +1 -1
- package/package.json +1 -1
- package/src/components/forms/EditorSheet.tsx +21 -1
- package/src/components/forms/__tests__/EditorSheet.spec.tsx +40 -1
- package/src/features/notification/components/notifications/PushNotificationProvider.tsx +14 -2
- package/src/features/notification/components/notifications/__tests__/PushNotificationProvider.spec.tsx +11 -0
- package/dist/chunk-UGDYZW4K.js.map +0 -1
- package/dist/chunk-YEZGASBX.mjs.map +0 -1
- /package/dist/{BlockNoteEditor-HNP5UAJT.mjs.map → BlockNoteEditor-KSOVYIOL.mjs.map} +0 -0
package/dist/billing/index.js
CHANGED
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
|
|
82
82
|
|
|
83
83
|
|
|
84
|
-
var
|
|
84
|
+
var _chunkB6WMZXRYjs = require('../chunk-B6WMZXRY.js');
|
|
85
85
|
require('../chunk-3EPNHTMH.js');
|
|
86
86
|
|
|
87
87
|
|
|
@@ -164,43 +164,43 @@ function SubscriptionSummaryCard({
|
|
|
164
164
|
onManageClick
|
|
165
165
|
}) {
|
|
166
166
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
167
|
-
const fmt =
|
|
167
|
+
const fmt = _chunkB6WMZXRYjs.useBillingFormatOptions.call(void 0, );
|
|
168
168
|
if (loading) {
|
|
169
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
170
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
171
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
169
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.Card, { children: [
|
|
170
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
171
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.CardTitle, { children: t("billing.ui.subscriptions.title") }),
|
|
172
172
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
173
173
|
] }),
|
|
174
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
175
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
176
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
177
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
174
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.CardContent, { children: [
|
|
175
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
176
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Skeleton, { className: "h-4 w-24 mb-1" }),
|
|
177
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Skeleton, { className: "h-4 w-40" })
|
|
178
178
|
] })
|
|
179
179
|
] });
|
|
180
180
|
}
|
|
181
181
|
if (error) {
|
|
182
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
183
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
184
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
182
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.Card, { children: [
|
|
183
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
184
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.CardTitle, { children: t("billing.ui.subscriptions.title") }),
|
|
185
185
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
186
186
|
] }),
|
|
187
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
187
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
188
188
|
] });
|
|
189
189
|
}
|
|
190
190
|
const activeSubscriptions = subscriptions.filter(
|
|
191
191
|
(sub) => sub.status === "active" /* ACTIVE */ || sub.status === "trialing" /* TRIALING */ || sub.status === "past_due" /* PAST_DUE */
|
|
192
192
|
);
|
|
193
193
|
const primarySubscription = activeSubscriptions[0];
|
|
194
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
195
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
196
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
194
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
|
|
195
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
196
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.CardTitle, { children: t("billing.ui.subscriptions.title") }),
|
|
197
197
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
198
198
|
] }),
|
|
199
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
199
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.CardContent, { children: !primarySubscription ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
200
200
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: t("billing.ui.cards.subscriptions.empty_title") }),
|
|
201
201
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.subscriptions.empty_description") }),
|
|
202
202
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
203
|
-
|
|
203
|
+
_chunkB6WMZXRYjs.Button,
|
|
204
204
|
{
|
|
205
205
|
variant: "outline",
|
|
206
206
|
size: "sm",
|
|
@@ -218,8 +218,8 @@ function SubscriptionSummaryCard({
|
|
|
218
218
|
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
219
219
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
220
220
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: formatPlanName(primarySubscription, t("billing.ui.cards.subscriptions.fallback_name")) }),
|
|
221
|
-
primarySubscription.status === "past_due" /* PAST_DUE */ ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
222
|
-
|
|
221
|
+
primarySubscription.status === "past_due" /* PAST_DUE */ ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Badge, { variant: "softRed", children: t("billing.ui.cards.subscriptions.payment_failing") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
222
|
+
_chunkB6WMZXRYjs.Badge,
|
|
223
223
|
{
|
|
224
224
|
variant: primarySubscription.cancelAtPeriodEnd ? "secondary" : getStatusBadgeVariant(primarySubscription.status),
|
|
225
225
|
children: primarySubscription.cancelAtPeriodEnd ? t("billing.ui.cards.subscriptions.canceling") : SUBSCRIPTION_STATUSES.includes(primarySubscription.status) ? t(`billing.ui.subscription_status.${primarySubscription.status}`) : primarySubscription.status
|
|
@@ -227,11 +227,11 @@ function SubscriptionSummaryCard({
|
|
|
227
227
|
)
|
|
228
228
|
] }),
|
|
229
229
|
/* @__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", {
|
|
230
|
-
date:
|
|
230
|
+
date: _chunkB6WMZXRYjs.formatDate.call(void 0, primarySubscription.currentPeriodEnd, fmt)
|
|
231
231
|
}) : primarySubscription.cancelAtPeriodEnd ? t("billing.ui.cards.subscriptions.cancels_on", {
|
|
232
|
-
date:
|
|
232
|
+
date: _chunkB6WMZXRYjs.formatDate.call(void 0, primarySubscription.currentPeriodEnd, fmt)
|
|
233
233
|
}) : t("billing.ui.cards.subscriptions.renews_on", {
|
|
234
|
-
date:
|
|
234
|
+
date: _chunkB6WMZXRYjs.formatDate.call(void 0, primarySubscription.currentPeriodEnd, fmt)
|
|
235
235
|
}) }),
|
|
236
236
|
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 }) })
|
|
237
237
|
] }) })
|
|
@@ -265,37 +265,37 @@ function PaymentMethodSummaryCard({
|
|
|
265
265
|
}) {
|
|
266
266
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
267
267
|
if (loading) {
|
|
268
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
269
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
270
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
268
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.Card, { children: [
|
|
269
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
270
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.CardTitle, { children: t("billing.ui.payment_method.title") }),
|
|
271
271
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
272
272
|
] }),
|
|
273
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
274
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
275
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
273
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.CardContent, { children: [
|
|
274
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
275
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Skeleton, { className: "h-4 w-24" })
|
|
276
276
|
] })
|
|
277
277
|
] });
|
|
278
278
|
}
|
|
279
279
|
if (error) {
|
|
280
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
281
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
282
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
280
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.Card, { children: [
|
|
281
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
282
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.CardTitle, { children: t("billing.ui.payment_method.title") }),
|
|
283
283
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
284
284
|
] }),
|
|
285
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
285
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
286
286
|
] });
|
|
287
287
|
}
|
|
288
288
|
const defaultMethod = paymentMethods.find((pm) => pm.id === defaultPaymentMethodId) || paymentMethods[0];
|
|
289
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
290
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
291
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
289
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
|
|
290
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
291
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.CardTitle, { children: t("billing.ui.payment_method.title") }),
|
|
292
292
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
293
293
|
] }),
|
|
294
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
294
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.CardContent, { children: paymentMethods.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
295
295
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: t("billing.ui.cards.payment_method.empty_title") }),
|
|
296
296
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.payment_method.empty_description") }),
|
|
297
297
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
298
|
-
|
|
298
|
+
_chunkB6WMZXRYjs.Button,
|
|
299
299
|
{
|
|
300
300
|
variant: "outline",
|
|
301
301
|
size: "sm",
|
|
@@ -359,45 +359,45 @@ function CustomerInfoCard({ customer, loading, error }) {
|
|
|
359
359
|
}
|
|
360
360
|
}, "handlePortalClick");
|
|
361
361
|
if (loading) {
|
|
362
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
363
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
364
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
362
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.Card, { children: [
|
|
363
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
364
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.CardTitle, { children: t("billing.ui.cards.customer.title") }),
|
|
365
365
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
366
366
|
] }),
|
|
367
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
368
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
369
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
370
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
367
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.CardContent, { children: [
|
|
368
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
369
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Skeleton, { className: "h-4 w-48 mb-1" }),
|
|
370
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Skeleton, { className: "h-4 w-24" })
|
|
371
371
|
] })
|
|
372
372
|
] });
|
|
373
373
|
}
|
|
374
374
|
if (error) {
|
|
375
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
376
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
377
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
375
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.Card, { children: [
|
|
376
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
377
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.CardTitle, { children: t("billing.ui.cards.customer.title") }),
|
|
378
378
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
379
379
|
] }),
|
|
380
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
380
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
381
381
|
] });
|
|
382
382
|
}
|
|
383
383
|
if (!customer) {
|
|
384
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
385
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
386
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
384
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.Card, { children: [
|
|
385
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
386
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.CardTitle, { children: t("billing.ui.cards.customer.title") }),
|
|
387
387
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
388
388
|
] }),
|
|
389
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
389
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.CardContent, { children: [
|
|
390
390
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: t("billing.ui.cards.customer.not_set_up") }),
|
|
391
391
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.customer.not_set_up_description") })
|
|
392
392
|
] })
|
|
393
393
|
] });
|
|
394
394
|
}
|
|
395
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
396
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
397
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
395
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.Card, { children: [
|
|
396
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
397
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.CardTitle, { children: t("billing.ui.cards.customer.title") }),
|
|
398
398
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
399
399
|
] }),
|
|
400
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
400
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
401
401
|
customer.name && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: customer.name }),
|
|
402
402
|
customer.email && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: customer.email }),
|
|
403
403
|
customer.balance !== void 0 && customer.balance !== 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm", children: [
|
|
@@ -407,7 +407,7 @@ function CustomerInfoCard({ customer, loading, error }) {
|
|
|
407
407
|
] }),
|
|
408
408
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: customer.balance < 0 ? "text-success" : "text-destructive", children: formatBalance(customer.balance, customer.currency, locale) })
|
|
409
409
|
] }),
|
|
410
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
410
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.Button, { variant: "outline", size: "sm", className: "mt-2", onClick: handlePortalClick, disabled: portalLoading, children: [
|
|
411
411
|
portalLoading ? t("common.loading") : t("billing.ui.cards.customer.manage_portal"),
|
|
412
412
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ExternalLink, { className: "h-4 w-4 ms-1" })
|
|
413
413
|
] })
|
|
@@ -445,46 +445,46 @@ function formatAmount(amount, currency, locale) {
|
|
|
445
445
|
_chunk7QVYU63Ejs.__name.call(void 0, formatAmount, "formatAmount");
|
|
446
446
|
function InvoicesSummaryCard({ invoices, loading, error, onViewAllClick }) {
|
|
447
447
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
448
|
-
const fmt =
|
|
448
|
+
const fmt = _chunkB6WMZXRYjs.useBillingFormatOptions.call(void 0, );
|
|
449
449
|
if (loading) {
|
|
450
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
451
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
452
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
450
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.Card, { children: [
|
|
451
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
452
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.CardTitle, { children: t("billing.ui.cards.invoices.title") }),
|
|
453
453
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
454
454
|
] }),
|
|
455
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
456
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
457
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
458
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
455
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.CardContent, { children: [
|
|
456
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Skeleton, { className: "h-6 w-24 mb-2" }),
|
|
457
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Skeleton, { className: "h-4 w-32 mb-1" }),
|
|
458
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Skeleton, { className: "h-4 w-20" })
|
|
459
459
|
] })
|
|
460
460
|
] });
|
|
461
461
|
}
|
|
462
462
|
if (error) {
|
|
463
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
464
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
465
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
463
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.Card, { children: [
|
|
464
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
465
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.CardTitle, { children: t("billing.ui.cards.invoices.title") }),
|
|
466
466
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
467
467
|
] }),
|
|
468
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
468
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
469
469
|
] });
|
|
470
470
|
}
|
|
471
471
|
const latestInvoice = _nullishCoalesce(invoices.find((inv) => inv.status !== "void" /* VOID */), () => ( invoices[0]));
|
|
472
472
|
const paidInvoices = invoices.filter((inv) => inv.status === "paid" /* PAID */);
|
|
473
473
|
const openInvoices = invoices.filter((inv) => inv.status === "open" /* OPEN */);
|
|
474
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
475
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
476
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
474
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewAllClick, children: [
|
|
475
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
476
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.CardTitle, { children: t("billing.ui.cards.invoices.title") }),
|
|
477
477
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
478
478
|
] }),
|
|
479
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
479
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.CardContent, { children: invoices.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
480
480
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: t("billing.ui.invoices.empty_title") }),
|
|
481
481
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.invoices.empty_description") })
|
|
482
482
|
] }) : latestInvoice ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
483
483
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
484
484
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: formatAmount(latestInvoice.total, latestInvoice.currency, fmt.locale) }),
|
|
485
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
485
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Badge, { variant: getStatusBadgeVariant2(latestInvoice.status), children: INVOICE_STATUSES.includes(latestInvoice.status) ? t(`billing.ui.invoice_status.${latestInvoice.status}`) : latestInvoice.status })
|
|
486
486
|
] }),
|
|
487
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: latestInvoice.stripeInvoiceNumber || t("billing.ui.cards.invoices.invoice_from", { date:
|
|
487
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: latestInvoice.stripeInvoiceNumber || t("billing.ui.cards.invoices.invoice_from", { date: _chunkB6WMZXRYjs.formatDate.call(void 0, latestInvoice.periodStart, fmt) }) }),
|
|
488
488
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-4 text-xs text-muted-foreground", children: [
|
|
489
489
|
paidInvoices.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: t("billing.ui.cards.invoices.paid_count", { count: paidInvoices.length }) }),
|
|
490
490
|
openInvoices.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-warning", children: t("billing.ui.cards.invoices.open_count", { count: openInvoices.length }) }),
|
|
@@ -519,24 +519,24 @@ function BillingUsageSummaryCard({
|
|
|
519
519
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
520
520
|
const locale = _chunkA7Y5YW7Qjs.useI18nLocale.call(void 0, );
|
|
521
521
|
if (loading) {
|
|
522
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
523
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
524
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
522
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.Card, { children: [
|
|
523
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
524
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.CardTitle, { children: t("billing.ui.cards.usage.title") }),
|
|
525
525
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
526
526
|
] }),
|
|
527
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
528
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
529
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
527
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.CardContent, { children: [
|
|
528
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Skeleton, { className: "h-6 w-24 mb-2" }),
|
|
529
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Skeleton, { className: "h-4 w-32" })
|
|
530
530
|
] })
|
|
531
531
|
] });
|
|
532
532
|
}
|
|
533
533
|
if (error) {
|
|
534
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
535
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
536
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
534
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.Card, { children: [
|
|
535
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
536
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.CardTitle, { children: t("billing.ui.cards.usage.title") }),
|
|
537
537
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
538
538
|
] }),
|
|
539
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
539
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
540
540
|
] });
|
|
541
541
|
}
|
|
542
542
|
const totalUsage = Object.values(summaries).reduce((acc, summary) => {
|
|
@@ -544,12 +544,12 @@ function BillingUsageSummaryCard({
|
|
|
544
544
|
}, 0);
|
|
545
545
|
const primaryMeter = meters.find((m) => _optionalChain([summaries, 'access', _17 => _17[m.id], 'optionalAccess', _18 => _18.aggregatedValue]));
|
|
546
546
|
const primarySummary = primaryMeter ? summaries[primaryMeter.id] : null;
|
|
547
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
548
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
549
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
547
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewDetailsClick, children: [
|
|
548
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
549
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.CardTitle, { children: t("billing.ui.cards.usage.title") }),
|
|
550
550
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
551
551
|
] }),
|
|
552
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
552
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.CardContent, { children: meters.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
553
553
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: t("billing.ui.cards.usage.no_meters") }),
|
|
554
554
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.usage.no_meters_description") })
|
|
555
555
|
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
@@ -660,7 +660,7 @@ function PaymentMethodForm({
|
|
|
660
660
|
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") }) });
|
|
661
661
|
}
|
|
662
662
|
if (!setupIntent && error) {
|
|
663
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
663
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.AlertDescription, { children: error }) });
|
|
664
664
|
}
|
|
665
665
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: handleSubmit, className: "flex flex-col gap-y-4", children: [
|
|
666
666
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rounded-md border border-gray-300 p-3", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -684,19 +684,19 @@ function PaymentMethodForm({
|
|
|
684
684
|
) }),
|
|
685
685
|
!alwaysSetDefault && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
686
686
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
687
|
-
|
|
687
|
+
_chunkB6WMZXRYjs.Checkbox,
|
|
688
688
|
{
|
|
689
689
|
id: "setAsDefault",
|
|
690
690
|
checked: setAsDefault,
|
|
691
691
|
onCheckedChange: (checked) => setSetAsDefault(!!checked)
|
|
692
692
|
}
|
|
693
693
|
),
|
|
694
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
694
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Label, { htmlFor: "setAsDefault", className: "cursor-pointer font-normal", children: t("billing.ui.payment_form.set_default") })
|
|
695
695
|
] }),
|
|
696
|
-
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
696
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.AlertDescription, { children: error }) }),
|
|
697
697
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-x-2", children: [
|
|
698
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
699
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
698
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Button, { type: "button", variant: "outline", onClick: onCancel, disabled: isSubmitting || isLoading, children: t("ui.buttons.cancel") }),
|
|
699
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Button, { type: "submit", disabled: !stripe || isSubmitting || isLoading, children: isSubmitting ? t("billing.ui.wizard.review.processing") : t("billing.ui.cards.payment_method.add_card") })
|
|
700
700
|
] })
|
|
701
701
|
] });
|
|
702
702
|
}
|
|
@@ -713,10 +713,10 @@ function PaymentMethodEditor({ open, onOpenChange, onSuccess }) {
|
|
|
713
713
|
const handleCancel = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
714
714
|
onOpenChange(false);
|
|
715
715
|
}, "handleCancel");
|
|
716
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
717
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
718
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
719
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
716
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.DialogContent, { className: "max-w-md", children: [
|
|
717
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.DialogHeader, { children: [
|
|
718
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.DialogTitle, { children: t("billing.ui.payment_methods.add") }),
|
|
719
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.DialogDescription, { children: t("billing.ui.payment_methods.add_description") })
|
|
720
720
|
] }),
|
|
721
721
|
open && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodForm, { onSuccess: handleSuccess, onCancel: handleCancel })
|
|
722
722
|
] }) });
|
|
@@ -779,16 +779,16 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
779
779
|
}
|
|
780
780
|
}, "handleRemove");
|
|
781
781
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
782
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
783
|
-
isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
784
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
782
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.Card, { className: "relative", children: [
|
|
783
|
+
isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Badge, { variant: "softGreen", className: "absolute end-2 top-2", children: t("billing.ui.payment_methods.default") }),
|
|
784
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.CardHeader, { className: "flex flex-row items-center justify-between pb-2", children: [
|
|
785
785
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
786
786
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-2xl", children: brandIcon }),
|
|
787
787
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium capitalize", children: brand })
|
|
788
788
|
] }),
|
|
789
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
790
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
791
|
-
|
|
789
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.DropdownMenu, { children: [
|
|
790
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.DropdownMenuTrigger, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
791
|
+
_chunkB6WMZXRYjs.Button,
|
|
792
792
|
{
|
|
793
793
|
render: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {}),
|
|
794
794
|
nativeButton: false,
|
|
@@ -799,10 +799,10 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
799
799
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.MoreVertical, { className: "h-4 w-4" })
|
|
800
800
|
}
|
|
801
801
|
) }),
|
|
802
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
803
|
-
!isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
802
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.DropdownMenuContent, { align: "end", children: [
|
|
803
|
+
!isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.DropdownMenuItem, { onClick: handleSetDefault, disabled: loading, children: t("billing.ui.payment_methods.set_default") }),
|
|
804
804
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
805
|
-
|
|
805
|
+
_chunkB6WMZXRYjs.DropdownMenuItem,
|
|
806
806
|
{
|
|
807
807
|
onClick: () => setShowRemoveDialog(true),
|
|
808
808
|
disabled: loading,
|
|
@@ -813,7 +813,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
813
813
|
] })
|
|
814
814
|
] })
|
|
815
815
|
] }),
|
|
816
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
816
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-1", children: [
|
|
817
817
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-lg font-semibold", children: [
|
|
818
818
|
"\u2022\u2022\u2022\u2022 ",
|
|
819
819
|
last4
|
|
@@ -821,17 +821,17 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
821
821
|
/* @__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}` }) })
|
|
822
822
|
] }) })
|
|
823
823
|
] }),
|
|
824
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
825
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
826
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
827
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
824
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.AlertDialog, { open: showRemoveDialog, onOpenChange: setShowRemoveDialog, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.AlertDialogContent, { children: [
|
|
825
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.AlertDialogHeader, { children: [
|
|
826
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.AlertDialogTitle, { children: t("billing.ui.payment_methods.remove_title") }),
|
|
827
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.AlertDialogDescription, { children: [
|
|
828
828
|
t("billing.ui.payment_methods.remove_description"),
|
|
829
829
|
isDefault && ` ${t("billing.ui.payment_methods.remove_default_warning")}`
|
|
830
830
|
] })
|
|
831
831
|
] }),
|
|
832
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
833
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
834
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
832
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.AlertDialogFooter, { children: [
|
|
833
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.AlertDialogCancel, { disabled: loading, children: t("ui.buttons.cancel") }),
|
|
834
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.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") })
|
|
835
835
|
] })
|
|
836
836
|
] }) })
|
|
837
837
|
] });
|
|
@@ -875,14 +875,14 @@ function PaymentMethodsContainer() {
|
|
|
875
875
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8" }),
|
|
876
876
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: t("billing.ui.payment_methods.title") })
|
|
877
877
|
] }),
|
|
878
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
878
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Button, { onClick: () => setShowAddPaymentMethod(true), children: t("billing.ui.payment_methods.add") })
|
|
879
879
|
] }),
|
|
880
880
|
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: [
|
|
881
881
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-16 w-16 text-muted-foreground" }),
|
|
882
882
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
883
883
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "mb-2 text-sm font-medium", children: t("billing.ui.payment_methods.empty_title") }),
|
|
884
884
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mb-4 text-muted-foreground", children: t("billing.ui.payment_methods.empty_description") }),
|
|
885
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
885
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Button, { onClick: () => setShowAddPaymentMethod(true), children: t("billing.ui.payment_methods.add_first") })
|
|
886
886
|
] })
|
|
887
887
|
] }),
|
|
888
888
|
paymentMethods.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodsList, { paymentMethods, onUpdate: loadPaymentMethods }),
|
|
@@ -938,7 +938,7 @@ var statusConfig = {
|
|
|
938
938
|
function InvoiceStatusBadge({ status }) {
|
|
939
939
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
940
940
|
const config = statusConfig[status] || statusConfig["draft" /* DRAFT */];
|
|
941
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
941
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Badge, { variant: config.variant, children: t(config.label) });
|
|
942
942
|
}
|
|
943
943
|
_chunk7QVYU63Ejs.__name.call(void 0, InvoiceStatusBadge, "InvoiceStatusBadge");
|
|
944
944
|
|
|
@@ -951,7 +951,7 @@ function InvoiceDetails({
|
|
|
951
951
|
onInvoiceChange: _onInvoiceChange
|
|
952
952
|
}) {
|
|
953
953
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
954
|
-
const fmt =
|
|
954
|
+
const fmt = _chunkB6WMZXRYjs.useBillingFormatOptions.call(void 0, );
|
|
955
955
|
const handleDownloadPDF = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
956
956
|
if (invoice.stripePdfUrl) {
|
|
957
957
|
window.open(invoice.stripePdfUrl, "_blank");
|
|
@@ -971,10 +971,10 @@ function InvoiceDetails({
|
|
|
971
971
|
return invoice.stripeInvoiceId.slice(-8);
|
|
972
972
|
}, "getInvoiceNumber");
|
|
973
973
|
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");
|
|
974
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
975
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
976
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
977
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
974
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.DialogContent, { className: "max-w-2xl", children: [
|
|
975
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.DialogHeader, { children: [
|
|
976
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.DialogTitle, { children: t("billing.ui.invoice.title", { number: getInvoiceNumber() }) }),
|
|
977
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.DialogDescription, { children: _chunkB6WMZXRYjs.formatDate.call(void 0, invoice.periodStart, fmt) })
|
|
978
978
|
] }),
|
|
979
979
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
980
980
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
@@ -985,18 +985,18 @@ function InvoiceDetails({
|
|
|
985
985
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
986
986
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.billing_period") }),
|
|
987
987
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm", children: [
|
|
988
|
-
|
|
988
|
+
_chunkB6WMZXRYjs.formatDate.call(void 0, invoice.periodStart, fmt),
|
|
989
989
|
" - ",
|
|
990
|
-
|
|
990
|
+
_chunkB6WMZXRYjs.formatDate.call(void 0, invoice.periodEnd, fmt)
|
|
991
991
|
] })
|
|
992
992
|
] }),
|
|
993
993
|
invoice.dueDate && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
994
994
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.due_date") }),
|
|
995
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm", children:
|
|
995
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm", children: _chunkB6WMZXRYjs.formatDate.call(void 0, invoice.dueDate, fmt) })
|
|
996
996
|
] }),
|
|
997
997
|
invoice.paidAt && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
998
998
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.paid_date") }),
|
|
999
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm", children:
|
|
999
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm", children: _chunkB6WMZXRYjs.formatDate.call(void 0, invoice.paidAt, fmt) })
|
|
1000
1000
|
] }),
|
|
1001
1001
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
1002
1002
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.attempt_count") }),
|
|
@@ -1039,15 +1039,15 @@ function InvoiceDetails({
|
|
|
1039
1039
|
] })
|
|
1040
1040
|
] }),
|
|
1041
1041
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2 pt-4 border-t", children: [
|
|
1042
|
-
invoice.stripePdfUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1042
|
+
invoice.stripePdfUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.Button, { variant: "outline", onClick: handleDownloadPDF, children: [
|
|
1043
1043
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Download, { className: "me-2 h-4 w-4" }),
|
|
1044
1044
|
t("billing.ui.invoice.download_pdf")
|
|
1045
1045
|
] }),
|
|
1046
|
-
invoice.status === "open" /* OPEN */ && invoice.attempted && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1046
|
+
invoice.status === "open" /* OPEN */ && invoice.attempted && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.Button, { variant: "default", onClick: handleRetryPayment, children: [
|
|
1047
1047
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RefreshCw, { className: "me-2 h-4 w-4" }),
|
|
1048
1048
|
t("billing.ui.invoice.retry_payment")
|
|
1049
1049
|
] }),
|
|
1050
|
-
invoice.stripeHostedInvoiceUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1050
|
+
invoice.stripeHostedInvoiceUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.Button, { variant: "outline", onClick: handleViewInStripe, children: [
|
|
1051
1051
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ExternalLink, { className: "me-2 h-4 w-4" }),
|
|
1052
1052
|
t("billing.ui.invoice.view_in_stripe")
|
|
1053
1053
|
] })
|
|
@@ -1061,7 +1061,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, InvoiceDetails, "InvoiceDetails");
|
|
|
1061
1061
|
|
|
1062
1062
|
function InvoicesList({ invoices, onInvoicesChange }) {
|
|
1063
1063
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1064
|
-
const fmt =
|
|
1064
|
+
const fmt = _chunkB6WMZXRYjs.useBillingFormatOptions.call(void 0, );
|
|
1065
1065
|
const [selectedInvoice, setSelectedInvoice] = _react.useState.call(void 0, null);
|
|
1066
1066
|
const handleRowClick = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (invoice) => {
|
|
1067
1067
|
setSelectedInvoice(invoice);
|
|
@@ -1073,30 +1073,30 @@ function InvoicesList({ invoices, onInvoicesChange }) {
|
|
|
1073
1073
|
return invoice.stripeInvoiceId.slice(-8);
|
|
1074
1074
|
}, "getInvoiceNumber");
|
|
1075
1075
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1076
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1077
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1078
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1079
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1080
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1081
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1082
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1076
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.Table, { children: [
|
|
1077
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.TableRow, { children: [
|
|
1078
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.TableHead, { children: t("billing.ui.columns.invoice_number") }),
|
|
1079
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.TableHead, { children: t("billing.ui.columns.date") }),
|
|
1080
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.TableHead, { children: t("billing.ui.columns.status") }),
|
|
1081
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.TableHead, { className: "text-end", children: t("billing.ui.columns.amount") }),
|
|
1082
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.TableHead, { children: t("billing.ui.columns.period") })
|
|
1083
1083
|
] }) }),
|
|
1084
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1084
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.TableBody, { children: invoices.map((invoice) => {
|
|
1085
1085
|
const invoiceNumber = getInvoiceNumber(invoice);
|
|
1086
|
-
const date =
|
|
1086
|
+
const date = _chunkB6WMZXRYjs.formatDate.call(void 0, invoice.periodStart, fmt);
|
|
1087
1087
|
const amount = _chunkOO2DBP6Ljs.formatCurrency.call(void 0, invoice.total, invoice.currency, fmt);
|
|
1088
|
-
const period = `${
|
|
1088
|
+
const period = `${_chunkB6WMZXRYjs.formatDate.call(void 0, invoice.periodStart, fmt)} - ${_chunkB6WMZXRYjs.formatDate.call(void 0, invoice.periodEnd, fmt)}`;
|
|
1089
1089
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1090
|
-
|
|
1090
|
+
_chunkB6WMZXRYjs.TableRow,
|
|
1091
1091
|
{
|
|
1092
1092
|
onClick: () => handleRowClick(invoice),
|
|
1093
1093
|
className: "cursor-pointer hover:bg-muted/50",
|
|
1094
1094
|
children: [
|
|
1095
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1096
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1097
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1098
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1099
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1095
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.TableCell, { className: "font-medium", children: invoiceNumber }),
|
|
1096
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.TableCell, { className: "text-muted-foreground text-xs", children: date }),
|
|
1097
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InvoiceStatusBadge, { status: invoice.status }) }),
|
|
1098
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.TableCell, { className: "text-end font-medium", children: amount }),
|
|
1099
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.TableCell, { className: "text-muted-foreground text-xs", children: period })
|
|
1100
1100
|
]
|
|
1101
1101
|
},
|
|
1102
1102
|
invoice.id
|
|
@@ -1146,12 +1146,12 @@ function InvoicesContainer() {
|
|
|
1146
1146
|
setStatusFilter(value);
|
|
1147
1147
|
}, "handleFilterChange");
|
|
1148
1148
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-4", children: [
|
|
1149
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1150
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1151
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1152
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1153
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1154
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1149
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Tabs, { value: statusFilter, onValueChange: handleFilterChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.TabsList, { children: [
|
|
1150
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.TabsTrigger, { value: "all", children: t("billing.ui.invoices.filter_all") }),
|
|
1151
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.TabsTrigger, { value: "paid" /* PAID */, children: t("billing.ui.invoice_status.paid") }),
|
|
1152
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.TabsTrigger, { value: "open" /* OPEN */, children: t("billing.ui.invoice_status.open") }),
|
|
1153
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.TabsTrigger, { value: "void" /* VOID */, children: t("billing.ui.invoice_status.void") }),
|
|
1154
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.TabsTrigger, { value: "uncollectible" /* UNCOLLECTIBLE */, children: t("billing.ui.invoice_status.uncollectible") })
|
|
1155
1155
|
] }) }),
|
|
1156
1156
|
loading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-center py-8 text-muted-foreground", children: t("billing.ui.invoices.loading") }),
|
|
1157
1157
|
!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: [
|
|
@@ -1193,7 +1193,7 @@ function CancelSubscriptionDialog({
|
|
|
1193
1193
|
onSuccess
|
|
1194
1194
|
}) {
|
|
1195
1195
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1196
|
-
const fmt =
|
|
1196
|
+
const fmt = _chunkB6WMZXRYjs.useBillingFormatOptions.call(void 0, );
|
|
1197
1197
|
const [isSubmitting, setIsSubmitting] = _react.useState.call(void 0, false);
|
|
1198
1198
|
const form = _reacthookform.useForm.call(void 0, {
|
|
1199
1199
|
resolver: _zod.zodResolver.call(void 0, formSchema),
|
|
@@ -1216,16 +1216,16 @@ function CancelSubscriptionDialog({
|
|
|
1216
1216
|
setIsSubmitting(false);
|
|
1217
1217
|
}
|
|
1218
1218
|
}, "onSubmit");
|
|
1219
|
-
const periodEndDate =
|
|
1220
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1221
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1222
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1223
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1219
|
+
const periodEndDate = _chunkB6WMZXRYjs.formatDate.call(void 0, subscription.currentPeriodEnd, fmt);
|
|
1220
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.DialogContent, { className: "max-w-md", children: [
|
|
1221
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.DialogHeader, { children: [
|
|
1222
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.DialogTitle, { children: t("billing.ui.subscription.cancel.title") }),
|
|
1223
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.DialogDescription, { children: t("billing.ui.subscription.cancel.description") })
|
|
1224
1224
|
] }),
|
|
1225
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1225
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-col gap-y-4", children: [
|
|
1226
1226
|
/* @__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 }) }),
|
|
1227
1227
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1228
|
-
|
|
1228
|
+
_chunkB6WMZXRYjs.FormTextarea,
|
|
1229
1229
|
{
|
|
1230
1230
|
form,
|
|
1231
1231
|
id: "reason",
|
|
@@ -1235,8 +1235,8 @@ function CancelSubscriptionDialog({
|
|
|
1235
1235
|
}
|
|
1236
1236
|
),
|
|
1237
1237
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-x-2 justify-end pt-2", children: [
|
|
1238
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1239
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1238
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Button, { type: "button", variant: "outline", onClick: () => onOpenChange(false), disabled: isSubmitting, children: t("billing.ui.subscription.cancel.keep") }),
|
|
1239
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Button, { type: "submit", variant: "destructive", disabled: isSubmitting, children: isSubmitting ? t("billing.ui.subscription.cancel.canceling") : t("billing.ui.subscription.cancel.confirm") })
|
|
1240
1240
|
] })
|
|
1241
1241
|
] }) })
|
|
1242
1242
|
] }) });
|
|
@@ -1287,7 +1287,7 @@ var cancelingConfig = {
|
|
|
1287
1287
|
function SubscriptionStatusBadge({ status, cancelAtPeriodEnd }) {
|
|
1288
1288
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1289
1289
|
const config = cancelAtPeriodEnd ? cancelingConfig : statusConfig2[status] || statusConfig2["canceled" /* CANCELED */];
|
|
1290
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1290
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Badge, { variant: config.variant, children: t(config.label) });
|
|
1291
1291
|
}
|
|
1292
1292
|
_chunk7QVYU63Ejs.__name.call(void 0, SubscriptionStatusBadge, "SubscriptionStatusBadge");
|
|
1293
1293
|
|
|
@@ -1326,7 +1326,7 @@ function SubscriptionDetails({
|
|
|
1326
1326
|
renderCancelDialog
|
|
1327
1327
|
}) {
|
|
1328
1328
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1329
|
-
const fmt =
|
|
1329
|
+
const fmt = _chunkB6WMZXRYjs.useBillingFormatOptions.call(void 0, );
|
|
1330
1330
|
const [showCancel, setShowCancel] = _react.useState.call(void 0, false);
|
|
1331
1331
|
const handleManageViaPortal = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1332
1332
|
try {
|
|
@@ -1338,10 +1338,10 @@ function SubscriptionDetails({
|
|
|
1338
1338
|
}, "handleManageViaPortal");
|
|
1339
1339
|
const canCancel = subscription.status === "active" /* ACTIVE */ || subscription.status === "trialing" /* TRIALING */ || subscription.status === "paused" /* PAUSED */;
|
|
1340
1340
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1341
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1342
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1343
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1344
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1341
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.DialogContent, { className: "max-w-2xl", children: [
|
|
1342
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.DialogHeader, { children: [
|
|
1343
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.DialogTitle, { children: t("billing.ui.subscription.details_title") }),
|
|
1344
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.DialogDescription, { children: t("billing.ui.subscription.details_description") })
|
|
1345
1345
|
] }),
|
|
1346
1346
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
1347
1347
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
@@ -1367,22 +1367,22 @@ function SubscriptionDetails({
|
|
|
1367
1367
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "space-y-2", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1368
1368
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.subscription.current_period") }),
|
|
1369
1369
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "text-sm", children: [
|
|
1370
|
-
|
|
1370
|
+
_chunkB6WMZXRYjs.formatDate.call(void 0, subscription.currentPeriodStart, fmt),
|
|
1371
1371
|
" - ",
|
|
1372
|
-
|
|
1372
|
+
_chunkB6WMZXRYjs.formatDate.call(void 0, subscription.currentPeriodEnd, fmt)
|
|
1373
1373
|
] })
|
|
1374
1374
|
] }) }),
|
|
1375
1375
|
subscription.trialEnd && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1376
1376
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.subscription.trial_ends") }),
|
|
1377
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children:
|
|
1377
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children: _chunkB6WMZXRYjs.formatDate.call(void 0, subscription.trialEnd, fmt) })
|
|
1378
1378
|
] }),
|
|
1379
1379
|
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", {
|
|
1380
|
-
date:
|
|
1380
|
+
date: _chunkB6WMZXRYjs.formatDate.call(void 0, subscription.currentPeriodEnd, fmt)
|
|
1381
1381
|
}) }) }),
|
|
1382
1382
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2 pt-4 border-t", children: [
|
|
1383
|
-
onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1384
|
-
canCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1385
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1383
|
+
onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Button, { variant: "default", onClick: () => onChangePlan(subscription), children: t("billing.ui.subscription.change_plan") }),
|
|
1384
|
+
canCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Button, { variant: "destructive", onClick: () => setShowCancel(true), children: t("ui.buttons.cancel") }),
|
|
1385
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Button, { variant: "outline", onClick: handleManageViaPortal, children: t("billing.ui.subscription.manage_portal") })
|
|
1386
1386
|
] })
|
|
1387
1387
|
] })
|
|
1388
1388
|
] }) }),
|
|
@@ -1442,46 +1442,46 @@ function SubscriptionsList({
|
|
|
1442
1442
|
renderCancelDialog
|
|
1443
1443
|
}) {
|
|
1444
1444
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1445
|
-
const fmt =
|
|
1445
|
+
const fmt = _chunkB6WMZXRYjs.useBillingFormatOptions.call(void 0, );
|
|
1446
1446
|
const [selectedSub, setSelectedSub] = _react.useState.call(void 0, null);
|
|
1447
1447
|
const handleRowClick = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (subscription) => {
|
|
1448
1448
|
setSelectedSub(subscription);
|
|
1449
1449
|
}, "handleRowClick");
|
|
1450
1450
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1451
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1452
|
-
/* @__PURE__ */ _jsxruntime.jsx.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,
|
|
1451
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.Table, { children: [
|
|
1452
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.TableRow, { children: [
|
|
1453
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.TableHead, { children: t("billing.ui.columns.status") }),
|
|
1454
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.TableHead, { children: t("billing.ui.columns.plan") }),
|
|
1455
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.TableHead, { children: t("billing.ui.columns.period") }),
|
|
1456
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.TableHead, { className: "text-end", children: t("billing.ui.columns.amount") }),
|
|
1457
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.TableHead, { className: "text-end", children: t("billing.ui.columns.actions") })
|
|
1458
1458
|
] }) }),
|
|
1459
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1459
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.TableBody, { children: subscriptions.map((subscription) => {
|
|
1460
1460
|
const price = subscription.price;
|
|
1461
1461
|
const amount = _optionalChain([price, 'optionalAccess', _42 => _42.unitAmount]) ? _chunkOO2DBP6Ljs.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt) : "0";
|
|
1462
|
-
const discountedAmount = price ?
|
|
1463
|
-
const period = `${
|
|
1462
|
+
const discountedAmount = price ? _chunkB6WMZXRYjs.applyDiscount.call(void 0, price.unitAmount, _chunkB6WMZXRYjs.subscriptionDiscount.call(void 0, subscription)) : null;
|
|
1463
|
+
const period = `${_chunkB6WMZXRYjs.formatDate.call(void 0, subscription.currentPeriodStart, fmt)} - ${_chunkB6WMZXRYjs.formatDate.call(void 0, subscription.currentPeriodEnd, fmt)}`;
|
|
1464
1464
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1465
|
-
|
|
1465
|
+
_chunkB6WMZXRYjs.TableRow,
|
|
1466
1466
|
{
|
|
1467
1467
|
onClick: () => handleRowClick(subscription),
|
|
1468
1468
|
className: "cursor-pointer hover:bg-muted/50",
|
|
1469
1469
|
children: [
|
|
1470
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1470
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1471
1471
|
SubscriptionStatusBadge,
|
|
1472
1472
|
{
|
|
1473
1473
|
status: subscription.status,
|
|
1474
1474
|
cancelAtPeriodEnd: subscription.cancelAtPeriodEnd
|
|
1475
1475
|
}
|
|
1476
1476
|
) }),
|
|
1477
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1478
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1479
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1477
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.TableCell, { className: "font-medium", children: formatPlanName3(price, t) }),
|
|
1478
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.TableCell, { className: "text-muted-foreground text-sm", children: period }),
|
|
1479
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.TableCell, { className: "text-end font-medium", children: discountedAmount !== null && price ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1480
1480
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "line-through text-muted-foreground me-2", children: amount }),
|
|
1481
1481
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success", children: _chunkOO2DBP6Ljs.formatCurrency.call(void 0, discountedAmount, price.currency, fmt) })
|
|
1482
1482
|
] }) : amount }),
|
|
1483
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1484
|
-
|
|
1483
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.TableCell, { className: "text-end", children: (subscription.status === "active" /* ACTIVE */ || subscription.status === "trialing" /* TRIALING */) && onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1484
|
+
_chunkB6WMZXRYjs.Button,
|
|
1485
1485
|
{
|
|
1486
1486
|
size: "sm",
|
|
1487
1487
|
variant: "outline",
|
|
@@ -1564,7 +1564,7 @@ function SubscriptionsContainer({
|
|
|
1564
1564
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8" }),
|
|
1565
1565
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: t("billing.ui.subscriptions.title") })
|
|
1566
1566
|
] }),
|
|
1567
|
-
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1567
|
+
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _44 => _44()]), children: hasActiveRecurringSubscription ? t("billing.ui.subscriptions.purchase_addons") : t("billing.ui.subscriptions.subscribe") })
|
|
1568
1568
|
] }),
|
|
1569
1569
|
criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BillingAlertBanner, { subscription }, subscription.id)),
|
|
1570
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: [
|
|
@@ -1572,7 +1572,7 @@ function SubscriptionsContainer({
|
|
|
1572
1572
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
1573
1573
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium mb-2", children: t("billing.ui.subscriptions.empty_title") }),
|
|
1574
1574
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground mb-6", children: t("billing.ui.subscriptions.empty_description") }),
|
|
1575
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1575
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _45 => _45()]), children: t("billing.ui.subscriptions.subscribe") })
|
|
1576
1576
|
] })
|
|
1577
1577
|
] }),
|
|
1578
1578
|
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -1596,9 +1596,9 @@ function IntervalToggle({ value, onChange, hasMonthly, hasYearly }) {
|
|
|
1596
1596
|
if (!hasMonthly || !hasYearly) {
|
|
1597
1597
|
return null;
|
|
1598
1598
|
}
|
|
1599
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1600
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1601
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1599
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Tabs, { value, onValueChange: (v) => onChange(v), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.TabsList, { children: [
|
|
1600
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.TabsTrigger, { value: "month", children: t("billing.admin.prices.interval.month") }),
|
|
1601
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.TabsTrigger, { value: "year", children: t("billing.admin.prices.interval.year") })
|
|
1602
1602
|
] }) });
|
|
1603
1603
|
}
|
|
1604
1604
|
_chunk7QVYU63Ejs.__name.call(void 0, IntervalToggle, "IntervalToggle");
|
|
@@ -1616,7 +1616,7 @@ function PricingCard({
|
|
|
1616
1616
|
onSelect
|
|
1617
1617
|
}) {
|
|
1618
1618
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1619
|
-
const fmt =
|
|
1619
|
+
const fmt = _chunkB6WMZXRYjs.useBillingFormatOptions.call(void 0, );
|
|
1620
1620
|
const description = price.description || price.nickname || t("billing.ui.pricing.standard");
|
|
1621
1621
|
const features = price.features || [];
|
|
1622
1622
|
const formattedPrice = _chunkOO2DBP6Ljs.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt);
|
|
@@ -1633,7 +1633,7 @@ function PricingCard({
|
|
|
1633
1633
|
}
|
|
1634
1634
|
}, "handleClick");
|
|
1635
1635
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1636
|
-
|
|
1636
|
+
_chunkB6WMZXRYjs.Card,
|
|
1637
1637
|
{
|
|
1638
1638
|
role: "radio",
|
|
1639
1639
|
"aria-checked": isSelected,
|
|
@@ -1651,9 +1651,9 @@ function PricingCard({
|
|
|
1651
1651
|
isLoading && "pointer-events-none"
|
|
1652
1652
|
),
|
|
1653
1653
|
children: [
|
|
1654
|
-
isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1655
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1656
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1654
|
+
isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Badge, { variant: "secondary", className: "absolute top-2 end-2", children: t("billing.ui.pricing.current") }),
|
|
1655
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.CardHeader, { className: "pb-2", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium", children: description }) }),
|
|
1656
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.CardContent, { className: "pb-4 grow", children: [
|
|
1657
1657
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mb-4", children: [
|
|
1658
1658
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-3xl font-bold", children: formattedPrice }),
|
|
1659
1659
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground ms-1", children: interval })
|
|
@@ -1663,8 +1663,8 @@ function PricingCard({
|
|
|
1663
1663
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-muted-foreground", children: feature })
|
|
1664
1664
|
] }, index)) })
|
|
1665
1665
|
] }),
|
|
1666
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1667
|
-
|
|
1666
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.CardFooter, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1667
|
+
_chunkB6WMZXRYjs.Button,
|
|
1668
1668
|
{
|
|
1669
1669
|
variant: isCurrentPlan ? "secondary" : isSelected ? "default" : "outline",
|
|
1670
1670
|
className: "w-full",
|
|
@@ -1697,7 +1697,7 @@ function ProductPricingRow({
|
|
|
1697
1697
|
return null;
|
|
1698
1698
|
}
|
|
1699
1699
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-3", children: [
|
|
1700
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1700
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.SectionHeader, { children: product.name }),
|
|
1701
1701
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1702
1702
|
"div",
|
|
1703
1703
|
{
|
|
@@ -1798,15 +1798,15 @@ function ProductPricingList({
|
|
|
1798
1798
|
_chunk7QVYU63Ejs.__name.call(void 0, ProductPricingList, "ProductPricingList");
|
|
1799
1799
|
function ProductPricingListSkeleton() {
|
|
1800
1800
|
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: [
|
|
1801
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1801
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Skeleton, { className: "h-6 w-32" }),
|
|
1802
1802
|
/* @__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: [
|
|
1803
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1804
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1803
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Skeleton, { className: "h-6 w-24" }),
|
|
1804
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Skeleton, { className: "h-8 w-32" }),
|
|
1805
1805
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
1806
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1807
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1806
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Skeleton, { className: "h-4 w-full" }),
|
|
1807
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Skeleton, { className: "h-4 w-3/4" })
|
|
1808
1808
|
] }),
|
|
1809
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1809
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Skeleton, { className: "h-10 w-full" })
|
|
1810
1810
|
] }, cardIndex)) })
|
|
1811
1811
|
] }, rowIndex)) });
|
|
1812
1812
|
}
|
|
@@ -1817,7 +1817,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductPricingListSkeleton, "ProductPricing
|
|
|
1817
1817
|
|
|
1818
1818
|
function ProrationPreview({ preview }) {
|
|
1819
1819
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1820
|
-
const fmt =
|
|
1820
|
+
const fmt = _chunkB6WMZXRYjs.useBillingFormatOptions.call(void 0, );
|
|
1821
1821
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-primary/10 border-primary/30 rounded-lg border p-4", children: [
|
|
1822
1822
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "text-primary mb-3 font-semibold", children: t("billing.ui.proration.title") }),
|
|
1823
1823
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
@@ -1843,7 +1843,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProrationPreview, "ProrationPreview");
|
|
|
1843
1843
|
|
|
1844
1844
|
function SubscriptionConfirmation({ price, isLoading, onConfirm, onCancel }) {
|
|
1845
1845
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1846
|
-
const fmt =
|
|
1846
|
+
const fmt = _chunkB6WMZXRYjs.useBillingFormatOptions.call(void 0, );
|
|
1847
1847
|
const productName = _optionalChain([price, 'access', _51 => _51.product, 'optionalAccess', _52 => _52.name]) || price.nickname || t("billing.ui.wizard.review.selected_plan");
|
|
1848
1848
|
const productDescription = _optionalChain([price, 'access', _53 => _53.product, 'optionalAccess', _54 => _54.description]) || price.description;
|
|
1849
1849
|
const features = price.features || [];
|
|
@@ -1863,8 +1863,8 @@ function SubscriptionConfirmation({ price, isLoading, onConfirm, onCancel }) {
|
|
|
1863
1863
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: feature })
|
|
1864
1864
|
] }, index)) }),
|
|
1865
1865
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-3 pt-2 border-t border-accent/30", children: [
|
|
1866
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1867
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1866
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Button, { variant: "outline", onClick: onCancel, disabled: isLoading, children: t("ui.buttons.cancel") }),
|
|
1867
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Button, { onClick: onConfirm, disabled: isLoading, children: isLoading ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1868
1868
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "h-4 w-4 animate-spin me-2" }),
|
|
1869
1869
|
t("billing.ui.wizard.review.processing")
|
|
1870
1870
|
] }) : t("billing.ui.confirmation.subscribe") })
|
|
@@ -2402,7 +2402,7 @@ function WizardStepPlanSelection({
|
|
|
2402
2402
|
onSelectPrice: handleSelectPrice
|
|
2403
2403
|
}
|
|
2404
2404
|
),
|
|
2405
|
-
/* @__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, _chunkB6WMZXRYjs.Button, { onClick: onNext, disabled: !selectedPrice || isProcessing, children: isProcessing ? t("common.loading") : t("billing.ui.wizard.next_review") }) })
|
|
2406
2406
|
] });
|
|
2407
2407
|
}
|
|
2408
2408
|
_chunk7QVYU63Ejs.__name.call(void 0, WizardStepPlanSelection, "WizardStepPlanSelection");
|
|
@@ -2472,7 +2472,7 @@ function PromoCodeInput({
|
|
|
2472
2472
|
const codeInput = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
2473
2473
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
|
|
2474
2474
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2475
|
-
|
|
2475
|
+
_chunkB6WMZXRYjs.Input,
|
|
2476
2476
|
{
|
|
2477
2477
|
placeholder: t("billing.ui.promo_code.placeholder"),
|
|
2478
2478
|
value: code,
|
|
@@ -2482,7 +2482,7 @@ function PromoCodeInput({
|
|
|
2482
2482
|
className: "flex-1"
|
|
2483
2483
|
}
|
|
2484
2484
|
),
|
|
2485
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2485
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.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") })
|
|
2486
2486
|
] }),
|
|
2487
2487
|
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error })
|
|
2488
2488
|
] });
|
|
@@ -2511,7 +2511,7 @@ function PromoCodeInput({
|
|
|
2511
2511
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success text-sm", children: formatDiscount(appliedCode) })
|
|
2512
2512
|
] }),
|
|
2513
2513
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2514
|
-
|
|
2514
|
+
_chunkB6WMZXRYjs.Button,
|
|
2515
2515
|
{
|
|
2516
2516
|
variant: "ghost",
|
|
2517
2517
|
size: "sm",
|
|
@@ -2559,7 +2559,7 @@ function WizardStepReview({
|
|
|
2559
2559
|
isTrialUpgrade
|
|
2560
2560
|
}) {
|
|
2561
2561
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2562
|
-
const fmt =
|
|
2562
|
+
const fmt = _chunkB6WMZXRYjs.useBillingFormatOptions.call(void 0, );
|
|
2563
2563
|
const [card, setCard] = _react.useState.call(void 0, null);
|
|
2564
2564
|
_react.useEffect.call(void 0, () => {
|
|
2565
2565
|
if (!hasPaymentMethod) {
|
|
@@ -2586,11 +2586,11 @@ function WizardStepReview({
|
|
|
2586
2586
|
const interval = _optionalChain([price, 'access', _93 => _93.recurring, 'optionalAccess', _94 => _94.interval]) || "month";
|
|
2587
2587
|
return interval === "year" ? t("billing.ui.wizard.review.interval_yearly") : t("billing.ui.wizard.review.interval_monthly");
|
|
2588
2588
|
}, "formatInterval");
|
|
2589
|
-
const codeDiscount =
|
|
2590
|
-
const carriedDiscount = isChangingPlan && !codeDiscount ?
|
|
2589
|
+
const codeDiscount = _chunkB6WMZXRYjs.promotionCodeDiscount.call(void 0, promotionCode);
|
|
2590
|
+
const carriedDiscount = isChangingPlan && !codeDiscount ? _chunkB6WMZXRYjs.subscriptionDiscount.call(void 0, subscription) : null;
|
|
2591
2591
|
const discount = _nullishCoalesce(codeDiscount, () => ( carriedDiscount));
|
|
2592
|
-
const discountedPrice =
|
|
2593
|
-
const discountedImmediateCharge =
|
|
2592
|
+
const discountedPrice = _chunkB6WMZXRYjs.applyDiscount.call(void 0, selectedPrice.unitAmount, discount);
|
|
2593
|
+
const discountedImmediateCharge = _chunkB6WMZXRYjs.applyDiscount.call(void 0, _optionalChain([prorationPreview, 'optionalAccess', _95 => _95.immediateCharge]), discount);
|
|
2594
2594
|
const isProrationCredit = !isTrialUpgrade && (_nullishCoalesce(_nullishCoalesce(discountedImmediateCharge, () => ( _optionalChain([prorationPreview, 'optionalAccess', _96 => _96.immediateCharge]))), () => ( 0))) < 0;
|
|
2595
2595
|
const prorationAmount = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (amount) => isProrationCredit ? Math.abs(amount) : amount, "prorationAmount");
|
|
2596
2596
|
const getDiscountDescription = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
@@ -2605,7 +2605,7 @@ function WizardStepReview({
|
|
|
2605
2605
|
const discountDescription = getDiscountDescription();
|
|
2606
2606
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
2607
2607
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-muted/50 rounded-lg p-4 space-y-3", children: [
|
|
2608
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2608
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.SectionHeader, { children: t("billing.ui.wizard.review.selected_plan") }),
|
|
2609
2609
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between items-center", children: [
|
|
2610
2610
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
2611
2611
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-medium", children: _optionalChain([selectedPrice, 'access', _97 => _97.product, 'optionalAccess', _98 => _98.name]) }),
|
|
@@ -2615,7 +2615,7 @@ function WizardStepReview({
|
|
|
2615
2615
|
discountedPrice !== null ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2616
2616
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground line-through", children: _chunkOO2DBP6Ljs.formatCurrency.call(void 0, selectedPrice.unitAmount || 0, selectedPrice.currency, fmt) }),
|
|
2617
2617
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-success text-lg font-semibold", children: _chunkOO2DBP6Ljs.formatCurrency.call(void 0, discountedPrice, selectedPrice.currency, fmt) }),
|
|
2618
|
-
discountDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2618
|
+
discountDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Badge, { variant: "softGreen", children: discountDescription }),
|
|
2619
2619
|
carriedDiscount && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: t("billing.ui.wizard.review.discount_carries_over") })
|
|
2620
2620
|
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-semibold text-lg", children: _chunkOO2DBP6Ljs.formatCurrency.call(void 0, selectedPrice.unitAmount || 0, selectedPrice.currency, fmt) }),
|
|
2621
2621
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: formatInterval2(selectedPrice) })
|
|
@@ -2658,15 +2658,15 @@ function WizardStepReview({
|
|
|
2658
2658
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "font-medium", children: t("billing.ui.payment_method.title") }),
|
|
2659
2659
|
/* @__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") })
|
|
2660
2660
|
] }),
|
|
2661
|
-
hasPaymentMethod ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2661
|
+
hasPaymentMethod ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Button, { variant: "outline", onClick: onAddPaymentMethod, disabled: isProcessing, children: t("billing.ui.wizard.review.use_another_card") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Button, { variant: "outline", onClick: onAddPaymentMethod, children: t("billing.ui.payment_methods.add") })
|
|
2662
2662
|
] }) }),
|
|
2663
|
-
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2663
|
+
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.Alert, { variant: "destructive", children: [
|
|
2664
2664
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.AlertCircle, { className: "h-4 w-4" }),
|
|
2665
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2665
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.AlertDescription, { children: error })
|
|
2666
2666
|
] }),
|
|
2667
2667
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between pt-4 border-t", children: [
|
|
2668
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2669
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2668
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Button, { variant: "outline", onClick: onBack, disabled: isProcessing, children: t("billing.ui.wizard.back") }),
|
|
2669
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.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") })
|
|
2670
2670
|
] })
|
|
2671
2671
|
] });
|
|
2672
2672
|
}
|
|
@@ -2679,7 +2679,7 @@ function WizardStepPaymentMethod({ onBack, onSuccess, isProcessing }) {
|
|
|
2679
2679
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2680
2680
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
2681
2681
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
2682
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2682
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.SectionHeader, { children: t("billing.ui.payment_methods.add") }),
|
|
2683
2683
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: t("billing.ui.wizard.payment_description") })
|
|
2684
2684
|
] }),
|
|
2685
2685
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodForm, { onSuccess, onCancel: onBack, isLoading: isProcessing, alwaysSetDefault: true })
|
|
@@ -2722,10 +2722,10 @@ function SubscriptionWizard({
|
|
|
2722
2722
|
const isChangePlanMode = !!subscription;
|
|
2723
2723
|
const dialogTitle = subscription ? t("billing.ui.wizard.change_title") : isPurchasingAddons ? t("billing.ui.subscriptions.purchase_addons") : t("billing.ui.subscriptions.subscribe");
|
|
2724
2724
|
const dialogDescription = subscription ? t("billing.ui.wizard.change_description") : isPurchasingAddons ? t("billing.ui.wizard.addons_description") : t("billing.ui.wizard.subscribe_description");
|
|
2725
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2726
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2727
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2728
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2725
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.DialogContent, { className: "max-w-2xl max-h-[90vh] overflow-y-auto", children: [
|
|
2726
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.DialogHeader, { children: [
|
|
2727
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.DialogTitle, { children: dialogTitle }),
|
|
2728
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.DialogDescription, { children: dialogDescription })
|
|
2729
2729
|
] }),
|
|
2730
2730
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, WizardProgressIndicator, { currentStep: state.step }),
|
|
2731
2731
|
state.step === "plan-selection" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -2804,7 +2804,7 @@ function formatDate2(date, { locale, t }) {
|
|
|
2804
2804
|
_chunk7QVYU63Ejs.__name.call(void 0, formatDate2, "formatDate");
|
|
2805
2805
|
function UsageSummaryCard({ meter, summary }) {
|
|
2806
2806
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2807
|
-
const fmt =
|
|
2807
|
+
const fmt = _chunkB6WMZXRYjs.useBillingFormatOptions.call(void 0, );
|
|
2808
2808
|
const currentUsage = _nullishCoalesce(_optionalChain([summary, 'optionalAccess', _101 => _101.aggregatedValue]), () => ( 0));
|
|
2809
2809
|
const limit = meter.limit;
|
|
2810
2810
|
const percentage = limit && limit > 0 ? currentUsage / limit * 100 : null;
|
|
@@ -2812,15 +2812,15 @@ function UsageSummaryCard({ meter, summary }) {
|
|
|
2812
2812
|
const progressWidth = percentage !== null ? Math.min(percentage, 100) : 0;
|
|
2813
2813
|
const displayName = meter.displayName || meter.eventName;
|
|
2814
2814
|
const hasLimit = limit !== null && limit !== void 0;
|
|
2815
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2816
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2815
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.Card, { children: [
|
|
2816
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.CardHeader, { className: "flex flex-row items-center gap-x-3 pb-3", children: [
|
|
2817
2817
|
/* @__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" }) }),
|
|
2818
2818
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col", children: [
|
|
2819
2819
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium", children: displayName }),
|
|
2820
2820
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-xs", children: meter.id })
|
|
2821
2821
|
] })
|
|
2822
2822
|
] }),
|
|
2823
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2823
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.CardContent, { className: "flex flex-col gap-y-4", children: [
|
|
2824
2824
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
2825
2825
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-3xl font-bold", children: currentUsage.toLocaleString(fmt.locale) }),
|
|
2826
2826
|
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) }) })
|
|
@@ -2939,27 +2939,27 @@ function formatDateTime(date, { locale, t }) {
|
|
|
2939
2939
|
_chunk7QVYU63Ejs.__name.call(void 0, formatDateTime, "formatDateTime");
|
|
2940
2940
|
function UsageHistoryTable({ usageRecords }) {
|
|
2941
2941
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2942
|
-
const fmt =
|
|
2942
|
+
const fmt = _chunkB6WMZXRYjs.useBillingFormatOptions.call(void 0, );
|
|
2943
2943
|
if (usageRecords.length === 0) {
|
|
2944
2944
|
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") }) });
|
|
2945
2945
|
}
|
|
2946
2946
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
2947
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2948
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-clip rounded-lg border", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2949
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2950
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2951
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2952
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2953
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2947
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.SectionHeader, { level: 2, children: t("billing.ui.usage.history_title") }),
|
|
2948
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-clip rounded-lg border", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.Table, { children: [
|
|
2949
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.TableRow, { children: [
|
|
2950
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.TableHead, { children: t("billing.ui.columns.date_time") }),
|
|
2951
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.TableHead, { children: t("billing.ui.columns.meter_event") }),
|
|
2952
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.TableHead, { className: "text-end", children: t("billing.ui.columns.quantity") }),
|
|
2953
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.TableHead, { children: t("billing.ui.columns.event_id") })
|
|
2954
2954
|
] }) }),
|
|
2955
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2955
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.TableBody, { children: usageRecords.map((record) => {
|
|
2956
2956
|
const dateTime = formatDateTime(record.timestamp, fmt);
|
|
2957
2957
|
const quantity = record.quantity.toLocaleString(fmt.locale);
|
|
2958
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2959
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2960
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2961
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2962
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2958
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.TableRow, { children: [
|
|
2959
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.TableCell, { className: "font-medium", children: dateTime }),
|
|
2960
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.TableCell, { className: "text-muted-foreground", children: record.meterEventName }),
|
|
2961
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.TableCell, { className: "text-end font-medium", children: quantity }),
|
|
2962
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.TableCell, { className: "text-muted-foreground text-sm tabular-nums", children: record.stripeEventId })
|
|
2963
2963
|
] }, record.id);
|
|
2964
2964
|
}) })
|
|
2965
2965
|
] }) })
|
|
@@ -2970,8 +2970,8 @@ _chunk7QVYU63Ejs.__name.call(void 0, UsageHistoryTable, "UsageHistoryTable");
|
|
|
2970
2970
|
// src/features/billing/components/modals/BillingDetailModal.tsx
|
|
2971
2971
|
|
|
2972
2972
|
function BillingDetailModal({ open, onOpenChange, title, children, className }) {
|
|
2973
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2974
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2973
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.DialogContent, { className: _nullishCoalesce(className, () => ( "max-w-4xl max-h-[90vh] overflow-y-auto")), children: [
|
|
2974
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.DialogHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.DialogTitle, { children: title }) }),
|
|
2975
2975
|
children
|
|
2976
2976
|
] }) });
|
|
2977
2977
|
}
|
|
@@ -2999,7 +2999,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
|
|
|
2999
2999
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-destructive text-sm font-medium", children: t("billing.ui.alert.payment_failed_title") }),
|
|
3000
3000
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive mt-1 text-sm", children: t("billing.ui.alert.payment_failed_description") })
|
|
3001
3001
|
] }),
|
|
3002
|
-
onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3002
|
+
onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Button, { variant: "outline", size: "sm", onClick: onUpdatePayment, className: "text-destructive border-red-300", children: t("billing.ui.alert.update_payment_method") })
|
|
3003
3003
|
] });
|
|
3004
3004
|
}
|
|
3005
3005
|
if (subscription.status === "trialing" /* TRIALING */ && subscription.trialEnd) {
|
|
@@ -3013,7 +3013,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
|
|
|
3013
3013
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-warning text-sm font-medium", children: t("billing.ui.alert.trial_ending_title") }),
|
|
3014
3014
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-warning mt-1 text-sm", children: t("billing.ui.alert.trial_ending_description", { count: daysRemaining }) })
|
|
3015
3015
|
] }),
|
|
3016
|
-
onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3016
|
+
onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Button, { variant: "outline", size: "sm", onClick: onAddPayment, className: "text-warning border-yellow-300", children: t("billing.ui.payment_methods.add") })
|
|
3017
3017
|
] });
|
|
3018
3018
|
}
|
|
3019
3019
|
}
|
|
@@ -3254,18 +3254,18 @@ function BillingDashboardContainer({ renderCancelDialog } = {}) {
|
|
|
3254
3254
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-8 w-8" }),
|
|
3255
3255
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: t("billing.title") })
|
|
3256
3256
|
] }),
|
|
3257
|
-
isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3258
|
-
noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3259
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3257
|
+
isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.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" }) }) }),
|
|
3258
|
+
noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.Card, { children: [
|
|
3259
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.CardHeader, { className: "text-center", children: [
|
|
3260
3260
|
/* @__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" }) }),
|
|
3261
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3262
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3261
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.CardTitle, { children: t("billing.ui.dashboard.setup_title") }),
|
|
3262
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.CardDescription, { children: t("billing.ui.dashboard.setup_description") })
|
|
3263
3263
|
] }),
|
|
3264
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3264
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.CardContent, { className: "flex justify-center pb-8", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Button, { onClick: handleCreateCustomer, disabled: creatingCustomer, size: "lg", children: creatingCustomer ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
3265
3265
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "me-2 h-4 w-4 animate-spin" }),
|
|
3266
3266
|
t("billing.ui.dashboard.setting_up")
|
|
3267
3267
|
] }) : t("billing.ui.dashboard.setup_button") }) }),
|
|
3268
|
-
errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3268
|
+
errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.CardContent, { className: "pt-0", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-center text-destructive text-xs/relaxed", children: t(errors.customer) }) })
|
|
3269
3269
|
] }),
|
|
3270
3270
|
!noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
3271
3271
|
criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -3435,18 +3435,18 @@ _chunk7QVYU63Ejs.__name.call(void 0, isStripeConfigured, "isStripeConfigured");
|
|
|
3435
3435
|
|
|
3436
3436
|
function PriceArchiver({ price }) {
|
|
3437
3437
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
3438
|
-
const fmt =
|
|
3438
|
+
const fmt = _chunkB6WMZXRYjs.useBillingFormatOptions.call(void 0, );
|
|
3439
3439
|
const { archivePrice, restorePrice } = usePriceContext();
|
|
3440
3440
|
const [open, setOpen] = _react.useState.call(void 0, false);
|
|
3441
3441
|
const isArchived = !price.active;
|
|
3442
3442
|
const scope = isArchived ? "restore" : "archive";
|
|
3443
3443
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
3444
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3444
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.Button, { variant: "outline", size: "sm", onClick: () => setOpen(true), children: [
|
|
3445
3445
|
isArchived ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RotateCcwIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ArchiveIcon, {}),
|
|
3446
3446
|
t(`billing.admin.prices.${scope}.confirm`)
|
|
3447
3447
|
] }),
|
|
3448
3448
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3449
|
-
|
|
3449
|
+
_chunkB6WMZXRYjs.ConfirmDialog,
|
|
3450
3450
|
{
|
|
3451
3451
|
open,
|
|
3452
3452
|
onOpenChange: setOpen,
|
|
@@ -3460,7 +3460,7 @@ function PriceArchiver({ price }) {
|
|
|
3460
3460
|
if (isArchived) await restorePrice(price.id);
|
|
3461
3461
|
else await archivePrice(price.id);
|
|
3462
3462
|
} catch (error) {
|
|
3463
|
-
|
|
3463
|
+
_chunkB6WMZXRYjs.errorToast.call(void 0, { title: t(`billing.admin.prices.${scope}.title`), error });
|
|
3464
3464
|
throw error;
|
|
3465
3465
|
}
|
|
3466
3466
|
}
|
|
@@ -3492,7 +3492,7 @@ function PriceEditorInternal({
|
|
|
3492
3492
|
onDialogOpenChange
|
|
3493
3493
|
}) {
|
|
3494
3494
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
3495
|
-
const fmt =
|
|
3495
|
+
const fmt = _chunkB6WMZXRYjs.useBillingFormatOptions.call(void 0, );
|
|
3496
3496
|
const router = _chunkA7Y5YW7Qjs.useI18nRouter.call(void 0, );
|
|
3497
3497
|
const { createPrice, updatePrice, productId: contextProductId } = usePriceContext();
|
|
3498
3498
|
const [allFeatures, setAllFeatures] = _react.useState.call(void 0, []);
|
|
@@ -3634,7 +3634,7 @@ function PriceEditorInternal({
|
|
|
3634
3634
|
{ id: "metered", text: t("billing.admin.prices.usage.metered") }
|
|
3635
3635
|
];
|
|
3636
3636
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3637
|
-
|
|
3637
|
+
_chunkB6WMZXRYjs.EditorSheet,
|
|
3638
3638
|
{
|
|
3639
3639
|
form,
|
|
3640
3640
|
entityType: t("billing.admin.prices.entity"),
|
|
@@ -3689,13 +3689,13 @@ function PriceEditorInternal({
|
|
|
3689
3689
|
dialogOpen,
|
|
3690
3690
|
onDialogOpenChange,
|
|
3691
3691
|
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
3692
|
-
isEdit && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3693
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3694
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3692
|
+
isEdit && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.Alert, { children: [
|
|
3693
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.AlertTitle, { children: t("billing.admin.prices.immutability.title") }),
|
|
3694
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.AlertDescription, { children: t("billing.admin.prices.immutability.description") })
|
|
3695
3695
|
] }),
|
|
3696
3696
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
|
|
3697
3697
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3698
|
-
|
|
3698
|
+
_chunkB6WMZXRYjs.FormInput,
|
|
3699
3699
|
{
|
|
3700
3700
|
form,
|
|
3701
3701
|
id: "unitAmount",
|
|
@@ -3707,7 +3707,7 @@ function PriceEditorInternal({
|
|
|
3707
3707
|
}
|
|
3708
3708
|
),
|
|
3709
3709
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3710
|
-
|
|
3710
|
+
_chunkB6WMZXRYjs.FormSelect,
|
|
3711
3711
|
{
|
|
3712
3712
|
form,
|
|
3713
3713
|
id: "currency",
|
|
@@ -3718,7 +3718,7 @@ function PriceEditorInternal({
|
|
|
3718
3718
|
)
|
|
3719
3719
|
] }),
|
|
3720
3720
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3721
|
-
|
|
3721
|
+
_chunkB6WMZXRYjs.FormSelect,
|
|
3722
3722
|
{
|
|
3723
3723
|
form,
|
|
3724
3724
|
id: "interval",
|
|
@@ -3729,7 +3729,7 @@ function PriceEditorInternal({
|
|
|
3729
3729
|
),
|
|
3730
3730
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
|
|
3731
3731
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3732
|
-
|
|
3732
|
+
_chunkB6WMZXRYjs.FormInput,
|
|
3733
3733
|
{
|
|
3734
3734
|
form,
|
|
3735
3735
|
id: "intervalCount",
|
|
@@ -3740,7 +3740,7 @@ function PriceEditorInternal({
|
|
|
3740
3740
|
}
|
|
3741
3741
|
),
|
|
3742
3742
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3743
|
-
|
|
3743
|
+
_chunkB6WMZXRYjs.FormSelect,
|
|
3744
3744
|
{
|
|
3745
3745
|
form,
|
|
3746
3746
|
id: "usageType",
|
|
@@ -3751,7 +3751,7 @@ function PriceEditorInternal({
|
|
|
3751
3751
|
)
|
|
3752
3752
|
] }),
|
|
3753
3753
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3754
|
-
|
|
3754
|
+
_chunkB6WMZXRYjs.FormInput,
|
|
3755
3755
|
{
|
|
3756
3756
|
form,
|
|
3757
3757
|
id: "nickname",
|
|
@@ -3760,7 +3760,7 @@ function PriceEditorInternal({
|
|
|
3760
3760
|
}
|
|
3761
3761
|
),
|
|
3762
3762
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3763
|
-
|
|
3763
|
+
_chunkB6WMZXRYjs.FormTextarea,
|
|
3764
3764
|
{
|
|
3765
3765
|
form,
|
|
3766
3766
|
id: "description",
|
|
@@ -3770,7 +3770,7 @@ function PriceEditorInternal({
|
|
|
3770
3770
|
}
|
|
3771
3771
|
),
|
|
3772
3772
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3773
|
-
|
|
3773
|
+
_chunkB6WMZXRYjs.FormInput,
|
|
3774
3774
|
{
|
|
3775
3775
|
form,
|
|
3776
3776
|
id: "token",
|
|
@@ -3780,10 +3780,10 @@ function PriceEditorInternal({
|
|
|
3780
3780
|
}
|
|
3781
3781
|
),
|
|
3782
3782
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-2", children: [
|
|
3783
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3783
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.FieldLabel, { children: t("billing.admin.prices.fields.features") }),
|
|
3784
3784
|
form.watch("features").map((_, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
|
|
3785
3785
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3786
|
-
|
|
3786
|
+
_chunkB6WMZXRYjs.Input,
|
|
3787
3787
|
{
|
|
3788
3788
|
...form.register(`features.${index}`),
|
|
3789
3789
|
placeholder: t("billing.admin.prices.placeholders.feature", { index: index + 1 }),
|
|
@@ -3791,7 +3791,7 @@ function PriceEditorInternal({
|
|
|
3791
3791
|
}
|
|
3792
3792
|
),
|
|
3793
3793
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3794
|
-
|
|
3794
|
+
_chunkB6WMZXRYjs.Button,
|
|
3795
3795
|
{
|
|
3796
3796
|
type: "button",
|
|
3797
3797
|
variant: "outline",
|
|
@@ -3806,7 +3806,7 @@ function PriceEditorInternal({
|
|
|
3806
3806
|
)
|
|
3807
3807
|
] }, index)),
|
|
3808
3808
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3809
|
-
|
|
3809
|
+
_chunkB6WMZXRYjs.Button,
|
|
3810
3810
|
{
|
|
3811
3811
|
type: "button",
|
|
3812
3812
|
variant: "outline",
|
|
@@ -3821,12 +3821,12 @@ function PriceEditorInternal({
|
|
|
3821
3821
|
)
|
|
3822
3822
|
] }),
|
|
3823
3823
|
isRecurring && allFeatures.length > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-2", children: [
|
|
3824
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3824
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.FieldLabel, { children: t("billing.admin.prices.fields.platformFeatures") }),
|
|
3825
3825
|
/* @__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) => {
|
|
3826
3826
|
const isChecked = form.watch("featureIds").includes(feature.id);
|
|
3827
3827
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
3828
3828
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3829
|
-
|
|
3829
|
+
_chunkB6WMZXRYjs.Checkbox,
|
|
3830
3830
|
{
|
|
3831
3831
|
id: `feature-${feature.id}`,
|
|
3832
3832
|
checked: isChecked,
|
|
@@ -3842,13 +3842,13 @@ function PriceEditorInternal({
|
|
|
3842
3842
|
}
|
|
3843
3843
|
}
|
|
3844
3844
|
),
|
|
3845
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3845
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.FieldLabel, { htmlFor: `feature-${feature.id}`, children: feature.name }),
|
|
3846
3846
|
feature.isCore && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.admin.prices.help.core") })
|
|
3847
3847
|
] }, feature.id);
|
|
3848
3848
|
}) })
|
|
3849
3849
|
] }),
|
|
3850
3850
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3851
|
-
|
|
3851
|
+
_chunkB6WMZXRYjs.FormCheckbox,
|
|
3852
3852
|
{
|
|
3853
3853
|
form,
|
|
3854
3854
|
id: "isTrial",
|
|
@@ -3901,9 +3901,9 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3901
3901
|
productId: productIdProp
|
|
3902
3902
|
}) => {
|
|
3903
3903
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
3904
|
-
const fmt =
|
|
3905
|
-
const generateUrl =
|
|
3906
|
-
const { hasRole } =
|
|
3904
|
+
const fmt = _chunkB6WMZXRYjs.useBillingFormatOptions.call(void 0, );
|
|
3905
|
+
const generateUrl = _chunkB6WMZXRYjs.usePageUrlGenerator.call(void 0, );
|
|
3906
|
+
const { hasRole } = _chunkB6WMZXRYjs.useCurrentUserContext.call(void 0, );
|
|
3907
3907
|
const [price, setPrice] = _react.useState.call(void 0,
|
|
3908
3908
|
dehydratedPrice ? _chunkOO2DBP6Ljs.rehydrate.call(void 0, _chunkA7Y5YW7Qjs.Modules.StripePrice, dehydratedPrice) : void 0
|
|
3909
3909
|
);
|
|
@@ -3991,7 +3991,7 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3991
3991
|
}
|
|
3992
3992
|
return response;
|
|
3993
3993
|
}, "title");
|
|
3994
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3994
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceContext.Provider, { value, children }) });
|
|
3995
3995
|
}, "PriceProvider");
|
|
3996
3996
|
var usePriceContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => _nullishCoalesce(_react.useContext.call(void 0, PriceContext), () => ( defaultContextValue)), "usePriceContext");
|
|
3997
3997
|
|
|
@@ -4011,12 +4011,12 @@ function ProductArchiver({ product }) {
|
|
|
4011
4011
|
const isArchived = !product.active;
|
|
4012
4012
|
const scope = isArchived ? "restore" : "archive";
|
|
4013
4013
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
4014
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
4014
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.Button, { variant: "outline", size: "sm", onClick: () => setOpen(true), children: [
|
|
4015
4015
|
isArchived ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RotateCcwIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ArchiveIcon, {}),
|
|
4016
4016
|
t(`billing.admin.products.${scope}.confirm`)
|
|
4017
4017
|
] }),
|
|
4018
4018
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4019
|
-
|
|
4019
|
+
_chunkB6WMZXRYjs.ConfirmDialog,
|
|
4020
4020
|
{
|
|
4021
4021
|
open,
|
|
4022
4022
|
onOpenChange: setOpen,
|
|
@@ -4030,7 +4030,7 @@ function ProductArchiver({ product }) {
|
|
|
4030
4030
|
if (isArchived) await restoreProduct(product.id);
|
|
4031
4031
|
else await archiveProduct(product.id);
|
|
4032
4032
|
} catch (error) {
|
|
4033
|
-
|
|
4033
|
+
_chunkB6WMZXRYjs.errorToast.call(void 0, { title: t(`billing.admin.products.${scope}.title`), error });
|
|
4034
4034
|
throw error;
|
|
4035
4035
|
}
|
|
4036
4036
|
}
|
|
@@ -4083,7 +4083,7 @@ function ProductEditorInternal({
|
|
|
4083
4083
|
defaultValues: getDefaultValues()
|
|
4084
4084
|
});
|
|
4085
4085
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4086
|
-
|
|
4086
|
+
_chunkB6WMZXRYjs.EditorSheet,
|
|
4087
4087
|
{
|
|
4088
4088
|
form,
|
|
4089
4089
|
entityType: t("billing.admin.products.entity"),
|
|
@@ -4106,7 +4106,7 @@ function ProductEditorInternal({
|
|
|
4106
4106
|
onDialogOpenChange,
|
|
4107
4107
|
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4108
4108
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4109
|
-
|
|
4109
|
+
_chunkB6WMZXRYjs.FormInput,
|
|
4110
4110
|
{
|
|
4111
4111
|
form,
|
|
4112
4112
|
id: "name",
|
|
@@ -4116,7 +4116,7 @@ function ProductEditorInternal({
|
|
|
4116
4116
|
}
|
|
4117
4117
|
),
|
|
4118
4118
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4119
|
-
|
|
4119
|
+
_chunkB6WMZXRYjs.FormTextarea,
|
|
4120
4120
|
{
|
|
4121
4121
|
form,
|
|
4122
4122
|
id: "description",
|
|
@@ -4160,8 +4160,8 @@ var defaultContextValue2 = {
|
|
|
4160
4160
|
};
|
|
4161
4161
|
var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ children, dehydratedProduct, publishChrome = true }) => {
|
|
4162
4162
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4163
|
-
const generateUrl =
|
|
4164
|
-
const { hasRole } =
|
|
4163
|
+
const generateUrl = _chunkB6WMZXRYjs.usePageUrlGenerator.call(void 0, );
|
|
4164
|
+
const { hasRole } = _chunkB6WMZXRYjs.useCurrentUserContext.call(void 0, );
|
|
4165
4165
|
const [product, setProduct] = _react.useState.call(void 0,
|
|
4166
4166
|
dehydratedProduct ? _chunkOO2DBP6Ljs.rehydrate.call(void 0, _chunkA7Y5YW7Qjs.Modules.StripeProduct, dehydratedProduct) : void 0
|
|
4167
4167
|
);
|
|
@@ -4255,7 +4255,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
4255
4255
|
}
|
|
4256
4256
|
return response;
|
|
4257
4257
|
}, "title");
|
|
4258
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4258
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductContext.Provider, { value, children }) });
|
|
4259
4259
|
}, "ProductProvider");
|
|
4260
4260
|
var useProductContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => _nullishCoalesce(_react.useContext.call(void 0, ProductContext), () => ( defaultContextValue2)), "useProductContext");
|
|
4261
4261
|
|
|
@@ -4264,57 +4264,57 @@ var useProductContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ()
|
|
|
4264
4264
|
|
|
4265
4265
|
function PriceDetails() {
|
|
4266
4266
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4267
|
-
const fmt =
|
|
4268
|
-
const generateUrl =
|
|
4267
|
+
const fmt = _chunkB6WMZXRYjs.useBillingFormatOptions.call(void 0, );
|
|
4268
|
+
const generateUrl = _chunkB6WMZXRYjs.usePageUrlGenerator.call(void 0, );
|
|
4269
4269
|
const { price } = usePriceContext();
|
|
4270
4270
|
if (!price) return null;
|
|
4271
4271
|
const isRecurring = price.priceType === "recurring";
|
|
4272
4272
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-8", children: [
|
|
4273
4273
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4274
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4274
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.SectionHeader, { children: t("billing.admin.prices.title") }),
|
|
4275
4275
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
4276
4276
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4277
|
-
|
|
4277
|
+
_chunkB6WMZXRYjs.DetailField,
|
|
4278
4278
|
{
|
|
4279
4279
|
label: t("billing.admin.prices.fields.product"),
|
|
4280
|
-
value: price.product ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4280
|
+
value: price.product ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Link, { href: generateUrl({ page: _chunkA7Y5YW7Qjs.Modules.StripeProduct, id: price.product.id }), children: price.product.name }) : "\u2014"
|
|
4281
4281
|
}
|
|
4282
4282
|
),
|
|
4283
4283
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4284
|
-
|
|
4284
|
+
_chunkB6WMZXRYjs.DetailField,
|
|
4285
4285
|
{
|
|
4286
4286
|
label: t("billing.admin.prices.fields.status"),
|
|
4287
4287
|
value: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex flex-wrap items-center gap-1", children: [
|
|
4288
|
-
price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4289
|
-
price.isTrial && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4288
|
+
price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Badge, { variant: "softGreen", children: t("billing.admin.prices.status.active") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Badge, { variant: "softGray", children: t("billing.admin.prices.status.archived") }),
|
|
4289
|
+
price.isTrial && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Badge, { variant: "softBlue", children: t("billing.admin.prices.badge.trial") })
|
|
4290
4290
|
] })
|
|
4291
4291
|
}
|
|
4292
4292
|
),
|
|
4293
4293
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4294
|
-
|
|
4294
|
+
_chunkB6WMZXRYjs.DetailField,
|
|
4295
4295
|
{
|
|
4296
4296
|
label: t("billing.admin.prices.fields.amount"),
|
|
4297
4297
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _chunkOO2DBP6Ljs.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt) })
|
|
4298
4298
|
}
|
|
4299
4299
|
),
|
|
4300
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4300
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.DetailField, { label: t("billing.admin.prices.fields.currency"), value: price.currency.toUpperCase() }),
|
|
4301
4301
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4302
|
-
|
|
4302
|
+
_chunkB6WMZXRYjs.DetailField,
|
|
4303
4303
|
{
|
|
4304
4304
|
label: t("billing.admin.prices.fields.type"),
|
|
4305
4305
|
value: isRecurring ? t("billing.admin.prices.type.recurring") : t("billing.admin.prices.type.oneTime")
|
|
4306
4306
|
}
|
|
4307
4307
|
),
|
|
4308
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4308
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.DetailField, { label: t("billing.admin.prices.fields.billing"), value: _chunkOO2DBP6Ljs.formatInterval.call(void 0, price, fmt) }),
|
|
4309
4309
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4310
|
-
|
|
4310
|
+
_chunkB6WMZXRYjs.DetailField,
|
|
4311
4311
|
{
|
|
4312
4312
|
label: t("billing.admin.prices.fields.intervalCount"),
|
|
4313
4313
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _nullishCoalesce(_optionalChain([price, 'access', _163 => _163.recurring, 'optionalAccess', _164 => _164.intervalCount]), () => ( 1)) })
|
|
4314
4314
|
}
|
|
4315
4315
|
),
|
|
4316
4316
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4317
|
-
|
|
4317
|
+
_chunkB6WMZXRYjs.DetailField,
|
|
4318
4318
|
{
|
|
4319
4319
|
label: t("billing.admin.prices.fields.usageType"),
|
|
4320
4320
|
value: _optionalChain([price, 'access', _165 => _165.recurring, 'optionalAccess', _166 => _166.usageType]) === "metered" ? t("billing.admin.prices.usage.metered") : t("billing.admin.prices.usage.licensed")
|
|
@@ -4323,24 +4323,24 @@ function PriceDetails() {
|
|
|
4323
4323
|
] })
|
|
4324
4324
|
] }),
|
|
4325
4325
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4326
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4326
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.SectionHeader, { children: t("billing.admin.prices.fields.platformFeatures") }),
|
|
4327
4327
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
4328
4328
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4329
|
-
|
|
4329
|
+
_chunkB6WMZXRYjs.DetailField,
|
|
4330
4330
|
{
|
|
4331
4331
|
label: t("billing.admin.prices.fields.token"),
|
|
4332
4332
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _nullishCoalesce(price.token, () => ( "\u2014")) })
|
|
4333
4333
|
}
|
|
4334
4334
|
),
|
|
4335
4335
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4336
|
-
|
|
4336
|
+
_chunkB6WMZXRYjs.DetailField,
|
|
4337
4337
|
{
|
|
4338
4338
|
label: t("billing.admin.prices.fields.stripeId"),
|
|
4339
4339
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: price.stripePriceId })
|
|
4340
4340
|
}
|
|
4341
4341
|
),
|
|
4342
4342
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4343
|
-
|
|
4343
|
+
_chunkB6WMZXRYjs.DetailField,
|
|
4344
4344
|
{
|
|
4345
4345
|
label: t("billing.admin.prices.fields.description"),
|
|
4346
4346
|
value: _nullishCoalesce(price.description, () => ( "\u2014")),
|
|
@@ -4348,7 +4348,7 @@ function PriceDetails() {
|
|
|
4348
4348
|
}
|
|
4349
4349
|
),
|
|
4350
4350
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4351
|
-
|
|
4351
|
+
_chunkB6WMZXRYjs.DetailField,
|
|
4352
4352
|
{
|
|
4353
4353
|
label: t("billing.admin.prices.fields.features"),
|
|
4354
4354
|
className: "md:col-span-2",
|
|
@@ -4356,11 +4356,11 @@ function PriceDetails() {
|
|
|
4356
4356
|
}
|
|
4357
4357
|
),
|
|
4358
4358
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4359
|
-
|
|
4359
|
+
_chunkB6WMZXRYjs.DetailField,
|
|
4360
4360
|
{
|
|
4361
4361
|
label: t("billing.admin.prices.fields.platformFeatures"),
|
|
4362
4362
|
className: "md:col-span-2",
|
|
4363
|
-
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,
|
|
4363
|
+
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, _chunkB6WMZXRYjs.Badge, { variant: "softGray", children: feature.name }, feature.id)) }) : "\u2014"
|
|
4364
4364
|
}
|
|
4365
4365
|
)
|
|
4366
4366
|
] })
|
|
@@ -4374,7 +4374,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, PriceDetails, "PriceDetails");
|
|
|
4374
4374
|
function PriceContainer() {
|
|
4375
4375
|
const { price } = usePriceContext();
|
|
4376
4376
|
if (!price) return null;
|
|
4377
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4377
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.RoundPageContainer, { module: _chunkA7Y5YW7Qjs.Modules.StripePrice, id: price.id, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceDetails, {}) });
|
|
4378
4378
|
}
|
|
4379
4379
|
_chunk7QVYU63Ejs.__name.call(void 0, PriceContainer, "PriceContainer");
|
|
4380
4380
|
|
|
@@ -4499,7 +4499,7 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4499
4499
|
const importInputRef = _react.useRef.call(void 0, null);
|
|
4500
4500
|
const [seed, setSeed] = _react.useState.call(void 0, void 0);
|
|
4501
4501
|
const [seedNonce, setSeedNonce] = _react.useState.call(void 0, 0);
|
|
4502
|
-
const data =
|
|
4502
|
+
const data = _chunkB6WMZXRYjs.useDataListRetriever.call(void 0, {
|
|
4503
4503
|
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunkOO2DBP6Ljs.StripePriceService.listPrices({ ...params, productId }), "retriever"),
|
|
4504
4504
|
retrieverParams: {},
|
|
4505
4505
|
module: _chunkA7Y5YW7Qjs.Modules.StripePrice
|
|
@@ -4537,7 +4537,7 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4537
4537
|
openSeededEditor(transfer.price);
|
|
4538
4538
|
} catch (error) {
|
|
4539
4539
|
console.error("[PricesList] price import failed", error);
|
|
4540
|
-
|
|
4540
|
+
_chunkB6WMZXRYjs.errorToast.call(void 0, {
|
|
4541
4541
|
title: t("billing.admin.prices.import.errors.title"),
|
|
4542
4542
|
error: t("billing.admin.prices.import.errors.invalid")
|
|
4543
4543
|
});
|
|
@@ -4556,7 +4556,7 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4556
4556
|
"create-price"
|
|
4557
4557
|
),
|
|
4558
4558
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _react.Fragment, { children: [
|
|
4559
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
4559
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkB6WMZXRYjs.Button, { variant: "outline", size: "sm", type: "button", onClick: () => _optionalChain([importInputRef, 'access', _181 => _181.current, 'optionalAccess', _182 => _182.click, 'call', _183 => _183()]), children: [
|
|
4560
4560
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.UploadIcon, {}),
|
|
4561
4561
|
t("billing.admin.prices.actions.import")
|
|
4562
4562
|
] }),
|
|
@@ -4574,7 +4574,7 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4574
4574
|
];
|
|
4575
4575
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
4576
4576
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4577
|
-
|
|
4577
|
+
_chunkB6WMZXRYjs.ContentListTable,
|
|
4578
4578
|
{
|
|
4579
4579
|
data,
|
|
4580
4580
|
fields: [
|
|
@@ -4591,7 +4591,7 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4591
4591
|
fullWidth,
|
|
4592
4592
|
title: t("billing.admin.prices.title"),
|
|
4593
4593
|
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4594
|
-
|
|
4594
|
+
_chunkB6WMZXRYjs.EmptyState,
|
|
4595
4595
|
{
|
|
4596
4596
|
icon: _lucidereact.DollarSignIcon,
|
|
4597
4597
|
title: t("billing.admin.prices.empty.title"),
|
|
@@ -4631,18 +4631,18 @@ function ProductDetails() {
|
|
|
4631
4631
|
const { product } = useProductContext();
|
|
4632
4632
|
if (!product) return null;
|
|
4633
4633
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4634
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4634
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.SectionHeader, { children: t("billing.admin.products.tabs.details") }),
|
|
4635
4635
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
4636
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4636
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.DetailField, { label: t("billing.admin.products.fields.name"), value: product.name }),
|
|
4637
4637
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4638
|
-
|
|
4638
|
+
_chunkB6WMZXRYjs.DetailField,
|
|
4639
4639
|
{
|
|
4640
4640
|
label: t("billing.admin.products.fields.status"),
|
|
4641
|
-
value: product.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4641
|
+
value: product.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Badge, { variant: "softGreen", children: t("billing.admin.products.status.active") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Badge, { variant: "softGray", children: t("billing.admin.products.status.archived") })
|
|
4642
4642
|
}
|
|
4643
4643
|
),
|
|
4644
4644
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4645
|
-
|
|
4645
|
+
_chunkB6WMZXRYjs.DetailField,
|
|
4646
4646
|
{
|
|
4647
4647
|
label: t("billing.admin.products.fields.description"),
|
|
4648
4648
|
value: _nullishCoalesce(product.description, () => ( "\u2014")),
|
|
@@ -4650,14 +4650,14 @@ function ProductDetails() {
|
|
|
4650
4650
|
}
|
|
4651
4651
|
),
|
|
4652
4652
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4653
|
-
|
|
4653
|
+
_chunkB6WMZXRYjs.DetailField,
|
|
4654
4654
|
{
|
|
4655
4655
|
label: t("billing.admin.products.fields.prices"),
|
|
4656
4656
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: product.stripePrices.length })
|
|
4657
4657
|
}
|
|
4658
4658
|
),
|
|
4659
4659
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4660
|
-
|
|
4660
|
+
_chunkB6WMZXRYjs.DetailField,
|
|
4661
4661
|
{
|
|
4662
4662
|
label: t("billing.admin.products.fields.stripeId"),
|
|
4663
4663
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: product.stripeProductId })
|
|
@@ -4675,7 +4675,7 @@ function ProductContainer() {
|
|
|
4675
4675
|
const { product } = useProductContext();
|
|
4676
4676
|
if (!product) return null;
|
|
4677
4677
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4678
|
-
|
|
4678
|
+
_chunkB6WMZXRYjs.RoundPageContainer,
|
|
4679
4679
|
{
|
|
4680
4680
|
module: _chunkA7Y5YW7Qjs.Modules.StripeProduct,
|
|
4681
4681
|
id: product.id,
|
|
@@ -4712,8 +4712,8 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductContainer, "ProductContainer");
|
|
|
4712
4712
|
|
|
4713
4713
|
function CouponsList({ fullWidth } = {}) {
|
|
4714
4714
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4715
|
-
const { catalogueVersion } =
|
|
4716
|
-
const data =
|
|
4715
|
+
const { catalogueVersion } = _chunkB6WMZXRYjs.useCouponContext.call(void 0, );
|
|
4716
|
+
const data = _chunkB6WMZXRYjs.useDataListRetriever.call(void 0, {
|
|
4717
4717
|
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunkOO2DBP6Ljs.StripeCouponService.listCoupons(params), "retriever"),
|
|
4718
4718
|
retrieverParams: {},
|
|
4719
4719
|
module: _chunkA7Y5YW7Qjs.Modules.StripeCoupon
|
|
@@ -4721,9 +4721,9 @@ function CouponsList({ fullWidth } = {}) {
|
|
|
4721
4721
|
_react.useEffect.call(void 0, () => {
|
|
4722
4722
|
if (catalogueVersion > 0) void data.refresh();
|
|
4723
4723
|
}, [catalogueVersion]);
|
|
4724
|
-
const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4724
|
+
const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.CouponEditor, {}, "create-coupon")];
|
|
4725
4725
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4726
|
-
|
|
4726
|
+
_chunkB6WMZXRYjs.ContentListTable,
|
|
4727
4727
|
{
|
|
4728
4728
|
data,
|
|
4729
4729
|
fields: [
|
|
@@ -4738,7 +4738,7 @@ function CouponsList({ fullWidth } = {}) {
|
|
|
4738
4738
|
fullWidth,
|
|
4739
4739
|
title: t("billing.admin.coupons.title"),
|
|
4740
4740
|
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4741
|
-
|
|
4741
|
+
_chunkB6WMZXRYjs.EmptyState,
|
|
4742
4742
|
{
|
|
4743
4743
|
icon: _lucidereact.TicketPercentIcon,
|
|
4744
4744
|
title: t("billing.admin.coupons.empty.title"),
|
|
@@ -4758,7 +4758,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, CouponsList, "CouponsList");
|
|
|
4758
4758
|
function ProductsList({ fullWidth } = {}) {
|
|
4759
4759
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4760
4760
|
const { catalogueVersion } = useProductContext();
|
|
4761
|
-
const data =
|
|
4761
|
+
const data = _chunkB6WMZXRYjs.useDataListRetriever.call(void 0, {
|
|
4762
4762
|
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunkOO2DBP6Ljs.StripeProductService.listProducts(params), "retriever"),
|
|
4763
4763
|
retrieverParams: {},
|
|
4764
4764
|
module: _chunkA7Y5YW7Qjs.Modules.StripeProduct
|
|
@@ -4768,7 +4768,7 @@ function ProductsList({ fullWidth } = {}) {
|
|
|
4768
4768
|
}, [catalogueVersion]);
|
|
4769
4769
|
const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductEditor, {}, "create-product")];
|
|
4770
4770
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4771
|
-
|
|
4771
|
+
_chunkB6WMZXRYjs.ContentListTable,
|
|
4772
4772
|
{
|
|
4773
4773
|
data,
|
|
4774
4774
|
fields: ["name" /* name */, "status" /* status */, "prices" /* prices */],
|
|
@@ -4777,7 +4777,7 @@ function ProductsList({ fullWidth } = {}) {
|
|
|
4777
4777
|
fullWidth,
|
|
4778
4778
|
title: t("billing.admin.products.title"),
|
|
4779
4779
|
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4780
|
-
|
|
4780
|
+
_chunkB6WMZXRYjs.EmptyState,
|
|
4781
4781
|
{
|
|
4782
4782
|
icon: _lucidereact.PackageIcon,
|
|
4783
4783
|
title: t("billing.admin.products.empty.title"),
|
|
@@ -4793,8 +4793,8 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductsList, "ProductsList");
|
|
|
4793
4793
|
|
|
4794
4794
|
function ProductsListContainer() {
|
|
4795
4795
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4796
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductProvider, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4797
|
-
|
|
4796
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductProvider, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.CouponProvider, { publishChrome: false, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4797
|
+
_chunkB6WMZXRYjs.RoundPageContainer,
|
|
4798
4798
|
{
|
|
4799
4799
|
module: _chunkA7Y5YW7Qjs.Modules.StripeProduct,
|
|
4800
4800
|
tabs: [
|
|
@@ -4814,30 +4814,30 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductsListContainer, "ProductsListContain
|
|
|
4814
4814
|
|
|
4815
4815
|
function CouponDetails() {
|
|
4816
4816
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4817
|
-
const fmt =
|
|
4818
|
-
const { coupon } =
|
|
4817
|
+
const fmt = _chunkB6WMZXRYjs.useBillingFormatOptions.call(void 0, );
|
|
4818
|
+
const { coupon } = _chunkB6WMZXRYjs.useCouponContext.call(void 0, );
|
|
4819
4819
|
if (!coupon) return null;
|
|
4820
4820
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4821
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4821
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.SectionHeader, { children: t("billing.admin.products.tabs.details") }),
|
|
4822
4822
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-xs/relaxed", children: t("billing.admin.coupons.fixed_notice") }),
|
|
4823
4823
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
4824
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4824
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.DetailField, { label: t("billing.admin.coupons.fields.name"), value: coupon.name }),
|
|
4825
4825
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4826
|
-
|
|
4826
|
+
_chunkB6WMZXRYjs.DetailField,
|
|
4827
4827
|
{
|
|
4828
4828
|
label: t("billing.admin.coupons.fields.status"),
|
|
4829
|
-
value: coupon.valid ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4829
|
+
value: coupon.valid ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Badge, { variant: "softGreen", children: t("billing.admin.coupons.status.active") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.Badge, { variant: "softGray", children: t("billing.admin.coupons.status.ended") })
|
|
4830
4830
|
}
|
|
4831
4831
|
),
|
|
4832
4832
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4833
|
-
|
|
4833
|
+
_chunkB6WMZXRYjs.DetailField,
|
|
4834
4834
|
{
|
|
4835
4835
|
label: t("billing.admin.coupons.fields.discount"),
|
|
4836
4836
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _chunkOO2DBP6Ljs.formatCouponDiscount.call(void 0, coupon, t, fmt) })
|
|
4837
4837
|
}
|
|
4838
4838
|
),
|
|
4839
4839
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4840
|
-
|
|
4840
|
+
_chunkB6WMZXRYjs.DetailField,
|
|
4841
4841
|
{
|
|
4842
4842
|
label: t("billing.admin.coupons.fields.places"),
|
|
4843
4843
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: coupon.maxRedemptions !== void 0 ? t("billing.admin.coupons.places.limited", {
|
|
@@ -4847,21 +4847,21 @@ function CouponDetails() {
|
|
|
4847
4847
|
}
|
|
4848
4848
|
),
|
|
4849
4849
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4850
|
-
|
|
4850
|
+
_chunkB6WMZXRYjs.DetailField,
|
|
4851
4851
|
{
|
|
4852
4852
|
label: t("billing.admin.coupons.fields.products"),
|
|
4853
4853
|
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")
|
|
4854
4854
|
}
|
|
4855
4855
|
),
|
|
4856
4856
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4857
|
-
|
|
4857
|
+
_chunkB6WMZXRYjs.DetailField,
|
|
4858
4858
|
{
|
|
4859
4859
|
label: t("billing.admin.coupons.fields.redeemBy"),
|
|
4860
|
-
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: coupon.redeemBy ?
|
|
4860
|
+
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: coupon.redeemBy ? _chunkB6WMZXRYjs.formatDate.call(void 0, coupon.redeemBy, fmt) : "\u2014" })
|
|
4861
4861
|
}
|
|
4862
4862
|
),
|
|
4863
4863
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4864
|
-
|
|
4864
|
+
_chunkB6WMZXRYjs.DetailField,
|
|
4865
4865
|
{
|
|
4866
4866
|
label: t("billing.admin.coupons.fields.stripeId"),
|
|
4867
4867
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: coupon.stripeCouponId })
|
|
@@ -4896,15 +4896,15 @@ function CouponCodeEditorInternal({
|
|
|
4896
4896
|
}) {
|
|
4897
4897
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4898
4898
|
const router = _chunkA7Y5YW7Qjs.useI18nRouter.call(void 0, );
|
|
4899
|
-
const { createCode } =
|
|
4900
|
-
const formSchema2 = _react.useMemo.call(void 0, () => _zod3.z.object({ id: _zod3.z.uuidv4() }).and(
|
|
4901
|
-
const getDefaultValues = _react.useCallback.call(void 0, () => ({ id: _uuid.v4.call(void 0, ), ...
|
|
4899
|
+
const { createCode } = _chunkB6WMZXRYjs.useCouponContext.call(void 0, );
|
|
4900
|
+
const formSchema2 = _react.useMemo.call(void 0, () => _zod3.z.object({ id: _zod3.z.uuidv4() }).and(_chunkB6WMZXRYjs.couponCodeSchema.call(void 0, t)), [t]);
|
|
4901
|
+
const getDefaultValues = _react.useCallback.call(void 0, () => ({ id: _uuid.v4.call(void 0, ), ..._chunkB6WMZXRYjs.couponCodeDefaults.call(void 0, ) }), []);
|
|
4902
4902
|
const form = _reacthookform.useForm.call(void 0, {
|
|
4903
4903
|
resolver: _zod.zodResolver.call(void 0, formSchema2),
|
|
4904
4904
|
defaultValues: getDefaultValues()
|
|
4905
4905
|
});
|
|
4906
4906
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4907
|
-
|
|
4907
|
+
_chunkB6WMZXRYjs.EditorSheet,
|
|
4908
4908
|
{
|
|
4909
4909
|
form,
|
|
4910
4910
|
entityType: t("billing.admin.coupons.codes.entity"),
|
|
@@ -4914,14 +4914,14 @@ function CouponCodeEditorInternal({
|
|
|
4914
4914
|
onSuccess: _nullishCoalesce(onSuccess, () => ( (() => {
|
|
4915
4915
|
}))),
|
|
4916
4916
|
onNavigate: (url) => router.push(url),
|
|
4917
|
-
onSubmit: async (values) => await createCode({ id: values.id, couponId, ...
|
|
4917
|
+
onSubmit: async (values) => await createCode({ id: values.id, couponId, ..._chunkB6WMZXRYjs.toCouponCodeInput.call(void 0, values) }),
|
|
4918
4918
|
onReset: getDefaultValues,
|
|
4919
4919
|
trigger,
|
|
4920
4920
|
forceShow,
|
|
4921
4921
|
onClose,
|
|
4922
4922
|
dialogOpen,
|
|
4923
4923
|
onDialogOpenChange,
|
|
4924
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4924
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkB6WMZXRYjs.CouponCodeFields, { form })
|
|
4925
4925
|
}
|
|
4926
4926
|
);
|
|
4927
4927
|
}
|
|
@@ -4935,8 +4935,8 @@ _chunk7QVYU63Ejs.__name.call(void 0, CouponCodeEditor, "CouponCodeEditor");
|
|
|
4935
4935
|
|
|
4936
4936
|
function CouponCodesList({ couponId }) {
|
|
4937
4937
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4938
|
-
const { catalogueVersion } =
|
|
4939
|
-
const data =
|
|
4938
|
+
const { catalogueVersion } = _chunkB6WMZXRYjs.useCouponContext.call(void 0, );
|
|
4939
|
+
const data = _chunkB6WMZXRYjs.useDataListRetriever.call(void 0, {
|
|
4940
4940
|
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunkOO2DBP6Ljs.StripeCouponCodeService.listByCoupon({ ...params, couponId }), "retriever"),
|
|
4941
4941
|
retrieverParams: {},
|
|
4942
4942
|
module: _chunkA7Y5YW7Qjs.Modules.StripeCouponCode
|
|
@@ -4946,7 +4946,7 @@ function CouponCodesList({ couponId }) {
|
|
|
4946
4946
|
}, [catalogueVersion]);
|
|
4947
4947
|
const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, CouponCodeEditor, { couponId }, "create-code")];
|
|
4948
4948
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4949
|
-
|
|
4949
|
+
_chunkB6WMZXRYjs.ContentListTable,
|
|
4950
4950
|
{
|
|
4951
4951
|
data,
|
|
4952
4952
|
fields: [
|
|
@@ -4961,7 +4961,7 @@ function CouponCodesList({ couponId }) {
|
|
|
4961
4961
|
functions,
|
|
4962
4962
|
title: t("billing.admin.coupons.codes.title"),
|
|
4963
4963
|
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4964
|
-
|
|
4964
|
+
_chunkB6WMZXRYjs.EmptyState,
|
|
4965
4965
|
{
|
|
4966
4966
|
icon: _lucidereact.TicketIcon,
|
|
4967
4967
|
title: t("billing.admin.coupons.codes.empty.title"),
|
|
@@ -4977,12 +4977,12 @@ _chunk7QVYU63Ejs.__name.call(void 0, CouponCodesList, "CouponCodesList");
|
|
|
4977
4977
|
|
|
4978
4978
|
function CouponContainer() {
|
|
4979
4979
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4980
|
-
const { coupon } =
|
|
4980
|
+
const { coupon } = _chunkB6WMZXRYjs.useCouponContext.call(void 0, );
|
|
4981
4981
|
if (!coupon) return null;
|
|
4982
4982
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4983
|
-
|
|
4983
|
+
_chunkB6WMZXRYjs.RoundPageContainer,
|
|
4984
4984
|
{
|
|
4985
|
-
module:
|
|
4985
|
+
module: _chunkB6WMZXRYjs.couponPageModule.call(void 0, ),
|
|
4986
4986
|
id: coupon.id,
|
|
4987
4987
|
tabs: [
|
|
4988
4988
|
{
|
|
@@ -5089,5 +5089,5 @@ _chunk7QVYU63Ejs.__name.call(void 0, CouponContainer, "CouponContainer");
|
|
|
5089
5089
|
|
|
5090
5090
|
|
|
5091
5091
|
|
|
5092
|
-
exports.BillingAlertBanner = BillingAlertBanner; exports.BillingDashboardContainer = BillingDashboardContainer; exports.BillingDetailModal = BillingDetailModal; exports.BillingUsageSummaryCard = BillingUsageSummaryCard; exports.CancelSubscriptionDialog = CancelSubscriptionDialog; exports.CouponCodeActions =
|
|
5092
|
+
exports.BillingAlertBanner = BillingAlertBanner; exports.BillingDashboardContainer = BillingDashboardContainer; exports.BillingDetailModal = BillingDetailModal; exports.BillingUsageSummaryCard = BillingUsageSummaryCard; exports.CancelSubscriptionDialog = CancelSubscriptionDialog; exports.CouponCodeActions = _chunkB6WMZXRYjs.CouponCodeActions; exports.CouponCodeEditor = CouponCodeEditor; exports.CouponCodeFields = _chunkB6WMZXRYjs.CouponCodeFields; exports.CouponCodesList = CouponCodesList; exports.CouponContainer = CouponContainer; exports.CouponDetails = CouponDetails; exports.CouponEditor = _chunkB6WMZXRYjs.CouponEditor; exports.CouponProvider = _chunkB6WMZXRYjs.CouponProvider; exports.CouponRefresher = _chunkB6WMZXRYjs.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 = _chunkB6WMZXRYjs.applyDiscount; exports.couponCodeDefaults = _chunkB6WMZXRYjs.couponCodeDefaults; exports.couponCodeSchema = _chunkB6WMZXRYjs.couponCodeSchema; exports.couponCurrencyOptions = _chunkB6WMZXRYjs.couponCurrencyOptions; exports.formatCurrency = _chunkOO2DBP6Ljs.formatCurrency; exports.formatDate = _chunkB6WMZXRYjs.formatDate; exports.formatFixed = _chunkOO2DBP6Ljs.formatFixed; exports.formatInterval = _chunkOO2DBP6Ljs.formatInterval; exports.isStripeConfigured = isStripeConfigured; exports.optionalDate = _chunkB6WMZXRYjs.optionalDate; exports.optionalDecimal = _chunkB6WMZXRYjs.optionalDecimal; exports.optionalPositiveInt = _chunkB6WMZXRYjs.optionalPositiveInt; exports.parseOptionalDecimal = _chunkB6WMZXRYjs.parseOptionalDecimal; exports.parseOptionalPositiveInt = _chunkB6WMZXRYjs.parseOptionalPositiveInt; exports.priceLabel = priceLabel; exports.promotionCodeDiscount = _chunkB6WMZXRYjs.promotionCodeDiscount; exports.subscriptionDiscount = _chunkB6WMZXRYjs.subscriptionDiscount; exports.toCouponCodeInput = _chunkB6WMZXRYjs.toCouponCodeInput; exports.useBillingFormatOptions = _chunkB6WMZXRYjs.useBillingFormatOptions; exports.useCouponContext = _chunkB6WMZXRYjs.useCouponContext; exports.usePriceContext = usePriceContext; exports.useProductContext = useProductContext;
|
|
5093
5093
|
//# sourceMappingURL=index.js.map
|