@carlonicora/nextjs-jsonapi 5.7.1 → 5.7.2
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-ARUXU5AV.js → BlockNoteEditor-G45WMJ5V.js} +19 -19
- package/dist/{BlockNoteEditor-ARUXU5AV.js.map → BlockNoteEditor-G45WMJ5V.js.map} +1 -1
- package/dist/{BlockNoteEditor-MNNISNVN.mjs → BlockNoteEditor-R3745ALQ.mjs} +4 -4
- package/dist/{BlockNoteViewer-SD3ZFIXD.js → BlockNoteViewer-5PGOVURC.js} +3 -3
- package/dist/{BlockNoteViewer-SD3ZFIXD.js.map → BlockNoteViewer-5PGOVURC.js.map} +1 -1
- package/dist/{BlockNoteViewer-BVVN6D3T.mjs → BlockNoteViewer-TNK3OMH5.mjs} +2 -2
- package/dist/billing/index.d.mts +6 -5
- package/dist/billing/index.d.ts +6 -5
- package/dist/billing/index.js +495 -494
- package/dist/billing/index.js.map +1 -1
- package/dist/billing/index.mjs +6 -5
- package/dist/billing/index.mjs.map +1 -1
- package/dist/{chunk-5TH2DSAH.js → chunk-3CSPHMVK.js} +2 -3
- package/dist/chunk-3CSPHMVK.js.map +1 -0
- package/dist/{chunk-OKCV4GPJ.mjs → chunk-6KAYEYFU.mjs} +2 -2
- package/dist/{chunk-FK26NX3S.mjs → chunk-CJS5WA4E.mjs} +1 -2
- package/dist/chunk-CJS5WA4E.mjs.map +1 -0
- package/dist/{chunk-XOSC3FFP.js → chunk-CP7BXAFH.js} +8 -8
- package/dist/{chunk-XOSC3FFP.js.map → chunk-CP7BXAFH.js.map} +1 -1
- package/dist/{chunk-2WK35GO2.js → chunk-EXG4ANC7.js} +868 -869
- package/dist/chunk-EXG4ANC7.js.map +1 -0
- package/dist/{chunk-2FNSDBJG.mjs → chunk-JCNB5KTQ.mjs} +7 -8
- package/dist/{chunk-2FNSDBJG.mjs.map → chunk-JCNB5KTQ.mjs.map} +1 -1
- package/dist/{chunk-RGQYFSJF.mjs → chunk-KOA5PZZA.mjs} +2 -2
- package/dist/{chunk-WCHLCOZG.mjs → chunk-RJMLAW5O.mjs} +2 -2
- package/dist/{chunk-IJME5SAM.js → chunk-WU47MIZZ.js} +4 -4
- package/dist/{chunk-IJME5SAM.js.map → chunk-WU47MIZZ.js.map} +1 -1
- package/dist/{chunk-2TXE57LE.js → chunk-YG4YFAYY.js} +3 -3
- package/dist/{chunk-2TXE57LE.js.map → chunk-YG4YFAYY.js.map} +1 -1
- package/dist/client/index.js +4 -4
- package/dist/client/index.mjs +3 -3
- package/dist/components/index.js +4 -4
- package/dist/components/index.mjs +3 -3
- package/dist/contexts/index.js +4 -4
- package/dist/contexts/index.mjs +3 -3
- package/dist/core/index.d.mts +2 -2
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.js +2 -2
- package/dist/core/index.mjs +1 -1
- package/dist/{currency-pK9eRYRC.d.ts → currency-8ErEC39n.d.ts} +3 -2
- package/dist/{currency-DT_dveBx.d.mts → currency-DrEVd_Xs.d.mts} +3 -2
- 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.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/index.mjs +2 -2
- package/dist/server/index.js +3 -3
- package/dist/server/index.mjs +2 -2
- package/package.json +1 -1
- package/src/features/billing/components/utils/__tests__/billing-formatters.spec.ts +13 -2
- package/src/features/billing/components/utils/date.ts +7 -5
- package/src/features/billing/components/utils/format-options.ts +4 -2
- package/src/features/billing/stripe-usage/components/details/UsageSummaryCard.tsx +2 -1
- package/src/features/billing/stripe-usage/components/lists/UsageHistoryTable.tsx +2 -1
- package/src/features/oauth/components/OAuthClientDetail.tsx +2 -1
- package/dist/chunk-2WK35GO2.js.map +0 -1
- package/dist/chunk-5TH2DSAH.js.map +0 -1
- package/dist/chunk-FK26NX3S.mjs.map +0 -1
- /package/dist/{BlockNoteEditor-MNNISNVN.mjs.map → BlockNoteEditor-R3745ALQ.mjs.map} +0 -0
- /package/dist/{BlockNoteViewer-BVVN6D3T.mjs.map → BlockNoteViewer-TNK3OMH5.mjs.map} +0 -0
- /package/dist/{chunk-OKCV4GPJ.mjs.map → chunk-6KAYEYFU.mjs.map} +0 -0
- /package/dist/{chunk-RGQYFSJF.mjs.map → chunk-KOA5PZZA.mjs.map} +0 -0
- /package/dist/{chunk-WCHLCOZG.mjs.map → chunk-RJMLAW5O.mjs.map} +0 -0
package/dist/billing/index.js
CHANGED
|
@@ -81,10 +81,10 @@
|
|
|
81
81
|
|
|
82
82
|
|
|
83
83
|
|
|
84
|
-
var
|
|
84
|
+
var _chunkEXG4ANC7js = require('../chunk-EXG4ANC7.js');
|
|
85
85
|
|
|
86
86
|
|
|
87
|
-
var
|
|
87
|
+
var _chunkCP7BXAFHjs = require('../chunk-CP7BXAFH.js');
|
|
88
88
|
|
|
89
89
|
|
|
90
90
|
var _chunkG4JR3SFVjs = require('../chunk-G4JR3SFV.js');
|
|
@@ -112,7 +112,8 @@ var _chunkG4JR3SFVjs = require('../chunk-G4JR3SFV.js');
|
|
|
112
112
|
|
|
113
113
|
|
|
114
114
|
|
|
115
|
-
|
|
115
|
+
|
|
116
|
+
var _chunk3CSPHMVKjs = require('../chunk-3CSPHMVK.js');
|
|
116
117
|
require('../chunk-GHE4VT2R.js');
|
|
117
118
|
require('../chunk-LXKSUWAV.js');
|
|
118
119
|
require('../chunk-JTPRJNT2.js');
|
|
@@ -125,7 +126,7 @@ var _chunk7QVYU63Ejs = require('../chunk-7QVYU63E.js');
|
|
|
125
126
|
var _nextintl = require('next-intl');
|
|
126
127
|
var _lucidereact = require('lucide-react');
|
|
127
128
|
var _jsxruntime = require('react/jsx-runtime');
|
|
128
|
-
var SUBSCRIPTION_STATUSES = Object.values(
|
|
129
|
+
var SUBSCRIPTION_STATUSES = Object.values(_chunk3CSPHMVKjs.SubscriptionStatus);
|
|
129
130
|
function getStatusBadgeVariant(status) {
|
|
130
131
|
switch (status) {
|
|
131
132
|
case "active" /* ACTIVE */:
|
|
@@ -157,43 +158,43 @@ function SubscriptionSummaryCard({
|
|
|
157
158
|
onManageClick
|
|
158
159
|
}) {
|
|
159
160
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
160
|
-
const fmt =
|
|
161
|
+
const fmt = _chunkEXG4ANC7js.useBillingFormatOptions.call(void 0, );
|
|
161
162
|
if (loading) {
|
|
162
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
163
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
164
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
163
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.Card, { children: [
|
|
164
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
165
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.CardTitle, { children: t("billing.ui.subscriptions.title") }),
|
|
165
166
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
166
167
|
] }),
|
|
167
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
168
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
169
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
170
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
168
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.CardContent, { children: [
|
|
169
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
170
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Skeleton, { className: "h-4 w-24 mb-1" }),
|
|
171
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Skeleton, { className: "h-4 w-40" })
|
|
171
172
|
] })
|
|
172
173
|
] });
|
|
173
174
|
}
|
|
174
175
|
if (error) {
|
|
175
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
176
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
177
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
176
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.Card, { children: [
|
|
177
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
178
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.CardTitle, { children: t("billing.ui.subscriptions.title") }),
|
|
178
179
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
179
180
|
] }),
|
|
180
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
181
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
181
182
|
] });
|
|
182
183
|
}
|
|
183
184
|
const activeSubscriptions = subscriptions.filter(
|
|
184
185
|
(sub) => sub.status === "active" /* ACTIVE */ || sub.status === "trialing" /* TRIALING */
|
|
185
186
|
);
|
|
186
187
|
const primarySubscription = activeSubscriptions[0];
|
|
187
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
188
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
189
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
188
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
|
|
189
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
190
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.CardTitle, { children: t("billing.ui.subscriptions.title") }),
|
|
190
191
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
191
192
|
] }),
|
|
192
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
193
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.CardContent, { children: !primarySubscription ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
193
194
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: t("billing.ui.cards.subscriptions.empty_title") }),
|
|
194
195
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.subscriptions.empty_description") }),
|
|
195
196
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
196
|
-
|
|
197
|
+
_chunkEXG4ANC7js.Button,
|
|
197
198
|
{
|
|
198
199
|
variant: "outline",
|
|
199
200
|
size: "sm",
|
|
@@ -212,7 +213,7 @@ function SubscriptionSummaryCard({
|
|
|
212
213
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
213
214
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: formatPlanName(primarySubscription, t("billing.ui.cards.subscriptions.fallback_name")) }),
|
|
214
215
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
215
|
-
|
|
216
|
+
_chunkEXG4ANC7js.Badge,
|
|
216
217
|
{
|
|
217
218
|
variant: primarySubscription.cancelAtPeriodEnd ? "secondary" : getStatusBadgeVariant(primarySubscription.status),
|
|
218
219
|
children: primarySubscription.cancelAtPeriodEnd ? t("billing.ui.cards.subscriptions.canceling") : SUBSCRIPTION_STATUSES.includes(primarySubscription.status) ? t(`billing.ui.subscription_status.${primarySubscription.status}`) : primarySubscription.status
|
|
@@ -220,11 +221,11 @@ function SubscriptionSummaryCard({
|
|
|
220
221
|
)
|
|
221
222
|
] }),
|
|
222
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", {
|
|
223
|
-
date:
|
|
224
|
+
date: _chunkEXG4ANC7js.formatDate.call(void 0, primarySubscription.currentPeriodEnd, fmt)
|
|
224
225
|
}) : primarySubscription.cancelAtPeriodEnd ? t("billing.ui.cards.subscriptions.cancels_on", {
|
|
225
|
-
date:
|
|
226
|
+
date: _chunkEXG4ANC7js.formatDate.call(void 0, primarySubscription.currentPeriodEnd, fmt)
|
|
226
227
|
}) : t("billing.ui.cards.subscriptions.renews_on", {
|
|
227
|
-
date:
|
|
228
|
+
date: _chunkEXG4ANC7js.formatDate.call(void 0, primarySubscription.currentPeriodEnd, fmt)
|
|
228
229
|
}) }),
|
|
229
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 }) })
|
|
230
231
|
] }) })
|
|
@@ -258,37 +259,37 @@ function PaymentMethodSummaryCard({
|
|
|
258
259
|
}) {
|
|
259
260
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
260
261
|
if (loading) {
|
|
261
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
262
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
263
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
262
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.Card, { children: [
|
|
263
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
264
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.CardTitle, { children: t("billing.ui.payment_method.title") }),
|
|
264
265
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
265
266
|
] }),
|
|
266
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
267
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
268
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
267
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.CardContent, { children: [
|
|
268
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
269
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Skeleton, { className: "h-4 w-24" })
|
|
269
270
|
] })
|
|
270
271
|
] });
|
|
271
272
|
}
|
|
272
273
|
if (error) {
|
|
273
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
274
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
275
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
274
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.Card, { children: [
|
|
275
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
276
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.CardTitle, { children: t("billing.ui.payment_method.title") }),
|
|
276
277
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
277
278
|
] }),
|
|
278
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
279
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
279
280
|
] });
|
|
280
281
|
}
|
|
281
282
|
const defaultMethod = paymentMethods.find((pm) => pm.id === defaultPaymentMethodId) || paymentMethods[0];
|
|
282
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
283
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
284
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
283
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
|
|
284
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
285
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.CardTitle, { children: t("billing.ui.payment_method.title") }),
|
|
285
286
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
286
287
|
] }),
|
|
287
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
288
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.CardContent, { children: paymentMethods.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
288
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") }),
|
|
289
290
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.payment_method.empty_description") }),
|
|
290
291
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
291
|
-
|
|
292
|
+
_chunkEXG4ANC7js.Button,
|
|
292
293
|
{
|
|
293
294
|
variant: "outline",
|
|
294
295
|
size: "sm",
|
|
@@ -337,13 +338,13 @@ function formatBalance(balance, currency, locale) {
|
|
|
337
338
|
_chunk7QVYU63Ejs.__name.call(void 0, formatBalance, "formatBalance");
|
|
338
339
|
function CustomerInfoCard({ customer, loading, error }) {
|
|
339
340
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
340
|
-
const locale =
|
|
341
|
+
const locale = _chunk3CSPHMVKjs.useI18nLocale.call(void 0, );
|
|
341
342
|
const [portalLoading, setPortalLoading] = _react.useState.call(void 0, false);
|
|
342
343
|
const handlePortalClick = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async (e) => {
|
|
343
344
|
e.stopPropagation();
|
|
344
345
|
setPortalLoading(true);
|
|
345
346
|
try {
|
|
346
|
-
const { url } = await
|
|
347
|
+
const { url } = await _chunk3CSPHMVKjs.StripeCustomerService.createPortalSession();
|
|
347
348
|
window.open(url, "_blank");
|
|
348
349
|
} catch (err) {
|
|
349
350
|
console.error("[CustomerInfoCard] Failed to create portal session:", err);
|
|
@@ -352,45 +353,45 @@ function CustomerInfoCard({ customer, loading, error }) {
|
|
|
352
353
|
}
|
|
353
354
|
}, "handlePortalClick");
|
|
354
355
|
if (loading) {
|
|
355
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
356
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
357
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
356
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.Card, { children: [
|
|
357
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
358
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.CardTitle, { children: t("billing.ui.cards.customer.title") }),
|
|
358
359
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
359
360
|
] }),
|
|
360
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
361
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
362
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
363
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
361
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.CardContent, { children: [
|
|
362
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
363
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Skeleton, { className: "h-4 w-48 mb-1" }),
|
|
364
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Skeleton, { className: "h-4 w-24" })
|
|
364
365
|
] })
|
|
365
366
|
] });
|
|
366
367
|
}
|
|
367
368
|
if (error) {
|
|
368
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
369
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
370
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
369
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.Card, { children: [
|
|
370
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
371
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.CardTitle, { children: t("billing.ui.cards.customer.title") }),
|
|
371
372
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
372
373
|
] }),
|
|
373
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
374
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
374
375
|
] });
|
|
375
376
|
}
|
|
376
377
|
if (!customer) {
|
|
377
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
378
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
379
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
378
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.Card, { children: [
|
|
379
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
380
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.CardTitle, { children: t("billing.ui.cards.customer.title") }),
|
|
380
381
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
381
382
|
] }),
|
|
382
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
383
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.CardContent, { children: [
|
|
383
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") }),
|
|
384
385
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.customer.not_set_up_description") })
|
|
385
386
|
] })
|
|
386
387
|
] });
|
|
387
388
|
}
|
|
388
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
389
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
390
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
389
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.Card, { children: [
|
|
390
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
391
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.CardTitle, { children: t("billing.ui.cards.customer.title") }),
|
|
391
392
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
392
393
|
] }),
|
|
393
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
394
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
394
395
|
customer.name && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: customer.name }),
|
|
395
396
|
customer.email && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: customer.email }),
|
|
396
397
|
customer.balance !== void 0 && customer.balance !== 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm", children: [
|
|
@@ -400,7 +401,7 @@ function CustomerInfoCard({ customer, loading, error }) {
|
|
|
400
401
|
] }),
|
|
401
402
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: customer.balance < 0 ? "text-success" : "text-destructive", children: formatBalance(customer.balance, customer.currency, locale) })
|
|
402
403
|
] }),
|
|
403
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
404
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.Button, { variant: "outline", size: "sm", className: "mt-2", onClick: handlePortalClick, disabled: portalLoading, children: [
|
|
404
405
|
portalLoading ? t("common.loading") : t("billing.ui.cards.customer.manage_portal"),
|
|
405
406
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ExternalLink, { className: "h-4 w-4 ms-1" })
|
|
406
407
|
] })
|
|
@@ -413,7 +414,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, CustomerInfoCard, "CustomerInfoCard");
|
|
|
413
414
|
|
|
414
415
|
|
|
415
416
|
|
|
416
|
-
var INVOICE_STATUSES = Object.values(
|
|
417
|
+
var INVOICE_STATUSES = Object.values(_chunk3CSPHMVKjs.InvoiceStatus);
|
|
417
418
|
function getStatusBadgeVariant2(status) {
|
|
418
419
|
switch (status) {
|
|
419
420
|
case "paid" /* PAID */:
|
|
@@ -438,46 +439,46 @@ function formatAmount(amount, currency, locale) {
|
|
|
438
439
|
_chunk7QVYU63Ejs.__name.call(void 0, formatAmount, "formatAmount");
|
|
439
440
|
function InvoicesSummaryCard({ invoices, loading, error, onViewAllClick }) {
|
|
440
441
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
441
|
-
const fmt =
|
|
442
|
+
const fmt = _chunkEXG4ANC7js.useBillingFormatOptions.call(void 0, );
|
|
442
443
|
if (loading) {
|
|
443
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
444
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
445
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
444
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.Card, { children: [
|
|
445
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
446
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.CardTitle, { children: t("billing.ui.cards.invoices.title") }),
|
|
446
447
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
447
448
|
] }),
|
|
448
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
449
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
450
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
451
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
449
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.CardContent, { children: [
|
|
450
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Skeleton, { className: "h-6 w-24 mb-2" }),
|
|
451
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Skeleton, { className: "h-4 w-32 mb-1" }),
|
|
452
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Skeleton, { className: "h-4 w-20" })
|
|
452
453
|
] })
|
|
453
454
|
] });
|
|
454
455
|
}
|
|
455
456
|
if (error) {
|
|
456
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
457
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
458
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
457
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.Card, { children: [
|
|
458
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
459
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.CardTitle, { children: t("billing.ui.cards.invoices.title") }),
|
|
459
460
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
460
461
|
] }),
|
|
461
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
462
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
462
463
|
] });
|
|
463
464
|
}
|
|
464
465
|
const latestInvoice = _nullishCoalesce(invoices.find((inv) => inv.status !== "void" /* VOID */), () => ( invoices[0]));
|
|
465
466
|
const paidInvoices = invoices.filter((inv) => inv.status === "paid" /* PAID */);
|
|
466
467
|
const openInvoices = invoices.filter((inv) => inv.status === "open" /* OPEN */);
|
|
467
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
468
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
469
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
468
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewAllClick, children: [
|
|
469
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
470
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.CardTitle, { children: t("billing.ui.cards.invoices.title") }),
|
|
470
471
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
471
472
|
] }),
|
|
472
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
473
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.CardContent, { children: invoices.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
473
474
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: t("billing.ui.invoices.empty_title") }),
|
|
474
475
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.invoices.empty_description") })
|
|
475
476
|
] }) : latestInvoice ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
476
477
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
477
478
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: formatAmount(latestInvoice.total, latestInvoice.currency, fmt.locale) }),
|
|
478
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
479
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Badge, { variant: getStatusBadgeVariant2(latestInvoice.status), children: INVOICE_STATUSES.includes(latestInvoice.status) ? t(`billing.ui.invoice_status.${latestInvoice.status}`) : latestInvoice.status })
|
|
479
480
|
] }),
|
|
480
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: latestInvoice.stripeInvoiceNumber || t("billing.ui.cards.invoices.invoice_from", { date:
|
|
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: _chunkEXG4ANC7js.formatDate.call(void 0, latestInvoice.periodStart, fmt) }) }),
|
|
481
482
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-4 text-xs text-muted-foreground", children: [
|
|
482
483
|
paidInvoices.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: t("billing.ui.cards.invoices.paid_count", { count: paidInvoices.length }) }),
|
|
483
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 }) }),
|
|
@@ -510,26 +511,26 @@ function BillingUsageSummaryCard({
|
|
|
510
511
|
onViewDetailsClick
|
|
511
512
|
}) {
|
|
512
513
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
513
|
-
const locale =
|
|
514
|
+
const locale = _chunk3CSPHMVKjs.useI18nLocale.call(void 0, );
|
|
514
515
|
if (loading) {
|
|
515
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
516
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
517
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
516
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.Card, { children: [
|
|
517
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
518
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.CardTitle, { children: t("billing.ui.cards.usage.title") }),
|
|
518
519
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
519
520
|
] }),
|
|
520
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
521
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
522
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
521
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.CardContent, { children: [
|
|
522
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Skeleton, { className: "h-6 w-24 mb-2" }),
|
|
523
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Skeleton, { className: "h-4 w-32" })
|
|
523
524
|
] })
|
|
524
525
|
] });
|
|
525
526
|
}
|
|
526
527
|
if (error) {
|
|
527
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
528
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
529
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
528
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.Card, { children: [
|
|
529
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
530
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.CardTitle, { children: t("billing.ui.cards.usage.title") }),
|
|
530
531
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
531
532
|
] }),
|
|
532
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
533
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
533
534
|
] });
|
|
534
535
|
}
|
|
535
536
|
const totalUsage = Object.values(summaries).reduce((acc, summary) => {
|
|
@@ -537,12 +538,12 @@ function BillingUsageSummaryCard({
|
|
|
537
538
|
}, 0);
|
|
538
539
|
const primaryMeter = meters.find((m) => _optionalChain([summaries, 'access', _17 => _17[m.id], 'optionalAccess', _18 => _18.aggregatedValue]));
|
|
539
540
|
const primarySummary = primaryMeter ? summaries[primaryMeter.id] : null;
|
|
540
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
541
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
542
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
541
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewDetailsClick, children: [
|
|
542
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
543
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.CardTitle, { children: t("billing.ui.cards.usage.title") }),
|
|
543
544
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
544
545
|
] }),
|
|
545
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
546
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.CardContent, { children: meters.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
546
547
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: t("billing.ui.cards.usage.no_meters") }),
|
|
547
548
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.usage.no_meters_description") })
|
|
548
549
|
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
@@ -599,7 +600,7 @@ function PaymentMethodForm({
|
|
|
599
600
|
const fetchSetupIntent = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
600
601
|
setLoading(true);
|
|
601
602
|
try {
|
|
602
|
-
const intent = await
|
|
603
|
+
const intent = await _chunk3CSPHMVKjs.StripeCustomerService.createSetupIntent();
|
|
603
604
|
setSetupIntent(intent);
|
|
604
605
|
} catch (err) {
|
|
605
606
|
console.error("[PaymentMethodForm] Failed to create setup intent:", err);
|
|
@@ -637,7 +638,7 @@ function PaymentMethodForm({
|
|
|
637
638
|
return;
|
|
638
639
|
}
|
|
639
640
|
if ((alwaysSetDefault || setAsDefault) && _optionalChain([confirmedSetupIntent, 'optionalAccess', _19 => _19.payment_method])) {
|
|
640
|
-
await
|
|
641
|
+
await _chunk3CSPHMVKjs.StripeCustomerService.setDefaultPaymentMethod({
|
|
641
642
|
paymentMethodId: typeof confirmedSetupIntent.payment_method === "string" ? confirmedSetupIntent.payment_method : confirmedSetupIntent.payment_method.id
|
|
642
643
|
});
|
|
643
644
|
}
|
|
@@ -653,7 +654,7 @@ function PaymentMethodForm({
|
|
|
653
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") }) });
|
|
654
655
|
}
|
|
655
656
|
if (!setupIntent && error) {
|
|
656
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
657
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.AlertDescription, { children: error }) });
|
|
657
658
|
}
|
|
658
659
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: handleSubmit, className: "flex flex-col gap-y-4", children: [
|
|
659
660
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rounded-md border border-gray-300 p-3", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -677,19 +678,19 @@ function PaymentMethodForm({
|
|
|
677
678
|
) }),
|
|
678
679
|
!alwaysSetDefault && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
679
680
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
680
|
-
|
|
681
|
+
_chunkEXG4ANC7js.Checkbox,
|
|
681
682
|
{
|
|
682
683
|
id: "setAsDefault",
|
|
683
684
|
checked: setAsDefault,
|
|
684
685
|
onCheckedChange: (checked) => setSetAsDefault(!!checked)
|
|
685
686
|
}
|
|
686
687
|
),
|
|
687
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
688
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Label, { htmlFor: "setAsDefault", className: "cursor-pointer font-normal", children: t("billing.ui.payment_form.set_default") })
|
|
688
689
|
] }),
|
|
689
|
-
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
690
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.AlertDescription, { children: error }) }),
|
|
690
691
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-x-2", children: [
|
|
691
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
692
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
692
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Button, { type: "button", variant: "outline", onClick: onCancel, disabled: isSubmitting || isLoading, children: t("ui.buttons.cancel") }),
|
|
693
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Button, { type: "submit", disabled: !stripe || isSubmitting || isLoading, children: isSubmitting ? t("billing.ui.wizard.review.processing") : t("billing.ui.cards.payment_method.add_card") })
|
|
693
694
|
] })
|
|
694
695
|
] });
|
|
695
696
|
}
|
|
@@ -706,10 +707,10 @@ function PaymentMethodEditor({ open, onOpenChange, onSuccess }) {
|
|
|
706
707
|
const handleCancel = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
707
708
|
onOpenChange(false);
|
|
708
709
|
}, "handleCancel");
|
|
709
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
710
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
711
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
712
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
710
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.DialogContent, { className: "max-w-md", children: [
|
|
711
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.DialogHeader, { children: [
|
|
712
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.DialogTitle, { children: t("billing.ui.payment_methods.add") }),
|
|
713
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.DialogDescription, { children: t("billing.ui.payment_methods.add_description") })
|
|
713
714
|
] }),
|
|
714
715
|
open && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodForm, { onSuccess: handleSuccess, onCancel: handleCancel })
|
|
715
716
|
] }) });
|
|
@@ -735,7 +736,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
735
736
|
_react.useEffect.call(void 0, () => {
|
|
736
737
|
const loadCustomer = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
737
738
|
try {
|
|
738
|
-
const fetchedCustomer = await
|
|
739
|
+
const fetchedCustomer = await _chunk3CSPHMVKjs.StripeCustomerService.getCustomer();
|
|
739
740
|
setCustomer(fetchedCustomer);
|
|
740
741
|
} catch (error) {
|
|
741
742
|
console.error("[PaymentMethodCard] Failed to load customer:", error);
|
|
@@ -752,7 +753,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
752
753
|
const handleSetDefault = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
753
754
|
setLoading(true);
|
|
754
755
|
try {
|
|
755
|
-
await
|
|
756
|
+
await _chunk3CSPHMVKjs.StripeCustomerService.setDefaultPaymentMethod({ paymentMethodId: paymentMethod.id });
|
|
756
757
|
onUpdate();
|
|
757
758
|
} catch (error) {
|
|
758
759
|
console.error("[PaymentMethodCard] Failed to set as default:", error);
|
|
@@ -763,7 +764,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
763
764
|
const handleRemove = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
764
765
|
setLoading(true);
|
|
765
766
|
try {
|
|
766
|
-
await
|
|
767
|
+
await _chunk3CSPHMVKjs.StripeCustomerService.removePaymentMethod({ paymentMethodId: paymentMethod.id });
|
|
767
768
|
setShowRemoveDialog(false);
|
|
768
769
|
onUpdate();
|
|
769
770
|
} catch (error) {
|
|
@@ -772,16 +773,16 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
772
773
|
}
|
|
773
774
|
}, "handleRemove");
|
|
774
775
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
775
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
776
|
-
isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
777
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
776
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.Card, { className: "relative", children: [
|
|
777
|
+
isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Badge, { variant: "softGreen", className: "absolute end-2 top-2", children: t("billing.ui.payment_methods.default") }),
|
|
778
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.CardHeader, { className: "flex flex-row items-center justify-between pb-2", children: [
|
|
778
779
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
779
780
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-2xl", children: brandIcon }),
|
|
780
781
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium capitalize", children: brand })
|
|
781
782
|
] }),
|
|
782
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
783
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
784
|
-
|
|
783
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.DropdownMenu, { children: [
|
|
784
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.DropdownMenuTrigger, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
785
|
+
_chunkEXG4ANC7js.Button,
|
|
785
786
|
{
|
|
786
787
|
render: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {}),
|
|
787
788
|
nativeButton: false,
|
|
@@ -792,10 +793,10 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
792
793
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.MoreVertical, { className: "h-4 w-4" })
|
|
793
794
|
}
|
|
794
795
|
) }),
|
|
795
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
796
|
-
!isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
796
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.DropdownMenuContent, { align: "end", children: [
|
|
797
|
+
!isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.DropdownMenuItem, { onClick: handleSetDefault, disabled: loading, children: t("billing.ui.payment_methods.set_default") }),
|
|
797
798
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
798
|
-
|
|
799
|
+
_chunkEXG4ANC7js.DropdownMenuItem,
|
|
799
800
|
{
|
|
800
801
|
onClick: () => setShowRemoveDialog(true),
|
|
801
802
|
disabled: loading,
|
|
@@ -806,7 +807,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
806
807
|
] })
|
|
807
808
|
] })
|
|
808
809
|
] }),
|
|
809
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
810
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-1", children: [
|
|
810
811
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-lg font-semibold", children: [
|
|
811
812
|
"\u2022\u2022\u2022\u2022 ",
|
|
812
813
|
last4
|
|
@@ -814,17 +815,17 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
814
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}` }) })
|
|
815
816
|
] }) })
|
|
816
817
|
] }),
|
|
817
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
818
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
819
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
820
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
818
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.AlertDialog, { open: showRemoveDialog, onOpenChange: setShowRemoveDialog, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.AlertDialogContent, { children: [
|
|
819
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.AlertDialogHeader, { children: [
|
|
820
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.AlertDialogTitle, { children: t("billing.ui.payment_methods.remove_title") }),
|
|
821
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.AlertDialogDescription, { children: [
|
|
821
822
|
t("billing.ui.payment_methods.remove_description"),
|
|
822
823
|
isDefault && ` ${t("billing.ui.payment_methods.remove_default_warning")}`
|
|
823
824
|
] })
|
|
824
825
|
] }),
|
|
825
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
826
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
827
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
826
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.AlertDialogFooter, { children: [
|
|
827
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.AlertDialogCancel, { disabled: loading, children: t("ui.buttons.cancel") }),
|
|
828
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.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") })
|
|
828
829
|
] })
|
|
829
830
|
] }) })
|
|
830
831
|
] });
|
|
@@ -848,7 +849,7 @@ function PaymentMethodsContainer() {
|
|
|
848
849
|
const loadPaymentMethods = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
849
850
|
setLoading(true);
|
|
850
851
|
try {
|
|
851
|
-
const fetchedPaymentMethods = await
|
|
852
|
+
const fetchedPaymentMethods = await _chunk3CSPHMVKjs.StripeCustomerService.listPaymentMethods();
|
|
852
853
|
setPaymentMethods(fetchedPaymentMethods);
|
|
853
854
|
} catch (error) {
|
|
854
855
|
console.error("[PaymentMethodsContainer] Failed to load payment methods:", error);
|
|
@@ -868,14 +869,14 @@ function PaymentMethodsContainer() {
|
|
|
868
869
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8" }),
|
|
869
870
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: t("billing.ui.payment_methods.title") })
|
|
870
871
|
] }),
|
|
871
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
872
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Button, { onClick: () => setShowAddPaymentMethod(true), children: t("billing.ui.payment_methods.add") })
|
|
872
873
|
] }),
|
|
873
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: [
|
|
874
875
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-16 w-16 text-muted-foreground" }),
|
|
875
876
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
876
877
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "mb-2 text-sm font-medium", children: t("billing.ui.payment_methods.empty_title") }),
|
|
877
878
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mb-4 text-muted-foreground", children: t("billing.ui.payment_methods.empty_description") }),
|
|
878
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
879
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Button, { onClick: () => setShowAddPaymentMethod(true), children: t("billing.ui.payment_methods.add_first") })
|
|
879
880
|
] })
|
|
880
881
|
] }),
|
|
881
882
|
paymentMethods.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodsList, { paymentMethods, onUpdate: loadPaymentMethods }),
|
|
@@ -931,7 +932,7 @@ var statusConfig = {
|
|
|
931
932
|
function InvoiceStatusBadge({ status }) {
|
|
932
933
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
933
934
|
const config = statusConfig[status] || statusConfig["draft" /* DRAFT */];
|
|
934
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
935
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Badge, { variant: config.variant, children: t(config.label) });
|
|
935
936
|
}
|
|
936
937
|
_chunk7QVYU63Ejs.__name.call(void 0, InvoiceStatusBadge, "InvoiceStatusBadge");
|
|
937
938
|
|
|
@@ -944,7 +945,7 @@ function InvoiceDetails({
|
|
|
944
945
|
onInvoiceChange: _onInvoiceChange
|
|
945
946
|
}) {
|
|
946
947
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
947
|
-
const fmt =
|
|
948
|
+
const fmt = _chunkEXG4ANC7js.useBillingFormatOptions.call(void 0, );
|
|
948
949
|
const handleDownloadPDF = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
949
950
|
if (invoice.stripePdfUrl) {
|
|
950
951
|
window.open(invoice.stripePdfUrl, "_blank");
|
|
@@ -964,10 +965,10 @@ function InvoiceDetails({
|
|
|
964
965
|
return invoice.stripeInvoiceId.slice(-8);
|
|
965
966
|
}, "getInvoiceNumber");
|
|
966
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");
|
|
967
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
968
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
969
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
970
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
968
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.DialogContent, { className: "max-w-2xl", children: [
|
|
969
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.DialogHeader, { children: [
|
|
970
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.DialogTitle, { children: t("billing.ui.invoice.title", { number: getInvoiceNumber() }) }),
|
|
971
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.DialogDescription, { children: _chunkEXG4ANC7js.formatDate.call(void 0, invoice.periodStart, fmt) })
|
|
971
972
|
] }),
|
|
972
973
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
973
974
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
@@ -978,18 +979,18 @@ function InvoiceDetails({
|
|
|
978
979
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
979
980
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.billing_period") }),
|
|
980
981
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm", children: [
|
|
981
|
-
|
|
982
|
+
_chunkEXG4ANC7js.formatDate.call(void 0, invoice.periodStart, fmt),
|
|
982
983
|
" - ",
|
|
983
|
-
|
|
984
|
+
_chunkEXG4ANC7js.formatDate.call(void 0, invoice.periodEnd, fmt)
|
|
984
985
|
] })
|
|
985
986
|
] }),
|
|
986
987
|
invoice.dueDate && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
987
988
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.due_date") }),
|
|
988
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm", children:
|
|
989
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm", children: _chunkEXG4ANC7js.formatDate.call(void 0, invoice.dueDate, fmt) })
|
|
989
990
|
] }),
|
|
990
991
|
invoice.paidAt && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
991
992
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.paid_date") }),
|
|
992
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm", children:
|
|
993
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm", children: _chunkEXG4ANC7js.formatDate.call(void 0, invoice.paidAt, fmt) })
|
|
993
994
|
] }),
|
|
994
995
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
995
996
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.attempt_count") }),
|
|
@@ -1005,42 +1006,42 @@ function InvoiceDetails({
|
|
|
1005
1006
|
] }) }),
|
|
1006
1007
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "tbody", { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "tr", { className: "border-t", children: [
|
|
1007
1008
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "td", { className: "p-3", children: productName }),
|
|
1008
|
-
/* @__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: _chunk3CSPHMVKjs.formatCurrency.call(void 0, invoice.subtotal, invoice.currency, fmt) })
|
|
1009
1010
|
] }) })
|
|
1010
1011
|
] }) })
|
|
1011
1012
|
] }),
|
|
1012
1013
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2 border-t pt-4", children: [
|
|
1013
1014
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1014
1015
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.subtotal") }),
|
|
1015
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children:
|
|
1016
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children: _chunk3CSPHMVKjs.formatCurrency.call(void 0, invoice.subtotal, invoice.currency, fmt) })
|
|
1016
1017
|
] }),
|
|
1017
1018
|
invoice.tax !== void 0 && invoice.tax > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1018
1019
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.tax") }),
|
|
1019
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children:
|
|
1020
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children: _chunk3CSPHMVKjs.formatCurrency.call(void 0, invoice.tax, invoice.currency, fmt) })
|
|
1020
1021
|
] }),
|
|
1021
1022
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between text-lg font-semibold border-t pt-2", children: [
|
|
1022
1023
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: t("billing.ui.invoice.total") }),
|
|
1023
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children:
|
|
1024
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _chunk3CSPHMVKjs.formatCurrency.call(void 0, invoice.total, invoice.currency, fmt) })
|
|
1024
1025
|
] }),
|
|
1025
1026
|
invoice.amountPaid > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1026
1027
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.amount_paid") }),
|
|
1027
|
-
/* @__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: _chunk3CSPHMVKjs.formatCurrency.call(void 0, invoice.amountPaid, invoice.currency, fmt) })
|
|
1028
1029
|
] }),
|
|
1029
1030
|
invoice.amountRemaining > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1030
1031
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.amount_due") }),
|
|
1031
|
-
/* @__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: _chunk3CSPHMVKjs.formatCurrency.call(void 0, invoice.amountRemaining, invoice.currency, fmt) })
|
|
1032
1033
|
] })
|
|
1033
1034
|
] }),
|
|
1034
1035
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2 pt-4 border-t", children: [
|
|
1035
|
-
invoice.stripePdfUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1036
|
+
invoice.stripePdfUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.Button, { variant: "outline", onClick: handleDownloadPDF, children: [
|
|
1036
1037
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Download, { className: "me-2 h-4 w-4" }),
|
|
1037
1038
|
t("billing.ui.invoice.download_pdf")
|
|
1038
1039
|
] }),
|
|
1039
|
-
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, _chunkEXG4ANC7js.Button, { variant: "default", onClick: handleRetryPayment, children: [
|
|
1040
1041
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RefreshCw, { className: "me-2 h-4 w-4" }),
|
|
1041
1042
|
t("billing.ui.invoice.retry_payment")
|
|
1042
1043
|
] }),
|
|
1043
|
-
invoice.stripeHostedInvoiceUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1044
|
+
invoice.stripeHostedInvoiceUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.Button, { variant: "outline", onClick: handleViewInStripe, children: [
|
|
1044
1045
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ExternalLink, { className: "me-2 h-4 w-4" }),
|
|
1045
1046
|
t("billing.ui.invoice.view_in_stripe")
|
|
1046
1047
|
] })
|
|
@@ -1054,7 +1055,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, InvoiceDetails, "InvoiceDetails");
|
|
|
1054
1055
|
|
|
1055
1056
|
function InvoicesList({ invoices, onInvoicesChange }) {
|
|
1056
1057
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1057
|
-
const fmt =
|
|
1058
|
+
const fmt = _chunkEXG4ANC7js.useBillingFormatOptions.call(void 0, );
|
|
1058
1059
|
const [selectedInvoice, setSelectedInvoice] = _react.useState.call(void 0, null);
|
|
1059
1060
|
const handleRowClick = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (invoice) => {
|
|
1060
1061
|
setSelectedInvoice(invoice);
|
|
@@ -1066,30 +1067,30 @@ function InvoicesList({ invoices, onInvoicesChange }) {
|
|
|
1066
1067
|
return invoice.stripeInvoiceId.slice(-8);
|
|
1067
1068
|
}, "getInvoiceNumber");
|
|
1068
1069
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1069
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1070
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1071
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1072
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1073
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1074
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1075
|
-
/* @__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, _chunkEXG4ANC7js.Table, { children: [
|
|
1071
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.TableRow, { children: [
|
|
1072
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TableHead, { children: t("billing.ui.columns.invoice_number") }),
|
|
1073
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TableHead, { children: t("billing.ui.columns.date") }),
|
|
1074
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TableHead, { children: t("billing.ui.columns.status") }),
|
|
1075
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TableHead, { className: "text-end", children: t("billing.ui.columns.amount") }),
|
|
1076
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TableHead, { children: t("billing.ui.columns.period") })
|
|
1076
1077
|
] }) }),
|
|
1077
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1078
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TableBody, { children: invoices.map((invoice) => {
|
|
1078
1079
|
const invoiceNumber = getInvoiceNumber(invoice);
|
|
1079
|
-
const date =
|
|
1080
|
-
const amount =
|
|
1081
|
-
const period = `${
|
|
1080
|
+
const date = _chunkEXG4ANC7js.formatDate.call(void 0, invoice.periodStart, fmt);
|
|
1081
|
+
const amount = _chunk3CSPHMVKjs.formatCurrency.call(void 0, invoice.total, invoice.currency, fmt);
|
|
1082
|
+
const period = `${_chunkEXG4ANC7js.formatDate.call(void 0, invoice.periodStart, fmt)} - ${_chunkEXG4ANC7js.formatDate.call(void 0, invoice.periodEnd, fmt)}`;
|
|
1082
1083
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1083
|
-
|
|
1084
|
+
_chunkEXG4ANC7js.TableRow,
|
|
1084
1085
|
{
|
|
1085
1086
|
onClick: () => handleRowClick(invoice),
|
|
1086
1087
|
className: "cursor-pointer hover:bg-muted/50",
|
|
1087
1088
|
children: [
|
|
1088
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1089
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1090
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1091
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1092
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1089
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TableCell, { className: "font-medium", children: invoiceNumber }),
|
|
1090
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TableCell, { className: "text-muted-foreground text-xs", children: date }),
|
|
1091
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InvoiceStatusBadge, { status: invoice.status }) }),
|
|
1092
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TableCell, { className: "text-end font-medium", children: amount }),
|
|
1093
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TableCell, { className: "text-muted-foreground text-xs", children: period })
|
|
1093
1094
|
]
|
|
1094
1095
|
},
|
|
1095
1096
|
invoice.id
|
|
@@ -1123,7 +1124,7 @@ function InvoicesContainer() {
|
|
|
1123
1124
|
setLoading(true);
|
|
1124
1125
|
try {
|
|
1125
1126
|
const params = statusFilter !== "all" ? { status: statusFilter } : void 0;
|
|
1126
|
-
const data = await
|
|
1127
|
+
const data = await _chunk3CSPHMVKjs.StripeInvoiceService.listInvoices(params);
|
|
1127
1128
|
setInvoices(data);
|
|
1128
1129
|
} catch (error) {
|
|
1129
1130
|
console.error("[InvoicesContainer] Failed to load invoices:", error);
|
|
@@ -1139,12 +1140,12 @@ function InvoicesContainer() {
|
|
|
1139
1140
|
setStatusFilter(value);
|
|
1140
1141
|
}, "handleFilterChange");
|
|
1141
1142
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-4", children: [
|
|
1142
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1143
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1144
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1145
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1146
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1147
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1143
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Tabs, { value: statusFilter, onValueChange: handleFilterChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.TabsList, { children: [
|
|
1144
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TabsTrigger, { value: "all", children: t("billing.ui.invoices.filter_all") }),
|
|
1145
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TabsTrigger, { value: "paid" /* PAID */, children: t("billing.ui.invoice_status.paid") }),
|
|
1146
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TabsTrigger, { value: "open" /* OPEN */, children: t("billing.ui.invoice_status.open") }),
|
|
1147
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TabsTrigger, { value: "void" /* VOID */, children: t("billing.ui.invoice_status.void") }),
|
|
1148
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TabsTrigger, { value: "uncollectible" /* UNCOLLECTIBLE */, children: t("billing.ui.invoice_status.uncollectible") })
|
|
1148
1149
|
] }) }),
|
|
1149
1150
|
loading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-center py-8 text-muted-foreground", children: t("billing.ui.invoices.loading") }),
|
|
1150
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: [
|
|
@@ -1186,7 +1187,7 @@ function CancelSubscriptionDialog({
|
|
|
1186
1187
|
onSuccess
|
|
1187
1188
|
}) {
|
|
1188
1189
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1189
|
-
const fmt =
|
|
1190
|
+
const fmt = _chunkEXG4ANC7js.useBillingFormatOptions.call(void 0, );
|
|
1190
1191
|
const [isSubmitting, setIsSubmitting] = _react.useState.call(void 0, false);
|
|
1191
1192
|
const form = _reacthookform.useForm.call(void 0, {
|
|
1192
1193
|
resolver: _zod.zodResolver.call(void 0, formSchema),
|
|
@@ -1197,7 +1198,7 @@ function CancelSubscriptionDialog({
|
|
|
1197
1198
|
const onSubmit = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async (_values) => {
|
|
1198
1199
|
setIsSubmitting(true);
|
|
1199
1200
|
try {
|
|
1200
|
-
await
|
|
1201
|
+
await _chunk3CSPHMVKjs.StripeSubscriptionService.cancelSubscription({
|
|
1201
1202
|
id: subscription.id,
|
|
1202
1203
|
cancelImmediately: false
|
|
1203
1204
|
});
|
|
@@ -1209,16 +1210,16 @@ function CancelSubscriptionDialog({
|
|
|
1209
1210
|
setIsSubmitting(false);
|
|
1210
1211
|
}
|
|
1211
1212
|
}, "onSubmit");
|
|
1212
|
-
const periodEndDate =
|
|
1213
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1214
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1215
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1216
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1213
|
+
const periodEndDate = _chunkEXG4ANC7js.formatDate.call(void 0, subscription.currentPeriodEnd, fmt);
|
|
1214
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.DialogContent, { className: "max-w-md", children: [
|
|
1215
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.DialogHeader, { children: [
|
|
1216
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.DialogTitle, { children: t("billing.ui.subscription.cancel.title") }),
|
|
1217
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.DialogDescription, { children: t("billing.ui.subscription.cancel.description") })
|
|
1217
1218
|
] }),
|
|
1218
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1219
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-col gap-y-4", children: [
|
|
1219
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 }) }),
|
|
1220
1221
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1221
|
-
|
|
1222
|
+
_chunkEXG4ANC7js.FormTextarea,
|
|
1222
1223
|
{
|
|
1223
1224
|
form,
|
|
1224
1225
|
id: "reason",
|
|
@@ -1228,8 +1229,8 @@ function CancelSubscriptionDialog({
|
|
|
1228
1229
|
}
|
|
1229
1230
|
),
|
|
1230
1231
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-x-2 justify-end pt-2", children: [
|
|
1231
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1232
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1232
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Button, { type: "button", variant: "outline", onClick: () => onOpenChange(false), disabled: isSubmitting, children: t("billing.ui.subscription.cancel.keep") }),
|
|
1233
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Button, { type: "submit", variant: "destructive", disabled: isSubmitting, children: isSubmitting ? t("billing.ui.subscription.cancel.canceling") : t("billing.ui.subscription.cancel.confirm") })
|
|
1233
1234
|
] })
|
|
1234
1235
|
] }) })
|
|
1235
1236
|
] }) });
|
|
@@ -1280,7 +1281,7 @@ var cancelingConfig = {
|
|
|
1280
1281
|
function SubscriptionStatusBadge({ status, cancelAtPeriodEnd }) {
|
|
1281
1282
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1282
1283
|
const config = cancelAtPeriodEnd ? cancelingConfig : statusConfig2[status] || statusConfig2["canceled" /* CANCELED */];
|
|
1283
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1284
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Badge, { variant: config.variant, children: t(config.label) });
|
|
1284
1285
|
}
|
|
1285
1286
|
_chunk7QVYU63Ejs.__name.call(void 0, SubscriptionStatusBadge, "SubscriptionStatusBadge");
|
|
1286
1287
|
|
|
@@ -1307,7 +1308,7 @@ function formatPlanName2(price, t) {
|
|
|
1307
1308
|
_chunk7QVYU63Ejs.__name.call(void 0, formatPlanName2, "formatPlanName");
|
|
1308
1309
|
function formatBillingAmount(price, notAvailable, fmt) {
|
|
1309
1310
|
if (!_optionalChain([price, 'optionalAccess', _37 => _37.unitAmount])) return notAvailable;
|
|
1310
|
-
return
|
|
1311
|
+
return _chunk3CSPHMVKjs.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt);
|
|
1311
1312
|
}
|
|
1312
1313
|
_chunk7QVYU63Ejs.__name.call(void 0, formatBillingAmount, "formatBillingAmount");
|
|
1313
1314
|
function SubscriptionDetails({
|
|
@@ -1318,13 +1319,13 @@ function SubscriptionDetails({
|
|
|
1318
1319
|
onChangePlan
|
|
1319
1320
|
}) {
|
|
1320
1321
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1321
|
-
const fmt =
|
|
1322
|
+
const fmt = _chunkEXG4ANC7js.useBillingFormatOptions.call(void 0, );
|
|
1322
1323
|
const [showCancel, setShowCancel] = _react.useState.call(void 0, false);
|
|
1323
1324
|
const [isProcessing, setIsProcessing] = _react.useState.call(void 0, false);
|
|
1324
1325
|
const handlePause = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1325
1326
|
setIsProcessing(true);
|
|
1326
1327
|
try {
|
|
1327
|
-
await
|
|
1328
|
+
await _chunk3CSPHMVKjs.StripeSubscriptionService.pauseSubscription({ subscriptionId: subscription.id });
|
|
1328
1329
|
onSubscriptionChange();
|
|
1329
1330
|
} catch (error) {
|
|
1330
1331
|
console.error("[SubscriptionDetails] Failed to pause subscription:", error);
|
|
@@ -1335,7 +1336,7 @@ function SubscriptionDetails({
|
|
|
1335
1336
|
const handleResume = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1336
1337
|
setIsProcessing(true);
|
|
1337
1338
|
try {
|
|
1338
|
-
await
|
|
1339
|
+
await _chunk3CSPHMVKjs.StripeSubscriptionService.resumeSubscription({ subscriptionId: subscription.id });
|
|
1339
1340
|
onSubscriptionChange();
|
|
1340
1341
|
} catch (error) {
|
|
1341
1342
|
console.error("[SubscriptionDetails] Failed to resume subscription:", error);
|
|
@@ -1345,7 +1346,7 @@ function SubscriptionDetails({
|
|
|
1345
1346
|
}, "handleResume");
|
|
1346
1347
|
const handleManageViaPortal = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1347
1348
|
try {
|
|
1348
|
-
const { url } = await
|
|
1349
|
+
const { url } = await _chunk3CSPHMVKjs.StripeCustomerService.createPortalSession();
|
|
1349
1350
|
window.open(url, "_blank");
|
|
1350
1351
|
} catch (error) {
|
|
1351
1352
|
console.error("[SubscriptionDetails] Failed to create portal session:", error);
|
|
@@ -1355,10 +1356,10 @@ function SubscriptionDetails({
|
|
|
1355
1356
|
const canResume = subscription.status === "paused" /* PAUSED */;
|
|
1356
1357
|
const canCancel = subscription.status === "active" /* ACTIVE */ || subscription.status === "trialing" /* TRIALING */ || subscription.status === "paused" /* PAUSED */;
|
|
1357
1358
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1358
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1359
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1360
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1361
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1359
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.DialogContent, { className: "max-w-2xl", children: [
|
|
1360
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.DialogHeader, { children: [
|
|
1361
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.DialogTitle, { children: t("billing.ui.subscription.details_title") }),
|
|
1362
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.DialogDescription, { children: t("billing.ui.subscription.details_description") })
|
|
1362
1363
|
] }),
|
|
1363
1364
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
1364
1365
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
@@ -1384,24 +1385,24 @@ function SubscriptionDetails({
|
|
|
1384
1385
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "space-y-2", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1385
1386
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.subscription.current_period") }),
|
|
1386
1387
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "text-sm", children: [
|
|
1387
|
-
|
|
1388
|
+
_chunkEXG4ANC7js.formatDate.call(void 0, subscription.currentPeriodStart, fmt),
|
|
1388
1389
|
" - ",
|
|
1389
|
-
|
|
1390
|
+
_chunkEXG4ANC7js.formatDate.call(void 0, subscription.currentPeriodEnd, fmt)
|
|
1390
1391
|
] })
|
|
1391
1392
|
] }) }),
|
|
1392
1393
|
subscription.trialEnd && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1393
1394
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.subscription.trial_ends") }),
|
|
1394
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children:
|
|
1395
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children: _chunkEXG4ANC7js.formatDate.call(void 0, subscription.trialEnd, fmt) })
|
|
1395
1396
|
] }),
|
|
1396
1397
|
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", {
|
|
1397
|
-
date:
|
|
1398
|
+
date: _chunkEXG4ANC7js.formatDate.call(void 0, subscription.currentPeriodEnd, fmt)
|
|
1398
1399
|
}) }) }),
|
|
1399
1400
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2 pt-4 border-t", children: [
|
|
1400
|
-
onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1401
|
-
canPause && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1402
|
-
canResume && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1403
|
-
canCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1404
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1401
|
+
onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Button, { variant: "default", onClick: () => onChangePlan(subscription), children: t("billing.ui.subscription.change_plan") }),
|
|
1402
|
+
canPause && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Button, { variant: "outline", onClick: handlePause, disabled: isProcessing, children: isProcessing ? t("billing.ui.subscription.pausing") : t("billing.ui.subscription.pause") }),
|
|
1403
|
+
canResume && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Button, { variant: "outline", onClick: handleResume, disabled: isProcessing, children: isProcessing ? t("billing.ui.subscription.resuming") : t("billing.ui.subscription.resume") }),
|
|
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") })
|
|
1405
1406
|
] })
|
|
1406
1407
|
] })
|
|
1407
1408
|
] }) }),
|
|
@@ -1444,46 +1445,46 @@ function formatPlanName3(price, t) {
|
|
|
1444
1445
|
_chunk7QVYU63Ejs.__name.call(void 0, formatPlanName3, "formatPlanName");
|
|
1445
1446
|
function SubscriptionsList({ subscriptions, onSubscriptionsChange, onChangePlan }) {
|
|
1446
1447
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1447
|
-
const fmt =
|
|
1448
|
+
const fmt = _chunkEXG4ANC7js.useBillingFormatOptions.call(void 0, );
|
|
1448
1449
|
const [selectedSub, setSelectedSub] = _react.useState.call(void 0, null);
|
|
1449
1450
|
const handleRowClick = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (subscription) => {
|
|
1450
1451
|
setSelectedSub(subscription);
|
|
1451
1452
|
}, "handleRowClick");
|
|
1452
1453
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1453
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1454
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1455
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1456
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1457
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1458
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1459
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1454
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.Table, { children: [
|
|
1455
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.TableRow, { children: [
|
|
1456
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TableHead, { children: t("billing.ui.columns.status") }),
|
|
1457
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TableHead, { children: t("billing.ui.columns.plan") }),
|
|
1458
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TableHead, { children: t("billing.ui.columns.period") }),
|
|
1459
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TableHead, { className: "text-end", children: t("billing.ui.columns.amount") }),
|
|
1460
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TableHead, { className: "text-end", children: t("billing.ui.columns.actions") })
|
|
1460
1461
|
] }) }),
|
|
1461
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1462
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TableBody, { children: subscriptions.map((subscription) => {
|
|
1462
1463
|
const price = subscription.price;
|
|
1463
|
-
const amount = _optionalChain([price, 'optionalAccess', _42 => _42.unitAmount]) ?
|
|
1464
|
-
const discountedAmount = price ?
|
|
1465
|
-
const period = `${
|
|
1464
|
+
const amount = _optionalChain([price, 'optionalAccess', _42 => _42.unitAmount]) ? _chunk3CSPHMVKjs.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt) : "0";
|
|
1465
|
+
const discountedAmount = price ? _chunkEXG4ANC7js.applyDiscount.call(void 0, price.unitAmount, _chunkEXG4ANC7js.subscriptionDiscount.call(void 0, subscription)) : null;
|
|
1466
|
+
const period = `${_chunkEXG4ANC7js.formatDate.call(void 0, subscription.currentPeriodStart, fmt)} - ${_chunkEXG4ANC7js.formatDate.call(void 0, subscription.currentPeriodEnd, fmt)}`;
|
|
1466
1467
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1467
|
-
|
|
1468
|
+
_chunkEXG4ANC7js.TableRow,
|
|
1468
1469
|
{
|
|
1469
1470
|
onClick: () => handleRowClick(subscription),
|
|
1470
1471
|
className: "cursor-pointer hover:bg-muted/50",
|
|
1471
1472
|
children: [
|
|
1472
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1473
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1473
1474
|
SubscriptionStatusBadge,
|
|
1474
1475
|
{
|
|
1475
1476
|
status: subscription.status,
|
|
1476
1477
|
cancelAtPeriodEnd: subscription.cancelAtPeriodEnd
|
|
1477
1478
|
}
|
|
1478
1479
|
) }),
|
|
1479
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1480
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1481
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1480
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TableCell, { className: "font-medium", children: formatPlanName3(price, t) }),
|
|
1481
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TableCell, { className: "text-muted-foreground text-sm", children: period }),
|
|
1482
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TableCell, { className: "text-end font-medium", children: discountedAmount !== null && price ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1482
1483
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "line-through text-muted-foreground me-2", children: amount }),
|
|
1483
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success", children:
|
|
1484
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success", children: _chunk3CSPHMVKjs.formatCurrency.call(void 0, discountedAmount, price.currency, fmt) })
|
|
1484
1485
|
] }) : amount }),
|
|
1485
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1486
|
-
|
|
1486
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TableCell, { className: "text-end", children: (subscription.status === "active" /* ACTIVE */ || subscription.status === "trialing" /* TRIALING */) && onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1487
|
+
_chunkEXG4ANC7js.Button,
|
|
1487
1488
|
{
|
|
1488
1489
|
size: "sm",
|
|
1489
1490
|
variant: "outline",
|
|
@@ -1541,7 +1542,7 @@ function SubscriptionsContainer({
|
|
|
1541
1542
|
}
|
|
1542
1543
|
setLoading(true);
|
|
1543
1544
|
try {
|
|
1544
|
-
const fetchedSubscriptions = await
|
|
1545
|
+
const fetchedSubscriptions = await _chunk3CSPHMVKjs.StripeSubscriptionService.listSubscriptions();
|
|
1545
1546
|
setSubscriptions(fetchedSubscriptions);
|
|
1546
1547
|
} catch (error) {
|
|
1547
1548
|
console.error("[SubscriptionsContainer] Failed to load subscriptions:", error);
|
|
@@ -1564,7 +1565,7 @@ function SubscriptionsContainer({
|
|
|
1564
1565
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8" }),
|
|
1565
1566
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: t("billing.ui.subscriptions.title") })
|
|
1566
1567
|
] }),
|
|
1567
|
-
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1568
|
+
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _44 => _44()]), children: hasActiveRecurringSubscription ? t("billing.ui.subscriptions.purchase_addons") : t("billing.ui.subscriptions.subscribe") })
|
|
1568
1569
|
] }),
|
|
1569
1570
|
criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BillingAlertBanner, { subscription }, subscription.id)),
|
|
1570
1571
|
subscriptions.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col items-center justify-center py-12 space-y-4", children: [
|
|
@@ -1572,7 +1573,7 @@ function SubscriptionsContainer({
|
|
|
1572
1573
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
1573
1574
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium mb-2", children: t("billing.ui.subscriptions.empty_title") }),
|
|
1574
1575
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground mb-6", children: t("billing.ui.subscriptions.empty_description") }),
|
|
1575
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1576
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _45 => _45()]), children: t("billing.ui.subscriptions.subscribe") })
|
|
1576
1577
|
] })
|
|
1577
1578
|
] }),
|
|
1578
1579
|
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -1595,9 +1596,9 @@ function IntervalToggle({ value, onChange, hasMonthly, hasYearly }) {
|
|
|
1595
1596
|
if (!hasMonthly || !hasYearly) {
|
|
1596
1597
|
return null;
|
|
1597
1598
|
}
|
|
1598
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1599
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1600
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1599
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Tabs, { value, onValueChange: (v) => onChange(v), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.TabsList, { children: [
|
|
1600
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TabsTrigger, { value: "month", children: t("billing.admin.prices.interval.month") }),
|
|
1601
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TabsTrigger, { value: "year", children: t("billing.admin.prices.interval.year") })
|
|
1601
1602
|
] }) });
|
|
1602
1603
|
}
|
|
1603
1604
|
_chunk7QVYU63Ejs.__name.call(void 0, IntervalToggle, "IntervalToggle");
|
|
@@ -1615,11 +1616,11 @@ function PricingCard({
|
|
|
1615
1616
|
onSelect
|
|
1616
1617
|
}) {
|
|
1617
1618
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1618
|
-
const fmt =
|
|
1619
|
+
const fmt = _chunkEXG4ANC7js.useBillingFormatOptions.call(void 0, );
|
|
1619
1620
|
const description = price.description || price.nickname || t("billing.ui.pricing.standard");
|
|
1620
1621
|
const features = price.features || [];
|
|
1621
|
-
const formattedPrice =
|
|
1622
|
-
const interval =
|
|
1622
|
+
const formattedPrice = _chunk3CSPHMVKjs.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt);
|
|
1623
|
+
const interval = _chunk3CSPHMVKjs.formatInterval.call(void 0, price, fmt);
|
|
1623
1624
|
const handleKeyDown = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (e) => {
|
|
1624
1625
|
if ((e.key === "Enter" || e.key === " ") && !isDisabled && !isCurrentPlan) {
|
|
1625
1626
|
e.preventDefault();
|
|
@@ -1632,7 +1633,7 @@ function PricingCard({
|
|
|
1632
1633
|
}
|
|
1633
1634
|
}, "handleClick");
|
|
1634
1635
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1635
|
-
|
|
1636
|
+
_chunkEXG4ANC7js.Card,
|
|
1636
1637
|
{
|
|
1637
1638
|
role: "radio",
|
|
1638
1639
|
"aria-checked": isSelected,
|
|
@@ -1640,7 +1641,7 @@ function PricingCard({
|
|
|
1640
1641
|
tabIndex: isDisabled ? -1 : 0,
|
|
1641
1642
|
onKeyDown: handleKeyDown,
|
|
1642
1643
|
onClick: handleClick,
|
|
1643
|
-
className:
|
|
1644
|
+
className: _chunk3CSPHMVKjs.cn.call(void 0,
|
|
1644
1645
|
"relative cursor-pointer transition-all duration-200 flex flex-col h-full",
|
|
1645
1646
|
"focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
1646
1647
|
isCurrentPlan && "bg-muted/30",
|
|
@@ -1650,9 +1651,9 @@ function PricingCard({
|
|
|
1650
1651
|
isLoading && "pointer-events-none"
|
|
1651
1652
|
),
|
|
1652
1653
|
children: [
|
|
1653
|
-
isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1654
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1655
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1654
|
+
isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Badge, { variant: "secondary", className: "absolute top-2 end-2", children: t("billing.ui.pricing.current") }),
|
|
1655
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.CardHeader, { className: "pb-2", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium", children: description }) }),
|
|
1656
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.CardContent, { className: "pb-4 grow", children: [
|
|
1656
1657
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mb-4", children: [
|
|
1657
1658
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-3xl font-bold", children: formattedPrice }),
|
|
1658
1659
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground ms-1", children: interval })
|
|
@@ -1662,8 +1663,8 @@ function PricingCard({
|
|
|
1662
1663
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-muted-foreground", children: feature })
|
|
1663
1664
|
] }, index)) })
|
|
1664
1665
|
] }),
|
|
1665
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1666
|
-
|
|
1666
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.CardFooter, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1667
|
+
_chunkEXG4ANC7js.Button,
|
|
1667
1668
|
{
|
|
1668
1669
|
variant: isCurrentPlan ? "secondary" : isSelected ? "default" : "outline",
|
|
1669
1670
|
className: "w-full",
|
|
@@ -1696,7 +1697,7 @@ function ProductPricingRow({
|
|
|
1696
1697
|
return null;
|
|
1697
1698
|
}
|
|
1698
1699
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-3", children: [
|
|
1699
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1700
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.SectionHeader, { children: product.name }),
|
|
1700
1701
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1701
1702
|
"div",
|
|
1702
1703
|
{
|
|
@@ -1797,15 +1798,15 @@ function ProductPricingList({
|
|
|
1797
1798
|
_chunk7QVYU63Ejs.__name.call(void 0, ProductPricingList, "ProductPricingList");
|
|
1798
1799
|
function ProductPricingListSkeleton() {
|
|
1799
1800
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "space-y-6", children: [1, 2].map((rowIndex) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-3", children: [
|
|
1800
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1801
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Skeleton, { className: "h-6 w-32" }),
|
|
1801
1802
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4", children: [1, 2, 3].map((cardIndex) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "p-4 rounded-lg border animate-pulse space-y-3", children: [
|
|
1802
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1803
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1803
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Skeleton, { className: "h-6 w-24" }),
|
|
1804
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Skeleton, { className: "h-8 w-32" }),
|
|
1804
1805
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
1805
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1806
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1806
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Skeleton, { className: "h-4 w-full" }),
|
|
1807
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Skeleton, { className: "h-4 w-3/4" })
|
|
1807
1808
|
] }),
|
|
1808
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1809
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Skeleton, { className: "h-10 w-full" })
|
|
1809
1810
|
] }, cardIndex)) })
|
|
1810
1811
|
] }, rowIndex)) });
|
|
1811
1812
|
}
|
|
@@ -1816,21 +1817,21 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductPricingListSkeleton, "ProductPricing
|
|
|
1816
1817
|
|
|
1817
1818
|
function ProrationPreview({ preview }) {
|
|
1818
1819
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1819
|
-
const fmt =
|
|
1820
|
+
const fmt = _chunkEXG4ANC7js.useBillingFormatOptions.call(void 0, );
|
|
1820
1821
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-primary/10 border-primary/30 rounded-lg border p-4", children: [
|
|
1821
1822
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "text-primary mb-3 font-semibold", children: t("billing.ui.proration.title") }),
|
|
1822
1823
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
1823
1824
|
preview.lineItems.map((item, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between text-sm", children: [
|
|
1824
1825
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground", children: item.description }),
|
|
1825
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `font-medium ${item.amount < 0 ? "text-success" : "text-foreground"}`, children:
|
|
1826
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `font-medium ${item.amount < 0 ? "text-success" : "text-foreground"}`, children: _chunk3CSPHMVKjs.formatCurrency.call(void 0, item.amount, preview.currency, fmt) })
|
|
1826
1827
|
] }, index)),
|
|
1827
1828
|
/* @__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: [
|
|
1828
1829
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-foreground", children: t("billing.ui.proration.net_due_today") }),
|
|
1829
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-foreground", children:
|
|
1830
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-foreground", children: _chunk3CSPHMVKjs.formatCurrency.call(void 0, preview.immediateCharge, preview.currency, fmt) })
|
|
1830
1831
|
] }) }),
|
|
1831
1832
|
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", {
|
|
1832
|
-
date:
|
|
1833
|
-
amount:
|
|
1833
|
+
date: _chunkEXG4ANC7js.formatDate.call(void 0, preview.lineItems[0].period.end, fmt),
|
|
1834
|
+
amount: _chunk3CSPHMVKjs.formatCurrency.call(void 0, preview.amountDue, preview.currency, fmt)
|
|
1834
1835
|
}) })
|
|
1835
1836
|
] })
|
|
1836
1837
|
] });
|
|
@@ -1843,7 +1844,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProrationPreview, "ProrationPreview");
|
|
|
1843
1844
|
|
|
1844
1845
|
function SubscriptionConfirmation({ price, isLoading, onConfirm, onCancel }) {
|
|
1845
1846
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1846
|
-
const fmt =
|
|
1847
|
+
const fmt = _chunkEXG4ANC7js.useBillingFormatOptions.call(void 0, );
|
|
1847
1848
|
const productName = _optionalChain([price, 'access', _51 => _51.product, 'optionalAccess', _52 => _52.name]) || price.nickname || t("billing.ui.wizard.review.selected_plan");
|
|
1848
1849
|
const productDescription = _optionalChain([price, 'access', _53 => _53.product, 'optionalAccess', _54 => _54.description]) || price.description;
|
|
1849
1850
|
const features = price.features || [];
|
|
@@ -1855,16 +1856,16 @@ function SubscriptionConfirmation({ price, isLoading, onConfirm, onCancel }) {
|
|
|
1855
1856
|
productDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-sm text-muted-foreground", children: productDescription })
|
|
1856
1857
|
] }),
|
|
1857
1858
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-lg font-semibold", children: [
|
|
1858
|
-
|
|
1859
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-normal text-muted-foreground", children:
|
|
1859
|
+
_chunk3CSPHMVKjs.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt),
|
|
1860
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-normal text-muted-foreground", children: _chunk3CSPHMVKjs.formatInterval.call(void 0, price, fmt) })
|
|
1860
1861
|
] }),
|
|
1861
1862
|
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: [
|
|
1862
1863
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Check, { className: "h-4 w-4 text-primary" }),
|
|
1863
1864
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: feature })
|
|
1864
1865
|
] }, index)) }),
|
|
1865
1866
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-3 pt-2 border-t border-accent/30", children: [
|
|
1866
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1867
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1867
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Button, { variant: "outline", onClick: onCancel, disabled: isLoading, children: t("ui.buttons.cancel") }),
|
|
1868
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Button, { onClick: onConfirm, disabled: isLoading, children: isLoading ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1868
1869
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "h-4 w-4 animate-spin me-2" }),
|
|
1869
1870
|
t("billing.ui.wizard.review.processing")
|
|
1870
1871
|
] }) : t("billing.ui.confirmation.subscribe") })
|
|
@@ -2043,7 +2044,7 @@ function wizardReducer(state, action) {
|
|
|
2043
2044
|
_chunk7QVYU63Ejs.__name.call(void 0, wizardReducer, "wizardReducer");
|
|
2044
2045
|
function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
2045
2046
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2046
|
-
const locale =
|
|
2047
|
+
const locale = _chunk3CSPHMVKjs.useI18nLocale.call(void 0, );
|
|
2047
2048
|
const { confirmPayment } = useConfirmSubscriptionPayment();
|
|
2048
2049
|
const [state, dispatch] = _react.useReducer.call(void 0, wizardReducer, {
|
|
2049
2050
|
...initialState,
|
|
@@ -2055,7 +2056,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2055
2056
|
onCloseRef.current = onClose;
|
|
2056
2057
|
const checkPaymentMethod = _react.useCallback.call(void 0, async () => {
|
|
2057
2058
|
try {
|
|
2058
|
-
const methods = await
|
|
2059
|
+
const methods = await _chunk3CSPHMVKjs.StripeCustomerService.listPaymentMethods();
|
|
2059
2060
|
dispatch({ type: "SET_HAS_PAYMENT_METHOD", hasMethod: methods.length > 0 });
|
|
2060
2061
|
} catch (error) {
|
|
2061
2062
|
console.error("[useSubscriptionWizard] Failed to check payment methods:", error);
|
|
@@ -2073,10 +2074,10 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2073
2074
|
}, []);
|
|
2074
2075
|
const lookUpAutomaticCode = _react.useCallback.call(void 0, async (priceId) => {
|
|
2075
2076
|
try {
|
|
2076
|
-
const automaticCode = await
|
|
2077
|
+
const automaticCode = await _chunk3CSPHMVKjs.StripeCouponCodeService.findAutomatic({ priceId });
|
|
2077
2078
|
dispatch({
|
|
2078
2079
|
type: "SET_PROMOTION_CODE",
|
|
2079
|
-
code: automaticCode ?
|
|
2080
|
+
code: automaticCode ? _chunk3CSPHMVKjs.toPromotionCodeResult.call(void 0, automaticCode) : null
|
|
2080
2081
|
});
|
|
2081
2082
|
return true;
|
|
2082
2083
|
} catch (error) {
|
|
@@ -2103,7 +2104,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2103
2104
|
const isTrialUpgrade = _optionalChain([subscription, 'optionalAccess', _61 => _61.status]) === "trialing" /* TRIALING */;
|
|
2104
2105
|
dispatch({ type: "SET_IS_TRIAL_SUBSCRIPTION", isTrial: isTrialUpgrade });
|
|
2105
2106
|
if (isTrialUpgrade && !state.hasPaymentMethod) {
|
|
2106
|
-
const methods = await
|
|
2107
|
+
const methods = await _chunk3CSPHMVKjs.StripeCustomerService.listPaymentMethods();
|
|
2107
2108
|
if (methods.length === 0) {
|
|
2108
2109
|
dispatch({ type: "SET_STEP", step: "payment-method" });
|
|
2109
2110
|
dispatch({
|
|
@@ -2121,7 +2122,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2121
2122
|
}
|
|
2122
2123
|
}
|
|
2123
2124
|
if (subscription && state.selectedPrice.id !== _optionalChain([subscription, 'access', _62 => _62.price, 'optionalAccess', _63 => _63.id])) {
|
|
2124
|
-
const preview = await
|
|
2125
|
+
const preview = await _chunk3CSPHMVKjs.StripeSubscriptionService.getProrationPreview({
|
|
2125
2126
|
subscriptionId: subscription.id,
|
|
2126
2127
|
newPriceId: state.selectedPrice.id
|
|
2127
2128
|
});
|
|
@@ -2155,14 +2156,14 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2155
2156
|
newPriceId: state.selectedPrice.id,
|
|
2156
2157
|
promotionCode: promotionCodeToSend(state.promotionCode)
|
|
2157
2158
|
};
|
|
2158
|
-
result = await
|
|
2159
|
+
result = await _chunk3CSPHMVKjs.StripeSubscriptionService.changePlanWithMeta(changePlanParams);
|
|
2159
2160
|
} else {
|
|
2160
2161
|
const createParams = {
|
|
2161
2162
|
id: _uuid.v4.call(void 0, ),
|
|
2162
2163
|
priceId: state.selectedPrice.id,
|
|
2163
2164
|
promotionCode: promotionCodeToSend(state.promotionCode)
|
|
2164
2165
|
};
|
|
2165
|
-
result = await
|
|
2166
|
+
result = await _chunk3CSPHMVKjs.StripeSubscriptionService.createSubscription(createParams);
|
|
2166
2167
|
}
|
|
2167
2168
|
const clientSecret = clientSecretToConfirm(result.meta);
|
|
2168
2169
|
if (clientSecret) {
|
|
@@ -2178,7 +2179,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2178
2179
|
const subscriptionId = subscriptionIdToSync(result.subscription, subscription);
|
|
2179
2180
|
if (subscriptionId) {
|
|
2180
2181
|
try {
|
|
2181
|
-
await
|
|
2182
|
+
await _chunk3CSPHMVKjs.StripeSubscriptionService.syncSubscription({ subscriptionId });
|
|
2182
2183
|
} catch (syncError) {
|
|
2183
2184
|
console.error("[useSubscriptionWizard] Subscription sync after payment failed:", syncError);
|
|
2184
2185
|
}
|
|
@@ -2226,7 +2227,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2226
2227
|
dispatch({ type: "SET_VALIDATING_PROMO_CODE", isValidating: true });
|
|
2227
2228
|
dispatch({ type: "SET_PROMO_CODE_ERROR", error: null });
|
|
2228
2229
|
try {
|
|
2229
|
-
const result = await
|
|
2230
|
+
const result = await _chunk3CSPHMVKjs.StripePromotionCodeService.validatePromotionCode({
|
|
2230
2231
|
code,
|
|
2231
2232
|
stripePriceId: _optionalChain([state, 'access', _72 => _72.selectedPrice, 'optionalAccess', _73 => _73.id]),
|
|
2232
2233
|
language: locale
|
|
@@ -2351,7 +2352,7 @@ function WizardStepPlanSelection({
|
|
|
2351
2352
|
_react.useEffect.call(void 0, () => {
|
|
2352
2353
|
const loadProducts = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2353
2354
|
try {
|
|
2354
|
-
const fetchedProducts = await
|
|
2355
|
+
const fetchedProducts = await _chunk3CSPHMVKjs.StripeProductService.listProducts({ active: true });
|
|
2355
2356
|
setProducts(fetchedProducts);
|
|
2356
2357
|
} catch (error) {
|
|
2357
2358
|
console.error("[WizardStepPlanSelection] Failed to load products:", error);
|
|
@@ -2402,7 +2403,7 @@ function WizardStepPlanSelection({
|
|
|
2402
2403
|
onSelectPrice: handleSelectPrice
|
|
2403
2404
|
}
|
|
2404
2405
|
),
|
|
2405
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex justify-end pt-4 border-t", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2406
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex justify-end pt-4 border-t", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Button, { onClick: onNext, disabled: !selectedPrice || isProcessing, children: isProcessing ? t("common.loading") : t("billing.ui.wizard.next_review") }) })
|
|
2406
2407
|
] });
|
|
2407
2408
|
}
|
|
2408
2409
|
_chunk7QVYU63Ejs.__name.call(void 0, WizardStepPlanSelection, "WizardStepPlanSelection");
|
|
@@ -2426,7 +2427,7 @@ function PromoCodeInput({
|
|
|
2426
2427
|
disabled = false
|
|
2427
2428
|
}) {
|
|
2428
2429
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2429
|
-
const locale =
|
|
2430
|
+
const locale = _chunk3CSPHMVKjs.useI18nLocale.call(void 0, );
|
|
2430
2431
|
const [code, setCode] = _react.useState.call(void 0, "");
|
|
2431
2432
|
const appliedKey = _optionalChain([appliedCode, 'optionalAccess', _82 => _82.valid]) ? `${appliedCode.automatic ? "auto" : "typed"}:${_nullishCoalesce(appliedCode.code, () => ( ""))}` : null;
|
|
2432
2433
|
const [previousAppliedKey, setPreviousAppliedKey] = _react.useState.call(void 0, appliedKey);
|
|
@@ -2455,7 +2456,7 @@ function PromoCodeInput({
|
|
|
2455
2456
|
}
|
|
2456
2457
|
const amount = (result.discountValue || 0) / 100;
|
|
2457
2458
|
const currency = _optionalChain([result, 'access', _83 => _83.currency, 'optionalAccess', _84 => _84.toUpperCase, 'call', _85 => _85()]) || "USD";
|
|
2458
|
-
return t("billing.ui.wizard.review.amount_off", { amount: `${currency} ${
|
|
2459
|
+
return t("billing.ui.wizard.review.amount_off", { amount: `${currency} ${_chunk3CSPHMVKjs.formatFixed.call(void 0, amount, locale, 2)}` });
|
|
2459
2460
|
}, "formatDiscount");
|
|
2460
2461
|
const formatDuration = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (result) => {
|
|
2461
2462
|
switch (result.duration) {
|
|
@@ -2472,7 +2473,7 @@ function PromoCodeInput({
|
|
|
2472
2473
|
const codeInput = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
2473
2474
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
|
|
2474
2475
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2475
|
-
|
|
2476
|
+
_chunkEXG4ANC7js.Input,
|
|
2476
2477
|
{
|
|
2477
2478
|
placeholder: t("billing.ui.promo_code.placeholder"),
|
|
2478
2479
|
value: code,
|
|
@@ -2482,7 +2483,7 @@ function PromoCodeInput({
|
|
|
2482
2483
|
className: "flex-1"
|
|
2483
2484
|
}
|
|
2484
2485
|
),
|
|
2485
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2486
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Button, { variant: "outline", onClick: handleApply, disabled: disabled || isValidating || !code.trim(), children: isValidating ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "h-4 w-4 animate-spin" }) : t("billing.ui.promo_code.apply") })
|
|
2486
2487
|
] }),
|
|
2487
2488
|
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error })
|
|
2488
2489
|
] });
|
|
@@ -2511,7 +2512,7 @@ function PromoCodeInput({
|
|
|
2511
2512
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success text-sm", children: formatDiscount(appliedCode) })
|
|
2512
2513
|
] }),
|
|
2513
2514
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2514
|
-
|
|
2515
|
+
_chunkEXG4ANC7js.Button,
|
|
2515
2516
|
{
|
|
2516
2517
|
variant: "ghost",
|
|
2517
2518
|
size: "sm",
|
|
@@ -2559,7 +2560,7 @@ function WizardStepReview({
|
|
|
2559
2560
|
isTrialUpgrade
|
|
2560
2561
|
}) {
|
|
2561
2562
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2562
|
-
const fmt =
|
|
2563
|
+
const fmt = _chunkEXG4ANC7js.useBillingFormatOptions.call(void 0, );
|
|
2563
2564
|
const [card, setCard] = _react.useState.call(void 0, null);
|
|
2564
2565
|
_react.useEffect.call(void 0, () => {
|
|
2565
2566
|
if (!hasPaymentMethod) {
|
|
@@ -2567,7 +2568,7 @@ function WizardStepReview({
|
|
|
2567
2568
|
return;
|
|
2568
2569
|
}
|
|
2569
2570
|
let cancelled = false;
|
|
2570
|
-
Promise.all([
|
|
2571
|
+
Promise.all([_chunk3CSPHMVKjs.StripeCustomerService.listPaymentMethods(), _chunk3CSPHMVKjs.StripeCustomerService.getCustomer()]).then(([methods, customer]) => {
|
|
2571
2572
|
if (!cancelled) setCard(reviewCard(methods, _optionalChain([customer, 'optionalAccess', _90 => _90.defaultPaymentMethodId])));
|
|
2572
2573
|
}).catch((err) => {
|
|
2573
2574
|
console.error("[WizardStepReview] Failed to load the card on file:", err);
|
|
@@ -2586,24 +2587,24 @@ function WizardStepReview({
|
|
|
2586
2587
|
const interval = _optionalChain([price, 'access', _93 => _93.recurring, 'optionalAccess', _94 => _94.interval]) || "month";
|
|
2587
2588
|
return interval === "year" ? t("billing.ui.wizard.review.interval_yearly") : t("billing.ui.wizard.review.interval_monthly");
|
|
2588
2589
|
}, "formatInterval");
|
|
2589
|
-
const codeDiscount =
|
|
2590
|
-
const carriedDiscount = isChangingPlan && !codeDiscount ?
|
|
2590
|
+
const codeDiscount = _chunkEXG4ANC7js.promotionCodeDiscount.call(void 0, promotionCode);
|
|
2591
|
+
const carriedDiscount = isChangingPlan && !codeDiscount ? _chunkEXG4ANC7js.subscriptionDiscount.call(void 0, subscription) : null;
|
|
2591
2592
|
const discount = _nullishCoalesce(codeDiscount, () => ( carriedDiscount));
|
|
2592
|
-
const discountedPrice =
|
|
2593
|
-
const discountedImmediateCharge =
|
|
2593
|
+
const discountedPrice = _chunkEXG4ANC7js.applyDiscount.call(void 0, selectedPrice.unitAmount, discount);
|
|
2594
|
+
const discountedImmediateCharge = _chunkEXG4ANC7js.applyDiscount.call(void 0, _optionalChain([prorationPreview, 'optionalAccess', _95 => _95.immediateCharge]), discount);
|
|
2594
2595
|
const getDiscountDescription = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
2595
2596
|
if (!discount) return null;
|
|
2596
2597
|
if (discount.discountType === "percent_off") {
|
|
2597
2598
|
return t("billing.ui.wizard.review.percent_off", { value: discount.discountValue });
|
|
2598
2599
|
}
|
|
2599
2600
|
return t("billing.ui.wizard.review.amount_off", {
|
|
2600
|
-
amount:
|
|
2601
|
+
amount: _chunk3CSPHMVKjs.formatCurrency.call(void 0, discount.discountValue, discount.currency || selectedPrice.currency, fmt)
|
|
2601
2602
|
});
|
|
2602
2603
|
}, "getDiscountDescription");
|
|
2603
2604
|
const discountDescription = getDiscountDescription();
|
|
2604
2605
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
2605
2606
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-muted/50 rounded-lg p-4 space-y-3", children: [
|
|
2606
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2607
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.SectionHeader, { children: t("billing.ui.wizard.review.selected_plan") }),
|
|
2607
2608
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between items-center", children: [
|
|
2608
2609
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
2609
2610
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-medium", children: _optionalChain([selectedPrice, 'access', _96 => _96.product, 'optionalAccess', _97 => _97.name]) }),
|
|
@@ -2611,11 +2612,11 @@ function WizardStepReview({
|
|
|
2611
2612
|
] }),
|
|
2612
2613
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-end", children: [
|
|
2613
2614
|
discountedPrice !== null ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2614
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground line-through", children:
|
|
2615
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-success text-lg font-semibold", children:
|
|
2616
|
-
discountDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2615
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground line-through", children: _chunk3CSPHMVKjs.formatCurrency.call(void 0, selectedPrice.unitAmount || 0, selectedPrice.currency, fmt) }),
|
|
2616
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-success text-lg font-semibold", children: _chunk3CSPHMVKjs.formatCurrency.call(void 0, discountedPrice, selectedPrice.currency, fmt) }),
|
|
2617
|
+
discountDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Badge, { variant: "softGreen", children: discountDescription }),
|
|
2617
2618
|
carriedDiscount && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: t("billing.ui.wizard.review.discount_carries_over") })
|
|
2618
|
-
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-semibold text-lg", children:
|
|
2619
|
+
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-semibold text-lg", children: _chunk3CSPHMVKjs.formatCurrency.call(void 0, selectedPrice.unitAmount || 0, selectedPrice.currency, fmt) }),
|
|
2619
2620
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: formatInterval2(selectedPrice) })
|
|
2620
2621
|
] })
|
|
2621
2622
|
] })
|
|
@@ -2630,9 +2631,9 @@ function WizardStepReview({
|
|
|
2630
2631
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between text-sm", children: [
|
|
2631
2632
|
/* @__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") }),
|
|
2632
2633
|
/* @__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: [
|
|
2633
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "line-through text-muted-foreground me-2", children:
|
|
2634
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success", children:
|
|
2635
|
-
] }) :
|
|
2634
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "line-through text-muted-foreground me-2", children: _chunk3CSPHMVKjs.formatCurrency.call(void 0, prorationPreview.immediateCharge, prorationPreview.currency, fmt) }),
|
|
2635
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success", children: _chunk3CSPHMVKjs.formatCurrency.call(void 0, discountedImmediateCharge, prorationPreview.currency, fmt) })
|
|
2636
|
+
] }) : _chunk3CSPHMVKjs.formatCurrency.call(void 0, prorationPreview.immediateCharge, prorationPreview.currency, fmt) })
|
|
2636
2637
|
] })
|
|
2637
2638
|
]
|
|
2638
2639
|
}
|
|
@@ -2656,15 +2657,15 @@ function WizardStepReview({
|
|
|
2656
2657
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "font-medium", children: t("billing.ui.payment_method.title") }),
|
|
2657
2658
|
/* @__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") })
|
|
2658
2659
|
] }),
|
|
2659
|
-
hasPaymentMethod ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2660
|
+
hasPaymentMethod ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Button, { variant: "outline", onClick: onAddPaymentMethod, disabled: isProcessing, children: t("billing.ui.wizard.review.use_another_card") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Button, { variant: "outline", onClick: onAddPaymentMethod, children: t("billing.ui.payment_methods.add") })
|
|
2660
2661
|
] }) }),
|
|
2661
|
-
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2662
|
+
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.Alert, { variant: "destructive", children: [
|
|
2662
2663
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.AlertCircle, { className: "h-4 w-4" }),
|
|
2663
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2664
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.AlertDescription, { children: error })
|
|
2664
2665
|
] }),
|
|
2665
2666
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between pt-4 border-t", children: [
|
|
2666
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2667
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2667
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Button, { variant: "outline", onClick: onBack, disabled: isProcessing, children: t("billing.ui.wizard.back") }),
|
|
2668
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.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") })
|
|
2668
2669
|
] })
|
|
2669
2670
|
] });
|
|
2670
2671
|
}
|
|
@@ -2677,7 +2678,7 @@ function WizardStepPaymentMethod({ onBack, onSuccess, isProcessing }) {
|
|
|
2677
2678
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2678
2679
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
2679
2680
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
2680
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2681
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.SectionHeader, { children: t("billing.ui.payment_methods.add") }),
|
|
2681
2682
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: t("billing.ui.wizard.payment_description") })
|
|
2682
2683
|
] }),
|
|
2683
2684
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodForm, { onSuccess, onCancel: onBack, isLoading: isProcessing, alwaysSetDefault: true })
|
|
@@ -2720,10 +2721,10 @@ function SubscriptionWizard({
|
|
|
2720
2721
|
const isChangePlanMode = !!subscription;
|
|
2721
2722
|
const dialogTitle = subscription ? t("billing.ui.wizard.change_title") : isPurchasingAddons ? t("billing.ui.subscriptions.purchase_addons") : t("billing.ui.subscriptions.subscribe");
|
|
2722
2723
|
const dialogDescription = subscription ? t("billing.ui.wizard.change_description") : isPurchasingAddons ? t("billing.ui.wizard.addons_description") : t("billing.ui.wizard.subscribe_description");
|
|
2723
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2724
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2725
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2726
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2724
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.DialogContent, { className: "max-w-2xl max-h-[90vh] overflow-y-auto", children: [
|
|
2725
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.DialogHeader, { children: [
|
|
2726
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.DialogTitle, { children: dialogTitle }),
|
|
2727
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.DialogDescription, { children: dialogDescription })
|
|
2727
2728
|
] }),
|
|
2728
2729
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, WizardProgressIndicator, { currentStep: state.step }),
|
|
2729
2730
|
state.step === "plan-selection" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -2791,7 +2792,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, getProgressColor, "getProgressColor");
|
|
|
2791
2792
|
function formatDate2(date, { locale, t }) {
|
|
2792
2793
|
if (!date) return t("billing.ui.not_available");
|
|
2793
2794
|
try {
|
|
2794
|
-
return new Intl.DateTimeFormat(locale, {
|
|
2795
|
+
return new Intl.DateTimeFormat(_chunk3CSPHMVKjs.dateFormatLocale.call(void 0, locale), {
|
|
2795
2796
|
month: "short",
|
|
2796
2797
|
day: "numeric"
|
|
2797
2798
|
}).format(new Date(date));
|
|
@@ -2802,7 +2803,7 @@ function formatDate2(date, { locale, t }) {
|
|
|
2802
2803
|
_chunk7QVYU63Ejs.__name.call(void 0, formatDate2, "formatDate");
|
|
2803
2804
|
function UsageSummaryCard({ meter, summary }) {
|
|
2804
2805
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2805
|
-
const fmt =
|
|
2806
|
+
const fmt = _chunkEXG4ANC7js.useBillingFormatOptions.call(void 0, );
|
|
2806
2807
|
const currentUsage = _nullishCoalesce(_optionalChain([summary, 'optionalAccess', _100 => _100.aggregatedValue]), () => ( 0));
|
|
2807
2808
|
const limit = meter.limit;
|
|
2808
2809
|
const percentage = limit && limit > 0 ? currentUsage / limit * 100 : null;
|
|
@@ -2810,15 +2811,15 @@ function UsageSummaryCard({ meter, summary }) {
|
|
|
2810
2811
|
const progressWidth = percentage !== null ? Math.min(percentage, 100) : 0;
|
|
2811
2812
|
const displayName = meter.displayName || meter.eventName;
|
|
2812
2813
|
const hasLimit = limit !== null && limit !== void 0;
|
|
2813
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2814
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2814
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.Card, { children: [
|
|
2815
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.CardHeader, { className: "flex flex-row items-center gap-x-3 pb-3", children: [
|
|
2815
2816
|
/* @__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" }) }),
|
|
2816
2817
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col", children: [
|
|
2817
2818
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium", children: displayName }),
|
|
2818
2819
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-xs", children: meter.id })
|
|
2819
2820
|
] })
|
|
2820
2821
|
] }),
|
|
2821
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2822
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.CardContent, { className: "flex flex-col gap-y-4", children: [
|
|
2822
2823
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
2823
2824
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-3xl font-bold", children: currentUsage.toLocaleString(fmt.locale) }),
|
|
2824
2825
|
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) }) })
|
|
@@ -2826,7 +2827,7 @@ function UsageSummaryCard({ meter, summary }) {
|
|
|
2826
2827
|
hasLimit ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-2", children: [
|
|
2827
2828
|
/* @__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}%` } }) }),
|
|
2828
2829
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-sm", children: t("billing.ui.usage.percent_used", {
|
|
2829
|
-
value: percentage !== null ?
|
|
2830
|
+
value: percentage !== null ? _chunk3CSPHMVKjs.formatFixed.call(void 0, percentage, fmt.locale, 1) : ""
|
|
2830
2831
|
}) })
|
|
2831
2832
|
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-sm", children: t("billing.ui.usage.no_limit") }),
|
|
2832
2833
|
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", {
|
|
@@ -2859,14 +2860,14 @@ function UsageContainer() {
|
|
|
2859
2860
|
const loadUsageData = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2860
2861
|
setLoading(true);
|
|
2861
2862
|
try {
|
|
2862
|
-
const fetchedSubscriptions = await
|
|
2863
|
+
const fetchedSubscriptions = await _chunk3CSPHMVKjs.StripeSubscriptionService.listSubscriptions();
|
|
2863
2864
|
setSubscriptions(fetchedSubscriptions);
|
|
2864
2865
|
const hasMeteredSubscriptions2 = fetchedSubscriptions.some((sub) => _optionalChain([sub, 'access', _101 => _101.price, 'optionalAccess', _102 => _102.recurring, 'optionalAccess', _103 => _103.usageType]) === "metered");
|
|
2865
2866
|
if (!hasMeteredSubscriptions2) {
|
|
2866
2867
|
setLoading(false);
|
|
2867
2868
|
return;
|
|
2868
2869
|
}
|
|
2869
|
-
const fetchedMeters = await
|
|
2870
|
+
const fetchedMeters = await _chunk3CSPHMVKjs.StripeUsageService.listMeters();
|
|
2870
2871
|
setMeters(fetchedMeters);
|
|
2871
2872
|
const summariesMap = {};
|
|
2872
2873
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -2874,7 +2875,7 @@ function UsageContainer() {
|
|
|
2874
2875
|
const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
|
|
2875
2876
|
for (const meter of fetchedMeters) {
|
|
2876
2877
|
try {
|
|
2877
|
-
const meterSummaries = await
|
|
2878
|
+
const meterSummaries = await _chunk3CSPHMVKjs.StripeUsageService.getMeterSummaries({
|
|
2878
2879
|
meterId: meter.id,
|
|
2879
2880
|
startTime: startOfMonth,
|
|
2880
2881
|
endTime: endOfMonth
|
|
@@ -2923,7 +2924,7 @@ function formatDateTime(date, { locale, t }) {
|
|
|
2923
2924
|
if (!date) return t("billing.ui.not_available");
|
|
2924
2925
|
const dateObj = typeof date === "string" ? new Date(date) : date;
|
|
2925
2926
|
try {
|
|
2926
|
-
return new Intl.DateTimeFormat(locale, {
|
|
2927
|
+
return new Intl.DateTimeFormat(_chunk3CSPHMVKjs.dateFormatLocale.call(void 0, locale), {
|
|
2927
2928
|
month: "short",
|
|
2928
2929
|
day: "numeric",
|
|
2929
2930
|
year: "numeric",
|
|
@@ -2937,27 +2938,27 @@ function formatDateTime(date, { locale, t }) {
|
|
|
2937
2938
|
_chunk7QVYU63Ejs.__name.call(void 0, formatDateTime, "formatDateTime");
|
|
2938
2939
|
function UsageHistoryTable({ usageRecords }) {
|
|
2939
2940
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2940
|
-
const fmt =
|
|
2941
|
+
const fmt = _chunkEXG4ANC7js.useBillingFormatOptions.call(void 0, );
|
|
2941
2942
|
if (usageRecords.length === 0) {
|
|
2942
2943
|
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") }) });
|
|
2943
2944
|
}
|
|
2944
2945
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
2945
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2946
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-clip rounded-lg border", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2947
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2948
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2949
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2950
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2951
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2946
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.SectionHeader, { level: 2, children: t("billing.ui.usage.history_title") }),
|
|
2947
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-clip rounded-lg border", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.Table, { children: [
|
|
2948
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.TableRow, { children: [
|
|
2949
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TableHead, { children: t("billing.ui.columns.date_time") }),
|
|
2950
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TableHead, { children: t("billing.ui.columns.meter_event") }),
|
|
2951
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TableHead, { className: "text-end", children: t("billing.ui.columns.quantity") }),
|
|
2952
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TableHead, { children: t("billing.ui.columns.event_id") })
|
|
2952
2953
|
] }) }),
|
|
2953
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2954
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TableBody, { children: usageRecords.map((record) => {
|
|
2954
2955
|
const dateTime = formatDateTime(record.timestamp, fmt);
|
|
2955
2956
|
const quantity = record.quantity.toLocaleString(fmt.locale);
|
|
2956
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2957
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2958
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2959
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2960
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2957
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.TableRow, { children: [
|
|
2958
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TableCell, { className: "font-medium", children: dateTime }),
|
|
2959
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TableCell, { className: "text-muted-foreground", children: record.meterEventName }),
|
|
2960
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TableCell, { className: "text-end font-medium", children: quantity }),
|
|
2961
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TableCell, { className: "text-muted-foreground text-sm tabular-nums", children: record.stripeEventId })
|
|
2961
2962
|
] }, record.id);
|
|
2962
2963
|
}) })
|
|
2963
2964
|
] }) })
|
|
@@ -2968,8 +2969,8 @@ _chunk7QVYU63Ejs.__name.call(void 0, UsageHistoryTable, "UsageHistoryTable");
|
|
|
2968
2969
|
// src/features/billing/components/modals/BillingDetailModal.tsx
|
|
2969
2970
|
|
|
2970
2971
|
function BillingDetailModal({ open, onOpenChange, title, children, className }) {
|
|
2971
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2972
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2972
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.DialogContent, { className: _nullishCoalesce(className, () => ( "max-w-4xl max-h-[90vh] overflow-y-auto")), children: [
|
|
2973
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.DialogHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.DialogTitle, { children: title }) }),
|
|
2973
2974
|
children
|
|
2974
2975
|
] }) });
|
|
2975
2976
|
}
|
|
@@ -2997,7 +2998,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
|
|
|
2997
2998
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-destructive text-sm font-medium", children: t("billing.ui.alert.payment_failed_title") }),
|
|
2998
2999
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive mt-1 text-sm", children: t("billing.ui.alert.payment_failed_description") })
|
|
2999
3000
|
] }),
|
|
3000
|
-
onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3001
|
+
onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Button, { variant: "outline", size: "sm", onClick: onUpdatePayment, className: "text-destructive border-red-300", children: t("billing.ui.alert.update_payment_method") })
|
|
3001
3002
|
] });
|
|
3002
3003
|
}
|
|
3003
3004
|
if (subscription.status === "trialing" /* TRIALING */ && subscription.trialEnd) {
|
|
@@ -3011,7 +3012,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
|
|
|
3011
3012
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-warning text-sm font-medium", children: t("billing.ui.alert.trial_ending_title") }),
|
|
3012
3013
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-warning mt-1 text-sm", children: t("billing.ui.alert.trial_ending_description", { count: daysRemaining }) })
|
|
3013
3014
|
] }),
|
|
3014
|
-
onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3015
|
+
onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Button, { variant: "outline", size: "sm", onClick: onAddPayment, className: "text-warning border-yellow-300", children: t("billing.ui.payment_methods.add") })
|
|
3015
3016
|
] });
|
|
3016
3017
|
}
|
|
3017
3018
|
}
|
|
@@ -3063,7 +3064,7 @@ function BillingDashboardContainer() {
|
|
|
3063
3064
|
setNoCustomerExists(false);
|
|
3064
3065
|
let customer = null;
|
|
3065
3066
|
try {
|
|
3066
|
-
customer = await
|
|
3067
|
+
customer = await _chunk3CSPHMVKjs.StripeCustomerService.getCustomer();
|
|
3067
3068
|
setData((prev) => ({ ...prev, customer }));
|
|
3068
3069
|
setErrors((prev) => ({ ...prev, customer: null }));
|
|
3069
3070
|
setNoCustomerExists(false);
|
|
@@ -3089,7 +3090,7 @@ function BillingDashboardContainer() {
|
|
|
3089
3090
|
}
|
|
3090
3091
|
const fetchSubscriptions = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3091
3092
|
try {
|
|
3092
|
-
const subscriptions2 = await
|
|
3093
|
+
const subscriptions2 = await _chunk3CSPHMVKjs.StripeSubscriptionService.listSubscriptions();
|
|
3093
3094
|
setData((prev) => ({ ...prev, subscriptions: subscriptions2 }));
|
|
3094
3095
|
setErrors((prev) => ({ ...prev, subscriptions: null }));
|
|
3095
3096
|
return subscriptions2;
|
|
@@ -3103,7 +3104,7 @@ function BillingDashboardContainer() {
|
|
|
3103
3104
|
}, "fetchSubscriptions");
|
|
3104
3105
|
const fetchPaymentMethods = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3105
3106
|
try {
|
|
3106
|
-
const paymentMethods = await
|
|
3107
|
+
const paymentMethods = await _chunk3CSPHMVKjs.StripeCustomerService.listPaymentMethods();
|
|
3107
3108
|
setData((prev) => ({ ...prev, paymentMethods }));
|
|
3108
3109
|
setErrors((prev) => ({ ...prev, paymentMethods: null }));
|
|
3109
3110
|
} catch (error) {
|
|
@@ -3115,7 +3116,7 @@ function BillingDashboardContainer() {
|
|
|
3115
3116
|
}, "fetchPaymentMethods");
|
|
3116
3117
|
const fetchInvoices = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3117
3118
|
try {
|
|
3118
|
-
const invoices = await
|
|
3119
|
+
const invoices = await _chunk3CSPHMVKjs.StripeInvoiceService.listInvoices();
|
|
3119
3120
|
setData((prev) => ({ ...prev, invoices }));
|
|
3120
3121
|
setErrors((prev) => ({ ...prev, invoices: null }));
|
|
3121
3122
|
} catch (error) {
|
|
@@ -3138,7 +3139,7 @@ function BillingDashboardContainer() {
|
|
|
3138
3139
|
const handleCreateCustomer = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3139
3140
|
setCreatingCustomer(true);
|
|
3140
3141
|
try {
|
|
3141
|
-
await
|
|
3142
|
+
await _chunk3CSPHMVKjs.StripeCustomerService.createCustomer();
|
|
3142
3143
|
setNoCustomerExists(false);
|
|
3143
3144
|
await fetchAllData();
|
|
3144
3145
|
} catch (error) {
|
|
@@ -3150,7 +3151,7 @@ function BillingDashboardContainer() {
|
|
|
3150
3151
|
}, "handleCreateCustomer");
|
|
3151
3152
|
const fetchUsageData = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3152
3153
|
try {
|
|
3153
|
-
const meters = await
|
|
3154
|
+
const meters = await _chunk3CSPHMVKjs.StripeUsageService.listMeters();
|
|
3154
3155
|
setData((prev) => ({ ...prev, meters }));
|
|
3155
3156
|
const summariesMap = {};
|
|
3156
3157
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -3158,7 +3159,7 @@ function BillingDashboardContainer() {
|
|
|
3158
3159
|
const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
|
|
3159
3160
|
for (const meter of meters) {
|
|
3160
3161
|
try {
|
|
3161
|
-
const meterSummaries = await
|
|
3162
|
+
const meterSummaries = await _chunk3CSPHMVKjs.StripeUsageService.getMeterSummaries({
|
|
3162
3163
|
meterId: meter.id,
|
|
3163
3164
|
startTime: startOfMonth,
|
|
3164
3165
|
endTime: endOfMonth
|
|
@@ -3245,18 +3246,18 @@ function BillingDashboardContainer() {
|
|
|
3245
3246
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-8 w-8" }),
|
|
3246
3247
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: t("billing.title") })
|
|
3247
3248
|
] }),
|
|
3248
|
-
isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3249
|
-
noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3250
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3249
|
+
isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.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" }) }) }),
|
|
3250
|
+
noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.Card, { children: [
|
|
3251
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.CardHeader, { className: "text-center", children: [
|
|
3251
3252
|
/* @__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" }) }),
|
|
3252
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3253
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3253
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.CardTitle, { children: t("billing.ui.dashboard.setup_title") }),
|
|
3254
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.CardDescription, { children: t("billing.ui.dashboard.setup_description") })
|
|
3254
3255
|
] }),
|
|
3255
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3256
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.CardContent, { className: "flex justify-center pb-8", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Button, { onClick: handleCreateCustomer, disabled: creatingCustomer, size: "lg", children: creatingCustomer ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
3256
3257
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "me-2 h-4 w-4 animate-spin" }),
|
|
3257
3258
|
t("billing.ui.dashboard.setting_up")
|
|
3258
3259
|
] }) : t("billing.ui.dashboard.setup_button") }) }),
|
|
3259
|
-
errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3260
|
+
errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.CardContent, { className: "pt-0", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-center text-destructive text-xs/relaxed", children: t(errors.customer) }) })
|
|
3260
3261
|
] }),
|
|
3261
3262
|
!noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
3262
3263
|
criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -3400,7 +3401,7 @@ function getStripePromise(publishableKey) {
|
|
|
3400
3401
|
}
|
|
3401
3402
|
_chunk7QVYU63Ejs.__name.call(void 0, getStripePromise, "getStripePromise");
|
|
3402
3403
|
function StripeProvider({ children }) {
|
|
3403
|
-
const publishableKey =
|
|
3404
|
+
const publishableKey = _chunkCP7BXAFHjs.getStripePublishableKey.call(void 0, );
|
|
3404
3405
|
const stripePromise = _react.useMemo.call(void 0, () => getStripePromise(publishableKey), [publishableKey]);
|
|
3405
3406
|
const options = _react.useMemo.call(void 0, () => ({}), []);
|
|
3406
3407
|
if (!publishableKey) {
|
|
@@ -3410,7 +3411,7 @@ function StripeProvider({ children }) {
|
|
|
3410
3411
|
}
|
|
3411
3412
|
_chunk7QVYU63Ejs.__name.call(void 0, StripeProvider, "StripeProvider");
|
|
3412
3413
|
function isStripeConfigured() {
|
|
3413
|
-
return !!
|
|
3414
|
+
return !!_chunkCP7BXAFHjs.getStripePublishableKey.call(void 0, );
|
|
3414
3415
|
}
|
|
3415
3416
|
_chunk7QVYU63Ejs.__name.call(void 0, isStripeConfigured, "isStripeConfigured");
|
|
3416
3417
|
|
|
@@ -3425,18 +3426,18 @@ _chunk7QVYU63Ejs.__name.call(void 0, isStripeConfigured, "isStripeConfigured");
|
|
|
3425
3426
|
|
|
3426
3427
|
function PriceArchiver({ price }) {
|
|
3427
3428
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
3428
|
-
const fmt =
|
|
3429
|
+
const fmt = _chunkEXG4ANC7js.useBillingFormatOptions.call(void 0, );
|
|
3429
3430
|
const { archivePrice, restorePrice } = usePriceContext();
|
|
3430
3431
|
const [open, setOpen] = _react.useState.call(void 0, false);
|
|
3431
3432
|
const isArchived = !price.active;
|
|
3432
3433
|
const scope = isArchived ? "restore" : "archive";
|
|
3433
3434
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
3434
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3435
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.Button, { variant: "outline", size: "sm", onClick: () => setOpen(true), children: [
|
|
3435
3436
|
isArchived ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RotateCcwIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ArchiveIcon, {}),
|
|
3436
3437
|
t(`billing.admin.prices.${scope}.confirm`)
|
|
3437
3438
|
] }),
|
|
3438
3439
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3439
|
-
|
|
3440
|
+
_chunkEXG4ANC7js.ConfirmDialog,
|
|
3440
3441
|
{
|
|
3441
3442
|
open,
|
|
3442
3443
|
onOpenChange: setOpen,
|
|
@@ -3450,7 +3451,7 @@ function PriceArchiver({ price }) {
|
|
|
3450
3451
|
if (isArchived) await restorePrice(price.id);
|
|
3451
3452
|
else await archivePrice(price.id);
|
|
3452
3453
|
} catch (error) {
|
|
3453
|
-
|
|
3454
|
+
_chunkEXG4ANC7js.errorToast.call(void 0, { title: t(`billing.admin.prices.${scope}.title`), error });
|
|
3454
3455
|
throw error;
|
|
3455
3456
|
}
|
|
3456
3457
|
}
|
|
@@ -3482,15 +3483,15 @@ function PriceEditorInternal({
|
|
|
3482
3483
|
onDialogOpenChange
|
|
3483
3484
|
}) {
|
|
3484
3485
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
3485
|
-
const fmt =
|
|
3486
|
-
const router =
|
|
3486
|
+
const fmt = _chunkEXG4ANC7js.useBillingFormatOptions.call(void 0, );
|
|
3487
|
+
const router = _chunk3CSPHMVKjs.useI18nRouter.call(void 0, );
|
|
3487
3488
|
const { createPrice, updatePrice, productId: contextProductId } = usePriceContext();
|
|
3488
3489
|
const [allFeatures, setAllFeatures] = _react.useState.call(void 0, []);
|
|
3489
3490
|
const isEdit = !!price;
|
|
3490
3491
|
const targetProductId = _nullishCoalesce(_nullishCoalesce(productId, () => ( _optionalChain([price, 'optionalAccess', _119 => _119.product, 'optionalAccess', _120 => _120.id]))), () => ( contextProductId));
|
|
3491
3492
|
_react.useEffect.call(void 0, () => {
|
|
3492
3493
|
const fetchFeatures = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3493
|
-
setAllFeatures(await
|
|
3494
|
+
setAllFeatures(await _chunk3CSPHMVKjs.FeatureService.findMany({}));
|
|
3494
3495
|
}, "fetchFeatures");
|
|
3495
3496
|
void fetchFeatures();
|
|
3496
3497
|
}, []);
|
|
@@ -3603,7 +3604,7 @@ function PriceEditorInternal({
|
|
|
3603
3604
|
warnedUnknownFor.current = fingerprint;
|
|
3604
3605
|
const { unknown } = resolvePlatformFeatures(seed.platformFeatures);
|
|
3605
3606
|
if (unknown.length > 0)
|
|
3606
|
-
|
|
3607
|
+
_chunk3CSPHMVKjs.showToast.call(void 0, t("billing.admin.prices.import.warnings.unknownFeatures", { features: unknown.join(", ") }));
|
|
3607
3608
|
}, [seed, isEdit, allFeatures, resolvePlatformFeatures, t]);
|
|
3608
3609
|
const watchInterval = form.watch("interval");
|
|
3609
3610
|
const isRecurring = watchInterval !== "one_time";
|
|
@@ -3624,13 +3625,13 @@ function PriceEditorInternal({
|
|
|
3624
3625
|
{ id: "metered", text: t("billing.admin.prices.usage.metered") }
|
|
3625
3626
|
];
|
|
3626
3627
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3627
|
-
|
|
3628
|
+
_chunkEXG4ANC7js.EditorSheet,
|
|
3628
3629
|
{
|
|
3629
3630
|
form,
|
|
3630
3631
|
entityType: t("billing.admin.prices.entity"),
|
|
3631
3632
|
entityName: price ? priceLabel(price, fmt) : void 0,
|
|
3632
3633
|
isEdit,
|
|
3633
|
-
module:
|
|
3634
|
+
module: _chunk3CSPHMVKjs.Modules.StripePrice,
|
|
3634
3635
|
size: "lg",
|
|
3635
3636
|
propagateChanges,
|
|
3636
3637
|
onSuccess,
|
|
@@ -3679,13 +3680,13 @@ function PriceEditorInternal({
|
|
|
3679
3680
|
dialogOpen,
|
|
3680
3681
|
onDialogOpenChange,
|
|
3681
3682
|
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
3682
|
-
isEdit && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3683
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3684
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3683
|
+
isEdit && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.Alert, { children: [
|
|
3684
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.AlertTitle, { children: t("billing.admin.prices.immutability.title") }),
|
|
3685
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.AlertDescription, { children: t("billing.admin.prices.immutability.description") })
|
|
3685
3686
|
] }),
|
|
3686
3687
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
|
|
3687
3688
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3688
|
-
|
|
3689
|
+
_chunkEXG4ANC7js.FormInput,
|
|
3689
3690
|
{
|
|
3690
3691
|
form,
|
|
3691
3692
|
id: "unitAmount",
|
|
@@ -3697,7 +3698,7 @@ function PriceEditorInternal({
|
|
|
3697
3698
|
}
|
|
3698
3699
|
),
|
|
3699
3700
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3700
|
-
|
|
3701
|
+
_chunkEXG4ANC7js.FormSelect,
|
|
3701
3702
|
{
|
|
3702
3703
|
form,
|
|
3703
3704
|
id: "currency",
|
|
@@ -3708,7 +3709,7 @@ function PriceEditorInternal({
|
|
|
3708
3709
|
)
|
|
3709
3710
|
] }),
|
|
3710
3711
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3711
|
-
|
|
3712
|
+
_chunkEXG4ANC7js.FormSelect,
|
|
3712
3713
|
{
|
|
3713
3714
|
form,
|
|
3714
3715
|
id: "interval",
|
|
@@ -3719,7 +3720,7 @@ function PriceEditorInternal({
|
|
|
3719
3720
|
),
|
|
3720
3721
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
|
|
3721
3722
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3722
|
-
|
|
3723
|
+
_chunkEXG4ANC7js.FormInput,
|
|
3723
3724
|
{
|
|
3724
3725
|
form,
|
|
3725
3726
|
id: "intervalCount",
|
|
@@ -3730,7 +3731,7 @@ function PriceEditorInternal({
|
|
|
3730
3731
|
}
|
|
3731
3732
|
),
|
|
3732
3733
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3733
|
-
|
|
3734
|
+
_chunkEXG4ANC7js.FormSelect,
|
|
3734
3735
|
{
|
|
3735
3736
|
form,
|
|
3736
3737
|
id: "usageType",
|
|
@@ -3741,7 +3742,7 @@ function PriceEditorInternal({
|
|
|
3741
3742
|
)
|
|
3742
3743
|
] }),
|
|
3743
3744
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3744
|
-
|
|
3745
|
+
_chunkEXG4ANC7js.FormInput,
|
|
3745
3746
|
{
|
|
3746
3747
|
form,
|
|
3747
3748
|
id: "nickname",
|
|
@@ -3750,7 +3751,7 @@ function PriceEditorInternal({
|
|
|
3750
3751
|
}
|
|
3751
3752
|
),
|
|
3752
3753
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3753
|
-
|
|
3754
|
+
_chunkEXG4ANC7js.FormTextarea,
|
|
3754
3755
|
{
|
|
3755
3756
|
form,
|
|
3756
3757
|
id: "description",
|
|
@@ -3760,7 +3761,7 @@ function PriceEditorInternal({
|
|
|
3760
3761
|
}
|
|
3761
3762
|
),
|
|
3762
3763
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3763
|
-
|
|
3764
|
+
_chunkEXG4ANC7js.FormInput,
|
|
3764
3765
|
{
|
|
3765
3766
|
form,
|
|
3766
3767
|
id: "token",
|
|
@@ -3770,10 +3771,10 @@ function PriceEditorInternal({
|
|
|
3770
3771
|
}
|
|
3771
3772
|
),
|
|
3772
3773
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-2", children: [
|
|
3773
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3774
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.FieldLabel, { children: t("billing.admin.prices.fields.features") }),
|
|
3774
3775
|
form.watch("features").map((_, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
|
|
3775
3776
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3776
|
-
|
|
3777
|
+
_chunkEXG4ANC7js.Input,
|
|
3777
3778
|
{
|
|
3778
3779
|
...form.register(`features.${index}`),
|
|
3779
3780
|
placeholder: t("billing.admin.prices.placeholders.feature", { index: index + 1 }),
|
|
@@ -3781,7 +3782,7 @@ function PriceEditorInternal({
|
|
|
3781
3782
|
}
|
|
3782
3783
|
),
|
|
3783
3784
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3784
|
-
|
|
3785
|
+
_chunkEXG4ANC7js.Button,
|
|
3785
3786
|
{
|
|
3786
3787
|
type: "button",
|
|
3787
3788
|
variant: "outline",
|
|
@@ -3796,7 +3797,7 @@ function PriceEditorInternal({
|
|
|
3796
3797
|
)
|
|
3797
3798
|
] }, index)),
|
|
3798
3799
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3799
|
-
|
|
3800
|
+
_chunkEXG4ANC7js.Button,
|
|
3800
3801
|
{
|
|
3801
3802
|
type: "button",
|
|
3802
3803
|
variant: "outline",
|
|
@@ -3811,12 +3812,12 @@ function PriceEditorInternal({
|
|
|
3811
3812
|
)
|
|
3812
3813
|
] }),
|
|
3813
3814
|
isRecurring && allFeatures.length > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-2", children: [
|
|
3814
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3815
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.FieldLabel, { children: t("billing.admin.prices.fields.platformFeatures") }),
|
|
3815
3816
|
/* @__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) => {
|
|
3816
3817
|
const isChecked = form.watch("featureIds").includes(feature.id);
|
|
3817
3818
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
3818
3819
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3819
|
-
|
|
3820
|
+
_chunkEXG4ANC7js.Checkbox,
|
|
3820
3821
|
{
|
|
3821
3822
|
id: `feature-${feature.id}`,
|
|
3822
3823
|
checked: isChecked,
|
|
@@ -3832,13 +3833,13 @@ function PriceEditorInternal({
|
|
|
3832
3833
|
}
|
|
3833
3834
|
}
|
|
3834
3835
|
),
|
|
3835
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3836
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.FieldLabel, { htmlFor: `feature-${feature.id}`, children: feature.name }),
|
|
3836
3837
|
feature.isCore && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.admin.prices.help.core") })
|
|
3837
3838
|
] }, feature.id);
|
|
3838
3839
|
}) })
|
|
3839
3840
|
] }),
|
|
3840
3841
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3841
|
-
|
|
3842
|
+
_chunkEXG4ANC7js.FormCheckbox,
|
|
3842
3843
|
{
|
|
3843
3844
|
form,
|
|
3844
3845
|
id: "isTrial",
|
|
@@ -3881,7 +3882,7 @@ var defaultContextValue = {
|
|
|
3881
3882
|
productId: void 0
|
|
3882
3883
|
};
|
|
3883
3884
|
function priceLabel(price, fmt = {}) {
|
|
3884
|
-
return _nullishCoalesce(price.nickname, () => ( `${
|
|
3885
|
+
return _nullishCoalesce(price.nickname, () => ( `${_chunk3CSPHMVKjs.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt)} ${_chunk3CSPHMVKjs.formatInterval.call(void 0, price, fmt)}`.trim()));
|
|
3885
3886
|
}
|
|
3886
3887
|
_chunk7QVYU63Ejs.__name.call(void 0, priceLabel, "priceLabel");
|
|
3887
3888
|
var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
@@ -3891,22 +3892,22 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3891
3892
|
productId: productIdProp
|
|
3892
3893
|
}) => {
|
|
3893
3894
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
3894
|
-
const fmt =
|
|
3895
|
-
const generateUrl =
|
|
3896
|
-
const { hasRole } =
|
|
3895
|
+
const fmt = _chunkEXG4ANC7js.useBillingFormatOptions.call(void 0, );
|
|
3896
|
+
const generateUrl = _chunkEXG4ANC7js.usePageUrlGenerator.call(void 0, );
|
|
3897
|
+
const { hasRole } = _chunkEXG4ANC7js.useCurrentUserContext.call(void 0, );
|
|
3897
3898
|
const [price, setPrice] = _react.useState.call(void 0,
|
|
3898
|
-
dehydratedPrice ?
|
|
3899
|
+
dehydratedPrice ? _chunk3CSPHMVKjs.rehydrate.call(void 0, _chunk3CSPHMVKjs.Modules.StripePrice, dehydratedPrice) : void 0
|
|
3899
3900
|
);
|
|
3900
3901
|
const [priceVersion, setPriceVersion] = _react.useState.call(void 0, 0);
|
|
3901
3902
|
const refreshPrices = _react.useCallback.call(void 0, () => setPriceVersion((value2) => value2 + 1), []);
|
|
3902
3903
|
const productId = _nullishCoalesce(productIdProp, () => ( _optionalChain([price, 'optionalAccess', _143 => _143.product, 'optionalAccess', _144 => _144.id])));
|
|
3903
3904
|
const reloadPrice = _react.useCallback.call(void 0, async () => {
|
|
3904
3905
|
if (!_optionalChain([price, 'optionalAccess', _145 => _145.id])) return;
|
|
3905
|
-
setPrice(await
|
|
3906
|
+
setPrice(await _chunk3CSPHMVKjs.StripePriceService.getPrice({ id: price.id }));
|
|
3906
3907
|
}, [_optionalChain([price, 'optionalAccess', _146 => _146.id])]);
|
|
3907
3908
|
const createPrice = _react.useCallback.call(void 0,
|
|
3908
3909
|
async (input) => {
|
|
3909
|
-
const saved = await
|
|
3910
|
+
const saved = await _chunk3CSPHMVKjs.StripePriceService.createPrice(input);
|
|
3910
3911
|
refreshPrices();
|
|
3911
3912
|
return saved;
|
|
3912
3913
|
},
|
|
@@ -3914,7 +3915,7 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3914
3915
|
);
|
|
3915
3916
|
const updatePrice = _react.useCallback.call(void 0,
|
|
3916
3917
|
async (input) => {
|
|
3917
|
-
const saved = await
|
|
3918
|
+
const saved = await _chunk3CSPHMVKjs.StripePriceService.updatePrice(input);
|
|
3918
3919
|
setPrice(saved);
|
|
3919
3920
|
refreshPrices();
|
|
3920
3921
|
return saved;
|
|
@@ -3925,7 +3926,7 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3925
3926
|
async (id) => {
|
|
3926
3927
|
const target = _nullishCoalesce(id, () => ( _optionalChain([price, 'optionalAccess', _147 => _147.id])));
|
|
3927
3928
|
if (!target) return;
|
|
3928
|
-
await
|
|
3929
|
+
await _chunk3CSPHMVKjs.StripePriceService.archivePrice({ id: target });
|
|
3929
3930
|
await reloadPrice();
|
|
3930
3931
|
refreshPrices();
|
|
3931
3932
|
},
|
|
@@ -3935,7 +3936,7 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3935
3936
|
async (id) => {
|
|
3936
3937
|
const target = _nullishCoalesce(id, () => ( _optionalChain([price, 'optionalAccess', _149 => _149.id])));
|
|
3937
3938
|
if (!target) return;
|
|
3938
|
-
await
|
|
3939
|
+
await _chunk3CSPHMVKjs.StripePriceService.reactivatePrice({ id: target });
|
|
3939
3940
|
await reloadPrice();
|
|
3940
3941
|
refreshPrices();
|
|
3941
3942
|
},
|
|
@@ -3959,12 +3960,12 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3959
3960
|
if (!publishChrome) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceContext.Provider, { value, children });
|
|
3960
3961
|
const breadcrumb = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
3961
3962
|
const items = [
|
|
3962
|
-
{ name: t("billing.admin.products.title"), href: generateUrl({ page:
|
|
3963
|
+
{ name: t("billing.admin.products.title"), href: generateUrl({ page: _chunk3CSPHMVKjs.Modules.StripeProduct }) }
|
|
3963
3964
|
];
|
|
3964
3965
|
if (_optionalChain([price, 'optionalAccess', _151 => _151.product]))
|
|
3965
3966
|
items.push({
|
|
3966
3967
|
name: price.product.name,
|
|
3967
|
-
href: generateUrl({ page:
|
|
3968
|
+
href: generateUrl({ page: _chunk3CSPHMVKjs.Modules.StripeProduct, id: price.product.id })
|
|
3968
3969
|
});
|
|
3969
3970
|
if (price) items.push({ name: priceLabel(price, fmt) });
|
|
3970
3971
|
return items;
|
|
@@ -3981,7 +3982,7 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3981
3982
|
}
|
|
3982
3983
|
return response;
|
|
3983
3984
|
}, "title");
|
|
3984
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3985
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceContext.Provider, { value, children }) });
|
|
3985
3986
|
}, "PriceProvider");
|
|
3986
3987
|
var usePriceContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => _nullishCoalesce(_react.useContext.call(void 0, PriceContext), () => ( defaultContextValue)), "usePriceContext");
|
|
3987
3988
|
|
|
@@ -4001,12 +4002,12 @@ function ProductArchiver({ product }) {
|
|
|
4001
4002
|
const isArchived = !product.active;
|
|
4002
4003
|
const scope = isArchived ? "restore" : "archive";
|
|
4003
4004
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
4004
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
4005
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.Button, { variant: "outline", size: "sm", onClick: () => setOpen(true), children: [
|
|
4005
4006
|
isArchived ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RotateCcwIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ArchiveIcon, {}),
|
|
4006
4007
|
t(`billing.admin.products.${scope}.confirm`)
|
|
4007
4008
|
] }),
|
|
4008
4009
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4009
|
-
|
|
4010
|
+
_chunkEXG4ANC7js.ConfirmDialog,
|
|
4010
4011
|
{
|
|
4011
4012
|
open,
|
|
4012
4013
|
onOpenChange: setOpen,
|
|
@@ -4020,7 +4021,7 @@ function ProductArchiver({ product }) {
|
|
|
4020
4021
|
if (isArchived) await restoreProduct(product.id);
|
|
4021
4022
|
else await archiveProduct(product.id);
|
|
4022
4023
|
} catch (error) {
|
|
4023
|
-
|
|
4024
|
+
_chunkEXG4ANC7js.errorToast.call(void 0, { title: t(`billing.admin.products.${scope}.title`), error });
|
|
4024
4025
|
throw error;
|
|
4025
4026
|
}
|
|
4026
4027
|
}
|
|
@@ -4049,7 +4050,7 @@ function ProductEditorInternal({
|
|
|
4049
4050
|
onDialogOpenChange
|
|
4050
4051
|
}) {
|
|
4051
4052
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4052
|
-
const router =
|
|
4053
|
+
const router = _chunk3CSPHMVKjs.useI18nRouter.call(void 0, );
|
|
4053
4054
|
const { createProduct, updateProduct } = useProductContext();
|
|
4054
4055
|
const isEdit = !!product;
|
|
4055
4056
|
const formSchema2 = _react.useMemo.call(void 0,
|
|
@@ -4073,13 +4074,13 @@ function ProductEditorInternal({
|
|
|
4073
4074
|
defaultValues: getDefaultValues()
|
|
4074
4075
|
});
|
|
4075
4076
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4076
|
-
|
|
4077
|
+
_chunkEXG4ANC7js.EditorSheet,
|
|
4077
4078
|
{
|
|
4078
4079
|
form,
|
|
4079
4080
|
entityType: t("billing.admin.products.entity"),
|
|
4080
4081
|
entityName: _optionalChain([product, 'optionalAccess', _155 => _155.name]),
|
|
4081
4082
|
isEdit,
|
|
4082
|
-
module:
|
|
4083
|
+
module: _chunk3CSPHMVKjs.Modules.StripeProduct,
|
|
4083
4084
|
size: "md",
|
|
4084
4085
|
propagateChanges,
|
|
4085
4086
|
onSuccess,
|
|
@@ -4096,7 +4097,7 @@ function ProductEditorInternal({
|
|
|
4096
4097
|
onDialogOpenChange,
|
|
4097
4098
|
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4098
4099
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4099
|
-
|
|
4100
|
+
_chunkEXG4ANC7js.FormInput,
|
|
4100
4101
|
{
|
|
4101
4102
|
form,
|
|
4102
4103
|
id: "name",
|
|
@@ -4106,7 +4107,7 @@ function ProductEditorInternal({
|
|
|
4106
4107
|
}
|
|
4107
4108
|
),
|
|
4108
4109
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4109
|
-
|
|
4110
|
+
_chunkEXG4ANC7js.FormTextarea,
|
|
4110
4111
|
{
|
|
4111
4112
|
form,
|
|
4112
4113
|
id: "description",
|
|
@@ -4150,20 +4151,20 @@ var defaultContextValue2 = {
|
|
|
4150
4151
|
};
|
|
4151
4152
|
var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ children, dehydratedProduct, publishChrome = true }) => {
|
|
4152
4153
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4153
|
-
const generateUrl =
|
|
4154
|
-
const { hasRole } =
|
|
4154
|
+
const generateUrl = _chunkEXG4ANC7js.usePageUrlGenerator.call(void 0, );
|
|
4155
|
+
const { hasRole } = _chunkEXG4ANC7js.useCurrentUserContext.call(void 0, );
|
|
4155
4156
|
const [product, setProduct] = _react.useState.call(void 0,
|
|
4156
|
-
dehydratedProduct ?
|
|
4157
|
+
dehydratedProduct ? _chunk3CSPHMVKjs.rehydrate.call(void 0, _chunk3CSPHMVKjs.Modules.StripeProduct, dehydratedProduct) : void 0
|
|
4157
4158
|
);
|
|
4158
4159
|
const [catalogueVersion, setCatalogueVersion] = _react.useState.call(void 0, 0);
|
|
4159
4160
|
const refreshCatalogue = _react.useCallback.call(void 0, () => setCatalogueVersion((value2) => value2 + 1), []);
|
|
4160
4161
|
const reloadProduct = _react.useCallback.call(void 0, async () => {
|
|
4161
4162
|
if (!_optionalChain([product, 'optionalAccess', _156 => _156.id])) return;
|
|
4162
|
-
setProduct(await
|
|
4163
|
+
setProduct(await _chunk3CSPHMVKjs.StripeProductService.getProduct({ id: product.id }));
|
|
4163
4164
|
}, [_optionalChain([product, 'optionalAccess', _157 => _157.id])]);
|
|
4164
4165
|
const createProduct = _react.useCallback.call(void 0,
|
|
4165
4166
|
async (input) => {
|
|
4166
|
-
const saved = await
|
|
4167
|
+
const saved = await _chunk3CSPHMVKjs.StripeProductService.createProduct(input);
|
|
4167
4168
|
refreshCatalogue();
|
|
4168
4169
|
return saved;
|
|
4169
4170
|
},
|
|
@@ -4171,7 +4172,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
4171
4172
|
);
|
|
4172
4173
|
const updateProduct = _react.useCallback.call(void 0,
|
|
4173
4174
|
async (input) => {
|
|
4174
|
-
const saved = await
|
|
4175
|
+
const saved = await _chunk3CSPHMVKjs.StripeProductService.updateProduct(input);
|
|
4175
4176
|
setProduct(saved);
|
|
4176
4177
|
refreshCatalogue();
|
|
4177
4178
|
return saved;
|
|
@@ -4182,7 +4183,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
4182
4183
|
async (id) => {
|
|
4183
4184
|
const target = _nullishCoalesce(id, () => ( _optionalChain([product, 'optionalAccess', _158 => _158.id])));
|
|
4184
4185
|
if (!target) return;
|
|
4185
|
-
await
|
|
4186
|
+
await _chunk3CSPHMVKjs.StripeProductService.archiveProduct({ id: target });
|
|
4186
4187
|
await reloadProduct();
|
|
4187
4188
|
refreshCatalogue();
|
|
4188
4189
|
},
|
|
@@ -4192,7 +4193,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
4192
4193
|
async (id) => {
|
|
4193
4194
|
const target = _nullishCoalesce(id, () => ( _optionalChain([product, 'optionalAccess', _160 => _160.id])));
|
|
4194
4195
|
if (!target) return;
|
|
4195
|
-
await
|
|
4196
|
+
await _chunk3CSPHMVKjs.StripeProductService.reactivateProduct({ id: target });
|
|
4196
4197
|
await reloadProduct();
|
|
4197
4198
|
refreshCatalogue();
|
|
4198
4199
|
},
|
|
@@ -4227,7 +4228,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
4227
4228
|
{
|
|
4228
4229
|
name: t("billing.admin.products.title"),
|
|
4229
4230
|
// Linked only when it is NOT the current page.
|
|
4230
|
-
...product ? { href: generateUrl({ page:
|
|
4231
|
+
...product ? { href: generateUrl({ page: _chunk3CSPHMVKjs.Modules.StripeProduct }) } : {}
|
|
4231
4232
|
}
|
|
4232
4233
|
];
|
|
4233
4234
|
if (product) items.push({ name: product.name });
|
|
@@ -4245,7 +4246,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
4245
4246
|
}
|
|
4246
4247
|
return response;
|
|
4247
4248
|
}, "title");
|
|
4248
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4249
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductContext.Provider, { value, children }) });
|
|
4249
4250
|
}, "ProductProvider");
|
|
4250
4251
|
var useProductContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => _nullishCoalesce(_react.useContext.call(void 0, ProductContext), () => ( defaultContextValue2)), "useProductContext");
|
|
4251
4252
|
|
|
@@ -4254,57 +4255,57 @@ var useProductContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ()
|
|
|
4254
4255
|
|
|
4255
4256
|
function PriceDetails() {
|
|
4256
4257
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4257
|
-
const fmt =
|
|
4258
|
-
const generateUrl =
|
|
4258
|
+
const fmt = _chunkEXG4ANC7js.useBillingFormatOptions.call(void 0, );
|
|
4259
|
+
const generateUrl = _chunkEXG4ANC7js.usePageUrlGenerator.call(void 0, );
|
|
4259
4260
|
const { price } = usePriceContext();
|
|
4260
4261
|
if (!price) return null;
|
|
4261
4262
|
const isRecurring = price.priceType === "recurring";
|
|
4262
4263
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-8", children: [
|
|
4263
4264
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4264
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4265
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.SectionHeader, { children: t("billing.admin.prices.title") }),
|
|
4265
4266
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
4266
4267
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4267
|
-
|
|
4268
|
+
_chunkEXG4ANC7js.DetailField,
|
|
4268
4269
|
{
|
|
4269
4270
|
label: t("billing.admin.prices.fields.product"),
|
|
4270
|
-
value: price.product ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4271
|
+
value: price.product ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Link, { href: generateUrl({ page: _chunk3CSPHMVKjs.Modules.StripeProduct, id: price.product.id }), children: price.product.name }) : "\u2014"
|
|
4271
4272
|
}
|
|
4272
4273
|
),
|
|
4273
4274
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4274
|
-
|
|
4275
|
+
_chunkEXG4ANC7js.DetailField,
|
|
4275
4276
|
{
|
|
4276
4277
|
label: t("billing.admin.prices.fields.status"),
|
|
4277
4278
|
value: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex flex-wrap items-center gap-1", children: [
|
|
4278
|
-
price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4279
|
-
price.isTrial && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4279
|
+
price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Badge, { variant: "softGreen", children: t("billing.admin.prices.status.active") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Badge, { variant: "softGray", children: t("billing.admin.prices.status.archived") }),
|
|
4280
|
+
price.isTrial && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Badge, { variant: "softBlue", children: t("billing.admin.prices.badge.trial") })
|
|
4280
4281
|
] })
|
|
4281
4282
|
}
|
|
4282
4283
|
),
|
|
4283
4284
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4284
|
-
|
|
4285
|
+
_chunkEXG4ANC7js.DetailField,
|
|
4285
4286
|
{
|
|
4286
4287
|
label: t("billing.admin.prices.fields.amount"),
|
|
4287
|
-
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children:
|
|
4288
|
+
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _chunk3CSPHMVKjs.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt) })
|
|
4288
4289
|
}
|
|
4289
4290
|
),
|
|
4290
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4291
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.DetailField, { label: t("billing.admin.prices.fields.currency"), value: price.currency.toUpperCase() }),
|
|
4291
4292
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4292
|
-
|
|
4293
|
+
_chunkEXG4ANC7js.DetailField,
|
|
4293
4294
|
{
|
|
4294
4295
|
label: t("billing.admin.prices.fields.type"),
|
|
4295
4296
|
value: isRecurring ? t("billing.admin.prices.type.recurring") : t("billing.admin.prices.type.oneTime")
|
|
4296
4297
|
}
|
|
4297
4298
|
),
|
|
4298
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4299
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.DetailField, { label: t("billing.admin.prices.fields.billing"), value: _chunk3CSPHMVKjs.formatInterval.call(void 0, price, fmt) }),
|
|
4299
4300
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4300
|
-
|
|
4301
|
+
_chunkEXG4ANC7js.DetailField,
|
|
4301
4302
|
{
|
|
4302
4303
|
label: t("billing.admin.prices.fields.intervalCount"),
|
|
4303
4304
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _nullishCoalesce(_optionalChain([price, 'access', _162 => _162.recurring, 'optionalAccess', _163 => _163.intervalCount]), () => ( 1)) })
|
|
4304
4305
|
}
|
|
4305
4306
|
),
|
|
4306
4307
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4307
|
-
|
|
4308
|
+
_chunkEXG4ANC7js.DetailField,
|
|
4308
4309
|
{
|
|
4309
4310
|
label: t("billing.admin.prices.fields.usageType"),
|
|
4310
4311
|
value: _optionalChain([price, 'access', _164 => _164.recurring, 'optionalAccess', _165 => _165.usageType]) === "metered" ? t("billing.admin.prices.usage.metered") : t("billing.admin.prices.usage.licensed")
|
|
@@ -4313,24 +4314,24 @@ function PriceDetails() {
|
|
|
4313
4314
|
] })
|
|
4314
4315
|
] }),
|
|
4315
4316
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4316
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4317
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.SectionHeader, { children: t("billing.admin.prices.fields.platformFeatures") }),
|
|
4317
4318
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
4318
4319
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4319
|
-
|
|
4320
|
+
_chunkEXG4ANC7js.DetailField,
|
|
4320
4321
|
{
|
|
4321
4322
|
label: t("billing.admin.prices.fields.token"),
|
|
4322
4323
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _nullishCoalesce(price.token, () => ( "\u2014")) })
|
|
4323
4324
|
}
|
|
4324
4325
|
),
|
|
4325
4326
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4326
|
-
|
|
4327
|
+
_chunkEXG4ANC7js.DetailField,
|
|
4327
4328
|
{
|
|
4328
4329
|
label: t("billing.admin.prices.fields.stripeId"),
|
|
4329
4330
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: price.stripePriceId })
|
|
4330
4331
|
}
|
|
4331
4332
|
),
|
|
4332
4333
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4333
|
-
|
|
4334
|
+
_chunkEXG4ANC7js.DetailField,
|
|
4334
4335
|
{
|
|
4335
4336
|
label: t("billing.admin.prices.fields.description"),
|
|
4336
4337
|
value: _nullishCoalesce(price.description, () => ( "\u2014")),
|
|
@@ -4338,7 +4339,7 @@ function PriceDetails() {
|
|
|
4338
4339
|
}
|
|
4339
4340
|
),
|
|
4340
4341
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4341
|
-
|
|
4342
|
+
_chunkEXG4ANC7js.DetailField,
|
|
4342
4343
|
{
|
|
4343
4344
|
label: t("billing.admin.prices.fields.features"),
|
|
4344
4345
|
className: "md:col-span-2",
|
|
@@ -4346,11 +4347,11 @@ function PriceDetails() {
|
|
|
4346
4347
|
}
|
|
4347
4348
|
),
|
|
4348
4349
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4349
|
-
|
|
4350
|
+
_chunkEXG4ANC7js.DetailField,
|
|
4350
4351
|
{
|
|
4351
4352
|
label: t("billing.admin.prices.fields.platformFeatures"),
|
|
4352
4353
|
className: "md:col-span-2",
|
|
4353
|
-
value: price.priceFeatures.length > 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "flex flex-wrap items-center gap-1", children: price.priceFeatures.map((feature) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
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, _chunkEXG4ANC7js.Badge, { variant: "softGray", children: feature.name }, feature.id)) }) : "\u2014"
|
|
4354
4355
|
}
|
|
4355
4356
|
)
|
|
4356
4357
|
] })
|
|
@@ -4364,7 +4365,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, PriceDetails, "PriceDetails");
|
|
|
4364
4365
|
function PriceContainer() {
|
|
4365
4366
|
const { price } = usePriceContext();
|
|
4366
4367
|
if (!price) return null;
|
|
4367
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4368
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.RoundPageContainer, { module: _chunk3CSPHMVKjs.Modules.StripePrice, id: price.id, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceDetails, {}) });
|
|
4368
4369
|
}
|
|
4369
4370
|
_chunk7QVYU63Ejs.__name.call(void 0, PriceContainer, "PriceContainer");
|
|
4370
4371
|
|
|
@@ -4489,10 +4490,10 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4489
4490
|
const importInputRef = _react.useRef.call(void 0, null);
|
|
4490
4491
|
const [seed, setSeed] = _react.useState.call(void 0, void 0);
|
|
4491
4492
|
const [seedNonce, setSeedNonce] = _react.useState.call(void 0, 0);
|
|
4492
|
-
const data =
|
|
4493
|
-
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) =>
|
|
4493
|
+
const data = _chunkEXG4ANC7js.useDataListRetriever.call(void 0, {
|
|
4494
|
+
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunk3CSPHMVKjs.StripePriceService.listPrices({ ...params, productId }), "retriever"),
|
|
4494
4495
|
retrieverParams: {},
|
|
4495
|
-
module:
|
|
4496
|
+
module: _chunk3CSPHMVKjs.Modules.StripePrice
|
|
4496
4497
|
});
|
|
4497
4498
|
_react.useEffect.call(void 0, () => {
|
|
4498
4499
|
if (priceVersion > 0) void data.refresh();
|
|
@@ -4527,7 +4528,7 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4527
4528
|
openSeededEditor(transfer.price);
|
|
4528
4529
|
} catch (error) {
|
|
4529
4530
|
console.error("[PricesList] price import failed", error);
|
|
4530
|
-
|
|
4531
|
+
_chunkEXG4ANC7js.errorToast.call(void 0, {
|
|
4531
4532
|
title: t("billing.admin.prices.import.errors.title"),
|
|
4532
4533
|
error: t("billing.admin.prices.import.errors.invalid")
|
|
4533
4534
|
});
|
|
@@ -4546,7 +4547,7 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4546
4547
|
"create-price"
|
|
4547
4548
|
),
|
|
4548
4549
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _react.Fragment, { children: [
|
|
4549
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
4550
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.Button, { variant: "outline", size: "sm", type: "button", onClick: () => _optionalChain([importInputRef, 'access', _180 => _180.current, 'optionalAccess', _181 => _181.click, 'call', _182 => _182()]), children: [
|
|
4550
4551
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.UploadIcon, {}),
|
|
4551
4552
|
t("billing.admin.prices.actions.import")
|
|
4552
4553
|
] }),
|
|
@@ -4564,7 +4565,7 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4564
4565
|
];
|
|
4565
4566
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
4566
4567
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4567
|
-
|
|
4568
|
+
_chunkEXG4ANC7js.ContentListTable,
|
|
4568
4569
|
{
|
|
4569
4570
|
data,
|
|
4570
4571
|
fields: [
|
|
@@ -4575,13 +4576,13 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4575
4576
|
"status" /* status */,
|
|
4576
4577
|
"actions" /* actions */
|
|
4577
4578
|
],
|
|
4578
|
-
tableGeneratorType:
|
|
4579
|
+
tableGeneratorType: _chunk3CSPHMVKjs.Modules.StripePrice,
|
|
4579
4580
|
functions,
|
|
4580
4581
|
context: tableContext,
|
|
4581
4582
|
fullWidth,
|
|
4582
4583
|
title: t("billing.admin.prices.title"),
|
|
4583
4584
|
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4584
|
-
|
|
4585
|
+
_chunkEXG4ANC7js.EmptyState,
|
|
4585
4586
|
{
|
|
4586
4587
|
icon: _lucidereact.DollarSignIcon,
|
|
4587
4588
|
title: t("billing.admin.prices.empty.title"),
|
|
@@ -4621,18 +4622,18 @@ function ProductDetails() {
|
|
|
4621
4622
|
const { product } = useProductContext();
|
|
4622
4623
|
if (!product) return null;
|
|
4623
4624
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4624
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4625
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.SectionHeader, { children: t("billing.admin.products.tabs.details") }),
|
|
4625
4626
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
4626
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4627
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.DetailField, { label: t("billing.admin.products.fields.name"), value: product.name }),
|
|
4627
4628
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4628
|
-
|
|
4629
|
+
_chunkEXG4ANC7js.DetailField,
|
|
4629
4630
|
{
|
|
4630
4631
|
label: t("billing.admin.products.fields.status"),
|
|
4631
|
-
value: product.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4632
|
+
value: product.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Badge, { variant: "softGreen", children: t("billing.admin.products.status.active") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Badge, { variant: "softGray", children: t("billing.admin.products.status.archived") })
|
|
4632
4633
|
}
|
|
4633
4634
|
),
|
|
4634
4635
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4635
|
-
|
|
4636
|
+
_chunkEXG4ANC7js.DetailField,
|
|
4636
4637
|
{
|
|
4637
4638
|
label: t("billing.admin.products.fields.description"),
|
|
4638
4639
|
value: _nullishCoalesce(product.description, () => ( "\u2014")),
|
|
@@ -4640,14 +4641,14 @@ function ProductDetails() {
|
|
|
4640
4641
|
}
|
|
4641
4642
|
),
|
|
4642
4643
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4643
|
-
|
|
4644
|
+
_chunkEXG4ANC7js.DetailField,
|
|
4644
4645
|
{
|
|
4645
4646
|
label: t("billing.admin.products.fields.prices"),
|
|
4646
4647
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: product.stripePrices.length })
|
|
4647
4648
|
}
|
|
4648
4649
|
),
|
|
4649
4650
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4650
|
-
|
|
4651
|
+
_chunkEXG4ANC7js.DetailField,
|
|
4651
4652
|
{
|
|
4652
4653
|
label: t("billing.admin.products.fields.stripeId"),
|
|
4653
4654
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: product.stripeProductId })
|
|
@@ -4665,9 +4666,9 @@ function ProductContainer() {
|
|
|
4665
4666
|
const { product } = useProductContext();
|
|
4666
4667
|
if (!product) return null;
|
|
4667
4668
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4668
|
-
|
|
4669
|
+
_chunkEXG4ANC7js.RoundPageContainer,
|
|
4669
4670
|
{
|
|
4670
|
-
module:
|
|
4671
|
+
module: _chunk3CSPHMVKjs.Modules.StripeProduct,
|
|
4671
4672
|
id: product.id,
|
|
4672
4673
|
tabs: [
|
|
4673
4674
|
{
|
|
@@ -4676,7 +4677,7 @@ function ProductContainer() {
|
|
|
4676
4677
|
content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductDetails, {})
|
|
4677
4678
|
},
|
|
4678
4679
|
{
|
|
4679
|
-
key:
|
|
4680
|
+
key: _chunk3CSPHMVKjs.Modules.StripePrice,
|
|
4680
4681
|
label: t("billing.admin.prices.title"),
|
|
4681
4682
|
// publishChrome={false}: SharedProvider REPLACES its value for the
|
|
4682
4683
|
// subtree (SharedContext.tsx:35-37), so a nested provider publishing
|
|
@@ -4702,18 +4703,18 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductContainer, "ProductContainer");
|
|
|
4702
4703
|
|
|
4703
4704
|
function CouponsList({ fullWidth } = {}) {
|
|
4704
4705
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4705
|
-
const { catalogueVersion } =
|
|
4706
|
-
const data =
|
|
4707
|
-
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) =>
|
|
4706
|
+
const { catalogueVersion } = _chunkEXG4ANC7js.useCouponContext.call(void 0, );
|
|
4707
|
+
const data = _chunkEXG4ANC7js.useDataListRetriever.call(void 0, {
|
|
4708
|
+
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunk3CSPHMVKjs.StripeCouponService.listCoupons(params), "retriever"),
|
|
4708
4709
|
retrieverParams: {},
|
|
4709
|
-
module:
|
|
4710
|
+
module: _chunk3CSPHMVKjs.Modules.StripeCoupon
|
|
4710
4711
|
});
|
|
4711
4712
|
_react.useEffect.call(void 0, () => {
|
|
4712
4713
|
if (catalogueVersion > 0) void data.refresh();
|
|
4713
4714
|
}, [catalogueVersion]);
|
|
4714
|
-
const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4715
|
+
const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.CouponEditor, {}, "create-coupon")];
|
|
4715
4716
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4716
|
-
|
|
4717
|
+
_chunkEXG4ANC7js.ContentListTable,
|
|
4717
4718
|
{
|
|
4718
4719
|
data,
|
|
4719
4720
|
fields: [
|
|
@@ -4723,12 +4724,12 @@ function CouponsList({ fullWidth } = {}) {
|
|
|
4723
4724
|
"codes" /* codes */,
|
|
4724
4725
|
"status" /* status */
|
|
4725
4726
|
],
|
|
4726
|
-
tableGeneratorType:
|
|
4727
|
+
tableGeneratorType: _chunk3CSPHMVKjs.Modules.StripeCoupon,
|
|
4727
4728
|
functions,
|
|
4728
4729
|
fullWidth,
|
|
4729
4730
|
title: t("billing.admin.coupons.title"),
|
|
4730
4731
|
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4731
|
-
|
|
4732
|
+
_chunkEXG4ANC7js.EmptyState,
|
|
4732
4733
|
{
|
|
4733
4734
|
icon: _lucidereact.TicketPercentIcon,
|
|
4734
4735
|
title: t("billing.admin.coupons.empty.title"),
|
|
@@ -4748,26 +4749,26 @@ _chunk7QVYU63Ejs.__name.call(void 0, CouponsList, "CouponsList");
|
|
|
4748
4749
|
function ProductsList({ fullWidth } = {}) {
|
|
4749
4750
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4750
4751
|
const { catalogueVersion } = useProductContext();
|
|
4751
|
-
const data =
|
|
4752
|
-
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) =>
|
|
4752
|
+
const data = _chunkEXG4ANC7js.useDataListRetriever.call(void 0, {
|
|
4753
|
+
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunk3CSPHMVKjs.StripeProductService.listProducts(params), "retriever"),
|
|
4753
4754
|
retrieverParams: {},
|
|
4754
|
-
module:
|
|
4755
|
+
module: _chunk3CSPHMVKjs.Modules.StripeProduct
|
|
4755
4756
|
});
|
|
4756
4757
|
_react.useEffect.call(void 0, () => {
|
|
4757
4758
|
if (catalogueVersion > 0) void data.refresh();
|
|
4758
4759
|
}, [catalogueVersion]);
|
|
4759
4760
|
const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductEditor, {}, "create-product")];
|
|
4760
4761
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4761
|
-
|
|
4762
|
+
_chunkEXG4ANC7js.ContentListTable,
|
|
4762
4763
|
{
|
|
4763
4764
|
data,
|
|
4764
4765
|
fields: ["name" /* name */, "status" /* status */, "prices" /* prices */],
|
|
4765
|
-
tableGeneratorType:
|
|
4766
|
+
tableGeneratorType: _chunk3CSPHMVKjs.Modules.StripeProduct,
|
|
4766
4767
|
functions,
|
|
4767
4768
|
fullWidth,
|
|
4768
4769
|
title: t("billing.admin.products.title"),
|
|
4769
4770
|
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4770
|
-
|
|
4771
|
+
_chunkEXG4ANC7js.EmptyState,
|
|
4771
4772
|
{
|
|
4772
4773
|
icon: _lucidereact.PackageIcon,
|
|
4773
4774
|
title: t("billing.admin.products.empty.title"),
|
|
@@ -4783,10 +4784,10 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductsList, "ProductsList");
|
|
|
4783
4784
|
|
|
4784
4785
|
function ProductsListContainer() {
|
|
4785
4786
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4786
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductProvider, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4787
|
-
|
|
4787
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductProvider, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.CouponProvider, { publishChrome: false, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4788
|
+
_chunkEXG4ANC7js.RoundPageContainer,
|
|
4788
4789
|
{
|
|
4789
|
-
module:
|
|
4790
|
+
module: _chunk3CSPHMVKjs.Modules.StripeProduct,
|
|
4790
4791
|
tabs: [
|
|
4791
4792
|
{ sectionKey: "products", label: t("billing.admin.products.tabs.products"), content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductsList, {}) },
|
|
4792
4793
|
{ sectionKey: "codes", label: t("billing.admin.products.tabs.codes"), content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CouponsList, {}) }
|
|
@@ -4804,30 +4805,30 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductsListContainer, "ProductsListContain
|
|
|
4804
4805
|
|
|
4805
4806
|
function CouponDetails() {
|
|
4806
4807
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4807
|
-
const fmt =
|
|
4808
|
-
const { coupon } =
|
|
4808
|
+
const fmt = _chunkEXG4ANC7js.useBillingFormatOptions.call(void 0, );
|
|
4809
|
+
const { coupon } = _chunkEXG4ANC7js.useCouponContext.call(void 0, );
|
|
4809
4810
|
if (!coupon) return null;
|
|
4810
4811
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4811
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4812
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.SectionHeader, { children: t("billing.admin.products.tabs.details") }),
|
|
4812
4813
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-xs/relaxed", children: t("billing.admin.coupons.fixed_notice") }),
|
|
4813
4814
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
4814
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4815
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.DetailField, { label: t("billing.admin.coupons.fields.name"), value: coupon.name }),
|
|
4815
4816
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4816
|
-
|
|
4817
|
+
_chunkEXG4ANC7js.DetailField,
|
|
4817
4818
|
{
|
|
4818
4819
|
label: t("billing.admin.coupons.fields.status"),
|
|
4819
|
-
value: coupon.valid ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4820
|
+
value: coupon.valid ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Badge, { variant: "softGreen", children: t("billing.admin.coupons.status.active") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Badge, { variant: "softGray", children: t("billing.admin.coupons.status.ended") })
|
|
4820
4821
|
}
|
|
4821
4822
|
),
|
|
4822
4823
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4823
|
-
|
|
4824
|
+
_chunkEXG4ANC7js.DetailField,
|
|
4824
4825
|
{
|
|
4825
4826
|
label: t("billing.admin.coupons.fields.discount"),
|
|
4826
|
-
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children:
|
|
4827
|
+
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _chunk3CSPHMVKjs.formatCouponDiscount.call(void 0, coupon, t, fmt) })
|
|
4827
4828
|
}
|
|
4828
4829
|
),
|
|
4829
4830
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4830
|
-
|
|
4831
|
+
_chunkEXG4ANC7js.DetailField,
|
|
4831
4832
|
{
|
|
4832
4833
|
label: t("billing.admin.coupons.fields.places"),
|
|
4833
4834
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: coupon.maxRedemptions !== void 0 ? t("billing.admin.coupons.places.limited", {
|
|
@@ -4837,21 +4838,21 @@ function CouponDetails() {
|
|
|
4837
4838
|
}
|
|
4838
4839
|
),
|
|
4839
4840
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4840
|
-
|
|
4841
|
+
_chunkEXG4ANC7js.DetailField,
|
|
4841
4842
|
{
|
|
4842
4843
|
label: t("billing.admin.coupons.fields.products"),
|
|
4843
4844
|
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")
|
|
4844
4845
|
}
|
|
4845
4846
|
),
|
|
4846
4847
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4847
|
-
|
|
4848
|
+
_chunkEXG4ANC7js.DetailField,
|
|
4848
4849
|
{
|
|
4849
4850
|
label: t("billing.admin.coupons.fields.redeemBy"),
|
|
4850
|
-
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: coupon.redeemBy ?
|
|
4851
|
+
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: coupon.redeemBy ? _chunkEXG4ANC7js.formatDate.call(void 0, coupon.redeemBy, fmt) : "\u2014" })
|
|
4851
4852
|
}
|
|
4852
4853
|
),
|
|
4853
4854
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4854
|
-
|
|
4855
|
+
_chunkEXG4ANC7js.DetailField,
|
|
4855
4856
|
{
|
|
4856
4857
|
label: t("billing.admin.coupons.fields.stripeId"),
|
|
4857
4858
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: coupon.stripeCouponId })
|
|
@@ -4885,33 +4886,33 @@ function CouponCodeEditorInternal({
|
|
|
4885
4886
|
onDialogOpenChange
|
|
4886
4887
|
}) {
|
|
4887
4888
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4888
|
-
const router =
|
|
4889
|
-
const { createCode } =
|
|
4890
|
-
const formSchema2 = _react.useMemo.call(void 0, () => _zod3.z.object({ id: _zod3.z.uuidv4() }).and(
|
|
4891
|
-
const getDefaultValues = _react.useCallback.call(void 0, () => ({ id: _uuid.v4.call(void 0, ), ...
|
|
4889
|
+
const router = _chunk3CSPHMVKjs.useI18nRouter.call(void 0, );
|
|
4890
|
+
const { createCode } = _chunkEXG4ANC7js.useCouponContext.call(void 0, );
|
|
4891
|
+
const formSchema2 = _react.useMemo.call(void 0, () => _zod3.z.object({ id: _zod3.z.uuidv4() }).and(_chunkEXG4ANC7js.couponCodeSchema.call(void 0, t)), [t]);
|
|
4892
|
+
const getDefaultValues = _react.useCallback.call(void 0, () => ({ id: _uuid.v4.call(void 0, ), ..._chunkEXG4ANC7js.couponCodeDefaults.call(void 0, ) }), []);
|
|
4892
4893
|
const form = _reacthookform.useForm.call(void 0, {
|
|
4893
4894
|
resolver: _zod.zodResolver.call(void 0, formSchema2),
|
|
4894
4895
|
defaultValues: getDefaultValues()
|
|
4895
4896
|
});
|
|
4896
4897
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4897
|
-
|
|
4898
|
+
_chunkEXG4ANC7js.EditorSheet,
|
|
4898
4899
|
{
|
|
4899
4900
|
form,
|
|
4900
4901
|
entityType: t("billing.admin.coupons.codes.entity"),
|
|
4901
4902
|
isEdit: false,
|
|
4902
|
-
module:
|
|
4903
|
+
module: _chunk3CSPHMVKjs.Modules.StripeCouponCode,
|
|
4903
4904
|
size: "md",
|
|
4904
4905
|
onSuccess: _nullishCoalesce(onSuccess, () => ( (() => {
|
|
4905
4906
|
}))),
|
|
4906
4907
|
onNavigate: (url) => router.push(url),
|
|
4907
|
-
onSubmit: async (values) => await createCode({ id: values.id, couponId, ...
|
|
4908
|
+
onSubmit: async (values) => await createCode({ id: values.id, couponId, ..._chunkEXG4ANC7js.toCouponCodeInput.call(void 0, values) }),
|
|
4908
4909
|
onReset: getDefaultValues,
|
|
4909
4910
|
trigger,
|
|
4910
4911
|
forceShow,
|
|
4911
4912
|
onClose,
|
|
4912
4913
|
dialogOpen,
|
|
4913
4914
|
onDialogOpenChange,
|
|
4914
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4915
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.CouponCodeFields, { form })
|
|
4915
4916
|
}
|
|
4916
4917
|
);
|
|
4917
4918
|
}
|
|
@@ -4925,18 +4926,18 @@ _chunk7QVYU63Ejs.__name.call(void 0, CouponCodeEditor, "CouponCodeEditor");
|
|
|
4925
4926
|
|
|
4926
4927
|
function CouponCodesList({ couponId }) {
|
|
4927
4928
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4928
|
-
const { catalogueVersion } =
|
|
4929
|
-
const data =
|
|
4930
|
-
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) =>
|
|
4929
|
+
const { catalogueVersion } = _chunkEXG4ANC7js.useCouponContext.call(void 0, );
|
|
4930
|
+
const data = _chunkEXG4ANC7js.useDataListRetriever.call(void 0, {
|
|
4931
|
+
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunk3CSPHMVKjs.StripeCouponCodeService.listByCoupon({ ...params, couponId }), "retriever"),
|
|
4931
4932
|
retrieverParams: {},
|
|
4932
|
-
module:
|
|
4933
|
+
module: _chunk3CSPHMVKjs.Modules.StripeCouponCode
|
|
4933
4934
|
});
|
|
4934
4935
|
_react.useEffect.call(void 0, () => {
|
|
4935
4936
|
if (catalogueVersion > 0) void data.refresh();
|
|
4936
4937
|
}, [catalogueVersion]);
|
|
4937
4938
|
const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, CouponCodeEditor, { couponId }, "create-code")];
|
|
4938
4939
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4939
|
-
|
|
4940
|
+
_chunkEXG4ANC7js.ContentListTable,
|
|
4940
4941
|
{
|
|
4941
4942
|
data,
|
|
4942
4943
|
fields: [
|
|
@@ -4947,11 +4948,11 @@ function CouponCodesList({ couponId }) {
|
|
|
4947
4948
|
"status" /* status */,
|
|
4948
4949
|
"actions" /* actions */
|
|
4949
4950
|
],
|
|
4950
|
-
tableGeneratorType:
|
|
4951
|
+
tableGeneratorType: _chunk3CSPHMVKjs.Modules.StripeCouponCode,
|
|
4951
4952
|
functions,
|
|
4952
4953
|
title: t("billing.admin.coupons.codes.title"),
|
|
4953
4954
|
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4954
|
-
|
|
4955
|
+
_chunkEXG4ANC7js.EmptyState,
|
|
4955
4956
|
{
|
|
4956
4957
|
icon: _lucidereact.TicketIcon,
|
|
4957
4958
|
title: t("billing.admin.coupons.codes.empty.title"),
|
|
@@ -4967,12 +4968,12 @@ _chunk7QVYU63Ejs.__name.call(void 0, CouponCodesList, "CouponCodesList");
|
|
|
4967
4968
|
|
|
4968
4969
|
function CouponContainer() {
|
|
4969
4970
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4970
|
-
const { coupon } =
|
|
4971
|
+
const { coupon } = _chunkEXG4ANC7js.useCouponContext.call(void 0, );
|
|
4971
4972
|
if (!coupon) return null;
|
|
4972
4973
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4973
|
-
|
|
4974
|
+
_chunkEXG4ANC7js.RoundPageContainer,
|
|
4974
4975
|
{
|
|
4975
|
-
module:
|
|
4976
|
+
module: _chunkEXG4ANC7js.couponPageModule.call(void 0, ),
|
|
4976
4977
|
id: coupon.id,
|
|
4977
4978
|
tabs: [
|
|
4978
4979
|
{
|
|
@@ -5079,5 +5080,5 @@ _chunk7QVYU63Ejs.__name.call(void 0, CouponContainer, "CouponContainer");
|
|
|
5079
5080
|
|
|
5080
5081
|
|
|
5081
5082
|
|
|
5082
|
-
exports.BillingAlertBanner = BillingAlertBanner; exports.BillingDashboardContainer = BillingDashboardContainer; exports.BillingDetailModal = BillingDetailModal; exports.BillingUsageSummaryCard = BillingUsageSummaryCard; exports.CancelSubscriptionDialog = CancelSubscriptionDialog; exports.CouponCodeActions =
|
|
5083
|
+
exports.BillingAlertBanner = BillingAlertBanner; exports.BillingDashboardContainer = BillingDashboardContainer; exports.BillingDetailModal = BillingDetailModal; exports.BillingUsageSummaryCard = BillingUsageSummaryCard; exports.CancelSubscriptionDialog = CancelSubscriptionDialog; exports.CouponCodeActions = _chunkEXG4ANC7js.CouponCodeActions; exports.CouponCodeEditor = CouponCodeEditor; exports.CouponCodeFields = _chunkEXG4ANC7js.CouponCodeFields; exports.CouponCodesList = CouponCodesList; exports.CouponContainer = CouponContainer; exports.CouponDetails = CouponDetails; exports.CouponEditor = _chunkEXG4ANC7js.CouponEditor; exports.CouponProvider = _chunkEXG4ANC7js.CouponProvider; exports.CouponRefresher = _chunkEXG4ANC7js.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 = _chunkEXG4ANC7js.applyDiscount; exports.couponCodeDefaults = _chunkEXG4ANC7js.couponCodeDefaults; exports.couponCodeSchema = _chunkEXG4ANC7js.couponCodeSchema; exports.couponCurrencyOptions = _chunkEXG4ANC7js.couponCurrencyOptions; exports.formatCurrency = _chunk3CSPHMVKjs.formatCurrency; exports.formatDate = _chunkEXG4ANC7js.formatDate; exports.formatFixed = _chunk3CSPHMVKjs.formatFixed; exports.formatInterval = _chunk3CSPHMVKjs.formatInterval; exports.isStripeConfigured = isStripeConfigured; exports.optionalDate = _chunkEXG4ANC7js.optionalDate; exports.optionalDecimal = _chunkEXG4ANC7js.optionalDecimal; exports.optionalPositiveInt = _chunkEXG4ANC7js.optionalPositiveInt; exports.parseOptionalDecimal = _chunkEXG4ANC7js.parseOptionalDecimal; exports.parseOptionalPositiveInt = _chunkEXG4ANC7js.parseOptionalPositiveInt; exports.priceLabel = priceLabel; exports.promotionCodeDiscount = _chunkEXG4ANC7js.promotionCodeDiscount; exports.subscriptionDiscount = _chunkEXG4ANC7js.subscriptionDiscount; exports.toCouponCodeInput = _chunkEXG4ANC7js.toCouponCodeInput; exports.useBillingFormatOptions = _chunkEXG4ANC7js.useBillingFormatOptions; exports.useCouponContext = _chunkEXG4ANC7js.useCouponContext; exports.usePriceContext = usePriceContext; exports.useProductContext = useProductContext;
|
|
5083
5084
|
//# sourceMappingURL=index.js.map
|