@carlonicora/nextjs-jsonapi 6.15.0 → 6.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{BlockNoteEditor-UIAX72XW.js → BlockNoteEditor-GWDYMS6R.js} +20 -20
- package/dist/{BlockNoteEditor-UIAX72XW.js.map → BlockNoteEditor-GWDYMS6R.js.map} +1 -1
- package/dist/{BlockNoteEditor-I3J6YYXK.mjs → BlockNoteEditor-HNP5UAJT.mjs} +5 -5
- package/dist/{BlockNoteViewer-HIUAJQRI.mjs → BlockNoteViewer-X4UEVI2A.mjs} +3 -3
- package/dist/{BlockNoteViewer-APBOPT4B.js → BlockNoteViewer-XYKFY77F.js} +4 -4
- package/dist/{BlockNoteViewer-APBOPT4B.js.map → BlockNoteViewer-XYKFY77F.js.map} +1 -1
- package/dist/EmailPurpose-DOsSqM5K.d.mts +3 -0
- package/dist/EmailPurpose-DOsSqM5K.d.ts +3 -0
- package/dist/billing/index.js +492 -492
- package/dist/billing/index.mjs +4 -4
- package/dist/{chunk-4XLDBOSE.js → chunk-A7Y5YW7Q.js} +1 -1
- package/dist/{chunk-4XLDBOSE.js.map → chunk-A7Y5YW7Q.js.map} +1 -1
- package/dist/{chunk-ZYSNJKOP.js → chunk-DFA566KY.js} +4 -4
- package/dist/{chunk-ZYSNJKOP.js.map → chunk-DFA566KY.js.map} +1 -1
- package/dist/{chunk-DJXSCARG.js → chunk-I5BQLY7V.js} +9 -9
- package/dist/{chunk-DJXSCARG.js.map → chunk-I5BQLY7V.js.map} +1 -1
- package/dist/{chunk-RFKSJIQB.mjs → chunk-KMPBSOFB.mjs} +138 -5
- package/dist/chunk-KMPBSOFB.mjs.map +1 -0
- package/dist/{chunk-UOTHRJD2.mjs → chunk-OKBJEIOP.mjs} +1 -1
- package/dist/chunk-OKBJEIOP.mjs.map +1 -0
- package/dist/{chunk-PMESKNKL.js → chunk-OO2DBP6L.js} +1106 -973
- package/dist/chunk-OO2DBP6L.js.map +1 -0
- package/dist/{chunk-HAW5PNJG.mjs → chunk-TY5YWBLL.mjs} +3 -3
- package/dist/{chunk-RT7XFGIN.js → chunk-UGDYZW4K.js} +1035 -997
- package/dist/chunk-UGDYZW4K.js.map +1 -0
- package/dist/{chunk-RYY7USSW.mjs → chunk-YEZGASBX.mjs} +50 -12
- package/dist/{chunk-RYY7USSW.mjs.map → chunk-YEZGASBX.mjs.map} +1 -1
- package/dist/{chunk-OUEYZOLB.mjs → chunk-YVKWACDP.mjs} +2 -2
- package/dist/client/index.js +5 -5
- package/dist/client/index.mjs +4 -4
- package/dist/components/index.d.mts +3 -2
- package/dist/components/index.d.ts +3 -2
- package/dist/components/index.js +5 -5
- package/dist/components/index.mjs +4 -4
- package/dist/contexts/index.js +5 -5
- package/dist/contexts/index.mjs +4 -4
- package/dist/core/index.d.mts +92 -7
- package/dist/core/index.d.ts +92 -7
- package/dist/core/index.js +7 -3
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +6 -2
- package/dist/{email-automation-enrollment.fields-BZvF14qx.d.mts → email-automation-enrollment.fields-CPsgxLif.d.mts} +11 -1
- package/dist/{email-automation-enrollment.fields-Cp3VMzFq.d.ts → email-automation-enrollment.fields-CVicSamF.d.ts} +11 -1
- package/dist/email-automations/index.d.mts +19 -5
- package/dist/email-automations/index.d.ts +19 -5
- package/dist/email-automations/index.js +356 -129
- package/dist/email-automations/index.js.map +1 -1
- package/dist/email-automations/index.mjs +306 -79
- package/dist/email-automations/index.mjs.map +1 -1
- package/dist/features/analytics/index.js +121 -121
- package/dist/features/analytics/index.mjs +4 -4
- package/dist/features/analytics/server.js +5 -5
- package/dist/features/analytics/server.mjs +3 -3
- package/dist/features/blog/index.js +151 -151
- package/dist/features/blog/index.mjs +4 -4
- package/dist/features/blog/server.js +17 -17
- package/dist/features/blog/server.mjs +2 -2
- package/dist/features/help/index.js +38 -38
- package/dist/features/help/index.mjs +4 -4
- package/dist/features/tokenusage/index.js +127 -127
- package/dist/features/tokenusage/index.mjs +4 -4
- package/dist/index.d.mts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +8 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -3
- package/dist/offline/index.js +14 -14
- package/dist/offline/index.mjs +1 -1
- package/dist/{referral-admin.interface-RVO-ZTJz.d.mts → referral-admin.interface-DTj4LzXx.d.mts} +3 -0
- package/dist/{referral-admin.interface-CnytdDaQ.d.ts → referral-admin.interface-DeSCw3Pp.d.ts} +3 -0
- package/dist/server/index.js +4 -4
- package/dist/server/index.mjs +3 -3
- package/messages/en.json +35 -3
- package/messages/it.json +35 -3
- package/package.json +1 -1
- package/src/core/index.ts +1 -0
- package/src/core/registry/ModuleRegistry.ts +1 -0
- package/src/features/email-automation/EmailAutomationCandidateModule.ts +12 -0
- package/src/features/email-automation/EmailAutomationModule.ts +1 -0
- package/src/features/email-automation/components/__tests__/EmailAutomationEditor.spec.tsx +74 -9
- package/src/features/email-automation/components/forms/EmailAutomationAddPersonDialog.tsx +226 -0
- package/src/features/email-automation/components/forms/EmailAutomationEditor.tsx +23 -0
- package/src/features/email-automation/components/forms/EmailStepEditor.tsx +7 -3
- package/src/features/email-automation/components/index.ts +1 -0
- package/src/features/email-automation/components/lists/EmailAutomationRecipientsList.tsx +38 -20
- package/src/features/email-automation/components/lists/EmailAutomationsList.tsx +1 -0
- package/src/features/email-automation/components/unsubscribe/EmailUnsubscribe.tsx +9 -4
- package/src/features/email-automation/data/EmailAutomation.ts +9 -0
- package/src/features/email-automation/data/EmailAutomationCandidate.ts +66 -0
- package/src/features/email-automation/data/EmailAutomationCandidateInterface.ts +19 -0
- package/src/features/email-automation/data/EmailAutomationEnrollment.ts +16 -2
- package/src/features/email-automation/data/EmailAutomationEnrollmentInterface.ts +7 -0
- package/src/features/email-automation/data/EmailAutomationInterface.ts +3 -0
- package/src/features/email-automation/data/EmailAutomationService.ts +53 -1
- package/src/features/email-automation/data/EmailPurpose.ts +1 -0
- package/src/features/email-automation/data/__tests__/email-automation-models.spec.ts +70 -0
- package/src/features/email-automation/data/email-automation.fields.ts +1 -0
- package/src/features/email-automation/data/index.ts +2 -0
- package/src/features/email-automation/hooks/useEmailAutomationTableStructure.tsx +19 -0
- package/src/features/email-automation/index.ts +2 -0
- package/src/features/email-blast/EmailBlastModule.ts +1 -0
- package/src/features/email-blast/components/forms/EmailBlastEditor.tsx +33 -4
- package/src/features/email-blast/components/lists/EmailBlastsList.tsx +1 -0
- package/src/features/email-blast/data/EmailBlast.ts +10 -1
- package/src/features/email-blast/data/EmailBlastInterface.ts +3 -0
- package/src/features/email-blast/data/__tests__/EmailBlast.spec.ts +18 -0
- package/src/features/email-blast/data/email-blast.fields.ts +1 -0
- package/src/features/email-blast/hooks/useEmailBlastTableStructure.tsx +15 -0
- package/dist/chunk-PMESKNKL.js.map +0 -1
- package/dist/chunk-RFKSJIQB.mjs.map +0 -1
- package/dist/chunk-RT7XFGIN.js.map +0 -1
- package/dist/chunk-UOTHRJD2.mjs.map +0 -1
- /package/dist/{BlockNoteEditor-I3J6YYXK.mjs.map → BlockNoteEditor-HNP5UAJT.mjs.map} +0 -0
- /package/dist/{BlockNoteViewer-HIUAJQRI.mjs.map → BlockNoteViewer-X4UEVI2A.mjs.map} +0 -0
- /package/dist/{chunk-HAW5PNJG.mjs.map → chunk-TY5YWBLL.mjs.map} +0 -0
- /package/dist/{chunk-OUEYZOLB.mjs.map → chunk-YVKWACDP.mjs.map} +0 -0
package/dist/billing/index.js
CHANGED
|
@@ -81,11 +81,11 @@
|
|
|
81
81
|
|
|
82
82
|
|
|
83
83
|
|
|
84
|
-
var
|
|
84
|
+
var _chunkUGDYZW4Kjs = require('../chunk-UGDYZW4K.js');
|
|
85
85
|
require('../chunk-3EPNHTMH.js');
|
|
86
86
|
|
|
87
87
|
|
|
88
|
-
var
|
|
88
|
+
var _chunkI5BQLY7Vjs = require('../chunk-I5BQLY7V.js');
|
|
89
89
|
|
|
90
90
|
|
|
91
91
|
var _chunkG4JR3SFVjs = require('../chunk-G4JR3SFV.js');
|
|
@@ -112,13 +112,13 @@ var _chunkG4JR3SFVjs = require('../chunk-G4JR3SFV.js');
|
|
|
112
112
|
|
|
113
113
|
|
|
114
114
|
|
|
115
|
-
var
|
|
115
|
+
var _chunkOO2DBP6Ljs = require('../chunk-OO2DBP6L.js');
|
|
116
116
|
require('../chunk-DGN3PR2F.js');
|
|
117
117
|
|
|
118
118
|
|
|
119
119
|
|
|
120
120
|
|
|
121
|
-
var
|
|
121
|
+
var _chunkA7Y5YW7Qjs = require('../chunk-A7Y5YW7Q.js');
|
|
122
122
|
require('../chunk-KV4N7DEG.js');
|
|
123
123
|
require('../chunk-WCEYT3GG.js');
|
|
124
124
|
require('../chunk-WUNSG3IN.js');
|
|
@@ -132,7 +132,7 @@ var _chunk7QVYU63Ejs = require('../chunk-7QVYU63E.js');
|
|
|
132
132
|
var _nextintl = require('next-intl');
|
|
133
133
|
var _lucidereact = require('lucide-react');
|
|
134
134
|
var _jsxruntime = require('react/jsx-runtime');
|
|
135
|
-
var SUBSCRIPTION_STATUSES = Object.values(
|
|
135
|
+
var SUBSCRIPTION_STATUSES = Object.values(_chunkOO2DBP6Ljs.SubscriptionStatus);
|
|
136
136
|
function getStatusBadgeVariant(status) {
|
|
137
137
|
switch (status) {
|
|
138
138
|
case "active" /* ACTIVE */:
|
|
@@ -164,43 +164,43 @@ function SubscriptionSummaryCard({
|
|
|
164
164
|
onManageClick
|
|
165
165
|
}) {
|
|
166
166
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
167
|
-
const fmt =
|
|
167
|
+
const fmt = _chunkUGDYZW4Kjs.useBillingFormatOptions.call(void 0, );
|
|
168
168
|
if (loading) {
|
|
169
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
170
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
171
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
169
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.Card, { children: [
|
|
170
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
171
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.CardTitle, { children: t("billing.ui.subscriptions.title") }),
|
|
172
172
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
173
173
|
] }),
|
|
174
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
175
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
176
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
177
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
174
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.CardContent, { children: [
|
|
175
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
176
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Skeleton, { className: "h-4 w-24 mb-1" }),
|
|
177
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Skeleton, { className: "h-4 w-40" })
|
|
178
178
|
] })
|
|
179
179
|
] });
|
|
180
180
|
}
|
|
181
181
|
if (error) {
|
|
182
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
183
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
184
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
182
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.Card, { children: [
|
|
183
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
184
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.CardTitle, { children: t("billing.ui.subscriptions.title") }),
|
|
185
185
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
186
186
|
] }),
|
|
187
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
187
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
188
188
|
] });
|
|
189
189
|
}
|
|
190
190
|
const activeSubscriptions = subscriptions.filter(
|
|
191
191
|
(sub) => sub.status === "active" /* ACTIVE */ || sub.status === "trialing" /* TRIALING */ || sub.status === "past_due" /* PAST_DUE */
|
|
192
192
|
);
|
|
193
193
|
const primarySubscription = activeSubscriptions[0];
|
|
194
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
195
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
196
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
194
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
|
|
195
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
196
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.CardTitle, { children: t("billing.ui.subscriptions.title") }),
|
|
197
197
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
198
198
|
] }),
|
|
199
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
199
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.CardContent, { children: !primarySubscription ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
200
200
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: t("billing.ui.cards.subscriptions.empty_title") }),
|
|
201
201
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.subscriptions.empty_description") }),
|
|
202
202
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
203
|
-
|
|
203
|
+
_chunkUGDYZW4Kjs.Button,
|
|
204
204
|
{
|
|
205
205
|
variant: "outline",
|
|
206
206
|
size: "sm",
|
|
@@ -218,8 +218,8 @@ function SubscriptionSummaryCard({
|
|
|
218
218
|
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
219
219
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
220
220
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: formatPlanName(primarySubscription, t("billing.ui.cards.subscriptions.fallback_name")) }),
|
|
221
|
-
primarySubscription.status === "past_due" /* PAST_DUE */ ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
222
|
-
|
|
221
|
+
primarySubscription.status === "past_due" /* PAST_DUE */ ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Badge, { variant: "softRed", children: t("billing.ui.cards.subscriptions.payment_failing") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
222
|
+
_chunkUGDYZW4Kjs.Badge,
|
|
223
223
|
{
|
|
224
224
|
variant: primarySubscription.cancelAtPeriodEnd ? "secondary" : getStatusBadgeVariant(primarySubscription.status),
|
|
225
225
|
children: primarySubscription.cancelAtPeriodEnd ? t("billing.ui.cards.subscriptions.canceling") : SUBSCRIPTION_STATUSES.includes(primarySubscription.status) ? t(`billing.ui.subscription_status.${primarySubscription.status}`) : primarySubscription.status
|
|
@@ -227,11 +227,11 @@ function SubscriptionSummaryCard({
|
|
|
227
227
|
)
|
|
228
228
|
] }),
|
|
229
229
|
/* @__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", {
|
|
230
|
-
date:
|
|
230
|
+
date: _chunkUGDYZW4Kjs.formatDate.call(void 0, primarySubscription.currentPeriodEnd, fmt)
|
|
231
231
|
}) : primarySubscription.cancelAtPeriodEnd ? t("billing.ui.cards.subscriptions.cancels_on", {
|
|
232
|
-
date:
|
|
232
|
+
date: _chunkUGDYZW4Kjs.formatDate.call(void 0, primarySubscription.currentPeriodEnd, fmt)
|
|
233
233
|
}) : t("billing.ui.cards.subscriptions.renews_on", {
|
|
234
|
-
date:
|
|
234
|
+
date: _chunkUGDYZW4Kjs.formatDate.call(void 0, primarySubscription.currentPeriodEnd, fmt)
|
|
235
235
|
}) }),
|
|
236
236
|
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 }) })
|
|
237
237
|
] }) })
|
|
@@ -265,37 +265,37 @@ function PaymentMethodSummaryCard({
|
|
|
265
265
|
}) {
|
|
266
266
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
267
267
|
if (loading) {
|
|
268
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
269
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
270
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
268
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.Card, { children: [
|
|
269
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
270
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.CardTitle, { children: t("billing.ui.payment_method.title") }),
|
|
271
271
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
272
272
|
] }),
|
|
273
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
274
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
275
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
273
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.CardContent, { children: [
|
|
274
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
275
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Skeleton, { className: "h-4 w-24" })
|
|
276
276
|
] })
|
|
277
277
|
] });
|
|
278
278
|
}
|
|
279
279
|
if (error) {
|
|
280
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
281
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
282
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
280
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.Card, { children: [
|
|
281
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
282
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.CardTitle, { children: t("billing.ui.payment_method.title") }),
|
|
283
283
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
284
284
|
] }),
|
|
285
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
285
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
286
286
|
] });
|
|
287
287
|
}
|
|
288
288
|
const defaultMethod = paymentMethods.find((pm) => pm.id === defaultPaymentMethodId) || paymentMethods[0];
|
|
289
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
290
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
291
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
289
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
|
|
290
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
291
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.CardTitle, { children: t("billing.ui.payment_method.title") }),
|
|
292
292
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
293
293
|
] }),
|
|
294
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
294
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.CardContent, { children: paymentMethods.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
295
295
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: t("billing.ui.cards.payment_method.empty_title") }),
|
|
296
296
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.payment_method.empty_description") }),
|
|
297
297
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
298
|
-
|
|
298
|
+
_chunkUGDYZW4Kjs.Button,
|
|
299
299
|
{
|
|
300
300
|
variant: "outline",
|
|
301
301
|
size: "sm",
|
|
@@ -344,13 +344,13 @@ function formatBalance(balance, currency, locale) {
|
|
|
344
344
|
_chunk7QVYU63Ejs.__name.call(void 0, formatBalance, "formatBalance");
|
|
345
345
|
function CustomerInfoCard({ customer, loading, error }) {
|
|
346
346
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
347
|
-
const locale =
|
|
347
|
+
const locale = _chunkA7Y5YW7Qjs.useI18nLocale.call(void 0, );
|
|
348
348
|
const [portalLoading, setPortalLoading] = _react.useState.call(void 0, false);
|
|
349
349
|
const handlePortalClick = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async (e) => {
|
|
350
350
|
e.stopPropagation();
|
|
351
351
|
setPortalLoading(true);
|
|
352
352
|
try {
|
|
353
|
-
const { url } = await
|
|
353
|
+
const { url } = await _chunkOO2DBP6Ljs.StripeCustomerService.createPortalSession();
|
|
354
354
|
window.open(url, "_blank");
|
|
355
355
|
} catch (err) {
|
|
356
356
|
console.error("[CustomerInfoCard] Failed to create portal session:", err);
|
|
@@ -359,45 +359,45 @@ function CustomerInfoCard({ customer, loading, error }) {
|
|
|
359
359
|
}
|
|
360
360
|
}, "handlePortalClick");
|
|
361
361
|
if (loading) {
|
|
362
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
363
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
364
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
362
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.Card, { children: [
|
|
363
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
364
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.CardTitle, { children: t("billing.ui.cards.customer.title") }),
|
|
365
365
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
366
366
|
] }),
|
|
367
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
368
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
369
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
370
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
367
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.CardContent, { children: [
|
|
368
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
369
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Skeleton, { className: "h-4 w-48 mb-1" }),
|
|
370
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Skeleton, { className: "h-4 w-24" })
|
|
371
371
|
] })
|
|
372
372
|
] });
|
|
373
373
|
}
|
|
374
374
|
if (error) {
|
|
375
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
376
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
377
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
375
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.Card, { children: [
|
|
376
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
377
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.CardTitle, { children: t("billing.ui.cards.customer.title") }),
|
|
378
378
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
379
379
|
] }),
|
|
380
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
380
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
381
381
|
] });
|
|
382
382
|
}
|
|
383
383
|
if (!customer) {
|
|
384
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
385
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
386
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
384
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.Card, { children: [
|
|
385
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
386
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.CardTitle, { children: t("billing.ui.cards.customer.title") }),
|
|
387
387
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
388
388
|
] }),
|
|
389
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
389
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.CardContent, { children: [
|
|
390
390
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: t("billing.ui.cards.customer.not_set_up") }),
|
|
391
391
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.customer.not_set_up_description") })
|
|
392
392
|
] })
|
|
393
393
|
] });
|
|
394
394
|
}
|
|
395
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
396
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
397
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
395
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.Card, { children: [
|
|
396
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
397
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.CardTitle, { children: t("billing.ui.cards.customer.title") }),
|
|
398
398
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
399
399
|
] }),
|
|
400
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
400
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
401
401
|
customer.name && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: customer.name }),
|
|
402
402
|
customer.email && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: customer.email }),
|
|
403
403
|
customer.balance !== void 0 && customer.balance !== 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm", children: [
|
|
@@ -407,7 +407,7 @@ function CustomerInfoCard({ customer, loading, error }) {
|
|
|
407
407
|
] }),
|
|
408
408
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: customer.balance < 0 ? "text-success" : "text-destructive", children: formatBalance(customer.balance, customer.currency, locale) })
|
|
409
409
|
] }),
|
|
410
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
410
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.Button, { variant: "outline", size: "sm", className: "mt-2", onClick: handlePortalClick, disabled: portalLoading, children: [
|
|
411
411
|
portalLoading ? t("common.loading") : t("billing.ui.cards.customer.manage_portal"),
|
|
412
412
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ExternalLink, { className: "h-4 w-4 ms-1" })
|
|
413
413
|
] })
|
|
@@ -420,7 +420,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, CustomerInfoCard, "CustomerInfoCard");
|
|
|
420
420
|
|
|
421
421
|
|
|
422
422
|
|
|
423
|
-
var INVOICE_STATUSES = Object.values(
|
|
423
|
+
var INVOICE_STATUSES = Object.values(_chunkOO2DBP6Ljs.InvoiceStatus);
|
|
424
424
|
function getStatusBadgeVariant2(status) {
|
|
425
425
|
switch (status) {
|
|
426
426
|
case "paid" /* PAID */:
|
|
@@ -445,46 +445,46 @@ function formatAmount(amount, currency, locale) {
|
|
|
445
445
|
_chunk7QVYU63Ejs.__name.call(void 0, formatAmount, "formatAmount");
|
|
446
446
|
function InvoicesSummaryCard({ invoices, loading, error, onViewAllClick }) {
|
|
447
447
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
448
|
-
const fmt =
|
|
448
|
+
const fmt = _chunkUGDYZW4Kjs.useBillingFormatOptions.call(void 0, );
|
|
449
449
|
if (loading) {
|
|
450
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
451
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
452
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
450
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.Card, { children: [
|
|
451
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
452
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.CardTitle, { children: t("billing.ui.cards.invoices.title") }),
|
|
453
453
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
454
454
|
] }),
|
|
455
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
456
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
457
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
458
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
455
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.CardContent, { children: [
|
|
456
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Skeleton, { className: "h-6 w-24 mb-2" }),
|
|
457
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Skeleton, { className: "h-4 w-32 mb-1" }),
|
|
458
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Skeleton, { className: "h-4 w-20" })
|
|
459
459
|
] })
|
|
460
460
|
] });
|
|
461
461
|
}
|
|
462
462
|
if (error) {
|
|
463
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
464
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
465
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
463
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.Card, { children: [
|
|
464
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
465
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.CardTitle, { children: t("billing.ui.cards.invoices.title") }),
|
|
466
466
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
467
467
|
] }),
|
|
468
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
468
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
469
469
|
] });
|
|
470
470
|
}
|
|
471
471
|
const latestInvoice = _nullishCoalesce(invoices.find((inv) => inv.status !== "void" /* VOID */), () => ( invoices[0]));
|
|
472
472
|
const paidInvoices = invoices.filter((inv) => inv.status === "paid" /* PAID */);
|
|
473
473
|
const openInvoices = invoices.filter((inv) => inv.status === "open" /* OPEN */);
|
|
474
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
475
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
476
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
474
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewAllClick, children: [
|
|
475
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
476
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.CardTitle, { children: t("billing.ui.cards.invoices.title") }),
|
|
477
477
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
478
478
|
] }),
|
|
479
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
479
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.CardContent, { children: invoices.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
480
480
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: t("billing.ui.invoices.empty_title") }),
|
|
481
481
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.invoices.empty_description") })
|
|
482
482
|
] }) : latestInvoice ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
483
483
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
484
484
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: formatAmount(latestInvoice.total, latestInvoice.currency, fmt.locale) }),
|
|
485
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
485
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Badge, { variant: getStatusBadgeVariant2(latestInvoice.status), children: INVOICE_STATUSES.includes(latestInvoice.status) ? t(`billing.ui.invoice_status.${latestInvoice.status}`) : latestInvoice.status })
|
|
486
486
|
] }),
|
|
487
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: latestInvoice.stripeInvoiceNumber || t("billing.ui.cards.invoices.invoice_from", { date:
|
|
487
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: latestInvoice.stripeInvoiceNumber || t("billing.ui.cards.invoices.invoice_from", { date: _chunkUGDYZW4Kjs.formatDate.call(void 0, latestInvoice.periodStart, fmt) }) }),
|
|
488
488
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-4 text-xs text-muted-foreground", children: [
|
|
489
489
|
paidInvoices.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: t("billing.ui.cards.invoices.paid_count", { count: paidInvoices.length }) }),
|
|
490
490
|
openInvoices.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-warning", children: t("billing.ui.cards.invoices.open_count", { count: openInvoices.length }) }),
|
|
@@ -517,26 +517,26 @@ function BillingUsageSummaryCard({
|
|
|
517
517
|
onViewDetailsClick
|
|
518
518
|
}) {
|
|
519
519
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
520
|
-
const locale =
|
|
520
|
+
const locale = _chunkA7Y5YW7Qjs.useI18nLocale.call(void 0, );
|
|
521
521
|
if (loading) {
|
|
522
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
523
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
524
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
522
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.Card, { children: [
|
|
523
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
524
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.CardTitle, { children: t("billing.ui.cards.usage.title") }),
|
|
525
525
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
526
526
|
] }),
|
|
527
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
528
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
529
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
527
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.CardContent, { children: [
|
|
528
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Skeleton, { className: "h-6 w-24 mb-2" }),
|
|
529
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Skeleton, { className: "h-4 w-32" })
|
|
530
530
|
] })
|
|
531
531
|
] });
|
|
532
532
|
}
|
|
533
533
|
if (error) {
|
|
534
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
535
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
536
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
534
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.Card, { children: [
|
|
535
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
536
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.CardTitle, { children: t("billing.ui.cards.usage.title") }),
|
|
537
537
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
538
538
|
] }),
|
|
539
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
539
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
540
540
|
] });
|
|
541
541
|
}
|
|
542
542
|
const totalUsage = Object.values(summaries).reduce((acc, summary) => {
|
|
@@ -544,12 +544,12 @@ function BillingUsageSummaryCard({
|
|
|
544
544
|
}, 0);
|
|
545
545
|
const primaryMeter = meters.find((m) => _optionalChain([summaries, 'access', _17 => _17[m.id], 'optionalAccess', _18 => _18.aggregatedValue]));
|
|
546
546
|
const primarySummary = primaryMeter ? summaries[primaryMeter.id] : null;
|
|
547
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
548
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
549
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
547
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewDetailsClick, children: [
|
|
548
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
549
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.CardTitle, { children: t("billing.ui.cards.usage.title") }),
|
|
550
550
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
551
551
|
] }),
|
|
552
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
552
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.CardContent, { children: meters.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
553
553
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: t("billing.ui.cards.usage.no_meters") }),
|
|
554
554
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.usage.no_meters_description") })
|
|
555
555
|
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
@@ -606,7 +606,7 @@ function PaymentMethodForm({
|
|
|
606
606
|
const fetchSetupIntent = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
607
607
|
setLoading(true);
|
|
608
608
|
try {
|
|
609
|
-
const intent = await
|
|
609
|
+
const intent = await _chunkOO2DBP6Ljs.StripeCustomerService.createSetupIntent();
|
|
610
610
|
setSetupIntent(intent);
|
|
611
611
|
} catch (err) {
|
|
612
612
|
console.error("[PaymentMethodForm] Failed to create setup intent:", err);
|
|
@@ -644,7 +644,7 @@ function PaymentMethodForm({
|
|
|
644
644
|
return;
|
|
645
645
|
}
|
|
646
646
|
if ((alwaysSetDefault || setAsDefault) && _optionalChain([confirmedSetupIntent, 'optionalAccess', _19 => _19.payment_method])) {
|
|
647
|
-
await
|
|
647
|
+
await _chunkOO2DBP6Ljs.StripeCustomerService.setDefaultPaymentMethod({
|
|
648
648
|
paymentMethodId: typeof confirmedSetupIntent.payment_method === "string" ? confirmedSetupIntent.payment_method : confirmedSetupIntent.payment_method.id
|
|
649
649
|
});
|
|
650
650
|
}
|
|
@@ -660,7 +660,7 @@ function PaymentMethodForm({
|
|
|
660
660
|
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") }) });
|
|
661
661
|
}
|
|
662
662
|
if (!setupIntent && error) {
|
|
663
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
663
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.AlertDescription, { children: error }) });
|
|
664
664
|
}
|
|
665
665
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: handleSubmit, className: "flex flex-col gap-y-4", children: [
|
|
666
666
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rounded-md border border-gray-300 p-3", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -684,19 +684,19 @@ function PaymentMethodForm({
|
|
|
684
684
|
) }),
|
|
685
685
|
!alwaysSetDefault && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
686
686
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
687
|
-
|
|
687
|
+
_chunkUGDYZW4Kjs.Checkbox,
|
|
688
688
|
{
|
|
689
689
|
id: "setAsDefault",
|
|
690
690
|
checked: setAsDefault,
|
|
691
691
|
onCheckedChange: (checked) => setSetAsDefault(!!checked)
|
|
692
692
|
}
|
|
693
693
|
),
|
|
694
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
694
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Label, { htmlFor: "setAsDefault", className: "cursor-pointer font-normal", children: t("billing.ui.payment_form.set_default") })
|
|
695
695
|
] }),
|
|
696
|
-
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
696
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.AlertDescription, { children: error }) }),
|
|
697
697
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-x-2", children: [
|
|
698
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
699
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
698
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Button, { type: "button", variant: "outline", onClick: onCancel, disabled: isSubmitting || isLoading, children: t("ui.buttons.cancel") }),
|
|
699
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Button, { type: "submit", disabled: !stripe || isSubmitting || isLoading, children: isSubmitting ? t("billing.ui.wizard.review.processing") : t("billing.ui.cards.payment_method.add_card") })
|
|
700
700
|
] })
|
|
701
701
|
] });
|
|
702
702
|
}
|
|
@@ -713,10 +713,10 @@ function PaymentMethodEditor({ open, onOpenChange, onSuccess }) {
|
|
|
713
713
|
const handleCancel = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
714
714
|
onOpenChange(false);
|
|
715
715
|
}, "handleCancel");
|
|
716
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
717
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
718
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
719
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
716
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.DialogContent, { className: "max-w-md", children: [
|
|
717
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.DialogHeader, { children: [
|
|
718
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.DialogTitle, { children: t("billing.ui.payment_methods.add") }),
|
|
719
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.DialogDescription, { children: t("billing.ui.payment_methods.add_description") })
|
|
720
720
|
] }),
|
|
721
721
|
open && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodForm, { onSuccess: handleSuccess, onCancel: handleCancel })
|
|
722
722
|
] }) });
|
|
@@ -742,7 +742,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
742
742
|
_react.useEffect.call(void 0, () => {
|
|
743
743
|
const loadCustomer = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
744
744
|
try {
|
|
745
|
-
const fetchedCustomer = await
|
|
745
|
+
const fetchedCustomer = await _chunkOO2DBP6Ljs.StripeCustomerService.getCustomer();
|
|
746
746
|
setCustomer(fetchedCustomer);
|
|
747
747
|
} catch (error) {
|
|
748
748
|
console.error("[PaymentMethodCard] Failed to load customer:", error);
|
|
@@ -759,7 +759,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
759
759
|
const handleSetDefault = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
760
760
|
setLoading(true);
|
|
761
761
|
try {
|
|
762
|
-
await
|
|
762
|
+
await _chunkOO2DBP6Ljs.StripeCustomerService.setDefaultPaymentMethod({ paymentMethodId: paymentMethod.id });
|
|
763
763
|
onUpdate();
|
|
764
764
|
} catch (error) {
|
|
765
765
|
console.error("[PaymentMethodCard] Failed to set as default:", error);
|
|
@@ -770,7 +770,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
770
770
|
const handleRemove = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
771
771
|
setLoading(true);
|
|
772
772
|
try {
|
|
773
|
-
await
|
|
773
|
+
await _chunkOO2DBP6Ljs.StripeCustomerService.removePaymentMethod({ paymentMethodId: paymentMethod.id });
|
|
774
774
|
setShowRemoveDialog(false);
|
|
775
775
|
onUpdate();
|
|
776
776
|
} catch (error) {
|
|
@@ -779,16 +779,16 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
779
779
|
}
|
|
780
780
|
}, "handleRemove");
|
|
781
781
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
782
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
783
|
-
isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
784
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
782
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.Card, { className: "relative", children: [
|
|
783
|
+
isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Badge, { variant: "softGreen", className: "absolute end-2 top-2", children: t("billing.ui.payment_methods.default") }),
|
|
784
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.CardHeader, { className: "flex flex-row items-center justify-between pb-2", children: [
|
|
785
785
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
786
786
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-2xl", children: brandIcon }),
|
|
787
787
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium capitalize", children: brand })
|
|
788
788
|
] }),
|
|
789
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
790
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
791
|
-
|
|
789
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.DropdownMenu, { children: [
|
|
790
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.DropdownMenuTrigger, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
791
|
+
_chunkUGDYZW4Kjs.Button,
|
|
792
792
|
{
|
|
793
793
|
render: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {}),
|
|
794
794
|
nativeButton: false,
|
|
@@ -799,10 +799,10 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
799
799
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.MoreVertical, { className: "h-4 w-4" })
|
|
800
800
|
}
|
|
801
801
|
) }),
|
|
802
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
803
|
-
!isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
802
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.DropdownMenuContent, { align: "end", children: [
|
|
803
|
+
!isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.DropdownMenuItem, { onClick: handleSetDefault, disabled: loading, children: t("billing.ui.payment_methods.set_default") }),
|
|
804
804
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
805
|
-
|
|
805
|
+
_chunkUGDYZW4Kjs.DropdownMenuItem,
|
|
806
806
|
{
|
|
807
807
|
onClick: () => setShowRemoveDialog(true),
|
|
808
808
|
disabled: loading,
|
|
@@ -813,7 +813,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
813
813
|
] })
|
|
814
814
|
] })
|
|
815
815
|
] }),
|
|
816
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
816
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-1", children: [
|
|
817
817
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-lg font-semibold", children: [
|
|
818
818
|
"\u2022\u2022\u2022\u2022 ",
|
|
819
819
|
last4
|
|
@@ -821,17 +821,17 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
821
821
|
/* @__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}` }) })
|
|
822
822
|
] }) })
|
|
823
823
|
] }),
|
|
824
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
825
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
826
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
827
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
824
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.AlertDialog, { open: showRemoveDialog, onOpenChange: setShowRemoveDialog, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.AlertDialogContent, { children: [
|
|
825
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.AlertDialogHeader, { children: [
|
|
826
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.AlertDialogTitle, { children: t("billing.ui.payment_methods.remove_title") }),
|
|
827
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.AlertDialogDescription, { children: [
|
|
828
828
|
t("billing.ui.payment_methods.remove_description"),
|
|
829
829
|
isDefault && ` ${t("billing.ui.payment_methods.remove_default_warning")}`
|
|
830
830
|
] })
|
|
831
831
|
] }),
|
|
832
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
833
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
834
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
832
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.AlertDialogFooter, { children: [
|
|
833
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.AlertDialogCancel, { disabled: loading, children: t("ui.buttons.cancel") }),
|
|
834
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.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") })
|
|
835
835
|
] })
|
|
836
836
|
] }) })
|
|
837
837
|
] });
|
|
@@ -855,7 +855,7 @@ function PaymentMethodsContainer() {
|
|
|
855
855
|
const loadPaymentMethods = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
856
856
|
setLoading(true);
|
|
857
857
|
try {
|
|
858
|
-
const fetchedPaymentMethods = await
|
|
858
|
+
const fetchedPaymentMethods = await _chunkOO2DBP6Ljs.StripeCustomerService.listPaymentMethods();
|
|
859
859
|
setPaymentMethods(fetchedPaymentMethods);
|
|
860
860
|
} catch (error) {
|
|
861
861
|
console.error("[PaymentMethodsContainer] Failed to load payment methods:", error);
|
|
@@ -875,14 +875,14 @@ function PaymentMethodsContainer() {
|
|
|
875
875
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8" }),
|
|
876
876
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: t("billing.ui.payment_methods.title") })
|
|
877
877
|
] }),
|
|
878
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
878
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Button, { onClick: () => setShowAddPaymentMethod(true), children: t("billing.ui.payment_methods.add") })
|
|
879
879
|
] }),
|
|
880
880
|
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: [
|
|
881
881
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-16 w-16 text-muted-foreground" }),
|
|
882
882
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
883
883
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "mb-2 text-sm font-medium", children: t("billing.ui.payment_methods.empty_title") }),
|
|
884
884
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mb-4 text-muted-foreground", children: t("billing.ui.payment_methods.empty_description") }),
|
|
885
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
885
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Button, { onClick: () => setShowAddPaymentMethod(true), children: t("billing.ui.payment_methods.add_first") })
|
|
886
886
|
] })
|
|
887
887
|
] }),
|
|
888
888
|
paymentMethods.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodsList, { paymentMethods, onUpdate: loadPaymentMethods }),
|
|
@@ -938,7 +938,7 @@ var statusConfig = {
|
|
|
938
938
|
function InvoiceStatusBadge({ status }) {
|
|
939
939
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
940
940
|
const config = statusConfig[status] || statusConfig["draft" /* DRAFT */];
|
|
941
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
941
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Badge, { variant: config.variant, children: t(config.label) });
|
|
942
942
|
}
|
|
943
943
|
_chunk7QVYU63Ejs.__name.call(void 0, InvoiceStatusBadge, "InvoiceStatusBadge");
|
|
944
944
|
|
|
@@ -951,7 +951,7 @@ function InvoiceDetails({
|
|
|
951
951
|
onInvoiceChange: _onInvoiceChange
|
|
952
952
|
}) {
|
|
953
953
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
954
|
-
const fmt =
|
|
954
|
+
const fmt = _chunkUGDYZW4Kjs.useBillingFormatOptions.call(void 0, );
|
|
955
955
|
const handleDownloadPDF = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
956
956
|
if (invoice.stripePdfUrl) {
|
|
957
957
|
window.open(invoice.stripePdfUrl, "_blank");
|
|
@@ -971,10 +971,10 @@ function InvoiceDetails({
|
|
|
971
971
|
return invoice.stripeInvoiceId.slice(-8);
|
|
972
972
|
}, "getInvoiceNumber");
|
|
973
973
|
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");
|
|
974
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
975
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
976
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
977
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
974
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.DialogContent, { className: "max-w-2xl", children: [
|
|
975
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.DialogHeader, { children: [
|
|
976
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.DialogTitle, { children: t("billing.ui.invoice.title", { number: getInvoiceNumber() }) }),
|
|
977
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.DialogDescription, { children: _chunkUGDYZW4Kjs.formatDate.call(void 0, invoice.periodStart, fmt) })
|
|
978
978
|
] }),
|
|
979
979
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
980
980
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
@@ -985,18 +985,18 @@ function InvoiceDetails({
|
|
|
985
985
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
986
986
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.billing_period") }),
|
|
987
987
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm", children: [
|
|
988
|
-
|
|
988
|
+
_chunkUGDYZW4Kjs.formatDate.call(void 0, invoice.periodStart, fmt),
|
|
989
989
|
" - ",
|
|
990
|
-
|
|
990
|
+
_chunkUGDYZW4Kjs.formatDate.call(void 0, invoice.periodEnd, fmt)
|
|
991
991
|
] })
|
|
992
992
|
] }),
|
|
993
993
|
invoice.dueDate && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
994
994
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.due_date") }),
|
|
995
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm", children:
|
|
995
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm", children: _chunkUGDYZW4Kjs.formatDate.call(void 0, invoice.dueDate, fmt) })
|
|
996
996
|
] }),
|
|
997
997
|
invoice.paidAt && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
998
998
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.paid_date") }),
|
|
999
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm", children:
|
|
999
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm", children: _chunkUGDYZW4Kjs.formatDate.call(void 0, invoice.paidAt, fmt) })
|
|
1000
1000
|
] }),
|
|
1001
1001
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
1002
1002
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.attempt_count") }),
|
|
@@ -1012,42 +1012,42 @@ function InvoiceDetails({
|
|
|
1012
1012
|
] }) }),
|
|
1013
1013
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "tbody", { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "tr", { className: "border-t", children: [
|
|
1014
1014
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "td", { className: "p-3", children: productName }),
|
|
1015
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "td", { className: "p-3 text-end", children:
|
|
1015
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "td", { className: "p-3 text-end", children: _chunkOO2DBP6Ljs.formatCurrency.call(void 0, invoice.subtotal, invoice.currency, fmt) })
|
|
1016
1016
|
] }) })
|
|
1017
1017
|
] }) })
|
|
1018
1018
|
] }),
|
|
1019
1019
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2 border-t pt-4", children: [
|
|
1020
1020
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1021
1021
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.subtotal") }),
|
|
1022
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children:
|
|
1022
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children: _chunkOO2DBP6Ljs.formatCurrency.call(void 0, invoice.subtotal, invoice.currency, fmt) })
|
|
1023
1023
|
] }),
|
|
1024
1024
|
invoice.tax !== void 0 && invoice.tax > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1025
1025
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.tax") }),
|
|
1026
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children:
|
|
1026
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children: _chunkOO2DBP6Ljs.formatCurrency.call(void 0, invoice.tax, invoice.currency, fmt) })
|
|
1027
1027
|
] }),
|
|
1028
1028
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between text-lg font-semibold border-t pt-2", children: [
|
|
1029
1029
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: t("billing.ui.invoice.total") }),
|
|
1030
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children:
|
|
1030
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _chunkOO2DBP6Ljs.formatCurrency.call(void 0, invoice.total, invoice.currency, fmt) })
|
|
1031
1031
|
] }),
|
|
1032
1032
|
invoice.amountPaid > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1033
1033
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.amount_paid") }),
|
|
1034
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-success", children:
|
|
1034
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-success", children: _chunkOO2DBP6Ljs.formatCurrency.call(void 0, invoice.amountPaid, invoice.currency, fmt) })
|
|
1035
1035
|
] }),
|
|
1036
1036
|
invoice.amountRemaining > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1037
1037
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.amount_due") }),
|
|
1038
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-destructive", children:
|
|
1038
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-destructive", children: _chunkOO2DBP6Ljs.formatCurrency.call(void 0, invoice.amountRemaining, invoice.currency, fmt) })
|
|
1039
1039
|
] })
|
|
1040
1040
|
] }),
|
|
1041
1041
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2 pt-4 border-t", children: [
|
|
1042
|
-
invoice.stripePdfUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1042
|
+
invoice.stripePdfUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.Button, { variant: "outline", onClick: handleDownloadPDF, children: [
|
|
1043
1043
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Download, { className: "me-2 h-4 w-4" }),
|
|
1044
1044
|
t("billing.ui.invoice.download_pdf")
|
|
1045
1045
|
] }),
|
|
1046
|
-
invoice.status === "open" /* OPEN */ && invoice.attempted && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1046
|
+
invoice.status === "open" /* OPEN */ && invoice.attempted && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.Button, { variant: "default", onClick: handleRetryPayment, children: [
|
|
1047
1047
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RefreshCw, { className: "me-2 h-4 w-4" }),
|
|
1048
1048
|
t("billing.ui.invoice.retry_payment")
|
|
1049
1049
|
] }),
|
|
1050
|
-
invoice.stripeHostedInvoiceUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1050
|
+
invoice.stripeHostedInvoiceUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.Button, { variant: "outline", onClick: handleViewInStripe, children: [
|
|
1051
1051
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ExternalLink, { className: "me-2 h-4 w-4" }),
|
|
1052
1052
|
t("billing.ui.invoice.view_in_stripe")
|
|
1053
1053
|
] })
|
|
@@ -1061,7 +1061,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, InvoiceDetails, "InvoiceDetails");
|
|
|
1061
1061
|
|
|
1062
1062
|
function InvoicesList({ invoices, onInvoicesChange }) {
|
|
1063
1063
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1064
|
-
const fmt =
|
|
1064
|
+
const fmt = _chunkUGDYZW4Kjs.useBillingFormatOptions.call(void 0, );
|
|
1065
1065
|
const [selectedInvoice, setSelectedInvoice] = _react.useState.call(void 0, null);
|
|
1066
1066
|
const handleRowClick = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (invoice) => {
|
|
1067
1067
|
setSelectedInvoice(invoice);
|
|
@@ -1073,30 +1073,30 @@ function InvoicesList({ invoices, onInvoicesChange }) {
|
|
|
1073
1073
|
return invoice.stripeInvoiceId.slice(-8);
|
|
1074
1074
|
}, "getInvoiceNumber");
|
|
1075
1075
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1076
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1077
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1078
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1079
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1080
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1081
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1082
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1076
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.Table, { children: [
|
|
1077
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.TableRow, { children: [
|
|
1078
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.TableHead, { children: t("billing.ui.columns.invoice_number") }),
|
|
1079
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.TableHead, { children: t("billing.ui.columns.date") }),
|
|
1080
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.TableHead, { children: t("billing.ui.columns.status") }),
|
|
1081
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.TableHead, { className: "text-end", children: t("billing.ui.columns.amount") }),
|
|
1082
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.TableHead, { children: t("billing.ui.columns.period") })
|
|
1083
1083
|
] }) }),
|
|
1084
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1084
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.TableBody, { children: invoices.map((invoice) => {
|
|
1085
1085
|
const invoiceNumber = getInvoiceNumber(invoice);
|
|
1086
|
-
const date =
|
|
1087
|
-
const amount =
|
|
1088
|
-
const period = `${
|
|
1086
|
+
const date = _chunkUGDYZW4Kjs.formatDate.call(void 0, invoice.periodStart, fmt);
|
|
1087
|
+
const amount = _chunkOO2DBP6Ljs.formatCurrency.call(void 0, invoice.total, invoice.currency, fmt);
|
|
1088
|
+
const period = `${_chunkUGDYZW4Kjs.formatDate.call(void 0, invoice.periodStart, fmt)} - ${_chunkUGDYZW4Kjs.formatDate.call(void 0, invoice.periodEnd, fmt)}`;
|
|
1089
1089
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1090
|
-
|
|
1090
|
+
_chunkUGDYZW4Kjs.TableRow,
|
|
1091
1091
|
{
|
|
1092
1092
|
onClick: () => handleRowClick(invoice),
|
|
1093
1093
|
className: "cursor-pointer hover:bg-muted/50",
|
|
1094
1094
|
children: [
|
|
1095
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1096
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1097
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1098
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1099
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1095
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.TableCell, { className: "font-medium", children: invoiceNumber }),
|
|
1096
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.TableCell, { className: "text-muted-foreground text-xs", children: date }),
|
|
1097
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InvoiceStatusBadge, { status: invoice.status }) }),
|
|
1098
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.TableCell, { className: "text-end font-medium", children: amount }),
|
|
1099
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.TableCell, { className: "text-muted-foreground text-xs", children: period })
|
|
1100
1100
|
]
|
|
1101
1101
|
},
|
|
1102
1102
|
invoice.id
|
|
@@ -1130,7 +1130,7 @@ function InvoicesContainer() {
|
|
|
1130
1130
|
setLoading(true);
|
|
1131
1131
|
try {
|
|
1132
1132
|
const params = statusFilter !== "all" ? { status: statusFilter } : void 0;
|
|
1133
|
-
const data = await
|
|
1133
|
+
const data = await _chunkOO2DBP6Ljs.StripeInvoiceService.listInvoices(params);
|
|
1134
1134
|
setInvoices(data);
|
|
1135
1135
|
} catch (error) {
|
|
1136
1136
|
console.error("[InvoicesContainer] Failed to load invoices:", error);
|
|
@@ -1146,12 +1146,12 @@ function InvoicesContainer() {
|
|
|
1146
1146
|
setStatusFilter(value);
|
|
1147
1147
|
}, "handleFilterChange");
|
|
1148
1148
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-4", children: [
|
|
1149
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1150
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1151
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1152
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1153
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1154
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1149
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Tabs, { value: statusFilter, onValueChange: handleFilterChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.TabsList, { children: [
|
|
1150
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.TabsTrigger, { value: "all", children: t("billing.ui.invoices.filter_all") }),
|
|
1151
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.TabsTrigger, { value: "paid" /* PAID */, children: t("billing.ui.invoice_status.paid") }),
|
|
1152
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.TabsTrigger, { value: "open" /* OPEN */, children: t("billing.ui.invoice_status.open") }),
|
|
1153
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.TabsTrigger, { value: "void" /* VOID */, children: t("billing.ui.invoice_status.void") }),
|
|
1154
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.TabsTrigger, { value: "uncollectible" /* UNCOLLECTIBLE */, children: t("billing.ui.invoice_status.uncollectible") })
|
|
1155
1155
|
] }) }),
|
|
1156
1156
|
loading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-center py-8 text-muted-foreground", children: t("billing.ui.invoices.loading") }),
|
|
1157
1157
|
!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: [
|
|
@@ -1193,7 +1193,7 @@ function CancelSubscriptionDialog({
|
|
|
1193
1193
|
onSuccess
|
|
1194
1194
|
}) {
|
|
1195
1195
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1196
|
-
const fmt =
|
|
1196
|
+
const fmt = _chunkUGDYZW4Kjs.useBillingFormatOptions.call(void 0, );
|
|
1197
1197
|
const [isSubmitting, setIsSubmitting] = _react.useState.call(void 0, false);
|
|
1198
1198
|
const form = _reacthookform.useForm.call(void 0, {
|
|
1199
1199
|
resolver: _zod.zodResolver.call(void 0, formSchema),
|
|
@@ -1204,7 +1204,7 @@ function CancelSubscriptionDialog({
|
|
|
1204
1204
|
const onSubmit = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async (_values) => {
|
|
1205
1205
|
setIsSubmitting(true);
|
|
1206
1206
|
try {
|
|
1207
|
-
await
|
|
1207
|
+
await _chunkOO2DBP6Ljs.StripeSubscriptionService.cancelSubscription({
|
|
1208
1208
|
id: subscription.id,
|
|
1209
1209
|
cancelImmediately: false
|
|
1210
1210
|
});
|
|
@@ -1216,16 +1216,16 @@ function CancelSubscriptionDialog({
|
|
|
1216
1216
|
setIsSubmitting(false);
|
|
1217
1217
|
}
|
|
1218
1218
|
}, "onSubmit");
|
|
1219
|
-
const periodEndDate =
|
|
1220
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1221
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1222
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1223
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1219
|
+
const periodEndDate = _chunkUGDYZW4Kjs.formatDate.call(void 0, subscription.currentPeriodEnd, fmt);
|
|
1220
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.DialogContent, { className: "max-w-md", children: [
|
|
1221
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.DialogHeader, { children: [
|
|
1222
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.DialogTitle, { children: t("billing.ui.subscription.cancel.title") }),
|
|
1223
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.DialogDescription, { children: t("billing.ui.subscription.cancel.description") })
|
|
1224
1224
|
] }),
|
|
1225
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1225
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-col gap-y-4", children: [
|
|
1226
1226
|
/* @__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 }) }),
|
|
1227
1227
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1228
|
-
|
|
1228
|
+
_chunkUGDYZW4Kjs.FormTextarea,
|
|
1229
1229
|
{
|
|
1230
1230
|
form,
|
|
1231
1231
|
id: "reason",
|
|
@@ -1235,8 +1235,8 @@ function CancelSubscriptionDialog({
|
|
|
1235
1235
|
}
|
|
1236
1236
|
),
|
|
1237
1237
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-x-2 justify-end pt-2", children: [
|
|
1238
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1239
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1238
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Button, { type: "button", variant: "outline", onClick: () => onOpenChange(false), disabled: isSubmitting, children: t("billing.ui.subscription.cancel.keep") }),
|
|
1239
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Button, { type: "submit", variant: "destructive", disabled: isSubmitting, children: isSubmitting ? t("billing.ui.subscription.cancel.canceling") : t("billing.ui.subscription.cancel.confirm") })
|
|
1240
1240
|
] })
|
|
1241
1241
|
] }) })
|
|
1242
1242
|
] }) });
|
|
@@ -1287,7 +1287,7 @@ var cancelingConfig = {
|
|
|
1287
1287
|
function SubscriptionStatusBadge({ status, cancelAtPeriodEnd }) {
|
|
1288
1288
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1289
1289
|
const config = cancelAtPeriodEnd ? cancelingConfig : statusConfig2[status] || statusConfig2["canceled" /* CANCELED */];
|
|
1290
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1290
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Badge, { variant: config.variant, children: t(config.label) });
|
|
1291
1291
|
}
|
|
1292
1292
|
_chunk7QVYU63Ejs.__name.call(void 0, SubscriptionStatusBadge, "SubscriptionStatusBadge");
|
|
1293
1293
|
|
|
@@ -1314,7 +1314,7 @@ function formatPlanName2(price, t) {
|
|
|
1314
1314
|
_chunk7QVYU63Ejs.__name.call(void 0, formatPlanName2, "formatPlanName");
|
|
1315
1315
|
function formatBillingAmount(price, notAvailable, fmt) {
|
|
1316
1316
|
if (!_optionalChain([price, 'optionalAccess', _37 => _37.unitAmount])) return notAvailable;
|
|
1317
|
-
return
|
|
1317
|
+
return _chunkOO2DBP6Ljs.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt);
|
|
1318
1318
|
}
|
|
1319
1319
|
_chunk7QVYU63Ejs.__name.call(void 0, formatBillingAmount, "formatBillingAmount");
|
|
1320
1320
|
function SubscriptionDetails({
|
|
@@ -1326,11 +1326,11 @@ function SubscriptionDetails({
|
|
|
1326
1326
|
renderCancelDialog
|
|
1327
1327
|
}) {
|
|
1328
1328
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1329
|
-
const fmt =
|
|
1329
|
+
const fmt = _chunkUGDYZW4Kjs.useBillingFormatOptions.call(void 0, );
|
|
1330
1330
|
const [showCancel, setShowCancel] = _react.useState.call(void 0, false);
|
|
1331
1331
|
const handleManageViaPortal = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1332
1332
|
try {
|
|
1333
|
-
const { url } = await
|
|
1333
|
+
const { url } = await _chunkOO2DBP6Ljs.StripeCustomerService.createPortalSession();
|
|
1334
1334
|
window.open(url, "_blank");
|
|
1335
1335
|
} catch (error) {
|
|
1336
1336
|
console.error("[SubscriptionDetails] Failed to create portal session:", error);
|
|
@@ -1338,10 +1338,10 @@ function SubscriptionDetails({
|
|
|
1338
1338
|
}, "handleManageViaPortal");
|
|
1339
1339
|
const canCancel = subscription.status === "active" /* ACTIVE */ || subscription.status === "trialing" /* TRIALING */ || subscription.status === "paused" /* PAUSED */;
|
|
1340
1340
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1341
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1342
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1343
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1344
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1341
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.DialogContent, { className: "max-w-2xl", children: [
|
|
1342
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.DialogHeader, { children: [
|
|
1343
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.DialogTitle, { children: t("billing.ui.subscription.details_title") }),
|
|
1344
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.DialogDescription, { children: t("billing.ui.subscription.details_description") })
|
|
1345
1345
|
] }),
|
|
1346
1346
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
1347
1347
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
@@ -1367,22 +1367,22 @@ function SubscriptionDetails({
|
|
|
1367
1367
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "space-y-2", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1368
1368
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.subscription.current_period") }),
|
|
1369
1369
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "text-sm", children: [
|
|
1370
|
-
|
|
1370
|
+
_chunkUGDYZW4Kjs.formatDate.call(void 0, subscription.currentPeriodStart, fmt),
|
|
1371
1371
|
" - ",
|
|
1372
|
-
|
|
1372
|
+
_chunkUGDYZW4Kjs.formatDate.call(void 0, subscription.currentPeriodEnd, fmt)
|
|
1373
1373
|
] })
|
|
1374
1374
|
] }) }),
|
|
1375
1375
|
subscription.trialEnd && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1376
1376
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.subscription.trial_ends") }),
|
|
1377
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children:
|
|
1377
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children: _chunkUGDYZW4Kjs.formatDate.call(void 0, subscription.trialEnd, fmt) })
|
|
1378
1378
|
] }),
|
|
1379
1379
|
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", {
|
|
1380
|
-
date:
|
|
1380
|
+
date: _chunkUGDYZW4Kjs.formatDate.call(void 0, subscription.currentPeriodEnd, fmt)
|
|
1381
1381
|
}) }) }),
|
|
1382
1382
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2 pt-4 border-t", children: [
|
|
1383
|
-
onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1384
|
-
canCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1385
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1383
|
+
onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Button, { variant: "default", onClick: () => onChangePlan(subscription), children: t("billing.ui.subscription.change_plan") }),
|
|
1384
|
+
canCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Button, { variant: "destructive", onClick: () => setShowCancel(true), children: t("ui.buttons.cancel") }),
|
|
1385
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Button, { variant: "outline", onClick: handleManageViaPortal, children: t("billing.ui.subscription.manage_portal") })
|
|
1386
1386
|
] })
|
|
1387
1387
|
] })
|
|
1388
1388
|
] }) }),
|
|
@@ -1442,46 +1442,46 @@ function SubscriptionsList({
|
|
|
1442
1442
|
renderCancelDialog
|
|
1443
1443
|
}) {
|
|
1444
1444
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1445
|
-
const fmt =
|
|
1445
|
+
const fmt = _chunkUGDYZW4Kjs.useBillingFormatOptions.call(void 0, );
|
|
1446
1446
|
const [selectedSub, setSelectedSub] = _react.useState.call(void 0, null);
|
|
1447
1447
|
const handleRowClick = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (subscription) => {
|
|
1448
1448
|
setSelectedSub(subscription);
|
|
1449
1449
|
}, "handleRowClick");
|
|
1450
1450
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1451
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1452
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1453
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1454
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1455
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1456
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1457
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1451
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.Table, { children: [
|
|
1452
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.TableRow, { children: [
|
|
1453
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.TableHead, { children: t("billing.ui.columns.status") }),
|
|
1454
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.TableHead, { children: t("billing.ui.columns.plan") }),
|
|
1455
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.TableHead, { children: t("billing.ui.columns.period") }),
|
|
1456
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.TableHead, { className: "text-end", children: t("billing.ui.columns.amount") }),
|
|
1457
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.TableHead, { className: "text-end", children: t("billing.ui.columns.actions") })
|
|
1458
1458
|
] }) }),
|
|
1459
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1459
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.TableBody, { children: subscriptions.map((subscription) => {
|
|
1460
1460
|
const price = subscription.price;
|
|
1461
|
-
const amount = _optionalChain([price, 'optionalAccess', _42 => _42.unitAmount]) ?
|
|
1462
|
-
const discountedAmount = price ?
|
|
1463
|
-
const period = `${
|
|
1461
|
+
const amount = _optionalChain([price, 'optionalAccess', _42 => _42.unitAmount]) ? _chunkOO2DBP6Ljs.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt) : "0";
|
|
1462
|
+
const discountedAmount = price ? _chunkUGDYZW4Kjs.applyDiscount.call(void 0, price.unitAmount, _chunkUGDYZW4Kjs.subscriptionDiscount.call(void 0, subscription)) : null;
|
|
1463
|
+
const period = `${_chunkUGDYZW4Kjs.formatDate.call(void 0, subscription.currentPeriodStart, fmt)} - ${_chunkUGDYZW4Kjs.formatDate.call(void 0, subscription.currentPeriodEnd, fmt)}`;
|
|
1464
1464
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1465
|
-
|
|
1465
|
+
_chunkUGDYZW4Kjs.TableRow,
|
|
1466
1466
|
{
|
|
1467
1467
|
onClick: () => handleRowClick(subscription),
|
|
1468
1468
|
className: "cursor-pointer hover:bg-muted/50",
|
|
1469
1469
|
children: [
|
|
1470
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1470
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1471
1471
|
SubscriptionStatusBadge,
|
|
1472
1472
|
{
|
|
1473
1473
|
status: subscription.status,
|
|
1474
1474
|
cancelAtPeriodEnd: subscription.cancelAtPeriodEnd
|
|
1475
1475
|
}
|
|
1476
1476
|
) }),
|
|
1477
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1478
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1479
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1477
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.TableCell, { className: "font-medium", children: formatPlanName3(price, t) }),
|
|
1478
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.TableCell, { className: "text-muted-foreground text-sm", children: period }),
|
|
1479
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.TableCell, { className: "text-end font-medium", children: discountedAmount !== null && price ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1480
1480
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "line-through text-muted-foreground me-2", children: amount }),
|
|
1481
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success", children:
|
|
1481
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success", children: _chunkOO2DBP6Ljs.formatCurrency.call(void 0, discountedAmount, price.currency, fmt) })
|
|
1482
1482
|
] }) : amount }),
|
|
1483
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1484
|
-
|
|
1483
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.TableCell, { className: "text-end", children: (subscription.status === "active" /* ACTIVE */ || subscription.status === "trialing" /* TRIALING */) && onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1484
|
+
_chunkUGDYZW4Kjs.Button,
|
|
1485
1485
|
{
|
|
1486
1486
|
size: "sm",
|
|
1487
1487
|
variant: "outline",
|
|
@@ -1541,7 +1541,7 @@ function SubscriptionsContainer({
|
|
|
1541
1541
|
}
|
|
1542
1542
|
setLoading(true);
|
|
1543
1543
|
try {
|
|
1544
|
-
const fetchedSubscriptions = await
|
|
1544
|
+
const fetchedSubscriptions = await _chunkOO2DBP6Ljs.StripeSubscriptionService.listSubscriptions();
|
|
1545
1545
|
setSubscriptions(fetchedSubscriptions);
|
|
1546
1546
|
} catch (error) {
|
|
1547
1547
|
console.error("[SubscriptionsContainer] Failed to load subscriptions:", error);
|
|
@@ -1564,7 +1564,7 @@ function SubscriptionsContainer({
|
|
|
1564
1564
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8" }),
|
|
1565
1565
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: t("billing.ui.subscriptions.title") })
|
|
1566
1566
|
] }),
|
|
1567
|
-
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1567
|
+
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _44 => _44()]), children: hasActiveRecurringSubscription ? t("billing.ui.subscriptions.purchase_addons") : t("billing.ui.subscriptions.subscribe") })
|
|
1568
1568
|
] }),
|
|
1569
1569
|
criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BillingAlertBanner, { subscription }, subscription.id)),
|
|
1570
1570
|
subscriptions.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col items-center justify-center py-12 space-y-4", children: [
|
|
@@ -1572,7 +1572,7 @@ function SubscriptionsContainer({
|
|
|
1572
1572
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
1573
1573
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium mb-2", children: t("billing.ui.subscriptions.empty_title") }),
|
|
1574
1574
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground mb-6", children: t("billing.ui.subscriptions.empty_description") }),
|
|
1575
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1575
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _45 => _45()]), children: t("billing.ui.subscriptions.subscribe") })
|
|
1576
1576
|
] })
|
|
1577
1577
|
] }),
|
|
1578
1578
|
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -1596,9 +1596,9 @@ function IntervalToggle({ value, onChange, hasMonthly, hasYearly }) {
|
|
|
1596
1596
|
if (!hasMonthly || !hasYearly) {
|
|
1597
1597
|
return null;
|
|
1598
1598
|
}
|
|
1599
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1600
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1601
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1599
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Tabs, { value, onValueChange: (v) => onChange(v), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.TabsList, { children: [
|
|
1600
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.TabsTrigger, { value: "month", children: t("billing.admin.prices.interval.month") }),
|
|
1601
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.TabsTrigger, { value: "year", children: t("billing.admin.prices.interval.year") })
|
|
1602
1602
|
] }) });
|
|
1603
1603
|
}
|
|
1604
1604
|
_chunk7QVYU63Ejs.__name.call(void 0, IntervalToggle, "IntervalToggle");
|
|
@@ -1616,11 +1616,11 @@ function PricingCard({
|
|
|
1616
1616
|
onSelect
|
|
1617
1617
|
}) {
|
|
1618
1618
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1619
|
-
const fmt =
|
|
1619
|
+
const fmt = _chunkUGDYZW4Kjs.useBillingFormatOptions.call(void 0, );
|
|
1620
1620
|
const description = price.description || price.nickname || t("billing.ui.pricing.standard");
|
|
1621
1621
|
const features = price.features || [];
|
|
1622
|
-
const formattedPrice =
|
|
1623
|
-
const interval =
|
|
1622
|
+
const formattedPrice = _chunkOO2DBP6Ljs.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt);
|
|
1623
|
+
const interval = _chunkOO2DBP6Ljs.formatInterval.call(void 0, price, fmt);
|
|
1624
1624
|
const handleKeyDown = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (e) => {
|
|
1625
1625
|
if ((e.key === "Enter" || e.key === " ") && !isDisabled && !isCurrentPlan) {
|
|
1626
1626
|
e.preventDefault();
|
|
@@ -1633,7 +1633,7 @@ function PricingCard({
|
|
|
1633
1633
|
}
|
|
1634
1634
|
}, "handleClick");
|
|
1635
1635
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1636
|
-
|
|
1636
|
+
_chunkUGDYZW4Kjs.Card,
|
|
1637
1637
|
{
|
|
1638
1638
|
role: "radio",
|
|
1639
1639
|
"aria-checked": isSelected,
|
|
@@ -1641,7 +1641,7 @@ function PricingCard({
|
|
|
1641
1641
|
tabIndex: isDisabled ? -1 : 0,
|
|
1642
1642
|
onKeyDown: handleKeyDown,
|
|
1643
1643
|
onClick: handleClick,
|
|
1644
|
-
className:
|
|
1644
|
+
className: _chunkOO2DBP6Ljs.cn.call(void 0,
|
|
1645
1645
|
"relative cursor-pointer transition-all duration-200 flex flex-col h-full",
|
|
1646
1646
|
"focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
1647
1647
|
isCurrentPlan && "bg-muted/30",
|
|
@@ -1651,9 +1651,9 @@ function PricingCard({
|
|
|
1651
1651
|
isLoading && "pointer-events-none"
|
|
1652
1652
|
),
|
|
1653
1653
|
children: [
|
|
1654
|
-
isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1655
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1656
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1654
|
+
isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Badge, { variant: "secondary", className: "absolute top-2 end-2", children: t("billing.ui.pricing.current") }),
|
|
1655
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.CardHeader, { className: "pb-2", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium", children: description }) }),
|
|
1656
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.CardContent, { className: "pb-4 grow", children: [
|
|
1657
1657
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mb-4", children: [
|
|
1658
1658
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-3xl font-bold", children: formattedPrice }),
|
|
1659
1659
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground ms-1", children: interval })
|
|
@@ -1663,8 +1663,8 @@ function PricingCard({
|
|
|
1663
1663
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-muted-foreground", children: feature })
|
|
1664
1664
|
] }, index)) })
|
|
1665
1665
|
] }),
|
|
1666
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1667
|
-
|
|
1666
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.CardFooter, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1667
|
+
_chunkUGDYZW4Kjs.Button,
|
|
1668
1668
|
{
|
|
1669
1669
|
variant: isCurrentPlan ? "secondary" : isSelected ? "default" : "outline",
|
|
1670
1670
|
className: "w-full",
|
|
@@ -1697,7 +1697,7 @@ function ProductPricingRow({
|
|
|
1697
1697
|
return null;
|
|
1698
1698
|
}
|
|
1699
1699
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-3", children: [
|
|
1700
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1700
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.SectionHeader, { children: product.name }),
|
|
1701
1701
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1702
1702
|
"div",
|
|
1703
1703
|
{
|
|
@@ -1798,15 +1798,15 @@ function ProductPricingList({
|
|
|
1798
1798
|
_chunk7QVYU63Ejs.__name.call(void 0, ProductPricingList, "ProductPricingList");
|
|
1799
1799
|
function ProductPricingListSkeleton() {
|
|
1800
1800
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "space-y-6", children: [1, 2].map((rowIndex) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-3", children: [
|
|
1801
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1801
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Skeleton, { className: "h-6 w-32" }),
|
|
1802
1802
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4", children: [1, 2, 3].map((cardIndex) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "p-4 rounded-lg border animate-pulse space-y-3", children: [
|
|
1803
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1804
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1803
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Skeleton, { className: "h-6 w-24" }),
|
|
1804
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Skeleton, { className: "h-8 w-32" }),
|
|
1805
1805
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
1806
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1807
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1806
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Skeleton, { className: "h-4 w-full" }),
|
|
1807
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Skeleton, { className: "h-4 w-3/4" })
|
|
1808
1808
|
] }),
|
|
1809
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1809
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Skeleton, { className: "h-10 w-full" })
|
|
1810
1810
|
] }, cardIndex)) })
|
|
1811
1811
|
] }, rowIndex)) });
|
|
1812
1812
|
}
|
|
@@ -1817,20 +1817,20 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductPricingListSkeleton, "ProductPricing
|
|
|
1817
1817
|
|
|
1818
1818
|
function ProrationPreview({ preview }) {
|
|
1819
1819
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1820
|
-
const fmt =
|
|
1820
|
+
const fmt = _chunkUGDYZW4Kjs.useBillingFormatOptions.call(void 0, );
|
|
1821
1821
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-primary/10 border-primary/30 rounded-lg border p-4", children: [
|
|
1822
1822
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "text-primary mb-3 font-semibold", children: t("billing.ui.proration.title") }),
|
|
1823
1823
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
1824
1824
|
preview.lineItems.map((item, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between text-sm", children: [
|
|
1825
1825
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground", children: item.description }),
|
|
1826
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `font-medium ${item.amount < 0 ? "text-success" : "text-foreground"}`, children:
|
|
1826
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `font-medium ${item.amount < 0 ? "text-success" : "text-foreground"}`, children: _chunkOO2DBP6Ljs.formatCurrency.call(void 0, item.amount, preview.currency, fmt) })
|
|
1827
1827
|
] }, index)),
|
|
1828
1828
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border-primary/30 mt-2 border-t pt-2", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between font-semibold", children: [
|
|
1829
1829
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-foreground", children: t("billing.ui.proration.net_due_today") }),
|
|
1830
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-foreground", children:
|
|
1830
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-foreground", children: _chunkOO2DBP6Ljs.formatCurrency.call(void 0, preview.immediateCharge, preview.currency, fmt) })
|
|
1831
1831
|
] }) }),
|
|
1832
1832
|
preview.lineItems.length > 0 && preview.lineItems[0].period && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-muted-foreground mt-2 text-xs", children: t("billing.ui.proration.next_invoice", {
|
|
1833
|
-
amount:
|
|
1833
|
+
amount: _chunkOO2DBP6Ljs.formatCurrency.call(void 0, preview.amountDue, preview.currency, fmt)
|
|
1834
1834
|
}) })
|
|
1835
1835
|
] })
|
|
1836
1836
|
] });
|
|
@@ -1843,7 +1843,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProrationPreview, "ProrationPreview");
|
|
|
1843
1843
|
|
|
1844
1844
|
function SubscriptionConfirmation({ price, isLoading, onConfirm, onCancel }) {
|
|
1845
1845
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1846
|
-
const fmt =
|
|
1846
|
+
const fmt = _chunkUGDYZW4Kjs.useBillingFormatOptions.call(void 0, );
|
|
1847
1847
|
const productName = _optionalChain([price, 'access', _51 => _51.product, 'optionalAccess', _52 => _52.name]) || price.nickname || t("billing.ui.wizard.review.selected_plan");
|
|
1848
1848
|
const productDescription = _optionalChain([price, 'access', _53 => _53.product, 'optionalAccess', _54 => _54.description]) || price.description;
|
|
1849
1849
|
const features = price.features || [];
|
|
@@ -1855,16 +1855,16 @@ function SubscriptionConfirmation({ price, isLoading, onConfirm, onCancel }) {
|
|
|
1855
1855
|
productDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-sm text-muted-foreground", children: productDescription })
|
|
1856
1856
|
] }),
|
|
1857
1857
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-lg font-semibold", children: [
|
|
1858
|
-
|
|
1859
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-normal text-muted-foreground", children:
|
|
1858
|
+
_chunkOO2DBP6Ljs.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt),
|
|
1859
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-normal text-muted-foreground", children: _chunkOO2DBP6Ljs.formatInterval.call(void 0, price, fmt) })
|
|
1860
1860
|
] }),
|
|
1861
1861
|
features.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "space-y-1", children: features.map((feature, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2 text-sm ", children: [
|
|
1862
1862
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Check, { className: "h-4 w-4 text-primary" }),
|
|
1863
1863
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: feature })
|
|
1864
1864
|
] }, index)) }),
|
|
1865
1865
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-3 pt-2 border-t border-accent/30", children: [
|
|
1866
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1867
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1866
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Button, { variant: "outline", onClick: onCancel, disabled: isLoading, children: t("ui.buttons.cancel") }),
|
|
1867
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Button, { onClick: onConfirm, disabled: isLoading, children: isLoading ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1868
1868
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "h-4 w-4 animate-spin me-2" }),
|
|
1869
1869
|
t("billing.ui.wizard.review.processing")
|
|
1870
1870
|
] }) : t("billing.ui.confirmation.subscribe") })
|
|
@@ -2043,7 +2043,7 @@ function wizardReducer(state, action) {
|
|
|
2043
2043
|
_chunk7QVYU63Ejs.__name.call(void 0, wizardReducer, "wizardReducer");
|
|
2044
2044
|
function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
2045
2045
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2046
|
-
const locale =
|
|
2046
|
+
const locale = _chunkA7Y5YW7Qjs.useI18nLocale.call(void 0, );
|
|
2047
2047
|
const { confirmPayment } = useConfirmSubscriptionPayment();
|
|
2048
2048
|
const [state, dispatch] = _react.useReducer.call(void 0, wizardReducer, {
|
|
2049
2049
|
...initialState,
|
|
@@ -2055,7 +2055,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2055
2055
|
onCloseRef.current = onClose;
|
|
2056
2056
|
const checkPaymentMethod = _react.useCallback.call(void 0, async () => {
|
|
2057
2057
|
try {
|
|
2058
|
-
const methods = await
|
|
2058
|
+
const methods = await _chunkOO2DBP6Ljs.StripeCustomerService.listPaymentMethods();
|
|
2059
2059
|
dispatch({ type: "SET_HAS_PAYMENT_METHOD", hasMethod: methods.length > 0 });
|
|
2060
2060
|
} catch (error) {
|
|
2061
2061
|
console.error("[useSubscriptionWizard] Failed to check payment methods:", error);
|
|
@@ -2073,10 +2073,10 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2073
2073
|
}, []);
|
|
2074
2074
|
const lookUpAutomaticCode = _react.useCallback.call(void 0, async (priceId) => {
|
|
2075
2075
|
try {
|
|
2076
|
-
const automaticCode = await
|
|
2076
|
+
const automaticCode = await _chunkOO2DBP6Ljs.StripeCouponCodeService.findAutomatic({ priceId });
|
|
2077
2077
|
dispatch({
|
|
2078
2078
|
type: "SET_PROMOTION_CODE",
|
|
2079
|
-
code: automaticCode ?
|
|
2079
|
+
code: automaticCode ? _chunkOO2DBP6Ljs.toPromotionCodeResult.call(void 0, automaticCode) : null
|
|
2080
2080
|
});
|
|
2081
2081
|
return true;
|
|
2082
2082
|
} catch (error) {
|
|
@@ -2103,7 +2103,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2103
2103
|
const isTrialUpgrade = _optionalChain([subscription, 'optionalAccess', _61 => _61.status]) === "trialing" /* TRIALING */;
|
|
2104
2104
|
dispatch({ type: "SET_IS_TRIAL_SUBSCRIPTION", isTrial: isTrialUpgrade });
|
|
2105
2105
|
if (isTrialUpgrade && !state.hasPaymentMethod) {
|
|
2106
|
-
const methods = await
|
|
2106
|
+
const methods = await _chunkOO2DBP6Ljs.StripeCustomerService.listPaymentMethods();
|
|
2107
2107
|
if (methods.length === 0) {
|
|
2108
2108
|
dispatch({ type: "SET_STEP", step: "payment-method" });
|
|
2109
2109
|
dispatch({
|
|
@@ -2121,7 +2121,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2121
2121
|
}
|
|
2122
2122
|
}
|
|
2123
2123
|
if (subscription && state.selectedPrice.id !== _optionalChain([subscription, 'access', _62 => _62.price, 'optionalAccess', _63 => _63.id])) {
|
|
2124
|
-
const preview = await
|
|
2124
|
+
const preview = await _chunkOO2DBP6Ljs.StripeSubscriptionService.getProrationPreview({
|
|
2125
2125
|
subscriptionId: subscription.id,
|
|
2126
2126
|
newPriceId: state.selectedPrice.id
|
|
2127
2127
|
});
|
|
@@ -2155,14 +2155,14 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2155
2155
|
newPriceId: state.selectedPrice.id,
|
|
2156
2156
|
promotionCode: promotionCodeToSend(state.promotionCode)
|
|
2157
2157
|
};
|
|
2158
|
-
result = await
|
|
2158
|
+
result = await _chunkOO2DBP6Ljs.StripeSubscriptionService.changePlanWithMeta(changePlanParams);
|
|
2159
2159
|
} else {
|
|
2160
2160
|
const createParams = {
|
|
2161
2161
|
id: _uuid.v4.call(void 0, ),
|
|
2162
2162
|
priceId: state.selectedPrice.id,
|
|
2163
2163
|
promotionCode: promotionCodeToSend(state.promotionCode)
|
|
2164
2164
|
};
|
|
2165
|
-
result = await
|
|
2165
|
+
result = await _chunkOO2DBP6Ljs.StripeSubscriptionService.createSubscription(createParams);
|
|
2166
2166
|
}
|
|
2167
2167
|
const clientSecret = clientSecretToConfirm(result.meta);
|
|
2168
2168
|
if (clientSecret) {
|
|
@@ -2178,7 +2178,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2178
2178
|
const subscriptionId = subscriptionIdToSync(result.subscription, subscription);
|
|
2179
2179
|
if (subscriptionId) {
|
|
2180
2180
|
try {
|
|
2181
|
-
await
|
|
2181
|
+
await _chunkOO2DBP6Ljs.StripeSubscriptionService.syncSubscription({ subscriptionId });
|
|
2182
2182
|
} catch (syncError) {
|
|
2183
2183
|
console.error("[useSubscriptionWizard] Subscription sync after payment failed:", syncError);
|
|
2184
2184
|
}
|
|
@@ -2226,7 +2226,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2226
2226
|
dispatch({ type: "SET_VALIDATING_PROMO_CODE", isValidating: true });
|
|
2227
2227
|
dispatch({ type: "SET_PROMO_CODE_ERROR", error: null });
|
|
2228
2228
|
try {
|
|
2229
|
-
const result = await
|
|
2229
|
+
const result = await _chunkOO2DBP6Ljs.StripePromotionCodeService.validatePromotionCode({
|
|
2230
2230
|
code,
|
|
2231
2231
|
stripePriceId: _optionalChain([state, 'access', _72 => _72.selectedPrice, 'optionalAccess', _73 => _73.id]),
|
|
2232
2232
|
language: locale
|
|
@@ -2351,7 +2351,7 @@ function WizardStepPlanSelection({
|
|
|
2351
2351
|
_react.useEffect.call(void 0, () => {
|
|
2352
2352
|
const loadProducts = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2353
2353
|
try {
|
|
2354
|
-
const fetchedProducts = await
|
|
2354
|
+
const fetchedProducts = await _chunkOO2DBP6Ljs.StripeProductService.listProducts({ active: true });
|
|
2355
2355
|
setProducts(fetchedProducts);
|
|
2356
2356
|
} catch (error) {
|
|
2357
2357
|
console.error("[WizardStepPlanSelection] Failed to load products:", error);
|
|
@@ -2402,7 +2402,7 @@ function WizardStepPlanSelection({
|
|
|
2402
2402
|
onSelectPrice: handleSelectPrice
|
|
2403
2403
|
}
|
|
2404
2404
|
),
|
|
2405
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex justify-end pt-4 border-t", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2405
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex justify-end pt-4 border-t", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Button, { onClick: onNext, disabled: !selectedPrice || isProcessing, children: isProcessing ? t("common.loading") : t("billing.ui.wizard.next_review") }) })
|
|
2406
2406
|
] });
|
|
2407
2407
|
}
|
|
2408
2408
|
_chunk7QVYU63Ejs.__name.call(void 0, WizardStepPlanSelection, "WizardStepPlanSelection");
|
|
@@ -2426,7 +2426,7 @@ function PromoCodeInput({
|
|
|
2426
2426
|
disabled = false
|
|
2427
2427
|
}) {
|
|
2428
2428
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2429
|
-
const locale =
|
|
2429
|
+
const locale = _chunkA7Y5YW7Qjs.useI18nLocale.call(void 0, );
|
|
2430
2430
|
const [code, setCode] = _react.useState.call(void 0, "");
|
|
2431
2431
|
const appliedKey = _optionalChain([appliedCode, 'optionalAccess', _82 => _82.valid]) ? `${appliedCode.automatic ? "auto" : "typed"}:${_nullishCoalesce(appliedCode.code, () => ( ""))}` : null;
|
|
2432
2432
|
const [previousAppliedKey, setPreviousAppliedKey] = _react.useState.call(void 0, appliedKey);
|
|
@@ -2455,7 +2455,7 @@ function PromoCodeInput({
|
|
|
2455
2455
|
}
|
|
2456
2456
|
const amount = (result.discountValue || 0) / 100;
|
|
2457
2457
|
const currency = _optionalChain([result, 'access', _83 => _83.currency, 'optionalAccess', _84 => _84.toUpperCase, 'call', _85 => _85()]) || "USD";
|
|
2458
|
-
return t("billing.ui.wizard.review.amount_off", { amount: `${currency} ${
|
|
2458
|
+
return t("billing.ui.wizard.review.amount_off", { amount: `${currency} ${_chunkOO2DBP6Ljs.formatFixed.call(void 0, amount, locale, 2)}` });
|
|
2459
2459
|
}, "formatDiscount");
|
|
2460
2460
|
const formatDuration = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (result) => {
|
|
2461
2461
|
switch (result.duration) {
|
|
@@ -2472,7 +2472,7 @@ function PromoCodeInput({
|
|
|
2472
2472
|
const codeInput = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
2473
2473
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
|
|
2474
2474
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2475
|
-
|
|
2475
|
+
_chunkUGDYZW4Kjs.Input,
|
|
2476
2476
|
{
|
|
2477
2477
|
placeholder: t("billing.ui.promo_code.placeholder"),
|
|
2478
2478
|
value: code,
|
|
@@ -2482,7 +2482,7 @@ function PromoCodeInput({
|
|
|
2482
2482
|
className: "flex-1"
|
|
2483
2483
|
}
|
|
2484
2484
|
),
|
|
2485
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2485
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Button, { variant: "outline", onClick: handleApply, disabled: disabled || isValidating || !code.trim(), children: isValidating ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "h-4 w-4 animate-spin" }) : t("billing.ui.promo_code.apply") })
|
|
2486
2486
|
] }),
|
|
2487
2487
|
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error })
|
|
2488
2488
|
] });
|
|
@@ -2511,7 +2511,7 @@ function PromoCodeInput({
|
|
|
2511
2511
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success text-sm", children: formatDiscount(appliedCode) })
|
|
2512
2512
|
] }),
|
|
2513
2513
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2514
|
-
|
|
2514
|
+
_chunkUGDYZW4Kjs.Button,
|
|
2515
2515
|
{
|
|
2516
2516
|
variant: "ghost",
|
|
2517
2517
|
size: "sm",
|
|
@@ -2559,7 +2559,7 @@ function WizardStepReview({
|
|
|
2559
2559
|
isTrialUpgrade
|
|
2560
2560
|
}) {
|
|
2561
2561
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2562
|
-
const fmt =
|
|
2562
|
+
const fmt = _chunkUGDYZW4Kjs.useBillingFormatOptions.call(void 0, );
|
|
2563
2563
|
const [card, setCard] = _react.useState.call(void 0, null);
|
|
2564
2564
|
_react.useEffect.call(void 0, () => {
|
|
2565
2565
|
if (!hasPaymentMethod) {
|
|
@@ -2567,7 +2567,7 @@ function WizardStepReview({
|
|
|
2567
2567
|
return;
|
|
2568
2568
|
}
|
|
2569
2569
|
let cancelled = false;
|
|
2570
|
-
Promise.all([
|
|
2570
|
+
Promise.all([_chunkOO2DBP6Ljs.StripeCustomerService.listPaymentMethods(), _chunkOO2DBP6Ljs.StripeCustomerService.getCustomer()]).then(([methods, customer]) => {
|
|
2571
2571
|
if (!cancelled) setCard(reviewCard(methods, _optionalChain([customer, 'optionalAccess', _90 => _90.defaultPaymentMethodId])));
|
|
2572
2572
|
}).catch((err) => {
|
|
2573
2573
|
console.error("[WizardStepReview] Failed to load the card on file:", err);
|
|
@@ -2586,11 +2586,11 @@ function WizardStepReview({
|
|
|
2586
2586
|
const interval = _optionalChain([price, 'access', _93 => _93.recurring, 'optionalAccess', _94 => _94.interval]) || "month";
|
|
2587
2587
|
return interval === "year" ? t("billing.ui.wizard.review.interval_yearly") : t("billing.ui.wizard.review.interval_monthly");
|
|
2588
2588
|
}, "formatInterval");
|
|
2589
|
-
const codeDiscount =
|
|
2590
|
-
const carriedDiscount = isChangingPlan && !codeDiscount ?
|
|
2589
|
+
const codeDiscount = _chunkUGDYZW4Kjs.promotionCodeDiscount.call(void 0, promotionCode);
|
|
2590
|
+
const carriedDiscount = isChangingPlan && !codeDiscount ? _chunkUGDYZW4Kjs.subscriptionDiscount.call(void 0, subscription) : null;
|
|
2591
2591
|
const discount = _nullishCoalesce(codeDiscount, () => ( carriedDiscount));
|
|
2592
|
-
const discountedPrice =
|
|
2593
|
-
const discountedImmediateCharge =
|
|
2592
|
+
const discountedPrice = _chunkUGDYZW4Kjs.applyDiscount.call(void 0, selectedPrice.unitAmount, discount);
|
|
2593
|
+
const discountedImmediateCharge = _chunkUGDYZW4Kjs.applyDiscount.call(void 0, _optionalChain([prorationPreview, 'optionalAccess', _95 => _95.immediateCharge]), discount);
|
|
2594
2594
|
const isProrationCredit = !isTrialUpgrade && (_nullishCoalesce(_nullishCoalesce(discountedImmediateCharge, () => ( _optionalChain([prorationPreview, 'optionalAccess', _96 => _96.immediateCharge]))), () => ( 0))) < 0;
|
|
2595
2595
|
const prorationAmount = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (amount) => isProrationCredit ? Math.abs(amount) : amount, "prorationAmount");
|
|
2596
2596
|
const getDiscountDescription = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
@@ -2599,13 +2599,13 @@ function WizardStepReview({
|
|
|
2599
2599
|
return t("billing.ui.wizard.review.percent_off", { value: discount.discountValue });
|
|
2600
2600
|
}
|
|
2601
2601
|
return t("billing.ui.wizard.review.amount_off", {
|
|
2602
|
-
amount:
|
|
2602
|
+
amount: _chunkOO2DBP6Ljs.formatCurrency.call(void 0, discount.discountValue, discount.currency || selectedPrice.currency, fmt)
|
|
2603
2603
|
});
|
|
2604
2604
|
}, "getDiscountDescription");
|
|
2605
2605
|
const discountDescription = getDiscountDescription();
|
|
2606
2606
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
2607
2607
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-muted/50 rounded-lg p-4 space-y-3", children: [
|
|
2608
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2608
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.SectionHeader, { children: t("billing.ui.wizard.review.selected_plan") }),
|
|
2609
2609
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between items-center", children: [
|
|
2610
2610
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
2611
2611
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-medium", children: _optionalChain([selectedPrice, 'access', _97 => _97.product, 'optionalAccess', _98 => _98.name]) }),
|
|
@@ -2613,11 +2613,11 @@ function WizardStepReview({
|
|
|
2613
2613
|
] }),
|
|
2614
2614
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-end", children: [
|
|
2615
2615
|
discountedPrice !== null ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2616
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground line-through", children:
|
|
2617
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-success text-lg font-semibold", children:
|
|
2618
|
-
discountDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2616
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground line-through", children: _chunkOO2DBP6Ljs.formatCurrency.call(void 0, selectedPrice.unitAmount || 0, selectedPrice.currency, fmt) }),
|
|
2617
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-success text-lg font-semibold", children: _chunkOO2DBP6Ljs.formatCurrency.call(void 0, discountedPrice, selectedPrice.currency, fmt) }),
|
|
2618
|
+
discountDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Badge, { variant: "softGreen", children: discountDescription }),
|
|
2619
2619
|
carriedDiscount && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: t("billing.ui.wizard.review.discount_carries_over") })
|
|
2620
|
-
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-semibold text-lg", children:
|
|
2620
|
+
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-semibold text-lg", children: _chunkOO2DBP6Ljs.formatCurrency.call(void 0, selectedPrice.unitAmount || 0, selectedPrice.currency, fmt) }),
|
|
2621
2621
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: formatInterval2(selectedPrice) })
|
|
2622
2622
|
] })
|
|
2623
2623
|
] })
|
|
@@ -2632,9 +2632,9 @@ function WizardStepReview({
|
|
|
2632
2632
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between text-sm", children: [
|
|
2633
2633
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `${isTrialUpgrade ? "text-warning" : "text-muted-foreground"}`, children: isTrialUpgrade ? t("billing.ui.wizard.review.charge_now") : isProrationCredit ? t("billing.ui.wizard.review.credit_now") : t("billing.ui.wizard.review.due_now") }),
|
|
2634
2634
|
/* @__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: [
|
|
2635
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "line-through text-muted-foreground me-2", children:
|
|
2636
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success", children:
|
|
2637
|
-
] }) :
|
|
2635
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "line-through text-muted-foreground me-2", children: _chunkOO2DBP6Ljs.formatCurrency.call(void 0, prorationAmount(prorationPreview.immediateCharge), prorationPreview.currency, fmt) }),
|
|
2636
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success", children: _chunkOO2DBP6Ljs.formatCurrency.call(void 0, prorationAmount(discountedImmediateCharge), prorationPreview.currency, fmt) })
|
|
2637
|
+
] }) : _chunkOO2DBP6Ljs.formatCurrency.call(void 0, prorationAmount(prorationPreview.immediateCharge), prorationPreview.currency, fmt) })
|
|
2638
2638
|
] })
|
|
2639
2639
|
]
|
|
2640
2640
|
}
|
|
@@ -2658,15 +2658,15 @@ function WizardStepReview({
|
|
|
2658
2658
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "font-medium", children: t("billing.ui.payment_method.title") }),
|
|
2659
2659
|
/* @__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") })
|
|
2660
2660
|
] }),
|
|
2661
|
-
hasPaymentMethod ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2661
|
+
hasPaymentMethod ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Button, { variant: "outline", onClick: onAddPaymentMethod, disabled: isProcessing, children: t("billing.ui.wizard.review.use_another_card") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Button, { variant: "outline", onClick: onAddPaymentMethod, children: t("billing.ui.payment_methods.add") })
|
|
2662
2662
|
] }) }),
|
|
2663
|
-
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2663
|
+
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.Alert, { variant: "destructive", children: [
|
|
2664
2664
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.AlertCircle, { className: "h-4 w-4" }),
|
|
2665
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2665
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.AlertDescription, { children: error })
|
|
2666
2666
|
] }),
|
|
2667
2667
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between pt-4 border-t", children: [
|
|
2668
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2669
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2668
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Button, { variant: "outline", onClick: onBack, disabled: isProcessing, children: t("billing.ui.wizard.back") }),
|
|
2669
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.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") })
|
|
2670
2670
|
] })
|
|
2671
2671
|
] });
|
|
2672
2672
|
}
|
|
@@ -2679,7 +2679,7 @@ function WizardStepPaymentMethod({ onBack, onSuccess, isProcessing }) {
|
|
|
2679
2679
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2680
2680
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
2681
2681
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
2682
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2682
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.SectionHeader, { children: t("billing.ui.payment_methods.add") }),
|
|
2683
2683
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: t("billing.ui.wizard.payment_description") })
|
|
2684
2684
|
] }),
|
|
2685
2685
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodForm, { onSuccess, onCancel: onBack, isLoading: isProcessing, alwaysSetDefault: true })
|
|
@@ -2722,10 +2722,10 @@ function SubscriptionWizard({
|
|
|
2722
2722
|
const isChangePlanMode = !!subscription;
|
|
2723
2723
|
const dialogTitle = subscription ? t("billing.ui.wizard.change_title") : isPurchasingAddons ? t("billing.ui.subscriptions.purchase_addons") : t("billing.ui.subscriptions.subscribe");
|
|
2724
2724
|
const dialogDescription = subscription ? t("billing.ui.wizard.change_description") : isPurchasingAddons ? t("billing.ui.wizard.addons_description") : t("billing.ui.wizard.subscribe_description");
|
|
2725
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2726
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2727
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2728
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2725
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.DialogContent, { className: "max-w-2xl max-h-[90vh] overflow-y-auto", children: [
|
|
2726
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.DialogHeader, { children: [
|
|
2727
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.DialogTitle, { children: dialogTitle }),
|
|
2728
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.DialogDescription, { children: dialogDescription })
|
|
2729
2729
|
] }),
|
|
2730
2730
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, WizardProgressIndicator, { currentStep: state.step }),
|
|
2731
2731
|
state.step === "plan-selection" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -2793,7 +2793,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, getProgressColor, "getProgressColor");
|
|
|
2793
2793
|
function formatDate2(date, { locale, t }) {
|
|
2794
2794
|
if (!date) return t("billing.ui.not_available");
|
|
2795
2795
|
try {
|
|
2796
|
-
return new Intl.DateTimeFormat(
|
|
2796
|
+
return new Intl.DateTimeFormat(_chunkOO2DBP6Ljs.dateFormatLocale.call(void 0, locale), {
|
|
2797
2797
|
month: "short",
|
|
2798
2798
|
day: "numeric"
|
|
2799
2799
|
}).format(new Date(date));
|
|
@@ -2804,7 +2804,7 @@ function formatDate2(date, { locale, t }) {
|
|
|
2804
2804
|
_chunk7QVYU63Ejs.__name.call(void 0, formatDate2, "formatDate");
|
|
2805
2805
|
function UsageSummaryCard({ meter, summary }) {
|
|
2806
2806
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2807
|
-
const fmt =
|
|
2807
|
+
const fmt = _chunkUGDYZW4Kjs.useBillingFormatOptions.call(void 0, );
|
|
2808
2808
|
const currentUsage = _nullishCoalesce(_optionalChain([summary, 'optionalAccess', _101 => _101.aggregatedValue]), () => ( 0));
|
|
2809
2809
|
const limit = meter.limit;
|
|
2810
2810
|
const percentage = limit && limit > 0 ? currentUsage / limit * 100 : null;
|
|
@@ -2812,15 +2812,15 @@ function UsageSummaryCard({ meter, summary }) {
|
|
|
2812
2812
|
const progressWidth = percentage !== null ? Math.min(percentage, 100) : 0;
|
|
2813
2813
|
const displayName = meter.displayName || meter.eventName;
|
|
2814
2814
|
const hasLimit = limit !== null && limit !== void 0;
|
|
2815
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2816
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2815
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.Card, { children: [
|
|
2816
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.CardHeader, { className: "flex flex-row items-center gap-x-3 pb-3", children: [
|
|
2817
2817
|
/* @__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" }) }),
|
|
2818
2818
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col", children: [
|
|
2819
2819
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium", children: displayName }),
|
|
2820
2820
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-xs", children: meter.id })
|
|
2821
2821
|
] })
|
|
2822
2822
|
] }),
|
|
2823
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2823
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.CardContent, { className: "flex flex-col gap-y-4", children: [
|
|
2824
2824
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
2825
2825
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-3xl font-bold", children: currentUsage.toLocaleString(fmt.locale) }),
|
|
2826
2826
|
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) }) })
|
|
@@ -2828,7 +2828,7 @@ function UsageSummaryCard({ meter, summary }) {
|
|
|
2828
2828
|
hasLimit ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-2", children: [
|
|
2829
2829
|
/* @__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}%` } }) }),
|
|
2830
2830
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-sm", children: t("billing.ui.usage.percent_used", {
|
|
2831
|
-
value: percentage !== null ?
|
|
2831
|
+
value: percentage !== null ? _chunkOO2DBP6Ljs.formatFixed.call(void 0, percentage, fmt.locale, 1) : ""
|
|
2832
2832
|
}) })
|
|
2833
2833
|
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-sm", children: t("billing.ui.usage.no_limit") }),
|
|
2834
2834
|
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", {
|
|
@@ -2861,14 +2861,14 @@ function UsageContainer() {
|
|
|
2861
2861
|
const loadUsageData = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2862
2862
|
setLoading(true);
|
|
2863
2863
|
try {
|
|
2864
|
-
const fetchedSubscriptions = await
|
|
2864
|
+
const fetchedSubscriptions = await _chunkOO2DBP6Ljs.StripeSubscriptionService.listSubscriptions();
|
|
2865
2865
|
setSubscriptions(fetchedSubscriptions);
|
|
2866
2866
|
const hasMeteredSubscriptions2 = fetchedSubscriptions.some((sub) => _optionalChain([sub, 'access', _102 => _102.price, 'optionalAccess', _103 => _103.recurring, 'optionalAccess', _104 => _104.usageType]) === "metered");
|
|
2867
2867
|
if (!hasMeteredSubscriptions2) {
|
|
2868
2868
|
setLoading(false);
|
|
2869
2869
|
return;
|
|
2870
2870
|
}
|
|
2871
|
-
const fetchedMeters = await
|
|
2871
|
+
const fetchedMeters = await _chunkOO2DBP6Ljs.StripeUsageService.listMeters();
|
|
2872
2872
|
setMeters(fetchedMeters);
|
|
2873
2873
|
const summariesMap = {};
|
|
2874
2874
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -2876,7 +2876,7 @@ function UsageContainer() {
|
|
|
2876
2876
|
const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
|
|
2877
2877
|
for (const meter of fetchedMeters) {
|
|
2878
2878
|
try {
|
|
2879
|
-
const meterSummaries = await
|
|
2879
|
+
const meterSummaries = await _chunkOO2DBP6Ljs.StripeUsageService.getMeterSummaries({
|
|
2880
2880
|
meterId: meter.id,
|
|
2881
2881
|
startTime: startOfMonth,
|
|
2882
2882
|
endTime: endOfMonth
|
|
@@ -2925,7 +2925,7 @@ function formatDateTime(date, { locale, t }) {
|
|
|
2925
2925
|
if (!date) return t("billing.ui.not_available");
|
|
2926
2926
|
const dateObj = typeof date === "string" ? new Date(date) : date;
|
|
2927
2927
|
try {
|
|
2928
|
-
return new Intl.DateTimeFormat(
|
|
2928
|
+
return new Intl.DateTimeFormat(_chunkOO2DBP6Ljs.dateFormatLocale.call(void 0, locale), {
|
|
2929
2929
|
month: "short",
|
|
2930
2930
|
day: "numeric",
|
|
2931
2931
|
year: "numeric",
|
|
@@ -2939,27 +2939,27 @@ function formatDateTime(date, { locale, t }) {
|
|
|
2939
2939
|
_chunk7QVYU63Ejs.__name.call(void 0, formatDateTime, "formatDateTime");
|
|
2940
2940
|
function UsageHistoryTable({ usageRecords }) {
|
|
2941
2941
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2942
|
-
const fmt =
|
|
2942
|
+
const fmt = _chunkUGDYZW4Kjs.useBillingFormatOptions.call(void 0, );
|
|
2943
2943
|
if (usageRecords.length === 0) {
|
|
2944
2944
|
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") }) });
|
|
2945
2945
|
}
|
|
2946
2946
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
2947
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2948
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-clip rounded-lg border", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2949
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2950
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2951
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2952
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2953
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2947
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.SectionHeader, { level: 2, children: t("billing.ui.usage.history_title") }),
|
|
2948
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-clip rounded-lg border", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.Table, { children: [
|
|
2949
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.TableRow, { children: [
|
|
2950
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.TableHead, { children: t("billing.ui.columns.date_time") }),
|
|
2951
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.TableHead, { children: t("billing.ui.columns.meter_event") }),
|
|
2952
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.TableHead, { className: "text-end", children: t("billing.ui.columns.quantity") }),
|
|
2953
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.TableHead, { children: t("billing.ui.columns.event_id") })
|
|
2954
2954
|
] }) }),
|
|
2955
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2955
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.TableBody, { children: usageRecords.map((record) => {
|
|
2956
2956
|
const dateTime = formatDateTime(record.timestamp, fmt);
|
|
2957
2957
|
const quantity = record.quantity.toLocaleString(fmt.locale);
|
|
2958
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2959
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2960
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2961
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2962
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2958
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.TableRow, { children: [
|
|
2959
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.TableCell, { className: "font-medium", children: dateTime }),
|
|
2960
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.TableCell, { className: "text-muted-foreground", children: record.meterEventName }),
|
|
2961
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.TableCell, { className: "text-end font-medium", children: quantity }),
|
|
2962
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.TableCell, { className: "text-muted-foreground text-sm tabular-nums", children: record.stripeEventId })
|
|
2963
2963
|
] }, record.id);
|
|
2964
2964
|
}) })
|
|
2965
2965
|
] }) })
|
|
@@ -2970,8 +2970,8 @@ _chunk7QVYU63Ejs.__name.call(void 0, UsageHistoryTable, "UsageHistoryTable");
|
|
|
2970
2970
|
// src/features/billing/components/modals/BillingDetailModal.tsx
|
|
2971
2971
|
|
|
2972
2972
|
function BillingDetailModal({ open, onOpenChange, title, children, className }) {
|
|
2973
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2974
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2973
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.DialogContent, { className: _nullishCoalesce(className, () => ( "max-w-4xl max-h-[90vh] overflow-y-auto")), children: [
|
|
2974
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.DialogHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.DialogTitle, { children: title }) }),
|
|
2975
2975
|
children
|
|
2976
2976
|
] }) });
|
|
2977
2977
|
}
|
|
@@ -2999,7 +2999,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
|
|
|
2999
2999
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-destructive text-sm font-medium", children: t("billing.ui.alert.payment_failed_title") }),
|
|
3000
3000
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive mt-1 text-sm", children: t("billing.ui.alert.payment_failed_description") })
|
|
3001
3001
|
] }),
|
|
3002
|
-
onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3002
|
+
onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Button, { variant: "outline", size: "sm", onClick: onUpdatePayment, className: "text-destructive border-red-300", children: t("billing.ui.alert.update_payment_method") })
|
|
3003
3003
|
] });
|
|
3004
3004
|
}
|
|
3005
3005
|
if (subscription.status === "trialing" /* TRIALING */ && subscription.trialEnd) {
|
|
@@ -3013,7 +3013,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
|
|
|
3013
3013
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-warning text-sm font-medium", children: t("billing.ui.alert.trial_ending_title") }),
|
|
3014
3014
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-warning mt-1 text-sm", children: t("billing.ui.alert.trial_ending_description", { count: daysRemaining }) })
|
|
3015
3015
|
] }),
|
|
3016
|
-
onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3016
|
+
onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Button, { variant: "outline", size: "sm", onClick: onAddPayment, className: "text-warning border-yellow-300", children: t("billing.ui.payment_methods.add") })
|
|
3017
3017
|
] });
|
|
3018
3018
|
}
|
|
3019
3019
|
}
|
|
@@ -3066,7 +3066,7 @@ function BillingDashboardContainer({ renderCancelDialog } = {}) {
|
|
|
3066
3066
|
setNoCustomerExists(false);
|
|
3067
3067
|
let customer = null;
|
|
3068
3068
|
try {
|
|
3069
|
-
customer = await
|
|
3069
|
+
customer = await _chunkOO2DBP6Ljs.StripeCustomerService.getCustomer();
|
|
3070
3070
|
setData((prev) => ({ ...prev, customer }));
|
|
3071
3071
|
setErrors((prev) => ({ ...prev, customer: null }));
|
|
3072
3072
|
setNoCustomerExists(false);
|
|
@@ -3092,7 +3092,7 @@ function BillingDashboardContainer({ renderCancelDialog } = {}) {
|
|
|
3092
3092
|
}
|
|
3093
3093
|
const fetchSubscriptions = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3094
3094
|
try {
|
|
3095
|
-
const subscriptions2 = await
|
|
3095
|
+
const subscriptions2 = await _chunkOO2DBP6Ljs.StripeSubscriptionService.listSubscriptions();
|
|
3096
3096
|
setData((prev) => ({ ...prev, subscriptions: subscriptions2 }));
|
|
3097
3097
|
setErrors((prev) => ({ ...prev, subscriptions: null }));
|
|
3098
3098
|
return subscriptions2;
|
|
@@ -3106,7 +3106,7 @@ function BillingDashboardContainer({ renderCancelDialog } = {}) {
|
|
|
3106
3106
|
}, "fetchSubscriptions");
|
|
3107
3107
|
const fetchPaymentMethods = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3108
3108
|
try {
|
|
3109
|
-
const paymentMethods = await
|
|
3109
|
+
const paymentMethods = await _chunkOO2DBP6Ljs.StripeCustomerService.listPaymentMethods();
|
|
3110
3110
|
setData((prev) => ({ ...prev, paymentMethods }));
|
|
3111
3111
|
setErrors((prev) => ({ ...prev, paymentMethods: null }));
|
|
3112
3112
|
} catch (error) {
|
|
@@ -3118,7 +3118,7 @@ function BillingDashboardContainer({ renderCancelDialog } = {}) {
|
|
|
3118
3118
|
}, "fetchPaymentMethods");
|
|
3119
3119
|
const fetchInvoices = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3120
3120
|
try {
|
|
3121
|
-
const invoices = await
|
|
3121
|
+
const invoices = await _chunkOO2DBP6Ljs.StripeInvoiceService.listInvoices();
|
|
3122
3122
|
setData((prev) => ({ ...prev, invoices }));
|
|
3123
3123
|
setErrors((prev) => ({ ...prev, invoices: null }));
|
|
3124
3124
|
} catch (error) {
|
|
@@ -3141,7 +3141,7 @@ function BillingDashboardContainer({ renderCancelDialog } = {}) {
|
|
|
3141
3141
|
const handleCreateCustomer = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3142
3142
|
setCreatingCustomer(true);
|
|
3143
3143
|
try {
|
|
3144
|
-
await
|
|
3144
|
+
await _chunkOO2DBP6Ljs.StripeCustomerService.createCustomer();
|
|
3145
3145
|
setNoCustomerExists(false);
|
|
3146
3146
|
await fetchAllData();
|
|
3147
3147
|
} catch (error) {
|
|
@@ -3153,7 +3153,7 @@ function BillingDashboardContainer({ renderCancelDialog } = {}) {
|
|
|
3153
3153
|
}, "handleCreateCustomer");
|
|
3154
3154
|
const fetchUsageData = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3155
3155
|
try {
|
|
3156
|
-
const meters = await
|
|
3156
|
+
const meters = await _chunkOO2DBP6Ljs.StripeUsageService.listMeters();
|
|
3157
3157
|
setData((prev) => ({ ...prev, meters }));
|
|
3158
3158
|
const summariesMap = {};
|
|
3159
3159
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -3161,7 +3161,7 @@ function BillingDashboardContainer({ renderCancelDialog } = {}) {
|
|
|
3161
3161
|
const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
|
|
3162
3162
|
for (const meter of meters) {
|
|
3163
3163
|
try {
|
|
3164
|
-
const meterSummaries = await
|
|
3164
|
+
const meterSummaries = await _chunkOO2DBP6Ljs.StripeUsageService.getMeterSummaries({
|
|
3165
3165
|
meterId: meter.id,
|
|
3166
3166
|
startTime: startOfMonth,
|
|
3167
3167
|
endTime: endOfMonth
|
|
@@ -3223,7 +3223,7 @@ function BillingDashboardContainer({ renderCancelDialog } = {}) {
|
|
|
3223
3223
|
_react.useEffect.call(void 0, () => {
|
|
3224
3224
|
if (!pendingChangePlan || loading.subscriptions) return;
|
|
3225
3225
|
setPendingChangePlan(false);
|
|
3226
|
-
handleOpenWizard(
|
|
3226
|
+
handleOpenWizard(_chunkOO2DBP6Ljs.resolveChangePlanTarget.call(void 0, data.subscriptions));
|
|
3227
3227
|
}, [pendingChangePlan, loading.subscriptions, data.subscriptions, handleOpenWizard]);
|
|
3228
3228
|
const criticalSubscriptions = data.subscriptions.filter(
|
|
3229
3229
|
(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
|
|
@@ -3254,18 +3254,18 @@ function BillingDashboardContainer({ renderCancelDialog } = {}) {
|
|
|
3254
3254
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-8 w-8" }),
|
|
3255
3255
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: t("billing.title") })
|
|
3256
3256
|
] }),
|
|
3257
|
-
isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3258
|
-
noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3259
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3257
|
+
isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.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" }) }) }),
|
|
3258
|
+
noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.Card, { children: [
|
|
3259
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.CardHeader, { className: "text-center", children: [
|
|
3260
3260
|
/* @__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" }) }),
|
|
3261
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3262
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3261
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.CardTitle, { children: t("billing.ui.dashboard.setup_title") }),
|
|
3262
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.CardDescription, { children: t("billing.ui.dashboard.setup_description") })
|
|
3263
3263
|
] }),
|
|
3264
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3264
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.CardContent, { className: "flex justify-center pb-8", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Button, { onClick: handleCreateCustomer, disabled: creatingCustomer, size: "lg", children: creatingCustomer ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
3265
3265
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "me-2 h-4 w-4 animate-spin" }),
|
|
3266
3266
|
t("billing.ui.dashboard.setting_up")
|
|
3267
3267
|
] }) : t("billing.ui.dashboard.setup_button") }) }),
|
|
3268
|
-
errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3268
|
+
errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.CardContent, { className: "pt-0", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-center text-destructive text-xs/relaxed", children: t(errors.customer) }) })
|
|
3269
3269
|
] }),
|
|
3270
3270
|
!noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
3271
3271
|
criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -3410,7 +3410,7 @@ function getStripePromise(publishableKey) {
|
|
|
3410
3410
|
}
|
|
3411
3411
|
_chunk7QVYU63Ejs.__name.call(void 0, getStripePromise, "getStripePromise");
|
|
3412
3412
|
function StripeProvider({ children }) {
|
|
3413
|
-
const publishableKey =
|
|
3413
|
+
const publishableKey = _chunkI5BQLY7Vjs.getStripePublishableKey.call(void 0, );
|
|
3414
3414
|
const stripePromise = _react.useMemo.call(void 0, () => getStripePromise(publishableKey), [publishableKey]);
|
|
3415
3415
|
const options = _react.useMemo.call(void 0, () => ({}), []);
|
|
3416
3416
|
if (!publishableKey) {
|
|
@@ -3420,7 +3420,7 @@ function StripeProvider({ children }) {
|
|
|
3420
3420
|
}
|
|
3421
3421
|
_chunk7QVYU63Ejs.__name.call(void 0, StripeProvider, "StripeProvider");
|
|
3422
3422
|
function isStripeConfigured() {
|
|
3423
|
-
return !!
|
|
3423
|
+
return !!_chunkI5BQLY7Vjs.getStripePublishableKey.call(void 0, );
|
|
3424
3424
|
}
|
|
3425
3425
|
_chunk7QVYU63Ejs.__name.call(void 0, isStripeConfigured, "isStripeConfigured");
|
|
3426
3426
|
|
|
@@ -3435,18 +3435,18 @@ _chunk7QVYU63Ejs.__name.call(void 0, isStripeConfigured, "isStripeConfigured");
|
|
|
3435
3435
|
|
|
3436
3436
|
function PriceArchiver({ price }) {
|
|
3437
3437
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
3438
|
-
const fmt =
|
|
3438
|
+
const fmt = _chunkUGDYZW4Kjs.useBillingFormatOptions.call(void 0, );
|
|
3439
3439
|
const { archivePrice, restorePrice } = usePriceContext();
|
|
3440
3440
|
const [open, setOpen] = _react.useState.call(void 0, false);
|
|
3441
3441
|
const isArchived = !price.active;
|
|
3442
3442
|
const scope = isArchived ? "restore" : "archive";
|
|
3443
3443
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
3444
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3444
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.Button, { variant: "outline", size: "sm", onClick: () => setOpen(true), children: [
|
|
3445
3445
|
isArchived ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RotateCcwIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ArchiveIcon, {}),
|
|
3446
3446
|
t(`billing.admin.prices.${scope}.confirm`)
|
|
3447
3447
|
] }),
|
|
3448
3448
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3449
|
-
|
|
3449
|
+
_chunkUGDYZW4Kjs.ConfirmDialog,
|
|
3450
3450
|
{
|
|
3451
3451
|
open,
|
|
3452
3452
|
onOpenChange: setOpen,
|
|
@@ -3460,7 +3460,7 @@ function PriceArchiver({ price }) {
|
|
|
3460
3460
|
if (isArchived) await restorePrice(price.id);
|
|
3461
3461
|
else await archivePrice(price.id);
|
|
3462
3462
|
} catch (error) {
|
|
3463
|
-
|
|
3463
|
+
_chunkUGDYZW4Kjs.errorToast.call(void 0, { title: t(`billing.admin.prices.${scope}.title`), error });
|
|
3464
3464
|
throw error;
|
|
3465
3465
|
}
|
|
3466
3466
|
}
|
|
@@ -3492,15 +3492,15 @@ function PriceEditorInternal({
|
|
|
3492
3492
|
onDialogOpenChange
|
|
3493
3493
|
}) {
|
|
3494
3494
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
3495
|
-
const fmt =
|
|
3496
|
-
const router =
|
|
3495
|
+
const fmt = _chunkUGDYZW4Kjs.useBillingFormatOptions.call(void 0, );
|
|
3496
|
+
const router = _chunkA7Y5YW7Qjs.useI18nRouter.call(void 0, );
|
|
3497
3497
|
const { createPrice, updatePrice, productId: contextProductId } = usePriceContext();
|
|
3498
3498
|
const [allFeatures, setAllFeatures] = _react.useState.call(void 0, []);
|
|
3499
3499
|
const isEdit = !!price;
|
|
3500
3500
|
const targetProductId = _nullishCoalesce(_nullishCoalesce(productId, () => ( _optionalChain([price, 'optionalAccess', _120 => _120.product, 'optionalAccess', _121 => _121.id]))), () => ( contextProductId));
|
|
3501
3501
|
_react.useEffect.call(void 0, () => {
|
|
3502
3502
|
const fetchFeatures = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3503
|
-
setAllFeatures(await
|
|
3503
|
+
setAllFeatures(await _chunkOO2DBP6Ljs.FeatureService.findMany({}));
|
|
3504
3504
|
}, "fetchFeatures");
|
|
3505
3505
|
void fetchFeatures();
|
|
3506
3506
|
}, []);
|
|
@@ -3613,7 +3613,7 @@ function PriceEditorInternal({
|
|
|
3613
3613
|
warnedUnknownFor.current = fingerprint;
|
|
3614
3614
|
const { unknown } = resolvePlatformFeatures(seed.platformFeatures);
|
|
3615
3615
|
if (unknown.length > 0)
|
|
3616
|
-
|
|
3616
|
+
_chunkOO2DBP6Ljs.showToast.call(void 0, t("billing.admin.prices.import.warnings.unknownFeatures", { features: unknown.join(", ") }));
|
|
3617
3617
|
}, [seed, isEdit, allFeatures, resolvePlatformFeatures, t]);
|
|
3618
3618
|
const watchInterval = form.watch("interval");
|
|
3619
3619
|
const isRecurring = watchInterval !== "one_time";
|
|
@@ -3634,13 +3634,13 @@ function PriceEditorInternal({
|
|
|
3634
3634
|
{ id: "metered", text: t("billing.admin.prices.usage.metered") }
|
|
3635
3635
|
];
|
|
3636
3636
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3637
|
-
|
|
3637
|
+
_chunkUGDYZW4Kjs.EditorSheet,
|
|
3638
3638
|
{
|
|
3639
3639
|
form,
|
|
3640
3640
|
entityType: t("billing.admin.prices.entity"),
|
|
3641
3641
|
entityName: price ? priceLabel(price, fmt) : void 0,
|
|
3642
3642
|
isEdit,
|
|
3643
|
-
module:
|
|
3643
|
+
module: _chunkA7Y5YW7Qjs.Modules.StripePrice,
|
|
3644
3644
|
size: "lg",
|
|
3645
3645
|
propagateChanges,
|
|
3646
3646
|
onSuccess,
|
|
@@ -3689,13 +3689,13 @@ function PriceEditorInternal({
|
|
|
3689
3689
|
dialogOpen,
|
|
3690
3690
|
onDialogOpenChange,
|
|
3691
3691
|
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
3692
|
-
isEdit && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3693
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3694
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3692
|
+
isEdit && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.Alert, { children: [
|
|
3693
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.AlertTitle, { children: t("billing.admin.prices.immutability.title") }),
|
|
3694
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.AlertDescription, { children: t("billing.admin.prices.immutability.description") })
|
|
3695
3695
|
] }),
|
|
3696
3696
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
|
|
3697
3697
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3698
|
-
|
|
3698
|
+
_chunkUGDYZW4Kjs.FormInput,
|
|
3699
3699
|
{
|
|
3700
3700
|
form,
|
|
3701
3701
|
id: "unitAmount",
|
|
@@ -3707,7 +3707,7 @@ function PriceEditorInternal({
|
|
|
3707
3707
|
}
|
|
3708
3708
|
),
|
|
3709
3709
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3710
|
-
|
|
3710
|
+
_chunkUGDYZW4Kjs.FormSelect,
|
|
3711
3711
|
{
|
|
3712
3712
|
form,
|
|
3713
3713
|
id: "currency",
|
|
@@ -3718,7 +3718,7 @@ function PriceEditorInternal({
|
|
|
3718
3718
|
)
|
|
3719
3719
|
] }),
|
|
3720
3720
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3721
|
-
|
|
3721
|
+
_chunkUGDYZW4Kjs.FormSelect,
|
|
3722
3722
|
{
|
|
3723
3723
|
form,
|
|
3724
3724
|
id: "interval",
|
|
@@ -3729,7 +3729,7 @@ function PriceEditorInternal({
|
|
|
3729
3729
|
),
|
|
3730
3730
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
|
|
3731
3731
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3732
|
-
|
|
3732
|
+
_chunkUGDYZW4Kjs.FormInput,
|
|
3733
3733
|
{
|
|
3734
3734
|
form,
|
|
3735
3735
|
id: "intervalCount",
|
|
@@ -3740,7 +3740,7 @@ function PriceEditorInternal({
|
|
|
3740
3740
|
}
|
|
3741
3741
|
),
|
|
3742
3742
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3743
|
-
|
|
3743
|
+
_chunkUGDYZW4Kjs.FormSelect,
|
|
3744
3744
|
{
|
|
3745
3745
|
form,
|
|
3746
3746
|
id: "usageType",
|
|
@@ -3751,7 +3751,7 @@ function PriceEditorInternal({
|
|
|
3751
3751
|
)
|
|
3752
3752
|
] }),
|
|
3753
3753
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3754
|
-
|
|
3754
|
+
_chunkUGDYZW4Kjs.FormInput,
|
|
3755
3755
|
{
|
|
3756
3756
|
form,
|
|
3757
3757
|
id: "nickname",
|
|
@@ -3760,7 +3760,7 @@ function PriceEditorInternal({
|
|
|
3760
3760
|
}
|
|
3761
3761
|
),
|
|
3762
3762
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3763
|
-
|
|
3763
|
+
_chunkUGDYZW4Kjs.FormTextarea,
|
|
3764
3764
|
{
|
|
3765
3765
|
form,
|
|
3766
3766
|
id: "description",
|
|
@@ -3770,7 +3770,7 @@ function PriceEditorInternal({
|
|
|
3770
3770
|
}
|
|
3771
3771
|
),
|
|
3772
3772
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3773
|
-
|
|
3773
|
+
_chunkUGDYZW4Kjs.FormInput,
|
|
3774
3774
|
{
|
|
3775
3775
|
form,
|
|
3776
3776
|
id: "token",
|
|
@@ -3780,10 +3780,10 @@ function PriceEditorInternal({
|
|
|
3780
3780
|
}
|
|
3781
3781
|
),
|
|
3782
3782
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-2", children: [
|
|
3783
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3783
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.FieldLabel, { children: t("billing.admin.prices.fields.features") }),
|
|
3784
3784
|
form.watch("features").map((_, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
|
|
3785
3785
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3786
|
-
|
|
3786
|
+
_chunkUGDYZW4Kjs.Input,
|
|
3787
3787
|
{
|
|
3788
3788
|
...form.register(`features.${index}`),
|
|
3789
3789
|
placeholder: t("billing.admin.prices.placeholders.feature", { index: index + 1 }),
|
|
@@ -3791,7 +3791,7 @@ function PriceEditorInternal({
|
|
|
3791
3791
|
}
|
|
3792
3792
|
),
|
|
3793
3793
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3794
|
-
|
|
3794
|
+
_chunkUGDYZW4Kjs.Button,
|
|
3795
3795
|
{
|
|
3796
3796
|
type: "button",
|
|
3797
3797
|
variant: "outline",
|
|
@@ -3806,7 +3806,7 @@ function PriceEditorInternal({
|
|
|
3806
3806
|
)
|
|
3807
3807
|
] }, index)),
|
|
3808
3808
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3809
|
-
|
|
3809
|
+
_chunkUGDYZW4Kjs.Button,
|
|
3810
3810
|
{
|
|
3811
3811
|
type: "button",
|
|
3812
3812
|
variant: "outline",
|
|
@@ -3821,12 +3821,12 @@ function PriceEditorInternal({
|
|
|
3821
3821
|
)
|
|
3822
3822
|
] }),
|
|
3823
3823
|
isRecurring && allFeatures.length > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-2", children: [
|
|
3824
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3824
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.FieldLabel, { children: t("billing.admin.prices.fields.platformFeatures") }),
|
|
3825
3825
|
/* @__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) => {
|
|
3826
3826
|
const isChecked = form.watch("featureIds").includes(feature.id);
|
|
3827
3827
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
3828
3828
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3829
|
-
|
|
3829
|
+
_chunkUGDYZW4Kjs.Checkbox,
|
|
3830
3830
|
{
|
|
3831
3831
|
id: `feature-${feature.id}`,
|
|
3832
3832
|
checked: isChecked,
|
|
@@ -3842,13 +3842,13 @@ function PriceEditorInternal({
|
|
|
3842
3842
|
}
|
|
3843
3843
|
}
|
|
3844
3844
|
),
|
|
3845
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3845
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.FieldLabel, { htmlFor: `feature-${feature.id}`, children: feature.name }),
|
|
3846
3846
|
feature.isCore && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.admin.prices.help.core") })
|
|
3847
3847
|
] }, feature.id);
|
|
3848
3848
|
}) })
|
|
3849
3849
|
] }),
|
|
3850
3850
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3851
|
-
|
|
3851
|
+
_chunkUGDYZW4Kjs.FormCheckbox,
|
|
3852
3852
|
{
|
|
3853
3853
|
form,
|
|
3854
3854
|
id: "isTrial",
|
|
@@ -3891,7 +3891,7 @@ var defaultContextValue = {
|
|
|
3891
3891
|
productId: void 0
|
|
3892
3892
|
};
|
|
3893
3893
|
function priceLabel(price, fmt = {}) {
|
|
3894
|
-
return _nullishCoalesce(price.nickname, () => ( `${
|
|
3894
|
+
return _nullishCoalesce(price.nickname, () => ( `${_chunkOO2DBP6Ljs.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt)} ${_chunkOO2DBP6Ljs.formatInterval.call(void 0, price, fmt)}`.trim()));
|
|
3895
3895
|
}
|
|
3896
3896
|
_chunk7QVYU63Ejs.__name.call(void 0, priceLabel, "priceLabel");
|
|
3897
3897
|
var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
@@ -3901,22 +3901,22 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3901
3901
|
productId: productIdProp
|
|
3902
3902
|
}) => {
|
|
3903
3903
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
3904
|
-
const fmt =
|
|
3905
|
-
const generateUrl =
|
|
3906
|
-
const { hasRole } =
|
|
3904
|
+
const fmt = _chunkUGDYZW4Kjs.useBillingFormatOptions.call(void 0, );
|
|
3905
|
+
const generateUrl = _chunkUGDYZW4Kjs.usePageUrlGenerator.call(void 0, );
|
|
3906
|
+
const { hasRole } = _chunkUGDYZW4Kjs.useCurrentUserContext.call(void 0, );
|
|
3907
3907
|
const [price, setPrice] = _react.useState.call(void 0,
|
|
3908
|
-
dehydratedPrice ?
|
|
3908
|
+
dehydratedPrice ? _chunkOO2DBP6Ljs.rehydrate.call(void 0, _chunkA7Y5YW7Qjs.Modules.StripePrice, dehydratedPrice) : void 0
|
|
3909
3909
|
);
|
|
3910
3910
|
const [priceVersion, setPriceVersion] = _react.useState.call(void 0, 0);
|
|
3911
3911
|
const refreshPrices = _react.useCallback.call(void 0, () => setPriceVersion((value2) => value2 + 1), []);
|
|
3912
3912
|
const productId = _nullishCoalesce(productIdProp, () => ( _optionalChain([price, 'optionalAccess', _144 => _144.product, 'optionalAccess', _145 => _145.id])));
|
|
3913
3913
|
const reloadPrice = _react.useCallback.call(void 0, async () => {
|
|
3914
3914
|
if (!_optionalChain([price, 'optionalAccess', _146 => _146.id])) return;
|
|
3915
|
-
setPrice(await
|
|
3915
|
+
setPrice(await _chunkOO2DBP6Ljs.StripePriceService.getPrice({ id: price.id }));
|
|
3916
3916
|
}, [_optionalChain([price, 'optionalAccess', _147 => _147.id])]);
|
|
3917
3917
|
const createPrice = _react.useCallback.call(void 0,
|
|
3918
3918
|
async (input) => {
|
|
3919
|
-
const saved = await
|
|
3919
|
+
const saved = await _chunkOO2DBP6Ljs.StripePriceService.createPrice(input);
|
|
3920
3920
|
refreshPrices();
|
|
3921
3921
|
return saved;
|
|
3922
3922
|
},
|
|
@@ -3924,7 +3924,7 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3924
3924
|
);
|
|
3925
3925
|
const updatePrice = _react.useCallback.call(void 0,
|
|
3926
3926
|
async (input) => {
|
|
3927
|
-
const saved = await
|
|
3927
|
+
const saved = await _chunkOO2DBP6Ljs.StripePriceService.updatePrice(input);
|
|
3928
3928
|
setPrice(saved);
|
|
3929
3929
|
refreshPrices();
|
|
3930
3930
|
return saved;
|
|
@@ -3935,7 +3935,7 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3935
3935
|
async (id) => {
|
|
3936
3936
|
const target = _nullishCoalesce(id, () => ( _optionalChain([price, 'optionalAccess', _148 => _148.id])));
|
|
3937
3937
|
if (!target) return;
|
|
3938
|
-
await
|
|
3938
|
+
await _chunkOO2DBP6Ljs.StripePriceService.archivePrice({ id: target });
|
|
3939
3939
|
await reloadPrice();
|
|
3940
3940
|
refreshPrices();
|
|
3941
3941
|
},
|
|
@@ -3945,7 +3945,7 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3945
3945
|
async (id) => {
|
|
3946
3946
|
const target = _nullishCoalesce(id, () => ( _optionalChain([price, 'optionalAccess', _150 => _150.id])));
|
|
3947
3947
|
if (!target) return;
|
|
3948
|
-
await
|
|
3948
|
+
await _chunkOO2DBP6Ljs.StripePriceService.reactivatePrice({ id: target });
|
|
3949
3949
|
await reloadPrice();
|
|
3950
3950
|
refreshPrices();
|
|
3951
3951
|
},
|
|
@@ -3969,12 +3969,12 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3969
3969
|
if (!publishChrome) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceContext.Provider, { value, children });
|
|
3970
3970
|
const breadcrumb = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
3971
3971
|
const items = [
|
|
3972
|
-
{ name: t("billing.admin.products.title"), href: generateUrl({ page:
|
|
3972
|
+
{ name: t("billing.admin.products.title"), href: generateUrl({ page: _chunkA7Y5YW7Qjs.Modules.StripeProduct }) }
|
|
3973
3973
|
];
|
|
3974
3974
|
if (_optionalChain([price, 'optionalAccess', _152 => _152.product]))
|
|
3975
3975
|
items.push({
|
|
3976
3976
|
name: price.product.name,
|
|
3977
|
-
href: generateUrl({ page:
|
|
3977
|
+
href: generateUrl({ page: _chunkA7Y5YW7Qjs.Modules.StripeProduct, id: price.product.id })
|
|
3978
3978
|
});
|
|
3979
3979
|
if (price) items.push({ name: priceLabel(price, fmt) });
|
|
3980
3980
|
return items;
|
|
@@ -3991,7 +3991,7 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3991
3991
|
}
|
|
3992
3992
|
return response;
|
|
3993
3993
|
}, "title");
|
|
3994
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3994
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceContext.Provider, { value, children }) });
|
|
3995
3995
|
}, "PriceProvider");
|
|
3996
3996
|
var usePriceContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => _nullishCoalesce(_react.useContext.call(void 0, PriceContext), () => ( defaultContextValue)), "usePriceContext");
|
|
3997
3997
|
|
|
@@ -4011,12 +4011,12 @@ function ProductArchiver({ product }) {
|
|
|
4011
4011
|
const isArchived = !product.active;
|
|
4012
4012
|
const scope = isArchived ? "restore" : "archive";
|
|
4013
4013
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
4014
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
4014
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.Button, { variant: "outline", size: "sm", onClick: () => setOpen(true), children: [
|
|
4015
4015
|
isArchived ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RotateCcwIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ArchiveIcon, {}),
|
|
4016
4016
|
t(`billing.admin.products.${scope}.confirm`)
|
|
4017
4017
|
] }),
|
|
4018
4018
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4019
|
-
|
|
4019
|
+
_chunkUGDYZW4Kjs.ConfirmDialog,
|
|
4020
4020
|
{
|
|
4021
4021
|
open,
|
|
4022
4022
|
onOpenChange: setOpen,
|
|
@@ -4030,7 +4030,7 @@ function ProductArchiver({ product }) {
|
|
|
4030
4030
|
if (isArchived) await restoreProduct(product.id);
|
|
4031
4031
|
else await archiveProduct(product.id);
|
|
4032
4032
|
} catch (error) {
|
|
4033
|
-
|
|
4033
|
+
_chunkUGDYZW4Kjs.errorToast.call(void 0, { title: t(`billing.admin.products.${scope}.title`), error });
|
|
4034
4034
|
throw error;
|
|
4035
4035
|
}
|
|
4036
4036
|
}
|
|
@@ -4059,7 +4059,7 @@ function ProductEditorInternal({
|
|
|
4059
4059
|
onDialogOpenChange
|
|
4060
4060
|
}) {
|
|
4061
4061
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4062
|
-
const router =
|
|
4062
|
+
const router = _chunkA7Y5YW7Qjs.useI18nRouter.call(void 0, );
|
|
4063
4063
|
const { createProduct, updateProduct } = useProductContext();
|
|
4064
4064
|
const isEdit = !!product;
|
|
4065
4065
|
const formSchema2 = _react.useMemo.call(void 0,
|
|
@@ -4083,13 +4083,13 @@ function ProductEditorInternal({
|
|
|
4083
4083
|
defaultValues: getDefaultValues()
|
|
4084
4084
|
});
|
|
4085
4085
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4086
|
-
|
|
4086
|
+
_chunkUGDYZW4Kjs.EditorSheet,
|
|
4087
4087
|
{
|
|
4088
4088
|
form,
|
|
4089
4089
|
entityType: t("billing.admin.products.entity"),
|
|
4090
4090
|
entityName: _optionalChain([product, 'optionalAccess', _156 => _156.name]),
|
|
4091
4091
|
isEdit,
|
|
4092
|
-
module:
|
|
4092
|
+
module: _chunkA7Y5YW7Qjs.Modules.StripeProduct,
|
|
4093
4093
|
size: "md",
|
|
4094
4094
|
propagateChanges,
|
|
4095
4095
|
onSuccess,
|
|
@@ -4106,7 +4106,7 @@ function ProductEditorInternal({
|
|
|
4106
4106
|
onDialogOpenChange,
|
|
4107
4107
|
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4108
4108
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4109
|
-
|
|
4109
|
+
_chunkUGDYZW4Kjs.FormInput,
|
|
4110
4110
|
{
|
|
4111
4111
|
form,
|
|
4112
4112
|
id: "name",
|
|
@@ -4116,7 +4116,7 @@ function ProductEditorInternal({
|
|
|
4116
4116
|
}
|
|
4117
4117
|
),
|
|
4118
4118
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4119
|
-
|
|
4119
|
+
_chunkUGDYZW4Kjs.FormTextarea,
|
|
4120
4120
|
{
|
|
4121
4121
|
form,
|
|
4122
4122
|
id: "description",
|
|
@@ -4160,20 +4160,20 @@ var defaultContextValue2 = {
|
|
|
4160
4160
|
};
|
|
4161
4161
|
var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ children, dehydratedProduct, publishChrome = true }) => {
|
|
4162
4162
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4163
|
-
const generateUrl =
|
|
4164
|
-
const { hasRole } =
|
|
4163
|
+
const generateUrl = _chunkUGDYZW4Kjs.usePageUrlGenerator.call(void 0, );
|
|
4164
|
+
const { hasRole } = _chunkUGDYZW4Kjs.useCurrentUserContext.call(void 0, );
|
|
4165
4165
|
const [product, setProduct] = _react.useState.call(void 0,
|
|
4166
|
-
dehydratedProduct ?
|
|
4166
|
+
dehydratedProduct ? _chunkOO2DBP6Ljs.rehydrate.call(void 0, _chunkA7Y5YW7Qjs.Modules.StripeProduct, dehydratedProduct) : void 0
|
|
4167
4167
|
);
|
|
4168
4168
|
const [catalogueVersion, setCatalogueVersion] = _react.useState.call(void 0, 0);
|
|
4169
4169
|
const refreshCatalogue = _react.useCallback.call(void 0, () => setCatalogueVersion((value2) => value2 + 1), []);
|
|
4170
4170
|
const reloadProduct = _react.useCallback.call(void 0, async () => {
|
|
4171
4171
|
if (!_optionalChain([product, 'optionalAccess', _157 => _157.id])) return;
|
|
4172
|
-
setProduct(await
|
|
4172
|
+
setProduct(await _chunkOO2DBP6Ljs.StripeProductService.getProduct({ id: product.id }));
|
|
4173
4173
|
}, [_optionalChain([product, 'optionalAccess', _158 => _158.id])]);
|
|
4174
4174
|
const createProduct = _react.useCallback.call(void 0,
|
|
4175
4175
|
async (input) => {
|
|
4176
|
-
const saved = await
|
|
4176
|
+
const saved = await _chunkOO2DBP6Ljs.StripeProductService.createProduct(input);
|
|
4177
4177
|
refreshCatalogue();
|
|
4178
4178
|
return saved;
|
|
4179
4179
|
},
|
|
@@ -4181,7 +4181,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
4181
4181
|
);
|
|
4182
4182
|
const updateProduct = _react.useCallback.call(void 0,
|
|
4183
4183
|
async (input) => {
|
|
4184
|
-
const saved = await
|
|
4184
|
+
const saved = await _chunkOO2DBP6Ljs.StripeProductService.updateProduct(input);
|
|
4185
4185
|
setProduct(saved);
|
|
4186
4186
|
refreshCatalogue();
|
|
4187
4187
|
return saved;
|
|
@@ -4192,7 +4192,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
4192
4192
|
async (id) => {
|
|
4193
4193
|
const target = _nullishCoalesce(id, () => ( _optionalChain([product, 'optionalAccess', _159 => _159.id])));
|
|
4194
4194
|
if (!target) return;
|
|
4195
|
-
await
|
|
4195
|
+
await _chunkOO2DBP6Ljs.StripeProductService.archiveProduct({ id: target });
|
|
4196
4196
|
await reloadProduct();
|
|
4197
4197
|
refreshCatalogue();
|
|
4198
4198
|
},
|
|
@@ -4202,7 +4202,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
4202
4202
|
async (id) => {
|
|
4203
4203
|
const target = _nullishCoalesce(id, () => ( _optionalChain([product, 'optionalAccess', _161 => _161.id])));
|
|
4204
4204
|
if (!target) return;
|
|
4205
|
-
await
|
|
4205
|
+
await _chunkOO2DBP6Ljs.StripeProductService.reactivateProduct({ id: target });
|
|
4206
4206
|
await reloadProduct();
|
|
4207
4207
|
refreshCatalogue();
|
|
4208
4208
|
},
|
|
@@ -4237,7 +4237,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
4237
4237
|
{
|
|
4238
4238
|
name: t("billing.admin.products.title"),
|
|
4239
4239
|
// Linked only when it is NOT the current page.
|
|
4240
|
-
...product ? { href: generateUrl({ page:
|
|
4240
|
+
...product ? { href: generateUrl({ page: _chunkA7Y5YW7Qjs.Modules.StripeProduct }) } : {}
|
|
4241
4241
|
}
|
|
4242
4242
|
];
|
|
4243
4243
|
if (product) items.push({ name: product.name });
|
|
@@ -4255,7 +4255,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
4255
4255
|
}
|
|
4256
4256
|
return response;
|
|
4257
4257
|
}, "title");
|
|
4258
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4258
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductContext.Provider, { value, children }) });
|
|
4259
4259
|
}, "ProductProvider");
|
|
4260
4260
|
var useProductContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => _nullishCoalesce(_react.useContext.call(void 0, ProductContext), () => ( defaultContextValue2)), "useProductContext");
|
|
4261
4261
|
|
|
@@ -4264,57 +4264,57 @@ var useProductContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ()
|
|
|
4264
4264
|
|
|
4265
4265
|
function PriceDetails() {
|
|
4266
4266
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4267
|
-
const fmt =
|
|
4268
|
-
const generateUrl =
|
|
4267
|
+
const fmt = _chunkUGDYZW4Kjs.useBillingFormatOptions.call(void 0, );
|
|
4268
|
+
const generateUrl = _chunkUGDYZW4Kjs.usePageUrlGenerator.call(void 0, );
|
|
4269
4269
|
const { price } = usePriceContext();
|
|
4270
4270
|
if (!price) return null;
|
|
4271
4271
|
const isRecurring = price.priceType === "recurring";
|
|
4272
4272
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-8", children: [
|
|
4273
4273
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4274
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4274
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.SectionHeader, { children: t("billing.admin.prices.title") }),
|
|
4275
4275
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
4276
4276
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4277
|
-
|
|
4277
|
+
_chunkUGDYZW4Kjs.DetailField,
|
|
4278
4278
|
{
|
|
4279
4279
|
label: t("billing.admin.prices.fields.product"),
|
|
4280
|
-
value: price.product ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4280
|
+
value: price.product ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Link, { href: generateUrl({ page: _chunkA7Y5YW7Qjs.Modules.StripeProduct, id: price.product.id }), children: price.product.name }) : "\u2014"
|
|
4281
4281
|
}
|
|
4282
4282
|
),
|
|
4283
4283
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4284
|
-
|
|
4284
|
+
_chunkUGDYZW4Kjs.DetailField,
|
|
4285
4285
|
{
|
|
4286
4286
|
label: t("billing.admin.prices.fields.status"),
|
|
4287
4287
|
value: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex flex-wrap items-center gap-1", children: [
|
|
4288
|
-
price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4289
|
-
price.isTrial && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4288
|
+
price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Badge, { variant: "softGreen", children: t("billing.admin.prices.status.active") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Badge, { variant: "softGray", children: t("billing.admin.prices.status.archived") }),
|
|
4289
|
+
price.isTrial && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Badge, { variant: "softBlue", children: t("billing.admin.prices.badge.trial") })
|
|
4290
4290
|
] })
|
|
4291
4291
|
}
|
|
4292
4292
|
),
|
|
4293
4293
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4294
|
-
|
|
4294
|
+
_chunkUGDYZW4Kjs.DetailField,
|
|
4295
4295
|
{
|
|
4296
4296
|
label: t("billing.admin.prices.fields.amount"),
|
|
4297
|
-
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children:
|
|
4297
|
+
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _chunkOO2DBP6Ljs.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt) })
|
|
4298
4298
|
}
|
|
4299
4299
|
),
|
|
4300
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4300
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.DetailField, { label: t("billing.admin.prices.fields.currency"), value: price.currency.toUpperCase() }),
|
|
4301
4301
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4302
|
-
|
|
4302
|
+
_chunkUGDYZW4Kjs.DetailField,
|
|
4303
4303
|
{
|
|
4304
4304
|
label: t("billing.admin.prices.fields.type"),
|
|
4305
4305
|
value: isRecurring ? t("billing.admin.prices.type.recurring") : t("billing.admin.prices.type.oneTime")
|
|
4306
4306
|
}
|
|
4307
4307
|
),
|
|
4308
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4308
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.DetailField, { label: t("billing.admin.prices.fields.billing"), value: _chunkOO2DBP6Ljs.formatInterval.call(void 0, price, fmt) }),
|
|
4309
4309
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4310
|
-
|
|
4310
|
+
_chunkUGDYZW4Kjs.DetailField,
|
|
4311
4311
|
{
|
|
4312
4312
|
label: t("billing.admin.prices.fields.intervalCount"),
|
|
4313
4313
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _nullishCoalesce(_optionalChain([price, 'access', _163 => _163.recurring, 'optionalAccess', _164 => _164.intervalCount]), () => ( 1)) })
|
|
4314
4314
|
}
|
|
4315
4315
|
),
|
|
4316
4316
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4317
|
-
|
|
4317
|
+
_chunkUGDYZW4Kjs.DetailField,
|
|
4318
4318
|
{
|
|
4319
4319
|
label: t("billing.admin.prices.fields.usageType"),
|
|
4320
4320
|
value: _optionalChain([price, 'access', _165 => _165.recurring, 'optionalAccess', _166 => _166.usageType]) === "metered" ? t("billing.admin.prices.usage.metered") : t("billing.admin.prices.usage.licensed")
|
|
@@ -4323,24 +4323,24 @@ function PriceDetails() {
|
|
|
4323
4323
|
] })
|
|
4324
4324
|
] }),
|
|
4325
4325
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4326
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4326
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.SectionHeader, { children: t("billing.admin.prices.fields.platformFeatures") }),
|
|
4327
4327
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
4328
4328
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4329
|
-
|
|
4329
|
+
_chunkUGDYZW4Kjs.DetailField,
|
|
4330
4330
|
{
|
|
4331
4331
|
label: t("billing.admin.prices.fields.token"),
|
|
4332
4332
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _nullishCoalesce(price.token, () => ( "\u2014")) })
|
|
4333
4333
|
}
|
|
4334
4334
|
),
|
|
4335
4335
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4336
|
-
|
|
4336
|
+
_chunkUGDYZW4Kjs.DetailField,
|
|
4337
4337
|
{
|
|
4338
4338
|
label: t("billing.admin.prices.fields.stripeId"),
|
|
4339
4339
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: price.stripePriceId })
|
|
4340
4340
|
}
|
|
4341
4341
|
),
|
|
4342
4342
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4343
|
-
|
|
4343
|
+
_chunkUGDYZW4Kjs.DetailField,
|
|
4344
4344
|
{
|
|
4345
4345
|
label: t("billing.admin.prices.fields.description"),
|
|
4346
4346
|
value: _nullishCoalesce(price.description, () => ( "\u2014")),
|
|
@@ -4348,7 +4348,7 @@ function PriceDetails() {
|
|
|
4348
4348
|
}
|
|
4349
4349
|
),
|
|
4350
4350
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4351
|
-
|
|
4351
|
+
_chunkUGDYZW4Kjs.DetailField,
|
|
4352
4352
|
{
|
|
4353
4353
|
label: t("billing.admin.prices.fields.features"),
|
|
4354
4354
|
className: "md:col-span-2",
|
|
@@ -4356,11 +4356,11 @@ function PriceDetails() {
|
|
|
4356
4356
|
}
|
|
4357
4357
|
),
|
|
4358
4358
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4359
|
-
|
|
4359
|
+
_chunkUGDYZW4Kjs.DetailField,
|
|
4360
4360
|
{
|
|
4361
4361
|
label: t("billing.admin.prices.fields.platformFeatures"),
|
|
4362
4362
|
className: "md:col-span-2",
|
|
4363
|
-
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,
|
|
4363
|
+
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, _chunkUGDYZW4Kjs.Badge, { variant: "softGray", children: feature.name }, feature.id)) }) : "\u2014"
|
|
4364
4364
|
}
|
|
4365
4365
|
)
|
|
4366
4366
|
] })
|
|
@@ -4374,7 +4374,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, PriceDetails, "PriceDetails");
|
|
|
4374
4374
|
function PriceContainer() {
|
|
4375
4375
|
const { price } = usePriceContext();
|
|
4376
4376
|
if (!price) return null;
|
|
4377
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4377
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.RoundPageContainer, { module: _chunkA7Y5YW7Qjs.Modules.StripePrice, id: price.id, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceDetails, {}) });
|
|
4378
4378
|
}
|
|
4379
4379
|
_chunk7QVYU63Ejs.__name.call(void 0, PriceContainer, "PriceContainer");
|
|
4380
4380
|
|
|
@@ -4499,10 +4499,10 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4499
4499
|
const importInputRef = _react.useRef.call(void 0, null);
|
|
4500
4500
|
const [seed, setSeed] = _react.useState.call(void 0, void 0);
|
|
4501
4501
|
const [seedNonce, setSeedNonce] = _react.useState.call(void 0, 0);
|
|
4502
|
-
const data =
|
|
4503
|
-
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) =>
|
|
4502
|
+
const data = _chunkUGDYZW4Kjs.useDataListRetriever.call(void 0, {
|
|
4503
|
+
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunkOO2DBP6Ljs.StripePriceService.listPrices({ ...params, productId }), "retriever"),
|
|
4504
4504
|
retrieverParams: {},
|
|
4505
|
-
module:
|
|
4505
|
+
module: _chunkA7Y5YW7Qjs.Modules.StripePrice
|
|
4506
4506
|
});
|
|
4507
4507
|
_react.useEffect.call(void 0, () => {
|
|
4508
4508
|
if (priceVersion > 0) void data.refresh();
|
|
@@ -4537,7 +4537,7 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4537
4537
|
openSeededEditor(transfer.price);
|
|
4538
4538
|
} catch (error) {
|
|
4539
4539
|
console.error("[PricesList] price import failed", error);
|
|
4540
|
-
|
|
4540
|
+
_chunkUGDYZW4Kjs.errorToast.call(void 0, {
|
|
4541
4541
|
title: t("billing.admin.prices.import.errors.title"),
|
|
4542
4542
|
error: t("billing.admin.prices.import.errors.invalid")
|
|
4543
4543
|
});
|
|
@@ -4556,7 +4556,7 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4556
4556
|
"create-price"
|
|
4557
4557
|
),
|
|
4558
4558
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _react.Fragment, { children: [
|
|
4559
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
4559
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUGDYZW4Kjs.Button, { variant: "outline", size: "sm", type: "button", onClick: () => _optionalChain([importInputRef, 'access', _181 => _181.current, 'optionalAccess', _182 => _182.click, 'call', _183 => _183()]), children: [
|
|
4560
4560
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.UploadIcon, {}),
|
|
4561
4561
|
t("billing.admin.prices.actions.import")
|
|
4562
4562
|
] }),
|
|
@@ -4574,7 +4574,7 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4574
4574
|
];
|
|
4575
4575
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
4576
4576
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4577
|
-
|
|
4577
|
+
_chunkUGDYZW4Kjs.ContentListTable,
|
|
4578
4578
|
{
|
|
4579
4579
|
data,
|
|
4580
4580
|
fields: [
|
|
@@ -4585,13 +4585,13 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4585
4585
|
"status" /* status */,
|
|
4586
4586
|
"actions" /* actions */
|
|
4587
4587
|
],
|
|
4588
|
-
tableGeneratorType:
|
|
4588
|
+
tableGeneratorType: _chunkA7Y5YW7Qjs.Modules.StripePrice,
|
|
4589
4589
|
functions,
|
|
4590
4590
|
context: tableContext,
|
|
4591
4591
|
fullWidth,
|
|
4592
4592
|
title: t("billing.admin.prices.title"),
|
|
4593
4593
|
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4594
|
-
|
|
4594
|
+
_chunkUGDYZW4Kjs.EmptyState,
|
|
4595
4595
|
{
|
|
4596
4596
|
icon: _lucidereact.DollarSignIcon,
|
|
4597
4597
|
title: t("billing.admin.prices.empty.title"),
|
|
@@ -4631,18 +4631,18 @@ function ProductDetails() {
|
|
|
4631
4631
|
const { product } = useProductContext();
|
|
4632
4632
|
if (!product) return null;
|
|
4633
4633
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4634
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4634
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.SectionHeader, { children: t("billing.admin.products.tabs.details") }),
|
|
4635
4635
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
4636
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4636
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.DetailField, { label: t("billing.admin.products.fields.name"), value: product.name }),
|
|
4637
4637
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4638
|
-
|
|
4638
|
+
_chunkUGDYZW4Kjs.DetailField,
|
|
4639
4639
|
{
|
|
4640
4640
|
label: t("billing.admin.products.fields.status"),
|
|
4641
|
-
value: product.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4641
|
+
value: product.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Badge, { variant: "softGreen", children: t("billing.admin.products.status.active") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Badge, { variant: "softGray", children: t("billing.admin.products.status.archived") })
|
|
4642
4642
|
}
|
|
4643
4643
|
),
|
|
4644
4644
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4645
|
-
|
|
4645
|
+
_chunkUGDYZW4Kjs.DetailField,
|
|
4646
4646
|
{
|
|
4647
4647
|
label: t("billing.admin.products.fields.description"),
|
|
4648
4648
|
value: _nullishCoalesce(product.description, () => ( "\u2014")),
|
|
@@ -4650,14 +4650,14 @@ function ProductDetails() {
|
|
|
4650
4650
|
}
|
|
4651
4651
|
),
|
|
4652
4652
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4653
|
-
|
|
4653
|
+
_chunkUGDYZW4Kjs.DetailField,
|
|
4654
4654
|
{
|
|
4655
4655
|
label: t("billing.admin.products.fields.prices"),
|
|
4656
4656
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: product.stripePrices.length })
|
|
4657
4657
|
}
|
|
4658
4658
|
),
|
|
4659
4659
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4660
|
-
|
|
4660
|
+
_chunkUGDYZW4Kjs.DetailField,
|
|
4661
4661
|
{
|
|
4662
4662
|
label: t("billing.admin.products.fields.stripeId"),
|
|
4663
4663
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: product.stripeProductId })
|
|
@@ -4675,9 +4675,9 @@ function ProductContainer() {
|
|
|
4675
4675
|
const { product } = useProductContext();
|
|
4676
4676
|
if (!product) return null;
|
|
4677
4677
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4678
|
-
|
|
4678
|
+
_chunkUGDYZW4Kjs.RoundPageContainer,
|
|
4679
4679
|
{
|
|
4680
|
-
module:
|
|
4680
|
+
module: _chunkA7Y5YW7Qjs.Modules.StripeProduct,
|
|
4681
4681
|
id: product.id,
|
|
4682
4682
|
tabs: [
|
|
4683
4683
|
{
|
|
@@ -4686,7 +4686,7 @@ function ProductContainer() {
|
|
|
4686
4686
|
content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductDetails, {})
|
|
4687
4687
|
},
|
|
4688
4688
|
{
|
|
4689
|
-
key:
|
|
4689
|
+
key: _chunkA7Y5YW7Qjs.Modules.StripePrice,
|
|
4690
4690
|
label: t("billing.admin.prices.title"),
|
|
4691
4691
|
// publishChrome={false}: SharedProvider REPLACES its value for the
|
|
4692
4692
|
// subtree (SharedContext.tsx:35-37), so a nested provider publishing
|
|
@@ -4712,18 +4712,18 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductContainer, "ProductContainer");
|
|
|
4712
4712
|
|
|
4713
4713
|
function CouponsList({ fullWidth } = {}) {
|
|
4714
4714
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4715
|
-
const { catalogueVersion } =
|
|
4716
|
-
const data =
|
|
4717
|
-
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) =>
|
|
4715
|
+
const { catalogueVersion } = _chunkUGDYZW4Kjs.useCouponContext.call(void 0, );
|
|
4716
|
+
const data = _chunkUGDYZW4Kjs.useDataListRetriever.call(void 0, {
|
|
4717
|
+
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunkOO2DBP6Ljs.StripeCouponService.listCoupons(params), "retriever"),
|
|
4718
4718
|
retrieverParams: {},
|
|
4719
|
-
module:
|
|
4719
|
+
module: _chunkA7Y5YW7Qjs.Modules.StripeCoupon
|
|
4720
4720
|
});
|
|
4721
4721
|
_react.useEffect.call(void 0, () => {
|
|
4722
4722
|
if (catalogueVersion > 0) void data.refresh();
|
|
4723
4723
|
}, [catalogueVersion]);
|
|
4724
|
-
const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4724
|
+
const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.CouponEditor, {}, "create-coupon")];
|
|
4725
4725
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4726
|
-
|
|
4726
|
+
_chunkUGDYZW4Kjs.ContentListTable,
|
|
4727
4727
|
{
|
|
4728
4728
|
data,
|
|
4729
4729
|
fields: [
|
|
@@ -4733,12 +4733,12 @@ function CouponsList({ fullWidth } = {}) {
|
|
|
4733
4733
|
"codes" /* codes */,
|
|
4734
4734
|
"status" /* status */
|
|
4735
4735
|
],
|
|
4736
|
-
tableGeneratorType:
|
|
4736
|
+
tableGeneratorType: _chunkA7Y5YW7Qjs.Modules.StripeCoupon,
|
|
4737
4737
|
functions,
|
|
4738
4738
|
fullWidth,
|
|
4739
4739
|
title: t("billing.admin.coupons.title"),
|
|
4740
4740
|
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4741
|
-
|
|
4741
|
+
_chunkUGDYZW4Kjs.EmptyState,
|
|
4742
4742
|
{
|
|
4743
4743
|
icon: _lucidereact.TicketPercentIcon,
|
|
4744
4744
|
title: t("billing.admin.coupons.empty.title"),
|
|
@@ -4758,26 +4758,26 @@ _chunk7QVYU63Ejs.__name.call(void 0, CouponsList, "CouponsList");
|
|
|
4758
4758
|
function ProductsList({ fullWidth } = {}) {
|
|
4759
4759
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4760
4760
|
const { catalogueVersion } = useProductContext();
|
|
4761
|
-
const data =
|
|
4762
|
-
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) =>
|
|
4761
|
+
const data = _chunkUGDYZW4Kjs.useDataListRetriever.call(void 0, {
|
|
4762
|
+
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunkOO2DBP6Ljs.StripeProductService.listProducts(params), "retriever"),
|
|
4763
4763
|
retrieverParams: {},
|
|
4764
|
-
module:
|
|
4764
|
+
module: _chunkA7Y5YW7Qjs.Modules.StripeProduct
|
|
4765
4765
|
});
|
|
4766
4766
|
_react.useEffect.call(void 0, () => {
|
|
4767
4767
|
if (catalogueVersion > 0) void data.refresh();
|
|
4768
4768
|
}, [catalogueVersion]);
|
|
4769
4769
|
const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductEditor, {}, "create-product")];
|
|
4770
4770
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4771
|
-
|
|
4771
|
+
_chunkUGDYZW4Kjs.ContentListTable,
|
|
4772
4772
|
{
|
|
4773
4773
|
data,
|
|
4774
4774
|
fields: ["name" /* name */, "status" /* status */, "prices" /* prices */],
|
|
4775
|
-
tableGeneratorType:
|
|
4775
|
+
tableGeneratorType: _chunkA7Y5YW7Qjs.Modules.StripeProduct,
|
|
4776
4776
|
functions,
|
|
4777
4777
|
fullWidth,
|
|
4778
4778
|
title: t("billing.admin.products.title"),
|
|
4779
4779
|
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4780
|
-
|
|
4780
|
+
_chunkUGDYZW4Kjs.EmptyState,
|
|
4781
4781
|
{
|
|
4782
4782
|
icon: _lucidereact.PackageIcon,
|
|
4783
4783
|
title: t("billing.admin.products.empty.title"),
|
|
@@ -4793,10 +4793,10 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductsList, "ProductsList");
|
|
|
4793
4793
|
|
|
4794
4794
|
function ProductsListContainer() {
|
|
4795
4795
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4796
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductProvider, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4797
|
-
|
|
4796
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductProvider, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.CouponProvider, { publishChrome: false, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4797
|
+
_chunkUGDYZW4Kjs.RoundPageContainer,
|
|
4798
4798
|
{
|
|
4799
|
-
module:
|
|
4799
|
+
module: _chunkA7Y5YW7Qjs.Modules.StripeProduct,
|
|
4800
4800
|
tabs: [
|
|
4801
4801
|
{ sectionKey: "products", label: t("billing.admin.products.tabs.products"), content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductsList, {}) },
|
|
4802
4802
|
{ sectionKey: "codes", label: t("billing.admin.products.tabs.codes"), content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CouponsList, {}) }
|
|
@@ -4814,30 +4814,30 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductsListContainer, "ProductsListContain
|
|
|
4814
4814
|
|
|
4815
4815
|
function CouponDetails() {
|
|
4816
4816
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4817
|
-
const fmt =
|
|
4818
|
-
const { coupon } =
|
|
4817
|
+
const fmt = _chunkUGDYZW4Kjs.useBillingFormatOptions.call(void 0, );
|
|
4818
|
+
const { coupon } = _chunkUGDYZW4Kjs.useCouponContext.call(void 0, );
|
|
4819
4819
|
if (!coupon) return null;
|
|
4820
4820
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4821
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4821
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.SectionHeader, { children: t("billing.admin.products.tabs.details") }),
|
|
4822
4822
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-xs/relaxed", children: t("billing.admin.coupons.fixed_notice") }),
|
|
4823
4823
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
4824
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4824
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.DetailField, { label: t("billing.admin.coupons.fields.name"), value: coupon.name }),
|
|
4825
4825
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4826
|
-
|
|
4826
|
+
_chunkUGDYZW4Kjs.DetailField,
|
|
4827
4827
|
{
|
|
4828
4828
|
label: t("billing.admin.coupons.fields.status"),
|
|
4829
|
-
value: coupon.valid ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4829
|
+
value: coupon.valid ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Badge, { variant: "softGreen", children: t("billing.admin.coupons.status.active") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.Badge, { variant: "softGray", children: t("billing.admin.coupons.status.ended") })
|
|
4830
4830
|
}
|
|
4831
4831
|
),
|
|
4832
4832
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4833
|
-
|
|
4833
|
+
_chunkUGDYZW4Kjs.DetailField,
|
|
4834
4834
|
{
|
|
4835
4835
|
label: t("billing.admin.coupons.fields.discount"),
|
|
4836
|
-
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children:
|
|
4836
|
+
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _chunkOO2DBP6Ljs.formatCouponDiscount.call(void 0, coupon, t, fmt) })
|
|
4837
4837
|
}
|
|
4838
4838
|
),
|
|
4839
4839
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4840
|
-
|
|
4840
|
+
_chunkUGDYZW4Kjs.DetailField,
|
|
4841
4841
|
{
|
|
4842
4842
|
label: t("billing.admin.coupons.fields.places"),
|
|
4843
4843
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: coupon.maxRedemptions !== void 0 ? t("billing.admin.coupons.places.limited", {
|
|
@@ -4847,21 +4847,21 @@ function CouponDetails() {
|
|
|
4847
4847
|
}
|
|
4848
4848
|
),
|
|
4849
4849
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4850
|
-
|
|
4850
|
+
_chunkUGDYZW4Kjs.DetailField,
|
|
4851
4851
|
{
|
|
4852
4852
|
label: t("billing.admin.coupons.fields.products"),
|
|
4853
4853
|
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")
|
|
4854
4854
|
}
|
|
4855
4855
|
),
|
|
4856
4856
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4857
|
-
|
|
4857
|
+
_chunkUGDYZW4Kjs.DetailField,
|
|
4858
4858
|
{
|
|
4859
4859
|
label: t("billing.admin.coupons.fields.redeemBy"),
|
|
4860
|
-
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: coupon.redeemBy ?
|
|
4860
|
+
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: coupon.redeemBy ? _chunkUGDYZW4Kjs.formatDate.call(void 0, coupon.redeemBy, fmt) : "\u2014" })
|
|
4861
4861
|
}
|
|
4862
4862
|
),
|
|
4863
4863
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4864
|
-
|
|
4864
|
+
_chunkUGDYZW4Kjs.DetailField,
|
|
4865
4865
|
{
|
|
4866
4866
|
label: t("billing.admin.coupons.fields.stripeId"),
|
|
4867
4867
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: coupon.stripeCouponId })
|
|
@@ -4895,33 +4895,33 @@ function CouponCodeEditorInternal({
|
|
|
4895
4895
|
onDialogOpenChange
|
|
4896
4896
|
}) {
|
|
4897
4897
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4898
|
-
const router =
|
|
4899
|
-
const { createCode } =
|
|
4900
|
-
const formSchema2 = _react.useMemo.call(void 0, () => _zod3.z.object({ id: _zod3.z.uuidv4() }).and(
|
|
4901
|
-
const getDefaultValues = _react.useCallback.call(void 0, () => ({ id: _uuid.v4.call(void 0, ), ...
|
|
4898
|
+
const router = _chunkA7Y5YW7Qjs.useI18nRouter.call(void 0, );
|
|
4899
|
+
const { createCode } = _chunkUGDYZW4Kjs.useCouponContext.call(void 0, );
|
|
4900
|
+
const formSchema2 = _react.useMemo.call(void 0, () => _zod3.z.object({ id: _zod3.z.uuidv4() }).and(_chunkUGDYZW4Kjs.couponCodeSchema.call(void 0, t)), [t]);
|
|
4901
|
+
const getDefaultValues = _react.useCallback.call(void 0, () => ({ id: _uuid.v4.call(void 0, ), ..._chunkUGDYZW4Kjs.couponCodeDefaults.call(void 0, ) }), []);
|
|
4902
4902
|
const form = _reacthookform.useForm.call(void 0, {
|
|
4903
4903
|
resolver: _zod.zodResolver.call(void 0, formSchema2),
|
|
4904
4904
|
defaultValues: getDefaultValues()
|
|
4905
4905
|
});
|
|
4906
4906
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4907
|
-
|
|
4907
|
+
_chunkUGDYZW4Kjs.EditorSheet,
|
|
4908
4908
|
{
|
|
4909
4909
|
form,
|
|
4910
4910
|
entityType: t("billing.admin.coupons.codes.entity"),
|
|
4911
4911
|
isEdit: false,
|
|
4912
|
-
module:
|
|
4912
|
+
module: _chunkA7Y5YW7Qjs.Modules.StripeCouponCode,
|
|
4913
4913
|
size: "md",
|
|
4914
4914
|
onSuccess: _nullishCoalesce(onSuccess, () => ( (() => {
|
|
4915
4915
|
}))),
|
|
4916
4916
|
onNavigate: (url) => router.push(url),
|
|
4917
|
-
onSubmit: async (values) => await createCode({ id: values.id, couponId, ...
|
|
4917
|
+
onSubmit: async (values) => await createCode({ id: values.id, couponId, ..._chunkUGDYZW4Kjs.toCouponCodeInput.call(void 0, values) }),
|
|
4918
4918
|
onReset: getDefaultValues,
|
|
4919
4919
|
trigger,
|
|
4920
4920
|
forceShow,
|
|
4921
4921
|
onClose,
|
|
4922
4922
|
dialogOpen,
|
|
4923
4923
|
onDialogOpenChange,
|
|
4924
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4924
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUGDYZW4Kjs.CouponCodeFields, { form })
|
|
4925
4925
|
}
|
|
4926
4926
|
);
|
|
4927
4927
|
}
|
|
@@ -4935,18 +4935,18 @@ _chunk7QVYU63Ejs.__name.call(void 0, CouponCodeEditor, "CouponCodeEditor");
|
|
|
4935
4935
|
|
|
4936
4936
|
function CouponCodesList({ couponId }) {
|
|
4937
4937
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4938
|
-
const { catalogueVersion } =
|
|
4939
|
-
const data =
|
|
4940
|
-
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) =>
|
|
4938
|
+
const { catalogueVersion } = _chunkUGDYZW4Kjs.useCouponContext.call(void 0, );
|
|
4939
|
+
const data = _chunkUGDYZW4Kjs.useDataListRetriever.call(void 0, {
|
|
4940
|
+
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunkOO2DBP6Ljs.StripeCouponCodeService.listByCoupon({ ...params, couponId }), "retriever"),
|
|
4941
4941
|
retrieverParams: {},
|
|
4942
|
-
module:
|
|
4942
|
+
module: _chunkA7Y5YW7Qjs.Modules.StripeCouponCode
|
|
4943
4943
|
});
|
|
4944
4944
|
_react.useEffect.call(void 0, () => {
|
|
4945
4945
|
if (catalogueVersion > 0) void data.refresh();
|
|
4946
4946
|
}, [catalogueVersion]);
|
|
4947
4947
|
const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, CouponCodeEditor, { couponId }, "create-code")];
|
|
4948
4948
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4949
|
-
|
|
4949
|
+
_chunkUGDYZW4Kjs.ContentListTable,
|
|
4950
4950
|
{
|
|
4951
4951
|
data,
|
|
4952
4952
|
fields: [
|
|
@@ -4957,11 +4957,11 @@ function CouponCodesList({ couponId }) {
|
|
|
4957
4957
|
"status" /* status */,
|
|
4958
4958
|
"actions" /* actions */
|
|
4959
4959
|
],
|
|
4960
|
-
tableGeneratorType:
|
|
4960
|
+
tableGeneratorType: _chunkA7Y5YW7Qjs.Modules.StripeCouponCode,
|
|
4961
4961
|
functions,
|
|
4962
4962
|
title: t("billing.admin.coupons.codes.title"),
|
|
4963
4963
|
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4964
|
-
|
|
4964
|
+
_chunkUGDYZW4Kjs.EmptyState,
|
|
4965
4965
|
{
|
|
4966
4966
|
icon: _lucidereact.TicketIcon,
|
|
4967
4967
|
title: t("billing.admin.coupons.codes.empty.title"),
|
|
@@ -4977,12 +4977,12 @@ _chunk7QVYU63Ejs.__name.call(void 0, CouponCodesList, "CouponCodesList");
|
|
|
4977
4977
|
|
|
4978
4978
|
function CouponContainer() {
|
|
4979
4979
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4980
|
-
const { coupon } =
|
|
4980
|
+
const { coupon } = _chunkUGDYZW4Kjs.useCouponContext.call(void 0, );
|
|
4981
4981
|
if (!coupon) return null;
|
|
4982
4982
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4983
|
-
|
|
4983
|
+
_chunkUGDYZW4Kjs.RoundPageContainer,
|
|
4984
4984
|
{
|
|
4985
|
-
module:
|
|
4985
|
+
module: _chunkUGDYZW4Kjs.couponPageModule.call(void 0, ),
|
|
4986
4986
|
id: coupon.id,
|
|
4987
4987
|
tabs: [
|
|
4988
4988
|
{
|
|
@@ -5089,5 +5089,5 @@ _chunk7QVYU63Ejs.__name.call(void 0, CouponContainer, "CouponContainer");
|
|
|
5089
5089
|
|
|
5090
5090
|
|
|
5091
5091
|
|
|
5092
|
-
exports.BillingAlertBanner = BillingAlertBanner; exports.BillingDashboardContainer = BillingDashboardContainer; exports.BillingDetailModal = BillingDetailModal; exports.BillingUsageSummaryCard = BillingUsageSummaryCard; exports.CancelSubscriptionDialog = CancelSubscriptionDialog; exports.CouponCodeActions =
|
|
5092
|
+
exports.BillingAlertBanner = BillingAlertBanner; exports.BillingDashboardContainer = BillingDashboardContainer; exports.BillingDetailModal = BillingDetailModal; exports.BillingUsageSummaryCard = BillingUsageSummaryCard; exports.CancelSubscriptionDialog = CancelSubscriptionDialog; exports.CouponCodeActions = _chunkUGDYZW4Kjs.CouponCodeActions; exports.CouponCodeEditor = CouponCodeEditor; exports.CouponCodeFields = _chunkUGDYZW4Kjs.CouponCodeFields; exports.CouponCodesList = CouponCodesList; exports.CouponContainer = CouponContainer; exports.CouponDetails = CouponDetails; exports.CouponEditor = _chunkUGDYZW4Kjs.CouponEditor; exports.CouponProvider = _chunkUGDYZW4Kjs.CouponProvider; exports.CouponRefresher = _chunkUGDYZW4Kjs.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 = _chunkUGDYZW4Kjs.applyDiscount; exports.couponCodeDefaults = _chunkUGDYZW4Kjs.couponCodeDefaults; exports.couponCodeSchema = _chunkUGDYZW4Kjs.couponCodeSchema; exports.couponCurrencyOptions = _chunkUGDYZW4Kjs.couponCurrencyOptions; exports.formatCurrency = _chunkOO2DBP6Ljs.formatCurrency; exports.formatDate = _chunkUGDYZW4Kjs.formatDate; exports.formatFixed = _chunkOO2DBP6Ljs.formatFixed; exports.formatInterval = _chunkOO2DBP6Ljs.formatInterval; exports.isStripeConfigured = isStripeConfigured; exports.optionalDate = _chunkUGDYZW4Kjs.optionalDate; exports.optionalDecimal = _chunkUGDYZW4Kjs.optionalDecimal; exports.optionalPositiveInt = _chunkUGDYZW4Kjs.optionalPositiveInt; exports.parseOptionalDecimal = _chunkUGDYZW4Kjs.parseOptionalDecimal; exports.parseOptionalPositiveInt = _chunkUGDYZW4Kjs.parseOptionalPositiveInt; exports.priceLabel = priceLabel; exports.promotionCodeDiscount = _chunkUGDYZW4Kjs.promotionCodeDiscount; exports.subscriptionDiscount = _chunkUGDYZW4Kjs.subscriptionDiscount; exports.toCouponCodeInput = _chunkUGDYZW4Kjs.toCouponCodeInput; exports.useBillingFormatOptions = _chunkUGDYZW4Kjs.useBillingFormatOptions; exports.useCouponContext = _chunkUGDYZW4Kjs.useCouponContext; exports.usePriceContext = usePriceContext; exports.useProductContext = useProductContext;
|
|
5093
5093
|
//# sourceMappingURL=index.js.map
|