@carlonicora/nextjs-jsonapi 5.7.3 → 6.0.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-R3745ALQ.mjs → BlockNoteEditor-FZNU4YQT.mjs} +4 -4
- package/dist/{BlockNoteEditor-G45WMJ5V.js → BlockNoteEditor-SAU3G6H7.js} +19 -19
- package/dist/{BlockNoteEditor-G45WMJ5V.js.map → BlockNoteEditor-SAU3G6H7.js.map} +1 -1
- package/dist/{BlockNoteViewer-TNK3OMH5.mjs → BlockNoteViewer-6XDDVTN6.mjs} +2 -2
- package/dist/{BlockNoteViewer-5PGOVURC.js → BlockNoteViewer-7BTV7QQA.js} +3 -3
- package/dist/{BlockNoteViewer-5PGOVURC.js.map → BlockNoteViewer-7BTV7QQA.js.map} +1 -1
- package/dist/billing/index.js +492 -506
- package/dist/billing/index.js.map +1 -1
- package/dist/billing/index.mjs +5 -19
- package/dist/billing/index.mjs.map +1 -1
- package/dist/{chunk-CP7BXAFH.js → chunk-F4JB7YAP.js} +8 -8
- package/dist/{chunk-CP7BXAFH.js.map → chunk-F4JB7YAP.js.map} +1 -1
- package/dist/{chunk-KOA5PZZA.mjs → chunk-GFGKMUPZ.mjs} +2 -2
- package/dist/{chunk-EXG4ANC7.js → chunk-IPYXT7MH.js} +868 -868
- package/dist/{chunk-EXG4ANC7.js.map → chunk-IPYXT7MH.js.map} +1 -1
- package/dist/{chunk-RJMLAW5O.mjs → chunk-JVJS5RHB.mjs} +2 -2
- package/dist/{chunk-WU47MIZZ.js → chunk-MTI2UXDA.js} +4 -4
- package/dist/{chunk-WU47MIZZ.js.map → chunk-MTI2UXDA.js.map} +1 -1
- package/dist/{chunk-6KAYEYFU.mjs → chunk-RYZYKG6W.mjs} +2 -2
- package/dist/{chunk-3CSPHMVK.js → chunk-T3YQ47EF.js} +2 -32
- package/dist/chunk-T3YQ47EF.js.map +1 -0
- package/dist/{chunk-YG4YFAYY.js → chunk-TPZS46IM.js} +3 -3
- package/dist/{chunk-YG4YFAYY.js.map → chunk-TPZS46IM.js.map} +1 -1
- package/dist/{chunk-JCNB5KTQ.mjs → chunk-U7DR5VDT.mjs} +5 -5
- package/dist/{chunk-CJS5WA4E.mjs → chunk-USYZNWKS.mjs} +2 -32
- package/dist/chunk-USYZNWKS.mjs.map +1 -0
- 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.d.mts +0 -12
- package/dist/core/index.d.ts +0 -12
- 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.js +121 -121
- package/dist/features/analytics/index.mjs +4 -4
- 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 +124 -124
- package/dist/features/tokenusage/index.mjs +4 -4
- 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 +2 -1
- package/messages/it.json +2 -1
- package/package.json +1 -1
- package/src/features/__tests__/i18n-keys.contract.spec.ts +4 -0
- package/src/features/billing/components/cards/SubscriptionSummaryCard.tsx +22 -14
- package/src/features/billing/i18n-keys.ts +1 -0
- package/src/features/billing/stripe-subscription/components/details/SubscriptionDetails.tsx +1 -21
- package/src/features/billing/stripe-subscription/data/__tests__/stripe-subscription.spec.ts +59 -0
- package/src/features/billing/stripe-subscription/data/stripe-subscription.service.ts +0 -34
- package/src/features/billing/stripe-subscription/data/stripe-subscription.ts +1 -1
- package/dist/chunk-3CSPHMVK.js.map +0 -1
- package/dist/chunk-CJS5WA4E.mjs.map +0 -1
- /package/dist/{BlockNoteEditor-R3745ALQ.mjs.map → BlockNoteEditor-FZNU4YQT.mjs.map} +0 -0
- /package/dist/{BlockNoteViewer-TNK3OMH5.mjs.map → BlockNoteViewer-6XDDVTN6.mjs.map} +0 -0
- /package/dist/{chunk-KOA5PZZA.mjs.map → chunk-GFGKMUPZ.mjs.map} +0 -0
- /package/dist/{chunk-RJMLAW5O.mjs.map → chunk-JVJS5RHB.mjs.map} +0 -0
- /package/dist/{chunk-6KAYEYFU.mjs.map → chunk-RYZYKG6W.mjs.map} +0 -0
- /package/dist/{chunk-JCNB5KTQ.mjs.map → chunk-U7DR5VDT.mjs.map} +0 -0
package/dist/billing/index.js
CHANGED
|
@@ -81,10 +81,10 @@
|
|
|
81
81
|
|
|
82
82
|
|
|
83
83
|
|
|
84
|
-
var
|
|
84
|
+
var _chunkIPYXT7MHjs = require('../chunk-IPYXT7MH.js');
|
|
85
85
|
|
|
86
86
|
|
|
87
|
-
var
|
|
87
|
+
var _chunkF4JB7YAPjs = require('../chunk-F4JB7YAP.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 _chunkT3YQ47EFjs = require('../chunk-T3YQ47EF.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(_chunkT3YQ47EFjs.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 = _chunkIPYXT7MHjs.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, _chunkIPYXT7MHjs.Card, { children: [
|
|
164
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
165
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.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, _chunkIPYXT7MHjs.CardContent, { children: [
|
|
169
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
170
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.Skeleton, { className: "h-4 w-24 mb-1" }),
|
|
171
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.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, _chunkIPYXT7MHjs.Card, { children: [
|
|
177
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
178
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.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, _chunkIPYXT7MHjs.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
|
-
(sub) => sub.status === "active" /* ACTIVE */ || sub.status === "trialing" /* TRIALING */
|
|
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, _chunkIPYXT7MHjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
|
|
189
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
190
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.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, _chunkIPYXT7MHjs.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
|
+
_chunkIPYXT7MHjs.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
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
216
|
-
|
|
215
|
+
primarySubscription.status === "past_due" /* PAST_DUE */ ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.Badge, { variant: "softRed", children: t("billing.ui.cards.subscriptions.payment_failing") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
216
|
+
_chunkIPYXT7MHjs.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: _chunkIPYXT7MHjs.formatDate.call(void 0, primarySubscription.currentPeriodEnd, fmt)
|
|
225
225
|
}) : primarySubscription.cancelAtPeriodEnd ? t("billing.ui.cards.subscriptions.cancels_on", {
|
|
226
|
-
date:
|
|
226
|
+
date: _chunkIPYXT7MHjs.formatDate.call(void 0, primarySubscription.currentPeriodEnd, fmt)
|
|
227
227
|
}) : t("billing.ui.cards.subscriptions.renews_on", {
|
|
228
|
-
date:
|
|
228
|
+
date: _chunkIPYXT7MHjs.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, _chunkIPYXT7MHjs.Card, { children: [
|
|
263
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
264
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.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, _chunkIPYXT7MHjs.CardContent, { children: [
|
|
268
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
269
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.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, _chunkIPYXT7MHjs.Card, { children: [
|
|
275
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
276
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.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, _chunkIPYXT7MHjs.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, _chunkIPYXT7MHjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
|
|
284
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
285
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.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, _chunkIPYXT7MHjs.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
|
+
_chunkIPYXT7MHjs.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 = _chunkT3YQ47EFjs.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 _chunkT3YQ47EFjs.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, _chunkIPYXT7MHjs.Card, { children: [
|
|
357
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
358
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.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, _chunkIPYXT7MHjs.CardContent, { children: [
|
|
362
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
363
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.Skeleton, { className: "h-4 w-48 mb-1" }),
|
|
364
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.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, _chunkIPYXT7MHjs.Card, { children: [
|
|
370
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
371
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.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, _chunkIPYXT7MHjs.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, _chunkIPYXT7MHjs.Card, { children: [
|
|
379
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
380
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.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, _chunkIPYXT7MHjs.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, _chunkIPYXT7MHjs.Card, { children: [
|
|
390
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
391
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.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, _chunkIPYXT7MHjs.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, _chunkIPYXT7MHjs.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(_chunkT3YQ47EFjs.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 = _chunkIPYXT7MHjs.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, _chunkIPYXT7MHjs.Card, { children: [
|
|
445
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
446
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.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, _chunkIPYXT7MHjs.CardContent, { children: [
|
|
450
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.Skeleton, { className: "h-6 w-24 mb-2" }),
|
|
451
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.Skeleton, { className: "h-4 w-32 mb-1" }),
|
|
452
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.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, _chunkIPYXT7MHjs.Card, { children: [
|
|
458
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
459
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.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, _chunkIPYXT7MHjs.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, _chunkIPYXT7MHjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewAllClick, children: [
|
|
469
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
470
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.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, _chunkIPYXT7MHjs.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, _chunkIPYXT7MHjs.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: _chunkIPYXT7MHjs.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 = _chunkT3YQ47EFjs.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, _chunkIPYXT7MHjs.Card, { children: [
|
|
517
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
518
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.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, _chunkIPYXT7MHjs.CardContent, { children: [
|
|
522
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.Skeleton, { className: "h-6 w-24 mb-2" }),
|
|
523
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.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, _chunkIPYXT7MHjs.Card, { children: [
|
|
529
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
530
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.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, _chunkIPYXT7MHjs.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, _chunkIPYXT7MHjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewDetailsClick, children: [
|
|
542
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
543
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.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, _chunkIPYXT7MHjs.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 _chunkT3YQ47EFjs.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 _chunkT3YQ47EFjs.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, _chunkIPYXT7MHjs.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.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
|
+
_chunkIPYXT7MHjs.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, _chunkIPYXT7MHjs.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, _chunkIPYXT7MHjs.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.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, _chunkIPYXT7MHjs.Button, { type: "button", variant: "outline", onClick: onCancel, disabled: isSubmitting || isLoading, children: t("ui.buttons.cancel") }),
|
|
693
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.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, _chunkIPYXT7MHjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.DialogContent, { className: "max-w-md", children: [
|
|
711
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.DialogHeader, { children: [
|
|
712
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.DialogTitle, { children: t("billing.ui.payment_methods.add") }),
|
|
713
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.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 _chunkT3YQ47EFjs.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 _chunkT3YQ47EFjs.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 _chunkT3YQ47EFjs.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, _chunkIPYXT7MHjs.Card, { className: "relative", children: [
|
|
777
|
+
isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.Badge, { variant: "softGreen", className: "absolute end-2 top-2", children: t("billing.ui.payment_methods.default") }),
|
|
778
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.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, _chunkIPYXT7MHjs.DropdownMenu, { children: [
|
|
784
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.DropdownMenuTrigger, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
785
|
+
_chunkIPYXT7MHjs.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, _chunkIPYXT7MHjs.DropdownMenuContent, { align: "end", children: [
|
|
797
|
+
!isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.DropdownMenuItem, { onClick: handleSetDefault, disabled: loading, children: t("billing.ui.payment_methods.set_default") }),
|
|
798
798
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
799
|
-
|
|
799
|
+
_chunkIPYXT7MHjs.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, _chunkIPYXT7MHjs.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, _chunkIPYXT7MHjs.AlertDialog, { open: showRemoveDialog, onOpenChange: setShowRemoveDialog, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.AlertDialogContent, { children: [
|
|
819
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.AlertDialogHeader, { children: [
|
|
820
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.AlertDialogTitle, { children: t("billing.ui.payment_methods.remove_title") }),
|
|
821
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.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, _chunkIPYXT7MHjs.AlertDialogFooter, { children: [
|
|
827
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.AlertDialogCancel, { disabled: loading, children: t("ui.buttons.cancel") }),
|
|
828
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.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 _chunkT3YQ47EFjs.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, _chunkIPYXT7MHjs.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, _chunkIPYXT7MHjs.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, _chunkIPYXT7MHjs.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 = _chunkIPYXT7MHjs.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, _chunkIPYXT7MHjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.DialogContent, { className: "max-w-2xl", children: [
|
|
969
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.DialogHeader, { children: [
|
|
970
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.DialogTitle, { children: t("billing.ui.invoice.title", { number: getInvoiceNumber() }) }),
|
|
971
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.DialogDescription, { children: _chunkIPYXT7MHjs.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
|
+
_chunkIPYXT7MHjs.formatDate.call(void 0, invoice.periodStart, fmt),
|
|
983
983
|
" - ",
|
|
984
|
-
|
|
984
|
+
_chunkIPYXT7MHjs.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: _chunkIPYXT7MHjs.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: _chunkIPYXT7MHjs.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: _chunkT3YQ47EFjs.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: _chunkT3YQ47EFjs.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: _chunkT3YQ47EFjs.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: _chunkT3YQ47EFjs.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: _chunkT3YQ47EFjs.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: _chunkT3YQ47EFjs.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, _chunkIPYXT7MHjs.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, _chunkIPYXT7MHjs.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, _chunkIPYXT7MHjs.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 = _chunkIPYXT7MHjs.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, _chunkIPYXT7MHjs.Table, { children: [
|
|
1071
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.TableRow, { children: [
|
|
1072
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TableHead, { children: t("billing.ui.columns.invoice_number") }),
|
|
1073
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TableHead, { children: t("billing.ui.columns.date") }),
|
|
1074
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TableHead, { children: t("billing.ui.columns.status") }),
|
|
1075
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TableHead, { className: "text-end", children: t("billing.ui.columns.amount") }),
|
|
1076
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TableHead, { children: t("billing.ui.columns.period") })
|
|
1077
1077
|
] }) }),
|
|
1078
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1078
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TableBody, { children: invoices.map((invoice) => {
|
|
1079
1079
|
const invoiceNumber = getInvoiceNumber(invoice);
|
|
1080
|
-
const date =
|
|
1081
|
-
const amount =
|
|
1082
|
-
const period = `${
|
|
1080
|
+
const date = _chunkIPYXT7MHjs.formatDate.call(void 0, invoice.periodStart, fmt);
|
|
1081
|
+
const amount = _chunkT3YQ47EFjs.formatCurrency.call(void 0, invoice.total, invoice.currency, fmt);
|
|
1082
|
+
const period = `${_chunkIPYXT7MHjs.formatDate.call(void 0, invoice.periodStart, fmt)} - ${_chunkIPYXT7MHjs.formatDate.call(void 0, invoice.periodEnd, fmt)}`;
|
|
1083
1083
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1084
|
-
|
|
1084
|
+
_chunkIPYXT7MHjs.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, _chunkIPYXT7MHjs.TableCell, { className: "font-medium", children: invoiceNumber }),
|
|
1090
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TableCell, { className: "text-muted-foreground text-xs", children: date }),
|
|
1091
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InvoiceStatusBadge, { status: invoice.status }) }),
|
|
1092
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TableCell, { className: "text-end font-medium", children: amount }),
|
|
1093
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.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 _chunkT3YQ47EFjs.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, _chunkIPYXT7MHjs.Tabs, { value: statusFilter, onValueChange: handleFilterChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.TabsList, { children: [
|
|
1144
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TabsTrigger, { value: "all", children: t("billing.ui.invoices.filter_all") }),
|
|
1145
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TabsTrigger, { value: "paid" /* PAID */, children: t("billing.ui.invoice_status.paid") }),
|
|
1146
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TabsTrigger, { value: "open" /* OPEN */, children: t("billing.ui.invoice_status.open") }),
|
|
1147
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TabsTrigger, { value: "void" /* VOID */, children: t("billing.ui.invoice_status.void") }),
|
|
1148
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.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 = _chunkIPYXT7MHjs.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 _chunkT3YQ47EFjs.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 = _chunkIPYXT7MHjs.formatDate.call(void 0, subscription.currentPeriodEnd, fmt);
|
|
1214
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.DialogContent, { className: "max-w-md", children: [
|
|
1215
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.DialogHeader, { children: [
|
|
1216
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.DialogTitle, { children: t("billing.ui.subscription.cancel.title") }),
|
|
1217
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.DialogDescription, { children: t("billing.ui.subscription.cancel.description") })
|
|
1218
1218
|
] }),
|
|
1219
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1219
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.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
|
+
_chunkIPYXT7MHjs.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, _chunkIPYXT7MHjs.Button, { type: "button", variant: "outline", onClick: () => onOpenChange(false), disabled: isSubmitting, children: t("billing.ui.subscription.cancel.keep") }),
|
|
1233
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.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, _chunkIPYXT7MHjs.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 _chunkT3YQ47EFjs.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,35 +1319,22 @@ function SubscriptionDetails({
|
|
|
1319
1319
|
onChangePlan
|
|
1320
1320
|
}) {
|
|
1321
1321
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1322
|
-
const fmt =
|
|
1322
|
+
const fmt = _chunkIPYXT7MHjs.useBillingFormatOptions.call(void 0, );
|
|
1323
1323
|
const [showCancel, setShowCancel] = _react.useState.call(void 0, false);
|
|
1324
|
-
const [isProcessing, setIsProcessing] = _react.useState.call(void 0, false);
|
|
1325
|
-
const handleResume = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1326
|
-
setIsProcessing(true);
|
|
1327
|
-
try {
|
|
1328
|
-
await _chunk3CSPHMVKjs.StripeSubscriptionService.resumeSubscription({ subscriptionId: subscription.id });
|
|
1329
|
-
onSubscriptionChange();
|
|
1330
|
-
} catch (error) {
|
|
1331
|
-
console.error("[SubscriptionDetails] Failed to resume subscription:", error);
|
|
1332
|
-
} finally {
|
|
1333
|
-
setIsProcessing(false);
|
|
1334
|
-
}
|
|
1335
|
-
}, "handleResume");
|
|
1336
1324
|
const handleManageViaPortal = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1337
1325
|
try {
|
|
1338
|
-
const { url } = await
|
|
1326
|
+
const { url } = await _chunkT3YQ47EFjs.StripeCustomerService.createPortalSession();
|
|
1339
1327
|
window.open(url, "_blank");
|
|
1340
1328
|
} catch (error) {
|
|
1341
1329
|
console.error("[SubscriptionDetails] Failed to create portal session:", error);
|
|
1342
1330
|
}
|
|
1343
1331
|
}, "handleManageViaPortal");
|
|
1344
|
-
const canResume = subscription.status === "paused" /* PAUSED */;
|
|
1345
1332
|
const canCancel = subscription.status === "active" /* ACTIVE */ || subscription.status === "trialing" /* TRIALING */ || subscription.status === "paused" /* PAUSED */;
|
|
1346
1333
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1347
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1348
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1349
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1350
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1334
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.DialogContent, { className: "max-w-2xl", children: [
|
|
1335
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.DialogHeader, { children: [
|
|
1336
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.DialogTitle, { children: t("billing.ui.subscription.details_title") }),
|
|
1337
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.DialogDescription, { children: t("billing.ui.subscription.details_description") })
|
|
1351
1338
|
] }),
|
|
1352
1339
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
1353
1340
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
@@ -1373,23 +1360,22 @@ function SubscriptionDetails({
|
|
|
1373
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: [
|
|
1374
1361
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.subscription.current_period") }),
|
|
1375
1362
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "text-sm", children: [
|
|
1376
|
-
|
|
1363
|
+
_chunkIPYXT7MHjs.formatDate.call(void 0, subscription.currentPeriodStart, fmt),
|
|
1377
1364
|
" - ",
|
|
1378
|
-
|
|
1365
|
+
_chunkIPYXT7MHjs.formatDate.call(void 0, subscription.currentPeriodEnd, fmt)
|
|
1379
1366
|
] })
|
|
1380
1367
|
] }) }),
|
|
1381
1368
|
subscription.trialEnd && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1382
1369
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.subscription.trial_ends") }),
|
|
1383
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children:
|
|
1370
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children: _chunkIPYXT7MHjs.formatDate.call(void 0, subscription.trialEnd, fmt) })
|
|
1384
1371
|
] }),
|
|
1385
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", {
|
|
1386
|
-
date:
|
|
1373
|
+
date: _chunkIPYXT7MHjs.formatDate.call(void 0, subscription.currentPeriodEnd, fmt)
|
|
1387
1374
|
}) }) }),
|
|
1388
1375
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2 pt-4 border-t", children: [
|
|
1389
|
-
onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Button, { variant: "outline", onClick: handleManageViaPortal, children: t("billing.ui.subscription.manage_portal") })
|
|
1376
|
+
onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.Button, { variant: "default", onClick: () => onChangePlan(subscription), children: t("billing.ui.subscription.change_plan") }),
|
|
1377
|
+
canCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.Button, { variant: "destructive", onClick: () => setShowCancel(true), children: t("ui.buttons.cancel") }),
|
|
1378
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.Button, { variant: "outline", onClick: handleManageViaPortal, children: t("billing.ui.subscription.manage_portal") })
|
|
1393
1379
|
] })
|
|
1394
1380
|
] })
|
|
1395
1381
|
] }) }),
|
|
@@ -1432,46 +1418,46 @@ function formatPlanName3(price, t) {
|
|
|
1432
1418
|
_chunk7QVYU63Ejs.__name.call(void 0, formatPlanName3, "formatPlanName");
|
|
1433
1419
|
function SubscriptionsList({ subscriptions, onSubscriptionsChange, onChangePlan }) {
|
|
1434
1420
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1435
|
-
const fmt =
|
|
1421
|
+
const fmt = _chunkIPYXT7MHjs.useBillingFormatOptions.call(void 0, );
|
|
1436
1422
|
const [selectedSub, setSelectedSub] = _react.useState.call(void 0, null);
|
|
1437
1423
|
const handleRowClick = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (subscription) => {
|
|
1438
1424
|
setSelectedSub(subscription);
|
|
1439
1425
|
}, "handleRowClick");
|
|
1440
1426
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1441
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1442
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1443
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1444
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1445
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1446
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1447
|
-
/* @__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, _chunkIPYXT7MHjs.Table, { children: [
|
|
1428
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.TableRow, { children: [
|
|
1429
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TableHead, { children: t("billing.ui.columns.status") }),
|
|
1430
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TableHead, { children: t("billing.ui.columns.plan") }),
|
|
1431
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TableHead, { children: t("billing.ui.columns.period") }),
|
|
1432
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TableHead, { className: "text-end", children: t("billing.ui.columns.amount") }),
|
|
1433
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TableHead, { className: "text-end", children: t("billing.ui.columns.actions") })
|
|
1448
1434
|
] }) }),
|
|
1449
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1435
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TableBody, { children: subscriptions.map((subscription) => {
|
|
1450
1436
|
const price = subscription.price;
|
|
1451
|
-
const amount = _optionalChain([price, 'optionalAccess', _42 => _42.unitAmount]) ?
|
|
1452
|
-
const discountedAmount = price ?
|
|
1453
|
-
const period = `${
|
|
1437
|
+
const amount = _optionalChain([price, 'optionalAccess', _42 => _42.unitAmount]) ? _chunkT3YQ47EFjs.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt) : "0";
|
|
1438
|
+
const discountedAmount = price ? _chunkIPYXT7MHjs.applyDiscount.call(void 0, price.unitAmount, _chunkIPYXT7MHjs.subscriptionDiscount.call(void 0, subscription)) : null;
|
|
1439
|
+
const period = `${_chunkIPYXT7MHjs.formatDate.call(void 0, subscription.currentPeriodStart, fmt)} - ${_chunkIPYXT7MHjs.formatDate.call(void 0, subscription.currentPeriodEnd, fmt)}`;
|
|
1454
1440
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1455
|
-
|
|
1441
|
+
_chunkIPYXT7MHjs.TableRow,
|
|
1456
1442
|
{
|
|
1457
1443
|
onClick: () => handleRowClick(subscription),
|
|
1458
1444
|
className: "cursor-pointer hover:bg-muted/50",
|
|
1459
1445
|
children: [
|
|
1460
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1446
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1461
1447
|
SubscriptionStatusBadge,
|
|
1462
1448
|
{
|
|
1463
1449
|
status: subscription.status,
|
|
1464
1450
|
cancelAtPeriodEnd: subscription.cancelAtPeriodEnd
|
|
1465
1451
|
}
|
|
1466
1452
|
) }),
|
|
1467
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1468
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1469
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1453
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TableCell, { className: "font-medium", children: formatPlanName3(price, t) }),
|
|
1454
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TableCell, { className: "text-muted-foreground text-sm", children: period }),
|
|
1455
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TableCell, { className: "text-end font-medium", children: discountedAmount !== null && price ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1470
1456
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "line-through text-muted-foreground me-2", children: amount }),
|
|
1471
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success", children:
|
|
1457
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success", children: _chunkT3YQ47EFjs.formatCurrency.call(void 0, discountedAmount, price.currency, fmt) })
|
|
1472
1458
|
] }) : amount }),
|
|
1473
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1474
|
-
|
|
1459
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TableCell, { className: "text-end", children: (subscription.status === "active" /* ACTIVE */ || subscription.status === "trialing" /* TRIALING */) && onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1460
|
+
_chunkIPYXT7MHjs.Button,
|
|
1475
1461
|
{
|
|
1476
1462
|
size: "sm",
|
|
1477
1463
|
variant: "outline",
|
|
@@ -1529,7 +1515,7 @@ function SubscriptionsContainer({
|
|
|
1529
1515
|
}
|
|
1530
1516
|
setLoading(true);
|
|
1531
1517
|
try {
|
|
1532
|
-
const fetchedSubscriptions = await
|
|
1518
|
+
const fetchedSubscriptions = await _chunkT3YQ47EFjs.StripeSubscriptionService.listSubscriptions();
|
|
1533
1519
|
setSubscriptions(fetchedSubscriptions);
|
|
1534
1520
|
} catch (error) {
|
|
1535
1521
|
console.error("[SubscriptionsContainer] Failed to load subscriptions:", error);
|
|
@@ -1552,7 +1538,7 @@ function SubscriptionsContainer({
|
|
|
1552
1538
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8" }),
|
|
1553
1539
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: t("billing.ui.subscriptions.title") })
|
|
1554
1540
|
] }),
|
|
1555
|
-
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1541
|
+
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _44 => _44()]), children: hasActiveRecurringSubscription ? t("billing.ui.subscriptions.purchase_addons") : t("billing.ui.subscriptions.subscribe") })
|
|
1556
1542
|
] }),
|
|
1557
1543
|
criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BillingAlertBanner, { subscription }, subscription.id)),
|
|
1558
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: [
|
|
@@ -1560,7 +1546,7 @@ function SubscriptionsContainer({
|
|
|
1560
1546
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
1561
1547
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium mb-2", children: t("billing.ui.subscriptions.empty_title") }),
|
|
1562
1548
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground mb-6", children: t("billing.ui.subscriptions.empty_description") }),
|
|
1563
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1549
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _45 => _45()]), children: t("billing.ui.subscriptions.subscribe") })
|
|
1564
1550
|
] })
|
|
1565
1551
|
] }),
|
|
1566
1552
|
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -1583,9 +1569,9 @@ function IntervalToggle({ value, onChange, hasMonthly, hasYearly }) {
|
|
|
1583
1569
|
if (!hasMonthly || !hasYearly) {
|
|
1584
1570
|
return null;
|
|
1585
1571
|
}
|
|
1586
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1587
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1588
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1572
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.Tabs, { value, onValueChange: (v) => onChange(v), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.TabsList, { children: [
|
|
1573
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TabsTrigger, { value: "month", children: t("billing.admin.prices.interval.month") }),
|
|
1574
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TabsTrigger, { value: "year", children: t("billing.admin.prices.interval.year") })
|
|
1589
1575
|
] }) });
|
|
1590
1576
|
}
|
|
1591
1577
|
_chunk7QVYU63Ejs.__name.call(void 0, IntervalToggle, "IntervalToggle");
|
|
@@ -1603,11 +1589,11 @@ function PricingCard({
|
|
|
1603
1589
|
onSelect
|
|
1604
1590
|
}) {
|
|
1605
1591
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1606
|
-
const fmt =
|
|
1592
|
+
const fmt = _chunkIPYXT7MHjs.useBillingFormatOptions.call(void 0, );
|
|
1607
1593
|
const description = price.description || price.nickname || t("billing.ui.pricing.standard");
|
|
1608
1594
|
const features = price.features || [];
|
|
1609
|
-
const formattedPrice =
|
|
1610
|
-
const interval =
|
|
1595
|
+
const formattedPrice = _chunkT3YQ47EFjs.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt);
|
|
1596
|
+
const interval = _chunkT3YQ47EFjs.formatInterval.call(void 0, price, fmt);
|
|
1611
1597
|
const handleKeyDown = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (e) => {
|
|
1612
1598
|
if ((e.key === "Enter" || e.key === " ") && !isDisabled && !isCurrentPlan) {
|
|
1613
1599
|
e.preventDefault();
|
|
@@ -1620,7 +1606,7 @@ function PricingCard({
|
|
|
1620
1606
|
}
|
|
1621
1607
|
}, "handleClick");
|
|
1622
1608
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1623
|
-
|
|
1609
|
+
_chunkIPYXT7MHjs.Card,
|
|
1624
1610
|
{
|
|
1625
1611
|
role: "radio",
|
|
1626
1612
|
"aria-checked": isSelected,
|
|
@@ -1628,7 +1614,7 @@ function PricingCard({
|
|
|
1628
1614
|
tabIndex: isDisabled ? -1 : 0,
|
|
1629
1615
|
onKeyDown: handleKeyDown,
|
|
1630
1616
|
onClick: handleClick,
|
|
1631
|
-
className:
|
|
1617
|
+
className: _chunkT3YQ47EFjs.cn.call(void 0,
|
|
1632
1618
|
"relative cursor-pointer transition-all duration-200 flex flex-col h-full",
|
|
1633
1619
|
"focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
1634
1620
|
isCurrentPlan && "bg-muted/30",
|
|
@@ -1638,9 +1624,9 @@ function PricingCard({
|
|
|
1638
1624
|
isLoading && "pointer-events-none"
|
|
1639
1625
|
),
|
|
1640
1626
|
children: [
|
|
1641
|
-
isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1642
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1643
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1627
|
+
isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.Badge, { variant: "secondary", className: "absolute top-2 end-2", children: t("billing.ui.pricing.current") }),
|
|
1628
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.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, _chunkIPYXT7MHjs.CardContent, { className: "pb-4 grow", children: [
|
|
1644
1630
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mb-4", children: [
|
|
1645
1631
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-3xl font-bold", children: formattedPrice }),
|
|
1646
1632
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground ms-1", children: interval })
|
|
@@ -1650,8 +1636,8 @@ function PricingCard({
|
|
|
1650
1636
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-muted-foreground", children: feature })
|
|
1651
1637
|
] }, index)) })
|
|
1652
1638
|
] }),
|
|
1653
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1654
|
-
|
|
1639
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.CardFooter, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1640
|
+
_chunkIPYXT7MHjs.Button,
|
|
1655
1641
|
{
|
|
1656
1642
|
variant: isCurrentPlan ? "secondary" : isSelected ? "default" : "outline",
|
|
1657
1643
|
className: "w-full",
|
|
@@ -1684,7 +1670,7 @@ function ProductPricingRow({
|
|
|
1684
1670
|
return null;
|
|
1685
1671
|
}
|
|
1686
1672
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-3", children: [
|
|
1687
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1673
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.SectionHeader, { children: product.name }),
|
|
1688
1674
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1689
1675
|
"div",
|
|
1690
1676
|
{
|
|
@@ -1785,15 +1771,15 @@ function ProductPricingList({
|
|
|
1785
1771
|
_chunk7QVYU63Ejs.__name.call(void 0, ProductPricingList, "ProductPricingList");
|
|
1786
1772
|
function ProductPricingListSkeleton() {
|
|
1787
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: [
|
|
1788
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1774
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.Skeleton, { className: "h-6 w-32" }),
|
|
1789
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: [
|
|
1790
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1791
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1776
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.Skeleton, { className: "h-6 w-24" }),
|
|
1777
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.Skeleton, { className: "h-8 w-32" }),
|
|
1792
1778
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
1793
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1794
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1779
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.Skeleton, { className: "h-4 w-full" }),
|
|
1780
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.Skeleton, { className: "h-4 w-3/4" })
|
|
1795
1781
|
] }),
|
|
1796
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1782
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.Skeleton, { className: "h-10 w-full" })
|
|
1797
1783
|
] }, cardIndex)) })
|
|
1798
1784
|
] }, rowIndex)) });
|
|
1799
1785
|
}
|
|
@@ -1804,21 +1790,21 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductPricingListSkeleton, "ProductPricing
|
|
|
1804
1790
|
|
|
1805
1791
|
function ProrationPreview({ preview }) {
|
|
1806
1792
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1807
|
-
const fmt =
|
|
1793
|
+
const fmt = _chunkIPYXT7MHjs.useBillingFormatOptions.call(void 0, );
|
|
1808
1794
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-primary/10 border-primary/30 rounded-lg border p-4", children: [
|
|
1809
1795
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "text-primary mb-3 font-semibold", children: t("billing.ui.proration.title") }),
|
|
1810
1796
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
1811
1797
|
preview.lineItems.map((item, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between text-sm", children: [
|
|
1812
1798
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground", children: item.description }),
|
|
1813
|
-
/* @__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: _chunkT3YQ47EFjs.formatCurrency.call(void 0, item.amount, preview.currency, fmt) })
|
|
1814
1800
|
] }, index)),
|
|
1815
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: [
|
|
1816
1802
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-foreground", children: t("billing.ui.proration.net_due_today") }),
|
|
1817
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-foreground", children:
|
|
1803
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-foreground", children: _chunkT3YQ47EFjs.formatCurrency.call(void 0, preview.immediateCharge, preview.currency, fmt) })
|
|
1818
1804
|
] }) }),
|
|
1819
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", {
|
|
1820
|
-
date:
|
|
1821
|
-
amount:
|
|
1806
|
+
date: _chunkIPYXT7MHjs.formatDate.call(void 0, preview.lineItems[0].period.end, fmt),
|
|
1807
|
+
amount: _chunkT3YQ47EFjs.formatCurrency.call(void 0, preview.amountDue, preview.currency, fmt)
|
|
1822
1808
|
}) })
|
|
1823
1809
|
] })
|
|
1824
1810
|
] });
|
|
@@ -1831,7 +1817,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProrationPreview, "ProrationPreview");
|
|
|
1831
1817
|
|
|
1832
1818
|
function SubscriptionConfirmation({ price, isLoading, onConfirm, onCancel }) {
|
|
1833
1819
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1834
|
-
const fmt =
|
|
1820
|
+
const fmt = _chunkIPYXT7MHjs.useBillingFormatOptions.call(void 0, );
|
|
1835
1821
|
const productName = _optionalChain([price, 'access', _51 => _51.product, 'optionalAccess', _52 => _52.name]) || price.nickname || t("billing.ui.wizard.review.selected_plan");
|
|
1836
1822
|
const productDescription = _optionalChain([price, 'access', _53 => _53.product, 'optionalAccess', _54 => _54.description]) || price.description;
|
|
1837
1823
|
const features = price.features || [];
|
|
@@ -1843,16 +1829,16 @@ function SubscriptionConfirmation({ price, isLoading, onConfirm, onCancel }) {
|
|
|
1843
1829
|
productDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-sm text-muted-foreground", children: productDescription })
|
|
1844
1830
|
] }),
|
|
1845
1831
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-lg font-semibold", children: [
|
|
1846
|
-
|
|
1847
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-normal text-muted-foreground", children:
|
|
1832
|
+
_chunkT3YQ47EFjs.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: _chunkT3YQ47EFjs.formatInterval.call(void 0, price, fmt) })
|
|
1848
1834
|
] }),
|
|
1849
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: [
|
|
1850
1836
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Check, { className: "h-4 w-4 text-primary" }),
|
|
1851
1837
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: feature })
|
|
1852
1838
|
] }, index)) }),
|
|
1853
1839
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-3 pt-2 border-t border-accent/30", children: [
|
|
1854
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1855
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1840
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.Button, { variant: "outline", onClick: onCancel, disabled: isLoading, children: t("ui.buttons.cancel") }),
|
|
1841
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.Button, { onClick: onConfirm, disabled: isLoading, children: isLoading ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1856
1842
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "h-4 w-4 animate-spin me-2" }),
|
|
1857
1843
|
t("billing.ui.wizard.review.processing")
|
|
1858
1844
|
] }) : t("billing.ui.confirmation.subscribe") })
|
|
@@ -2031,7 +2017,7 @@ function wizardReducer(state, action) {
|
|
|
2031
2017
|
_chunk7QVYU63Ejs.__name.call(void 0, wizardReducer, "wizardReducer");
|
|
2032
2018
|
function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
2033
2019
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2034
|
-
const locale =
|
|
2020
|
+
const locale = _chunkT3YQ47EFjs.useI18nLocale.call(void 0, );
|
|
2035
2021
|
const { confirmPayment } = useConfirmSubscriptionPayment();
|
|
2036
2022
|
const [state, dispatch] = _react.useReducer.call(void 0, wizardReducer, {
|
|
2037
2023
|
...initialState,
|
|
@@ -2043,7 +2029,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2043
2029
|
onCloseRef.current = onClose;
|
|
2044
2030
|
const checkPaymentMethod = _react.useCallback.call(void 0, async () => {
|
|
2045
2031
|
try {
|
|
2046
|
-
const methods = await
|
|
2032
|
+
const methods = await _chunkT3YQ47EFjs.StripeCustomerService.listPaymentMethods();
|
|
2047
2033
|
dispatch({ type: "SET_HAS_PAYMENT_METHOD", hasMethod: methods.length > 0 });
|
|
2048
2034
|
} catch (error) {
|
|
2049
2035
|
console.error("[useSubscriptionWizard] Failed to check payment methods:", error);
|
|
@@ -2061,10 +2047,10 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2061
2047
|
}, []);
|
|
2062
2048
|
const lookUpAutomaticCode = _react.useCallback.call(void 0, async (priceId) => {
|
|
2063
2049
|
try {
|
|
2064
|
-
const automaticCode = await
|
|
2050
|
+
const automaticCode = await _chunkT3YQ47EFjs.StripeCouponCodeService.findAutomatic({ priceId });
|
|
2065
2051
|
dispatch({
|
|
2066
2052
|
type: "SET_PROMOTION_CODE",
|
|
2067
|
-
code: automaticCode ?
|
|
2053
|
+
code: automaticCode ? _chunkT3YQ47EFjs.toPromotionCodeResult.call(void 0, automaticCode) : null
|
|
2068
2054
|
});
|
|
2069
2055
|
return true;
|
|
2070
2056
|
} catch (error) {
|
|
@@ -2091,7 +2077,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2091
2077
|
const isTrialUpgrade = _optionalChain([subscription, 'optionalAccess', _61 => _61.status]) === "trialing" /* TRIALING */;
|
|
2092
2078
|
dispatch({ type: "SET_IS_TRIAL_SUBSCRIPTION", isTrial: isTrialUpgrade });
|
|
2093
2079
|
if (isTrialUpgrade && !state.hasPaymentMethod) {
|
|
2094
|
-
const methods = await
|
|
2080
|
+
const methods = await _chunkT3YQ47EFjs.StripeCustomerService.listPaymentMethods();
|
|
2095
2081
|
if (methods.length === 0) {
|
|
2096
2082
|
dispatch({ type: "SET_STEP", step: "payment-method" });
|
|
2097
2083
|
dispatch({
|
|
@@ -2109,7 +2095,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2109
2095
|
}
|
|
2110
2096
|
}
|
|
2111
2097
|
if (subscription && state.selectedPrice.id !== _optionalChain([subscription, 'access', _62 => _62.price, 'optionalAccess', _63 => _63.id])) {
|
|
2112
|
-
const preview = await
|
|
2098
|
+
const preview = await _chunkT3YQ47EFjs.StripeSubscriptionService.getProrationPreview({
|
|
2113
2099
|
subscriptionId: subscription.id,
|
|
2114
2100
|
newPriceId: state.selectedPrice.id
|
|
2115
2101
|
});
|
|
@@ -2143,14 +2129,14 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2143
2129
|
newPriceId: state.selectedPrice.id,
|
|
2144
2130
|
promotionCode: promotionCodeToSend(state.promotionCode)
|
|
2145
2131
|
};
|
|
2146
|
-
result = await
|
|
2132
|
+
result = await _chunkT3YQ47EFjs.StripeSubscriptionService.changePlanWithMeta(changePlanParams);
|
|
2147
2133
|
} else {
|
|
2148
2134
|
const createParams = {
|
|
2149
2135
|
id: _uuid.v4.call(void 0, ),
|
|
2150
2136
|
priceId: state.selectedPrice.id,
|
|
2151
2137
|
promotionCode: promotionCodeToSend(state.promotionCode)
|
|
2152
2138
|
};
|
|
2153
|
-
result = await
|
|
2139
|
+
result = await _chunkT3YQ47EFjs.StripeSubscriptionService.createSubscription(createParams);
|
|
2154
2140
|
}
|
|
2155
2141
|
const clientSecret = clientSecretToConfirm(result.meta);
|
|
2156
2142
|
if (clientSecret) {
|
|
@@ -2166,7 +2152,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2166
2152
|
const subscriptionId = subscriptionIdToSync(result.subscription, subscription);
|
|
2167
2153
|
if (subscriptionId) {
|
|
2168
2154
|
try {
|
|
2169
|
-
await
|
|
2155
|
+
await _chunkT3YQ47EFjs.StripeSubscriptionService.syncSubscription({ subscriptionId });
|
|
2170
2156
|
} catch (syncError) {
|
|
2171
2157
|
console.error("[useSubscriptionWizard] Subscription sync after payment failed:", syncError);
|
|
2172
2158
|
}
|
|
@@ -2214,7 +2200,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2214
2200
|
dispatch({ type: "SET_VALIDATING_PROMO_CODE", isValidating: true });
|
|
2215
2201
|
dispatch({ type: "SET_PROMO_CODE_ERROR", error: null });
|
|
2216
2202
|
try {
|
|
2217
|
-
const result = await
|
|
2203
|
+
const result = await _chunkT3YQ47EFjs.StripePromotionCodeService.validatePromotionCode({
|
|
2218
2204
|
code,
|
|
2219
2205
|
stripePriceId: _optionalChain([state, 'access', _72 => _72.selectedPrice, 'optionalAccess', _73 => _73.id]),
|
|
2220
2206
|
language: locale
|
|
@@ -2339,7 +2325,7 @@ function WizardStepPlanSelection({
|
|
|
2339
2325
|
_react.useEffect.call(void 0, () => {
|
|
2340
2326
|
const loadProducts = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2341
2327
|
try {
|
|
2342
|
-
const fetchedProducts = await
|
|
2328
|
+
const fetchedProducts = await _chunkT3YQ47EFjs.StripeProductService.listProducts({ active: true });
|
|
2343
2329
|
setProducts(fetchedProducts);
|
|
2344
2330
|
} catch (error) {
|
|
2345
2331
|
console.error("[WizardStepPlanSelection] Failed to load products:", error);
|
|
@@ -2390,7 +2376,7 @@ function WizardStepPlanSelection({
|
|
|
2390
2376
|
onSelectPrice: handleSelectPrice
|
|
2391
2377
|
}
|
|
2392
2378
|
),
|
|
2393
|
-
/* @__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, _chunkIPYXT7MHjs.Button, { onClick: onNext, disabled: !selectedPrice || isProcessing, children: isProcessing ? t("common.loading") : t("billing.ui.wizard.next_review") }) })
|
|
2394
2380
|
] });
|
|
2395
2381
|
}
|
|
2396
2382
|
_chunk7QVYU63Ejs.__name.call(void 0, WizardStepPlanSelection, "WizardStepPlanSelection");
|
|
@@ -2414,7 +2400,7 @@ function PromoCodeInput({
|
|
|
2414
2400
|
disabled = false
|
|
2415
2401
|
}) {
|
|
2416
2402
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2417
|
-
const locale =
|
|
2403
|
+
const locale = _chunkT3YQ47EFjs.useI18nLocale.call(void 0, );
|
|
2418
2404
|
const [code, setCode] = _react.useState.call(void 0, "");
|
|
2419
2405
|
const appliedKey = _optionalChain([appliedCode, 'optionalAccess', _82 => _82.valid]) ? `${appliedCode.automatic ? "auto" : "typed"}:${_nullishCoalesce(appliedCode.code, () => ( ""))}` : null;
|
|
2420
2406
|
const [previousAppliedKey, setPreviousAppliedKey] = _react.useState.call(void 0, appliedKey);
|
|
@@ -2443,7 +2429,7 @@ function PromoCodeInput({
|
|
|
2443
2429
|
}
|
|
2444
2430
|
const amount = (result.discountValue || 0) / 100;
|
|
2445
2431
|
const currency = _optionalChain([result, 'access', _83 => _83.currency, 'optionalAccess', _84 => _84.toUpperCase, 'call', _85 => _85()]) || "USD";
|
|
2446
|
-
return t("billing.ui.wizard.review.amount_off", { amount: `${currency} ${
|
|
2432
|
+
return t("billing.ui.wizard.review.amount_off", { amount: `${currency} ${_chunkT3YQ47EFjs.formatFixed.call(void 0, amount, locale, 2)}` });
|
|
2447
2433
|
}, "formatDiscount");
|
|
2448
2434
|
const formatDuration = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (result) => {
|
|
2449
2435
|
switch (result.duration) {
|
|
@@ -2460,7 +2446,7 @@ function PromoCodeInput({
|
|
|
2460
2446
|
const codeInput = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
2461
2447
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
|
|
2462
2448
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2463
|
-
|
|
2449
|
+
_chunkIPYXT7MHjs.Input,
|
|
2464
2450
|
{
|
|
2465
2451
|
placeholder: t("billing.ui.promo_code.placeholder"),
|
|
2466
2452
|
value: code,
|
|
@@ -2470,7 +2456,7 @@ function PromoCodeInput({
|
|
|
2470
2456
|
className: "flex-1"
|
|
2471
2457
|
}
|
|
2472
2458
|
),
|
|
2473
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2459
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.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") })
|
|
2474
2460
|
] }),
|
|
2475
2461
|
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error })
|
|
2476
2462
|
] });
|
|
@@ -2499,7 +2485,7 @@ function PromoCodeInput({
|
|
|
2499
2485
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success text-sm", children: formatDiscount(appliedCode) })
|
|
2500
2486
|
] }),
|
|
2501
2487
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2502
|
-
|
|
2488
|
+
_chunkIPYXT7MHjs.Button,
|
|
2503
2489
|
{
|
|
2504
2490
|
variant: "ghost",
|
|
2505
2491
|
size: "sm",
|
|
@@ -2547,7 +2533,7 @@ function WizardStepReview({
|
|
|
2547
2533
|
isTrialUpgrade
|
|
2548
2534
|
}) {
|
|
2549
2535
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2550
|
-
const fmt =
|
|
2536
|
+
const fmt = _chunkIPYXT7MHjs.useBillingFormatOptions.call(void 0, );
|
|
2551
2537
|
const [card, setCard] = _react.useState.call(void 0, null);
|
|
2552
2538
|
_react.useEffect.call(void 0, () => {
|
|
2553
2539
|
if (!hasPaymentMethod) {
|
|
@@ -2555,7 +2541,7 @@ function WizardStepReview({
|
|
|
2555
2541
|
return;
|
|
2556
2542
|
}
|
|
2557
2543
|
let cancelled = false;
|
|
2558
|
-
Promise.all([
|
|
2544
|
+
Promise.all([_chunkT3YQ47EFjs.StripeCustomerService.listPaymentMethods(), _chunkT3YQ47EFjs.StripeCustomerService.getCustomer()]).then(([methods, customer]) => {
|
|
2559
2545
|
if (!cancelled) setCard(reviewCard(methods, _optionalChain([customer, 'optionalAccess', _90 => _90.defaultPaymentMethodId])));
|
|
2560
2546
|
}).catch((err) => {
|
|
2561
2547
|
console.error("[WizardStepReview] Failed to load the card on file:", err);
|
|
@@ -2574,24 +2560,24 @@ function WizardStepReview({
|
|
|
2574
2560
|
const interval = _optionalChain([price, 'access', _93 => _93.recurring, 'optionalAccess', _94 => _94.interval]) || "month";
|
|
2575
2561
|
return interval === "year" ? t("billing.ui.wizard.review.interval_yearly") : t("billing.ui.wizard.review.interval_monthly");
|
|
2576
2562
|
}, "formatInterval");
|
|
2577
|
-
const codeDiscount =
|
|
2578
|
-
const carriedDiscount = isChangingPlan && !codeDiscount ?
|
|
2563
|
+
const codeDiscount = _chunkIPYXT7MHjs.promotionCodeDiscount.call(void 0, promotionCode);
|
|
2564
|
+
const carriedDiscount = isChangingPlan && !codeDiscount ? _chunkIPYXT7MHjs.subscriptionDiscount.call(void 0, subscription) : null;
|
|
2579
2565
|
const discount = _nullishCoalesce(codeDiscount, () => ( carriedDiscount));
|
|
2580
|
-
const discountedPrice =
|
|
2581
|
-
const discountedImmediateCharge =
|
|
2566
|
+
const discountedPrice = _chunkIPYXT7MHjs.applyDiscount.call(void 0, selectedPrice.unitAmount, discount);
|
|
2567
|
+
const discountedImmediateCharge = _chunkIPYXT7MHjs.applyDiscount.call(void 0, _optionalChain([prorationPreview, 'optionalAccess', _95 => _95.immediateCharge]), discount);
|
|
2582
2568
|
const getDiscountDescription = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
2583
2569
|
if (!discount) return null;
|
|
2584
2570
|
if (discount.discountType === "percent_off") {
|
|
2585
2571
|
return t("billing.ui.wizard.review.percent_off", { value: discount.discountValue });
|
|
2586
2572
|
}
|
|
2587
2573
|
return t("billing.ui.wizard.review.amount_off", {
|
|
2588
|
-
amount:
|
|
2574
|
+
amount: _chunkT3YQ47EFjs.formatCurrency.call(void 0, discount.discountValue, discount.currency || selectedPrice.currency, fmt)
|
|
2589
2575
|
});
|
|
2590
2576
|
}, "getDiscountDescription");
|
|
2591
2577
|
const discountDescription = getDiscountDescription();
|
|
2592
2578
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
2593
2579
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-muted/50 rounded-lg p-4 space-y-3", children: [
|
|
2594
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2580
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.SectionHeader, { children: t("billing.ui.wizard.review.selected_plan") }),
|
|
2595
2581
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between items-center", children: [
|
|
2596
2582
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
2597
2583
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-medium", children: _optionalChain([selectedPrice, 'access', _96 => _96.product, 'optionalAccess', _97 => _97.name]) }),
|
|
@@ -2599,11 +2585,11 @@ function WizardStepReview({
|
|
|
2599
2585
|
] }),
|
|
2600
2586
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-end", children: [
|
|
2601
2587
|
discountedPrice !== null ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2602
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground line-through", children:
|
|
2603
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-success text-lg font-semibold", children:
|
|
2604
|
-
discountDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2588
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground line-through", children: _chunkT3YQ47EFjs.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: _chunkT3YQ47EFjs.formatCurrency.call(void 0, discountedPrice, selectedPrice.currency, fmt) }),
|
|
2590
|
+
discountDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.Badge, { variant: "softGreen", children: discountDescription }),
|
|
2605
2591
|
carriedDiscount && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: t("billing.ui.wizard.review.discount_carries_over") })
|
|
2606
|
-
] }) : /* @__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: _chunkT3YQ47EFjs.formatCurrency.call(void 0, selectedPrice.unitAmount || 0, selectedPrice.currency, fmt) }),
|
|
2607
2593
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: formatInterval2(selectedPrice) })
|
|
2608
2594
|
] })
|
|
2609
2595
|
] })
|
|
@@ -2618,9 +2604,9 @@ function WizardStepReview({
|
|
|
2618
2604
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between text-sm", children: [
|
|
2619
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") }),
|
|
2620
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: [
|
|
2621
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "line-through text-muted-foreground me-2", children:
|
|
2622
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success", children:
|
|
2623
|
-
] }) :
|
|
2607
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "line-through text-muted-foreground me-2", children: _chunkT3YQ47EFjs.formatCurrency.call(void 0, prorationPreview.immediateCharge, prorationPreview.currency, fmt) }),
|
|
2608
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success", children: _chunkT3YQ47EFjs.formatCurrency.call(void 0, discountedImmediateCharge, prorationPreview.currency, fmt) })
|
|
2609
|
+
] }) : _chunkT3YQ47EFjs.formatCurrency.call(void 0, prorationPreview.immediateCharge, prorationPreview.currency, fmt) })
|
|
2624
2610
|
] })
|
|
2625
2611
|
]
|
|
2626
2612
|
}
|
|
@@ -2644,15 +2630,15 @@ function WizardStepReview({
|
|
|
2644
2630
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "font-medium", children: t("billing.ui.payment_method.title") }),
|
|
2645
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") })
|
|
2646
2632
|
] }),
|
|
2647
|
-
hasPaymentMethod ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2633
|
+
hasPaymentMethod ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.Button, { variant: "outline", onClick: onAddPaymentMethod, disabled: isProcessing, children: t("billing.ui.wizard.review.use_another_card") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.Button, { variant: "outline", onClick: onAddPaymentMethod, children: t("billing.ui.payment_methods.add") })
|
|
2648
2634
|
] }) }),
|
|
2649
|
-
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2635
|
+
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.Alert, { variant: "destructive", children: [
|
|
2650
2636
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.AlertCircle, { className: "h-4 w-4" }),
|
|
2651
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2637
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.AlertDescription, { children: error })
|
|
2652
2638
|
] }),
|
|
2653
2639
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between pt-4 border-t", children: [
|
|
2654
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2655
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2640
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.Button, { variant: "outline", onClick: onBack, disabled: isProcessing, children: t("billing.ui.wizard.back") }),
|
|
2641
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.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") })
|
|
2656
2642
|
] })
|
|
2657
2643
|
] });
|
|
2658
2644
|
}
|
|
@@ -2665,7 +2651,7 @@ function WizardStepPaymentMethod({ onBack, onSuccess, isProcessing }) {
|
|
|
2665
2651
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2666
2652
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
2667
2653
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
2668
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2654
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.SectionHeader, { children: t("billing.ui.payment_methods.add") }),
|
|
2669
2655
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: t("billing.ui.wizard.payment_description") })
|
|
2670
2656
|
] }),
|
|
2671
2657
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodForm, { onSuccess, onCancel: onBack, isLoading: isProcessing, alwaysSetDefault: true })
|
|
@@ -2708,10 +2694,10 @@ function SubscriptionWizard({
|
|
|
2708
2694
|
const isChangePlanMode = !!subscription;
|
|
2709
2695
|
const dialogTitle = subscription ? t("billing.ui.wizard.change_title") : isPurchasingAddons ? t("billing.ui.subscriptions.purchase_addons") : t("billing.ui.subscriptions.subscribe");
|
|
2710
2696
|
const dialogDescription = subscription ? t("billing.ui.wizard.change_description") : isPurchasingAddons ? t("billing.ui.wizard.addons_description") : t("billing.ui.wizard.subscribe_description");
|
|
2711
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2712
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2713
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2714
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2697
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.DialogContent, { className: "max-w-2xl max-h-[90vh] overflow-y-auto", children: [
|
|
2698
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.DialogHeader, { children: [
|
|
2699
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.DialogTitle, { children: dialogTitle }),
|
|
2700
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.DialogDescription, { children: dialogDescription })
|
|
2715
2701
|
] }),
|
|
2716
2702
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, WizardProgressIndicator, { currentStep: state.step }),
|
|
2717
2703
|
state.step === "plan-selection" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -2779,7 +2765,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, getProgressColor, "getProgressColor");
|
|
|
2779
2765
|
function formatDate2(date, { locale, t }) {
|
|
2780
2766
|
if (!date) return t("billing.ui.not_available");
|
|
2781
2767
|
try {
|
|
2782
|
-
return new Intl.DateTimeFormat(
|
|
2768
|
+
return new Intl.DateTimeFormat(_chunkT3YQ47EFjs.dateFormatLocale.call(void 0, locale), {
|
|
2783
2769
|
month: "short",
|
|
2784
2770
|
day: "numeric"
|
|
2785
2771
|
}).format(new Date(date));
|
|
@@ -2790,7 +2776,7 @@ function formatDate2(date, { locale, t }) {
|
|
|
2790
2776
|
_chunk7QVYU63Ejs.__name.call(void 0, formatDate2, "formatDate");
|
|
2791
2777
|
function UsageSummaryCard({ meter, summary }) {
|
|
2792
2778
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2793
|
-
const fmt =
|
|
2779
|
+
const fmt = _chunkIPYXT7MHjs.useBillingFormatOptions.call(void 0, );
|
|
2794
2780
|
const currentUsage = _nullishCoalesce(_optionalChain([summary, 'optionalAccess', _100 => _100.aggregatedValue]), () => ( 0));
|
|
2795
2781
|
const limit = meter.limit;
|
|
2796
2782
|
const percentage = limit && limit > 0 ? currentUsage / limit * 100 : null;
|
|
@@ -2798,15 +2784,15 @@ function UsageSummaryCard({ meter, summary }) {
|
|
|
2798
2784
|
const progressWidth = percentage !== null ? Math.min(percentage, 100) : 0;
|
|
2799
2785
|
const displayName = meter.displayName || meter.eventName;
|
|
2800
2786
|
const hasLimit = limit !== null && limit !== void 0;
|
|
2801
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2802
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2787
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.Card, { children: [
|
|
2788
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.CardHeader, { className: "flex flex-row items-center gap-x-3 pb-3", children: [
|
|
2803
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" }) }),
|
|
2804
2790
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col", children: [
|
|
2805
2791
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium", children: displayName }),
|
|
2806
2792
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-xs", children: meter.id })
|
|
2807
2793
|
] })
|
|
2808
2794
|
] }),
|
|
2809
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2795
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.CardContent, { className: "flex flex-col gap-y-4", children: [
|
|
2810
2796
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
2811
2797
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-3xl font-bold", children: currentUsage.toLocaleString(fmt.locale) }),
|
|
2812
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) }) })
|
|
@@ -2814,7 +2800,7 @@ function UsageSummaryCard({ meter, summary }) {
|
|
|
2814
2800
|
hasLimit ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-2", children: [
|
|
2815
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}%` } }) }),
|
|
2816
2802
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-sm", children: t("billing.ui.usage.percent_used", {
|
|
2817
|
-
value: percentage !== null ?
|
|
2803
|
+
value: percentage !== null ? _chunkT3YQ47EFjs.formatFixed.call(void 0, percentage, fmt.locale, 1) : ""
|
|
2818
2804
|
}) })
|
|
2819
2805
|
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-sm", children: t("billing.ui.usage.no_limit") }),
|
|
2820
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", {
|
|
@@ -2847,14 +2833,14 @@ function UsageContainer() {
|
|
|
2847
2833
|
const loadUsageData = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2848
2834
|
setLoading(true);
|
|
2849
2835
|
try {
|
|
2850
|
-
const fetchedSubscriptions = await
|
|
2836
|
+
const fetchedSubscriptions = await _chunkT3YQ47EFjs.StripeSubscriptionService.listSubscriptions();
|
|
2851
2837
|
setSubscriptions(fetchedSubscriptions);
|
|
2852
2838
|
const hasMeteredSubscriptions2 = fetchedSubscriptions.some((sub) => _optionalChain([sub, 'access', _101 => _101.price, 'optionalAccess', _102 => _102.recurring, 'optionalAccess', _103 => _103.usageType]) === "metered");
|
|
2853
2839
|
if (!hasMeteredSubscriptions2) {
|
|
2854
2840
|
setLoading(false);
|
|
2855
2841
|
return;
|
|
2856
2842
|
}
|
|
2857
|
-
const fetchedMeters = await
|
|
2843
|
+
const fetchedMeters = await _chunkT3YQ47EFjs.StripeUsageService.listMeters();
|
|
2858
2844
|
setMeters(fetchedMeters);
|
|
2859
2845
|
const summariesMap = {};
|
|
2860
2846
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -2862,7 +2848,7 @@ function UsageContainer() {
|
|
|
2862
2848
|
const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
|
|
2863
2849
|
for (const meter of fetchedMeters) {
|
|
2864
2850
|
try {
|
|
2865
|
-
const meterSummaries = await
|
|
2851
|
+
const meterSummaries = await _chunkT3YQ47EFjs.StripeUsageService.getMeterSummaries({
|
|
2866
2852
|
meterId: meter.id,
|
|
2867
2853
|
startTime: startOfMonth,
|
|
2868
2854
|
endTime: endOfMonth
|
|
@@ -2911,7 +2897,7 @@ function formatDateTime(date, { locale, t }) {
|
|
|
2911
2897
|
if (!date) return t("billing.ui.not_available");
|
|
2912
2898
|
const dateObj = typeof date === "string" ? new Date(date) : date;
|
|
2913
2899
|
try {
|
|
2914
|
-
return new Intl.DateTimeFormat(
|
|
2900
|
+
return new Intl.DateTimeFormat(_chunkT3YQ47EFjs.dateFormatLocale.call(void 0, locale), {
|
|
2915
2901
|
month: "short",
|
|
2916
2902
|
day: "numeric",
|
|
2917
2903
|
year: "numeric",
|
|
@@ -2925,27 +2911,27 @@ function formatDateTime(date, { locale, t }) {
|
|
|
2925
2911
|
_chunk7QVYU63Ejs.__name.call(void 0, formatDateTime, "formatDateTime");
|
|
2926
2912
|
function UsageHistoryTable({ usageRecords }) {
|
|
2927
2913
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2928
|
-
const fmt =
|
|
2914
|
+
const fmt = _chunkIPYXT7MHjs.useBillingFormatOptions.call(void 0, );
|
|
2929
2915
|
if (usageRecords.length === 0) {
|
|
2930
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") }) });
|
|
2931
2917
|
}
|
|
2932
2918
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
2933
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2934
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-clip rounded-lg border", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2935
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2936
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2937
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2938
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2939
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2919
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.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, _chunkIPYXT7MHjs.Table, { children: [
|
|
2921
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.TableRow, { children: [
|
|
2922
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TableHead, { children: t("billing.ui.columns.date_time") }),
|
|
2923
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TableHead, { children: t("billing.ui.columns.meter_event") }),
|
|
2924
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TableHead, { className: "text-end", children: t("billing.ui.columns.quantity") }),
|
|
2925
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TableHead, { children: t("billing.ui.columns.event_id") })
|
|
2940
2926
|
] }) }),
|
|
2941
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2927
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TableBody, { children: usageRecords.map((record) => {
|
|
2942
2928
|
const dateTime = formatDateTime(record.timestamp, fmt);
|
|
2943
2929
|
const quantity = record.quantity.toLocaleString(fmt.locale);
|
|
2944
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2945
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2946
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2947
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2948
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2930
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.TableRow, { children: [
|
|
2931
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TableCell, { className: "font-medium", children: dateTime }),
|
|
2932
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TableCell, { className: "text-muted-foreground", children: record.meterEventName }),
|
|
2933
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TableCell, { className: "text-end font-medium", children: quantity }),
|
|
2934
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TableCell, { className: "text-muted-foreground text-sm tabular-nums", children: record.stripeEventId })
|
|
2949
2935
|
] }, record.id);
|
|
2950
2936
|
}) })
|
|
2951
2937
|
] }) })
|
|
@@ -2956,8 +2942,8 @@ _chunk7QVYU63Ejs.__name.call(void 0, UsageHistoryTable, "UsageHistoryTable");
|
|
|
2956
2942
|
// src/features/billing/components/modals/BillingDetailModal.tsx
|
|
2957
2943
|
|
|
2958
2944
|
function BillingDetailModal({ open, onOpenChange, title, children, className }) {
|
|
2959
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2960
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2945
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.DialogContent, { className: _nullishCoalesce(className, () => ( "max-w-4xl max-h-[90vh] overflow-y-auto")), children: [
|
|
2946
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.DialogHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.DialogTitle, { children: title }) }),
|
|
2961
2947
|
children
|
|
2962
2948
|
] }) });
|
|
2963
2949
|
}
|
|
@@ -2985,7 +2971,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
|
|
|
2985
2971
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-destructive text-sm font-medium", children: t("billing.ui.alert.payment_failed_title") }),
|
|
2986
2972
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive mt-1 text-sm", children: t("billing.ui.alert.payment_failed_description") })
|
|
2987
2973
|
] }),
|
|
2988
|
-
onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2974
|
+
onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.Button, { variant: "outline", size: "sm", onClick: onUpdatePayment, className: "text-destructive border-red-300", children: t("billing.ui.alert.update_payment_method") })
|
|
2989
2975
|
] });
|
|
2990
2976
|
}
|
|
2991
2977
|
if (subscription.status === "trialing" /* TRIALING */ && subscription.trialEnd) {
|
|
@@ -2999,7 +2985,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
|
|
|
2999
2985
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-warning text-sm font-medium", children: t("billing.ui.alert.trial_ending_title") }),
|
|
3000
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 }) })
|
|
3001
2987
|
] }),
|
|
3002
|
-
onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2988
|
+
onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.Button, { variant: "outline", size: "sm", onClick: onAddPayment, className: "text-warning border-yellow-300", children: t("billing.ui.payment_methods.add") })
|
|
3003
2989
|
] });
|
|
3004
2990
|
}
|
|
3005
2991
|
}
|
|
@@ -3051,7 +3037,7 @@ function BillingDashboardContainer() {
|
|
|
3051
3037
|
setNoCustomerExists(false);
|
|
3052
3038
|
let customer = null;
|
|
3053
3039
|
try {
|
|
3054
|
-
customer = await
|
|
3040
|
+
customer = await _chunkT3YQ47EFjs.StripeCustomerService.getCustomer();
|
|
3055
3041
|
setData((prev) => ({ ...prev, customer }));
|
|
3056
3042
|
setErrors((prev) => ({ ...prev, customer: null }));
|
|
3057
3043
|
setNoCustomerExists(false);
|
|
@@ -3077,7 +3063,7 @@ function BillingDashboardContainer() {
|
|
|
3077
3063
|
}
|
|
3078
3064
|
const fetchSubscriptions = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3079
3065
|
try {
|
|
3080
|
-
const subscriptions2 = await
|
|
3066
|
+
const subscriptions2 = await _chunkT3YQ47EFjs.StripeSubscriptionService.listSubscriptions();
|
|
3081
3067
|
setData((prev) => ({ ...prev, subscriptions: subscriptions2 }));
|
|
3082
3068
|
setErrors((prev) => ({ ...prev, subscriptions: null }));
|
|
3083
3069
|
return subscriptions2;
|
|
@@ -3091,7 +3077,7 @@ function BillingDashboardContainer() {
|
|
|
3091
3077
|
}, "fetchSubscriptions");
|
|
3092
3078
|
const fetchPaymentMethods = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3093
3079
|
try {
|
|
3094
|
-
const paymentMethods = await
|
|
3080
|
+
const paymentMethods = await _chunkT3YQ47EFjs.StripeCustomerService.listPaymentMethods();
|
|
3095
3081
|
setData((prev) => ({ ...prev, paymentMethods }));
|
|
3096
3082
|
setErrors((prev) => ({ ...prev, paymentMethods: null }));
|
|
3097
3083
|
} catch (error) {
|
|
@@ -3103,7 +3089,7 @@ function BillingDashboardContainer() {
|
|
|
3103
3089
|
}, "fetchPaymentMethods");
|
|
3104
3090
|
const fetchInvoices = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3105
3091
|
try {
|
|
3106
|
-
const invoices = await
|
|
3092
|
+
const invoices = await _chunkT3YQ47EFjs.StripeInvoiceService.listInvoices();
|
|
3107
3093
|
setData((prev) => ({ ...prev, invoices }));
|
|
3108
3094
|
setErrors((prev) => ({ ...prev, invoices: null }));
|
|
3109
3095
|
} catch (error) {
|
|
@@ -3126,7 +3112,7 @@ function BillingDashboardContainer() {
|
|
|
3126
3112
|
const handleCreateCustomer = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3127
3113
|
setCreatingCustomer(true);
|
|
3128
3114
|
try {
|
|
3129
|
-
await
|
|
3115
|
+
await _chunkT3YQ47EFjs.StripeCustomerService.createCustomer();
|
|
3130
3116
|
setNoCustomerExists(false);
|
|
3131
3117
|
await fetchAllData();
|
|
3132
3118
|
} catch (error) {
|
|
@@ -3138,7 +3124,7 @@ function BillingDashboardContainer() {
|
|
|
3138
3124
|
}, "handleCreateCustomer");
|
|
3139
3125
|
const fetchUsageData = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3140
3126
|
try {
|
|
3141
|
-
const meters = await
|
|
3127
|
+
const meters = await _chunkT3YQ47EFjs.StripeUsageService.listMeters();
|
|
3142
3128
|
setData((prev) => ({ ...prev, meters }));
|
|
3143
3129
|
const summariesMap = {};
|
|
3144
3130
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -3146,7 +3132,7 @@ function BillingDashboardContainer() {
|
|
|
3146
3132
|
const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
|
|
3147
3133
|
for (const meter of meters) {
|
|
3148
3134
|
try {
|
|
3149
|
-
const meterSummaries = await
|
|
3135
|
+
const meterSummaries = await _chunkT3YQ47EFjs.StripeUsageService.getMeterSummaries({
|
|
3150
3136
|
meterId: meter.id,
|
|
3151
3137
|
startTime: startOfMonth,
|
|
3152
3138
|
endTime: endOfMonth
|
|
@@ -3233,18 +3219,18 @@ function BillingDashboardContainer() {
|
|
|
3233
3219
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-8 w-8" }),
|
|
3234
3220
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: t("billing.title") })
|
|
3235
3221
|
] }),
|
|
3236
|
-
isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3237
|
-
noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3238
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3222
|
+
isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.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, _chunkIPYXT7MHjs.Card, { children: [
|
|
3224
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.CardHeader, { className: "text-center", children: [
|
|
3239
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" }) }),
|
|
3240
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3241
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3226
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.CardTitle, { children: t("billing.ui.dashboard.setup_title") }),
|
|
3227
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.CardDescription, { children: t("billing.ui.dashboard.setup_description") })
|
|
3242
3228
|
] }),
|
|
3243
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3229
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.CardContent, { className: "flex justify-center pb-8", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.Button, { onClick: handleCreateCustomer, disabled: creatingCustomer, size: "lg", children: creatingCustomer ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
3244
3230
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "me-2 h-4 w-4 animate-spin" }),
|
|
3245
3231
|
t("billing.ui.dashboard.setting_up")
|
|
3246
3232
|
] }) : t("billing.ui.dashboard.setup_button") }) }),
|
|
3247
|
-
errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3233
|
+
errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.CardContent, { className: "pt-0", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-center text-destructive text-xs/relaxed", children: t(errors.customer) }) })
|
|
3248
3234
|
] }),
|
|
3249
3235
|
!noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
3250
3236
|
criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -3388,7 +3374,7 @@ function getStripePromise(publishableKey) {
|
|
|
3388
3374
|
}
|
|
3389
3375
|
_chunk7QVYU63Ejs.__name.call(void 0, getStripePromise, "getStripePromise");
|
|
3390
3376
|
function StripeProvider({ children }) {
|
|
3391
|
-
const publishableKey =
|
|
3377
|
+
const publishableKey = _chunkF4JB7YAPjs.getStripePublishableKey.call(void 0, );
|
|
3392
3378
|
const stripePromise = _react.useMemo.call(void 0, () => getStripePromise(publishableKey), [publishableKey]);
|
|
3393
3379
|
const options = _react.useMemo.call(void 0, () => ({}), []);
|
|
3394
3380
|
if (!publishableKey) {
|
|
@@ -3398,7 +3384,7 @@ function StripeProvider({ children }) {
|
|
|
3398
3384
|
}
|
|
3399
3385
|
_chunk7QVYU63Ejs.__name.call(void 0, StripeProvider, "StripeProvider");
|
|
3400
3386
|
function isStripeConfigured() {
|
|
3401
|
-
return !!
|
|
3387
|
+
return !!_chunkF4JB7YAPjs.getStripePublishableKey.call(void 0, );
|
|
3402
3388
|
}
|
|
3403
3389
|
_chunk7QVYU63Ejs.__name.call(void 0, isStripeConfigured, "isStripeConfigured");
|
|
3404
3390
|
|
|
@@ -3413,18 +3399,18 @@ _chunk7QVYU63Ejs.__name.call(void 0, isStripeConfigured, "isStripeConfigured");
|
|
|
3413
3399
|
|
|
3414
3400
|
function PriceArchiver({ price }) {
|
|
3415
3401
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
3416
|
-
const fmt =
|
|
3402
|
+
const fmt = _chunkIPYXT7MHjs.useBillingFormatOptions.call(void 0, );
|
|
3417
3403
|
const { archivePrice, restorePrice } = usePriceContext();
|
|
3418
3404
|
const [open, setOpen] = _react.useState.call(void 0, false);
|
|
3419
3405
|
const isArchived = !price.active;
|
|
3420
3406
|
const scope = isArchived ? "restore" : "archive";
|
|
3421
3407
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
3422
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3408
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.Button, { variant: "outline", size: "sm", onClick: () => setOpen(true), children: [
|
|
3423
3409
|
isArchived ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RotateCcwIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ArchiveIcon, {}),
|
|
3424
3410
|
t(`billing.admin.prices.${scope}.confirm`)
|
|
3425
3411
|
] }),
|
|
3426
3412
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3427
|
-
|
|
3413
|
+
_chunkIPYXT7MHjs.ConfirmDialog,
|
|
3428
3414
|
{
|
|
3429
3415
|
open,
|
|
3430
3416
|
onOpenChange: setOpen,
|
|
@@ -3438,7 +3424,7 @@ function PriceArchiver({ price }) {
|
|
|
3438
3424
|
if (isArchived) await restorePrice(price.id);
|
|
3439
3425
|
else await archivePrice(price.id);
|
|
3440
3426
|
} catch (error) {
|
|
3441
|
-
|
|
3427
|
+
_chunkIPYXT7MHjs.errorToast.call(void 0, { title: t(`billing.admin.prices.${scope}.title`), error });
|
|
3442
3428
|
throw error;
|
|
3443
3429
|
}
|
|
3444
3430
|
}
|
|
@@ -3470,15 +3456,15 @@ function PriceEditorInternal({
|
|
|
3470
3456
|
onDialogOpenChange
|
|
3471
3457
|
}) {
|
|
3472
3458
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
3473
|
-
const fmt =
|
|
3474
|
-
const router =
|
|
3459
|
+
const fmt = _chunkIPYXT7MHjs.useBillingFormatOptions.call(void 0, );
|
|
3460
|
+
const router = _chunkT3YQ47EFjs.useI18nRouter.call(void 0, );
|
|
3475
3461
|
const { createPrice, updatePrice, productId: contextProductId } = usePriceContext();
|
|
3476
3462
|
const [allFeatures, setAllFeatures] = _react.useState.call(void 0, []);
|
|
3477
3463
|
const isEdit = !!price;
|
|
3478
3464
|
const targetProductId = _nullishCoalesce(_nullishCoalesce(productId, () => ( _optionalChain([price, 'optionalAccess', _119 => _119.product, 'optionalAccess', _120 => _120.id]))), () => ( contextProductId));
|
|
3479
3465
|
_react.useEffect.call(void 0, () => {
|
|
3480
3466
|
const fetchFeatures = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3481
|
-
setAllFeatures(await
|
|
3467
|
+
setAllFeatures(await _chunkT3YQ47EFjs.FeatureService.findMany({}));
|
|
3482
3468
|
}, "fetchFeatures");
|
|
3483
3469
|
void fetchFeatures();
|
|
3484
3470
|
}, []);
|
|
@@ -3591,7 +3577,7 @@ function PriceEditorInternal({
|
|
|
3591
3577
|
warnedUnknownFor.current = fingerprint;
|
|
3592
3578
|
const { unknown } = resolvePlatformFeatures(seed.platformFeatures);
|
|
3593
3579
|
if (unknown.length > 0)
|
|
3594
|
-
|
|
3580
|
+
_chunkT3YQ47EFjs.showToast.call(void 0, t("billing.admin.prices.import.warnings.unknownFeatures", { features: unknown.join(", ") }));
|
|
3595
3581
|
}, [seed, isEdit, allFeatures, resolvePlatformFeatures, t]);
|
|
3596
3582
|
const watchInterval = form.watch("interval");
|
|
3597
3583
|
const isRecurring = watchInterval !== "one_time";
|
|
@@ -3612,13 +3598,13 @@ function PriceEditorInternal({
|
|
|
3612
3598
|
{ id: "metered", text: t("billing.admin.prices.usage.metered") }
|
|
3613
3599
|
];
|
|
3614
3600
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3615
|
-
|
|
3601
|
+
_chunkIPYXT7MHjs.EditorSheet,
|
|
3616
3602
|
{
|
|
3617
3603
|
form,
|
|
3618
3604
|
entityType: t("billing.admin.prices.entity"),
|
|
3619
3605
|
entityName: price ? priceLabel(price, fmt) : void 0,
|
|
3620
3606
|
isEdit,
|
|
3621
|
-
module:
|
|
3607
|
+
module: _chunkT3YQ47EFjs.Modules.StripePrice,
|
|
3622
3608
|
size: "lg",
|
|
3623
3609
|
propagateChanges,
|
|
3624
3610
|
onSuccess,
|
|
@@ -3667,13 +3653,13 @@ function PriceEditorInternal({
|
|
|
3667
3653
|
dialogOpen,
|
|
3668
3654
|
onDialogOpenChange,
|
|
3669
3655
|
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
3670
|
-
isEdit && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3671
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3672
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3656
|
+
isEdit && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.Alert, { children: [
|
|
3657
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.AlertTitle, { children: t("billing.admin.prices.immutability.title") }),
|
|
3658
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.AlertDescription, { children: t("billing.admin.prices.immutability.description") })
|
|
3673
3659
|
] }),
|
|
3674
3660
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
|
|
3675
3661
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3676
|
-
|
|
3662
|
+
_chunkIPYXT7MHjs.FormInput,
|
|
3677
3663
|
{
|
|
3678
3664
|
form,
|
|
3679
3665
|
id: "unitAmount",
|
|
@@ -3685,7 +3671,7 @@ function PriceEditorInternal({
|
|
|
3685
3671
|
}
|
|
3686
3672
|
),
|
|
3687
3673
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3688
|
-
|
|
3674
|
+
_chunkIPYXT7MHjs.FormSelect,
|
|
3689
3675
|
{
|
|
3690
3676
|
form,
|
|
3691
3677
|
id: "currency",
|
|
@@ -3696,7 +3682,7 @@ function PriceEditorInternal({
|
|
|
3696
3682
|
)
|
|
3697
3683
|
] }),
|
|
3698
3684
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3699
|
-
|
|
3685
|
+
_chunkIPYXT7MHjs.FormSelect,
|
|
3700
3686
|
{
|
|
3701
3687
|
form,
|
|
3702
3688
|
id: "interval",
|
|
@@ -3707,7 +3693,7 @@ function PriceEditorInternal({
|
|
|
3707
3693
|
),
|
|
3708
3694
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
|
|
3709
3695
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3710
|
-
|
|
3696
|
+
_chunkIPYXT7MHjs.FormInput,
|
|
3711
3697
|
{
|
|
3712
3698
|
form,
|
|
3713
3699
|
id: "intervalCount",
|
|
@@ -3718,7 +3704,7 @@ function PriceEditorInternal({
|
|
|
3718
3704
|
}
|
|
3719
3705
|
),
|
|
3720
3706
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3721
|
-
|
|
3707
|
+
_chunkIPYXT7MHjs.FormSelect,
|
|
3722
3708
|
{
|
|
3723
3709
|
form,
|
|
3724
3710
|
id: "usageType",
|
|
@@ -3729,7 +3715,7 @@ function PriceEditorInternal({
|
|
|
3729
3715
|
)
|
|
3730
3716
|
] }),
|
|
3731
3717
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3732
|
-
|
|
3718
|
+
_chunkIPYXT7MHjs.FormInput,
|
|
3733
3719
|
{
|
|
3734
3720
|
form,
|
|
3735
3721
|
id: "nickname",
|
|
@@ -3738,7 +3724,7 @@ function PriceEditorInternal({
|
|
|
3738
3724
|
}
|
|
3739
3725
|
),
|
|
3740
3726
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3741
|
-
|
|
3727
|
+
_chunkIPYXT7MHjs.FormTextarea,
|
|
3742
3728
|
{
|
|
3743
3729
|
form,
|
|
3744
3730
|
id: "description",
|
|
@@ -3748,7 +3734,7 @@ function PriceEditorInternal({
|
|
|
3748
3734
|
}
|
|
3749
3735
|
),
|
|
3750
3736
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3751
|
-
|
|
3737
|
+
_chunkIPYXT7MHjs.FormInput,
|
|
3752
3738
|
{
|
|
3753
3739
|
form,
|
|
3754
3740
|
id: "token",
|
|
@@ -3758,10 +3744,10 @@ function PriceEditorInternal({
|
|
|
3758
3744
|
}
|
|
3759
3745
|
),
|
|
3760
3746
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-2", children: [
|
|
3761
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3747
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.FieldLabel, { children: t("billing.admin.prices.fields.features") }),
|
|
3762
3748
|
form.watch("features").map((_, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
|
|
3763
3749
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3764
|
-
|
|
3750
|
+
_chunkIPYXT7MHjs.Input,
|
|
3765
3751
|
{
|
|
3766
3752
|
...form.register(`features.${index}`),
|
|
3767
3753
|
placeholder: t("billing.admin.prices.placeholders.feature", { index: index + 1 }),
|
|
@@ -3769,7 +3755,7 @@ function PriceEditorInternal({
|
|
|
3769
3755
|
}
|
|
3770
3756
|
),
|
|
3771
3757
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3772
|
-
|
|
3758
|
+
_chunkIPYXT7MHjs.Button,
|
|
3773
3759
|
{
|
|
3774
3760
|
type: "button",
|
|
3775
3761
|
variant: "outline",
|
|
@@ -3784,7 +3770,7 @@ function PriceEditorInternal({
|
|
|
3784
3770
|
)
|
|
3785
3771
|
] }, index)),
|
|
3786
3772
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3787
|
-
|
|
3773
|
+
_chunkIPYXT7MHjs.Button,
|
|
3788
3774
|
{
|
|
3789
3775
|
type: "button",
|
|
3790
3776
|
variant: "outline",
|
|
@@ -3799,12 +3785,12 @@ function PriceEditorInternal({
|
|
|
3799
3785
|
)
|
|
3800
3786
|
] }),
|
|
3801
3787
|
isRecurring && allFeatures.length > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-2", children: [
|
|
3802
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3788
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.FieldLabel, { children: t("billing.admin.prices.fields.platformFeatures") }),
|
|
3803
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) => {
|
|
3804
3790
|
const isChecked = form.watch("featureIds").includes(feature.id);
|
|
3805
3791
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
3806
3792
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3807
|
-
|
|
3793
|
+
_chunkIPYXT7MHjs.Checkbox,
|
|
3808
3794
|
{
|
|
3809
3795
|
id: `feature-${feature.id}`,
|
|
3810
3796
|
checked: isChecked,
|
|
@@ -3820,13 +3806,13 @@ function PriceEditorInternal({
|
|
|
3820
3806
|
}
|
|
3821
3807
|
}
|
|
3822
3808
|
),
|
|
3823
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3809
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.FieldLabel, { htmlFor: `feature-${feature.id}`, children: feature.name }),
|
|
3824
3810
|
feature.isCore && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.admin.prices.help.core") })
|
|
3825
3811
|
] }, feature.id);
|
|
3826
3812
|
}) })
|
|
3827
3813
|
] }),
|
|
3828
3814
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3829
|
-
|
|
3815
|
+
_chunkIPYXT7MHjs.FormCheckbox,
|
|
3830
3816
|
{
|
|
3831
3817
|
form,
|
|
3832
3818
|
id: "isTrial",
|
|
@@ -3869,7 +3855,7 @@ var defaultContextValue = {
|
|
|
3869
3855
|
productId: void 0
|
|
3870
3856
|
};
|
|
3871
3857
|
function priceLabel(price, fmt = {}) {
|
|
3872
|
-
return _nullishCoalesce(price.nickname, () => ( `${
|
|
3858
|
+
return _nullishCoalesce(price.nickname, () => ( `${_chunkT3YQ47EFjs.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt)} ${_chunkT3YQ47EFjs.formatInterval.call(void 0, price, fmt)}`.trim()));
|
|
3873
3859
|
}
|
|
3874
3860
|
_chunk7QVYU63Ejs.__name.call(void 0, priceLabel, "priceLabel");
|
|
3875
3861
|
var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
@@ -3879,22 +3865,22 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3879
3865
|
productId: productIdProp
|
|
3880
3866
|
}) => {
|
|
3881
3867
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
3882
|
-
const fmt =
|
|
3883
|
-
const generateUrl =
|
|
3884
|
-
const { hasRole } =
|
|
3868
|
+
const fmt = _chunkIPYXT7MHjs.useBillingFormatOptions.call(void 0, );
|
|
3869
|
+
const generateUrl = _chunkIPYXT7MHjs.usePageUrlGenerator.call(void 0, );
|
|
3870
|
+
const { hasRole } = _chunkIPYXT7MHjs.useCurrentUserContext.call(void 0, );
|
|
3885
3871
|
const [price, setPrice] = _react.useState.call(void 0,
|
|
3886
|
-
dehydratedPrice ?
|
|
3872
|
+
dehydratedPrice ? _chunkT3YQ47EFjs.rehydrate.call(void 0, _chunkT3YQ47EFjs.Modules.StripePrice, dehydratedPrice) : void 0
|
|
3887
3873
|
);
|
|
3888
3874
|
const [priceVersion, setPriceVersion] = _react.useState.call(void 0, 0);
|
|
3889
3875
|
const refreshPrices = _react.useCallback.call(void 0, () => setPriceVersion((value2) => value2 + 1), []);
|
|
3890
3876
|
const productId = _nullishCoalesce(productIdProp, () => ( _optionalChain([price, 'optionalAccess', _143 => _143.product, 'optionalAccess', _144 => _144.id])));
|
|
3891
3877
|
const reloadPrice = _react.useCallback.call(void 0, async () => {
|
|
3892
3878
|
if (!_optionalChain([price, 'optionalAccess', _145 => _145.id])) return;
|
|
3893
|
-
setPrice(await
|
|
3879
|
+
setPrice(await _chunkT3YQ47EFjs.StripePriceService.getPrice({ id: price.id }));
|
|
3894
3880
|
}, [_optionalChain([price, 'optionalAccess', _146 => _146.id])]);
|
|
3895
3881
|
const createPrice = _react.useCallback.call(void 0,
|
|
3896
3882
|
async (input) => {
|
|
3897
|
-
const saved = await
|
|
3883
|
+
const saved = await _chunkT3YQ47EFjs.StripePriceService.createPrice(input);
|
|
3898
3884
|
refreshPrices();
|
|
3899
3885
|
return saved;
|
|
3900
3886
|
},
|
|
@@ -3902,7 +3888,7 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3902
3888
|
);
|
|
3903
3889
|
const updatePrice = _react.useCallback.call(void 0,
|
|
3904
3890
|
async (input) => {
|
|
3905
|
-
const saved = await
|
|
3891
|
+
const saved = await _chunkT3YQ47EFjs.StripePriceService.updatePrice(input);
|
|
3906
3892
|
setPrice(saved);
|
|
3907
3893
|
refreshPrices();
|
|
3908
3894
|
return saved;
|
|
@@ -3913,7 +3899,7 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3913
3899
|
async (id) => {
|
|
3914
3900
|
const target = _nullishCoalesce(id, () => ( _optionalChain([price, 'optionalAccess', _147 => _147.id])));
|
|
3915
3901
|
if (!target) return;
|
|
3916
|
-
await
|
|
3902
|
+
await _chunkT3YQ47EFjs.StripePriceService.archivePrice({ id: target });
|
|
3917
3903
|
await reloadPrice();
|
|
3918
3904
|
refreshPrices();
|
|
3919
3905
|
},
|
|
@@ -3923,7 +3909,7 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3923
3909
|
async (id) => {
|
|
3924
3910
|
const target = _nullishCoalesce(id, () => ( _optionalChain([price, 'optionalAccess', _149 => _149.id])));
|
|
3925
3911
|
if (!target) return;
|
|
3926
|
-
await
|
|
3912
|
+
await _chunkT3YQ47EFjs.StripePriceService.reactivatePrice({ id: target });
|
|
3927
3913
|
await reloadPrice();
|
|
3928
3914
|
refreshPrices();
|
|
3929
3915
|
},
|
|
@@ -3947,12 +3933,12 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3947
3933
|
if (!publishChrome) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceContext.Provider, { value, children });
|
|
3948
3934
|
const breadcrumb = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
3949
3935
|
const items = [
|
|
3950
|
-
{ name: t("billing.admin.products.title"), href: generateUrl({ page:
|
|
3936
|
+
{ name: t("billing.admin.products.title"), href: generateUrl({ page: _chunkT3YQ47EFjs.Modules.StripeProduct }) }
|
|
3951
3937
|
];
|
|
3952
3938
|
if (_optionalChain([price, 'optionalAccess', _151 => _151.product]))
|
|
3953
3939
|
items.push({
|
|
3954
3940
|
name: price.product.name,
|
|
3955
|
-
href: generateUrl({ page:
|
|
3941
|
+
href: generateUrl({ page: _chunkT3YQ47EFjs.Modules.StripeProduct, id: price.product.id })
|
|
3956
3942
|
});
|
|
3957
3943
|
if (price) items.push({ name: priceLabel(price, fmt) });
|
|
3958
3944
|
return items;
|
|
@@ -3969,7 +3955,7 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3969
3955
|
}
|
|
3970
3956
|
return response;
|
|
3971
3957
|
}, "title");
|
|
3972
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3958
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceContext.Provider, { value, children }) });
|
|
3973
3959
|
}, "PriceProvider");
|
|
3974
3960
|
var usePriceContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => _nullishCoalesce(_react.useContext.call(void 0, PriceContext), () => ( defaultContextValue)), "usePriceContext");
|
|
3975
3961
|
|
|
@@ -3989,12 +3975,12 @@ function ProductArchiver({ product }) {
|
|
|
3989
3975
|
const isArchived = !product.active;
|
|
3990
3976
|
const scope = isArchived ? "restore" : "archive";
|
|
3991
3977
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
3992
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3978
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.Button, { variant: "outline", size: "sm", onClick: () => setOpen(true), children: [
|
|
3993
3979
|
isArchived ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RotateCcwIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ArchiveIcon, {}),
|
|
3994
3980
|
t(`billing.admin.products.${scope}.confirm`)
|
|
3995
3981
|
] }),
|
|
3996
3982
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3997
|
-
|
|
3983
|
+
_chunkIPYXT7MHjs.ConfirmDialog,
|
|
3998
3984
|
{
|
|
3999
3985
|
open,
|
|
4000
3986
|
onOpenChange: setOpen,
|
|
@@ -4008,7 +3994,7 @@ function ProductArchiver({ product }) {
|
|
|
4008
3994
|
if (isArchived) await restoreProduct(product.id);
|
|
4009
3995
|
else await archiveProduct(product.id);
|
|
4010
3996
|
} catch (error) {
|
|
4011
|
-
|
|
3997
|
+
_chunkIPYXT7MHjs.errorToast.call(void 0, { title: t(`billing.admin.products.${scope}.title`), error });
|
|
4012
3998
|
throw error;
|
|
4013
3999
|
}
|
|
4014
4000
|
}
|
|
@@ -4037,7 +4023,7 @@ function ProductEditorInternal({
|
|
|
4037
4023
|
onDialogOpenChange
|
|
4038
4024
|
}) {
|
|
4039
4025
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4040
|
-
const router =
|
|
4026
|
+
const router = _chunkT3YQ47EFjs.useI18nRouter.call(void 0, );
|
|
4041
4027
|
const { createProduct, updateProduct } = useProductContext();
|
|
4042
4028
|
const isEdit = !!product;
|
|
4043
4029
|
const formSchema2 = _react.useMemo.call(void 0,
|
|
@@ -4061,13 +4047,13 @@ function ProductEditorInternal({
|
|
|
4061
4047
|
defaultValues: getDefaultValues()
|
|
4062
4048
|
});
|
|
4063
4049
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4064
|
-
|
|
4050
|
+
_chunkIPYXT7MHjs.EditorSheet,
|
|
4065
4051
|
{
|
|
4066
4052
|
form,
|
|
4067
4053
|
entityType: t("billing.admin.products.entity"),
|
|
4068
4054
|
entityName: _optionalChain([product, 'optionalAccess', _155 => _155.name]),
|
|
4069
4055
|
isEdit,
|
|
4070
|
-
module:
|
|
4056
|
+
module: _chunkT3YQ47EFjs.Modules.StripeProduct,
|
|
4071
4057
|
size: "md",
|
|
4072
4058
|
propagateChanges,
|
|
4073
4059
|
onSuccess,
|
|
@@ -4084,7 +4070,7 @@ function ProductEditorInternal({
|
|
|
4084
4070
|
onDialogOpenChange,
|
|
4085
4071
|
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4086
4072
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4087
|
-
|
|
4073
|
+
_chunkIPYXT7MHjs.FormInput,
|
|
4088
4074
|
{
|
|
4089
4075
|
form,
|
|
4090
4076
|
id: "name",
|
|
@@ -4094,7 +4080,7 @@ function ProductEditorInternal({
|
|
|
4094
4080
|
}
|
|
4095
4081
|
),
|
|
4096
4082
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4097
|
-
|
|
4083
|
+
_chunkIPYXT7MHjs.FormTextarea,
|
|
4098
4084
|
{
|
|
4099
4085
|
form,
|
|
4100
4086
|
id: "description",
|
|
@@ -4138,20 +4124,20 @@ var defaultContextValue2 = {
|
|
|
4138
4124
|
};
|
|
4139
4125
|
var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ children, dehydratedProduct, publishChrome = true }) => {
|
|
4140
4126
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4141
|
-
const generateUrl =
|
|
4142
|
-
const { hasRole } =
|
|
4127
|
+
const generateUrl = _chunkIPYXT7MHjs.usePageUrlGenerator.call(void 0, );
|
|
4128
|
+
const { hasRole } = _chunkIPYXT7MHjs.useCurrentUserContext.call(void 0, );
|
|
4143
4129
|
const [product, setProduct] = _react.useState.call(void 0,
|
|
4144
|
-
dehydratedProduct ?
|
|
4130
|
+
dehydratedProduct ? _chunkT3YQ47EFjs.rehydrate.call(void 0, _chunkT3YQ47EFjs.Modules.StripeProduct, dehydratedProduct) : void 0
|
|
4145
4131
|
);
|
|
4146
4132
|
const [catalogueVersion, setCatalogueVersion] = _react.useState.call(void 0, 0);
|
|
4147
4133
|
const refreshCatalogue = _react.useCallback.call(void 0, () => setCatalogueVersion((value2) => value2 + 1), []);
|
|
4148
4134
|
const reloadProduct = _react.useCallback.call(void 0, async () => {
|
|
4149
4135
|
if (!_optionalChain([product, 'optionalAccess', _156 => _156.id])) return;
|
|
4150
|
-
setProduct(await
|
|
4136
|
+
setProduct(await _chunkT3YQ47EFjs.StripeProductService.getProduct({ id: product.id }));
|
|
4151
4137
|
}, [_optionalChain([product, 'optionalAccess', _157 => _157.id])]);
|
|
4152
4138
|
const createProduct = _react.useCallback.call(void 0,
|
|
4153
4139
|
async (input) => {
|
|
4154
|
-
const saved = await
|
|
4140
|
+
const saved = await _chunkT3YQ47EFjs.StripeProductService.createProduct(input);
|
|
4155
4141
|
refreshCatalogue();
|
|
4156
4142
|
return saved;
|
|
4157
4143
|
},
|
|
@@ -4159,7 +4145,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
4159
4145
|
);
|
|
4160
4146
|
const updateProduct = _react.useCallback.call(void 0,
|
|
4161
4147
|
async (input) => {
|
|
4162
|
-
const saved = await
|
|
4148
|
+
const saved = await _chunkT3YQ47EFjs.StripeProductService.updateProduct(input);
|
|
4163
4149
|
setProduct(saved);
|
|
4164
4150
|
refreshCatalogue();
|
|
4165
4151
|
return saved;
|
|
@@ -4170,7 +4156,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
4170
4156
|
async (id) => {
|
|
4171
4157
|
const target = _nullishCoalesce(id, () => ( _optionalChain([product, 'optionalAccess', _158 => _158.id])));
|
|
4172
4158
|
if (!target) return;
|
|
4173
|
-
await
|
|
4159
|
+
await _chunkT3YQ47EFjs.StripeProductService.archiveProduct({ id: target });
|
|
4174
4160
|
await reloadProduct();
|
|
4175
4161
|
refreshCatalogue();
|
|
4176
4162
|
},
|
|
@@ -4180,7 +4166,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
4180
4166
|
async (id) => {
|
|
4181
4167
|
const target = _nullishCoalesce(id, () => ( _optionalChain([product, 'optionalAccess', _160 => _160.id])));
|
|
4182
4168
|
if (!target) return;
|
|
4183
|
-
await
|
|
4169
|
+
await _chunkT3YQ47EFjs.StripeProductService.reactivateProduct({ id: target });
|
|
4184
4170
|
await reloadProduct();
|
|
4185
4171
|
refreshCatalogue();
|
|
4186
4172
|
},
|
|
@@ -4215,7 +4201,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
4215
4201
|
{
|
|
4216
4202
|
name: t("billing.admin.products.title"),
|
|
4217
4203
|
// Linked only when it is NOT the current page.
|
|
4218
|
-
...product ? { href: generateUrl({ page:
|
|
4204
|
+
...product ? { href: generateUrl({ page: _chunkT3YQ47EFjs.Modules.StripeProduct }) } : {}
|
|
4219
4205
|
}
|
|
4220
4206
|
];
|
|
4221
4207
|
if (product) items.push({ name: product.name });
|
|
@@ -4233,7 +4219,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
4233
4219
|
}
|
|
4234
4220
|
return response;
|
|
4235
4221
|
}, "title");
|
|
4236
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4222
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductContext.Provider, { value, children }) });
|
|
4237
4223
|
}, "ProductProvider");
|
|
4238
4224
|
var useProductContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => _nullishCoalesce(_react.useContext.call(void 0, ProductContext), () => ( defaultContextValue2)), "useProductContext");
|
|
4239
4225
|
|
|
@@ -4242,57 +4228,57 @@ var useProductContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ()
|
|
|
4242
4228
|
|
|
4243
4229
|
function PriceDetails() {
|
|
4244
4230
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4245
|
-
const fmt =
|
|
4246
|
-
const generateUrl =
|
|
4231
|
+
const fmt = _chunkIPYXT7MHjs.useBillingFormatOptions.call(void 0, );
|
|
4232
|
+
const generateUrl = _chunkIPYXT7MHjs.usePageUrlGenerator.call(void 0, );
|
|
4247
4233
|
const { price } = usePriceContext();
|
|
4248
4234
|
if (!price) return null;
|
|
4249
4235
|
const isRecurring = price.priceType === "recurring";
|
|
4250
4236
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-8", children: [
|
|
4251
4237
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4252
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4238
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.SectionHeader, { children: t("billing.admin.prices.title") }),
|
|
4253
4239
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
4254
4240
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4255
|
-
|
|
4241
|
+
_chunkIPYXT7MHjs.DetailField,
|
|
4256
4242
|
{
|
|
4257
4243
|
label: t("billing.admin.prices.fields.product"),
|
|
4258
|
-
value: price.product ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4244
|
+
value: price.product ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.Link, { href: generateUrl({ page: _chunkT3YQ47EFjs.Modules.StripeProduct, id: price.product.id }), children: price.product.name }) : "\u2014"
|
|
4259
4245
|
}
|
|
4260
4246
|
),
|
|
4261
4247
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4262
|
-
|
|
4248
|
+
_chunkIPYXT7MHjs.DetailField,
|
|
4263
4249
|
{
|
|
4264
4250
|
label: t("billing.admin.prices.fields.status"),
|
|
4265
4251
|
value: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex flex-wrap items-center gap-1", children: [
|
|
4266
|
-
price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4267
|
-
price.isTrial && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4252
|
+
price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.Badge, { variant: "softGreen", children: t("billing.admin.prices.status.active") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.Badge, { variant: "softGray", children: t("billing.admin.prices.status.archived") }),
|
|
4253
|
+
price.isTrial && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.Badge, { variant: "softBlue", children: t("billing.admin.prices.badge.trial") })
|
|
4268
4254
|
] })
|
|
4269
4255
|
}
|
|
4270
4256
|
),
|
|
4271
4257
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4272
|
-
|
|
4258
|
+
_chunkIPYXT7MHjs.DetailField,
|
|
4273
4259
|
{
|
|
4274
4260
|
label: t("billing.admin.prices.fields.amount"),
|
|
4275
|
-
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: _chunkT3YQ47EFjs.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt) })
|
|
4276
4262
|
}
|
|
4277
4263
|
),
|
|
4278
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4264
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.DetailField, { label: t("billing.admin.prices.fields.currency"), value: price.currency.toUpperCase() }),
|
|
4279
4265
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4280
|
-
|
|
4266
|
+
_chunkIPYXT7MHjs.DetailField,
|
|
4281
4267
|
{
|
|
4282
4268
|
label: t("billing.admin.prices.fields.type"),
|
|
4283
4269
|
value: isRecurring ? t("billing.admin.prices.type.recurring") : t("billing.admin.prices.type.oneTime")
|
|
4284
4270
|
}
|
|
4285
4271
|
),
|
|
4286
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4272
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.DetailField, { label: t("billing.admin.prices.fields.billing"), value: _chunkT3YQ47EFjs.formatInterval.call(void 0, price, fmt) }),
|
|
4287
4273
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4288
|
-
|
|
4274
|
+
_chunkIPYXT7MHjs.DetailField,
|
|
4289
4275
|
{
|
|
4290
4276
|
label: t("billing.admin.prices.fields.intervalCount"),
|
|
4291
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)) })
|
|
4292
4278
|
}
|
|
4293
4279
|
),
|
|
4294
4280
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4295
|
-
|
|
4281
|
+
_chunkIPYXT7MHjs.DetailField,
|
|
4296
4282
|
{
|
|
4297
4283
|
label: t("billing.admin.prices.fields.usageType"),
|
|
4298
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")
|
|
@@ -4301,24 +4287,24 @@ function PriceDetails() {
|
|
|
4301
4287
|
] })
|
|
4302
4288
|
] }),
|
|
4303
4289
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4304
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4290
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.SectionHeader, { children: t("billing.admin.prices.fields.platformFeatures") }),
|
|
4305
4291
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
4306
4292
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4307
|
-
|
|
4293
|
+
_chunkIPYXT7MHjs.DetailField,
|
|
4308
4294
|
{
|
|
4309
4295
|
label: t("billing.admin.prices.fields.token"),
|
|
4310
4296
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _nullishCoalesce(price.token, () => ( "\u2014")) })
|
|
4311
4297
|
}
|
|
4312
4298
|
),
|
|
4313
4299
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4314
|
-
|
|
4300
|
+
_chunkIPYXT7MHjs.DetailField,
|
|
4315
4301
|
{
|
|
4316
4302
|
label: t("billing.admin.prices.fields.stripeId"),
|
|
4317
4303
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: price.stripePriceId })
|
|
4318
4304
|
}
|
|
4319
4305
|
),
|
|
4320
4306
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4321
|
-
|
|
4307
|
+
_chunkIPYXT7MHjs.DetailField,
|
|
4322
4308
|
{
|
|
4323
4309
|
label: t("billing.admin.prices.fields.description"),
|
|
4324
4310
|
value: _nullishCoalesce(price.description, () => ( "\u2014")),
|
|
@@ -4326,7 +4312,7 @@ function PriceDetails() {
|
|
|
4326
4312
|
}
|
|
4327
4313
|
),
|
|
4328
4314
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4329
|
-
|
|
4315
|
+
_chunkIPYXT7MHjs.DetailField,
|
|
4330
4316
|
{
|
|
4331
4317
|
label: t("billing.admin.prices.fields.features"),
|
|
4332
4318
|
className: "md:col-span-2",
|
|
@@ -4334,11 +4320,11 @@ function PriceDetails() {
|
|
|
4334
4320
|
}
|
|
4335
4321
|
),
|
|
4336
4322
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4337
|
-
|
|
4323
|
+
_chunkIPYXT7MHjs.DetailField,
|
|
4338
4324
|
{
|
|
4339
4325
|
label: t("billing.admin.prices.fields.platformFeatures"),
|
|
4340
4326
|
className: "md:col-span-2",
|
|
4341
|
-
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, _chunkIPYXT7MHjs.Badge, { variant: "softGray", children: feature.name }, feature.id)) }) : "\u2014"
|
|
4342
4328
|
}
|
|
4343
4329
|
)
|
|
4344
4330
|
] })
|
|
@@ -4352,7 +4338,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, PriceDetails, "PriceDetails");
|
|
|
4352
4338
|
function PriceContainer() {
|
|
4353
4339
|
const { price } = usePriceContext();
|
|
4354
4340
|
if (!price) return null;
|
|
4355
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4341
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.RoundPageContainer, { module: _chunkT3YQ47EFjs.Modules.StripePrice, id: price.id, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceDetails, {}) });
|
|
4356
4342
|
}
|
|
4357
4343
|
_chunk7QVYU63Ejs.__name.call(void 0, PriceContainer, "PriceContainer");
|
|
4358
4344
|
|
|
@@ -4477,10 +4463,10 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4477
4463
|
const importInputRef = _react.useRef.call(void 0, null);
|
|
4478
4464
|
const [seed, setSeed] = _react.useState.call(void 0, void 0);
|
|
4479
4465
|
const [seedNonce, setSeedNonce] = _react.useState.call(void 0, 0);
|
|
4480
|
-
const data =
|
|
4481
|
-
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) =>
|
|
4466
|
+
const data = _chunkIPYXT7MHjs.useDataListRetriever.call(void 0, {
|
|
4467
|
+
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunkT3YQ47EFjs.StripePriceService.listPrices({ ...params, productId }), "retriever"),
|
|
4482
4468
|
retrieverParams: {},
|
|
4483
|
-
module:
|
|
4469
|
+
module: _chunkT3YQ47EFjs.Modules.StripePrice
|
|
4484
4470
|
});
|
|
4485
4471
|
_react.useEffect.call(void 0, () => {
|
|
4486
4472
|
if (priceVersion > 0) void data.refresh();
|
|
@@ -4515,7 +4501,7 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4515
4501
|
openSeededEditor(transfer.price);
|
|
4516
4502
|
} catch (error) {
|
|
4517
4503
|
console.error("[PricesList] price import failed", error);
|
|
4518
|
-
|
|
4504
|
+
_chunkIPYXT7MHjs.errorToast.call(void 0, {
|
|
4519
4505
|
title: t("billing.admin.prices.import.errors.title"),
|
|
4520
4506
|
error: t("billing.admin.prices.import.errors.invalid")
|
|
4521
4507
|
});
|
|
@@ -4534,7 +4520,7 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4534
4520
|
"create-price"
|
|
4535
4521
|
),
|
|
4536
4522
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _react.Fragment, { children: [
|
|
4537
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
4523
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.Button, { variant: "outline", size: "sm", type: "button", onClick: () => _optionalChain([importInputRef, 'access', _180 => _180.current, 'optionalAccess', _181 => _181.click, 'call', _182 => _182()]), children: [
|
|
4538
4524
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.UploadIcon, {}),
|
|
4539
4525
|
t("billing.admin.prices.actions.import")
|
|
4540
4526
|
] }),
|
|
@@ -4552,7 +4538,7 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4552
4538
|
];
|
|
4553
4539
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
4554
4540
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4555
|
-
|
|
4541
|
+
_chunkIPYXT7MHjs.ContentListTable,
|
|
4556
4542
|
{
|
|
4557
4543
|
data,
|
|
4558
4544
|
fields: [
|
|
@@ -4563,13 +4549,13 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4563
4549
|
"status" /* status */,
|
|
4564
4550
|
"actions" /* actions */
|
|
4565
4551
|
],
|
|
4566
|
-
tableGeneratorType:
|
|
4552
|
+
tableGeneratorType: _chunkT3YQ47EFjs.Modules.StripePrice,
|
|
4567
4553
|
functions,
|
|
4568
4554
|
context: tableContext,
|
|
4569
4555
|
fullWidth,
|
|
4570
4556
|
title: t("billing.admin.prices.title"),
|
|
4571
4557
|
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4572
|
-
|
|
4558
|
+
_chunkIPYXT7MHjs.EmptyState,
|
|
4573
4559
|
{
|
|
4574
4560
|
icon: _lucidereact.DollarSignIcon,
|
|
4575
4561
|
title: t("billing.admin.prices.empty.title"),
|
|
@@ -4609,18 +4595,18 @@ function ProductDetails() {
|
|
|
4609
4595
|
const { product } = useProductContext();
|
|
4610
4596
|
if (!product) return null;
|
|
4611
4597
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4612
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4598
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.SectionHeader, { children: t("billing.admin.products.tabs.details") }),
|
|
4613
4599
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
4614
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4600
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.DetailField, { label: t("billing.admin.products.fields.name"), value: product.name }),
|
|
4615
4601
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4616
|
-
|
|
4602
|
+
_chunkIPYXT7MHjs.DetailField,
|
|
4617
4603
|
{
|
|
4618
4604
|
label: t("billing.admin.products.fields.status"),
|
|
4619
|
-
value: product.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4605
|
+
value: product.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.Badge, { variant: "softGreen", children: t("billing.admin.products.status.active") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.Badge, { variant: "softGray", children: t("billing.admin.products.status.archived") })
|
|
4620
4606
|
}
|
|
4621
4607
|
),
|
|
4622
4608
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4623
|
-
|
|
4609
|
+
_chunkIPYXT7MHjs.DetailField,
|
|
4624
4610
|
{
|
|
4625
4611
|
label: t("billing.admin.products.fields.description"),
|
|
4626
4612
|
value: _nullishCoalesce(product.description, () => ( "\u2014")),
|
|
@@ -4628,14 +4614,14 @@ function ProductDetails() {
|
|
|
4628
4614
|
}
|
|
4629
4615
|
),
|
|
4630
4616
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4631
|
-
|
|
4617
|
+
_chunkIPYXT7MHjs.DetailField,
|
|
4632
4618
|
{
|
|
4633
4619
|
label: t("billing.admin.products.fields.prices"),
|
|
4634
4620
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: product.stripePrices.length })
|
|
4635
4621
|
}
|
|
4636
4622
|
),
|
|
4637
4623
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4638
|
-
|
|
4624
|
+
_chunkIPYXT7MHjs.DetailField,
|
|
4639
4625
|
{
|
|
4640
4626
|
label: t("billing.admin.products.fields.stripeId"),
|
|
4641
4627
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: product.stripeProductId })
|
|
@@ -4653,9 +4639,9 @@ function ProductContainer() {
|
|
|
4653
4639
|
const { product } = useProductContext();
|
|
4654
4640
|
if (!product) return null;
|
|
4655
4641
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4656
|
-
|
|
4642
|
+
_chunkIPYXT7MHjs.RoundPageContainer,
|
|
4657
4643
|
{
|
|
4658
|
-
module:
|
|
4644
|
+
module: _chunkT3YQ47EFjs.Modules.StripeProduct,
|
|
4659
4645
|
id: product.id,
|
|
4660
4646
|
tabs: [
|
|
4661
4647
|
{
|
|
@@ -4664,7 +4650,7 @@ function ProductContainer() {
|
|
|
4664
4650
|
content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductDetails, {})
|
|
4665
4651
|
},
|
|
4666
4652
|
{
|
|
4667
|
-
key:
|
|
4653
|
+
key: _chunkT3YQ47EFjs.Modules.StripePrice,
|
|
4668
4654
|
label: t("billing.admin.prices.title"),
|
|
4669
4655
|
// publishChrome={false}: SharedProvider REPLACES its value for the
|
|
4670
4656
|
// subtree (SharedContext.tsx:35-37), so a nested provider publishing
|
|
@@ -4690,18 +4676,18 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductContainer, "ProductContainer");
|
|
|
4690
4676
|
|
|
4691
4677
|
function CouponsList({ fullWidth } = {}) {
|
|
4692
4678
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4693
|
-
const { catalogueVersion } =
|
|
4694
|
-
const data =
|
|
4695
|
-
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) =>
|
|
4679
|
+
const { catalogueVersion } = _chunkIPYXT7MHjs.useCouponContext.call(void 0, );
|
|
4680
|
+
const data = _chunkIPYXT7MHjs.useDataListRetriever.call(void 0, {
|
|
4681
|
+
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunkT3YQ47EFjs.StripeCouponService.listCoupons(params), "retriever"),
|
|
4696
4682
|
retrieverParams: {},
|
|
4697
|
-
module:
|
|
4683
|
+
module: _chunkT3YQ47EFjs.Modules.StripeCoupon
|
|
4698
4684
|
});
|
|
4699
4685
|
_react.useEffect.call(void 0, () => {
|
|
4700
4686
|
if (catalogueVersion > 0) void data.refresh();
|
|
4701
4687
|
}, [catalogueVersion]);
|
|
4702
|
-
const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4688
|
+
const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.CouponEditor, {}, "create-coupon")];
|
|
4703
4689
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4704
|
-
|
|
4690
|
+
_chunkIPYXT7MHjs.ContentListTable,
|
|
4705
4691
|
{
|
|
4706
4692
|
data,
|
|
4707
4693
|
fields: [
|
|
@@ -4711,12 +4697,12 @@ function CouponsList({ fullWidth } = {}) {
|
|
|
4711
4697
|
"codes" /* codes */,
|
|
4712
4698
|
"status" /* status */
|
|
4713
4699
|
],
|
|
4714
|
-
tableGeneratorType:
|
|
4700
|
+
tableGeneratorType: _chunkT3YQ47EFjs.Modules.StripeCoupon,
|
|
4715
4701
|
functions,
|
|
4716
4702
|
fullWidth,
|
|
4717
4703
|
title: t("billing.admin.coupons.title"),
|
|
4718
4704
|
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4719
|
-
|
|
4705
|
+
_chunkIPYXT7MHjs.EmptyState,
|
|
4720
4706
|
{
|
|
4721
4707
|
icon: _lucidereact.TicketPercentIcon,
|
|
4722
4708
|
title: t("billing.admin.coupons.empty.title"),
|
|
@@ -4736,26 +4722,26 @@ _chunk7QVYU63Ejs.__name.call(void 0, CouponsList, "CouponsList");
|
|
|
4736
4722
|
function ProductsList({ fullWidth } = {}) {
|
|
4737
4723
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4738
4724
|
const { catalogueVersion } = useProductContext();
|
|
4739
|
-
const data =
|
|
4740
|
-
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) =>
|
|
4725
|
+
const data = _chunkIPYXT7MHjs.useDataListRetriever.call(void 0, {
|
|
4726
|
+
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunkT3YQ47EFjs.StripeProductService.listProducts(params), "retriever"),
|
|
4741
4727
|
retrieverParams: {},
|
|
4742
|
-
module:
|
|
4728
|
+
module: _chunkT3YQ47EFjs.Modules.StripeProduct
|
|
4743
4729
|
});
|
|
4744
4730
|
_react.useEffect.call(void 0, () => {
|
|
4745
4731
|
if (catalogueVersion > 0) void data.refresh();
|
|
4746
4732
|
}, [catalogueVersion]);
|
|
4747
4733
|
const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductEditor, {}, "create-product")];
|
|
4748
4734
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4749
|
-
|
|
4735
|
+
_chunkIPYXT7MHjs.ContentListTable,
|
|
4750
4736
|
{
|
|
4751
4737
|
data,
|
|
4752
4738
|
fields: ["name" /* name */, "status" /* status */, "prices" /* prices */],
|
|
4753
|
-
tableGeneratorType:
|
|
4739
|
+
tableGeneratorType: _chunkT3YQ47EFjs.Modules.StripeProduct,
|
|
4754
4740
|
functions,
|
|
4755
4741
|
fullWidth,
|
|
4756
4742
|
title: t("billing.admin.products.title"),
|
|
4757
4743
|
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4758
|
-
|
|
4744
|
+
_chunkIPYXT7MHjs.EmptyState,
|
|
4759
4745
|
{
|
|
4760
4746
|
icon: _lucidereact.PackageIcon,
|
|
4761
4747
|
title: t("billing.admin.products.empty.title"),
|
|
@@ -4771,10 +4757,10 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductsList, "ProductsList");
|
|
|
4771
4757
|
|
|
4772
4758
|
function ProductsListContainer() {
|
|
4773
4759
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4774
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductProvider, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4775
|
-
|
|
4760
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductProvider, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.CouponProvider, { publishChrome: false, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4761
|
+
_chunkIPYXT7MHjs.RoundPageContainer,
|
|
4776
4762
|
{
|
|
4777
|
-
module:
|
|
4763
|
+
module: _chunkT3YQ47EFjs.Modules.StripeProduct,
|
|
4778
4764
|
tabs: [
|
|
4779
4765
|
{ sectionKey: "products", label: t("billing.admin.products.tabs.products"), content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductsList, {}) },
|
|
4780
4766
|
{ sectionKey: "codes", label: t("billing.admin.products.tabs.codes"), content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CouponsList, {}) }
|
|
@@ -4792,30 +4778,30 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductsListContainer, "ProductsListContain
|
|
|
4792
4778
|
|
|
4793
4779
|
function CouponDetails() {
|
|
4794
4780
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4795
|
-
const fmt =
|
|
4796
|
-
const { coupon } =
|
|
4781
|
+
const fmt = _chunkIPYXT7MHjs.useBillingFormatOptions.call(void 0, );
|
|
4782
|
+
const { coupon } = _chunkIPYXT7MHjs.useCouponContext.call(void 0, );
|
|
4797
4783
|
if (!coupon) return null;
|
|
4798
4784
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4799
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4785
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.SectionHeader, { children: t("billing.admin.products.tabs.details") }),
|
|
4800
4786
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-xs/relaxed", children: t("billing.admin.coupons.fixed_notice") }),
|
|
4801
4787
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
4802
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4788
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.DetailField, { label: t("billing.admin.coupons.fields.name"), value: coupon.name }),
|
|
4803
4789
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4804
|
-
|
|
4790
|
+
_chunkIPYXT7MHjs.DetailField,
|
|
4805
4791
|
{
|
|
4806
4792
|
label: t("billing.admin.coupons.fields.status"),
|
|
4807
|
-
value: coupon.valid ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4793
|
+
value: coupon.valid ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.Badge, { variant: "softGreen", children: t("billing.admin.coupons.status.active") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.Badge, { variant: "softGray", children: t("billing.admin.coupons.status.ended") })
|
|
4808
4794
|
}
|
|
4809
4795
|
),
|
|
4810
4796
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4811
|
-
|
|
4797
|
+
_chunkIPYXT7MHjs.DetailField,
|
|
4812
4798
|
{
|
|
4813
4799
|
label: t("billing.admin.coupons.fields.discount"),
|
|
4814
|
-
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: _chunkT3YQ47EFjs.formatCouponDiscount.call(void 0, coupon, t, fmt) })
|
|
4815
4801
|
}
|
|
4816
4802
|
),
|
|
4817
4803
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4818
|
-
|
|
4804
|
+
_chunkIPYXT7MHjs.DetailField,
|
|
4819
4805
|
{
|
|
4820
4806
|
label: t("billing.admin.coupons.fields.places"),
|
|
4821
4807
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: coupon.maxRedemptions !== void 0 ? t("billing.admin.coupons.places.limited", {
|
|
@@ -4825,21 +4811,21 @@ function CouponDetails() {
|
|
|
4825
4811
|
}
|
|
4826
4812
|
),
|
|
4827
4813
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4828
|
-
|
|
4814
|
+
_chunkIPYXT7MHjs.DetailField,
|
|
4829
4815
|
{
|
|
4830
4816
|
label: t("billing.admin.coupons.fields.products"),
|
|
4831
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")
|
|
4832
4818
|
}
|
|
4833
4819
|
),
|
|
4834
4820
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4835
|
-
|
|
4821
|
+
_chunkIPYXT7MHjs.DetailField,
|
|
4836
4822
|
{
|
|
4837
4823
|
label: t("billing.admin.coupons.fields.redeemBy"),
|
|
4838
|
-
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 ? _chunkIPYXT7MHjs.formatDate.call(void 0, coupon.redeemBy, fmt) : "\u2014" })
|
|
4839
4825
|
}
|
|
4840
4826
|
),
|
|
4841
4827
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4842
|
-
|
|
4828
|
+
_chunkIPYXT7MHjs.DetailField,
|
|
4843
4829
|
{
|
|
4844
4830
|
label: t("billing.admin.coupons.fields.stripeId"),
|
|
4845
4831
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: coupon.stripeCouponId })
|
|
@@ -4873,33 +4859,33 @@ function CouponCodeEditorInternal({
|
|
|
4873
4859
|
onDialogOpenChange
|
|
4874
4860
|
}) {
|
|
4875
4861
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4876
|
-
const router =
|
|
4877
|
-
const { createCode } =
|
|
4878
|
-
const formSchema2 = _react.useMemo.call(void 0, () => _zod3.z.object({ id: _zod3.z.uuidv4() }).and(
|
|
4879
|
-
const getDefaultValues = _react.useCallback.call(void 0, () => ({ id: _uuid.v4.call(void 0, ), ...
|
|
4862
|
+
const router = _chunkT3YQ47EFjs.useI18nRouter.call(void 0, );
|
|
4863
|
+
const { createCode } = _chunkIPYXT7MHjs.useCouponContext.call(void 0, );
|
|
4864
|
+
const formSchema2 = _react.useMemo.call(void 0, () => _zod3.z.object({ id: _zod3.z.uuidv4() }).and(_chunkIPYXT7MHjs.couponCodeSchema.call(void 0, t)), [t]);
|
|
4865
|
+
const getDefaultValues = _react.useCallback.call(void 0, () => ({ id: _uuid.v4.call(void 0, ), ..._chunkIPYXT7MHjs.couponCodeDefaults.call(void 0, ) }), []);
|
|
4880
4866
|
const form = _reacthookform.useForm.call(void 0, {
|
|
4881
4867
|
resolver: _zod.zodResolver.call(void 0, formSchema2),
|
|
4882
4868
|
defaultValues: getDefaultValues()
|
|
4883
4869
|
});
|
|
4884
4870
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4885
|
-
|
|
4871
|
+
_chunkIPYXT7MHjs.EditorSheet,
|
|
4886
4872
|
{
|
|
4887
4873
|
form,
|
|
4888
4874
|
entityType: t("billing.admin.coupons.codes.entity"),
|
|
4889
4875
|
isEdit: false,
|
|
4890
|
-
module:
|
|
4876
|
+
module: _chunkT3YQ47EFjs.Modules.StripeCouponCode,
|
|
4891
4877
|
size: "md",
|
|
4892
4878
|
onSuccess: _nullishCoalesce(onSuccess, () => ( (() => {
|
|
4893
4879
|
}))),
|
|
4894
4880
|
onNavigate: (url) => router.push(url),
|
|
4895
|
-
onSubmit: async (values) => await createCode({ id: values.id, couponId, ...
|
|
4881
|
+
onSubmit: async (values) => await createCode({ id: values.id, couponId, ..._chunkIPYXT7MHjs.toCouponCodeInput.call(void 0, values) }),
|
|
4896
4882
|
onReset: getDefaultValues,
|
|
4897
4883
|
trigger,
|
|
4898
4884
|
forceShow,
|
|
4899
4885
|
onClose,
|
|
4900
4886
|
dialogOpen,
|
|
4901
4887
|
onDialogOpenChange,
|
|
4902
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4888
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.CouponCodeFields, { form })
|
|
4903
4889
|
}
|
|
4904
4890
|
);
|
|
4905
4891
|
}
|
|
@@ -4913,18 +4899,18 @@ _chunk7QVYU63Ejs.__name.call(void 0, CouponCodeEditor, "CouponCodeEditor");
|
|
|
4913
4899
|
|
|
4914
4900
|
function CouponCodesList({ couponId }) {
|
|
4915
4901
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4916
|
-
const { catalogueVersion } =
|
|
4917
|
-
const data =
|
|
4918
|
-
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) =>
|
|
4902
|
+
const { catalogueVersion } = _chunkIPYXT7MHjs.useCouponContext.call(void 0, );
|
|
4903
|
+
const data = _chunkIPYXT7MHjs.useDataListRetriever.call(void 0, {
|
|
4904
|
+
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunkT3YQ47EFjs.StripeCouponCodeService.listByCoupon({ ...params, couponId }), "retriever"),
|
|
4919
4905
|
retrieverParams: {},
|
|
4920
|
-
module:
|
|
4906
|
+
module: _chunkT3YQ47EFjs.Modules.StripeCouponCode
|
|
4921
4907
|
});
|
|
4922
4908
|
_react.useEffect.call(void 0, () => {
|
|
4923
4909
|
if (catalogueVersion > 0) void data.refresh();
|
|
4924
4910
|
}, [catalogueVersion]);
|
|
4925
4911
|
const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, CouponCodeEditor, { couponId }, "create-code")];
|
|
4926
4912
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4927
|
-
|
|
4913
|
+
_chunkIPYXT7MHjs.ContentListTable,
|
|
4928
4914
|
{
|
|
4929
4915
|
data,
|
|
4930
4916
|
fields: [
|
|
@@ -4935,11 +4921,11 @@ function CouponCodesList({ couponId }) {
|
|
|
4935
4921
|
"status" /* status */,
|
|
4936
4922
|
"actions" /* actions */
|
|
4937
4923
|
],
|
|
4938
|
-
tableGeneratorType:
|
|
4924
|
+
tableGeneratorType: _chunkT3YQ47EFjs.Modules.StripeCouponCode,
|
|
4939
4925
|
functions,
|
|
4940
4926
|
title: t("billing.admin.coupons.codes.title"),
|
|
4941
4927
|
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4942
|
-
|
|
4928
|
+
_chunkIPYXT7MHjs.EmptyState,
|
|
4943
4929
|
{
|
|
4944
4930
|
icon: _lucidereact.TicketIcon,
|
|
4945
4931
|
title: t("billing.admin.coupons.codes.empty.title"),
|
|
@@ -4955,12 +4941,12 @@ _chunk7QVYU63Ejs.__name.call(void 0, CouponCodesList, "CouponCodesList");
|
|
|
4955
4941
|
|
|
4956
4942
|
function CouponContainer() {
|
|
4957
4943
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4958
|
-
const { coupon } =
|
|
4944
|
+
const { coupon } = _chunkIPYXT7MHjs.useCouponContext.call(void 0, );
|
|
4959
4945
|
if (!coupon) return null;
|
|
4960
4946
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4961
|
-
|
|
4947
|
+
_chunkIPYXT7MHjs.RoundPageContainer,
|
|
4962
4948
|
{
|
|
4963
|
-
module:
|
|
4949
|
+
module: _chunkIPYXT7MHjs.couponPageModule.call(void 0, ),
|
|
4964
4950
|
id: coupon.id,
|
|
4965
4951
|
tabs: [
|
|
4966
4952
|
{
|
|
@@ -5067,5 +5053,5 @@ _chunk7QVYU63Ejs.__name.call(void 0, CouponContainer, "CouponContainer");
|
|
|
5067
5053
|
|
|
5068
5054
|
|
|
5069
5055
|
|
|
5070
|
-
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 = _chunkIPYXT7MHjs.CouponCodeActions; exports.CouponCodeEditor = CouponCodeEditor; exports.CouponCodeFields = _chunkIPYXT7MHjs.CouponCodeFields; exports.CouponCodesList = CouponCodesList; exports.CouponContainer = CouponContainer; exports.CouponDetails = CouponDetails; exports.CouponEditor = _chunkIPYXT7MHjs.CouponEditor; exports.CouponProvider = _chunkIPYXT7MHjs.CouponProvider; exports.CouponRefresher = _chunkIPYXT7MHjs.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 = _chunkIPYXT7MHjs.applyDiscount; exports.couponCodeDefaults = _chunkIPYXT7MHjs.couponCodeDefaults; exports.couponCodeSchema = _chunkIPYXT7MHjs.couponCodeSchema; exports.couponCurrencyOptions = _chunkIPYXT7MHjs.couponCurrencyOptions; exports.formatCurrency = _chunkT3YQ47EFjs.formatCurrency; exports.formatDate = _chunkIPYXT7MHjs.formatDate; exports.formatFixed = _chunkT3YQ47EFjs.formatFixed; exports.formatInterval = _chunkT3YQ47EFjs.formatInterval; exports.isStripeConfigured = isStripeConfigured; exports.optionalDate = _chunkIPYXT7MHjs.optionalDate; exports.optionalDecimal = _chunkIPYXT7MHjs.optionalDecimal; exports.optionalPositiveInt = _chunkIPYXT7MHjs.optionalPositiveInt; exports.parseOptionalDecimal = _chunkIPYXT7MHjs.parseOptionalDecimal; exports.parseOptionalPositiveInt = _chunkIPYXT7MHjs.parseOptionalPositiveInt; exports.priceLabel = priceLabel; exports.promotionCodeDiscount = _chunkIPYXT7MHjs.promotionCodeDiscount; exports.subscriptionDiscount = _chunkIPYXT7MHjs.subscriptionDiscount; exports.toCouponCodeInput = _chunkIPYXT7MHjs.toCouponCodeInput; exports.useBillingFormatOptions = _chunkIPYXT7MHjs.useBillingFormatOptions; exports.useCouponContext = _chunkIPYXT7MHjs.useCouponContext; exports.usePriceContext = usePriceContext; exports.useProductContext = useProductContext;
|
|
5071
5057
|
//# sourceMappingURL=index.js.map
|