@carlonicora/nextjs-jsonapi 5.7.2 → 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 -519
- package/dist/billing/index.js.map +1 -1
- package/dist/billing/index.mjs +5 -32
- 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 -3
- package/messages/it.json +2 -3
- 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 -2
- package/src/features/billing/stripe-subscription/components/details/SubscriptionDetails.tsx +1 -40
- 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,47 +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 handlePause = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1326
|
-
setIsProcessing(true);
|
|
1327
|
-
try {
|
|
1328
|
-
await _chunk3CSPHMVKjs.StripeSubscriptionService.pauseSubscription({ subscriptionId: subscription.id });
|
|
1329
|
-
onSubscriptionChange();
|
|
1330
|
-
} catch (error) {
|
|
1331
|
-
console.error("[SubscriptionDetails] Failed to pause subscription:", error);
|
|
1332
|
-
} finally {
|
|
1333
|
-
setIsProcessing(false);
|
|
1334
|
-
}
|
|
1335
|
-
}, "handlePause");
|
|
1336
|
-
const handleResume = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1337
|
-
setIsProcessing(true);
|
|
1338
|
-
try {
|
|
1339
|
-
await _chunk3CSPHMVKjs.StripeSubscriptionService.resumeSubscription({ subscriptionId: subscription.id });
|
|
1340
|
-
onSubscriptionChange();
|
|
1341
|
-
} catch (error) {
|
|
1342
|
-
console.error("[SubscriptionDetails] Failed to resume subscription:", error);
|
|
1343
|
-
} finally {
|
|
1344
|
-
setIsProcessing(false);
|
|
1345
|
-
}
|
|
1346
|
-
}, "handleResume");
|
|
1347
1324
|
const handleManageViaPortal = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1348
1325
|
try {
|
|
1349
|
-
const { url } = await
|
|
1326
|
+
const { url } = await _chunkT3YQ47EFjs.StripeCustomerService.createPortalSession();
|
|
1350
1327
|
window.open(url, "_blank");
|
|
1351
1328
|
} catch (error) {
|
|
1352
1329
|
console.error("[SubscriptionDetails] Failed to create portal session:", error);
|
|
1353
1330
|
}
|
|
1354
1331
|
}, "handleManageViaPortal");
|
|
1355
|
-
const canPause = subscription.status === "active" /* ACTIVE */;
|
|
1356
|
-
const canResume = subscription.status === "paused" /* PAUSED */;
|
|
1357
1332
|
const canCancel = subscription.status === "active" /* ACTIVE */ || subscription.status === "trialing" /* TRIALING */ || subscription.status === "paused" /* PAUSED */;
|
|
1358
1333
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1359
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1360
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1361
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1362
|
-
/* @__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") })
|
|
1363
1338
|
] }),
|
|
1364
1339
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
1365
1340
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
@@ -1385,24 +1360,22 @@ function SubscriptionDetails({
|
|
|
1385
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: [
|
|
1386
1361
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.subscription.current_period") }),
|
|
1387
1362
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "text-sm", children: [
|
|
1388
|
-
|
|
1363
|
+
_chunkIPYXT7MHjs.formatDate.call(void 0, subscription.currentPeriodStart, fmt),
|
|
1389
1364
|
" - ",
|
|
1390
|
-
|
|
1365
|
+
_chunkIPYXT7MHjs.formatDate.call(void 0, subscription.currentPeriodEnd, fmt)
|
|
1391
1366
|
] })
|
|
1392
1367
|
] }) }),
|
|
1393
1368
|
subscription.trialEnd && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1394
1369
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.subscription.trial_ends") }),
|
|
1395
|
-
/* @__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) })
|
|
1396
1371
|
] }),
|
|
1397
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", {
|
|
1398
|
-
date:
|
|
1373
|
+
date: _chunkIPYXT7MHjs.formatDate.call(void 0, subscription.currentPeriodEnd, fmt)
|
|
1399
1374
|
}) }) }),
|
|
1400
1375
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2 pt-4 border-t", children: [
|
|
1401
|
-
onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
canCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Button, { variant: "destructive", onClick: () => setShowCancel(true), children: t("ui.buttons.cancel") }),
|
|
1405
|
-
/* @__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") })
|
|
1406
1379
|
] })
|
|
1407
1380
|
] })
|
|
1408
1381
|
] }) }),
|
|
@@ -1445,46 +1418,46 @@ function formatPlanName3(price, t) {
|
|
|
1445
1418
|
_chunk7QVYU63Ejs.__name.call(void 0, formatPlanName3, "formatPlanName");
|
|
1446
1419
|
function SubscriptionsList({ subscriptions, onSubscriptionsChange, onChangePlan }) {
|
|
1447
1420
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1448
|
-
const fmt =
|
|
1421
|
+
const fmt = _chunkIPYXT7MHjs.useBillingFormatOptions.call(void 0, );
|
|
1449
1422
|
const [selectedSub, setSelectedSub] = _react.useState.call(void 0, null);
|
|
1450
1423
|
const handleRowClick = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (subscription) => {
|
|
1451
1424
|
setSelectedSub(subscription);
|
|
1452
1425
|
}, "handleRowClick");
|
|
1453
1426
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1454
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1455
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1456
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1457
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1458
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1459
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1460
|
-
/* @__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") })
|
|
1461
1434
|
] }) }),
|
|
1462
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1435
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TableBody, { children: subscriptions.map((subscription) => {
|
|
1463
1436
|
const price = subscription.price;
|
|
1464
|
-
const amount = _optionalChain([price, 'optionalAccess', _42 => _42.unitAmount]) ?
|
|
1465
|
-
const discountedAmount = price ?
|
|
1466
|
-
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)}`;
|
|
1467
1440
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1468
|
-
|
|
1441
|
+
_chunkIPYXT7MHjs.TableRow,
|
|
1469
1442
|
{
|
|
1470
1443
|
onClick: () => handleRowClick(subscription),
|
|
1471
1444
|
className: "cursor-pointer hover:bg-muted/50",
|
|
1472
1445
|
children: [
|
|
1473
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1446
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1474
1447
|
SubscriptionStatusBadge,
|
|
1475
1448
|
{
|
|
1476
1449
|
status: subscription.status,
|
|
1477
1450
|
cancelAtPeriodEnd: subscription.cancelAtPeriodEnd
|
|
1478
1451
|
}
|
|
1479
1452
|
) }),
|
|
1480
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1481
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1482
|
-
/* @__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: [
|
|
1483
1456
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "line-through text-muted-foreground me-2", children: amount }),
|
|
1484
|
-
/* @__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) })
|
|
1485
1458
|
] }) : amount }),
|
|
1486
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1487
|
-
|
|
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,
|
|
1488
1461
|
{
|
|
1489
1462
|
size: "sm",
|
|
1490
1463
|
variant: "outline",
|
|
@@ -1542,7 +1515,7 @@ function SubscriptionsContainer({
|
|
|
1542
1515
|
}
|
|
1543
1516
|
setLoading(true);
|
|
1544
1517
|
try {
|
|
1545
|
-
const fetchedSubscriptions = await
|
|
1518
|
+
const fetchedSubscriptions = await _chunkT3YQ47EFjs.StripeSubscriptionService.listSubscriptions();
|
|
1546
1519
|
setSubscriptions(fetchedSubscriptions);
|
|
1547
1520
|
} catch (error) {
|
|
1548
1521
|
console.error("[SubscriptionsContainer] Failed to load subscriptions:", error);
|
|
@@ -1565,7 +1538,7 @@ function SubscriptionsContainer({
|
|
|
1565
1538
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8" }),
|
|
1566
1539
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: t("billing.ui.subscriptions.title") })
|
|
1567
1540
|
] }),
|
|
1568
|
-
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") })
|
|
1569
1542
|
] }),
|
|
1570
1543
|
criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BillingAlertBanner, { subscription }, subscription.id)),
|
|
1571
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: [
|
|
@@ -1573,7 +1546,7 @@ function SubscriptionsContainer({
|
|
|
1573
1546
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
1574
1547
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium mb-2", children: t("billing.ui.subscriptions.empty_title") }),
|
|
1575
1548
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground mb-6", children: t("billing.ui.subscriptions.empty_description") }),
|
|
1576
|
-
/* @__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") })
|
|
1577
1550
|
] })
|
|
1578
1551
|
] }),
|
|
1579
1552
|
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -1596,9 +1569,9 @@ function IntervalToggle({ value, onChange, hasMonthly, hasYearly }) {
|
|
|
1596
1569
|
if (!hasMonthly || !hasYearly) {
|
|
1597
1570
|
return null;
|
|
1598
1571
|
}
|
|
1599
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1600
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1601
|
-
/* @__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") })
|
|
1602
1575
|
] }) });
|
|
1603
1576
|
}
|
|
1604
1577
|
_chunk7QVYU63Ejs.__name.call(void 0, IntervalToggle, "IntervalToggle");
|
|
@@ -1616,11 +1589,11 @@ function PricingCard({
|
|
|
1616
1589
|
onSelect
|
|
1617
1590
|
}) {
|
|
1618
1591
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1619
|
-
const fmt =
|
|
1592
|
+
const fmt = _chunkIPYXT7MHjs.useBillingFormatOptions.call(void 0, );
|
|
1620
1593
|
const description = price.description || price.nickname || t("billing.ui.pricing.standard");
|
|
1621
1594
|
const features = price.features || [];
|
|
1622
|
-
const formattedPrice =
|
|
1623
|
-
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);
|
|
1624
1597
|
const handleKeyDown = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (e) => {
|
|
1625
1598
|
if ((e.key === "Enter" || e.key === " ") && !isDisabled && !isCurrentPlan) {
|
|
1626
1599
|
e.preventDefault();
|
|
@@ -1633,7 +1606,7 @@ function PricingCard({
|
|
|
1633
1606
|
}
|
|
1634
1607
|
}, "handleClick");
|
|
1635
1608
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1636
|
-
|
|
1609
|
+
_chunkIPYXT7MHjs.Card,
|
|
1637
1610
|
{
|
|
1638
1611
|
role: "radio",
|
|
1639
1612
|
"aria-checked": isSelected,
|
|
@@ -1641,7 +1614,7 @@ function PricingCard({
|
|
|
1641
1614
|
tabIndex: isDisabled ? -1 : 0,
|
|
1642
1615
|
onKeyDown: handleKeyDown,
|
|
1643
1616
|
onClick: handleClick,
|
|
1644
|
-
className:
|
|
1617
|
+
className: _chunkT3YQ47EFjs.cn.call(void 0,
|
|
1645
1618
|
"relative cursor-pointer transition-all duration-200 flex flex-col h-full",
|
|
1646
1619
|
"focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
1647
1620
|
isCurrentPlan && "bg-muted/30",
|
|
@@ -1651,9 +1624,9 @@ function PricingCard({
|
|
|
1651
1624
|
isLoading && "pointer-events-none"
|
|
1652
1625
|
),
|
|
1653
1626
|
children: [
|
|
1654
|
-
isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1655
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1656
|
-
/* @__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: [
|
|
1657
1630
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mb-4", children: [
|
|
1658
1631
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-3xl font-bold", children: formattedPrice }),
|
|
1659
1632
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground ms-1", children: interval })
|
|
@@ -1663,8 +1636,8 @@ function PricingCard({
|
|
|
1663
1636
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-muted-foreground", children: feature })
|
|
1664
1637
|
] }, index)) })
|
|
1665
1638
|
] }),
|
|
1666
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1667
|
-
|
|
1639
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.CardFooter, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1640
|
+
_chunkIPYXT7MHjs.Button,
|
|
1668
1641
|
{
|
|
1669
1642
|
variant: isCurrentPlan ? "secondary" : isSelected ? "default" : "outline",
|
|
1670
1643
|
className: "w-full",
|
|
@@ -1697,7 +1670,7 @@ function ProductPricingRow({
|
|
|
1697
1670
|
return null;
|
|
1698
1671
|
}
|
|
1699
1672
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-3", children: [
|
|
1700
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1673
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.SectionHeader, { children: product.name }),
|
|
1701
1674
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1702
1675
|
"div",
|
|
1703
1676
|
{
|
|
@@ -1798,15 +1771,15 @@ function ProductPricingList({
|
|
|
1798
1771
|
_chunk7QVYU63Ejs.__name.call(void 0, ProductPricingList, "ProductPricingList");
|
|
1799
1772
|
function ProductPricingListSkeleton() {
|
|
1800
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: [
|
|
1801
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1774
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.Skeleton, { className: "h-6 w-32" }),
|
|
1802
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: [
|
|
1803
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1804
|
-
/* @__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" }),
|
|
1805
1778
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
1806
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1807
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
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" })
|
|
1808
1781
|
] }),
|
|
1809
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1782
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.Skeleton, { className: "h-10 w-full" })
|
|
1810
1783
|
] }, cardIndex)) })
|
|
1811
1784
|
] }, rowIndex)) });
|
|
1812
1785
|
}
|
|
@@ -1817,21 +1790,21 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductPricingListSkeleton, "ProductPricing
|
|
|
1817
1790
|
|
|
1818
1791
|
function ProrationPreview({ preview }) {
|
|
1819
1792
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1820
|
-
const fmt =
|
|
1793
|
+
const fmt = _chunkIPYXT7MHjs.useBillingFormatOptions.call(void 0, );
|
|
1821
1794
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-primary/10 border-primary/30 rounded-lg border p-4", children: [
|
|
1822
1795
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "text-primary mb-3 font-semibold", children: t("billing.ui.proration.title") }),
|
|
1823
1796
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
1824
1797
|
preview.lineItems.map((item, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between text-sm", children: [
|
|
1825
1798
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground", children: item.description }),
|
|
1826
|
-
/* @__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) })
|
|
1827
1800
|
] }, index)),
|
|
1828
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: [
|
|
1829
1802
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-foreground", children: t("billing.ui.proration.net_due_today") }),
|
|
1830
|
-
/* @__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) })
|
|
1831
1804
|
] }) }),
|
|
1832
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", {
|
|
1833
|
-
date:
|
|
1834
|
-
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)
|
|
1835
1808
|
}) })
|
|
1836
1809
|
] })
|
|
1837
1810
|
] });
|
|
@@ -1844,7 +1817,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProrationPreview, "ProrationPreview");
|
|
|
1844
1817
|
|
|
1845
1818
|
function SubscriptionConfirmation({ price, isLoading, onConfirm, onCancel }) {
|
|
1846
1819
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1847
|
-
const fmt =
|
|
1820
|
+
const fmt = _chunkIPYXT7MHjs.useBillingFormatOptions.call(void 0, );
|
|
1848
1821
|
const productName = _optionalChain([price, 'access', _51 => _51.product, 'optionalAccess', _52 => _52.name]) || price.nickname || t("billing.ui.wizard.review.selected_plan");
|
|
1849
1822
|
const productDescription = _optionalChain([price, 'access', _53 => _53.product, 'optionalAccess', _54 => _54.description]) || price.description;
|
|
1850
1823
|
const features = price.features || [];
|
|
@@ -1856,16 +1829,16 @@ function SubscriptionConfirmation({ price, isLoading, onConfirm, onCancel }) {
|
|
|
1856
1829
|
productDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-sm text-muted-foreground", children: productDescription })
|
|
1857
1830
|
] }),
|
|
1858
1831
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-lg font-semibold", children: [
|
|
1859
|
-
|
|
1860
|
-
/* @__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) })
|
|
1861
1834
|
] }),
|
|
1862
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: [
|
|
1863
1836
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Check, { className: "h-4 w-4 text-primary" }),
|
|
1864
1837
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: feature })
|
|
1865
1838
|
] }, index)) }),
|
|
1866
1839
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-3 pt-2 border-t border-accent/30", children: [
|
|
1867
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1868
|
-
/* @__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: [
|
|
1869
1842
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "h-4 w-4 animate-spin me-2" }),
|
|
1870
1843
|
t("billing.ui.wizard.review.processing")
|
|
1871
1844
|
] }) : t("billing.ui.confirmation.subscribe") })
|
|
@@ -2044,7 +2017,7 @@ function wizardReducer(state, action) {
|
|
|
2044
2017
|
_chunk7QVYU63Ejs.__name.call(void 0, wizardReducer, "wizardReducer");
|
|
2045
2018
|
function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
2046
2019
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2047
|
-
const locale =
|
|
2020
|
+
const locale = _chunkT3YQ47EFjs.useI18nLocale.call(void 0, );
|
|
2048
2021
|
const { confirmPayment } = useConfirmSubscriptionPayment();
|
|
2049
2022
|
const [state, dispatch] = _react.useReducer.call(void 0, wizardReducer, {
|
|
2050
2023
|
...initialState,
|
|
@@ -2056,7 +2029,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2056
2029
|
onCloseRef.current = onClose;
|
|
2057
2030
|
const checkPaymentMethod = _react.useCallback.call(void 0, async () => {
|
|
2058
2031
|
try {
|
|
2059
|
-
const methods = await
|
|
2032
|
+
const methods = await _chunkT3YQ47EFjs.StripeCustomerService.listPaymentMethods();
|
|
2060
2033
|
dispatch({ type: "SET_HAS_PAYMENT_METHOD", hasMethod: methods.length > 0 });
|
|
2061
2034
|
} catch (error) {
|
|
2062
2035
|
console.error("[useSubscriptionWizard] Failed to check payment methods:", error);
|
|
@@ -2074,10 +2047,10 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2074
2047
|
}, []);
|
|
2075
2048
|
const lookUpAutomaticCode = _react.useCallback.call(void 0, async (priceId) => {
|
|
2076
2049
|
try {
|
|
2077
|
-
const automaticCode = await
|
|
2050
|
+
const automaticCode = await _chunkT3YQ47EFjs.StripeCouponCodeService.findAutomatic({ priceId });
|
|
2078
2051
|
dispatch({
|
|
2079
2052
|
type: "SET_PROMOTION_CODE",
|
|
2080
|
-
code: automaticCode ?
|
|
2053
|
+
code: automaticCode ? _chunkT3YQ47EFjs.toPromotionCodeResult.call(void 0, automaticCode) : null
|
|
2081
2054
|
});
|
|
2082
2055
|
return true;
|
|
2083
2056
|
} catch (error) {
|
|
@@ -2104,7 +2077,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2104
2077
|
const isTrialUpgrade = _optionalChain([subscription, 'optionalAccess', _61 => _61.status]) === "trialing" /* TRIALING */;
|
|
2105
2078
|
dispatch({ type: "SET_IS_TRIAL_SUBSCRIPTION", isTrial: isTrialUpgrade });
|
|
2106
2079
|
if (isTrialUpgrade && !state.hasPaymentMethod) {
|
|
2107
|
-
const methods = await
|
|
2080
|
+
const methods = await _chunkT3YQ47EFjs.StripeCustomerService.listPaymentMethods();
|
|
2108
2081
|
if (methods.length === 0) {
|
|
2109
2082
|
dispatch({ type: "SET_STEP", step: "payment-method" });
|
|
2110
2083
|
dispatch({
|
|
@@ -2122,7 +2095,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2122
2095
|
}
|
|
2123
2096
|
}
|
|
2124
2097
|
if (subscription && state.selectedPrice.id !== _optionalChain([subscription, 'access', _62 => _62.price, 'optionalAccess', _63 => _63.id])) {
|
|
2125
|
-
const preview = await
|
|
2098
|
+
const preview = await _chunkT3YQ47EFjs.StripeSubscriptionService.getProrationPreview({
|
|
2126
2099
|
subscriptionId: subscription.id,
|
|
2127
2100
|
newPriceId: state.selectedPrice.id
|
|
2128
2101
|
});
|
|
@@ -2156,14 +2129,14 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2156
2129
|
newPriceId: state.selectedPrice.id,
|
|
2157
2130
|
promotionCode: promotionCodeToSend(state.promotionCode)
|
|
2158
2131
|
};
|
|
2159
|
-
result = await
|
|
2132
|
+
result = await _chunkT3YQ47EFjs.StripeSubscriptionService.changePlanWithMeta(changePlanParams);
|
|
2160
2133
|
} else {
|
|
2161
2134
|
const createParams = {
|
|
2162
2135
|
id: _uuid.v4.call(void 0, ),
|
|
2163
2136
|
priceId: state.selectedPrice.id,
|
|
2164
2137
|
promotionCode: promotionCodeToSend(state.promotionCode)
|
|
2165
2138
|
};
|
|
2166
|
-
result = await
|
|
2139
|
+
result = await _chunkT3YQ47EFjs.StripeSubscriptionService.createSubscription(createParams);
|
|
2167
2140
|
}
|
|
2168
2141
|
const clientSecret = clientSecretToConfirm(result.meta);
|
|
2169
2142
|
if (clientSecret) {
|
|
@@ -2179,7 +2152,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2179
2152
|
const subscriptionId = subscriptionIdToSync(result.subscription, subscription);
|
|
2180
2153
|
if (subscriptionId) {
|
|
2181
2154
|
try {
|
|
2182
|
-
await
|
|
2155
|
+
await _chunkT3YQ47EFjs.StripeSubscriptionService.syncSubscription({ subscriptionId });
|
|
2183
2156
|
} catch (syncError) {
|
|
2184
2157
|
console.error("[useSubscriptionWizard] Subscription sync after payment failed:", syncError);
|
|
2185
2158
|
}
|
|
@@ -2227,7 +2200,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2227
2200
|
dispatch({ type: "SET_VALIDATING_PROMO_CODE", isValidating: true });
|
|
2228
2201
|
dispatch({ type: "SET_PROMO_CODE_ERROR", error: null });
|
|
2229
2202
|
try {
|
|
2230
|
-
const result = await
|
|
2203
|
+
const result = await _chunkT3YQ47EFjs.StripePromotionCodeService.validatePromotionCode({
|
|
2231
2204
|
code,
|
|
2232
2205
|
stripePriceId: _optionalChain([state, 'access', _72 => _72.selectedPrice, 'optionalAccess', _73 => _73.id]),
|
|
2233
2206
|
language: locale
|
|
@@ -2352,7 +2325,7 @@ function WizardStepPlanSelection({
|
|
|
2352
2325
|
_react.useEffect.call(void 0, () => {
|
|
2353
2326
|
const loadProducts = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2354
2327
|
try {
|
|
2355
|
-
const fetchedProducts = await
|
|
2328
|
+
const fetchedProducts = await _chunkT3YQ47EFjs.StripeProductService.listProducts({ active: true });
|
|
2356
2329
|
setProducts(fetchedProducts);
|
|
2357
2330
|
} catch (error) {
|
|
2358
2331
|
console.error("[WizardStepPlanSelection] Failed to load products:", error);
|
|
@@ -2403,7 +2376,7 @@ function WizardStepPlanSelection({
|
|
|
2403
2376
|
onSelectPrice: handleSelectPrice
|
|
2404
2377
|
}
|
|
2405
2378
|
),
|
|
2406
|
-
/* @__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") }) })
|
|
2407
2380
|
] });
|
|
2408
2381
|
}
|
|
2409
2382
|
_chunk7QVYU63Ejs.__name.call(void 0, WizardStepPlanSelection, "WizardStepPlanSelection");
|
|
@@ -2427,7 +2400,7 @@ function PromoCodeInput({
|
|
|
2427
2400
|
disabled = false
|
|
2428
2401
|
}) {
|
|
2429
2402
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2430
|
-
const locale =
|
|
2403
|
+
const locale = _chunkT3YQ47EFjs.useI18nLocale.call(void 0, );
|
|
2431
2404
|
const [code, setCode] = _react.useState.call(void 0, "");
|
|
2432
2405
|
const appliedKey = _optionalChain([appliedCode, 'optionalAccess', _82 => _82.valid]) ? `${appliedCode.automatic ? "auto" : "typed"}:${_nullishCoalesce(appliedCode.code, () => ( ""))}` : null;
|
|
2433
2406
|
const [previousAppliedKey, setPreviousAppliedKey] = _react.useState.call(void 0, appliedKey);
|
|
@@ -2456,7 +2429,7 @@ function PromoCodeInput({
|
|
|
2456
2429
|
}
|
|
2457
2430
|
const amount = (result.discountValue || 0) / 100;
|
|
2458
2431
|
const currency = _optionalChain([result, 'access', _83 => _83.currency, 'optionalAccess', _84 => _84.toUpperCase, 'call', _85 => _85()]) || "USD";
|
|
2459
|
-
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)}` });
|
|
2460
2433
|
}, "formatDiscount");
|
|
2461
2434
|
const formatDuration = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (result) => {
|
|
2462
2435
|
switch (result.duration) {
|
|
@@ -2473,7 +2446,7 @@ function PromoCodeInput({
|
|
|
2473
2446
|
const codeInput = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
2474
2447
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
|
|
2475
2448
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2476
|
-
|
|
2449
|
+
_chunkIPYXT7MHjs.Input,
|
|
2477
2450
|
{
|
|
2478
2451
|
placeholder: t("billing.ui.promo_code.placeholder"),
|
|
2479
2452
|
value: code,
|
|
@@ -2483,7 +2456,7 @@ function PromoCodeInput({
|
|
|
2483
2456
|
className: "flex-1"
|
|
2484
2457
|
}
|
|
2485
2458
|
),
|
|
2486
|
-
/* @__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") })
|
|
2487
2460
|
] }),
|
|
2488
2461
|
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error })
|
|
2489
2462
|
] });
|
|
@@ -2512,7 +2485,7 @@ function PromoCodeInput({
|
|
|
2512
2485
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success text-sm", children: formatDiscount(appliedCode) })
|
|
2513
2486
|
] }),
|
|
2514
2487
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2515
|
-
|
|
2488
|
+
_chunkIPYXT7MHjs.Button,
|
|
2516
2489
|
{
|
|
2517
2490
|
variant: "ghost",
|
|
2518
2491
|
size: "sm",
|
|
@@ -2560,7 +2533,7 @@ function WizardStepReview({
|
|
|
2560
2533
|
isTrialUpgrade
|
|
2561
2534
|
}) {
|
|
2562
2535
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2563
|
-
const fmt =
|
|
2536
|
+
const fmt = _chunkIPYXT7MHjs.useBillingFormatOptions.call(void 0, );
|
|
2564
2537
|
const [card, setCard] = _react.useState.call(void 0, null);
|
|
2565
2538
|
_react.useEffect.call(void 0, () => {
|
|
2566
2539
|
if (!hasPaymentMethod) {
|
|
@@ -2568,7 +2541,7 @@ function WizardStepReview({
|
|
|
2568
2541
|
return;
|
|
2569
2542
|
}
|
|
2570
2543
|
let cancelled = false;
|
|
2571
|
-
Promise.all([
|
|
2544
|
+
Promise.all([_chunkT3YQ47EFjs.StripeCustomerService.listPaymentMethods(), _chunkT3YQ47EFjs.StripeCustomerService.getCustomer()]).then(([methods, customer]) => {
|
|
2572
2545
|
if (!cancelled) setCard(reviewCard(methods, _optionalChain([customer, 'optionalAccess', _90 => _90.defaultPaymentMethodId])));
|
|
2573
2546
|
}).catch((err) => {
|
|
2574
2547
|
console.error("[WizardStepReview] Failed to load the card on file:", err);
|
|
@@ -2587,24 +2560,24 @@ function WizardStepReview({
|
|
|
2587
2560
|
const interval = _optionalChain([price, 'access', _93 => _93.recurring, 'optionalAccess', _94 => _94.interval]) || "month";
|
|
2588
2561
|
return interval === "year" ? t("billing.ui.wizard.review.interval_yearly") : t("billing.ui.wizard.review.interval_monthly");
|
|
2589
2562
|
}, "formatInterval");
|
|
2590
|
-
const codeDiscount =
|
|
2591
|
-
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;
|
|
2592
2565
|
const discount = _nullishCoalesce(codeDiscount, () => ( carriedDiscount));
|
|
2593
|
-
const discountedPrice =
|
|
2594
|
-
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);
|
|
2595
2568
|
const getDiscountDescription = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
2596
2569
|
if (!discount) return null;
|
|
2597
2570
|
if (discount.discountType === "percent_off") {
|
|
2598
2571
|
return t("billing.ui.wizard.review.percent_off", { value: discount.discountValue });
|
|
2599
2572
|
}
|
|
2600
2573
|
return t("billing.ui.wizard.review.amount_off", {
|
|
2601
|
-
amount:
|
|
2574
|
+
amount: _chunkT3YQ47EFjs.formatCurrency.call(void 0, discount.discountValue, discount.currency || selectedPrice.currency, fmt)
|
|
2602
2575
|
});
|
|
2603
2576
|
}, "getDiscountDescription");
|
|
2604
2577
|
const discountDescription = getDiscountDescription();
|
|
2605
2578
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
2606
2579
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-muted/50 rounded-lg p-4 space-y-3", children: [
|
|
2607
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2580
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.SectionHeader, { children: t("billing.ui.wizard.review.selected_plan") }),
|
|
2608
2581
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between items-center", children: [
|
|
2609
2582
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
2610
2583
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-medium", children: _optionalChain([selectedPrice, 'access', _96 => _96.product, 'optionalAccess', _97 => _97.name]) }),
|
|
@@ -2612,11 +2585,11 @@ function WizardStepReview({
|
|
|
2612
2585
|
] }),
|
|
2613
2586
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-end", children: [
|
|
2614
2587
|
discountedPrice !== null ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2615
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground line-through", children:
|
|
2616
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-success text-lg font-semibold", children:
|
|
2617
|
-
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 }),
|
|
2618
2591
|
carriedDiscount && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: t("billing.ui.wizard.review.discount_carries_over") })
|
|
2619
|
-
] }) : /* @__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) }),
|
|
2620
2593
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: formatInterval2(selectedPrice) })
|
|
2621
2594
|
] })
|
|
2622
2595
|
] })
|
|
@@ -2631,9 +2604,9 @@ function WizardStepReview({
|
|
|
2631
2604
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between text-sm", children: [
|
|
2632
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") }),
|
|
2633
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: [
|
|
2634
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "line-through text-muted-foreground me-2", children:
|
|
2635
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success", children:
|
|
2636
|
-
] }) :
|
|
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) })
|
|
2637
2610
|
] })
|
|
2638
2611
|
]
|
|
2639
2612
|
}
|
|
@@ -2657,15 +2630,15 @@ function WizardStepReview({
|
|
|
2657
2630
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "font-medium", children: t("billing.ui.payment_method.title") }),
|
|
2658
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") })
|
|
2659
2632
|
] }),
|
|
2660
|
-
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") })
|
|
2661
2634
|
] }) }),
|
|
2662
|
-
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2635
|
+
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.Alert, { variant: "destructive", children: [
|
|
2663
2636
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.AlertCircle, { className: "h-4 w-4" }),
|
|
2664
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2637
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.AlertDescription, { children: error })
|
|
2665
2638
|
] }),
|
|
2666
2639
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between pt-4 border-t", children: [
|
|
2667
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2668
|
-
/* @__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") })
|
|
2669
2642
|
] })
|
|
2670
2643
|
] });
|
|
2671
2644
|
}
|
|
@@ -2678,7 +2651,7 @@ function WizardStepPaymentMethod({ onBack, onSuccess, isProcessing }) {
|
|
|
2678
2651
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2679
2652
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
2680
2653
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
2681
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2654
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.SectionHeader, { children: t("billing.ui.payment_methods.add") }),
|
|
2682
2655
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: t("billing.ui.wizard.payment_description") })
|
|
2683
2656
|
] }),
|
|
2684
2657
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodForm, { onSuccess, onCancel: onBack, isLoading: isProcessing, alwaysSetDefault: true })
|
|
@@ -2721,10 +2694,10 @@ function SubscriptionWizard({
|
|
|
2721
2694
|
const isChangePlanMode = !!subscription;
|
|
2722
2695
|
const dialogTitle = subscription ? t("billing.ui.wizard.change_title") : isPurchasingAddons ? t("billing.ui.subscriptions.purchase_addons") : t("billing.ui.subscriptions.subscribe");
|
|
2723
2696
|
const dialogDescription = subscription ? t("billing.ui.wizard.change_description") : isPurchasingAddons ? t("billing.ui.wizard.addons_description") : t("billing.ui.wizard.subscribe_description");
|
|
2724
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2725
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2726
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2727
|
-
/* @__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 })
|
|
2728
2701
|
] }),
|
|
2729
2702
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, WizardProgressIndicator, { currentStep: state.step }),
|
|
2730
2703
|
state.step === "plan-selection" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -2792,7 +2765,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, getProgressColor, "getProgressColor");
|
|
|
2792
2765
|
function formatDate2(date, { locale, t }) {
|
|
2793
2766
|
if (!date) return t("billing.ui.not_available");
|
|
2794
2767
|
try {
|
|
2795
|
-
return new Intl.DateTimeFormat(
|
|
2768
|
+
return new Intl.DateTimeFormat(_chunkT3YQ47EFjs.dateFormatLocale.call(void 0, locale), {
|
|
2796
2769
|
month: "short",
|
|
2797
2770
|
day: "numeric"
|
|
2798
2771
|
}).format(new Date(date));
|
|
@@ -2803,7 +2776,7 @@ function formatDate2(date, { locale, t }) {
|
|
|
2803
2776
|
_chunk7QVYU63Ejs.__name.call(void 0, formatDate2, "formatDate");
|
|
2804
2777
|
function UsageSummaryCard({ meter, summary }) {
|
|
2805
2778
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2806
|
-
const fmt =
|
|
2779
|
+
const fmt = _chunkIPYXT7MHjs.useBillingFormatOptions.call(void 0, );
|
|
2807
2780
|
const currentUsage = _nullishCoalesce(_optionalChain([summary, 'optionalAccess', _100 => _100.aggregatedValue]), () => ( 0));
|
|
2808
2781
|
const limit = meter.limit;
|
|
2809
2782
|
const percentage = limit && limit > 0 ? currentUsage / limit * 100 : null;
|
|
@@ -2811,15 +2784,15 @@ function UsageSummaryCard({ meter, summary }) {
|
|
|
2811
2784
|
const progressWidth = percentage !== null ? Math.min(percentage, 100) : 0;
|
|
2812
2785
|
const displayName = meter.displayName || meter.eventName;
|
|
2813
2786
|
const hasLimit = limit !== null && limit !== void 0;
|
|
2814
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2815
|
-
/* @__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: [
|
|
2816
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" }) }),
|
|
2817
2790
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col", children: [
|
|
2818
2791
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium", children: displayName }),
|
|
2819
2792
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-xs", children: meter.id })
|
|
2820
2793
|
] })
|
|
2821
2794
|
] }),
|
|
2822
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2795
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.CardContent, { className: "flex flex-col gap-y-4", children: [
|
|
2823
2796
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
2824
2797
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-3xl font-bold", children: currentUsage.toLocaleString(fmt.locale) }),
|
|
2825
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) }) })
|
|
@@ -2827,7 +2800,7 @@ function UsageSummaryCard({ meter, summary }) {
|
|
|
2827
2800
|
hasLimit ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-2", children: [
|
|
2828
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}%` } }) }),
|
|
2829
2802
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-sm", children: t("billing.ui.usage.percent_used", {
|
|
2830
|
-
value: percentage !== null ?
|
|
2803
|
+
value: percentage !== null ? _chunkT3YQ47EFjs.formatFixed.call(void 0, percentage, fmt.locale, 1) : ""
|
|
2831
2804
|
}) })
|
|
2832
2805
|
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-sm", children: t("billing.ui.usage.no_limit") }),
|
|
2833
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", {
|
|
@@ -2860,14 +2833,14 @@ function UsageContainer() {
|
|
|
2860
2833
|
const loadUsageData = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2861
2834
|
setLoading(true);
|
|
2862
2835
|
try {
|
|
2863
|
-
const fetchedSubscriptions = await
|
|
2836
|
+
const fetchedSubscriptions = await _chunkT3YQ47EFjs.StripeSubscriptionService.listSubscriptions();
|
|
2864
2837
|
setSubscriptions(fetchedSubscriptions);
|
|
2865
2838
|
const hasMeteredSubscriptions2 = fetchedSubscriptions.some((sub) => _optionalChain([sub, 'access', _101 => _101.price, 'optionalAccess', _102 => _102.recurring, 'optionalAccess', _103 => _103.usageType]) === "metered");
|
|
2866
2839
|
if (!hasMeteredSubscriptions2) {
|
|
2867
2840
|
setLoading(false);
|
|
2868
2841
|
return;
|
|
2869
2842
|
}
|
|
2870
|
-
const fetchedMeters = await
|
|
2843
|
+
const fetchedMeters = await _chunkT3YQ47EFjs.StripeUsageService.listMeters();
|
|
2871
2844
|
setMeters(fetchedMeters);
|
|
2872
2845
|
const summariesMap = {};
|
|
2873
2846
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -2875,7 +2848,7 @@ function UsageContainer() {
|
|
|
2875
2848
|
const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
|
|
2876
2849
|
for (const meter of fetchedMeters) {
|
|
2877
2850
|
try {
|
|
2878
|
-
const meterSummaries = await
|
|
2851
|
+
const meterSummaries = await _chunkT3YQ47EFjs.StripeUsageService.getMeterSummaries({
|
|
2879
2852
|
meterId: meter.id,
|
|
2880
2853
|
startTime: startOfMonth,
|
|
2881
2854
|
endTime: endOfMonth
|
|
@@ -2924,7 +2897,7 @@ function formatDateTime(date, { locale, t }) {
|
|
|
2924
2897
|
if (!date) return t("billing.ui.not_available");
|
|
2925
2898
|
const dateObj = typeof date === "string" ? new Date(date) : date;
|
|
2926
2899
|
try {
|
|
2927
|
-
return new Intl.DateTimeFormat(
|
|
2900
|
+
return new Intl.DateTimeFormat(_chunkT3YQ47EFjs.dateFormatLocale.call(void 0, locale), {
|
|
2928
2901
|
month: "short",
|
|
2929
2902
|
day: "numeric",
|
|
2930
2903
|
year: "numeric",
|
|
@@ -2938,27 +2911,27 @@ function formatDateTime(date, { locale, t }) {
|
|
|
2938
2911
|
_chunk7QVYU63Ejs.__name.call(void 0, formatDateTime, "formatDateTime");
|
|
2939
2912
|
function UsageHistoryTable({ usageRecords }) {
|
|
2940
2913
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2941
|
-
const fmt =
|
|
2914
|
+
const fmt = _chunkIPYXT7MHjs.useBillingFormatOptions.call(void 0, );
|
|
2942
2915
|
if (usageRecords.length === 0) {
|
|
2943
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") }) });
|
|
2944
2917
|
}
|
|
2945
2918
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
2946
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2947
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-clip rounded-lg border", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2948
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2949
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2950
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2951
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2952
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
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") })
|
|
2953
2926
|
] }) }),
|
|
2954
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2927
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.TableBody, { children: usageRecords.map((record) => {
|
|
2955
2928
|
const dateTime = formatDateTime(record.timestamp, fmt);
|
|
2956
2929
|
const quantity = record.quantity.toLocaleString(fmt.locale);
|
|
2957
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2958
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2959
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2960
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2961
|
-
/* @__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 })
|
|
2962
2935
|
] }, record.id);
|
|
2963
2936
|
}) })
|
|
2964
2937
|
] }) })
|
|
@@ -2969,8 +2942,8 @@ _chunk7QVYU63Ejs.__name.call(void 0, UsageHistoryTable, "UsageHistoryTable");
|
|
|
2969
2942
|
// src/features/billing/components/modals/BillingDetailModal.tsx
|
|
2970
2943
|
|
|
2971
2944
|
function BillingDetailModal({ open, onOpenChange, title, children, className }) {
|
|
2972
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2973
|
-
/* @__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 }) }),
|
|
2974
2947
|
children
|
|
2975
2948
|
] }) });
|
|
2976
2949
|
}
|
|
@@ -2998,7 +2971,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
|
|
|
2998
2971
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-destructive text-sm font-medium", children: t("billing.ui.alert.payment_failed_title") }),
|
|
2999
2972
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive mt-1 text-sm", children: t("billing.ui.alert.payment_failed_description") })
|
|
3000
2973
|
] }),
|
|
3001
|
-
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") })
|
|
3002
2975
|
] });
|
|
3003
2976
|
}
|
|
3004
2977
|
if (subscription.status === "trialing" /* TRIALING */ && subscription.trialEnd) {
|
|
@@ -3012,7 +2985,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
|
|
|
3012
2985
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-warning text-sm font-medium", children: t("billing.ui.alert.trial_ending_title") }),
|
|
3013
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 }) })
|
|
3014
2987
|
] }),
|
|
3015
|
-
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") })
|
|
3016
2989
|
] });
|
|
3017
2990
|
}
|
|
3018
2991
|
}
|
|
@@ -3064,7 +3037,7 @@ function BillingDashboardContainer() {
|
|
|
3064
3037
|
setNoCustomerExists(false);
|
|
3065
3038
|
let customer = null;
|
|
3066
3039
|
try {
|
|
3067
|
-
customer = await
|
|
3040
|
+
customer = await _chunkT3YQ47EFjs.StripeCustomerService.getCustomer();
|
|
3068
3041
|
setData((prev) => ({ ...prev, customer }));
|
|
3069
3042
|
setErrors((prev) => ({ ...prev, customer: null }));
|
|
3070
3043
|
setNoCustomerExists(false);
|
|
@@ -3090,7 +3063,7 @@ function BillingDashboardContainer() {
|
|
|
3090
3063
|
}
|
|
3091
3064
|
const fetchSubscriptions = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3092
3065
|
try {
|
|
3093
|
-
const subscriptions2 = await
|
|
3066
|
+
const subscriptions2 = await _chunkT3YQ47EFjs.StripeSubscriptionService.listSubscriptions();
|
|
3094
3067
|
setData((prev) => ({ ...prev, subscriptions: subscriptions2 }));
|
|
3095
3068
|
setErrors((prev) => ({ ...prev, subscriptions: null }));
|
|
3096
3069
|
return subscriptions2;
|
|
@@ -3104,7 +3077,7 @@ function BillingDashboardContainer() {
|
|
|
3104
3077
|
}, "fetchSubscriptions");
|
|
3105
3078
|
const fetchPaymentMethods = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3106
3079
|
try {
|
|
3107
|
-
const paymentMethods = await
|
|
3080
|
+
const paymentMethods = await _chunkT3YQ47EFjs.StripeCustomerService.listPaymentMethods();
|
|
3108
3081
|
setData((prev) => ({ ...prev, paymentMethods }));
|
|
3109
3082
|
setErrors((prev) => ({ ...prev, paymentMethods: null }));
|
|
3110
3083
|
} catch (error) {
|
|
@@ -3116,7 +3089,7 @@ function BillingDashboardContainer() {
|
|
|
3116
3089
|
}, "fetchPaymentMethods");
|
|
3117
3090
|
const fetchInvoices = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3118
3091
|
try {
|
|
3119
|
-
const invoices = await
|
|
3092
|
+
const invoices = await _chunkT3YQ47EFjs.StripeInvoiceService.listInvoices();
|
|
3120
3093
|
setData((prev) => ({ ...prev, invoices }));
|
|
3121
3094
|
setErrors((prev) => ({ ...prev, invoices: null }));
|
|
3122
3095
|
} catch (error) {
|
|
@@ -3139,7 +3112,7 @@ function BillingDashboardContainer() {
|
|
|
3139
3112
|
const handleCreateCustomer = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3140
3113
|
setCreatingCustomer(true);
|
|
3141
3114
|
try {
|
|
3142
|
-
await
|
|
3115
|
+
await _chunkT3YQ47EFjs.StripeCustomerService.createCustomer();
|
|
3143
3116
|
setNoCustomerExists(false);
|
|
3144
3117
|
await fetchAllData();
|
|
3145
3118
|
} catch (error) {
|
|
@@ -3151,7 +3124,7 @@ function BillingDashboardContainer() {
|
|
|
3151
3124
|
}, "handleCreateCustomer");
|
|
3152
3125
|
const fetchUsageData = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3153
3126
|
try {
|
|
3154
|
-
const meters = await
|
|
3127
|
+
const meters = await _chunkT3YQ47EFjs.StripeUsageService.listMeters();
|
|
3155
3128
|
setData((prev) => ({ ...prev, meters }));
|
|
3156
3129
|
const summariesMap = {};
|
|
3157
3130
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -3159,7 +3132,7 @@ function BillingDashboardContainer() {
|
|
|
3159
3132
|
const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
|
|
3160
3133
|
for (const meter of meters) {
|
|
3161
3134
|
try {
|
|
3162
|
-
const meterSummaries = await
|
|
3135
|
+
const meterSummaries = await _chunkT3YQ47EFjs.StripeUsageService.getMeterSummaries({
|
|
3163
3136
|
meterId: meter.id,
|
|
3164
3137
|
startTime: startOfMonth,
|
|
3165
3138
|
endTime: endOfMonth
|
|
@@ -3246,18 +3219,18 @@ function BillingDashboardContainer() {
|
|
|
3246
3219
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-8 w-8" }),
|
|
3247
3220
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: t("billing.title") })
|
|
3248
3221
|
] }),
|
|
3249
|
-
isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3250
|
-
noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3251
|
-
/* @__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: [
|
|
3252
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" }) }),
|
|
3253
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3254
|
-
/* @__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") })
|
|
3255
3228
|
] }),
|
|
3256
|
-
/* @__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: [
|
|
3257
3230
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "me-2 h-4 w-4 animate-spin" }),
|
|
3258
3231
|
t("billing.ui.dashboard.setting_up")
|
|
3259
3232
|
] }) : t("billing.ui.dashboard.setup_button") }) }),
|
|
3260
|
-
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) }) })
|
|
3261
3234
|
] }),
|
|
3262
3235
|
!noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
3263
3236
|
criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -3401,7 +3374,7 @@ function getStripePromise(publishableKey) {
|
|
|
3401
3374
|
}
|
|
3402
3375
|
_chunk7QVYU63Ejs.__name.call(void 0, getStripePromise, "getStripePromise");
|
|
3403
3376
|
function StripeProvider({ children }) {
|
|
3404
|
-
const publishableKey =
|
|
3377
|
+
const publishableKey = _chunkF4JB7YAPjs.getStripePublishableKey.call(void 0, );
|
|
3405
3378
|
const stripePromise = _react.useMemo.call(void 0, () => getStripePromise(publishableKey), [publishableKey]);
|
|
3406
3379
|
const options = _react.useMemo.call(void 0, () => ({}), []);
|
|
3407
3380
|
if (!publishableKey) {
|
|
@@ -3411,7 +3384,7 @@ function StripeProvider({ children }) {
|
|
|
3411
3384
|
}
|
|
3412
3385
|
_chunk7QVYU63Ejs.__name.call(void 0, StripeProvider, "StripeProvider");
|
|
3413
3386
|
function isStripeConfigured() {
|
|
3414
|
-
return !!
|
|
3387
|
+
return !!_chunkF4JB7YAPjs.getStripePublishableKey.call(void 0, );
|
|
3415
3388
|
}
|
|
3416
3389
|
_chunk7QVYU63Ejs.__name.call(void 0, isStripeConfigured, "isStripeConfigured");
|
|
3417
3390
|
|
|
@@ -3426,18 +3399,18 @@ _chunk7QVYU63Ejs.__name.call(void 0, isStripeConfigured, "isStripeConfigured");
|
|
|
3426
3399
|
|
|
3427
3400
|
function PriceArchiver({ price }) {
|
|
3428
3401
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
3429
|
-
const fmt =
|
|
3402
|
+
const fmt = _chunkIPYXT7MHjs.useBillingFormatOptions.call(void 0, );
|
|
3430
3403
|
const { archivePrice, restorePrice } = usePriceContext();
|
|
3431
3404
|
const [open, setOpen] = _react.useState.call(void 0, false);
|
|
3432
3405
|
const isArchived = !price.active;
|
|
3433
3406
|
const scope = isArchived ? "restore" : "archive";
|
|
3434
3407
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
3435
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3408
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.Button, { variant: "outline", size: "sm", onClick: () => setOpen(true), children: [
|
|
3436
3409
|
isArchived ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RotateCcwIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ArchiveIcon, {}),
|
|
3437
3410
|
t(`billing.admin.prices.${scope}.confirm`)
|
|
3438
3411
|
] }),
|
|
3439
3412
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3440
|
-
|
|
3413
|
+
_chunkIPYXT7MHjs.ConfirmDialog,
|
|
3441
3414
|
{
|
|
3442
3415
|
open,
|
|
3443
3416
|
onOpenChange: setOpen,
|
|
@@ -3451,7 +3424,7 @@ function PriceArchiver({ price }) {
|
|
|
3451
3424
|
if (isArchived) await restorePrice(price.id);
|
|
3452
3425
|
else await archivePrice(price.id);
|
|
3453
3426
|
} catch (error) {
|
|
3454
|
-
|
|
3427
|
+
_chunkIPYXT7MHjs.errorToast.call(void 0, { title: t(`billing.admin.prices.${scope}.title`), error });
|
|
3455
3428
|
throw error;
|
|
3456
3429
|
}
|
|
3457
3430
|
}
|
|
@@ -3483,15 +3456,15 @@ function PriceEditorInternal({
|
|
|
3483
3456
|
onDialogOpenChange
|
|
3484
3457
|
}) {
|
|
3485
3458
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
3486
|
-
const fmt =
|
|
3487
|
-
const router =
|
|
3459
|
+
const fmt = _chunkIPYXT7MHjs.useBillingFormatOptions.call(void 0, );
|
|
3460
|
+
const router = _chunkT3YQ47EFjs.useI18nRouter.call(void 0, );
|
|
3488
3461
|
const { createPrice, updatePrice, productId: contextProductId } = usePriceContext();
|
|
3489
3462
|
const [allFeatures, setAllFeatures] = _react.useState.call(void 0, []);
|
|
3490
3463
|
const isEdit = !!price;
|
|
3491
3464
|
const targetProductId = _nullishCoalesce(_nullishCoalesce(productId, () => ( _optionalChain([price, 'optionalAccess', _119 => _119.product, 'optionalAccess', _120 => _120.id]))), () => ( contextProductId));
|
|
3492
3465
|
_react.useEffect.call(void 0, () => {
|
|
3493
3466
|
const fetchFeatures = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3494
|
-
setAllFeatures(await
|
|
3467
|
+
setAllFeatures(await _chunkT3YQ47EFjs.FeatureService.findMany({}));
|
|
3495
3468
|
}, "fetchFeatures");
|
|
3496
3469
|
void fetchFeatures();
|
|
3497
3470
|
}, []);
|
|
@@ -3604,7 +3577,7 @@ function PriceEditorInternal({
|
|
|
3604
3577
|
warnedUnknownFor.current = fingerprint;
|
|
3605
3578
|
const { unknown } = resolvePlatformFeatures(seed.platformFeatures);
|
|
3606
3579
|
if (unknown.length > 0)
|
|
3607
|
-
|
|
3580
|
+
_chunkT3YQ47EFjs.showToast.call(void 0, t("billing.admin.prices.import.warnings.unknownFeatures", { features: unknown.join(", ") }));
|
|
3608
3581
|
}, [seed, isEdit, allFeatures, resolvePlatformFeatures, t]);
|
|
3609
3582
|
const watchInterval = form.watch("interval");
|
|
3610
3583
|
const isRecurring = watchInterval !== "one_time";
|
|
@@ -3625,13 +3598,13 @@ function PriceEditorInternal({
|
|
|
3625
3598
|
{ id: "metered", text: t("billing.admin.prices.usage.metered") }
|
|
3626
3599
|
];
|
|
3627
3600
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3628
|
-
|
|
3601
|
+
_chunkIPYXT7MHjs.EditorSheet,
|
|
3629
3602
|
{
|
|
3630
3603
|
form,
|
|
3631
3604
|
entityType: t("billing.admin.prices.entity"),
|
|
3632
3605
|
entityName: price ? priceLabel(price, fmt) : void 0,
|
|
3633
3606
|
isEdit,
|
|
3634
|
-
module:
|
|
3607
|
+
module: _chunkT3YQ47EFjs.Modules.StripePrice,
|
|
3635
3608
|
size: "lg",
|
|
3636
3609
|
propagateChanges,
|
|
3637
3610
|
onSuccess,
|
|
@@ -3680,13 +3653,13 @@ function PriceEditorInternal({
|
|
|
3680
3653
|
dialogOpen,
|
|
3681
3654
|
onDialogOpenChange,
|
|
3682
3655
|
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
3683
|
-
isEdit && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3684
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3685
|
-
/* @__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") })
|
|
3686
3659
|
] }),
|
|
3687
3660
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
|
|
3688
3661
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3689
|
-
|
|
3662
|
+
_chunkIPYXT7MHjs.FormInput,
|
|
3690
3663
|
{
|
|
3691
3664
|
form,
|
|
3692
3665
|
id: "unitAmount",
|
|
@@ -3698,7 +3671,7 @@ function PriceEditorInternal({
|
|
|
3698
3671
|
}
|
|
3699
3672
|
),
|
|
3700
3673
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3701
|
-
|
|
3674
|
+
_chunkIPYXT7MHjs.FormSelect,
|
|
3702
3675
|
{
|
|
3703
3676
|
form,
|
|
3704
3677
|
id: "currency",
|
|
@@ -3709,7 +3682,7 @@ function PriceEditorInternal({
|
|
|
3709
3682
|
)
|
|
3710
3683
|
] }),
|
|
3711
3684
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3712
|
-
|
|
3685
|
+
_chunkIPYXT7MHjs.FormSelect,
|
|
3713
3686
|
{
|
|
3714
3687
|
form,
|
|
3715
3688
|
id: "interval",
|
|
@@ -3720,7 +3693,7 @@ function PriceEditorInternal({
|
|
|
3720
3693
|
),
|
|
3721
3694
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
|
|
3722
3695
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3723
|
-
|
|
3696
|
+
_chunkIPYXT7MHjs.FormInput,
|
|
3724
3697
|
{
|
|
3725
3698
|
form,
|
|
3726
3699
|
id: "intervalCount",
|
|
@@ -3731,7 +3704,7 @@ function PriceEditorInternal({
|
|
|
3731
3704
|
}
|
|
3732
3705
|
),
|
|
3733
3706
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3734
|
-
|
|
3707
|
+
_chunkIPYXT7MHjs.FormSelect,
|
|
3735
3708
|
{
|
|
3736
3709
|
form,
|
|
3737
3710
|
id: "usageType",
|
|
@@ -3742,7 +3715,7 @@ function PriceEditorInternal({
|
|
|
3742
3715
|
)
|
|
3743
3716
|
] }),
|
|
3744
3717
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3745
|
-
|
|
3718
|
+
_chunkIPYXT7MHjs.FormInput,
|
|
3746
3719
|
{
|
|
3747
3720
|
form,
|
|
3748
3721
|
id: "nickname",
|
|
@@ -3751,7 +3724,7 @@ function PriceEditorInternal({
|
|
|
3751
3724
|
}
|
|
3752
3725
|
),
|
|
3753
3726
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3754
|
-
|
|
3727
|
+
_chunkIPYXT7MHjs.FormTextarea,
|
|
3755
3728
|
{
|
|
3756
3729
|
form,
|
|
3757
3730
|
id: "description",
|
|
@@ -3761,7 +3734,7 @@ function PriceEditorInternal({
|
|
|
3761
3734
|
}
|
|
3762
3735
|
),
|
|
3763
3736
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3764
|
-
|
|
3737
|
+
_chunkIPYXT7MHjs.FormInput,
|
|
3765
3738
|
{
|
|
3766
3739
|
form,
|
|
3767
3740
|
id: "token",
|
|
@@ -3771,10 +3744,10 @@ function PriceEditorInternal({
|
|
|
3771
3744
|
}
|
|
3772
3745
|
),
|
|
3773
3746
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-2", children: [
|
|
3774
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3747
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.FieldLabel, { children: t("billing.admin.prices.fields.features") }),
|
|
3775
3748
|
form.watch("features").map((_, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
|
|
3776
3749
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3777
|
-
|
|
3750
|
+
_chunkIPYXT7MHjs.Input,
|
|
3778
3751
|
{
|
|
3779
3752
|
...form.register(`features.${index}`),
|
|
3780
3753
|
placeholder: t("billing.admin.prices.placeholders.feature", { index: index + 1 }),
|
|
@@ -3782,7 +3755,7 @@ function PriceEditorInternal({
|
|
|
3782
3755
|
}
|
|
3783
3756
|
),
|
|
3784
3757
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3785
|
-
|
|
3758
|
+
_chunkIPYXT7MHjs.Button,
|
|
3786
3759
|
{
|
|
3787
3760
|
type: "button",
|
|
3788
3761
|
variant: "outline",
|
|
@@ -3797,7 +3770,7 @@ function PriceEditorInternal({
|
|
|
3797
3770
|
)
|
|
3798
3771
|
] }, index)),
|
|
3799
3772
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3800
|
-
|
|
3773
|
+
_chunkIPYXT7MHjs.Button,
|
|
3801
3774
|
{
|
|
3802
3775
|
type: "button",
|
|
3803
3776
|
variant: "outline",
|
|
@@ -3812,12 +3785,12 @@ function PriceEditorInternal({
|
|
|
3812
3785
|
)
|
|
3813
3786
|
] }),
|
|
3814
3787
|
isRecurring && allFeatures.length > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-2", children: [
|
|
3815
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3788
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.FieldLabel, { children: t("billing.admin.prices.fields.platformFeatures") }),
|
|
3816
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) => {
|
|
3817
3790
|
const isChecked = form.watch("featureIds").includes(feature.id);
|
|
3818
3791
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
3819
3792
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3820
|
-
|
|
3793
|
+
_chunkIPYXT7MHjs.Checkbox,
|
|
3821
3794
|
{
|
|
3822
3795
|
id: `feature-${feature.id}`,
|
|
3823
3796
|
checked: isChecked,
|
|
@@ -3833,13 +3806,13 @@ function PriceEditorInternal({
|
|
|
3833
3806
|
}
|
|
3834
3807
|
}
|
|
3835
3808
|
),
|
|
3836
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3809
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.FieldLabel, { htmlFor: `feature-${feature.id}`, children: feature.name }),
|
|
3837
3810
|
feature.isCore && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.admin.prices.help.core") })
|
|
3838
3811
|
] }, feature.id);
|
|
3839
3812
|
}) })
|
|
3840
3813
|
] }),
|
|
3841
3814
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3842
|
-
|
|
3815
|
+
_chunkIPYXT7MHjs.FormCheckbox,
|
|
3843
3816
|
{
|
|
3844
3817
|
form,
|
|
3845
3818
|
id: "isTrial",
|
|
@@ -3882,7 +3855,7 @@ var defaultContextValue = {
|
|
|
3882
3855
|
productId: void 0
|
|
3883
3856
|
};
|
|
3884
3857
|
function priceLabel(price, fmt = {}) {
|
|
3885
|
-
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()));
|
|
3886
3859
|
}
|
|
3887
3860
|
_chunk7QVYU63Ejs.__name.call(void 0, priceLabel, "priceLabel");
|
|
3888
3861
|
var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
@@ -3892,22 +3865,22 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3892
3865
|
productId: productIdProp
|
|
3893
3866
|
}) => {
|
|
3894
3867
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
3895
|
-
const fmt =
|
|
3896
|
-
const generateUrl =
|
|
3897
|
-
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, );
|
|
3898
3871
|
const [price, setPrice] = _react.useState.call(void 0,
|
|
3899
|
-
dehydratedPrice ?
|
|
3872
|
+
dehydratedPrice ? _chunkT3YQ47EFjs.rehydrate.call(void 0, _chunkT3YQ47EFjs.Modules.StripePrice, dehydratedPrice) : void 0
|
|
3900
3873
|
);
|
|
3901
3874
|
const [priceVersion, setPriceVersion] = _react.useState.call(void 0, 0);
|
|
3902
3875
|
const refreshPrices = _react.useCallback.call(void 0, () => setPriceVersion((value2) => value2 + 1), []);
|
|
3903
3876
|
const productId = _nullishCoalesce(productIdProp, () => ( _optionalChain([price, 'optionalAccess', _143 => _143.product, 'optionalAccess', _144 => _144.id])));
|
|
3904
3877
|
const reloadPrice = _react.useCallback.call(void 0, async () => {
|
|
3905
3878
|
if (!_optionalChain([price, 'optionalAccess', _145 => _145.id])) return;
|
|
3906
|
-
setPrice(await
|
|
3879
|
+
setPrice(await _chunkT3YQ47EFjs.StripePriceService.getPrice({ id: price.id }));
|
|
3907
3880
|
}, [_optionalChain([price, 'optionalAccess', _146 => _146.id])]);
|
|
3908
3881
|
const createPrice = _react.useCallback.call(void 0,
|
|
3909
3882
|
async (input) => {
|
|
3910
|
-
const saved = await
|
|
3883
|
+
const saved = await _chunkT3YQ47EFjs.StripePriceService.createPrice(input);
|
|
3911
3884
|
refreshPrices();
|
|
3912
3885
|
return saved;
|
|
3913
3886
|
},
|
|
@@ -3915,7 +3888,7 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3915
3888
|
);
|
|
3916
3889
|
const updatePrice = _react.useCallback.call(void 0,
|
|
3917
3890
|
async (input) => {
|
|
3918
|
-
const saved = await
|
|
3891
|
+
const saved = await _chunkT3YQ47EFjs.StripePriceService.updatePrice(input);
|
|
3919
3892
|
setPrice(saved);
|
|
3920
3893
|
refreshPrices();
|
|
3921
3894
|
return saved;
|
|
@@ -3926,7 +3899,7 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3926
3899
|
async (id) => {
|
|
3927
3900
|
const target = _nullishCoalesce(id, () => ( _optionalChain([price, 'optionalAccess', _147 => _147.id])));
|
|
3928
3901
|
if (!target) return;
|
|
3929
|
-
await
|
|
3902
|
+
await _chunkT3YQ47EFjs.StripePriceService.archivePrice({ id: target });
|
|
3930
3903
|
await reloadPrice();
|
|
3931
3904
|
refreshPrices();
|
|
3932
3905
|
},
|
|
@@ -3936,7 +3909,7 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3936
3909
|
async (id) => {
|
|
3937
3910
|
const target = _nullishCoalesce(id, () => ( _optionalChain([price, 'optionalAccess', _149 => _149.id])));
|
|
3938
3911
|
if (!target) return;
|
|
3939
|
-
await
|
|
3912
|
+
await _chunkT3YQ47EFjs.StripePriceService.reactivatePrice({ id: target });
|
|
3940
3913
|
await reloadPrice();
|
|
3941
3914
|
refreshPrices();
|
|
3942
3915
|
},
|
|
@@ -3960,12 +3933,12 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3960
3933
|
if (!publishChrome) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceContext.Provider, { value, children });
|
|
3961
3934
|
const breadcrumb = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
3962
3935
|
const items = [
|
|
3963
|
-
{ name: t("billing.admin.products.title"), href: generateUrl({ page:
|
|
3936
|
+
{ name: t("billing.admin.products.title"), href: generateUrl({ page: _chunkT3YQ47EFjs.Modules.StripeProduct }) }
|
|
3964
3937
|
];
|
|
3965
3938
|
if (_optionalChain([price, 'optionalAccess', _151 => _151.product]))
|
|
3966
3939
|
items.push({
|
|
3967
3940
|
name: price.product.name,
|
|
3968
|
-
href: generateUrl({ page:
|
|
3941
|
+
href: generateUrl({ page: _chunkT3YQ47EFjs.Modules.StripeProduct, id: price.product.id })
|
|
3969
3942
|
});
|
|
3970
3943
|
if (price) items.push({ name: priceLabel(price, fmt) });
|
|
3971
3944
|
return items;
|
|
@@ -3982,7 +3955,7 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3982
3955
|
}
|
|
3983
3956
|
return response;
|
|
3984
3957
|
}, "title");
|
|
3985
|
-
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 }) });
|
|
3986
3959
|
}, "PriceProvider");
|
|
3987
3960
|
var usePriceContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => _nullishCoalesce(_react.useContext.call(void 0, PriceContext), () => ( defaultContextValue)), "usePriceContext");
|
|
3988
3961
|
|
|
@@ -4002,12 +3975,12 @@ function ProductArchiver({ product }) {
|
|
|
4002
3975
|
const isArchived = !product.active;
|
|
4003
3976
|
const scope = isArchived ? "restore" : "archive";
|
|
4004
3977
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
4005
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3978
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkIPYXT7MHjs.Button, { variant: "outline", size: "sm", onClick: () => setOpen(true), children: [
|
|
4006
3979
|
isArchived ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RotateCcwIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ArchiveIcon, {}),
|
|
4007
3980
|
t(`billing.admin.products.${scope}.confirm`)
|
|
4008
3981
|
] }),
|
|
4009
3982
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4010
|
-
|
|
3983
|
+
_chunkIPYXT7MHjs.ConfirmDialog,
|
|
4011
3984
|
{
|
|
4012
3985
|
open,
|
|
4013
3986
|
onOpenChange: setOpen,
|
|
@@ -4021,7 +3994,7 @@ function ProductArchiver({ product }) {
|
|
|
4021
3994
|
if (isArchived) await restoreProduct(product.id);
|
|
4022
3995
|
else await archiveProduct(product.id);
|
|
4023
3996
|
} catch (error) {
|
|
4024
|
-
|
|
3997
|
+
_chunkIPYXT7MHjs.errorToast.call(void 0, { title: t(`billing.admin.products.${scope}.title`), error });
|
|
4025
3998
|
throw error;
|
|
4026
3999
|
}
|
|
4027
4000
|
}
|
|
@@ -4050,7 +4023,7 @@ function ProductEditorInternal({
|
|
|
4050
4023
|
onDialogOpenChange
|
|
4051
4024
|
}) {
|
|
4052
4025
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4053
|
-
const router =
|
|
4026
|
+
const router = _chunkT3YQ47EFjs.useI18nRouter.call(void 0, );
|
|
4054
4027
|
const { createProduct, updateProduct } = useProductContext();
|
|
4055
4028
|
const isEdit = !!product;
|
|
4056
4029
|
const formSchema2 = _react.useMemo.call(void 0,
|
|
@@ -4074,13 +4047,13 @@ function ProductEditorInternal({
|
|
|
4074
4047
|
defaultValues: getDefaultValues()
|
|
4075
4048
|
});
|
|
4076
4049
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4077
|
-
|
|
4050
|
+
_chunkIPYXT7MHjs.EditorSheet,
|
|
4078
4051
|
{
|
|
4079
4052
|
form,
|
|
4080
4053
|
entityType: t("billing.admin.products.entity"),
|
|
4081
4054
|
entityName: _optionalChain([product, 'optionalAccess', _155 => _155.name]),
|
|
4082
4055
|
isEdit,
|
|
4083
|
-
module:
|
|
4056
|
+
module: _chunkT3YQ47EFjs.Modules.StripeProduct,
|
|
4084
4057
|
size: "md",
|
|
4085
4058
|
propagateChanges,
|
|
4086
4059
|
onSuccess,
|
|
@@ -4097,7 +4070,7 @@ function ProductEditorInternal({
|
|
|
4097
4070
|
onDialogOpenChange,
|
|
4098
4071
|
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4099
4072
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4100
|
-
|
|
4073
|
+
_chunkIPYXT7MHjs.FormInput,
|
|
4101
4074
|
{
|
|
4102
4075
|
form,
|
|
4103
4076
|
id: "name",
|
|
@@ -4107,7 +4080,7 @@ function ProductEditorInternal({
|
|
|
4107
4080
|
}
|
|
4108
4081
|
),
|
|
4109
4082
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4110
|
-
|
|
4083
|
+
_chunkIPYXT7MHjs.FormTextarea,
|
|
4111
4084
|
{
|
|
4112
4085
|
form,
|
|
4113
4086
|
id: "description",
|
|
@@ -4151,20 +4124,20 @@ var defaultContextValue2 = {
|
|
|
4151
4124
|
};
|
|
4152
4125
|
var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ children, dehydratedProduct, publishChrome = true }) => {
|
|
4153
4126
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4154
|
-
const generateUrl =
|
|
4155
|
-
const { hasRole } =
|
|
4127
|
+
const generateUrl = _chunkIPYXT7MHjs.usePageUrlGenerator.call(void 0, );
|
|
4128
|
+
const { hasRole } = _chunkIPYXT7MHjs.useCurrentUserContext.call(void 0, );
|
|
4156
4129
|
const [product, setProduct] = _react.useState.call(void 0,
|
|
4157
|
-
dehydratedProduct ?
|
|
4130
|
+
dehydratedProduct ? _chunkT3YQ47EFjs.rehydrate.call(void 0, _chunkT3YQ47EFjs.Modules.StripeProduct, dehydratedProduct) : void 0
|
|
4158
4131
|
);
|
|
4159
4132
|
const [catalogueVersion, setCatalogueVersion] = _react.useState.call(void 0, 0);
|
|
4160
4133
|
const refreshCatalogue = _react.useCallback.call(void 0, () => setCatalogueVersion((value2) => value2 + 1), []);
|
|
4161
4134
|
const reloadProduct = _react.useCallback.call(void 0, async () => {
|
|
4162
4135
|
if (!_optionalChain([product, 'optionalAccess', _156 => _156.id])) return;
|
|
4163
|
-
setProduct(await
|
|
4136
|
+
setProduct(await _chunkT3YQ47EFjs.StripeProductService.getProduct({ id: product.id }));
|
|
4164
4137
|
}, [_optionalChain([product, 'optionalAccess', _157 => _157.id])]);
|
|
4165
4138
|
const createProduct = _react.useCallback.call(void 0,
|
|
4166
4139
|
async (input) => {
|
|
4167
|
-
const saved = await
|
|
4140
|
+
const saved = await _chunkT3YQ47EFjs.StripeProductService.createProduct(input);
|
|
4168
4141
|
refreshCatalogue();
|
|
4169
4142
|
return saved;
|
|
4170
4143
|
},
|
|
@@ -4172,7 +4145,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
4172
4145
|
);
|
|
4173
4146
|
const updateProduct = _react.useCallback.call(void 0,
|
|
4174
4147
|
async (input) => {
|
|
4175
|
-
const saved = await
|
|
4148
|
+
const saved = await _chunkT3YQ47EFjs.StripeProductService.updateProduct(input);
|
|
4176
4149
|
setProduct(saved);
|
|
4177
4150
|
refreshCatalogue();
|
|
4178
4151
|
return saved;
|
|
@@ -4183,7 +4156,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
4183
4156
|
async (id) => {
|
|
4184
4157
|
const target = _nullishCoalesce(id, () => ( _optionalChain([product, 'optionalAccess', _158 => _158.id])));
|
|
4185
4158
|
if (!target) return;
|
|
4186
|
-
await
|
|
4159
|
+
await _chunkT3YQ47EFjs.StripeProductService.archiveProduct({ id: target });
|
|
4187
4160
|
await reloadProduct();
|
|
4188
4161
|
refreshCatalogue();
|
|
4189
4162
|
},
|
|
@@ -4193,7 +4166,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
4193
4166
|
async (id) => {
|
|
4194
4167
|
const target = _nullishCoalesce(id, () => ( _optionalChain([product, 'optionalAccess', _160 => _160.id])));
|
|
4195
4168
|
if (!target) return;
|
|
4196
|
-
await
|
|
4169
|
+
await _chunkT3YQ47EFjs.StripeProductService.reactivateProduct({ id: target });
|
|
4197
4170
|
await reloadProduct();
|
|
4198
4171
|
refreshCatalogue();
|
|
4199
4172
|
},
|
|
@@ -4228,7 +4201,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
4228
4201
|
{
|
|
4229
4202
|
name: t("billing.admin.products.title"),
|
|
4230
4203
|
// Linked only when it is NOT the current page.
|
|
4231
|
-
...product ? { href: generateUrl({ page:
|
|
4204
|
+
...product ? { href: generateUrl({ page: _chunkT3YQ47EFjs.Modules.StripeProduct }) } : {}
|
|
4232
4205
|
}
|
|
4233
4206
|
];
|
|
4234
4207
|
if (product) items.push({ name: product.name });
|
|
@@ -4246,7 +4219,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
4246
4219
|
}
|
|
4247
4220
|
return response;
|
|
4248
4221
|
}, "title");
|
|
4249
|
-
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 }) });
|
|
4250
4223
|
}, "ProductProvider");
|
|
4251
4224
|
var useProductContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => _nullishCoalesce(_react.useContext.call(void 0, ProductContext), () => ( defaultContextValue2)), "useProductContext");
|
|
4252
4225
|
|
|
@@ -4255,57 +4228,57 @@ var useProductContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ()
|
|
|
4255
4228
|
|
|
4256
4229
|
function PriceDetails() {
|
|
4257
4230
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4258
|
-
const fmt =
|
|
4259
|
-
const generateUrl =
|
|
4231
|
+
const fmt = _chunkIPYXT7MHjs.useBillingFormatOptions.call(void 0, );
|
|
4232
|
+
const generateUrl = _chunkIPYXT7MHjs.usePageUrlGenerator.call(void 0, );
|
|
4260
4233
|
const { price } = usePriceContext();
|
|
4261
4234
|
if (!price) return null;
|
|
4262
4235
|
const isRecurring = price.priceType === "recurring";
|
|
4263
4236
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-8", children: [
|
|
4264
4237
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4265
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4238
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.SectionHeader, { children: t("billing.admin.prices.title") }),
|
|
4266
4239
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
4267
4240
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4268
|
-
|
|
4241
|
+
_chunkIPYXT7MHjs.DetailField,
|
|
4269
4242
|
{
|
|
4270
4243
|
label: t("billing.admin.prices.fields.product"),
|
|
4271
|
-
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"
|
|
4272
4245
|
}
|
|
4273
4246
|
),
|
|
4274
4247
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4275
|
-
|
|
4248
|
+
_chunkIPYXT7MHjs.DetailField,
|
|
4276
4249
|
{
|
|
4277
4250
|
label: t("billing.admin.prices.fields.status"),
|
|
4278
4251
|
value: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex flex-wrap items-center gap-1", children: [
|
|
4279
|
-
price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4280
|
-
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") })
|
|
4281
4254
|
] })
|
|
4282
4255
|
}
|
|
4283
4256
|
),
|
|
4284
4257
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4285
|
-
|
|
4258
|
+
_chunkIPYXT7MHjs.DetailField,
|
|
4286
4259
|
{
|
|
4287
4260
|
label: t("billing.admin.prices.fields.amount"),
|
|
4288
|
-
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) })
|
|
4289
4262
|
}
|
|
4290
4263
|
),
|
|
4291
|
-
/* @__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() }),
|
|
4292
4265
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4293
|
-
|
|
4266
|
+
_chunkIPYXT7MHjs.DetailField,
|
|
4294
4267
|
{
|
|
4295
4268
|
label: t("billing.admin.prices.fields.type"),
|
|
4296
4269
|
value: isRecurring ? t("billing.admin.prices.type.recurring") : t("billing.admin.prices.type.oneTime")
|
|
4297
4270
|
}
|
|
4298
4271
|
),
|
|
4299
|
-
/* @__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) }),
|
|
4300
4273
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4301
|
-
|
|
4274
|
+
_chunkIPYXT7MHjs.DetailField,
|
|
4302
4275
|
{
|
|
4303
4276
|
label: t("billing.admin.prices.fields.intervalCount"),
|
|
4304
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)) })
|
|
4305
4278
|
}
|
|
4306
4279
|
),
|
|
4307
4280
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4308
|
-
|
|
4281
|
+
_chunkIPYXT7MHjs.DetailField,
|
|
4309
4282
|
{
|
|
4310
4283
|
label: t("billing.admin.prices.fields.usageType"),
|
|
4311
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")
|
|
@@ -4314,24 +4287,24 @@ function PriceDetails() {
|
|
|
4314
4287
|
] })
|
|
4315
4288
|
] }),
|
|
4316
4289
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4317
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4290
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.SectionHeader, { children: t("billing.admin.prices.fields.platformFeatures") }),
|
|
4318
4291
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
4319
4292
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4320
|
-
|
|
4293
|
+
_chunkIPYXT7MHjs.DetailField,
|
|
4321
4294
|
{
|
|
4322
4295
|
label: t("billing.admin.prices.fields.token"),
|
|
4323
4296
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _nullishCoalesce(price.token, () => ( "\u2014")) })
|
|
4324
4297
|
}
|
|
4325
4298
|
),
|
|
4326
4299
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4327
|
-
|
|
4300
|
+
_chunkIPYXT7MHjs.DetailField,
|
|
4328
4301
|
{
|
|
4329
4302
|
label: t("billing.admin.prices.fields.stripeId"),
|
|
4330
4303
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: price.stripePriceId })
|
|
4331
4304
|
}
|
|
4332
4305
|
),
|
|
4333
4306
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4334
|
-
|
|
4307
|
+
_chunkIPYXT7MHjs.DetailField,
|
|
4335
4308
|
{
|
|
4336
4309
|
label: t("billing.admin.prices.fields.description"),
|
|
4337
4310
|
value: _nullishCoalesce(price.description, () => ( "\u2014")),
|
|
@@ -4339,7 +4312,7 @@ function PriceDetails() {
|
|
|
4339
4312
|
}
|
|
4340
4313
|
),
|
|
4341
4314
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4342
|
-
|
|
4315
|
+
_chunkIPYXT7MHjs.DetailField,
|
|
4343
4316
|
{
|
|
4344
4317
|
label: t("billing.admin.prices.fields.features"),
|
|
4345
4318
|
className: "md:col-span-2",
|
|
@@ -4347,11 +4320,11 @@ function PriceDetails() {
|
|
|
4347
4320
|
}
|
|
4348
4321
|
),
|
|
4349
4322
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4350
|
-
|
|
4323
|
+
_chunkIPYXT7MHjs.DetailField,
|
|
4351
4324
|
{
|
|
4352
4325
|
label: t("billing.admin.prices.fields.platformFeatures"),
|
|
4353
4326
|
className: "md:col-span-2",
|
|
4354
|
-
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"
|
|
4355
4328
|
}
|
|
4356
4329
|
)
|
|
4357
4330
|
] })
|
|
@@ -4365,7 +4338,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, PriceDetails, "PriceDetails");
|
|
|
4365
4338
|
function PriceContainer() {
|
|
4366
4339
|
const { price } = usePriceContext();
|
|
4367
4340
|
if (!price) return null;
|
|
4368
|
-
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, {}) });
|
|
4369
4342
|
}
|
|
4370
4343
|
_chunk7QVYU63Ejs.__name.call(void 0, PriceContainer, "PriceContainer");
|
|
4371
4344
|
|
|
@@ -4490,10 +4463,10 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4490
4463
|
const importInputRef = _react.useRef.call(void 0, null);
|
|
4491
4464
|
const [seed, setSeed] = _react.useState.call(void 0, void 0);
|
|
4492
4465
|
const [seedNonce, setSeedNonce] = _react.useState.call(void 0, 0);
|
|
4493
|
-
const data =
|
|
4494
|
-
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"),
|
|
4495
4468
|
retrieverParams: {},
|
|
4496
|
-
module:
|
|
4469
|
+
module: _chunkT3YQ47EFjs.Modules.StripePrice
|
|
4497
4470
|
});
|
|
4498
4471
|
_react.useEffect.call(void 0, () => {
|
|
4499
4472
|
if (priceVersion > 0) void data.refresh();
|
|
@@ -4528,7 +4501,7 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4528
4501
|
openSeededEditor(transfer.price);
|
|
4529
4502
|
} catch (error) {
|
|
4530
4503
|
console.error("[PricesList] price import failed", error);
|
|
4531
|
-
|
|
4504
|
+
_chunkIPYXT7MHjs.errorToast.call(void 0, {
|
|
4532
4505
|
title: t("billing.admin.prices.import.errors.title"),
|
|
4533
4506
|
error: t("billing.admin.prices.import.errors.invalid")
|
|
4534
4507
|
});
|
|
@@ -4547,7 +4520,7 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4547
4520
|
"create-price"
|
|
4548
4521
|
),
|
|
4549
4522
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _react.Fragment, { children: [
|
|
4550
|
-
/* @__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: [
|
|
4551
4524
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.UploadIcon, {}),
|
|
4552
4525
|
t("billing.admin.prices.actions.import")
|
|
4553
4526
|
] }),
|
|
@@ -4565,7 +4538,7 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4565
4538
|
];
|
|
4566
4539
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
4567
4540
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4568
|
-
|
|
4541
|
+
_chunkIPYXT7MHjs.ContentListTable,
|
|
4569
4542
|
{
|
|
4570
4543
|
data,
|
|
4571
4544
|
fields: [
|
|
@@ -4576,13 +4549,13 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4576
4549
|
"status" /* status */,
|
|
4577
4550
|
"actions" /* actions */
|
|
4578
4551
|
],
|
|
4579
|
-
tableGeneratorType:
|
|
4552
|
+
tableGeneratorType: _chunkT3YQ47EFjs.Modules.StripePrice,
|
|
4580
4553
|
functions,
|
|
4581
4554
|
context: tableContext,
|
|
4582
4555
|
fullWidth,
|
|
4583
4556
|
title: t("billing.admin.prices.title"),
|
|
4584
4557
|
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4585
|
-
|
|
4558
|
+
_chunkIPYXT7MHjs.EmptyState,
|
|
4586
4559
|
{
|
|
4587
4560
|
icon: _lucidereact.DollarSignIcon,
|
|
4588
4561
|
title: t("billing.admin.prices.empty.title"),
|
|
@@ -4622,18 +4595,18 @@ function ProductDetails() {
|
|
|
4622
4595
|
const { product } = useProductContext();
|
|
4623
4596
|
if (!product) return null;
|
|
4624
4597
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4625
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4598
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.SectionHeader, { children: t("billing.admin.products.tabs.details") }),
|
|
4626
4599
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
4627
|
-
/* @__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 }),
|
|
4628
4601
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4629
|
-
|
|
4602
|
+
_chunkIPYXT7MHjs.DetailField,
|
|
4630
4603
|
{
|
|
4631
4604
|
label: t("billing.admin.products.fields.status"),
|
|
4632
|
-
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") })
|
|
4633
4606
|
}
|
|
4634
4607
|
),
|
|
4635
4608
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4636
|
-
|
|
4609
|
+
_chunkIPYXT7MHjs.DetailField,
|
|
4637
4610
|
{
|
|
4638
4611
|
label: t("billing.admin.products.fields.description"),
|
|
4639
4612
|
value: _nullishCoalesce(product.description, () => ( "\u2014")),
|
|
@@ -4641,14 +4614,14 @@ function ProductDetails() {
|
|
|
4641
4614
|
}
|
|
4642
4615
|
),
|
|
4643
4616
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4644
|
-
|
|
4617
|
+
_chunkIPYXT7MHjs.DetailField,
|
|
4645
4618
|
{
|
|
4646
4619
|
label: t("billing.admin.products.fields.prices"),
|
|
4647
4620
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: product.stripePrices.length })
|
|
4648
4621
|
}
|
|
4649
4622
|
),
|
|
4650
4623
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4651
|
-
|
|
4624
|
+
_chunkIPYXT7MHjs.DetailField,
|
|
4652
4625
|
{
|
|
4653
4626
|
label: t("billing.admin.products.fields.stripeId"),
|
|
4654
4627
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: product.stripeProductId })
|
|
@@ -4666,9 +4639,9 @@ function ProductContainer() {
|
|
|
4666
4639
|
const { product } = useProductContext();
|
|
4667
4640
|
if (!product) return null;
|
|
4668
4641
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4669
|
-
|
|
4642
|
+
_chunkIPYXT7MHjs.RoundPageContainer,
|
|
4670
4643
|
{
|
|
4671
|
-
module:
|
|
4644
|
+
module: _chunkT3YQ47EFjs.Modules.StripeProduct,
|
|
4672
4645
|
id: product.id,
|
|
4673
4646
|
tabs: [
|
|
4674
4647
|
{
|
|
@@ -4677,7 +4650,7 @@ function ProductContainer() {
|
|
|
4677
4650
|
content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductDetails, {})
|
|
4678
4651
|
},
|
|
4679
4652
|
{
|
|
4680
|
-
key:
|
|
4653
|
+
key: _chunkT3YQ47EFjs.Modules.StripePrice,
|
|
4681
4654
|
label: t("billing.admin.prices.title"),
|
|
4682
4655
|
// publishChrome={false}: SharedProvider REPLACES its value for the
|
|
4683
4656
|
// subtree (SharedContext.tsx:35-37), so a nested provider publishing
|
|
@@ -4703,18 +4676,18 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductContainer, "ProductContainer");
|
|
|
4703
4676
|
|
|
4704
4677
|
function CouponsList({ fullWidth } = {}) {
|
|
4705
4678
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4706
|
-
const { catalogueVersion } =
|
|
4707
|
-
const data =
|
|
4708
|
-
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"),
|
|
4709
4682
|
retrieverParams: {},
|
|
4710
|
-
module:
|
|
4683
|
+
module: _chunkT3YQ47EFjs.Modules.StripeCoupon
|
|
4711
4684
|
});
|
|
4712
4685
|
_react.useEffect.call(void 0, () => {
|
|
4713
4686
|
if (catalogueVersion > 0) void data.refresh();
|
|
4714
4687
|
}, [catalogueVersion]);
|
|
4715
|
-
const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4688
|
+
const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.CouponEditor, {}, "create-coupon")];
|
|
4716
4689
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4717
|
-
|
|
4690
|
+
_chunkIPYXT7MHjs.ContentListTable,
|
|
4718
4691
|
{
|
|
4719
4692
|
data,
|
|
4720
4693
|
fields: [
|
|
@@ -4724,12 +4697,12 @@ function CouponsList({ fullWidth } = {}) {
|
|
|
4724
4697
|
"codes" /* codes */,
|
|
4725
4698
|
"status" /* status */
|
|
4726
4699
|
],
|
|
4727
|
-
tableGeneratorType:
|
|
4700
|
+
tableGeneratorType: _chunkT3YQ47EFjs.Modules.StripeCoupon,
|
|
4728
4701
|
functions,
|
|
4729
4702
|
fullWidth,
|
|
4730
4703
|
title: t("billing.admin.coupons.title"),
|
|
4731
4704
|
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4732
|
-
|
|
4705
|
+
_chunkIPYXT7MHjs.EmptyState,
|
|
4733
4706
|
{
|
|
4734
4707
|
icon: _lucidereact.TicketPercentIcon,
|
|
4735
4708
|
title: t("billing.admin.coupons.empty.title"),
|
|
@@ -4749,26 +4722,26 @@ _chunk7QVYU63Ejs.__name.call(void 0, CouponsList, "CouponsList");
|
|
|
4749
4722
|
function ProductsList({ fullWidth } = {}) {
|
|
4750
4723
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4751
4724
|
const { catalogueVersion } = useProductContext();
|
|
4752
|
-
const data =
|
|
4753
|
-
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"),
|
|
4754
4727
|
retrieverParams: {},
|
|
4755
|
-
module:
|
|
4728
|
+
module: _chunkT3YQ47EFjs.Modules.StripeProduct
|
|
4756
4729
|
});
|
|
4757
4730
|
_react.useEffect.call(void 0, () => {
|
|
4758
4731
|
if (catalogueVersion > 0) void data.refresh();
|
|
4759
4732
|
}, [catalogueVersion]);
|
|
4760
4733
|
const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductEditor, {}, "create-product")];
|
|
4761
4734
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4762
|
-
|
|
4735
|
+
_chunkIPYXT7MHjs.ContentListTable,
|
|
4763
4736
|
{
|
|
4764
4737
|
data,
|
|
4765
4738
|
fields: ["name" /* name */, "status" /* status */, "prices" /* prices */],
|
|
4766
|
-
tableGeneratorType:
|
|
4739
|
+
tableGeneratorType: _chunkT3YQ47EFjs.Modules.StripeProduct,
|
|
4767
4740
|
functions,
|
|
4768
4741
|
fullWidth,
|
|
4769
4742
|
title: t("billing.admin.products.title"),
|
|
4770
4743
|
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4771
|
-
|
|
4744
|
+
_chunkIPYXT7MHjs.EmptyState,
|
|
4772
4745
|
{
|
|
4773
4746
|
icon: _lucidereact.PackageIcon,
|
|
4774
4747
|
title: t("billing.admin.products.empty.title"),
|
|
@@ -4784,10 +4757,10 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductsList, "ProductsList");
|
|
|
4784
4757
|
|
|
4785
4758
|
function ProductsListContainer() {
|
|
4786
4759
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4787
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductProvider, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4788
|
-
|
|
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,
|
|
4789
4762
|
{
|
|
4790
|
-
module:
|
|
4763
|
+
module: _chunkT3YQ47EFjs.Modules.StripeProduct,
|
|
4791
4764
|
tabs: [
|
|
4792
4765
|
{ sectionKey: "products", label: t("billing.admin.products.tabs.products"), content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductsList, {}) },
|
|
4793
4766
|
{ sectionKey: "codes", label: t("billing.admin.products.tabs.codes"), content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CouponsList, {}) }
|
|
@@ -4805,30 +4778,30 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductsListContainer, "ProductsListContain
|
|
|
4805
4778
|
|
|
4806
4779
|
function CouponDetails() {
|
|
4807
4780
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4808
|
-
const fmt =
|
|
4809
|
-
const { coupon } =
|
|
4781
|
+
const fmt = _chunkIPYXT7MHjs.useBillingFormatOptions.call(void 0, );
|
|
4782
|
+
const { coupon } = _chunkIPYXT7MHjs.useCouponContext.call(void 0, );
|
|
4810
4783
|
if (!coupon) return null;
|
|
4811
4784
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4812
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4785
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.SectionHeader, { children: t("billing.admin.products.tabs.details") }),
|
|
4813
4786
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-xs/relaxed", children: t("billing.admin.coupons.fixed_notice") }),
|
|
4814
4787
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
4815
|
-
/* @__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 }),
|
|
4816
4789
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4817
|
-
|
|
4790
|
+
_chunkIPYXT7MHjs.DetailField,
|
|
4818
4791
|
{
|
|
4819
4792
|
label: t("billing.admin.coupons.fields.status"),
|
|
4820
|
-
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") })
|
|
4821
4794
|
}
|
|
4822
4795
|
),
|
|
4823
4796
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4824
|
-
|
|
4797
|
+
_chunkIPYXT7MHjs.DetailField,
|
|
4825
4798
|
{
|
|
4826
4799
|
label: t("billing.admin.coupons.fields.discount"),
|
|
4827
|
-
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) })
|
|
4828
4801
|
}
|
|
4829
4802
|
),
|
|
4830
4803
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4831
|
-
|
|
4804
|
+
_chunkIPYXT7MHjs.DetailField,
|
|
4832
4805
|
{
|
|
4833
4806
|
label: t("billing.admin.coupons.fields.places"),
|
|
4834
4807
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: coupon.maxRedemptions !== void 0 ? t("billing.admin.coupons.places.limited", {
|
|
@@ -4838,21 +4811,21 @@ function CouponDetails() {
|
|
|
4838
4811
|
}
|
|
4839
4812
|
),
|
|
4840
4813
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4841
|
-
|
|
4814
|
+
_chunkIPYXT7MHjs.DetailField,
|
|
4842
4815
|
{
|
|
4843
4816
|
label: t("billing.admin.coupons.fields.products"),
|
|
4844
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")
|
|
4845
4818
|
}
|
|
4846
4819
|
),
|
|
4847
4820
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4848
|
-
|
|
4821
|
+
_chunkIPYXT7MHjs.DetailField,
|
|
4849
4822
|
{
|
|
4850
4823
|
label: t("billing.admin.coupons.fields.redeemBy"),
|
|
4851
|
-
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" })
|
|
4852
4825
|
}
|
|
4853
4826
|
),
|
|
4854
4827
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4855
|
-
|
|
4828
|
+
_chunkIPYXT7MHjs.DetailField,
|
|
4856
4829
|
{
|
|
4857
4830
|
label: t("billing.admin.coupons.fields.stripeId"),
|
|
4858
4831
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: coupon.stripeCouponId })
|
|
@@ -4886,33 +4859,33 @@ function CouponCodeEditorInternal({
|
|
|
4886
4859
|
onDialogOpenChange
|
|
4887
4860
|
}) {
|
|
4888
4861
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4889
|
-
const router =
|
|
4890
|
-
const { createCode } =
|
|
4891
|
-
const formSchema2 = _react.useMemo.call(void 0, () => _zod3.z.object({ id: _zod3.z.uuidv4() }).and(
|
|
4892
|
-
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, ) }), []);
|
|
4893
4866
|
const form = _reacthookform.useForm.call(void 0, {
|
|
4894
4867
|
resolver: _zod.zodResolver.call(void 0, formSchema2),
|
|
4895
4868
|
defaultValues: getDefaultValues()
|
|
4896
4869
|
});
|
|
4897
4870
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4898
|
-
|
|
4871
|
+
_chunkIPYXT7MHjs.EditorSheet,
|
|
4899
4872
|
{
|
|
4900
4873
|
form,
|
|
4901
4874
|
entityType: t("billing.admin.coupons.codes.entity"),
|
|
4902
4875
|
isEdit: false,
|
|
4903
|
-
module:
|
|
4876
|
+
module: _chunkT3YQ47EFjs.Modules.StripeCouponCode,
|
|
4904
4877
|
size: "md",
|
|
4905
4878
|
onSuccess: _nullishCoalesce(onSuccess, () => ( (() => {
|
|
4906
4879
|
}))),
|
|
4907
4880
|
onNavigate: (url) => router.push(url),
|
|
4908
|
-
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) }),
|
|
4909
4882
|
onReset: getDefaultValues,
|
|
4910
4883
|
trigger,
|
|
4911
4884
|
forceShow,
|
|
4912
4885
|
onClose,
|
|
4913
4886
|
dialogOpen,
|
|
4914
4887
|
onDialogOpenChange,
|
|
4915
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4888
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkIPYXT7MHjs.CouponCodeFields, { form })
|
|
4916
4889
|
}
|
|
4917
4890
|
);
|
|
4918
4891
|
}
|
|
@@ -4926,18 +4899,18 @@ _chunk7QVYU63Ejs.__name.call(void 0, CouponCodeEditor, "CouponCodeEditor");
|
|
|
4926
4899
|
|
|
4927
4900
|
function CouponCodesList({ couponId }) {
|
|
4928
4901
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4929
|
-
const { catalogueVersion } =
|
|
4930
|
-
const data =
|
|
4931
|
-
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"),
|
|
4932
4905
|
retrieverParams: {},
|
|
4933
|
-
module:
|
|
4906
|
+
module: _chunkT3YQ47EFjs.Modules.StripeCouponCode
|
|
4934
4907
|
});
|
|
4935
4908
|
_react.useEffect.call(void 0, () => {
|
|
4936
4909
|
if (catalogueVersion > 0) void data.refresh();
|
|
4937
4910
|
}, [catalogueVersion]);
|
|
4938
4911
|
const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, CouponCodeEditor, { couponId }, "create-code")];
|
|
4939
4912
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4940
|
-
|
|
4913
|
+
_chunkIPYXT7MHjs.ContentListTable,
|
|
4941
4914
|
{
|
|
4942
4915
|
data,
|
|
4943
4916
|
fields: [
|
|
@@ -4948,11 +4921,11 @@ function CouponCodesList({ couponId }) {
|
|
|
4948
4921
|
"status" /* status */,
|
|
4949
4922
|
"actions" /* actions */
|
|
4950
4923
|
],
|
|
4951
|
-
tableGeneratorType:
|
|
4924
|
+
tableGeneratorType: _chunkT3YQ47EFjs.Modules.StripeCouponCode,
|
|
4952
4925
|
functions,
|
|
4953
4926
|
title: t("billing.admin.coupons.codes.title"),
|
|
4954
4927
|
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4955
|
-
|
|
4928
|
+
_chunkIPYXT7MHjs.EmptyState,
|
|
4956
4929
|
{
|
|
4957
4930
|
icon: _lucidereact.TicketIcon,
|
|
4958
4931
|
title: t("billing.admin.coupons.codes.empty.title"),
|
|
@@ -4968,12 +4941,12 @@ _chunk7QVYU63Ejs.__name.call(void 0, CouponCodesList, "CouponCodesList");
|
|
|
4968
4941
|
|
|
4969
4942
|
function CouponContainer() {
|
|
4970
4943
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4971
|
-
const { coupon } =
|
|
4944
|
+
const { coupon } = _chunkIPYXT7MHjs.useCouponContext.call(void 0, );
|
|
4972
4945
|
if (!coupon) return null;
|
|
4973
4946
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4974
|
-
|
|
4947
|
+
_chunkIPYXT7MHjs.RoundPageContainer,
|
|
4975
4948
|
{
|
|
4976
|
-
module:
|
|
4949
|
+
module: _chunkIPYXT7MHjs.couponPageModule.call(void 0, ),
|
|
4977
4950
|
id: coupon.id,
|
|
4978
4951
|
tabs: [
|
|
4979
4952
|
{
|
|
@@ -5080,5 +5053,5 @@ _chunk7QVYU63Ejs.__name.call(void 0, CouponContainer, "CouponContainer");
|
|
|
5080
5053
|
|
|
5081
5054
|
|
|
5082
5055
|
|
|
5083
|
-
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;
|
|
5084
5057
|
//# sourceMappingURL=index.js.map
|