@carlonicora/nextjs-jsonapi 5.7.1 → 5.7.3
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 +493 -505
- package/dist/billing/index.js.map +1 -1
- package/dist/billing/index.mjs +6 -18
- 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/messages/en.json +0 -2
- package/messages/it.json +0 -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/i18n-keys.ts +0 -2
- package/src/features/billing/stripe-subscription/components/details/SubscriptionDetails.tsx +0 -19
- 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,24 +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
|
-
const handlePause = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1325
|
-
setIsProcessing(true);
|
|
1326
|
-
try {
|
|
1327
|
-
await _chunk5TH2DSAHjs.StripeSubscriptionService.pauseSubscription({ subscriptionId: subscription.id });
|
|
1328
|
-
onSubscriptionChange();
|
|
1329
|
-
} catch (error) {
|
|
1330
|
-
console.error("[SubscriptionDetails] Failed to pause subscription:", error);
|
|
1331
|
-
} finally {
|
|
1332
|
-
setIsProcessing(false);
|
|
1333
|
-
}
|
|
1334
|
-
}, "handlePause");
|
|
1335
1325
|
const handleResume = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1336
1326
|
setIsProcessing(true);
|
|
1337
1327
|
try {
|
|
1338
|
-
await
|
|
1328
|
+
await _chunk3CSPHMVKjs.StripeSubscriptionService.resumeSubscription({ subscriptionId: subscription.id });
|
|
1339
1329
|
onSubscriptionChange();
|
|
1340
1330
|
} catch (error) {
|
|
1341
1331
|
console.error("[SubscriptionDetails] Failed to resume subscription:", error);
|
|
@@ -1345,20 +1335,19 @@ function SubscriptionDetails({
|
|
|
1345
1335
|
}, "handleResume");
|
|
1346
1336
|
const handleManageViaPortal = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1347
1337
|
try {
|
|
1348
|
-
const { url } = await
|
|
1338
|
+
const { url } = await _chunk3CSPHMVKjs.StripeCustomerService.createPortalSession();
|
|
1349
1339
|
window.open(url, "_blank");
|
|
1350
1340
|
} catch (error) {
|
|
1351
1341
|
console.error("[SubscriptionDetails] Failed to create portal session:", error);
|
|
1352
1342
|
}
|
|
1353
1343
|
}, "handleManageViaPortal");
|
|
1354
|
-
const canPause = subscription.status === "active" /* ACTIVE */;
|
|
1355
1344
|
const canResume = subscription.status === "paused" /* PAUSED */;
|
|
1356
1345
|
const canCancel = subscription.status === "active" /* ACTIVE */ || subscription.status === "trialing" /* TRIALING */ || subscription.status === "paused" /* PAUSED */;
|
|
1357
1346
|
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,
|
|
1347
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.DialogContent, { className: "max-w-2xl", children: [
|
|
1348
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.DialogHeader, { children: [
|
|
1349
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.DialogTitle, { children: t("billing.ui.subscription.details_title") }),
|
|
1350
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.DialogDescription, { children: t("billing.ui.subscription.details_description") })
|
|
1362
1351
|
] }),
|
|
1363
1352
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
1364
1353
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
@@ -1384,24 +1373,23 @@ function SubscriptionDetails({
|
|
|
1384
1373
|
/* @__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
1374
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.subscription.current_period") }),
|
|
1386
1375
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "text-sm", children: [
|
|
1387
|
-
|
|
1376
|
+
_chunkEXG4ANC7js.formatDate.call(void 0, subscription.currentPeriodStart, fmt),
|
|
1388
1377
|
" - ",
|
|
1389
|
-
|
|
1378
|
+
_chunkEXG4ANC7js.formatDate.call(void 0, subscription.currentPeriodEnd, fmt)
|
|
1390
1379
|
] })
|
|
1391
1380
|
] }) }),
|
|
1392
1381
|
subscription.trialEnd && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1393
1382
|
/* @__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:
|
|
1383
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children: _chunkEXG4ANC7js.formatDate.call(void 0, subscription.trialEnd, fmt) })
|
|
1395
1384
|
] }),
|
|
1396
1385
|
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:
|
|
1386
|
+
date: _chunkEXG4ANC7js.formatDate.call(void 0, subscription.currentPeriodEnd, fmt)
|
|
1398
1387
|
}) }) }),
|
|
1399
1388
|
/* @__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
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2WK35GO2js.Button, { variant: "outline", onClick: handleManageViaPortal, children: t("billing.ui.subscription.manage_portal") })
|
|
1389
|
+
onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Button, { variant: "default", onClick: () => onChangePlan(subscription), children: t("billing.ui.subscription.change_plan") }),
|
|
1390
|
+
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") }),
|
|
1391
|
+
canCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Button, { variant: "destructive", onClick: () => setShowCancel(true), children: t("ui.buttons.cancel") }),
|
|
1392
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Button, { variant: "outline", onClick: handleManageViaPortal, children: t("billing.ui.subscription.manage_portal") })
|
|
1405
1393
|
] })
|
|
1406
1394
|
] })
|
|
1407
1395
|
] }) }),
|
|
@@ -1444,46 +1432,46 @@ function formatPlanName3(price, t) {
|
|
|
1444
1432
|
_chunk7QVYU63Ejs.__name.call(void 0, formatPlanName3, "formatPlanName");
|
|
1445
1433
|
function SubscriptionsList({ subscriptions, onSubscriptionsChange, onChangePlan }) {
|
|
1446
1434
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1447
|
-
const fmt =
|
|
1435
|
+
const fmt = _chunkEXG4ANC7js.useBillingFormatOptions.call(void 0, );
|
|
1448
1436
|
const [selectedSub, setSelectedSub] = _react.useState.call(void 0, null);
|
|
1449
1437
|
const handleRowClick = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (subscription) => {
|
|
1450
1438
|
setSelectedSub(subscription);
|
|
1451
1439
|
}, "handleRowClick");
|
|
1452
1440
|
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,
|
|
1441
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.Table, { children: [
|
|
1442
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.TableRow, { children: [
|
|
1443
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TableHead, { children: t("billing.ui.columns.status") }),
|
|
1444
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TableHead, { children: t("billing.ui.columns.plan") }),
|
|
1445
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TableHead, { children: t("billing.ui.columns.period") }),
|
|
1446
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TableHead, { className: "text-end", children: t("billing.ui.columns.amount") }),
|
|
1447
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TableHead, { className: "text-end", children: t("billing.ui.columns.actions") })
|
|
1460
1448
|
] }) }),
|
|
1461
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1449
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TableBody, { children: subscriptions.map((subscription) => {
|
|
1462
1450
|
const price = subscription.price;
|
|
1463
|
-
const amount = _optionalChain([price, 'optionalAccess', _42 => _42.unitAmount]) ?
|
|
1464
|
-
const discountedAmount = price ?
|
|
1465
|
-
const period = `${
|
|
1451
|
+
const amount = _optionalChain([price, 'optionalAccess', _42 => _42.unitAmount]) ? _chunk3CSPHMVKjs.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt) : "0";
|
|
1452
|
+
const discountedAmount = price ? _chunkEXG4ANC7js.applyDiscount.call(void 0, price.unitAmount, _chunkEXG4ANC7js.subscriptionDiscount.call(void 0, subscription)) : null;
|
|
1453
|
+
const period = `${_chunkEXG4ANC7js.formatDate.call(void 0, subscription.currentPeriodStart, fmt)} - ${_chunkEXG4ANC7js.formatDate.call(void 0, subscription.currentPeriodEnd, fmt)}`;
|
|
1466
1454
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1467
|
-
|
|
1455
|
+
_chunkEXG4ANC7js.TableRow,
|
|
1468
1456
|
{
|
|
1469
1457
|
onClick: () => handleRowClick(subscription),
|
|
1470
1458
|
className: "cursor-pointer hover:bg-muted/50",
|
|
1471
1459
|
children: [
|
|
1472
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1460
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1473
1461
|
SubscriptionStatusBadge,
|
|
1474
1462
|
{
|
|
1475
1463
|
status: subscription.status,
|
|
1476
1464
|
cancelAtPeriodEnd: subscription.cancelAtPeriodEnd
|
|
1477
1465
|
}
|
|
1478
1466
|
) }),
|
|
1479
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1480
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1481
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1467
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TableCell, { className: "font-medium", children: formatPlanName3(price, t) }),
|
|
1468
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TableCell, { className: "text-muted-foreground text-sm", children: period }),
|
|
1469
|
+
/* @__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
1470
|
/* @__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:
|
|
1471
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success", children: _chunk3CSPHMVKjs.formatCurrency.call(void 0, discountedAmount, price.currency, fmt) })
|
|
1484
1472
|
] }) : amount }),
|
|
1485
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1486
|
-
|
|
1473
|
+
/* @__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,
|
|
1474
|
+
_chunkEXG4ANC7js.Button,
|
|
1487
1475
|
{
|
|
1488
1476
|
size: "sm",
|
|
1489
1477
|
variant: "outline",
|
|
@@ -1541,7 +1529,7 @@ function SubscriptionsContainer({
|
|
|
1541
1529
|
}
|
|
1542
1530
|
setLoading(true);
|
|
1543
1531
|
try {
|
|
1544
|
-
const fetchedSubscriptions = await
|
|
1532
|
+
const fetchedSubscriptions = await _chunk3CSPHMVKjs.StripeSubscriptionService.listSubscriptions();
|
|
1545
1533
|
setSubscriptions(fetchedSubscriptions);
|
|
1546
1534
|
} catch (error) {
|
|
1547
1535
|
console.error("[SubscriptionsContainer] Failed to load subscriptions:", error);
|
|
@@ -1564,7 +1552,7 @@ function SubscriptionsContainer({
|
|
|
1564
1552
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8" }),
|
|
1565
1553
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: t("billing.ui.subscriptions.title") })
|
|
1566
1554
|
] }),
|
|
1567
|
-
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1555
|
+
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
1556
|
] }),
|
|
1569
1557
|
criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BillingAlertBanner, { subscription }, subscription.id)),
|
|
1570
1558
|
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 +1560,7 @@ function SubscriptionsContainer({
|
|
|
1572
1560
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
1573
1561
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium mb-2", children: t("billing.ui.subscriptions.empty_title") }),
|
|
1574
1562
|
/* @__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,
|
|
1563
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _45 => _45()]), children: t("billing.ui.subscriptions.subscribe") })
|
|
1576
1564
|
] })
|
|
1577
1565
|
] }),
|
|
1578
1566
|
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -1595,9 +1583,9 @@ function IntervalToggle({ value, onChange, hasMonthly, hasYearly }) {
|
|
|
1595
1583
|
if (!hasMonthly || !hasYearly) {
|
|
1596
1584
|
return null;
|
|
1597
1585
|
}
|
|
1598
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1599
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1600
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1586
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Tabs, { value, onValueChange: (v) => onChange(v), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.TabsList, { children: [
|
|
1587
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TabsTrigger, { value: "month", children: t("billing.admin.prices.interval.month") }),
|
|
1588
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TabsTrigger, { value: "year", children: t("billing.admin.prices.interval.year") })
|
|
1601
1589
|
] }) });
|
|
1602
1590
|
}
|
|
1603
1591
|
_chunk7QVYU63Ejs.__name.call(void 0, IntervalToggle, "IntervalToggle");
|
|
@@ -1615,11 +1603,11 @@ function PricingCard({
|
|
|
1615
1603
|
onSelect
|
|
1616
1604
|
}) {
|
|
1617
1605
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1618
|
-
const fmt =
|
|
1606
|
+
const fmt = _chunkEXG4ANC7js.useBillingFormatOptions.call(void 0, );
|
|
1619
1607
|
const description = price.description || price.nickname || t("billing.ui.pricing.standard");
|
|
1620
1608
|
const features = price.features || [];
|
|
1621
|
-
const formattedPrice =
|
|
1622
|
-
const interval =
|
|
1609
|
+
const formattedPrice = _chunk3CSPHMVKjs.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt);
|
|
1610
|
+
const interval = _chunk3CSPHMVKjs.formatInterval.call(void 0, price, fmt);
|
|
1623
1611
|
const handleKeyDown = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (e) => {
|
|
1624
1612
|
if ((e.key === "Enter" || e.key === " ") && !isDisabled && !isCurrentPlan) {
|
|
1625
1613
|
e.preventDefault();
|
|
@@ -1632,7 +1620,7 @@ function PricingCard({
|
|
|
1632
1620
|
}
|
|
1633
1621
|
}, "handleClick");
|
|
1634
1622
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1635
|
-
|
|
1623
|
+
_chunkEXG4ANC7js.Card,
|
|
1636
1624
|
{
|
|
1637
1625
|
role: "radio",
|
|
1638
1626
|
"aria-checked": isSelected,
|
|
@@ -1640,7 +1628,7 @@ function PricingCard({
|
|
|
1640
1628
|
tabIndex: isDisabled ? -1 : 0,
|
|
1641
1629
|
onKeyDown: handleKeyDown,
|
|
1642
1630
|
onClick: handleClick,
|
|
1643
|
-
className:
|
|
1631
|
+
className: _chunk3CSPHMVKjs.cn.call(void 0,
|
|
1644
1632
|
"relative cursor-pointer transition-all duration-200 flex flex-col h-full",
|
|
1645
1633
|
"focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
1646
1634
|
isCurrentPlan && "bg-muted/30",
|
|
@@ -1650,9 +1638,9 @@ function PricingCard({
|
|
|
1650
1638
|
isLoading && "pointer-events-none"
|
|
1651
1639
|
),
|
|
1652
1640
|
children: [
|
|
1653
|
-
isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1654
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1655
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1641
|
+
isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Badge, { variant: "secondary", className: "absolute top-2 end-2", children: t("billing.ui.pricing.current") }),
|
|
1642
|
+
/* @__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 }) }),
|
|
1643
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.CardContent, { className: "pb-4 grow", children: [
|
|
1656
1644
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mb-4", children: [
|
|
1657
1645
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-3xl font-bold", children: formattedPrice }),
|
|
1658
1646
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground ms-1", children: interval })
|
|
@@ -1662,8 +1650,8 @@ function PricingCard({
|
|
|
1662
1650
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-muted-foreground", children: feature })
|
|
1663
1651
|
] }, index)) })
|
|
1664
1652
|
] }),
|
|
1665
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1666
|
-
|
|
1653
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.CardFooter, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1654
|
+
_chunkEXG4ANC7js.Button,
|
|
1667
1655
|
{
|
|
1668
1656
|
variant: isCurrentPlan ? "secondary" : isSelected ? "default" : "outline",
|
|
1669
1657
|
className: "w-full",
|
|
@@ -1696,7 +1684,7 @@ function ProductPricingRow({
|
|
|
1696
1684
|
return null;
|
|
1697
1685
|
}
|
|
1698
1686
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-3", children: [
|
|
1699
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1687
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.SectionHeader, { children: product.name }),
|
|
1700
1688
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1701
1689
|
"div",
|
|
1702
1690
|
{
|
|
@@ -1797,15 +1785,15 @@ function ProductPricingList({
|
|
|
1797
1785
|
_chunk7QVYU63Ejs.__name.call(void 0, ProductPricingList, "ProductPricingList");
|
|
1798
1786
|
function ProductPricingListSkeleton() {
|
|
1799
1787
|
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,
|
|
1788
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Skeleton, { className: "h-6 w-32" }),
|
|
1801
1789
|
/* @__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,
|
|
1790
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Skeleton, { className: "h-6 w-24" }),
|
|
1791
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Skeleton, { className: "h-8 w-32" }),
|
|
1804
1792
|
/* @__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,
|
|
1793
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Skeleton, { className: "h-4 w-full" }),
|
|
1794
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Skeleton, { className: "h-4 w-3/4" })
|
|
1807
1795
|
] }),
|
|
1808
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1796
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Skeleton, { className: "h-10 w-full" })
|
|
1809
1797
|
] }, cardIndex)) })
|
|
1810
1798
|
] }, rowIndex)) });
|
|
1811
1799
|
}
|
|
@@ -1816,21 +1804,21 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductPricingListSkeleton, "ProductPricing
|
|
|
1816
1804
|
|
|
1817
1805
|
function ProrationPreview({ preview }) {
|
|
1818
1806
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1819
|
-
const fmt =
|
|
1807
|
+
const fmt = _chunkEXG4ANC7js.useBillingFormatOptions.call(void 0, );
|
|
1820
1808
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-primary/10 border-primary/30 rounded-lg border p-4", children: [
|
|
1821
1809
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "text-primary mb-3 font-semibold", children: t("billing.ui.proration.title") }),
|
|
1822
1810
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
1823
1811
|
preview.lineItems.map((item, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between text-sm", children: [
|
|
1824
1812
|
/* @__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:
|
|
1813
|
+
/* @__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
1814
|
] }, index)),
|
|
1827
1815
|
/* @__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
1816
|
/* @__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:
|
|
1817
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-foreground", children: _chunk3CSPHMVKjs.formatCurrency.call(void 0, preview.immediateCharge, preview.currency, fmt) })
|
|
1830
1818
|
] }) }),
|
|
1831
1819
|
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:
|
|
1820
|
+
date: _chunkEXG4ANC7js.formatDate.call(void 0, preview.lineItems[0].period.end, fmt),
|
|
1821
|
+
amount: _chunk3CSPHMVKjs.formatCurrency.call(void 0, preview.amountDue, preview.currency, fmt)
|
|
1834
1822
|
}) })
|
|
1835
1823
|
] })
|
|
1836
1824
|
] });
|
|
@@ -1843,7 +1831,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProrationPreview, "ProrationPreview");
|
|
|
1843
1831
|
|
|
1844
1832
|
function SubscriptionConfirmation({ price, isLoading, onConfirm, onCancel }) {
|
|
1845
1833
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1846
|
-
const fmt =
|
|
1834
|
+
const fmt = _chunkEXG4ANC7js.useBillingFormatOptions.call(void 0, );
|
|
1847
1835
|
const productName = _optionalChain([price, 'access', _51 => _51.product, 'optionalAccess', _52 => _52.name]) || price.nickname || t("billing.ui.wizard.review.selected_plan");
|
|
1848
1836
|
const productDescription = _optionalChain([price, 'access', _53 => _53.product, 'optionalAccess', _54 => _54.description]) || price.description;
|
|
1849
1837
|
const features = price.features || [];
|
|
@@ -1855,16 +1843,16 @@ function SubscriptionConfirmation({ price, isLoading, onConfirm, onCancel }) {
|
|
|
1855
1843
|
productDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-sm text-muted-foreground", children: productDescription })
|
|
1856
1844
|
] }),
|
|
1857
1845
|
/* @__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:
|
|
1846
|
+
_chunk3CSPHMVKjs.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt),
|
|
1847
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-normal text-muted-foreground", children: _chunk3CSPHMVKjs.formatInterval.call(void 0, price, fmt) })
|
|
1860
1848
|
] }),
|
|
1861
1849
|
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
1850
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Check, { className: "h-4 w-4 text-primary" }),
|
|
1863
1851
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: feature })
|
|
1864
1852
|
] }, index)) }),
|
|
1865
1853
|
/* @__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,
|
|
1854
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Button, { variant: "outline", onClick: onCancel, disabled: isLoading, children: t("ui.buttons.cancel") }),
|
|
1855
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Button, { onClick: onConfirm, disabled: isLoading, children: isLoading ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1868
1856
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "h-4 w-4 animate-spin me-2" }),
|
|
1869
1857
|
t("billing.ui.wizard.review.processing")
|
|
1870
1858
|
] }) : t("billing.ui.confirmation.subscribe") })
|
|
@@ -2043,7 +2031,7 @@ function wizardReducer(state, action) {
|
|
|
2043
2031
|
_chunk7QVYU63Ejs.__name.call(void 0, wizardReducer, "wizardReducer");
|
|
2044
2032
|
function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
2045
2033
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2046
|
-
const locale =
|
|
2034
|
+
const locale = _chunk3CSPHMVKjs.useI18nLocale.call(void 0, );
|
|
2047
2035
|
const { confirmPayment } = useConfirmSubscriptionPayment();
|
|
2048
2036
|
const [state, dispatch] = _react.useReducer.call(void 0, wizardReducer, {
|
|
2049
2037
|
...initialState,
|
|
@@ -2055,7 +2043,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2055
2043
|
onCloseRef.current = onClose;
|
|
2056
2044
|
const checkPaymentMethod = _react.useCallback.call(void 0, async () => {
|
|
2057
2045
|
try {
|
|
2058
|
-
const methods = await
|
|
2046
|
+
const methods = await _chunk3CSPHMVKjs.StripeCustomerService.listPaymentMethods();
|
|
2059
2047
|
dispatch({ type: "SET_HAS_PAYMENT_METHOD", hasMethod: methods.length > 0 });
|
|
2060
2048
|
} catch (error) {
|
|
2061
2049
|
console.error("[useSubscriptionWizard] Failed to check payment methods:", error);
|
|
@@ -2073,10 +2061,10 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2073
2061
|
}, []);
|
|
2074
2062
|
const lookUpAutomaticCode = _react.useCallback.call(void 0, async (priceId) => {
|
|
2075
2063
|
try {
|
|
2076
|
-
const automaticCode = await
|
|
2064
|
+
const automaticCode = await _chunk3CSPHMVKjs.StripeCouponCodeService.findAutomatic({ priceId });
|
|
2077
2065
|
dispatch({
|
|
2078
2066
|
type: "SET_PROMOTION_CODE",
|
|
2079
|
-
code: automaticCode ?
|
|
2067
|
+
code: automaticCode ? _chunk3CSPHMVKjs.toPromotionCodeResult.call(void 0, automaticCode) : null
|
|
2080
2068
|
});
|
|
2081
2069
|
return true;
|
|
2082
2070
|
} catch (error) {
|
|
@@ -2103,7 +2091,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2103
2091
|
const isTrialUpgrade = _optionalChain([subscription, 'optionalAccess', _61 => _61.status]) === "trialing" /* TRIALING */;
|
|
2104
2092
|
dispatch({ type: "SET_IS_TRIAL_SUBSCRIPTION", isTrial: isTrialUpgrade });
|
|
2105
2093
|
if (isTrialUpgrade && !state.hasPaymentMethod) {
|
|
2106
|
-
const methods = await
|
|
2094
|
+
const methods = await _chunk3CSPHMVKjs.StripeCustomerService.listPaymentMethods();
|
|
2107
2095
|
if (methods.length === 0) {
|
|
2108
2096
|
dispatch({ type: "SET_STEP", step: "payment-method" });
|
|
2109
2097
|
dispatch({
|
|
@@ -2121,7 +2109,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2121
2109
|
}
|
|
2122
2110
|
}
|
|
2123
2111
|
if (subscription && state.selectedPrice.id !== _optionalChain([subscription, 'access', _62 => _62.price, 'optionalAccess', _63 => _63.id])) {
|
|
2124
|
-
const preview = await
|
|
2112
|
+
const preview = await _chunk3CSPHMVKjs.StripeSubscriptionService.getProrationPreview({
|
|
2125
2113
|
subscriptionId: subscription.id,
|
|
2126
2114
|
newPriceId: state.selectedPrice.id
|
|
2127
2115
|
});
|
|
@@ -2155,14 +2143,14 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2155
2143
|
newPriceId: state.selectedPrice.id,
|
|
2156
2144
|
promotionCode: promotionCodeToSend(state.promotionCode)
|
|
2157
2145
|
};
|
|
2158
|
-
result = await
|
|
2146
|
+
result = await _chunk3CSPHMVKjs.StripeSubscriptionService.changePlanWithMeta(changePlanParams);
|
|
2159
2147
|
} else {
|
|
2160
2148
|
const createParams = {
|
|
2161
2149
|
id: _uuid.v4.call(void 0, ),
|
|
2162
2150
|
priceId: state.selectedPrice.id,
|
|
2163
2151
|
promotionCode: promotionCodeToSend(state.promotionCode)
|
|
2164
2152
|
};
|
|
2165
|
-
result = await
|
|
2153
|
+
result = await _chunk3CSPHMVKjs.StripeSubscriptionService.createSubscription(createParams);
|
|
2166
2154
|
}
|
|
2167
2155
|
const clientSecret = clientSecretToConfirm(result.meta);
|
|
2168
2156
|
if (clientSecret) {
|
|
@@ -2178,7 +2166,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2178
2166
|
const subscriptionId = subscriptionIdToSync(result.subscription, subscription);
|
|
2179
2167
|
if (subscriptionId) {
|
|
2180
2168
|
try {
|
|
2181
|
-
await
|
|
2169
|
+
await _chunk3CSPHMVKjs.StripeSubscriptionService.syncSubscription({ subscriptionId });
|
|
2182
2170
|
} catch (syncError) {
|
|
2183
2171
|
console.error("[useSubscriptionWizard] Subscription sync after payment failed:", syncError);
|
|
2184
2172
|
}
|
|
@@ -2226,7 +2214,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2226
2214
|
dispatch({ type: "SET_VALIDATING_PROMO_CODE", isValidating: true });
|
|
2227
2215
|
dispatch({ type: "SET_PROMO_CODE_ERROR", error: null });
|
|
2228
2216
|
try {
|
|
2229
|
-
const result = await
|
|
2217
|
+
const result = await _chunk3CSPHMVKjs.StripePromotionCodeService.validatePromotionCode({
|
|
2230
2218
|
code,
|
|
2231
2219
|
stripePriceId: _optionalChain([state, 'access', _72 => _72.selectedPrice, 'optionalAccess', _73 => _73.id]),
|
|
2232
2220
|
language: locale
|
|
@@ -2351,7 +2339,7 @@ function WizardStepPlanSelection({
|
|
|
2351
2339
|
_react.useEffect.call(void 0, () => {
|
|
2352
2340
|
const loadProducts = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2353
2341
|
try {
|
|
2354
|
-
const fetchedProducts = await
|
|
2342
|
+
const fetchedProducts = await _chunk3CSPHMVKjs.StripeProductService.listProducts({ active: true });
|
|
2355
2343
|
setProducts(fetchedProducts);
|
|
2356
2344
|
} catch (error) {
|
|
2357
2345
|
console.error("[WizardStepPlanSelection] Failed to load products:", error);
|
|
@@ -2402,7 +2390,7 @@ function WizardStepPlanSelection({
|
|
|
2402
2390
|
onSelectPrice: handleSelectPrice
|
|
2403
2391
|
}
|
|
2404
2392
|
),
|
|
2405
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex justify-end pt-4 border-t", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2393
|
+
/* @__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
2394
|
] });
|
|
2407
2395
|
}
|
|
2408
2396
|
_chunk7QVYU63Ejs.__name.call(void 0, WizardStepPlanSelection, "WizardStepPlanSelection");
|
|
@@ -2426,7 +2414,7 @@ function PromoCodeInput({
|
|
|
2426
2414
|
disabled = false
|
|
2427
2415
|
}) {
|
|
2428
2416
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2429
|
-
const locale =
|
|
2417
|
+
const locale = _chunk3CSPHMVKjs.useI18nLocale.call(void 0, );
|
|
2430
2418
|
const [code, setCode] = _react.useState.call(void 0, "");
|
|
2431
2419
|
const appliedKey = _optionalChain([appliedCode, 'optionalAccess', _82 => _82.valid]) ? `${appliedCode.automatic ? "auto" : "typed"}:${_nullishCoalesce(appliedCode.code, () => ( ""))}` : null;
|
|
2432
2420
|
const [previousAppliedKey, setPreviousAppliedKey] = _react.useState.call(void 0, appliedKey);
|
|
@@ -2455,7 +2443,7 @@ function PromoCodeInput({
|
|
|
2455
2443
|
}
|
|
2456
2444
|
const amount = (result.discountValue || 0) / 100;
|
|
2457
2445
|
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} ${
|
|
2446
|
+
return t("billing.ui.wizard.review.amount_off", { amount: `${currency} ${_chunk3CSPHMVKjs.formatFixed.call(void 0, amount, locale, 2)}` });
|
|
2459
2447
|
}, "formatDiscount");
|
|
2460
2448
|
const formatDuration = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (result) => {
|
|
2461
2449
|
switch (result.duration) {
|
|
@@ -2472,7 +2460,7 @@ function PromoCodeInput({
|
|
|
2472
2460
|
const codeInput = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
2473
2461
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
|
|
2474
2462
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2475
|
-
|
|
2463
|
+
_chunkEXG4ANC7js.Input,
|
|
2476
2464
|
{
|
|
2477
2465
|
placeholder: t("billing.ui.promo_code.placeholder"),
|
|
2478
2466
|
value: code,
|
|
@@ -2482,7 +2470,7 @@ function PromoCodeInput({
|
|
|
2482
2470
|
className: "flex-1"
|
|
2483
2471
|
}
|
|
2484
2472
|
),
|
|
2485
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2473
|
+
/* @__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
2474
|
] }),
|
|
2487
2475
|
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error })
|
|
2488
2476
|
] });
|
|
@@ -2511,7 +2499,7 @@ function PromoCodeInput({
|
|
|
2511
2499
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success text-sm", children: formatDiscount(appliedCode) })
|
|
2512
2500
|
] }),
|
|
2513
2501
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2514
|
-
|
|
2502
|
+
_chunkEXG4ANC7js.Button,
|
|
2515
2503
|
{
|
|
2516
2504
|
variant: "ghost",
|
|
2517
2505
|
size: "sm",
|
|
@@ -2559,7 +2547,7 @@ function WizardStepReview({
|
|
|
2559
2547
|
isTrialUpgrade
|
|
2560
2548
|
}) {
|
|
2561
2549
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2562
|
-
const fmt =
|
|
2550
|
+
const fmt = _chunkEXG4ANC7js.useBillingFormatOptions.call(void 0, );
|
|
2563
2551
|
const [card, setCard] = _react.useState.call(void 0, null);
|
|
2564
2552
|
_react.useEffect.call(void 0, () => {
|
|
2565
2553
|
if (!hasPaymentMethod) {
|
|
@@ -2567,7 +2555,7 @@ function WizardStepReview({
|
|
|
2567
2555
|
return;
|
|
2568
2556
|
}
|
|
2569
2557
|
let cancelled = false;
|
|
2570
|
-
Promise.all([
|
|
2558
|
+
Promise.all([_chunk3CSPHMVKjs.StripeCustomerService.listPaymentMethods(), _chunk3CSPHMVKjs.StripeCustomerService.getCustomer()]).then(([methods, customer]) => {
|
|
2571
2559
|
if (!cancelled) setCard(reviewCard(methods, _optionalChain([customer, 'optionalAccess', _90 => _90.defaultPaymentMethodId])));
|
|
2572
2560
|
}).catch((err) => {
|
|
2573
2561
|
console.error("[WizardStepReview] Failed to load the card on file:", err);
|
|
@@ -2586,24 +2574,24 @@ function WizardStepReview({
|
|
|
2586
2574
|
const interval = _optionalChain([price, 'access', _93 => _93.recurring, 'optionalAccess', _94 => _94.interval]) || "month";
|
|
2587
2575
|
return interval === "year" ? t("billing.ui.wizard.review.interval_yearly") : t("billing.ui.wizard.review.interval_monthly");
|
|
2588
2576
|
}, "formatInterval");
|
|
2589
|
-
const codeDiscount =
|
|
2590
|
-
const carriedDiscount = isChangingPlan && !codeDiscount ?
|
|
2577
|
+
const codeDiscount = _chunkEXG4ANC7js.promotionCodeDiscount.call(void 0, promotionCode);
|
|
2578
|
+
const carriedDiscount = isChangingPlan && !codeDiscount ? _chunkEXG4ANC7js.subscriptionDiscount.call(void 0, subscription) : null;
|
|
2591
2579
|
const discount = _nullishCoalesce(codeDiscount, () => ( carriedDiscount));
|
|
2592
|
-
const discountedPrice =
|
|
2593
|
-
const discountedImmediateCharge =
|
|
2580
|
+
const discountedPrice = _chunkEXG4ANC7js.applyDiscount.call(void 0, selectedPrice.unitAmount, discount);
|
|
2581
|
+
const discountedImmediateCharge = _chunkEXG4ANC7js.applyDiscount.call(void 0, _optionalChain([prorationPreview, 'optionalAccess', _95 => _95.immediateCharge]), discount);
|
|
2594
2582
|
const getDiscountDescription = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
2595
2583
|
if (!discount) return null;
|
|
2596
2584
|
if (discount.discountType === "percent_off") {
|
|
2597
2585
|
return t("billing.ui.wizard.review.percent_off", { value: discount.discountValue });
|
|
2598
2586
|
}
|
|
2599
2587
|
return t("billing.ui.wizard.review.amount_off", {
|
|
2600
|
-
amount:
|
|
2588
|
+
amount: _chunk3CSPHMVKjs.formatCurrency.call(void 0, discount.discountValue, discount.currency || selectedPrice.currency, fmt)
|
|
2601
2589
|
});
|
|
2602
2590
|
}, "getDiscountDescription");
|
|
2603
2591
|
const discountDescription = getDiscountDescription();
|
|
2604
2592
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
2605
2593
|
/* @__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,
|
|
2594
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.SectionHeader, { children: t("billing.ui.wizard.review.selected_plan") }),
|
|
2607
2595
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between items-center", children: [
|
|
2608
2596
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
2609
2597
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-medium", children: _optionalChain([selectedPrice, 'access', _96 => _96.product, 'optionalAccess', _97 => _97.name]) }),
|
|
@@ -2611,11 +2599,11 @@ function WizardStepReview({
|
|
|
2611
2599
|
] }),
|
|
2612
2600
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-end", children: [
|
|
2613
2601
|
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,
|
|
2602
|
+
/* @__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) }),
|
|
2603
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-success text-lg font-semibold", children: _chunk3CSPHMVKjs.formatCurrency.call(void 0, discountedPrice, selectedPrice.currency, fmt) }),
|
|
2604
|
+
discountDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Badge, { variant: "softGreen", children: discountDescription }),
|
|
2617
2605
|
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:
|
|
2606
|
+
] }) : /* @__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
2607
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: formatInterval2(selectedPrice) })
|
|
2620
2608
|
] })
|
|
2621
2609
|
] })
|
|
@@ -2630,9 +2618,9 @@ function WizardStepReview({
|
|
|
2630
2618
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between text-sm", children: [
|
|
2631
2619
|
/* @__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
2620
|
/* @__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
|
-
] }) :
|
|
2621
|
+
/* @__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) }),
|
|
2622
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success", children: _chunk3CSPHMVKjs.formatCurrency.call(void 0, discountedImmediateCharge, prorationPreview.currency, fmt) })
|
|
2623
|
+
] }) : _chunk3CSPHMVKjs.formatCurrency.call(void 0, prorationPreview.immediateCharge, prorationPreview.currency, fmt) })
|
|
2636
2624
|
] })
|
|
2637
2625
|
]
|
|
2638
2626
|
}
|
|
@@ -2656,15 +2644,15 @@ function WizardStepReview({
|
|
|
2656
2644
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "font-medium", children: t("billing.ui.payment_method.title") }),
|
|
2657
2645
|
/* @__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
2646
|
] }),
|
|
2659
|
-
hasPaymentMethod ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2647
|
+
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
2648
|
] }) }),
|
|
2661
|
-
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2649
|
+
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.Alert, { variant: "destructive", children: [
|
|
2662
2650
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.AlertCircle, { className: "h-4 w-4" }),
|
|
2663
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2651
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.AlertDescription, { children: error })
|
|
2664
2652
|
] }),
|
|
2665
2653
|
/* @__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,
|
|
2654
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Button, { variant: "outline", onClick: onBack, disabled: isProcessing, children: t("billing.ui.wizard.back") }),
|
|
2655
|
+
/* @__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
2656
|
] })
|
|
2669
2657
|
] });
|
|
2670
2658
|
}
|
|
@@ -2677,7 +2665,7 @@ function WizardStepPaymentMethod({ onBack, onSuccess, isProcessing }) {
|
|
|
2677
2665
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2678
2666
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
2679
2667
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
2680
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2668
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.SectionHeader, { children: t("billing.ui.payment_methods.add") }),
|
|
2681
2669
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: t("billing.ui.wizard.payment_description") })
|
|
2682
2670
|
] }),
|
|
2683
2671
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodForm, { onSuccess, onCancel: onBack, isLoading: isProcessing, alwaysSetDefault: true })
|
|
@@ -2720,10 +2708,10 @@ function SubscriptionWizard({
|
|
|
2720
2708
|
const isChangePlanMode = !!subscription;
|
|
2721
2709
|
const dialogTitle = subscription ? t("billing.ui.wizard.change_title") : isPurchasingAddons ? t("billing.ui.subscriptions.purchase_addons") : t("billing.ui.subscriptions.subscribe");
|
|
2722
2710
|
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,
|
|
2711
|
+
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: [
|
|
2712
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.DialogHeader, { children: [
|
|
2713
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.DialogTitle, { children: dialogTitle }),
|
|
2714
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.DialogDescription, { children: dialogDescription })
|
|
2727
2715
|
] }),
|
|
2728
2716
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, WizardProgressIndicator, { currentStep: state.step }),
|
|
2729
2717
|
state.step === "plan-selection" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -2791,7 +2779,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, getProgressColor, "getProgressColor");
|
|
|
2791
2779
|
function formatDate2(date, { locale, t }) {
|
|
2792
2780
|
if (!date) return t("billing.ui.not_available");
|
|
2793
2781
|
try {
|
|
2794
|
-
return new Intl.DateTimeFormat(locale, {
|
|
2782
|
+
return new Intl.DateTimeFormat(_chunk3CSPHMVKjs.dateFormatLocale.call(void 0, locale), {
|
|
2795
2783
|
month: "short",
|
|
2796
2784
|
day: "numeric"
|
|
2797
2785
|
}).format(new Date(date));
|
|
@@ -2802,7 +2790,7 @@ function formatDate2(date, { locale, t }) {
|
|
|
2802
2790
|
_chunk7QVYU63Ejs.__name.call(void 0, formatDate2, "formatDate");
|
|
2803
2791
|
function UsageSummaryCard({ meter, summary }) {
|
|
2804
2792
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2805
|
-
const fmt =
|
|
2793
|
+
const fmt = _chunkEXG4ANC7js.useBillingFormatOptions.call(void 0, );
|
|
2806
2794
|
const currentUsage = _nullishCoalesce(_optionalChain([summary, 'optionalAccess', _100 => _100.aggregatedValue]), () => ( 0));
|
|
2807
2795
|
const limit = meter.limit;
|
|
2808
2796
|
const percentage = limit && limit > 0 ? currentUsage / limit * 100 : null;
|
|
@@ -2810,15 +2798,15 @@ function UsageSummaryCard({ meter, summary }) {
|
|
|
2810
2798
|
const progressWidth = percentage !== null ? Math.min(percentage, 100) : 0;
|
|
2811
2799
|
const displayName = meter.displayName || meter.eventName;
|
|
2812
2800
|
const hasLimit = limit !== null && limit !== void 0;
|
|
2813
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2814
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2801
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.Card, { children: [
|
|
2802
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.CardHeader, { className: "flex flex-row items-center gap-x-3 pb-3", children: [
|
|
2815
2803
|
/* @__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
2804
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col", children: [
|
|
2817
2805
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium", children: displayName }),
|
|
2818
2806
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-xs", children: meter.id })
|
|
2819
2807
|
] })
|
|
2820
2808
|
] }),
|
|
2821
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2809
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.CardContent, { className: "flex flex-col gap-y-4", children: [
|
|
2822
2810
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
2823
2811
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-3xl font-bold", children: currentUsage.toLocaleString(fmt.locale) }),
|
|
2824
2812
|
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 +2814,7 @@ function UsageSummaryCard({ meter, summary }) {
|
|
|
2826
2814
|
hasLimit ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-2", children: [
|
|
2827
2815
|
/* @__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
2816
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-sm", children: t("billing.ui.usage.percent_used", {
|
|
2829
|
-
value: percentage !== null ?
|
|
2817
|
+
value: percentage !== null ? _chunk3CSPHMVKjs.formatFixed.call(void 0, percentage, fmt.locale, 1) : ""
|
|
2830
2818
|
}) })
|
|
2831
2819
|
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-sm", children: t("billing.ui.usage.no_limit") }),
|
|
2832
2820
|
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 +2847,14 @@ function UsageContainer() {
|
|
|
2859
2847
|
const loadUsageData = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2860
2848
|
setLoading(true);
|
|
2861
2849
|
try {
|
|
2862
|
-
const fetchedSubscriptions = await
|
|
2850
|
+
const fetchedSubscriptions = await _chunk3CSPHMVKjs.StripeSubscriptionService.listSubscriptions();
|
|
2863
2851
|
setSubscriptions(fetchedSubscriptions);
|
|
2864
2852
|
const hasMeteredSubscriptions2 = fetchedSubscriptions.some((sub) => _optionalChain([sub, 'access', _101 => _101.price, 'optionalAccess', _102 => _102.recurring, 'optionalAccess', _103 => _103.usageType]) === "metered");
|
|
2865
2853
|
if (!hasMeteredSubscriptions2) {
|
|
2866
2854
|
setLoading(false);
|
|
2867
2855
|
return;
|
|
2868
2856
|
}
|
|
2869
|
-
const fetchedMeters = await
|
|
2857
|
+
const fetchedMeters = await _chunk3CSPHMVKjs.StripeUsageService.listMeters();
|
|
2870
2858
|
setMeters(fetchedMeters);
|
|
2871
2859
|
const summariesMap = {};
|
|
2872
2860
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -2874,7 +2862,7 @@ function UsageContainer() {
|
|
|
2874
2862
|
const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
|
|
2875
2863
|
for (const meter of fetchedMeters) {
|
|
2876
2864
|
try {
|
|
2877
|
-
const meterSummaries = await
|
|
2865
|
+
const meterSummaries = await _chunk3CSPHMVKjs.StripeUsageService.getMeterSummaries({
|
|
2878
2866
|
meterId: meter.id,
|
|
2879
2867
|
startTime: startOfMonth,
|
|
2880
2868
|
endTime: endOfMonth
|
|
@@ -2923,7 +2911,7 @@ function formatDateTime(date, { locale, t }) {
|
|
|
2923
2911
|
if (!date) return t("billing.ui.not_available");
|
|
2924
2912
|
const dateObj = typeof date === "string" ? new Date(date) : date;
|
|
2925
2913
|
try {
|
|
2926
|
-
return new Intl.DateTimeFormat(locale, {
|
|
2914
|
+
return new Intl.DateTimeFormat(_chunk3CSPHMVKjs.dateFormatLocale.call(void 0, locale), {
|
|
2927
2915
|
month: "short",
|
|
2928
2916
|
day: "numeric",
|
|
2929
2917
|
year: "numeric",
|
|
@@ -2937,27 +2925,27 @@ function formatDateTime(date, { locale, t }) {
|
|
|
2937
2925
|
_chunk7QVYU63Ejs.__name.call(void 0, formatDateTime, "formatDateTime");
|
|
2938
2926
|
function UsageHistoryTable({ usageRecords }) {
|
|
2939
2927
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2940
|
-
const fmt =
|
|
2928
|
+
const fmt = _chunkEXG4ANC7js.useBillingFormatOptions.call(void 0, );
|
|
2941
2929
|
if (usageRecords.length === 0) {
|
|
2942
2930
|
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
2931
|
}
|
|
2944
2932
|
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,
|
|
2933
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.SectionHeader, { level: 2, children: t("billing.ui.usage.history_title") }),
|
|
2934
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-clip rounded-lg border", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.Table, { children: [
|
|
2935
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.TableRow, { children: [
|
|
2936
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TableHead, { children: t("billing.ui.columns.date_time") }),
|
|
2937
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TableHead, { children: t("billing.ui.columns.meter_event") }),
|
|
2938
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TableHead, { className: "text-end", children: t("billing.ui.columns.quantity") }),
|
|
2939
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TableHead, { children: t("billing.ui.columns.event_id") })
|
|
2952
2940
|
] }) }),
|
|
2953
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2941
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TableBody, { children: usageRecords.map((record) => {
|
|
2954
2942
|
const dateTime = formatDateTime(record.timestamp, fmt);
|
|
2955
2943
|
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,
|
|
2944
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.TableRow, { children: [
|
|
2945
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TableCell, { className: "font-medium", children: dateTime }),
|
|
2946
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TableCell, { className: "text-muted-foreground", children: record.meterEventName }),
|
|
2947
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TableCell, { className: "text-end font-medium", children: quantity }),
|
|
2948
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.TableCell, { className: "text-muted-foreground text-sm tabular-nums", children: record.stripeEventId })
|
|
2961
2949
|
] }, record.id);
|
|
2962
2950
|
}) })
|
|
2963
2951
|
] }) })
|
|
@@ -2968,8 +2956,8 @@ _chunk7QVYU63Ejs.__name.call(void 0, UsageHistoryTable, "UsageHistoryTable");
|
|
|
2968
2956
|
// src/features/billing/components/modals/BillingDetailModal.tsx
|
|
2969
2957
|
|
|
2970
2958
|
function BillingDetailModal({ open, onOpenChange, title, children, className }) {
|
|
2971
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2972
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2959
|
+
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: [
|
|
2960
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.DialogHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.DialogTitle, { children: title }) }),
|
|
2973
2961
|
children
|
|
2974
2962
|
] }) });
|
|
2975
2963
|
}
|
|
@@ -2997,7 +2985,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
|
|
|
2997
2985
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-destructive text-sm font-medium", children: t("billing.ui.alert.payment_failed_title") }),
|
|
2998
2986
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive mt-1 text-sm", children: t("billing.ui.alert.payment_failed_description") })
|
|
2999
2987
|
] }),
|
|
3000
|
-
onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2988
|
+
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
2989
|
] });
|
|
3002
2990
|
}
|
|
3003
2991
|
if (subscription.status === "trialing" /* TRIALING */ && subscription.trialEnd) {
|
|
@@ -3011,7 +2999,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
|
|
|
3011
2999
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-warning text-sm font-medium", children: t("billing.ui.alert.trial_ending_title") }),
|
|
3012
3000
|
/* @__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
3001
|
] }),
|
|
3014
|
-
onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3002
|
+
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
3003
|
] });
|
|
3016
3004
|
}
|
|
3017
3005
|
}
|
|
@@ -3063,7 +3051,7 @@ function BillingDashboardContainer() {
|
|
|
3063
3051
|
setNoCustomerExists(false);
|
|
3064
3052
|
let customer = null;
|
|
3065
3053
|
try {
|
|
3066
|
-
customer = await
|
|
3054
|
+
customer = await _chunk3CSPHMVKjs.StripeCustomerService.getCustomer();
|
|
3067
3055
|
setData((prev) => ({ ...prev, customer }));
|
|
3068
3056
|
setErrors((prev) => ({ ...prev, customer: null }));
|
|
3069
3057
|
setNoCustomerExists(false);
|
|
@@ -3089,7 +3077,7 @@ function BillingDashboardContainer() {
|
|
|
3089
3077
|
}
|
|
3090
3078
|
const fetchSubscriptions = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3091
3079
|
try {
|
|
3092
|
-
const subscriptions2 = await
|
|
3080
|
+
const subscriptions2 = await _chunk3CSPHMVKjs.StripeSubscriptionService.listSubscriptions();
|
|
3093
3081
|
setData((prev) => ({ ...prev, subscriptions: subscriptions2 }));
|
|
3094
3082
|
setErrors((prev) => ({ ...prev, subscriptions: null }));
|
|
3095
3083
|
return subscriptions2;
|
|
@@ -3103,7 +3091,7 @@ function BillingDashboardContainer() {
|
|
|
3103
3091
|
}, "fetchSubscriptions");
|
|
3104
3092
|
const fetchPaymentMethods = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3105
3093
|
try {
|
|
3106
|
-
const paymentMethods = await
|
|
3094
|
+
const paymentMethods = await _chunk3CSPHMVKjs.StripeCustomerService.listPaymentMethods();
|
|
3107
3095
|
setData((prev) => ({ ...prev, paymentMethods }));
|
|
3108
3096
|
setErrors((prev) => ({ ...prev, paymentMethods: null }));
|
|
3109
3097
|
} catch (error) {
|
|
@@ -3115,7 +3103,7 @@ function BillingDashboardContainer() {
|
|
|
3115
3103
|
}, "fetchPaymentMethods");
|
|
3116
3104
|
const fetchInvoices = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3117
3105
|
try {
|
|
3118
|
-
const invoices = await
|
|
3106
|
+
const invoices = await _chunk3CSPHMVKjs.StripeInvoiceService.listInvoices();
|
|
3119
3107
|
setData((prev) => ({ ...prev, invoices }));
|
|
3120
3108
|
setErrors((prev) => ({ ...prev, invoices: null }));
|
|
3121
3109
|
} catch (error) {
|
|
@@ -3138,7 +3126,7 @@ function BillingDashboardContainer() {
|
|
|
3138
3126
|
const handleCreateCustomer = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3139
3127
|
setCreatingCustomer(true);
|
|
3140
3128
|
try {
|
|
3141
|
-
await
|
|
3129
|
+
await _chunk3CSPHMVKjs.StripeCustomerService.createCustomer();
|
|
3142
3130
|
setNoCustomerExists(false);
|
|
3143
3131
|
await fetchAllData();
|
|
3144
3132
|
} catch (error) {
|
|
@@ -3150,7 +3138,7 @@ function BillingDashboardContainer() {
|
|
|
3150
3138
|
}, "handleCreateCustomer");
|
|
3151
3139
|
const fetchUsageData = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3152
3140
|
try {
|
|
3153
|
-
const meters = await
|
|
3141
|
+
const meters = await _chunk3CSPHMVKjs.StripeUsageService.listMeters();
|
|
3154
3142
|
setData((prev) => ({ ...prev, meters }));
|
|
3155
3143
|
const summariesMap = {};
|
|
3156
3144
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -3158,7 +3146,7 @@ function BillingDashboardContainer() {
|
|
|
3158
3146
|
const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
|
|
3159
3147
|
for (const meter of meters) {
|
|
3160
3148
|
try {
|
|
3161
|
-
const meterSummaries = await
|
|
3149
|
+
const meterSummaries = await _chunk3CSPHMVKjs.StripeUsageService.getMeterSummaries({
|
|
3162
3150
|
meterId: meter.id,
|
|
3163
3151
|
startTime: startOfMonth,
|
|
3164
3152
|
endTime: endOfMonth
|
|
@@ -3245,18 +3233,18 @@ function BillingDashboardContainer() {
|
|
|
3245
3233
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-8 w-8" }),
|
|
3246
3234
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: t("billing.title") })
|
|
3247
3235
|
] }),
|
|
3248
|
-
isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3249
|
-
noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3250
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3236
|
+
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" }) }) }),
|
|
3237
|
+
noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.Card, { children: [
|
|
3238
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.CardHeader, { className: "text-center", children: [
|
|
3251
3239
|
/* @__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,
|
|
3240
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.CardTitle, { children: t("billing.ui.dashboard.setup_title") }),
|
|
3241
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.CardDescription, { children: t("billing.ui.dashboard.setup_description") })
|
|
3254
3242
|
] }),
|
|
3255
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3243
|
+
/* @__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
3244
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "me-2 h-4 w-4 animate-spin" }),
|
|
3257
3245
|
t("billing.ui.dashboard.setting_up")
|
|
3258
3246
|
] }) : t("billing.ui.dashboard.setup_button") }) }),
|
|
3259
|
-
errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3247
|
+
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
3248
|
] }),
|
|
3261
3249
|
!noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
3262
3250
|
criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -3400,7 +3388,7 @@ function getStripePromise(publishableKey) {
|
|
|
3400
3388
|
}
|
|
3401
3389
|
_chunk7QVYU63Ejs.__name.call(void 0, getStripePromise, "getStripePromise");
|
|
3402
3390
|
function StripeProvider({ children }) {
|
|
3403
|
-
const publishableKey =
|
|
3391
|
+
const publishableKey = _chunkCP7BXAFHjs.getStripePublishableKey.call(void 0, );
|
|
3404
3392
|
const stripePromise = _react.useMemo.call(void 0, () => getStripePromise(publishableKey), [publishableKey]);
|
|
3405
3393
|
const options = _react.useMemo.call(void 0, () => ({}), []);
|
|
3406
3394
|
if (!publishableKey) {
|
|
@@ -3410,7 +3398,7 @@ function StripeProvider({ children }) {
|
|
|
3410
3398
|
}
|
|
3411
3399
|
_chunk7QVYU63Ejs.__name.call(void 0, StripeProvider, "StripeProvider");
|
|
3412
3400
|
function isStripeConfigured() {
|
|
3413
|
-
return !!
|
|
3401
|
+
return !!_chunkCP7BXAFHjs.getStripePublishableKey.call(void 0, );
|
|
3414
3402
|
}
|
|
3415
3403
|
_chunk7QVYU63Ejs.__name.call(void 0, isStripeConfigured, "isStripeConfigured");
|
|
3416
3404
|
|
|
@@ -3425,18 +3413,18 @@ _chunk7QVYU63Ejs.__name.call(void 0, isStripeConfigured, "isStripeConfigured");
|
|
|
3425
3413
|
|
|
3426
3414
|
function PriceArchiver({ price }) {
|
|
3427
3415
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
3428
|
-
const fmt =
|
|
3416
|
+
const fmt = _chunkEXG4ANC7js.useBillingFormatOptions.call(void 0, );
|
|
3429
3417
|
const { archivePrice, restorePrice } = usePriceContext();
|
|
3430
3418
|
const [open, setOpen] = _react.useState.call(void 0, false);
|
|
3431
3419
|
const isArchived = !price.active;
|
|
3432
3420
|
const scope = isArchived ? "restore" : "archive";
|
|
3433
3421
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
3434
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3422
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.Button, { variant: "outline", size: "sm", onClick: () => setOpen(true), children: [
|
|
3435
3423
|
isArchived ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RotateCcwIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ArchiveIcon, {}),
|
|
3436
3424
|
t(`billing.admin.prices.${scope}.confirm`)
|
|
3437
3425
|
] }),
|
|
3438
3426
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3439
|
-
|
|
3427
|
+
_chunkEXG4ANC7js.ConfirmDialog,
|
|
3440
3428
|
{
|
|
3441
3429
|
open,
|
|
3442
3430
|
onOpenChange: setOpen,
|
|
@@ -3450,7 +3438,7 @@ function PriceArchiver({ price }) {
|
|
|
3450
3438
|
if (isArchived) await restorePrice(price.id);
|
|
3451
3439
|
else await archivePrice(price.id);
|
|
3452
3440
|
} catch (error) {
|
|
3453
|
-
|
|
3441
|
+
_chunkEXG4ANC7js.errorToast.call(void 0, { title: t(`billing.admin.prices.${scope}.title`), error });
|
|
3454
3442
|
throw error;
|
|
3455
3443
|
}
|
|
3456
3444
|
}
|
|
@@ -3482,15 +3470,15 @@ function PriceEditorInternal({
|
|
|
3482
3470
|
onDialogOpenChange
|
|
3483
3471
|
}) {
|
|
3484
3472
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
3485
|
-
const fmt =
|
|
3486
|
-
const router =
|
|
3473
|
+
const fmt = _chunkEXG4ANC7js.useBillingFormatOptions.call(void 0, );
|
|
3474
|
+
const router = _chunk3CSPHMVKjs.useI18nRouter.call(void 0, );
|
|
3487
3475
|
const { createPrice, updatePrice, productId: contextProductId } = usePriceContext();
|
|
3488
3476
|
const [allFeatures, setAllFeatures] = _react.useState.call(void 0, []);
|
|
3489
3477
|
const isEdit = !!price;
|
|
3490
3478
|
const targetProductId = _nullishCoalesce(_nullishCoalesce(productId, () => ( _optionalChain([price, 'optionalAccess', _119 => _119.product, 'optionalAccess', _120 => _120.id]))), () => ( contextProductId));
|
|
3491
3479
|
_react.useEffect.call(void 0, () => {
|
|
3492
3480
|
const fetchFeatures = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3493
|
-
setAllFeatures(await
|
|
3481
|
+
setAllFeatures(await _chunk3CSPHMVKjs.FeatureService.findMany({}));
|
|
3494
3482
|
}, "fetchFeatures");
|
|
3495
3483
|
void fetchFeatures();
|
|
3496
3484
|
}, []);
|
|
@@ -3603,7 +3591,7 @@ function PriceEditorInternal({
|
|
|
3603
3591
|
warnedUnknownFor.current = fingerprint;
|
|
3604
3592
|
const { unknown } = resolvePlatformFeatures(seed.platformFeatures);
|
|
3605
3593
|
if (unknown.length > 0)
|
|
3606
|
-
|
|
3594
|
+
_chunk3CSPHMVKjs.showToast.call(void 0, t("billing.admin.prices.import.warnings.unknownFeatures", { features: unknown.join(", ") }));
|
|
3607
3595
|
}, [seed, isEdit, allFeatures, resolvePlatformFeatures, t]);
|
|
3608
3596
|
const watchInterval = form.watch("interval");
|
|
3609
3597
|
const isRecurring = watchInterval !== "one_time";
|
|
@@ -3624,13 +3612,13 @@ function PriceEditorInternal({
|
|
|
3624
3612
|
{ id: "metered", text: t("billing.admin.prices.usage.metered") }
|
|
3625
3613
|
];
|
|
3626
3614
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3627
|
-
|
|
3615
|
+
_chunkEXG4ANC7js.EditorSheet,
|
|
3628
3616
|
{
|
|
3629
3617
|
form,
|
|
3630
3618
|
entityType: t("billing.admin.prices.entity"),
|
|
3631
3619
|
entityName: price ? priceLabel(price, fmt) : void 0,
|
|
3632
3620
|
isEdit,
|
|
3633
|
-
module:
|
|
3621
|
+
module: _chunk3CSPHMVKjs.Modules.StripePrice,
|
|
3634
3622
|
size: "lg",
|
|
3635
3623
|
propagateChanges,
|
|
3636
3624
|
onSuccess,
|
|
@@ -3679,13 +3667,13 @@ function PriceEditorInternal({
|
|
|
3679
3667
|
dialogOpen,
|
|
3680
3668
|
onDialogOpenChange,
|
|
3681
3669
|
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,
|
|
3670
|
+
isEdit && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.Alert, { children: [
|
|
3671
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.AlertTitle, { children: t("billing.admin.prices.immutability.title") }),
|
|
3672
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.AlertDescription, { children: t("billing.admin.prices.immutability.description") })
|
|
3685
3673
|
] }),
|
|
3686
3674
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
|
|
3687
3675
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3688
|
-
|
|
3676
|
+
_chunkEXG4ANC7js.FormInput,
|
|
3689
3677
|
{
|
|
3690
3678
|
form,
|
|
3691
3679
|
id: "unitAmount",
|
|
@@ -3697,7 +3685,7 @@ function PriceEditorInternal({
|
|
|
3697
3685
|
}
|
|
3698
3686
|
),
|
|
3699
3687
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3700
|
-
|
|
3688
|
+
_chunkEXG4ANC7js.FormSelect,
|
|
3701
3689
|
{
|
|
3702
3690
|
form,
|
|
3703
3691
|
id: "currency",
|
|
@@ -3708,7 +3696,7 @@ function PriceEditorInternal({
|
|
|
3708
3696
|
)
|
|
3709
3697
|
] }),
|
|
3710
3698
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3711
|
-
|
|
3699
|
+
_chunkEXG4ANC7js.FormSelect,
|
|
3712
3700
|
{
|
|
3713
3701
|
form,
|
|
3714
3702
|
id: "interval",
|
|
@@ -3719,7 +3707,7 @@ function PriceEditorInternal({
|
|
|
3719
3707
|
),
|
|
3720
3708
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
|
|
3721
3709
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3722
|
-
|
|
3710
|
+
_chunkEXG4ANC7js.FormInput,
|
|
3723
3711
|
{
|
|
3724
3712
|
form,
|
|
3725
3713
|
id: "intervalCount",
|
|
@@ -3730,7 +3718,7 @@ function PriceEditorInternal({
|
|
|
3730
3718
|
}
|
|
3731
3719
|
),
|
|
3732
3720
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3733
|
-
|
|
3721
|
+
_chunkEXG4ANC7js.FormSelect,
|
|
3734
3722
|
{
|
|
3735
3723
|
form,
|
|
3736
3724
|
id: "usageType",
|
|
@@ -3741,7 +3729,7 @@ function PriceEditorInternal({
|
|
|
3741
3729
|
)
|
|
3742
3730
|
] }),
|
|
3743
3731
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3744
|
-
|
|
3732
|
+
_chunkEXG4ANC7js.FormInput,
|
|
3745
3733
|
{
|
|
3746
3734
|
form,
|
|
3747
3735
|
id: "nickname",
|
|
@@ -3750,7 +3738,7 @@ function PriceEditorInternal({
|
|
|
3750
3738
|
}
|
|
3751
3739
|
),
|
|
3752
3740
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3753
|
-
|
|
3741
|
+
_chunkEXG4ANC7js.FormTextarea,
|
|
3754
3742
|
{
|
|
3755
3743
|
form,
|
|
3756
3744
|
id: "description",
|
|
@@ -3760,7 +3748,7 @@ function PriceEditorInternal({
|
|
|
3760
3748
|
}
|
|
3761
3749
|
),
|
|
3762
3750
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3763
|
-
|
|
3751
|
+
_chunkEXG4ANC7js.FormInput,
|
|
3764
3752
|
{
|
|
3765
3753
|
form,
|
|
3766
3754
|
id: "token",
|
|
@@ -3770,10 +3758,10 @@ function PriceEditorInternal({
|
|
|
3770
3758
|
}
|
|
3771
3759
|
),
|
|
3772
3760
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-2", children: [
|
|
3773
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3761
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.FieldLabel, { children: t("billing.admin.prices.fields.features") }),
|
|
3774
3762
|
form.watch("features").map((_, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
|
|
3775
3763
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3776
|
-
|
|
3764
|
+
_chunkEXG4ANC7js.Input,
|
|
3777
3765
|
{
|
|
3778
3766
|
...form.register(`features.${index}`),
|
|
3779
3767
|
placeholder: t("billing.admin.prices.placeholders.feature", { index: index + 1 }),
|
|
@@ -3781,7 +3769,7 @@ function PriceEditorInternal({
|
|
|
3781
3769
|
}
|
|
3782
3770
|
),
|
|
3783
3771
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3784
|
-
|
|
3772
|
+
_chunkEXG4ANC7js.Button,
|
|
3785
3773
|
{
|
|
3786
3774
|
type: "button",
|
|
3787
3775
|
variant: "outline",
|
|
@@ -3796,7 +3784,7 @@ function PriceEditorInternal({
|
|
|
3796
3784
|
)
|
|
3797
3785
|
] }, index)),
|
|
3798
3786
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3799
|
-
|
|
3787
|
+
_chunkEXG4ANC7js.Button,
|
|
3800
3788
|
{
|
|
3801
3789
|
type: "button",
|
|
3802
3790
|
variant: "outline",
|
|
@@ -3811,12 +3799,12 @@ function PriceEditorInternal({
|
|
|
3811
3799
|
)
|
|
3812
3800
|
] }),
|
|
3813
3801
|
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,
|
|
3802
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.FieldLabel, { children: t("billing.admin.prices.fields.platformFeatures") }),
|
|
3815
3803
|
/* @__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
3804
|
const isChecked = form.watch("featureIds").includes(feature.id);
|
|
3817
3805
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
3818
3806
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3819
|
-
|
|
3807
|
+
_chunkEXG4ANC7js.Checkbox,
|
|
3820
3808
|
{
|
|
3821
3809
|
id: `feature-${feature.id}`,
|
|
3822
3810
|
checked: isChecked,
|
|
@@ -3832,13 +3820,13 @@ function PriceEditorInternal({
|
|
|
3832
3820
|
}
|
|
3833
3821
|
}
|
|
3834
3822
|
),
|
|
3835
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3823
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.FieldLabel, { htmlFor: `feature-${feature.id}`, children: feature.name }),
|
|
3836
3824
|
feature.isCore && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.admin.prices.help.core") })
|
|
3837
3825
|
] }, feature.id);
|
|
3838
3826
|
}) })
|
|
3839
3827
|
] }),
|
|
3840
3828
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3841
|
-
|
|
3829
|
+
_chunkEXG4ANC7js.FormCheckbox,
|
|
3842
3830
|
{
|
|
3843
3831
|
form,
|
|
3844
3832
|
id: "isTrial",
|
|
@@ -3881,7 +3869,7 @@ var defaultContextValue = {
|
|
|
3881
3869
|
productId: void 0
|
|
3882
3870
|
};
|
|
3883
3871
|
function priceLabel(price, fmt = {}) {
|
|
3884
|
-
return _nullishCoalesce(price.nickname, () => ( `${
|
|
3872
|
+
return _nullishCoalesce(price.nickname, () => ( `${_chunk3CSPHMVKjs.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt)} ${_chunk3CSPHMVKjs.formatInterval.call(void 0, price, fmt)}`.trim()));
|
|
3885
3873
|
}
|
|
3886
3874
|
_chunk7QVYU63Ejs.__name.call(void 0, priceLabel, "priceLabel");
|
|
3887
3875
|
var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
@@ -3891,22 +3879,22 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3891
3879
|
productId: productIdProp
|
|
3892
3880
|
}) => {
|
|
3893
3881
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
3894
|
-
const fmt =
|
|
3895
|
-
const generateUrl =
|
|
3896
|
-
const { hasRole } =
|
|
3882
|
+
const fmt = _chunkEXG4ANC7js.useBillingFormatOptions.call(void 0, );
|
|
3883
|
+
const generateUrl = _chunkEXG4ANC7js.usePageUrlGenerator.call(void 0, );
|
|
3884
|
+
const { hasRole } = _chunkEXG4ANC7js.useCurrentUserContext.call(void 0, );
|
|
3897
3885
|
const [price, setPrice] = _react.useState.call(void 0,
|
|
3898
|
-
dehydratedPrice ?
|
|
3886
|
+
dehydratedPrice ? _chunk3CSPHMVKjs.rehydrate.call(void 0, _chunk3CSPHMVKjs.Modules.StripePrice, dehydratedPrice) : void 0
|
|
3899
3887
|
);
|
|
3900
3888
|
const [priceVersion, setPriceVersion] = _react.useState.call(void 0, 0);
|
|
3901
3889
|
const refreshPrices = _react.useCallback.call(void 0, () => setPriceVersion((value2) => value2 + 1), []);
|
|
3902
3890
|
const productId = _nullishCoalesce(productIdProp, () => ( _optionalChain([price, 'optionalAccess', _143 => _143.product, 'optionalAccess', _144 => _144.id])));
|
|
3903
3891
|
const reloadPrice = _react.useCallback.call(void 0, async () => {
|
|
3904
3892
|
if (!_optionalChain([price, 'optionalAccess', _145 => _145.id])) return;
|
|
3905
|
-
setPrice(await
|
|
3893
|
+
setPrice(await _chunk3CSPHMVKjs.StripePriceService.getPrice({ id: price.id }));
|
|
3906
3894
|
}, [_optionalChain([price, 'optionalAccess', _146 => _146.id])]);
|
|
3907
3895
|
const createPrice = _react.useCallback.call(void 0,
|
|
3908
3896
|
async (input) => {
|
|
3909
|
-
const saved = await
|
|
3897
|
+
const saved = await _chunk3CSPHMVKjs.StripePriceService.createPrice(input);
|
|
3910
3898
|
refreshPrices();
|
|
3911
3899
|
return saved;
|
|
3912
3900
|
},
|
|
@@ -3914,7 +3902,7 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3914
3902
|
);
|
|
3915
3903
|
const updatePrice = _react.useCallback.call(void 0,
|
|
3916
3904
|
async (input) => {
|
|
3917
|
-
const saved = await
|
|
3905
|
+
const saved = await _chunk3CSPHMVKjs.StripePriceService.updatePrice(input);
|
|
3918
3906
|
setPrice(saved);
|
|
3919
3907
|
refreshPrices();
|
|
3920
3908
|
return saved;
|
|
@@ -3925,7 +3913,7 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3925
3913
|
async (id) => {
|
|
3926
3914
|
const target = _nullishCoalesce(id, () => ( _optionalChain([price, 'optionalAccess', _147 => _147.id])));
|
|
3927
3915
|
if (!target) return;
|
|
3928
|
-
await
|
|
3916
|
+
await _chunk3CSPHMVKjs.StripePriceService.archivePrice({ id: target });
|
|
3929
3917
|
await reloadPrice();
|
|
3930
3918
|
refreshPrices();
|
|
3931
3919
|
},
|
|
@@ -3935,7 +3923,7 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3935
3923
|
async (id) => {
|
|
3936
3924
|
const target = _nullishCoalesce(id, () => ( _optionalChain([price, 'optionalAccess', _149 => _149.id])));
|
|
3937
3925
|
if (!target) return;
|
|
3938
|
-
await
|
|
3926
|
+
await _chunk3CSPHMVKjs.StripePriceService.reactivatePrice({ id: target });
|
|
3939
3927
|
await reloadPrice();
|
|
3940
3928
|
refreshPrices();
|
|
3941
3929
|
},
|
|
@@ -3959,12 +3947,12 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3959
3947
|
if (!publishChrome) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceContext.Provider, { value, children });
|
|
3960
3948
|
const breadcrumb = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
3961
3949
|
const items = [
|
|
3962
|
-
{ name: t("billing.admin.products.title"), href: generateUrl({ page:
|
|
3950
|
+
{ name: t("billing.admin.products.title"), href: generateUrl({ page: _chunk3CSPHMVKjs.Modules.StripeProduct }) }
|
|
3963
3951
|
];
|
|
3964
3952
|
if (_optionalChain([price, 'optionalAccess', _151 => _151.product]))
|
|
3965
3953
|
items.push({
|
|
3966
3954
|
name: price.product.name,
|
|
3967
|
-
href: generateUrl({ page:
|
|
3955
|
+
href: generateUrl({ page: _chunk3CSPHMVKjs.Modules.StripeProduct, id: price.product.id })
|
|
3968
3956
|
});
|
|
3969
3957
|
if (price) items.push({ name: priceLabel(price, fmt) });
|
|
3970
3958
|
return items;
|
|
@@ -3981,7 +3969,7 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3981
3969
|
}
|
|
3982
3970
|
return response;
|
|
3983
3971
|
}, "title");
|
|
3984
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3972
|
+
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
3973
|
}, "PriceProvider");
|
|
3986
3974
|
var usePriceContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => _nullishCoalesce(_react.useContext.call(void 0, PriceContext), () => ( defaultContextValue)), "usePriceContext");
|
|
3987
3975
|
|
|
@@ -4001,12 +3989,12 @@ function ProductArchiver({ product }) {
|
|
|
4001
3989
|
const isArchived = !product.active;
|
|
4002
3990
|
const scope = isArchived ? "restore" : "archive";
|
|
4003
3991
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
4004
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3992
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEXG4ANC7js.Button, { variant: "outline", size: "sm", onClick: () => setOpen(true), children: [
|
|
4005
3993
|
isArchived ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RotateCcwIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ArchiveIcon, {}),
|
|
4006
3994
|
t(`billing.admin.products.${scope}.confirm`)
|
|
4007
3995
|
] }),
|
|
4008
3996
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4009
|
-
|
|
3997
|
+
_chunkEXG4ANC7js.ConfirmDialog,
|
|
4010
3998
|
{
|
|
4011
3999
|
open,
|
|
4012
4000
|
onOpenChange: setOpen,
|
|
@@ -4020,7 +4008,7 @@ function ProductArchiver({ product }) {
|
|
|
4020
4008
|
if (isArchived) await restoreProduct(product.id);
|
|
4021
4009
|
else await archiveProduct(product.id);
|
|
4022
4010
|
} catch (error) {
|
|
4023
|
-
|
|
4011
|
+
_chunkEXG4ANC7js.errorToast.call(void 0, { title: t(`billing.admin.products.${scope}.title`), error });
|
|
4024
4012
|
throw error;
|
|
4025
4013
|
}
|
|
4026
4014
|
}
|
|
@@ -4049,7 +4037,7 @@ function ProductEditorInternal({
|
|
|
4049
4037
|
onDialogOpenChange
|
|
4050
4038
|
}) {
|
|
4051
4039
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4052
|
-
const router =
|
|
4040
|
+
const router = _chunk3CSPHMVKjs.useI18nRouter.call(void 0, );
|
|
4053
4041
|
const { createProduct, updateProduct } = useProductContext();
|
|
4054
4042
|
const isEdit = !!product;
|
|
4055
4043
|
const formSchema2 = _react.useMemo.call(void 0,
|
|
@@ -4073,13 +4061,13 @@ function ProductEditorInternal({
|
|
|
4073
4061
|
defaultValues: getDefaultValues()
|
|
4074
4062
|
});
|
|
4075
4063
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4076
|
-
|
|
4064
|
+
_chunkEXG4ANC7js.EditorSheet,
|
|
4077
4065
|
{
|
|
4078
4066
|
form,
|
|
4079
4067
|
entityType: t("billing.admin.products.entity"),
|
|
4080
4068
|
entityName: _optionalChain([product, 'optionalAccess', _155 => _155.name]),
|
|
4081
4069
|
isEdit,
|
|
4082
|
-
module:
|
|
4070
|
+
module: _chunk3CSPHMVKjs.Modules.StripeProduct,
|
|
4083
4071
|
size: "md",
|
|
4084
4072
|
propagateChanges,
|
|
4085
4073
|
onSuccess,
|
|
@@ -4096,7 +4084,7 @@ function ProductEditorInternal({
|
|
|
4096
4084
|
onDialogOpenChange,
|
|
4097
4085
|
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4098
4086
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4099
|
-
|
|
4087
|
+
_chunkEXG4ANC7js.FormInput,
|
|
4100
4088
|
{
|
|
4101
4089
|
form,
|
|
4102
4090
|
id: "name",
|
|
@@ -4106,7 +4094,7 @@ function ProductEditorInternal({
|
|
|
4106
4094
|
}
|
|
4107
4095
|
),
|
|
4108
4096
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4109
|
-
|
|
4097
|
+
_chunkEXG4ANC7js.FormTextarea,
|
|
4110
4098
|
{
|
|
4111
4099
|
form,
|
|
4112
4100
|
id: "description",
|
|
@@ -4150,20 +4138,20 @@ var defaultContextValue2 = {
|
|
|
4150
4138
|
};
|
|
4151
4139
|
var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ children, dehydratedProduct, publishChrome = true }) => {
|
|
4152
4140
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4153
|
-
const generateUrl =
|
|
4154
|
-
const { hasRole } =
|
|
4141
|
+
const generateUrl = _chunkEXG4ANC7js.usePageUrlGenerator.call(void 0, );
|
|
4142
|
+
const { hasRole } = _chunkEXG4ANC7js.useCurrentUserContext.call(void 0, );
|
|
4155
4143
|
const [product, setProduct] = _react.useState.call(void 0,
|
|
4156
|
-
dehydratedProduct ?
|
|
4144
|
+
dehydratedProduct ? _chunk3CSPHMVKjs.rehydrate.call(void 0, _chunk3CSPHMVKjs.Modules.StripeProduct, dehydratedProduct) : void 0
|
|
4157
4145
|
);
|
|
4158
4146
|
const [catalogueVersion, setCatalogueVersion] = _react.useState.call(void 0, 0);
|
|
4159
4147
|
const refreshCatalogue = _react.useCallback.call(void 0, () => setCatalogueVersion((value2) => value2 + 1), []);
|
|
4160
4148
|
const reloadProduct = _react.useCallback.call(void 0, async () => {
|
|
4161
4149
|
if (!_optionalChain([product, 'optionalAccess', _156 => _156.id])) return;
|
|
4162
|
-
setProduct(await
|
|
4150
|
+
setProduct(await _chunk3CSPHMVKjs.StripeProductService.getProduct({ id: product.id }));
|
|
4163
4151
|
}, [_optionalChain([product, 'optionalAccess', _157 => _157.id])]);
|
|
4164
4152
|
const createProduct = _react.useCallback.call(void 0,
|
|
4165
4153
|
async (input) => {
|
|
4166
|
-
const saved = await
|
|
4154
|
+
const saved = await _chunk3CSPHMVKjs.StripeProductService.createProduct(input);
|
|
4167
4155
|
refreshCatalogue();
|
|
4168
4156
|
return saved;
|
|
4169
4157
|
},
|
|
@@ -4171,7 +4159,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
4171
4159
|
);
|
|
4172
4160
|
const updateProduct = _react.useCallback.call(void 0,
|
|
4173
4161
|
async (input) => {
|
|
4174
|
-
const saved = await
|
|
4162
|
+
const saved = await _chunk3CSPHMVKjs.StripeProductService.updateProduct(input);
|
|
4175
4163
|
setProduct(saved);
|
|
4176
4164
|
refreshCatalogue();
|
|
4177
4165
|
return saved;
|
|
@@ -4182,7 +4170,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
4182
4170
|
async (id) => {
|
|
4183
4171
|
const target = _nullishCoalesce(id, () => ( _optionalChain([product, 'optionalAccess', _158 => _158.id])));
|
|
4184
4172
|
if (!target) return;
|
|
4185
|
-
await
|
|
4173
|
+
await _chunk3CSPHMVKjs.StripeProductService.archiveProduct({ id: target });
|
|
4186
4174
|
await reloadProduct();
|
|
4187
4175
|
refreshCatalogue();
|
|
4188
4176
|
},
|
|
@@ -4192,7 +4180,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
4192
4180
|
async (id) => {
|
|
4193
4181
|
const target = _nullishCoalesce(id, () => ( _optionalChain([product, 'optionalAccess', _160 => _160.id])));
|
|
4194
4182
|
if (!target) return;
|
|
4195
|
-
await
|
|
4183
|
+
await _chunk3CSPHMVKjs.StripeProductService.reactivateProduct({ id: target });
|
|
4196
4184
|
await reloadProduct();
|
|
4197
4185
|
refreshCatalogue();
|
|
4198
4186
|
},
|
|
@@ -4227,7 +4215,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
4227
4215
|
{
|
|
4228
4216
|
name: t("billing.admin.products.title"),
|
|
4229
4217
|
// Linked only when it is NOT the current page.
|
|
4230
|
-
...product ? { href: generateUrl({ page:
|
|
4218
|
+
...product ? { href: generateUrl({ page: _chunk3CSPHMVKjs.Modules.StripeProduct }) } : {}
|
|
4231
4219
|
}
|
|
4232
4220
|
];
|
|
4233
4221
|
if (product) items.push({ name: product.name });
|
|
@@ -4245,7 +4233,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
4245
4233
|
}
|
|
4246
4234
|
return response;
|
|
4247
4235
|
}, "title");
|
|
4248
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4236
|
+
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
4237
|
}, "ProductProvider");
|
|
4250
4238
|
var useProductContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => _nullishCoalesce(_react.useContext.call(void 0, ProductContext), () => ( defaultContextValue2)), "useProductContext");
|
|
4251
4239
|
|
|
@@ -4254,57 +4242,57 @@ var useProductContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ()
|
|
|
4254
4242
|
|
|
4255
4243
|
function PriceDetails() {
|
|
4256
4244
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4257
|
-
const fmt =
|
|
4258
|
-
const generateUrl =
|
|
4245
|
+
const fmt = _chunkEXG4ANC7js.useBillingFormatOptions.call(void 0, );
|
|
4246
|
+
const generateUrl = _chunkEXG4ANC7js.usePageUrlGenerator.call(void 0, );
|
|
4259
4247
|
const { price } = usePriceContext();
|
|
4260
4248
|
if (!price) return null;
|
|
4261
4249
|
const isRecurring = price.priceType === "recurring";
|
|
4262
4250
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-8", children: [
|
|
4263
4251
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4264
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4252
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.SectionHeader, { children: t("billing.admin.prices.title") }),
|
|
4265
4253
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
4266
4254
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4267
|
-
|
|
4255
|
+
_chunkEXG4ANC7js.DetailField,
|
|
4268
4256
|
{
|
|
4269
4257
|
label: t("billing.admin.prices.fields.product"),
|
|
4270
|
-
value: price.product ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4258
|
+
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
4259
|
}
|
|
4272
4260
|
),
|
|
4273
4261
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4274
|
-
|
|
4262
|
+
_chunkEXG4ANC7js.DetailField,
|
|
4275
4263
|
{
|
|
4276
4264
|
label: t("billing.admin.prices.fields.status"),
|
|
4277
4265
|
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,
|
|
4266
|
+
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") }),
|
|
4267
|
+
price.isTrial && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Badge, { variant: "softBlue", children: t("billing.admin.prices.badge.trial") })
|
|
4280
4268
|
] })
|
|
4281
4269
|
}
|
|
4282
4270
|
),
|
|
4283
4271
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4284
|
-
|
|
4272
|
+
_chunkEXG4ANC7js.DetailField,
|
|
4285
4273
|
{
|
|
4286
4274
|
label: t("billing.admin.prices.fields.amount"),
|
|
4287
|
-
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children:
|
|
4275
|
+
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _chunk3CSPHMVKjs.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt) })
|
|
4288
4276
|
}
|
|
4289
4277
|
),
|
|
4290
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4278
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.DetailField, { label: t("billing.admin.prices.fields.currency"), value: price.currency.toUpperCase() }),
|
|
4291
4279
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4292
|
-
|
|
4280
|
+
_chunkEXG4ANC7js.DetailField,
|
|
4293
4281
|
{
|
|
4294
4282
|
label: t("billing.admin.prices.fields.type"),
|
|
4295
4283
|
value: isRecurring ? t("billing.admin.prices.type.recurring") : t("billing.admin.prices.type.oneTime")
|
|
4296
4284
|
}
|
|
4297
4285
|
),
|
|
4298
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4286
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.DetailField, { label: t("billing.admin.prices.fields.billing"), value: _chunk3CSPHMVKjs.formatInterval.call(void 0, price, fmt) }),
|
|
4299
4287
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4300
|
-
|
|
4288
|
+
_chunkEXG4ANC7js.DetailField,
|
|
4301
4289
|
{
|
|
4302
4290
|
label: t("billing.admin.prices.fields.intervalCount"),
|
|
4303
4291
|
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
4292
|
}
|
|
4305
4293
|
),
|
|
4306
4294
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4307
|
-
|
|
4295
|
+
_chunkEXG4ANC7js.DetailField,
|
|
4308
4296
|
{
|
|
4309
4297
|
label: t("billing.admin.prices.fields.usageType"),
|
|
4310
4298
|
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 +4301,24 @@ function PriceDetails() {
|
|
|
4313
4301
|
] })
|
|
4314
4302
|
] }),
|
|
4315
4303
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4316
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4304
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.SectionHeader, { children: t("billing.admin.prices.fields.platformFeatures") }),
|
|
4317
4305
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
4318
4306
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4319
|
-
|
|
4307
|
+
_chunkEXG4ANC7js.DetailField,
|
|
4320
4308
|
{
|
|
4321
4309
|
label: t("billing.admin.prices.fields.token"),
|
|
4322
4310
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _nullishCoalesce(price.token, () => ( "\u2014")) })
|
|
4323
4311
|
}
|
|
4324
4312
|
),
|
|
4325
4313
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4326
|
-
|
|
4314
|
+
_chunkEXG4ANC7js.DetailField,
|
|
4327
4315
|
{
|
|
4328
4316
|
label: t("billing.admin.prices.fields.stripeId"),
|
|
4329
4317
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: price.stripePriceId })
|
|
4330
4318
|
}
|
|
4331
4319
|
),
|
|
4332
4320
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4333
|
-
|
|
4321
|
+
_chunkEXG4ANC7js.DetailField,
|
|
4334
4322
|
{
|
|
4335
4323
|
label: t("billing.admin.prices.fields.description"),
|
|
4336
4324
|
value: _nullishCoalesce(price.description, () => ( "\u2014")),
|
|
@@ -4338,7 +4326,7 @@ function PriceDetails() {
|
|
|
4338
4326
|
}
|
|
4339
4327
|
),
|
|
4340
4328
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4341
|
-
|
|
4329
|
+
_chunkEXG4ANC7js.DetailField,
|
|
4342
4330
|
{
|
|
4343
4331
|
label: t("billing.admin.prices.fields.features"),
|
|
4344
4332
|
className: "md:col-span-2",
|
|
@@ -4346,11 +4334,11 @@ function PriceDetails() {
|
|
|
4346
4334
|
}
|
|
4347
4335
|
),
|
|
4348
4336
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4349
|
-
|
|
4337
|
+
_chunkEXG4ANC7js.DetailField,
|
|
4350
4338
|
{
|
|
4351
4339
|
label: t("billing.admin.prices.fields.platformFeatures"),
|
|
4352
4340
|
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,
|
|
4341
|
+
value: price.priceFeatures.length > 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "flex flex-wrap items-center gap-1", children: price.priceFeatures.map((feature) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.Badge, { variant: "softGray", children: feature.name }, feature.id)) }) : "\u2014"
|
|
4354
4342
|
}
|
|
4355
4343
|
)
|
|
4356
4344
|
] })
|
|
@@ -4364,7 +4352,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, PriceDetails, "PriceDetails");
|
|
|
4364
4352
|
function PriceContainer() {
|
|
4365
4353
|
const { price } = usePriceContext();
|
|
4366
4354
|
if (!price) return null;
|
|
4367
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4355
|
+
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
4356
|
}
|
|
4369
4357
|
_chunk7QVYU63Ejs.__name.call(void 0, PriceContainer, "PriceContainer");
|
|
4370
4358
|
|
|
@@ -4489,10 +4477,10 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4489
4477
|
const importInputRef = _react.useRef.call(void 0, null);
|
|
4490
4478
|
const [seed, setSeed] = _react.useState.call(void 0, void 0);
|
|
4491
4479
|
const [seedNonce, setSeedNonce] = _react.useState.call(void 0, 0);
|
|
4492
|
-
const data =
|
|
4493
|
-
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) =>
|
|
4480
|
+
const data = _chunkEXG4ANC7js.useDataListRetriever.call(void 0, {
|
|
4481
|
+
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunk3CSPHMVKjs.StripePriceService.listPrices({ ...params, productId }), "retriever"),
|
|
4494
4482
|
retrieverParams: {},
|
|
4495
|
-
module:
|
|
4483
|
+
module: _chunk3CSPHMVKjs.Modules.StripePrice
|
|
4496
4484
|
});
|
|
4497
4485
|
_react.useEffect.call(void 0, () => {
|
|
4498
4486
|
if (priceVersion > 0) void data.refresh();
|
|
@@ -4527,7 +4515,7 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4527
4515
|
openSeededEditor(transfer.price);
|
|
4528
4516
|
} catch (error) {
|
|
4529
4517
|
console.error("[PricesList] price import failed", error);
|
|
4530
|
-
|
|
4518
|
+
_chunkEXG4ANC7js.errorToast.call(void 0, {
|
|
4531
4519
|
title: t("billing.admin.prices.import.errors.title"),
|
|
4532
4520
|
error: t("billing.admin.prices.import.errors.invalid")
|
|
4533
4521
|
});
|
|
@@ -4546,7 +4534,7 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4546
4534
|
"create-price"
|
|
4547
4535
|
),
|
|
4548
4536
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _react.Fragment, { children: [
|
|
4549
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
4537
|
+
/* @__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
4538
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.UploadIcon, {}),
|
|
4551
4539
|
t("billing.admin.prices.actions.import")
|
|
4552
4540
|
] }),
|
|
@@ -4564,7 +4552,7 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4564
4552
|
];
|
|
4565
4553
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
4566
4554
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4567
|
-
|
|
4555
|
+
_chunkEXG4ANC7js.ContentListTable,
|
|
4568
4556
|
{
|
|
4569
4557
|
data,
|
|
4570
4558
|
fields: [
|
|
@@ -4575,13 +4563,13 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4575
4563
|
"status" /* status */,
|
|
4576
4564
|
"actions" /* actions */
|
|
4577
4565
|
],
|
|
4578
|
-
tableGeneratorType:
|
|
4566
|
+
tableGeneratorType: _chunk3CSPHMVKjs.Modules.StripePrice,
|
|
4579
4567
|
functions,
|
|
4580
4568
|
context: tableContext,
|
|
4581
4569
|
fullWidth,
|
|
4582
4570
|
title: t("billing.admin.prices.title"),
|
|
4583
4571
|
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4584
|
-
|
|
4572
|
+
_chunkEXG4ANC7js.EmptyState,
|
|
4585
4573
|
{
|
|
4586
4574
|
icon: _lucidereact.DollarSignIcon,
|
|
4587
4575
|
title: t("billing.admin.prices.empty.title"),
|
|
@@ -4621,18 +4609,18 @@ function ProductDetails() {
|
|
|
4621
4609
|
const { product } = useProductContext();
|
|
4622
4610
|
if (!product) return null;
|
|
4623
4611
|
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,
|
|
4612
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.SectionHeader, { children: t("billing.admin.products.tabs.details") }),
|
|
4625
4613
|
/* @__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,
|
|
4614
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.DetailField, { label: t("billing.admin.products.fields.name"), value: product.name }),
|
|
4627
4615
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4628
|
-
|
|
4616
|
+
_chunkEXG4ANC7js.DetailField,
|
|
4629
4617
|
{
|
|
4630
4618
|
label: t("billing.admin.products.fields.status"),
|
|
4631
|
-
value: product.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4619
|
+
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
4620
|
}
|
|
4633
4621
|
),
|
|
4634
4622
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4635
|
-
|
|
4623
|
+
_chunkEXG4ANC7js.DetailField,
|
|
4636
4624
|
{
|
|
4637
4625
|
label: t("billing.admin.products.fields.description"),
|
|
4638
4626
|
value: _nullishCoalesce(product.description, () => ( "\u2014")),
|
|
@@ -4640,14 +4628,14 @@ function ProductDetails() {
|
|
|
4640
4628
|
}
|
|
4641
4629
|
),
|
|
4642
4630
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4643
|
-
|
|
4631
|
+
_chunkEXG4ANC7js.DetailField,
|
|
4644
4632
|
{
|
|
4645
4633
|
label: t("billing.admin.products.fields.prices"),
|
|
4646
4634
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: product.stripePrices.length })
|
|
4647
4635
|
}
|
|
4648
4636
|
),
|
|
4649
4637
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4650
|
-
|
|
4638
|
+
_chunkEXG4ANC7js.DetailField,
|
|
4651
4639
|
{
|
|
4652
4640
|
label: t("billing.admin.products.fields.stripeId"),
|
|
4653
4641
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: product.stripeProductId })
|
|
@@ -4665,9 +4653,9 @@ function ProductContainer() {
|
|
|
4665
4653
|
const { product } = useProductContext();
|
|
4666
4654
|
if (!product) return null;
|
|
4667
4655
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4668
|
-
|
|
4656
|
+
_chunkEXG4ANC7js.RoundPageContainer,
|
|
4669
4657
|
{
|
|
4670
|
-
module:
|
|
4658
|
+
module: _chunk3CSPHMVKjs.Modules.StripeProduct,
|
|
4671
4659
|
id: product.id,
|
|
4672
4660
|
tabs: [
|
|
4673
4661
|
{
|
|
@@ -4676,7 +4664,7 @@ function ProductContainer() {
|
|
|
4676
4664
|
content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductDetails, {})
|
|
4677
4665
|
},
|
|
4678
4666
|
{
|
|
4679
|
-
key:
|
|
4667
|
+
key: _chunk3CSPHMVKjs.Modules.StripePrice,
|
|
4680
4668
|
label: t("billing.admin.prices.title"),
|
|
4681
4669
|
// publishChrome={false}: SharedProvider REPLACES its value for the
|
|
4682
4670
|
// subtree (SharedContext.tsx:35-37), so a nested provider publishing
|
|
@@ -4702,18 +4690,18 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductContainer, "ProductContainer");
|
|
|
4702
4690
|
|
|
4703
4691
|
function CouponsList({ fullWidth } = {}) {
|
|
4704
4692
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4705
|
-
const { catalogueVersion } =
|
|
4706
|
-
const data =
|
|
4707
|
-
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) =>
|
|
4693
|
+
const { catalogueVersion } = _chunkEXG4ANC7js.useCouponContext.call(void 0, );
|
|
4694
|
+
const data = _chunkEXG4ANC7js.useDataListRetriever.call(void 0, {
|
|
4695
|
+
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunk3CSPHMVKjs.StripeCouponService.listCoupons(params), "retriever"),
|
|
4708
4696
|
retrieverParams: {},
|
|
4709
|
-
module:
|
|
4697
|
+
module: _chunk3CSPHMVKjs.Modules.StripeCoupon
|
|
4710
4698
|
});
|
|
4711
4699
|
_react.useEffect.call(void 0, () => {
|
|
4712
4700
|
if (catalogueVersion > 0) void data.refresh();
|
|
4713
4701
|
}, [catalogueVersion]);
|
|
4714
|
-
const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4702
|
+
const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.CouponEditor, {}, "create-coupon")];
|
|
4715
4703
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4716
|
-
|
|
4704
|
+
_chunkEXG4ANC7js.ContentListTable,
|
|
4717
4705
|
{
|
|
4718
4706
|
data,
|
|
4719
4707
|
fields: [
|
|
@@ -4723,12 +4711,12 @@ function CouponsList({ fullWidth } = {}) {
|
|
|
4723
4711
|
"codes" /* codes */,
|
|
4724
4712
|
"status" /* status */
|
|
4725
4713
|
],
|
|
4726
|
-
tableGeneratorType:
|
|
4714
|
+
tableGeneratorType: _chunk3CSPHMVKjs.Modules.StripeCoupon,
|
|
4727
4715
|
functions,
|
|
4728
4716
|
fullWidth,
|
|
4729
4717
|
title: t("billing.admin.coupons.title"),
|
|
4730
4718
|
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4731
|
-
|
|
4719
|
+
_chunkEXG4ANC7js.EmptyState,
|
|
4732
4720
|
{
|
|
4733
4721
|
icon: _lucidereact.TicketPercentIcon,
|
|
4734
4722
|
title: t("billing.admin.coupons.empty.title"),
|
|
@@ -4748,26 +4736,26 @@ _chunk7QVYU63Ejs.__name.call(void 0, CouponsList, "CouponsList");
|
|
|
4748
4736
|
function ProductsList({ fullWidth } = {}) {
|
|
4749
4737
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4750
4738
|
const { catalogueVersion } = useProductContext();
|
|
4751
|
-
const data =
|
|
4752
|
-
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) =>
|
|
4739
|
+
const data = _chunkEXG4ANC7js.useDataListRetriever.call(void 0, {
|
|
4740
|
+
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunk3CSPHMVKjs.StripeProductService.listProducts(params), "retriever"),
|
|
4753
4741
|
retrieverParams: {},
|
|
4754
|
-
module:
|
|
4742
|
+
module: _chunk3CSPHMVKjs.Modules.StripeProduct
|
|
4755
4743
|
});
|
|
4756
4744
|
_react.useEffect.call(void 0, () => {
|
|
4757
4745
|
if (catalogueVersion > 0) void data.refresh();
|
|
4758
4746
|
}, [catalogueVersion]);
|
|
4759
4747
|
const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductEditor, {}, "create-product")];
|
|
4760
4748
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4761
|
-
|
|
4749
|
+
_chunkEXG4ANC7js.ContentListTable,
|
|
4762
4750
|
{
|
|
4763
4751
|
data,
|
|
4764
4752
|
fields: ["name" /* name */, "status" /* status */, "prices" /* prices */],
|
|
4765
|
-
tableGeneratorType:
|
|
4753
|
+
tableGeneratorType: _chunk3CSPHMVKjs.Modules.StripeProduct,
|
|
4766
4754
|
functions,
|
|
4767
4755
|
fullWidth,
|
|
4768
4756
|
title: t("billing.admin.products.title"),
|
|
4769
4757
|
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4770
|
-
|
|
4758
|
+
_chunkEXG4ANC7js.EmptyState,
|
|
4771
4759
|
{
|
|
4772
4760
|
icon: _lucidereact.PackageIcon,
|
|
4773
4761
|
title: t("billing.admin.products.empty.title"),
|
|
@@ -4783,10 +4771,10 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductsList, "ProductsList");
|
|
|
4783
4771
|
|
|
4784
4772
|
function ProductsListContainer() {
|
|
4785
4773
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4786
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductProvider, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4787
|
-
|
|
4774
|
+
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,
|
|
4775
|
+
_chunkEXG4ANC7js.RoundPageContainer,
|
|
4788
4776
|
{
|
|
4789
|
-
module:
|
|
4777
|
+
module: _chunk3CSPHMVKjs.Modules.StripeProduct,
|
|
4790
4778
|
tabs: [
|
|
4791
4779
|
{ sectionKey: "products", label: t("billing.admin.products.tabs.products"), content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductsList, {}) },
|
|
4792
4780
|
{ sectionKey: "codes", label: t("billing.admin.products.tabs.codes"), content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CouponsList, {}) }
|
|
@@ -4804,30 +4792,30 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductsListContainer, "ProductsListContain
|
|
|
4804
4792
|
|
|
4805
4793
|
function CouponDetails() {
|
|
4806
4794
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4807
|
-
const fmt =
|
|
4808
|
-
const { coupon } =
|
|
4795
|
+
const fmt = _chunkEXG4ANC7js.useBillingFormatOptions.call(void 0, );
|
|
4796
|
+
const { coupon } = _chunkEXG4ANC7js.useCouponContext.call(void 0, );
|
|
4809
4797
|
if (!coupon) return null;
|
|
4810
4798
|
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,
|
|
4799
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.SectionHeader, { children: t("billing.admin.products.tabs.details") }),
|
|
4812
4800
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-xs/relaxed", children: t("billing.admin.coupons.fixed_notice") }),
|
|
4813
4801
|
/* @__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,
|
|
4802
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.DetailField, { label: t("billing.admin.coupons.fields.name"), value: coupon.name }),
|
|
4815
4803
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4816
|
-
|
|
4804
|
+
_chunkEXG4ANC7js.DetailField,
|
|
4817
4805
|
{
|
|
4818
4806
|
label: t("billing.admin.coupons.fields.status"),
|
|
4819
|
-
value: coupon.valid ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4807
|
+
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
4808
|
}
|
|
4821
4809
|
),
|
|
4822
4810
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4823
|
-
|
|
4811
|
+
_chunkEXG4ANC7js.DetailField,
|
|
4824
4812
|
{
|
|
4825
4813
|
label: t("billing.admin.coupons.fields.discount"),
|
|
4826
|
-
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children:
|
|
4814
|
+
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _chunk3CSPHMVKjs.formatCouponDiscount.call(void 0, coupon, t, fmt) })
|
|
4827
4815
|
}
|
|
4828
4816
|
),
|
|
4829
4817
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4830
|
-
|
|
4818
|
+
_chunkEXG4ANC7js.DetailField,
|
|
4831
4819
|
{
|
|
4832
4820
|
label: t("billing.admin.coupons.fields.places"),
|
|
4833
4821
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: coupon.maxRedemptions !== void 0 ? t("billing.admin.coupons.places.limited", {
|
|
@@ -4837,21 +4825,21 @@ function CouponDetails() {
|
|
|
4837
4825
|
}
|
|
4838
4826
|
),
|
|
4839
4827
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4840
|
-
|
|
4828
|
+
_chunkEXG4ANC7js.DetailField,
|
|
4841
4829
|
{
|
|
4842
4830
|
label: t("billing.admin.coupons.fields.products"),
|
|
4843
4831
|
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
4832
|
}
|
|
4845
4833
|
),
|
|
4846
4834
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4847
|
-
|
|
4835
|
+
_chunkEXG4ANC7js.DetailField,
|
|
4848
4836
|
{
|
|
4849
4837
|
label: t("billing.admin.coupons.fields.redeemBy"),
|
|
4850
|
-
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: coupon.redeemBy ?
|
|
4838
|
+
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: coupon.redeemBy ? _chunkEXG4ANC7js.formatDate.call(void 0, coupon.redeemBy, fmt) : "\u2014" })
|
|
4851
4839
|
}
|
|
4852
4840
|
),
|
|
4853
4841
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4854
|
-
|
|
4842
|
+
_chunkEXG4ANC7js.DetailField,
|
|
4855
4843
|
{
|
|
4856
4844
|
label: t("billing.admin.coupons.fields.stripeId"),
|
|
4857
4845
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: coupon.stripeCouponId })
|
|
@@ -4885,33 +4873,33 @@ function CouponCodeEditorInternal({
|
|
|
4885
4873
|
onDialogOpenChange
|
|
4886
4874
|
}) {
|
|
4887
4875
|
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, ), ...
|
|
4876
|
+
const router = _chunk3CSPHMVKjs.useI18nRouter.call(void 0, );
|
|
4877
|
+
const { createCode } = _chunkEXG4ANC7js.useCouponContext.call(void 0, );
|
|
4878
|
+
const formSchema2 = _react.useMemo.call(void 0, () => _zod3.z.object({ id: _zod3.z.uuidv4() }).and(_chunkEXG4ANC7js.couponCodeSchema.call(void 0, t)), [t]);
|
|
4879
|
+
const getDefaultValues = _react.useCallback.call(void 0, () => ({ id: _uuid.v4.call(void 0, ), ..._chunkEXG4ANC7js.couponCodeDefaults.call(void 0, ) }), []);
|
|
4892
4880
|
const form = _reacthookform.useForm.call(void 0, {
|
|
4893
4881
|
resolver: _zod.zodResolver.call(void 0, formSchema2),
|
|
4894
4882
|
defaultValues: getDefaultValues()
|
|
4895
4883
|
});
|
|
4896
4884
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4897
|
-
|
|
4885
|
+
_chunkEXG4ANC7js.EditorSheet,
|
|
4898
4886
|
{
|
|
4899
4887
|
form,
|
|
4900
4888
|
entityType: t("billing.admin.coupons.codes.entity"),
|
|
4901
4889
|
isEdit: false,
|
|
4902
|
-
module:
|
|
4890
|
+
module: _chunk3CSPHMVKjs.Modules.StripeCouponCode,
|
|
4903
4891
|
size: "md",
|
|
4904
4892
|
onSuccess: _nullishCoalesce(onSuccess, () => ( (() => {
|
|
4905
4893
|
}))),
|
|
4906
4894
|
onNavigate: (url) => router.push(url),
|
|
4907
|
-
onSubmit: async (values) => await createCode({ id: values.id, couponId, ...
|
|
4895
|
+
onSubmit: async (values) => await createCode({ id: values.id, couponId, ..._chunkEXG4ANC7js.toCouponCodeInput.call(void 0, values) }),
|
|
4908
4896
|
onReset: getDefaultValues,
|
|
4909
4897
|
trigger,
|
|
4910
4898
|
forceShow,
|
|
4911
4899
|
onClose,
|
|
4912
4900
|
dialogOpen,
|
|
4913
4901
|
onDialogOpenChange,
|
|
4914
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4902
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEXG4ANC7js.CouponCodeFields, { form })
|
|
4915
4903
|
}
|
|
4916
4904
|
);
|
|
4917
4905
|
}
|
|
@@ -4925,18 +4913,18 @@ _chunk7QVYU63Ejs.__name.call(void 0, CouponCodeEditor, "CouponCodeEditor");
|
|
|
4925
4913
|
|
|
4926
4914
|
function CouponCodesList({ couponId }) {
|
|
4927
4915
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4928
|
-
const { catalogueVersion } =
|
|
4929
|
-
const data =
|
|
4930
|
-
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) =>
|
|
4916
|
+
const { catalogueVersion } = _chunkEXG4ANC7js.useCouponContext.call(void 0, );
|
|
4917
|
+
const data = _chunkEXG4ANC7js.useDataListRetriever.call(void 0, {
|
|
4918
|
+
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunk3CSPHMVKjs.StripeCouponCodeService.listByCoupon({ ...params, couponId }), "retriever"),
|
|
4931
4919
|
retrieverParams: {},
|
|
4932
|
-
module:
|
|
4920
|
+
module: _chunk3CSPHMVKjs.Modules.StripeCouponCode
|
|
4933
4921
|
});
|
|
4934
4922
|
_react.useEffect.call(void 0, () => {
|
|
4935
4923
|
if (catalogueVersion > 0) void data.refresh();
|
|
4936
4924
|
}, [catalogueVersion]);
|
|
4937
4925
|
const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, CouponCodeEditor, { couponId }, "create-code")];
|
|
4938
4926
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4939
|
-
|
|
4927
|
+
_chunkEXG4ANC7js.ContentListTable,
|
|
4940
4928
|
{
|
|
4941
4929
|
data,
|
|
4942
4930
|
fields: [
|
|
@@ -4947,11 +4935,11 @@ function CouponCodesList({ couponId }) {
|
|
|
4947
4935
|
"status" /* status */,
|
|
4948
4936
|
"actions" /* actions */
|
|
4949
4937
|
],
|
|
4950
|
-
tableGeneratorType:
|
|
4938
|
+
tableGeneratorType: _chunk3CSPHMVKjs.Modules.StripeCouponCode,
|
|
4951
4939
|
functions,
|
|
4952
4940
|
title: t("billing.admin.coupons.codes.title"),
|
|
4953
4941
|
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4954
|
-
|
|
4942
|
+
_chunkEXG4ANC7js.EmptyState,
|
|
4955
4943
|
{
|
|
4956
4944
|
icon: _lucidereact.TicketIcon,
|
|
4957
4945
|
title: t("billing.admin.coupons.codes.empty.title"),
|
|
@@ -4967,12 +4955,12 @@ _chunk7QVYU63Ejs.__name.call(void 0, CouponCodesList, "CouponCodesList");
|
|
|
4967
4955
|
|
|
4968
4956
|
function CouponContainer() {
|
|
4969
4957
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4970
|
-
const { coupon } =
|
|
4958
|
+
const { coupon } = _chunkEXG4ANC7js.useCouponContext.call(void 0, );
|
|
4971
4959
|
if (!coupon) return null;
|
|
4972
4960
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4973
|
-
|
|
4961
|
+
_chunkEXG4ANC7js.RoundPageContainer,
|
|
4974
4962
|
{
|
|
4975
|
-
module:
|
|
4963
|
+
module: _chunkEXG4ANC7js.couponPageModule.call(void 0, ),
|
|
4976
4964
|
id: coupon.id,
|
|
4977
4965
|
tabs: [
|
|
4978
4966
|
{
|
|
@@ -5079,5 +5067,5 @@ _chunk7QVYU63Ejs.__name.call(void 0, CouponContainer, "CouponContainer");
|
|
|
5079
5067
|
|
|
5080
5068
|
|
|
5081
5069
|
|
|
5082
|
-
exports.BillingAlertBanner = BillingAlertBanner; exports.BillingDashboardContainer = BillingDashboardContainer; exports.BillingDetailModal = BillingDetailModal; exports.BillingUsageSummaryCard = BillingUsageSummaryCard; exports.CancelSubscriptionDialog = CancelSubscriptionDialog; exports.CouponCodeActions =
|
|
5070
|
+
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
5071
|
//# sourceMappingURL=index.js.map
|