@carlonicora/nextjs-jsonapi 6.0.0 → 6.2.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-FZNU4YQT.mjs → BlockNoteEditor-D6VMXRZH.mjs} +4 -4
- package/dist/{BlockNoteEditor-SAU3G6H7.js → BlockNoteEditor-Q757ZLCO.js} +19 -19
- package/dist/{BlockNoteEditor-SAU3G6H7.js.map → BlockNoteEditor-Q757ZLCO.js.map} +1 -1
- package/dist/{BlockNoteViewer-6XDDVTN6.mjs → BlockNoteViewer-GI5LVQHZ.mjs} +2 -2
- package/dist/{BlockNoteViewer-7BTV7QQA.js → BlockNoteViewer-KG4CIJC5.js} +3 -3
- package/dist/{BlockNoteViewer-7BTV7QQA.js.map → BlockNoteViewer-KG4CIJC5.js.map} +1 -1
- package/dist/billing/index.js +491 -491
- package/dist/billing/index.mjs +3 -3
- package/dist/{chunk-F4JB7YAP.js → chunk-3P3IYUWQ.js} +8 -8
- package/dist/{chunk-F4JB7YAP.js.map → chunk-3P3IYUWQ.js.map} +1 -1
- package/dist/{chunk-U7DR5VDT.mjs → chunk-6PW3562E.mjs} +5 -5
- package/dist/{chunk-JVJS5RHB.mjs → chunk-CUNSPLOD.mjs} +2 -2
- package/dist/{chunk-T3YQ47EF.js → chunk-GSHMGL6N.js} +2 -1
- package/dist/chunk-GSHMGL6N.js.map +1 -0
- package/dist/{chunk-GFGKMUPZ.mjs → chunk-HLW3SUMD.mjs} +2 -2
- package/dist/{chunk-RYZYKG6W.mjs → chunk-MHBE4KQR.mjs} +2 -2
- package/dist/{chunk-USYZNWKS.mjs → chunk-QKDPCZ3G.mjs} +2 -1
- package/dist/{chunk-USYZNWKS.mjs.map → chunk-QKDPCZ3G.mjs.map} +1 -1
- package/dist/{chunk-TPZS46IM.js → chunk-S332ZCIE.js} +3 -3
- package/dist/{chunk-TPZS46IM.js.map → chunk-S332ZCIE.js.map} +1 -1
- package/dist/{chunk-MTI2UXDA.js → chunk-UEWDYVLW.js} +4 -4
- package/dist/{chunk-MTI2UXDA.js.map → chunk-UEWDYVLW.js.map} +1 -1
- package/dist/{chunk-IPYXT7MH.js → chunk-XQEYBESH.js} +868 -868
- package/dist/{chunk-IPYXT7MH.js.map → chunk-XQEYBESH.js.map} +1 -1
- package/dist/client/index.js +4 -4
- package/dist/client/index.mjs +3 -3
- package/dist/components/index.js +4 -4
- package/dist/components/index.mjs +3 -3
- package/dist/contexts/index.js +4 -4
- package/dist/contexts/index.mjs +3 -3
- package/dist/core/index.js +2 -2
- package/dist/core/index.mjs +1 -1
- package/dist/email-automations/index.js +92 -92
- package/dist/email-automations/index.mjs +3 -3
- package/dist/features/analytics/index.d.mts +9 -1
- package/dist/features/analytics/index.d.ts +9 -1
- package/dist/features/analytics/index.js +129 -127
- package/dist/features/analytics/index.js.map +1 -1
- package/dist/features/analytics/index.mjs +12 -10
- package/dist/features/analytics/index.mjs.map +1 -1
- package/dist/features/analytics/server.js +4 -4
- package/dist/features/analytics/server.mjs +2 -2
- package/dist/features/blog/index.js +150 -150
- package/dist/features/blog/index.mjs +3 -3
- package/dist/features/blog/server.js +16 -16
- package/dist/features/blog/server.mjs +1 -1
- package/dist/features/help/index.js +37 -37
- package/dist/features/help/index.mjs +3 -3
- package/dist/features/tokenusage/index.js +158 -125
- package/dist/features/tokenusage/index.js.map +1 -1
- package/dist/features/tokenusage/index.mjs +38 -5
- package/dist/features/tokenusage/index.mjs.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.mjs +2 -2
- package/dist/server/index.js +3 -3
- package/dist/server/index.mjs +2 -2
- package/messages/en.json +23 -0
- package/messages/it.json +23 -0
- package/package.json +1 -1
- package/scripts/validate-messages.mjs +4 -1
- package/src/features/analytics/components/AnalyticsTracker.tsx +22 -9
- package/src/features/analytics/components/__tests__/AnalyticsTracker.spec.tsx +67 -0
- package/src/features/analytics/data/__tests__/models.spec.ts +13 -0
- package/src/features/analytics/data/analytics-event.ts +1 -0
- package/src/features/analytics/data/analytics.types.ts +2 -0
- package/src/features/tokenusage/components/TokenUsageRankedBar.tsx +34 -2
- package/src/features/tokenusage/components/__tests__/TokenUsageRankedBar.spec.tsx +22 -0
- package/src/features/tokenusage/lib/operation-label.ts +20 -0
- package/dist/chunk-T3YQ47EF.js.map +0 -1
- /package/dist/{BlockNoteEditor-FZNU4YQT.mjs.map → BlockNoteEditor-D6VMXRZH.mjs.map} +0 -0
- /package/dist/{BlockNoteViewer-6XDDVTN6.mjs.map → BlockNoteViewer-GI5LVQHZ.mjs.map} +0 -0
- /package/dist/{chunk-U7DR5VDT.mjs.map → chunk-6PW3562E.mjs.map} +0 -0
- /package/dist/{chunk-JVJS5RHB.mjs.map → chunk-CUNSPLOD.mjs.map} +0 -0
- /package/dist/{chunk-GFGKMUPZ.mjs.map → chunk-HLW3SUMD.mjs.map} +0 -0
- /package/dist/{chunk-RYZYKG6W.mjs.map → chunk-MHBE4KQR.mjs.map} +0 -0
package/dist/billing/index.js
CHANGED
|
@@ -81,10 +81,10 @@
|
|
|
81
81
|
|
|
82
82
|
|
|
83
83
|
|
|
84
|
-
var
|
|
84
|
+
var _chunkXQEYBESHjs = require('../chunk-XQEYBESH.js');
|
|
85
85
|
|
|
86
86
|
|
|
87
|
-
var
|
|
87
|
+
var _chunk3P3IYUWQjs = require('../chunk-3P3IYUWQ.js');
|
|
88
88
|
|
|
89
89
|
|
|
90
90
|
var _chunkG4JR3SFVjs = require('../chunk-G4JR3SFV.js');
|
|
@@ -113,7 +113,7 @@ var _chunkG4JR3SFVjs = require('../chunk-G4JR3SFV.js');
|
|
|
113
113
|
|
|
114
114
|
|
|
115
115
|
|
|
116
|
-
var
|
|
116
|
+
var _chunkGSHMGL6Njs = require('../chunk-GSHMGL6N.js');
|
|
117
117
|
require('../chunk-GHE4VT2R.js');
|
|
118
118
|
require('../chunk-LXKSUWAV.js');
|
|
119
119
|
require('../chunk-JTPRJNT2.js');
|
|
@@ -126,7 +126,7 @@ var _chunk7QVYU63Ejs = require('../chunk-7QVYU63E.js');
|
|
|
126
126
|
var _nextintl = require('next-intl');
|
|
127
127
|
var _lucidereact = require('lucide-react');
|
|
128
128
|
var _jsxruntime = require('react/jsx-runtime');
|
|
129
|
-
var SUBSCRIPTION_STATUSES = Object.values(
|
|
129
|
+
var SUBSCRIPTION_STATUSES = Object.values(_chunkGSHMGL6Njs.SubscriptionStatus);
|
|
130
130
|
function getStatusBadgeVariant(status) {
|
|
131
131
|
switch (status) {
|
|
132
132
|
case "active" /* ACTIVE */:
|
|
@@ -158,43 +158,43 @@ function SubscriptionSummaryCard({
|
|
|
158
158
|
onManageClick
|
|
159
159
|
}) {
|
|
160
160
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
161
|
-
const fmt =
|
|
161
|
+
const fmt = _chunkXQEYBESHjs.useBillingFormatOptions.call(void 0, );
|
|
162
162
|
if (loading) {
|
|
163
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
164
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
165
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
163
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.Card, { children: [
|
|
164
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
165
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.CardTitle, { children: t("billing.ui.subscriptions.title") }),
|
|
166
166
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
167
167
|
] }),
|
|
168
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
169
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
170
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
171
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
168
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.CardContent, { children: [
|
|
169
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
170
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Skeleton, { className: "h-4 w-24 mb-1" }),
|
|
171
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Skeleton, { className: "h-4 w-40" })
|
|
172
172
|
] })
|
|
173
173
|
] });
|
|
174
174
|
}
|
|
175
175
|
if (error) {
|
|
176
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
177
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
178
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
176
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.Card, { children: [
|
|
177
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
178
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.CardTitle, { children: t("billing.ui.subscriptions.title") }),
|
|
179
179
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
180
180
|
] }),
|
|
181
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
181
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
182
182
|
] });
|
|
183
183
|
}
|
|
184
184
|
const activeSubscriptions = subscriptions.filter(
|
|
185
185
|
(sub) => sub.status === "active" /* ACTIVE */ || sub.status === "trialing" /* TRIALING */ || sub.status === "past_due" /* PAST_DUE */
|
|
186
186
|
);
|
|
187
187
|
const primarySubscription = activeSubscriptions[0];
|
|
188
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
189
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
190
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
188
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
|
|
189
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
190
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.CardTitle, { children: t("billing.ui.subscriptions.title") }),
|
|
191
191
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
192
192
|
] }),
|
|
193
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
193
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.CardContent, { children: !primarySubscription ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
194
194
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: t("billing.ui.cards.subscriptions.empty_title") }),
|
|
195
195
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.subscriptions.empty_description") }),
|
|
196
196
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
197
|
-
|
|
197
|
+
_chunkXQEYBESHjs.Button,
|
|
198
198
|
{
|
|
199
199
|
variant: "outline",
|
|
200
200
|
size: "sm",
|
|
@@ -212,8 +212,8 @@ function SubscriptionSummaryCard({
|
|
|
212
212
|
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
213
213
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
214
214
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: formatPlanName(primarySubscription, t("billing.ui.cards.subscriptions.fallback_name")) }),
|
|
215
|
-
primarySubscription.status === "past_due" /* PAST_DUE */ ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
216
|
-
|
|
215
|
+
primarySubscription.status === "past_due" /* PAST_DUE */ ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Badge, { variant: "softRed", children: t("billing.ui.cards.subscriptions.payment_failing") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
216
|
+
_chunkXQEYBESHjs.Badge,
|
|
217
217
|
{
|
|
218
218
|
variant: primarySubscription.cancelAtPeriodEnd ? "secondary" : getStatusBadgeVariant(primarySubscription.status),
|
|
219
219
|
children: primarySubscription.cancelAtPeriodEnd ? t("billing.ui.cards.subscriptions.canceling") : SUBSCRIPTION_STATUSES.includes(primarySubscription.status) ? t(`billing.ui.subscription_status.${primarySubscription.status}`) : primarySubscription.status
|
|
@@ -221,11 +221,11 @@ function SubscriptionSummaryCard({
|
|
|
221
221
|
)
|
|
222
222
|
] }),
|
|
223
223
|
/* @__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", {
|
|
224
|
-
date:
|
|
224
|
+
date: _chunkXQEYBESHjs.formatDate.call(void 0, primarySubscription.currentPeriodEnd, fmt)
|
|
225
225
|
}) : primarySubscription.cancelAtPeriodEnd ? t("billing.ui.cards.subscriptions.cancels_on", {
|
|
226
|
-
date:
|
|
226
|
+
date: _chunkXQEYBESHjs.formatDate.call(void 0, primarySubscription.currentPeriodEnd, fmt)
|
|
227
227
|
}) : t("billing.ui.cards.subscriptions.renews_on", {
|
|
228
|
-
date:
|
|
228
|
+
date: _chunkXQEYBESHjs.formatDate.call(void 0, primarySubscription.currentPeriodEnd, fmt)
|
|
229
229
|
}) }),
|
|
230
230
|
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 }) })
|
|
231
231
|
] }) })
|
|
@@ -259,37 +259,37 @@ function PaymentMethodSummaryCard({
|
|
|
259
259
|
}) {
|
|
260
260
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
261
261
|
if (loading) {
|
|
262
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
263
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
264
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
262
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.Card, { children: [
|
|
263
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
264
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.CardTitle, { children: t("billing.ui.payment_method.title") }),
|
|
265
265
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
266
266
|
] }),
|
|
267
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
268
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
269
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
267
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.CardContent, { children: [
|
|
268
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
269
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Skeleton, { className: "h-4 w-24" })
|
|
270
270
|
] })
|
|
271
271
|
] });
|
|
272
272
|
}
|
|
273
273
|
if (error) {
|
|
274
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
275
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
276
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
274
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.Card, { children: [
|
|
275
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
276
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.CardTitle, { children: t("billing.ui.payment_method.title") }),
|
|
277
277
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
278
278
|
] }),
|
|
279
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
279
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
280
280
|
] });
|
|
281
281
|
}
|
|
282
282
|
const defaultMethod = paymentMethods.find((pm) => pm.id === defaultPaymentMethodId) || paymentMethods[0];
|
|
283
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
284
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
285
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
283
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
|
|
284
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
285
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.CardTitle, { children: t("billing.ui.payment_method.title") }),
|
|
286
286
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
287
287
|
] }),
|
|
288
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
288
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.CardContent, { children: paymentMethods.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
289
289
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: t("billing.ui.cards.payment_method.empty_title") }),
|
|
290
290
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.payment_method.empty_description") }),
|
|
291
291
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
292
|
-
|
|
292
|
+
_chunkXQEYBESHjs.Button,
|
|
293
293
|
{
|
|
294
294
|
variant: "outline",
|
|
295
295
|
size: "sm",
|
|
@@ -338,13 +338,13 @@ function formatBalance(balance, currency, locale) {
|
|
|
338
338
|
_chunk7QVYU63Ejs.__name.call(void 0, formatBalance, "formatBalance");
|
|
339
339
|
function CustomerInfoCard({ customer, loading, error }) {
|
|
340
340
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
341
|
-
const locale =
|
|
341
|
+
const locale = _chunkGSHMGL6Njs.useI18nLocale.call(void 0, );
|
|
342
342
|
const [portalLoading, setPortalLoading] = _react.useState.call(void 0, false);
|
|
343
343
|
const handlePortalClick = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async (e) => {
|
|
344
344
|
e.stopPropagation();
|
|
345
345
|
setPortalLoading(true);
|
|
346
346
|
try {
|
|
347
|
-
const { url } = await
|
|
347
|
+
const { url } = await _chunkGSHMGL6Njs.StripeCustomerService.createPortalSession();
|
|
348
348
|
window.open(url, "_blank");
|
|
349
349
|
} catch (err) {
|
|
350
350
|
console.error("[CustomerInfoCard] Failed to create portal session:", err);
|
|
@@ -353,45 +353,45 @@ function CustomerInfoCard({ customer, loading, error }) {
|
|
|
353
353
|
}
|
|
354
354
|
}, "handlePortalClick");
|
|
355
355
|
if (loading) {
|
|
356
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
357
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
358
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
356
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.Card, { children: [
|
|
357
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
358
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.CardTitle, { children: t("billing.ui.cards.customer.title") }),
|
|
359
359
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
360
360
|
] }),
|
|
361
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
362
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
363
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
364
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
361
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.CardContent, { children: [
|
|
362
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
363
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Skeleton, { className: "h-4 w-48 mb-1" }),
|
|
364
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Skeleton, { className: "h-4 w-24" })
|
|
365
365
|
] })
|
|
366
366
|
] });
|
|
367
367
|
}
|
|
368
368
|
if (error) {
|
|
369
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
370
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
371
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
369
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.Card, { children: [
|
|
370
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
371
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.CardTitle, { children: t("billing.ui.cards.customer.title") }),
|
|
372
372
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
373
373
|
] }),
|
|
374
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
374
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
375
375
|
] });
|
|
376
376
|
}
|
|
377
377
|
if (!customer) {
|
|
378
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
379
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
380
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
378
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.Card, { children: [
|
|
379
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
380
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.CardTitle, { children: t("billing.ui.cards.customer.title") }),
|
|
381
381
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
382
382
|
] }),
|
|
383
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
383
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.CardContent, { children: [
|
|
384
384
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: t("billing.ui.cards.customer.not_set_up") }),
|
|
385
385
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.customer.not_set_up_description") })
|
|
386
386
|
] })
|
|
387
387
|
] });
|
|
388
388
|
}
|
|
389
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
390
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
391
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
389
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.Card, { children: [
|
|
390
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
391
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.CardTitle, { children: t("billing.ui.cards.customer.title") }),
|
|
392
392
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
393
393
|
] }),
|
|
394
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
394
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
395
395
|
customer.name && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: customer.name }),
|
|
396
396
|
customer.email && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: customer.email }),
|
|
397
397
|
customer.balance !== void 0 && customer.balance !== 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm", children: [
|
|
@@ -401,7 +401,7 @@ function CustomerInfoCard({ customer, loading, error }) {
|
|
|
401
401
|
] }),
|
|
402
402
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: customer.balance < 0 ? "text-success" : "text-destructive", children: formatBalance(customer.balance, customer.currency, locale) })
|
|
403
403
|
] }),
|
|
404
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
404
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.Button, { variant: "outline", size: "sm", className: "mt-2", onClick: handlePortalClick, disabled: portalLoading, children: [
|
|
405
405
|
portalLoading ? t("common.loading") : t("billing.ui.cards.customer.manage_portal"),
|
|
406
406
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ExternalLink, { className: "h-4 w-4 ms-1" })
|
|
407
407
|
] })
|
|
@@ -414,7 +414,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, CustomerInfoCard, "CustomerInfoCard");
|
|
|
414
414
|
|
|
415
415
|
|
|
416
416
|
|
|
417
|
-
var INVOICE_STATUSES = Object.values(
|
|
417
|
+
var INVOICE_STATUSES = Object.values(_chunkGSHMGL6Njs.InvoiceStatus);
|
|
418
418
|
function getStatusBadgeVariant2(status) {
|
|
419
419
|
switch (status) {
|
|
420
420
|
case "paid" /* PAID */:
|
|
@@ -439,46 +439,46 @@ function formatAmount(amount, currency, locale) {
|
|
|
439
439
|
_chunk7QVYU63Ejs.__name.call(void 0, formatAmount, "formatAmount");
|
|
440
440
|
function InvoicesSummaryCard({ invoices, loading, error, onViewAllClick }) {
|
|
441
441
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
442
|
-
const fmt =
|
|
442
|
+
const fmt = _chunkXQEYBESHjs.useBillingFormatOptions.call(void 0, );
|
|
443
443
|
if (loading) {
|
|
444
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
445
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
446
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
444
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.Card, { children: [
|
|
445
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
446
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.CardTitle, { children: t("billing.ui.cards.invoices.title") }),
|
|
447
447
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
448
448
|
] }),
|
|
449
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
450
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
451
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
452
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
449
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.CardContent, { children: [
|
|
450
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Skeleton, { className: "h-6 w-24 mb-2" }),
|
|
451
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Skeleton, { className: "h-4 w-32 mb-1" }),
|
|
452
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Skeleton, { className: "h-4 w-20" })
|
|
453
453
|
] })
|
|
454
454
|
] });
|
|
455
455
|
}
|
|
456
456
|
if (error) {
|
|
457
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
458
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
459
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
457
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.Card, { children: [
|
|
458
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
459
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.CardTitle, { children: t("billing.ui.cards.invoices.title") }),
|
|
460
460
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
461
461
|
] }),
|
|
462
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
462
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
463
463
|
] });
|
|
464
464
|
}
|
|
465
465
|
const latestInvoice = _nullishCoalesce(invoices.find((inv) => inv.status !== "void" /* VOID */), () => ( invoices[0]));
|
|
466
466
|
const paidInvoices = invoices.filter((inv) => inv.status === "paid" /* PAID */);
|
|
467
467
|
const openInvoices = invoices.filter((inv) => inv.status === "open" /* OPEN */);
|
|
468
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
469
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
470
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
468
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewAllClick, children: [
|
|
469
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
470
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.CardTitle, { children: t("billing.ui.cards.invoices.title") }),
|
|
471
471
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
472
472
|
] }),
|
|
473
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
473
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.CardContent, { children: invoices.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
474
474
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: t("billing.ui.invoices.empty_title") }),
|
|
475
475
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.invoices.empty_description") })
|
|
476
476
|
] }) : latestInvoice ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
477
477
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
478
478
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: formatAmount(latestInvoice.total, latestInvoice.currency, fmt.locale) }),
|
|
479
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
479
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Badge, { variant: getStatusBadgeVariant2(latestInvoice.status), children: INVOICE_STATUSES.includes(latestInvoice.status) ? t(`billing.ui.invoice_status.${latestInvoice.status}`) : latestInvoice.status })
|
|
480
480
|
] }),
|
|
481
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: latestInvoice.stripeInvoiceNumber || t("billing.ui.cards.invoices.invoice_from", { date:
|
|
481
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: latestInvoice.stripeInvoiceNumber || t("billing.ui.cards.invoices.invoice_from", { date: _chunkXQEYBESHjs.formatDate.call(void 0, latestInvoice.periodStart, fmt) }) }),
|
|
482
482
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-4 text-xs text-muted-foreground", children: [
|
|
483
483
|
paidInvoices.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: t("billing.ui.cards.invoices.paid_count", { count: paidInvoices.length }) }),
|
|
484
484
|
openInvoices.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-warning", children: t("billing.ui.cards.invoices.open_count", { count: openInvoices.length }) }),
|
|
@@ -511,26 +511,26 @@ function BillingUsageSummaryCard({
|
|
|
511
511
|
onViewDetailsClick
|
|
512
512
|
}) {
|
|
513
513
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
514
|
-
const locale =
|
|
514
|
+
const locale = _chunkGSHMGL6Njs.useI18nLocale.call(void 0, );
|
|
515
515
|
if (loading) {
|
|
516
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
517
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
518
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
516
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.Card, { children: [
|
|
517
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
518
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.CardTitle, { children: t("billing.ui.cards.usage.title") }),
|
|
519
519
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
520
520
|
] }),
|
|
521
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
522
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
523
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
521
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.CardContent, { children: [
|
|
522
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Skeleton, { className: "h-6 w-24 mb-2" }),
|
|
523
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Skeleton, { className: "h-4 w-32" })
|
|
524
524
|
] })
|
|
525
525
|
] });
|
|
526
526
|
}
|
|
527
527
|
if (error) {
|
|
528
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
529
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
530
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
528
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.Card, { children: [
|
|
529
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
530
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.CardTitle, { children: t("billing.ui.cards.usage.title") }),
|
|
531
531
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
532
532
|
] }),
|
|
533
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
533
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
534
534
|
] });
|
|
535
535
|
}
|
|
536
536
|
const totalUsage = Object.values(summaries).reduce((acc, summary) => {
|
|
@@ -538,12 +538,12 @@ function BillingUsageSummaryCard({
|
|
|
538
538
|
}, 0);
|
|
539
539
|
const primaryMeter = meters.find((m) => _optionalChain([summaries, 'access', _17 => _17[m.id], 'optionalAccess', _18 => _18.aggregatedValue]));
|
|
540
540
|
const primarySummary = primaryMeter ? summaries[primaryMeter.id] : null;
|
|
541
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
542
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
543
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
541
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewDetailsClick, children: [
|
|
542
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
543
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.CardTitle, { children: t("billing.ui.cards.usage.title") }),
|
|
544
544
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
545
545
|
] }),
|
|
546
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
546
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.CardContent, { children: meters.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
547
547
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: t("billing.ui.cards.usage.no_meters") }),
|
|
548
548
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.usage.no_meters_description") })
|
|
549
549
|
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
@@ -600,7 +600,7 @@ function PaymentMethodForm({
|
|
|
600
600
|
const fetchSetupIntent = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
601
601
|
setLoading(true);
|
|
602
602
|
try {
|
|
603
|
-
const intent = await
|
|
603
|
+
const intent = await _chunkGSHMGL6Njs.StripeCustomerService.createSetupIntent();
|
|
604
604
|
setSetupIntent(intent);
|
|
605
605
|
} catch (err) {
|
|
606
606
|
console.error("[PaymentMethodForm] Failed to create setup intent:", err);
|
|
@@ -638,7 +638,7 @@ function PaymentMethodForm({
|
|
|
638
638
|
return;
|
|
639
639
|
}
|
|
640
640
|
if ((alwaysSetDefault || setAsDefault) && _optionalChain([confirmedSetupIntent, 'optionalAccess', _19 => _19.payment_method])) {
|
|
641
|
-
await
|
|
641
|
+
await _chunkGSHMGL6Njs.StripeCustomerService.setDefaultPaymentMethod({
|
|
642
642
|
paymentMethodId: typeof confirmedSetupIntent.payment_method === "string" ? confirmedSetupIntent.payment_method : confirmedSetupIntent.payment_method.id
|
|
643
643
|
});
|
|
644
644
|
}
|
|
@@ -654,7 +654,7 @@ function PaymentMethodForm({
|
|
|
654
654
|
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") }) });
|
|
655
655
|
}
|
|
656
656
|
if (!setupIntent && error) {
|
|
657
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
657
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.AlertDescription, { children: error }) });
|
|
658
658
|
}
|
|
659
659
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: handleSubmit, className: "flex flex-col gap-y-4", children: [
|
|
660
660
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rounded-md border border-gray-300 p-3", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -678,19 +678,19 @@ function PaymentMethodForm({
|
|
|
678
678
|
) }),
|
|
679
679
|
!alwaysSetDefault && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
680
680
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
681
|
-
|
|
681
|
+
_chunkXQEYBESHjs.Checkbox,
|
|
682
682
|
{
|
|
683
683
|
id: "setAsDefault",
|
|
684
684
|
checked: setAsDefault,
|
|
685
685
|
onCheckedChange: (checked) => setSetAsDefault(!!checked)
|
|
686
686
|
}
|
|
687
687
|
),
|
|
688
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
688
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Label, { htmlFor: "setAsDefault", className: "cursor-pointer font-normal", children: t("billing.ui.payment_form.set_default") })
|
|
689
689
|
] }),
|
|
690
|
-
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
690
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.AlertDescription, { children: error }) }),
|
|
691
691
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-x-2", children: [
|
|
692
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
693
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
692
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Button, { type: "button", variant: "outline", onClick: onCancel, disabled: isSubmitting || isLoading, children: t("ui.buttons.cancel") }),
|
|
693
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Button, { type: "submit", disabled: !stripe || isSubmitting || isLoading, children: isSubmitting ? t("billing.ui.wizard.review.processing") : t("billing.ui.cards.payment_method.add_card") })
|
|
694
694
|
] })
|
|
695
695
|
] });
|
|
696
696
|
}
|
|
@@ -707,10 +707,10 @@ function PaymentMethodEditor({ open, onOpenChange, onSuccess }) {
|
|
|
707
707
|
const handleCancel = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
708
708
|
onOpenChange(false);
|
|
709
709
|
}, "handleCancel");
|
|
710
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
711
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
712
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
713
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
710
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.DialogContent, { className: "max-w-md", children: [
|
|
711
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.DialogHeader, { children: [
|
|
712
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.DialogTitle, { children: t("billing.ui.payment_methods.add") }),
|
|
713
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.DialogDescription, { children: t("billing.ui.payment_methods.add_description") })
|
|
714
714
|
] }),
|
|
715
715
|
open && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodForm, { onSuccess: handleSuccess, onCancel: handleCancel })
|
|
716
716
|
] }) });
|
|
@@ -736,7 +736,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
736
736
|
_react.useEffect.call(void 0, () => {
|
|
737
737
|
const loadCustomer = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
738
738
|
try {
|
|
739
|
-
const fetchedCustomer = await
|
|
739
|
+
const fetchedCustomer = await _chunkGSHMGL6Njs.StripeCustomerService.getCustomer();
|
|
740
740
|
setCustomer(fetchedCustomer);
|
|
741
741
|
} catch (error) {
|
|
742
742
|
console.error("[PaymentMethodCard] Failed to load customer:", error);
|
|
@@ -753,7 +753,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
753
753
|
const handleSetDefault = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
754
754
|
setLoading(true);
|
|
755
755
|
try {
|
|
756
|
-
await
|
|
756
|
+
await _chunkGSHMGL6Njs.StripeCustomerService.setDefaultPaymentMethod({ paymentMethodId: paymentMethod.id });
|
|
757
757
|
onUpdate();
|
|
758
758
|
} catch (error) {
|
|
759
759
|
console.error("[PaymentMethodCard] Failed to set as default:", error);
|
|
@@ -764,7 +764,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
764
764
|
const handleRemove = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
765
765
|
setLoading(true);
|
|
766
766
|
try {
|
|
767
|
-
await
|
|
767
|
+
await _chunkGSHMGL6Njs.StripeCustomerService.removePaymentMethod({ paymentMethodId: paymentMethod.id });
|
|
768
768
|
setShowRemoveDialog(false);
|
|
769
769
|
onUpdate();
|
|
770
770
|
} catch (error) {
|
|
@@ -773,16 +773,16 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
773
773
|
}
|
|
774
774
|
}, "handleRemove");
|
|
775
775
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
776
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
777
|
-
isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
778
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
776
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.Card, { className: "relative", children: [
|
|
777
|
+
isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Badge, { variant: "softGreen", className: "absolute end-2 top-2", children: t("billing.ui.payment_methods.default") }),
|
|
778
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.CardHeader, { className: "flex flex-row items-center justify-between pb-2", children: [
|
|
779
779
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
780
780
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-2xl", children: brandIcon }),
|
|
781
781
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium capitalize", children: brand })
|
|
782
782
|
] }),
|
|
783
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
784
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
785
|
-
|
|
783
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.DropdownMenu, { children: [
|
|
784
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.DropdownMenuTrigger, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
785
|
+
_chunkXQEYBESHjs.Button,
|
|
786
786
|
{
|
|
787
787
|
render: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {}),
|
|
788
788
|
nativeButton: false,
|
|
@@ -793,10 +793,10 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
793
793
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.MoreVertical, { className: "h-4 w-4" })
|
|
794
794
|
}
|
|
795
795
|
) }),
|
|
796
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
797
|
-
!isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
796
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.DropdownMenuContent, { align: "end", children: [
|
|
797
|
+
!isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.DropdownMenuItem, { onClick: handleSetDefault, disabled: loading, children: t("billing.ui.payment_methods.set_default") }),
|
|
798
798
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
799
|
-
|
|
799
|
+
_chunkXQEYBESHjs.DropdownMenuItem,
|
|
800
800
|
{
|
|
801
801
|
onClick: () => setShowRemoveDialog(true),
|
|
802
802
|
disabled: loading,
|
|
@@ -807,7 +807,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
807
807
|
] })
|
|
808
808
|
] })
|
|
809
809
|
] }),
|
|
810
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
810
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-1", children: [
|
|
811
811
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-lg font-semibold", children: [
|
|
812
812
|
"\u2022\u2022\u2022\u2022 ",
|
|
813
813
|
last4
|
|
@@ -815,17 +815,17 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
815
815
|
/* @__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}` }) })
|
|
816
816
|
] }) })
|
|
817
817
|
] }),
|
|
818
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
819
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
820
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
821
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
818
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.AlertDialog, { open: showRemoveDialog, onOpenChange: setShowRemoveDialog, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.AlertDialogContent, { children: [
|
|
819
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.AlertDialogHeader, { children: [
|
|
820
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.AlertDialogTitle, { children: t("billing.ui.payment_methods.remove_title") }),
|
|
821
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.AlertDialogDescription, { children: [
|
|
822
822
|
t("billing.ui.payment_methods.remove_description"),
|
|
823
823
|
isDefault && ` ${t("billing.ui.payment_methods.remove_default_warning")}`
|
|
824
824
|
] })
|
|
825
825
|
] }),
|
|
826
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
827
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
828
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
826
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.AlertDialogFooter, { children: [
|
|
827
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.AlertDialogCancel, { disabled: loading, children: t("ui.buttons.cancel") }),
|
|
828
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.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") })
|
|
829
829
|
] })
|
|
830
830
|
] }) })
|
|
831
831
|
] });
|
|
@@ -849,7 +849,7 @@ function PaymentMethodsContainer() {
|
|
|
849
849
|
const loadPaymentMethods = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
850
850
|
setLoading(true);
|
|
851
851
|
try {
|
|
852
|
-
const fetchedPaymentMethods = await
|
|
852
|
+
const fetchedPaymentMethods = await _chunkGSHMGL6Njs.StripeCustomerService.listPaymentMethods();
|
|
853
853
|
setPaymentMethods(fetchedPaymentMethods);
|
|
854
854
|
} catch (error) {
|
|
855
855
|
console.error("[PaymentMethodsContainer] Failed to load payment methods:", error);
|
|
@@ -869,14 +869,14 @@ function PaymentMethodsContainer() {
|
|
|
869
869
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8" }),
|
|
870
870
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: t("billing.ui.payment_methods.title") })
|
|
871
871
|
] }),
|
|
872
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
872
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Button, { onClick: () => setShowAddPaymentMethod(true), children: t("billing.ui.payment_methods.add") })
|
|
873
873
|
] }),
|
|
874
874
|
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: [
|
|
875
875
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-16 w-16 text-muted-foreground" }),
|
|
876
876
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
877
877
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "mb-2 text-sm font-medium", children: t("billing.ui.payment_methods.empty_title") }),
|
|
878
878
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mb-4 text-muted-foreground", children: t("billing.ui.payment_methods.empty_description") }),
|
|
879
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
879
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Button, { onClick: () => setShowAddPaymentMethod(true), children: t("billing.ui.payment_methods.add_first") })
|
|
880
880
|
] })
|
|
881
881
|
] }),
|
|
882
882
|
paymentMethods.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodsList, { paymentMethods, onUpdate: loadPaymentMethods }),
|
|
@@ -932,7 +932,7 @@ var statusConfig = {
|
|
|
932
932
|
function InvoiceStatusBadge({ status }) {
|
|
933
933
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
934
934
|
const config = statusConfig[status] || statusConfig["draft" /* DRAFT */];
|
|
935
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
935
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Badge, { variant: config.variant, children: t(config.label) });
|
|
936
936
|
}
|
|
937
937
|
_chunk7QVYU63Ejs.__name.call(void 0, InvoiceStatusBadge, "InvoiceStatusBadge");
|
|
938
938
|
|
|
@@ -945,7 +945,7 @@ function InvoiceDetails({
|
|
|
945
945
|
onInvoiceChange: _onInvoiceChange
|
|
946
946
|
}) {
|
|
947
947
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
948
|
-
const fmt =
|
|
948
|
+
const fmt = _chunkXQEYBESHjs.useBillingFormatOptions.call(void 0, );
|
|
949
949
|
const handleDownloadPDF = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
950
950
|
if (invoice.stripePdfUrl) {
|
|
951
951
|
window.open(invoice.stripePdfUrl, "_blank");
|
|
@@ -965,10 +965,10 @@ function InvoiceDetails({
|
|
|
965
965
|
return invoice.stripeInvoiceId.slice(-8);
|
|
966
966
|
}, "getInvoiceNumber");
|
|
967
967
|
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");
|
|
968
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
969
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
970
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
971
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
968
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.DialogContent, { className: "max-w-2xl", children: [
|
|
969
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.DialogHeader, { children: [
|
|
970
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.DialogTitle, { children: t("billing.ui.invoice.title", { number: getInvoiceNumber() }) }),
|
|
971
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.DialogDescription, { children: _chunkXQEYBESHjs.formatDate.call(void 0, invoice.periodStart, fmt) })
|
|
972
972
|
] }),
|
|
973
973
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
974
974
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
@@ -979,18 +979,18 @@ function InvoiceDetails({
|
|
|
979
979
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
980
980
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.billing_period") }),
|
|
981
981
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm", children: [
|
|
982
|
-
|
|
982
|
+
_chunkXQEYBESHjs.formatDate.call(void 0, invoice.periodStart, fmt),
|
|
983
983
|
" - ",
|
|
984
|
-
|
|
984
|
+
_chunkXQEYBESHjs.formatDate.call(void 0, invoice.periodEnd, fmt)
|
|
985
985
|
] })
|
|
986
986
|
] }),
|
|
987
987
|
invoice.dueDate && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
988
988
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.due_date") }),
|
|
989
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm", children:
|
|
989
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm", children: _chunkXQEYBESHjs.formatDate.call(void 0, invoice.dueDate, fmt) })
|
|
990
990
|
] }),
|
|
991
991
|
invoice.paidAt && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
992
992
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.paid_date") }),
|
|
993
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm", children:
|
|
993
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm", children: _chunkXQEYBESHjs.formatDate.call(void 0, invoice.paidAt, fmt) })
|
|
994
994
|
] }),
|
|
995
995
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
996
996
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.attempt_count") }),
|
|
@@ -1006,42 +1006,42 @@ function InvoiceDetails({
|
|
|
1006
1006
|
] }) }),
|
|
1007
1007
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "tbody", { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "tr", { className: "border-t", children: [
|
|
1008
1008
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "td", { className: "p-3", children: productName }),
|
|
1009
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "td", { className: "p-3 text-end", children:
|
|
1009
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "td", { className: "p-3 text-end", children: _chunkGSHMGL6Njs.formatCurrency.call(void 0, invoice.subtotal, invoice.currency, fmt) })
|
|
1010
1010
|
] }) })
|
|
1011
1011
|
] }) })
|
|
1012
1012
|
] }),
|
|
1013
1013
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2 border-t pt-4", children: [
|
|
1014
1014
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1015
1015
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.subtotal") }),
|
|
1016
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children:
|
|
1016
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children: _chunkGSHMGL6Njs.formatCurrency.call(void 0, invoice.subtotal, invoice.currency, fmt) })
|
|
1017
1017
|
] }),
|
|
1018
1018
|
invoice.tax !== void 0 && invoice.tax > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1019
1019
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.tax") }),
|
|
1020
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children:
|
|
1020
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children: _chunkGSHMGL6Njs.formatCurrency.call(void 0, invoice.tax, invoice.currency, fmt) })
|
|
1021
1021
|
] }),
|
|
1022
1022
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between text-lg font-semibold border-t pt-2", children: [
|
|
1023
1023
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: t("billing.ui.invoice.total") }),
|
|
1024
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children:
|
|
1024
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _chunkGSHMGL6Njs.formatCurrency.call(void 0, invoice.total, invoice.currency, fmt) })
|
|
1025
1025
|
] }),
|
|
1026
1026
|
invoice.amountPaid > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1027
1027
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.amount_paid") }),
|
|
1028
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-success", children:
|
|
1028
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-success", children: _chunkGSHMGL6Njs.formatCurrency.call(void 0, invoice.amountPaid, invoice.currency, fmt) })
|
|
1029
1029
|
] }),
|
|
1030
1030
|
invoice.amountRemaining > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1031
1031
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.amount_due") }),
|
|
1032
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-destructive", children:
|
|
1032
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-destructive", children: _chunkGSHMGL6Njs.formatCurrency.call(void 0, invoice.amountRemaining, invoice.currency, fmt) })
|
|
1033
1033
|
] })
|
|
1034
1034
|
] }),
|
|
1035
1035
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2 pt-4 border-t", children: [
|
|
1036
|
-
invoice.stripePdfUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1036
|
+
invoice.stripePdfUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.Button, { variant: "outline", onClick: handleDownloadPDF, children: [
|
|
1037
1037
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Download, { className: "me-2 h-4 w-4" }),
|
|
1038
1038
|
t("billing.ui.invoice.download_pdf")
|
|
1039
1039
|
] }),
|
|
1040
|
-
invoice.status === "open" /* OPEN */ && invoice.attempted && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1040
|
+
invoice.status === "open" /* OPEN */ && invoice.attempted && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.Button, { variant: "default", onClick: handleRetryPayment, children: [
|
|
1041
1041
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RefreshCw, { className: "me-2 h-4 w-4" }),
|
|
1042
1042
|
t("billing.ui.invoice.retry_payment")
|
|
1043
1043
|
] }),
|
|
1044
|
-
invoice.stripeHostedInvoiceUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1044
|
+
invoice.stripeHostedInvoiceUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.Button, { variant: "outline", onClick: handleViewInStripe, children: [
|
|
1045
1045
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ExternalLink, { className: "me-2 h-4 w-4" }),
|
|
1046
1046
|
t("billing.ui.invoice.view_in_stripe")
|
|
1047
1047
|
] })
|
|
@@ -1055,7 +1055,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, InvoiceDetails, "InvoiceDetails");
|
|
|
1055
1055
|
|
|
1056
1056
|
function InvoicesList({ invoices, onInvoicesChange }) {
|
|
1057
1057
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1058
|
-
const fmt =
|
|
1058
|
+
const fmt = _chunkXQEYBESHjs.useBillingFormatOptions.call(void 0, );
|
|
1059
1059
|
const [selectedInvoice, setSelectedInvoice] = _react.useState.call(void 0, null);
|
|
1060
1060
|
const handleRowClick = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (invoice) => {
|
|
1061
1061
|
setSelectedInvoice(invoice);
|
|
@@ -1067,30 +1067,30 @@ function InvoicesList({ invoices, onInvoicesChange }) {
|
|
|
1067
1067
|
return invoice.stripeInvoiceId.slice(-8);
|
|
1068
1068
|
}, "getInvoiceNumber");
|
|
1069
1069
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1070
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1071
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1072
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1073
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1074
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1075
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1076
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1070
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.Table, { children: [
|
|
1071
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.TableRow, { children: [
|
|
1072
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.TableHead, { children: t("billing.ui.columns.invoice_number") }),
|
|
1073
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.TableHead, { children: t("billing.ui.columns.date") }),
|
|
1074
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.TableHead, { children: t("billing.ui.columns.status") }),
|
|
1075
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.TableHead, { className: "text-end", children: t("billing.ui.columns.amount") }),
|
|
1076
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.TableHead, { children: t("billing.ui.columns.period") })
|
|
1077
1077
|
] }) }),
|
|
1078
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1078
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.TableBody, { children: invoices.map((invoice) => {
|
|
1079
1079
|
const invoiceNumber = getInvoiceNumber(invoice);
|
|
1080
|
-
const date =
|
|
1081
|
-
const amount =
|
|
1082
|
-
const period = `${
|
|
1080
|
+
const date = _chunkXQEYBESHjs.formatDate.call(void 0, invoice.periodStart, fmt);
|
|
1081
|
+
const amount = _chunkGSHMGL6Njs.formatCurrency.call(void 0, invoice.total, invoice.currency, fmt);
|
|
1082
|
+
const period = `${_chunkXQEYBESHjs.formatDate.call(void 0, invoice.periodStart, fmt)} - ${_chunkXQEYBESHjs.formatDate.call(void 0, invoice.periodEnd, fmt)}`;
|
|
1083
1083
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1084
|
-
|
|
1084
|
+
_chunkXQEYBESHjs.TableRow,
|
|
1085
1085
|
{
|
|
1086
1086
|
onClick: () => handleRowClick(invoice),
|
|
1087
1087
|
className: "cursor-pointer hover:bg-muted/50",
|
|
1088
1088
|
children: [
|
|
1089
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1090
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1091
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1092
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1093
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1089
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.TableCell, { className: "font-medium", children: invoiceNumber }),
|
|
1090
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.TableCell, { className: "text-muted-foreground text-xs", children: date }),
|
|
1091
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InvoiceStatusBadge, { status: invoice.status }) }),
|
|
1092
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.TableCell, { className: "text-end font-medium", children: amount }),
|
|
1093
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.TableCell, { className: "text-muted-foreground text-xs", children: period })
|
|
1094
1094
|
]
|
|
1095
1095
|
},
|
|
1096
1096
|
invoice.id
|
|
@@ -1124,7 +1124,7 @@ function InvoicesContainer() {
|
|
|
1124
1124
|
setLoading(true);
|
|
1125
1125
|
try {
|
|
1126
1126
|
const params = statusFilter !== "all" ? { status: statusFilter } : void 0;
|
|
1127
|
-
const data = await
|
|
1127
|
+
const data = await _chunkGSHMGL6Njs.StripeInvoiceService.listInvoices(params);
|
|
1128
1128
|
setInvoices(data);
|
|
1129
1129
|
} catch (error) {
|
|
1130
1130
|
console.error("[InvoicesContainer] Failed to load invoices:", error);
|
|
@@ -1140,12 +1140,12 @@ function InvoicesContainer() {
|
|
|
1140
1140
|
setStatusFilter(value);
|
|
1141
1141
|
}, "handleFilterChange");
|
|
1142
1142
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-4", children: [
|
|
1143
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1144
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1145
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1146
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1147
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1148
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1143
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Tabs, { value: statusFilter, onValueChange: handleFilterChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.TabsList, { children: [
|
|
1144
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.TabsTrigger, { value: "all", children: t("billing.ui.invoices.filter_all") }),
|
|
1145
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.TabsTrigger, { value: "paid" /* PAID */, children: t("billing.ui.invoice_status.paid") }),
|
|
1146
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.TabsTrigger, { value: "open" /* OPEN */, children: t("billing.ui.invoice_status.open") }),
|
|
1147
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.TabsTrigger, { value: "void" /* VOID */, children: t("billing.ui.invoice_status.void") }),
|
|
1148
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.TabsTrigger, { value: "uncollectible" /* UNCOLLECTIBLE */, children: t("billing.ui.invoice_status.uncollectible") })
|
|
1149
1149
|
] }) }),
|
|
1150
1150
|
loading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-center py-8 text-muted-foreground", children: t("billing.ui.invoices.loading") }),
|
|
1151
1151
|
!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: [
|
|
@@ -1187,7 +1187,7 @@ function CancelSubscriptionDialog({
|
|
|
1187
1187
|
onSuccess
|
|
1188
1188
|
}) {
|
|
1189
1189
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1190
|
-
const fmt =
|
|
1190
|
+
const fmt = _chunkXQEYBESHjs.useBillingFormatOptions.call(void 0, );
|
|
1191
1191
|
const [isSubmitting, setIsSubmitting] = _react.useState.call(void 0, false);
|
|
1192
1192
|
const form = _reacthookform.useForm.call(void 0, {
|
|
1193
1193
|
resolver: _zod.zodResolver.call(void 0, formSchema),
|
|
@@ -1198,7 +1198,7 @@ function CancelSubscriptionDialog({
|
|
|
1198
1198
|
const onSubmit = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async (_values) => {
|
|
1199
1199
|
setIsSubmitting(true);
|
|
1200
1200
|
try {
|
|
1201
|
-
await
|
|
1201
|
+
await _chunkGSHMGL6Njs.StripeSubscriptionService.cancelSubscription({
|
|
1202
1202
|
id: subscription.id,
|
|
1203
1203
|
cancelImmediately: false
|
|
1204
1204
|
});
|
|
@@ -1210,16 +1210,16 @@ function CancelSubscriptionDialog({
|
|
|
1210
1210
|
setIsSubmitting(false);
|
|
1211
1211
|
}
|
|
1212
1212
|
}, "onSubmit");
|
|
1213
|
-
const periodEndDate =
|
|
1214
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1215
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1216
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1217
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1213
|
+
const periodEndDate = _chunkXQEYBESHjs.formatDate.call(void 0, subscription.currentPeriodEnd, fmt);
|
|
1214
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.DialogContent, { className: "max-w-md", children: [
|
|
1215
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.DialogHeader, { children: [
|
|
1216
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.DialogTitle, { children: t("billing.ui.subscription.cancel.title") }),
|
|
1217
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.DialogDescription, { children: t("billing.ui.subscription.cancel.description") })
|
|
1218
1218
|
] }),
|
|
1219
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1219
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-col gap-y-4", children: [
|
|
1220
1220
|
/* @__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 }) }),
|
|
1221
1221
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1222
|
-
|
|
1222
|
+
_chunkXQEYBESHjs.FormTextarea,
|
|
1223
1223
|
{
|
|
1224
1224
|
form,
|
|
1225
1225
|
id: "reason",
|
|
@@ -1229,8 +1229,8 @@ function CancelSubscriptionDialog({
|
|
|
1229
1229
|
}
|
|
1230
1230
|
),
|
|
1231
1231
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-x-2 justify-end pt-2", children: [
|
|
1232
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1233
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1232
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Button, { type: "button", variant: "outline", onClick: () => onOpenChange(false), disabled: isSubmitting, children: t("billing.ui.subscription.cancel.keep") }),
|
|
1233
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Button, { type: "submit", variant: "destructive", disabled: isSubmitting, children: isSubmitting ? t("billing.ui.subscription.cancel.canceling") : t("billing.ui.subscription.cancel.confirm") })
|
|
1234
1234
|
] })
|
|
1235
1235
|
] }) })
|
|
1236
1236
|
] }) });
|
|
@@ -1281,7 +1281,7 @@ var cancelingConfig = {
|
|
|
1281
1281
|
function SubscriptionStatusBadge({ status, cancelAtPeriodEnd }) {
|
|
1282
1282
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1283
1283
|
const config = cancelAtPeriodEnd ? cancelingConfig : statusConfig2[status] || statusConfig2["canceled" /* CANCELED */];
|
|
1284
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1284
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Badge, { variant: config.variant, children: t(config.label) });
|
|
1285
1285
|
}
|
|
1286
1286
|
_chunk7QVYU63Ejs.__name.call(void 0, SubscriptionStatusBadge, "SubscriptionStatusBadge");
|
|
1287
1287
|
|
|
@@ -1308,7 +1308,7 @@ function formatPlanName2(price, t) {
|
|
|
1308
1308
|
_chunk7QVYU63Ejs.__name.call(void 0, formatPlanName2, "formatPlanName");
|
|
1309
1309
|
function formatBillingAmount(price, notAvailable, fmt) {
|
|
1310
1310
|
if (!_optionalChain([price, 'optionalAccess', _37 => _37.unitAmount])) return notAvailable;
|
|
1311
|
-
return
|
|
1311
|
+
return _chunkGSHMGL6Njs.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt);
|
|
1312
1312
|
}
|
|
1313
1313
|
_chunk7QVYU63Ejs.__name.call(void 0, formatBillingAmount, "formatBillingAmount");
|
|
1314
1314
|
function SubscriptionDetails({
|
|
@@ -1319,11 +1319,11 @@ function SubscriptionDetails({
|
|
|
1319
1319
|
onChangePlan
|
|
1320
1320
|
}) {
|
|
1321
1321
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1322
|
-
const fmt =
|
|
1322
|
+
const fmt = _chunkXQEYBESHjs.useBillingFormatOptions.call(void 0, );
|
|
1323
1323
|
const [showCancel, setShowCancel] = _react.useState.call(void 0, false);
|
|
1324
1324
|
const handleManageViaPortal = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1325
1325
|
try {
|
|
1326
|
-
const { url } = await
|
|
1326
|
+
const { url } = await _chunkGSHMGL6Njs.StripeCustomerService.createPortalSession();
|
|
1327
1327
|
window.open(url, "_blank");
|
|
1328
1328
|
} catch (error) {
|
|
1329
1329
|
console.error("[SubscriptionDetails] Failed to create portal session:", error);
|
|
@@ -1331,10 +1331,10 @@ function SubscriptionDetails({
|
|
|
1331
1331
|
}, "handleManageViaPortal");
|
|
1332
1332
|
const canCancel = subscription.status === "active" /* ACTIVE */ || subscription.status === "trialing" /* TRIALING */ || subscription.status === "paused" /* PAUSED */;
|
|
1333
1333
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1334
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1335
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1336
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1337
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1334
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.DialogContent, { className: "max-w-2xl", children: [
|
|
1335
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.DialogHeader, { children: [
|
|
1336
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.DialogTitle, { children: t("billing.ui.subscription.details_title") }),
|
|
1337
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.DialogDescription, { children: t("billing.ui.subscription.details_description") })
|
|
1338
1338
|
] }),
|
|
1339
1339
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
1340
1340
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
@@ -1360,22 +1360,22 @@ function SubscriptionDetails({
|
|
|
1360
1360
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "space-y-2", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1361
1361
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.subscription.current_period") }),
|
|
1362
1362
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "text-sm", children: [
|
|
1363
|
-
|
|
1363
|
+
_chunkXQEYBESHjs.formatDate.call(void 0, subscription.currentPeriodStart, fmt),
|
|
1364
1364
|
" - ",
|
|
1365
|
-
|
|
1365
|
+
_chunkXQEYBESHjs.formatDate.call(void 0, subscription.currentPeriodEnd, fmt)
|
|
1366
1366
|
] })
|
|
1367
1367
|
] }) }),
|
|
1368
1368
|
subscription.trialEnd && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1369
1369
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.subscription.trial_ends") }),
|
|
1370
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children:
|
|
1370
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children: _chunkXQEYBESHjs.formatDate.call(void 0, subscription.trialEnd, fmt) })
|
|
1371
1371
|
] }),
|
|
1372
1372
|
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", {
|
|
1373
|
-
date:
|
|
1373
|
+
date: _chunkXQEYBESHjs.formatDate.call(void 0, subscription.currentPeriodEnd, fmt)
|
|
1374
1374
|
}) }) }),
|
|
1375
1375
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2 pt-4 border-t", children: [
|
|
1376
|
-
onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1377
|
-
canCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1378
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1376
|
+
onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Button, { variant: "default", onClick: () => onChangePlan(subscription), children: t("billing.ui.subscription.change_plan") }),
|
|
1377
|
+
canCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Button, { variant: "destructive", onClick: () => setShowCancel(true), children: t("ui.buttons.cancel") }),
|
|
1378
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Button, { variant: "outline", onClick: handleManageViaPortal, children: t("billing.ui.subscription.manage_portal") })
|
|
1379
1379
|
] })
|
|
1380
1380
|
] })
|
|
1381
1381
|
] }) }),
|
|
@@ -1418,46 +1418,46 @@ function formatPlanName3(price, t) {
|
|
|
1418
1418
|
_chunk7QVYU63Ejs.__name.call(void 0, formatPlanName3, "formatPlanName");
|
|
1419
1419
|
function SubscriptionsList({ subscriptions, onSubscriptionsChange, onChangePlan }) {
|
|
1420
1420
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1421
|
-
const fmt =
|
|
1421
|
+
const fmt = _chunkXQEYBESHjs.useBillingFormatOptions.call(void 0, );
|
|
1422
1422
|
const [selectedSub, setSelectedSub] = _react.useState.call(void 0, null);
|
|
1423
1423
|
const handleRowClick = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (subscription) => {
|
|
1424
1424
|
setSelectedSub(subscription);
|
|
1425
1425
|
}, "handleRowClick");
|
|
1426
1426
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1427
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1428
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1429
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1430
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1431
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1432
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1433
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1427
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.Table, { children: [
|
|
1428
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.TableRow, { children: [
|
|
1429
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.TableHead, { children: t("billing.ui.columns.status") }),
|
|
1430
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.TableHead, { children: t("billing.ui.columns.plan") }),
|
|
1431
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.TableHead, { children: t("billing.ui.columns.period") }),
|
|
1432
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.TableHead, { className: "text-end", children: t("billing.ui.columns.amount") }),
|
|
1433
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.TableHead, { className: "text-end", children: t("billing.ui.columns.actions") })
|
|
1434
1434
|
] }) }),
|
|
1435
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1435
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.TableBody, { children: subscriptions.map((subscription) => {
|
|
1436
1436
|
const price = subscription.price;
|
|
1437
|
-
const amount = _optionalChain([price, 'optionalAccess', _42 => _42.unitAmount]) ?
|
|
1438
|
-
const discountedAmount = price ?
|
|
1439
|
-
const period = `${
|
|
1437
|
+
const amount = _optionalChain([price, 'optionalAccess', _42 => _42.unitAmount]) ? _chunkGSHMGL6Njs.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt) : "0";
|
|
1438
|
+
const discountedAmount = price ? _chunkXQEYBESHjs.applyDiscount.call(void 0, price.unitAmount, _chunkXQEYBESHjs.subscriptionDiscount.call(void 0, subscription)) : null;
|
|
1439
|
+
const period = `${_chunkXQEYBESHjs.formatDate.call(void 0, subscription.currentPeriodStart, fmt)} - ${_chunkXQEYBESHjs.formatDate.call(void 0, subscription.currentPeriodEnd, fmt)}`;
|
|
1440
1440
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1441
|
-
|
|
1441
|
+
_chunkXQEYBESHjs.TableRow,
|
|
1442
1442
|
{
|
|
1443
1443
|
onClick: () => handleRowClick(subscription),
|
|
1444
1444
|
className: "cursor-pointer hover:bg-muted/50",
|
|
1445
1445
|
children: [
|
|
1446
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1446
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1447
1447
|
SubscriptionStatusBadge,
|
|
1448
1448
|
{
|
|
1449
1449
|
status: subscription.status,
|
|
1450
1450
|
cancelAtPeriodEnd: subscription.cancelAtPeriodEnd
|
|
1451
1451
|
}
|
|
1452
1452
|
) }),
|
|
1453
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1454
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1455
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1453
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.TableCell, { className: "font-medium", children: formatPlanName3(price, t) }),
|
|
1454
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.TableCell, { className: "text-muted-foreground text-sm", children: period }),
|
|
1455
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.TableCell, { className: "text-end font-medium", children: discountedAmount !== null && price ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1456
1456
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "line-through text-muted-foreground me-2", children: amount }),
|
|
1457
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success", children:
|
|
1457
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success", children: _chunkGSHMGL6Njs.formatCurrency.call(void 0, discountedAmount, price.currency, fmt) })
|
|
1458
1458
|
] }) : amount }),
|
|
1459
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1460
|
-
|
|
1459
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.TableCell, { className: "text-end", children: (subscription.status === "active" /* ACTIVE */ || subscription.status === "trialing" /* TRIALING */) && onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1460
|
+
_chunkXQEYBESHjs.Button,
|
|
1461
1461
|
{
|
|
1462
1462
|
size: "sm",
|
|
1463
1463
|
variant: "outline",
|
|
@@ -1515,7 +1515,7 @@ function SubscriptionsContainer({
|
|
|
1515
1515
|
}
|
|
1516
1516
|
setLoading(true);
|
|
1517
1517
|
try {
|
|
1518
|
-
const fetchedSubscriptions = await
|
|
1518
|
+
const fetchedSubscriptions = await _chunkGSHMGL6Njs.StripeSubscriptionService.listSubscriptions();
|
|
1519
1519
|
setSubscriptions(fetchedSubscriptions);
|
|
1520
1520
|
} catch (error) {
|
|
1521
1521
|
console.error("[SubscriptionsContainer] Failed to load subscriptions:", error);
|
|
@@ -1538,7 +1538,7 @@ function SubscriptionsContainer({
|
|
|
1538
1538
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8" }),
|
|
1539
1539
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: t("billing.ui.subscriptions.title") })
|
|
1540
1540
|
] }),
|
|
1541
|
-
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1541
|
+
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _44 => _44()]), children: hasActiveRecurringSubscription ? t("billing.ui.subscriptions.purchase_addons") : t("billing.ui.subscriptions.subscribe") })
|
|
1542
1542
|
] }),
|
|
1543
1543
|
criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BillingAlertBanner, { subscription }, subscription.id)),
|
|
1544
1544
|
subscriptions.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col items-center justify-center py-12 space-y-4", children: [
|
|
@@ -1546,7 +1546,7 @@ function SubscriptionsContainer({
|
|
|
1546
1546
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
1547
1547
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium mb-2", children: t("billing.ui.subscriptions.empty_title") }),
|
|
1548
1548
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground mb-6", children: t("billing.ui.subscriptions.empty_description") }),
|
|
1549
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1549
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _45 => _45()]), children: t("billing.ui.subscriptions.subscribe") })
|
|
1550
1550
|
] })
|
|
1551
1551
|
] }),
|
|
1552
1552
|
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -1569,9 +1569,9 @@ function IntervalToggle({ value, onChange, hasMonthly, hasYearly }) {
|
|
|
1569
1569
|
if (!hasMonthly || !hasYearly) {
|
|
1570
1570
|
return null;
|
|
1571
1571
|
}
|
|
1572
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1573
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1574
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1572
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Tabs, { value, onValueChange: (v) => onChange(v), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.TabsList, { children: [
|
|
1573
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.TabsTrigger, { value: "month", children: t("billing.admin.prices.interval.month") }),
|
|
1574
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.TabsTrigger, { value: "year", children: t("billing.admin.prices.interval.year") })
|
|
1575
1575
|
] }) });
|
|
1576
1576
|
}
|
|
1577
1577
|
_chunk7QVYU63Ejs.__name.call(void 0, IntervalToggle, "IntervalToggle");
|
|
@@ -1589,11 +1589,11 @@ function PricingCard({
|
|
|
1589
1589
|
onSelect
|
|
1590
1590
|
}) {
|
|
1591
1591
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1592
|
-
const fmt =
|
|
1592
|
+
const fmt = _chunkXQEYBESHjs.useBillingFormatOptions.call(void 0, );
|
|
1593
1593
|
const description = price.description || price.nickname || t("billing.ui.pricing.standard");
|
|
1594
1594
|
const features = price.features || [];
|
|
1595
|
-
const formattedPrice =
|
|
1596
|
-
const interval =
|
|
1595
|
+
const formattedPrice = _chunkGSHMGL6Njs.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt);
|
|
1596
|
+
const interval = _chunkGSHMGL6Njs.formatInterval.call(void 0, price, fmt);
|
|
1597
1597
|
const handleKeyDown = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (e) => {
|
|
1598
1598
|
if ((e.key === "Enter" || e.key === " ") && !isDisabled && !isCurrentPlan) {
|
|
1599
1599
|
e.preventDefault();
|
|
@@ -1606,7 +1606,7 @@ function PricingCard({
|
|
|
1606
1606
|
}
|
|
1607
1607
|
}, "handleClick");
|
|
1608
1608
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1609
|
-
|
|
1609
|
+
_chunkXQEYBESHjs.Card,
|
|
1610
1610
|
{
|
|
1611
1611
|
role: "radio",
|
|
1612
1612
|
"aria-checked": isSelected,
|
|
@@ -1614,7 +1614,7 @@ function PricingCard({
|
|
|
1614
1614
|
tabIndex: isDisabled ? -1 : 0,
|
|
1615
1615
|
onKeyDown: handleKeyDown,
|
|
1616
1616
|
onClick: handleClick,
|
|
1617
|
-
className:
|
|
1617
|
+
className: _chunkGSHMGL6Njs.cn.call(void 0,
|
|
1618
1618
|
"relative cursor-pointer transition-all duration-200 flex flex-col h-full",
|
|
1619
1619
|
"focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
1620
1620
|
isCurrentPlan && "bg-muted/30",
|
|
@@ -1624,9 +1624,9 @@ function PricingCard({
|
|
|
1624
1624
|
isLoading && "pointer-events-none"
|
|
1625
1625
|
),
|
|
1626
1626
|
children: [
|
|
1627
|
-
isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1628
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1629
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1627
|
+
isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Badge, { variant: "secondary", className: "absolute top-2 end-2", children: t("billing.ui.pricing.current") }),
|
|
1628
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.CardHeader, { className: "pb-2", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium", children: description }) }),
|
|
1629
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.CardContent, { className: "pb-4 grow", children: [
|
|
1630
1630
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mb-4", children: [
|
|
1631
1631
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-3xl font-bold", children: formattedPrice }),
|
|
1632
1632
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground ms-1", children: interval })
|
|
@@ -1636,8 +1636,8 @@ function PricingCard({
|
|
|
1636
1636
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-muted-foreground", children: feature })
|
|
1637
1637
|
] }, index)) })
|
|
1638
1638
|
] }),
|
|
1639
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1640
|
-
|
|
1639
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.CardFooter, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1640
|
+
_chunkXQEYBESHjs.Button,
|
|
1641
1641
|
{
|
|
1642
1642
|
variant: isCurrentPlan ? "secondary" : isSelected ? "default" : "outline",
|
|
1643
1643
|
className: "w-full",
|
|
@@ -1670,7 +1670,7 @@ function ProductPricingRow({
|
|
|
1670
1670
|
return null;
|
|
1671
1671
|
}
|
|
1672
1672
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-3", children: [
|
|
1673
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1673
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.SectionHeader, { children: product.name }),
|
|
1674
1674
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1675
1675
|
"div",
|
|
1676
1676
|
{
|
|
@@ -1771,15 +1771,15 @@ function ProductPricingList({
|
|
|
1771
1771
|
_chunk7QVYU63Ejs.__name.call(void 0, ProductPricingList, "ProductPricingList");
|
|
1772
1772
|
function ProductPricingListSkeleton() {
|
|
1773
1773
|
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: [
|
|
1774
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1774
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Skeleton, { className: "h-6 w-32" }),
|
|
1775
1775
|
/* @__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: [
|
|
1776
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1777
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1776
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Skeleton, { className: "h-6 w-24" }),
|
|
1777
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Skeleton, { className: "h-8 w-32" }),
|
|
1778
1778
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
1779
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1780
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1779
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Skeleton, { className: "h-4 w-full" }),
|
|
1780
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Skeleton, { className: "h-4 w-3/4" })
|
|
1781
1781
|
] }),
|
|
1782
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1782
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Skeleton, { className: "h-10 w-full" })
|
|
1783
1783
|
] }, cardIndex)) })
|
|
1784
1784
|
] }, rowIndex)) });
|
|
1785
1785
|
}
|
|
@@ -1790,21 +1790,21 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductPricingListSkeleton, "ProductPricing
|
|
|
1790
1790
|
|
|
1791
1791
|
function ProrationPreview({ preview }) {
|
|
1792
1792
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1793
|
-
const fmt =
|
|
1793
|
+
const fmt = _chunkXQEYBESHjs.useBillingFormatOptions.call(void 0, );
|
|
1794
1794
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-primary/10 border-primary/30 rounded-lg border p-4", children: [
|
|
1795
1795
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "text-primary mb-3 font-semibold", children: t("billing.ui.proration.title") }),
|
|
1796
1796
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
1797
1797
|
preview.lineItems.map((item, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between text-sm", children: [
|
|
1798
1798
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground", children: item.description }),
|
|
1799
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `font-medium ${item.amount < 0 ? "text-success" : "text-foreground"}`, children:
|
|
1799
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `font-medium ${item.amount < 0 ? "text-success" : "text-foreground"}`, children: _chunkGSHMGL6Njs.formatCurrency.call(void 0, item.amount, preview.currency, fmt) })
|
|
1800
1800
|
] }, index)),
|
|
1801
1801
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border-primary/30 mt-2 border-t pt-2", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between font-semibold", children: [
|
|
1802
1802
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-foreground", children: t("billing.ui.proration.net_due_today") }),
|
|
1803
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-foreground", children:
|
|
1803
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-foreground", children: _chunkGSHMGL6Njs.formatCurrency.call(void 0, preview.immediateCharge, preview.currency, fmt) })
|
|
1804
1804
|
] }) }),
|
|
1805
1805
|
preview.lineItems.length > 0 && preview.lineItems[0].period && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-muted-foreground mt-2 text-xs", children: t("billing.ui.proration.next_invoice", {
|
|
1806
|
-
date:
|
|
1807
|
-
amount:
|
|
1806
|
+
date: _chunkXQEYBESHjs.formatDate.call(void 0, preview.lineItems[0].period.end, fmt),
|
|
1807
|
+
amount: _chunkGSHMGL6Njs.formatCurrency.call(void 0, preview.amountDue, preview.currency, fmt)
|
|
1808
1808
|
}) })
|
|
1809
1809
|
] })
|
|
1810
1810
|
] });
|
|
@@ -1817,7 +1817,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProrationPreview, "ProrationPreview");
|
|
|
1817
1817
|
|
|
1818
1818
|
function SubscriptionConfirmation({ price, isLoading, onConfirm, onCancel }) {
|
|
1819
1819
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1820
|
-
const fmt =
|
|
1820
|
+
const fmt = _chunkXQEYBESHjs.useBillingFormatOptions.call(void 0, );
|
|
1821
1821
|
const productName = _optionalChain([price, 'access', _51 => _51.product, 'optionalAccess', _52 => _52.name]) || price.nickname || t("billing.ui.wizard.review.selected_plan");
|
|
1822
1822
|
const productDescription = _optionalChain([price, 'access', _53 => _53.product, 'optionalAccess', _54 => _54.description]) || price.description;
|
|
1823
1823
|
const features = price.features || [];
|
|
@@ -1829,16 +1829,16 @@ function SubscriptionConfirmation({ price, isLoading, onConfirm, onCancel }) {
|
|
|
1829
1829
|
productDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-sm text-muted-foreground", children: productDescription })
|
|
1830
1830
|
] }),
|
|
1831
1831
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-lg font-semibold", children: [
|
|
1832
|
-
|
|
1833
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-normal text-muted-foreground", children:
|
|
1832
|
+
_chunkGSHMGL6Njs.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt),
|
|
1833
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-normal text-muted-foreground", children: _chunkGSHMGL6Njs.formatInterval.call(void 0, price, fmt) })
|
|
1834
1834
|
] }),
|
|
1835
1835
|
features.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "space-y-1", children: features.map((feature, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2 text-sm ", children: [
|
|
1836
1836
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Check, { className: "h-4 w-4 text-primary" }),
|
|
1837
1837
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: feature })
|
|
1838
1838
|
] }, index)) }),
|
|
1839
1839
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-3 pt-2 border-t border-accent/30", children: [
|
|
1840
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1841
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1840
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Button, { variant: "outline", onClick: onCancel, disabled: isLoading, children: t("ui.buttons.cancel") }),
|
|
1841
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Button, { onClick: onConfirm, disabled: isLoading, children: isLoading ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1842
1842
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "h-4 w-4 animate-spin me-2" }),
|
|
1843
1843
|
t("billing.ui.wizard.review.processing")
|
|
1844
1844
|
] }) : t("billing.ui.confirmation.subscribe") })
|
|
@@ -2017,7 +2017,7 @@ function wizardReducer(state, action) {
|
|
|
2017
2017
|
_chunk7QVYU63Ejs.__name.call(void 0, wizardReducer, "wizardReducer");
|
|
2018
2018
|
function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
2019
2019
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2020
|
-
const locale =
|
|
2020
|
+
const locale = _chunkGSHMGL6Njs.useI18nLocale.call(void 0, );
|
|
2021
2021
|
const { confirmPayment } = useConfirmSubscriptionPayment();
|
|
2022
2022
|
const [state, dispatch] = _react.useReducer.call(void 0, wizardReducer, {
|
|
2023
2023
|
...initialState,
|
|
@@ -2029,7 +2029,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2029
2029
|
onCloseRef.current = onClose;
|
|
2030
2030
|
const checkPaymentMethod = _react.useCallback.call(void 0, async () => {
|
|
2031
2031
|
try {
|
|
2032
|
-
const methods = await
|
|
2032
|
+
const methods = await _chunkGSHMGL6Njs.StripeCustomerService.listPaymentMethods();
|
|
2033
2033
|
dispatch({ type: "SET_HAS_PAYMENT_METHOD", hasMethod: methods.length > 0 });
|
|
2034
2034
|
} catch (error) {
|
|
2035
2035
|
console.error("[useSubscriptionWizard] Failed to check payment methods:", error);
|
|
@@ -2047,10 +2047,10 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2047
2047
|
}, []);
|
|
2048
2048
|
const lookUpAutomaticCode = _react.useCallback.call(void 0, async (priceId) => {
|
|
2049
2049
|
try {
|
|
2050
|
-
const automaticCode = await
|
|
2050
|
+
const automaticCode = await _chunkGSHMGL6Njs.StripeCouponCodeService.findAutomatic({ priceId });
|
|
2051
2051
|
dispatch({
|
|
2052
2052
|
type: "SET_PROMOTION_CODE",
|
|
2053
|
-
code: automaticCode ?
|
|
2053
|
+
code: automaticCode ? _chunkGSHMGL6Njs.toPromotionCodeResult.call(void 0, automaticCode) : null
|
|
2054
2054
|
});
|
|
2055
2055
|
return true;
|
|
2056
2056
|
} catch (error) {
|
|
@@ -2077,7 +2077,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2077
2077
|
const isTrialUpgrade = _optionalChain([subscription, 'optionalAccess', _61 => _61.status]) === "trialing" /* TRIALING */;
|
|
2078
2078
|
dispatch({ type: "SET_IS_TRIAL_SUBSCRIPTION", isTrial: isTrialUpgrade });
|
|
2079
2079
|
if (isTrialUpgrade && !state.hasPaymentMethod) {
|
|
2080
|
-
const methods = await
|
|
2080
|
+
const methods = await _chunkGSHMGL6Njs.StripeCustomerService.listPaymentMethods();
|
|
2081
2081
|
if (methods.length === 0) {
|
|
2082
2082
|
dispatch({ type: "SET_STEP", step: "payment-method" });
|
|
2083
2083
|
dispatch({
|
|
@@ -2095,7 +2095,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2095
2095
|
}
|
|
2096
2096
|
}
|
|
2097
2097
|
if (subscription && state.selectedPrice.id !== _optionalChain([subscription, 'access', _62 => _62.price, 'optionalAccess', _63 => _63.id])) {
|
|
2098
|
-
const preview = await
|
|
2098
|
+
const preview = await _chunkGSHMGL6Njs.StripeSubscriptionService.getProrationPreview({
|
|
2099
2099
|
subscriptionId: subscription.id,
|
|
2100
2100
|
newPriceId: state.selectedPrice.id
|
|
2101
2101
|
});
|
|
@@ -2129,14 +2129,14 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2129
2129
|
newPriceId: state.selectedPrice.id,
|
|
2130
2130
|
promotionCode: promotionCodeToSend(state.promotionCode)
|
|
2131
2131
|
};
|
|
2132
|
-
result = await
|
|
2132
|
+
result = await _chunkGSHMGL6Njs.StripeSubscriptionService.changePlanWithMeta(changePlanParams);
|
|
2133
2133
|
} else {
|
|
2134
2134
|
const createParams = {
|
|
2135
2135
|
id: _uuid.v4.call(void 0, ),
|
|
2136
2136
|
priceId: state.selectedPrice.id,
|
|
2137
2137
|
promotionCode: promotionCodeToSend(state.promotionCode)
|
|
2138
2138
|
};
|
|
2139
|
-
result = await
|
|
2139
|
+
result = await _chunkGSHMGL6Njs.StripeSubscriptionService.createSubscription(createParams);
|
|
2140
2140
|
}
|
|
2141
2141
|
const clientSecret = clientSecretToConfirm(result.meta);
|
|
2142
2142
|
if (clientSecret) {
|
|
@@ -2152,7 +2152,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2152
2152
|
const subscriptionId = subscriptionIdToSync(result.subscription, subscription);
|
|
2153
2153
|
if (subscriptionId) {
|
|
2154
2154
|
try {
|
|
2155
|
-
await
|
|
2155
|
+
await _chunkGSHMGL6Njs.StripeSubscriptionService.syncSubscription({ subscriptionId });
|
|
2156
2156
|
} catch (syncError) {
|
|
2157
2157
|
console.error("[useSubscriptionWizard] Subscription sync after payment failed:", syncError);
|
|
2158
2158
|
}
|
|
@@ -2200,7 +2200,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2200
2200
|
dispatch({ type: "SET_VALIDATING_PROMO_CODE", isValidating: true });
|
|
2201
2201
|
dispatch({ type: "SET_PROMO_CODE_ERROR", error: null });
|
|
2202
2202
|
try {
|
|
2203
|
-
const result = await
|
|
2203
|
+
const result = await _chunkGSHMGL6Njs.StripePromotionCodeService.validatePromotionCode({
|
|
2204
2204
|
code,
|
|
2205
2205
|
stripePriceId: _optionalChain([state, 'access', _72 => _72.selectedPrice, 'optionalAccess', _73 => _73.id]),
|
|
2206
2206
|
language: locale
|
|
@@ -2325,7 +2325,7 @@ function WizardStepPlanSelection({
|
|
|
2325
2325
|
_react.useEffect.call(void 0, () => {
|
|
2326
2326
|
const loadProducts = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2327
2327
|
try {
|
|
2328
|
-
const fetchedProducts = await
|
|
2328
|
+
const fetchedProducts = await _chunkGSHMGL6Njs.StripeProductService.listProducts({ active: true });
|
|
2329
2329
|
setProducts(fetchedProducts);
|
|
2330
2330
|
} catch (error) {
|
|
2331
2331
|
console.error("[WizardStepPlanSelection] Failed to load products:", error);
|
|
@@ -2376,7 +2376,7 @@ function WizardStepPlanSelection({
|
|
|
2376
2376
|
onSelectPrice: handleSelectPrice
|
|
2377
2377
|
}
|
|
2378
2378
|
),
|
|
2379
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex justify-end pt-4 border-t", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2379
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex justify-end pt-4 border-t", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Button, { onClick: onNext, disabled: !selectedPrice || isProcessing, children: isProcessing ? t("common.loading") : t("billing.ui.wizard.next_review") }) })
|
|
2380
2380
|
] });
|
|
2381
2381
|
}
|
|
2382
2382
|
_chunk7QVYU63Ejs.__name.call(void 0, WizardStepPlanSelection, "WizardStepPlanSelection");
|
|
@@ -2400,7 +2400,7 @@ function PromoCodeInput({
|
|
|
2400
2400
|
disabled = false
|
|
2401
2401
|
}) {
|
|
2402
2402
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2403
|
-
const locale =
|
|
2403
|
+
const locale = _chunkGSHMGL6Njs.useI18nLocale.call(void 0, );
|
|
2404
2404
|
const [code, setCode] = _react.useState.call(void 0, "");
|
|
2405
2405
|
const appliedKey = _optionalChain([appliedCode, 'optionalAccess', _82 => _82.valid]) ? `${appliedCode.automatic ? "auto" : "typed"}:${_nullishCoalesce(appliedCode.code, () => ( ""))}` : null;
|
|
2406
2406
|
const [previousAppliedKey, setPreviousAppliedKey] = _react.useState.call(void 0, appliedKey);
|
|
@@ -2429,7 +2429,7 @@ function PromoCodeInput({
|
|
|
2429
2429
|
}
|
|
2430
2430
|
const amount = (result.discountValue || 0) / 100;
|
|
2431
2431
|
const currency = _optionalChain([result, 'access', _83 => _83.currency, 'optionalAccess', _84 => _84.toUpperCase, 'call', _85 => _85()]) || "USD";
|
|
2432
|
-
return t("billing.ui.wizard.review.amount_off", { amount: `${currency} ${
|
|
2432
|
+
return t("billing.ui.wizard.review.amount_off", { amount: `${currency} ${_chunkGSHMGL6Njs.formatFixed.call(void 0, amount, locale, 2)}` });
|
|
2433
2433
|
}, "formatDiscount");
|
|
2434
2434
|
const formatDuration = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (result) => {
|
|
2435
2435
|
switch (result.duration) {
|
|
@@ -2446,7 +2446,7 @@ function PromoCodeInput({
|
|
|
2446
2446
|
const codeInput = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
2447
2447
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
|
|
2448
2448
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2449
|
-
|
|
2449
|
+
_chunkXQEYBESHjs.Input,
|
|
2450
2450
|
{
|
|
2451
2451
|
placeholder: t("billing.ui.promo_code.placeholder"),
|
|
2452
2452
|
value: code,
|
|
@@ -2456,7 +2456,7 @@ function PromoCodeInput({
|
|
|
2456
2456
|
className: "flex-1"
|
|
2457
2457
|
}
|
|
2458
2458
|
),
|
|
2459
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2459
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.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") })
|
|
2460
2460
|
] }),
|
|
2461
2461
|
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error })
|
|
2462
2462
|
] });
|
|
@@ -2485,7 +2485,7 @@ function PromoCodeInput({
|
|
|
2485
2485
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success text-sm", children: formatDiscount(appliedCode) })
|
|
2486
2486
|
] }),
|
|
2487
2487
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2488
|
-
|
|
2488
|
+
_chunkXQEYBESHjs.Button,
|
|
2489
2489
|
{
|
|
2490
2490
|
variant: "ghost",
|
|
2491
2491
|
size: "sm",
|
|
@@ -2533,7 +2533,7 @@ function WizardStepReview({
|
|
|
2533
2533
|
isTrialUpgrade
|
|
2534
2534
|
}) {
|
|
2535
2535
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2536
|
-
const fmt =
|
|
2536
|
+
const fmt = _chunkXQEYBESHjs.useBillingFormatOptions.call(void 0, );
|
|
2537
2537
|
const [card, setCard] = _react.useState.call(void 0, null);
|
|
2538
2538
|
_react.useEffect.call(void 0, () => {
|
|
2539
2539
|
if (!hasPaymentMethod) {
|
|
@@ -2541,7 +2541,7 @@ function WizardStepReview({
|
|
|
2541
2541
|
return;
|
|
2542
2542
|
}
|
|
2543
2543
|
let cancelled = false;
|
|
2544
|
-
Promise.all([
|
|
2544
|
+
Promise.all([_chunkGSHMGL6Njs.StripeCustomerService.listPaymentMethods(), _chunkGSHMGL6Njs.StripeCustomerService.getCustomer()]).then(([methods, customer]) => {
|
|
2545
2545
|
if (!cancelled) setCard(reviewCard(methods, _optionalChain([customer, 'optionalAccess', _90 => _90.defaultPaymentMethodId])));
|
|
2546
2546
|
}).catch((err) => {
|
|
2547
2547
|
console.error("[WizardStepReview] Failed to load the card on file:", err);
|
|
@@ -2560,24 +2560,24 @@ function WizardStepReview({
|
|
|
2560
2560
|
const interval = _optionalChain([price, 'access', _93 => _93.recurring, 'optionalAccess', _94 => _94.interval]) || "month";
|
|
2561
2561
|
return interval === "year" ? t("billing.ui.wizard.review.interval_yearly") : t("billing.ui.wizard.review.interval_monthly");
|
|
2562
2562
|
}, "formatInterval");
|
|
2563
|
-
const codeDiscount =
|
|
2564
|
-
const carriedDiscount = isChangingPlan && !codeDiscount ?
|
|
2563
|
+
const codeDiscount = _chunkXQEYBESHjs.promotionCodeDiscount.call(void 0, promotionCode);
|
|
2564
|
+
const carriedDiscount = isChangingPlan && !codeDiscount ? _chunkXQEYBESHjs.subscriptionDiscount.call(void 0, subscription) : null;
|
|
2565
2565
|
const discount = _nullishCoalesce(codeDiscount, () => ( carriedDiscount));
|
|
2566
|
-
const discountedPrice =
|
|
2567
|
-
const discountedImmediateCharge =
|
|
2566
|
+
const discountedPrice = _chunkXQEYBESHjs.applyDiscount.call(void 0, selectedPrice.unitAmount, discount);
|
|
2567
|
+
const discountedImmediateCharge = _chunkXQEYBESHjs.applyDiscount.call(void 0, _optionalChain([prorationPreview, 'optionalAccess', _95 => _95.immediateCharge]), discount);
|
|
2568
2568
|
const getDiscountDescription = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
2569
2569
|
if (!discount) return null;
|
|
2570
2570
|
if (discount.discountType === "percent_off") {
|
|
2571
2571
|
return t("billing.ui.wizard.review.percent_off", { value: discount.discountValue });
|
|
2572
2572
|
}
|
|
2573
2573
|
return t("billing.ui.wizard.review.amount_off", {
|
|
2574
|
-
amount:
|
|
2574
|
+
amount: _chunkGSHMGL6Njs.formatCurrency.call(void 0, discount.discountValue, discount.currency || selectedPrice.currency, fmt)
|
|
2575
2575
|
});
|
|
2576
2576
|
}, "getDiscountDescription");
|
|
2577
2577
|
const discountDescription = getDiscountDescription();
|
|
2578
2578
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
2579
2579
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-muted/50 rounded-lg p-4 space-y-3", children: [
|
|
2580
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2580
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.SectionHeader, { children: t("billing.ui.wizard.review.selected_plan") }),
|
|
2581
2581
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between items-center", children: [
|
|
2582
2582
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
2583
2583
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-medium", children: _optionalChain([selectedPrice, 'access', _96 => _96.product, 'optionalAccess', _97 => _97.name]) }),
|
|
@@ -2585,11 +2585,11 @@ function WizardStepReview({
|
|
|
2585
2585
|
] }),
|
|
2586
2586
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-end", children: [
|
|
2587
2587
|
discountedPrice !== null ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2588
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground line-through", children:
|
|
2589
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-success text-lg font-semibold", children:
|
|
2590
|
-
discountDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2588
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground line-through", children: _chunkGSHMGL6Njs.formatCurrency.call(void 0, selectedPrice.unitAmount || 0, selectedPrice.currency, fmt) }),
|
|
2589
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-success text-lg font-semibold", children: _chunkGSHMGL6Njs.formatCurrency.call(void 0, discountedPrice, selectedPrice.currency, fmt) }),
|
|
2590
|
+
discountDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Badge, { variant: "softGreen", children: discountDescription }),
|
|
2591
2591
|
carriedDiscount && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: t("billing.ui.wizard.review.discount_carries_over") })
|
|
2592
|
-
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-semibold text-lg", children:
|
|
2592
|
+
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-semibold text-lg", children: _chunkGSHMGL6Njs.formatCurrency.call(void 0, selectedPrice.unitAmount || 0, selectedPrice.currency, fmt) }),
|
|
2593
2593
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: formatInterval2(selectedPrice) })
|
|
2594
2594
|
] })
|
|
2595
2595
|
] })
|
|
@@ -2604,9 +2604,9 @@ function WizardStepReview({
|
|
|
2604
2604
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between text-sm", children: [
|
|
2605
2605
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `${isTrialUpgrade ? "text-warning" : "text-muted-foreground"}`, children: isTrialUpgrade ? t("billing.ui.wizard.review.charge_now") : t("billing.ui.wizard.review.due_now") }),
|
|
2606
2606
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `font-medium ${isTrialUpgrade ? "text-warning" : "text-foreground"}`, children: discountedImmediateCharge !== null ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2607
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "line-through text-muted-foreground me-2", children:
|
|
2608
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success", children:
|
|
2609
|
-
] }) :
|
|
2607
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "line-through text-muted-foreground me-2", children: _chunkGSHMGL6Njs.formatCurrency.call(void 0, prorationPreview.immediateCharge, prorationPreview.currency, fmt) }),
|
|
2608
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success", children: _chunkGSHMGL6Njs.formatCurrency.call(void 0, discountedImmediateCharge, prorationPreview.currency, fmt) })
|
|
2609
|
+
] }) : _chunkGSHMGL6Njs.formatCurrency.call(void 0, prorationPreview.immediateCharge, prorationPreview.currency, fmt) })
|
|
2610
2610
|
] })
|
|
2611
2611
|
]
|
|
2612
2612
|
}
|
|
@@ -2630,15 +2630,15 @@ function WizardStepReview({
|
|
|
2630
2630
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "font-medium", children: t("billing.ui.payment_method.title") }),
|
|
2631
2631
|
/* @__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") })
|
|
2632
2632
|
] }),
|
|
2633
|
-
hasPaymentMethod ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2633
|
+
hasPaymentMethod ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Button, { variant: "outline", onClick: onAddPaymentMethod, disabled: isProcessing, children: t("billing.ui.wizard.review.use_another_card") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Button, { variant: "outline", onClick: onAddPaymentMethod, children: t("billing.ui.payment_methods.add") })
|
|
2634
2634
|
] }) }),
|
|
2635
|
-
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2635
|
+
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.Alert, { variant: "destructive", children: [
|
|
2636
2636
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.AlertCircle, { className: "h-4 w-4" }),
|
|
2637
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2637
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.AlertDescription, { children: error })
|
|
2638
2638
|
] }),
|
|
2639
2639
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between pt-4 border-t", children: [
|
|
2640
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2641
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2640
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Button, { variant: "outline", onClick: onBack, disabled: isProcessing, children: t("billing.ui.wizard.back") }),
|
|
2641
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.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") })
|
|
2642
2642
|
] })
|
|
2643
2643
|
] });
|
|
2644
2644
|
}
|
|
@@ -2651,7 +2651,7 @@ function WizardStepPaymentMethod({ onBack, onSuccess, isProcessing }) {
|
|
|
2651
2651
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2652
2652
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
2653
2653
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
2654
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2654
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.SectionHeader, { children: t("billing.ui.payment_methods.add") }),
|
|
2655
2655
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: t("billing.ui.wizard.payment_description") })
|
|
2656
2656
|
] }),
|
|
2657
2657
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodForm, { onSuccess, onCancel: onBack, isLoading: isProcessing, alwaysSetDefault: true })
|
|
@@ -2694,10 +2694,10 @@ function SubscriptionWizard({
|
|
|
2694
2694
|
const isChangePlanMode = !!subscription;
|
|
2695
2695
|
const dialogTitle = subscription ? t("billing.ui.wizard.change_title") : isPurchasingAddons ? t("billing.ui.subscriptions.purchase_addons") : t("billing.ui.subscriptions.subscribe");
|
|
2696
2696
|
const dialogDescription = subscription ? t("billing.ui.wizard.change_description") : isPurchasingAddons ? t("billing.ui.wizard.addons_description") : t("billing.ui.wizard.subscribe_description");
|
|
2697
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2698
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2699
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2700
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2697
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.DialogContent, { className: "max-w-2xl max-h-[90vh] overflow-y-auto", children: [
|
|
2698
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.DialogHeader, { children: [
|
|
2699
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.DialogTitle, { children: dialogTitle }),
|
|
2700
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.DialogDescription, { children: dialogDescription })
|
|
2701
2701
|
] }),
|
|
2702
2702
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, WizardProgressIndicator, { currentStep: state.step }),
|
|
2703
2703
|
state.step === "plan-selection" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -2765,7 +2765,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, getProgressColor, "getProgressColor");
|
|
|
2765
2765
|
function formatDate2(date, { locale, t }) {
|
|
2766
2766
|
if (!date) return t("billing.ui.not_available");
|
|
2767
2767
|
try {
|
|
2768
|
-
return new Intl.DateTimeFormat(
|
|
2768
|
+
return new Intl.DateTimeFormat(_chunkGSHMGL6Njs.dateFormatLocale.call(void 0, locale), {
|
|
2769
2769
|
month: "short",
|
|
2770
2770
|
day: "numeric"
|
|
2771
2771
|
}).format(new Date(date));
|
|
@@ -2776,7 +2776,7 @@ function formatDate2(date, { locale, t }) {
|
|
|
2776
2776
|
_chunk7QVYU63Ejs.__name.call(void 0, formatDate2, "formatDate");
|
|
2777
2777
|
function UsageSummaryCard({ meter, summary }) {
|
|
2778
2778
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2779
|
-
const fmt =
|
|
2779
|
+
const fmt = _chunkXQEYBESHjs.useBillingFormatOptions.call(void 0, );
|
|
2780
2780
|
const currentUsage = _nullishCoalesce(_optionalChain([summary, 'optionalAccess', _100 => _100.aggregatedValue]), () => ( 0));
|
|
2781
2781
|
const limit = meter.limit;
|
|
2782
2782
|
const percentage = limit && limit > 0 ? currentUsage / limit * 100 : null;
|
|
@@ -2784,15 +2784,15 @@ function UsageSummaryCard({ meter, summary }) {
|
|
|
2784
2784
|
const progressWidth = percentage !== null ? Math.min(percentage, 100) : 0;
|
|
2785
2785
|
const displayName = meter.displayName || meter.eventName;
|
|
2786
2786
|
const hasLimit = limit !== null && limit !== void 0;
|
|
2787
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2788
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2787
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.Card, { children: [
|
|
2788
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.CardHeader, { className: "flex flex-row items-center gap-x-3 pb-3", children: [
|
|
2789
2789
|
/* @__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" }) }),
|
|
2790
2790
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col", children: [
|
|
2791
2791
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium", children: displayName }),
|
|
2792
2792
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-xs", children: meter.id })
|
|
2793
2793
|
] })
|
|
2794
2794
|
] }),
|
|
2795
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2795
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.CardContent, { className: "flex flex-col gap-y-4", children: [
|
|
2796
2796
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
2797
2797
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-3xl font-bold", children: currentUsage.toLocaleString(fmt.locale) }),
|
|
2798
2798
|
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) }) })
|
|
@@ -2800,7 +2800,7 @@ function UsageSummaryCard({ meter, summary }) {
|
|
|
2800
2800
|
hasLimit ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-2", children: [
|
|
2801
2801
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-2 w-full overflow-hidden rounded-full bg-gray-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: `h-full transition-all ${progressColor}`, style: { width: `${progressWidth}%` } }) }),
|
|
2802
2802
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-sm", children: t("billing.ui.usage.percent_used", {
|
|
2803
|
-
value: percentage !== null ?
|
|
2803
|
+
value: percentage !== null ? _chunkGSHMGL6Njs.formatFixed.call(void 0, percentage, fmt.locale, 1) : ""
|
|
2804
2804
|
}) })
|
|
2805
2805
|
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-sm", children: t("billing.ui.usage.no_limit") }),
|
|
2806
2806
|
summary && summary.start && summary.end && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border-t pt-3", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-xs", children: t("billing.ui.usage.period", {
|
|
@@ -2833,14 +2833,14 @@ function UsageContainer() {
|
|
|
2833
2833
|
const loadUsageData = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2834
2834
|
setLoading(true);
|
|
2835
2835
|
try {
|
|
2836
|
-
const fetchedSubscriptions = await
|
|
2836
|
+
const fetchedSubscriptions = await _chunkGSHMGL6Njs.StripeSubscriptionService.listSubscriptions();
|
|
2837
2837
|
setSubscriptions(fetchedSubscriptions);
|
|
2838
2838
|
const hasMeteredSubscriptions2 = fetchedSubscriptions.some((sub) => _optionalChain([sub, 'access', _101 => _101.price, 'optionalAccess', _102 => _102.recurring, 'optionalAccess', _103 => _103.usageType]) === "metered");
|
|
2839
2839
|
if (!hasMeteredSubscriptions2) {
|
|
2840
2840
|
setLoading(false);
|
|
2841
2841
|
return;
|
|
2842
2842
|
}
|
|
2843
|
-
const fetchedMeters = await
|
|
2843
|
+
const fetchedMeters = await _chunkGSHMGL6Njs.StripeUsageService.listMeters();
|
|
2844
2844
|
setMeters(fetchedMeters);
|
|
2845
2845
|
const summariesMap = {};
|
|
2846
2846
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -2848,7 +2848,7 @@ function UsageContainer() {
|
|
|
2848
2848
|
const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
|
|
2849
2849
|
for (const meter of fetchedMeters) {
|
|
2850
2850
|
try {
|
|
2851
|
-
const meterSummaries = await
|
|
2851
|
+
const meterSummaries = await _chunkGSHMGL6Njs.StripeUsageService.getMeterSummaries({
|
|
2852
2852
|
meterId: meter.id,
|
|
2853
2853
|
startTime: startOfMonth,
|
|
2854
2854
|
endTime: endOfMonth
|
|
@@ -2897,7 +2897,7 @@ function formatDateTime(date, { locale, t }) {
|
|
|
2897
2897
|
if (!date) return t("billing.ui.not_available");
|
|
2898
2898
|
const dateObj = typeof date === "string" ? new Date(date) : date;
|
|
2899
2899
|
try {
|
|
2900
|
-
return new Intl.DateTimeFormat(
|
|
2900
|
+
return new Intl.DateTimeFormat(_chunkGSHMGL6Njs.dateFormatLocale.call(void 0, locale), {
|
|
2901
2901
|
month: "short",
|
|
2902
2902
|
day: "numeric",
|
|
2903
2903
|
year: "numeric",
|
|
@@ -2911,27 +2911,27 @@ function formatDateTime(date, { locale, t }) {
|
|
|
2911
2911
|
_chunk7QVYU63Ejs.__name.call(void 0, formatDateTime, "formatDateTime");
|
|
2912
2912
|
function UsageHistoryTable({ usageRecords }) {
|
|
2913
2913
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2914
|
-
const fmt =
|
|
2914
|
+
const fmt = _chunkXQEYBESHjs.useBillingFormatOptions.call(void 0, );
|
|
2915
2915
|
if (usageRecords.length === 0) {
|
|
2916
2916
|
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") }) });
|
|
2917
2917
|
}
|
|
2918
2918
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
2919
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2920
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-clip rounded-lg border", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2921
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2922
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2923
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2924
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2925
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2919
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.SectionHeader, { level: 2, children: t("billing.ui.usage.history_title") }),
|
|
2920
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-clip rounded-lg border", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.Table, { children: [
|
|
2921
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.TableRow, { children: [
|
|
2922
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.TableHead, { children: t("billing.ui.columns.date_time") }),
|
|
2923
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.TableHead, { children: t("billing.ui.columns.meter_event") }),
|
|
2924
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.TableHead, { className: "text-end", children: t("billing.ui.columns.quantity") }),
|
|
2925
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.TableHead, { children: t("billing.ui.columns.event_id") })
|
|
2926
2926
|
] }) }),
|
|
2927
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2927
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.TableBody, { children: usageRecords.map((record) => {
|
|
2928
2928
|
const dateTime = formatDateTime(record.timestamp, fmt);
|
|
2929
2929
|
const quantity = record.quantity.toLocaleString(fmt.locale);
|
|
2930
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2931
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2932
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2933
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2934
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2930
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.TableRow, { children: [
|
|
2931
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.TableCell, { className: "font-medium", children: dateTime }),
|
|
2932
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.TableCell, { className: "text-muted-foreground", children: record.meterEventName }),
|
|
2933
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.TableCell, { className: "text-end font-medium", children: quantity }),
|
|
2934
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.TableCell, { className: "text-muted-foreground text-sm tabular-nums", children: record.stripeEventId })
|
|
2935
2935
|
] }, record.id);
|
|
2936
2936
|
}) })
|
|
2937
2937
|
] }) })
|
|
@@ -2942,8 +2942,8 @@ _chunk7QVYU63Ejs.__name.call(void 0, UsageHistoryTable, "UsageHistoryTable");
|
|
|
2942
2942
|
// src/features/billing/components/modals/BillingDetailModal.tsx
|
|
2943
2943
|
|
|
2944
2944
|
function BillingDetailModal({ open, onOpenChange, title, children, className }) {
|
|
2945
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2946
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2945
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.DialogContent, { className: _nullishCoalesce(className, () => ( "max-w-4xl max-h-[90vh] overflow-y-auto")), children: [
|
|
2946
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.DialogHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.DialogTitle, { children: title }) }),
|
|
2947
2947
|
children
|
|
2948
2948
|
] }) });
|
|
2949
2949
|
}
|
|
@@ -2971,7 +2971,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
|
|
|
2971
2971
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-destructive text-sm font-medium", children: t("billing.ui.alert.payment_failed_title") }),
|
|
2972
2972
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive mt-1 text-sm", children: t("billing.ui.alert.payment_failed_description") })
|
|
2973
2973
|
] }),
|
|
2974
|
-
onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2974
|
+
onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Button, { variant: "outline", size: "sm", onClick: onUpdatePayment, className: "text-destructive border-red-300", children: t("billing.ui.alert.update_payment_method") })
|
|
2975
2975
|
] });
|
|
2976
2976
|
}
|
|
2977
2977
|
if (subscription.status === "trialing" /* TRIALING */ && subscription.trialEnd) {
|
|
@@ -2985,7 +2985,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
|
|
|
2985
2985
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-warning text-sm font-medium", children: t("billing.ui.alert.trial_ending_title") }),
|
|
2986
2986
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-warning mt-1 text-sm", children: t("billing.ui.alert.trial_ending_description", { count: daysRemaining }) })
|
|
2987
2987
|
] }),
|
|
2988
|
-
onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2988
|
+
onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Button, { variant: "outline", size: "sm", onClick: onAddPayment, className: "text-warning border-yellow-300", children: t("billing.ui.payment_methods.add") })
|
|
2989
2989
|
] });
|
|
2990
2990
|
}
|
|
2991
2991
|
}
|
|
@@ -3037,7 +3037,7 @@ function BillingDashboardContainer() {
|
|
|
3037
3037
|
setNoCustomerExists(false);
|
|
3038
3038
|
let customer = null;
|
|
3039
3039
|
try {
|
|
3040
|
-
customer = await
|
|
3040
|
+
customer = await _chunkGSHMGL6Njs.StripeCustomerService.getCustomer();
|
|
3041
3041
|
setData((prev) => ({ ...prev, customer }));
|
|
3042
3042
|
setErrors((prev) => ({ ...prev, customer: null }));
|
|
3043
3043
|
setNoCustomerExists(false);
|
|
@@ -3063,7 +3063,7 @@ function BillingDashboardContainer() {
|
|
|
3063
3063
|
}
|
|
3064
3064
|
const fetchSubscriptions = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3065
3065
|
try {
|
|
3066
|
-
const subscriptions2 = await
|
|
3066
|
+
const subscriptions2 = await _chunkGSHMGL6Njs.StripeSubscriptionService.listSubscriptions();
|
|
3067
3067
|
setData((prev) => ({ ...prev, subscriptions: subscriptions2 }));
|
|
3068
3068
|
setErrors((prev) => ({ ...prev, subscriptions: null }));
|
|
3069
3069
|
return subscriptions2;
|
|
@@ -3077,7 +3077,7 @@ function BillingDashboardContainer() {
|
|
|
3077
3077
|
}, "fetchSubscriptions");
|
|
3078
3078
|
const fetchPaymentMethods = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3079
3079
|
try {
|
|
3080
|
-
const paymentMethods = await
|
|
3080
|
+
const paymentMethods = await _chunkGSHMGL6Njs.StripeCustomerService.listPaymentMethods();
|
|
3081
3081
|
setData((prev) => ({ ...prev, paymentMethods }));
|
|
3082
3082
|
setErrors((prev) => ({ ...prev, paymentMethods: null }));
|
|
3083
3083
|
} catch (error) {
|
|
@@ -3089,7 +3089,7 @@ function BillingDashboardContainer() {
|
|
|
3089
3089
|
}, "fetchPaymentMethods");
|
|
3090
3090
|
const fetchInvoices = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3091
3091
|
try {
|
|
3092
|
-
const invoices = await
|
|
3092
|
+
const invoices = await _chunkGSHMGL6Njs.StripeInvoiceService.listInvoices();
|
|
3093
3093
|
setData((prev) => ({ ...prev, invoices }));
|
|
3094
3094
|
setErrors((prev) => ({ ...prev, invoices: null }));
|
|
3095
3095
|
} catch (error) {
|
|
@@ -3112,7 +3112,7 @@ function BillingDashboardContainer() {
|
|
|
3112
3112
|
const handleCreateCustomer = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3113
3113
|
setCreatingCustomer(true);
|
|
3114
3114
|
try {
|
|
3115
|
-
await
|
|
3115
|
+
await _chunkGSHMGL6Njs.StripeCustomerService.createCustomer();
|
|
3116
3116
|
setNoCustomerExists(false);
|
|
3117
3117
|
await fetchAllData();
|
|
3118
3118
|
} catch (error) {
|
|
@@ -3124,7 +3124,7 @@ function BillingDashboardContainer() {
|
|
|
3124
3124
|
}, "handleCreateCustomer");
|
|
3125
3125
|
const fetchUsageData = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3126
3126
|
try {
|
|
3127
|
-
const meters = await
|
|
3127
|
+
const meters = await _chunkGSHMGL6Njs.StripeUsageService.listMeters();
|
|
3128
3128
|
setData((prev) => ({ ...prev, meters }));
|
|
3129
3129
|
const summariesMap = {};
|
|
3130
3130
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -3132,7 +3132,7 @@ function BillingDashboardContainer() {
|
|
|
3132
3132
|
const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
|
|
3133
3133
|
for (const meter of meters) {
|
|
3134
3134
|
try {
|
|
3135
|
-
const meterSummaries = await
|
|
3135
|
+
const meterSummaries = await _chunkGSHMGL6Njs.StripeUsageService.getMeterSummaries({
|
|
3136
3136
|
meterId: meter.id,
|
|
3137
3137
|
startTime: startOfMonth,
|
|
3138
3138
|
endTime: endOfMonth
|
|
@@ -3219,18 +3219,18 @@ function BillingDashboardContainer() {
|
|
|
3219
3219
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-8 w-8" }),
|
|
3220
3220
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: t("billing.title") })
|
|
3221
3221
|
] }),
|
|
3222
|
-
isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3223
|
-
noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3224
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3222
|
+
isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.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" }) }) }),
|
|
3223
|
+
noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.Card, { children: [
|
|
3224
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.CardHeader, { className: "text-center", children: [
|
|
3225
3225
|
/* @__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" }) }),
|
|
3226
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3227
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3226
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.CardTitle, { children: t("billing.ui.dashboard.setup_title") }),
|
|
3227
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.CardDescription, { children: t("billing.ui.dashboard.setup_description") })
|
|
3228
3228
|
] }),
|
|
3229
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3229
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.CardContent, { className: "flex justify-center pb-8", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Button, { onClick: handleCreateCustomer, disabled: creatingCustomer, size: "lg", children: creatingCustomer ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
3230
3230
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "me-2 h-4 w-4 animate-spin" }),
|
|
3231
3231
|
t("billing.ui.dashboard.setting_up")
|
|
3232
3232
|
] }) : t("billing.ui.dashboard.setup_button") }) }),
|
|
3233
|
-
errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3233
|
+
errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.CardContent, { className: "pt-0", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-center text-destructive text-xs/relaxed", children: t(errors.customer) }) })
|
|
3234
3234
|
] }),
|
|
3235
3235
|
!noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
3236
3236
|
criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -3374,7 +3374,7 @@ function getStripePromise(publishableKey) {
|
|
|
3374
3374
|
}
|
|
3375
3375
|
_chunk7QVYU63Ejs.__name.call(void 0, getStripePromise, "getStripePromise");
|
|
3376
3376
|
function StripeProvider({ children }) {
|
|
3377
|
-
const publishableKey =
|
|
3377
|
+
const publishableKey = _chunk3P3IYUWQjs.getStripePublishableKey.call(void 0, );
|
|
3378
3378
|
const stripePromise = _react.useMemo.call(void 0, () => getStripePromise(publishableKey), [publishableKey]);
|
|
3379
3379
|
const options = _react.useMemo.call(void 0, () => ({}), []);
|
|
3380
3380
|
if (!publishableKey) {
|
|
@@ -3384,7 +3384,7 @@ function StripeProvider({ children }) {
|
|
|
3384
3384
|
}
|
|
3385
3385
|
_chunk7QVYU63Ejs.__name.call(void 0, StripeProvider, "StripeProvider");
|
|
3386
3386
|
function isStripeConfigured() {
|
|
3387
|
-
return !!
|
|
3387
|
+
return !!_chunk3P3IYUWQjs.getStripePublishableKey.call(void 0, );
|
|
3388
3388
|
}
|
|
3389
3389
|
_chunk7QVYU63Ejs.__name.call(void 0, isStripeConfigured, "isStripeConfigured");
|
|
3390
3390
|
|
|
@@ -3399,18 +3399,18 @@ _chunk7QVYU63Ejs.__name.call(void 0, isStripeConfigured, "isStripeConfigured");
|
|
|
3399
3399
|
|
|
3400
3400
|
function PriceArchiver({ price }) {
|
|
3401
3401
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
3402
|
-
const fmt =
|
|
3402
|
+
const fmt = _chunkXQEYBESHjs.useBillingFormatOptions.call(void 0, );
|
|
3403
3403
|
const { archivePrice, restorePrice } = usePriceContext();
|
|
3404
3404
|
const [open, setOpen] = _react.useState.call(void 0, false);
|
|
3405
3405
|
const isArchived = !price.active;
|
|
3406
3406
|
const scope = isArchived ? "restore" : "archive";
|
|
3407
3407
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
3408
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3408
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.Button, { variant: "outline", size: "sm", onClick: () => setOpen(true), children: [
|
|
3409
3409
|
isArchived ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RotateCcwIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ArchiveIcon, {}),
|
|
3410
3410
|
t(`billing.admin.prices.${scope}.confirm`)
|
|
3411
3411
|
] }),
|
|
3412
3412
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3413
|
-
|
|
3413
|
+
_chunkXQEYBESHjs.ConfirmDialog,
|
|
3414
3414
|
{
|
|
3415
3415
|
open,
|
|
3416
3416
|
onOpenChange: setOpen,
|
|
@@ -3424,7 +3424,7 @@ function PriceArchiver({ price }) {
|
|
|
3424
3424
|
if (isArchived) await restorePrice(price.id);
|
|
3425
3425
|
else await archivePrice(price.id);
|
|
3426
3426
|
} catch (error) {
|
|
3427
|
-
|
|
3427
|
+
_chunkXQEYBESHjs.errorToast.call(void 0, { title: t(`billing.admin.prices.${scope}.title`), error });
|
|
3428
3428
|
throw error;
|
|
3429
3429
|
}
|
|
3430
3430
|
}
|
|
@@ -3456,15 +3456,15 @@ function PriceEditorInternal({
|
|
|
3456
3456
|
onDialogOpenChange
|
|
3457
3457
|
}) {
|
|
3458
3458
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
3459
|
-
const fmt =
|
|
3460
|
-
const router =
|
|
3459
|
+
const fmt = _chunkXQEYBESHjs.useBillingFormatOptions.call(void 0, );
|
|
3460
|
+
const router = _chunkGSHMGL6Njs.useI18nRouter.call(void 0, );
|
|
3461
3461
|
const { createPrice, updatePrice, productId: contextProductId } = usePriceContext();
|
|
3462
3462
|
const [allFeatures, setAllFeatures] = _react.useState.call(void 0, []);
|
|
3463
3463
|
const isEdit = !!price;
|
|
3464
3464
|
const targetProductId = _nullishCoalesce(_nullishCoalesce(productId, () => ( _optionalChain([price, 'optionalAccess', _119 => _119.product, 'optionalAccess', _120 => _120.id]))), () => ( contextProductId));
|
|
3465
3465
|
_react.useEffect.call(void 0, () => {
|
|
3466
3466
|
const fetchFeatures = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3467
|
-
setAllFeatures(await
|
|
3467
|
+
setAllFeatures(await _chunkGSHMGL6Njs.FeatureService.findMany({}));
|
|
3468
3468
|
}, "fetchFeatures");
|
|
3469
3469
|
void fetchFeatures();
|
|
3470
3470
|
}, []);
|
|
@@ -3577,7 +3577,7 @@ function PriceEditorInternal({
|
|
|
3577
3577
|
warnedUnknownFor.current = fingerprint;
|
|
3578
3578
|
const { unknown } = resolvePlatformFeatures(seed.platformFeatures);
|
|
3579
3579
|
if (unknown.length > 0)
|
|
3580
|
-
|
|
3580
|
+
_chunkGSHMGL6Njs.showToast.call(void 0, t("billing.admin.prices.import.warnings.unknownFeatures", { features: unknown.join(", ") }));
|
|
3581
3581
|
}, [seed, isEdit, allFeatures, resolvePlatformFeatures, t]);
|
|
3582
3582
|
const watchInterval = form.watch("interval");
|
|
3583
3583
|
const isRecurring = watchInterval !== "one_time";
|
|
@@ -3598,13 +3598,13 @@ function PriceEditorInternal({
|
|
|
3598
3598
|
{ id: "metered", text: t("billing.admin.prices.usage.metered") }
|
|
3599
3599
|
];
|
|
3600
3600
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3601
|
-
|
|
3601
|
+
_chunkXQEYBESHjs.EditorSheet,
|
|
3602
3602
|
{
|
|
3603
3603
|
form,
|
|
3604
3604
|
entityType: t("billing.admin.prices.entity"),
|
|
3605
3605
|
entityName: price ? priceLabel(price, fmt) : void 0,
|
|
3606
3606
|
isEdit,
|
|
3607
|
-
module:
|
|
3607
|
+
module: _chunkGSHMGL6Njs.Modules.StripePrice,
|
|
3608
3608
|
size: "lg",
|
|
3609
3609
|
propagateChanges,
|
|
3610
3610
|
onSuccess,
|
|
@@ -3653,13 +3653,13 @@ function PriceEditorInternal({
|
|
|
3653
3653
|
dialogOpen,
|
|
3654
3654
|
onDialogOpenChange,
|
|
3655
3655
|
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
3656
|
-
isEdit && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3657
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3658
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3656
|
+
isEdit && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.Alert, { children: [
|
|
3657
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.AlertTitle, { children: t("billing.admin.prices.immutability.title") }),
|
|
3658
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.AlertDescription, { children: t("billing.admin.prices.immutability.description") })
|
|
3659
3659
|
] }),
|
|
3660
3660
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
|
|
3661
3661
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3662
|
-
|
|
3662
|
+
_chunkXQEYBESHjs.FormInput,
|
|
3663
3663
|
{
|
|
3664
3664
|
form,
|
|
3665
3665
|
id: "unitAmount",
|
|
@@ -3671,7 +3671,7 @@ function PriceEditorInternal({
|
|
|
3671
3671
|
}
|
|
3672
3672
|
),
|
|
3673
3673
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3674
|
-
|
|
3674
|
+
_chunkXQEYBESHjs.FormSelect,
|
|
3675
3675
|
{
|
|
3676
3676
|
form,
|
|
3677
3677
|
id: "currency",
|
|
@@ -3682,7 +3682,7 @@ function PriceEditorInternal({
|
|
|
3682
3682
|
)
|
|
3683
3683
|
] }),
|
|
3684
3684
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3685
|
-
|
|
3685
|
+
_chunkXQEYBESHjs.FormSelect,
|
|
3686
3686
|
{
|
|
3687
3687
|
form,
|
|
3688
3688
|
id: "interval",
|
|
@@ -3693,7 +3693,7 @@ function PriceEditorInternal({
|
|
|
3693
3693
|
),
|
|
3694
3694
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
|
|
3695
3695
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3696
|
-
|
|
3696
|
+
_chunkXQEYBESHjs.FormInput,
|
|
3697
3697
|
{
|
|
3698
3698
|
form,
|
|
3699
3699
|
id: "intervalCount",
|
|
@@ -3704,7 +3704,7 @@ function PriceEditorInternal({
|
|
|
3704
3704
|
}
|
|
3705
3705
|
),
|
|
3706
3706
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3707
|
-
|
|
3707
|
+
_chunkXQEYBESHjs.FormSelect,
|
|
3708
3708
|
{
|
|
3709
3709
|
form,
|
|
3710
3710
|
id: "usageType",
|
|
@@ -3715,7 +3715,7 @@ function PriceEditorInternal({
|
|
|
3715
3715
|
)
|
|
3716
3716
|
] }),
|
|
3717
3717
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3718
|
-
|
|
3718
|
+
_chunkXQEYBESHjs.FormInput,
|
|
3719
3719
|
{
|
|
3720
3720
|
form,
|
|
3721
3721
|
id: "nickname",
|
|
@@ -3724,7 +3724,7 @@ function PriceEditorInternal({
|
|
|
3724
3724
|
}
|
|
3725
3725
|
),
|
|
3726
3726
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3727
|
-
|
|
3727
|
+
_chunkXQEYBESHjs.FormTextarea,
|
|
3728
3728
|
{
|
|
3729
3729
|
form,
|
|
3730
3730
|
id: "description",
|
|
@@ -3734,7 +3734,7 @@ function PriceEditorInternal({
|
|
|
3734
3734
|
}
|
|
3735
3735
|
),
|
|
3736
3736
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3737
|
-
|
|
3737
|
+
_chunkXQEYBESHjs.FormInput,
|
|
3738
3738
|
{
|
|
3739
3739
|
form,
|
|
3740
3740
|
id: "token",
|
|
@@ -3744,10 +3744,10 @@ function PriceEditorInternal({
|
|
|
3744
3744
|
}
|
|
3745
3745
|
),
|
|
3746
3746
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-2", children: [
|
|
3747
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3747
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.FieldLabel, { children: t("billing.admin.prices.fields.features") }),
|
|
3748
3748
|
form.watch("features").map((_, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
|
|
3749
3749
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3750
|
-
|
|
3750
|
+
_chunkXQEYBESHjs.Input,
|
|
3751
3751
|
{
|
|
3752
3752
|
...form.register(`features.${index}`),
|
|
3753
3753
|
placeholder: t("billing.admin.prices.placeholders.feature", { index: index + 1 }),
|
|
@@ -3755,7 +3755,7 @@ function PriceEditorInternal({
|
|
|
3755
3755
|
}
|
|
3756
3756
|
),
|
|
3757
3757
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3758
|
-
|
|
3758
|
+
_chunkXQEYBESHjs.Button,
|
|
3759
3759
|
{
|
|
3760
3760
|
type: "button",
|
|
3761
3761
|
variant: "outline",
|
|
@@ -3770,7 +3770,7 @@ function PriceEditorInternal({
|
|
|
3770
3770
|
)
|
|
3771
3771
|
] }, index)),
|
|
3772
3772
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3773
|
-
|
|
3773
|
+
_chunkXQEYBESHjs.Button,
|
|
3774
3774
|
{
|
|
3775
3775
|
type: "button",
|
|
3776
3776
|
variant: "outline",
|
|
@@ -3785,12 +3785,12 @@ function PriceEditorInternal({
|
|
|
3785
3785
|
)
|
|
3786
3786
|
] }),
|
|
3787
3787
|
isRecurring && allFeatures.length > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-2", children: [
|
|
3788
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3788
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.FieldLabel, { children: t("billing.admin.prices.fields.platformFeatures") }),
|
|
3789
3789
|
/* @__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) => {
|
|
3790
3790
|
const isChecked = form.watch("featureIds").includes(feature.id);
|
|
3791
3791
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
3792
3792
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3793
|
-
|
|
3793
|
+
_chunkXQEYBESHjs.Checkbox,
|
|
3794
3794
|
{
|
|
3795
3795
|
id: `feature-${feature.id}`,
|
|
3796
3796
|
checked: isChecked,
|
|
@@ -3806,13 +3806,13 @@ function PriceEditorInternal({
|
|
|
3806
3806
|
}
|
|
3807
3807
|
}
|
|
3808
3808
|
),
|
|
3809
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3809
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.FieldLabel, { htmlFor: `feature-${feature.id}`, children: feature.name }),
|
|
3810
3810
|
feature.isCore && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.admin.prices.help.core") })
|
|
3811
3811
|
] }, feature.id);
|
|
3812
3812
|
}) })
|
|
3813
3813
|
] }),
|
|
3814
3814
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3815
|
-
|
|
3815
|
+
_chunkXQEYBESHjs.FormCheckbox,
|
|
3816
3816
|
{
|
|
3817
3817
|
form,
|
|
3818
3818
|
id: "isTrial",
|
|
@@ -3855,7 +3855,7 @@ var defaultContextValue = {
|
|
|
3855
3855
|
productId: void 0
|
|
3856
3856
|
};
|
|
3857
3857
|
function priceLabel(price, fmt = {}) {
|
|
3858
|
-
return _nullishCoalesce(price.nickname, () => ( `${
|
|
3858
|
+
return _nullishCoalesce(price.nickname, () => ( `${_chunkGSHMGL6Njs.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt)} ${_chunkGSHMGL6Njs.formatInterval.call(void 0, price, fmt)}`.trim()));
|
|
3859
3859
|
}
|
|
3860
3860
|
_chunk7QVYU63Ejs.__name.call(void 0, priceLabel, "priceLabel");
|
|
3861
3861
|
var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
@@ -3865,22 +3865,22 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3865
3865
|
productId: productIdProp
|
|
3866
3866
|
}) => {
|
|
3867
3867
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
3868
|
-
const fmt =
|
|
3869
|
-
const generateUrl =
|
|
3870
|
-
const { hasRole } =
|
|
3868
|
+
const fmt = _chunkXQEYBESHjs.useBillingFormatOptions.call(void 0, );
|
|
3869
|
+
const generateUrl = _chunkXQEYBESHjs.usePageUrlGenerator.call(void 0, );
|
|
3870
|
+
const { hasRole } = _chunkXQEYBESHjs.useCurrentUserContext.call(void 0, );
|
|
3871
3871
|
const [price, setPrice] = _react.useState.call(void 0,
|
|
3872
|
-
dehydratedPrice ?
|
|
3872
|
+
dehydratedPrice ? _chunkGSHMGL6Njs.rehydrate.call(void 0, _chunkGSHMGL6Njs.Modules.StripePrice, dehydratedPrice) : void 0
|
|
3873
3873
|
);
|
|
3874
3874
|
const [priceVersion, setPriceVersion] = _react.useState.call(void 0, 0);
|
|
3875
3875
|
const refreshPrices = _react.useCallback.call(void 0, () => setPriceVersion((value2) => value2 + 1), []);
|
|
3876
3876
|
const productId = _nullishCoalesce(productIdProp, () => ( _optionalChain([price, 'optionalAccess', _143 => _143.product, 'optionalAccess', _144 => _144.id])));
|
|
3877
3877
|
const reloadPrice = _react.useCallback.call(void 0, async () => {
|
|
3878
3878
|
if (!_optionalChain([price, 'optionalAccess', _145 => _145.id])) return;
|
|
3879
|
-
setPrice(await
|
|
3879
|
+
setPrice(await _chunkGSHMGL6Njs.StripePriceService.getPrice({ id: price.id }));
|
|
3880
3880
|
}, [_optionalChain([price, 'optionalAccess', _146 => _146.id])]);
|
|
3881
3881
|
const createPrice = _react.useCallback.call(void 0,
|
|
3882
3882
|
async (input) => {
|
|
3883
|
-
const saved = await
|
|
3883
|
+
const saved = await _chunkGSHMGL6Njs.StripePriceService.createPrice(input);
|
|
3884
3884
|
refreshPrices();
|
|
3885
3885
|
return saved;
|
|
3886
3886
|
},
|
|
@@ -3888,7 +3888,7 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3888
3888
|
);
|
|
3889
3889
|
const updatePrice = _react.useCallback.call(void 0,
|
|
3890
3890
|
async (input) => {
|
|
3891
|
-
const saved = await
|
|
3891
|
+
const saved = await _chunkGSHMGL6Njs.StripePriceService.updatePrice(input);
|
|
3892
3892
|
setPrice(saved);
|
|
3893
3893
|
refreshPrices();
|
|
3894
3894
|
return saved;
|
|
@@ -3899,7 +3899,7 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3899
3899
|
async (id) => {
|
|
3900
3900
|
const target = _nullishCoalesce(id, () => ( _optionalChain([price, 'optionalAccess', _147 => _147.id])));
|
|
3901
3901
|
if (!target) return;
|
|
3902
|
-
await
|
|
3902
|
+
await _chunkGSHMGL6Njs.StripePriceService.archivePrice({ id: target });
|
|
3903
3903
|
await reloadPrice();
|
|
3904
3904
|
refreshPrices();
|
|
3905
3905
|
},
|
|
@@ -3909,7 +3909,7 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3909
3909
|
async (id) => {
|
|
3910
3910
|
const target = _nullishCoalesce(id, () => ( _optionalChain([price, 'optionalAccess', _149 => _149.id])));
|
|
3911
3911
|
if (!target) return;
|
|
3912
|
-
await
|
|
3912
|
+
await _chunkGSHMGL6Njs.StripePriceService.reactivatePrice({ id: target });
|
|
3913
3913
|
await reloadPrice();
|
|
3914
3914
|
refreshPrices();
|
|
3915
3915
|
},
|
|
@@ -3933,12 +3933,12 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3933
3933
|
if (!publishChrome) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceContext.Provider, { value, children });
|
|
3934
3934
|
const breadcrumb = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
3935
3935
|
const items = [
|
|
3936
|
-
{ name: t("billing.admin.products.title"), href: generateUrl({ page:
|
|
3936
|
+
{ name: t("billing.admin.products.title"), href: generateUrl({ page: _chunkGSHMGL6Njs.Modules.StripeProduct }) }
|
|
3937
3937
|
];
|
|
3938
3938
|
if (_optionalChain([price, 'optionalAccess', _151 => _151.product]))
|
|
3939
3939
|
items.push({
|
|
3940
3940
|
name: price.product.name,
|
|
3941
|
-
href: generateUrl({ page:
|
|
3941
|
+
href: generateUrl({ page: _chunkGSHMGL6Njs.Modules.StripeProduct, id: price.product.id })
|
|
3942
3942
|
});
|
|
3943
3943
|
if (price) items.push({ name: priceLabel(price, fmt) });
|
|
3944
3944
|
return items;
|
|
@@ -3955,7 +3955,7 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3955
3955
|
}
|
|
3956
3956
|
return response;
|
|
3957
3957
|
}, "title");
|
|
3958
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3958
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceContext.Provider, { value, children }) });
|
|
3959
3959
|
}, "PriceProvider");
|
|
3960
3960
|
var usePriceContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => _nullishCoalesce(_react.useContext.call(void 0, PriceContext), () => ( defaultContextValue)), "usePriceContext");
|
|
3961
3961
|
|
|
@@ -3975,12 +3975,12 @@ function ProductArchiver({ product }) {
|
|
|
3975
3975
|
const isArchived = !product.active;
|
|
3976
3976
|
const scope = isArchived ? "restore" : "archive";
|
|
3977
3977
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
3978
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3978
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.Button, { variant: "outline", size: "sm", onClick: () => setOpen(true), children: [
|
|
3979
3979
|
isArchived ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RotateCcwIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ArchiveIcon, {}),
|
|
3980
3980
|
t(`billing.admin.products.${scope}.confirm`)
|
|
3981
3981
|
] }),
|
|
3982
3982
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3983
|
-
|
|
3983
|
+
_chunkXQEYBESHjs.ConfirmDialog,
|
|
3984
3984
|
{
|
|
3985
3985
|
open,
|
|
3986
3986
|
onOpenChange: setOpen,
|
|
@@ -3994,7 +3994,7 @@ function ProductArchiver({ product }) {
|
|
|
3994
3994
|
if (isArchived) await restoreProduct(product.id);
|
|
3995
3995
|
else await archiveProduct(product.id);
|
|
3996
3996
|
} catch (error) {
|
|
3997
|
-
|
|
3997
|
+
_chunkXQEYBESHjs.errorToast.call(void 0, { title: t(`billing.admin.products.${scope}.title`), error });
|
|
3998
3998
|
throw error;
|
|
3999
3999
|
}
|
|
4000
4000
|
}
|
|
@@ -4023,7 +4023,7 @@ function ProductEditorInternal({
|
|
|
4023
4023
|
onDialogOpenChange
|
|
4024
4024
|
}) {
|
|
4025
4025
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4026
|
-
const router =
|
|
4026
|
+
const router = _chunkGSHMGL6Njs.useI18nRouter.call(void 0, );
|
|
4027
4027
|
const { createProduct, updateProduct } = useProductContext();
|
|
4028
4028
|
const isEdit = !!product;
|
|
4029
4029
|
const formSchema2 = _react.useMemo.call(void 0,
|
|
@@ -4047,13 +4047,13 @@ function ProductEditorInternal({
|
|
|
4047
4047
|
defaultValues: getDefaultValues()
|
|
4048
4048
|
});
|
|
4049
4049
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4050
|
-
|
|
4050
|
+
_chunkXQEYBESHjs.EditorSheet,
|
|
4051
4051
|
{
|
|
4052
4052
|
form,
|
|
4053
4053
|
entityType: t("billing.admin.products.entity"),
|
|
4054
4054
|
entityName: _optionalChain([product, 'optionalAccess', _155 => _155.name]),
|
|
4055
4055
|
isEdit,
|
|
4056
|
-
module:
|
|
4056
|
+
module: _chunkGSHMGL6Njs.Modules.StripeProduct,
|
|
4057
4057
|
size: "md",
|
|
4058
4058
|
propagateChanges,
|
|
4059
4059
|
onSuccess,
|
|
@@ -4070,7 +4070,7 @@ function ProductEditorInternal({
|
|
|
4070
4070
|
onDialogOpenChange,
|
|
4071
4071
|
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4072
4072
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4073
|
-
|
|
4073
|
+
_chunkXQEYBESHjs.FormInput,
|
|
4074
4074
|
{
|
|
4075
4075
|
form,
|
|
4076
4076
|
id: "name",
|
|
@@ -4080,7 +4080,7 @@ function ProductEditorInternal({
|
|
|
4080
4080
|
}
|
|
4081
4081
|
),
|
|
4082
4082
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4083
|
-
|
|
4083
|
+
_chunkXQEYBESHjs.FormTextarea,
|
|
4084
4084
|
{
|
|
4085
4085
|
form,
|
|
4086
4086
|
id: "description",
|
|
@@ -4124,20 +4124,20 @@ var defaultContextValue2 = {
|
|
|
4124
4124
|
};
|
|
4125
4125
|
var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ children, dehydratedProduct, publishChrome = true }) => {
|
|
4126
4126
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4127
|
-
const generateUrl =
|
|
4128
|
-
const { hasRole } =
|
|
4127
|
+
const generateUrl = _chunkXQEYBESHjs.usePageUrlGenerator.call(void 0, );
|
|
4128
|
+
const { hasRole } = _chunkXQEYBESHjs.useCurrentUserContext.call(void 0, );
|
|
4129
4129
|
const [product, setProduct] = _react.useState.call(void 0,
|
|
4130
|
-
dehydratedProduct ?
|
|
4130
|
+
dehydratedProduct ? _chunkGSHMGL6Njs.rehydrate.call(void 0, _chunkGSHMGL6Njs.Modules.StripeProduct, dehydratedProduct) : void 0
|
|
4131
4131
|
);
|
|
4132
4132
|
const [catalogueVersion, setCatalogueVersion] = _react.useState.call(void 0, 0);
|
|
4133
4133
|
const refreshCatalogue = _react.useCallback.call(void 0, () => setCatalogueVersion((value2) => value2 + 1), []);
|
|
4134
4134
|
const reloadProduct = _react.useCallback.call(void 0, async () => {
|
|
4135
4135
|
if (!_optionalChain([product, 'optionalAccess', _156 => _156.id])) return;
|
|
4136
|
-
setProduct(await
|
|
4136
|
+
setProduct(await _chunkGSHMGL6Njs.StripeProductService.getProduct({ id: product.id }));
|
|
4137
4137
|
}, [_optionalChain([product, 'optionalAccess', _157 => _157.id])]);
|
|
4138
4138
|
const createProduct = _react.useCallback.call(void 0,
|
|
4139
4139
|
async (input) => {
|
|
4140
|
-
const saved = await
|
|
4140
|
+
const saved = await _chunkGSHMGL6Njs.StripeProductService.createProduct(input);
|
|
4141
4141
|
refreshCatalogue();
|
|
4142
4142
|
return saved;
|
|
4143
4143
|
},
|
|
@@ -4145,7 +4145,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
4145
4145
|
);
|
|
4146
4146
|
const updateProduct = _react.useCallback.call(void 0,
|
|
4147
4147
|
async (input) => {
|
|
4148
|
-
const saved = await
|
|
4148
|
+
const saved = await _chunkGSHMGL6Njs.StripeProductService.updateProduct(input);
|
|
4149
4149
|
setProduct(saved);
|
|
4150
4150
|
refreshCatalogue();
|
|
4151
4151
|
return saved;
|
|
@@ -4156,7 +4156,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
4156
4156
|
async (id) => {
|
|
4157
4157
|
const target = _nullishCoalesce(id, () => ( _optionalChain([product, 'optionalAccess', _158 => _158.id])));
|
|
4158
4158
|
if (!target) return;
|
|
4159
|
-
await
|
|
4159
|
+
await _chunkGSHMGL6Njs.StripeProductService.archiveProduct({ id: target });
|
|
4160
4160
|
await reloadProduct();
|
|
4161
4161
|
refreshCatalogue();
|
|
4162
4162
|
},
|
|
@@ -4166,7 +4166,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
4166
4166
|
async (id) => {
|
|
4167
4167
|
const target = _nullishCoalesce(id, () => ( _optionalChain([product, 'optionalAccess', _160 => _160.id])));
|
|
4168
4168
|
if (!target) return;
|
|
4169
|
-
await
|
|
4169
|
+
await _chunkGSHMGL6Njs.StripeProductService.reactivateProduct({ id: target });
|
|
4170
4170
|
await reloadProduct();
|
|
4171
4171
|
refreshCatalogue();
|
|
4172
4172
|
},
|
|
@@ -4201,7 +4201,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
4201
4201
|
{
|
|
4202
4202
|
name: t("billing.admin.products.title"),
|
|
4203
4203
|
// Linked only when it is NOT the current page.
|
|
4204
|
-
...product ? { href: generateUrl({ page:
|
|
4204
|
+
...product ? { href: generateUrl({ page: _chunkGSHMGL6Njs.Modules.StripeProduct }) } : {}
|
|
4205
4205
|
}
|
|
4206
4206
|
];
|
|
4207
4207
|
if (product) items.push({ name: product.name });
|
|
@@ -4219,7 +4219,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
4219
4219
|
}
|
|
4220
4220
|
return response;
|
|
4221
4221
|
}, "title");
|
|
4222
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4222
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductContext.Provider, { value, children }) });
|
|
4223
4223
|
}, "ProductProvider");
|
|
4224
4224
|
var useProductContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => _nullishCoalesce(_react.useContext.call(void 0, ProductContext), () => ( defaultContextValue2)), "useProductContext");
|
|
4225
4225
|
|
|
@@ -4228,57 +4228,57 @@ var useProductContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ()
|
|
|
4228
4228
|
|
|
4229
4229
|
function PriceDetails() {
|
|
4230
4230
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4231
|
-
const fmt =
|
|
4232
|
-
const generateUrl =
|
|
4231
|
+
const fmt = _chunkXQEYBESHjs.useBillingFormatOptions.call(void 0, );
|
|
4232
|
+
const generateUrl = _chunkXQEYBESHjs.usePageUrlGenerator.call(void 0, );
|
|
4233
4233
|
const { price } = usePriceContext();
|
|
4234
4234
|
if (!price) return null;
|
|
4235
4235
|
const isRecurring = price.priceType === "recurring";
|
|
4236
4236
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-8", children: [
|
|
4237
4237
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4238
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4238
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.SectionHeader, { children: t("billing.admin.prices.title") }),
|
|
4239
4239
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
4240
4240
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4241
|
-
|
|
4241
|
+
_chunkXQEYBESHjs.DetailField,
|
|
4242
4242
|
{
|
|
4243
4243
|
label: t("billing.admin.prices.fields.product"),
|
|
4244
|
-
value: price.product ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4244
|
+
value: price.product ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Link, { href: generateUrl({ page: _chunkGSHMGL6Njs.Modules.StripeProduct, id: price.product.id }), children: price.product.name }) : "\u2014"
|
|
4245
4245
|
}
|
|
4246
4246
|
),
|
|
4247
4247
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4248
|
-
|
|
4248
|
+
_chunkXQEYBESHjs.DetailField,
|
|
4249
4249
|
{
|
|
4250
4250
|
label: t("billing.admin.prices.fields.status"),
|
|
4251
4251
|
value: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex flex-wrap items-center gap-1", children: [
|
|
4252
|
-
price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4253
|
-
price.isTrial && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4252
|
+
price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Badge, { variant: "softGreen", children: t("billing.admin.prices.status.active") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Badge, { variant: "softGray", children: t("billing.admin.prices.status.archived") }),
|
|
4253
|
+
price.isTrial && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Badge, { variant: "softBlue", children: t("billing.admin.prices.badge.trial") })
|
|
4254
4254
|
] })
|
|
4255
4255
|
}
|
|
4256
4256
|
),
|
|
4257
4257
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4258
|
-
|
|
4258
|
+
_chunkXQEYBESHjs.DetailField,
|
|
4259
4259
|
{
|
|
4260
4260
|
label: t("billing.admin.prices.fields.amount"),
|
|
4261
|
-
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children:
|
|
4261
|
+
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _chunkGSHMGL6Njs.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt) })
|
|
4262
4262
|
}
|
|
4263
4263
|
),
|
|
4264
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4264
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.DetailField, { label: t("billing.admin.prices.fields.currency"), value: price.currency.toUpperCase() }),
|
|
4265
4265
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4266
|
-
|
|
4266
|
+
_chunkXQEYBESHjs.DetailField,
|
|
4267
4267
|
{
|
|
4268
4268
|
label: t("billing.admin.prices.fields.type"),
|
|
4269
4269
|
value: isRecurring ? t("billing.admin.prices.type.recurring") : t("billing.admin.prices.type.oneTime")
|
|
4270
4270
|
}
|
|
4271
4271
|
),
|
|
4272
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4272
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.DetailField, { label: t("billing.admin.prices.fields.billing"), value: _chunkGSHMGL6Njs.formatInterval.call(void 0, price, fmt) }),
|
|
4273
4273
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4274
|
-
|
|
4274
|
+
_chunkXQEYBESHjs.DetailField,
|
|
4275
4275
|
{
|
|
4276
4276
|
label: t("billing.admin.prices.fields.intervalCount"),
|
|
4277
4277
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _nullishCoalesce(_optionalChain([price, 'access', _162 => _162.recurring, 'optionalAccess', _163 => _163.intervalCount]), () => ( 1)) })
|
|
4278
4278
|
}
|
|
4279
4279
|
),
|
|
4280
4280
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4281
|
-
|
|
4281
|
+
_chunkXQEYBESHjs.DetailField,
|
|
4282
4282
|
{
|
|
4283
4283
|
label: t("billing.admin.prices.fields.usageType"),
|
|
4284
4284
|
value: _optionalChain([price, 'access', _164 => _164.recurring, 'optionalAccess', _165 => _165.usageType]) === "metered" ? t("billing.admin.prices.usage.metered") : t("billing.admin.prices.usage.licensed")
|
|
@@ -4287,24 +4287,24 @@ function PriceDetails() {
|
|
|
4287
4287
|
] })
|
|
4288
4288
|
] }),
|
|
4289
4289
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4290
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4290
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.SectionHeader, { children: t("billing.admin.prices.fields.platformFeatures") }),
|
|
4291
4291
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
4292
4292
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4293
|
-
|
|
4293
|
+
_chunkXQEYBESHjs.DetailField,
|
|
4294
4294
|
{
|
|
4295
4295
|
label: t("billing.admin.prices.fields.token"),
|
|
4296
4296
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _nullishCoalesce(price.token, () => ( "\u2014")) })
|
|
4297
4297
|
}
|
|
4298
4298
|
),
|
|
4299
4299
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4300
|
-
|
|
4300
|
+
_chunkXQEYBESHjs.DetailField,
|
|
4301
4301
|
{
|
|
4302
4302
|
label: t("billing.admin.prices.fields.stripeId"),
|
|
4303
4303
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: price.stripePriceId })
|
|
4304
4304
|
}
|
|
4305
4305
|
),
|
|
4306
4306
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4307
|
-
|
|
4307
|
+
_chunkXQEYBESHjs.DetailField,
|
|
4308
4308
|
{
|
|
4309
4309
|
label: t("billing.admin.prices.fields.description"),
|
|
4310
4310
|
value: _nullishCoalesce(price.description, () => ( "\u2014")),
|
|
@@ -4312,7 +4312,7 @@ function PriceDetails() {
|
|
|
4312
4312
|
}
|
|
4313
4313
|
),
|
|
4314
4314
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4315
|
-
|
|
4315
|
+
_chunkXQEYBESHjs.DetailField,
|
|
4316
4316
|
{
|
|
4317
4317
|
label: t("billing.admin.prices.fields.features"),
|
|
4318
4318
|
className: "md:col-span-2",
|
|
@@ -4320,11 +4320,11 @@ function PriceDetails() {
|
|
|
4320
4320
|
}
|
|
4321
4321
|
),
|
|
4322
4322
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4323
|
-
|
|
4323
|
+
_chunkXQEYBESHjs.DetailField,
|
|
4324
4324
|
{
|
|
4325
4325
|
label: t("billing.admin.prices.fields.platformFeatures"),
|
|
4326
4326
|
className: "md:col-span-2",
|
|
4327
|
-
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,
|
|
4327
|
+
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, _chunkXQEYBESHjs.Badge, { variant: "softGray", children: feature.name }, feature.id)) }) : "\u2014"
|
|
4328
4328
|
}
|
|
4329
4329
|
)
|
|
4330
4330
|
] })
|
|
@@ -4338,7 +4338,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, PriceDetails, "PriceDetails");
|
|
|
4338
4338
|
function PriceContainer() {
|
|
4339
4339
|
const { price } = usePriceContext();
|
|
4340
4340
|
if (!price) return null;
|
|
4341
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4341
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.RoundPageContainer, { module: _chunkGSHMGL6Njs.Modules.StripePrice, id: price.id, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceDetails, {}) });
|
|
4342
4342
|
}
|
|
4343
4343
|
_chunk7QVYU63Ejs.__name.call(void 0, PriceContainer, "PriceContainer");
|
|
4344
4344
|
|
|
@@ -4463,10 +4463,10 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4463
4463
|
const importInputRef = _react.useRef.call(void 0, null);
|
|
4464
4464
|
const [seed, setSeed] = _react.useState.call(void 0, void 0);
|
|
4465
4465
|
const [seedNonce, setSeedNonce] = _react.useState.call(void 0, 0);
|
|
4466
|
-
const data =
|
|
4467
|
-
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) =>
|
|
4466
|
+
const data = _chunkXQEYBESHjs.useDataListRetriever.call(void 0, {
|
|
4467
|
+
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunkGSHMGL6Njs.StripePriceService.listPrices({ ...params, productId }), "retriever"),
|
|
4468
4468
|
retrieverParams: {},
|
|
4469
|
-
module:
|
|
4469
|
+
module: _chunkGSHMGL6Njs.Modules.StripePrice
|
|
4470
4470
|
});
|
|
4471
4471
|
_react.useEffect.call(void 0, () => {
|
|
4472
4472
|
if (priceVersion > 0) void data.refresh();
|
|
@@ -4501,7 +4501,7 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4501
4501
|
openSeededEditor(transfer.price);
|
|
4502
4502
|
} catch (error) {
|
|
4503
4503
|
console.error("[PricesList] price import failed", error);
|
|
4504
|
-
|
|
4504
|
+
_chunkXQEYBESHjs.errorToast.call(void 0, {
|
|
4505
4505
|
title: t("billing.admin.prices.import.errors.title"),
|
|
4506
4506
|
error: t("billing.admin.prices.import.errors.invalid")
|
|
4507
4507
|
});
|
|
@@ -4520,7 +4520,7 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4520
4520
|
"create-price"
|
|
4521
4521
|
),
|
|
4522
4522
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _react.Fragment, { children: [
|
|
4523
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
4523
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkXQEYBESHjs.Button, { variant: "outline", size: "sm", type: "button", onClick: () => _optionalChain([importInputRef, 'access', _180 => _180.current, 'optionalAccess', _181 => _181.click, 'call', _182 => _182()]), children: [
|
|
4524
4524
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.UploadIcon, {}),
|
|
4525
4525
|
t("billing.admin.prices.actions.import")
|
|
4526
4526
|
] }),
|
|
@@ -4538,7 +4538,7 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4538
4538
|
];
|
|
4539
4539
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
4540
4540
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4541
|
-
|
|
4541
|
+
_chunkXQEYBESHjs.ContentListTable,
|
|
4542
4542
|
{
|
|
4543
4543
|
data,
|
|
4544
4544
|
fields: [
|
|
@@ -4549,13 +4549,13 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4549
4549
|
"status" /* status */,
|
|
4550
4550
|
"actions" /* actions */
|
|
4551
4551
|
],
|
|
4552
|
-
tableGeneratorType:
|
|
4552
|
+
tableGeneratorType: _chunkGSHMGL6Njs.Modules.StripePrice,
|
|
4553
4553
|
functions,
|
|
4554
4554
|
context: tableContext,
|
|
4555
4555
|
fullWidth,
|
|
4556
4556
|
title: t("billing.admin.prices.title"),
|
|
4557
4557
|
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4558
|
-
|
|
4558
|
+
_chunkXQEYBESHjs.EmptyState,
|
|
4559
4559
|
{
|
|
4560
4560
|
icon: _lucidereact.DollarSignIcon,
|
|
4561
4561
|
title: t("billing.admin.prices.empty.title"),
|
|
@@ -4595,18 +4595,18 @@ function ProductDetails() {
|
|
|
4595
4595
|
const { product } = useProductContext();
|
|
4596
4596
|
if (!product) return null;
|
|
4597
4597
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4598
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4598
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.SectionHeader, { children: t("billing.admin.products.tabs.details") }),
|
|
4599
4599
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
4600
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4600
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.DetailField, { label: t("billing.admin.products.fields.name"), value: product.name }),
|
|
4601
4601
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4602
|
-
|
|
4602
|
+
_chunkXQEYBESHjs.DetailField,
|
|
4603
4603
|
{
|
|
4604
4604
|
label: t("billing.admin.products.fields.status"),
|
|
4605
|
-
value: product.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4605
|
+
value: product.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Badge, { variant: "softGreen", children: t("billing.admin.products.status.active") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Badge, { variant: "softGray", children: t("billing.admin.products.status.archived") })
|
|
4606
4606
|
}
|
|
4607
4607
|
),
|
|
4608
4608
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4609
|
-
|
|
4609
|
+
_chunkXQEYBESHjs.DetailField,
|
|
4610
4610
|
{
|
|
4611
4611
|
label: t("billing.admin.products.fields.description"),
|
|
4612
4612
|
value: _nullishCoalesce(product.description, () => ( "\u2014")),
|
|
@@ -4614,14 +4614,14 @@ function ProductDetails() {
|
|
|
4614
4614
|
}
|
|
4615
4615
|
),
|
|
4616
4616
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4617
|
-
|
|
4617
|
+
_chunkXQEYBESHjs.DetailField,
|
|
4618
4618
|
{
|
|
4619
4619
|
label: t("billing.admin.products.fields.prices"),
|
|
4620
4620
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: product.stripePrices.length })
|
|
4621
4621
|
}
|
|
4622
4622
|
),
|
|
4623
4623
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4624
|
-
|
|
4624
|
+
_chunkXQEYBESHjs.DetailField,
|
|
4625
4625
|
{
|
|
4626
4626
|
label: t("billing.admin.products.fields.stripeId"),
|
|
4627
4627
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: product.stripeProductId })
|
|
@@ -4639,9 +4639,9 @@ function ProductContainer() {
|
|
|
4639
4639
|
const { product } = useProductContext();
|
|
4640
4640
|
if (!product) return null;
|
|
4641
4641
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4642
|
-
|
|
4642
|
+
_chunkXQEYBESHjs.RoundPageContainer,
|
|
4643
4643
|
{
|
|
4644
|
-
module:
|
|
4644
|
+
module: _chunkGSHMGL6Njs.Modules.StripeProduct,
|
|
4645
4645
|
id: product.id,
|
|
4646
4646
|
tabs: [
|
|
4647
4647
|
{
|
|
@@ -4650,7 +4650,7 @@ function ProductContainer() {
|
|
|
4650
4650
|
content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductDetails, {})
|
|
4651
4651
|
},
|
|
4652
4652
|
{
|
|
4653
|
-
key:
|
|
4653
|
+
key: _chunkGSHMGL6Njs.Modules.StripePrice,
|
|
4654
4654
|
label: t("billing.admin.prices.title"),
|
|
4655
4655
|
// publishChrome={false}: SharedProvider REPLACES its value for the
|
|
4656
4656
|
// subtree (SharedContext.tsx:35-37), so a nested provider publishing
|
|
@@ -4676,18 +4676,18 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductContainer, "ProductContainer");
|
|
|
4676
4676
|
|
|
4677
4677
|
function CouponsList({ fullWidth } = {}) {
|
|
4678
4678
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4679
|
-
const { catalogueVersion } =
|
|
4680
|
-
const data =
|
|
4681
|
-
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) =>
|
|
4679
|
+
const { catalogueVersion } = _chunkXQEYBESHjs.useCouponContext.call(void 0, );
|
|
4680
|
+
const data = _chunkXQEYBESHjs.useDataListRetriever.call(void 0, {
|
|
4681
|
+
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunkGSHMGL6Njs.StripeCouponService.listCoupons(params), "retriever"),
|
|
4682
4682
|
retrieverParams: {},
|
|
4683
|
-
module:
|
|
4683
|
+
module: _chunkGSHMGL6Njs.Modules.StripeCoupon
|
|
4684
4684
|
});
|
|
4685
4685
|
_react.useEffect.call(void 0, () => {
|
|
4686
4686
|
if (catalogueVersion > 0) void data.refresh();
|
|
4687
4687
|
}, [catalogueVersion]);
|
|
4688
|
-
const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4688
|
+
const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.CouponEditor, {}, "create-coupon")];
|
|
4689
4689
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4690
|
-
|
|
4690
|
+
_chunkXQEYBESHjs.ContentListTable,
|
|
4691
4691
|
{
|
|
4692
4692
|
data,
|
|
4693
4693
|
fields: [
|
|
@@ -4697,12 +4697,12 @@ function CouponsList({ fullWidth } = {}) {
|
|
|
4697
4697
|
"codes" /* codes */,
|
|
4698
4698
|
"status" /* status */
|
|
4699
4699
|
],
|
|
4700
|
-
tableGeneratorType:
|
|
4700
|
+
tableGeneratorType: _chunkGSHMGL6Njs.Modules.StripeCoupon,
|
|
4701
4701
|
functions,
|
|
4702
4702
|
fullWidth,
|
|
4703
4703
|
title: t("billing.admin.coupons.title"),
|
|
4704
4704
|
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4705
|
-
|
|
4705
|
+
_chunkXQEYBESHjs.EmptyState,
|
|
4706
4706
|
{
|
|
4707
4707
|
icon: _lucidereact.TicketPercentIcon,
|
|
4708
4708
|
title: t("billing.admin.coupons.empty.title"),
|
|
@@ -4722,26 +4722,26 @@ _chunk7QVYU63Ejs.__name.call(void 0, CouponsList, "CouponsList");
|
|
|
4722
4722
|
function ProductsList({ fullWidth } = {}) {
|
|
4723
4723
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4724
4724
|
const { catalogueVersion } = useProductContext();
|
|
4725
|
-
const data =
|
|
4726
|
-
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) =>
|
|
4725
|
+
const data = _chunkXQEYBESHjs.useDataListRetriever.call(void 0, {
|
|
4726
|
+
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunkGSHMGL6Njs.StripeProductService.listProducts(params), "retriever"),
|
|
4727
4727
|
retrieverParams: {},
|
|
4728
|
-
module:
|
|
4728
|
+
module: _chunkGSHMGL6Njs.Modules.StripeProduct
|
|
4729
4729
|
});
|
|
4730
4730
|
_react.useEffect.call(void 0, () => {
|
|
4731
4731
|
if (catalogueVersion > 0) void data.refresh();
|
|
4732
4732
|
}, [catalogueVersion]);
|
|
4733
4733
|
const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductEditor, {}, "create-product")];
|
|
4734
4734
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4735
|
-
|
|
4735
|
+
_chunkXQEYBESHjs.ContentListTable,
|
|
4736
4736
|
{
|
|
4737
4737
|
data,
|
|
4738
4738
|
fields: ["name" /* name */, "status" /* status */, "prices" /* prices */],
|
|
4739
|
-
tableGeneratorType:
|
|
4739
|
+
tableGeneratorType: _chunkGSHMGL6Njs.Modules.StripeProduct,
|
|
4740
4740
|
functions,
|
|
4741
4741
|
fullWidth,
|
|
4742
4742
|
title: t("billing.admin.products.title"),
|
|
4743
4743
|
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4744
|
-
|
|
4744
|
+
_chunkXQEYBESHjs.EmptyState,
|
|
4745
4745
|
{
|
|
4746
4746
|
icon: _lucidereact.PackageIcon,
|
|
4747
4747
|
title: t("billing.admin.products.empty.title"),
|
|
@@ -4757,10 +4757,10 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductsList, "ProductsList");
|
|
|
4757
4757
|
|
|
4758
4758
|
function ProductsListContainer() {
|
|
4759
4759
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4760
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductProvider, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4761
|
-
|
|
4760
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductProvider, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.CouponProvider, { publishChrome: false, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4761
|
+
_chunkXQEYBESHjs.RoundPageContainer,
|
|
4762
4762
|
{
|
|
4763
|
-
module:
|
|
4763
|
+
module: _chunkGSHMGL6Njs.Modules.StripeProduct,
|
|
4764
4764
|
tabs: [
|
|
4765
4765
|
{ sectionKey: "products", label: t("billing.admin.products.tabs.products"), content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductsList, {}) },
|
|
4766
4766
|
{ sectionKey: "codes", label: t("billing.admin.products.tabs.codes"), content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CouponsList, {}) }
|
|
@@ -4778,30 +4778,30 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductsListContainer, "ProductsListContain
|
|
|
4778
4778
|
|
|
4779
4779
|
function CouponDetails() {
|
|
4780
4780
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4781
|
-
const fmt =
|
|
4782
|
-
const { coupon } =
|
|
4781
|
+
const fmt = _chunkXQEYBESHjs.useBillingFormatOptions.call(void 0, );
|
|
4782
|
+
const { coupon } = _chunkXQEYBESHjs.useCouponContext.call(void 0, );
|
|
4783
4783
|
if (!coupon) return null;
|
|
4784
4784
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4785
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4785
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.SectionHeader, { children: t("billing.admin.products.tabs.details") }),
|
|
4786
4786
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-xs/relaxed", children: t("billing.admin.coupons.fixed_notice") }),
|
|
4787
4787
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
4788
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4788
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.DetailField, { label: t("billing.admin.coupons.fields.name"), value: coupon.name }),
|
|
4789
4789
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4790
|
-
|
|
4790
|
+
_chunkXQEYBESHjs.DetailField,
|
|
4791
4791
|
{
|
|
4792
4792
|
label: t("billing.admin.coupons.fields.status"),
|
|
4793
|
-
value: coupon.valid ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4793
|
+
value: coupon.valid ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Badge, { variant: "softGreen", children: t("billing.admin.coupons.status.active") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.Badge, { variant: "softGray", children: t("billing.admin.coupons.status.ended") })
|
|
4794
4794
|
}
|
|
4795
4795
|
),
|
|
4796
4796
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4797
|
-
|
|
4797
|
+
_chunkXQEYBESHjs.DetailField,
|
|
4798
4798
|
{
|
|
4799
4799
|
label: t("billing.admin.coupons.fields.discount"),
|
|
4800
|
-
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children:
|
|
4800
|
+
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _chunkGSHMGL6Njs.formatCouponDiscount.call(void 0, coupon, t, fmt) })
|
|
4801
4801
|
}
|
|
4802
4802
|
),
|
|
4803
4803
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4804
|
-
|
|
4804
|
+
_chunkXQEYBESHjs.DetailField,
|
|
4805
4805
|
{
|
|
4806
4806
|
label: t("billing.admin.coupons.fields.places"),
|
|
4807
4807
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: coupon.maxRedemptions !== void 0 ? t("billing.admin.coupons.places.limited", {
|
|
@@ -4811,21 +4811,21 @@ function CouponDetails() {
|
|
|
4811
4811
|
}
|
|
4812
4812
|
),
|
|
4813
4813
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4814
|
-
|
|
4814
|
+
_chunkXQEYBESHjs.DetailField,
|
|
4815
4815
|
{
|
|
4816
4816
|
label: t("billing.admin.coupons.fields.products"),
|
|
4817
4817
|
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")
|
|
4818
4818
|
}
|
|
4819
4819
|
),
|
|
4820
4820
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4821
|
-
|
|
4821
|
+
_chunkXQEYBESHjs.DetailField,
|
|
4822
4822
|
{
|
|
4823
4823
|
label: t("billing.admin.coupons.fields.redeemBy"),
|
|
4824
|
-
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: coupon.redeemBy ?
|
|
4824
|
+
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: coupon.redeemBy ? _chunkXQEYBESHjs.formatDate.call(void 0, coupon.redeemBy, fmt) : "\u2014" })
|
|
4825
4825
|
}
|
|
4826
4826
|
),
|
|
4827
4827
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4828
|
-
|
|
4828
|
+
_chunkXQEYBESHjs.DetailField,
|
|
4829
4829
|
{
|
|
4830
4830
|
label: t("billing.admin.coupons.fields.stripeId"),
|
|
4831
4831
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: coupon.stripeCouponId })
|
|
@@ -4859,33 +4859,33 @@ function CouponCodeEditorInternal({
|
|
|
4859
4859
|
onDialogOpenChange
|
|
4860
4860
|
}) {
|
|
4861
4861
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4862
|
-
const router =
|
|
4863
|
-
const { createCode } =
|
|
4864
|
-
const formSchema2 = _react.useMemo.call(void 0, () => _zod3.z.object({ id: _zod3.z.uuidv4() }).and(
|
|
4865
|
-
const getDefaultValues = _react.useCallback.call(void 0, () => ({ id: _uuid.v4.call(void 0, ), ...
|
|
4862
|
+
const router = _chunkGSHMGL6Njs.useI18nRouter.call(void 0, );
|
|
4863
|
+
const { createCode } = _chunkXQEYBESHjs.useCouponContext.call(void 0, );
|
|
4864
|
+
const formSchema2 = _react.useMemo.call(void 0, () => _zod3.z.object({ id: _zod3.z.uuidv4() }).and(_chunkXQEYBESHjs.couponCodeSchema.call(void 0, t)), [t]);
|
|
4865
|
+
const getDefaultValues = _react.useCallback.call(void 0, () => ({ id: _uuid.v4.call(void 0, ), ..._chunkXQEYBESHjs.couponCodeDefaults.call(void 0, ) }), []);
|
|
4866
4866
|
const form = _reacthookform.useForm.call(void 0, {
|
|
4867
4867
|
resolver: _zod.zodResolver.call(void 0, formSchema2),
|
|
4868
4868
|
defaultValues: getDefaultValues()
|
|
4869
4869
|
});
|
|
4870
4870
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4871
|
-
|
|
4871
|
+
_chunkXQEYBESHjs.EditorSheet,
|
|
4872
4872
|
{
|
|
4873
4873
|
form,
|
|
4874
4874
|
entityType: t("billing.admin.coupons.codes.entity"),
|
|
4875
4875
|
isEdit: false,
|
|
4876
|
-
module:
|
|
4876
|
+
module: _chunkGSHMGL6Njs.Modules.StripeCouponCode,
|
|
4877
4877
|
size: "md",
|
|
4878
4878
|
onSuccess: _nullishCoalesce(onSuccess, () => ( (() => {
|
|
4879
4879
|
}))),
|
|
4880
4880
|
onNavigate: (url) => router.push(url),
|
|
4881
|
-
onSubmit: async (values) => await createCode({ id: values.id, couponId, ...
|
|
4881
|
+
onSubmit: async (values) => await createCode({ id: values.id, couponId, ..._chunkXQEYBESHjs.toCouponCodeInput.call(void 0, values) }),
|
|
4882
4882
|
onReset: getDefaultValues,
|
|
4883
4883
|
trigger,
|
|
4884
4884
|
forceShow,
|
|
4885
4885
|
onClose,
|
|
4886
4886
|
dialogOpen,
|
|
4887
4887
|
onDialogOpenChange,
|
|
4888
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4888
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkXQEYBESHjs.CouponCodeFields, { form })
|
|
4889
4889
|
}
|
|
4890
4890
|
);
|
|
4891
4891
|
}
|
|
@@ -4899,18 +4899,18 @@ _chunk7QVYU63Ejs.__name.call(void 0, CouponCodeEditor, "CouponCodeEditor");
|
|
|
4899
4899
|
|
|
4900
4900
|
function CouponCodesList({ couponId }) {
|
|
4901
4901
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4902
|
-
const { catalogueVersion } =
|
|
4903
|
-
const data =
|
|
4904
|
-
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) =>
|
|
4902
|
+
const { catalogueVersion } = _chunkXQEYBESHjs.useCouponContext.call(void 0, );
|
|
4903
|
+
const data = _chunkXQEYBESHjs.useDataListRetriever.call(void 0, {
|
|
4904
|
+
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunkGSHMGL6Njs.StripeCouponCodeService.listByCoupon({ ...params, couponId }), "retriever"),
|
|
4905
4905
|
retrieverParams: {},
|
|
4906
|
-
module:
|
|
4906
|
+
module: _chunkGSHMGL6Njs.Modules.StripeCouponCode
|
|
4907
4907
|
});
|
|
4908
4908
|
_react.useEffect.call(void 0, () => {
|
|
4909
4909
|
if (catalogueVersion > 0) void data.refresh();
|
|
4910
4910
|
}, [catalogueVersion]);
|
|
4911
4911
|
const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, CouponCodeEditor, { couponId }, "create-code")];
|
|
4912
4912
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4913
|
-
|
|
4913
|
+
_chunkXQEYBESHjs.ContentListTable,
|
|
4914
4914
|
{
|
|
4915
4915
|
data,
|
|
4916
4916
|
fields: [
|
|
@@ -4921,11 +4921,11 @@ function CouponCodesList({ couponId }) {
|
|
|
4921
4921
|
"status" /* status */,
|
|
4922
4922
|
"actions" /* actions */
|
|
4923
4923
|
],
|
|
4924
|
-
tableGeneratorType:
|
|
4924
|
+
tableGeneratorType: _chunkGSHMGL6Njs.Modules.StripeCouponCode,
|
|
4925
4925
|
functions,
|
|
4926
4926
|
title: t("billing.admin.coupons.codes.title"),
|
|
4927
4927
|
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4928
|
-
|
|
4928
|
+
_chunkXQEYBESHjs.EmptyState,
|
|
4929
4929
|
{
|
|
4930
4930
|
icon: _lucidereact.TicketIcon,
|
|
4931
4931
|
title: t("billing.admin.coupons.codes.empty.title"),
|
|
@@ -4941,12 +4941,12 @@ _chunk7QVYU63Ejs.__name.call(void 0, CouponCodesList, "CouponCodesList");
|
|
|
4941
4941
|
|
|
4942
4942
|
function CouponContainer() {
|
|
4943
4943
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4944
|
-
const { coupon } =
|
|
4944
|
+
const { coupon } = _chunkXQEYBESHjs.useCouponContext.call(void 0, );
|
|
4945
4945
|
if (!coupon) return null;
|
|
4946
4946
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4947
|
-
|
|
4947
|
+
_chunkXQEYBESHjs.RoundPageContainer,
|
|
4948
4948
|
{
|
|
4949
|
-
module:
|
|
4949
|
+
module: _chunkXQEYBESHjs.couponPageModule.call(void 0, ),
|
|
4950
4950
|
id: coupon.id,
|
|
4951
4951
|
tabs: [
|
|
4952
4952
|
{
|
|
@@ -5053,5 +5053,5 @@ _chunk7QVYU63Ejs.__name.call(void 0, CouponContainer, "CouponContainer");
|
|
|
5053
5053
|
|
|
5054
5054
|
|
|
5055
5055
|
|
|
5056
|
-
exports.BillingAlertBanner = BillingAlertBanner; exports.BillingDashboardContainer = BillingDashboardContainer; exports.BillingDetailModal = BillingDetailModal; exports.BillingUsageSummaryCard = BillingUsageSummaryCard; exports.CancelSubscriptionDialog = CancelSubscriptionDialog; exports.CouponCodeActions =
|
|
5056
|
+
exports.BillingAlertBanner = BillingAlertBanner; exports.BillingDashboardContainer = BillingDashboardContainer; exports.BillingDetailModal = BillingDetailModal; exports.BillingUsageSummaryCard = BillingUsageSummaryCard; exports.CancelSubscriptionDialog = CancelSubscriptionDialog; exports.CouponCodeActions = _chunkXQEYBESHjs.CouponCodeActions; exports.CouponCodeEditor = CouponCodeEditor; exports.CouponCodeFields = _chunkXQEYBESHjs.CouponCodeFields; exports.CouponCodesList = CouponCodesList; exports.CouponContainer = CouponContainer; exports.CouponDetails = CouponDetails; exports.CouponEditor = _chunkXQEYBESHjs.CouponEditor; exports.CouponProvider = _chunkXQEYBESHjs.CouponProvider; exports.CouponRefresher = _chunkXQEYBESHjs.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 = _chunkXQEYBESHjs.applyDiscount; exports.couponCodeDefaults = _chunkXQEYBESHjs.couponCodeDefaults; exports.couponCodeSchema = _chunkXQEYBESHjs.couponCodeSchema; exports.couponCurrencyOptions = _chunkXQEYBESHjs.couponCurrencyOptions; exports.formatCurrency = _chunkGSHMGL6Njs.formatCurrency; exports.formatDate = _chunkXQEYBESHjs.formatDate; exports.formatFixed = _chunkGSHMGL6Njs.formatFixed; exports.formatInterval = _chunkGSHMGL6Njs.formatInterval; exports.isStripeConfigured = isStripeConfigured; exports.optionalDate = _chunkXQEYBESHjs.optionalDate; exports.optionalDecimal = _chunkXQEYBESHjs.optionalDecimal; exports.optionalPositiveInt = _chunkXQEYBESHjs.optionalPositiveInt; exports.parseOptionalDecimal = _chunkXQEYBESHjs.parseOptionalDecimal; exports.parseOptionalPositiveInt = _chunkXQEYBESHjs.parseOptionalPositiveInt; exports.priceLabel = priceLabel; exports.promotionCodeDiscount = _chunkXQEYBESHjs.promotionCodeDiscount; exports.subscriptionDiscount = _chunkXQEYBESHjs.subscriptionDiscount; exports.toCouponCodeInput = _chunkXQEYBESHjs.toCouponCodeInput; exports.useBillingFormatOptions = _chunkXQEYBESHjs.useBillingFormatOptions; exports.useCouponContext = _chunkXQEYBESHjs.useCouponContext; exports.usePriceContext = usePriceContext; exports.useProductContext = useProductContext;
|
|
5057
5057
|
//# sourceMappingURL=index.js.map
|