@carlonicora/nextjs-jsonapi 6.12.2 → 6.13.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/{ApiData-DPKNfY-9.d.mts → ApiData-Be8yxCOX.d.mts} +2 -0
- package/dist/{ApiData-DPKNfY-9.d.ts → ApiData-Be8yxCOX.d.ts} +2 -0
- package/dist/{BlockNoteEditor-75ED2CN2.mjs → BlockNoteEditor-22Q4DJBU.mjs} +20 -8
- package/dist/BlockNoteEditor-22Q4DJBU.mjs.map +1 -0
- package/dist/{BlockNoteEditor-7M5QW2YQ.js → BlockNoteEditor-2VLPSEKS.js} +34 -22
- package/dist/BlockNoteEditor-2VLPSEKS.js.map +1 -0
- package/dist/{BlockNoteViewer-WGCDB7IJ.js → BlockNoteViewer-2XYASA5Y.js} +8 -5
- package/dist/BlockNoteViewer-2XYASA5Y.js.map +1 -0
- package/dist/{BlockNoteViewer-MTGS6YJV.mjs → BlockNoteViewer-NBW2H6LC.mjs} +7 -4
- package/dist/{BlockNoteViewer-MTGS6YJV.mjs.map → BlockNoteViewer-NBW2H6LC.mjs.map} +1 -1
- package/dist/{JsonApiRequest-A66XK5WT.mjs → JsonApiRequest-F6TMJ42G.mjs} +2 -2
- package/dist/JsonApiRequest-WISJZSDE.js +26 -0
- package/dist/{JsonApiRequest-FZGPLNUF.js.map → JsonApiRequest-WISJZSDE.js.map} +1 -1
- package/dist/billing/index.js +499 -494
- package/dist/billing/index.js.map +1 -1
- package/dist/billing/index.mjs +13 -8
- package/dist/billing/index.mjs.map +1 -1
- package/dist/chunk-27LQDGNP.mjs +317 -0
- package/dist/chunk-27LQDGNP.mjs.map +1 -0
- package/dist/{chunk-V3YDVJ63.js → chunk-2H342HNN.js} +948 -921
- package/dist/chunk-2H342HNN.js.map +1 -0
- package/dist/{chunk-KSYQEKJX.js → chunk-2SV4SS6N.js} +14 -14
- package/dist/{chunk-KSYQEKJX.js.map → chunk-2SV4SS6N.js.map} +1 -1
- package/dist/{chunk-4FNGWALA.mjs → chunk-47BBY5KA.mjs} +6 -4
- package/dist/{chunk-4FNGWALA.mjs.map → chunk-47BBY5KA.mjs.map} +1 -1
- package/dist/chunk-6JUCIWDC.mjs +570 -0
- package/dist/chunk-6JUCIWDC.mjs.map +1 -0
- package/dist/chunk-7DBJTNSU.mjs +1049 -0
- package/dist/chunk-7DBJTNSU.mjs.map +1 -0
- package/dist/chunk-7JZHPMGW.mjs +704 -0
- package/dist/chunk-7JZHPMGW.mjs.map +1 -0
- package/dist/{chunk-L6PYFQTO.js → chunk-7ZHTPFFT.js} +16 -14
- package/dist/chunk-7ZHTPFFT.js.map +1 -0
- package/dist/chunk-B6JGKDP2.js +214 -0
- package/dist/chunk-B6JGKDP2.js.map +1 -0
- package/dist/{chunk-3YW35YHQ.mjs → chunk-BH6JWIKI.mjs} +5 -5
- package/dist/chunk-BZ5J2FIV.js +570 -0
- package/dist/chunk-BZ5J2FIV.js.map +1 -0
- package/dist/{chunk-V5MI7RNB.mjs → chunk-DGWOVYEC.mjs} +2 -2
- package/dist/chunk-DOCIFE6A.mjs +212 -0
- package/dist/chunk-DOCIFE6A.mjs.map +1 -0
- package/dist/chunk-GB6DBFYY.js +25 -0
- package/dist/chunk-GB6DBFYY.js.map +1 -0
- package/dist/{chunk-RXQYEEKZ.mjs → chunk-H4NLDX5G.mjs} +51 -24
- package/dist/chunk-H4NLDX5G.mjs.map +1 -0
- package/dist/{chunk-EWCY6QJA.mjs → chunk-JJMMT24D.mjs} +37 -3
- package/dist/chunk-JJMMT24D.mjs.map +1 -0
- package/dist/{chunk-JTPRJNT2.js → chunk-KMW7UNL2.js} +38 -3
- package/dist/chunk-KMW7UNL2.js.map +1 -0
- package/dist/chunk-MHB36MYE.js +317 -0
- package/dist/chunk-MHB36MYE.js.map +1 -0
- package/dist/{chunk-FF4EIQ6H.js → chunk-MOGEGWXW.js} +1039 -1680
- package/dist/chunk-MOGEGWXW.js.map +1 -0
- package/dist/{chunk-AA52ORW2.mjs → chunk-P445QGOC.mjs} +61 -702
- package/dist/chunk-P445QGOC.mjs.map +1 -0
- package/dist/chunk-PV4Z5W6V.js +212 -0
- package/dist/chunk-PV4Z5W6V.js.map +1 -0
- package/dist/chunk-PXDUJ47N.js +1049 -0
- package/dist/chunk-PXDUJ47N.js.map +1 -0
- package/dist/{chunk-GHE4VT2R.js → chunk-QKNGZDSQ.js} +2 -2
- package/dist/{chunk-GHE4VT2R.js.map → chunk-QKNGZDSQ.js.map} +1 -1
- package/dist/chunk-W62MHDWM.js +704 -0
- package/dist/chunk-W62MHDWM.js.map +1 -0
- package/dist/chunk-XXP3TQHF.mjs +25 -0
- package/dist/chunk-XXP3TQHF.mjs.map +1 -0
- package/dist/chunk-YRKIFYOE.mjs +214 -0
- package/dist/chunk-YRKIFYOE.mjs.map +1 -0
- package/dist/{chunk-O3PDL2CV.js → chunk-Z4POQWFG.js} +40 -6
- package/dist/chunk-Z4POQWFG.js.map +1 -0
- package/dist/{chunk-PI56A4DG.mjs → chunk-ZLTOUZN2.mjs} +37 -2
- package/dist/chunk-ZLTOUZN2.mjs.map +1 -0
- package/dist/client/index.d.mts +2 -2
- package/dist/client/index.d.ts +2 -2
- package/dist/client/index.js +14 -9
- package/dist/client/index.js.map +1 -1
- package/dist/client/index.mjs +24 -19
- package/dist/components/index.d.mts +7 -1
- package/dist/components/index.d.ts +7 -1
- package/dist/components/index.js +11 -7
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +10 -6
- package/dist/contexts/index.d.mts +1 -1
- package/dist/contexts/index.d.ts +1 -1
- package/dist/contexts/index.js +11 -7
- package/dist/contexts/index.js.map +1 -1
- package/dist/contexts/index.mjs +10 -6
- package/dist/core/index.d.mts +128 -2
- package/dist/core/index.d.ts +128 -2
- package/dist/core/index.js +17 -4
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +22 -9
- package/dist/email-automations/index.js +101 -96
- package/dist/email-automations/index.js.map +1 -1
- package/dist/email-automations/index.mjs +13 -8
- package/dist/email-automations/index.mjs.map +1 -1
- package/dist/features/analytics/index.js +128 -123
- package/dist/features/analytics/index.js.map +1 -1
- package/dist/features/analytics/index.mjs +13 -8
- package/dist/features/analytics/index.mjs.map +1 -1
- package/dist/features/analytics/server.js +11 -8
- package/dist/features/analytics/server.js.map +1 -1
- package/dist/features/analytics/server.mjs +9 -6
- package/dist/features/analytics/server.mjs.map +1 -1
- package/dist/features/blog/index.js +158 -153
- package/dist/features/blog/index.js.map +1 -1
- package/dist/features/blog/index.mjs +14 -9
- package/dist/features/blog/index.mjs.map +1 -1
- package/dist/features/blog/server.js +30 -26
- package/dist/features/blog/server.js.map +1 -1
- package/dist/features/blog/server.mjs +10 -6
- package/dist/features/blog/server.mjs.map +1 -1
- package/dist/features/help/index.js +44 -40
- package/dist/features/help/index.js.map +1 -1
- package/dist/features/help/index.mjs +10 -6
- package/dist/features/help/index.mjs.map +1 -1
- package/dist/features/tokenusage/index.js +134 -129
- package/dist/features/tokenusage/index.js.map +1 -1
- package/dist/features/tokenusage/index.mjs +13 -8
- package/dist/features/tokenusage/index.mjs.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +18 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -11
- package/dist/lifecycle-4GUOTB46.js +23 -0
- package/dist/lifecycle-4GUOTB46.js.map +1 -0
- package/dist/lifecycle-LKGPRBS7.mjs +23 -0
- package/dist/local-transport-7H3SPZSA.js +15 -0
- package/dist/local-transport-7H3SPZSA.js.map +1 -0
- package/dist/local-transport-QYFKA6AN.mjs +15 -0
- package/dist/local-transport-QYFKA6AN.mjs.map +1 -0
- package/dist/offline/index.d.mts +607 -0
- package/dist/offline/index.d.ts +607 -0
- package/dist/offline/index.js +1052 -0
- package/dist/offline/index.js.map +1 -0
- package/dist/offline/index.mjs +1052 -0
- package/dist/offline/index.mjs.map +1 -0
- package/dist/offline/sqlite/device-worker.mjs +62 -0
- package/dist/offline/sqlite/index.mjs +17392 -0
- package/dist/offline/sqlite/sqlite3-opfs-async-proxy.js +881 -0
- package/dist/offline/sqlite/sqlite3.wasm +0 -0
- package/dist/request-KTBV6HHH.js +10 -0
- package/dist/request-KTBV6HHH.js.map +1 -0
- package/dist/request-SQOUNWZ4.mjs +10 -0
- package/dist/request-SQOUNWZ4.mjs.map +1 -0
- package/dist/server/cachedGet.d.mts +1 -1
- package/dist/server/cachedGet.d.ts +1 -1
- package/dist/server/cachedGet.stub.d.mts +1 -1
- package/dist/server/cachedGet.stub.d.ts +1 -1
- package/dist/server/index.d.mts +28 -2
- package/dist/server/index.d.ts +28 -2
- package/dist/server/index.js +18 -8
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +18 -8
- package/dist/{useSocket-IRHtk2xc.d.ts → useSocket-Bo9M0t0J.d.ts} +3 -1
- package/dist/{useSocket-C8fqU4od.d.mts → useSocket-J5qanQPN.d.mts} +3 -1
- package/dist/write-through-FDQ7N4YI.js +15 -0
- package/dist/write-through-FDQ7N4YI.js.map +1 -0
- package/dist/write-through-R25VQMH6.mjs +15 -0
- package/dist/write-through-R25VQMH6.mjs.map +1 -0
- package/package.json +7 -1
- package/pwa/sw.js +277 -26
- package/src/client/request.ts +37 -0
- package/src/components/editors/BlockNoteEditor.tsx +14 -0
- package/src/components/editors/__tests__/BlockNoteEditor.empty-change.spec.tsx +205 -0
- package/src/contexts/SocketContext.tsx +7 -1
- package/src/contexts/__tests__/SocketContext.session.spec.tsx +52 -5
- package/src/core/factories/RehydrationFactory.ts +28 -8
- package/src/core/factories/__tests__/RehydrationFactory.spec.ts +33 -0
- package/src/core/index.ts +3 -0
- package/src/core/interfaces/ApiData.ts +2 -0
- package/src/core/registry/ModuleRegistry.ts +3 -0
- package/src/features/auth/components/forms/Logout.tsx +8 -1
- package/src/features/auth/components/forms/__tests__/Logout.spec.tsx +62 -0
- package/src/hooks/__tests__/useSocket.pause.spec.ts +39 -0
- package/src/hooks/useSocket.ts +20 -1
- package/src/offline/__tests__/answer-builders.spec.ts +176 -0
- package/src/offline/__tests__/device-switch.spec.ts +179 -0
- package/src/offline/__tests__/generic-answers.spec.ts +380 -0
- package/src/offline/__tests__/local-transport.spec.ts +150 -0
- package/src/offline/__tests__/logout.spec.ts +122 -0
- package/src/offline/__tests__/offline-fixtures.ts +89 -0
- package/src/offline/__tests__/router.spec.ts +56 -0
- package/src/offline/__tests__/state.spec.ts +62 -0
- package/src/offline/__tests__/write-through.spec.ts +137 -0
- package/src/offline/config.ts +229 -0
- package/src/offline/configure.ts +14 -0
- package/src/offline/device-switch.ts +75 -0
- package/src/offline/generic-answers.ts +706 -0
- package/src/offline/index.ts +67 -0
- package/src/offline/local-transport.ts +189 -0
- package/src/offline/logout.ts +41 -0
- package/src/offline/router.ts +41 -0
- package/src/offline/server/__tests__/build-offline-manifest.spec.ts +76 -0
- package/src/offline/server/build-offline-manifest.ts +49 -0
- package/src/offline/state-hooks.ts +10 -0
- package/src/offline/state.ts +143 -0
- package/src/offline/store/DeviceStore.ts +112 -0
- package/src/offline/store/__tests__/device-store-lifecycle.spec.ts +343 -0
- package/src/offline/store/__tests__/shared-database.spec.ts +151 -0
- package/src/offline/store/__tests__/sql-device-store.spec.ts +399 -0
- package/src/offline/store/lifecycle.ts +315 -0
- package/src/offline/store/schema.ts +101 -0
- package/src/offline/store/shared-database.ts +321 -0
- package/src/offline/store/sql-device-store.ts +469 -0
- package/src/offline/store/worker-client.ts +71 -0
- package/src/offline/store/worker.ts +87 -0
- package/src/offline/sync/__tests__/conflicts.spec.ts +185 -0
- package/src/offline/sync/__tests__/queue-drain.spec.ts +364 -0
- package/src/offline/sync/__tests__/runtime.spec.ts +337 -0
- package/src/offline/sync/__tests__/sync-fixtures.ts +103 -0
- package/src/offline/sync/__tests__/sync-root.spec.ts +727 -0
- package/src/offline/sync/artwork-cache.ts +67 -0
- package/src/offline/sync/conflicts.ts +211 -0
- package/src/offline/sync/counts.ts +39 -0
- package/src/offline/sync/drain-queue.ts +246 -0
- package/src/offline/sync/known-roots.ts +37 -0
- package/src/offline/sync/models/OfflineChangeSet.ts +34 -0
- package/src/offline/sync/models/OfflineChangeSetInterface.ts +54 -0
- package/src/offline/sync/models/RootSync.ts +68 -0
- package/src/offline/sync/models/RootSyncInterface.ts +20 -0
- package/src/offline/sync/models/__tests__/OfflineChangeSet.spec.ts +47 -0
- package/src/offline/sync/models/__tests__/RootSync.spec.ts +54 -0
- package/src/offline/sync/models/index.ts +5 -0
- package/src/offline/sync/models/offline.modules.ts +14 -0
- package/src/offline/sync/runtime.ts +226 -0
- package/src/offline/sync/session-refresh.ts +32 -0
- package/src/offline/sync/sync-root.ts +336 -0
- package/src/offline/sync/waiting.ts +40 -0
- package/src/offline/types.ts +115 -0
- package/src/offline/write-through.ts +189 -0
- package/src/pwa/__tests__/sw.spec.ts +358 -1
- package/src/server/index.ts +5 -0
- package/src/unified/__tests__/JsonApiRequest.offline.spec.ts +243 -0
- package/dist/BlockNoteEditor-75ED2CN2.mjs.map +0 -1
- package/dist/BlockNoteEditor-7M5QW2YQ.js.map +0 -1
- package/dist/BlockNoteViewer-WGCDB7IJ.js.map +0 -1
- package/dist/JsonApiRequest-FZGPLNUF.js +0 -26
- package/dist/chunk-AA52ORW2.mjs.map +0 -1
- package/dist/chunk-EWCY6QJA.mjs.map +0 -1
- package/dist/chunk-FF4EIQ6H.js.map +0 -1
- package/dist/chunk-JTPRJNT2.js.map +0 -1
- package/dist/chunk-L6PYFQTO.js.map +0 -1
- package/dist/chunk-O3PDL2CV.js.map +0 -1
- package/dist/chunk-PI56A4DG.mjs.map +0 -1
- package/dist/chunk-RXQYEEKZ.mjs.map +0 -1
- package/dist/chunk-V3YDVJ63.js.map +0 -1
- package/dist/request-5RLK2AM3.mjs +0 -9
- package/dist/request-EUGTI3BE.js +0 -9
- package/dist/request-EUGTI3BE.js.map +0 -1
- /package/dist/{JsonApiRequest-A66XK5WT.mjs.map → JsonApiRequest-F6TMJ42G.mjs.map} +0 -0
- /package/dist/{chunk-3YW35YHQ.mjs.map → chunk-BH6JWIKI.mjs.map} +0 -0
- /package/dist/{chunk-V5MI7RNB.mjs.map → chunk-DGWOVYEC.mjs.map} +0 -0
- /package/dist/{request-5RLK2AM3.mjs.map → lifecycle-LKGPRBS7.mjs.map} +0 -0
package/dist/billing/index.js
CHANGED
|
@@ -81,10 +81,11 @@
|
|
|
81
81
|
|
|
82
82
|
|
|
83
83
|
|
|
84
|
-
var
|
|
84
|
+
var _chunk2H342HNNjs = require('../chunk-2H342HNN.js');
|
|
85
|
+
require('../chunk-3EPNHTMH.js');
|
|
85
86
|
|
|
86
87
|
|
|
87
|
-
var
|
|
88
|
+
var _chunk7ZHTPFFTjs = require('../chunk-7ZHTPFFT.js');
|
|
88
89
|
|
|
89
90
|
|
|
90
91
|
var _chunkG4JR3SFVjs = require('../chunk-G4JR3SFV.js');
|
|
@@ -110,15 +111,19 @@ var _chunkG4JR3SFVjs = require('../chunk-G4JR3SFV.js');
|
|
|
110
111
|
|
|
111
112
|
|
|
112
113
|
|
|
114
|
+
|
|
115
|
+
var _chunkMOGEGWXWjs = require('../chunk-MOGEGWXW.js');
|
|
116
|
+
require('../chunk-GB6DBFYY.js');
|
|
113
117
|
|
|
114
118
|
|
|
115
119
|
|
|
116
120
|
|
|
117
|
-
var
|
|
118
|
-
require('../chunk-
|
|
121
|
+
var _chunkBZ5J2FIVjs = require('../chunk-BZ5J2FIV.js');
|
|
122
|
+
require('../chunk-PV4Z5W6V.js');
|
|
123
|
+
require('../chunk-KMW7UNL2.js');
|
|
124
|
+
require('../chunk-MHB36MYE.js');
|
|
125
|
+
require('../chunk-QKNGZDSQ.js');
|
|
119
126
|
require('../chunk-LXKSUWAV.js');
|
|
120
|
-
require('../chunk-JTPRJNT2.js');
|
|
121
|
-
require('../chunk-3EPNHTMH.js');
|
|
122
127
|
|
|
123
128
|
|
|
124
129
|
var _chunk7QVYU63Ejs = require('../chunk-7QVYU63E.js');
|
|
@@ -127,7 +132,7 @@ var _chunk7QVYU63Ejs = require('../chunk-7QVYU63E.js');
|
|
|
127
132
|
var _nextintl = require('next-intl');
|
|
128
133
|
var _lucidereact = require('lucide-react');
|
|
129
134
|
var _jsxruntime = require('react/jsx-runtime');
|
|
130
|
-
var SUBSCRIPTION_STATUSES = Object.values(
|
|
135
|
+
var SUBSCRIPTION_STATUSES = Object.values(_chunkMOGEGWXWjs.SubscriptionStatus);
|
|
131
136
|
function getStatusBadgeVariant(status) {
|
|
132
137
|
switch (status) {
|
|
133
138
|
case "active" /* ACTIVE */:
|
|
@@ -159,43 +164,43 @@ function SubscriptionSummaryCard({
|
|
|
159
164
|
onManageClick
|
|
160
165
|
}) {
|
|
161
166
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
162
|
-
const fmt =
|
|
167
|
+
const fmt = _chunk2H342HNNjs.useBillingFormatOptions.call(void 0, );
|
|
163
168
|
if (loading) {
|
|
164
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
165
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
166
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
169
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.Card, { children: [
|
|
170
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
171
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.CardTitle, { children: t("billing.ui.subscriptions.title") }),
|
|
167
172
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
168
173
|
] }),
|
|
169
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
170
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
171
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
172
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
174
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.CardContent, { children: [
|
|
175
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
176
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Skeleton, { className: "h-4 w-24 mb-1" }),
|
|
177
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Skeleton, { className: "h-4 w-40" })
|
|
173
178
|
] })
|
|
174
179
|
] });
|
|
175
180
|
}
|
|
176
181
|
if (error) {
|
|
177
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
178
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
179
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
182
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.Card, { children: [
|
|
183
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
184
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.CardTitle, { children: t("billing.ui.subscriptions.title") }),
|
|
180
185
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
181
186
|
] }),
|
|
182
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
187
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
183
188
|
] });
|
|
184
189
|
}
|
|
185
190
|
const activeSubscriptions = subscriptions.filter(
|
|
186
191
|
(sub) => sub.status === "active" /* ACTIVE */ || sub.status === "trialing" /* TRIALING */ || sub.status === "past_due" /* PAST_DUE */
|
|
187
192
|
);
|
|
188
193
|
const primarySubscription = activeSubscriptions[0];
|
|
189
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
190
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
191
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
194
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
|
|
195
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
196
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.CardTitle, { children: t("billing.ui.subscriptions.title") }),
|
|
192
197
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
193
198
|
] }),
|
|
194
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
199
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.CardContent, { children: !primarySubscription ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
195
200
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: t("billing.ui.cards.subscriptions.empty_title") }),
|
|
196
201
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.subscriptions.empty_description") }),
|
|
197
202
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
198
|
-
|
|
203
|
+
_chunk2H342HNNjs.Button,
|
|
199
204
|
{
|
|
200
205
|
variant: "outline",
|
|
201
206
|
size: "sm",
|
|
@@ -213,8 +218,8 @@ function SubscriptionSummaryCard({
|
|
|
213
218
|
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
214
219
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
215
220
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: formatPlanName(primarySubscription, t("billing.ui.cards.subscriptions.fallback_name")) }),
|
|
216
|
-
primarySubscription.status === "past_due" /* PAST_DUE */ ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
217
|
-
|
|
221
|
+
primarySubscription.status === "past_due" /* PAST_DUE */ ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Badge, { variant: "softRed", children: t("billing.ui.cards.subscriptions.payment_failing") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
222
|
+
_chunk2H342HNNjs.Badge,
|
|
218
223
|
{
|
|
219
224
|
variant: primarySubscription.cancelAtPeriodEnd ? "secondary" : getStatusBadgeVariant(primarySubscription.status),
|
|
220
225
|
children: primarySubscription.cancelAtPeriodEnd ? t("billing.ui.cards.subscriptions.canceling") : SUBSCRIPTION_STATUSES.includes(primarySubscription.status) ? t(`billing.ui.subscription_status.${primarySubscription.status}`) : primarySubscription.status
|
|
@@ -222,11 +227,11 @@ function SubscriptionSummaryCard({
|
|
|
222
227
|
)
|
|
223
228
|
] }),
|
|
224
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", {
|
|
225
|
-
date:
|
|
230
|
+
date: _chunk2H342HNNjs.formatDate.call(void 0, primarySubscription.currentPeriodEnd, fmt)
|
|
226
231
|
}) : primarySubscription.cancelAtPeriodEnd ? t("billing.ui.cards.subscriptions.cancels_on", {
|
|
227
|
-
date:
|
|
232
|
+
date: _chunk2H342HNNjs.formatDate.call(void 0, primarySubscription.currentPeriodEnd, fmt)
|
|
228
233
|
}) : t("billing.ui.cards.subscriptions.renews_on", {
|
|
229
|
-
date:
|
|
234
|
+
date: _chunk2H342HNNjs.formatDate.call(void 0, primarySubscription.currentPeriodEnd, fmt)
|
|
230
235
|
}) }),
|
|
231
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 }) })
|
|
232
237
|
] }) })
|
|
@@ -260,37 +265,37 @@ function PaymentMethodSummaryCard({
|
|
|
260
265
|
}) {
|
|
261
266
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
262
267
|
if (loading) {
|
|
263
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
264
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
265
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
268
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.Card, { children: [
|
|
269
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
270
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.CardTitle, { children: t("billing.ui.payment_method.title") }),
|
|
266
271
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
267
272
|
] }),
|
|
268
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
269
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
270
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
273
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.CardContent, { children: [
|
|
274
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
275
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Skeleton, { className: "h-4 w-24" })
|
|
271
276
|
] })
|
|
272
277
|
] });
|
|
273
278
|
}
|
|
274
279
|
if (error) {
|
|
275
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
276
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
277
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
280
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.Card, { children: [
|
|
281
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
282
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.CardTitle, { children: t("billing.ui.payment_method.title") }),
|
|
278
283
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
279
284
|
] }),
|
|
280
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
285
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
281
286
|
] });
|
|
282
287
|
}
|
|
283
288
|
const defaultMethod = paymentMethods.find((pm) => pm.id === defaultPaymentMethodId) || paymentMethods[0];
|
|
284
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
285
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
286
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
289
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
|
|
290
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
291
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.CardTitle, { children: t("billing.ui.payment_method.title") }),
|
|
287
292
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
288
293
|
] }),
|
|
289
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
294
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.CardContent, { children: paymentMethods.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
290
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") }),
|
|
291
296
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.payment_method.empty_description") }),
|
|
292
297
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
293
|
-
|
|
298
|
+
_chunk2H342HNNjs.Button,
|
|
294
299
|
{
|
|
295
300
|
variant: "outline",
|
|
296
301
|
size: "sm",
|
|
@@ -339,13 +344,13 @@ function formatBalance(balance, currency, locale) {
|
|
|
339
344
|
_chunk7QVYU63Ejs.__name.call(void 0, formatBalance, "formatBalance");
|
|
340
345
|
function CustomerInfoCard({ customer, loading, error }) {
|
|
341
346
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
342
|
-
const locale =
|
|
347
|
+
const locale = _chunkBZ5J2FIVjs.useI18nLocale.call(void 0, );
|
|
343
348
|
const [portalLoading, setPortalLoading] = _react.useState.call(void 0, false);
|
|
344
349
|
const handlePortalClick = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async (e) => {
|
|
345
350
|
e.stopPropagation();
|
|
346
351
|
setPortalLoading(true);
|
|
347
352
|
try {
|
|
348
|
-
const { url } = await
|
|
353
|
+
const { url } = await _chunkMOGEGWXWjs.StripeCustomerService.createPortalSession();
|
|
349
354
|
window.open(url, "_blank");
|
|
350
355
|
} catch (err) {
|
|
351
356
|
console.error("[CustomerInfoCard] Failed to create portal session:", err);
|
|
@@ -354,45 +359,45 @@ function CustomerInfoCard({ customer, loading, error }) {
|
|
|
354
359
|
}
|
|
355
360
|
}, "handlePortalClick");
|
|
356
361
|
if (loading) {
|
|
357
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
358
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
359
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
362
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.Card, { children: [
|
|
363
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
364
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.CardTitle, { children: t("billing.ui.cards.customer.title") }),
|
|
360
365
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
361
366
|
] }),
|
|
362
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
363
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
364
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
365
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
367
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.CardContent, { children: [
|
|
368
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
369
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Skeleton, { className: "h-4 w-48 mb-1" }),
|
|
370
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Skeleton, { className: "h-4 w-24" })
|
|
366
371
|
] })
|
|
367
372
|
] });
|
|
368
373
|
}
|
|
369
374
|
if (error) {
|
|
370
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
371
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
372
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
375
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.Card, { children: [
|
|
376
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
377
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.CardTitle, { children: t("billing.ui.cards.customer.title") }),
|
|
373
378
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
374
379
|
] }),
|
|
375
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
380
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
376
381
|
] });
|
|
377
382
|
}
|
|
378
383
|
if (!customer) {
|
|
379
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
380
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
381
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
384
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.Card, { children: [
|
|
385
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
386
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.CardTitle, { children: t("billing.ui.cards.customer.title") }),
|
|
382
387
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
383
388
|
] }),
|
|
384
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
389
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.CardContent, { children: [
|
|
385
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") }),
|
|
386
391
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.customer.not_set_up_description") })
|
|
387
392
|
] })
|
|
388
393
|
] });
|
|
389
394
|
}
|
|
390
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
391
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
392
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
395
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.Card, { children: [
|
|
396
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
397
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.CardTitle, { children: t("billing.ui.cards.customer.title") }),
|
|
393
398
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
394
399
|
] }),
|
|
395
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
400
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
396
401
|
customer.name && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: customer.name }),
|
|
397
402
|
customer.email && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: customer.email }),
|
|
398
403
|
customer.balance !== void 0 && customer.balance !== 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm", children: [
|
|
@@ -402,7 +407,7 @@ function CustomerInfoCard({ customer, loading, error }) {
|
|
|
402
407
|
] }),
|
|
403
408
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: customer.balance < 0 ? "text-success" : "text-destructive", children: formatBalance(customer.balance, customer.currency, locale) })
|
|
404
409
|
] }),
|
|
405
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
410
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.Button, { variant: "outline", size: "sm", className: "mt-2", onClick: handlePortalClick, disabled: portalLoading, children: [
|
|
406
411
|
portalLoading ? t("common.loading") : t("billing.ui.cards.customer.manage_portal"),
|
|
407
412
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ExternalLink, { className: "h-4 w-4 ms-1" })
|
|
408
413
|
] })
|
|
@@ -415,7 +420,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, CustomerInfoCard, "CustomerInfoCard");
|
|
|
415
420
|
|
|
416
421
|
|
|
417
422
|
|
|
418
|
-
var INVOICE_STATUSES = Object.values(
|
|
423
|
+
var INVOICE_STATUSES = Object.values(_chunkMOGEGWXWjs.InvoiceStatus);
|
|
419
424
|
function getStatusBadgeVariant2(status) {
|
|
420
425
|
switch (status) {
|
|
421
426
|
case "paid" /* PAID */:
|
|
@@ -440,46 +445,46 @@ function formatAmount(amount, currency, locale) {
|
|
|
440
445
|
_chunk7QVYU63Ejs.__name.call(void 0, formatAmount, "formatAmount");
|
|
441
446
|
function InvoicesSummaryCard({ invoices, loading, error, onViewAllClick }) {
|
|
442
447
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
443
|
-
const fmt =
|
|
448
|
+
const fmt = _chunk2H342HNNjs.useBillingFormatOptions.call(void 0, );
|
|
444
449
|
if (loading) {
|
|
445
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
446
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
447
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
450
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.Card, { children: [
|
|
451
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
452
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.CardTitle, { children: t("billing.ui.cards.invoices.title") }),
|
|
448
453
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
449
454
|
] }),
|
|
450
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
451
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
452
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
453
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
455
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.CardContent, { children: [
|
|
456
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Skeleton, { className: "h-6 w-24 mb-2" }),
|
|
457
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Skeleton, { className: "h-4 w-32 mb-1" }),
|
|
458
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Skeleton, { className: "h-4 w-20" })
|
|
454
459
|
] })
|
|
455
460
|
] });
|
|
456
461
|
}
|
|
457
462
|
if (error) {
|
|
458
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
459
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
460
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
463
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.Card, { children: [
|
|
464
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
465
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.CardTitle, { children: t("billing.ui.cards.invoices.title") }),
|
|
461
466
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
462
467
|
] }),
|
|
463
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
468
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
464
469
|
] });
|
|
465
470
|
}
|
|
466
471
|
const latestInvoice = _nullishCoalesce(invoices.find((inv) => inv.status !== "void" /* VOID */), () => ( invoices[0]));
|
|
467
472
|
const paidInvoices = invoices.filter((inv) => inv.status === "paid" /* PAID */);
|
|
468
473
|
const openInvoices = invoices.filter((inv) => inv.status === "open" /* OPEN */);
|
|
469
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
470
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
471
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
474
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewAllClick, children: [
|
|
475
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
476
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.CardTitle, { children: t("billing.ui.cards.invoices.title") }),
|
|
472
477
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
473
478
|
] }),
|
|
474
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
479
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.CardContent, { children: invoices.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
475
480
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: t("billing.ui.invoices.empty_title") }),
|
|
476
481
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.invoices.empty_description") })
|
|
477
482
|
] }) : latestInvoice ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
478
483
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
479
484
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: formatAmount(latestInvoice.total, latestInvoice.currency, fmt.locale) }),
|
|
480
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
485
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Badge, { variant: getStatusBadgeVariant2(latestInvoice.status), children: INVOICE_STATUSES.includes(latestInvoice.status) ? t(`billing.ui.invoice_status.${latestInvoice.status}`) : latestInvoice.status })
|
|
481
486
|
] }),
|
|
482
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: latestInvoice.stripeInvoiceNumber || t("billing.ui.cards.invoices.invoice_from", { date:
|
|
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: _chunk2H342HNNjs.formatDate.call(void 0, latestInvoice.periodStart, fmt) }) }),
|
|
483
488
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-4 text-xs text-muted-foreground", children: [
|
|
484
489
|
paidInvoices.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: t("billing.ui.cards.invoices.paid_count", { count: paidInvoices.length }) }),
|
|
485
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 }) }),
|
|
@@ -512,26 +517,26 @@ function BillingUsageSummaryCard({
|
|
|
512
517
|
onViewDetailsClick
|
|
513
518
|
}) {
|
|
514
519
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
515
|
-
const locale =
|
|
520
|
+
const locale = _chunkBZ5J2FIVjs.useI18nLocale.call(void 0, );
|
|
516
521
|
if (loading) {
|
|
517
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
518
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
519
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
522
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.Card, { children: [
|
|
523
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
524
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.CardTitle, { children: t("billing.ui.cards.usage.title") }),
|
|
520
525
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
521
526
|
] }),
|
|
522
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
523
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
524
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
527
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.CardContent, { children: [
|
|
528
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Skeleton, { className: "h-6 w-24 mb-2" }),
|
|
529
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Skeleton, { className: "h-4 w-32" })
|
|
525
530
|
] })
|
|
526
531
|
] });
|
|
527
532
|
}
|
|
528
533
|
if (error) {
|
|
529
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
530
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
531
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
534
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.Card, { children: [
|
|
535
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
536
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.CardTitle, { children: t("billing.ui.cards.usage.title") }),
|
|
532
537
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
533
538
|
] }),
|
|
534
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
539
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
535
540
|
] });
|
|
536
541
|
}
|
|
537
542
|
const totalUsage = Object.values(summaries).reduce((acc, summary) => {
|
|
@@ -539,12 +544,12 @@ function BillingUsageSummaryCard({
|
|
|
539
544
|
}, 0);
|
|
540
545
|
const primaryMeter = meters.find((m) => _optionalChain([summaries, 'access', _17 => _17[m.id], 'optionalAccess', _18 => _18.aggregatedValue]));
|
|
541
546
|
const primarySummary = primaryMeter ? summaries[primaryMeter.id] : null;
|
|
542
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
543
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
544
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
547
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewDetailsClick, children: [
|
|
548
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
549
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.CardTitle, { children: t("billing.ui.cards.usage.title") }),
|
|
545
550
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
546
551
|
] }),
|
|
547
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
552
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.CardContent, { children: meters.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
548
553
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: t("billing.ui.cards.usage.no_meters") }),
|
|
549
554
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.usage.no_meters_description") })
|
|
550
555
|
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
@@ -601,7 +606,7 @@ function PaymentMethodForm({
|
|
|
601
606
|
const fetchSetupIntent = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
602
607
|
setLoading(true);
|
|
603
608
|
try {
|
|
604
|
-
const intent = await
|
|
609
|
+
const intent = await _chunkMOGEGWXWjs.StripeCustomerService.createSetupIntent();
|
|
605
610
|
setSetupIntent(intent);
|
|
606
611
|
} catch (err) {
|
|
607
612
|
console.error("[PaymentMethodForm] Failed to create setup intent:", err);
|
|
@@ -639,7 +644,7 @@ function PaymentMethodForm({
|
|
|
639
644
|
return;
|
|
640
645
|
}
|
|
641
646
|
if ((alwaysSetDefault || setAsDefault) && _optionalChain([confirmedSetupIntent, 'optionalAccess', _19 => _19.payment_method])) {
|
|
642
|
-
await
|
|
647
|
+
await _chunkMOGEGWXWjs.StripeCustomerService.setDefaultPaymentMethod({
|
|
643
648
|
paymentMethodId: typeof confirmedSetupIntent.payment_method === "string" ? confirmedSetupIntent.payment_method : confirmedSetupIntent.payment_method.id
|
|
644
649
|
});
|
|
645
650
|
}
|
|
@@ -655,7 +660,7 @@ function PaymentMethodForm({
|
|
|
655
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") }) });
|
|
656
661
|
}
|
|
657
662
|
if (!setupIntent && error) {
|
|
658
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
663
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.AlertDescription, { children: error }) });
|
|
659
664
|
}
|
|
660
665
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: handleSubmit, className: "flex flex-col gap-y-4", children: [
|
|
661
666
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rounded-md border border-gray-300 p-3", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -679,19 +684,19 @@ function PaymentMethodForm({
|
|
|
679
684
|
) }),
|
|
680
685
|
!alwaysSetDefault && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
681
686
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
682
|
-
|
|
687
|
+
_chunk2H342HNNjs.Checkbox,
|
|
683
688
|
{
|
|
684
689
|
id: "setAsDefault",
|
|
685
690
|
checked: setAsDefault,
|
|
686
691
|
onCheckedChange: (checked) => setSetAsDefault(!!checked)
|
|
687
692
|
}
|
|
688
693
|
),
|
|
689
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
694
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Label, { htmlFor: "setAsDefault", className: "cursor-pointer font-normal", children: t("billing.ui.payment_form.set_default") })
|
|
690
695
|
] }),
|
|
691
|
-
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
696
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.AlertDescription, { children: error }) }),
|
|
692
697
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-x-2", children: [
|
|
693
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
694
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
698
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Button, { type: "button", variant: "outline", onClick: onCancel, disabled: isSubmitting || isLoading, children: t("ui.buttons.cancel") }),
|
|
699
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Button, { type: "submit", disabled: !stripe || isSubmitting || isLoading, children: isSubmitting ? t("billing.ui.wizard.review.processing") : t("billing.ui.cards.payment_method.add_card") })
|
|
695
700
|
] })
|
|
696
701
|
] });
|
|
697
702
|
}
|
|
@@ -708,10 +713,10 @@ function PaymentMethodEditor({ open, onOpenChange, onSuccess }) {
|
|
|
708
713
|
const handleCancel = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
709
714
|
onOpenChange(false);
|
|
710
715
|
}, "handleCancel");
|
|
711
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
712
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
713
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
714
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
716
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.DialogContent, { className: "max-w-md", children: [
|
|
717
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.DialogHeader, { children: [
|
|
718
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.DialogTitle, { children: t("billing.ui.payment_methods.add") }),
|
|
719
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.DialogDescription, { children: t("billing.ui.payment_methods.add_description") })
|
|
715
720
|
] }),
|
|
716
721
|
open && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodForm, { onSuccess: handleSuccess, onCancel: handleCancel })
|
|
717
722
|
] }) });
|
|
@@ -737,7 +742,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
737
742
|
_react.useEffect.call(void 0, () => {
|
|
738
743
|
const loadCustomer = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
739
744
|
try {
|
|
740
|
-
const fetchedCustomer = await
|
|
745
|
+
const fetchedCustomer = await _chunkMOGEGWXWjs.StripeCustomerService.getCustomer();
|
|
741
746
|
setCustomer(fetchedCustomer);
|
|
742
747
|
} catch (error) {
|
|
743
748
|
console.error("[PaymentMethodCard] Failed to load customer:", error);
|
|
@@ -754,7 +759,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
754
759
|
const handleSetDefault = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
755
760
|
setLoading(true);
|
|
756
761
|
try {
|
|
757
|
-
await
|
|
762
|
+
await _chunkMOGEGWXWjs.StripeCustomerService.setDefaultPaymentMethod({ paymentMethodId: paymentMethod.id });
|
|
758
763
|
onUpdate();
|
|
759
764
|
} catch (error) {
|
|
760
765
|
console.error("[PaymentMethodCard] Failed to set as default:", error);
|
|
@@ -765,7 +770,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
765
770
|
const handleRemove = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
766
771
|
setLoading(true);
|
|
767
772
|
try {
|
|
768
|
-
await
|
|
773
|
+
await _chunkMOGEGWXWjs.StripeCustomerService.removePaymentMethod({ paymentMethodId: paymentMethod.id });
|
|
769
774
|
setShowRemoveDialog(false);
|
|
770
775
|
onUpdate();
|
|
771
776
|
} catch (error) {
|
|
@@ -774,16 +779,16 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
774
779
|
}
|
|
775
780
|
}, "handleRemove");
|
|
776
781
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
777
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
778
|
-
isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
779
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
782
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.Card, { className: "relative", children: [
|
|
783
|
+
isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Badge, { variant: "softGreen", className: "absolute end-2 top-2", children: t("billing.ui.payment_methods.default") }),
|
|
784
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.CardHeader, { className: "flex flex-row items-center justify-between pb-2", children: [
|
|
780
785
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
781
786
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-2xl", children: brandIcon }),
|
|
782
787
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium capitalize", children: brand })
|
|
783
788
|
] }),
|
|
784
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
785
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
786
|
-
|
|
789
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.DropdownMenu, { children: [
|
|
790
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.DropdownMenuTrigger, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
791
|
+
_chunk2H342HNNjs.Button,
|
|
787
792
|
{
|
|
788
793
|
render: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {}),
|
|
789
794
|
nativeButton: false,
|
|
@@ -794,10 +799,10 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
794
799
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.MoreVertical, { className: "h-4 w-4" })
|
|
795
800
|
}
|
|
796
801
|
) }),
|
|
797
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
798
|
-
!isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
802
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.DropdownMenuContent, { align: "end", children: [
|
|
803
|
+
!isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.DropdownMenuItem, { onClick: handleSetDefault, disabled: loading, children: t("billing.ui.payment_methods.set_default") }),
|
|
799
804
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
800
|
-
|
|
805
|
+
_chunk2H342HNNjs.DropdownMenuItem,
|
|
801
806
|
{
|
|
802
807
|
onClick: () => setShowRemoveDialog(true),
|
|
803
808
|
disabled: loading,
|
|
@@ -808,7 +813,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
808
813
|
] })
|
|
809
814
|
] })
|
|
810
815
|
] }),
|
|
811
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
816
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-1", children: [
|
|
812
817
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-lg font-semibold", children: [
|
|
813
818
|
"\u2022\u2022\u2022\u2022 ",
|
|
814
819
|
last4
|
|
@@ -816,17 +821,17 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
816
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}` }) })
|
|
817
822
|
] }) })
|
|
818
823
|
] }),
|
|
819
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
820
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
821
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
822
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
824
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.AlertDialog, { open: showRemoveDialog, onOpenChange: setShowRemoveDialog, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.AlertDialogContent, { children: [
|
|
825
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.AlertDialogHeader, { children: [
|
|
826
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.AlertDialogTitle, { children: t("billing.ui.payment_methods.remove_title") }),
|
|
827
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.AlertDialogDescription, { children: [
|
|
823
828
|
t("billing.ui.payment_methods.remove_description"),
|
|
824
829
|
isDefault && ` ${t("billing.ui.payment_methods.remove_default_warning")}`
|
|
825
830
|
] })
|
|
826
831
|
] }),
|
|
827
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
828
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
829
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
832
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.AlertDialogFooter, { children: [
|
|
833
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.AlertDialogCancel, { disabled: loading, children: t("ui.buttons.cancel") }),
|
|
834
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.AlertDialogAction, { onClick: handleRemove, disabled: loading, className: "bg-red-600 hover:bg-red-700", children: loading ? t("billing.ui.payment_methods.removing") : t("ui.buttons.remove") })
|
|
830
835
|
] })
|
|
831
836
|
] }) })
|
|
832
837
|
] });
|
|
@@ -850,7 +855,7 @@ function PaymentMethodsContainer() {
|
|
|
850
855
|
const loadPaymentMethods = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
851
856
|
setLoading(true);
|
|
852
857
|
try {
|
|
853
|
-
const fetchedPaymentMethods = await
|
|
858
|
+
const fetchedPaymentMethods = await _chunkMOGEGWXWjs.StripeCustomerService.listPaymentMethods();
|
|
854
859
|
setPaymentMethods(fetchedPaymentMethods);
|
|
855
860
|
} catch (error) {
|
|
856
861
|
console.error("[PaymentMethodsContainer] Failed to load payment methods:", error);
|
|
@@ -870,14 +875,14 @@ function PaymentMethodsContainer() {
|
|
|
870
875
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8" }),
|
|
871
876
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: t("billing.ui.payment_methods.title") })
|
|
872
877
|
] }),
|
|
873
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
878
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Button, { onClick: () => setShowAddPaymentMethod(true), children: t("billing.ui.payment_methods.add") })
|
|
874
879
|
] }),
|
|
875
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: [
|
|
876
881
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-16 w-16 text-muted-foreground" }),
|
|
877
882
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
878
883
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "mb-2 text-sm font-medium", children: t("billing.ui.payment_methods.empty_title") }),
|
|
879
884
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mb-4 text-muted-foreground", children: t("billing.ui.payment_methods.empty_description") }),
|
|
880
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
885
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Button, { onClick: () => setShowAddPaymentMethod(true), children: t("billing.ui.payment_methods.add_first") })
|
|
881
886
|
] })
|
|
882
887
|
] }),
|
|
883
888
|
paymentMethods.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodsList, { paymentMethods, onUpdate: loadPaymentMethods }),
|
|
@@ -933,7 +938,7 @@ var statusConfig = {
|
|
|
933
938
|
function InvoiceStatusBadge({ status }) {
|
|
934
939
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
935
940
|
const config = statusConfig[status] || statusConfig["draft" /* DRAFT */];
|
|
936
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
941
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Badge, { variant: config.variant, children: t(config.label) });
|
|
937
942
|
}
|
|
938
943
|
_chunk7QVYU63Ejs.__name.call(void 0, InvoiceStatusBadge, "InvoiceStatusBadge");
|
|
939
944
|
|
|
@@ -946,7 +951,7 @@ function InvoiceDetails({
|
|
|
946
951
|
onInvoiceChange: _onInvoiceChange
|
|
947
952
|
}) {
|
|
948
953
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
949
|
-
const fmt =
|
|
954
|
+
const fmt = _chunk2H342HNNjs.useBillingFormatOptions.call(void 0, );
|
|
950
955
|
const handleDownloadPDF = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
951
956
|
if (invoice.stripePdfUrl) {
|
|
952
957
|
window.open(invoice.stripePdfUrl, "_blank");
|
|
@@ -966,10 +971,10 @@ function InvoiceDetails({
|
|
|
966
971
|
return invoice.stripeInvoiceId.slice(-8);
|
|
967
972
|
}, "getInvoiceNumber");
|
|
968
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");
|
|
969
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
970
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
971
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
972
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
974
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.DialogContent, { className: "max-w-2xl", children: [
|
|
975
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.DialogHeader, { children: [
|
|
976
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.DialogTitle, { children: t("billing.ui.invoice.title", { number: getInvoiceNumber() }) }),
|
|
977
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.DialogDescription, { children: _chunk2H342HNNjs.formatDate.call(void 0, invoice.periodStart, fmt) })
|
|
973
978
|
] }),
|
|
974
979
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
975
980
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
@@ -980,18 +985,18 @@ function InvoiceDetails({
|
|
|
980
985
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
981
986
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.billing_period") }),
|
|
982
987
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm", children: [
|
|
983
|
-
|
|
988
|
+
_chunk2H342HNNjs.formatDate.call(void 0, invoice.periodStart, fmt),
|
|
984
989
|
" - ",
|
|
985
|
-
|
|
990
|
+
_chunk2H342HNNjs.formatDate.call(void 0, invoice.periodEnd, fmt)
|
|
986
991
|
] })
|
|
987
992
|
] }),
|
|
988
993
|
invoice.dueDate && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
989
994
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.due_date") }),
|
|
990
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm", children:
|
|
995
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm", children: _chunk2H342HNNjs.formatDate.call(void 0, invoice.dueDate, fmt) })
|
|
991
996
|
] }),
|
|
992
997
|
invoice.paidAt && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
993
998
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.paid_date") }),
|
|
994
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm", children:
|
|
999
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm", children: _chunk2H342HNNjs.formatDate.call(void 0, invoice.paidAt, fmt) })
|
|
995
1000
|
] }),
|
|
996
1001
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
997
1002
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.attempt_count") }),
|
|
@@ -1007,42 +1012,42 @@ function InvoiceDetails({
|
|
|
1007
1012
|
] }) }),
|
|
1008
1013
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "tbody", { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "tr", { className: "border-t", children: [
|
|
1009
1014
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "td", { className: "p-3", children: productName }),
|
|
1010
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "td", { className: "p-3 text-end", children:
|
|
1015
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "td", { className: "p-3 text-end", children: _chunkMOGEGWXWjs.formatCurrency.call(void 0, invoice.subtotal, invoice.currency, fmt) })
|
|
1011
1016
|
] }) })
|
|
1012
1017
|
] }) })
|
|
1013
1018
|
] }),
|
|
1014
1019
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2 border-t pt-4", children: [
|
|
1015
1020
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1016
1021
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.subtotal") }),
|
|
1017
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children:
|
|
1022
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children: _chunkMOGEGWXWjs.formatCurrency.call(void 0, invoice.subtotal, invoice.currency, fmt) })
|
|
1018
1023
|
] }),
|
|
1019
1024
|
invoice.tax !== void 0 && invoice.tax > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1020
1025
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.tax") }),
|
|
1021
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children:
|
|
1026
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children: _chunkMOGEGWXWjs.formatCurrency.call(void 0, invoice.tax, invoice.currency, fmt) })
|
|
1022
1027
|
] }),
|
|
1023
1028
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between text-lg font-semibold border-t pt-2", children: [
|
|
1024
1029
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: t("billing.ui.invoice.total") }),
|
|
1025
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children:
|
|
1030
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _chunkMOGEGWXWjs.formatCurrency.call(void 0, invoice.total, invoice.currency, fmt) })
|
|
1026
1031
|
] }),
|
|
1027
1032
|
invoice.amountPaid > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1028
1033
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.amount_paid") }),
|
|
1029
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-success", children:
|
|
1034
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-success", children: _chunkMOGEGWXWjs.formatCurrency.call(void 0, invoice.amountPaid, invoice.currency, fmt) })
|
|
1030
1035
|
] }),
|
|
1031
1036
|
invoice.amountRemaining > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1032
1037
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.amount_due") }),
|
|
1033
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-destructive", children:
|
|
1038
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-destructive", children: _chunkMOGEGWXWjs.formatCurrency.call(void 0, invoice.amountRemaining, invoice.currency, fmt) })
|
|
1034
1039
|
] })
|
|
1035
1040
|
] }),
|
|
1036
1041
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2 pt-4 border-t", children: [
|
|
1037
|
-
invoice.stripePdfUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1042
|
+
invoice.stripePdfUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.Button, { variant: "outline", onClick: handleDownloadPDF, children: [
|
|
1038
1043
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Download, { className: "me-2 h-4 w-4" }),
|
|
1039
1044
|
t("billing.ui.invoice.download_pdf")
|
|
1040
1045
|
] }),
|
|
1041
|
-
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, _chunk2H342HNNjs.Button, { variant: "default", onClick: handleRetryPayment, children: [
|
|
1042
1047
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RefreshCw, { className: "me-2 h-4 w-4" }),
|
|
1043
1048
|
t("billing.ui.invoice.retry_payment")
|
|
1044
1049
|
] }),
|
|
1045
|
-
invoice.stripeHostedInvoiceUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1050
|
+
invoice.stripeHostedInvoiceUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.Button, { variant: "outline", onClick: handleViewInStripe, children: [
|
|
1046
1051
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ExternalLink, { className: "me-2 h-4 w-4" }),
|
|
1047
1052
|
t("billing.ui.invoice.view_in_stripe")
|
|
1048
1053
|
] })
|
|
@@ -1056,7 +1061,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, InvoiceDetails, "InvoiceDetails");
|
|
|
1056
1061
|
|
|
1057
1062
|
function InvoicesList({ invoices, onInvoicesChange }) {
|
|
1058
1063
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1059
|
-
const fmt =
|
|
1064
|
+
const fmt = _chunk2H342HNNjs.useBillingFormatOptions.call(void 0, );
|
|
1060
1065
|
const [selectedInvoice, setSelectedInvoice] = _react.useState.call(void 0, null);
|
|
1061
1066
|
const handleRowClick = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (invoice) => {
|
|
1062
1067
|
setSelectedInvoice(invoice);
|
|
@@ -1068,30 +1073,30 @@ function InvoicesList({ invoices, onInvoicesChange }) {
|
|
|
1068
1073
|
return invoice.stripeInvoiceId.slice(-8);
|
|
1069
1074
|
}, "getInvoiceNumber");
|
|
1070
1075
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1071
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1072
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1073
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1074
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1075
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1076
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1077
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1076
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.Table, { children: [
|
|
1077
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.TableRow, { children: [
|
|
1078
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.TableHead, { children: t("billing.ui.columns.invoice_number") }),
|
|
1079
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.TableHead, { children: t("billing.ui.columns.date") }),
|
|
1080
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.TableHead, { children: t("billing.ui.columns.status") }),
|
|
1081
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.TableHead, { className: "text-end", children: t("billing.ui.columns.amount") }),
|
|
1082
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.TableHead, { children: t("billing.ui.columns.period") })
|
|
1078
1083
|
] }) }),
|
|
1079
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1084
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.TableBody, { children: invoices.map((invoice) => {
|
|
1080
1085
|
const invoiceNumber = getInvoiceNumber(invoice);
|
|
1081
|
-
const date =
|
|
1082
|
-
const amount =
|
|
1083
|
-
const period = `${
|
|
1086
|
+
const date = _chunk2H342HNNjs.formatDate.call(void 0, invoice.periodStart, fmt);
|
|
1087
|
+
const amount = _chunkMOGEGWXWjs.formatCurrency.call(void 0, invoice.total, invoice.currency, fmt);
|
|
1088
|
+
const period = `${_chunk2H342HNNjs.formatDate.call(void 0, invoice.periodStart, fmt)} - ${_chunk2H342HNNjs.formatDate.call(void 0, invoice.periodEnd, fmt)}`;
|
|
1084
1089
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1085
|
-
|
|
1090
|
+
_chunk2H342HNNjs.TableRow,
|
|
1086
1091
|
{
|
|
1087
1092
|
onClick: () => handleRowClick(invoice),
|
|
1088
1093
|
className: "cursor-pointer hover:bg-muted/50",
|
|
1089
1094
|
children: [
|
|
1090
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1091
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1092
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1093
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1094
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1095
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.TableCell, { className: "font-medium", children: invoiceNumber }),
|
|
1096
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.TableCell, { className: "text-muted-foreground text-xs", children: date }),
|
|
1097
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InvoiceStatusBadge, { status: invoice.status }) }),
|
|
1098
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.TableCell, { className: "text-end font-medium", children: amount }),
|
|
1099
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.TableCell, { className: "text-muted-foreground text-xs", children: period })
|
|
1095
1100
|
]
|
|
1096
1101
|
},
|
|
1097
1102
|
invoice.id
|
|
@@ -1125,7 +1130,7 @@ function InvoicesContainer() {
|
|
|
1125
1130
|
setLoading(true);
|
|
1126
1131
|
try {
|
|
1127
1132
|
const params = statusFilter !== "all" ? { status: statusFilter } : void 0;
|
|
1128
|
-
const data = await
|
|
1133
|
+
const data = await _chunkMOGEGWXWjs.StripeInvoiceService.listInvoices(params);
|
|
1129
1134
|
setInvoices(data);
|
|
1130
1135
|
} catch (error) {
|
|
1131
1136
|
console.error("[InvoicesContainer] Failed to load invoices:", error);
|
|
@@ -1141,12 +1146,12 @@ function InvoicesContainer() {
|
|
|
1141
1146
|
setStatusFilter(value);
|
|
1142
1147
|
}, "handleFilterChange");
|
|
1143
1148
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-4", children: [
|
|
1144
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1145
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1146
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1147
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1148
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1149
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1149
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Tabs, { value: statusFilter, onValueChange: handleFilterChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.TabsList, { children: [
|
|
1150
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.TabsTrigger, { value: "all", children: t("billing.ui.invoices.filter_all") }),
|
|
1151
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.TabsTrigger, { value: "paid" /* PAID */, children: t("billing.ui.invoice_status.paid") }),
|
|
1152
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.TabsTrigger, { value: "open" /* OPEN */, children: t("billing.ui.invoice_status.open") }),
|
|
1153
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.TabsTrigger, { value: "void" /* VOID */, children: t("billing.ui.invoice_status.void") }),
|
|
1154
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.TabsTrigger, { value: "uncollectible" /* UNCOLLECTIBLE */, children: t("billing.ui.invoice_status.uncollectible") })
|
|
1150
1155
|
] }) }),
|
|
1151
1156
|
loading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-center py-8 text-muted-foreground", children: t("billing.ui.invoices.loading") }),
|
|
1152
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: [
|
|
@@ -1188,7 +1193,7 @@ function CancelSubscriptionDialog({
|
|
|
1188
1193
|
onSuccess
|
|
1189
1194
|
}) {
|
|
1190
1195
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1191
|
-
const fmt =
|
|
1196
|
+
const fmt = _chunk2H342HNNjs.useBillingFormatOptions.call(void 0, );
|
|
1192
1197
|
const [isSubmitting, setIsSubmitting] = _react.useState.call(void 0, false);
|
|
1193
1198
|
const form = _reacthookform.useForm.call(void 0, {
|
|
1194
1199
|
resolver: _zod.zodResolver.call(void 0, formSchema),
|
|
@@ -1199,7 +1204,7 @@ function CancelSubscriptionDialog({
|
|
|
1199
1204
|
const onSubmit = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async (_values) => {
|
|
1200
1205
|
setIsSubmitting(true);
|
|
1201
1206
|
try {
|
|
1202
|
-
await
|
|
1207
|
+
await _chunkMOGEGWXWjs.StripeSubscriptionService.cancelSubscription({
|
|
1203
1208
|
id: subscription.id,
|
|
1204
1209
|
cancelImmediately: false
|
|
1205
1210
|
});
|
|
@@ -1211,16 +1216,16 @@ function CancelSubscriptionDialog({
|
|
|
1211
1216
|
setIsSubmitting(false);
|
|
1212
1217
|
}
|
|
1213
1218
|
}, "onSubmit");
|
|
1214
|
-
const periodEndDate =
|
|
1215
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1216
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1217
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1218
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1219
|
+
const periodEndDate = _chunk2H342HNNjs.formatDate.call(void 0, subscription.currentPeriodEnd, fmt);
|
|
1220
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.DialogContent, { className: "max-w-md", children: [
|
|
1221
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.DialogHeader, { children: [
|
|
1222
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.DialogTitle, { children: t("billing.ui.subscription.cancel.title") }),
|
|
1223
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.DialogDescription, { children: t("billing.ui.subscription.cancel.description") })
|
|
1219
1224
|
] }),
|
|
1220
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1225
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-col gap-y-4", children: [
|
|
1221
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 }) }),
|
|
1222
1227
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1223
|
-
|
|
1228
|
+
_chunk2H342HNNjs.FormTextarea,
|
|
1224
1229
|
{
|
|
1225
1230
|
form,
|
|
1226
1231
|
id: "reason",
|
|
@@ -1230,8 +1235,8 @@ function CancelSubscriptionDialog({
|
|
|
1230
1235
|
}
|
|
1231
1236
|
),
|
|
1232
1237
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-x-2 justify-end pt-2", children: [
|
|
1233
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1234
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1238
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Button, { type: "button", variant: "outline", onClick: () => onOpenChange(false), disabled: isSubmitting, children: t("billing.ui.subscription.cancel.keep") }),
|
|
1239
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Button, { type: "submit", variant: "destructive", disabled: isSubmitting, children: isSubmitting ? t("billing.ui.subscription.cancel.canceling") : t("billing.ui.subscription.cancel.confirm") })
|
|
1235
1240
|
] })
|
|
1236
1241
|
] }) })
|
|
1237
1242
|
] }) });
|
|
@@ -1282,7 +1287,7 @@ var cancelingConfig = {
|
|
|
1282
1287
|
function SubscriptionStatusBadge({ status, cancelAtPeriodEnd }) {
|
|
1283
1288
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1284
1289
|
const config = cancelAtPeriodEnd ? cancelingConfig : statusConfig2[status] || statusConfig2["canceled" /* CANCELED */];
|
|
1285
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1290
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Badge, { variant: config.variant, children: t(config.label) });
|
|
1286
1291
|
}
|
|
1287
1292
|
_chunk7QVYU63Ejs.__name.call(void 0, SubscriptionStatusBadge, "SubscriptionStatusBadge");
|
|
1288
1293
|
|
|
@@ -1309,7 +1314,7 @@ function formatPlanName2(price, t) {
|
|
|
1309
1314
|
_chunk7QVYU63Ejs.__name.call(void 0, formatPlanName2, "formatPlanName");
|
|
1310
1315
|
function formatBillingAmount(price, notAvailable, fmt) {
|
|
1311
1316
|
if (!_optionalChain([price, 'optionalAccess', _37 => _37.unitAmount])) return notAvailable;
|
|
1312
|
-
return
|
|
1317
|
+
return _chunkMOGEGWXWjs.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt);
|
|
1313
1318
|
}
|
|
1314
1319
|
_chunk7QVYU63Ejs.__name.call(void 0, formatBillingAmount, "formatBillingAmount");
|
|
1315
1320
|
function SubscriptionDetails({
|
|
@@ -1321,11 +1326,11 @@ function SubscriptionDetails({
|
|
|
1321
1326
|
renderCancelDialog
|
|
1322
1327
|
}) {
|
|
1323
1328
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1324
|
-
const fmt =
|
|
1329
|
+
const fmt = _chunk2H342HNNjs.useBillingFormatOptions.call(void 0, );
|
|
1325
1330
|
const [showCancel, setShowCancel] = _react.useState.call(void 0, false);
|
|
1326
1331
|
const handleManageViaPortal = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1327
1332
|
try {
|
|
1328
|
-
const { url } = await
|
|
1333
|
+
const { url } = await _chunkMOGEGWXWjs.StripeCustomerService.createPortalSession();
|
|
1329
1334
|
window.open(url, "_blank");
|
|
1330
1335
|
} catch (error) {
|
|
1331
1336
|
console.error("[SubscriptionDetails] Failed to create portal session:", error);
|
|
@@ -1333,10 +1338,10 @@ function SubscriptionDetails({
|
|
|
1333
1338
|
}, "handleManageViaPortal");
|
|
1334
1339
|
const canCancel = subscription.status === "active" /* ACTIVE */ || subscription.status === "trialing" /* TRIALING */ || subscription.status === "paused" /* PAUSED */;
|
|
1335
1340
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1336
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1337
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1338
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1339
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1341
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.DialogContent, { className: "max-w-2xl", children: [
|
|
1342
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.DialogHeader, { children: [
|
|
1343
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.DialogTitle, { children: t("billing.ui.subscription.details_title") }),
|
|
1344
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.DialogDescription, { children: t("billing.ui.subscription.details_description") })
|
|
1340
1345
|
] }),
|
|
1341
1346
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
1342
1347
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
@@ -1362,22 +1367,22 @@ function SubscriptionDetails({
|
|
|
1362
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: [
|
|
1363
1368
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.subscription.current_period") }),
|
|
1364
1369
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "text-sm", children: [
|
|
1365
|
-
|
|
1370
|
+
_chunk2H342HNNjs.formatDate.call(void 0, subscription.currentPeriodStart, fmt),
|
|
1366
1371
|
" - ",
|
|
1367
|
-
|
|
1372
|
+
_chunk2H342HNNjs.formatDate.call(void 0, subscription.currentPeriodEnd, fmt)
|
|
1368
1373
|
] })
|
|
1369
1374
|
] }) }),
|
|
1370
1375
|
subscription.trialEnd && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1371
1376
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.subscription.trial_ends") }),
|
|
1372
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children:
|
|
1377
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children: _chunk2H342HNNjs.formatDate.call(void 0, subscription.trialEnd, fmt) })
|
|
1373
1378
|
] }),
|
|
1374
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", {
|
|
1375
|
-
date:
|
|
1380
|
+
date: _chunk2H342HNNjs.formatDate.call(void 0, subscription.currentPeriodEnd, fmt)
|
|
1376
1381
|
}) }) }),
|
|
1377
1382
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2 pt-4 border-t", children: [
|
|
1378
|
-
onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1379
|
-
canCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1380
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1383
|
+
onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Button, { variant: "default", onClick: () => onChangePlan(subscription), children: t("billing.ui.subscription.change_plan") }),
|
|
1384
|
+
canCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Button, { variant: "destructive", onClick: () => setShowCancel(true), children: t("ui.buttons.cancel") }),
|
|
1385
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Button, { variant: "outline", onClick: handleManageViaPortal, children: t("billing.ui.subscription.manage_portal") })
|
|
1381
1386
|
] })
|
|
1382
1387
|
] })
|
|
1383
1388
|
] }) }),
|
|
@@ -1437,46 +1442,46 @@ function SubscriptionsList({
|
|
|
1437
1442
|
renderCancelDialog
|
|
1438
1443
|
}) {
|
|
1439
1444
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1440
|
-
const fmt =
|
|
1445
|
+
const fmt = _chunk2H342HNNjs.useBillingFormatOptions.call(void 0, );
|
|
1441
1446
|
const [selectedSub, setSelectedSub] = _react.useState.call(void 0, null);
|
|
1442
1447
|
const handleRowClick = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (subscription) => {
|
|
1443
1448
|
setSelectedSub(subscription);
|
|
1444
1449
|
}, "handleRowClick");
|
|
1445
1450
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1446
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1447
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1448
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1449
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1450
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1451
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1452
|
-
/* @__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, _chunk2H342HNNjs.Table, { children: [
|
|
1452
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.TableRow, { children: [
|
|
1453
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.TableHead, { children: t("billing.ui.columns.status") }),
|
|
1454
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.TableHead, { children: t("billing.ui.columns.plan") }),
|
|
1455
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.TableHead, { children: t("billing.ui.columns.period") }),
|
|
1456
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.TableHead, { className: "text-end", children: t("billing.ui.columns.amount") }),
|
|
1457
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.TableHead, { className: "text-end", children: t("billing.ui.columns.actions") })
|
|
1453
1458
|
] }) }),
|
|
1454
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1459
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.TableBody, { children: subscriptions.map((subscription) => {
|
|
1455
1460
|
const price = subscription.price;
|
|
1456
|
-
const amount = _optionalChain([price, 'optionalAccess', _42 => _42.unitAmount]) ?
|
|
1457
|
-
const discountedAmount = price ?
|
|
1458
|
-
const period = `${
|
|
1461
|
+
const amount = _optionalChain([price, 'optionalAccess', _42 => _42.unitAmount]) ? _chunkMOGEGWXWjs.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt) : "0";
|
|
1462
|
+
const discountedAmount = price ? _chunk2H342HNNjs.applyDiscount.call(void 0, price.unitAmount, _chunk2H342HNNjs.subscriptionDiscount.call(void 0, subscription)) : null;
|
|
1463
|
+
const period = `${_chunk2H342HNNjs.formatDate.call(void 0, subscription.currentPeriodStart, fmt)} - ${_chunk2H342HNNjs.formatDate.call(void 0, subscription.currentPeriodEnd, fmt)}`;
|
|
1459
1464
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1460
|
-
|
|
1465
|
+
_chunk2H342HNNjs.TableRow,
|
|
1461
1466
|
{
|
|
1462
1467
|
onClick: () => handleRowClick(subscription),
|
|
1463
1468
|
className: "cursor-pointer hover:bg-muted/50",
|
|
1464
1469
|
children: [
|
|
1465
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1470
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1466
1471
|
SubscriptionStatusBadge,
|
|
1467
1472
|
{
|
|
1468
1473
|
status: subscription.status,
|
|
1469
1474
|
cancelAtPeriodEnd: subscription.cancelAtPeriodEnd
|
|
1470
1475
|
}
|
|
1471
1476
|
) }),
|
|
1472
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1473
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1474
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1477
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.TableCell, { className: "font-medium", children: formatPlanName3(price, t) }),
|
|
1478
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.TableCell, { className: "text-muted-foreground text-sm", children: period }),
|
|
1479
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.TableCell, { className: "text-end font-medium", children: discountedAmount !== null && price ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1475
1480
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "line-through text-muted-foreground me-2", children: amount }),
|
|
1476
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success", children:
|
|
1481
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success", children: _chunkMOGEGWXWjs.formatCurrency.call(void 0, discountedAmount, price.currency, fmt) })
|
|
1477
1482
|
] }) : amount }),
|
|
1478
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1479
|
-
|
|
1483
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.TableCell, { className: "text-end", children: (subscription.status === "active" /* ACTIVE */ || subscription.status === "trialing" /* TRIALING */) && onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1484
|
+
_chunk2H342HNNjs.Button,
|
|
1480
1485
|
{
|
|
1481
1486
|
size: "sm",
|
|
1482
1487
|
variant: "outline",
|
|
@@ -1536,7 +1541,7 @@ function SubscriptionsContainer({
|
|
|
1536
1541
|
}
|
|
1537
1542
|
setLoading(true);
|
|
1538
1543
|
try {
|
|
1539
|
-
const fetchedSubscriptions = await
|
|
1544
|
+
const fetchedSubscriptions = await _chunkMOGEGWXWjs.StripeSubscriptionService.listSubscriptions();
|
|
1540
1545
|
setSubscriptions(fetchedSubscriptions);
|
|
1541
1546
|
} catch (error) {
|
|
1542
1547
|
console.error("[SubscriptionsContainer] Failed to load subscriptions:", error);
|
|
@@ -1559,7 +1564,7 @@ function SubscriptionsContainer({
|
|
|
1559
1564
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8" }),
|
|
1560
1565
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: t("billing.ui.subscriptions.title") })
|
|
1561
1566
|
] }),
|
|
1562
|
-
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1567
|
+
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _44 => _44()]), children: hasActiveRecurringSubscription ? t("billing.ui.subscriptions.purchase_addons") : t("billing.ui.subscriptions.subscribe") })
|
|
1563
1568
|
] }),
|
|
1564
1569
|
criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BillingAlertBanner, { subscription }, subscription.id)),
|
|
1565
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: [
|
|
@@ -1567,7 +1572,7 @@ function SubscriptionsContainer({
|
|
|
1567
1572
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
1568
1573
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium mb-2", children: t("billing.ui.subscriptions.empty_title") }),
|
|
1569
1574
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground mb-6", children: t("billing.ui.subscriptions.empty_description") }),
|
|
1570
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1575
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _45 => _45()]), children: t("billing.ui.subscriptions.subscribe") })
|
|
1571
1576
|
] })
|
|
1572
1577
|
] }),
|
|
1573
1578
|
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -1591,9 +1596,9 @@ function IntervalToggle({ value, onChange, hasMonthly, hasYearly }) {
|
|
|
1591
1596
|
if (!hasMonthly || !hasYearly) {
|
|
1592
1597
|
return null;
|
|
1593
1598
|
}
|
|
1594
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1595
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1596
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1599
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Tabs, { value, onValueChange: (v) => onChange(v), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.TabsList, { children: [
|
|
1600
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.TabsTrigger, { value: "month", children: t("billing.admin.prices.interval.month") }),
|
|
1601
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.TabsTrigger, { value: "year", children: t("billing.admin.prices.interval.year") })
|
|
1597
1602
|
] }) });
|
|
1598
1603
|
}
|
|
1599
1604
|
_chunk7QVYU63Ejs.__name.call(void 0, IntervalToggle, "IntervalToggle");
|
|
@@ -1611,11 +1616,11 @@ function PricingCard({
|
|
|
1611
1616
|
onSelect
|
|
1612
1617
|
}) {
|
|
1613
1618
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1614
|
-
const fmt =
|
|
1619
|
+
const fmt = _chunk2H342HNNjs.useBillingFormatOptions.call(void 0, );
|
|
1615
1620
|
const description = price.description || price.nickname || t("billing.ui.pricing.standard");
|
|
1616
1621
|
const features = price.features || [];
|
|
1617
|
-
const formattedPrice =
|
|
1618
|
-
const interval =
|
|
1622
|
+
const formattedPrice = _chunkMOGEGWXWjs.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt);
|
|
1623
|
+
const interval = _chunkMOGEGWXWjs.formatInterval.call(void 0, price, fmt);
|
|
1619
1624
|
const handleKeyDown = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (e) => {
|
|
1620
1625
|
if ((e.key === "Enter" || e.key === " ") && !isDisabled && !isCurrentPlan) {
|
|
1621
1626
|
e.preventDefault();
|
|
@@ -1628,7 +1633,7 @@ function PricingCard({
|
|
|
1628
1633
|
}
|
|
1629
1634
|
}, "handleClick");
|
|
1630
1635
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1631
|
-
|
|
1636
|
+
_chunk2H342HNNjs.Card,
|
|
1632
1637
|
{
|
|
1633
1638
|
role: "radio",
|
|
1634
1639
|
"aria-checked": isSelected,
|
|
@@ -1636,7 +1641,7 @@ function PricingCard({
|
|
|
1636
1641
|
tabIndex: isDisabled ? -1 : 0,
|
|
1637
1642
|
onKeyDown: handleKeyDown,
|
|
1638
1643
|
onClick: handleClick,
|
|
1639
|
-
className:
|
|
1644
|
+
className: _chunkMOGEGWXWjs.cn.call(void 0,
|
|
1640
1645
|
"relative cursor-pointer transition-all duration-200 flex flex-col h-full",
|
|
1641
1646
|
"focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
1642
1647
|
isCurrentPlan && "bg-muted/30",
|
|
@@ -1646,9 +1651,9 @@ function PricingCard({
|
|
|
1646
1651
|
isLoading && "pointer-events-none"
|
|
1647
1652
|
),
|
|
1648
1653
|
children: [
|
|
1649
|
-
isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1650
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1651
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1654
|
+
isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Badge, { variant: "secondary", className: "absolute top-2 end-2", children: t("billing.ui.pricing.current") }),
|
|
1655
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.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, _chunk2H342HNNjs.CardContent, { className: "pb-4 grow", children: [
|
|
1652
1657
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mb-4", children: [
|
|
1653
1658
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-3xl font-bold", children: formattedPrice }),
|
|
1654
1659
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground ms-1", children: interval })
|
|
@@ -1658,8 +1663,8 @@ function PricingCard({
|
|
|
1658
1663
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-muted-foreground", children: feature })
|
|
1659
1664
|
] }, index)) })
|
|
1660
1665
|
] }),
|
|
1661
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1662
|
-
|
|
1666
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.CardFooter, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1667
|
+
_chunk2H342HNNjs.Button,
|
|
1663
1668
|
{
|
|
1664
1669
|
variant: isCurrentPlan ? "secondary" : isSelected ? "default" : "outline",
|
|
1665
1670
|
className: "w-full",
|
|
@@ -1692,7 +1697,7 @@ function ProductPricingRow({
|
|
|
1692
1697
|
return null;
|
|
1693
1698
|
}
|
|
1694
1699
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-3", children: [
|
|
1695
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1700
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.SectionHeader, { children: product.name }),
|
|
1696
1701
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1697
1702
|
"div",
|
|
1698
1703
|
{
|
|
@@ -1793,15 +1798,15 @@ function ProductPricingList({
|
|
|
1793
1798
|
_chunk7QVYU63Ejs.__name.call(void 0, ProductPricingList, "ProductPricingList");
|
|
1794
1799
|
function ProductPricingListSkeleton() {
|
|
1795
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: [
|
|
1796
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1801
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Skeleton, { className: "h-6 w-32" }),
|
|
1797
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: [
|
|
1798
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1799
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1803
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Skeleton, { className: "h-6 w-24" }),
|
|
1804
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Skeleton, { className: "h-8 w-32" }),
|
|
1800
1805
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
1801
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1802
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1806
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Skeleton, { className: "h-4 w-full" }),
|
|
1807
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Skeleton, { className: "h-4 w-3/4" })
|
|
1803
1808
|
] }),
|
|
1804
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1809
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Skeleton, { className: "h-10 w-full" })
|
|
1805
1810
|
] }, cardIndex)) })
|
|
1806
1811
|
] }, rowIndex)) });
|
|
1807
1812
|
}
|
|
@@ -1812,20 +1817,20 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductPricingListSkeleton, "ProductPricing
|
|
|
1812
1817
|
|
|
1813
1818
|
function ProrationPreview({ preview }) {
|
|
1814
1819
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1815
|
-
const fmt =
|
|
1820
|
+
const fmt = _chunk2H342HNNjs.useBillingFormatOptions.call(void 0, );
|
|
1816
1821
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-primary/10 border-primary/30 rounded-lg border p-4", children: [
|
|
1817
1822
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "text-primary mb-3 font-semibold", children: t("billing.ui.proration.title") }),
|
|
1818
1823
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
1819
1824
|
preview.lineItems.map((item, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between text-sm", children: [
|
|
1820
1825
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground", children: item.description }),
|
|
1821
|
-
/* @__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: _chunkMOGEGWXWjs.formatCurrency.call(void 0, item.amount, preview.currency, fmt) })
|
|
1822
1827
|
] }, index)),
|
|
1823
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: [
|
|
1824
1829
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-foreground", children: t("billing.ui.proration.net_due_today") }),
|
|
1825
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-foreground", children:
|
|
1830
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-foreground", children: _chunkMOGEGWXWjs.formatCurrency.call(void 0, preview.immediateCharge, preview.currency, fmt) })
|
|
1826
1831
|
] }) }),
|
|
1827
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", {
|
|
1828
|
-
amount:
|
|
1833
|
+
amount: _chunkMOGEGWXWjs.formatCurrency.call(void 0, preview.amountDue, preview.currency, fmt)
|
|
1829
1834
|
}) })
|
|
1830
1835
|
] })
|
|
1831
1836
|
] });
|
|
@@ -1838,7 +1843,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProrationPreview, "ProrationPreview");
|
|
|
1838
1843
|
|
|
1839
1844
|
function SubscriptionConfirmation({ price, isLoading, onConfirm, onCancel }) {
|
|
1840
1845
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
1841
|
-
const fmt =
|
|
1846
|
+
const fmt = _chunk2H342HNNjs.useBillingFormatOptions.call(void 0, );
|
|
1842
1847
|
const productName = _optionalChain([price, 'access', _51 => _51.product, 'optionalAccess', _52 => _52.name]) || price.nickname || t("billing.ui.wizard.review.selected_plan");
|
|
1843
1848
|
const productDescription = _optionalChain([price, 'access', _53 => _53.product, 'optionalAccess', _54 => _54.description]) || price.description;
|
|
1844
1849
|
const features = price.features || [];
|
|
@@ -1850,16 +1855,16 @@ function SubscriptionConfirmation({ price, isLoading, onConfirm, onCancel }) {
|
|
|
1850
1855
|
productDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-sm text-muted-foreground", children: productDescription })
|
|
1851
1856
|
] }),
|
|
1852
1857
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-lg font-semibold", children: [
|
|
1853
|
-
|
|
1854
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-normal text-muted-foreground", children:
|
|
1858
|
+
_chunkMOGEGWXWjs.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: _chunkMOGEGWXWjs.formatInterval.call(void 0, price, fmt) })
|
|
1855
1860
|
] }),
|
|
1856
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: [
|
|
1857
1862
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Check, { className: "h-4 w-4 text-primary" }),
|
|
1858
1863
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: feature })
|
|
1859
1864
|
] }, index)) }),
|
|
1860
1865
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-3 pt-2 border-t border-accent/30", children: [
|
|
1861
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1862
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1866
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Button, { variant: "outline", onClick: onCancel, disabled: isLoading, children: t("ui.buttons.cancel") }),
|
|
1867
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Button, { onClick: onConfirm, disabled: isLoading, children: isLoading ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1863
1868
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "h-4 w-4 animate-spin me-2" }),
|
|
1864
1869
|
t("billing.ui.wizard.review.processing")
|
|
1865
1870
|
] }) : t("billing.ui.confirmation.subscribe") })
|
|
@@ -2038,7 +2043,7 @@ function wizardReducer(state, action) {
|
|
|
2038
2043
|
_chunk7QVYU63Ejs.__name.call(void 0, wizardReducer, "wizardReducer");
|
|
2039
2044
|
function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
2040
2045
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2041
|
-
const locale =
|
|
2046
|
+
const locale = _chunkBZ5J2FIVjs.useI18nLocale.call(void 0, );
|
|
2042
2047
|
const { confirmPayment } = useConfirmSubscriptionPayment();
|
|
2043
2048
|
const [state, dispatch] = _react.useReducer.call(void 0, wizardReducer, {
|
|
2044
2049
|
...initialState,
|
|
@@ -2050,7 +2055,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2050
2055
|
onCloseRef.current = onClose;
|
|
2051
2056
|
const checkPaymentMethod = _react.useCallback.call(void 0, async () => {
|
|
2052
2057
|
try {
|
|
2053
|
-
const methods = await
|
|
2058
|
+
const methods = await _chunkMOGEGWXWjs.StripeCustomerService.listPaymentMethods();
|
|
2054
2059
|
dispatch({ type: "SET_HAS_PAYMENT_METHOD", hasMethod: methods.length > 0 });
|
|
2055
2060
|
} catch (error) {
|
|
2056
2061
|
console.error("[useSubscriptionWizard] Failed to check payment methods:", error);
|
|
@@ -2068,10 +2073,10 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2068
2073
|
}, []);
|
|
2069
2074
|
const lookUpAutomaticCode = _react.useCallback.call(void 0, async (priceId) => {
|
|
2070
2075
|
try {
|
|
2071
|
-
const automaticCode = await
|
|
2076
|
+
const automaticCode = await _chunkMOGEGWXWjs.StripeCouponCodeService.findAutomatic({ priceId });
|
|
2072
2077
|
dispatch({
|
|
2073
2078
|
type: "SET_PROMOTION_CODE",
|
|
2074
|
-
code: automaticCode ?
|
|
2079
|
+
code: automaticCode ? _chunkMOGEGWXWjs.toPromotionCodeResult.call(void 0, automaticCode) : null
|
|
2075
2080
|
});
|
|
2076
2081
|
return true;
|
|
2077
2082
|
} catch (error) {
|
|
@@ -2098,7 +2103,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2098
2103
|
const isTrialUpgrade = _optionalChain([subscription, 'optionalAccess', _61 => _61.status]) === "trialing" /* TRIALING */;
|
|
2099
2104
|
dispatch({ type: "SET_IS_TRIAL_SUBSCRIPTION", isTrial: isTrialUpgrade });
|
|
2100
2105
|
if (isTrialUpgrade && !state.hasPaymentMethod) {
|
|
2101
|
-
const methods = await
|
|
2106
|
+
const methods = await _chunkMOGEGWXWjs.StripeCustomerService.listPaymentMethods();
|
|
2102
2107
|
if (methods.length === 0) {
|
|
2103
2108
|
dispatch({ type: "SET_STEP", step: "payment-method" });
|
|
2104
2109
|
dispatch({
|
|
@@ -2116,7 +2121,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2116
2121
|
}
|
|
2117
2122
|
}
|
|
2118
2123
|
if (subscription && state.selectedPrice.id !== _optionalChain([subscription, 'access', _62 => _62.price, 'optionalAccess', _63 => _63.id])) {
|
|
2119
|
-
const preview = await
|
|
2124
|
+
const preview = await _chunkMOGEGWXWjs.StripeSubscriptionService.getProrationPreview({
|
|
2120
2125
|
subscriptionId: subscription.id,
|
|
2121
2126
|
newPriceId: state.selectedPrice.id
|
|
2122
2127
|
});
|
|
@@ -2150,14 +2155,14 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2150
2155
|
newPriceId: state.selectedPrice.id,
|
|
2151
2156
|
promotionCode: promotionCodeToSend(state.promotionCode)
|
|
2152
2157
|
};
|
|
2153
|
-
result = await
|
|
2158
|
+
result = await _chunkMOGEGWXWjs.StripeSubscriptionService.changePlanWithMeta(changePlanParams);
|
|
2154
2159
|
} else {
|
|
2155
2160
|
const createParams = {
|
|
2156
2161
|
id: _uuid.v4.call(void 0, ),
|
|
2157
2162
|
priceId: state.selectedPrice.id,
|
|
2158
2163
|
promotionCode: promotionCodeToSend(state.promotionCode)
|
|
2159
2164
|
};
|
|
2160
|
-
result = await
|
|
2165
|
+
result = await _chunkMOGEGWXWjs.StripeSubscriptionService.createSubscription(createParams);
|
|
2161
2166
|
}
|
|
2162
2167
|
const clientSecret = clientSecretToConfirm(result.meta);
|
|
2163
2168
|
if (clientSecret) {
|
|
@@ -2173,7 +2178,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2173
2178
|
const subscriptionId = subscriptionIdToSync(result.subscription, subscription);
|
|
2174
2179
|
if (subscriptionId) {
|
|
2175
2180
|
try {
|
|
2176
|
-
await
|
|
2181
|
+
await _chunkMOGEGWXWjs.StripeSubscriptionService.syncSubscription({ subscriptionId });
|
|
2177
2182
|
} catch (syncError) {
|
|
2178
2183
|
console.error("[useSubscriptionWizard] Subscription sync after payment failed:", syncError);
|
|
2179
2184
|
}
|
|
@@ -2221,7 +2226,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
2221
2226
|
dispatch({ type: "SET_VALIDATING_PROMO_CODE", isValidating: true });
|
|
2222
2227
|
dispatch({ type: "SET_PROMO_CODE_ERROR", error: null });
|
|
2223
2228
|
try {
|
|
2224
|
-
const result = await
|
|
2229
|
+
const result = await _chunkMOGEGWXWjs.StripePromotionCodeService.validatePromotionCode({
|
|
2225
2230
|
code,
|
|
2226
2231
|
stripePriceId: _optionalChain([state, 'access', _72 => _72.selectedPrice, 'optionalAccess', _73 => _73.id]),
|
|
2227
2232
|
language: locale
|
|
@@ -2346,7 +2351,7 @@ function WizardStepPlanSelection({
|
|
|
2346
2351
|
_react.useEffect.call(void 0, () => {
|
|
2347
2352
|
const loadProducts = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2348
2353
|
try {
|
|
2349
|
-
const fetchedProducts = await
|
|
2354
|
+
const fetchedProducts = await _chunkMOGEGWXWjs.StripeProductService.listProducts({ active: true });
|
|
2350
2355
|
setProducts(fetchedProducts);
|
|
2351
2356
|
} catch (error) {
|
|
2352
2357
|
console.error("[WizardStepPlanSelection] Failed to load products:", error);
|
|
@@ -2397,7 +2402,7 @@ function WizardStepPlanSelection({
|
|
|
2397
2402
|
onSelectPrice: handleSelectPrice
|
|
2398
2403
|
}
|
|
2399
2404
|
),
|
|
2400
|
-
/* @__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, _chunk2H342HNNjs.Button, { onClick: onNext, disabled: !selectedPrice || isProcessing, children: isProcessing ? t("common.loading") : t("billing.ui.wizard.next_review") }) })
|
|
2401
2406
|
] });
|
|
2402
2407
|
}
|
|
2403
2408
|
_chunk7QVYU63Ejs.__name.call(void 0, WizardStepPlanSelection, "WizardStepPlanSelection");
|
|
@@ -2421,7 +2426,7 @@ function PromoCodeInput({
|
|
|
2421
2426
|
disabled = false
|
|
2422
2427
|
}) {
|
|
2423
2428
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2424
|
-
const locale =
|
|
2429
|
+
const locale = _chunkBZ5J2FIVjs.useI18nLocale.call(void 0, );
|
|
2425
2430
|
const [code, setCode] = _react.useState.call(void 0, "");
|
|
2426
2431
|
const appliedKey = _optionalChain([appliedCode, 'optionalAccess', _82 => _82.valid]) ? `${appliedCode.automatic ? "auto" : "typed"}:${_nullishCoalesce(appliedCode.code, () => ( ""))}` : null;
|
|
2427
2432
|
const [previousAppliedKey, setPreviousAppliedKey] = _react.useState.call(void 0, appliedKey);
|
|
@@ -2450,7 +2455,7 @@ function PromoCodeInput({
|
|
|
2450
2455
|
}
|
|
2451
2456
|
const amount = (result.discountValue || 0) / 100;
|
|
2452
2457
|
const currency = _optionalChain([result, 'access', _83 => _83.currency, 'optionalAccess', _84 => _84.toUpperCase, 'call', _85 => _85()]) || "USD";
|
|
2453
|
-
return t("billing.ui.wizard.review.amount_off", { amount: `${currency} ${
|
|
2458
|
+
return t("billing.ui.wizard.review.amount_off", { amount: `${currency} ${_chunkMOGEGWXWjs.formatFixed.call(void 0, amount, locale, 2)}` });
|
|
2454
2459
|
}, "formatDiscount");
|
|
2455
2460
|
const formatDuration = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (result) => {
|
|
2456
2461
|
switch (result.duration) {
|
|
@@ -2467,7 +2472,7 @@ function PromoCodeInput({
|
|
|
2467
2472
|
const codeInput = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
2468
2473
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
|
|
2469
2474
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2470
|
-
|
|
2475
|
+
_chunk2H342HNNjs.Input,
|
|
2471
2476
|
{
|
|
2472
2477
|
placeholder: t("billing.ui.promo_code.placeholder"),
|
|
2473
2478
|
value: code,
|
|
@@ -2477,7 +2482,7 @@ function PromoCodeInput({
|
|
|
2477
2482
|
className: "flex-1"
|
|
2478
2483
|
}
|
|
2479
2484
|
),
|
|
2480
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2485
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.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") })
|
|
2481
2486
|
] }),
|
|
2482
2487
|
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error })
|
|
2483
2488
|
] });
|
|
@@ -2506,7 +2511,7 @@ function PromoCodeInput({
|
|
|
2506
2511
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success text-sm", children: formatDiscount(appliedCode) })
|
|
2507
2512
|
] }),
|
|
2508
2513
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2509
|
-
|
|
2514
|
+
_chunk2H342HNNjs.Button,
|
|
2510
2515
|
{
|
|
2511
2516
|
variant: "ghost",
|
|
2512
2517
|
size: "sm",
|
|
@@ -2554,7 +2559,7 @@ function WizardStepReview({
|
|
|
2554
2559
|
isTrialUpgrade
|
|
2555
2560
|
}) {
|
|
2556
2561
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2557
|
-
const fmt =
|
|
2562
|
+
const fmt = _chunk2H342HNNjs.useBillingFormatOptions.call(void 0, );
|
|
2558
2563
|
const [card, setCard] = _react.useState.call(void 0, null);
|
|
2559
2564
|
_react.useEffect.call(void 0, () => {
|
|
2560
2565
|
if (!hasPaymentMethod) {
|
|
@@ -2562,7 +2567,7 @@ function WizardStepReview({
|
|
|
2562
2567
|
return;
|
|
2563
2568
|
}
|
|
2564
2569
|
let cancelled = false;
|
|
2565
|
-
Promise.all([
|
|
2570
|
+
Promise.all([_chunkMOGEGWXWjs.StripeCustomerService.listPaymentMethods(), _chunkMOGEGWXWjs.StripeCustomerService.getCustomer()]).then(([methods, customer]) => {
|
|
2566
2571
|
if (!cancelled) setCard(reviewCard(methods, _optionalChain([customer, 'optionalAccess', _90 => _90.defaultPaymentMethodId])));
|
|
2567
2572
|
}).catch((err) => {
|
|
2568
2573
|
console.error("[WizardStepReview] Failed to load the card on file:", err);
|
|
@@ -2581,11 +2586,11 @@ function WizardStepReview({
|
|
|
2581
2586
|
const interval = _optionalChain([price, 'access', _93 => _93.recurring, 'optionalAccess', _94 => _94.interval]) || "month";
|
|
2582
2587
|
return interval === "year" ? t("billing.ui.wizard.review.interval_yearly") : t("billing.ui.wizard.review.interval_monthly");
|
|
2583
2588
|
}, "formatInterval");
|
|
2584
|
-
const codeDiscount =
|
|
2585
|
-
const carriedDiscount = isChangingPlan && !codeDiscount ?
|
|
2589
|
+
const codeDiscount = _chunk2H342HNNjs.promotionCodeDiscount.call(void 0, promotionCode);
|
|
2590
|
+
const carriedDiscount = isChangingPlan && !codeDiscount ? _chunk2H342HNNjs.subscriptionDiscount.call(void 0, subscription) : null;
|
|
2586
2591
|
const discount = _nullishCoalesce(codeDiscount, () => ( carriedDiscount));
|
|
2587
|
-
const discountedPrice =
|
|
2588
|
-
const discountedImmediateCharge =
|
|
2592
|
+
const discountedPrice = _chunk2H342HNNjs.applyDiscount.call(void 0, selectedPrice.unitAmount, discount);
|
|
2593
|
+
const discountedImmediateCharge = _chunk2H342HNNjs.applyDiscount.call(void 0, _optionalChain([prorationPreview, 'optionalAccess', _95 => _95.immediateCharge]), discount);
|
|
2589
2594
|
const isProrationCredit = !isTrialUpgrade && (_nullishCoalesce(_nullishCoalesce(discountedImmediateCharge, () => ( _optionalChain([prorationPreview, 'optionalAccess', _96 => _96.immediateCharge]))), () => ( 0))) < 0;
|
|
2590
2595
|
const prorationAmount = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (amount) => isProrationCredit ? Math.abs(amount) : amount, "prorationAmount");
|
|
2591
2596
|
const getDiscountDescription = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
@@ -2594,13 +2599,13 @@ function WizardStepReview({
|
|
|
2594
2599
|
return t("billing.ui.wizard.review.percent_off", { value: discount.discountValue });
|
|
2595
2600
|
}
|
|
2596
2601
|
return t("billing.ui.wizard.review.amount_off", {
|
|
2597
|
-
amount:
|
|
2602
|
+
amount: _chunkMOGEGWXWjs.formatCurrency.call(void 0, discount.discountValue, discount.currency || selectedPrice.currency, fmt)
|
|
2598
2603
|
});
|
|
2599
2604
|
}, "getDiscountDescription");
|
|
2600
2605
|
const discountDescription = getDiscountDescription();
|
|
2601
2606
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
2602
2607
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-muted/50 rounded-lg p-4 space-y-3", children: [
|
|
2603
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2608
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.SectionHeader, { children: t("billing.ui.wizard.review.selected_plan") }),
|
|
2604
2609
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between items-center", children: [
|
|
2605
2610
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
2606
2611
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-medium", children: _optionalChain([selectedPrice, 'access', _97 => _97.product, 'optionalAccess', _98 => _98.name]) }),
|
|
@@ -2608,11 +2613,11 @@ function WizardStepReview({
|
|
|
2608
2613
|
] }),
|
|
2609
2614
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-end", children: [
|
|
2610
2615
|
discountedPrice !== null ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2611
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground line-through", children:
|
|
2612
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-success text-lg font-semibold", children:
|
|
2613
|
-
discountDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2616
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground line-through", children: _chunkMOGEGWXWjs.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: _chunkMOGEGWXWjs.formatCurrency.call(void 0, discountedPrice, selectedPrice.currency, fmt) }),
|
|
2618
|
+
discountDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Badge, { variant: "softGreen", children: discountDescription }),
|
|
2614
2619
|
carriedDiscount && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: t("billing.ui.wizard.review.discount_carries_over") })
|
|
2615
|
-
] }) : /* @__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: _chunkMOGEGWXWjs.formatCurrency.call(void 0, selectedPrice.unitAmount || 0, selectedPrice.currency, fmt) }),
|
|
2616
2621
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: formatInterval2(selectedPrice) })
|
|
2617
2622
|
] })
|
|
2618
2623
|
] })
|
|
@@ -2627,9 +2632,9 @@ function WizardStepReview({
|
|
|
2627
2632
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between text-sm", children: [
|
|
2628
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") }),
|
|
2629
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: [
|
|
2630
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "line-through text-muted-foreground me-2", children:
|
|
2631
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success", children:
|
|
2632
|
-
] }) :
|
|
2635
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "line-through text-muted-foreground me-2", children: _chunkMOGEGWXWjs.formatCurrency.call(void 0, prorationAmount(prorationPreview.immediateCharge), prorationPreview.currency, fmt) }),
|
|
2636
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success", children: _chunkMOGEGWXWjs.formatCurrency.call(void 0, prorationAmount(discountedImmediateCharge), prorationPreview.currency, fmt) })
|
|
2637
|
+
] }) : _chunkMOGEGWXWjs.formatCurrency.call(void 0, prorationAmount(prorationPreview.immediateCharge), prorationPreview.currency, fmt) })
|
|
2633
2638
|
] })
|
|
2634
2639
|
]
|
|
2635
2640
|
}
|
|
@@ -2653,15 +2658,15 @@ function WizardStepReview({
|
|
|
2653
2658
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "font-medium", children: t("billing.ui.payment_method.title") }),
|
|
2654
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") })
|
|
2655
2660
|
] }),
|
|
2656
|
-
hasPaymentMethod ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2661
|
+
hasPaymentMethod ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Button, { variant: "outline", onClick: onAddPaymentMethod, disabled: isProcessing, children: t("billing.ui.wizard.review.use_another_card") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Button, { variant: "outline", onClick: onAddPaymentMethod, children: t("billing.ui.payment_methods.add") })
|
|
2657
2662
|
] }) }),
|
|
2658
|
-
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2663
|
+
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.Alert, { variant: "destructive", children: [
|
|
2659
2664
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.AlertCircle, { className: "h-4 w-4" }),
|
|
2660
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2665
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.AlertDescription, { children: error })
|
|
2661
2666
|
] }),
|
|
2662
2667
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between pt-4 border-t", children: [
|
|
2663
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2664
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2668
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Button, { variant: "outline", onClick: onBack, disabled: isProcessing, children: t("billing.ui.wizard.back") }),
|
|
2669
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.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") })
|
|
2665
2670
|
] })
|
|
2666
2671
|
] });
|
|
2667
2672
|
}
|
|
@@ -2674,7 +2679,7 @@ function WizardStepPaymentMethod({ onBack, onSuccess, isProcessing }) {
|
|
|
2674
2679
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2675
2680
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
2676
2681
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
2677
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2682
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.SectionHeader, { children: t("billing.ui.payment_methods.add") }),
|
|
2678
2683
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: t("billing.ui.wizard.payment_description") })
|
|
2679
2684
|
] }),
|
|
2680
2685
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodForm, { onSuccess, onCancel: onBack, isLoading: isProcessing, alwaysSetDefault: true })
|
|
@@ -2717,10 +2722,10 @@ function SubscriptionWizard({
|
|
|
2717
2722
|
const isChangePlanMode = !!subscription;
|
|
2718
2723
|
const dialogTitle = subscription ? t("billing.ui.wizard.change_title") : isPurchasingAddons ? t("billing.ui.subscriptions.purchase_addons") : t("billing.ui.subscriptions.subscribe");
|
|
2719
2724
|
const dialogDescription = subscription ? t("billing.ui.wizard.change_description") : isPurchasingAddons ? t("billing.ui.wizard.addons_description") : t("billing.ui.wizard.subscribe_description");
|
|
2720
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2721
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2722
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2723
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2725
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.DialogContent, { className: "max-w-2xl max-h-[90vh] overflow-y-auto", children: [
|
|
2726
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.DialogHeader, { children: [
|
|
2727
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.DialogTitle, { children: dialogTitle }),
|
|
2728
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.DialogDescription, { children: dialogDescription })
|
|
2724
2729
|
] }),
|
|
2725
2730
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, WizardProgressIndicator, { currentStep: state.step }),
|
|
2726
2731
|
state.step === "plan-selection" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -2788,7 +2793,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, getProgressColor, "getProgressColor");
|
|
|
2788
2793
|
function formatDate2(date, { locale, t }) {
|
|
2789
2794
|
if (!date) return t("billing.ui.not_available");
|
|
2790
2795
|
try {
|
|
2791
|
-
return new Intl.DateTimeFormat(
|
|
2796
|
+
return new Intl.DateTimeFormat(_chunkMOGEGWXWjs.dateFormatLocale.call(void 0, locale), {
|
|
2792
2797
|
month: "short",
|
|
2793
2798
|
day: "numeric"
|
|
2794
2799
|
}).format(new Date(date));
|
|
@@ -2799,7 +2804,7 @@ function formatDate2(date, { locale, t }) {
|
|
|
2799
2804
|
_chunk7QVYU63Ejs.__name.call(void 0, formatDate2, "formatDate");
|
|
2800
2805
|
function UsageSummaryCard({ meter, summary }) {
|
|
2801
2806
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2802
|
-
const fmt =
|
|
2807
|
+
const fmt = _chunk2H342HNNjs.useBillingFormatOptions.call(void 0, );
|
|
2803
2808
|
const currentUsage = _nullishCoalesce(_optionalChain([summary, 'optionalAccess', _101 => _101.aggregatedValue]), () => ( 0));
|
|
2804
2809
|
const limit = meter.limit;
|
|
2805
2810
|
const percentage = limit && limit > 0 ? currentUsage / limit * 100 : null;
|
|
@@ -2807,15 +2812,15 @@ function UsageSummaryCard({ meter, summary }) {
|
|
|
2807
2812
|
const progressWidth = percentage !== null ? Math.min(percentage, 100) : 0;
|
|
2808
2813
|
const displayName = meter.displayName || meter.eventName;
|
|
2809
2814
|
const hasLimit = limit !== null && limit !== void 0;
|
|
2810
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2811
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2815
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.Card, { children: [
|
|
2816
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.CardHeader, { className: "flex flex-row items-center gap-x-3 pb-3", children: [
|
|
2812
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" }) }),
|
|
2813
2818
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col", children: [
|
|
2814
2819
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium", children: displayName }),
|
|
2815
2820
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-xs", children: meter.id })
|
|
2816
2821
|
] })
|
|
2817
2822
|
] }),
|
|
2818
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2823
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.CardContent, { className: "flex flex-col gap-y-4", children: [
|
|
2819
2824
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
2820
2825
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-3xl font-bold", children: currentUsage.toLocaleString(fmt.locale) }),
|
|
2821
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) }) })
|
|
@@ -2823,7 +2828,7 @@ function UsageSummaryCard({ meter, summary }) {
|
|
|
2823
2828
|
hasLimit ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-2", children: [
|
|
2824
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}%` } }) }),
|
|
2825
2830
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-sm", children: t("billing.ui.usage.percent_used", {
|
|
2826
|
-
value: percentage !== null ?
|
|
2831
|
+
value: percentage !== null ? _chunkMOGEGWXWjs.formatFixed.call(void 0, percentage, fmt.locale, 1) : ""
|
|
2827
2832
|
}) })
|
|
2828
2833
|
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-sm", children: t("billing.ui.usage.no_limit") }),
|
|
2829
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", {
|
|
@@ -2856,14 +2861,14 @@ function UsageContainer() {
|
|
|
2856
2861
|
const loadUsageData = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2857
2862
|
setLoading(true);
|
|
2858
2863
|
try {
|
|
2859
|
-
const fetchedSubscriptions = await
|
|
2864
|
+
const fetchedSubscriptions = await _chunkMOGEGWXWjs.StripeSubscriptionService.listSubscriptions();
|
|
2860
2865
|
setSubscriptions(fetchedSubscriptions);
|
|
2861
2866
|
const hasMeteredSubscriptions2 = fetchedSubscriptions.some((sub) => _optionalChain([sub, 'access', _102 => _102.price, 'optionalAccess', _103 => _103.recurring, 'optionalAccess', _104 => _104.usageType]) === "metered");
|
|
2862
2867
|
if (!hasMeteredSubscriptions2) {
|
|
2863
2868
|
setLoading(false);
|
|
2864
2869
|
return;
|
|
2865
2870
|
}
|
|
2866
|
-
const fetchedMeters = await
|
|
2871
|
+
const fetchedMeters = await _chunkMOGEGWXWjs.StripeUsageService.listMeters();
|
|
2867
2872
|
setMeters(fetchedMeters);
|
|
2868
2873
|
const summariesMap = {};
|
|
2869
2874
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -2871,7 +2876,7 @@ function UsageContainer() {
|
|
|
2871
2876
|
const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
|
|
2872
2877
|
for (const meter of fetchedMeters) {
|
|
2873
2878
|
try {
|
|
2874
|
-
const meterSummaries = await
|
|
2879
|
+
const meterSummaries = await _chunkMOGEGWXWjs.StripeUsageService.getMeterSummaries({
|
|
2875
2880
|
meterId: meter.id,
|
|
2876
2881
|
startTime: startOfMonth,
|
|
2877
2882
|
endTime: endOfMonth
|
|
@@ -2920,7 +2925,7 @@ function formatDateTime(date, { locale, t }) {
|
|
|
2920
2925
|
if (!date) return t("billing.ui.not_available");
|
|
2921
2926
|
const dateObj = typeof date === "string" ? new Date(date) : date;
|
|
2922
2927
|
try {
|
|
2923
|
-
return new Intl.DateTimeFormat(
|
|
2928
|
+
return new Intl.DateTimeFormat(_chunkMOGEGWXWjs.dateFormatLocale.call(void 0, locale), {
|
|
2924
2929
|
month: "short",
|
|
2925
2930
|
day: "numeric",
|
|
2926
2931
|
year: "numeric",
|
|
@@ -2934,27 +2939,27 @@ function formatDateTime(date, { locale, t }) {
|
|
|
2934
2939
|
_chunk7QVYU63Ejs.__name.call(void 0, formatDateTime, "formatDateTime");
|
|
2935
2940
|
function UsageHistoryTable({ usageRecords }) {
|
|
2936
2941
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
2937
|
-
const fmt =
|
|
2942
|
+
const fmt = _chunk2H342HNNjs.useBillingFormatOptions.call(void 0, );
|
|
2938
2943
|
if (usageRecords.length === 0) {
|
|
2939
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") }) });
|
|
2940
2945
|
}
|
|
2941
2946
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
2942
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2943
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-clip rounded-lg border", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2944
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2945
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2946
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2947
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2948
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2947
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.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, _chunk2H342HNNjs.Table, { children: [
|
|
2949
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.TableRow, { children: [
|
|
2950
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.TableHead, { children: t("billing.ui.columns.date_time") }),
|
|
2951
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.TableHead, { children: t("billing.ui.columns.meter_event") }),
|
|
2952
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.TableHead, { className: "text-end", children: t("billing.ui.columns.quantity") }),
|
|
2953
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.TableHead, { children: t("billing.ui.columns.event_id") })
|
|
2949
2954
|
] }) }),
|
|
2950
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2955
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.TableBody, { children: usageRecords.map((record) => {
|
|
2951
2956
|
const dateTime = formatDateTime(record.timestamp, fmt);
|
|
2952
2957
|
const quantity = record.quantity.toLocaleString(fmt.locale);
|
|
2953
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2954
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2955
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2956
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2957
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2958
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.TableRow, { children: [
|
|
2959
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.TableCell, { className: "font-medium", children: dateTime }),
|
|
2960
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.TableCell, { className: "text-muted-foreground", children: record.meterEventName }),
|
|
2961
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.TableCell, { className: "text-end font-medium", children: quantity }),
|
|
2962
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.TableCell, { className: "text-muted-foreground text-sm tabular-nums", children: record.stripeEventId })
|
|
2958
2963
|
] }, record.id);
|
|
2959
2964
|
}) })
|
|
2960
2965
|
] }) })
|
|
@@ -2965,8 +2970,8 @@ _chunk7QVYU63Ejs.__name.call(void 0, UsageHistoryTable, "UsageHistoryTable");
|
|
|
2965
2970
|
// src/features/billing/components/modals/BillingDetailModal.tsx
|
|
2966
2971
|
|
|
2967
2972
|
function BillingDetailModal({ open, onOpenChange, title, children, className }) {
|
|
2968
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2969
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2973
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.DialogContent, { className: _nullishCoalesce(className, () => ( "max-w-4xl max-h-[90vh] overflow-y-auto")), children: [
|
|
2974
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.DialogHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.DialogTitle, { children: title }) }),
|
|
2970
2975
|
children
|
|
2971
2976
|
] }) });
|
|
2972
2977
|
}
|
|
@@ -2994,7 +2999,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
|
|
|
2994
2999
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-destructive text-sm font-medium", children: t("billing.ui.alert.payment_failed_title") }),
|
|
2995
3000
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive mt-1 text-sm", children: t("billing.ui.alert.payment_failed_description") })
|
|
2996
3001
|
] }),
|
|
2997
|
-
onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3002
|
+
onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Button, { variant: "outline", size: "sm", onClick: onUpdatePayment, className: "text-destructive border-red-300", children: t("billing.ui.alert.update_payment_method") })
|
|
2998
3003
|
] });
|
|
2999
3004
|
}
|
|
3000
3005
|
if (subscription.status === "trialing" /* TRIALING */ && subscription.trialEnd) {
|
|
@@ -3008,7 +3013,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
|
|
|
3008
3013
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-warning text-sm font-medium", children: t("billing.ui.alert.trial_ending_title") }),
|
|
3009
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 }) })
|
|
3010
3015
|
] }),
|
|
3011
|
-
onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3016
|
+
onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Button, { variant: "outline", size: "sm", onClick: onAddPayment, className: "text-warning border-yellow-300", children: t("billing.ui.payment_methods.add") })
|
|
3012
3017
|
] });
|
|
3013
3018
|
}
|
|
3014
3019
|
}
|
|
@@ -3061,7 +3066,7 @@ function BillingDashboardContainer({ renderCancelDialog } = {}) {
|
|
|
3061
3066
|
setNoCustomerExists(false);
|
|
3062
3067
|
let customer = null;
|
|
3063
3068
|
try {
|
|
3064
|
-
customer = await
|
|
3069
|
+
customer = await _chunkMOGEGWXWjs.StripeCustomerService.getCustomer();
|
|
3065
3070
|
setData((prev) => ({ ...prev, customer }));
|
|
3066
3071
|
setErrors((prev) => ({ ...prev, customer: null }));
|
|
3067
3072
|
setNoCustomerExists(false);
|
|
@@ -3087,7 +3092,7 @@ function BillingDashboardContainer({ renderCancelDialog } = {}) {
|
|
|
3087
3092
|
}
|
|
3088
3093
|
const fetchSubscriptions = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3089
3094
|
try {
|
|
3090
|
-
const subscriptions2 = await
|
|
3095
|
+
const subscriptions2 = await _chunkMOGEGWXWjs.StripeSubscriptionService.listSubscriptions();
|
|
3091
3096
|
setData((prev) => ({ ...prev, subscriptions: subscriptions2 }));
|
|
3092
3097
|
setErrors((prev) => ({ ...prev, subscriptions: null }));
|
|
3093
3098
|
return subscriptions2;
|
|
@@ -3101,7 +3106,7 @@ function BillingDashboardContainer({ renderCancelDialog } = {}) {
|
|
|
3101
3106
|
}, "fetchSubscriptions");
|
|
3102
3107
|
const fetchPaymentMethods = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3103
3108
|
try {
|
|
3104
|
-
const paymentMethods = await
|
|
3109
|
+
const paymentMethods = await _chunkMOGEGWXWjs.StripeCustomerService.listPaymentMethods();
|
|
3105
3110
|
setData((prev) => ({ ...prev, paymentMethods }));
|
|
3106
3111
|
setErrors((prev) => ({ ...prev, paymentMethods: null }));
|
|
3107
3112
|
} catch (error) {
|
|
@@ -3113,7 +3118,7 @@ function BillingDashboardContainer({ renderCancelDialog } = {}) {
|
|
|
3113
3118
|
}, "fetchPaymentMethods");
|
|
3114
3119
|
const fetchInvoices = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3115
3120
|
try {
|
|
3116
|
-
const invoices = await
|
|
3121
|
+
const invoices = await _chunkMOGEGWXWjs.StripeInvoiceService.listInvoices();
|
|
3117
3122
|
setData((prev) => ({ ...prev, invoices }));
|
|
3118
3123
|
setErrors((prev) => ({ ...prev, invoices: null }));
|
|
3119
3124
|
} catch (error) {
|
|
@@ -3136,7 +3141,7 @@ function BillingDashboardContainer({ renderCancelDialog } = {}) {
|
|
|
3136
3141
|
const handleCreateCustomer = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3137
3142
|
setCreatingCustomer(true);
|
|
3138
3143
|
try {
|
|
3139
|
-
await
|
|
3144
|
+
await _chunkMOGEGWXWjs.StripeCustomerService.createCustomer();
|
|
3140
3145
|
setNoCustomerExists(false);
|
|
3141
3146
|
await fetchAllData();
|
|
3142
3147
|
} catch (error) {
|
|
@@ -3148,7 +3153,7 @@ function BillingDashboardContainer({ renderCancelDialog } = {}) {
|
|
|
3148
3153
|
}, "handleCreateCustomer");
|
|
3149
3154
|
const fetchUsageData = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3150
3155
|
try {
|
|
3151
|
-
const meters = await
|
|
3156
|
+
const meters = await _chunkMOGEGWXWjs.StripeUsageService.listMeters();
|
|
3152
3157
|
setData((prev) => ({ ...prev, meters }));
|
|
3153
3158
|
const summariesMap = {};
|
|
3154
3159
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -3156,7 +3161,7 @@ function BillingDashboardContainer({ renderCancelDialog } = {}) {
|
|
|
3156
3161
|
const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
|
|
3157
3162
|
for (const meter of meters) {
|
|
3158
3163
|
try {
|
|
3159
|
-
const meterSummaries = await
|
|
3164
|
+
const meterSummaries = await _chunkMOGEGWXWjs.StripeUsageService.getMeterSummaries({
|
|
3160
3165
|
meterId: meter.id,
|
|
3161
3166
|
startTime: startOfMonth,
|
|
3162
3167
|
endTime: endOfMonth
|
|
@@ -3218,7 +3223,7 @@ function BillingDashboardContainer({ renderCancelDialog } = {}) {
|
|
|
3218
3223
|
_react.useEffect.call(void 0, () => {
|
|
3219
3224
|
if (!pendingChangePlan || loading.subscriptions) return;
|
|
3220
3225
|
setPendingChangePlan(false);
|
|
3221
|
-
handleOpenWizard(
|
|
3226
|
+
handleOpenWizard(_chunkMOGEGWXWjs.resolveChangePlanTarget.call(void 0, data.subscriptions));
|
|
3222
3227
|
}, [pendingChangePlan, loading.subscriptions, data.subscriptions, handleOpenWizard]);
|
|
3223
3228
|
const criticalSubscriptions = data.subscriptions.filter(
|
|
3224
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
|
|
@@ -3249,18 +3254,18 @@ function BillingDashboardContainer({ renderCancelDialog } = {}) {
|
|
|
3249
3254
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-8 w-8" }),
|
|
3250
3255
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: t("billing.title") })
|
|
3251
3256
|
] }),
|
|
3252
|
-
isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3253
|
-
noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3254
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3257
|
+
isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.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, _chunk2H342HNNjs.Card, { children: [
|
|
3259
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.CardHeader, { className: "text-center", children: [
|
|
3255
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" }) }),
|
|
3256
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3257
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3261
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.CardTitle, { children: t("billing.ui.dashboard.setup_title") }),
|
|
3262
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.CardDescription, { children: t("billing.ui.dashboard.setup_description") })
|
|
3258
3263
|
] }),
|
|
3259
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3264
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.CardContent, { className: "flex justify-center pb-8", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Button, { onClick: handleCreateCustomer, disabled: creatingCustomer, size: "lg", children: creatingCustomer ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
3260
3265
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "me-2 h-4 w-4 animate-spin" }),
|
|
3261
3266
|
t("billing.ui.dashboard.setting_up")
|
|
3262
3267
|
] }) : t("billing.ui.dashboard.setup_button") }) }),
|
|
3263
|
-
errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3268
|
+
errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.CardContent, { className: "pt-0", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-center text-destructive text-xs/relaxed", children: t(errors.customer) }) })
|
|
3264
3269
|
] }),
|
|
3265
3270
|
!noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
3266
3271
|
criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -3405,7 +3410,7 @@ function getStripePromise(publishableKey) {
|
|
|
3405
3410
|
}
|
|
3406
3411
|
_chunk7QVYU63Ejs.__name.call(void 0, getStripePromise, "getStripePromise");
|
|
3407
3412
|
function StripeProvider({ children }) {
|
|
3408
|
-
const publishableKey =
|
|
3413
|
+
const publishableKey = _chunk7ZHTPFFTjs.getStripePublishableKey.call(void 0, );
|
|
3409
3414
|
const stripePromise = _react.useMemo.call(void 0, () => getStripePromise(publishableKey), [publishableKey]);
|
|
3410
3415
|
const options = _react.useMemo.call(void 0, () => ({}), []);
|
|
3411
3416
|
if (!publishableKey) {
|
|
@@ -3415,7 +3420,7 @@ function StripeProvider({ children }) {
|
|
|
3415
3420
|
}
|
|
3416
3421
|
_chunk7QVYU63Ejs.__name.call(void 0, StripeProvider, "StripeProvider");
|
|
3417
3422
|
function isStripeConfigured() {
|
|
3418
|
-
return !!
|
|
3423
|
+
return !!_chunk7ZHTPFFTjs.getStripePublishableKey.call(void 0, );
|
|
3419
3424
|
}
|
|
3420
3425
|
_chunk7QVYU63Ejs.__name.call(void 0, isStripeConfigured, "isStripeConfigured");
|
|
3421
3426
|
|
|
@@ -3430,18 +3435,18 @@ _chunk7QVYU63Ejs.__name.call(void 0, isStripeConfigured, "isStripeConfigured");
|
|
|
3430
3435
|
|
|
3431
3436
|
function PriceArchiver({ price }) {
|
|
3432
3437
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
3433
|
-
const fmt =
|
|
3438
|
+
const fmt = _chunk2H342HNNjs.useBillingFormatOptions.call(void 0, );
|
|
3434
3439
|
const { archivePrice, restorePrice } = usePriceContext();
|
|
3435
3440
|
const [open, setOpen] = _react.useState.call(void 0, false);
|
|
3436
3441
|
const isArchived = !price.active;
|
|
3437
3442
|
const scope = isArchived ? "restore" : "archive";
|
|
3438
3443
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
3439
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3444
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.Button, { variant: "outline", size: "sm", onClick: () => setOpen(true), children: [
|
|
3440
3445
|
isArchived ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RotateCcwIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ArchiveIcon, {}),
|
|
3441
3446
|
t(`billing.admin.prices.${scope}.confirm`)
|
|
3442
3447
|
] }),
|
|
3443
3448
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3444
|
-
|
|
3449
|
+
_chunk2H342HNNjs.ConfirmDialog,
|
|
3445
3450
|
{
|
|
3446
3451
|
open,
|
|
3447
3452
|
onOpenChange: setOpen,
|
|
@@ -3455,7 +3460,7 @@ function PriceArchiver({ price }) {
|
|
|
3455
3460
|
if (isArchived) await restorePrice(price.id);
|
|
3456
3461
|
else await archivePrice(price.id);
|
|
3457
3462
|
} catch (error) {
|
|
3458
|
-
|
|
3463
|
+
_chunk2H342HNNjs.errorToast.call(void 0, { title: t(`billing.admin.prices.${scope}.title`), error });
|
|
3459
3464
|
throw error;
|
|
3460
3465
|
}
|
|
3461
3466
|
}
|
|
@@ -3487,15 +3492,15 @@ function PriceEditorInternal({
|
|
|
3487
3492
|
onDialogOpenChange
|
|
3488
3493
|
}) {
|
|
3489
3494
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
3490
|
-
const fmt =
|
|
3491
|
-
const router =
|
|
3495
|
+
const fmt = _chunk2H342HNNjs.useBillingFormatOptions.call(void 0, );
|
|
3496
|
+
const router = _chunkBZ5J2FIVjs.useI18nRouter.call(void 0, );
|
|
3492
3497
|
const { createPrice, updatePrice, productId: contextProductId } = usePriceContext();
|
|
3493
3498
|
const [allFeatures, setAllFeatures] = _react.useState.call(void 0, []);
|
|
3494
3499
|
const isEdit = !!price;
|
|
3495
3500
|
const targetProductId = _nullishCoalesce(_nullishCoalesce(productId, () => ( _optionalChain([price, 'optionalAccess', _120 => _120.product, 'optionalAccess', _121 => _121.id]))), () => ( contextProductId));
|
|
3496
3501
|
_react.useEffect.call(void 0, () => {
|
|
3497
3502
|
const fetchFeatures = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3498
|
-
setAllFeatures(await
|
|
3503
|
+
setAllFeatures(await _chunkMOGEGWXWjs.FeatureService.findMany({}));
|
|
3499
3504
|
}, "fetchFeatures");
|
|
3500
3505
|
void fetchFeatures();
|
|
3501
3506
|
}, []);
|
|
@@ -3608,7 +3613,7 @@ function PriceEditorInternal({
|
|
|
3608
3613
|
warnedUnknownFor.current = fingerprint;
|
|
3609
3614
|
const { unknown } = resolvePlatformFeatures(seed.platformFeatures);
|
|
3610
3615
|
if (unknown.length > 0)
|
|
3611
|
-
|
|
3616
|
+
_chunkMOGEGWXWjs.showToast.call(void 0, t("billing.admin.prices.import.warnings.unknownFeatures", { features: unknown.join(", ") }));
|
|
3612
3617
|
}, [seed, isEdit, allFeatures, resolvePlatformFeatures, t]);
|
|
3613
3618
|
const watchInterval = form.watch("interval");
|
|
3614
3619
|
const isRecurring = watchInterval !== "one_time";
|
|
@@ -3629,13 +3634,13 @@ function PriceEditorInternal({
|
|
|
3629
3634
|
{ id: "metered", text: t("billing.admin.prices.usage.metered") }
|
|
3630
3635
|
];
|
|
3631
3636
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3632
|
-
|
|
3637
|
+
_chunk2H342HNNjs.EditorSheet,
|
|
3633
3638
|
{
|
|
3634
3639
|
form,
|
|
3635
3640
|
entityType: t("billing.admin.prices.entity"),
|
|
3636
3641
|
entityName: price ? priceLabel(price, fmt) : void 0,
|
|
3637
3642
|
isEdit,
|
|
3638
|
-
module:
|
|
3643
|
+
module: _chunkBZ5J2FIVjs.Modules.StripePrice,
|
|
3639
3644
|
size: "lg",
|
|
3640
3645
|
propagateChanges,
|
|
3641
3646
|
onSuccess,
|
|
@@ -3684,13 +3689,13 @@ function PriceEditorInternal({
|
|
|
3684
3689
|
dialogOpen,
|
|
3685
3690
|
onDialogOpenChange,
|
|
3686
3691
|
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
3687
|
-
isEdit && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3688
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3689
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3692
|
+
isEdit && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.Alert, { children: [
|
|
3693
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.AlertTitle, { children: t("billing.admin.prices.immutability.title") }),
|
|
3694
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.AlertDescription, { children: t("billing.admin.prices.immutability.description") })
|
|
3690
3695
|
] }),
|
|
3691
3696
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
|
|
3692
3697
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3693
|
-
|
|
3698
|
+
_chunk2H342HNNjs.FormInput,
|
|
3694
3699
|
{
|
|
3695
3700
|
form,
|
|
3696
3701
|
id: "unitAmount",
|
|
@@ -3702,7 +3707,7 @@ function PriceEditorInternal({
|
|
|
3702
3707
|
}
|
|
3703
3708
|
),
|
|
3704
3709
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3705
|
-
|
|
3710
|
+
_chunk2H342HNNjs.FormSelect,
|
|
3706
3711
|
{
|
|
3707
3712
|
form,
|
|
3708
3713
|
id: "currency",
|
|
@@ -3713,7 +3718,7 @@ function PriceEditorInternal({
|
|
|
3713
3718
|
)
|
|
3714
3719
|
] }),
|
|
3715
3720
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3716
|
-
|
|
3721
|
+
_chunk2H342HNNjs.FormSelect,
|
|
3717
3722
|
{
|
|
3718
3723
|
form,
|
|
3719
3724
|
id: "interval",
|
|
@@ -3724,7 +3729,7 @@ function PriceEditorInternal({
|
|
|
3724
3729
|
),
|
|
3725
3730
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
|
|
3726
3731
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3727
|
-
|
|
3732
|
+
_chunk2H342HNNjs.FormInput,
|
|
3728
3733
|
{
|
|
3729
3734
|
form,
|
|
3730
3735
|
id: "intervalCount",
|
|
@@ -3735,7 +3740,7 @@ function PriceEditorInternal({
|
|
|
3735
3740
|
}
|
|
3736
3741
|
),
|
|
3737
3742
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3738
|
-
|
|
3743
|
+
_chunk2H342HNNjs.FormSelect,
|
|
3739
3744
|
{
|
|
3740
3745
|
form,
|
|
3741
3746
|
id: "usageType",
|
|
@@ -3746,7 +3751,7 @@ function PriceEditorInternal({
|
|
|
3746
3751
|
)
|
|
3747
3752
|
] }),
|
|
3748
3753
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3749
|
-
|
|
3754
|
+
_chunk2H342HNNjs.FormInput,
|
|
3750
3755
|
{
|
|
3751
3756
|
form,
|
|
3752
3757
|
id: "nickname",
|
|
@@ -3755,7 +3760,7 @@ function PriceEditorInternal({
|
|
|
3755
3760
|
}
|
|
3756
3761
|
),
|
|
3757
3762
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3758
|
-
|
|
3763
|
+
_chunk2H342HNNjs.FormTextarea,
|
|
3759
3764
|
{
|
|
3760
3765
|
form,
|
|
3761
3766
|
id: "description",
|
|
@@ -3765,7 +3770,7 @@ function PriceEditorInternal({
|
|
|
3765
3770
|
}
|
|
3766
3771
|
),
|
|
3767
3772
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3768
|
-
|
|
3773
|
+
_chunk2H342HNNjs.FormInput,
|
|
3769
3774
|
{
|
|
3770
3775
|
form,
|
|
3771
3776
|
id: "token",
|
|
@@ -3775,10 +3780,10 @@ function PriceEditorInternal({
|
|
|
3775
3780
|
}
|
|
3776
3781
|
),
|
|
3777
3782
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-2", children: [
|
|
3778
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3783
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.FieldLabel, { children: t("billing.admin.prices.fields.features") }),
|
|
3779
3784
|
form.watch("features").map((_, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
|
|
3780
3785
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3781
|
-
|
|
3786
|
+
_chunk2H342HNNjs.Input,
|
|
3782
3787
|
{
|
|
3783
3788
|
...form.register(`features.${index}`),
|
|
3784
3789
|
placeholder: t("billing.admin.prices.placeholders.feature", { index: index + 1 }),
|
|
@@ -3786,7 +3791,7 @@ function PriceEditorInternal({
|
|
|
3786
3791
|
}
|
|
3787
3792
|
),
|
|
3788
3793
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3789
|
-
|
|
3794
|
+
_chunk2H342HNNjs.Button,
|
|
3790
3795
|
{
|
|
3791
3796
|
type: "button",
|
|
3792
3797
|
variant: "outline",
|
|
@@ -3801,7 +3806,7 @@ function PriceEditorInternal({
|
|
|
3801
3806
|
)
|
|
3802
3807
|
] }, index)),
|
|
3803
3808
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3804
|
-
|
|
3809
|
+
_chunk2H342HNNjs.Button,
|
|
3805
3810
|
{
|
|
3806
3811
|
type: "button",
|
|
3807
3812
|
variant: "outline",
|
|
@@ -3816,12 +3821,12 @@ function PriceEditorInternal({
|
|
|
3816
3821
|
)
|
|
3817
3822
|
] }),
|
|
3818
3823
|
isRecurring && allFeatures.length > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-2", children: [
|
|
3819
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3824
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.FieldLabel, { children: t("billing.admin.prices.fields.platformFeatures") }),
|
|
3820
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) => {
|
|
3821
3826
|
const isChecked = form.watch("featureIds").includes(feature.id);
|
|
3822
3827
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
3823
3828
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3824
|
-
|
|
3829
|
+
_chunk2H342HNNjs.Checkbox,
|
|
3825
3830
|
{
|
|
3826
3831
|
id: `feature-${feature.id}`,
|
|
3827
3832
|
checked: isChecked,
|
|
@@ -3837,13 +3842,13 @@ function PriceEditorInternal({
|
|
|
3837
3842
|
}
|
|
3838
3843
|
}
|
|
3839
3844
|
),
|
|
3840
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3845
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.FieldLabel, { htmlFor: `feature-${feature.id}`, children: feature.name }),
|
|
3841
3846
|
feature.isCore && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.admin.prices.help.core") })
|
|
3842
3847
|
] }, feature.id);
|
|
3843
3848
|
}) })
|
|
3844
3849
|
] }),
|
|
3845
3850
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3846
|
-
|
|
3851
|
+
_chunk2H342HNNjs.FormCheckbox,
|
|
3847
3852
|
{
|
|
3848
3853
|
form,
|
|
3849
3854
|
id: "isTrial",
|
|
@@ -3886,7 +3891,7 @@ var defaultContextValue = {
|
|
|
3886
3891
|
productId: void 0
|
|
3887
3892
|
};
|
|
3888
3893
|
function priceLabel(price, fmt = {}) {
|
|
3889
|
-
return _nullishCoalesce(price.nickname, () => ( `${
|
|
3894
|
+
return _nullishCoalesce(price.nickname, () => ( `${_chunkMOGEGWXWjs.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt)} ${_chunkMOGEGWXWjs.formatInterval.call(void 0, price, fmt)}`.trim()));
|
|
3890
3895
|
}
|
|
3891
3896
|
_chunk7QVYU63Ejs.__name.call(void 0, priceLabel, "priceLabel");
|
|
3892
3897
|
var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
@@ -3896,22 +3901,22 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3896
3901
|
productId: productIdProp
|
|
3897
3902
|
}) => {
|
|
3898
3903
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
3899
|
-
const fmt =
|
|
3900
|
-
const generateUrl =
|
|
3901
|
-
const { hasRole } =
|
|
3904
|
+
const fmt = _chunk2H342HNNjs.useBillingFormatOptions.call(void 0, );
|
|
3905
|
+
const generateUrl = _chunk2H342HNNjs.usePageUrlGenerator.call(void 0, );
|
|
3906
|
+
const { hasRole } = _chunk2H342HNNjs.useCurrentUserContext.call(void 0, );
|
|
3902
3907
|
const [price, setPrice] = _react.useState.call(void 0,
|
|
3903
|
-
dehydratedPrice ?
|
|
3908
|
+
dehydratedPrice ? _chunkMOGEGWXWjs.rehydrate.call(void 0, _chunkBZ5J2FIVjs.Modules.StripePrice, dehydratedPrice) : void 0
|
|
3904
3909
|
);
|
|
3905
3910
|
const [priceVersion, setPriceVersion] = _react.useState.call(void 0, 0);
|
|
3906
3911
|
const refreshPrices = _react.useCallback.call(void 0, () => setPriceVersion((value2) => value2 + 1), []);
|
|
3907
3912
|
const productId = _nullishCoalesce(productIdProp, () => ( _optionalChain([price, 'optionalAccess', _144 => _144.product, 'optionalAccess', _145 => _145.id])));
|
|
3908
3913
|
const reloadPrice = _react.useCallback.call(void 0, async () => {
|
|
3909
3914
|
if (!_optionalChain([price, 'optionalAccess', _146 => _146.id])) return;
|
|
3910
|
-
setPrice(await
|
|
3915
|
+
setPrice(await _chunkMOGEGWXWjs.StripePriceService.getPrice({ id: price.id }));
|
|
3911
3916
|
}, [_optionalChain([price, 'optionalAccess', _147 => _147.id])]);
|
|
3912
3917
|
const createPrice = _react.useCallback.call(void 0,
|
|
3913
3918
|
async (input) => {
|
|
3914
|
-
const saved = await
|
|
3919
|
+
const saved = await _chunkMOGEGWXWjs.StripePriceService.createPrice(input);
|
|
3915
3920
|
refreshPrices();
|
|
3916
3921
|
return saved;
|
|
3917
3922
|
},
|
|
@@ -3919,7 +3924,7 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3919
3924
|
);
|
|
3920
3925
|
const updatePrice = _react.useCallback.call(void 0,
|
|
3921
3926
|
async (input) => {
|
|
3922
|
-
const saved = await
|
|
3927
|
+
const saved = await _chunkMOGEGWXWjs.StripePriceService.updatePrice(input);
|
|
3923
3928
|
setPrice(saved);
|
|
3924
3929
|
refreshPrices();
|
|
3925
3930
|
return saved;
|
|
@@ -3930,7 +3935,7 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3930
3935
|
async (id) => {
|
|
3931
3936
|
const target = _nullishCoalesce(id, () => ( _optionalChain([price, 'optionalAccess', _148 => _148.id])));
|
|
3932
3937
|
if (!target) return;
|
|
3933
|
-
await
|
|
3938
|
+
await _chunkMOGEGWXWjs.StripePriceService.archivePrice({ id: target });
|
|
3934
3939
|
await reloadPrice();
|
|
3935
3940
|
refreshPrices();
|
|
3936
3941
|
},
|
|
@@ -3940,7 +3945,7 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3940
3945
|
async (id) => {
|
|
3941
3946
|
const target = _nullishCoalesce(id, () => ( _optionalChain([price, 'optionalAccess', _150 => _150.id])));
|
|
3942
3947
|
if (!target) return;
|
|
3943
|
-
await
|
|
3948
|
+
await _chunkMOGEGWXWjs.StripePriceService.reactivatePrice({ id: target });
|
|
3944
3949
|
await reloadPrice();
|
|
3945
3950
|
refreshPrices();
|
|
3946
3951
|
},
|
|
@@ -3964,12 +3969,12 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3964
3969
|
if (!publishChrome) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceContext.Provider, { value, children });
|
|
3965
3970
|
const breadcrumb = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
3966
3971
|
const items = [
|
|
3967
|
-
{ name: t("billing.admin.products.title"), href: generateUrl({ page:
|
|
3972
|
+
{ name: t("billing.admin.products.title"), href: generateUrl({ page: _chunkBZ5J2FIVjs.Modules.StripeProduct }) }
|
|
3968
3973
|
];
|
|
3969
3974
|
if (_optionalChain([price, 'optionalAccess', _152 => _152.product]))
|
|
3970
3975
|
items.push({
|
|
3971
3976
|
name: price.product.name,
|
|
3972
|
-
href: generateUrl({ page:
|
|
3977
|
+
href: generateUrl({ page: _chunkBZ5J2FIVjs.Modules.StripeProduct, id: price.product.id })
|
|
3973
3978
|
});
|
|
3974
3979
|
if (price) items.push({ name: priceLabel(price, fmt) });
|
|
3975
3980
|
return items;
|
|
@@ -3986,7 +3991,7 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3986
3991
|
}
|
|
3987
3992
|
return response;
|
|
3988
3993
|
}, "title");
|
|
3989
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3994
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceContext.Provider, { value, children }) });
|
|
3990
3995
|
}, "PriceProvider");
|
|
3991
3996
|
var usePriceContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => _nullishCoalesce(_react.useContext.call(void 0, PriceContext), () => ( defaultContextValue)), "usePriceContext");
|
|
3992
3997
|
|
|
@@ -4006,12 +4011,12 @@ function ProductArchiver({ product }) {
|
|
|
4006
4011
|
const isArchived = !product.active;
|
|
4007
4012
|
const scope = isArchived ? "restore" : "archive";
|
|
4008
4013
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
4009
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
4014
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.Button, { variant: "outline", size: "sm", onClick: () => setOpen(true), children: [
|
|
4010
4015
|
isArchived ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RotateCcwIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ArchiveIcon, {}),
|
|
4011
4016
|
t(`billing.admin.products.${scope}.confirm`)
|
|
4012
4017
|
] }),
|
|
4013
4018
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4014
|
-
|
|
4019
|
+
_chunk2H342HNNjs.ConfirmDialog,
|
|
4015
4020
|
{
|
|
4016
4021
|
open,
|
|
4017
4022
|
onOpenChange: setOpen,
|
|
@@ -4025,7 +4030,7 @@ function ProductArchiver({ product }) {
|
|
|
4025
4030
|
if (isArchived) await restoreProduct(product.id);
|
|
4026
4031
|
else await archiveProduct(product.id);
|
|
4027
4032
|
} catch (error) {
|
|
4028
|
-
|
|
4033
|
+
_chunk2H342HNNjs.errorToast.call(void 0, { title: t(`billing.admin.products.${scope}.title`), error });
|
|
4029
4034
|
throw error;
|
|
4030
4035
|
}
|
|
4031
4036
|
}
|
|
@@ -4054,7 +4059,7 @@ function ProductEditorInternal({
|
|
|
4054
4059
|
onDialogOpenChange
|
|
4055
4060
|
}) {
|
|
4056
4061
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4057
|
-
const router =
|
|
4062
|
+
const router = _chunkBZ5J2FIVjs.useI18nRouter.call(void 0, );
|
|
4058
4063
|
const { createProduct, updateProduct } = useProductContext();
|
|
4059
4064
|
const isEdit = !!product;
|
|
4060
4065
|
const formSchema2 = _react.useMemo.call(void 0,
|
|
@@ -4078,13 +4083,13 @@ function ProductEditorInternal({
|
|
|
4078
4083
|
defaultValues: getDefaultValues()
|
|
4079
4084
|
});
|
|
4080
4085
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4081
|
-
|
|
4086
|
+
_chunk2H342HNNjs.EditorSheet,
|
|
4082
4087
|
{
|
|
4083
4088
|
form,
|
|
4084
4089
|
entityType: t("billing.admin.products.entity"),
|
|
4085
4090
|
entityName: _optionalChain([product, 'optionalAccess', _156 => _156.name]),
|
|
4086
4091
|
isEdit,
|
|
4087
|
-
module:
|
|
4092
|
+
module: _chunkBZ5J2FIVjs.Modules.StripeProduct,
|
|
4088
4093
|
size: "md",
|
|
4089
4094
|
propagateChanges,
|
|
4090
4095
|
onSuccess,
|
|
@@ -4101,7 +4106,7 @@ function ProductEditorInternal({
|
|
|
4101
4106
|
onDialogOpenChange,
|
|
4102
4107
|
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4103
4108
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4104
|
-
|
|
4109
|
+
_chunk2H342HNNjs.FormInput,
|
|
4105
4110
|
{
|
|
4106
4111
|
form,
|
|
4107
4112
|
id: "name",
|
|
@@ -4111,7 +4116,7 @@ function ProductEditorInternal({
|
|
|
4111
4116
|
}
|
|
4112
4117
|
),
|
|
4113
4118
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4114
|
-
|
|
4119
|
+
_chunk2H342HNNjs.FormTextarea,
|
|
4115
4120
|
{
|
|
4116
4121
|
form,
|
|
4117
4122
|
id: "description",
|
|
@@ -4155,20 +4160,20 @@ var defaultContextValue2 = {
|
|
|
4155
4160
|
};
|
|
4156
4161
|
var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ children, dehydratedProduct, publishChrome = true }) => {
|
|
4157
4162
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4158
|
-
const generateUrl =
|
|
4159
|
-
const { hasRole } =
|
|
4163
|
+
const generateUrl = _chunk2H342HNNjs.usePageUrlGenerator.call(void 0, );
|
|
4164
|
+
const { hasRole } = _chunk2H342HNNjs.useCurrentUserContext.call(void 0, );
|
|
4160
4165
|
const [product, setProduct] = _react.useState.call(void 0,
|
|
4161
|
-
dehydratedProduct ?
|
|
4166
|
+
dehydratedProduct ? _chunkMOGEGWXWjs.rehydrate.call(void 0, _chunkBZ5J2FIVjs.Modules.StripeProduct, dehydratedProduct) : void 0
|
|
4162
4167
|
);
|
|
4163
4168
|
const [catalogueVersion, setCatalogueVersion] = _react.useState.call(void 0, 0);
|
|
4164
4169
|
const refreshCatalogue = _react.useCallback.call(void 0, () => setCatalogueVersion((value2) => value2 + 1), []);
|
|
4165
4170
|
const reloadProduct = _react.useCallback.call(void 0, async () => {
|
|
4166
4171
|
if (!_optionalChain([product, 'optionalAccess', _157 => _157.id])) return;
|
|
4167
|
-
setProduct(await
|
|
4172
|
+
setProduct(await _chunkMOGEGWXWjs.StripeProductService.getProduct({ id: product.id }));
|
|
4168
4173
|
}, [_optionalChain([product, 'optionalAccess', _158 => _158.id])]);
|
|
4169
4174
|
const createProduct = _react.useCallback.call(void 0,
|
|
4170
4175
|
async (input) => {
|
|
4171
|
-
const saved = await
|
|
4176
|
+
const saved = await _chunkMOGEGWXWjs.StripeProductService.createProduct(input);
|
|
4172
4177
|
refreshCatalogue();
|
|
4173
4178
|
return saved;
|
|
4174
4179
|
},
|
|
@@ -4176,7 +4181,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
4176
4181
|
);
|
|
4177
4182
|
const updateProduct = _react.useCallback.call(void 0,
|
|
4178
4183
|
async (input) => {
|
|
4179
|
-
const saved = await
|
|
4184
|
+
const saved = await _chunkMOGEGWXWjs.StripeProductService.updateProduct(input);
|
|
4180
4185
|
setProduct(saved);
|
|
4181
4186
|
refreshCatalogue();
|
|
4182
4187
|
return saved;
|
|
@@ -4187,7 +4192,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
4187
4192
|
async (id) => {
|
|
4188
4193
|
const target = _nullishCoalesce(id, () => ( _optionalChain([product, 'optionalAccess', _159 => _159.id])));
|
|
4189
4194
|
if (!target) return;
|
|
4190
|
-
await
|
|
4195
|
+
await _chunkMOGEGWXWjs.StripeProductService.archiveProduct({ id: target });
|
|
4191
4196
|
await reloadProduct();
|
|
4192
4197
|
refreshCatalogue();
|
|
4193
4198
|
},
|
|
@@ -4197,7 +4202,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
4197
4202
|
async (id) => {
|
|
4198
4203
|
const target = _nullishCoalesce(id, () => ( _optionalChain([product, 'optionalAccess', _161 => _161.id])));
|
|
4199
4204
|
if (!target) return;
|
|
4200
|
-
await
|
|
4205
|
+
await _chunkMOGEGWXWjs.StripeProductService.reactivateProduct({ id: target });
|
|
4201
4206
|
await reloadProduct();
|
|
4202
4207
|
refreshCatalogue();
|
|
4203
4208
|
},
|
|
@@ -4232,7 +4237,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
4232
4237
|
{
|
|
4233
4238
|
name: t("billing.admin.products.title"),
|
|
4234
4239
|
// Linked only when it is NOT the current page.
|
|
4235
|
-
...product ? { href: generateUrl({ page:
|
|
4240
|
+
...product ? { href: generateUrl({ page: _chunkBZ5J2FIVjs.Modules.StripeProduct }) } : {}
|
|
4236
4241
|
}
|
|
4237
4242
|
];
|
|
4238
4243
|
if (product) items.push({ name: product.name });
|
|
@@ -4250,7 +4255,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
4250
4255
|
}
|
|
4251
4256
|
return response;
|
|
4252
4257
|
}, "title");
|
|
4253
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4258
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductContext.Provider, { value, children }) });
|
|
4254
4259
|
}, "ProductProvider");
|
|
4255
4260
|
var useProductContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => _nullishCoalesce(_react.useContext.call(void 0, ProductContext), () => ( defaultContextValue2)), "useProductContext");
|
|
4256
4261
|
|
|
@@ -4259,57 +4264,57 @@ var useProductContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ()
|
|
|
4259
4264
|
|
|
4260
4265
|
function PriceDetails() {
|
|
4261
4266
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4262
|
-
const fmt =
|
|
4263
|
-
const generateUrl =
|
|
4267
|
+
const fmt = _chunk2H342HNNjs.useBillingFormatOptions.call(void 0, );
|
|
4268
|
+
const generateUrl = _chunk2H342HNNjs.usePageUrlGenerator.call(void 0, );
|
|
4264
4269
|
const { price } = usePriceContext();
|
|
4265
4270
|
if (!price) return null;
|
|
4266
4271
|
const isRecurring = price.priceType === "recurring";
|
|
4267
4272
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-8", children: [
|
|
4268
4273
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4269
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4274
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.SectionHeader, { children: t("billing.admin.prices.title") }),
|
|
4270
4275
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
4271
4276
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4272
|
-
|
|
4277
|
+
_chunk2H342HNNjs.DetailField,
|
|
4273
4278
|
{
|
|
4274
4279
|
label: t("billing.admin.prices.fields.product"),
|
|
4275
|
-
value: price.product ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4280
|
+
value: price.product ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Link, { href: generateUrl({ page: _chunkBZ5J2FIVjs.Modules.StripeProduct, id: price.product.id }), children: price.product.name }) : "\u2014"
|
|
4276
4281
|
}
|
|
4277
4282
|
),
|
|
4278
4283
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4279
|
-
|
|
4284
|
+
_chunk2H342HNNjs.DetailField,
|
|
4280
4285
|
{
|
|
4281
4286
|
label: t("billing.admin.prices.fields.status"),
|
|
4282
4287
|
value: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex flex-wrap items-center gap-1", children: [
|
|
4283
|
-
price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4284
|
-
price.isTrial && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4288
|
+
price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Badge, { variant: "softGreen", children: t("billing.admin.prices.status.active") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Badge, { variant: "softGray", children: t("billing.admin.prices.status.archived") }),
|
|
4289
|
+
price.isTrial && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Badge, { variant: "softBlue", children: t("billing.admin.prices.badge.trial") })
|
|
4285
4290
|
] })
|
|
4286
4291
|
}
|
|
4287
4292
|
),
|
|
4288
4293
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4289
|
-
|
|
4294
|
+
_chunk2H342HNNjs.DetailField,
|
|
4290
4295
|
{
|
|
4291
4296
|
label: t("billing.admin.prices.fields.amount"),
|
|
4292
|
-
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: _chunkMOGEGWXWjs.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt) })
|
|
4293
4298
|
}
|
|
4294
4299
|
),
|
|
4295
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4300
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.DetailField, { label: t("billing.admin.prices.fields.currency"), value: price.currency.toUpperCase() }),
|
|
4296
4301
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4297
|
-
|
|
4302
|
+
_chunk2H342HNNjs.DetailField,
|
|
4298
4303
|
{
|
|
4299
4304
|
label: t("billing.admin.prices.fields.type"),
|
|
4300
4305
|
value: isRecurring ? t("billing.admin.prices.type.recurring") : t("billing.admin.prices.type.oneTime")
|
|
4301
4306
|
}
|
|
4302
4307
|
),
|
|
4303
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4308
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.DetailField, { label: t("billing.admin.prices.fields.billing"), value: _chunkMOGEGWXWjs.formatInterval.call(void 0, price, fmt) }),
|
|
4304
4309
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4305
|
-
|
|
4310
|
+
_chunk2H342HNNjs.DetailField,
|
|
4306
4311
|
{
|
|
4307
4312
|
label: t("billing.admin.prices.fields.intervalCount"),
|
|
4308
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)) })
|
|
4309
4314
|
}
|
|
4310
4315
|
),
|
|
4311
4316
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4312
|
-
|
|
4317
|
+
_chunk2H342HNNjs.DetailField,
|
|
4313
4318
|
{
|
|
4314
4319
|
label: t("billing.admin.prices.fields.usageType"),
|
|
4315
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")
|
|
@@ -4318,24 +4323,24 @@ function PriceDetails() {
|
|
|
4318
4323
|
] })
|
|
4319
4324
|
] }),
|
|
4320
4325
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4321
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4326
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.SectionHeader, { children: t("billing.admin.prices.fields.platformFeatures") }),
|
|
4322
4327
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
4323
4328
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4324
|
-
|
|
4329
|
+
_chunk2H342HNNjs.DetailField,
|
|
4325
4330
|
{
|
|
4326
4331
|
label: t("billing.admin.prices.fields.token"),
|
|
4327
4332
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _nullishCoalesce(price.token, () => ( "\u2014")) })
|
|
4328
4333
|
}
|
|
4329
4334
|
),
|
|
4330
4335
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4331
|
-
|
|
4336
|
+
_chunk2H342HNNjs.DetailField,
|
|
4332
4337
|
{
|
|
4333
4338
|
label: t("billing.admin.prices.fields.stripeId"),
|
|
4334
4339
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: price.stripePriceId })
|
|
4335
4340
|
}
|
|
4336
4341
|
),
|
|
4337
4342
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4338
|
-
|
|
4343
|
+
_chunk2H342HNNjs.DetailField,
|
|
4339
4344
|
{
|
|
4340
4345
|
label: t("billing.admin.prices.fields.description"),
|
|
4341
4346
|
value: _nullishCoalesce(price.description, () => ( "\u2014")),
|
|
@@ -4343,7 +4348,7 @@ function PriceDetails() {
|
|
|
4343
4348
|
}
|
|
4344
4349
|
),
|
|
4345
4350
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4346
|
-
|
|
4351
|
+
_chunk2H342HNNjs.DetailField,
|
|
4347
4352
|
{
|
|
4348
4353
|
label: t("billing.admin.prices.fields.features"),
|
|
4349
4354
|
className: "md:col-span-2",
|
|
@@ -4351,11 +4356,11 @@ function PriceDetails() {
|
|
|
4351
4356
|
}
|
|
4352
4357
|
),
|
|
4353
4358
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4354
|
-
|
|
4359
|
+
_chunk2H342HNNjs.DetailField,
|
|
4355
4360
|
{
|
|
4356
4361
|
label: t("billing.admin.prices.fields.platformFeatures"),
|
|
4357
4362
|
className: "md:col-span-2",
|
|
4358
|
-
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, _chunk2H342HNNjs.Badge, { variant: "softGray", children: feature.name }, feature.id)) }) : "\u2014"
|
|
4359
4364
|
}
|
|
4360
4365
|
)
|
|
4361
4366
|
] })
|
|
@@ -4369,7 +4374,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, PriceDetails, "PriceDetails");
|
|
|
4369
4374
|
function PriceContainer() {
|
|
4370
4375
|
const { price } = usePriceContext();
|
|
4371
4376
|
if (!price) return null;
|
|
4372
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4377
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.RoundPageContainer, { module: _chunkBZ5J2FIVjs.Modules.StripePrice, id: price.id, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceDetails, {}) });
|
|
4373
4378
|
}
|
|
4374
4379
|
_chunk7QVYU63Ejs.__name.call(void 0, PriceContainer, "PriceContainer");
|
|
4375
4380
|
|
|
@@ -4494,10 +4499,10 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4494
4499
|
const importInputRef = _react.useRef.call(void 0, null);
|
|
4495
4500
|
const [seed, setSeed] = _react.useState.call(void 0, void 0);
|
|
4496
4501
|
const [seedNonce, setSeedNonce] = _react.useState.call(void 0, 0);
|
|
4497
|
-
const data =
|
|
4498
|
-
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) =>
|
|
4502
|
+
const data = _chunk2H342HNNjs.useDataListRetriever.call(void 0, {
|
|
4503
|
+
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunkMOGEGWXWjs.StripePriceService.listPrices({ ...params, productId }), "retriever"),
|
|
4499
4504
|
retrieverParams: {},
|
|
4500
|
-
module:
|
|
4505
|
+
module: _chunkBZ5J2FIVjs.Modules.StripePrice
|
|
4501
4506
|
});
|
|
4502
4507
|
_react.useEffect.call(void 0, () => {
|
|
4503
4508
|
if (priceVersion > 0) void data.refresh();
|
|
@@ -4532,7 +4537,7 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4532
4537
|
openSeededEditor(transfer.price);
|
|
4533
4538
|
} catch (error) {
|
|
4534
4539
|
console.error("[PricesList] price import failed", error);
|
|
4535
|
-
|
|
4540
|
+
_chunk2H342HNNjs.errorToast.call(void 0, {
|
|
4536
4541
|
title: t("billing.admin.prices.import.errors.title"),
|
|
4537
4542
|
error: t("billing.admin.prices.import.errors.invalid")
|
|
4538
4543
|
});
|
|
@@ -4551,7 +4556,7 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4551
4556
|
"create-price"
|
|
4552
4557
|
),
|
|
4553
4558
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _react.Fragment, { children: [
|
|
4554
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
4559
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk2H342HNNjs.Button, { variant: "outline", size: "sm", type: "button", onClick: () => _optionalChain([importInputRef, 'access', _181 => _181.current, 'optionalAccess', _182 => _182.click, 'call', _183 => _183()]), children: [
|
|
4555
4560
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.UploadIcon, {}),
|
|
4556
4561
|
t("billing.admin.prices.actions.import")
|
|
4557
4562
|
] }),
|
|
@@ -4569,7 +4574,7 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4569
4574
|
];
|
|
4570
4575
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
4571
4576
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4572
|
-
|
|
4577
|
+
_chunk2H342HNNjs.ContentListTable,
|
|
4573
4578
|
{
|
|
4574
4579
|
data,
|
|
4575
4580
|
fields: [
|
|
@@ -4580,13 +4585,13 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4580
4585
|
"status" /* status */,
|
|
4581
4586
|
"actions" /* actions */
|
|
4582
4587
|
],
|
|
4583
|
-
tableGeneratorType:
|
|
4588
|
+
tableGeneratorType: _chunkBZ5J2FIVjs.Modules.StripePrice,
|
|
4584
4589
|
functions,
|
|
4585
4590
|
context: tableContext,
|
|
4586
4591
|
fullWidth,
|
|
4587
4592
|
title: t("billing.admin.prices.title"),
|
|
4588
4593
|
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4589
|
-
|
|
4594
|
+
_chunk2H342HNNjs.EmptyState,
|
|
4590
4595
|
{
|
|
4591
4596
|
icon: _lucidereact.DollarSignIcon,
|
|
4592
4597
|
title: t("billing.admin.prices.empty.title"),
|
|
@@ -4626,18 +4631,18 @@ function ProductDetails() {
|
|
|
4626
4631
|
const { product } = useProductContext();
|
|
4627
4632
|
if (!product) return null;
|
|
4628
4633
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4629
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4634
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.SectionHeader, { children: t("billing.admin.products.tabs.details") }),
|
|
4630
4635
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
4631
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4636
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.DetailField, { label: t("billing.admin.products.fields.name"), value: product.name }),
|
|
4632
4637
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4633
|
-
|
|
4638
|
+
_chunk2H342HNNjs.DetailField,
|
|
4634
4639
|
{
|
|
4635
4640
|
label: t("billing.admin.products.fields.status"),
|
|
4636
|
-
value: product.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4641
|
+
value: product.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Badge, { variant: "softGreen", children: t("billing.admin.products.status.active") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Badge, { variant: "softGray", children: t("billing.admin.products.status.archived") })
|
|
4637
4642
|
}
|
|
4638
4643
|
),
|
|
4639
4644
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4640
|
-
|
|
4645
|
+
_chunk2H342HNNjs.DetailField,
|
|
4641
4646
|
{
|
|
4642
4647
|
label: t("billing.admin.products.fields.description"),
|
|
4643
4648
|
value: _nullishCoalesce(product.description, () => ( "\u2014")),
|
|
@@ -4645,14 +4650,14 @@ function ProductDetails() {
|
|
|
4645
4650
|
}
|
|
4646
4651
|
),
|
|
4647
4652
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4648
|
-
|
|
4653
|
+
_chunk2H342HNNjs.DetailField,
|
|
4649
4654
|
{
|
|
4650
4655
|
label: t("billing.admin.products.fields.prices"),
|
|
4651
4656
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: product.stripePrices.length })
|
|
4652
4657
|
}
|
|
4653
4658
|
),
|
|
4654
4659
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4655
|
-
|
|
4660
|
+
_chunk2H342HNNjs.DetailField,
|
|
4656
4661
|
{
|
|
4657
4662
|
label: t("billing.admin.products.fields.stripeId"),
|
|
4658
4663
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: product.stripeProductId })
|
|
@@ -4670,9 +4675,9 @@ function ProductContainer() {
|
|
|
4670
4675
|
const { product } = useProductContext();
|
|
4671
4676
|
if (!product) return null;
|
|
4672
4677
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4673
|
-
|
|
4678
|
+
_chunk2H342HNNjs.RoundPageContainer,
|
|
4674
4679
|
{
|
|
4675
|
-
module:
|
|
4680
|
+
module: _chunkBZ5J2FIVjs.Modules.StripeProduct,
|
|
4676
4681
|
id: product.id,
|
|
4677
4682
|
tabs: [
|
|
4678
4683
|
{
|
|
@@ -4681,7 +4686,7 @@ function ProductContainer() {
|
|
|
4681
4686
|
content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductDetails, {})
|
|
4682
4687
|
},
|
|
4683
4688
|
{
|
|
4684
|
-
key:
|
|
4689
|
+
key: _chunkBZ5J2FIVjs.Modules.StripePrice,
|
|
4685
4690
|
label: t("billing.admin.prices.title"),
|
|
4686
4691
|
// publishChrome={false}: SharedProvider REPLACES its value for the
|
|
4687
4692
|
// subtree (SharedContext.tsx:35-37), so a nested provider publishing
|
|
@@ -4707,18 +4712,18 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductContainer, "ProductContainer");
|
|
|
4707
4712
|
|
|
4708
4713
|
function CouponsList({ fullWidth } = {}) {
|
|
4709
4714
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4710
|
-
const { catalogueVersion } =
|
|
4711
|
-
const data =
|
|
4712
|
-
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) =>
|
|
4715
|
+
const { catalogueVersion } = _chunk2H342HNNjs.useCouponContext.call(void 0, );
|
|
4716
|
+
const data = _chunk2H342HNNjs.useDataListRetriever.call(void 0, {
|
|
4717
|
+
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunkMOGEGWXWjs.StripeCouponService.listCoupons(params), "retriever"),
|
|
4713
4718
|
retrieverParams: {},
|
|
4714
|
-
module:
|
|
4719
|
+
module: _chunkBZ5J2FIVjs.Modules.StripeCoupon
|
|
4715
4720
|
});
|
|
4716
4721
|
_react.useEffect.call(void 0, () => {
|
|
4717
4722
|
if (catalogueVersion > 0) void data.refresh();
|
|
4718
4723
|
}, [catalogueVersion]);
|
|
4719
|
-
const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4724
|
+
const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.CouponEditor, {}, "create-coupon")];
|
|
4720
4725
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4721
|
-
|
|
4726
|
+
_chunk2H342HNNjs.ContentListTable,
|
|
4722
4727
|
{
|
|
4723
4728
|
data,
|
|
4724
4729
|
fields: [
|
|
@@ -4728,12 +4733,12 @@ function CouponsList({ fullWidth } = {}) {
|
|
|
4728
4733
|
"codes" /* codes */,
|
|
4729
4734
|
"status" /* status */
|
|
4730
4735
|
],
|
|
4731
|
-
tableGeneratorType:
|
|
4736
|
+
tableGeneratorType: _chunkBZ5J2FIVjs.Modules.StripeCoupon,
|
|
4732
4737
|
functions,
|
|
4733
4738
|
fullWidth,
|
|
4734
4739
|
title: t("billing.admin.coupons.title"),
|
|
4735
4740
|
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4736
|
-
|
|
4741
|
+
_chunk2H342HNNjs.EmptyState,
|
|
4737
4742
|
{
|
|
4738
4743
|
icon: _lucidereact.TicketPercentIcon,
|
|
4739
4744
|
title: t("billing.admin.coupons.empty.title"),
|
|
@@ -4753,26 +4758,26 @@ _chunk7QVYU63Ejs.__name.call(void 0, CouponsList, "CouponsList");
|
|
|
4753
4758
|
function ProductsList({ fullWidth } = {}) {
|
|
4754
4759
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4755
4760
|
const { catalogueVersion } = useProductContext();
|
|
4756
|
-
const data =
|
|
4757
|
-
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) =>
|
|
4761
|
+
const data = _chunk2H342HNNjs.useDataListRetriever.call(void 0, {
|
|
4762
|
+
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunkMOGEGWXWjs.StripeProductService.listProducts(params), "retriever"),
|
|
4758
4763
|
retrieverParams: {},
|
|
4759
|
-
module:
|
|
4764
|
+
module: _chunkBZ5J2FIVjs.Modules.StripeProduct
|
|
4760
4765
|
});
|
|
4761
4766
|
_react.useEffect.call(void 0, () => {
|
|
4762
4767
|
if (catalogueVersion > 0) void data.refresh();
|
|
4763
4768
|
}, [catalogueVersion]);
|
|
4764
4769
|
const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductEditor, {}, "create-product")];
|
|
4765
4770
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4766
|
-
|
|
4771
|
+
_chunk2H342HNNjs.ContentListTable,
|
|
4767
4772
|
{
|
|
4768
4773
|
data,
|
|
4769
4774
|
fields: ["name" /* name */, "status" /* status */, "prices" /* prices */],
|
|
4770
|
-
tableGeneratorType:
|
|
4775
|
+
tableGeneratorType: _chunkBZ5J2FIVjs.Modules.StripeProduct,
|
|
4771
4776
|
functions,
|
|
4772
4777
|
fullWidth,
|
|
4773
4778
|
title: t("billing.admin.products.title"),
|
|
4774
4779
|
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4775
|
-
|
|
4780
|
+
_chunk2H342HNNjs.EmptyState,
|
|
4776
4781
|
{
|
|
4777
4782
|
icon: _lucidereact.PackageIcon,
|
|
4778
4783
|
title: t("billing.admin.products.empty.title"),
|
|
@@ -4788,10 +4793,10 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductsList, "ProductsList");
|
|
|
4788
4793
|
|
|
4789
4794
|
function ProductsListContainer() {
|
|
4790
4795
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4791
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductProvider, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4792
|
-
|
|
4796
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductProvider, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.CouponProvider, { publishChrome: false, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4797
|
+
_chunk2H342HNNjs.RoundPageContainer,
|
|
4793
4798
|
{
|
|
4794
|
-
module:
|
|
4799
|
+
module: _chunkBZ5J2FIVjs.Modules.StripeProduct,
|
|
4795
4800
|
tabs: [
|
|
4796
4801
|
{ sectionKey: "products", label: t("billing.admin.products.tabs.products"), content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductsList, {}) },
|
|
4797
4802
|
{ sectionKey: "codes", label: t("billing.admin.products.tabs.codes"), content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CouponsList, {}) }
|
|
@@ -4809,30 +4814,30 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductsListContainer, "ProductsListContain
|
|
|
4809
4814
|
|
|
4810
4815
|
function CouponDetails() {
|
|
4811
4816
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4812
|
-
const fmt =
|
|
4813
|
-
const { coupon } =
|
|
4817
|
+
const fmt = _chunk2H342HNNjs.useBillingFormatOptions.call(void 0, );
|
|
4818
|
+
const { coupon } = _chunk2H342HNNjs.useCouponContext.call(void 0, );
|
|
4814
4819
|
if (!coupon) return null;
|
|
4815
4820
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4816
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4821
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.SectionHeader, { children: t("billing.admin.products.tabs.details") }),
|
|
4817
4822
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-xs/relaxed", children: t("billing.admin.coupons.fixed_notice") }),
|
|
4818
4823
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
4819
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4824
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.DetailField, { label: t("billing.admin.coupons.fields.name"), value: coupon.name }),
|
|
4820
4825
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4821
|
-
|
|
4826
|
+
_chunk2H342HNNjs.DetailField,
|
|
4822
4827
|
{
|
|
4823
4828
|
label: t("billing.admin.coupons.fields.status"),
|
|
4824
|
-
value: coupon.valid ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4829
|
+
value: coupon.valid ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Badge, { variant: "softGreen", children: t("billing.admin.coupons.status.active") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.Badge, { variant: "softGray", children: t("billing.admin.coupons.status.ended") })
|
|
4825
4830
|
}
|
|
4826
4831
|
),
|
|
4827
4832
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4828
|
-
|
|
4833
|
+
_chunk2H342HNNjs.DetailField,
|
|
4829
4834
|
{
|
|
4830
4835
|
label: t("billing.admin.coupons.fields.discount"),
|
|
4831
|
-
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: _chunkMOGEGWXWjs.formatCouponDiscount.call(void 0, coupon, t, fmt) })
|
|
4832
4837
|
}
|
|
4833
4838
|
),
|
|
4834
4839
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4835
|
-
|
|
4840
|
+
_chunk2H342HNNjs.DetailField,
|
|
4836
4841
|
{
|
|
4837
4842
|
label: t("billing.admin.coupons.fields.places"),
|
|
4838
4843
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: coupon.maxRedemptions !== void 0 ? t("billing.admin.coupons.places.limited", {
|
|
@@ -4842,21 +4847,21 @@ function CouponDetails() {
|
|
|
4842
4847
|
}
|
|
4843
4848
|
),
|
|
4844
4849
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4845
|
-
|
|
4850
|
+
_chunk2H342HNNjs.DetailField,
|
|
4846
4851
|
{
|
|
4847
4852
|
label: t("billing.admin.coupons.fields.products"),
|
|
4848
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")
|
|
4849
4854
|
}
|
|
4850
4855
|
),
|
|
4851
4856
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4852
|
-
|
|
4857
|
+
_chunk2H342HNNjs.DetailField,
|
|
4853
4858
|
{
|
|
4854
4859
|
label: t("billing.admin.coupons.fields.redeemBy"),
|
|
4855
|
-
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 ? _chunk2H342HNNjs.formatDate.call(void 0, coupon.redeemBy, fmt) : "\u2014" })
|
|
4856
4861
|
}
|
|
4857
4862
|
),
|
|
4858
4863
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4859
|
-
|
|
4864
|
+
_chunk2H342HNNjs.DetailField,
|
|
4860
4865
|
{
|
|
4861
4866
|
label: t("billing.admin.coupons.fields.stripeId"),
|
|
4862
4867
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: coupon.stripeCouponId })
|
|
@@ -4890,33 +4895,33 @@ function CouponCodeEditorInternal({
|
|
|
4890
4895
|
onDialogOpenChange
|
|
4891
4896
|
}) {
|
|
4892
4897
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4893
|
-
const router =
|
|
4894
|
-
const { createCode } =
|
|
4895
|
-
const formSchema2 = _react.useMemo.call(void 0, () => _zod3.z.object({ id: _zod3.z.uuidv4() }).and(
|
|
4896
|
-
const getDefaultValues = _react.useCallback.call(void 0, () => ({ id: _uuid.v4.call(void 0, ), ...
|
|
4898
|
+
const router = _chunkBZ5J2FIVjs.useI18nRouter.call(void 0, );
|
|
4899
|
+
const { createCode } = _chunk2H342HNNjs.useCouponContext.call(void 0, );
|
|
4900
|
+
const formSchema2 = _react.useMemo.call(void 0, () => _zod3.z.object({ id: _zod3.z.uuidv4() }).and(_chunk2H342HNNjs.couponCodeSchema.call(void 0, t)), [t]);
|
|
4901
|
+
const getDefaultValues = _react.useCallback.call(void 0, () => ({ id: _uuid.v4.call(void 0, ), ..._chunk2H342HNNjs.couponCodeDefaults.call(void 0, ) }), []);
|
|
4897
4902
|
const form = _reacthookform.useForm.call(void 0, {
|
|
4898
4903
|
resolver: _zod.zodResolver.call(void 0, formSchema2),
|
|
4899
4904
|
defaultValues: getDefaultValues()
|
|
4900
4905
|
});
|
|
4901
4906
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4902
|
-
|
|
4907
|
+
_chunk2H342HNNjs.EditorSheet,
|
|
4903
4908
|
{
|
|
4904
4909
|
form,
|
|
4905
4910
|
entityType: t("billing.admin.coupons.codes.entity"),
|
|
4906
4911
|
isEdit: false,
|
|
4907
|
-
module:
|
|
4912
|
+
module: _chunkBZ5J2FIVjs.Modules.StripeCouponCode,
|
|
4908
4913
|
size: "md",
|
|
4909
4914
|
onSuccess: _nullishCoalesce(onSuccess, () => ( (() => {
|
|
4910
4915
|
}))),
|
|
4911
4916
|
onNavigate: (url) => router.push(url),
|
|
4912
|
-
onSubmit: async (values) => await createCode({ id: values.id, couponId, ...
|
|
4917
|
+
onSubmit: async (values) => await createCode({ id: values.id, couponId, ..._chunk2H342HNNjs.toCouponCodeInput.call(void 0, values) }),
|
|
4913
4918
|
onReset: getDefaultValues,
|
|
4914
4919
|
trigger,
|
|
4915
4920
|
forceShow,
|
|
4916
4921
|
onClose,
|
|
4917
4922
|
dialogOpen,
|
|
4918
4923
|
onDialogOpenChange,
|
|
4919
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4924
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk2H342HNNjs.CouponCodeFields, { form })
|
|
4920
4925
|
}
|
|
4921
4926
|
);
|
|
4922
4927
|
}
|
|
@@ -4930,18 +4935,18 @@ _chunk7QVYU63Ejs.__name.call(void 0, CouponCodeEditor, "CouponCodeEditor");
|
|
|
4930
4935
|
|
|
4931
4936
|
function CouponCodesList({ couponId }) {
|
|
4932
4937
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4933
|
-
const { catalogueVersion } =
|
|
4934
|
-
const data =
|
|
4935
|
-
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) =>
|
|
4938
|
+
const { catalogueVersion } = _chunk2H342HNNjs.useCouponContext.call(void 0, );
|
|
4939
|
+
const data = _chunk2H342HNNjs.useDataListRetriever.call(void 0, {
|
|
4940
|
+
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunkMOGEGWXWjs.StripeCouponCodeService.listByCoupon({ ...params, couponId }), "retriever"),
|
|
4936
4941
|
retrieverParams: {},
|
|
4937
|
-
module:
|
|
4942
|
+
module: _chunkBZ5J2FIVjs.Modules.StripeCouponCode
|
|
4938
4943
|
});
|
|
4939
4944
|
_react.useEffect.call(void 0, () => {
|
|
4940
4945
|
if (catalogueVersion > 0) void data.refresh();
|
|
4941
4946
|
}, [catalogueVersion]);
|
|
4942
4947
|
const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, CouponCodeEditor, { couponId }, "create-code")];
|
|
4943
4948
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4944
|
-
|
|
4949
|
+
_chunk2H342HNNjs.ContentListTable,
|
|
4945
4950
|
{
|
|
4946
4951
|
data,
|
|
4947
4952
|
fields: [
|
|
@@ -4952,11 +4957,11 @@ function CouponCodesList({ couponId }) {
|
|
|
4952
4957
|
"status" /* status */,
|
|
4953
4958
|
"actions" /* actions */
|
|
4954
4959
|
],
|
|
4955
|
-
tableGeneratorType:
|
|
4960
|
+
tableGeneratorType: _chunkBZ5J2FIVjs.Modules.StripeCouponCode,
|
|
4956
4961
|
functions,
|
|
4957
4962
|
title: t("billing.admin.coupons.codes.title"),
|
|
4958
4963
|
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4959
|
-
|
|
4964
|
+
_chunk2H342HNNjs.EmptyState,
|
|
4960
4965
|
{
|
|
4961
4966
|
icon: _lucidereact.TicketIcon,
|
|
4962
4967
|
title: t("billing.admin.coupons.codes.empty.title"),
|
|
@@ -4972,12 +4977,12 @@ _chunk7QVYU63Ejs.__name.call(void 0, CouponCodesList, "CouponCodesList");
|
|
|
4972
4977
|
|
|
4973
4978
|
function CouponContainer() {
|
|
4974
4979
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4975
|
-
const { coupon } =
|
|
4980
|
+
const { coupon } = _chunk2H342HNNjs.useCouponContext.call(void 0, );
|
|
4976
4981
|
if (!coupon) return null;
|
|
4977
4982
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4978
|
-
|
|
4983
|
+
_chunk2H342HNNjs.RoundPageContainer,
|
|
4979
4984
|
{
|
|
4980
|
-
module:
|
|
4985
|
+
module: _chunk2H342HNNjs.couponPageModule.call(void 0, ),
|
|
4981
4986
|
id: coupon.id,
|
|
4982
4987
|
tabs: [
|
|
4983
4988
|
{
|
|
@@ -5084,5 +5089,5 @@ _chunk7QVYU63Ejs.__name.call(void 0, CouponContainer, "CouponContainer");
|
|
|
5084
5089
|
|
|
5085
5090
|
|
|
5086
5091
|
|
|
5087
|
-
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 = _chunk2H342HNNjs.CouponCodeActions; exports.CouponCodeEditor = CouponCodeEditor; exports.CouponCodeFields = _chunk2H342HNNjs.CouponCodeFields; exports.CouponCodesList = CouponCodesList; exports.CouponContainer = CouponContainer; exports.CouponDetails = CouponDetails; exports.CouponEditor = _chunk2H342HNNjs.CouponEditor; exports.CouponProvider = _chunk2H342HNNjs.CouponProvider; exports.CouponRefresher = _chunk2H342HNNjs.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 = _chunk2H342HNNjs.applyDiscount; exports.couponCodeDefaults = _chunk2H342HNNjs.couponCodeDefaults; exports.couponCodeSchema = _chunk2H342HNNjs.couponCodeSchema; exports.couponCurrencyOptions = _chunk2H342HNNjs.couponCurrencyOptions; exports.formatCurrency = _chunkMOGEGWXWjs.formatCurrency; exports.formatDate = _chunk2H342HNNjs.formatDate; exports.formatFixed = _chunkMOGEGWXWjs.formatFixed; exports.formatInterval = _chunkMOGEGWXWjs.formatInterval; exports.isStripeConfigured = isStripeConfigured; exports.optionalDate = _chunk2H342HNNjs.optionalDate; exports.optionalDecimal = _chunk2H342HNNjs.optionalDecimal; exports.optionalPositiveInt = _chunk2H342HNNjs.optionalPositiveInt; exports.parseOptionalDecimal = _chunk2H342HNNjs.parseOptionalDecimal; exports.parseOptionalPositiveInt = _chunk2H342HNNjs.parseOptionalPositiveInt; exports.priceLabel = priceLabel; exports.promotionCodeDiscount = _chunk2H342HNNjs.promotionCodeDiscount; exports.subscriptionDiscount = _chunk2H342HNNjs.subscriptionDiscount; exports.toCouponCodeInput = _chunk2H342HNNjs.toCouponCodeInput; exports.useBillingFormatOptions = _chunk2H342HNNjs.useBillingFormatOptions; exports.useCouponContext = _chunk2H342HNNjs.useCouponContext; exports.usePriceContext = usePriceContext; exports.useProductContext = useProductContext;
|
|
5088
5093
|
//# sourceMappingURL=index.js.map
|