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