@carlonicora/nextjs-jsonapi 6.2.0 → 6.3.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/{AssistantMessageInterface-S7oyERTT.d.mts → AssistantMessageInterface-0ZQ1EJKO.d.mts} +1 -1
- package/dist/{AssistantMessageInterface-DHJJO_Z_.d.ts → AssistantMessageInterface-CA-hZ5Wj.d.ts} +1 -1
- package/dist/{BlockNoteEditor-Q757ZLCO.js → BlockNoteEditor-CT4XUXPC.js} +19 -19
- package/dist/{BlockNoteEditor-Q757ZLCO.js.map → BlockNoteEditor-CT4XUXPC.js.map} +1 -1
- package/dist/{BlockNoteEditor-D6VMXRZH.mjs → BlockNoteEditor-M6UQRVRK.mjs} +4 -4
- package/dist/{BlockNoteViewer-KG4CIJC5.js → BlockNoteViewer-MFLWF3Y2.js} +3 -3
- package/dist/{BlockNoteViewer-KG4CIJC5.js.map → BlockNoteViewer-MFLWF3Y2.js.map} +1 -1
- package/dist/{BlockNoteViewer-GI5LVQHZ.mjs → BlockNoteViewer-XZJ5Y7WN.mjs} +2 -2
- package/dist/{BlogPostInterface-BB_4wcDR.d.mts → BlogPostInterface-BN2mXc46.d.mts} +1 -1
- package/dist/{BlogPostInterface-bWAT1rfR.d.ts → BlogPostInterface-CTGfsR1I.d.ts} +1 -1
- package/dist/{auth.interface-CSzJ1oP1.d.ts → auth.interface-D5606g19.d.ts} +1 -1
- package/dist/{auth.interface-DD4uQv2K.d.mts → auth.interface-tsOuc0Fi.d.mts} +1 -1
- package/dist/billing/index.d.mts +3 -3
- package/dist/billing/index.d.ts +3 -3
- package/dist/billing/index.js +501 -493
- package/dist/billing/index.js.map +1 -1
- package/dist/billing/index.mjs +13 -5
- package/dist/billing/index.mjs.map +1 -1
- package/dist/{chunk-QKDPCZ3G.mjs → chunk-3FD6Y734.mjs} +73 -15
- package/dist/chunk-3FD6Y734.mjs.map +1 -0
- package/dist/{chunk-3P3IYUWQ.js → chunk-DSGP6GC3.js} +8 -8
- package/dist/{chunk-3P3IYUWQ.js.map → chunk-DSGP6GC3.js.map} +1 -1
- package/dist/{chunk-HLW3SUMD.mjs → chunk-O2TEUH5S.mjs} +2 -2
- package/dist/{chunk-UEWDYVLW.js → chunk-QJIDORHM.js} +4 -4
- package/dist/{chunk-UEWDYVLW.js.map → chunk-QJIDORHM.js.map} +1 -1
- package/dist/{chunk-CUNSPLOD.mjs → chunk-RUJCWOJE.mjs} +2 -2
- package/dist/{chunk-6PW3562E.mjs → chunk-TIT4CJYQ.mjs} +1233 -1181
- package/dist/chunk-TIT4CJYQ.mjs.map +1 -0
- package/dist/{chunk-S332ZCIE.js → chunk-V4I3XKOM.js} +3 -3
- package/dist/{chunk-S332ZCIE.js.map → chunk-V4I3XKOM.js.map} +1 -1
- package/dist/{chunk-GSHMGL6N.js → chunk-XZCCIKX3.js} +151 -93
- package/dist/chunk-XZCCIKX3.js.map +1 -0
- package/dist/{chunk-XQEYBESH.js → chunk-Y7JIQNM6.js} +922 -870
- package/dist/chunk-Y7JIQNM6.js.map +1 -0
- package/dist/{chunk-MHBE4KQR.mjs → chunk-ZDUT5JPT.mjs} +2 -2
- package/dist/client/index.d.mts +4 -4
- package/dist/client/index.d.ts +4 -4
- package/dist/client/index.js +4 -4
- package/dist/client/index.mjs +3 -3
- package/dist/components/index.d.mts +22 -6
- package/dist/components/index.d.ts +22 -6
- package/dist/components/index.js +10 -4
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +10 -4
- package/dist/contexts/index.d.mts +5 -5
- package/dist/contexts/index.d.ts +5 -5
- package/dist/contexts/index.js +4 -4
- package/dist/contexts/index.mjs +3 -3
- package/dist/core/index.d.mts +23 -13
- package/dist/core/index.d.ts +23 -13
- package/dist/core/index.js +8 -2
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +7 -1
- package/dist/{currency-DrEVd_Xs.d.mts → currency-BhuEoBOn.d.mts} +2 -115
- package/dist/{currency-8ErEC39n.d.ts → currency-CBgZkS0u.d.ts} +2 -115
- package/dist/email-automations/index.js +92 -92
- package/dist/email-automations/index.mjs +3 -3
- package/dist/features/analytics/index.d.mts +2 -2
- package/dist/features/analytics/index.d.ts +2 -2
- 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.d.mts +4 -4
- package/dist/features/blog/index.d.ts +4 -4
- package/dist/features/blog/index.js +150 -150
- package/dist/features/blog/index.mjs +3 -3
- package/dist/features/blog/server.d.mts +4 -4
- package/dist/features/blog/server.d.ts +4 -4
- 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 +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.js +9 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -2
- package/dist/{notification.interface-BB6GPpZY.d.mts → notification.interface-CF5h90U2.d.mts} +1 -1
- package/dist/{notification.interface-CmAGrijJ.d.ts → notification.interface-DQReXAD7.d.ts} +1 -1
- package/dist/{s3.service-Bz_K-tjz.d.ts → s3.service-BTCpmp5g.d.ts} +11 -4
- package/dist/{s3.service-D5zNCEW3.d.mts → s3.service-CzFBDEuQ.d.mts} +11 -4
- package/dist/server/index.d.mts +5 -5
- package/dist/server/index.d.ts +5 -5
- package/dist/server/index.js +3 -3
- package/dist/server/index.mjs +2 -2
- package/dist/stripe-price.interface-D6mKjAdr.d.mts +132 -0
- package/dist/stripe-price.interface-DGqcklFJ.d.ts +132 -0
- package/dist/{useSocket-B0H9pmmH.d.ts → useSocket-BM3q9A0C.d.ts} +1 -1
- package/dist/{useSocket-B5RQb6v2.d.mts → useSocket-CwSoq6VS.d.mts} +1 -1
- package/dist/{user.interface-CIWGlbqM.d.mts → user.interface-BYnGJ7ss.d.mts} +37 -2
- package/dist/{user.interface-C0ZdsBZj.d.ts → user.interface-BqPjVyJI.d.ts} +37 -2
- package/messages/en.json +8 -0
- package/messages/it.json +8 -0
- package/package.json +1 -1
- package/src/components/containers/RoundPageContainer.tsx +7 -2
- package/src/components/index.ts +5 -0
- package/src/features/billing/components/containers/BillingDashboardContainer.tsx +20 -3
- package/src/features/billing/components/widgets/CreditWarningBanner.tsx +93 -0
- package/src/features/billing/data/credit-warning.spec.ts +96 -0
- package/src/features/billing/data/credit-warning.ts +57 -0
- package/src/features/billing/data/index.ts +3 -0
- package/src/features/billing/i18n-keys.ts +6 -0
- package/src/features/company/data/company.interface.ts +11 -0
- package/src/features/company/data/company.service.ts +17 -0
- package/src/features/company/data/company.spec.ts +29 -0
- package/src/features/company/data/company.ts +31 -0
- package/dist/chunk-6PW3562E.mjs.map +0 -1
- package/dist/chunk-GSHMGL6N.js.map +0 -1
- package/dist/chunk-QKDPCZ3G.mjs.map +0 -1
- package/dist/chunk-XQEYBESH.js.map +0 -1
- package/dist/feature.interface-BO25VLlx.d.ts +0 -19
- package/dist/feature.interface-CXb1-vNq.d.mts +0 -19
- /package/dist/{BlockNoteEditor-D6VMXRZH.mjs.map → BlockNoteEditor-M6UQRVRK.mjs.map} +0 -0
- /package/dist/{BlockNoteViewer-GI5LVQHZ.mjs.map → BlockNoteViewer-XZJ5Y7WN.mjs.map} +0 -0
- /package/dist/{chunk-HLW3SUMD.mjs.map → chunk-O2TEUH5S.mjs.map} +0 -0
- /package/dist/{chunk-CUNSPLOD.mjs.map → chunk-RUJCWOJE.mjs.map} +0 -0
- /package/dist/{chunk-MHBE4KQR.mjs.map → chunk-ZDUT5JPT.mjs.map} +0 -0
package/dist/billing/index.js
CHANGED
|
@@ -81,10 +81,10 @@
|
|
|
81
81
|
|
|
82
82
|
|
|
83
83
|
|
|
84
|
-
var
|
|
84
|
+
var _chunkY7JIQNM6js = require('../chunk-Y7JIQNM6.js');
|
|
85
85
|
|
|
86
86
|
|
|
87
|
-
var
|
|
87
|
+
var _chunkDSGP6GC3js = require('../chunk-DSGP6GC3.js');
|
|
88
88
|
|
|
89
89
|
|
|
90
90
|
var _chunkG4JR3SFVjs = require('../chunk-G4JR3SFV.js');
|
|
@@ -113,7 +113,8 @@ var _chunkG4JR3SFVjs = require('../chunk-G4JR3SFV.js');
|
|
|
113
113
|
|
|
114
114
|
|
|
115
115
|
|
|
116
|
-
|
|
116
|
+
|
|
117
|
+
var _chunkXZCCIKX3js = require('../chunk-XZCCIKX3.js');
|
|
117
118
|
require('../chunk-GHE4VT2R.js');
|
|
118
119
|
require('../chunk-LXKSUWAV.js');
|
|
119
120
|
require('../chunk-JTPRJNT2.js');
|
|
@@ -126,7 +127,7 @@ var _chunk7QVYU63Ejs = require('../chunk-7QVYU63E.js');
|
|
|
126
127
|
var _nextintl = require('next-intl');
|
|
127
128
|
var _lucidereact = require('lucide-react');
|
|
128
129
|
var _jsxruntime = require('react/jsx-runtime');
|
|
129
|
-
var SUBSCRIPTION_STATUSES = Object.values(
|
|
130
|
+
var SUBSCRIPTION_STATUSES = Object.values(_chunkXZCCIKX3js.SubscriptionStatus);
|
|
130
131
|
function getStatusBadgeVariant(status) {
|
|
131
132
|
switch (status) {
|
|
132
133
|
case "active" /* ACTIVE */:
|
|
@@ -158,43 +159,43 @@ function SubscriptionSummaryCard({
|
|
|
158
159
|
onManageClick
|
|
159
160
|
}) {
|
|
160
161
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
161
|
-
const fmt =
|
|
162
|
+
const fmt = _chunkY7JIQNM6js.useBillingFormatOptions.call(void 0, );
|
|
162
163
|
if (loading) {
|
|
163
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
164
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
165
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
164
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.Card, { children: [
|
|
165
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
166
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardTitle, { children: t("billing.ui.subscriptions.title") }),
|
|
166
167
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
167
168
|
] }),
|
|
168
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
169
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
170
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
171
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
169
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.CardContent, { children: [
|
|
170
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
171
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Skeleton, { className: "h-4 w-24 mb-1" }),
|
|
172
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Skeleton, { className: "h-4 w-40" })
|
|
172
173
|
] })
|
|
173
174
|
] });
|
|
174
175
|
}
|
|
175
176
|
if (error) {
|
|
176
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
177
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
178
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
177
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.Card, { children: [
|
|
178
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
179
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardTitle, { children: t("billing.ui.subscriptions.title") }),
|
|
179
180
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
180
181
|
] }),
|
|
181
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
182
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
182
183
|
] });
|
|
183
184
|
}
|
|
184
185
|
const activeSubscriptions = subscriptions.filter(
|
|
185
186
|
(sub) => sub.status === "active" /* ACTIVE */ || sub.status === "trialing" /* TRIALING */ || sub.status === "past_due" /* PAST_DUE */
|
|
186
187
|
);
|
|
187
188
|
const primarySubscription = activeSubscriptions[0];
|
|
188
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
189
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
190
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
189
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
|
|
190
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
191
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardTitle, { children: t("billing.ui.subscriptions.title") }),
|
|
191
192
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
192
193
|
] }),
|
|
193
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
194
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardContent, { children: !primarySubscription ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
194
195
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: t("billing.ui.cards.subscriptions.empty_title") }),
|
|
195
196
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.subscriptions.empty_description") }),
|
|
196
197
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
197
|
-
|
|
198
|
+
_chunkY7JIQNM6js.Button,
|
|
198
199
|
{
|
|
199
200
|
variant: "outline",
|
|
200
201
|
size: "sm",
|
|
@@ -212,8 +213,8 @@ function SubscriptionSummaryCard({
|
|
|
212
213
|
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
213
214
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
214
215
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: formatPlanName(primarySubscription, t("billing.ui.cards.subscriptions.fallback_name")) }),
|
|
215
|
-
primarySubscription.status === "past_due" /* PAST_DUE */ ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
216
|
-
|
|
216
|
+
primarySubscription.status === "past_due" /* PAST_DUE */ ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Badge, { variant: "softRed", children: t("billing.ui.cards.subscriptions.payment_failing") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
217
|
+
_chunkY7JIQNM6js.Badge,
|
|
217
218
|
{
|
|
218
219
|
variant: primarySubscription.cancelAtPeriodEnd ? "secondary" : getStatusBadgeVariant(primarySubscription.status),
|
|
219
220
|
children: primarySubscription.cancelAtPeriodEnd ? t("billing.ui.cards.subscriptions.canceling") : SUBSCRIPTION_STATUSES.includes(primarySubscription.status) ? t(`billing.ui.subscription_status.${primarySubscription.status}`) : primarySubscription.status
|
|
@@ -221,11 +222,11 @@ function SubscriptionSummaryCard({
|
|
|
221
222
|
)
|
|
222
223
|
] }),
|
|
223
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", {
|
|
224
|
-
date:
|
|
225
|
+
date: _chunkY7JIQNM6js.formatDate.call(void 0, primarySubscription.currentPeriodEnd, fmt)
|
|
225
226
|
}) : primarySubscription.cancelAtPeriodEnd ? t("billing.ui.cards.subscriptions.cancels_on", {
|
|
226
|
-
date:
|
|
227
|
+
date: _chunkY7JIQNM6js.formatDate.call(void 0, primarySubscription.currentPeriodEnd, fmt)
|
|
227
228
|
}) : t("billing.ui.cards.subscriptions.renews_on", {
|
|
228
|
-
date:
|
|
229
|
+
date: _chunkY7JIQNM6js.formatDate.call(void 0, primarySubscription.currentPeriodEnd, fmt)
|
|
229
230
|
}) }),
|
|
230
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 }) })
|
|
231
232
|
] }) })
|
|
@@ -259,37 +260,37 @@ function PaymentMethodSummaryCard({
|
|
|
259
260
|
}) {
|
|
260
261
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
261
262
|
if (loading) {
|
|
262
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
263
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
264
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
263
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.Card, { children: [
|
|
264
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
265
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardTitle, { children: t("billing.ui.payment_method.title") }),
|
|
265
266
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
266
267
|
] }),
|
|
267
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
268
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
269
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
268
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.CardContent, { children: [
|
|
269
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
270
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Skeleton, { className: "h-4 w-24" })
|
|
270
271
|
] })
|
|
271
272
|
] });
|
|
272
273
|
}
|
|
273
274
|
if (error) {
|
|
274
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
275
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
276
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
275
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.Card, { children: [
|
|
276
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
277
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardTitle, { children: t("billing.ui.payment_method.title") }),
|
|
277
278
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
278
279
|
] }),
|
|
279
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
280
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
280
281
|
] });
|
|
281
282
|
}
|
|
282
283
|
const defaultMethod = paymentMethods.find((pm) => pm.id === defaultPaymentMethodId) || paymentMethods[0];
|
|
283
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
284
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
285
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
284
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
|
|
285
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
286
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardTitle, { children: t("billing.ui.payment_method.title") }),
|
|
286
287
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
287
288
|
] }),
|
|
288
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
289
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardContent, { children: paymentMethods.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
289
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") }),
|
|
290
291
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.payment_method.empty_description") }),
|
|
291
292
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
292
|
-
|
|
293
|
+
_chunkY7JIQNM6js.Button,
|
|
293
294
|
{
|
|
294
295
|
variant: "outline",
|
|
295
296
|
size: "sm",
|
|
@@ -338,13 +339,13 @@ function formatBalance(balance, currency, locale) {
|
|
|
338
339
|
_chunk7QVYU63Ejs.__name.call(void 0, formatBalance, "formatBalance");
|
|
339
340
|
function CustomerInfoCard({ customer, loading, error }) {
|
|
340
341
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
341
|
-
const locale =
|
|
342
|
+
const locale = _chunkXZCCIKX3js.useI18nLocale.call(void 0, );
|
|
342
343
|
const [portalLoading, setPortalLoading] = _react.useState.call(void 0, false);
|
|
343
344
|
const handlePortalClick = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async (e) => {
|
|
344
345
|
e.stopPropagation();
|
|
345
346
|
setPortalLoading(true);
|
|
346
347
|
try {
|
|
347
|
-
const { url } = await
|
|
348
|
+
const { url } = await _chunkXZCCIKX3js.StripeCustomerService.createPortalSession();
|
|
348
349
|
window.open(url, "_blank");
|
|
349
350
|
} catch (err) {
|
|
350
351
|
console.error("[CustomerInfoCard] Failed to create portal session:", err);
|
|
@@ -353,45 +354,45 @@ function CustomerInfoCard({ customer, loading, error }) {
|
|
|
353
354
|
}
|
|
354
355
|
}, "handlePortalClick");
|
|
355
356
|
if (loading) {
|
|
356
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
357
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
358
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
357
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.Card, { children: [
|
|
358
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
359
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardTitle, { children: t("billing.ui.cards.customer.title") }),
|
|
359
360
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
360
361
|
] }),
|
|
361
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
362
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
363
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
364
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
362
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.CardContent, { children: [
|
|
363
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
364
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Skeleton, { className: "h-4 w-48 mb-1" }),
|
|
365
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Skeleton, { className: "h-4 w-24" })
|
|
365
366
|
] })
|
|
366
367
|
] });
|
|
367
368
|
}
|
|
368
369
|
if (error) {
|
|
369
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
370
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
371
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
370
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.Card, { children: [
|
|
371
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
372
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardTitle, { children: t("billing.ui.cards.customer.title") }),
|
|
372
373
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
373
374
|
] }),
|
|
374
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
375
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
375
376
|
] });
|
|
376
377
|
}
|
|
377
378
|
if (!customer) {
|
|
378
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
379
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
380
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
379
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.Card, { children: [
|
|
380
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
381
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardTitle, { children: t("billing.ui.cards.customer.title") }),
|
|
381
382
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
382
383
|
] }),
|
|
383
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
384
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.CardContent, { children: [
|
|
384
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") }),
|
|
385
386
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.customer.not_set_up_description") })
|
|
386
387
|
] })
|
|
387
388
|
] });
|
|
388
389
|
}
|
|
389
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
390
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
391
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
390
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.Card, { children: [
|
|
391
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
392
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardTitle, { children: t("billing.ui.cards.customer.title") }),
|
|
392
393
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
393
394
|
] }),
|
|
394
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
395
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
395
396
|
customer.name && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: customer.name }),
|
|
396
397
|
customer.email && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: customer.email }),
|
|
397
398
|
customer.balance !== void 0 && customer.balance !== 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm", children: [
|
|
@@ -401,7 +402,7 @@ function CustomerInfoCard({ customer, loading, error }) {
|
|
|
401
402
|
] }),
|
|
402
403
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: customer.balance < 0 ? "text-success" : "text-destructive", children: formatBalance(customer.balance, customer.currency, locale) })
|
|
403
404
|
] }),
|
|
404
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
405
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.Button, { variant: "outline", size: "sm", className: "mt-2", onClick: handlePortalClick, disabled: portalLoading, children: [
|
|
405
406
|
portalLoading ? t("common.loading") : t("billing.ui.cards.customer.manage_portal"),
|
|
406
407
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ExternalLink, { className: "h-4 w-4 ms-1" })
|
|
407
408
|
] })
|
|
@@ -414,7 +415,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, CustomerInfoCard, "CustomerInfoCard");
|
|
|
414
415
|
|
|
415
416
|
|
|
416
417
|
|
|
417
|
-
var INVOICE_STATUSES = Object.values(
|
|
418
|
+
var INVOICE_STATUSES = Object.values(_chunkXZCCIKX3js.InvoiceStatus);
|
|
418
419
|
function getStatusBadgeVariant2(status) {
|
|
419
420
|
switch (status) {
|
|
420
421
|
case "paid" /* PAID */:
|
|
@@ -439,46 +440,46 @@ function formatAmount(amount, currency, locale) {
|
|
|
439
440
|
_chunk7QVYU63Ejs.__name.call(void 0, formatAmount, "formatAmount");
|
|
440
441
|
function InvoicesSummaryCard({ invoices, loading, error, onViewAllClick }) {
|
|
441
442
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
442
|
-
const fmt =
|
|
443
|
+
const fmt = _chunkY7JIQNM6js.useBillingFormatOptions.call(void 0, );
|
|
443
444
|
if (loading) {
|
|
444
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
445
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
446
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
445
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.Card, { children: [
|
|
446
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
447
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardTitle, { children: t("billing.ui.cards.invoices.title") }),
|
|
447
448
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
448
449
|
] }),
|
|
449
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
450
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
451
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
452
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
450
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.CardContent, { children: [
|
|
451
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Skeleton, { className: "h-6 w-24 mb-2" }),
|
|
452
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Skeleton, { className: "h-4 w-32 mb-1" }),
|
|
453
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Skeleton, { className: "h-4 w-20" })
|
|
453
454
|
] })
|
|
454
455
|
] });
|
|
455
456
|
}
|
|
456
457
|
if (error) {
|
|
457
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
458
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
459
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
458
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.Card, { children: [
|
|
459
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
460
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardTitle, { children: t("billing.ui.cards.invoices.title") }),
|
|
460
461
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
461
462
|
] }),
|
|
462
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
463
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
463
464
|
] });
|
|
464
465
|
}
|
|
465
466
|
const latestInvoice = _nullishCoalesce(invoices.find((inv) => inv.status !== "void" /* VOID */), () => ( invoices[0]));
|
|
466
467
|
const paidInvoices = invoices.filter((inv) => inv.status === "paid" /* PAID */);
|
|
467
468
|
const openInvoices = invoices.filter((inv) => inv.status === "open" /* OPEN */);
|
|
468
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
469
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
470
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
469
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewAllClick, children: [
|
|
470
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
471
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardTitle, { children: t("billing.ui.cards.invoices.title") }),
|
|
471
472
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
472
473
|
] }),
|
|
473
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
474
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardContent, { children: invoices.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
474
475
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: t("billing.ui.invoices.empty_title") }),
|
|
475
476
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.invoices.empty_description") })
|
|
476
477
|
] }) : latestInvoice ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
477
478
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
478
479
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: formatAmount(latestInvoice.total, latestInvoice.currency, fmt.locale) }),
|
|
479
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
480
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Badge, { variant: getStatusBadgeVariant2(latestInvoice.status), children: INVOICE_STATUSES.includes(latestInvoice.status) ? t(`billing.ui.invoice_status.${latestInvoice.status}`) : latestInvoice.status })
|
|
480
481
|
] }),
|
|
481
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: latestInvoice.stripeInvoiceNumber || t("billing.ui.cards.invoices.invoice_from", { date:
|
|
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: _chunkY7JIQNM6js.formatDate.call(void 0, latestInvoice.periodStart, fmt) }) }),
|
|
482
483
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-4 text-xs text-muted-foreground", children: [
|
|
483
484
|
paidInvoices.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: t("billing.ui.cards.invoices.paid_count", { count: paidInvoices.length }) }),
|
|
484
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 }) }),
|
|
@@ -511,26 +512,26 @@ function BillingUsageSummaryCard({
|
|
|
511
512
|
onViewDetailsClick
|
|
512
513
|
}) {
|
|
513
514
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
514
|
-
const locale =
|
|
515
|
+
const locale = _chunkXZCCIKX3js.useI18nLocale.call(void 0, );
|
|
515
516
|
if (loading) {
|
|
516
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
517
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
518
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
517
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.Card, { children: [
|
|
518
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
519
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardTitle, { children: t("billing.ui.cards.usage.title") }),
|
|
519
520
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
520
521
|
] }),
|
|
521
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
522
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
523
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
522
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.CardContent, { children: [
|
|
523
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Skeleton, { className: "h-6 w-24 mb-2" }),
|
|
524
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Skeleton, { className: "h-4 w-32" })
|
|
524
525
|
] })
|
|
525
526
|
] });
|
|
526
527
|
}
|
|
527
528
|
if (error) {
|
|
528
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
529
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
530
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
529
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.Card, { children: [
|
|
530
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
531
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardTitle, { children: t("billing.ui.cards.usage.title") }),
|
|
531
532
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
532
533
|
] }),
|
|
533
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
534
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
534
535
|
] });
|
|
535
536
|
}
|
|
536
537
|
const totalUsage = Object.values(summaries).reduce((acc, summary) => {
|
|
@@ -538,12 +539,12 @@ function BillingUsageSummaryCard({
|
|
|
538
539
|
}, 0);
|
|
539
540
|
const primaryMeter = meters.find((m) => _optionalChain([summaries, 'access', _17 => _17[m.id], 'optionalAccess', _18 => _18.aggregatedValue]));
|
|
540
541
|
const primarySummary = primaryMeter ? summaries[primaryMeter.id] : null;
|
|
541
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
542
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
543
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
542
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewDetailsClick, children: [
|
|
543
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
544
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardTitle, { children: t("billing.ui.cards.usage.title") }),
|
|
544
545
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
545
546
|
] }),
|
|
546
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
547
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardContent, { children: meters.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
547
548
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: t("billing.ui.cards.usage.no_meters") }),
|
|
548
549
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.usage.no_meters_description") })
|
|
549
550
|
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
@@ -600,7 +601,7 @@ function PaymentMethodForm({
|
|
|
600
601
|
const fetchSetupIntent = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
601
602
|
setLoading(true);
|
|
602
603
|
try {
|
|
603
|
-
const intent = await
|
|
604
|
+
const intent = await _chunkXZCCIKX3js.StripeCustomerService.createSetupIntent();
|
|
604
605
|
setSetupIntent(intent);
|
|
605
606
|
} catch (err) {
|
|
606
607
|
console.error("[PaymentMethodForm] Failed to create setup intent:", err);
|
|
@@ -638,7 +639,7 @@ function PaymentMethodForm({
|
|
|
638
639
|
return;
|
|
639
640
|
}
|
|
640
641
|
if ((alwaysSetDefault || setAsDefault) && _optionalChain([confirmedSetupIntent, 'optionalAccess', _19 => _19.payment_method])) {
|
|
641
|
-
await
|
|
642
|
+
await _chunkXZCCIKX3js.StripeCustomerService.setDefaultPaymentMethod({
|
|
642
643
|
paymentMethodId: typeof confirmedSetupIntent.payment_method === "string" ? confirmedSetupIntent.payment_method : confirmedSetupIntent.payment_method.id
|
|
643
644
|
});
|
|
644
645
|
}
|
|
@@ -654,7 +655,7 @@ function PaymentMethodForm({
|
|
|
654
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") }) });
|
|
655
656
|
}
|
|
656
657
|
if (!setupIntent && error) {
|
|
657
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
658
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.AlertDescription, { children: error }) });
|
|
658
659
|
}
|
|
659
660
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: handleSubmit, className: "flex flex-col gap-y-4", children: [
|
|
660
661
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rounded-md border border-gray-300 p-3", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -678,19 +679,19 @@ function PaymentMethodForm({
|
|
|
678
679
|
) }),
|
|
679
680
|
!alwaysSetDefault && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
680
681
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
681
|
-
|
|
682
|
+
_chunkY7JIQNM6js.Checkbox,
|
|
682
683
|
{
|
|
683
684
|
id: "setAsDefault",
|
|
684
685
|
checked: setAsDefault,
|
|
685
686
|
onCheckedChange: (checked) => setSetAsDefault(!!checked)
|
|
686
687
|
}
|
|
687
688
|
),
|
|
688
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
689
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Label, { htmlFor: "setAsDefault", className: "cursor-pointer font-normal", children: t("billing.ui.payment_form.set_default") })
|
|
689
690
|
] }),
|
|
690
|
-
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
691
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.AlertDescription, { children: error }) }),
|
|
691
692
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-x-2", children: [
|
|
692
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
693
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
693
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Button, { type: "button", variant: "outline", onClick: onCancel, disabled: isSubmitting || isLoading, children: t("ui.buttons.cancel") }),
|
|
694
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Button, { type: "submit", disabled: !stripe || isSubmitting || isLoading, children: isSubmitting ? t("billing.ui.wizard.review.processing") : t("billing.ui.cards.payment_method.add_card") })
|
|
694
695
|
] })
|
|
695
696
|
] });
|
|
696
697
|
}
|
|
@@ -707,10 +708,10 @@ function PaymentMethodEditor({ open, onOpenChange, onSuccess }) {
|
|
|
707
708
|
const handleCancel = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
708
709
|
onOpenChange(false);
|
|
709
710
|
}, "handleCancel");
|
|
710
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
711
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
712
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
713
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
711
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.DialogContent, { className: "max-w-md", children: [
|
|
712
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.DialogHeader, { children: [
|
|
713
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.DialogTitle, { children: t("billing.ui.payment_methods.add") }),
|
|
714
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.DialogDescription, { children: t("billing.ui.payment_methods.add_description") })
|
|
714
715
|
] }),
|
|
715
716
|
open && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodForm, { onSuccess: handleSuccess, onCancel: handleCancel })
|
|
716
717
|
] }) });
|
|
@@ -736,7 +737,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
736
737
|
_react.useEffect.call(void 0, () => {
|
|
737
738
|
const loadCustomer = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
738
739
|
try {
|
|
739
|
-
const fetchedCustomer = await
|
|
740
|
+
const fetchedCustomer = await _chunkXZCCIKX3js.StripeCustomerService.getCustomer();
|
|
740
741
|
setCustomer(fetchedCustomer);
|
|
741
742
|
} catch (error) {
|
|
742
743
|
console.error("[PaymentMethodCard] Failed to load customer:", error);
|
|
@@ -753,7 +754,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
753
754
|
const handleSetDefault = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
754
755
|
setLoading(true);
|
|
755
756
|
try {
|
|
756
|
-
await
|
|
757
|
+
await _chunkXZCCIKX3js.StripeCustomerService.setDefaultPaymentMethod({ paymentMethodId: paymentMethod.id });
|
|
757
758
|
onUpdate();
|
|
758
759
|
} catch (error) {
|
|
759
760
|
console.error("[PaymentMethodCard] Failed to set as default:", error);
|
|
@@ -764,7 +765,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
764
765
|
const handleRemove = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
765
766
|
setLoading(true);
|
|
766
767
|
try {
|
|
767
|
-
await
|
|
768
|
+
await _chunkXZCCIKX3js.StripeCustomerService.removePaymentMethod({ paymentMethodId: paymentMethod.id });
|
|
768
769
|
setShowRemoveDialog(false);
|
|
769
770
|
onUpdate();
|
|
770
771
|
} catch (error) {
|
|
@@ -773,16 +774,16 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
773
774
|
}
|
|
774
775
|
}, "handleRemove");
|
|
775
776
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
776
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
777
|
-
isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
778
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
777
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.Card, { className: "relative", children: [
|
|
778
|
+
isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Badge, { variant: "softGreen", className: "absolute end-2 top-2", children: t("billing.ui.payment_methods.default") }),
|
|
779
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.CardHeader, { className: "flex flex-row items-center justify-between pb-2", children: [
|
|
779
780
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
780
781
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-2xl", children: brandIcon }),
|
|
781
782
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium capitalize", children: brand })
|
|
782
783
|
] }),
|
|
783
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
784
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
785
|
-
|
|
784
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.DropdownMenu, { children: [
|
|
785
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.DropdownMenuTrigger, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
786
|
+
_chunkY7JIQNM6js.Button,
|
|
786
787
|
{
|
|
787
788
|
render: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {}),
|
|
788
789
|
nativeButton: false,
|
|
@@ -793,10 +794,10 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
793
794
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.MoreVertical, { className: "h-4 w-4" })
|
|
794
795
|
}
|
|
795
796
|
) }),
|
|
796
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
797
|
-
!isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
797
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.DropdownMenuContent, { align: "end", children: [
|
|
798
|
+
!isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.DropdownMenuItem, { onClick: handleSetDefault, disabled: loading, children: t("billing.ui.payment_methods.set_default") }),
|
|
798
799
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
799
|
-
|
|
800
|
+
_chunkY7JIQNM6js.DropdownMenuItem,
|
|
800
801
|
{
|
|
801
802
|
onClick: () => setShowRemoveDialog(true),
|
|
802
803
|
disabled: loading,
|
|
@@ -807,7 +808,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
807
808
|
] })
|
|
808
809
|
] })
|
|
809
810
|
] }),
|
|
810
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
811
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-1", children: [
|
|
811
812
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-lg font-semibold", children: [
|
|
812
813
|
"\u2022\u2022\u2022\u2022 ",
|
|
813
814
|
last4
|
|
@@ -815,17 +816,17 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
815
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}` }) })
|
|
816
817
|
] }) })
|
|
817
818
|
] }),
|
|
818
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
819
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
820
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
821
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
819
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.AlertDialog, { open: showRemoveDialog, onOpenChange: setShowRemoveDialog, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.AlertDialogContent, { children: [
|
|
820
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.AlertDialogHeader, { children: [
|
|
821
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.AlertDialogTitle, { children: t("billing.ui.payment_methods.remove_title") }),
|
|
822
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.AlertDialogDescription, { children: [
|
|
822
823
|
t("billing.ui.payment_methods.remove_description"),
|
|
823
824
|
isDefault && ` ${t("billing.ui.payment_methods.remove_default_warning")}`
|
|
824
825
|
] })
|
|
825
826
|
] }),
|
|
826
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
827
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
828
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
827
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.AlertDialogFooter, { children: [
|
|
828
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.AlertDialogCancel, { disabled: loading, children: t("ui.buttons.cancel") }),
|
|
829
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.AlertDialogAction, { onClick: handleRemove, disabled: loading, className: "bg-red-600 hover:bg-red-700", children: loading ? t("billing.ui.payment_methods.removing") : t("ui.buttons.remove") })
|
|
829
830
|
] })
|
|
830
831
|
] }) })
|
|
831
832
|
] });
|
|
@@ -849,7 +850,7 @@ function PaymentMethodsContainer() {
|
|
|
849
850
|
const loadPaymentMethods = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
850
851
|
setLoading(true);
|
|
851
852
|
try {
|
|
852
|
-
const fetchedPaymentMethods = await
|
|
853
|
+
const fetchedPaymentMethods = await _chunkXZCCIKX3js.StripeCustomerService.listPaymentMethods();
|
|
853
854
|
setPaymentMethods(fetchedPaymentMethods);
|
|
854
855
|
} catch (error) {
|
|
855
856
|
console.error("[PaymentMethodsContainer] Failed to load payment methods:", error);
|
|
@@ -869,14 +870,14 @@ function PaymentMethodsContainer() {
|
|
|
869
870
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8" }),
|
|
870
871
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: t("billing.ui.payment_methods.title") })
|
|
871
872
|
] }),
|
|
872
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
873
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Button, { onClick: () => setShowAddPaymentMethod(true), children: t("billing.ui.payment_methods.add") })
|
|
873
874
|
] }),
|
|
874
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: [
|
|
875
876
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-16 w-16 text-muted-foreground" }),
|
|
876
877
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
877
878
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "mb-2 text-sm font-medium", children: t("billing.ui.payment_methods.empty_title") }),
|
|
878
879
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mb-4 text-muted-foreground", children: t("billing.ui.payment_methods.empty_description") }),
|
|
879
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
880
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Button, { onClick: () => setShowAddPaymentMethod(true), children: t("billing.ui.payment_methods.add_first") })
|
|
880
881
|
] })
|
|
881
882
|
] }),
|
|
882
883
|
paymentMethods.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodsList, { paymentMethods, onUpdate: loadPaymentMethods }),
|
|
@@ -932,7 +933,7 @@ var statusConfig = {
|
|
|
932
933
|
function InvoiceStatusBadge({ status }) {
|
|
933
934
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
934
935
|
const config = statusConfig[status] || statusConfig["draft" /* DRAFT */];
|
|
935
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
936
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Badge, { variant: config.variant, children: t(config.label) });
|
|
936
937
|
}
|
|
937
938
|
_chunk7QVYU63Ejs.__name.call(void 0, InvoiceStatusBadge, "InvoiceStatusBadge");
|
|
938
939
|
|
|
@@ -945,7 +946,7 @@ function InvoiceDetails({
|
|
|
945
946
|
onInvoiceChange: _onInvoiceChange
|
|
946
947
|
}) {
|
|
947
948
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
948
|
-
const fmt =
|
|
949
|
+
const fmt = _chunkY7JIQNM6js.useBillingFormatOptions.call(void 0, );
|
|
949
950
|
const handleDownloadPDF = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
950
951
|
if (invoice.stripePdfUrl) {
|
|
951
952
|
window.open(invoice.stripePdfUrl, "_blank");
|
|
@@ -965,10 +966,10 @@ function InvoiceDetails({
|
|
|
965
966
|
return invoice.stripeInvoiceId.slice(-8);
|
|
966
967
|
}, "getInvoiceNumber");
|
|
967
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");
|
|
968
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
969
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
970
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
971
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
969
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.DialogContent, { className: "max-w-2xl", children: [
|
|
970
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.DialogHeader, { children: [
|
|
971
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.DialogTitle, { children: t("billing.ui.invoice.title", { number: getInvoiceNumber() }) }),
|
|
972
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.DialogDescription, { children: _chunkY7JIQNM6js.formatDate.call(void 0, invoice.periodStart, fmt) })
|
|
972
973
|
] }),
|
|
973
974
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
974
975
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
@@ -979,18 +980,18 @@ function InvoiceDetails({
|
|
|
979
980
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
980
981
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.billing_period") }),
|
|
981
982
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm", children: [
|
|
982
|
-
|
|
983
|
+
_chunkY7JIQNM6js.formatDate.call(void 0, invoice.periodStart, fmt),
|
|
983
984
|
" - ",
|
|
984
|
-
|
|
985
|
+
_chunkY7JIQNM6js.formatDate.call(void 0, invoice.periodEnd, fmt)
|
|
985
986
|
] })
|
|
986
987
|
] }),
|
|
987
988
|
invoice.dueDate && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
988
989
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.due_date") }),
|
|
989
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm", children:
|
|
990
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm", children: _chunkY7JIQNM6js.formatDate.call(void 0, invoice.dueDate, fmt) })
|
|
990
991
|
] }),
|
|
991
992
|
invoice.paidAt && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
992
993
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.paid_date") }),
|
|
993
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm", children:
|
|
994
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm", children: _chunkY7JIQNM6js.formatDate.call(void 0, invoice.paidAt, fmt) })
|
|
994
995
|
] }),
|
|
995
996
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
996
997
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.attempt_count") }),
|
|
@@ -1006,42 +1007,42 @@ function InvoiceDetails({
|
|
|
1006
1007
|
] }) }),
|
|
1007
1008
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "tbody", { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "tr", { className: "border-t", children: [
|
|
1008
1009
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "td", { className: "p-3", children: productName }),
|
|
1009
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "td", { className: "p-3 text-end", children:
|
|
1010
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "td", { className: "p-3 text-end", children: _chunkXZCCIKX3js.formatCurrency.call(void 0, invoice.subtotal, invoice.currency, fmt) })
|
|
1010
1011
|
] }) })
|
|
1011
1012
|
] }) })
|
|
1012
1013
|
] }),
|
|
1013
1014
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2 border-t pt-4", children: [
|
|
1014
1015
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1015
1016
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.subtotal") }),
|
|
1016
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children:
|
|
1017
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children: _chunkXZCCIKX3js.formatCurrency.call(void 0, invoice.subtotal, invoice.currency, fmt) })
|
|
1017
1018
|
] }),
|
|
1018
1019
|
invoice.tax !== void 0 && invoice.tax > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1019
1020
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.tax") }),
|
|
1020
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children:
|
|
1021
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children: _chunkXZCCIKX3js.formatCurrency.call(void 0, invoice.tax, invoice.currency, fmt) })
|
|
1021
1022
|
] }),
|
|
1022
1023
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between text-lg font-semibold border-t pt-2", children: [
|
|
1023
1024
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: t("billing.ui.invoice.total") }),
|
|
1024
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children:
|
|
1025
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _chunkXZCCIKX3js.formatCurrency.call(void 0, invoice.total, invoice.currency, fmt) })
|
|
1025
1026
|
] }),
|
|
1026
1027
|
invoice.amountPaid > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1027
1028
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.amount_paid") }),
|
|
1028
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-success", children:
|
|
1029
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-success", children: _chunkXZCCIKX3js.formatCurrency.call(void 0, invoice.amountPaid, invoice.currency, fmt) })
|
|
1029
1030
|
] }),
|
|
1030
1031
|
invoice.amountRemaining > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1031
1032
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.amount_due") }),
|
|
1032
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-destructive", children:
|
|
1033
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-destructive", children: _chunkXZCCIKX3js.formatCurrency.call(void 0, invoice.amountRemaining, invoice.currency, fmt) })
|
|
1033
1034
|
] })
|
|
1034
1035
|
] }),
|
|
1035
1036
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2 pt-4 border-t", children: [
|
|
1036
|
-
invoice.stripePdfUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1037
|
+
invoice.stripePdfUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.Button, { variant: "outline", onClick: handleDownloadPDF, children: [
|
|
1037
1038
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Download, { className: "me-2 h-4 w-4" }),
|
|
1038
1039
|
t("billing.ui.invoice.download_pdf")
|
|
1039
1040
|
] }),
|
|
1040
|
-
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, _chunkY7JIQNM6js.Button, { variant: "default", onClick: handleRetryPayment, children: [
|
|
1041
1042
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RefreshCw, { className: "me-2 h-4 w-4" }),
|
|
1042
1043
|
t("billing.ui.invoice.retry_payment")
|
|
1043
1044
|
] }),
|
|
1044
|
-
invoice.stripeHostedInvoiceUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1045
|
+
invoice.stripeHostedInvoiceUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.Button, { variant: "outline", onClick: handleViewInStripe, children: [
|
|
1045
1046
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ExternalLink, { className: "me-2 h-4 w-4" }),
|
|
1046
1047
|
t("billing.ui.invoice.view_in_stripe")
|
|
1047
1048
|
] })
|
|
@@ -1055,7 +1056,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, InvoiceDetails, "InvoiceDetails");
|
|
|
1055
1056
|
|
|
1056
1057
|
function InvoicesList({ invoices, onInvoicesChange }) {
|
|
1057
1058
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1058
|
-
const fmt =
|
|
1059
|
+
const fmt = _chunkY7JIQNM6js.useBillingFormatOptions.call(void 0, );
|
|
1059
1060
|
const [selectedInvoice, setSelectedInvoice] = _react.useState.call(void 0, null);
|
|
1060
1061
|
const handleRowClick = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (invoice) => {
|
|
1061
1062
|
setSelectedInvoice(invoice);
|
|
@@ -1067,30 +1068,30 @@ function InvoicesList({ invoices, onInvoicesChange }) {
|
|
|
1067
1068
|
return invoice.stripeInvoiceId.slice(-8);
|
|
1068
1069
|
}, "getInvoiceNumber");
|
|
1069
1070
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1070
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1071
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1072
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1073
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1074
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1075
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1076
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1071
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.Table, { children: [
|
|
1072
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.TableRow, { children: [
|
|
1073
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TableHead, { children: t("billing.ui.columns.invoice_number") }),
|
|
1074
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TableHead, { children: t("billing.ui.columns.date") }),
|
|
1075
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TableHead, { children: t("billing.ui.columns.status") }),
|
|
1076
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TableHead, { className: "text-end", children: t("billing.ui.columns.amount") }),
|
|
1077
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TableHead, { children: t("billing.ui.columns.period") })
|
|
1077
1078
|
] }) }),
|
|
1078
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1079
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TableBody, { children: invoices.map((invoice) => {
|
|
1079
1080
|
const invoiceNumber = getInvoiceNumber(invoice);
|
|
1080
|
-
const date =
|
|
1081
|
-
const amount =
|
|
1082
|
-
const period = `${
|
|
1081
|
+
const date = _chunkY7JIQNM6js.formatDate.call(void 0, invoice.periodStart, fmt);
|
|
1082
|
+
const amount = _chunkXZCCIKX3js.formatCurrency.call(void 0, invoice.total, invoice.currency, fmt);
|
|
1083
|
+
const period = `${_chunkY7JIQNM6js.formatDate.call(void 0, invoice.periodStart, fmt)} - ${_chunkY7JIQNM6js.formatDate.call(void 0, invoice.periodEnd, fmt)}`;
|
|
1083
1084
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1084
|
-
|
|
1085
|
+
_chunkY7JIQNM6js.TableRow,
|
|
1085
1086
|
{
|
|
1086
1087
|
onClick: () => handleRowClick(invoice),
|
|
1087
1088
|
className: "cursor-pointer hover:bg-muted/50",
|
|
1088
1089
|
children: [
|
|
1089
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1090
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1091
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1092
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1093
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1090
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TableCell, { className: "font-medium", children: invoiceNumber }),
|
|
1091
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TableCell, { className: "text-muted-foreground text-xs", children: date }),
|
|
1092
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InvoiceStatusBadge, { status: invoice.status }) }),
|
|
1093
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TableCell, { className: "text-end font-medium", children: amount }),
|
|
1094
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TableCell, { className: "text-muted-foreground text-xs", children: period })
|
|
1094
1095
|
]
|
|
1095
1096
|
},
|
|
1096
1097
|
invoice.id
|
|
@@ -1124,7 +1125,7 @@ function InvoicesContainer() {
|
|
|
1124
1125
|
setLoading(true);
|
|
1125
1126
|
try {
|
|
1126
1127
|
const params = statusFilter !== "all" ? { status: statusFilter } : void 0;
|
|
1127
|
-
const data = await
|
|
1128
|
+
const data = await _chunkXZCCIKX3js.StripeInvoiceService.listInvoices(params);
|
|
1128
1129
|
setInvoices(data);
|
|
1129
1130
|
} catch (error) {
|
|
1130
1131
|
console.error("[InvoicesContainer] Failed to load invoices:", error);
|
|
@@ -1140,12 +1141,12 @@ function InvoicesContainer() {
|
|
|
1140
1141
|
setStatusFilter(value);
|
|
1141
1142
|
}, "handleFilterChange");
|
|
1142
1143
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-4", children: [
|
|
1143
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1144
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1145
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1146
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1147
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1148
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1144
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Tabs, { value: statusFilter, onValueChange: handleFilterChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.TabsList, { children: [
|
|
1145
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TabsTrigger, { value: "all", children: t("billing.ui.invoices.filter_all") }),
|
|
1146
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TabsTrigger, { value: "paid" /* PAID */, children: t("billing.ui.invoice_status.paid") }),
|
|
1147
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TabsTrigger, { value: "open" /* OPEN */, children: t("billing.ui.invoice_status.open") }),
|
|
1148
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TabsTrigger, { value: "void" /* VOID */, children: t("billing.ui.invoice_status.void") }),
|
|
1149
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TabsTrigger, { value: "uncollectible" /* UNCOLLECTIBLE */, children: t("billing.ui.invoice_status.uncollectible") })
|
|
1149
1150
|
] }) }),
|
|
1150
1151
|
loading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-center py-8 text-muted-foreground", children: t("billing.ui.invoices.loading") }),
|
|
1151
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: [
|
|
@@ -1187,7 +1188,7 @@ function CancelSubscriptionDialog({
|
|
|
1187
1188
|
onSuccess
|
|
1188
1189
|
}) {
|
|
1189
1190
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1190
|
-
const fmt =
|
|
1191
|
+
const fmt = _chunkY7JIQNM6js.useBillingFormatOptions.call(void 0, );
|
|
1191
1192
|
const [isSubmitting, setIsSubmitting] = _react.useState.call(void 0, false);
|
|
1192
1193
|
const form = _reacthookform.useForm.call(void 0, {
|
|
1193
1194
|
resolver: _zod.zodResolver.call(void 0, formSchema),
|
|
@@ -1198,7 +1199,7 @@ function CancelSubscriptionDialog({
|
|
|
1198
1199
|
const onSubmit = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async (_values) => {
|
|
1199
1200
|
setIsSubmitting(true);
|
|
1200
1201
|
try {
|
|
1201
|
-
await
|
|
1202
|
+
await _chunkXZCCIKX3js.StripeSubscriptionService.cancelSubscription({
|
|
1202
1203
|
id: subscription.id,
|
|
1203
1204
|
cancelImmediately: false
|
|
1204
1205
|
});
|
|
@@ -1210,16 +1211,16 @@ function CancelSubscriptionDialog({
|
|
|
1210
1211
|
setIsSubmitting(false);
|
|
1211
1212
|
}
|
|
1212
1213
|
}, "onSubmit");
|
|
1213
|
-
const periodEndDate =
|
|
1214
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1215
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1216
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1217
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1214
|
+
const periodEndDate = _chunkY7JIQNM6js.formatDate.call(void 0, subscription.currentPeriodEnd, fmt);
|
|
1215
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.DialogContent, { className: "max-w-md", children: [
|
|
1216
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.DialogHeader, { children: [
|
|
1217
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.DialogTitle, { children: t("billing.ui.subscription.cancel.title") }),
|
|
1218
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.DialogDescription, { children: t("billing.ui.subscription.cancel.description") })
|
|
1218
1219
|
] }),
|
|
1219
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1220
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-col gap-y-4", children: [
|
|
1220
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 }) }),
|
|
1221
1222
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1222
|
-
|
|
1223
|
+
_chunkY7JIQNM6js.FormTextarea,
|
|
1223
1224
|
{
|
|
1224
1225
|
form,
|
|
1225
1226
|
id: "reason",
|
|
@@ -1229,8 +1230,8 @@ function CancelSubscriptionDialog({
|
|
|
1229
1230
|
}
|
|
1230
1231
|
),
|
|
1231
1232
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-x-2 justify-end pt-2", children: [
|
|
1232
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1233
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1233
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Button, { type: "button", variant: "outline", onClick: () => onOpenChange(false), disabled: isSubmitting, children: t("billing.ui.subscription.cancel.keep") }),
|
|
1234
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Button, { type: "submit", variant: "destructive", disabled: isSubmitting, children: isSubmitting ? t("billing.ui.subscription.cancel.canceling") : t("billing.ui.subscription.cancel.confirm") })
|
|
1234
1235
|
] })
|
|
1235
1236
|
] }) })
|
|
1236
1237
|
] }) });
|
|
@@ -1281,7 +1282,7 @@ var cancelingConfig = {
|
|
|
1281
1282
|
function SubscriptionStatusBadge({ status, cancelAtPeriodEnd }) {
|
|
1282
1283
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1283
1284
|
const config = cancelAtPeriodEnd ? cancelingConfig : statusConfig2[status] || statusConfig2["canceled" /* CANCELED */];
|
|
1284
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1285
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Badge, { variant: config.variant, children: t(config.label) });
|
|
1285
1286
|
}
|
|
1286
1287
|
_chunk7QVYU63Ejs.__name.call(void 0, SubscriptionStatusBadge, "SubscriptionStatusBadge");
|
|
1287
1288
|
|
|
@@ -1308,7 +1309,7 @@ function formatPlanName2(price, t) {
|
|
|
1308
1309
|
_chunk7QVYU63Ejs.__name.call(void 0, formatPlanName2, "formatPlanName");
|
|
1309
1310
|
function formatBillingAmount(price, notAvailable, fmt) {
|
|
1310
1311
|
if (!_optionalChain([price, 'optionalAccess', _37 => _37.unitAmount])) return notAvailable;
|
|
1311
|
-
return
|
|
1312
|
+
return _chunkXZCCIKX3js.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt);
|
|
1312
1313
|
}
|
|
1313
1314
|
_chunk7QVYU63Ejs.__name.call(void 0, formatBillingAmount, "formatBillingAmount");
|
|
1314
1315
|
function SubscriptionDetails({
|
|
@@ -1319,11 +1320,11 @@ function SubscriptionDetails({
|
|
|
1319
1320
|
onChangePlan
|
|
1320
1321
|
}) {
|
|
1321
1322
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1322
|
-
const fmt =
|
|
1323
|
+
const fmt = _chunkY7JIQNM6js.useBillingFormatOptions.call(void 0, );
|
|
1323
1324
|
const [showCancel, setShowCancel] = _react.useState.call(void 0, false);
|
|
1324
1325
|
const handleManageViaPortal = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1325
1326
|
try {
|
|
1326
|
-
const { url } = await
|
|
1327
|
+
const { url } = await _chunkXZCCIKX3js.StripeCustomerService.createPortalSession();
|
|
1327
1328
|
window.open(url, "_blank");
|
|
1328
1329
|
} catch (error) {
|
|
1329
1330
|
console.error("[SubscriptionDetails] Failed to create portal session:", error);
|
|
@@ -1331,10 +1332,10 @@ function SubscriptionDetails({
|
|
|
1331
1332
|
}, "handleManageViaPortal");
|
|
1332
1333
|
const canCancel = subscription.status === "active" /* ACTIVE */ || subscription.status === "trialing" /* TRIALING */ || subscription.status === "paused" /* PAUSED */;
|
|
1333
1334
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1334
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1335
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1336
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1337
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1335
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.DialogContent, { className: "max-w-2xl", children: [
|
|
1336
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.DialogHeader, { children: [
|
|
1337
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.DialogTitle, { children: t("billing.ui.subscription.details_title") }),
|
|
1338
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.DialogDescription, { children: t("billing.ui.subscription.details_description") })
|
|
1338
1339
|
] }),
|
|
1339
1340
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
1340
1341
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
@@ -1360,22 +1361,22 @@ function SubscriptionDetails({
|
|
|
1360
1361
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "space-y-2", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1361
1362
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.subscription.current_period") }),
|
|
1362
1363
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "text-sm", children: [
|
|
1363
|
-
|
|
1364
|
+
_chunkY7JIQNM6js.formatDate.call(void 0, subscription.currentPeriodStart, fmt),
|
|
1364
1365
|
" - ",
|
|
1365
|
-
|
|
1366
|
+
_chunkY7JIQNM6js.formatDate.call(void 0, subscription.currentPeriodEnd, fmt)
|
|
1366
1367
|
] })
|
|
1367
1368
|
] }) }),
|
|
1368
1369
|
subscription.trialEnd && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1369
1370
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.subscription.trial_ends") }),
|
|
1370
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children:
|
|
1371
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children: _chunkY7JIQNM6js.formatDate.call(void 0, subscription.trialEnd, fmt) })
|
|
1371
1372
|
] }),
|
|
1372
1373
|
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", {
|
|
1373
|
-
date:
|
|
1374
|
+
date: _chunkY7JIQNM6js.formatDate.call(void 0, subscription.currentPeriodEnd, fmt)
|
|
1374
1375
|
}) }) }),
|
|
1375
1376
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2 pt-4 border-t", children: [
|
|
1376
|
-
onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1377
|
-
canCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1378
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1377
|
+
onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Button, { variant: "default", onClick: () => onChangePlan(subscription), children: t("billing.ui.subscription.change_plan") }),
|
|
1378
|
+
canCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Button, { variant: "destructive", onClick: () => setShowCancel(true), children: t("ui.buttons.cancel") }),
|
|
1379
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Button, { variant: "outline", onClick: handleManageViaPortal, children: t("billing.ui.subscription.manage_portal") })
|
|
1379
1380
|
] })
|
|
1380
1381
|
] })
|
|
1381
1382
|
] }) }),
|
|
@@ -1418,46 +1419,46 @@ function formatPlanName3(price, t) {
|
|
|
1418
1419
|
_chunk7QVYU63Ejs.__name.call(void 0, formatPlanName3, "formatPlanName");
|
|
1419
1420
|
function SubscriptionsList({ subscriptions, onSubscriptionsChange, onChangePlan }) {
|
|
1420
1421
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1421
|
-
const fmt =
|
|
1422
|
+
const fmt = _chunkY7JIQNM6js.useBillingFormatOptions.call(void 0, );
|
|
1422
1423
|
const [selectedSub, setSelectedSub] = _react.useState.call(void 0, null);
|
|
1423
1424
|
const handleRowClick = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (subscription) => {
|
|
1424
1425
|
setSelectedSub(subscription);
|
|
1425
1426
|
}, "handleRowClick");
|
|
1426
1427
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1427
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1428
|
-
/* @__PURE__ */ _jsxruntime.jsx.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,
|
|
1428
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.Table, { children: [
|
|
1429
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.TableRow, { children: [
|
|
1430
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TableHead, { children: t("billing.ui.columns.status") }),
|
|
1431
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TableHead, { children: t("billing.ui.columns.plan") }),
|
|
1432
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TableHead, { children: t("billing.ui.columns.period") }),
|
|
1433
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TableHead, { className: "text-end", children: t("billing.ui.columns.amount") }),
|
|
1434
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TableHead, { className: "text-end", children: t("billing.ui.columns.actions") })
|
|
1434
1435
|
] }) }),
|
|
1435
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1436
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TableBody, { children: subscriptions.map((subscription) => {
|
|
1436
1437
|
const price = subscription.price;
|
|
1437
|
-
const amount = _optionalChain([price, 'optionalAccess', _42 => _42.unitAmount]) ?
|
|
1438
|
-
const discountedAmount = price ?
|
|
1439
|
-
const period = `${
|
|
1438
|
+
const amount = _optionalChain([price, 'optionalAccess', _42 => _42.unitAmount]) ? _chunkXZCCIKX3js.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt) : "0";
|
|
1439
|
+
const discountedAmount = price ? _chunkY7JIQNM6js.applyDiscount.call(void 0, price.unitAmount, _chunkY7JIQNM6js.subscriptionDiscount.call(void 0, subscription)) : null;
|
|
1440
|
+
const period = `${_chunkY7JIQNM6js.formatDate.call(void 0, subscription.currentPeriodStart, fmt)} - ${_chunkY7JIQNM6js.formatDate.call(void 0, subscription.currentPeriodEnd, fmt)}`;
|
|
1440
1441
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1441
|
-
|
|
1442
|
+
_chunkY7JIQNM6js.TableRow,
|
|
1442
1443
|
{
|
|
1443
1444
|
onClick: () => handleRowClick(subscription),
|
|
1444
1445
|
className: "cursor-pointer hover:bg-muted/50",
|
|
1445
1446
|
children: [
|
|
1446
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1447
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1447
1448
|
SubscriptionStatusBadge,
|
|
1448
1449
|
{
|
|
1449
1450
|
status: subscription.status,
|
|
1450
1451
|
cancelAtPeriodEnd: subscription.cancelAtPeriodEnd
|
|
1451
1452
|
}
|
|
1452
1453
|
) }),
|
|
1453
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1454
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1455
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1454
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TableCell, { className: "font-medium", children: formatPlanName3(price, t) }),
|
|
1455
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TableCell, { className: "text-muted-foreground text-sm", children: period }),
|
|
1456
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TableCell, { className: "text-end font-medium", children: discountedAmount !== null && price ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1456
1457
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "line-through text-muted-foreground me-2", children: amount }),
|
|
1457
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success", children:
|
|
1458
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success", children: _chunkXZCCIKX3js.formatCurrency.call(void 0, discountedAmount, price.currency, fmt) })
|
|
1458
1459
|
] }) : amount }),
|
|
1459
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1460
|
-
|
|
1460
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TableCell, { className: "text-end", children: (subscription.status === "active" /* ACTIVE */ || subscription.status === "trialing" /* TRIALING */) && onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1461
|
+
_chunkY7JIQNM6js.Button,
|
|
1461
1462
|
{
|
|
1462
1463
|
size: "sm",
|
|
1463
1464
|
variant: "outline",
|
|
@@ -1515,7 +1516,7 @@ function SubscriptionsContainer({
|
|
|
1515
1516
|
}
|
|
1516
1517
|
setLoading(true);
|
|
1517
1518
|
try {
|
|
1518
|
-
const fetchedSubscriptions = await
|
|
1519
|
+
const fetchedSubscriptions = await _chunkXZCCIKX3js.StripeSubscriptionService.listSubscriptions();
|
|
1519
1520
|
setSubscriptions(fetchedSubscriptions);
|
|
1520
1521
|
} catch (error) {
|
|
1521
1522
|
console.error("[SubscriptionsContainer] Failed to load subscriptions:", error);
|
|
@@ -1538,7 +1539,7 @@ function SubscriptionsContainer({
|
|
|
1538
1539
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8" }),
|
|
1539
1540
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: t("billing.ui.subscriptions.title") })
|
|
1540
1541
|
] }),
|
|
1541
|
-
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1542
|
+
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _44 => _44()]), children: hasActiveRecurringSubscription ? t("billing.ui.subscriptions.purchase_addons") : t("billing.ui.subscriptions.subscribe") })
|
|
1542
1543
|
] }),
|
|
1543
1544
|
criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BillingAlertBanner, { subscription }, subscription.id)),
|
|
1544
1545
|
subscriptions.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col items-center justify-center py-12 space-y-4", children: [
|
|
@@ -1546,7 +1547,7 @@ function SubscriptionsContainer({
|
|
|
1546
1547
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
1547
1548
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium mb-2", children: t("billing.ui.subscriptions.empty_title") }),
|
|
1548
1549
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground mb-6", children: t("billing.ui.subscriptions.empty_description") }),
|
|
1549
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1550
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _45 => _45()]), children: t("billing.ui.subscriptions.subscribe") })
|
|
1550
1551
|
] })
|
|
1551
1552
|
] }),
|
|
1552
1553
|
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -1569,9 +1570,9 @@ function IntervalToggle({ value, onChange, hasMonthly, hasYearly }) {
|
|
|
1569
1570
|
if (!hasMonthly || !hasYearly) {
|
|
1570
1571
|
return null;
|
|
1571
1572
|
}
|
|
1572
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1573
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1574
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1573
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Tabs, { value, onValueChange: (v) => onChange(v), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.TabsList, { children: [
|
|
1574
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TabsTrigger, { value: "month", children: t("billing.admin.prices.interval.month") }),
|
|
1575
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TabsTrigger, { value: "year", children: t("billing.admin.prices.interval.year") })
|
|
1575
1576
|
] }) });
|
|
1576
1577
|
}
|
|
1577
1578
|
_chunk7QVYU63Ejs.__name.call(void 0, IntervalToggle, "IntervalToggle");
|
|
@@ -1589,11 +1590,11 @@ function PricingCard({
|
|
|
1589
1590
|
onSelect
|
|
1590
1591
|
}) {
|
|
1591
1592
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1592
|
-
const fmt =
|
|
1593
|
+
const fmt = _chunkY7JIQNM6js.useBillingFormatOptions.call(void 0, );
|
|
1593
1594
|
const description = price.description || price.nickname || t("billing.ui.pricing.standard");
|
|
1594
1595
|
const features = price.features || [];
|
|
1595
|
-
const formattedPrice =
|
|
1596
|
-
const interval =
|
|
1596
|
+
const formattedPrice = _chunkXZCCIKX3js.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt);
|
|
1597
|
+
const interval = _chunkXZCCIKX3js.formatInterval.call(void 0, price, fmt);
|
|
1597
1598
|
const handleKeyDown = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (e) => {
|
|
1598
1599
|
if ((e.key === "Enter" || e.key === " ") && !isDisabled && !isCurrentPlan) {
|
|
1599
1600
|
e.preventDefault();
|
|
@@ -1606,7 +1607,7 @@ function PricingCard({
|
|
|
1606
1607
|
}
|
|
1607
1608
|
}, "handleClick");
|
|
1608
1609
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1609
|
-
|
|
1610
|
+
_chunkY7JIQNM6js.Card,
|
|
1610
1611
|
{
|
|
1611
1612
|
role: "radio",
|
|
1612
1613
|
"aria-checked": isSelected,
|
|
@@ -1614,7 +1615,7 @@ function PricingCard({
|
|
|
1614
1615
|
tabIndex: isDisabled ? -1 : 0,
|
|
1615
1616
|
onKeyDown: handleKeyDown,
|
|
1616
1617
|
onClick: handleClick,
|
|
1617
|
-
className:
|
|
1618
|
+
className: _chunkXZCCIKX3js.cn.call(void 0,
|
|
1618
1619
|
"relative cursor-pointer transition-all duration-200 flex flex-col h-full",
|
|
1619
1620
|
"focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
1620
1621
|
isCurrentPlan && "bg-muted/30",
|
|
@@ -1624,9 +1625,9 @@ function PricingCard({
|
|
|
1624
1625
|
isLoading && "pointer-events-none"
|
|
1625
1626
|
),
|
|
1626
1627
|
children: [
|
|
1627
|
-
isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1628
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1629
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1628
|
+
isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Badge, { variant: "secondary", className: "absolute top-2 end-2", children: t("billing.ui.pricing.current") }),
|
|
1629
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardHeader, { className: "pb-2", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium", children: description }) }),
|
|
1630
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.CardContent, { className: "pb-4 grow", children: [
|
|
1630
1631
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mb-4", children: [
|
|
1631
1632
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-3xl font-bold", children: formattedPrice }),
|
|
1632
1633
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground ms-1", children: interval })
|
|
@@ -1636,8 +1637,8 @@ function PricingCard({
|
|
|
1636
1637
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-muted-foreground", children: feature })
|
|
1637
1638
|
] }, index)) })
|
|
1638
1639
|
] }),
|
|
1639
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1640
|
-
|
|
1640
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardFooter, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1641
|
+
_chunkY7JIQNM6js.Button,
|
|
1641
1642
|
{
|
|
1642
1643
|
variant: isCurrentPlan ? "secondary" : isSelected ? "default" : "outline",
|
|
1643
1644
|
className: "w-full",
|
|
@@ -1670,7 +1671,7 @@ function ProductPricingRow({
|
|
|
1670
1671
|
return null;
|
|
1671
1672
|
}
|
|
1672
1673
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-3", children: [
|
|
1673
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1674
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.SectionHeader, { children: product.name }),
|
|
1674
1675
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1675
1676
|
"div",
|
|
1676
1677
|
{
|
|
@@ -1771,15 +1772,15 @@ function ProductPricingList({
|
|
|
1771
1772
|
_chunk7QVYU63Ejs.__name.call(void 0, ProductPricingList, "ProductPricingList");
|
|
1772
1773
|
function ProductPricingListSkeleton() {
|
|
1773
1774
|
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: [
|
|
1774
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1775
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Skeleton, { className: "h-6 w-32" }),
|
|
1775
1776
|
/* @__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: [
|
|
1776
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1777
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1777
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Skeleton, { className: "h-6 w-24" }),
|
|
1778
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Skeleton, { className: "h-8 w-32" }),
|
|
1778
1779
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
1779
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1780
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1780
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Skeleton, { className: "h-4 w-full" }),
|
|
1781
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Skeleton, { className: "h-4 w-3/4" })
|
|
1781
1782
|
] }),
|
|
1782
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1783
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Skeleton, { className: "h-10 w-full" })
|
|
1783
1784
|
] }, cardIndex)) })
|
|
1784
1785
|
] }, rowIndex)) });
|
|
1785
1786
|
}
|
|
@@ -1790,21 +1791,21 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductPricingListSkeleton, "ProductPricing
|
|
|
1790
1791
|
|
|
1791
1792
|
function ProrationPreview({ preview }) {
|
|
1792
1793
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1793
|
-
const fmt =
|
|
1794
|
+
const fmt = _chunkY7JIQNM6js.useBillingFormatOptions.call(void 0, );
|
|
1794
1795
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-primary/10 border-primary/30 rounded-lg border p-4", children: [
|
|
1795
1796
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "text-primary mb-3 font-semibold", children: t("billing.ui.proration.title") }),
|
|
1796
1797
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
1797
1798
|
preview.lineItems.map((item, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between text-sm", children: [
|
|
1798
1799
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground", children: item.description }),
|
|
1799
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `font-medium ${item.amount < 0 ? "text-success" : "text-foreground"}`, children:
|
|
1800
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `font-medium ${item.amount < 0 ? "text-success" : "text-foreground"}`, children: _chunkXZCCIKX3js.formatCurrency.call(void 0, item.amount, preview.currency, fmt) })
|
|
1800
1801
|
] }, index)),
|
|
1801
1802
|
/* @__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: [
|
|
1802
1803
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-foreground", children: t("billing.ui.proration.net_due_today") }),
|
|
1803
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-foreground", children:
|
|
1804
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-foreground", children: _chunkXZCCIKX3js.formatCurrency.call(void 0, preview.immediateCharge, preview.currency, fmt) })
|
|
1804
1805
|
] }) }),
|
|
1805
1806
|
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", {
|
|
1806
|
-
date:
|
|
1807
|
-
amount:
|
|
1807
|
+
date: _chunkY7JIQNM6js.formatDate.call(void 0, preview.lineItems[0].period.end, fmt),
|
|
1808
|
+
amount: _chunkXZCCIKX3js.formatCurrency.call(void 0, preview.amountDue, preview.currency, fmt)
|
|
1808
1809
|
}) })
|
|
1809
1810
|
] })
|
|
1810
1811
|
] });
|
|
@@ -1817,7 +1818,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProrationPreview, "ProrationPreview");
|
|
|
1817
1818
|
|
|
1818
1819
|
function SubscriptionConfirmation({ price, isLoading, onConfirm, onCancel }) {
|
|
1819
1820
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1820
|
-
const fmt =
|
|
1821
|
+
const fmt = _chunkY7JIQNM6js.useBillingFormatOptions.call(void 0, );
|
|
1821
1822
|
const productName = _optionalChain([price, 'access', _51 => _51.product, 'optionalAccess', _52 => _52.name]) || price.nickname || t("billing.ui.wizard.review.selected_plan");
|
|
1822
1823
|
const productDescription = _optionalChain([price, 'access', _53 => _53.product, 'optionalAccess', _54 => _54.description]) || price.description;
|
|
1823
1824
|
const features = price.features || [];
|
|
@@ -1829,16 +1830,16 @@ function SubscriptionConfirmation({ price, isLoading, onConfirm, onCancel }) {
|
|
|
1829
1830
|
productDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-sm text-muted-foreground", children: productDescription })
|
|
1830
1831
|
] }),
|
|
1831
1832
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-lg font-semibold", children: [
|
|
1832
|
-
|
|
1833
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-normal text-muted-foreground", children:
|
|
1833
|
+
_chunkXZCCIKX3js.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt),
|
|
1834
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-normal text-muted-foreground", children: _chunkXZCCIKX3js.formatInterval.call(void 0, price, fmt) })
|
|
1834
1835
|
] }),
|
|
1835
1836
|
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: [
|
|
1836
1837
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Check, { className: "h-4 w-4 text-primary" }),
|
|
1837
1838
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: feature })
|
|
1838
1839
|
] }, index)) }),
|
|
1839
1840
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-3 pt-2 border-t border-accent/30", children: [
|
|
1840
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1841
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1841
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Button, { variant: "outline", onClick: onCancel, disabled: isLoading, children: t("ui.buttons.cancel") }),
|
|
1842
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Button, { onClick: onConfirm, disabled: isLoading, children: isLoading ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1842
1843
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "h-4 w-4 animate-spin me-2" }),
|
|
1843
1844
|
t("billing.ui.wizard.review.processing")
|
|
1844
1845
|
] }) : t("billing.ui.confirmation.subscribe") })
|
|
@@ -2017,7 +2018,7 @@ function wizardReducer(state, action) {
|
|
|
2017
2018
|
_chunk7QVYU63Ejs.__name.call(void 0, wizardReducer, "wizardReducer");
|
|
2018
2019
|
function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
2019
2020
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2020
|
-
const locale =
|
|
2021
|
+
const locale = _chunkXZCCIKX3js.useI18nLocale.call(void 0, );
|
|
2021
2022
|
const { confirmPayment } = useConfirmSubscriptionPayment();
|
|
2022
2023
|
const [state, dispatch] = _react.useReducer.call(void 0, wizardReducer, {
|
|
2023
2024
|
...initialState,
|
|
@@ -2029,7 +2030,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2029
2030
|
onCloseRef.current = onClose;
|
|
2030
2031
|
const checkPaymentMethod = _react.useCallback.call(void 0, async () => {
|
|
2031
2032
|
try {
|
|
2032
|
-
const methods = await
|
|
2033
|
+
const methods = await _chunkXZCCIKX3js.StripeCustomerService.listPaymentMethods();
|
|
2033
2034
|
dispatch({ type: "SET_HAS_PAYMENT_METHOD", hasMethod: methods.length > 0 });
|
|
2034
2035
|
} catch (error) {
|
|
2035
2036
|
console.error("[useSubscriptionWizard] Failed to check payment methods:", error);
|
|
@@ -2047,10 +2048,10 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2047
2048
|
}, []);
|
|
2048
2049
|
const lookUpAutomaticCode = _react.useCallback.call(void 0, async (priceId) => {
|
|
2049
2050
|
try {
|
|
2050
|
-
const automaticCode = await
|
|
2051
|
+
const automaticCode = await _chunkXZCCIKX3js.StripeCouponCodeService.findAutomatic({ priceId });
|
|
2051
2052
|
dispatch({
|
|
2052
2053
|
type: "SET_PROMOTION_CODE",
|
|
2053
|
-
code: automaticCode ?
|
|
2054
|
+
code: automaticCode ? _chunkXZCCIKX3js.toPromotionCodeResult.call(void 0, automaticCode) : null
|
|
2054
2055
|
});
|
|
2055
2056
|
return true;
|
|
2056
2057
|
} catch (error) {
|
|
@@ -2077,7 +2078,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2077
2078
|
const isTrialUpgrade = _optionalChain([subscription, 'optionalAccess', _61 => _61.status]) === "trialing" /* TRIALING */;
|
|
2078
2079
|
dispatch({ type: "SET_IS_TRIAL_SUBSCRIPTION", isTrial: isTrialUpgrade });
|
|
2079
2080
|
if (isTrialUpgrade && !state.hasPaymentMethod) {
|
|
2080
|
-
const methods = await
|
|
2081
|
+
const methods = await _chunkXZCCIKX3js.StripeCustomerService.listPaymentMethods();
|
|
2081
2082
|
if (methods.length === 0) {
|
|
2082
2083
|
dispatch({ type: "SET_STEP", step: "payment-method" });
|
|
2083
2084
|
dispatch({
|
|
@@ -2095,7 +2096,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2095
2096
|
}
|
|
2096
2097
|
}
|
|
2097
2098
|
if (subscription && state.selectedPrice.id !== _optionalChain([subscription, 'access', _62 => _62.price, 'optionalAccess', _63 => _63.id])) {
|
|
2098
|
-
const preview = await
|
|
2099
|
+
const preview = await _chunkXZCCIKX3js.StripeSubscriptionService.getProrationPreview({
|
|
2099
2100
|
subscriptionId: subscription.id,
|
|
2100
2101
|
newPriceId: state.selectedPrice.id
|
|
2101
2102
|
});
|
|
@@ -2129,14 +2130,14 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2129
2130
|
newPriceId: state.selectedPrice.id,
|
|
2130
2131
|
promotionCode: promotionCodeToSend(state.promotionCode)
|
|
2131
2132
|
};
|
|
2132
|
-
result = await
|
|
2133
|
+
result = await _chunkXZCCIKX3js.StripeSubscriptionService.changePlanWithMeta(changePlanParams);
|
|
2133
2134
|
} else {
|
|
2134
2135
|
const createParams = {
|
|
2135
2136
|
id: _uuid.v4.call(void 0, ),
|
|
2136
2137
|
priceId: state.selectedPrice.id,
|
|
2137
2138
|
promotionCode: promotionCodeToSend(state.promotionCode)
|
|
2138
2139
|
};
|
|
2139
|
-
result = await
|
|
2140
|
+
result = await _chunkXZCCIKX3js.StripeSubscriptionService.createSubscription(createParams);
|
|
2140
2141
|
}
|
|
2141
2142
|
const clientSecret = clientSecretToConfirm(result.meta);
|
|
2142
2143
|
if (clientSecret) {
|
|
@@ -2152,7 +2153,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2152
2153
|
const subscriptionId = subscriptionIdToSync(result.subscription, subscription);
|
|
2153
2154
|
if (subscriptionId) {
|
|
2154
2155
|
try {
|
|
2155
|
-
await
|
|
2156
|
+
await _chunkXZCCIKX3js.StripeSubscriptionService.syncSubscription({ subscriptionId });
|
|
2156
2157
|
} catch (syncError) {
|
|
2157
2158
|
console.error("[useSubscriptionWizard] Subscription sync after payment failed:", syncError);
|
|
2158
2159
|
}
|
|
@@ -2200,7 +2201,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2200
2201
|
dispatch({ type: "SET_VALIDATING_PROMO_CODE", isValidating: true });
|
|
2201
2202
|
dispatch({ type: "SET_PROMO_CODE_ERROR", error: null });
|
|
2202
2203
|
try {
|
|
2203
|
-
const result = await
|
|
2204
|
+
const result = await _chunkXZCCIKX3js.StripePromotionCodeService.validatePromotionCode({
|
|
2204
2205
|
code,
|
|
2205
2206
|
stripePriceId: _optionalChain([state, 'access', _72 => _72.selectedPrice, 'optionalAccess', _73 => _73.id]),
|
|
2206
2207
|
language: locale
|
|
@@ -2325,7 +2326,7 @@ function WizardStepPlanSelection({
|
|
|
2325
2326
|
_react.useEffect.call(void 0, () => {
|
|
2326
2327
|
const loadProducts = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2327
2328
|
try {
|
|
2328
|
-
const fetchedProducts = await
|
|
2329
|
+
const fetchedProducts = await _chunkXZCCIKX3js.StripeProductService.listProducts({ active: true });
|
|
2329
2330
|
setProducts(fetchedProducts);
|
|
2330
2331
|
} catch (error) {
|
|
2331
2332
|
console.error("[WizardStepPlanSelection] Failed to load products:", error);
|
|
@@ -2376,7 +2377,7 @@ function WizardStepPlanSelection({
|
|
|
2376
2377
|
onSelectPrice: handleSelectPrice
|
|
2377
2378
|
}
|
|
2378
2379
|
),
|
|
2379
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex justify-end pt-4 border-t", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2380
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex justify-end pt-4 border-t", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Button, { onClick: onNext, disabled: !selectedPrice || isProcessing, children: isProcessing ? t("common.loading") : t("billing.ui.wizard.next_review") }) })
|
|
2380
2381
|
] });
|
|
2381
2382
|
}
|
|
2382
2383
|
_chunk7QVYU63Ejs.__name.call(void 0, WizardStepPlanSelection, "WizardStepPlanSelection");
|
|
@@ -2400,7 +2401,7 @@ function PromoCodeInput({
|
|
|
2400
2401
|
disabled = false
|
|
2401
2402
|
}) {
|
|
2402
2403
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2403
|
-
const locale =
|
|
2404
|
+
const locale = _chunkXZCCIKX3js.useI18nLocale.call(void 0, );
|
|
2404
2405
|
const [code, setCode] = _react.useState.call(void 0, "");
|
|
2405
2406
|
const appliedKey = _optionalChain([appliedCode, 'optionalAccess', _82 => _82.valid]) ? `${appliedCode.automatic ? "auto" : "typed"}:${_nullishCoalesce(appliedCode.code, () => ( ""))}` : null;
|
|
2406
2407
|
const [previousAppliedKey, setPreviousAppliedKey] = _react.useState.call(void 0, appliedKey);
|
|
@@ -2429,7 +2430,7 @@ function PromoCodeInput({
|
|
|
2429
2430
|
}
|
|
2430
2431
|
const amount = (result.discountValue || 0) / 100;
|
|
2431
2432
|
const currency = _optionalChain([result, 'access', _83 => _83.currency, 'optionalAccess', _84 => _84.toUpperCase, 'call', _85 => _85()]) || "USD";
|
|
2432
|
-
return t("billing.ui.wizard.review.amount_off", { amount: `${currency} ${
|
|
2433
|
+
return t("billing.ui.wizard.review.amount_off", { amount: `${currency} ${_chunkXZCCIKX3js.formatFixed.call(void 0, amount, locale, 2)}` });
|
|
2433
2434
|
}, "formatDiscount");
|
|
2434
2435
|
const formatDuration = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (result) => {
|
|
2435
2436
|
switch (result.duration) {
|
|
@@ -2446,7 +2447,7 @@ function PromoCodeInput({
|
|
|
2446
2447
|
const codeInput = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
2447
2448
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
|
|
2448
2449
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2449
|
-
|
|
2450
|
+
_chunkY7JIQNM6js.Input,
|
|
2450
2451
|
{
|
|
2451
2452
|
placeholder: t("billing.ui.promo_code.placeholder"),
|
|
2452
2453
|
value: code,
|
|
@@ -2456,7 +2457,7 @@ function PromoCodeInput({
|
|
|
2456
2457
|
className: "flex-1"
|
|
2457
2458
|
}
|
|
2458
2459
|
),
|
|
2459
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2460
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.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") })
|
|
2460
2461
|
] }),
|
|
2461
2462
|
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error })
|
|
2462
2463
|
] });
|
|
@@ -2485,7 +2486,7 @@ function PromoCodeInput({
|
|
|
2485
2486
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success text-sm", children: formatDiscount(appliedCode) })
|
|
2486
2487
|
] }),
|
|
2487
2488
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2488
|
-
|
|
2489
|
+
_chunkY7JIQNM6js.Button,
|
|
2489
2490
|
{
|
|
2490
2491
|
variant: "ghost",
|
|
2491
2492
|
size: "sm",
|
|
@@ -2533,7 +2534,7 @@ function WizardStepReview({
|
|
|
2533
2534
|
isTrialUpgrade
|
|
2534
2535
|
}) {
|
|
2535
2536
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2536
|
-
const fmt =
|
|
2537
|
+
const fmt = _chunkY7JIQNM6js.useBillingFormatOptions.call(void 0, );
|
|
2537
2538
|
const [card, setCard] = _react.useState.call(void 0, null);
|
|
2538
2539
|
_react.useEffect.call(void 0, () => {
|
|
2539
2540
|
if (!hasPaymentMethod) {
|
|
@@ -2541,7 +2542,7 @@ function WizardStepReview({
|
|
|
2541
2542
|
return;
|
|
2542
2543
|
}
|
|
2543
2544
|
let cancelled = false;
|
|
2544
|
-
Promise.all([
|
|
2545
|
+
Promise.all([_chunkXZCCIKX3js.StripeCustomerService.listPaymentMethods(), _chunkXZCCIKX3js.StripeCustomerService.getCustomer()]).then(([methods, customer]) => {
|
|
2545
2546
|
if (!cancelled) setCard(reviewCard(methods, _optionalChain([customer, 'optionalAccess', _90 => _90.defaultPaymentMethodId])));
|
|
2546
2547
|
}).catch((err) => {
|
|
2547
2548
|
console.error("[WizardStepReview] Failed to load the card on file:", err);
|
|
@@ -2560,24 +2561,24 @@ function WizardStepReview({
|
|
|
2560
2561
|
const interval = _optionalChain([price, 'access', _93 => _93.recurring, 'optionalAccess', _94 => _94.interval]) || "month";
|
|
2561
2562
|
return interval === "year" ? t("billing.ui.wizard.review.interval_yearly") : t("billing.ui.wizard.review.interval_monthly");
|
|
2562
2563
|
}, "formatInterval");
|
|
2563
|
-
const codeDiscount =
|
|
2564
|
-
const carriedDiscount = isChangingPlan && !codeDiscount ?
|
|
2564
|
+
const codeDiscount = _chunkY7JIQNM6js.promotionCodeDiscount.call(void 0, promotionCode);
|
|
2565
|
+
const carriedDiscount = isChangingPlan && !codeDiscount ? _chunkY7JIQNM6js.subscriptionDiscount.call(void 0, subscription) : null;
|
|
2565
2566
|
const discount = _nullishCoalesce(codeDiscount, () => ( carriedDiscount));
|
|
2566
|
-
const discountedPrice =
|
|
2567
|
-
const discountedImmediateCharge =
|
|
2567
|
+
const discountedPrice = _chunkY7JIQNM6js.applyDiscount.call(void 0, selectedPrice.unitAmount, discount);
|
|
2568
|
+
const discountedImmediateCharge = _chunkY7JIQNM6js.applyDiscount.call(void 0, _optionalChain([prorationPreview, 'optionalAccess', _95 => _95.immediateCharge]), discount);
|
|
2568
2569
|
const getDiscountDescription = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
2569
2570
|
if (!discount) return null;
|
|
2570
2571
|
if (discount.discountType === "percent_off") {
|
|
2571
2572
|
return t("billing.ui.wizard.review.percent_off", { value: discount.discountValue });
|
|
2572
2573
|
}
|
|
2573
2574
|
return t("billing.ui.wizard.review.amount_off", {
|
|
2574
|
-
amount:
|
|
2575
|
+
amount: _chunkXZCCIKX3js.formatCurrency.call(void 0, discount.discountValue, discount.currency || selectedPrice.currency, fmt)
|
|
2575
2576
|
});
|
|
2576
2577
|
}, "getDiscountDescription");
|
|
2577
2578
|
const discountDescription = getDiscountDescription();
|
|
2578
2579
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
2579
2580
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-muted/50 rounded-lg p-4 space-y-3", children: [
|
|
2580
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2581
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.SectionHeader, { children: t("billing.ui.wizard.review.selected_plan") }),
|
|
2581
2582
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between items-center", children: [
|
|
2582
2583
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
2583
2584
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-medium", children: _optionalChain([selectedPrice, 'access', _96 => _96.product, 'optionalAccess', _97 => _97.name]) }),
|
|
@@ -2585,11 +2586,11 @@ function WizardStepReview({
|
|
|
2585
2586
|
] }),
|
|
2586
2587
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-end", children: [
|
|
2587
2588
|
discountedPrice !== null ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2588
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground line-through", children:
|
|
2589
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-success text-lg font-semibold", children:
|
|
2590
|
-
discountDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2589
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground line-through", children: _chunkXZCCIKX3js.formatCurrency.call(void 0, selectedPrice.unitAmount || 0, selectedPrice.currency, fmt) }),
|
|
2590
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-success text-lg font-semibold", children: _chunkXZCCIKX3js.formatCurrency.call(void 0, discountedPrice, selectedPrice.currency, fmt) }),
|
|
2591
|
+
discountDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Badge, { variant: "softGreen", children: discountDescription }),
|
|
2591
2592
|
carriedDiscount && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: t("billing.ui.wizard.review.discount_carries_over") })
|
|
2592
|
-
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-semibold text-lg", children:
|
|
2593
|
+
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-semibold text-lg", children: _chunkXZCCIKX3js.formatCurrency.call(void 0, selectedPrice.unitAmount || 0, selectedPrice.currency, fmt) }),
|
|
2593
2594
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: formatInterval2(selectedPrice) })
|
|
2594
2595
|
] })
|
|
2595
2596
|
] })
|
|
@@ -2604,9 +2605,9 @@ function WizardStepReview({
|
|
|
2604
2605
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between text-sm", children: [
|
|
2605
2606
|
/* @__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") }),
|
|
2606
2607
|
/* @__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: [
|
|
2607
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "line-through text-muted-foreground me-2", children:
|
|
2608
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success", children:
|
|
2609
|
-
] }) :
|
|
2608
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "line-through text-muted-foreground me-2", children: _chunkXZCCIKX3js.formatCurrency.call(void 0, prorationPreview.immediateCharge, prorationPreview.currency, fmt) }),
|
|
2609
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success", children: _chunkXZCCIKX3js.formatCurrency.call(void 0, discountedImmediateCharge, prorationPreview.currency, fmt) })
|
|
2610
|
+
] }) : _chunkXZCCIKX3js.formatCurrency.call(void 0, prorationPreview.immediateCharge, prorationPreview.currency, fmt) })
|
|
2610
2611
|
] })
|
|
2611
2612
|
]
|
|
2612
2613
|
}
|
|
@@ -2630,15 +2631,15 @@ function WizardStepReview({
|
|
|
2630
2631
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "font-medium", children: t("billing.ui.payment_method.title") }),
|
|
2631
2632
|
/* @__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") })
|
|
2632
2633
|
] }),
|
|
2633
|
-
hasPaymentMethod ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2634
|
+
hasPaymentMethod ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Button, { variant: "outline", onClick: onAddPaymentMethod, disabled: isProcessing, children: t("billing.ui.wizard.review.use_another_card") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Button, { variant: "outline", onClick: onAddPaymentMethod, children: t("billing.ui.payment_methods.add") })
|
|
2634
2635
|
] }) }),
|
|
2635
|
-
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2636
|
+
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.Alert, { variant: "destructive", children: [
|
|
2636
2637
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.AlertCircle, { className: "h-4 w-4" }),
|
|
2637
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2638
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.AlertDescription, { children: error })
|
|
2638
2639
|
] }),
|
|
2639
2640
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between pt-4 border-t", children: [
|
|
2640
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2641
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2641
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Button, { variant: "outline", onClick: onBack, disabled: isProcessing, children: t("billing.ui.wizard.back") }),
|
|
2642
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.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") })
|
|
2642
2643
|
] })
|
|
2643
2644
|
] });
|
|
2644
2645
|
}
|
|
@@ -2651,7 +2652,7 @@ function WizardStepPaymentMethod({ onBack, onSuccess, isProcessing }) {
|
|
|
2651
2652
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2652
2653
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
2653
2654
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
2654
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2655
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.SectionHeader, { children: t("billing.ui.payment_methods.add") }),
|
|
2655
2656
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: t("billing.ui.wizard.payment_description") })
|
|
2656
2657
|
] }),
|
|
2657
2658
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodForm, { onSuccess, onCancel: onBack, isLoading: isProcessing, alwaysSetDefault: true })
|
|
@@ -2694,10 +2695,10 @@ function SubscriptionWizard({
|
|
|
2694
2695
|
const isChangePlanMode = !!subscription;
|
|
2695
2696
|
const dialogTitle = subscription ? t("billing.ui.wizard.change_title") : isPurchasingAddons ? t("billing.ui.subscriptions.purchase_addons") : t("billing.ui.subscriptions.subscribe");
|
|
2696
2697
|
const dialogDescription = subscription ? t("billing.ui.wizard.change_description") : isPurchasingAddons ? t("billing.ui.wizard.addons_description") : t("billing.ui.wizard.subscribe_description");
|
|
2697
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2698
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2699
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2700
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2698
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.DialogContent, { className: "max-w-2xl max-h-[90vh] overflow-y-auto", children: [
|
|
2699
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.DialogHeader, { children: [
|
|
2700
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.DialogTitle, { children: dialogTitle }),
|
|
2701
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.DialogDescription, { children: dialogDescription })
|
|
2701
2702
|
] }),
|
|
2702
2703
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, WizardProgressIndicator, { currentStep: state.step }),
|
|
2703
2704
|
state.step === "plan-selection" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -2765,7 +2766,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, getProgressColor, "getProgressColor");
|
|
|
2765
2766
|
function formatDate2(date, { locale, t }) {
|
|
2766
2767
|
if (!date) return t("billing.ui.not_available");
|
|
2767
2768
|
try {
|
|
2768
|
-
return new Intl.DateTimeFormat(
|
|
2769
|
+
return new Intl.DateTimeFormat(_chunkXZCCIKX3js.dateFormatLocale.call(void 0, locale), {
|
|
2769
2770
|
month: "short",
|
|
2770
2771
|
day: "numeric"
|
|
2771
2772
|
}).format(new Date(date));
|
|
@@ -2776,7 +2777,7 @@ function formatDate2(date, { locale, t }) {
|
|
|
2776
2777
|
_chunk7QVYU63Ejs.__name.call(void 0, formatDate2, "formatDate");
|
|
2777
2778
|
function UsageSummaryCard({ meter, summary }) {
|
|
2778
2779
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2779
|
-
const fmt =
|
|
2780
|
+
const fmt = _chunkY7JIQNM6js.useBillingFormatOptions.call(void 0, );
|
|
2780
2781
|
const currentUsage = _nullishCoalesce(_optionalChain([summary, 'optionalAccess', _100 => _100.aggregatedValue]), () => ( 0));
|
|
2781
2782
|
const limit = meter.limit;
|
|
2782
2783
|
const percentage = limit && limit > 0 ? currentUsage / limit * 100 : null;
|
|
@@ -2784,15 +2785,15 @@ function UsageSummaryCard({ meter, summary }) {
|
|
|
2784
2785
|
const progressWidth = percentage !== null ? Math.min(percentage, 100) : 0;
|
|
2785
2786
|
const displayName = meter.displayName || meter.eventName;
|
|
2786
2787
|
const hasLimit = limit !== null && limit !== void 0;
|
|
2787
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2788
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2788
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.Card, { children: [
|
|
2789
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.CardHeader, { className: "flex flex-row items-center gap-x-3 pb-3", children: [
|
|
2789
2790
|
/* @__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" }) }),
|
|
2790
2791
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col", children: [
|
|
2791
2792
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium", children: displayName }),
|
|
2792
2793
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-xs", children: meter.id })
|
|
2793
2794
|
] })
|
|
2794
2795
|
] }),
|
|
2795
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2796
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.CardContent, { className: "flex flex-col gap-y-4", children: [
|
|
2796
2797
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
2797
2798
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-3xl font-bold", children: currentUsage.toLocaleString(fmt.locale) }),
|
|
2798
2799
|
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) }) })
|
|
@@ -2800,7 +2801,7 @@ function UsageSummaryCard({ meter, summary }) {
|
|
|
2800
2801
|
hasLimit ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-2", children: [
|
|
2801
2802
|
/* @__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}%` } }) }),
|
|
2802
2803
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-sm", children: t("billing.ui.usage.percent_used", {
|
|
2803
|
-
value: percentage !== null ?
|
|
2804
|
+
value: percentage !== null ? _chunkXZCCIKX3js.formatFixed.call(void 0, percentage, fmt.locale, 1) : ""
|
|
2804
2805
|
}) })
|
|
2805
2806
|
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-sm", children: t("billing.ui.usage.no_limit") }),
|
|
2806
2807
|
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", {
|
|
@@ -2833,14 +2834,14 @@ function UsageContainer() {
|
|
|
2833
2834
|
const loadUsageData = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2834
2835
|
setLoading(true);
|
|
2835
2836
|
try {
|
|
2836
|
-
const fetchedSubscriptions = await
|
|
2837
|
+
const fetchedSubscriptions = await _chunkXZCCIKX3js.StripeSubscriptionService.listSubscriptions();
|
|
2837
2838
|
setSubscriptions(fetchedSubscriptions);
|
|
2838
2839
|
const hasMeteredSubscriptions2 = fetchedSubscriptions.some((sub) => _optionalChain([sub, 'access', _101 => _101.price, 'optionalAccess', _102 => _102.recurring, 'optionalAccess', _103 => _103.usageType]) === "metered");
|
|
2839
2840
|
if (!hasMeteredSubscriptions2) {
|
|
2840
2841
|
setLoading(false);
|
|
2841
2842
|
return;
|
|
2842
2843
|
}
|
|
2843
|
-
const fetchedMeters = await
|
|
2844
|
+
const fetchedMeters = await _chunkXZCCIKX3js.StripeUsageService.listMeters();
|
|
2844
2845
|
setMeters(fetchedMeters);
|
|
2845
2846
|
const summariesMap = {};
|
|
2846
2847
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -2848,7 +2849,7 @@ function UsageContainer() {
|
|
|
2848
2849
|
const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
|
|
2849
2850
|
for (const meter of fetchedMeters) {
|
|
2850
2851
|
try {
|
|
2851
|
-
const meterSummaries = await
|
|
2852
|
+
const meterSummaries = await _chunkXZCCIKX3js.StripeUsageService.getMeterSummaries({
|
|
2852
2853
|
meterId: meter.id,
|
|
2853
2854
|
startTime: startOfMonth,
|
|
2854
2855
|
endTime: endOfMonth
|
|
@@ -2897,7 +2898,7 @@ function formatDateTime(date, { locale, t }) {
|
|
|
2897
2898
|
if (!date) return t("billing.ui.not_available");
|
|
2898
2899
|
const dateObj = typeof date === "string" ? new Date(date) : date;
|
|
2899
2900
|
try {
|
|
2900
|
-
return new Intl.DateTimeFormat(
|
|
2901
|
+
return new Intl.DateTimeFormat(_chunkXZCCIKX3js.dateFormatLocale.call(void 0, locale), {
|
|
2901
2902
|
month: "short",
|
|
2902
2903
|
day: "numeric",
|
|
2903
2904
|
year: "numeric",
|
|
@@ -2911,27 +2912,27 @@ function formatDateTime(date, { locale, t }) {
|
|
|
2911
2912
|
_chunk7QVYU63Ejs.__name.call(void 0, formatDateTime, "formatDateTime");
|
|
2912
2913
|
function UsageHistoryTable({ usageRecords }) {
|
|
2913
2914
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2914
|
-
const fmt =
|
|
2915
|
+
const fmt = _chunkY7JIQNM6js.useBillingFormatOptions.call(void 0, );
|
|
2915
2916
|
if (usageRecords.length === 0) {
|
|
2916
2917
|
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") }) });
|
|
2917
2918
|
}
|
|
2918
2919
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
2919
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2920
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-clip rounded-lg border", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2921
|
-
/* @__PURE__ */ _jsxruntime.jsx.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,
|
|
2920
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.SectionHeader, { level: 2, children: t("billing.ui.usage.history_title") }),
|
|
2921
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-clip rounded-lg border", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.Table, { children: [
|
|
2922
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.TableRow, { children: [
|
|
2923
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TableHead, { children: t("billing.ui.columns.date_time") }),
|
|
2924
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TableHead, { children: t("billing.ui.columns.meter_event") }),
|
|
2925
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TableHead, { className: "text-end", children: t("billing.ui.columns.quantity") }),
|
|
2926
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TableHead, { children: t("billing.ui.columns.event_id") })
|
|
2926
2927
|
] }) }),
|
|
2927
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2928
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TableBody, { children: usageRecords.map((record) => {
|
|
2928
2929
|
const dateTime = formatDateTime(record.timestamp, fmt);
|
|
2929
2930
|
const quantity = record.quantity.toLocaleString(fmt.locale);
|
|
2930
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2931
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2932
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2933
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2934
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2931
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.TableRow, { children: [
|
|
2932
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TableCell, { className: "font-medium", children: dateTime }),
|
|
2933
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TableCell, { className: "text-muted-foreground", children: record.meterEventName }),
|
|
2934
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TableCell, { className: "text-end font-medium", children: quantity }),
|
|
2935
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.TableCell, { className: "text-muted-foreground text-sm tabular-nums", children: record.stripeEventId })
|
|
2935
2936
|
] }, record.id);
|
|
2936
2937
|
}) })
|
|
2937
2938
|
] }) })
|
|
@@ -2942,8 +2943,8 @@ _chunk7QVYU63Ejs.__name.call(void 0, UsageHistoryTable, "UsageHistoryTable");
|
|
|
2942
2943
|
// src/features/billing/components/modals/BillingDetailModal.tsx
|
|
2943
2944
|
|
|
2944
2945
|
function BillingDetailModal({ open, onOpenChange, title, children, className }) {
|
|
2945
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2946
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2946
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.DialogContent, { className: _nullishCoalesce(className, () => ( "max-w-4xl max-h-[90vh] overflow-y-auto")), children: [
|
|
2947
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.DialogHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.DialogTitle, { children: title }) }),
|
|
2947
2948
|
children
|
|
2948
2949
|
] }) });
|
|
2949
2950
|
}
|
|
@@ -2971,7 +2972,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
|
|
|
2971
2972
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-destructive text-sm font-medium", children: t("billing.ui.alert.payment_failed_title") }),
|
|
2972
2973
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive mt-1 text-sm", children: t("billing.ui.alert.payment_failed_description") })
|
|
2973
2974
|
] }),
|
|
2974
|
-
onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2975
|
+
onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Button, { variant: "outline", size: "sm", onClick: onUpdatePayment, className: "text-destructive border-red-300", children: t("billing.ui.alert.update_payment_method") })
|
|
2975
2976
|
] });
|
|
2976
2977
|
}
|
|
2977
2978
|
if (subscription.status === "trialing" /* TRIALING */ && subscription.trialEnd) {
|
|
@@ -2985,7 +2986,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
|
|
|
2985
2986
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-warning text-sm font-medium", children: t("billing.ui.alert.trial_ending_title") }),
|
|
2986
2987
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-warning mt-1 text-sm", children: t("billing.ui.alert.trial_ending_description", { count: daysRemaining }) })
|
|
2987
2988
|
] }),
|
|
2988
|
-
onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2989
|
+
onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Button, { variant: "outline", size: "sm", onClick: onAddPayment, className: "text-warning border-yellow-300", children: t("billing.ui.payment_methods.add") })
|
|
2989
2990
|
] });
|
|
2990
2991
|
}
|
|
2991
2992
|
}
|
|
@@ -3025,6 +3026,7 @@ function BillingDashboardContainer() {
|
|
|
3025
3026
|
const searchParams = _navigation.useSearchParams.call(void 0, );
|
|
3026
3027
|
const [showWizard, setShowWizard] = _react.useState.call(void 0, false);
|
|
3027
3028
|
const [editingSubscription, setEditingSubscription] = _react.useState.call(void 0, null);
|
|
3029
|
+
const [pendingChangePlan, setPendingChangePlan] = _react.useState.call(void 0, false);
|
|
3028
3030
|
const hasMeteredSubscriptions = _react.useCallback.call(void 0, () => {
|
|
3029
3031
|
return data.subscriptions.some((sub) => _optionalChain([sub, 'access', _107 => _107.price, 'optionalAccess', _108 => _108.recurring, 'optionalAccess', _109 => _109.usageType]) === "metered");
|
|
3030
3032
|
}, [data.subscriptions]);
|
|
@@ -3037,7 +3039,7 @@ function BillingDashboardContainer() {
|
|
|
3037
3039
|
setNoCustomerExists(false);
|
|
3038
3040
|
let customer = null;
|
|
3039
3041
|
try {
|
|
3040
|
-
customer = await
|
|
3042
|
+
customer = await _chunkXZCCIKX3js.StripeCustomerService.getCustomer();
|
|
3041
3043
|
setData((prev) => ({ ...prev, customer }));
|
|
3042
3044
|
setErrors((prev) => ({ ...prev, customer: null }));
|
|
3043
3045
|
setNoCustomerExists(false);
|
|
@@ -3063,7 +3065,7 @@ function BillingDashboardContainer() {
|
|
|
3063
3065
|
}
|
|
3064
3066
|
const fetchSubscriptions = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3065
3067
|
try {
|
|
3066
|
-
const subscriptions2 = await
|
|
3068
|
+
const subscriptions2 = await _chunkXZCCIKX3js.StripeSubscriptionService.listSubscriptions();
|
|
3067
3069
|
setData((prev) => ({ ...prev, subscriptions: subscriptions2 }));
|
|
3068
3070
|
setErrors((prev) => ({ ...prev, subscriptions: null }));
|
|
3069
3071
|
return subscriptions2;
|
|
@@ -3077,7 +3079,7 @@ function BillingDashboardContainer() {
|
|
|
3077
3079
|
}, "fetchSubscriptions");
|
|
3078
3080
|
const fetchPaymentMethods = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3079
3081
|
try {
|
|
3080
|
-
const paymentMethods = await
|
|
3082
|
+
const paymentMethods = await _chunkXZCCIKX3js.StripeCustomerService.listPaymentMethods();
|
|
3081
3083
|
setData((prev) => ({ ...prev, paymentMethods }));
|
|
3082
3084
|
setErrors((prev) => ({ ...prev, paymentMethods: null }));
|
|
3083
3085
|
} catch (error) {
|
|
@@ -3089,7 +3091,7 @@ function BillingDashboardContainer() {
|
|
|
3089
3091
|
}, "fetchPaymentMethods");
|
|
3090
3092
|
const fetchInvoices = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3091
3093
|
try {
|
|
3092
|
-
const invoices = await
|
|
3094
|
+
const invoices = await _chunkXZCCIKX3js.StripeInvoiceService.listInvoices();
|
|
3093
3095
|
setData((prev) => ({ ...prev, invoices }));
|
|
3094
3096
|
setErrors((prev) => ({ ...prev, invoices: null }));
|
|
3095
3097
|
} catch (error) {
|
|
@@ -3112,7 +3114,7 @@ function BillingDashboardContainer() {
|
|
|
3112
3114
|
const handleCreateCustomer = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3113
3115
|
setCreatingCustomer(true);
|
|
3114
3116
|
try {
|
|
3115
|
-
await
|
|
3117
|
+
await _chunkXZCCIKX3js.StripeCustomerService.createCustomer();
|
|
3116
3118
|
setNoCustomerExists(false);
|
|
3117
3119
|
await fetchAllData();
|
|
3118
3120
|
} catch (error) {
|
|
@@ -3124,7 +3126,7 @@ function BillingDashboardContainer() {
|
|
|
3124
3126
|
}, "handleCreateCustomer");
|
|
3125
3127
|
const fetchUsageData = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3126
3128
|
try {
|
|
3127
|
-
const meters = await
|
|
3129
|
+
const meters = await _chunkXZCCIKX3js.StripeUsageService.listMeters();
|
|
3128
3130
|
setData((prev) => ({ ...prev, meters }));
|
|
3129
3131
|
const summariesMap = {};
|
|
3130
3132
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -3132,7 +3134,7 @@ function BillingDashboardContainer() {
|
|
|
3132
3134
|
const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
|
|
3133
3135
|
for (const meter of meters) {
|
|
3134
3136
|
try {
|
|
3135
|
-
const meterSummaries = await
|
|
3137
|
+
const meterSummaries = await _chunkXZCCIKX3js.StripeUsageService.getMeterSummaries({
|
|
3136
3138
|
meterId: meter.id,
|
|
3137
3139
|
startTime: startOfMonth,
|
|
3138
3140
|
endTime: endOfMonth
|
|
@@ -3176,8 +3178,9 @@ function BillingDashboardContainer() {
|
|
|
3176
3178
|
}, [fetchAllData]);
|
|
3177
3179
|
_react.useEffect.call(void 0, () => {
|
|
3178
3180
|
const action = searchParams.get("action");
|
|
3179
|
-
if (action === "subscribe") {
|
|
3180
|
-
setShowWizard(true);
|
|
3181
|
+
if (action === "subscribe" || action === "change-plan") {
|
|
3182
|
+
if (action === "subscribe") setShowWizard(true);
|
|
3183
|
+
else setPendingChangePlan(true);
|
|
3181
3184
|
window.history.replaceState(
|
|
3182
3185
|
window.history.state,
|
|
3183
3186
|
"",
|
|
@@ -3190,6 +3193,11 @@ function BillingDashboardContainer() {
|
|
|
3190
3193
|
);
|
|
3191
3194
|
}
|
|
3192
3195
|
}, [searchParams]);
|
|
3196
|
+
_react.useEffect.call(void 0, () => {
|
|
3197
|
+
if (!pendingChangePlan || loading.subscriptions) return;
|
|
3198
|
+
setPendingChangePlan(false);
|
|
3199
|
+
handleOpenWizard(_chunkXZCCIKX3js.resolveChangePlanTarget.call(void 0, data.subscriptions));
|
|
3200
|
+
}, [pendingChangePlan, loading.subscriptions, data.subscriptions, handleOpenWizard]);
|
|
3193
3201
|
const criticalSubscriptions = data.subscriptions.filter(
|
|
3194
3202
|
(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
|
|
3195
3203
|
);
|
|
@@ -3219,18 +3227,18 @@ function BillingDashboardContainer() {
|
|
|
3219
3227
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-8 w-8" }),
|
|
3220
3228
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: t("billing.title") })
|
|
3221
3229
|
] }),
|
|
3222
|
-
isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3223
|
-
noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3224
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3230
|
+
isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.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" }) }) }),
|
|
3231
|
+
noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.Card, { children: [
|
|
3232
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.CardHeader, { className: "text-center", children: [
|
|
3225
3233
|
/* @__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" }) }),
|
|
3226
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3227
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3234
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardTitle, { children: t("billing.ui.dashboard.setup_title") }),
|
|
3235
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardDescription, { children: t("billing.ui.dashboard.setup_description") })
|
|
3228
3236
|
] }),
|
|
3229
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3237
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardContent, { className: "flex justify-center pb-8", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Button, { onClick: handleCreateCustomer, disabled: creatingCustomer, size: "lg", children: creatingCustomer ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
3230
3238
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "me-2 h-4 w-4 animate-spin" }),
|
|
3231
3239
|
t("billing.ui.dashboard.setting_up")
|
|
3232
3240
|
] }) : t("billing.ui.dashboard.setup_button") }) }),
|
|
3233
|
-
errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3241
|
+
errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CardContent, { className: "pt-0", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-center text-destructive text-xs/relaxed", children: t(errors.customer) }) })
|
|
3234
3242
|
] }),
|
|
3235
3243
|
!noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
3236
3244
|
criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -3374,7 +3382,7 @@ function getStripePromise(publishableKey) {
|
|
|
3374
3382
|
}
|
|
3375
3383
|
_chunk7QVYU63Ejs.__name.call(void 0, getStripePromise, "getStripePromise");
|
|
3376
3384
|
function StripeProvider({ children }) {
|
|
3377
|
-
const publishableKey =
|
|
3385
|
+
const publishableKey = _chunkDSGP6GC3js.getStripePublishableKey.call(void 0, );
|
|
3378
3386
|
const stripePromise = _react.useMemo.call(void 0, () => getStripePromise(publishableKey), [publishableKey]);
|
|
3379
3387
|
const options = _react.useMemo.call(void 0, () => ({}), []);
|
|
3380
3388
|
if (!publishableKey) {
|
|
@@ -3384,7 +3392,7 @@ function StripeProvider({ children }) {
|
|
|
3384
3392
|
}
|
|
3385
3393
|
_chunk7QVYU63Ejs.__name.call(void 0, StripeProvider, "StripeProvider");
|
|
3386
3394
|
function isStripeConfigured() {
|
|
3387
|
-
return !!
|
|
3395
|
+
return !!_chunkDSGP6GC3js.getStripePublishableKey.call(void 0, );
|
|
3388
3396
|
}
|
|
3389
3397
|
_chunk7QVYU63Ejs.__name.call(void 0, isStripeConfigured, "isStripeConfigured");
|
|
3390
3398
|
|
|
@@ -3399,18 +3407,18 @@ _chunk7QVYU63Ejs.__name.call(void 0, isStripeConfigured, "isStripeConfigured");
|
|
|
3399
3407
|
|
|
3400
3408
|
function PriceArchiver({ price }) {
|
|
3401
3409
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
3402
|
-
const fmt =
|
|
3410
|
+
const fmt = _chunkY7JIQNM6js.useBillingFormatOptions.call(void 0, );
|
|
3403
3411
|
const { archivePrice, restorePrice } = usePriceContext();
|
|
3404
3412
|
const [open, setOpen] = _react.useState.call(void 0, false);
|
|
3405
3413
|
const isArchived = !price.active;
|
|
3406
3414
|
const scope = isArchived ? "restore" : "archive";
|
|
3407
3415
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
3408
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3416
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.Button, { variant: "outline", size: "sm", onClick: () => setOpen(true), children: [
|
|
3409
3417
|
isArchived ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RotateCcwIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ArchiveIcon, {}),
|
|
3410
3418
|
t(`billing.admin.prices.${scope}.confirm`)
|
|
3411
3419
|
] }),
|
|
3412
3420
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3413
|
-
|
|
3421
|
+
_chunkY7JIQNM6js.ConfirmDialog,
|
|
3414
3422
|
{
|
|
3415
3423
|
open,
|
|
3416
3424
|
onOpenChange: setOpen,
|
|
@@ -3424,7 +3432,7 @@ function PriceArchiver({ price }) {
|
|
|
3424
3432
|
if (isArchived) await restorePrice(price.id);
|
|
3425
3433
|
else await archivePrice(price.id);
|
|
3426
3434
|
} catch (error) {
|
|
3427
|
-
|
|
3435
|
+
_chunkY7JIQNM6js.errorToast.call(void 0, { title: t(`billing.admin.prices.${scope}.title`), error });
|
|
3428
3436
|
throw error;
|
|
3429
3437
|
}
|
|
3430
3438
|
}
|
|
@@ -3456,15 +3464,15 @@ function PriceEditorInternal({
|
|
|
3456
3464
|
onDialogOpenChange
|
|
3457
3465
|
}) {
|
|
3458
3466
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
3459
|
-
const fmt =
|
|
3460
|
-
const router =
|
|
3467
|
+
const fmt = _chunkY7JIQNM6js.useBillingFormatOptions.call(void 0, );
|
|
3468
|
+
const router = _chunkXZCCIKX3js.useI18nRouter.call(void 0, );
|
|
3461
3469
|
const { createPrice, updatePrice, productId: contextProductId } = usePriceContext();
|
|
3462
3470
|
const [allFeatures, setAllFeatures] = _react.useState.call(void 0, []);
|
|
3463
3471
|
const isEdit = !!price;
|
|
3464
3472
|
const targetProductId = _nullishCoalesce(_nullishCoalesce(productId, () => ( _optionalChain([price, 'optionalAccess', _119 => _119.product, 'optionalAccess', _120 => _120.id]))), () => ( contextProductId));
|
|
3465
3473
|
_react.useEffect.call(void 0, () => {
|
|
3466
3474
|
const fetchFeatures = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3467
|
-
setAllFeatures(await
|
|
3475
|
+
setAllFeatures(await _chunkXZCCIKX3js.FeatureService.findMany({}));
|
|
3468
3476
|
}, "fetchFeatures");
|
|
3469
3477
|
void fetchFeatures();
|
|
3470
3478
|
}, []);
|
|
@@ -3577,7 +3585,7 @@ function PriceEditorInternal({
|
|
|
3577
3585
|
warnedUnknownFor.current = fingerprint;
|
|
3578
3586
|
const { unknown } = resolvePlatformFeatures(seed.platformFeatures);
|
|
3579
3587
|
if (unknown.length > 0)
|
|
3580
|
-
|
|
3588
|
+
_chunkXZCCIKX3js.showToast.call(void 0, t("billing.admin.prices.import.warnings.unknownFeatures", { features: unknown.join(", ") }));
|
|
3581
3589
|
}, [seed, isEdit, allFeatures, resolvePlatformFeatures, t]);
|
|
3582
3590
|
const watchInterval = form.watch("interval");
|
|
3583
3591
|
const isRecurring = watchInterval !== "one_time";
|
|
@@ -3598,13 +3606,13 @@ function PriceEditorInternal({
|
|
|
3598
3606
|
{ id: "metered", text: t("billing.admin.prices.usage.metered") }
|
|
3599
3607
|
];
|
|
3600
3608
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3601
|
-
|
|
3609
|
+
_chunkY7JIQNM6js.EditorSheet,
|
|
3602
3610
|
{
|
|
3603
3611
|
form,
|
|
3604
3612
|
entityType: t("billing.admin.prices.entity"),
|
|
3605
3613
|
entityName: price ? priceLabel(price, fmt) : void 0,
|
|
3606
3614
|
isEdit,
|
|
3607
|
-
module:
|
|
3615
|
+
module: _chunkXZCCIKX3js.Modules.StripePrice,
|
|
3608
3616
|
size: "lg",
|
|
3609
3617
|
propagateChanges,
|
|
3610
3618
|
onSuccess,
|
|
@@ -3653,13 +3661,13 @@ function PriceEditorInternal({
|
|
|
3653
3661
|
dialogOpen,
|
|
3654
3662
|
onDialogOpenChange,
|
|
3655
3663
|
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
3656
|
-
isEdit && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3657
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3658
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3664
|
+
isEdit && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.Alert, { children: [
|
|
3665
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.AlertTitle, { children: t("billing.admin.prices.immutability.title") }),
|
|
3666
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.AlertDescription, { children: t("billing.admin.prices.immutability.description") })
|
|
3659
3667
|
] }),
|
|
3660
3668
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
|
|
3661
3669
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3662
|
-
|
|
3670
|
+
_chunkY7JIQNM6js.FormInput,
|
|
3663
3671
|
{
|
|
3664
3672
|
form,
|
|
3665
3673
|
id: "unitAmount",
|
|
@@ -3671,7 +3679,7 @@ function PriceEditorInternal({
|
|
|
3671
3679
|
}
|
|
3672
3680
|
),
|
|
3673
3681
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3674
|
-
|
|
3682
|
+
_chunkY7JIQNM6js.FormSelect,
|
|
3675
3683
|
{
|
|
3676
3684
|
form,
|
|
3677
3685
|
id: "currency",
|
|
@@ -3682,7 +3690,7 @@ function PriceEditorInternal({
|
|
|
3682
3690
|
)
|
|
3683
3691
|
] }),
|
|
3684
3692
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3685
|
-
|
|
3693
|
+
_chunkY7JIQNM6js.FormSelect,
|
|
3686
3694
|
{
|
|
3687
3695
|
form,
|
|
3688
3696
|
id: "interval",
|
|
@@ -3693,7 +3701,7 @@ function PriceEditorInternal({
|
|
|
3693
3701
|
),
|
|
3694
3702
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
|
|
3695
3703
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3696
|
-
|
|
3704
|
+
_chunkY7JIQNM6js.FormInput,
|
|
3697
3705
|
{
|
|
3698
3706
|
form,
|
|
3699
3707
|
id: "intervalCount",
|
|
@@ -3704,7 +3712,7 @@ function PriceEditorInternal({
|
|
|
3704
3712
|
}
|
|
3705
3713
|
),
|
|
3706
3714
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3707
|
-
|
|
3715
|
+
_chunkY7JIQNM6js.FormSelect,
|
|
3708
3716
|
{
|
|
3709
3717
|
form,
|
|
3710
3718
|
id: "usageType",
|
|
@@ -3715,7 +3723,7 @@ function PriceEditorInternal({
|
|
|
3715
3723
|
)
|
|
3716
3724
|
] }),
|
|
3717
3725
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3718
|
-
|
|
3726
|
+
_chunkY7JIQNM6js.FormInput,
|
|
3719
3727
|
{
|
|
3720
3728
|
form,
|
|
3721
3729
|
id: "nickname",
|
|
@@ -3724,7 +3732,7 @@ function PriceEditorInternal({
|
|
|
3724
3732
|
}
|
|
3725
3733
|
),
|
|
3726
3734
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3727
|
-
|
|
3735
|
+
_chunkY7JIQNM6js.FormTextarea,
|
|
3728
3736
|
{
|
|
3729
3737
|
form,
|
|
3730
3738
|
id: "description",
|
|
@@ -3734,7 +3742,7 @@ function PriceEditorInternal({
|
|
|
3734
3742
|
}
|
|
3735
3743
|
),
|
|
3736
3744
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3737
|
-
|
|
3745
|
+
_chunkY7JIQNM6js.FormInput,
|
|
3738
3746
|
{
|
|
3739
3747
|
form,
|
|
3740
3748
|
id: "token",
|
|
@@ -3744,10 +3752,10 @@ function PriceEditorInternal({
|
|
|
3744
3752
|
}
|
|
3745
3753
|
),
|
|
3746
3754
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-2", children: [
|
|
3747
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3755
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.FieldLabel, { children: t("billing.admin.prices.fields.features") }),
|
|
3748
3756
|
form.watch("features").map((_, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
|
|
3749
3757
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3750
|
-
|
|
3758
|
+
_chunkY7JIQNM6js.Input,
|
|
3751
3759
|
{
|
|
3752
3760
|
...form.register(`features.${index}`),
|
|
3753
3761
|
placeholder: t("billing.admin.prices.placeholders.feature", { index: index + 1 }),
|
|
@@ -3755,7 +3763,7 @@ function PriceEditorInternal({
|
|
|
3755
3763
|
}
|
|
3756
3764
|
),
|
|
3757
3765
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3758
|
-
|
|
3766
|
+
_chunkY7JIQNM6js.Button,
|
|
3759
3767
|
{
|
|
3760
3768
|
type: "button",
|
|
3761
3769
|
variant: "outline",
|
|
@@ -3770,7 +3778,7 @@ function PriceEditorInternal({
|
|
|
3770
3778
|
)
|
|
3771
3779
|
] }, index)),
|
|
3772
3780
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3773
|
-
|
|
3781
|
+
_chunkY7JIQNM6js.Button,
|
|
3774
3782
|
{
|
|
3775
3783
|
type: "button",
|
|
3776
3784
|
variant: "outline",
|
|
@@ -3785,12 +3793,12 @@ function PriceEditorInternal({
|
|
|
3785
3793
|
)
|
|
3786
3794
|
] }),
|
|
3787
3795
|
isRecurring && allFeatures.length > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-2", children: [
|
|
3788
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3796
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.FieldLabel, { children: t("billing.admin.prices.fields.platformFeatures") }),
|
|
3789
3797
|
/* @__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) => {
|
|
3790
3798
|
const isChecked = form.watch("featureIds").includes(feature.id);
|
|
3791
3799
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
3792
3800
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3793
|
-
|
|
3801
|
+
_chunkY7JIQNM6js.Checkbox,
|
|
3794
3802
|
{
|
|
3795
3803
|
id: `feature-${feature.id}`,
|
|
3796
3804
|
checked: isChecked,
|
|
@@ -3806,13 +3814,13 @@ function PriceEditorInternal({
|
|
|
3806
3814
|
}
|
|
3807
3815
|
}
|
|
3808
3816
|
),
|
|
3809
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3817
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.FieldLabel, { htmlFor: `feature-${feature.id}`, children: feature.name }),
|
|
3810
3818
|
feature.isCore && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.admin.prices.help.core") })
|
|
3811
3819
|
] }, feature.id);
|
|
3812
3820
|
}) })
|
|
3813
3821
|
] }),
|
|
3814
3822
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3815
|
-
|
|
3823
|
+
_chunkY7JIQNM6js.FormCheckbox,
|
|
3816
3824
|
{
|
|
3817
3825
|
form,
|
|
3818
3826
|
id: "isTrial",
|
|
@@ -3855,7 +3863,7 @@ var defaultContextValue = {
|
|
|
3855
3863
|
productId: void 0
|
|
3856
3864
|
};
|
|
3857
3865
|
function priceLabel(price, fmt = {}) {
|
|
3858
|
-
return _nullishCoalesce(price.nickname, () => ( `${
|
|
3866
|
+
return _nullishCoalesce(price.nickname, () => ( `${_chunkXZCCIKX3js.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt)} ${_chunkXZCCIKX3js.formatInterval.call(void 0, price, fmt)}`.trim()));
|
|
3859
3867
|
}
|
|
3860
3868
|
_chunk7QVYU63Ejs.__name.call(void 0, priceLabel, "priceLabel");
|
|
3861
3869
|
var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
@@ -3865,22 +3873,22 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3865
3873
|
productId: productIdProp
|
|
3866
3874
|
}) => {
|
|
3867
3875
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
3868
|
-
const fmt =
|
|
3869
|
-
const generateUrl =
|
|
3870
|
-
const { hasRole } =
|
|
3876
|
+
const fmt = _chunkY7JIQNM6js.useBillingFormatOptions.call(void 0, );
|
|
3877
|
+
const generateUrl = _chunkY7JIQNM6js.usePageUrlGenerator.call(void 0, );
|
|
3878
|
+
const { hasRole } = _chunkY7JIQNM6js.useCurrentUserContext.call(void 0, );
|
|
3871
3879
|
const [price, setPrice] = _react.useState.call(void 0,
|
|
3872
|
-
dehydratedPrice ?
|
|
3880
|
+
dehydratedPrice ? _chunkXZCCIKX3js.rehydrate.call(void 0, _chunkXZCCIKX3js.Modules.StripePrice, dehydratedPrice) : void 0
|
|
3873
3881
|
);
|
|
3874
3882
|
const [priceVersion, setPriceVersion] = _react.useState.call(void 0, 0);
|
|
3875
3883
|
const refreshPrices = _react.useCallback.call(void 0, () => setPriceVersion((value2) => value2 + 1), []);
|
|
3876
3884
|
const productId = _nullishCoalesce(productIdProp, () => ( _optionalChain([price, 'optionalAccess', _143 => _143.product, 'optionalAccess', _144 => _144.id])));
|
|
3877
3885
|
const reloadPrice = _react.useCallback.call(void 0, async () => {
|
|
3878
3886
|
if (!_optionalChain([price, 'optionalAccess', _145 => _145.id])) return;
|
|
3879
|
-
setPrice(await
|
|
3887
|
+
setPrice(await _chunkXZCCIKX3js.StripePriceService.getPrice({ id: price.id }));
|
|
3880
3888
|
}, [_optionalChain([price, 'optionalAccess', _146 => _146.id])]);
|
|
3881
3889
|
const createPrice = _react.useCallback.call(void 0,
|
|
3882
3890
|
async (input) => {
|
|
3883
|
-
const saved = await
|
|
3891
|
+
const saved = await _chunkXZCCIKX3js.StripePriceService.createPrice(input);
|
|
3884
3892
|
refreshPrices();
|
|
3885
3893
|
return saved;
|
|
3886
3894
|
},
|
|
@@ -3888,7 +3896,7 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3888
3896
|
);
|
|
3889
3897
|
const updatePrice = _react.useCallback.call(void 0,
|
|
3890
3898
|
async (input) => {
|
|
3891
|
-
const saved = await
|
|
3899
|
+
const saved = await _chunkXZCCIKX3js.StripePriceService.updatePrice(input);
|
|
3892
3900
|
setPrice(saved);
|
|
3893
3901
|
refreshPrices();
|
|
3894
3902
|
return saved;
|
|
@@ -3899,7 +3907,7 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3899
3907
|
async (id) => {
|
|
3900
3908
|
const target = _nullishCoalesce(id, () => ( _optionalChain([price, 'optionalAccess', _147 => _147.id])));
|
|
3901
3909
|
if (!target) return;
|
|
3902
|
-
await
|
|
3910
|
+
await _chunkXZCCIKX3js.StripePriceService.archivePrice({ id: target });
|
|
3903
3911
|
await reloadPrice();
|
|
3904
3912
|
refreshPrices();
|
|
3905
3913
|
},
|
|
@@ -3909,7 +3917,7 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3909
3917
|
async (id) => {
|
|
3910
3918
|
const target = _nullishCoalesce(id, () => ( _optionalChain([price, 'optionalAccess', _149 => _149.id])));
|
|
3911
3919
|
if (!target) return;
|
|
3912
|
-
await
|
|
3920
|
+
await _chunkXZCCIKX3js.StripePriceService.reactivatePrice({ id: target });
|
|
3913
3921
|
await reloadPrice();
|
|
3914
3922
|
refreshPrices();
|
|
3915
3923
|
},
|
|
@@ -3933,12 +3941,12 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3933
3941
|
if (!publishChrome) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceContext.Provider, { value, children });
|
|
3934
3942
|
const breadcrumb = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
3935
3943
|
const items = [
|
|
3936
|
-
{ name: t("billing.admin.products.title"), href: generateUrl({ page:
|
|
3944
|
+
{ name: t("billing.admin.products.title"), href: generateUrl({ page: _chunkXZCCIKX3js.Modules.StripeProduct }) }
|
|
3937
3945
|
];
|
|
3938
3946
|
if (_optionalChain([price, 'optionalAccess', _151 => _151.product]))
|
|
3939
3947
|
items.push({
|
|
3940
3948
|
name: price.product.name,
|
|
3941
|
-
href: generateUrl({ page:
|
|
3949
|
+
href: generateUrl({ page: _chunkXZCCIKX3js.Modules.StripeProduct, id: price.product.id })
|
|
3942
3950
|
});
|
|
3943
3951
|
if (price) items.push({ name: priceLabel(price, fmt) });
|
|
3944
3952
|
return items;
|
|
@@ -3955,7 +3963,7 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3955
3963
|
}
|
|
3956
3964
|
return response;
|
|
3957
3965
|
}, "title");
|
|
3958
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3966
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceContext.Provider, { value, children }) });
|
|
3959
3967
|
}, "PriceProvider");
|
|
3960
3968
|
var usePriceContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => _nullishCoalesce(_react.useContext.call(void 0, PriceContext), () => ( defaultContextValue)), "usePriceContext");
|
|
3961
3969
|
|
|
@@ -3975,12 +3983,12 @@ function ProductArchiver({ product }) {
|
|
|
3975
3983
|
const isArchived = !product.active;
|
|
3976
3984
|
const scope = isArchived ? "restore" : "archive";
|
|
3977
3985
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
3978
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3986
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.Button, { variant: "outline", size: "sm", onClick: () => setOpen(true), children: [
|
|
3979
3987
|
isArchived ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RotateCcwIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ArchiveIcon, {}),
|
|
3980
3988
|
t(`billing.admin.products.${scope}.confirm`)
|
|
3981
3989
|
] }),
|
|
3982
3990
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3983
|
-
|
|
3991
|
+
_chunkY7JIQNM6js.ConfirmDialog,
|
|
3984
3992
|
{
|
|
3985
3993
|
open,
|
|
3986
3994
|
onOpenChange: setOpen,
|
|
@@ -3994,7 +4002,7 @@ function ProductArchiver({ product }) {
|
|
|
3994
4002
|
if (isArchived) await restoreProduct(product.id);
|
|
3995
4003
|
else await archiveProduct(product.id);
|
|
3996
4004
|
} catch (error) {
|
|
3997
|
-
|
|
4005
|
+
_chunkY7JIQNM6js.errorToast.call(void 0, { title: t(`billing.admin.products.${scope}.title`), error });
|
|
3998
4006
|
throw error;
|
|
3999
4007
|
}
|
|
4000
4008
|
}
|
|
@@ -4023,7 +4031,7 @@ function ProductEditorInternal({
|
|
|
4023
4031
|
onDialogOpenChange
|
|
4024
4032
|
}) {
|
|
4025
4033
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4026
|
-
const router =
|
|
4034
|
+
const router = _chunkXZCCIKX3js.useI18nRouter.call(void 0, );
|
|
4027
4035
|
const { createProduct, updateProduct } = useProductContext();
|
|
4028
4036
|
const isEdit = !!product;
|
|
4029
4037
|
const formSchema2 = _react.useMemo.call(void 0,
|
|
@@ -4047,13 +4055,13 @@ function ProductEditorInternal({
|
|
|
4047
4055
|
defaultValues: getDefaultValues()
|
|
4048
4056
|
});
|
|
4049
4057
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4050
|
-
|
|
4058
|
+
_chunkY7JIQNM6js.EditorSheet,
|
|
4051
4059
|
{
|
|
4052
4060
|
form,
|
|
4053
4061
|
entityType: t("billing.admin.products.entity"),
|
|
4054
4062
|
entityName: _optionalChain([product, 'optionalAccess', _155 => _155.name]),
|
|
4055
4063
|
isEdit,
|
|
4056
|
-
module:
|
|
4064
|
+
module: _chunkXZCCIKX3js.Modules.StripeProduct,
|
|
4057
4065
|
size: "md",
|
|
4058
4066
|
propagateChanges,
|
|
4059
4067
|
onSuccess,
|
|
@@ -4070,7 +4078,7 @@ function ProductEditorInternal({
|
|
|
4070
4078
|
onDialogOpenChange,
|
|
4071
4079
|
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4072
4080
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4073
|
-
|
|
4081
|
+
_chunkY7JIQNM6js.FormInput,
|
|
4074
4082
|
{
|
|
4075
4083
|
form,
|
|
4076
4084
|
id: "name",
|
|
@@ -4080,7 +4088,7 @@ function ProductEditorInternal({
|
|
|
4080
4088
|
}
|
|
4081
4089
|
),
|
|
4082
4090
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4083
|
-
|
|
4091
|
+
_chunkY7JIQNM6js.FormTextarea,
|
|
4084
4092
|
{
|
|
4085
4093
|
form,
|
|
4086
4094
|
id: "description",
|
|
@@ -4124,20 +4132,20 @@ var defaultContextValue2 = {
|
|
|
4124
4132
|
};
|
|
4125
4133
|
var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ children, dehydratedProduct, publishChrome = true }) => {
|
|
4126
4134
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4127
|
-
const generateUrl =
|
|
4128
|
-
const { hasRole } =
|
|
4135
|
+
const generateUrl = _chunkY7JIQNM6js.usePageUrlGenerator.call(void 0, );
|
|
4136
|
+
const { hasRole } = _chunkY7JIQNM6js.useCurrentUserContext.call(void 0, );
|
|
4129
4137
|
const [product, setProduct] = _react.useState.call(void 0,
|
|
4130
|
-
dehydratedProduct ?
|
|
4138
|
+
dehydratedProduct ? _chunkXZCCIKX3js.rehydrate.call(void 0, _chunkXZCCIKX3js.Modules.StripeProduct, dehydratedProduct) : void 0
|
|
4131
4139
|
);
|
|
4132
4140
|
const [catalogueVersion, setCatalogueVersion] = _react.useState.call(void 0, 0);
|
|
4133
4141
|
const refreshCatalogue = _react.useCallback.call(void 0, () => setCatalogueVersion((value2) => value2 + 1), []);
|
|
4134
4142
|
const reloadProduct = _react.useCallback.call(void 0, async () => {
|
|
4135
4143
|
if (!_optionalChain([product, 'optionalAccess', _156 => _156.id])) return;
|
|
4136
|
-
setProduct(await
|
|
4144
|
+
setProduct(await _chunkXZCCIKX3js.StripeProductService.getProduct({ id: product.id }));
|
|
4137
4145
|
}, [_optionalChain([product, 'optionalAccess', _157 => _157.id])]);
|
|
4138
4146
|
const createProduct = _react.useCallback.call(void 0,
|
|
4139
4147
|
async (input) => {
|
|
4140
|
-
const saved = await
|
|
4148
|
+
const saved = await _chunkXZCCIKX3js.StripeProductService.createProduct(input);
|
|
4141
4149
|
refreshCatalogue();
|
|
4142
4150
|
return saved;
|
|
4143
4151
|
},
|
|
@@ -4145,7 +4153,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
4145
4153
|
);
|
|
4146
4154
|
const updateProduct = _react.useCallback.call(void 0,
|
|
4147
4155
|
async (input) => {
|
|
4148
|
-
const saved = await
|
|
4156
|
+
const saved = await _chunkXZCCIKX3js.StripeProductService.updateProduct(input);
|
|
4149
4157
|
setProduct(saved);
|
|
4150
4158
|
refreshCatalogue();
|
|
4151
4159
|
return saved;
|
|
@@ -4156,7 +4164,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
4156
4164
|
async (id) => {
|
|
4157
4165
|
const target = _nullishCoalesce(id, () => ( _optionalChain([product, 'optionalAccess', _158 => _158.id])));
|
|
4158
4166
|
if (!target) return;
|
|
4159
|
-
await
|
|
4167
|
+
await _chunkXZCCIKX3js.StripeProductService.archiveProduct({ id: target });
|
|
4160
4168
|
await reloadProduct();
|
|
4161
4169
|
refreshCatalogue();
|
|
4162
4170
|
},
|
|
@@ -4166,7 +4174,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
4166
4174
|
async (id) => {
|
|
4167
4175
|
const target = _nullishCoalesce(id, () => ( _optionalChain([product, 'optionalAccess', _160 => _160.id])));
|
|
4168
4176
|
if (!target) return;
|
|
4169
|
-
await
|
|
4177
|
+
await _chunkXZCCIKX3js.StripeProductService.reactivateProduct({ id: target });
|
|
4170
4178
|
await reloadProduct();
|
|
4171
4179
|
refreshCatalogue();
|
|
4172
4180
|
},
|
|
@@ -4201,7 +4209,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
4201
4209
|
{
|
|
4202
4210
|
name: t("billing.admin.products.title"),
|
|
4203
4211
|
// Linked only when it is NOT the current page.
|
|
4204
|
-
...product ? { href: generateUrl({ page:
|
|
4212
|
+
...product ? { href: generateUrl({ page: _chunkXZCCIKX3js.Modules.StripeProduct }) } : {}
|
|
4205
4213
|
}
|
|
4206
4214
|
];
|
|
4207
4215
|
if (product) items.push({ name: product.name });
|
|
@@ -4219,7 +4227,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
4219
4227
|
}
|
|
4220
4228
|
return response;
|
|
4221
4229
|
}, "title");
|
|
4222
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4230
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductContext.Provider, { value, children }) });
|
|
4223
4231
|
}, "ProductProvider");
|
|
4224
4232
|
var useProductContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => _nullishCoalesce(_react.useContext.call(void 0, ProductContext), () => ( defaultContextValue2)), "useProductContext");
|
|
4225
4233
|
|
|
@@ -4228,57 +4236,57 @@ var useProductContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ()
|
|
|
4228
4236
|
|
|
4229
4237
|
function PriceDetails() {
|
|
4230
4238
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4231
|
-
const fmt =
|
|
4232
|
-
const generateUrl =
|
|
4239
|
+
const fmt = _chunkY7JIQNM6js.useBillingFormatOptions.call(void 0, );
|
|
4240
|
+
const generateUrl = _chunkY7JIQNM6js.usePageUrlGenerator.call(void 0, );
|
|
4233
4241
|
const { price } = usePriceContext();
|
|
4234
4242
|
if (!price) return null;
|
|
4235
4243
|
const isRecurring = price.priceType === "recurring";
|
|
4236
4244
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-8", children: [
|
|
4237
4245
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4238
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4246
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.SectionHeader, { children: t("billing.admin.prices.title") }),
|
|
4239
4247
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
4240
4248
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4241
|
-
|
|
4249
|
+
_chunkY7JIQNM6js.DetailField,
|
|
4242
4250
|
{
|
|
4243
4251
|
label: t("billing.admin.prices.fields.product"),
|
|
4244
|
-
value: price.product ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4252
|
+
value: price.product ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Link, { href: generateUrl({ page: _chunkXZCCIKX3js.Modules.StripeProduct, id: price.product.id }), children: price.product.name }) : "\u2014"
|
|
4245
4253
|
}
|
|
4246
4254
|
),
|
|
4247
4255
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4248
|
-
|
|
4256
|
+
_chunkY7JIQNM6js.DetailField,
|
|
4249
4257
|
{
|
|
4250
4258
|
label: t("billing.admin.prices.fields.status"),
|
|
4251
4259
|
value: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex flex-wrap items-center gap-1", children: [
|
|
4252
|
-
price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4253
|
-
price.isTrial && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4260
|
+
price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Badge, { variant: "softGreen", children: t("billing.admin.prices.status.active") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Badge, { variant: "softGray", children: t("billing.admin.prices.status.archived") }),
|
|
4261
|
+
price.isTrial && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Badge, { variant: "softBlue", children: t("billing.admin.prices.badge.trial") })
|
|
4254
4262
|
] })
|
|
4255
4263
|
}
|
|
4256
4264
|
),
|
|
4257
4265
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4258
|
-
|
|
4266
|
+
_chunkY7JIQNM6js.DetailField,
|
|
4259
4267
|
{
|
|
4260
4268
|
label: t("billing.admin.prices.fields.amount"),
|
|
4261
|
-
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children:
|
|
4269
|
+
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _chunkXZCCIKX3js.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt) })
|
|
4262
4270
|
}
|
|
4263
4271
|
),
|
|
4264
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4272
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.DetailField, { label: t("billing.admin.prices.fields.currency"), value: price.currency.toUpperCase() }),
|
|
4265
4273
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4266
|
-
|
|
4274
|
+
_chunkY7JIQNM6js.DetailField,
|
|
4267
4275
|
{
|
|
4268
4276
|
label: t("billing.admin.prices.fields.type"),
|
|
4269
4277
|
value: isRecurring ? t("billing.admin.prices.type.recurring") : t("billing.admin.prices.type.oneTime")
|
|
4270
4278
|
}
|
|
4271
4279
|
),
|
|
4272
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4280
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.DetailField, { label: t("billing.admin.prices.fields.billing"), value: _chunkXZCCIKX3js.formatInterval.call(void 0, price, fmt) }),
|
|
4273
4281
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4274
|
-
|
|
4282
|
+
_chunkY7JIQNM6js.DetailField,
|
|
4275
4283
|
{
|
|
4276
4284
|
label: t("billing.admin.prices.fields.intervalCount"),
|
|
4277
4285
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _nullishCoalesce(_optionalChain([price, 'access', _162 => _162.recurring, 'optionalAccess', _163 => _163.intervalCount]), () => ( 1)) })
|
|
4278
4286
|
}
|
|
4279
4287
|
),
|
|
4280
4288
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4281
|
-
|
|
4289
|
+
_chunkY7JIQNM6js.DetailField,
|
|
4282
4290
|
{
|
|
4283
4291
|
label: t("billing.admin.prices.fields.usageType"),
|
|
4284
4292
|
value: _optionalChain([price, 'access', _164 => _164.recurring, 'optionalAccess', _165 => _165.usageType]) === "metered" ? t("billing.admin.prices.usage.metered") : t("billing.admin.prices.usage.licensed")
|
|
@@ -4287,24 +4295,24 @@ function PriceDetails() {
|
|
|
4287
4295
|
] })
|
|
4288
4296
|
] }),
|
|
4289
4297
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4290
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4298
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.SectionHeader, { children: t("billing.admin.prices.fields.platformFeatures") }),
|
|
4291
4299
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
4292
4300
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4293
|
-
|
|
4301
|
+
_chunkY7JIQNM6js.DetailField,
|
|
4294
4302
|
{
|
|
4295
4303
|
label: t("billing.admin.prices.fields.token"),
|
|
4296
4304
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _nullishCoalesce(price.token, () => ( "\u2014")) })
|
|
4297
4305
|
}
|
|
4298
4306
|
),
|
|
4299
4307
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4300
|
-
|
|
4308
|
+
_chunkY7JIQNM6js.DetailField,
|
|
4301
4309
|
{
|
|
4302
4310
|
label: t("billing.admin.prices.fields.stripeId"),
|
|
4303
4311
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: price.stripePriceId })
|
|
4304
4312
|
}
|
|
4305
4313
|
),
|
|
4306
4314
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4307
|
-
|
|
4315
|
+
_chunkY7JIQNM6js.DetailField,
|
|
4308
4316
|
{
|
|
4309
4317
|
label: t("billing.admin.prices.fields.description"),
|
|
4310
4318
|
value: _nullishCoalesce(price.description, () => ( "\u2014")),
|
|
@@ -4312,7 +4320,7 @@ function PriceDetails() {
|
|
|
4312
4320
|
}
|
|
4313
4321
|
),
|
|
4314
4322
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4315
|
-
|
|
4323
|
+
_chunkY7JIQNM6js.DetailField,
|
|
4316
4324
|
{
|
|
4317
4325
|
label: t("billing.admin.prices.fields.features"),
|
|
4318
4326
|
className: "md:col-span-2",
|
|
@@ -4320,11 +4328,11 @@ function PriceDetails() {
|
|
|
4320
4328
|
}
|
|
4321
4329
|
),
|
|
4322
4330
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4323
|
-
|
|
4331
|
+
_chunkY7JIQNM6js.DetailField,
|
|
4324
4332
|
{
|
|
4325
4333
|
label: t("billing.admin.prices.fields.platformFeatures"),
|
|
4326
4334
|
className: "md:col-span-2",
|
|
4327
|
-
value: price.priceFeatures.length > 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "flex flex-wrap items-center gap-1", children: price.priceFeatures.map((feature) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
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, _chunkY7JIQNM6js.Badge, { variant: "softGray", children: feature.name }, feature.id)) }) : "\u2014"
|
|
4328
4336
|
}
|
|
4329
4337
|
)
|
|
4330
4338
|
] })
|
|
@@ -4338,7 +4346,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, PriceDetails, "PriceDetails");
|
|
|
4338
4346
|
function PriceContainer() {
|
|
4339
4347
|
const { price } = usePriceContext();
|
|
4340
4348
|
if (!price) return null;
|
|
4341
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4349
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.RoundPageContainer, { module: _chunkXZCCIKX3js.Modules.StripePrice, id: price.id, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceDetails, {}) });
|
|
4342
4350
|
}
|
|
4343
4351
|
_chunk7QVYU63Ejs.__name.call(void 0, PriceContainer, "PriceContainer");
|
|
4344
4352
|
|
|
@@ -4463,10 +4471,10 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4463
4471
|
const importInputRef = _react.useRef.call(void 0, null);
|
|
4464
4472
|
const [seed, setSeed] = _react.useState.call(void 0, void 0);
|
|
4465
4473
|
const [seedNonce, setSeedNonce] = _react.useState.call(void 0, 0);
|
|
4466
|
-
const data =
|
|
4467
|
-
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) =>
|
|
4474
|
+
const data = _chunkY7JIQNM6js.useDataListRetriever.call(void 0, {
|
|
4475
|
+
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunkXZCCIKX3js.StripePriceService.listPrices({ ...params, productId }), "retriever"),
|
|
4468
4476
|
retrieverParams: {},
|
|
4469
|
-
module:
|
|
4477
|
+
module: _chunkXZCCIKX3js.Modules.StripePrice
|
|
4470
4478
|
});
|
|
4471
4479
|
_react.useEffect.call(void 0, () => {
|
|
4472
4480
|
if (priceVersion > 0) void data.refresh();
|
|
@@ -4501,7 +4509,7 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4501
4509
|
openSeededEditor(transfer.price);
|
|
4502
4510
|
} catch (error) {
|
|
4503
4511
|
console.error("[PricesList] price import failed", error);
|
|
4504
|
-
|
|
4512
|
+
_chunkY7JIQNM6js.errorToast.call(void 0, {
|
|
4505
4513
|
title: t("billing.admin.prices.import.errors.title"),
|
|
4506
4514
|
error: t("billing.admin.prices.import.errors.invalid")
|
|
4507
4515
|
});
|
|
@@ -4520,7 +4528,7 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4520
4528
|
"create-price"
|
|
4521
4529
|
),
|
|
4522
4530
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _react.Fragment, { children: [
|
|
4523
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
4531
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7JIQNM6js.Button, { variant: "outline", size: "sm", type: "button", onClick: () => _optionalChain([importInputRef, 'access', _180 => _180.current, 'optionalAccess', _181 => _181.click, 'call', _182 => _182()]), children: [
|
|
4524
4532
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.UploadIcon, {}),
|
|
4525
4533
|
t("billing.admin.prices.actions.import")
|
|
4526
4534
|
] }),
|
|
@@ -4538,7 +4546,7 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4538
4546
|
];
|
|
4539
4547
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
4540
4548
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4541
|
-
|
|
4549
|
+
_chunkY7JIQNM6js.ContentListTable,
|
|
4542
4550
|
{
|
|
4543
4551
|
data,
|
|
4544
4552
|
fields: [
|
|
@@ -4549,13 +4557,13 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4549
4557
|
"status" /* status */,
|
|
4550
4558
|
"actions" /* actions */
|
|
4551
4559
|
],
|
|
4552
|
-
tableGeneratorType:
|
|
4560
|
+
tableGeneratorType: _chunkXZCCIKX3js.Modules.StripePrice,
|
|
4553
4561
|
functions,
|
|
4554
4562
|
context: tableContext,
|
|
4555
4563
|
fullWidth,
|
|
4556
4564
|
title: t("billing.admin.prices.title"),
|
|
4557
4565
|
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4558
|
-
|
|
4566
|
+
_chunkY7JIQNM6js.EmptyState,
|
|
4559
4567
|
{
|
|
4560
4568
|
icon: _lucidereact.DollarSignIcon,
|
|
4561
4569
|
title: t("billing.admin.prices.empty.title"),
|
|
@@ -4595,18 +4603,18 @@ function ProductDetails() {
|
|
|
4595
4603
|
const { product } = useProductContext();
|
|
4596
4604
|
if (!product) return null;
|
|
4597
4605
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4598
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4606
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.SectionHeader, { children: t("billing.admin.products.tabs.details") }),
|
|
4599
4607
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
4600
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4608
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.DetailField, { label: t("billing.admin.products.fields.name"), value: product.name }),
|
|
4601
4609
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4602
|
-
|
|
4610
|
+
_chunkY7JIQNM6js.DetailField,
|
|
4603
4611
|
{
|
|
4604
4612
|
label: t("billing.admin.products.fields.status"),
|
|
4605
|
-
value: product.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4613
|
+
value: product.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Badge, { variant: "softGreen", children: t("billing.admin.products.status.active") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Badge, { variant: "softGray", children: t("billing.admin.products.status.archived") })
|
|
4606
4614
|
}
|
|
4607
4615
|
),
|
|
4608
4616
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4609
|
-
|
|
4617
|
+
_chunkY7JIQNM6js.DetailField,
|
|
4610
4618
|
{
|
|
4611
4619
|
label: t("billing.admin.products.fields.description"),
|
|
4612
4620
|
value: _nullishCoalesce(product.description, () => ( "\u2014")),
|
|
@@ -4614,14 +4622,14 @@ function ProductDetails() {
|
|
|
4614
4622
|
}
|
|
4615
4623
|
),
|
|
4616
4624
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4617
|
-
|
|
4625
|
+
_chunkY7JIQNM6js.DetailField,
|
|
4618
4626
|
{
|
|
4619
4627
|
label: t("billing.admin.products.fields.prices"),
|
|
4620
4628
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: product.stripePrices.length })
|
|
4621
4629
|
}
|
|
4622
4630
|
),
|
|
4623
4631
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4624
|
-
|
|
4632
|
+
_chunkY7JIQNM6js.DetailField,
|
|
4625
4633
|
{
|
|
4626
4634
|
label: t("billing.admin.products.fields.stripeId"),
|
|
4627
4635
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: product.stripeProductId })
|
|
@@ -4639,9 +4647,9 @@ function ProductContainer() {
|
|
|
4639
4647
|
const { product } = useProductContext();
|
|
4640
4648
|
if (!product) return null;
|
|
4641
4649
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4642
|
-
|
|
4650
|
+
_chunkY7JIQNM6js.RoundPageContainer,
|
|
4643
4651
|
{
|
|
4644
|
-
module:
|
|
4652
|
+
module: _chunkXZCCIKX3js.Modules.StripeProduct,
|
|
4645
4653
|
id: product.id,
|
|
4646
4654
|
tabs: [
|
|
4647
4655
|
{
|
|
@@ -4650,7 +4658,7 @@ function ProductContainer() {
|
|
|
4650
4658
|
content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductDetails, {})
|
|
4651
4659
|
},
|
|
4652
4660
|
{
|
|
4653
|
-
key:
|
|
4661
|
+
key: _chunkXZCCIKX3js.Modules.StripePrice,
|
|
4654
4662
|
label: t("billing.admin.prices.title"),
|
|
4655
4663
|
// publishChrome={false}: SharedProvider REPLACES its value for the
|
|
4656
4664
|
// subtree (SharedContext.tsx:35-37), so a nested provider publishing
|
|
@@ -4676,18 +4684,18 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductContainer, "ProductContainer");
|
|
|
4676
4684
|
|
|
4677
4685
|
function CouponsList({ fullWidth } = {}) {
|
|
4678
4686
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4679
|
-
const { catalogueVersion } =
|
|
4680
|
-
const data =
|
|
4681
|
-
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) =>
|
|
4687
|
+
const { catalogueVersion } = _chunkY7JIQNM6js.useCouponContext.call(void 0, );
|
|
4688
|
+
const data = _chunkY7JIQNM6js.useDataListRetriever.call(void 0, {
|
|
4689
|
+
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunkXZCCIKX3js.StripeCouponService.listCoupons(params), "retriever"),
|
|
4682
4690
|
retrieverParams: {},
|
|
4683
|
-
module:
|
|
4691
|
+
module: _chunkXZCCIKX3js.Modules.StripeCoupon
|
|
4684
4692
|
});
|
|
4685
4693
|
_react.useEffect.call(void 0, () => {
|
|
4686
4694
|
if (catalogueVersion > 0) void data.refresh();
|
|
4687
4695
|
}, [catalogueVersion]);
|
|
4688
|
-
const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4696
|
+
const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CouponEditor, {}, "create-coupon")];
|
|
4689
4697
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4690
|
-
|
|
4698
|
+
_chunkY7JIQNM6js.ContentListTable,
|
|
4691
4699
|
{
|
|
4692
4700
|
data,
|
|
4693
4701
|
fields: [
|
|
@@ -4697,12 +4705,12 @@ function CouponsList({ fullWidth } = {}) {
|
|
|
4697
4705
|
"codes" /* codes */,
|
|
4698
4706
|
"status" /* status */
|
|
4699
4707
|
],
|
|
4700
|
-
tableGeneratorType:
|
|
4708
|
+
tableGeneratorType: _chunkXZCCIKX3js.Modules.StripeCoupon,
|
|
4701
4709
|
functions,
|
|
4702
4710
|
fullWidth,
|
|
4703
4711
|
title: t("billing.admin.coupons.title"),
|
|
4704
4712
|
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4705
|
-
|
|
4713
|
+
_chunkY7JIQNM6js.EmptyState,
|
|
4706
4714
|
{
|
|
4707
4715
|
icon: _lucidereact.TicketPercentIcon,
|
|
4708
4716
|
title: t("billing.admin.coupons.empty.title"),
|
|
@@ -4722,26 +4730,26 @@ _chunk7QVYU63Ejs.__name.call(void 0, CouponsList, "CouponsList");
|
|
|
4722
4730
|
function ProductsList({ fullWidth } = {}) {
|
|
4723
4731
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4724
4732
|
const { catalogueVersion } = useProductContext();
|
|
4725
|
-
const data =
|
|
4726
|
-
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) =>
|
|
4733
|
+
const data = _chunkY7JIQNM6js.useDataListRetriever.call(void 0, {
|
|
4734
|
+
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunkXZCCIKX3js.StripeProductService.listProducts(params), "retriever"),
|
|
4727
4735
|
retrieverParams: {},
|
|
4728
|
-
module:
|
|
4736
|
+
module: _chunkXZCCIKX3js.Modules.StripeProduct
|
|
4729
4737
|
});
|
|
4730
4738
|
_react.useEffect.call(void 0, () => {
|
|
4731
4739
|
if (catalogueVersion > 0) void data.refresh();
|
|
4732
4740
|
}, [catalogueVersion]);
|
|
4733
4741
|
const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductEditor, {}, "create-product")];
|
|
4734
4742
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4735
|
-
|
|
4743
|
+
_chunkY7JIQNM6js.ContentListTable,
|
|
4736
4744
|
{
|
|
4737
4745
|
data,
|
|
4738
4746
|
fields: ["name" /* name */, "status" /* status */, "prices" /* prices */],
|
|
4739
|
-
tableGeneratorType:
|
|
4747
|
+
tableGeneratorType: _chunkXZCCIKX3js.Modules.StripeProduct,
|
|
4740
4748
|
functions,
|
|
4741
4749
|
fullWidth,
|
|
4742
4750
|
title: t("billing.admin.products.title"),
|
|
4743
4751
|
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4744
|
-
|
|
4752
|
+
_chunkY7JIQNM6js.EmptyState,
|
|
4745
4753
|
{
|
|
4746
4754
|
icon: _lucidereact.PackageIcon,
|
|
4747
4755
|
title: t("billing.admin.products.empty.title"),
|
|
@@ -4757,10 +4765,10 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductsList, "ProductsList");
|
|
|
4757
4765
|
|
|
4758
4766
|
function ProductsListContainer() {
|
|
4759
4767
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4760
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductProvider, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4761
|
-
|
|
4768
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductProvider, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CouponProvider, { publishChrome: false, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4769
|
+
_chunkY7JIQNM6js.RoundPageContainer,
|
|
4762
4770
|
{
|
|
4763
|
-
module:
|
|
4771
|
+
module: _chunkXZCCIKX3js.Modules.StripeProduct,
|
|
4764
4772
|
tabs: [
|
|
4765
4773
|
{ sectionKey: "products", label: t("billing.admin.products.tabs.products"), content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductsList, {}) },
|
|
4766
4774
|
{ sectionKey: "codes", label: t("billing.admin.products.tabs.codes"), content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CouponsList, {}) }
|
|
@@ -4778,30 +4786,30 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductsListContainer, "ProductsListContain
|
|
|
4778
4786
|
|
|
4779
4787
|
function CouponDetails() {
|
|
4780
4788
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4781
|
-
const fmt =
|
|
4782
|
-
const { coupon } =
|
|
4789
|
+
const fmt = _chunkY7JIQNM6js.useBillingFormatOptions.call(void 0, );
|
|
4790
|
+
const { coupon } = _chunkY7JIQNM6js.useCouponContext.call(void 0, );
|
|
4783
4791
|
if (!coupon) return null;
|
|
4784
4792
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4785
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4793
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.SectionHeader, { children: t("billing.admin.products.tabs.details") }),
|
|
4786
4794
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-xs/relaxed", children: t("billing.admin.coupons.fixed_notice") }),
|
|
4787
4795
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
4788
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4796
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.DetailField, { label: t("billing.admin.coupons.fields.name"), value: coupon.name }),
|
|
4789
4797
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4790
|
-
|
|
4798
|
+
_chunkY7JIQNM6js.DetailField,
|
|
4791
4799
|
{
|
|
4792
4800
|
label: t("billing.admin.coupons.fields.status"),
|
|
4793
|
-
value: coupon.valid ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4801
|
+
value: coupon.valid ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Badge, { variant: "softGreen", children: t("billing.admin.coupons.status.active") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.Badge, { variant: "softGray", children: t("billing.admin.coupons.status.ended") })
|
|
4794
4802
|
}
|
|
4795
4803
|
),
|
|
4796
4804
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4797
|
-
|
|
4805
|
+
_chunkY7JIQNM6js.DetailField,
|
|
4798
4806
|
{
|
|
4799
4807
|
label: t("billing.admin.coupons.fields.discount"),
|
|
4800
|
-
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children:
|
|
4808
|
+
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _chunkXZCCIKX3js.formatCouponDiscount.call(void 0, coupon, t, fmt) })
|
|
4801
4809
|
}
|
|
4802
4810
|
),
|
|
4803
4811
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4804
|
-
|
|
4812
|
+
_chunkY7JIQNM6js.DetailField,
|
|
4805
4813
|
{
|
|
4806
4814
|
label: t("billing.admin.coupons.fields.places"),
|
|
4807
4815
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: coupon.maxRedemptions !== void 0 ? t("billing.admin.coupons.places.limited", {
|
|
@@ -4811,21 +4819,21 @@ function CouponDetails() {
|
|
|
4811
4819
|
}
|
|
4812
4820
|
),
|
|
4813
4821
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4814
|
-
|
|
4822
|
+
_chunkY7JIQNM6js.DetailField,
|
|
4815
4823
|
{
|
|
4816
4824
|
label: t("billing.admin.coupons.fields.products"),
|
|
4817
4825
|
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")
|
|
4818
4826
|
}
|
|
4819
4827
|
),
|
|
4820
4828
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4821
|
-
|
|
4829
|
+
_chunkY7JIQNM6js.DetailField,
|
|
4822
4830
|
{
|
|
4823
4831
|
label: t("billing.admin.coupons.fields.redeemBy"),
|
|
4824
|
-
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: coupon.redeemBy ?
|
|
4832
|
+
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: coupon.redeemBy ? _chunkY7JIQNM6js.formatDate.call(void 0, coupon.redeemBy, fmt) : "\u2014" })
|
|
4825
4833
|
}
|
|
4826
4834
|
),
|
|
4827
4835
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4828
|
-
|
|
4836
|
+
_chunkY7JIQNM6js.DetailField,
|
|
4829
4837
|
{
|
|
4830
4838
|
label: t("billing.admin.coupons.fields.stripeId"),
|
|
4831
4839
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: coupon.stripeCouponId })
|
|
@@ -4859,33 +4867,33 @@ function CouponCodeEditorInternal({
|
|
|
4859
4867
|
onDialogOpenChange
|
|
4860
4868
|
}) {
|
|
4861
4869
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4862
|
-
const router =
|
|
4863
|
-
const { createCode } =
|
|
4864
|
-
const formSchema2 = _react.useMemo.call(void 0, () => _zod3.z.object({ id: _zod3.z.uuidv4() }).and(
|
|
4865
|
-
const getDefaultValues = _react.useCallback.call(void 0, () => ({ id: _uuid.v4.call(void 0, ), ...
|
|
4870
|
+
const router = _chunkXZCCIKX3js.useI18nRouter.call(void 0, );
|
|
4871
|
+
const { createCode } = _chunkY7JIQNM6js.useCouponContext.call(void 0, );
|
|
4872
|
+
const formSchema2 = _react.useMemo.call(void 0, () => _zod3.z.object({ id: _zod3.z.uuidv4() }).and(_chunkY7JIQNM6js.couponCodeSchema.call(void 0, t)), [t]);
|
|
4873
|
+
const getDefaultValues = _react.useCallback.call(void 0, () => ({ id: _uuid.v4.call(void 0, ), ..._chunkY7JIQNM6js.couponCodeDefaults.call(void 0, ) }), []);
|
|
4866
4874
|
const form = _reacthookform.useForm.call(void 0, {
|
|
4867
4875
|
resolver: _zod.zodResolver.call(void 0, formSchema2),
|
|
4868
4876
|
defaultValues: getDefaultValues()
|
|
4869
4877
|
});
|
|
4870
4878
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4871
|
-
|
|
4879
|
+
_chunkY7JIQNM6js.EditorSheet,
|
|
4872
4880
|
{
|
|
4873
4881
|
form,
|
|
4874
4882
|
entityType: t("billing.admin.coupons.codes.entity"),
|
|
4875
4883
|
isEdit: false,
|
|
4876
|
-
module:
|
|
4884
|
+
module: _chunkXZCCIKX3js.Modules.StripeCouponCode,
|
|
4877
4885
|
size: "md",
|
|
4878
4886
|
onSuccess: _nullishCoalesce(onSuccess, () => ( (() => {
|
|
4879
4887
|
}))),
|
|
4880
4888
|
onNavigate: (url) => router.push(url),
|
|
4881
|
-
onSubmit: async (values) => await createCode({ id: values.id, couponId, ...
|
|
4889
|
+
onSubmit: async (values) => await createCode({ id: values.id, couponId, ..._chunkY7JIQNM6js.toCouponCodeInput.call(void 0, values) }),
|
|
4882
4890
|
onReset: getDefaultValues,
|
|
4883
4891
|
trigger,
|
|
4884
4892
|
forceShow,
|
|
4885
4893
|
onClose,
|
|
4886
4894
|
dialogOpen,
|
|
4887
4895
|
onDialogOpenChange,
|
|
4888
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4896
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7JIQNM6js.CouponCodeFields, { form })
|
|
4889
4897
|
}
|
|
4890
4898
|
);
|
|
4891
4899
|
}
|
|
@@ -4899,18 +4907,18 @@ _chunk7QVYU63Ejs.__name.call(void 0, CouponCodeEditor, "CouponCodeEditor");
|
|
|
4899
4907
|
|
|
4900
4908
|
function CouponCodesList({ couponId }) {
|
|
4901
4909
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4902
|
-
const { catalogueVersion } =
|
|
4903
|
-
const data =
|
|
4904
|
-
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) =>
|
|
4910
|
+
const { catalogueVersion } = _chunkY7JIQNM6js.useCouponContext.call(void 0, );
|
|
4911
|
+
const data = _chunkY7JIQNM6js.useDataListRetriever.call(void 0, {
|
|
4912
|
+
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunkXZCCIKX3js.StripeCouponCodeService.listByCoupon({ ...params, couponId }), "retriever"),
|
|
4905
4913
|
retrieverParams: {},
|
|
4906
|
-
module:
|
|
4914
|
+
module: _chunkXZCCIKX3js.Modules.StripeCouponCode
|
|
4907
4915
|
});
|
|
4908
4916
|
_react.useEffect.call(void 0, () => {
|
|
4909
4917
|
if (catalogueVersion > 0) void data.refresh();
|
|
4910
4918
|
}, [catalogueVersion]);
|
|
4911
4919
|
const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, CouponCodeEditor, { couponId }, "create-code")];
|
|
4912
4920
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4913
|
-
|
|
4921
|
+
_chunkY7JIQNM6js.ContentListTable,
|
|
4914
4922
|
{
|
|
4915
4923
|
data,
|
|
4916
4924
|
fields: [
|
|
@@ -4921,11 +4929,11 @@ function CouponCodesList({ couponId }) {
|
|
|
4921
4929
|
"status" /* status */,
|
|
4922
4930
|
"actions" /* actions */
|
|
4923
4931
|
],
|
|
4924
|
-
tableGeneratorType:
|
|
4932
|
+
tableGeneratorType: _chunkXZCCIKX3js.Modules.StripeCouponCode,
|
|
4925
4933
|
functions,
|
|
4926
4934
|
title: t("billing.admin.coupons.codes.title"),
|
|
4927
4935
|
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4928
|
-
|
|
4936
|
+
_chunkY7JIQNM6js.EmptyState,
|
|
4929
4937
|
{
|
|
4930
4938
|
icon: _lucidereact.TicketIcon,
|
|
4931
4939
|
title: t("billing.admin.coupons.codes.empty.title"),
|
|
@@ -4941,12 +4949,12 @@ _chunk7QVYU63Ejs.__name.call(void 0, CouponCodesList, "CouponCodesList");
|
|
|
4941
4949
|
|
|
4942
4950
|
function CouponContainer() {
|
|
4943
4951
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4944
|
-
const { coupon } =
|
|
4952
|
+
const { coupon } = _chunkY7JIQNM6js.useCouponContext.call(void 0, );
|
|
4945
4953
|
if (!coupon) return null;
|
|
4946
4954
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4947
|
-
|
|
4955
|
+
_chunkY7JIQNM6js.RoundPageContainer,
|
|
4948
4956
|
{
|
|
4949
|
-
module:
|
|
4957
|
+
module: _chunkY7JIQNM6js.couponPageModule.call(void 0, ),
|
|
4950
4958
|
id: coupon.id,
|
|
4951
4959
|
tabs: [
|
|
4952
4960
|
{
|
|
@@ -5053,5 +5061,5 @@ _chunk7QVYU63Ejs.__name.call(void 0, CouponContainer, "CouponContainer");
|
|
|
5053
5061
|
|
|
5054
5062
|
|
|
5055
5063
|
|
|
5056
|
-
exports.BillingAlertBanner = BillingAlertBanner; exports.BillingDashboardContainer = BillingDashboardContainer; exports.BillingDetailModal = BillingDetailModal; exports.BillingUsageSummaryCard = BillingUsageSummaryCard; exports.CancelSubscriptionDialog = CancelSubscriptionDialog; exports.CouponCodeActions =
|
|
5064
|
+
exports.BillingAlertBanner = BillingAlertBanner; exports.BillingDashboardContainer = BillingDashboardContainer; exports.BillingDetailModal = BillingDetailModal; exports.BillingUsageSummaryCard = BillingUsageSummaryCard; exports.CancelSubscriptionDialog = CancelSubscriptionDialog; exports.CouponCodeActions = _chunkY7JIQNM6js.CouponCodeActions; exports.CouponCodeEditor = CouponCodeEditor; exports.CouponCodeFields = _chunkY7JIQNM6js.CouponCodeFields; exports.CouponCodesList = CouponCodesList; exports.CouponContainer = CouponContainer; exports.CouponDetails = CouponDetails; exports.CouponEditor = _chunkY7JIQNM6js.CouponEditor; exports.CouponProvider = _chunkY7JIQNM6js.CouponProvider; exports.CouponRefresher = _chunkY7JIQNM6js.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 = _chunkY7JIQNM6js.applyDiscount; exports.couponCodeDefaults = _chunkY7JIQNM6js.couponCodeDefaults; exports.couponCodeSchema = _chunkY7JIQNM6js.couponCodeSchema; exports.couponCurrencyOptions = _chunkY7JIQNM6js.couponCurrencyOptions; exports.formatCurrency = _chunkXZCCIKX3js.formatCurrency; exports.formatDate = _chunkY7JIQNM6js.formatDate; exports.formatFixed = _chunkXZCCIKX3js.formatFixed; exports.formatInterval = _chunkXZCCIKX3js.formatInterval; exports.isStripeConfigured = isStripeConfigured; exports.optionalDate = _chunkY7JIQNM6js.optionalDate; exports.optionalDecimal = _chunkY7JIQNM6js.optionalDecimal; exports.optionalPositiveInt = _chunkY7JIQNM6js.optionalPositiveInt; exports.parseOptionalDecimal = _chunkY7JIQNM6js.parseOptionalDecimal; exports.parseOptionalPositiveInt = _chunkY7JIQNM6js.parseOptionalPositiveInt; exports.priceLabel = priceLabel; exports.promotionCodeDiscount = _chunkY7JIQNM6js.promotionCodeDiscount; exports.subscriptionDiscount = _chunkY7JIQNM6js.subscriptionDiscount; exports.toCouponCodeInput = _chunkY7JIQNM6js.toCouponCodeInput; exports.useBillingFormatOptions = _chunkY7JIQNM6js.useBillingFormatOptions; exports.useCouponContext = _chunkY7JIQNM6js.useCouponContext; exports.usePriceContext = usePriceContext; exports.useProductContext = useProductContext;
|
|
5057
5065
|
//# sourceMappingURL=index.js.map
|