@carlonicora/nextjs-jsonapi 6.4.0 → 6.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{BlockNoteEditor-CT4XUXPC.js → BlockNoteEditor-E4V7AEG2.js} +19 -19
- package/dist/{BlockNoteEditor-CT4XUXPC.js.map → BlockNoteEditor-E4V7AEG2.js.map} +1 -1
- package/dist/{BlockNoteEditor-M6UQRVRK.mjs → BlockNoteEditor-MWGVWNSE.mjs} +4 -4
- package/dist/{BlockNoteViewer-MFLWF3Y2.js → BlockNoteViewer-LGRKM7OA.js} +3 -3
- package/dist/{BlockNoteViewer-MFLWF3Y2.js.map → BlockNoteViewer-LGRKM7OA.js.map} +1 -1
- package/dist/{BlockNoteViewer-XZJ5Y7WN.mjs → BlockNoteViewer-VNU7WVN5.mjs} +2 -2
- package/dist/billing/index.d.mts +174 -157
- package/dist/billing/index.d.ts +174 -157
- package/dist/billing/index.js +523 -501
- package/dist/billing/index.js.map +1 -1
- package/dist/billing/index.mjs +34 -12
- package/dist/billing/index.mjs.map +1 -1
- package/dist/{chunk-3FD6Y734.mjs → chunk-7GB5MR77.mjs} +78 -1
- package/dist/chunk-7GB5MR77.mjs.map +1 -0
- package/dist/{chunk-ELQHE2DK.js → chunk-AEVLFZRK.js} +3 -3
- package/dist/{chunk-ELQHE2DK.js.map → chunk-AEVLFZRK.js.map} +1 -1
- package/dist/{chunk-DSGP6GC3.js → chunk-AMN2XDN5.js} +8 -8
- package/dist/{chunk-DSGP6GC3.js.map → chunk-AMN2XDN5.js.map} +1 -1
- package/dist/{chunk-QJIDORHM.js → chunk-F2MZ7GY6.js} +4 -4
- package/dist/{chunk-QJIDORHM.js.map → chunk-F2MZ7GY6.js.map} +1 -1
- package/dist/{chunk-TIT4CJYQ.mjs → chunk-IDV534SJ.mjs} +5 -5
- package/dist/{chunk-DYOSXIEL.mjs → chunk-IQ2XYAB5.mjs} +2 -2
- package/dist/{chunk-XZCCIKX3.js → chunk-OJAIKQR2.js} +79 -2
- package/dist/chunk-OJAIKQR2.js.map +1 -0
- package/dist/{chunk-O2TEUH5S.mjs → chunk-PDS57QPD.mjs} +2 -2
- package/dist/{chunk-Y7JIQNM6.js → chunk-R2XBVIO5.js} +870 -870
- package/dist/{chunk-Y7JIQNM6.js.map → chunk-R2XBVIO5.js.map} +1 -1
- package/dist/{chunk-RUJCWOJE.mjs → chunk-RSMBRI3E.mjs} +2 -2
- 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 +32 -3
- package/dist/core/index.d.ts +32 -3
- package/dist/core/index.js +6 -2
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +5 -1
- package/dist/email-automations/index.js +92 -92
- package/dist/email-automations/index.mjs +3 -3
- package/dist/features/analytics/index.js +121 -121
- package/dist/features/analytics/index.mjs +4 -4
- package/dist/features/analytics/server.js +4 -4
- package/dist/features/analytics/server.mjs +2 -2
- package/dist/features/blog/index.js +150 -150
- package/dist/features/blog/index.mjs +3 -3
- package/dist/features/blog/server.js +16 -16
- package/dist/features/blog/server.mjs +1 -1
- package/dist/features/help/index.js +37 -37
- package/dist/features/help/index.mjs +3 -3
- package/dist/features/tokenusage/index.js +127 -127
- package/dist/features/tokenusage/index.mjs +4 -4
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -2
- package/dist/{s3.service-CzFBDEuQ.d.mts → s3.service-BNBD9YTg.d.mts} +17 -1
- package/dist/{s3.service-BTCpmp5g.d.ts → s3.service-Da7C2gtt.d.ts} +17 -1
- package/dist/server/index.d.mts +1 -1
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.js +3 -3
- package/dist/server/index.mjs +2 -2
- package/package.json +1 -1
- package/src/core/index.ts +1 -0
- package/src/core/registry/ModuleRegistry.ts +2 -0
- package/src/features/auth/data/__tests__/pending-registration.spec.ts +37 -0
- package/src/features/auth/data/auth.service.ts +19 -0
- package/src/features/auth/data/index.ts +2 -0
- package/src/features/auth/data/pending-registration.interface.ts +10 -0
- package/src/features/auth/data/pending-registration.ts +57 -0
- package/src/features/auth/pending-registration.module.ts +9 -0
- package/src/features/billing/components/containers/BillingDashboardContainer.tsx +3 -2
- package/src/features/billing/stripe-subscription/components/containers/SubscriptionsContainer.tsx +5 -0
- package/src/features/billing/stripe-subscription/components/details/SubscriptionDetails.tsx +44 -12
- package/src/features/billing/stripe-subscription/components/details/__tests__/SubscriptionDetails.spec.tsx +79 -0
- package/src/features/billing/stripe-subscription/components/lists/SubscriptionsList.tsx +9 -2
- package/dist/chunk-3FD6Y734.mjs.map +0 -1
- package/dist/chunk-XZCCIKX3.js.map +0 -1
- /package/dist/{BlockNoteEditor-M6UQRVRK.mjs.map → BlockNoteEditor-MWGVWNSE.mjs.map} +0 -0
- /package/dist/{BlockNoteViewer-XZJ5Y7WN.mjs.map → BlockNoteViewer-VNU7WVN5.mjs.map} +0 -0
- /package/dist/{chunk-TIT4CJYQ.mjs.map → chunk-IDV534SJ.mjs.map} +0 -0
- /package/dist/{chunk-DYOSXIEL.mjs.map → chunk-IQ2XYAB5.mjs.map} +0 -0
- /package/dist/{chunk-O2TEUH5S.mjs.map → chunk-PDS57QPD.mjs.map} +0 -0
- /package/dist/{chunk-RUJCWOJE.mjs.map → chunk-RSMBRI3E.mjs.map} +0 -0
package/dist/billing/index.js
CHANGED
|
@@ -81,10 +81,10 @@
|
|
|
81
81
|
|
|
82
82
|
|
|
83
83
|
|
|
84
|
-
var
|
|
84
|
+
var _chunkR2XBVIO5js = require('../chunk-R2XBVIO5.js');
|
|
85
85
|
|
|
86
86
|
|
|
87
|
-
var
|
|
87
|
+
var _chunkAMN2XDN5js = require('../chunk-AMN2XDN5.js');
|
|
88
88
|
|
|
89
89
|
|
|
90
90
|
var _chunkG4JR3SFVjs = require('../chunk-G4JR3SFV.js');
|
|
@@ -114,7 +114,7 @@ var _chunkG4JR3SFVjs = require('../chunk-G4JR3SFV.js');
|
|
|
114
114
|
|
|
115
115
|
|
|
116
116
|
|
|
117
|
-
var
|
|
117
|
+
var _chunkOJAIKQR2js = require('../chunk-OJAIKQR2.js');
|
|
118
118
|
require('../chunk-GHE4VT2R.js');
|
|
119
119
|
require('../chunk-LXKSUWAV.js');
|
|
120
120
|
require('../chunk-JTPRJNT2.js');
|
|
@@ -127,7 +127,7 @@ var _chunk7QVYU63Ejs = require('../chunk-7QVYU63E.js');
|
|
|
127
127
|
var _nextintl = require('next-intl');
|
|
128
128
|
var _lucidereact = require('lucide-react');
|
|
129
129
|
var _jsxruntime = require('react/jsx-runtime');
|
|
130
|
-
var SUBSCRIPTION_STATUSES = Object.values(
|
|
130
|
+
var SUBSCRIPTION_STATUSES = Object.values(_chunkOJAIKQR2js.SubscriptionStatus);
|
|
131
131
|
function getStatusBadgeVariant(status) {
|
|
132
132
|
switch (status) {
|
|
133
133
|
case "active" /* ACTIVE */:
|
|
@@ -159,43 +159,43 @@ function SubscriptionSummaryCard({
|
|
|
159
159
|
onManageClick
|
|
160
160
|
}) {
|
|
161
161
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
162
|
-
const fmt =
|
|
162
|
+
const fmt = _chunkR2XBVIO5js.useBillingFormatOptions.call(void 0, );
|
|
163
163
|
if (loading) {
|
|
164
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
165
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
166
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
164
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.Card, { children: [
|
|
165
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
166
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.CardTitle, { children: t("billing.ui.subscriptions.title") }),
|
|
167
167
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
168
168
|
] }),
|
|
169
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
170
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
171
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
172
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
169
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.CardContent, { children: [
|
|
170
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
171
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Skeleton, { className: "h-4 w-24 mb-1" }),
|
|
172
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Skeleton, { className: "h-4 w-40" })
|
|
173
173
|
] })
|
|
174
174
|
] });
|
|
175
175
|
}
|
|
176
176
|
if (error) {
|
|
177
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
178
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
179
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
177
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.Card, { children: [
|
|
178
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
179
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.CardTitle, { children: t("billing.ui.subscriptions.title") }),
|
|
180
180
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
181
181
|
] }),
|
|
182
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
182
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
183
183
|
] });
|
|
184
184
|
}
|
|
185
185
|
const activeSubscriptions = subscriptions.filter(
|
|
186
186
|
(sub) => sub.status === "active" /* ACTIVE */ || sub.status === "trialing" /* TRIALING */ || sub.status === "past_due" /* PAST_DUE */
|
|
187
187
|
);
|
|
188
188
|
const primarySubscription = activeSubscriptions[0];
|
|
189
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
190
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
191
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
189
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
|
|
190
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
191
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.CardTitle, { children: t("billing.ui.subscriptions.title") }),
|
|
192
192
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
193
193
|
] }),
|
|
194
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
194
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.CardContent, { children: !primarySubscription ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
195
195
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: t("billing.ui.cards.subscriptions.empty_title") }),
|
|
196
196
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.subscriptions.empty_description") }),
|
|
197
197
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
198
|
-
|
|
198
|
+
_chunkR2XBVIO5js.Button,
|
|
199
199
|
{
|
|
200
200
|
variant: "outline",
|
|
201
201
|
size: "sm",
|
|
@@ -213,8 +213,8 @@ function SubscriptionSummaryCard({
|
|
|
213
213
|
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
214
214
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
215
215
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: formatPlanName(primarySubscription, t("billing.ui.cards.subscriptions.fallback_name")) }),
|
|
216
|
-
primarySubscription.status === "past_due" /* PAST_DUE */ ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
217
|
-
|
|
216
|
+
primarySubscription.status === "past_due" /* PAST_DUE */ ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Badge, { variant: "softRed", children: t("billing.ui.cards.subscriptions.payment_failing") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
217
|
+
_chunkR2XBVIO5js.Badge,
|
|
218
218
|
{
|
|
219
219
|
variant: primarySubscription.cancelAtPeriodEnd ? "secondary" : getStatusBadgeVariant(primarySubscription.status),
|
|
220
220
|
children: primarySubscription.cancelAtPeriodEnd ? t("billing.ui.cards.subscriptions.canceling") : SUBSCRIPTION_STATUSES.includes(primarySubscription.status) ? t(`billing.ui.subscription_status.${primarySubscription.status}`) : primarySubscription.status
|
|
@@ -222,11 +222,11 @@ function SubscriptionSummaryCard({
|
|
|
222
222
|
)
|
|
223
223
|
] }),
|
|
224
224
|
/* @__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", {
|
|
225
|
-
date:
|
|
225
|
+
date: _chunkR2XBVIO5js.formatDate.call(void 0, primarySubscription.currentPeriodEnd, fmt)
|
|
226
226
|
}) : primarySubscription.cancelAtPeriodEnd ? t("billing.ui.cards.subscriptions.cancels_on", {
|
|
227
|
-
date:
|
|
227
|
+
date: _chunkR2XBVIO5js.formatDate.call(void 0, primarySubscription.currentPeriodEnd, fmt)
|
|
228
228
|
}) : t("billing.ui.cards.subscriptions.renews_on", {
|
|
229
|
-
date:
|
|
229
|
+
date: _chunkR2XBVIO5js.formatDate.call(void 0, primarySubscription.currentPeriodEnd, fmt)
|
|
230
230
|
}) }),
|
|
231
231
|
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 }) })
|
|
232
232
|
] }) })
|
|
@@ -260,37 +260,37 @@ function PaymentMethodSummaryCard({
|
|
|
260
260
|
}) {
|
|
261
261
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
262
262
|
if (loading) {
|
|
263
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
264
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
265
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
263
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.Card, { children: [
|
|
264
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
265
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.CardTitle, { children: t("billing.ui.payment_method.title") }),
|
|
266
266
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
267
267
|
] }),
|
|
268
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
269
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
270
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
268
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.CardContent, { children: [
|
|
269
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
270
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Skeleton, { className: "h-4 w-24" })
|
|
271
271
|
] })
|
|
272
272
|
] });
|
|
273
273
|
}
|
|
274
274
|
if (error) {
|
|
275
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
276
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
277
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
275
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.Card, { children: [
|
|
276
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
277
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.CardTitle, { children: t("billing.ui.payment_method.title") }),
|
|
278
278
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
279
279
|
] }),
|
|
280
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
280
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
281
281
|
] });
|
|
282
282
|
}
|
|
283
283
|
const defaultMethod = paymentMethods.find((pm) => pm.id === defaultPaymentMethodId) || paymentMethods[0];
|
|
284
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
285
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
286
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
284
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
|
|
285
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
286
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.CardTitle, { children: t("billing.ui.payment_method.title") }),
|
|
287
287
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
288
288
|
] }),
|
|
289
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
289
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.CardContent, { children: paymentMethods.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
290
290
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: t("billing.ui.cards.payment_method.empty_title") }),
|
|
291
291
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.payment_method.empty_description") }),
|
|
292
292
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
293
|
-
|
|
293
|
+
_chunkR2XBVIO5js.Button,
|
|
294
294
|
{
|
|
295
295
|
variant: "outline",
|
|
296
296
|
size: "sm",
|
|
@@ -339,13 +339,13 @@ function formatBalance(balance, currency, locale) {
|
|
|
339
339
|
_chunk7QVYU63Ejs.__name.call(void 0, formatBalance, "formatBalance");
|
|
340
340
|
function CustomerInfoCard({ customer, loading, error }) {
|
|
341
341
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
342
|
-
const locale =
|
|
342
|
+
const locale = _chunkOJAIKQR2js.useI18nLocale.call(void 0, );
|
|
343
343
|
const [portalLoading, setPortalLoading] = _react.useState.call(void 0, false);
|
|
344
344
|
const handlePortalClick = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async (e) => {
|
|
345
345
|
e.stopPropagation();
|
|
346
346
|
setPortalLoading(true);
|
|
347
347
|
try {
|
|
348
|
-
const { url } = await
|
|
348
|
+
const { url } = await _chunkOJAIKQR2js.StripeCustomerService.createPortalSession();
|
|
349
349
|
window.open(url, "_blank");
|
|
350
350
|
} catch (err) {
|
|
351
351
|
console.error("[CustomerInfoCard] Failed to create portal session:", err);
|
|
@@ -354,45 +354,45 @@ function CustomerInfoCard({ customer, loading, error }) {
|
|
|
354
354
|
}
|
|
355
355
|
}, "handlePortalClick");
|
|
356
356
|
if (loading) {
|
|
357
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
358
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
359
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
357
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.Card, { children: [
|
|
358
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
359
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.CardTitle, { children: t("billing.ui.cards.customer.title") }),
|
|
360
360
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
361
361
|
] }),
|
|
362
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
363
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
364
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
365
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
362
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.CardContent, { children: [
|
|
363
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
364
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Skeleton, { className: "h-4 w-48 mb-1" }),
|
|
365
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Skeleton, { className: "h-4 w-24" })
|
|
366
366
|
] })
|
|
367
367
|
] });
|
|
368
368
|
}
|
|
369
369
|
if (error) {
|
|
370
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
371
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
372
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
370
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.Card, { children: [
|
|
371
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
372
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.CardTitle, { children: t("billing.ui.cards.customer.title") }),
|
|
373
373
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
374
374
|
] }),
|
|
375
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
375
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
376
376
|
] });
|
|
377
377
|
}
|
|
378
378
|
if (!customer) {
|
|
379
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
380
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
381
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
379
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.Card, { children: [
|
|
380
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
381
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.CardTitle, { children: t("billing.ui.cards.customer.title") }),
|
|
382
382
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
383
383
|
] }),
|
|
384
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
384
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.CardContent, { children: [
|
|
385
385
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: t("billing.ui.cards.customer.not_set_up") }),
|
|
386
386
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.customer.not_set_up_description") })
|
|
387
387
|
] })
|
|
388
388
|
] });
|
|
389
389
|
}
|
|
390
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
391
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
392
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
390
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.Card, { children: [
|
|
391
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
392
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.CardTitle, { children: t("billing.ui.cards.customer.title") }),
|
|
393
393
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
394
394
|
] }),
|
|
395
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
395
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
396
396
|
customer.name && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: customer.name }),
|
|
397
397
|
customer.email && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: customer.email }),
|
|
398
398
|
customer.balance !== void 0 && customer.balance !== 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm", children: [
|
|
@@ -402,7 +402,7 @@ function CustomerInfoCard({ customer, loading, error }) {
|
|
|
402
402
|
] }),
|
|
403
403
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: customer.balance < 0 ? "text-success" : "text-destructive", children: formatBalance(customer.balance, customer.currency, locale) })
|
|
404
404
|
] }),
|
|
405
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
405
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.Button, { variant: "outline", size: "sm", className: "mt-2", onClick: handlePortalClick, disabled: portalLoading, children: [
|
|
406
406
|
portalLoading ? t("common.loading") : t("billing.ui.cards.customer.manage_portal"),
|
|
407
407
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ExternalLink, { className: "h-4 w-4 ms-1" })
|
|
408
408
|
] })
|
|
@@ -415,7 +415,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, CustomerInfoCard, "CustomerInfoCard");
|
|
|
415
415
|
|
|
416
416
|
|
|
417
417
|
|
|
418
|
-
var INVOICE_STATUSES = Object.values(
|
|
418
|
+
var INVOICE_STATUSES = Object.values(_chunkOJAIKQR2js.InvoiceStatus);
|
|
419
419
|
function getStatusBadgeVariant2(status) {
|
|
420
420
|
switch (status) {
|
|
421
421
|
case "paid" /* PAID */:
|
|
@@ -440,46 +440,46 @@ function formatAmount(amount, currency, locale) {
|
|
|
440
440
|
_chunk7QVYU63Ejs.__name.call(void 0, formatAmount, "formatAmount");
|
|
441
441
|
function InvoicesSummaryCard({ invoices, loading, error, onViewAllClick }) {
|
|
442
442
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
443
|
-
const fmt =
|
|
443
|
+
const fmt = _chunkR2XBVIO5js.useBillingFormatOptions.call(void 0, );
|
|
444
444
|
if (loading) {
|
|
445
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
446
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
447
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
445
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.Card, { children: [
|
|
446
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
447
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.CardTitle, { children: t("billing.ui.cards.invoices.title") }),
|
|
448
448
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
449
449
|
] }),
|
|
450
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
451
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
452
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
453
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
450
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.CardContent, { children: [
|
|
451
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Skeleton, { className: "h-6 w-24 mb-2" }),
|
|
452
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Skeleton, { className: "h-4 w-32 mb-1" }),
|
|
453
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Skeleton, { className: "h-4 w-20" })
|
|
454
454
|
] })
|
|
455
455
|
] });
|
|
456
456
|
}
|
|
457
457
|
if (error) {
|
|
458
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
459
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
460
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
458
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.Card, { children: [
|
|
459
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
460
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.CardTitle, { children: t("billing.ui.cards.invoices.title") }),
|
|
461
461
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
462
462
|
] }),
|
|
463
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
463
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
464
464
|
] });
|
|
465
465
|
}
|
|
466
466
|
const latestInvoice = _nullishCoalesce(invoices.find((inv) => inv.status !== "void" /* VOID */), () => ( invoices[0]));
|
|
467
467
|
const paidInvoices = invoices.filter((inv) => inv.status === "paid" /* PAID */);
|
|
468
468
|
const openInvoices = invoices.filter((inv) => inv.status === "open" /* OPEN */);
|
|
469
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
470
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
471
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
469
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewAllClick, children: [
|
|
470
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
471
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.CardTitle, { children: t("billing.ui.cards.invoices.title") }),
|
|
472
472
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
473
473
|
] }),
|
|
474
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
474
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.CardContent, { children: invoices.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
475
475
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: t("billing.ui.invoices.empty_title") }),
|
|
476
476
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.invoices.empty_description") })
|
|
477
477
|
] }) : latestInvoice ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
478
478
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
479
479
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: formatAmount(latestInvoice.total, latestInvoice.currency, fmt.locale) }),
|
|
480
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
480
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Badge, { variant: getStatusBadgeVariant2(latestInvoice.status), children: INVOICE_STATUSES.includes(latestInvoice.status) ? t(`billing.ui.invoice_status.${latestInvoice.status}`) : latestInvoice.status })
|
|
481
481
|
] }),
|
|
482
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: latestInvoice.stripeInvoiceNumber || t("billing.ui.cards.invoices.invoice_from", { date:
|
|
482
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: latestInvoice.stripeInvoiceNumber || t("billing.ui.cards.invoices.invoice_from", { date: _chunkR2XBVIO5js.formatDate.call(void 0, latestInvoice.periodStart, fmt) }) }),
|
|
483
483
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-4 text-xs text-muted-foreground", children: [
|
|
484
484
|
paidInvoices.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: t("billing.ui.cards.invoices.paid_count", { count: paidInvoices.length }) }),
|
|
485
485
|
openInvoices.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-warning", children: t("billing.ui.cards.invoices.open_count", { count: openInvoices.length }) }),
|
|
@@ -512,26 +512,26 @@ function BillingUsageSummaryCard({
|
|
|
512
512
|
onViewDetailsClick
|
|
513
513
|
}) {
|
|
514
514
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
515
|
-
const locale =
|
|
515
|
+
const locale = _chunkOJAIKQR2js.useI18nLocale.call(void 0, );
|
|
516
516
|
if (loading) {
|
|
517
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
518
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
519
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
517
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.Card, { children: [
|
|
518
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
519
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.CardTitle, { children: t("billing.ui.cards.usage.title") }),
|
|
520
520
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
521
521
|
] }),
|
|
522
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
523
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
524
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
522
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.CardContent, { children: [
|
|
523
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Skeleton, { className: "h-6 w-24 mb-2" }),
|
|
524
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Skeleton, { className: "h-4 w-32" })
|
|
525
525
|
] })
|
|
526
526
|
] });
|
|
527
527
|
}
|
|
528
528
|
if (error) {
|
|
529
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
530
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
531
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
529
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.Card, { children: [
|
|
530
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
531
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.CardTitle, { children: t("billing.ui.cards.usage.title") }),
|
|
532
532
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
533
533
|
] }),
|
|
534
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
534
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
535
535
|
] });
|
|
536
536
|
}
|
|
537
537
|
const totalUsage = Object.values(summaries).reduce((acc, summary) => {
|
|
@@ -539,12 +539,12 @@ function BillingUsageSummaryCard({
|
|
|
539
539
|
}, 0);
|
|
540
540
|
const primaryMeter = meters.find((m) => _optionalChain([summaries, 'access', _17 => _17[m.id], 'optionalAccess', _18 => _18.aggregatedValue]));
|
|
541
541
|
const primarySummary = primaryMeter ? summaries[primaryMeter.id] : null;
|
|
542
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
543
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
544
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
542
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewDetailsClick, children: [
|
|
543
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
544
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.CardTitle, { children: t("billing.ui.cards.usage.title") }),
|
|
545
545
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
546
546
|
] }),
|
|
547
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
547
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.CardContent, { children: meters.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
548
548
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: t("billing.ui.cards.usage.no_meters") }),
|
|
549
549
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.usage.no_meters_description") })
|
|
550
550
|
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
@@ -601,7 +601,7 @@ function PaymentMethodForm({
|
|
|
601
601
|
const fetchSetupIntent = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
602
602
|
setLoading(true);
|
|
603
603
|
try {
|
|
604
|
-
const intent = await
|
|
604
|
+
const intent = await _chunkOJAIKQR2js.StripeCustomerService.createSetupIntent();
|
|
605
605
|
setSetupIntent(intent);
|
|
606
606
|
} catch (err) {
|
|
607
607
|
console.error("[PaymentMethodForm] Failed to create setup intent:", err);
|
|
@@ -639,7 +639,7 @@ function PaymentMethodForm({
|
|
|
639
639
|
return;
|
|
640
640
|
}
|
|
641
641
|
if ((alwaysSetDefault || setAsDefault) && _optionalChain([confirmedSetupIntent, 'optionalAccess', _19 => _19.payment_method])) {
|
|
642
|
-
await
|
|
642
|
+
await _chunkOJAIKQR2js.StripeCustomerService.setDefaultPaymentMethod({
|
|
643
643
|
paymentMethodId: typeof confirmedSetupIntent.payment_method === "string" ? confirmedSetupIntent.payment_method : confirmedSetupIntent.payment_method.id
|
|
644
644
|
});
|
|
645
645
|
}
|
|
@@ -655,7 +655,7 @@ function PaymentMethodForm({
|
|
|
655
655
|
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") }) });
|
|
656
656
|
}
|
|
657
657
|
if (!setupIntent && error) {
|
|
658
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
658
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.AlertDescription, { children: error }) });
|
|
659
659
|
}
|
|
660
660
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: handleSubmit, className: "flex flex-col gap-y-4", children: [
|
|
661
661
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rounded-md border border-gray-300 p-3", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -679,19 +679,19 @@ function PaymentMethodForm({
|
|
|
679
679
|
) }),
|
|
680
680
|
!alwaysSetDefault && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
681
681
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
682
|
-
|
|
682
|
+
_chunkR2XBVIO5js.Checkbox,
|
|
683
683
|
{
|
|
684
684
|
id: "setAsDefault",
|
|
685
685
|
checked: setAsDefault,
|
|
686
686
|
onCheckedChange: (checked) => setSetAsDefault(!!checked)
|
|
687
687
|
}
|
|
688
688
|
),
|
|
689
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
689
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Label, { htmlFor: "setAsDefault", className: "cursor-pointer font-normal", children: t("billing.ui.payment_form.set_default") })
|
|
690
690
|
] }),
|
|
691
|
-
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
691
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.AlertDescription, { children: error }) }),
|
|
692
692
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-x-2", children: [
|
|
693
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
694
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
693
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Button, { type: "button", variant: "outline", onClick: onCancel, disabled: isSubmitting || isLoading, children: t("ui.buttons.cancel") }),
|
|
694
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Button, { type: "submit", disabled: !stripe || isSubmitting || isLoading, children: isSubmitting ? t("billing.ui.wizard.review.processing") : t("billing.ui.cards.payment_method.add_card") })
|
|
695
695
|
] })
|
|
696
696
|
] });
|
|
697
697
|
}
|
|
@@ -708,10 +708,10 @@ function PaymentMethodEditor({ open, onOpenChange, onSuccess }) {
|
|
|
708
708
|
const handleCancel = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
709
709
|
onOpenChange(false);
|
|
710
710
|
}, "handleCancel");
|
|
711
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
712
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
713
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
714
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
711
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.DialogContent, { className: "max-w-md", children: [
|
|
712
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.DialogHeader, { children: [
|
|
713
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.DialogTitle, { children: t("billing.ui.payment_methods.add") }),
|
|
714
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.DialogDescription, { children: t("billing.ui.payment_methods.add_description") })
|
|
715
715
|
] }),
|
|
716
716
|
open && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodForm, { onSuccess: handleSuccess, onCancel: handleCancel })
|
|
717
717
|
] }) });
|
|
@@ -737,7 +737,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
737
737
|
_react.useEffect.call(void 0, () => {
|
|
738
738
|
const loadCustomer = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
739
739
|
try {
|
|
740
|
-
const fetchedCustomer = await
|
|
740
|
+
const fetchedCustomer = await _chunkOJAIKQR2js.StripeCustomerService.getCustomer();
|
|
741
741
|
setCustomer(fetchedCustomer);
|
|
742
742
|
} catch (error) {
|
|
743
743
|
console.error("[PaymentMethodCard] Failed to load customer:", error);
|
|
@@ -754,7 +754,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
754
754
|
const handleSetDefault = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
755
755
|
setLoading(true);
|
|
756
756
|
try {
|
|
757
|
-
await
|
|
757
|
+
await _chunkOJAIKQR2js.StripeCustomerService.setDefaultPaymentMethod({ paymentMethodId: paymentMethod.id });
|
|
758
758
|
onUpdate();
|
|
759
759
|
} catch (error) {
|
|
760
760
|
console.error("[PaymentMethodCard] Failed to set as default:", error);
|
|
@@ -765,7 +765,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
765
765
|
const handleRemove = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
766
766
|
setLoading(true);
|
|
767
767
|
try {
|
|
768
|
-
await
|
|
768
|
+
await _chunkOJAIKQR2js.StripeCustomerService.removePaymentMethod({ paymentMethodId: paymentMethod.id });
|
|
769
769
|
setShowRemoveDialog(false);
|
|
770
770
|
onUpdate();
|
|
771
771
|
} catch (error) {
|
|
@@ -774,16 +774,16 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
774
774
|
}
|
|
775
775
|
}, "handleRemove");
|
|
776
776
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
777
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
778
|
-
isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
779
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
777
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.Card, { className: "relative", children: [
|
|
778
|
+
isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Badge, { variant: "softGreen", className: "absolute end-2 top-2", children: t("billing.ui.payment_methods.default") }),
|
|
779
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.CardHeader, { className: "flex flex-row items-center justify-between pb-2", children: [
|
|
780
780
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
781
781
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-2xl", children: brandIcon }),
|
|
782
782
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium capitalize", children: brand })
|
|
783
783
|
] }),
|
|
784
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
785
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
786
|
-
|
|
784
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.DropdownMenu, { children: [
|
|
785
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.DropdownMenuTrigger, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
786
|
+
_chunkR2XBVIO5js.Button,
|
|
787
787
|
{
|
|
788
788
|
render: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {}),
|
|
789
789
|
nativeButton: false,
|
|
@@ -794,10 +794,10 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
794
794
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.MoreVertical, { className: "h-4 w-4" })
|
|
795
795
|
}
|
|
796
796
|
) }),
|
|
797
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
798
|
-
!isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
797
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.DropdownMenuContent, { align: "end", children: [
|
|
798
|
+
!isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.DropdownMenuItem, { onClick: handleSetDefault, disabled: loading, children: t("billing.ui.payment_methods.set_default") }),
|
|
799
799
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
800
|
-
|
|
800
|
+
_chunkR2XBVIO5js.DropdownMenuItem,
|
|
801
801
|
{
|
|
802
802
|
onClick: () => setShowRemoveDialog(true),
|
|
803
803
|
disabled: loading,
|
|
@@ -808,7 +808,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
808
808
|
] })
|
|
809
809
|
] })
|
|
810
810
|
] }),
|
|
811
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
811
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-1", children: [
|
|
812
812
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-lg font-semibold", children: [
|
|
813
813
|
"\u2022\u2022\u2022\u2022 ",
|
|
814
814
|
last4
|
|
@@ -816,17 +816,17 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
816
816
|
/* @__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}` }) })
|
|
817
817
|
] }) })
|
|
818
818
|
] }),
|
|
819
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
820
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
821
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
822
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
819
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.AlertDialog, { open: showRemoveDialog, onOpenChange: setShowRemoveDialog, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.AlertDialogContent, { children: [
|
|
820
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.AlertDialogHeader, { children: [
|
|
821
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.AlertDialogTitle, { children: t("billing.ui.payment_methods.remove_title") }),
|
|
822
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.AlertDialogDescription, { children: [
|
|
823
823
|
t("billing.ui.payment_methods.remove_description"),
|
|
824
824
|
isDefault && ` ${t("billing.ui.payment_methods.remove_default_warning")}`
|
|
825
825
|
] })
|
|
826
826
|
] }),
|
|
827
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
828
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
829
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
827
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.AlertDialogFooter, { children: [
|
|
828
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.AlertDialogCancel, { disabled: loading, children: t("ui.buttons.cancel") }),
|
|
829
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.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") })
|
|
830
830
|
] })
|
|
831
831
|
] }) })
|
|
832
832
|
] });
|
|
@@ -850,7 +850,7 @@ function PaymentMethodsContainer() {
|
|
|
850
850
|
const loadPaymentMethods = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
851
851
|
setLoading(true);
|
|
852
852
|
try {
|
|
853
|
-
const fetchedPaymentMethods = await
|
|
853
|
+
const fetchedPaymentMethods = await _chunkOJAIKQR2js.StripeCustomerService.listPaymentMethods();
|
|
854
854
|
setPaymentMethods(fetchedPaymentMethods);
|
|
855
855
|
} catch (error) {
|
|
856
856
|
console.error("[PaymentMethodsContainer] Failed to load payment methods:", error);
|
|
@@ -870,14 +870,14 @@ function PaymentMethodsContainer() {
|
|
|
870
870
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8" }),
|
|
871
871
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: t("billing.ui.payment_methods.title") })
|
|
872
872
|
] }),
|
|
873
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
873
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Button, { onClick: () => setShowAddPaymentMethod(true), children: t("billing.ui.payment_methods.add") })
|
|
874
874
|
] }),
|
|
875
875
|
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: [
|
|
876
876
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-16 w-16 text-muted-foreground" }),
|
|
877
877
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
878
878
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "mb-2 text-sm font-medium", children: t("billing.ui.payment_methods.empty_title") }),
|
|
879
879
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mb-4 text-muted-foreground", children: t("billing.ui.payment_methods.empty_description") }),
|
|
880
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
880
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Button, { onClick: () => setShowAddPaymentMethod(true), children: t("billing.ui.payment_methods.add_first") })
|
|
881
881
|
] })
|
|
882
882
|
] }),
|
|
883
883
|
paymentMethods.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodsList, { paymentMethods, onUpdate: loadPaymentMethods }),
|
|
@@ -933,7 +933,7 @@ var statusConfig = {
|
|
|
933
933
|
function InvoiceStatusBadge({ status }) {
|
|
934
934
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
935
935
|
const config = statusConfig[status] || statusConfig["draft" /* DRAFT */];
|
|
936
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
936
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Badge, { variant: config.variant, children: t(config.label) });
|
|
937
937
|
}
|
|
938
938
|
_chunk7QVYU63Ejs.__name.call(void 0, InvoiceStatusBadge, "InvoiceStatusBadge");
|
|
939
939
|
|
|
@@ -946,7 +946,7 @@ function InvoiceDetails({
|
|
|
946
946
|
onInvoiceChange: _onInvoiceChange
|
|
947
947
|
}) {
|
|
948
948
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
949
|
-
const fmt =
|
|
949
|
+
const fmt = _chunkR2XBVIO5js.useBillingFormatOptions.call(void 0, );
|
|
950
950
|
const handleDownloadPDF = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
951
951
|
if (invoice.stripePdfUrl) {
|
|
952
952
|
window.open(invoice.stripePdfUrl, "_blank");
|
|
@@ -966,10 +966,10 @@ function InvoiceDetails({
|
|
|
966
966
|
return invoice.stripeInvoiceId.slice(-8);
|
|
967
967
|
}, "getInvoiceNumber");
|
|
968
968
|
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");
|
|
969
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
970
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
971
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
972
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
969
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.DialogContent, { className: "max-w-2xl", children: [
|
|
970
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.DialogHeader, { children: [
|
|
971
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.DialogTitle, { children: t("billing.ui.invoice.title", { number: getInvoiceNumber() }) }),
|
|
972
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.DialogDescription, { children: _chunkR2XBVIO5js.formatDate.call(void 0, invoice.periodStart, fmt) })
|
|
973
973
|
] }),
|
|
974
974
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
975
975
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
@@ -980,18 +980,18 @@ function InvoiceDetails({
|
|
|
980
980
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
981
981
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.billing_period") }),
|
|
982
982
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm", children: [
|
|
983
|
-
|
|
983
|
+
_chunkR2XBVIO5js.formatDate.call(void 0, invoice.periodStart, fmt),
|
|
984
984
|
" - ",
|
|
985
|
-
|
|
985
|
+
_chunkR2XBVIO5js.formatDate.call(void 0, invoice.periodEnd, fmt)
|
|
986
986
|
] })
|
|
987
987
|
] }),
|
|
988
988
|
invoice.dueDate && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
989
989
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.due_date") }),
|
|
990
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm", children:
|
|
990
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm", children: _chunkR2XBVIO5js.formatDate.call(void 0, invoice.dueDate, fmt) })
|
|
991
991
|
] }),
|
|
992
992
|
invoice.paidAt && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
993
993
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.paid_date") }),
|
|
994
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm", children:
|
|
994
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm", children: _chunkR2XBVIO5js.formatDate.call(void 0, invoice.paidAt, fmt) })
|
|
995
995
|
] }),
|
|
996
996
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
997
997
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.attempt_count") }),
|
|
@@ -1007,42 +1007,42 @@ function InvoiceDetails({
|
|
|
1007
1007
|
] }) }),
|
|
1008
1008
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "tbody", { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "tr", { className: "border-t", children: [
|
|
1009
1009
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "td", { className: "p-3", children: productName }),
|
|
1010
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "td", { className: "p-3 text-end", children:
|
|
1010
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "td", { className: "p-3 text-end", children: _chunkOJAIKQR2js.formatCurrency.call(void 0, invoice.subtotal, invoice.currency, fmt) })
|
|
1011
1011
|
] }) })
|
|
1012
1012
|
] }) })
|
|
1013
1013
|
] }),
|
|
1014
1014
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2 border-t pt-4", children: [
|
|
1015
1015
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1016
1016
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.subtotal") }),
|
|
1017
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children:
|
|
1017
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children: _chunkOJAIKQR2js.formatCurrency.call(void 0, invoice.subtotal, invoice.currency, fmt) })
|
|
1018
1018
|
] }),
|
|
1019
1019
|
invoice.tax !== void 0 && invoice.tax > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1020
1020
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.tax") }),
|
|
1021
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children:
|
|
1021
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children: _chunkOJAIKQR2js.formatCurrency.call(void 0, invoice.tax, invoice.currency, fmt) })
|
|
1022
1022
|
] }),
|
|
1023
1023
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between text-lg font-semibold border-t pt-2", children: [
|
|
1024
1024
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: t("billing.ui.invoice.total") }),
|
|
1025
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children:
|
|
1025
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _chunkOJAIKQR2js.formatCurrency.call(void 0, invoice.total, invoice.currency, fmt) })
|
|
1026
1026
|
] }),
|
|
1027
1027
|
invoice.amountPaid > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1028
1028
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.amount_paid") }),
|
|
1029
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-success", children:
|
|
1029
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-success", children: _chunkOJAIKQR2js.formatCurrency.call(void 0, invoice.amountPaid, invoice.currency, fmt) })
|
|
1030
1030
|
] }),
|
|
1031
1031
|
invoice.amountRemaining > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1032
1032
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.amount_due") }),
|
|
1033
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-destructive", children:
|
|
1033
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-destructive", children: _chunkOJAIKQR2js.formatCurrency.call(void 0, invoice.amountRemaining, invoice.currency, fmt) })
|
|
1034
1034
|
] })
|
|
1035
1035
|
] }),
|
|
1036
1036
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2 pt-4 border-t", children: [
|
|
1037
|
-
invoice.stripePdfUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1037
|
+
invoice.stripePdfUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.Button, { variant: "outline", onClick: handleDownloadPDF, children: [
|
|
1038
1038
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Download, { className: "me-2 h-4 w-4" }),
|
|
1039
1039
|
t("billing.ui.invoice.download_pdf")
|
|
1040
1040
|
] }),
|
|
1041
|
-
invoice.status === "open" /* OPEN */ && invoice.attempted && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1041
|
+
invoice.status === "open" /* OPEN */ && invoice.attempted && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.Button, { variant: "default", onClick: handleRetryPayment, children: [
|
|
1042
1042
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RefreshCw, { className: "me-2 h-4 w-4" }),
|
|
1043
1043
|
t("billing.ui.invoice.retry_payment")
|
|
1044
1044
|
] }),
|
|
1045
|
-
invoice.stripeHostedInvoiceUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1045
|
+
invoice.stripeHostedInvoiceUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.Button, { variant: "outline", onClick: handleViewInStripe, children: [
|
|
1046
1046
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ExternalLink, { className: "me-2 h-4 w-4" }),
|
|
1047
1047
|
t("billing.ui.invoice.view_in_stripe")
|
|
1048
1048
|
] })
|
|
@@ -1056,7 +1056,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, InvoiceDetails, "InvoiceDetails");
|
|
|
1056
1056
|
|
|
1057
1057
|
function InvoicesList({ invoices, onInvoicesChange }) {
|
|
1058
1058
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1059
|
-
const fmt =
|
|
1059
|
+
const fmt = _chunkR2XBVIO5js.useBillingFormatOptions.call(void 0, );
|
|
1060
1060
|
const [selectedInvoice, setSelectedInvoice] = _react.useState.call(void 0, null);
|
|
1061
1061
|
const handleRowClick = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (invoice) => {
|
|
1062
1062
|
setSelectedInvoice(invoice);
|
|
@@ -1068,30 +1068,30 @@ function InvoicesList({ invoices, onInvoicesChange }) {
|
|
|
1068
1068
|
return invoice.stripeInvoiceId.slice(-8);
|
|
1069
1069
|
}, "getInvoiceNumber");
|
|
1070
1070
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1071
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1072
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1073
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1074
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1075
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1076
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1077
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1071
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.Table, { children: [
|
|
1072
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.TableRow, { children: [
|
|
1073
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.TableHead, { children: t("billing.ui.columns.invoice_number") }),
|
|
1074
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.TableHead, { children: t("billing.ui.columns.date") }),
|
|
1075
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.TableHead, { children: t("billing.ui.columns.status") }),
|
|
1076
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.TableHead, { className: "text-end", children: t("billing.ui.columns.amount") }),
|
|
1077
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.TableHead, { children: t("billing.ui.columns.period") })
|
|
1078
1078
|
] }) }),
|
|
1079
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1079
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.TableBody, { children: invoices.map((invoice) => {
|
|
1080
1080
|
const invoiceNumber = getInvoiceNumber(invoice);
|
|
1081
|
-
const date =
|
|
1082
|
-
const amount =
|
|
1083
|
-
const period = `${
|
|
1081
|
+
const date = _chunkR2XBVIO5js.formatDate.call(void 0, invoice.periodStart, fmt);
|
|
1082
|
+
const amount = _chunkOJAIKQR2js.formatCurrency.call(void 0, invoice.total, invoice.currency, fmt);
|
|
1083
|
+
const period = `${_chunkR2XBVIO5js.formatDate.call(void 0, invoice.periodStart, fmt)} - ${_chunkR2XBVIO5js.formatDate.call(void 0, invoice.periodEnd, fmt)}`;
|
|
1084
1084
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1085
|
-
|
|
1085
|
+
_chunkR2XBVIO5js.TableRow,
|
|
1086
1086
|
{
|
|
1087
1087
|
onClick: () => handleRowClick(invoice),
|
|
1088
1088
|
className: "cursor-pointer hover:bg-muted/50",
|
|
1089
1089
|
children: [
|
|
1090
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1091
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1092
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1093
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1094
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1090
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.TableCell, { className: "font-medium", children: invoiceNumber }),
|
|
1091
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.TableCell, { className: "text-muted-foreground text-xs", children: date }),
|
|
1092
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InvoiceStatusBadge, { status: invoice.status }) }),
|
|
1093
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.TableCell, { className: "text-end font-medium", children: amount }),
|
|
1094
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.TableCell, { className: "text-muted-foreground text-xs", children: period })
|
|
1095
1095
|
]
|
|
1096
1096
|
},
|
|
1097
1097
|
invoice.id
|
|
@@ -1125,7 +1125,7 @@ function InvoicesContainer() {
|
|
|
1125
1125
|
setLoading(true);
|
|
1126
1126
|
try {
|
|
1127
1127
|
const params = statusFilter !== "all" ? { status: statusFilter } : void 0;
|
|
1128
|
-
const data = await
|
|
1128
|
+
const data = await _chunkOJAIKQR2js.StripeInvoiceService.listInvoices(params);
|
|
1129
1129
|
setInvoices(data);
|
|
1130
1130
|
} catch (error) {
|
|
1131
1131
|
console.error("[InvoicesContainer] Failed to load invoices:", error);
|
|
@@ -1141,12 +1141,12 @@ function InvoicesContainer() {
|
|
|
1141
1141
|
setStatusFilter(value);
|
|
1142
1142
|
}, "handleFilterChange");
|
|
1143
1143
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-4", children: [
|
|
1144
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1145
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1146
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1147
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1148
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1149
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1144
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Tabs, { value: statusFilter, onValueChange: handleFilterChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.TabsList, { children: [
|
|
1145
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.TabsTrigger, { value: "all", children: t("billing.ui.invoices.filter_all") }),
|
|
1146
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.TabsTrigger, { value: "paid" /* PAID */, children: t("billing.ui.invoice_status.paid") }),
|
|
1147
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.TabsTrigger, { value: "open" /* OPEN */, children: t("billing.ui.invoice_status.open") }),
|
|
1148
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.TabsTrigger, { value: "void" /* VOID */, children: t("billing.ui.invoice_status.void") }),
|
|
1149
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.TabsTrigger, { value: "uncollectible" /* UNCOLLECTIBLE */, children: t("billing.ui.invoice_status.uncollectible") })
|
|
1150
1150
|
] }) }),
|
|
1151
1151
|
loading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-center py-8 text-muted-foreground", children: t("billing.ui.invoices.loading") }),
|
|
1152
1152
|
!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: [
|
|
@@ -1188,7 +1188,7 @@ function CancelSubscriptionDialog({
|
|
|
1188
1188
|
onSuccess
|
|
1189
1189
|
}) {
|
|
1190
1190
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1191
|
-
const fmt =
|
|
1191
|
+
const fmt = _chunkR2XBVIO5js.useBillingFormatOptions.call(void 0, );
|
|
1192
1192
|
const [isSubmitting, setIsSubmitting] = _react.useState.call(void 0, false);
|
|
1193
1193
|
const form = _reacthookform.useForm.call(void 0, {
|
|
1194
1194
|
resolver: _zod.zodResolver.call(void 0, formSchema),
|
|
@@ -1199,7 +1199,7 @@ function CancelSubscriptionDialog({
|
|
|
1199
1199
|
const onSubmit = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async (_values) => {
|
|
1200
1200
|
setIsSubmitting(true);
|
|
1201
1201
|
try {
|
|
1202
|
-
await
|
|
1202
|
+
await _chunkOJAIKQR2js.StripeSubscriptionService.cancelSubscription({
|
|
1203
1203
|
id: subscription.id,
|
|
1204
1204
|
cancelImmediately: false
|
|
1205
1205
|
});
|
|
@@ -1211,16 +1211,16 @@ function CancelSubscriptionDialog({
|
|
|
1211
1211
|
setIsSubmitting(false);
|
|
1212
1212
|
}
|
|
1213
1213
|
}, "onSubmit");
|
|
1214
|
-
const periodEndDate =
|
|
1215
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1216
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1217
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1218
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1214
|
+
const periodEndDate = _chunkR2XBVIO5js.formatDate.call(void 0, subscription.currentPeriodEnd, fmt);
|
|
1215
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.DialogContent, { className: "max-w-md", children: [
|
|
1216
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.DialogHeader, { children: [
|
|
1217
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.DialogTitle, { children: t("billing.ui.subscription.cancel.title") }),
|
|
1218
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.DialogDescription, { children: t("billing.ui.subscription.cancel.description") })
|
|
1219
1219
|
] }),
|
|
1220
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1220
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-col gap-y-4", children: [
|
|
1221
1221
|
/* @__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 }) }),
|
|
1222
1222
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1223
|
-
|
|
1223
|
+
_chunkR2XBVIO5js.FormTextarea,
|
|
1224
1224
|
{
|
|
1225
1225
|
form,
|
|
1226
1226
|
id: "reason",
|
|
@@ -1230,8 +1230,8 @@ function CancelSubscriptionDialog({
|
|
|
1230
1230
|
}
|
|
1231
1231
|
),
|
|
1232
1232
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-x-2 justify-end pt-2", children: [
|
|
1233
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1234
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1233
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Button, { type: "button", variant: "outline", onClick: () => onOpenChange(false), disabled: isSubmitting, children: t("billing.ui.subscription.cancel.keep") }),
|
|
1234
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Button, { type: "submit", variant: "destructive", disabled: isSubmitting, children: isSubmitting ? t("billing.ui.subscription.cancel.canceling") : t("billing.ui.subscription.cancel.confirm") })
|
|
1235
1235
|
] })
|
|
1236
1236
|
] }) })
|
|
1237
1237
|
] }) });
|
|
@@ -1282,7 +1282,7 @@ var cancelingConfig = {
|
|
|
1282
1282
|
function SubscriptionStatusBadge({ status, cancelAtPeriodEnd }) {
|
|
1283
1283
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1284
1284
|
const config = cancelAtPeriodEnd ? cancelingConfig : statusConfig2[status] || statusConfig2["canceled" /* CANCELED */];
|
|
1285
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1285
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Badge, { variant: config.variant, children: t(config.label) });
|
|
1286
1286
|
}
|
|
1287
1287
|
_chunk7QVYU63Ejs.__name.call(void 0, SubscriptionStatusBadge, "SubscriptionStatusBadge");
|
|
1288
1288
|
|
|
@@ -1309,7 +1309,7 @@ function formatPlanName2(price, t) {
|
|
|
1309
1309
|
_chunk7QVYU63Ejs.__name.call(void 0, formatPlanName2, "formatPlanName");
|
|
1310
1310
|
function formatBillingAmount(price, notAvailable, fmt) {
|
|
1311
1311
|
if (!_optionalChain([price, 'optionalAccess', _37 => _37.unitAmount])) return notAvailable;
|
|
1312
|
-
return
|
|
1312
|
+
return _chunkOJAIKQR2js.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt);
|
|
1313
1313
|
}
|
|
1314
1314
|
_chunk7QVYU63Ejs.__name.call(void 0, formatBillingAmount, "formatBillingAmount");
|
|
1315
1315
|
function SubscriptionDetails({
|
|
@@ -1317,14 +1317,15 @@ function SubscriptionDetails({
|
|
|
1317
1317
|
open,
|
|
1318
1318
|
onOpenChange,
|
|
1319
1319
|
onSubscriptionChange,
|
|
1320
|
-
onChangePlan
|
|
1320
|
+
onChangePlan,
|
|
1321
|
+
renderCancelDialog
|
|
1321
1322
|
}) {
|
|
1322
1323
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1323
|
-
const fmt =
|
|
1324
|
+
const fmt = _chunkR2XBVIO5js.useBillingFormatOptions.call(void 0, );
|
|
1324
1325
|
const [showCancel, setShowCancel] = _react.useState.call(void 0, false);
|
|
1325
1326
|
const handleManageViaPortal = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1326
1327
|
try {
|
|
1327
|
-
const { url } = await
|
|
1328
|
+
const { url } = await _chunkOJAIKQR2js.StripeCustomerService.createPortalSession();
|
|
1328
1329
|
window.open(url, "_blank");
|
|
1329
1330
|
} catch (error) {
|
|
1330
1331
|
console.error("[SubscriptionDetails] Failed to create portal session:", error);
|
|
@@ -1332,10 +1333,10 @@ function SubscriptionDetails({
|
|
|
1332
1333
|
}, "handleManageViaPortal");
|
|
1333
1334
|
const canCancel = subscription.status === "active" /* ACTIVE */ || subscription.status === "trialing" /* TRIALING */ || subscription.status === "paused" /* PAUSED */;
|
|
1334
1335
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1335
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1336
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1337
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1338
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1336
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.DialogContent, { className: "max-w-2xl", children: [
|
|
1337
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.DialogHeader, { children: [
|
|
1338
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.DialogTitle, { children: t("billing.ui.subscription.details_title") }),
|
|
1339
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.DialogDescription, { children: t("billing.ui.subscription.details_description") })
|
|
1339
1340
|
] }),
|
|
1340
1341
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
1341
1342
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
@@ -1361,26 +1362,38 @@ function SubscriptionDetails({
|
|
|
1361
1362
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "space-y-2", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1362
1363
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.subscription.current_period") }),
|
|
1363
1364
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "text-sm", children: [
|
|
1364
|
-
|
|
1365
|
+
_chunkR2XBVIO5js.formatDate.call(void 0, subscription.currentPeriodStart, fmt),
|
|
1365
1366
|
" - ",
|
|
1366
|
-
|
|
1367
|
+
_chunkR2XBVIO5js.formatDate.call(void 0, subscription.currentPeriodEnd, fmt)
|
|
1367
1368
|
] })
|
|
1368
1369
|
] }) }),
|
|
1369
1370
|
subscription.trialEnd && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1370
1371
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.subscription.trial_ends") }),
|
|
1371
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children:
|
|
1372
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children: _chunkR2XBVIO5js.formatDate.call(void 0, subscription.trialEnd, fmt) })
|
|
1372
1373
|
] }),
|
|
1373
1374
|
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", {
|
|
1374
|
-
date:
|
|
1375
|
+
date: _chunkR2XBVIO5js.formatDate.call(void 0, subscription.currentPeriodEnd, fmt)
|
|
1375
1376
|
}) }) }),
|
|
1376
1377
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2 pt-4 border-t", children: [
|
|
1377
|
-
onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1378
|
-
canCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1379
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1378
|
+
onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Button, { variant: "default", onClick: () => onChangePlan(subscription), children: t("billing.ui.subscription.change_plan") }),
|
|
1379
|
+
canCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Button, { variant: "destructive", onClick: () => setShowCancel(true), children: t("ui.buttons.cancel") }),
|
|
1380
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Button, { variant: "outline", onClick: handleManageViaPortal, children: t("billing.ui.subscription.manage_portal") })
|
|
1380
1381
|
] })
|
|
1381
1382
|
] })
|
|
1382
1383
|
] }) }),
|
|
1383
|
-
showCancel &&
|
|
1384
|
+
showCancel && (renderCancelDialog ? renderCancelDialog({
|
|
1385
|
+
subscription,
|
|
1386
|
+
open: showCancel,
|
|
1387
|
+
onOpenChange: setShowCancel,
|
|
1388
|
+
onSuccess: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
1389
|
+
onSubscriptionChange();
|
|
1390
|
+
setShowCancel(false);
|
|
1391
|
+
}, "onSuccess"),
|
|
1392
|
+
openChangePlan: onChangePlan ? () => {
|
|
1393
|
+
onChangePlan(subscription);
|
|
1394
|
+
onOpenChange(false);
|
|
1395
|
+
} : void 0
|
|
1396
|
+
}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1384
1397
|
CancelSubscriptionDialog,
|
|
1385
1398
|
{
|
|
1386
1399
|
subscription,
|
|
@@ -1391,7 +1404,7 @@ function SubscriptionDetails({
|
|
|
1391
1404
|
setShowCancel(false);
|
|
1392
1405
|
}
|
|
1393
1406
|
}
|
|
1394
|
-
)
|
|
1407
|
+
))
|
|
1395
1408
|
] });
|
|
1396
1409
|
}
|
|
1397
1410
|
_chunk7QVYU63Ejs.__name.call(void 0, SubscriptionDetails, "SubscriptionDetails");
|
|
@@ -1417,48 +1430,53 @@ function formatPlanName3(price, t) {
|
|
|
1417
1430
|
return interval ? `${planLabel} (${interval})` : planLabel || t("billing.ui.not_available");
|
|
1418
1431
|
}
|
|
1419
1432
|
_chunk7QVYU63Ejs.__name.call(void 0, formatPlanName3, "formatPlanName");
|
|
1420
|
-
function SubscriptionsList({
|
|
1433
|
+
function SubscriptionsList({
|
|
1434
|
+
subscriptions,
|
|
1435
|
+
onSubscriptionsChange,
|
|
1436
|
+
onChangePlan,
|
|
1437
|
+
renderCancelDialog
|
|
1438
|
+
}) {
|
|
1421
1439
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1422
|
-
const fmt =
|
|
1440
|
+
const fmt = _chunkR2XBVIO5js.useBillingFormatOptions.call(void 0, );
|
|
1423
1441
|
const [selectedSub, setSelectedSub] = _react.useState.call(void 0, null);
|
|
1424
1442
|
const handleRowClick = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (subscription) => {
|
|
1425
1443
|
setSelectedSub(subscription);
|
|
1426
1444
|
}, "handleRowClick");
|
|
1427
1445
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1428
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1429
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1430
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1431
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1432
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1433
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1434
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1446
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.Table, { children: [
|
|
1447
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.TableRow, { children: [
|
|
1448
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.TableHead, { children: t("billing.ui.columns.status") }),
|
|
1449
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.TableHead, { children: t("billing.ui.columns.plan") }),
|
|
1450
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.TableHead, { children: t("billing.ui.columns.period") }),
|
|
1451
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.TableHead, { className: "text-end", children: t("billing.ui.columns.amount") }),
|
|
1452
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.TableHead, { className: "text-end", children: t("billing.ui.columns.actions") })
|
|
1435
1453
|
] }) }),
|
|
1436
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1454
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.TableBody, { children: subscriptions.map((subscription) => {
|
|
1437
1455
|
const price = subscription.price;
|
|
1438
|
-
const amount = _optionalChain([price, 'optionalAccess', _42 => _42.unitAmount]) ?
|
|
1439
|
-
const discountedAmount = price ?
|
|
1440
|
-
const period = `${
|
|
1456
|
+
const amount = _optionalChain([price, 'optionalAccess', _42 => _42.unitAmount]) ? _chunkOJAIKQR2js.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt) : "0";
|
|
1457
|
+
const discountedAmount = price ? _chunkR2XBVIO5js.applyDiscount.call(void 0, price.unitAmount, _chunkR2XBVIO5js.subscriptionDiscount.call(void 0, subscription)) : null;
|
|
1458
|
+
const period = `${_chunkR2XBVIO5js.formatDate.call(void 0, subscription.currentPeriodStart, fmt)} - ${_chunkR2XBVIO5js.formatDate.call(void 0, subscription.currentPeriodEnd, fmt)}`;
|
|
1441
1459
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1442
|
-
|
|
1460
|
+
_chunkR2XBVIO5js.TableRow,
|
|
1443
1461
|
{
|
|
1444
1462
|
onClick: () => handleRowClick(subscription),
|
|
1445
1463
|
className: "cursor-pointer hover:bg-muted/50",
|
|
1446
1464
|
children: [
|
|
1447
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1465
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1448
1466
|
SubscriptionStatusBadge,
|
|
1449
1467
|
{
|
|
1450
1468
|
status: subscription.status,
|
|
1451
1469
|
cancelAtPeriodEnd: subscription.cancelAtPeriodEnd
|
|
1452
1470
|
}
|
|
1453
1471
|
) }),
|
|
1454
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1455
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1456
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1472
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.TableCell, { className: "font-medium", children: formatPlanName3(price, t) }),
|
|
1473
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.TableCell, { className: "text-muted-foreground text-sm", children: period }),
|
|
1474
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.TableCell, { className: "text-end font-medium", children: discountedAmount !== null && price ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1457
1475
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "line-through text-muted-foreground me-2", children: amount }),
|
|
1458
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success", children:
|
|
1476
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success", children: _chunkOJAIKQR2js.formatCurrency.call(void 0, discountedAmount, price.currency, fmt) })
|
|
1459
1477
|
] }) : amount }),
|
|
1460
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1461
|
-
|
|
1478
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.TableCell, { className: "text-end", children: (subscription.status === "active" /* ACTIVE */ || subscription.status === "trialing" /* TRIALING */) && onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1479
|
+
_chunkR2XBVIO5js.Button,
|
|
1462
1480
|
{
|
|
1463
1481
|
size: "sm",
|
|
1464
1482
|
variant: "outline",
|
|
@@ -1488,7 +1506,8 @@ function SubscriptionsList({ subscriptions, onSubscriptionsChange, onChangePlan
|
|
|
1488
1506
|
onChangePlan: onChangePlan ? (sub) => {
|
|
1489
1507
|
setSelectedSub(null);
|
|
1490
1508
|
onChangePlan(sub);
|
|
1491
|
-
} : void 0
|
|
1509
|
+
} : void 0,
|
|
1510
|
+
renderCancelDialog
|
|
1492
1511
|
}
|
|
1493
1512
|
)
|
|
1494
1513
|
] });
|
|
@@ -1501,7 +1520,8 @@ function SubscriptionsContainer({
|
|
|
1501
1520
|
onOpenWizard,
|
|
1502
1521
|
hasActiveRecurringSubscription,
|
|
1503
1522
|
subscriptions: parentSubscriptions,
|
|
1504
|
-
onSubscriptionsChange
|
|
1523
|
+
onSubscriptionsChange,
|
|
1524
|
+
renderCancelDialog
|
|
1505
1525
|
}) {
|
|
1506
1526
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1507
1527
|
const isControlled = parentSubscriptions !== void 0;
|
|
@@ -1516,7 +1536,7 @@ function SubscriptionsContainer({
|
|
|
1516
1536
|
}
|
|
1517
1537
|
setLoading(true);
|
|
1518
1538
|
try {
|
|
1519
|
-
const fetchedSubscriptions = await
|
|
1539
|
+
const fetchedSubscriptions = await _chunkOJAIKQR2js.StripeSubscriptionService.listSubscriptions();
|
|
1520
1540
|
setSubscriptions(fetchedSubscriptions);
|
|
1521
1541
|
} catch (error) {
|
|
1522
1542
|
console.error("[SubscriptionsContainer] Failed to load subscriptions:", error);
|
|
@@ -1539,7 +1559,7 @@ function SubscriptionsContainer({
|
|
|
1539
1559
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8" }),
|
|
1540
1560
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: t("billing.ui.subscriptions.title") })
|
|
1541
1561
|
] }),
|
|
1542
|
-
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1562
|
+
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _44 => _44()]), children: hasActiveRecurringSubscription ? t("billing.ui.subscriptions.purchase_addons") : t("billing.ui.subscriptions.subscribe") })
|
|
1543
1563
|
] }),
|
|
1544
1564
|
criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BillingAlertBanner, { subscription }, subscription.id)),
|
|
1545
1565
|
subscriptions.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col items-center justify-center py-12 space-y-4", children: [
|
|
@@ -1547,7 +1567,7 @@ function SubscriptionsContainer({
|
|
|
1547
1567
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
1548
1568
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium mb-2", children: t("billing.ui.subscriptions.empty_title") }),
|
|
1549
1569
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground mb-6", children: t("billing.ui.subscriptions.empty_description") }),
|
|
1550
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1570
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _45 => _45()]), children: t("billing.ui.subscriptions.subscribe") })
|
|
1551
1571
|
] })
|
|
1552
1572
|
] }),
|
|
1553
1573
|
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -1555,7 +1575,8 @@ function SubscriptionsContainer({
|
|
|
1555
1575
|
{
|
|
1556
1576
|
subscriptions,
|
|
1557
1577
|
onSubscriptionsChange: loadSubscriptions,
|
|
1558
|
-
onChangePlan: (sub) => _optionalChain([onOpenWizard, 'optionalCall', _46 => _46(sub)])
|
|
1578
|
+
onChangePlan: (sub) => _optionalChain([onOpenWizard, 'optionalCall', _46 => _46(sub)]),
|
|
1579
|
+
renderCancelDialog
|
|
1559
1580
|
}
|
|
1560
1581
|
)
|
|
1561
1582
|
] });
|
|
@@ -1570,9 +1591,9 @@ function IntervalToggle({ value, onChange, hasMonthly, hasYearly }) {
|
|
|
1570
1591
|
if (!hasMonthly || !hasYearly) {
|
|
1571
1592
|
return null;
|
|
1572
1593
|
}
|
|
1573
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1574
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1575
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1594
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Tabs, { value, onValueChange: (v) => onChange(v), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.TabsList, { children: [
|
|
1595
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.TabsTrigger, { value: "month", children: t("billing.admin.prices.interval.month") }),
|
|
1596
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.TabsTrigger, { value: "year", children: t("billing.admin.prices.interval.year") })
|
|
1576
1597
|
] }) });
|
|
1577
1598
|
}
|
|
1578
1599
|
_chunk7QVYU63Ejs.__name.call(void 0, IntervalToggle, "IntervalToggle");
|
|
@@ -1590,11 +1611,11 @@ function PricingCard({
|
|
|
1590
1611
|
onSelect
|
|
1591
1612
|
}) {
|
|
1592
1613
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1593
|
-
const fmt =
|
|
1614
|
+
const fmt = _chunkR2XBVIO5js.useBillingFormatOptions.call(void 0, );
|
|
1594
1615
|
const description = price.description || price.nickname || t("billing.ui.pricing.standard");
|
|
1595
1616
|
const features = price.features || [];
|
|
1596
|
-
const formattedPrice =
|
|
1597
|
-
const interval =
|
|
1617
|
+
const formattedPrice = _chunkOJAIKQR2js.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt);
|
|
1618
|
+
const interval = _chunkOJAIKQR2js.formatInterval.call(void 0, price, fmt);
|
|
1598
1619
|
const handleKeyDown = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (e) => {
|
|
1599
1620
|
if ((e.key === "Enter" || e.key === " ") && !isDisabled && !isCurrentPlan) {
|
|
1600
1621
|
e.preventDefault();
|
|
@@ -1607,7 +1628,7 @@ function PricingCard({
|
|
|
1607
1628
|
}
|
|
1608
1629
|
}, "handleClick");
|
|
1609
1630
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1610
|
-
|
|
1631
|
+
_chunkR2XBVIO5js.Card,
|
|
1611
1632
|
{
|
|
1612
1633
|
role: "radio",
|
|
1613
1634
|
"aria-checked": isSelected,
|
|
@@ -1615,7 +1636,7 @@ function PricingCard({
|
|
|
1615
1636
|
tabIndex: isDisabled ? -1 : 0,
|
|
1616
1637
|
onKeyDown: handleKeyDown,
|
|
1617
1638
|
onClick: handleClick,
|
|
1618
|
-
className:
|
|
1639
|
+
className: _chunkOJAIKQR2js.cn.call(void 0,
|
|
1619
1640
|
"relative cursor-pointer transition-all duration-200 flex flex-col h-full",
|
|
1620
1641
|
"focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
1621
1642
|
isCurrentPlan && "bg-muted/30",
|
|
@@ -1625,9 +1646,9 @@ function PricingCard({
|
|
|
1625
1646
|
isLoading && "pointer-events-none"
|
|
1626
1647
|
),
|
|
1627
1648
|
children: [
|
|
1628
|
-
isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1629
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1630
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1649
|
+
isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Badge, { variant: "secondary", className: "absolute top-2 end-2", children: t("billing.ui.pricing.current") }),
|
|
1650
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.CardHeader, { className: "pb-2", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium", children: description }) }),
|
|
1651
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.CardContent, { className: "pb-4 grow", children: [
|
|
1631
1652
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mb-4", children: [
|
|
1632
1653
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-3xl font-bold", children: formattedPrice }),
|
|
1633
1654
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground ms-1", children: interval })
|
|
@@ -1637,8 +1658,8 @@ function PricingCard({
|
|
|
1637
1658
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-muted-foreground", children: feature })
|
|
1638
1659
|
] }, index)) })
|
|
1639
1660
|
] }),
|
|
1640
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1641
|
-
|
|
1661
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.CardFooter, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1662
|
+
_chunkR2XBVIO5js.Button,
|
|
1642
1663
|
{
|
|
1643
1664
|
variant: isCurrentPlan ? "secondary" : isSelected ? "default" : "outline",
|
|
1644
1665
|
className: "w-full",
|
|
@@ -1671,7 +1692,7 @@ function ProductPricingRow({
|
|
|
1671
1692
|
return null;
|
|
1672
1693
|
}
|
|
1673
1694
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-3", children: [
|
|
1674
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1695
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.SectionHeader, { children: product.name }),
|
|
1675
1696
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1676
1697
|
"div",
|
|
1677
1698
|
{
|
|
@@ -1772,15 +1793,15 @@ function ProductPricingList({
|
|
|
1772
1793
|
_chunk7QVYU63Ejs.__name.call(void 0, ProductPricingList, "ProductPricingList");
|
|
1773
1794
|
function ProductPricingListSkeleton() {
|
|
1774
1795
|
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: [
|
|
1775
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1796
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Skeleton, { className: "h-6 w-32" }),
|
|
1776
1797
|
/* @__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: [
|
|
1777
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1778
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1798
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Skeleton, { className: "h-6 w-24" }),
|
|
1799
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Skeleton, { className: "h-8 w-32" }),
|
|
1779
1800
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
1780
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1781
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1801
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Skeleton, { className: "h-4 w-full" }),
|
|
1802
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Skeleton, { className: "h-4 w-3/4" })
|
|
1782
1803
|
] }),
|
|
1783
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1804
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Skeleton, { className: "h-10 w-full" })
|
|
1784
1805
|
] }, cardIndex)) })
|
|
1785
1806
|
] }, rowIndex)) });
|
|
1786
1807
|
}
|
|
@@ -1791,21 +1812,21 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductPricingListSkeleton, "ProductPricing
|
|
|
1791
1812
|
|
|
1792
1813
|
function ProrationPreview({ preview }) {
|
|
1793
1814
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1794
|
-
const fmt =
|
|
1815
|
+
const fmt = _chunkR2XBVIO5js.useBillingFormatOptions.call(void 0, );
|
|
1795
1816
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-primary/10 border-primary/30 rounded-lg border p-4", children: [
|
|
1796
1817
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "text-primary mb-3 font-semibold", children: t("billing.ui.proration.title") }),
|
|
1797
1818
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
1798
1819
|
preview.lineItems.map((item, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between text-sm", children: [
|
|
1799
1820
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground", children: item.description }),
|
|
1800
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `font-medium ${item.amount < 0 ? "text-success" : "text-foreground"}`, children:
|
|
1821
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `font-medium ${item.amount < 0 ? "text-success" : "text-foreground"}`, children: _chunkOJAIKQR2js.formatCurrency.call(void 0, item.amount, preview.currency, fmt) })
|
|
1801
1822
|
] }, index)),
|
|
1802
1823
|
/* @__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: [
|
|
1803
1824
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-foreground", children: t("billing.ui.proration.net_due_today") }),
|
|
1804
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-foreground", children:
|
|
1825
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-foreground", children: _chunkOJAIKQR2js.formatCurrency.call(void 0, preview.immediateCharge, preview.currency, fmt) })
|
|
1805
1826
|
] }) }),
|
|
1806
1827
|
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", {
|
|
1807
|
-
date:
|
|
1808
|
-
amount:
|
|
1828
|
+
date: _chunkR2XBVIO5js.formatDate.call(void 0, preview.lineItems[0].period.end, fmt),
|
|
1829
|
+
amount: _chunkOJAIKQR2js.formatCurrency.call(void 0, preview.amountDue, preview.currency, fmt)
|
|
1809
1830
|
}) })
|
|
1810
1831
|
] })
|
|
1811
1832
|
] });
|
|
@@ -1818,7 +1839,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProrationPreview, "ProrationPreview");
|
|
|
1818
1839
|
|
|
1819
1840
|
function SubscriptionConfirmation({ price, isLoading, onConfirm, onCancel }) {
|
|
1820
1841
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1821
|
-
const fmt =
|
|
1842
|
+
const fmt = _chunkR2XBVIO5js.useBillingFormatOptions.call(void 0, );
|
|
1822
1843
|
const productName = _optionalChain([price, 'access', _51 => _51.product, 'optionalAccess', _52 => _52.name]) || price.nickname || t("billing.ui.wizard.review.selected_plan");
|
|
1823
1844
|
const productDescription = _optionalChain([price, 'access', _53 => _53.product, 'optionalAccess', _54 => _54.description]) || price.description;
|
|
1824
1845
|
const features = price.features || [];
|
|
@@ -1830,16 +1851,16 @@ function SubscriptionConfirmation({ price, isLoading, onConfirm, onCancel }) {
|
|
|
1830
1851
|
productDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-sm text-muted-foreground", children: productDescription })
|
|
1831
1852
|
] }),
|
|
1832
1853
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-lg font-semibold", children: [
|
|
1833
|
-
|
|
1834
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-normal text-muted-foreground", children:
|
|
1854
|
+
_chunkOJAIKQR2js.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt),
|
|
1855
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-normal text-muted-foreground", children: _chunkOJAIKQR2js.formatInterval.call(void 0, price, fmt) })
|
|
1835
1856
|
] }),
|
|
1836
1857
|
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: [
|
|
1837
1858
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Check, { className: "h-4 w-4 text-primary" }),
|
|
1838
1859
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: feature })
|
|
1839
1860
|
] }, index)) }),
|
|
1840
1861
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-3 pt-2 border-t border-accent/30", children: [
|
|
1841
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1842
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1862
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Button, { variant: "outline", onClick: onCancel, disabled: isLoading, children: t("ui.buttons.cancel") }),
|
|
1863
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Button, { onClick: onConfirm, disabled: isLoading, children: isLoading ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1843
1864
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "h-4 w-4 animate-spin me-2" }),
|
|
1844
1865
|
t("billing.ui.wizard.review.processing")
|
|
1845
1866
|
] }) : t("billing.ui.confirmation.subscribe") })
|
|
@@ -2018,7 +2039,7 @@ function wizardReducer(state, action) {
|
|
|
2018
2039
|
_chunk7QVYU63Ejs.__name.call(void 0, wizardReducer, "wizardReducer");
|
|
2019
2040
|
function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
2020
2041
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2021
|
-
const locale =
|
|
2042
|
+
const locale = _chunkOJAIKQR2js.useI18nLocale.call(void 0, );
|
|
2022
2043
|
const { confirmPayment } = useConfirmSubscriptionPayment();
|
|
2023
2044
|
const [state, dispatch] = _react.useReducer.call(void 0, wizardReducer, {
|
|
2024
2045
|
...initialState,
|
|
@@ -2030,7 +2051,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2030
2051
|
onCloseRef.current = onClose;
|
|
2031
2052
|
const checkPaymentMethod = _react.useCallback.call(void 0, async () => {
|
|
2032
2053
|
try {
|
|
2033
|
-
const methods = await
|
|
2054
|
+
const methods = await _chunkOJAIKQR2js.StripeCustomerService.listPaymentMethods();
|
|
2034
2055
|
dispatch({ type: "SET_HAS_PAYMENT_METHOD", hasMethod: methods.length > 0 });
|
|
2035
2056
|
} catch (error) {
|
|
2036
2057
|
console.error("[useSubscriptionWizard] Failed to check payment methods:", error);
|
|
@@ -2048,10 +2069,10 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2048
2069
|
}, []);
|
|
2049
2070
|
const lookUpAutomaticCode = _react.useCallback.call(void 0, async (priceId) => {
|
|
2050
2071
|
try {
|
|
2051
|
-
const automaticCode = await
|
|
2072
|
+
const automaticCode = await _chunkOJAIKQR2js.StripeCouponCodeService.findAutomatic({ priceId });
|
|
2052
2073
|
dispatch({
|
|
2053
2074
|
type: "SET_PROMOTION_CODE",
|
|
2054
|
-
code: automaticCode ?
|
|
2075
|
+
code: automaticCode ? _chunkOJAIKQR2js.toPromotionCodeResult.call(void 0, automaticCode) : null
|
|
2055
2076
|
});
|
|
2056
2077
|
return true;
|
|
2057
2078
|
} catch (error) {
|
|
@@ -2078,7 +2099,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2078
2099
|
const isTrialUpgrade = _optionalChain([subscription, 'optionalAccess', _61 => _61.status]) === "trialing" /* TRIALING */;
|
|
2079
2100
|
dispatch({ type: "SET_IS_TRIAL_SUBSCRIPTION", isTrial: isTrialUpgrade });
|
|
2080
2101
|
if (isTrialUpgrade && !state.hasPaymentMethod) {
|
|
2081
|
-
const methods = await
|
|
2102
|
+
const methods = await _chunkOJAIKQR2js.StripeCustomerService.listPaymentMethods();
|
|
2082
2103
|
if (methods.length === 0) {
|
|
2083
2104
|
dispatch({ type: "SET_STEP", step: "payment-method" });
|
|
2084
2105
|
dispatch({
|
|
@@ -2096,7 +2117,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2096
2117
|
}
|
|
2097
2118
|
}
|
|
2098
2119
|
if (subscription && state.selectedPrice.id !== _optionalChain([subscription, 'access', _62 => _62.price, 'optionalAccess', _63 => _63.id])) {
|
|
2099
|
-
const preview = await
|
|
2120
|
+
const preview = await _chunkOJAIKQR2js.StripeSubscriptionService.getProrationPreview({
|
|
2100
2121
|
subscriptionId: subscription.id,
|
|
2101
2122
|
newPriceId: state.selectedPrice.id
|
|
2102
2123
|
});
|
|
@@ -2130,14 +2151,14 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2130
2151
|
newPriceId: state.selectedPrice.id,
|
|
2131
2152
|
promotionCode: promotionCodeToSend(state.promotionCode)
|
|
2132
2153
|
};
|
|
2133
|
-
result = await
|
|
2154
|
+
result = await _chunkOJAIKQR2js.StripeSubscriptionService.changePlanWithMeta(changePlanParams);
|
|
2134
2155
|
} else {
|
|
2135
2156
|
const createParams = {
|
|
2136
2157
|
id: _uuid.v4.call(void 0, ),
|
|
2137
2158
|
priceId: state.selectedPrice.id,
|
|
2138
2159
|
promotionCode: promotionCodeToSend(state.promotionCode)
|
|
2139
2160
|
};
|
|
2140
|
-
result = await
|
|
2161
|
+
result = await _chunkOJAIKQR2js.StripeSubscriptionService.createSubscription(createParams);
|
|
2141
2162
|
}
|
|
2142
2163
|
const clientSecret = clientSecretToConfirm(result.meta);
|
|
2143
2164
|
if (clientSecret) {
|
|
@@ -2153,7 +2174,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2153
2174
|
const subscriptionId = subscriptionIdToSync(result.subscription, subscription);
|
|
2154
2175
|
if (subscriptionId) {
|
|
2155
2176
|
try {
|
|
2156
|
-
await
|
|
2177
|
+
await _chunkOJAIKQR2js.StripeSubscriptionService.syncSubscription({ subscriptionId });
|
|
2157
2178
|
} catch (syncError) {
|
|
2158
2179
|
console.error("[useSubscriptionWizard] Subscription sync after payment failed:", syncError);
|
|
2159
2180
|
}
|
|
@@ -2201,7 +2222,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2201
2222
|
dispatch({ type: "SET_VALIDATING_PROMO_CODE", isValidating: true });
|
|
2202
2223
|
dispatch({ type: "SET_PROMO_CODE_ERROR", error: null });
|
|
2203
2224
|
try {
|
|
2204
|
-
const result = await
|
|
2225
|
+
const result = await _chunkOJAIKQR2js.StripePromotionCodeService.validatePromotionCode({
|
|
2205
2226
|
code,
|
|
2206
2227
|
stripePriceId: _optionalChain([state, 'access', _72 => _72.selectedPrice, 'optionalAccess', _73 => _73.id]),
|
|
2207
2228
|
language: locale
|
|
@@ -2326,7 +2347,7 @@ function WizardStepPlanSelection({
|
|
|
2326
2347
|
_react.useEffect.call(void 0, () => {
|
|
2327
2348
|
const loadProducts = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2328
2349
|
try {
|
|
2329
|
-
const fetchedProducts = await
|
|
2350
|
+
const fetchedProducts = await _chunkOJAIKQR2js.StripeProductService.listProducts({ active: true });
|
|
2330
2351
|
setProducts(fetchedProducts);
|
|
2331
2352
|
} catch (error) {
|
|
2332
2353
|
console.error("[WizardStepPlanSelection] Failed to load products:", error);
|
|
@@ -2377,7 +2398,7 @@ function WizardStepPlanSelection({
|
|
|
2377
2398
|
onSelectPrice: handleSelectPrice
|
|
2378
2399
|
}
|
|
2379
2400
|
),
|
|
2380
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex justify-end pt-4 border-t", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2401
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex justify-end pt-4 border-t", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Button, { onClick: onNext, disabled: !selectedPrice || isProcessing, children: isProcessing ? t("common.loading") : t("billing.ui.wizard.next_review") }) })
|
|
2381
2402
|
] });
|
|
2382
2403
|
}
|
|
2383
2404
|
_chunk7QVYU63Ejs.__name.call(void 0, WizardStepPlanSelection, "WizardStepPlanSelection");
|
|
@@ -2401,7 +2422,7 @@ function PromoCodeInput({
|
|
|
2401
2422
|
disabled = false
|
|
2402
2423
|
}) {
|
|
2403
2424
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2404
|
-
const locale =
|
|
2425
|
+
const locale = _chunkOJAIKQR2js.useI18nLocale.call(void 0, );
|
|
2405
2426
|
const [code, setCode] = _react.useState.call(void 0, "");
|
|
2406
2427
|
const appliedKey = _optionalChain([appliedCode, 'optionalAccess', _82 => _82.valid]) ? `${appliedCode.automatic ? "auto" : "typed"}:${_nullishCoalesce(appliedCode.code, () => ( ""))}` : null;
|
|
2407
2428
|
const [previousAppliedKey, setPreviousAppliedKey] = _react.useState.call(void 0, appliedKey);
|
|
@@ -2430,7 +2451,7 @@ function PromoCodeInput({
|
|
|
2430
2451
|
}
|
|
2431
2452
|
const amount = (result.discountValue || 0) / 100;
|
|
2432
2453
|
const currency = _optionalChain([result, 'access', _83 => _83.currency, 'optionalAccess', _84 => _84.toUpperCase, 'call', _85 => _85()]) || "USD";
|
|
2433
|
-
return t("billing.ui.wizard.review.amount_off", { amount: `${currency} ${
|
|
2454
|
+
return t("billing.ui.wizard.review.amount_off", { amount: `${currency} ${_chunkOJAIKQR2js.formatFixed.call(void 0, amount, locale, 2)}` });
|
|
2434
2455
|
}, "formatDiscount");
|
|
2435
2456
|
const formatDuration = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (result) => {
|
|
2436
2457
|
switch (result.duration) {
|
|
@@ -2447,7 +2468,7 @@ function PromoCodeInput({
|
|
|
2447
2468
|
const codeInput = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
2448
2469
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
|
|
2449
2470
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2450
|
-
|
|
2471
|
+
_chunkR2XBVIO5js.Input,
|
|
2451
2472
|
{
|
|
2452
2473
|
placeholder: t("billing.ui.promo_code.placeholder"),
|
|
2453
2474
|
value: code,
|
|
@@ -2457,7 +2478,7 @@ function PromoCodeInput({
|
|
|
2457
2478
|
className: "flex-1"
|
|
2458
2479
|
}
|
|
2459
2480
|
),
|
|
2460
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2481
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.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") })
|
|
2461
2482
|
] }),
|
|
2462
2483
|
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error })
|
|
2463
2484
|
] });
|
|
@@ -2486,7 +2507,7 @@ function PromoCodeInput({
|
|
|
2486
2507
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success text-sm", children: formatDiscount(appliedCode) })
|
|
2487
2508
|
] }),
|
|
2488
2509
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2489
|
-
|
|
2510
|
+
_chunkR2XBVIO5js.Button,
|
|
2490
2511
|
{
|
|
2491
2512
|
variant: "ghost",
|
|
2492
2513
|
size: "sm",
|
|
@@ -2534,7 +2555,7 @@ function WizardStepReview({
|
|
|
2534
2555
|
isTrialUpgrade
|
|
2535
2556
|
}) {
|
|
2536
2557
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2537
|
-
const fmt =
|
|
2558
|
+
const fmt = _chunkR2XBVIO5js.useBillingFormatOptions.call(void 0, );
|
|
2538
2559
|
const [card, setCard] = _react.useState.call(void 0, null);
|
|
2539
2560
|
_react.useEffect.call(void 0, () => {
|
|
2540
2561
|
if (!hasPaymentMethod) {
|
|
@@ -2542,7 +2563,7 @@ function WizardStepReview({
|
|
|
2542
2563
|
return;
|
|
2543
2564
|
}
|
|
2544
2565
|
let cancelled = false;
|
|
2545
|
-
Promise.all([
|
|
2566
|
+
Promise.all([_chunkOJAIKQR2js.StripeCustomerService.listPaymentMethods(), _chunkOJAIKQR2js.StripeCustomerService.getCustomer()]).then(([methods, customer]) => {
|
|
2546
2567
|
if (!cancelled) setCard(reviewCard(methods, _optionalChain([customer, 'optionalAccess', _90 => _90.defaultPaymentMethodId])));
|
|
2547
2568
|
}).catch((err) => {
|
|
2548
2569
|
console.error("[WizardStepReview] Failed to load the card on file:", err);
|
|
@@ -2561,24 +2582,24 @@ function WizardStepReview({
|
|
|
2561
2582
|
const interval = _optionalChain([price, 'access', _93 => _93.recurring, 'optionalAccess', _94 => _94.interval]) || "month";
|
|
2562
2583
|
return interval === "year" ? t("billing.ui.wizard.review.interval_yearly") : t("billing.ui.wizard.review.interval_monthly");
|
|
2563
2584
|
}, "formatInterval");
|
|
2564
|
-
const codeDiscount =
|
|
2565
|
-
const carriedDiscount = isChangingPlan && !codeDiscount ?
|
|
2585
|
+
const codeDiscount = _chunkR2XBVIO5js.promotionCodeDiscount.call(void 0, promotionCode);
|
|
2586
|
+
const carriedDiscount = isChangingPlan && !codeDiscount ? _chunkR2XBVIO5js.subscriptionDiscount.call(void 0, subscription) : null;
|
|
2566
2587
|
const discount = _nullishCoalesce(codeDiscount, () => ( carriedDiscount));
|
|
2567
|
-
const discountedPrice =
|
|
2568
|
-
const discountedImmediateCharge =
|
|
2588
|
+
const discountedPrice = _chunkR2XBVIO5js.applyDiscount.call(void 0, selectedPrice.unitAmount, discount);
|
|
2589
|
+
const discountedImmediateCharge = _chunkR2XBVIO5js.applyDiscount.call(void 0, _optionalChain([prorationPreview, 'optionalAccess', _95 => _95.immediateCharge]), discount);
|
|
2569
2590
|
const getDiscountDescription = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
2570
2591
|
if (!discount) return null;
|
|
2571
2592
|
if (discount.discountType === "percent_off") {
|
|
2572
2593
|
return t("billing.ui.wizard.review.percent_off", { value: discount.discountValue });
|
|
2573
2594
|
}
|
|
2574
2595
|
return t("billing.ui.wizard.review.amount_off", {
|
|
2575
|
-
amount:
|
|
2596
|
+
amount: _chunkOJAIKQR2js.formatCurrency.call(void 0, discount.discountValue, discount.currency || selectedPrice.currency, fmt)
|
|
2576
2597
|
});
|
|
2577
2598
|
}, "getDiscountDescription");
|
|
2578
2599
|
const discountDescription = getDiscountDescription();
|
|
2579
2600
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
2580
2601
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-muted/50 rounded-lg p-4 space-y-3", children: [
|
|
2581
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2602
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.SectionHeader, { children: t("billing.ui.wizard.review.selected_plan") }),
|
|
2582
2603
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between items-center", children: [
|
|
2583
2604
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
2584
2605
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-medium", children: _optionalChain([selectedPrice, 'access', _96 => _96.product, 'optionalAccess', _97 => _97.name]) }),
|
|
@@ -2586,11 +2607,11 @@ function WizardStepReview({
|
|
|
2586
2607
|
] }),
|
|
2587
2608
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-end", children: [
|
|
2588
2609
|
discountedPrice !== null ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2589
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground line-through", children:
|
|
2590
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-success text-lg font-semibold", children:
|
|
2591
|
-
discountDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2610
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground line-through", children: _chunkOJAIKQR2js.formatCurrency.call(void 0, selectedPrice.unitAmount || 0, selectedPrice.currency, fmt) }),
|
|
2611
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-success text-lg font-semibold", children: _chunkOJAIKQR2js.formatCurrency.call(void 0, discountedPrice, selectedPrice.currency, fmt) }),
|
|
2612
|
+
discountDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Badge, { variant: "softGreen", children: discountDescription }),
|
|
2592
2613
|
carriedDiscount && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: t("billing.ui.wizard.review.discount_carries_over") })
|
|
2593
|
-
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-semibold text-lg", children:
|
|
2614
|
+
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-semibold text-lg", children: _chunkOJAIKQR2js.formatCurrency.call(void 0, selectedPrice.unitAmount || 0, selectedPrice.currency, fmt) }),
|
|
2594
2615
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: formatInterval2(selectedPrice) })
|
|
2595
2616
|
] })
|
|
2596
2617
|
] })
|
|
@@ -2605,9 +2626,9 @@ function WizardStepReview({
|
|
|
2605
2626
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between text-sm", children: [
|
|
2606
2627
|
/* @__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") }),
|
|
2607
2628
|
/* @__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: [
|
|
2608
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "line-through text-muted-foreground me-2", children:
|
|
2609
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success", children:
|
|
2610
|
-
] }) :
|
|
2629
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "line-through text-muted-foreground me-2", children: _chunkOJAIKQR2js.formatCurrency.call(void 0, prorationPreview.immediateCharge, prorationPreview.currency, fmt) }),
|
|
2630
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success", children: _chunkOJAIKQR2js.formatCurrency.call(void 0, discountedImmediateCharge, prorationPreview.currency, fmt) })
|
|
2631
|
+
] }) : _chunkOJAIKQR2js.formatCurrency.call(void 0, prorationPreview.immediateCharge, prorationPreview.currency, fmt) })
|
|
2611
2632
|
] })
|
|
2612
2633
|
]
|
|
2613
2634
|
}
|
|
@@ -2631,15 +2652,15 @@ function WizardStepReview({
|
|
|
2631
2652
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "font-medium", children: t("billing.ui.payment_method.title") }),
|
|
2632
2653
|
/* @__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") })
|
|
2633
2654
|
] }),
|
|
2634
|
-
hasPaymentMethod ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2655
|
+
hasPaymentMethod ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Button, { variant: "outline", onClick: onAddPaymentMethod, disabled: isProcessing, children: t("billing.ui.wizard.review.use_another_card") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Button, { variant: "outline", onClick: onAddPaymentMethod, children: t("billing.ui.payment_methods.add") })
|
|
2635
2656
|
] }) }),
|
|
2636
|
-
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2657
|
+
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.Alert, { variant: "destructive", children: [
|
|
2637
2658
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.AlertCircle, { className: "h-4 w-4" }),
|
|
2638
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2659
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.AlertDescription, { children: error })
|
|
2639
2660
|
] }),
|
|
2640
2661
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between pt-4 border-t", children: [
|
|
2641
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2642
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2662
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Button, { variant: "outline", onClick: onBack, disabled: isProcessing, children: t("billing.ui.wizard.back") }),
|
|
2663
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.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") })
|
|
2643
2664
|
] })
|
|
2644
2665
|
] });
|
|
2645
2666
|
}
|
|
@@ -2652,7 +2673,7 @@ function WizardStepPaymentMethod({ onBack, onSuccess, isProcessing }) {
|
|
|
2652
2673
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2653
2674
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
2654
2675
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
2655
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2676
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.SectionHeader, { children: t("billing.ui.payment_methods.add") }),
|
|
2656
2677
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: t("billing.ui.wizard.payment_description") })
|
|
2657
2678
|
] }),
|
|
2658
2679
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodForm, { onSuccess, onCancel: onBack, isLoading: isProcessing, alwaysSetDefault: true })
|
|
@@ -2695,10 +2716,10 @@ function SubscriptionWizard({
|
|
|
2695
2716
|
const isChangePlanMode = !!subscription;
|
|
2696
2717
|
const dialogTitle = subscription ? t("billing.ui.wizard.change_title") : isPurchasingAddons ? t("billing.ui.subscriptions.purchase_addons") : t("billing.ui.subscriptions.subscribe");
|
|
2697
2718
|
const dialogDescription = subscription ? t("billing.ui.wizard.change_description") : isPurchasingAddons ? t("billing.ui.wizard.addons_description") : t("billing.ui.wizard.subscribe_description");
|
|
2698
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2699
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2700
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2701
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2719
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.DialogContent, { className: "max-w-2xl max-h-[90vh] overflow-y-auto", children: [
|
|
2720
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.DialogHeader, { children: [
|
|
2721
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.DialogTitle, { children: dialogTitle }),
|
|
2722
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.DialogDescription, { children: dialogDescription })
|
|
2702
2723
|
] }),
|
|
2703
2724
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, WizardProgressIndicator, { currentStep: state.step }),
|
|
2704
2725
|
state.step === "plan-selection" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -2766,7 +2787,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, getProgressColor, "getProgressColor");
|
|
|
2766
2787
|
function formatDate2(date, { locale, t }) {
|
|
2767
2788
|
if (!date) return t("billing.ui.not_available");
|
|
2768
2789
|
try {
|
|
2769
|
-
return new Intl.DateTimeFormat(
|
|
2790
|
+
return new Intl.DateTimeFormat(_chunkOJAIKQR2js.dateFormatLocale.call(void 0, locale), {
|
|
2770
2791
|
month: "short",
|
|
2771
2792
|
day: "numeric"
|
|
2772
2793
|
}).format(new Date(date));
|
|
@@ -2777,7 +2798,7 @@ function formatDate2(date, { locale, t }) {
|
|
|
2777
2798
|
_chunk7QVYU63Ejs.__name.call(void 0, formatDate2, "formatDate");
|
|
2778
2799
|
function UsageSummaryCard({ meter, summary }) {
|
|
2779
2800
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2780
|
-
const fmt =
|
|
2801
|
+
const fmt = _chunkR2XBVIO5js.useBillingFormatOptions.call(void 0, );
|
|
2781
2802
|
const currentUsage = _nullishCoalesce(_optionalChain([summary, 'optionalAccess', _100 => _100.aggregatedValue]), () => ( 0));
|
|
2782
2803
|
const limit = meter.limit;
|
|
2783
2804
|
const percentage = limit && limit > 0 ? currentUsage / limit * 100 : null;
|
|
@@ -2785,15 +2806,15 @@ function UsageSummaryCard({ meter, summary }) {
|
|
|
2785
2806
|
const progressWidth = percentage !== null ? Math.min(percentage, 100) : 0;
|
|
2786
2807
|
const displayName = meter.displayName || meter.eventName;
|
|
2787
2808
|
const hasLimit = limit !== null && limit !== void 0;
|
|
2788
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2789
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2809
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.Card, { children: [
|
|
2810
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.CardHeader, { className: "flex flex-row items-center gap-x-3 pb-3", children: [
|
|
2790
2811
|
/* @__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" }) }),
|
|
2791
2812
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col", children: [
|
|
2792
2813
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium", children: displayName }),
|
|
2793
2814
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-xs", children: meter.id })
|
|
2794
2815
|
] })
|
|
2795
2816
|
] }),
|
|
2796
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2817
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.CardContent, { className: "flex flex-col gap-y-4", children: [
|
|
2797
2818
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
2798
2819
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-3xl font-bold", children: currentUsage.toLocaleString(fmt.locale) }),
|
|
2799
2820
|
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) }) })
|
|
@@ -2801,7 +2822,7 @@ function UsageSummaryCard({ meter, summary }) {
|
|
|
2801
2822
|
hasLimit ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-2", children: [
|
|
2802
2823
|
/* @__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}%` } }) }),
|
|
2803
2824
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-sm", children: t("billing.ui.usage.percent_used", {
|
|
2804
|
-
value: percentage !== null ?
|
|
2825
|
+
value: percentage !== null ? _chunkOJAIKQR2js.formatFixed.call(void 0, percentage, fmt.locale, 1) : ""
|
|
2805
2826
|
}) })
|
|
2806
2827
|
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-sm", children: t("billing.ui.usage.no_limit") }),
|
|
2807
2828
|
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", {
|
|
@@ -2834,14 +2855,14 @@ function UsageContainer() {
|
|
|
2834
2855
|
const loadUsageData = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2835
2856
|
setLoading(true);
|
|
2836
2857
|
try {
|
|
2837
|
-
const fetchedSubscriptions = await
|
|
2858
|
+
const fetchedSubscriptions = await _chunkOJAIKQR2js.StripeSubscriptionService.listSubscriptions();
|
|
2838
2859
|
setSubscriptions(fetchedSubscriptions);
|
|
2839
2860
|
const hasMeteredSubscriptions2 = fetchedSubscriptions.some((sub) => _optionalChain([sub, 'access', _101 => _101.price, 'optionalAccess', _102 => _102.recurring, 'optionalAccess', _103 => _103.usageType]) === "metered");
|
|
2840
2861
|
if (!hasMeteredSubscriptions2) {
|
|
2841
2862
|
setLoading(false);
|
|
2842
2863
|
return;
|
|
2843
2864
|
}
|
|
2844
|
-
const fetchedMeters = await
|
|
2865
|
+
const fetchedMeters = await _chunkOJAIKQR2js.StripeUsageService.listMeters();
|
|
2845
2866
|
setMeters(fetchedMeters);
|
|
2846
2867
|
const summariesMap = {};
|
|
2847
2868
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -2849,7 +2870,7 @@ function UsageContainer() {
|
|
|
2849
2870
|
const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
|
|
2850
2871
|
for (const meter of fetchedMeters) {
|
|
2851
2872
|
try {
|
|
2852
|
-
const meterSummaries = await
|
|
2873
|
+
const meterSummaries = await _chunkOJAIKQR2js.StripeUsageService.getMeterSummaries({
|
|
2853
2874
|
meterId: meter.id,
|
|
2854
2875
|
startTime: startOfMonth,
|
|
2855
2876
|
endTime: endOfMonth
|
|
@@ -2898,7 +2919,7 @@ function formatDateTime(date, { locale, t }) {
|
|
|
2898
2919
|
if (!date) return t("billing.ui.not_available");
|
|
2899
2920
|
const dateObj = typeof date === "string" ? new Date(date) : date;
|
|
2900
2921
|
try {
|
|
2901
|
-
return new Intl.DateTimeFormat(
|
|
2922
|
+
return new Intl.DateTimeFormat(_chunkOJAIKQR2js.dateFormatLocale.call(void 0, locale), {
|
|
2902
2923
|
month: "short",
|
|
2903
2924
|
day: "numeric",
|
|
2904
2925
|
year: "numeric",
|
|
@@ -2912,27 +2933,27 @@ function formatDateTime(date, { locale, t }) {
|
|
|
2912
2933
|
_chunk7QVYU63Ejs.__name.call(void 0, formatDateTime, "formatDateTime");
|
|
2913
2934
|
function UsageHistoryTable({ usageRecords }) {
|
|
2914
2935
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2915
|
-
const fmt =
|
|
2936
|
+
const fmt = _chunkR2XBVIO5js.useBillingFormatOptions.call(void 0, );
|
|
2916
2937
|
if (usageRecords.length === 0) {
|
|
2917
2938
|
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") }) });
|
|
2918
2939
|
}
|
|
2919
2940
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
2920
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2921
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-clip rounded-lg border", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2922
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2923
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2924
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2925
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2926
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2941
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.SectionHeader, { level: 2, children: t("billing.ui.usage.history_title") }),
|
|
2942
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-clip rounded-lg border", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.Table, { children: [
|
|
2943
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.TableRow, { children: [
|
|
2944
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.TableHead, { children: t("billing.ui.columns.date_time") }),
|
|
2945
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.TableHead, { children: t("billing.ui.columns.meter_event") }),
|
|
2946
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.TableHead, { className: "text-end", children: t("billing.ui.columns.quantity") }),
|
|
2947
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.TableHead, { children: t("billing.ui.columns.event_id") })
|
|
2927
2948
|
] }) }),
|
|
2928
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2949
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.TableBody, { children: usageRecords.map((record) => {
|
|
2929
2950
|
const dateTime = formatDateTime(record.timestamp, fmt);
|
|
2930
2951
|
const quantity = record.quantity.toLocaleString(fmt.locale);
|
|
2931
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2932
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2933
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2934
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2935
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2952
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.TableRow, { children: [
|
|
2953
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.TableCell, { className: "font-medium", children: dateTime }),
|
|
2954
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.TableCell, { className: "text-muted-foreground", children: record.meterEventName }),
|
|
2955
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.TableCell, { className: "text-end font-medium", children: quantity }),
|
|
2956
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.TableCell, { className: "text-muted-foreground text-sm tabular-nums", children: record.stripeEventId })
|
|
2936
2957
|
] }, record.id);
|
|
2937
2958
|
}) })
|
|
2938
2959
|
] }) })
|
|
@@ -2943,8 +2964,8 @@ _chunk7QVYU63Ejs.__name.call(void 0, UsageHistoryTable, "UsageHistoryTable");
|
|
|
2943
2964
|
// src/features/billing/components/modals/BillingDetailModal.tsx
|
|
2944
2965
|
|
|
2945
2966
|
function BillingDetailModal({ open, onOpenChange, title, children, className }) {
|
|
2946
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2947
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2967
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.DialogContent, { className: _nullishCoalesce(className, () => ( "max-w-4xl max-h-[90vh] overflow-y-auto")), children: [
|
|
2968
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.DialogHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.DialogTitle, { children: title }) }),
|
|
2948
2969
|
children
|
|
2949
2970
|
] }) });
|
|
2950
2971
|
}
|
|
@@ -2972,7 +2993,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
|
|
|
2972
2993
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-destructive text-sm font-medium", children: t("billing.ui.alert.payment_failed_title") }),
|
|
2973
2994
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive mt-1 text-sm", children: t("billing.ui.alert.payment_failed_description") })
|
|
2974
2995
|
] }),
|
|
2975
|
-
onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2996
|
+
onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Button, { variant: "outline", size: "sm", onClick: onUpdatePayment, className: "text-destructive border-red-300", children: t("billing.ui.alert.update_payment_method") })
|
|
2976
2997
|
] });
|
|
2977
2998
|
}
|
|
2978
2999
|
if (subscription.status === "trialing" /* TRIALING */ && subscription.trialEnd) {
|
|
@@ -2986,7 +3007,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
|
|
|
2986
3007
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-warning text-sm font-medium", children: t("billing.ui.alert.trial_ending_title") }),
|
|
2987
3008
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-warning mt-1 text-sm", children: t("billing.ui.alert.trial_ending_description", { count: daysRemaining }) })
|
|
2988
3009
|
] }),
|
|
2989
|
-
onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3010
|
+
onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Button, { variant: "outline", size: "sm", onClick: onAddPayment, className: "text-warning border-yellow-300", children: t("billing.ui.payment_methods.add") })
|
|
2990
3011
|
] });
|
|
2991
3012
|
}
|
|
2992
3013
|
}
|
|
@@ -2996,7 +3017,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, BillingAlertBanner, "BillingAlertBanner");
|
|
|
2996
3017
|
|
|
2997
3018
|
// src/features/billing/components/containers/BillingDashboardContainer.tsx
|
|
2998
3019
|
|
|
2999
|
-
function BillingDashboardContainer() {
|
|
3020
|
+
function BillingDashboardContainer({ renderCancelDialog } = {}) {
|
|
3000
3021
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
3001
3022
|
const [data, setData] = _react.useState.call(void 0, {
|
|
3002
3023
|
customer: null,
|
|
@@ -3039,7 +3060,7 @@ function BillingDashboardContainer() {
|
|
|
3039
3060
|
setNoCustomerExists(false);
|
|
3040
3061
|
let customer = null;
|
|
3041
3062
|
try {
|
|
3042
|
-
customer = await
|
|
3063
|
+
customer = await _chunkOJAIKQR2js.StripeCustomerService.getCustomer();
|
|
3043
3064
|
setData((prev) => ({ ...prev, customer }));
|
|
3044
3065
|
setErrors((prev) => ({ ...prev, customer: null }));
|
|
3045
3066
|
setNoCustomerExists(false);
|
|
@@ -3065,7 +3086,7 @@ function BillingDashboardContainer() {
|
|
|
3065
3086
|
}
|
|
3066
3087
|
const fetchSubscriptions = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3067
3088
|
try {
|
|
3068
|
-
const subscriptions2 = await
|
|
3089
|
+
const subscriptions2 = await _chunkOJAIKQR2js.StripeSubscriptionService.listSubscriptions();
|
|
3069
3090
|
setData((prev) => ({ ...prev, subscriptions: subscriptions2 }));
|
|
3070
3091
|
setErrors((prev) => ({ ...prev, subscriptions: null }));
|
|
3071
3092
|
return subscriptions2;
|
|
@@ -3079,7 +3100,7 @@ function BillingDashboardContainer() {
|
|
|
3079
3100
|
}, "fetchSubscriptions");
|
|
3080
3101
|
const fetchPaymentMethods = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3081
3102
|
try {
|
|
3082
|
-
const paymentMethods = await
|
|
3103
|
+
const paymentMethods = await _chunkOJAIKQR2js.StripeCustomerService.listPaymentMethods();
|
|
3083
3104
|
setData((prev) => ({ ...prev, paymentMethods }));
|
|
3084
3105
|
setErrors((prev) => ({ ...prev, paymentMethods: null }));
|
|
3085
3106
|
} catch (error) {
|
|
@@ -3091,7 +3112,7 @@ function BillingDashboardContainer() {
|
|
|
3091
3112
|
}, "fetchPaymentMethods");
|
|
3092
3113
|
const fetchInvoices = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3093
3114
|
try {
|
|
3094
|
-
const invoices = await
|
|
3115
|
+
const invoices = await _chunkOJAIKQR2js.StripeInvoiceService.listInvoices();
|
|
3095
3116
|
setData((prev) => ({ ...prev, invoices }));
|
|
3096
3117
|
setErrors((prev) => ({ ...prev, invoices: null }));
|
|
3097
3118
|
} catch (error) {
|
|
@@ -3114,7 +3135,7 @@ function BillingDashboardContainer() {
|
|
|
3114
3135
|
const handleCreateCustomer = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3115
3136
|
setCreatingCustomer(true);
|
|
3116
3137
|
try {
|
|
3117
|
-
await
|
|
3138
|
+
await _chunkOJAIKQR2js.StripeCustomerService.createCustomer();
|
|
3118
3139
|
setNoCustomerExists(false);
|
|
3119
3140
|
await fetchAllData();
|
|
3120
3141
|
} catch (error) {
|
|
@@ -3126,7 +3147,7 @@ function BillingDashboardContainer() {
|
|
|
3126
3147
|
}, "handleCreateCustomer");
|
|
3127
3148
|
const fetchUsageData = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3128
3149
|
try {
|
|
3129
|
-
const meters = await
|
|
3150
|
+
const meters = await _chunkOJAIKQR2js.StripeUsageService.listMeters();
|
|
3130
3151
|
setData((prev) => ({ ...prev, meters }));
|
|
3131
3152
|
const summariesMap = {};
|
|
3132
3153
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -3134,7 +3155,7 @@ function BillingDashboardContainer() {
|
|
|
3134
3155
|
const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
|
|
3135
3156
|
for (const meter of meters) {
|
|
3136
3157
|
try {
|
|
3137
|
-
const meterSummaries = await
|
|
3158
|
+
const meterSummaries = await _chunkOJAIKQR2js.StripeUsageService.getMeterSummaries({
|
|
3138
3159
|
meterId: meter.id,
|
|
3139
3160
|
startTime: startOfMonth,
|
|
3140
3161
|
endTime: endOfMonth
|
|
@@ -3196,7 +3217,7 @@ function BillingDashboardContainer() {
|
|
|
3196
3217
|
_react.useEffect.call(void 0, () => {
|
|
3197
3218
|
if (!pendingChangePlan || loading.subscriptions) return;
|
|
3198
3219
|
setPendingChangePlan(false);
|
|
3199
|
-
handleOpenWizard(
|
|
3220
|
+
handleOpenWizard(_chunkOJAIKQR2js.resolveChangePlanTarget.call(void 0, data.subscriptions));
|
|
3200
3221
|
}, [pendingChangePlan, loading.subscriptions, data.subscriptions, handleOpenWizard]);
|
|
3201
3222
|
const criticalSubscriptions = data.subscriptions.filter(
|
|
3202
3223
|
(sub) => sub.status === "past_due" /* PAST_DUE */ || sub.status === "trialing" /* TRIALING */ && sub.trialEnd && new Date(sub.trialEnd).getTime() - (/* @__PURE__ */ new Date()).getTime() <= 7 * 24 * 60 * 60 * 1e3
|
|
@@ -3227,18 +3248,18 @@ function BillingDashboardContainer() {
|
|
|
3227
3248
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-8 w-8" }),
|
|
3228
3249
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: t("billing.title") })
|
|
3229
3250
|
] }),
|
|
3230
|
-
isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3231
|
-
noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3232
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3251
|
+
isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.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" }) }) }),
|
|
3252
|
+
noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.Card, { children: [
|
|
3253
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.CardHeader, { className: "text-center", children: [
|
|
3233
3254
|
/* @__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" }) }),
|
|
3234
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3235
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3255
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.CardTitle, { children: t("billing.ui.dashboard.setup_title") }),
|
|
3256
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.CardDescription, { children: t("billing.ui.dashboard.setup_description") })
|
|
3236
3257
|
] }),
|
|
3237
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3258
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.CardContent, { className: "flex justify-center pb-8", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Button, { onClick: handleCreateCustomer, disabled: creatingCustomer, size: "lg", children: creatingCustomer ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
3238
3259
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "me-2 h-4 w-4 animate-spin" }),
|
|
3239
3260
|
t("billing.ui.dashboard.setting_up")
|
|
3240
3261
|
] }) : t("billing.ui.dashboard.setup_button") }) }),
|
|
3241
|
-
errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3262
|
+
errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.CardContent, { className: "pt-0", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-center text-destructive text-xs/relaxed", children: t(errors.customer) }) })
|
|
3242
3263
|
] }),
|
|
3243
3264
|
!noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
3244
3265
|
criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -3316,7 +3337,8 @@ function BillingDashboardContainer() {
|
|
|
3316
3337
|
onOpenWizard: handleOpenWizard,
|
|
3317
3338
|
hasActiveRecurringSubscription,
|
|
3318
3339
|
subscriptions: data.subscriptions,
|
|
3319
|
-
onSubscriptionsChange: refreshData
|
|
3340
|
+
onSubscriptionsChange: refreshData,
|
|
3341
|
+
renderCancelDialog
|
|
3320
3342
|
}
|
|
3321
3343
|
)
|
|
3322
3344
|
}
|
|
@@ -3382,7 +3404,7 @@ function getStripePromise(publishableKey) {
|
|
|
3382
3404
|
}
|
|
3383
3405
|
_chunk7QVYU63Ejs.__name.call(void 0, getStripePromise, "getStripePromise");
|
|
3384
3406
|
function StripeProvider({ children }) {
|
|
3385
|
-
const publishableKey =
|
|
3407
|
+
const publishableKey = _chunkAMN2XDN5js.getStripePublishableKey.call(void 0, );
|
|
3386
3408
|
const stripePromise = _react.useMemo.call(void 0, () => getStripePromise(publishableKey), [publishableKey]);
|
|
3387
3409
|
const options = _react.useMemo.call(void 0, () => ({}), []);
|
|
3388
3410
|
if (!publishableKey) {
|
|
@@ -3392,7 +3414,7 @@ function StripeProvider({ children }) {
|
|
|
3392
3414
|
}
|
|
3393
3415
|
_chunk7QVYU63Ejs.__name.call(void 0, StripeProvider, "StripeProvider");
|
|
3394
3416
|
function isStripeConfigured() {
|
|
3395
|
-
return !!
|
|
3417
|
+
return !!_chunkAMN2XDN5js.getStripePublishableKey.call(void 0, );
|
|
3396
3418
|
}
|
|
3397
3419
|
_chunk7QVYU63Ejs.__name.call(void 0, isStripeConfigured, "isStripeConfigured");
|
|
3398
3420
|
|
|
@@ -3407,18 +3429,18 @@ _chunk7QVYU63Ejs.__name.call(void 0, isStripeConfigured, "isStripeConfigured");
|
|
|
3407
3429
|
|
|
3408
3430
|
function PriceArchiver({ price }) {
|
|
3409
3431
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
3410
|
-
const fmt =
|
|
3432
|
+
const fmt = _chunkR2XBVIO5js.useBillingFormatOptions.call(void 0, );
|
|
3411
3433
|
const { archivePrice, restorePrice } = usePriceContext();
|
|
3412
3434
|
const [open, setOpen] = _react.useState.call(void 0, false);
|
|
3413
3435
|
const isArchived = !price.active;
|
|
3414
3436
|
const scope = isArchived ? "restore" : "archive";
|
|
3415
3437
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
3416
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3438
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.Button, { variant: "outline", size: "sm", onClick: () => setOpen(true), children: [
|
|
3417
3439
|
isArchived ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RotateCcwIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ArchiveIcon, {}),
|
|
3418
3440
|
t(`billing.admin.prices.${scope}.confirm`)
|
|
3419
3441
|
] }),
|
|
3420
3442
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3421
|
-
|
|
3443
|
+
_chunkR2XBVIO5js.ConfirmDialog,
|
|
3422
3444
|
{
|
|
3423
3445
|
open,
|
|
3424
3446
|
onOpenChange: setOpen,
|
|
@@ -3432,7 +3454,7 @@ function PriceArchiver({ price }) {
|
|
|
3432
3454
|
if (isArchived) await restorePrice(price.id);
|
|
3433
3455
|
else await archivePrice(price.id);
|
|
3434
3456
|
} catch (error) {
|
|
3435
|
-
|
|
3457
|
+
_chunkR2XBVIO5js.errorToast.call(void 0, { title: t(`billing.admin.prices.${scope}.title`), error });
|
|
3436
3458
|
throw error;
|
|
3437
3459
|
}
|
|
3438
3460
|
}
|
|
@@ -3464,15 +3486,15 @@ function PriceEditorInternal({
|
|
|
3464
3486
|
onDialogOpenChange
|
|
3465
3487
|
}) {
|
|
3466
3488
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
3467
|
-
const fmt =
|
|
3468
|
-
const router =
|
|
3489
|
+
const fmt = _chunkR2XBVIO5js.useBillingFormatOptions.call(void 0, );
|
|
3490
|
+
const router = _chunkOJAIKQR2js.useI18nRouter.call(void 0, );
|
|
3469
3491
|
const { createPrice, updatePrice, productId: contextProductId } = usePriceContext();
|
|
3470
3492
|
const [allFeatures, setAllFeatures] = _react.useState.call(void 0, []);
|
|
3471
3493
|
const isEdit = !!price;
|
|
3472
3494
|
const targetProductId = _nullishCoalesce(_nullishCoalesce(productId, () => ( _optionalChain([price, 'optionalAccess', _119 => _119.product, 'optionalAccess', _120 => _120.id]))), () => ( contextProductId));
|
|
3473
3495
|
_react.useEffect.call(void 0, () => {
|
|
3474
3496
|
const fetchFeatures = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3475
|
-
setAllFeatures(await
|
|
3497
|
+
setAllFeatures(await _chunkOJAIKQR2js.FeatureService.findMany({}));
|
|
3476
3498
|
}, "fetchFeatures");
|
|
3477
3499
|
void fetchFeatures();
|
|
3478
3500
|
}, []);
|
|
@@ -3585,7 +3607,7 @@ function PriceEditorInternal({
|
|
|
3585
3607
|
warnedUnknownFor.current = fingerprint;
|
|
3586
3608
|
const { unknown } = resolvePlatformFeatures(seed.platformFeatures);
|
|
3587
3609
|
if (unknown.length > 0)
|
|
3588
|
-
|
|
3610
|
+
_chunkOJAIKQR2js.showToast.call(void 0, t("billing.admin.prices.import.warnings.unknownFeatures", { features: unknown.join(", ") }));
|
|
3589
3611
|
}, [seed, isEdit, allFeatures, resolvePlatformFeatures, t]);
|
|
3590
3612
|
const watchInterval = form.watch("interval");
|
|
3591
3613
|
const isRecurring = watchInterval !== "one_time";
|
|
@@ -3606,13 +3628,13 @@ function PriceEditorInternal({
|
|
|
3606
3628
|
{ id: "metered", text: t("billing.admin.prices.usage.metered") }
|
|
3607
3629
|
];
|
|
3608
3630
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3609
|
-
|
|
3631
|
+
_chunkR2XBVIO5js.EditorSheet,
|
|
3610
3632
|
{
|
|
3611
3633
|
form,
|
|
3612
3634
|
entityType: t("billing.admin.prices.entity"),
|
|
3613
3635
|
entityName: price ? priceLabel(price, fmt) : void 0,
|
|
3614
3636
|
isEdit,
|
|
3615
|
-
module:
|
|
3637
|
+
module: _chunkOJAIKQR2js.Modules.StripePrice,
|
|
3616
3638
|
size: "lg",
|
|
3617
3639
|
propagateChanges,
|
|
3618
3640
|
onSuccess,
|
|
@@ -3661,13 +3683,13 @@ function PriceEditorInternal({
|
|
|
3661
3683
|
dialogOpen,
|
|
3662
3684
|
onDialogOpenChange,
|
|
3663
3685
|
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
3664
|
-
isEdit && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3665
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3666
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3686
|
+
isEdit && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.Alert, { children: [
|
|
3687
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.AlertTitle, { children: t("billing.admin.prices.immutability.title") }),
|
|
3688
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.AlertDescription, { children: t("billing.admin.prices.immutability.description") })
|
|
3667
3689
|
] }),
|
|
3668
3690
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
|
|
3669
3691
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3670
|
-
|
|
3692
|
+
_chunkR2XBVIO5js.FormInput,
|
|
3671
3693
|
{
|
|
3672
3694
|
form,
|
|
3673
3695
|
id: "unitAmount",
|
|
@@ -3679,7 +3701,7 @@ function PriceEditorInternal({
|
|
|
3679
3701
|
}
|
|
3680
3702
|
),
|
|
3681
3703
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3682
|
-
|
|
3704
|
+
_chunkR2XBVIO5js.FormSelect,
|
|
3683
3705
|
{
|
|
3684
3706
|
form,
|
|
3685
3707
|
id: "currency",
|
|
@@ -3690,7 +3712,7 @@ function PriceEditorInternal({
|
|
|
3690
3712
|
)
|
|
3691
3713
|
] }),
|
|
3692
3714
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3693
|
-
|
|
3715
|
+
_chunkR2XBVIO5js.FormSelect,
|
|
3694
3716
|
{
|
|
3695
3717
|
form,
|
|
3696
3718
|
id: "interval",
|
|
@@ -3701,7 +3723,7 @@ function PriceEditorInternal({
|
|
|
3701
3723
|
),
|
|
3702
3724
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
|
|
3703
3725
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3704
|
-
|
|
3726
|
+
_chunkR2XBVIO5js.FormInput,
|
|
3705
3727
|
{
|
|
3706
3728
|
form,
|
|
3707
3729
|
id: "intervalCount",
|
|
@@ -3712,7 +3734,7 @@ function PriceEditorInternal({
|
|
|
3712
3734
|
}
|
|
3713
3735
|
),
|
|
3714
3736
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3715
|
-
|
|
3737
|
+
_chunkR2XBVIO5js.FormSelect,
|
|
3716
3738
|
{
|
|
3717
3739
|
form,
|
|
3718
3740
|
id: "usageType",
|
|
@@ -3723,7 +3745,7 @@ function PriceEditorInternal({
|
|
|
3723
3745
|
)
|
|
3724
3746
|
] }),
|
|
3725
3747
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3726
|
-
|
|
3748
|
+
_chunkR2XBVIO5js.FormInput,
|
|
3727
3749
|
{
|
|
3728
3750
|
form,
|
|
3729
3751
|
id: "nickname",
|
|
@@ -3732,7 +3754,7 @@ function PriceEditorInternal({
|
|
|
3732
3754
|
}
|
|
3733
3755
|
),
|
|
3734
3756
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3735
|
-
|
|
3757
|
+
_chunkR2XBVIO5js.FormTextarea,
|
|
3736
3758
|
{
|
|
3737
3759
|
form,
|
|
3738
3760
|
id: "description",
|
|
@@ -3742,7 +3764,7 @@ function PriceEditorInternal({
|
|
|
3742
3764
|
}
|
|
3743
3765
|
),
|
|
3744
3766
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3745
|
-
|
|
3767
|
+
_chunkR2XBVIO5js.FormInput,
|
|
3746
3768
|
{
|
|
3747
3769
|
form,
|
|
3748
3770
|
id: "token",
|
|
@@ -3752,10 +3774,10 @@ function PriceEditorInternal({
|
|
|
3752
3774
|
}
|
|
3753
3775
|
),
|
|
3754
3776
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-2", children: [
|
|
3755
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3777
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.FieldLabel, { children: t("billing.admin.prices.fields.features") }),
|
|
3756
3778
|
form.watch("features").map((_, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
|
|
3757
3779
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3758
|
-
|
|
3780
|
+
_chunkR2XBVIO5js.Input,
|
|
3759
3781
|
{
|
|
3760
3782
|
...form.register(`features.${index}`),
|
|
3761
3783
|
placeholder: t("billing.admin.prices.placeholders.feature", { index: index + 1 }),
|
|
@@ -3763,7 +3785,7 @@ function PriceEditorInternal({
|
|
|
3763
3785
|
}
|
|
3764
3786
|
),
|
|
3765
3787
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3766
|
-
|
|
3788
|
+
_chunkR2XBVIO5js.Button,
|
|
3767
3789
|
{
|
|
3768
3790
|
type: "button",
|
|
3769
3791
|
variant: "outline",
|
|
@@ -3778,7 +3800,7 @@ function PriceEditorInternal({
|
|
|
3778
3800
|
)
|
|
3779
3801
|
] }, index)),
|
|
3780
3802
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3781
|
-
|
|
3803
|
+
_chunkR2XBVIO5js.Button,
|
|
3782
3804
|
{
|
|
3783
3805
|
type: "button",
|
|
3784
3806
|
variant: "outline",
|
|
@@ -3793,12 +3815,12 @@ function PriceEditorInternal({
|
|
|
3793
3815
|
)
|
|
3794
3816
|
] }),
|
|
3795
3817
|
isRecurring && allFeatures.length > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-2", children: [
|
|
3796
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3818
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.FieldLabel, { children: t("billing.admin.prices.fields.platformFeatures") }),
|
|
3797
3819
|
/* @__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) => {
|
|
3798
3820
|
const isChecked = form.watch("featureIds").includes(feature.id);
|
|
3799
3821
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
3800
3822
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3801
|
-
|
|
3823
|
+
_chunkR2XBVIO5js.Checkbox,
|
|
3802
3824
|
{
|
|
3803
3825
|
id: `feature-${feature.id}`,
|
|
3804
3826
|
checked: isChecked,
|
|
@@ -3814,13 +3836,13 @@ function PriceEditorInternal({
|
|
|
3814
3836
|
}
|
|
3815
3837
|
}
|
|
3816
3838
|
),
|
|
3817
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3839
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.FieldLabel, { htmlFor: `feature-${feature.id}`, children: feature.name }),
|
|
3818
3840
|
feature.isCore && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.admin.prices.help.core") })
|
|
3819
3841
|
] }, feature.id);
|
|
3820
3842
|
}) })
|
|
3821
3843
|
] }),
|
|
3822
3844
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3823
|
-
|
|
3845
|
+
_chunkR2XBVIO5js.FormCheckbox,
|
|
3824
3846
|
{
|
|
3825
3847
|
form,
|
|
3826
3848
|
id: "isTrial",
|
|
@@ -3863,7 +3885,7 @@ var defaultContextValue = {
|
|
|
3863
3885
|
productId: void 0
|
|
3864
3886
|
};
|
|
3865
3887
|
function priceLabel(price, fmt = {}) {
|
|
3866
|
-
return _nullishCoalesce(price.nickname, () => ( `${
|
|
3888
|
+
return _nullishCoalesce(price.nickname, () => ( `${_chunkOJAIKQR2js.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt)} ${_chunkOJAIKQR2js.formatInterval.call(void 0, price, fmt)}`.trim()));
|
|
3867
3889
|
}
|
|
3868
3890
|
_chunk7QVYU63Ejs.__name.call(void 0, priceLabel, "priceLabel");
|
|
3869
3891
|
var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
@@ -3873,22 +3895,22 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3873
3895
|
productId: productIdProp
|
|
3874
3896
|
}) => {
|
|
3875
3897
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
3876
|
-
const fmt =
|
|
3877
|
-
const generateUrl =
|
|
3878
|
-
const { hasRole } =
|
|
3898
|
+
const fmt = _chunkR2XBVIO5js.useBillingFormatOptions.call(void 0, );
|
|
3899
|
+
const generateUrl = _chunkR2XBVIO5js.usePageUrlGenerator.call(void 0, );
|
|
3900
|
+
const { hasRole } = _chunkR2XBVIO5js.useCurrentUserContext.call(void 0, );
|
|
3879
3901
|
const [price, setPrice] = _react.useState.call(void 0,
|
|
3880
|
-
dehydratedPrice ?
|
|
3902
|
+
dehydratedPrice ? _chunkOJAIKQR2js.rehydrate.call(void 0, _chunkOJAIKQR2js.Modules.StripePrice, dehydratedPrice) : void 0
|
|
3881
3903
|
);
|
|
3882
3904
|
const [priceVersion, setPriceVersion] = _react.useState.call(void 0, 0);
|
|
3883
3905
|
const refreshPrices = _react.useCallback.call(void 0, () => setPriceVersion((value2) => value2 + 1), []);
|
|
3884
3906
|
const productId = _nullishCoalesce(productIdProp, () => ( _optionalChain([price, 'optionalAccess', _143 => _143.product, 'optionalAccess', _144 => _144.id])));
|
|
3885
3907
|
const reloadPrice = _react.useCallback.call(void 0, async () => {
|
|
3886
3908
|
if (!_optionalChain([price, 'optionalAccess', _145 => _145.id])) return;
|
|
3887
|
-
setPrice(await
|
|
3909
|
+
setPrice(await _chunkOJAIKQR2js.StripePriceService.getPrice({ id: price.id }));
|
|
3888
3910
|
}, [_optionalChain([price, 'optionalAccess', _146 => _146.id])]);
|
|
3889
3911
|
const createPrice = _react.useCallback.call(void 0,
|
|
3890
3912
|
async (input) => {
|
|
3891
|
-
const saved = await
|
|
3913
|
+
const saved = await _chunkOJAIKQR2js.StripePriceService.createPrice(input);
|
|
3892
3914
|
refreshPrices();
|
|
3893
3915
|
return saved;
|
|
3894
3916
|
},
|
|
@@ -3896,7 +3918,7 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3896
3918
|
);
|
|
3897
3919
|
const updatePrice = _react.useCallback.call(void 0,
|
|
3898
3920
|
async (input) => {
|
|
3899
|
-
const saved = await
|
|
3921
|
+
const saved = await _chunkOJAIKQR2js.StripePriceService.updatePrice(input);
|
|
3900
3922
|
setPrice(saved);
|
|
3901
3923
|
refreshPrices();
|
|
3902
3924
|
return saved;
|
|
@@ -3907,7 +3929,7 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3907
3929
|
async (id) => {
|
|
3908
3930
|
const target = _nullishCoalesce(id, () => ( _optionalChain([price, 'optionalAccess', _147 => _147.id])));
|
|
3909
3931
|
if (!target) return;
|
|
3910
|
-
await
|
|
3932
|
+
await _chunkOJAIKQR2js.StripePriceService.archivePrice({ id: target });
|
|
3911
3933
|
await reloadPrice();
|
|
3912
3934
|
refreshPrices();
|
|
3913
3935
|
},
|
|
@@ -3917,7 +3939,7 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3917
3939
|
async (id) => {
|
|
3918
3940
|
const target = _nullishCoalesce(id, () => ( _optionalChain([price, 'optionalAccess', _149 => _149.id])));
|
|
3919
3941
|
if (!target) return;
|
|
3920
|
-
await
|
|
3942
|
+
await _chunkOJAIKQR2js.StripePriceService.reactivatePrice({ id: target });
|
|
3921
3943
|
await reloadPrice();
|
|
3922
3944
|
refreshPrices();
|
|
3923
3945
|
},
|
|
@@ -3941,12 +3963,12 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3941
3963
|
if (!publishChrome) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceContext.Provider, { value, children });
|
|
3942
3964
|
const breadcrumb = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
3943
3965
|
const items = [
|
|
3944
|
-
{ name: t("billing.admin.products.title"), href: generateUrl({ page:
|
|
3966
|
+
{ name: t("billing.admin.products.title"), href: generateUrl({ page: _chunkOJAIKQR2js.Modules.StripeProduct }) }
|
|
3945
3967
|
];
|
|
3946
3968
|
if (_optionalChain([price, 'optionalAccess', _151 => _151.product]))
|
|
3947
3969
|
items.push({
|
|
3948
3970
|
name: price.product.name,
|
|
3949
|
-
href: generateUrl({ page:
|
|
3971
|
+
href: generateUrl({ page: _chunkOJAIKQR2js.Modules.StripeProduct, id: price.product.id })
|
|
3950
3972
|
});
|
|
3951
3973
|
if (price) items.push({ name: priceLabel(price, fmt) });
|
|
3952
3974
|
return items;
|
|
@@ -3963,7 +3985,7 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3963
3985
|
}
|
|
3964
3986
|
return response;
|
|
3965
3987
|
}, "title");
|
|
3966
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3988
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceContext.Provider, { value, children }) });
|
|
3967
3989
|
}, "PriceProvider");
|
|
3968
3990
|
var usePriceContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => _nullishCoalesce(_react.useContext.call(void 0, PriceContext), () => ( defaultContextValue)), "usePriceContext");
|
|
3969
3991
|
|
|
@@ -3983,12 +4005,12 @@ function ProductArchiver({ product }) {
|
|
|
3983
4005
|
const isArchived = !product.active;
|
|
3984
4006
|
const scope = isArchived ? "restore" : "archive";
|
|
3985
4007
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
3986
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
4008
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.Button, { variant: "outline", size: "sm", onClick: () => setOpen(true), children: [
|
|
3987
4009
|
isArchived ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RotateCcwIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ArchiveIcon, {}),
|
|
3988
4010
|
t(`billing.admin.products.${scope}.confirm`)
|
|
3989
4011
|
] }),
|
|
3990
4012
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3991
|
-
|
|
4013
|
+
_chunkR2XBVIO5js.ConfirmDialog,
|
|
3992
4014
|
{
|
|
3993
4015
|
open,
|
|
3994
4016
|
onOpenChange: setOpen,
|
|
@@ -4002,7 +4024,7 @@ function ProductArchiver({ product }) {
|
|
|
4002
4024
|
if (isArchived) await restoreProduct(product.id);
|
|
4003
4025
|
else await archiveProduct(product.id);
|
|
4004
4026
|
} catch (error) {
|
|
4005
|
-
|
|
4027
|
+
_chunkR2XBVIO5js.errorToast.call(void 0, { title: t(`billing.admin.products.${scope}.title`), error });
|
|
4006
4028
|
throw error;
|
|
4007
4029
|
}
|
|
4008
4030
|
}
|
|
@@ -4031,7 +4053,7 @@ function ProductEditorInternal({
|
|
|
4031
4053
|
onDialogOpenChange
|
|
4032
4054
|
}) {
|
|
4033
4055
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4034
|
-
const router =
|
|
4056
|
+
const router = _chunkOJAIKQR2js.useI18nRouter.call(void 0, );
|
|
4035
4057
|
const { createProduct, updateProduct } = useProductContext();
|
|
4036
4058
|
const isEdit = !!product;
|
|
4037
4059
|
const formSchema2 = _react.useMemo.call(void 0,
|
|
@@ -4055,13 +4077,13 @@ function ProductEditorInternal({
|
|
|
4055
4077
|
defaultValues: getDefaultValues()
|
|
4056
4078
|
});
|
|
4057
4079
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4058
|
-
|
|
4080
|
+
_chunkR2XBVIO5js.EditorSheet,
|
|
4059
4081
|
{
|
|
4060
4082
|
form,
|
|
4061
4083
|
entityType: t("billing.admin.products.entity"),
|
|
4062
4084
|
entityName: _optionalChain([product, 'optionalAccess', _155 => _155.name]),
|
|
4063
4085
|
isEdit,
|
|
4064
|
-
module:
|
|
4086
|
+
module: _chunkOJAIKQR2js.Modules.StripeProduct,
|
|
4065
4087
|
size: "md",
|
|
4066
4088
|
propagateChanges,
|
|
4067
4089
|
onSuccess,
|
|
@@ -4078,7 +4100,7 @@ function ProductEditorInternal({
|
|
|
4078
4100
|
onDialogOpenChange,
|
|
4079
4101
|
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4080
4102
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4081
|
-
|
|
4103
|
+
_chunkR2XBVIO5js.FormInput,
|
|
4082
4104
|
{
|
|
4083
4105
|
form,
|
|
4084
4106
|
id: "name",
|
|
@@ -4088,7 +4110,7 @@ function ProductEditorInternal({
|
|
|
4088
4110
|
}
|
|
4089
4111
|
),
|
|
4090
4112
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4091
|
-
|
|
4113
|
+
_chunkR2XBVIO5js.FormTextarea,
|
|
4092
4114
|
{
|
|
4093
4115
|
form,
|
|
4094
4116
|
id: "description",
|
|
@@ -4132,20 +4154,20 @@ var defaultContextValue2 = {
|
|
|
4132
4154
|
};
|
|
4133
4155
|
var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ children, dehydratedProduct, publishChrome = true }) => {
|
|
4134
4156
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4135
|
-
const generateUrl =
|
|
4136
|
-
const { hasRole } =
|
|
4157
|
+
const generateUrl = _chunkR2XBVIO5js.usePageUrlGenerator.call(void 0, );
|
|
4158
|
+
const { hasRole } = _chunkR2XBVIO5js.useCurrentUserContext.call(void 0, );
|
|
4137
4159
|
const [product, setProduct] = _react.useState.call(void 0,
|
|
4138
|
-
dehydratedProduct ?
|
|
4160
|
+
dehydratedProduct ? _chunkOJAIKQR2js.rehydrate.call(void 0, _chunkOJAIKQR2js.Modules.StripeProduct, dehydratedProduct) : void 0
|
|
4139
4161
|
);
|
|
4140
4162
|
const [catalogueVersion, setCatalogueVersion] = _react.useState.call(void 0, 0);
|
|
4141
4163
|
const refreshCatalogue = _react.useCallback.call(void 0, () => setCatalogueVersion((value2) => value2 + 1), []);
|
|
4142
4164
|
const reloadProduct = _react.useCallback.call(void 0, async () => {
|
|
4143
4165
|
if (!_optionalChain([product, 'optionalAccess', _156 => _156.id])) return;
|
|
4144
|
-
setProduct(await
|
|
4166
|
+
setProduct(await _chunkOJAIKQR2js.StripeProductService.getProduct({ id: product.id }));
|
|
4145
4167
|
}, [_optionalChain([product, 'optionalAccess', _157 => _157.id])]);
|
|
4146
4168
|
const createProduct = _react.useCallback.call(void 0,
|
|
4147
4169
|
async (input) => {
|
|
4148
|
-
const saved = await
|
|
4170
|
+
const saved = await _chunkOJAIKQR2js.StripeProductService.createProduct(input);
|
|
4149
4171
|
refreshCatalogue();
|
|
4150
4172
|
return saved;
|
|
4151
4173
|
},
|
|
@@ -4153,7 +4175,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
4153
4175
|
);
|
|
4154
4176
|
const updateProduct = _react.useCallback.call(void 0,
|
|
4155
4177
|
async (input) => {
|
|
4156
|
-
const saved = await
|
|
4178
|
+
const saved = await _chunkOJAIKQR2js.StripeProductService.updateProduct(input);
|
|
4157
4179
|
setProduct(saved);
|
|
4158
4180
|
refreshCatalogue();
|
|
4159
4181
|
return saved;
|
|
@@ -4164,7 +4186,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
4164
4186
|
async (id) => {
|
|
4165
4187
|
const target = _nullishCoalesce(id, () => ( _optionalChain([product, 'optionalAccess', _158 => _158.id])));
|
|
4166
4188
|
if (!target) return;
|
|
4167
|
-
await
|
|
4189
|
+
await _chunkOJAIKQR2js.StripeProductService.archiveProduct({ id: target });
|
|
4168
4190
|
await reloadProduct();
|
|
4169
4191
|
refreshCatalogue();
|
|
4170
4192
|
},
|
|
@@ -4174,7 +4196,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
4174
4196
|
async (id) => {
|
|
4175
4197
|
const target = _nullishCoalesce(id, () => ( _optionalChain([product, 'optionalAccess', _160 => _160.id])));
|
|
4176
4198
|
if (!target) return;
|
|
4177
|
-
await
|
|
4199
|
+
await _chunkOJAIKQR2js.StripeProductService.reactivateProduct({ id: target });
|
|
4178
4200
|
await reloadProduct();
|
|
4179
4201
|
refreshCatalogue();
|
|
4180
4202
|
},
|
|
@@ -4209,7 +4231,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
4209
4231
|
{
|
|
4210
4232
|
name: t("billing.admin.products.title"),
|
|
4211
4233
|
// Linked only when it is NOT the current page.
|
|
4212
|
-
...product ? { href: generateUrl({ page:
|
|
4234
|
+
...product ? { href: generateUrl({ page: _chunkOJAIKQR2js.Modules.StripeProduct }) } : {}
|
|
4213
4235
|
}
|
|
4214
4236
|
];
|
|
4215
4237
|
if (product) items.push({ name: product.name });
|
|
@@ -4227,7 +4249,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
4227
4249
|
}
|
|
4228
4250
|
return response;
|
|
4229
4251
|
}, "title");
|
|
4230
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4252
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductContext.Provider, { value, children }) });
|
|
4231
4253
|
}, "ProductProvider");
|
|
4232
4254
|
var useProductContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => _nullishCoalesce(_react.useContext.call(void 0, ProductContext), () => ( defaultContextValue2)), "useProductContext");
|
|
4233
4255
|
|
|
@@ -4236,57 +4258,57 @@ var useProductContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ()
|
|
|
4236
4258
|
|
|
4237
4259
|
function PriceDetails() {
|
|
4238
4260
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4239
|
-
const fmt =
|
|
4240
|
-
const generateUrl =
|
|
4261
|
+
const fmt = _chunkR2XBVIO5js.useBillingFormatOptions.call(void 0, );
|
|
4262
|
+
const generateUrl = _chunkR2XBVIO5js.usePageUrlGenerator.call(void 0, );
|
|
4241
4263
|
const { price } = usePriceContext();
|
|
4242
4264
|
if (!price) return null;
|
|
4243
4265
|
const isRecurring = price.priceType === "recurring";
|
|
4244
4266
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-8", children: [
|
|
4245
4267
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4246
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4268
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.SectionHeader, { children: t("billing.admin.prices.title") }),
|
|
4247
4269
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
4248
4270
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4249
|
-
|
|
4271
|
+
_chunkR2XBVIO5js.DetailField,
|
|
4250
4272
|
{
|
|
4251
4273
|
label: t("billing.admin.prices.fields.product"),
|
|
4252
|
-
value: price.product ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4274
|
+
value: price.product ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Link, { href: generateUrl({ page: _chunkOJAIKQR2js.Modules.StripeProduct, id: price.product.id }), children: price.product.name }) : "\u2014"
|
|
4253
4275
|
}
|
|
4254
4276
|
),
|
|
4255
4277
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4256
|
-
|
|
4278
|
+
_chunkR2XBVIO5js.DetailField,
|
|
4257
4279
|
{
|
|
4258
4280
|
label: t("billing.admin.prices.fields.status"),
|
|
4259
4281
|
value: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex flex-wrap items-center gap-1", children: [
|
|
4260
|
-
price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4261
|
-
price.isTrial && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4282
|
+
price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Badge, { variant: "softGreen", children: t("billing.admin.prices.status.active") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Badge, { variant: "softGray", children: t("billing.admin.prices.status.archived") }),
|
|
4283
|
+
price.isTrial && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Badge, { variant: "softBlue", children: t("billing.admin.prices.badge.trial") })
|
|
4262
4284
|
] })
|
|
4263
4285
|
}
|
|
4264
4286
|
),
|
|
4265
4287
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4266
|
-
|
|
4288
|
+
_chunkR2XBVIO5js.DetailField,
|
|
4267
4289
|
{
|
|
4268
4290
|
label: t("billing.admin.prices.fields.amount"),
|
|
4269
|
-
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children:
|
|
4291
|
+
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _chunkOJAIKQR2js.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt) })
|
|
4270
4292
|
}
|
|
4271
4293
|
),
|
|
4272
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4294
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.DetailField, { label: t("billing.admin.prices.fields.currency"), value: price.currency.toUpperCase() }),
|
|
4273
4295
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4274
|
-
|
|
4296
|
+
_chunkR2XBVIO5js.DetailField,
|
|
4275
4297
|
{
|
|
4276
4298
|
label: t("billing.admin.prices.fields.type"),
|
|
4277
4299
|
value: isRecurring ? t("billing.admin.prices.type.recurring") : t("billing.admin.prices.type.oneTime")
|
|
4278
4300
|
}
|
|
4279
4301
|
),
|
|
4280
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4302
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.DetailField, { label: t("billing.admin.prices.fields.billing"), value: _chunkOJAIKQR2js.formatInterval.call(void 0, price, fmt) }),
|
|
4281
4303
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4282
|
-
|
|
4304
|
+
_chunkR2XBVIO5js.DetailField,
|
|
4283
4305
|
{
|
|
4284
4306
|
label: t("billing.admin.prices.fields.intervalCount"),
|
|
4285
4307
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _nullishCoalesce(_optionalChain([price, 'access', _162 => _162.recurring, 'optionalAccess', _163 => _163.intervalCount]), () => ( 1)) })
|
|
4286
4308
|
}
|
|
4287
4309
|
),
|
|
4288
4310
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4289
|
-
|
|
4311
|
+
_chunkR2XBVIO5js.DetailField,
|
|
4290
4312
|
{
|
|
4291
4313
|
label: t("billing.admin.prices.fields.usageType"),
|
|
4292
4314
|
value: _optionalChain([price, 'access', _164 => _164.recurring, 'optionalAccess', _165 => _165.usageType]) === "metered" ? t("billing.admin.prices.usage.metered") : t("billing.admin.prices.usage.licensed")
|
|
@@ -4295,24 +4317,24 @@ function PriceDetails() {
|
|
|
4295
4317
|
] })
|
|
4296
4318
|
] }),
|
|
4297
4319
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4298
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4320
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.SectionHeader, { children: t("billing.admin.prices.fields.platformFeatures") }),
|
|
4299
4321
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
4300
4322
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4301
|
-
|
|
4323
|
+
_chunkR2XBVIO5js.DetailField,
|
|
4302
4324
|
{
|
|
4303
4325
|
label: t("billing.admin.prices.fields.token"),
|
|
4304
4326
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _nullishCoalesce(price.token, () => ( "\u2014")) })
|
|
4305
4327
|
}
|
|
4306
4328
|
),
|
|
4307
4329
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4308
|
-
|
|
4330
|
+
_chunkR2XBVIO5js.DetailField,
|
|
4309
4331
|
{
|
|
4310
4332
|
label: t("billing.admin.prices.fields.stripeId"),
|
|
4311
4333
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: price.stripePriceId })
|
|
4312
4334
|
}
|
|
4313
4335
|
),
|
|
4314
4336
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4315
|
-
|
|
4337
|
+
_chunkR2XBVIO5js.DetailField,
|
|
4316
4338
|
{
|
|
4317
4339
|
label: t("billing.admin.prices.fields.description"),
|
|
4318
4340
|
value: _nullishCoalesce(price.description, () => ( "\u2014")),
|
|
@@ -4320,7 +4342,7 @@ function PriceDetails() {
|
|
|
4320
4342
|
}
|
|
4321
4343
|
),
|
|
4322
4344
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4323
|
-
|
|
4345
|
+
_chunkR2XBVIO5js.DetailField,
|
|
4324
4346
|
{
|
|
4325
4347
|
label: t("billing.admin.prices.fields.features"),
|
|
4326
4348
|
className: "md:col-span-2",
|
|
@@ -4328,11 +4350,11 @@ function PriceDetails() {
|
|
|
4328
4350
|
}
|
|
4329
4351
|
),
|
|
4330
4352
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4331
|
-
|
|
4353
|
+
_chunkR2XBVIO5js.DetailField,
|
|
4332
4354
|
{
|
|
4333
4355
|
label: t("billing.admin.prices.fields.platformFeatures"),
|
|
4334
4356
|
className: "md:col-span-2",
|
|
4335
|
-
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,
|
|
4357
|
+
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, _chunkR2XBVIO5js.Badge, { variant: "softGray", children: feature.name }, feature.id)) }) : "\u2014"
|
|
4336
4358
|
}
|
|
4337
4359
|
)
|
|
4338
4360
|
] })
|
|
@@ -4346,7 +4368,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, PriceDetails, "PriceDetails");
|
|
|
4346
4368
|
function PriceContainer() {
|
|
4347
4369
|
const { price } = usePriceContext();
|
|
4348
4370
|
if (!price) return null;
|
|
4349
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4371
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.RoundPageContainer, { module: _chunkOJAIKQR2js.Modules.StripePrice, id: price.id, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceDetails, {}) });
|
|
4350
4372
|
}
|
|
4351
4373
|
_chunk7QVYU63Ejs.__name.call(void 0, PriceContainer, "PriceContainer");
|
|
4352
4374
|
|
|
@@ -4471,10 +4493,10 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4471
4493
|
const importInputRef = _react.useRef.call(void 0, null);
|
|
4472
4494
|
const [seed, setSeed] = _react.useState.call(void 0, void 0);
|
|
4473
4495
|
const [seedNonce, setSeedNonce] = _react.useState.call(void 0, 0);
|
|
4474
|
-
const data =
|
|
4475
|
-
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) =>
|
|
4496
|
+
const data = _chunkR2XBVIO5js.useDataListRetriever.call(void 0, {
|
|
4497
|
+
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunkOJAIKQR2js.StripePriceService.listPrices({ ...params, productId }), "retriever"),
|
|
4476
4498
|
retrieverParams: {},
|
|
4477
|
-
module:
|
|
4499
|
+
module: _chunkOJAIKQR2js.Modules.StripePrice
|
|
4478
4500
|
});
|
|
4479
4501
|
_react.useEffect.call(void 0, () => {
|
|
4480
4502
|
if (priceVersion > 0) void data.refresh();
|
|
@@ -4509,7 +4531,7 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4509
4531
|
openSeededEditor(transfer.price);
|
|
4510
4532
|
} catch (error) {
|
|
4511
4533
|
console.error("[PricesList] price import failed", error);
|
|
4512
|
-
|
|
4534
|
+
_chunkR2XBVIO5js.errorToast.call(void 0, {
|
|
4513
4535
|
title: t("billing.admin.prices.import.errors.title"),
|
|
4514
4536
|
error: t("billing.admin.prices.import.errors.invalid")
|
|
4515
4537
|
});
|
|
@@ -4528,7 +4550,7 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4528
4550
|
"create-price"
|
|
4529
4551
|
),
|
|
4530
4552
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _react.Fragment, { children: [
|
|
4531
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
4553
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR2XBVIO5js.Button, { variant: "outline", size: "sm", type: "button", onClick: () => _optionalChain([importInputRef, 'access', _180 => _180.current, 'optionalAccess', _181 => _181.click, 'call', _182 => _182()]), children: [
|
|
4532
4554
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.UploadIcon, {}),
|
|
4533
4555
|
t("billing.admin.prices.actions.import")
|
|
4534
4556
|
] }),
|
|
@@ -4546,7 +4568,7 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4546
4568
|
];
|
|
4547
4569
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
4548
4570
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4549
|
-
|
|
4571
|
+
_chunkR2XBVIO5js.ContentListTable,
|
|
4550
4572
|
{
|
|
4551
4573
|
data,
|
|
4552
4574
|
fields: [
|
|
@@ -4557,13 +4579,13 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4557
4579
|
"status" /* status */,
|
|
4558
4580
|
"actions" /* actions */
|
|
4559
4581
|
],
|
|
4560
|
-
tableGeneratorType:
|
|
4582
|
+
tableGeneratorType: _chunkOJAIKQR2js.Modules.StripePrice,
|
|
4561
4583
|
functions,
|
|
4562
4584
|
context: tableContext,
|
|
4563
4585
|
fullWidth,
|
|
4564
4586
|
title: t("billing.admin.prices.title"),
|
|
4565
4587
|
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4566
|
-
|
|
4588
|
+
_chunkR2XBVIO5js.EmptyState,
|
|
4567
4589
|
{
|
|
4568
4590
|
icon: _lucidereact.DollarSignIcon,
|
|
4569
4591
|
title: t("billing.admin.prices.empty.title"),
|
|
@@ -4603,18 +4625,18 @@ function ProductDetails() {
|
|
|
4603
4625
|
const { product } = useProductContext();
|
|
4604
4626
|
if (!product) return null;
|
|
4605
4627
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4606
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4628
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.SectionHeader, { children: t("billing.admin.products.tabs.details") }),
|
|
4607
4629
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
4608
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4630
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.DetailField, { label: t("billing.admin.products.fields.name"), value: product.name }),
|
|
4609
4631
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4610
|
-
|
|
4632
|
+
_chunkR2XBVIO5js.DetailField,
|
|
4611
4633
|
{
|
|
4612
4634
|
label: t("billing.admin.products.fields.status"),
|
|
4613
|
-
value: product.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4635
|
+
value: product.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Badge, { variant: "softGreen", children: t("billing.admin.products.status.active") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Badge, { variant: "softGray", children: t("billing.admin.products.status.archived") })
|
|
4614
4636
|
}
|
|
4615
4637
|
),
|
|
4616
4638
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4617
|
-
|
|
4639
|
+
_chunkR2XBVIO5js.DetailField,
|
|
4618
4640
|
{
|
|
4619
4641
|
label: t("billing.admin.products.fields.description"),
|
|
4620
4642
|
value: _nullishCoalesce(product.description, () => ( "\u2014")),
|
|
@@ -4622,14 +4644,14 @@ function ProductDetails() {
|
|
|
4622
4644
|
}
|
|
4623
4645
|
),
|
|
4624
4646
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4625
|
-
|
|
4647
|
+
_chunkR2XBVIO5js.DetailField,
|
|
4626
4648
|
{
|
|
4627
4649
|
label: t("billing.admin.products.fields.prices"),
|
|
4628
4650
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: product.stripePrices.length })
|
|
4629
4651
|
}
|
|
4630
4652
|
),
|
|
4631
4653
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4632
|
-
|
|
4654
|
+
_chunkR2XBVIO5js.DetailField,
|
|
4633
4655
|
{
|
|
4634
4656
|
label: t("billing.admin.products.fields.stripeId"),
|
|
4635
4657
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: product.stripeProductId })
|
|
@@ -4647,9 +4669,9 @@ function ProductContainer() {
|
|
|
4647
4669
|
const { product } = useProductContext();
|
|
4648
4670
|
if (!product) return null;
|
|
4649
4671
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4650
|
-
|
|
4672
|
+
_chunkR2XBVIO5js.RoundPageContainer,
|
|
4651
4673
|
{
|
|
4652
|
-
module:
|
|
4674
|
+
module: _chunkOJAIKQR2js.Modules.StripeProduct,
|
|
4653
4675
|
id: product.id,
|
|
4654
4676
|
tabs: [
|
|
4655
4677
|
{
|
|
@@ -4658,7 +4680,7 @@ function ProductContainer() {
|
|
|
4658
4680
|
content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductDetails, {})
|
|
4659
4681
|
},
|
|
4660
4682
|
{
|
|
4661
|
-
key:
|
|
4683
|
+
key: _chunkOJAIKQR2js.Modules.StripePrice,
|
|
4662
4684
|
label: t("billing.admin.prices.title"),
|
|
4663
4685
|
// publishChrome={false}: SharedProvider REPLACES its value for the
|
|
4664
4686
|
// subtree (SharedContext.tsx:35-37), so a nested provider publishing
|
|
@@ -4684,18 +4706,18 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductContainer, "ProductContainer");
|
|
|
4684
4706
|
|
|
4685
4707
|
function CouponsList({ fullWidth } = {}) {
|
|
4686
4708
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4687
|
-
const { catalogueVersion } =
|
|
4688
|
-
const data =
|
|
4689
|
-
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) =>
|
|
4709
|
+
const { catalogueVersion } = _chunkR2XBVIO5js.useCouponContext.call(void 0, );
|
|
4710
|
+
const data = _chunkR2XBVIO5js.useDataListRetriever.call(void 0, {
|
|
4711
|
+
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunkOJAIKQR2js.StripeCouponService.listCoupons(params), "retriever"),
|
|
4690
4712
|
retrieverParams: {},
|
|
4691
|
-
module:
|
|
4713
|
+
module: _chunkOJAIKQR2js.Modules.StripeCoupon
|
|
4692
4714
|
});
|
|
4693
4715
|
_react.useEffect.call(void 0, () => {
|
|
4694
4716
|
if (catalogueVersion > 0) void data.refresh();
|
|
4695
4717
|
}, [catalogueVersion]);
|
|
4696
|
-
const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4718
|
+
const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.CouponEditor, {}, "create-coupon")];
|
|
4697
4719
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4698
|
-
|
|
4720
|
+
_chunkR2XBVIO5js.ContentListTable,
|
|
4699
4721
|
{
|
|
4700
4722
|
data,
|
|
4701
4723
|
fields: [
|
|
@@ -4705,12 +4727,12 @@ function CouponsList({ fullWidth } = {}) {
|
|
|
4705
4727
|
"codes" /* codes */,
|
|
4706
4728
|
"status" /* status */
|
|
4707
4729
|
],
|
|
4708
|
-
tableGeneratorType:
|
|
4730
|
+
tableGeneratorType: _chunkOJAIKQR2js.Modules.StripeCoupon,
|
|
4709
4731
|
functions,
|
|
4710
4732
|
fullWidth,
|
|
4711
4733
|
title: t("billing.admin.coupons.title"),
|
|
4712
4734
|
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4713
|
-
|
|
4735
|
+
_chunkR2XBVIO5js.EmptyState,
|
|
4714
4736
|
{
|
|
4715
4737
|
icon: _lucidereact.TicketPercentIcon,
|
|
4716
4738
|
title: t("billing.admin.coupons.empty.title"),
|
|
@@ -4730,26 +4752,26 @@ _chunk7QVYU63Ejs.__name.call(void 0, CouponsList, "CouponsList");
|
|
|
4730
4752
|
function ProductsList({ fullWidth } = {}) {
|
|
4731
4753
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4732
4754
|
const { catalogueVersion } = useProductContext();
|
|
4733
|
-
const data =
|
|
4734
|
-
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) =>
|
|
4755
|
+
const data = _chunkR2XBVIO5js.useDataListRetriever.call(void 0, {
|
|
4756
|
+
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunkOJAIKQR2js.StripeProductService.listProducts(params), "retriever"),
|
|
4735
4757
|
retrieverParams: {},
|
|
4736
|
-
module:
|
|
4758
|
+
module: _chunkOJAIKQR2js.Modules.StripeProduct
|
|
4737
4759
|
});
|
|
4738
4760
|
_react.useEffect.call(void 0, () => {
|
|
4739
4761
|
if (catalogueVersion > 0) void data.refresh();
|
|
4740
4762
|
}, [catalogueVersion]);
|
|
4741
4763
|
const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductEditor, {}, "create-product")];
|
|
4742
4764
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4743
|
-
|
|
4765
|
+
_chunkR2XBVIO5js.ContentListTable,
|
|
4744
4766
|
{
|
|
4745
4767
|
data,
|
|
4746
4768
|
fields: ["name" /* name */, "status" /* status */, "prices" /* prices */],
|
|
4747
|
-
tableGeneratorType:
|
|
4769
|
+
tableGeneratorType: _chunkOJAIKQR2js.Modules.StripeProduct,
|
|
4748
4770
|
functions,
|
|
4749
4771
|
fullWidth,
|
|
4750
4772
|
title: t("billing.admin.products.title"),
|
|
4751
4773
|
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4752
|
-
|
|
4774
|
+
_chunkR2XBVIO5js.EmptyState,
|
|
4753
4775
|
{
|
|
4754
4776
|
icon: _lucidereact.PackageIcon,
|
|
4755
4777
|
title: t("billing.admin.products.empty.title"),
|
|
@@ -4765,10 +4787,10 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductsList, "ProductsList");
|
|
|
4765
4787
|
|
|
4766
4788
|
function ProductsListContainer() {
|
|
4767
4789
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4768
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductProvider, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4769
|
-
|
|
4790
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductProvider, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.CouponProvider, { publishChrome: false, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4791
|
+
_chunkR2XBVIO5js.RoundPageContainer,
|
|
4770
4792
|
{
|
|
4771
|
-
module:
|
|
4793
|
+
module: _chunkOJAIKQR2js.Modules.StripeProduct,
|
|
4772
4794
|
tabs: [
|
|
4773
4795
|
{ sectionKey: "products", label: t("billing.admin.products.tabs.products"), content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductsList, {}) },
|
|
4774
4796
|
{ sectionKey: "codes", label: t("billing.admin.products.tabs.codes"), content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CouponsList, {}) }
|
|
@@ -4786,30 +4808,30 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductsListContainer, "ProductsListContain
|
|
|
4786
4808
|
|
|
4787
4809
|
function CouponDetails() {
|
|
4788
4810
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4789
|
-
const fmt =
|
|
4790
|
-
const { coupon } =
|
|
4811
|
+
const fmt = _chunkR2XBVIO5js.useBillingFormatOptions.call(void 0, );
|
|
4812
|
+
const { coupon } = _chunkR2XBVIO5js.useCouponContext.call(void 0, );
|
|
4791
4813
|
if (!coupon) return null;
|
|
4792
4814
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4793
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4815
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.SectionHeader, { children: t("billing.admin.products.tabs.details") }),
|
|
4794
4816
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-xs/relaxed", children: t("billing.admin.coupons.fixed_notice") }),
|
|
4795
4817
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
4796
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4818
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.DetailField, { label: t("billing.admin.coupons.fields.name"), value: coupon.name }),
|
|
4797
4819
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4798
|
-
|
|
4820
|
+
_chunkR2XBVIO5js.DetailField,
|
|
4799
4821
|
{
|
|
4800
4822
|
label: t("billing.admin.coupons.fields.status"),
|
|
4801
|
-
value: coupon.valid ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4823
|
+
value: coupon.valid ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Badge, { variant: "softGreen", children: t("billing.admin.coupons.status.active") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.Badge, { variant: "softGray", children: t("billing.admin.coupons.status.ended") })
|
|
4802
4824
|
}
|
|
4803
4825
|
),
|
|
4804
4826
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4805
|
-
|
|
4827
|
+
_chunkR2XBVIO5js.DetailField,
|
|
4806
4828
|
{
|
|
4807
4829
|
label: t("billing.admin.coupons.fields.discount"),
|
|
4808
|
-
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children:
|
|
4830
|
+
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _chunkOJAIKQR2js.formatCouponDiscount.call(void 0, coupon, t, fmt) })
|
|
4809
4831
|
}
|
|
4810
4832
|
),
|
|
4811
4833
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4812
|
-
|
|
4834
|
+
_chunkR2XBVIO5js.DetailField,
|
|
4813
4835
|
{
|
|
4814
4836
|
label: t("billing.admin.coupons.fields.places"),
|
|
4815
4837
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: coupon.maxRedemptions !== void 0 ? t("billing.admin.coupons.places.limited", {
|
|
@@ -4819,21 +4841,21 @@ function CouponDetails() {
|
|
|
4819
4841
|
}
|
|
4820
4842
|
),
|
|
4821
4843
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4822
|
-
|
|
4844
|
+
_chunkR2XBVIO5js.DetailField,
|
|
4823
4845
|
{
|
|
4824
4846
|
label: t("billing.admin.coupons.fields.products"),
|
|
4825
4847
|
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")
|
|
4826
4848
|
}
|
|
4827
4849
|
),
|
|
4828
4850
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4829
|
-
|
|
4851
|
+
_chunkR2XBVIO5js.DetailField,
|
|
4830
4852
|
{
|
|
4831
4853
|
label: t("billing.admin.coupons.fields.redeemBy"),
|
|
4832
|
-
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: coupon.redeemBy ?
|
|
4854
|
+
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: coupon.redeemBy ? _chunkR2XBVIO5js.formatDate.call(void 0, coupon.redeemBy, fmt) : "\u2014" })
|
|
4833
4855
|
}
|
|
4834
4856
|
),
|
|
4835
4857
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4836
|
-
|
|
4858
|
+
_chunkR2XBVIO5js.DetailField,
|
|
4837
4859
|
{
|
|
4838
4860
|
label: t("billing.admin.coupons.fields.stripeId"),
|
|
4839
4861
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: coupon.stripeCouponId })
|
|
@@ -4867,33 +4889,33 @@ function CouponCodeEditorInternal({
|
|
|
4867
4889
|
onDialogOpenChange
|
|
4868
4890
|
}) {
|
|
4869
4891
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4870
|
-
const router =
|
|
4871
|
-
const { createCode } =
|
|
4872
|
-
const formSchema2 = _react.useMemo.call(void 0, () => _zod3.z.object({ id: _zod3.z.uuidv4() }).and(
|
|
4873
|
-
const getDefaultValues = _react.useCallback.call(void 0, () => ({ id: _uuid.v4.call(void 0, ), ...
|
|
4892
|
+
const router = _chunkOJAIKQR2js.useI18nRouter.call(void 0, );
|
|
4893
|
+
const { createCode } = _chunkR2XBVIO5js.useCouponContext.call(void 0, );
|
|
4894
|
+
const formSchema2 = _react.useMemo.call(void 0, () => _zod3.z.object({ id: _zod3.z.uuidv4() }).and(_chunkR2XBVIO5js.couponCodeSchema.call(void 0, t)), [t]);
|
|
4895
|
+
const getDefaultValues = _react.useCallback.call(void 0, () => ({ id: _uuid.v4.call(void 0, ), ..._chunkR2XBVIO5js.couponCodeDefaults.call(void 0, ) }), []);
|
|
4874
4896
|
const form = _reacthookform.useForm.call(void 0, {
|
|
4875
4897
|
resolver: _zod.zodResolver.call(void 0, formSchema2),
|
|
4876
4898
|
defaultValues: getDefaultValues()
|
|
4877
4899
|
});
|
|
4878
4900
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4879
|
-
|
|
4901
|
+
_chunkR2XBVIO5js.EditorSheet,
|
|
4880
4902
|
{
|
|
4881
4903
|
form,
|
|
4882
4904
|
entityType: t("billing.admin.coupons.codes.entity"),
|
|
4883
4905
|
isEdit: false,
|
|
4884
|
-
module:
|
|
4906
|
+
module: _chunkOJAIKQR2js.Modules.StripeCouponCode,
|
|
4885
4907
|
size: "md",
|
|
4886
4908
|
onSuccess: _nullishCoalesce(onSuccess, () => ( (() => {
|
|
4887
4909
|
}))),
|
|
4888
4910
|
onNavigate: (url) => router.push(url),
|
|
4889
|
-
onSubmit: async (values) => await createCode({ id: values.id, couponId, ...
|
|
4911
|
+
onSubmit: async (values) => await createCode({ id: values.id, couponId, ..._chunkR2XBVIO5js.toCouponCodeInput.call(void 0, values) }),
|
|
4890
4912
|
onReset: getDefaultValues,
|
|
4891
4913
|
trigger,
|
|
4892
4914
|
forceShow,
|
|
4893
4915
|
onClose,
|
|
4894
4916
|
dialogOpen,
|
|
4895
4917
|
onDialogOpenChange,
|
|
4896
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4918
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkR2XBVIO5js.CouponCodeFields, { form })
|
|
4897
4919
|
}
|
|
4898
4920
|
);
|
|
4899
4921
|
}
|
|
@@ -4907,18 +4929,18 @@ _chunk7QVYU63Ejs.__name.call(void 0, CouponCodeEditor, "CouponCodeEditor");
|
|
|
4907
4929
|
|
|
4908
4930
|
function CouponCodesList({ couponId }) {
|
|
4909
4931
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4910
|
-
const { catalogueVersion } =
|
|
4911
|
-
const data =
|
|
4912
|
-
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) =>
|
|
4932
|
+
const { catalogueVersion } = _chunkR2XBVIO5js.useCouponContext.call(void 0, );
|
|
4933
|
+
const data = _chunkR2XBVIO5js.useDataListRetriever.call(void 0, {
|
|
4934
|
+
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunkOJAIKQR2js.StripeCouponCodeService.listByCoupon({ ...params, couponId }), "retriever"),
|
|
4913
4935
|
retrieverParams: {},
|
|
4914
|
-
module:
|
|
4936
|
+
module: _chunkOJAIKQR2js.Modules.StripeCouponCode
|
|
4915
4937
|
});
|
|
4916
4938
|
_react.useEffect.call(void 0, () => {
|
|
4917
4939
|
if (catalogueVersion > 0) void data.refresh();
|
|
4918
4940
|
}, [catalogueVersion]);
|
|
4919
4941
|
const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, CouponCodeEditor, { couponId }, "create-code")];
|
|
4920
4942
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4921
|
-
|
|
4943
|
+
_chunkR2XBVIO5js.ContentListTable,
|
|
4922
4944
|
{
|
|
4923
4945
|
data,
|
|
4924
4946
|
fields: [
|
|
@@ -4929,11 +4951,11 @@ function CouponCodesList({ couponId }) {
|
|
|
4929
4951
|
"status" /* status */,
|
|
4930
4952
|
"actions" /* actions */
|
|
4931
4953
|
],
|
|
4932
|
-
tableGeneratorType:
|
|
4954
|
+
tableGeneratorType: _chunkOJAIKQR2js.Modules.StripeCouponCode,
|
|
4933
4955
|
functions,
|
|
4934
4956
|
title: t("billing.admin.coupons.codes.title"),
|
|
4935
4957
|
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4936
|
-
|
|
4958
|
+
_chunkR2XBVIO5js.EmptyState,
|
|
4937
4959
|
{
|
|
4938
4960
|
icon: _lucidereact.TicketIcon,
|
|
4939
4961
|
title: t("billing.admin.coupons.codes.empty.title"),
|
|
@@ -4949,12 +4971,12 @@ _chunk7QVYU63Ejs.__name.call(void 0, CouponCodesList, "CouponCodesList");
|
|
|
4949
4971
|
|
|
4950
4972
|
function CouponContainer() {
|
|
4951
4973
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4952
|
-
const { coupon } =
|
|
4974
|
+
const { coupon } = _chunkR2XBVIO5js.useCouponContext.call(void 0, );
|
|
4953
4975
|
if (!coupon) return null;
|
|
4954
4976
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4955
|
-
|
|
4977
|
+
_chunkR2XBVIO5js.RoundPageContainer,
|
|
4956
4978
|
{
|
|
4957
|
-
module:
|
|
4979
|
+
module: _chunkR2XBVIO5js.couponPageModule.call(void 0, ),
|
|
4958
4980
|
id: coupon.id,
|
|
4959
4981
|
tabs: [
|
|
4960
4982
|
{
|
|
@@ -5061,5 +5083,5 @@ _chunk7QVYU63Ejs.__name.call(void 0, CouponContainer, "CouponContainer");
|
|
|
5061
5083
|
|
|
5062
5084
|
|
|
5063
5085
|
|
|
5064
|
-
exports.BillingAlertBanner = BillingAlertBanner; exports.BillingDashboardContainer = BillingDashboardContainer; exports.BillingDetailModal = BillingDetailModal; exports.BillingUsageSummaryCard = BillingUsageSummaryCard; exports.CancelSubscriptionDialog = CancelSubscriptionDialog; exports.CouponCodeActions =
|
|
5086
|
+
exports.BillingAlertBanner = BillingAlertBanner; exports.BillingDashboardContainer = BillingDashboardContainer; exports.BillingDetailModal = BillingDetailModal; exports.BillingUsageSummaryCard = BillingUsageSummaryCard; exports.CancelSubscriptionDialog = CancelSubscriptionDialog; exports.CouponCodeActions = _chunkR2XBVIO5js.CouponCodeActions; exports.CouponCodeEditor = CouponCodeEditor; exports.CouponCodeFields = _chunkR2XBVIO5js.CouponCodeFields; exports.CouponCodesList = CouponCodesList; exports.CouponContainer = CouponContainer; exports.CouponDetails = CouponDetails; exports.CouponEditor = _chunkR2XBVIO5js.CouponEditor; exports.CouponProvider = _chunkR2XBVIO5js.CouponProvider; exports.CouponRefresher = _chunkR2XBVIO5js.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 = _chunkR2XBVIO5js.applyDiscount; exports.couponCodeDefaults = _chunkR2XBVIO5js.couponCodeDefaults; exports.couponCodeSchema = _chunkR2XBVIO5js.couponCodeSchema; exports.couponCurrencyOptions = _chunkR2XBVIO5js.couponCurrencyOptions; exports.formatCurrency = _chunkOJAIKQR2js.formatCurrency; exports.formatDate = _chunkR2XBVIO5js.formatDate; exports.formatFixed = _chunkOJAIKQR2js.formatFixed; exports.formatInterval = _chunkOJAIKQR2js.formatInterval; exports.isStripeConfigured = isStripeConfigured; exports.optionalDate = _chunkR2XBVIO5js.optionalDate; exports.optionalDecimal = _chunkR2XBVIO5js.optionalDecimal; exports.optionalPositiveInt = _chunkR2XBVIO5js.optionalPositiveInt; exports.parseOptionalDecimal = _chunkR2XBVIO5js.parseOptionalDecimal; exports.parseOptionalPositiveInt = _chunkR2XBVIO5js.parseOptionalPositiveInt; exports.priceLabel = priceLabel; exports.promotionCodeDiscount = _chunkR2XBVIO5js.promotionCodeDiscount; exports.subscriptionDiscount = _chunkR2XBVIO5js.subscriptionDiscount; exports.toCouponCodeInput = _chunkR2XBVIO5js.toCouponCodeInput; exports.useBillingFormatOptions = _chunkR2XBVIO5js.useBillingFormatOptions; exports.useCouponContext = _chunkR2XBVIO5js.useCouponContext; exports.usePriceContext = usePriceContext; exports.useProductContext = useProductContext;
|
|
5065
5087
|
//# sourceMappingURL=index.js.map
|