@carlonicora/nextjs-jsonapi 3.28.2 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{BlockNoteEditor-36VL2TNM.js → BlockNoteEditor-BXMTGKDV.js} +21 -20
- package/dist/BlockNoteEditor-BXMTGKDV.js.map +1 -0
- package/dist/{BlockNoteEditor-4IDXT6ZU.mjs → BlockNoteEditor-FGVQP35E.mjs} +9 -8
- package/dist/{BlockNoteEditor-4IDXT6ZU.mjs.map → BlockNoteEditor-FGVQP35E.mjs.map} +1 -1
- package/dist/{BlockNoteViewer-KRTAFTUX.mjs → BlockNoteViewer-DQYT6IJW.mjs} +3 -3
- package/dist/{BlockNoteViewer-7BFNTN4E.js → BlockNoteViewer-YH7G66PS.js} +4 -4
- package/dist/{BlockNoteViewer-7BFNTN4E.js.map → BlockNoteViewer-YH7G66PS.js.map} +1 -1
- package/dist/{HandbookSectionInterface-DgYH--Ik.d.mts → HandbookSectionInterface-BYsmnPEz.d.mts} +1 -1
- package/dist/{HandbookSectionInterface-Ck1wZJ81.d.ts → HandbookSectionInterface-OePKPbqN.d.ts} +1 -1
- package/dist/{JsonApiRequest-UHOWNI3O.mjs → JsonApiRequest-MEP6AXDT.mjs} +2 -2
- package/dist/JsonApiRequest-OB6WL4LA.js +26 -0
- package/dist/{JsonApiRequest-TE5WD3WS.js.map → JsonApiRequest-OB6WL4LA.js.map} +1 -1
- package/dist/ServerSession-DFNNNkg7.d.ts +29 -0
- package/dist/ServerSession-DK1z0_Ql.d.mts +29 -0
- package/dist/{analytics.modules-CfczU12P.d.ts → analytics.modules-Bsacu6ik.d.ts} +1 -1
- package/dist/{analytics.modules-pzGwMASI.d.mts → analytics.modules-txdCLNG-.d.mts} +1 -1
- package/dist/billing/index.js +404 -402
- package/dist/billing/index.js.map +1 -1
- package/dist/billing/index.mjs +10 -8
- package/dist/billing/index.mjs.map +1 -1
- package/dist/{chunk-7B4E42R5.mjs → chunk-3CZ2GK5R.mjs} +33 -9
- package/dist/chunk-3CZ2GK5R.mjs.map +1 -0
- package/dist/{chunk-4Z45NYPR.js → chunk-5W5MN7JP.js} +14 -83
- package/dist/chunk-5W5MN7JP.js.map +1 -0
- package/dist/{chunk-CAKOFJZD.js → chunk-6OFANJTE.js} +195 -142
- package/dist/chunk-6OFANJTE.js.map +1 -0
- package/dist/{chunk-5TRFNKJS.js → chunk-6TUB7Y6T.js} +23 -25
- package/dist/chunk-6TUB7Y6T.js.map +1 -0
- package/dist/{chunk-37DMFVLN.mjs → chunk-7SCREMTX.mjs} +4 -3
- package/dist/{chunk-37DMFVLN.mjs.map → chunk-7SCREMTX.mjs.map} +1 -1
- package/dist/{chunk-Q6J2ICKO.mjs → chunk-ADZSH3MG.mjs} +3 -72
- package/dist/chunk-ADZSH3MG.mjs.map +1 -0
- package/dist/{chunk-E3I4MT53.mjs → chunk-AQZ3T4BR.mjs} +71 -18
- package/dist/chunk-AQZ3T4BR.mjs.map +1 -0
- package/dist/{chunk-SJLXPHK5.mjs → chunk-E2LENTUH.mjs} +22 -24
- package/dist/chunk-E2LENTUH.mjs.map +1 -0
- package/dist/chunk-EBEXWN3I.mjs +17 -0
- package/dist/chunk-EBEXWN3I.mjs.map +1 -0
- package/dist/chunk-G4JR3SFV.js +28 -0
- package/dist/chunk-G4JR3SFV.js.map +1 -0
- package/dist/chunk-IK65TDQH.js +15 -0
- package/dist/chunk-IK65TDQH.js.map +1 -0
- package/dist/{chunk-GHFMKH3M.js → chunk-JEQ34Z5E.js} +62 -38
- package/dist/chunk-JEQ34Z5E.js.map +1 -0
- package/dist/{chunk-KOTKKBJT.js → chunk-NFCXUAE6.js} +1328 -1183
- package/dist/chunk-NFCXUAE6.js.map +1 -0
- package/dist/chunk-OEOK6A3P.js +17 -0
- package/dist/chunk-OEOK6A3P.js.map +1 -0
- package/dist/chunk-PW42LRSL.mjs +28 -0
- package/dist/chunk-PW42LRSL.mjs.map +1 -0
- package/dist/{chunk-U65JPKO3.mjs → chunk-R6ZYB4VN.mjs} +2 -2
- package/dist/chunk-T7SAW3UW.mjs +15 -0
- package/dist/chunk-T7SAW3UW.mjs.map +1 -0
- package/dist/{chunk-GKDHYB2R.js → chunk-TWBZ2GSX.js} +3 -3
- package/dist/{chunk-GKDHYB2R.js.map → chunk-TWBZ2GSX.js.map} +1 -1
- package/dist/{chunk-26MQIJNB.js → chunk-WGVNJXZO.js} +4 -3
- package/dist/chunk-WGVNJXZO.js.map +1 -0
- package/dist/{chunk-HPUV6FBW.mjs → chunk-WJC4SYRL.mjs} +2131 -1986
- package/dist/chunk-WJC4SYRL.mjs.map +1 -0
- package/dist/client/index.d.mts +3 -3
- package/dist/client/index.d.ts +3 -3
- package/dist/client/index.js +6 -5
- package/dist/client/index.js.map +1 -1
- package/dist/client/index.mjs +13 -12
- package/dist/components/index.d.mts +16 -6
- package/dist/components/index.d.ts +16 -6
- package/dist/components/index.js +8 -5
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +9 -6
- package/dist/{config-3N1LSrcC.d.ts → config-B6UB7j69.d.ts} +1 -1
- package/dist/{config-BmufyEj6.d.mts → config-CEAq4Ozy.d.mts} +10 -1
- package/dist/{config-AVtuvfM1.d.ts → config-DydDHCfb.d.ts} +10 -1
- package/dist/{config-BSKTYDoh.d.mts → config-n-ZpPmOL.d.mts} +1 -1
- package/dist/contexts/index.d.mts +28 -4
- package/dist/contexts/index.d.ts +28 -4
- package/dist/contexts/index.js +10 -5
- package/dist/contexts/index.js.map +1 -1
- package/dist/contexts/index.mjs +9 -4
- package/dist/core/index.d.mts +6 -6
- package/dist/core/index.d.ts +6 -6
- package/dist/core/index.js +5 -5
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +4 -4
- package/dist/features/analytics/index.d.mts +2 -2
- package/dist/features/analytics/index.d.ts +2 -2
- package/dist/features/analytics/index.js +124 -123
- package/dist/features/analytics/index.js.map +1 -1
- package/dist/features/analytics/index.mjs +6 -5
- package/dist/features/analytics/index.mjs.map +1 -1
- package/dist/features/analytics/server.d.mts +10 -2
- package/dist/features/analytics/server.d.ts +10 -2
- package/dist/features/analytics/server.js +8 -6
- package/dist/features/analytics/server.js.map +1 -1
- package/dist/features/analytics/server.mjs +6 -4
- package/dist/features/analytics/server.mjs.map +1 -1
- package/dist/features/help/index.d.mts +2 -2
- package/dist/features/help/index.d.ts +2 -2
- package/dist/features/help/index.js +39 -38
- package/dist/features/help/index.js.map +1 -1
- package/dist/features/help/index.mjs +5 -4
- package/dist/features/help/index.mjs.map +1 -1
- package/dist/features/tokenusage/index.d.mts +2 -2
- package/dist/features/tokenusage/index.d.ts +2 -2
- package/dist/features/tokenusage/index.js +127 -126
- package/dist/features/tokenusage/index.js.map +1 -1
- package/dist/features/tokenusage/index.mjs +6 -5
- package/dist/features/tokenusage/index.mjs.map +1 -1
- package/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +8 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -9
- package/dist/next-config/index.d.mts +43 -0
- package/dist/next-config/index.d.ts +43 -0
- package/dist/next-config/index.js +230 -0
- package/dist/next-config/index.js.map +1 -0
- package/dist/next-config/index.mjs +230 -0
- package/dist/next-config/index.mjs.map +1 -0
- package/dist/{request-FXF63NSQ.mjs → request-3IUMNVOS.mjs} +2 -2
- package/dist/request-LZBAOT3Y.js +8 -0
- package/dist/request-LZBAOT3Y.js.map +1 -0
- package/dist/server/cachedGet.d.mts +28 -0
- package/dist/server/cachedGet.d.ts +28 -0
- package/dist/server/cachedGet.js +60 -0
- package/dist/server/cachedGet.js.map +1 -0
- package/dist/server/cachedGet.mjs +60 -0
- package/dist/server/cachedGet.mjs.map +1 -0
- package/dist/server/cachedGet.stub.d.mts +7 -0
- package/dist/server/cachedGet.stub.d.ts +7 -0
- package/dist/server/cachedGet.stub.js +17 -0
- package/dist/server/cachedGet.stub.js.map +1 -0
- package/dist/server/cachedGet.stub.mjs +17 -0
- package/dist/server/cachedGet.stub.mjs.map +1 -0
- package/dist/server/index.d.mts +27 -25
- package/dist/server/index.d.ts +27 -25
- package/dist/server/index.js +13 -6
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +15 -8
- package/dist/testing/index.js.map +1 -1
- package/dist/testing/index.mjs.map +1 -1
- package/dist/{types-D0uLYV2P.d.mts → types-Bq_UA8Lg.d.mts} +1 -1
- package/dist/{types-Cn153-mH.d.ts → types-bsm8Fp55.d.ts} +1 -1
- package/dist/{usePageUrlGenerator-B-3FRKBD.d.ts → usePageUrlGenerator-J_ECv-oQ.d.ts} +1 -1
- package/dist/{usePageUrlGenerator-CCJ_cdQy.d.mts → usePageUrlGenerator-uKBjAKqC.d.mts} +1 -1
- package/package.json +12 -1
- package/src/components/forms/__tests__/EditorSheet.test.tsx +25 -1
- package/src/components/forms/__tests__/useEditorDialog.test.ts +164 -1
- package/src/components/forms/useEditorDialog.ts +69 -2
- package/src/contexts/SessionContext.tsx +20 -0
- package/src/contexts/SocketContext.tsx +30 -3
- package/src/contexts/ViewportContext.tsx +17 -2
- package/src/contexts/__tests__/SessionContext.test.tsx +58 -0
- package/src/contexts/__tests__/SocketContext.session.test.tsx +77 -0
- package/src/contexts/index.ts +1 -0
- package/src/core/abstracts/AbstractService.ts +4 -6
- package/src/core/abstracts/__tests__/AbstractService.locale.test.ts +64 -0
- package/src/features/analytics/components/server/AnalyticsAdminPage.tsx +5 -1
- package/src/features/analytics/components/server/AnalyticsJourneyPage.tsx +5 -1
- package/src/features/notification/contexts/NotificationContext.tsx +5 -2
- package/src/features/notification/contexts/__tests__/NotificationContext.spec.tsx +22 -0
- package/src/features/user/contexts/CurrentUserContext.tsx +7 -5
- package/src/features/user/contexts/__tests__/CurrentUserContext.spec.tsx +63 -3
- package/src/hooks/__tests__/useSocket.render.test.ts +22 -0
- package/src/hooks/useSocket.ts +0 -1
- package/src/i18n/__tests__/config.test.ts +27 -0
- package/src/i18n/config.ts +17 -0
- package/src/i18n/index.ts +2 -0
- package/src/next-config/__tests__/createNextConfig.test.ts +268 -0
- package/src/next-config/csp.ts +128 -0
- package/src/next-config/headers.ts +61 -0
- package/src/next-config/index.ts +114 -0
- package/src/server/JsonApiServer.ts +3 -1
- package/src/server/ServerSession.ts +29 -1
- package/src/server/__tests__/JsonApiServer.test.ts +41 -0
- package/src/server/__tests__/ServerSession.read.test.ts +67 -0
- package/src/server/__tests__/cache.test.ts +48 -0
- package/src/server/__tests__/cachedGet.test.ts +125 -0
- package/src/server/__tests__/request.test.ts +96 -1
- package/src/server/cache.ts +21 -4
- package/src/server/cacheDigest.ts +10 -0
- package/src/server/cacheProfiles.ts +15 -0
- package/src/server/cachedGet.stub.ts +15 -0
- package/src/server/cachedGet.ts +80 -0
- package/src/server/request.ts +33 -32
- package/src/shadcnui/ui/__tests__/sidebar.menu-skeleton.test.tsx +50 -0
- package/src/shadcnui/ui/__tests__/sidebar.session.test.tsx +133 -0
- package/src/shadcnui/ui/sidebar.tsx +121 -18
- package/src/testing/matchers/jsonApiMatchers.ts +1 -0
- package/src/unified/JsonApiRequest.ts +4 -1
- package/src/unified/__tests__/JsonApiGet.cache.test.ts +51 -0
- package/src/utils/__tests__/map-thenable.test.ts +29 -0
- package/src/utils/__tests__/use-mobile.test.tsx +102 -1
- package/src/utils/map-thenable.ts +15 -0
- package/src/utils/use-mobile.tsx +13 -4
- package/dist/BlockNoteEditor-36VL2TNM.js.map +0 -1
- package/dist/JsonApiRequest-TE5WD3WS.js +0 -26
- package/dist/chunk-26MQIJNB.js.map +0 -1
- package/dist/chunk-4Z45NYPR.js.map +0 -1
- package/dist/chunk-5TRFNKJS.js.map +0 -1
- package/dist/chunk-7B4E42R5.mjs.map +0 -1
- package/dist/chunk-CAKOFJZD.js.map +0 -1
- package/dist/chunk-E3I4MT53.mjs.map +0 -1
- package/dist/chunk-GHFMKH3M.js.map +0 -1
- package/dist/chunk-HPUV6FBW.mjs.map +0 -1
- package/dist/chunk-KOTKKBJT.js.map +0 -1
- package/dist/chunk-Q6J2ICKO.mjs.map +0 -1
- package/dist/chunk-SJLXPHK5.mjs.map +0 -1
- package/dist/request-ZTX6I63X.js +0 -8
- package/dist/request-ZTX6I63X.js.map +0 -1
- /package/dist/{BlockNoteViewer-KRTAFTUX.mjs.map → BlockNoteViewer-DQYT6IJW.mjs.map} +0 -0
- /package/dist/{JsonApiRequest-UHOWNI3O.mjs.map → JsonApiRequest-MEP6AXDT.mjs.map} +0 -0
- /package/dist/{chunk-U65JPKO3.mjs.map → chunk-R6ZYB4VN.mjs.map} +0 -0
- /package/dist/{request-FXF63NSQ.mjs.map → request-3IUMNVOS.mjs.map} +0 -0
package/dist/billing/index.js
CHANGED
|
@@ -62,12 +62,13 @@
|
|
|
62
62
|
|
|
63
63
|
|
|
64
64
|
|
|
65
|
-
var
|
|
65
|
+
var _chunkNFCXUAE6js = require('../chunk-NFCXUAE6.js');
|
|
66
66
|
|
|
67
67
|
|
|
68
|
+
var _chunk5W5MN7JPjs = require('../chunk-5W5MN7JP.js');
|
|
68
69
|
|
|
69
70
|
|
|
70
|
-
var
|
|
71
|
+
var _chunkG4JR3SFVjs = require('../chunk-G4JR3SFV.js');
|
|
71
72
|
|
|
72
73
|
|
|
73
74
|
|
|
@@ -81,10 +82,11 @@ var _chunk4Z45NYPRjs = require('../chunk-4Z45NYPR.js');
|
|
|
81
82
|
|
|
82
83
|
|
|
83
84
|
|
|
84
|
-
|
|
85
|
-
require('../chunk-
|
|
85
|
+
|
|
86
|
+
var _chunk6OFANJTEjs = require('../chunk-6OFANJTE.js');
|
|
86
87
|
require('../chunk-LXKSUWAV.js');
|
|
87
88
|
require('../chunk-JTPRJNT2.js');
|
|
89
|
+
require('../chunk-WGVNJXZO.js');
|
|
88
90
|
require('../chunk-3EPNHTMH.js');
|
|
89
91
|
|
|
90
92
|
|
|
@@ -132,41 +134,41 @@ function SubscriptionSummaryCard({
|
|
|
132
134
|
onManageClick
|
|
133
135
|
}) {
|
|
134
136
|
if (loading) {
|
|
135
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
136
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
137
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
137
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.Card, { children: [
|
|
138
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
139
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.CardTitle, { children: "Subscriptions" }),
|
|
138
140
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
139
141
|
] }),
|
|
140
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
141
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
142
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
143
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
142
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.CardContent, { children: [
|
|
143
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
144
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Skeleton, { className: "h-4 w-24 mb-1" }),
|
|
145
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Skeleton, { className: "h-4 w-40" })
|
|
144
146
|
] })
|
|
145
147
|
] });
|
|
146
148
|
}
|
|
147
149
|
if (error) {
|
|
148
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
149
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
150
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
150
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.Card, { children: [
|
|
151
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
152
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.CardTitle, { children: "Subscriptions" }),
|
|
151
153
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
152
154
|
] }),
|
|
153
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
155
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
154
156
|
] });
|
|
155
157
|
}
|
|
156
158
|
const activeSubscriptions = subscriptions.filter(
|
|
157
159
|
(sub) => sub.status === "active" /* ACTIVE */ || sub.status === "trialing" /* TRIALING */
|
|
158
160
|
);
|
|
159
161
|
const primarySubscription = activeSubscriptions[0];
|
|
160
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
161
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
162
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
162
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
|
|
163
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
164
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.CardTitle, { children: "Subscriptions" }),
|
|
163
165
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
164
166
|
] }),
|
|
165
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
167
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.CardContent, { children: subscriptions.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
166
168
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No active plan" }),
|
|
167
169
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Subscribe to get started" }),
|
|
168
170
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
169
|
-
|
|
171
|
+
_chunkNFCXUAE6js.Button,
|
|
170
172
|
{
|
|
171
173
|
variant: "outline",
|
|
172
174
|
size: "sm",
|
|
@@ -185,7 +187,7 @@ function SubscriptionSummaryCard({
|
|
|
185
187
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
186
188
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: formatPlanName(primarySubscription) }),
|
|
187
189
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
188
|
-
|
|
190
|
+
_chunkNFCXUAE6js.Badge,
|
|
189
191
|
{
|
|
190
192
|
variant: primarySubscription.cancelAtPeriodEnd ? "secondary" : getStatusBadgeVariant(primarySubscription.status),
|
|
191
193
|
children: primarySubscription.cancelAtPeriodEnd ? "Canceling" : primarySubscription.status
|
|
@@ -227,37 +229,37 @@ function PaymentMethodSummaryCard({
|
|
|
227
229
|
onManageClick
|
|
228
230
|
}) {
|
|
229
231
|
if (loading) {
|
|
230
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
231
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
232
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
232
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.Card, { children: [
|
|
233
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
234
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.CardTitle, { children: "Payment Method" }),
|
|
233
235
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
234
236
|
] }),
|
|
235
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
236
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
237
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
237
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.CardContent, { children: [
|
|
238
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
239
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Skeleton, { className: "h-4 w-24" })
|
|
238
240
|
] })
|
|
239
241
|
] });
|
|
240
242
|
}
|
|
241
243
|
if (error) {
|
|
242
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
243
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
244
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
244
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.Card, { children: [
|
|
245
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
246
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.CardTitle, { children: "Payment Method" }),
|
|
245
247
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
246
248
|
] }),
|
|
247
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
249
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
248
250
|
] });
|
|
249
251
|
}
|
|
250
252
|
const defaultMethod = paymentMethods.find((pm) => pm.id === defaultPaymentMethodId) || paymentMethods[0];
|
|
251
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
252
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
253
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
253
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
|
|
254
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
255
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.CardTitle, { children: "Payment Method" }),
|
|
254
256
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
255
257
|
] }),
|
|
256
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
258
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.CardContent, { children: paymentMethods.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
257
259
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No payment method" }),
|
|
258
260
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Add a card to enable subscriptions" }),
|
|
259
261
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
260
|
-
|
|
262
|
+
_chunkNFCXUAE6js.Button,
|
|
261
263
|
{
|
|
262
264
|
variant: "outline",
|
|
263
265
|
size: "sm",
|
|
@@ -321,7 +323,7 @@ function CustomerInfoCard({ customer, loading, error }) {
|
|
|
321
323
|
e.stopPropagation();
|
|
322
324
|
setPortalLoading(true);
|
|
323
325
|
try {
|
|
324
|
-
const { url } = await
|
|
326
|
+
const { url } = await _chunk6OFANJTEjs.StripeCustomerService.createPortalSession();
|
|
325
327
|
window.open(url, "_blank");
|
|
326
328
|
} catch (err) {
|
|
327
329
|
console.error("[CustomerInfoCard] Failed to create portal session:", err);
|
|
@@ -330,52 +332,52 @@ function CustomerInfoCard({ customer, loading, error }) {
|
|
|
330
332
|
}
|
|
331
333
|
}, "handlePortalClick");
|
|
332
334
|
if (loading) {
|
|
333
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
334
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
335
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
335
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.Card, { children: [
|
|
336
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
337
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.CardTitle, { children: "Billing Account" }),
|
|
336
338
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
337
339
|
] }),
|
|
338
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
339
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
340
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
341
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
340
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.CardContent, { children: [
|
|
341
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
342
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Skeleton, { className: "h-4 w-48 mb-1" }),
|
|
343
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Skeleton, { className: "h-4 w-24" })
|
|
342
344
|
] })
|
|
343
345
|
] });
|
|
344
346
|
}
|
|
345
347
|
if (error) {
|
|
346
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
347
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
348
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
348
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.Card, { children: [
|
|
349
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
350
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.CardTitle, { children: "Billing Account" }),
|
|
349
351
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
350
352
|
] }),
|
|
351
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
353
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
352
354
|
] });
|
|
353
355
|
}
|
|
354
356
|
if (!customer) {
|
|
355
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
356
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
357
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
357
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.Card, { children: [
|
|
358
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
359
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.CardTitle, { children: "Billing Account" }),
|
|
358
360
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
359
361
|
] }),
|
|
360
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
362
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.CardContent, { children: [
|
|
361
363
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "Not set up" }),
|
|
362
364
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Billing account will be created when you subscribe" })
|
|
363
365
|
] })
|
|
364
366
|
] });
|
|
365
367
|
}
|
|
366
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
367
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
368
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
368
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.Card, { children: [
|
|
369
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
370
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.CardTitle, { children: "Billing Account" }),
|
|
369
371
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
370
372
|
] }),
|
|
371
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
373
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
372
374
|
customer.name && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: customer.name }),
|
|
373
375
|
customer.email && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: customer.email }),
|
|
374
376
|
customer.balance !== void 0 && customer.balance !== 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm", children: [
|
|
375
377
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground", children: "Credit Balance: " }),
|
|
376
378
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: customer.balance < 0 ? "text-success" : "text-destructive", children: formatBalance(customer.balance, customer.currency) })
|
|
377
379
|
] }),
|
|
378
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
380
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.Button, { variant: "outline", size: "sm", className: "mt-2", onClick: handlePortalClick, disabled: portalLoading, children: [
|
|
379
381
|
portalLoading ? "Loading..." : "Manage in Stripe Portal",
|
|
380
382
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ExternalLink, { className: "h-4 w-4 ms-1" })
|
|
381
383
|
] })
|
|
@@ -419,42 +421,42 @@ function formatAmount(amount, currency) {
|
|
|
419
421
|
_chunk7QVYU63Ejs.__name.call(void 0, formatAmount, "formatAmount");
|
|
420
422
|
function InvoicesSummaryCard({ invoices, loading, error, onViewAllClick }) {
|
|
421
423
|
if (loading) {
|
|
422
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
423
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
424
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
424
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.Card, { children: [
|
|
425
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
426
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.CardTitle, { children: "Recent Invoices" }),
|
|
425
427
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
426
428
|
] }),
|
|
427
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
428
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
429
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
430
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
429
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.CardContent, { children: [
|
|
430
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Skeleton, { className: "h-6 w-24 mb-2" }),
|
|
431
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Skeleton, { className: "h-4 w-32 mb-1" }),
|
|
432
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Skeleton, { className: "h-4 w-20" })
|
|
431
433
|
] })
|
|
432
434
|
] });
|
|
433
435
|
}
|
|
434
436
|
if (error) {
|
|
435
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
436
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
437
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
437
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.Card, { children: [
|
|
438
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
439
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.CardTitle, { children: "Recent Invoices" }),
|
|
438
440
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
439
441
|
] }),
|
|
440
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
442
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
441
443
|
] });
|
|
442
444
|
}
|
|
443
445
|
const latestInvoice = invoices[0];
|
|
444
446
|
const paidInvoices = invoices.filter((inv) => inv.status === "paid" /* PAID */);
|
|
445
447
|
const openInvoices = invoices.filter((inv) => inv.status === "open" /* OPEN */);
|
|
446
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
447
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
448
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
448
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewAllClick, children: [
|
|
449
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
450
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.CardTitle, { children: "Recent Invoices" }),
|
|
449
451
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
450
452
|
] }),
|
|
451
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
453
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.CardContent, { children: invoices.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
452
454
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No invoices yet" }),
|
|
453
455
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Invoices will appear after your first billing cycle" })
|
|
454
456
|
] }) : latestInvoice ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
455
457
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
456
458
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: formatAmount(latestInvoice.total, latestInvoice.currency) }),
|
|
457
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
459
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Badge, { variant: getStatusBadgeVariant2(latestInvoice.status), children: latestInvoice.status })
|
|
458
460
|
] }),
|
|
459
461
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: latestInvoice.stripeInvoiceNumber || `Invoice from ${formatDate2(latestInvoice.periodStart)}` }),
|
|
460
462
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-4 text-xs text-muted-foreground", children: [
|
|
@@ -494,24 +496,24 @@ function BillingUsageSummaryCard({
|
|
|
494
496
|
onViewDetailsClick
|
|
495
497
|
}) {
|
|
496
498
|
if (loading) {
|
|
497
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
498
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
499
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
499
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.Card, { children: [
|
|
500
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
501
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.CardTitle, { children: "Usage This Month" }),
|
|
500
502
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
501
503
|
] }),
|
|
502
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
503
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
504
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
504
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.CardContent, { children: [
|
|
505
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Skeleton, { className: "h-6 w-24 mb-2" }),
|
|
506
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Skeleton, { className: "h-4 w-32" })
|
|
505
507
|
] })
|
|
506
508
|
] });
|
|
507
509
|
}
|
|
508
510
|
if (error) {
|
|
509
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
510
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
511
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
511
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.Card, { children: [
|
|
512
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
513
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.CardTitle, { children: "Usage This Month" }),
|
|
512
514
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
513
515
|
] }),
|
|
514
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
516
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
515
517
|
] });
|
|
516
518
|
}
|
|
517
519
|
const totalUsage = Object.values(summaries).reduce((acc, summary) => {
|
|
@@ -519,12 +521,12 @@ function BillingUsageSummaryCard({
|
|
|
519
521
|
}, 0);
|
|
520
522
|
const primaryMeter = meters.find((m) => _optionalChain([summaries, 'access', _17 => _17[m.id], 'optionalAccess', _18 => _18.aggregatedValue]));
|
|
521
523
|
const primarySummary = primaryMeter ? summaries[primaryMeter.id] : null;
|
|
522
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
523
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
524
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
524
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewDetailsClick, children: [
|
|
525
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
526
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.CardTitle, { children: "Usage This Month" }),
|
|
525
527
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
526
528
|
] }),
|
|
527
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
529
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.CardContent, { children: meters.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
528
530
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No meters" }),
|
|
529
531
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "No usage meters are configured" })
|
|
530
532
|
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
@@ -576,7 +578,7 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
|
|
|
576
578
|
const fetchSetupIntent = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
577
579
|
setLoading(true);
|
|
578
580
|
try {
|
|
579
|
-
const intent = await
|
|
581
|
+
const intent = await _chunk6OFANJTEjs.StripeCustomerService.createSetupIntent();
|
|
580
582
|
setSetupIntent(intent);
|
|
581
583
|
} catch (err) {
|
|
582
584
|
console.error("[PaymentMethodForm] Failed to create setup intent:", err);
|
|
@@ -614,7 +616,7 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
|
|
|
614
616
|
return;
|
|
615
617
|
}
|
|
616
618
|
if (setAsDefault && _optionalChain([confirmedSetupIntent, 'optionalAccess', _19 => _19.payment_method])) {
|
|
617
|
-
await
|
|
619
|
+
await _chunk6OFANJTEjs.StripeCustomerService.setDefaultPaymentMethod({
|
|
618
620
|
paymentMethodId: typeof confirmedSetupIntent.payment_method === "string" ? confirmedSetupIntent.payment_method : confirmedSetupIntent.payment_method.id
|
|
619
621
|
});
|
|
620
622
|
}
|
|
@@ -630,7 +632,7 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
|
|
|
630
632
|
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: "Loading payment form..." }) });
|
|
631
633
|
}
|
|
632
634
|
if (!setupIntent && error) {
|
|
633
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
635
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.AlertDescription, { children: error }) });
|
|
634
636
|
}
|
|
635
637
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: handleSubmit, className: "flex flex-col gap-y-4", children: [
|
|
636
638
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rounded-md border border-gray-300 p-3", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -653,13 +655,13 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
|
|
|
653
655
|
}
|
|
654
656
|
) }),
|
|
655
657
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
656
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
657
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
658
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Checkbox, { id: "setAsDefault", checked: setAsDefault, onCheckedChange: (checked) => setSetAsDefault(!!checked) }),
|
|
659
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Label, { htmlFor: "setAsDefault", className: "cursor-pointer font-normal", children: "Set as default payment method" })
|
|
658
660
|
] }),
|
|
659
|
-
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
661
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.AlertDescription, { children: error }) }),
|
|
660
662
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-x-2", children: [
|
|
661
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
662
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
663
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Button, { type: "button", variant: "outline", onClick: onCancel, disabled: isSubmitting || isLoading, children: "Cancel" }),
|
|
664
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Button, { type: "submit", disabled: !stripe || isSubmitting || isLoading, children: isSubmitting ? "Processing..." : "Add Card" })
|
|
663
665
|
] })
|
|
664
666
|
] });
|
|
665
667
|
}
|
|
@@ -675,10 +677,10 @@ function PaymentMethodEditor({ open, onOpenChange, onSuccess }) {
|
|
|
675
677
|
const handleCancel = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
676
678
|
onOpenChange(false);
|
|
677
679
|
}, "handleCancel");
|
|
678
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
679
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
680
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
681
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
680
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.DialogContent, { className: "max-w-md", children: [
|
|
681
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.DialogHeader, { children: [
|
|
682
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.DialogTitle, { children: "Add Payment Method" }),
|
|
683
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.DialogDescription, { children: "Add a new payment method to your account. Your card information is securely processed by Stripe." })
|
|
682
684
|
] }),
|
|
683
685
|
open && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodForm, { onSuccess: handleSuccess, onCancel: handleCancel })
|
|
684
686
|
] }) });
|
|
@@ -702,7 +704,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
702
704
|
_react.useEffect.call(void 0, () => {
|
|
703
705
|
const loadCustomer = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
704
706
|
try {
|
|
705
|
-
const fetchedCustomer = await
|
|
707
|
+
const fetchedCustomer = await _chunk6OFANJTEjs.StripeCustomerService.getCustomer();
|
|
706
708
|
setCustomer(fetchedCustomer);
|
|
707
709
|
} catch (error) {
|
|
708
710
|
console.error("[PaymentMethodCard] Failed to load customer:", error);
|
|
@@ -719,7 +721,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
719
721
|
const handleSetDefault = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
720
722
|
setLoading(true);
|
|
721
723
|
try {
|
|
722
|
-
await
|
|
724
|
+
await _chunk6OFANJTEjs.StripeCustomerService.setDefaultPaymentMethod({ paymentMethodId: paymentMethod.id });
|
|
723
725
|
onUpdate();
|
|
724
726
|
} catch (error) {
|
|
725
727
|
console.error("[PaymentMethodCard] Failed to set as default:", error);
|
|
@@ -730,7 +732,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
730
732
|
const handleRemove = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
731
733
|
setLoading(true);
|
|
732
734
|
try {
|
|
733
|
-
await
|
|
735
|
+
await _chunk6OFANJTEjs.StripeCustomerService.removePaymentMethod({ paymentMethodId: paymentMethod.id });
|
|
734
736
|
setShowRemoveDialog(false);
|
|
735
737
|
onUpdate();
|
|
736
738
|
} catch (error) {
|
|
@@ -739,16 +741,16 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
739
741
|
}
|
|
740
742
|
}, "handleRemove");
|
|
741
743
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
742
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
743
|
-
isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
744
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
744
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.Card, { className: "relative", children: [
|
|
745
|
+
isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Badge, { variant: "softGreen", className: "absolute end-2 top-2", children: "Default" }),
|
|
746
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.CardHeader, { className: "flex flex-row items-center justify-between pb-2", children: [
|
|
745
747
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
746
748
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-2xl", children: brandIcon }),
|
|
747
749
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium capitalize", children: brand })
|
|
748
750
|
] }),
|
|
749
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
750
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
751
|
-
|
|
751
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.DropdownMenu, { children: [
|
|
752
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.DropdownMenuTrigger, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
753
|
+
_chunkNFCXUAE6js.Button,
|
|
752
754
|
{
|
|
753
755
|
render: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {}),
|
|
754
756
|
nativeButton: false,
|
|
@@ -759,10 +761,10 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
759
761
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.MoreVertical, { className: "h-4 w-4" })
|
|
760
762
|
}
|
|
761
763
|
) }),
|
|
762
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
763
|
-
!isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
764
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.DropdownMenuContent, { align: "end", children: [
|
|
765
|
+
!isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.DropdownMenuItem, { onClick: handleSetDefault, disabled: loading, children: "Set as Default" }),
|
|
764
766
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
765
|
-
|
|
767
|
+
_chunkNFCXUAE6js.DropdownMenuItem,
|
|
766
768
|
{
|
|
767
769
|
onClick: () => setShowRemoveDialog(true),
|
|
768
770
|
disabled: loading,
|
|
@@ -773,7 +775,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
773
775
|
] })
|
|
774
776
|
] })
|
|
775
777
|
] }),
|
|
776
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
778
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-1", children: [
|
|
777
779
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-lg font-semibold", children: [
|
|
778
780
|
"\u2022\u2022\u2022\u2022 ",
|
|
779
781
|
last4
|
|
@@ -786,17 +788,17 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
786
788
|
] })
|
|
787
789
|
] }) })
|
|
788
790
|
] }),
|
|
789
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
790
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
791
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
792
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
791
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.AlertDialog, { open: showRemoveDialog, onOpenChange: setShowRemoveDialog, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.AlertDialogContent, { children: [
|
|
792
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.AlertDialogHeader, { children: [
|
|
793
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.AlertDialogTitle, { children: "Remove Payment Method" }),
|
|
794
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.AlertDialogDescription, { children: [
|
|
793
795
|
"Are you sure you want to remove this payment method? This action cannot be undone.",
|
|
794
796
|
isDefault && " This is your default payment method."
|
|
795
797
|
] })
|
|
796
798
|
] }),
|
|
797
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
798
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
799
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
799
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.AlertDialogFooter, { children: [
|
|
800
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.AlertDialogCancel, { disabled: loading, children: "Cancel" }),
|
|
801
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.AlertDialogAction, { onClick: handleRemove, disabled: loading, className: "bg-red-600 hover:bg-red-700", children: loading ? "Removing..." : "Remove" })
|
|
800
802
|
] })
|
|
801
803
|
] }) })
|
|
802
804
|
] });
|
|
@@ -819,7 +821,7 @@ function PaymentMethodsContainer() {
|
|
|
819
821
|
const loadPaymentMethods = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
820
822
|
setLoading(true);
|
|
821
823
|
try {
|
|
822
|
-
const fetchedPaymentMethods = await
|
|
824
|
+
const fetchedPaymentMethods = await _chunk6OFANJTEjs.StripeCustomerService.listPaymentMethods();
|
|
823
825
|
setPaymentMethods(fetchedPaymentMethods);
|
|
824
826
|
} catch (error) {
|
|
825
827
|
console.error("[PaymentMethodsContainer] Failed to load payment methods:", error);
|
|
@@ -839,14 +841,14 @@ function PaymentMethodsContainer() {
|
|
|
839
841
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8" }),
|
|
840
842
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: "Payment Methods" })
|
|
841
843
|
] }),
|
|
842
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
844
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Button, { onClick: () => setShowAddPaymentMethod(true), children: "Add Payment Method" })
|
|
843
845
|
] }),
|
|
844
846
|
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: [
|
|
845
847
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-16 w-16 text-muted-foreground" }),
|
|
846
848
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
847
849
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "mb-2 text-sm font-medium", children: "No payment methods" }),
|
|
848
850
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mb-4 text-muted-foreground", children: "Add a payment method to enable subscriptions and secure checkout." }),
|
|
849
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
851
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Button, { onClick: () => setShowAddPaymentMethod(true), children: "Add Your First Card" })
|
|
850
852
|
] })
|
|
851
853
|
] }),
|
|
852
854
|
paymentMethods.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodsList, { paymentMethods, onUpdate: loadPaymentMethods }),
|
|
@@ -914,7 +916,7 @@ var statusConfig = {
|
|
|
914
916
|
};
|
|
915
917
|
function InvoiceStatusBadge({ status }) {
|
|
916
918
|
const config = statusConfig[status] || statusConfig["draft" /* DRAFT */];
|
|
917
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
919
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Badge, { variant: config.variant, children: config.label });
|
|
918
920
|
}
|
|
919
921
|
_chunk7QVYU63Ejs.__name.call(void 0, InvoiceStatusBadge, "InvoiceStatusBadge");
|
|
920
922
|
|
|
@@ -945,13 +947,13 @@ function InvoiceDetails({
|
|
|
945
947
|
return invoice.stripeInvoiceId.slice(-8);
|
|
946
948
|
}, "getInvoiceNumber");
|
|
947
949
|
const productName = _optionalChain([invoice, 'access', _29 => _29.subscription, 'optionalAccess', _30 => _30.price, 'optionalAccess', _31 => _31.product, 'optionalAccess', _32 => _32.name]) || "Subscription";
|
|
948
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
949
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
950
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
950
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.DialogContent, { className: "max-w-2xl", children: [
|
|
951
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.DialogHeader, { children: [
|
|
952
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.DialogTitle, { children: [
|
|
951
953
|
"Invoice ",
|
|
952
954
|
getInvoiceNumber()
|
|
953
955
|
] }),
|
|
954
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
956
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.DialogDescription, { children: formatDate3(invoice.periodStart) })
|
|
955
957
|
] }),
|
|
956
958
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
957
959
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
@@ -989,42 +991,42 @@ function InvoiceDetails({
|
|
|
989
991
|
] }) }),
|
|
990
992
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "tbody", { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "tr", { className: "border-t", children: [
|
|
991
993
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "td", { className: "p-3", children: productName }),
|
|
992
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "td", { className: "p-3 text-end", children:
|
|
994
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "td", { className: "p-3 text-end", children: _chunkNFCXUAE6js.formatCurrency.call(void 0, invoice.subtotal, invoice.currency) })
|
|
993
995
|
] }) })
|
|
994
996
|
] }) })
|
|
995
997
|
] }),
|
|
996
998
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2 border-t pt-4", children: [
|
|
997
999
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
998
1000
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: "Subtotal:" }),
|
|
999
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children:
|
|
1001
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children: _chunkNFCXUAE6js.formatCurrency.call(void 0, invoice.subtotal, invoice.currency) })
|
|
1000
1002
|
] }),
|
|
1001
1003
|
invoice.tax !== void 0 && invoice.tax > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1002
1004
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: "Tax:" }),
|
|
1003
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children:
|
|
1005
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children: _chunkNFCXUAE6js.formatCurrency.call(void 0, invoice.tax, invoice.currency) })
|
|
1004
1006
|
] }),
|
|
1005
1007
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between text-lg font-semibold border-t pt-2", children: [
|
|
1006
1008
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Total:" }),
|
|
1007
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children:
|
|
1009
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _chunkNFCXUAE6js.formatCurrency.call(void 0, invoice.total, invoice.currency) })
|
|
1008
1010
|
] }),
|
|
1009
1011
|
invoice.amountPaid > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1010
1012
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: "Amount Paid:" }),
|
|
1011
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-success", children:
|
|
1013
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-success", children: _chunkNFCXUAE6js.formatCurrency.call(void 0, invoice.amountPaid, invoice.currency) })
|
|
1012
1014
|
] }),
|
|
1013
1015
|
invoice.amountRemaining > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1014
1016
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: "Amount Due:" }),
|
|
1015
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-destructive", children:
|
|
1017
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-destructive", children: _chunkNFCXUAE6js.formatCurrency.call(void 0, invoice.amountRemaining, invoice.currency) })
|
|
1016
1018
|
] })
|
|
1017
1019
|
] }),
|
|
1018
1020
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2 pt-4 border-t", children: [
|
|
1019
|
-
invoice.stripePdfUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1021
|
+
invoice.stripePdfUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.Button, { variant: "outline", onClick: handleDownloadPDF, children: [
|
|
1020
1022
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Download, { className: "me-2 h-4 w-4" }),
|
|
1021
1023
|
"Download PDF"
|
|
1022
1024
|
] }),
|
|
1023
|
-
invoice.status === "open" /* OPEN */ && invoice.attempted && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1025
|
+
invoice.status === "open" /* OPEN */ && invoice.attempted && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.Button, { variant: "default", onClick: handleRetryPayment, children: [
|
|
1024
1026
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RefreshCw, { className: "me-2 h-4 w-4" }),
|
|
1025
1027
|
"Retry Payment"
|
|
1026
1028
|
] }),
|
|
1027
|
-
invoice.stripeHostedInvoiceUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1029
|
+
invoice.stripeHostedInvoiceUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.Button, { variant: "outline", onClick: handleViewInStripe, children: [
|
|
1028
1030
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ExternalLink, { className: "me-2 h-4 w-4" }),
|
|
1029
1031
|
"View in Stripe"
|
|
1030
1032
|
] })
|
|
@@ -1048,30 +1050,30 @@ function InvoicesList({ invoices, onInvoicesChange }) {
|
|
|
1048
1050
|
return invoice.stripeInvoiceId.slice(-8);
|
|
1049
1051
|
}, "getInvoiceNumber");
|
|
1050
1052
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1051
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1052
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1053
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1054
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1055
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1056
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1057
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1053
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.Table, { children: [
|
|
1054
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.TableRow, { children: [
|
|
1055
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.TableHead, { children: "Invoice #" }),
|
|
1056
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.TableHead, { children: "Date" }),
|
|
1057
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.TableHead, { children: "Status" }),
|
|
1058
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.TableHead, { className: "text-end", children: "Amount" }),
|
|
1059
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.TableHead, { children: "Period" })
|
|
1058
1060
|
] }) }),
|
|
1059
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1061
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.TableBody, { children: invoices.map((invoice) => {
|
|
1060
1062
|
const invoiceNumber = getInvoiceNumber(invoice);
|
|
1061
1063
|
const date = formatDate3(invoice.periodStart);
|
|
1062
|
-
const amount =
|
|
1064
|
+
const amount = _chunkNFCXUAE6js.formatCurrency.call(void 0, invoice.total, invoice.currency);
|
|
1063
1065
|
const period = `${formatDate3(invoice.periodStart)} - ${formatDate3(invoice.periodEnd)}`;
|
|
1064
1066
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1065
|
-
|
|
1067
|
+
_chunkNFCXUAE6js.TableRow,
|
|
1066
1068
|
{
|
|
1067
1069
|
onClick: () => handleRowClick(invoice),
|
|
1068
1070
|
className: "cursor-pointer hover:bg-muted/50",
|
|
1069
1071
|
children: [
|
|
1070
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1071
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1072
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1073
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1074
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1072
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.TableCell, { className: "font-medium", children: invoiceNumber }),
|
|
1073
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.TableCell, { className: "text-muted-foreground text-xs", children: date }),
|
|
1074
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InvoiceStatusBadge, { status: invoice.status }) }),
|
|
1075
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.TableCell, { className: "text-end font-medium", children: amount }),
|
|
1076
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.TableCell, { className: "text-muted-foreground text-xs", children: period })
|
|
1075
1077
|
]
|
|
1076
1078
|
},
|
|
1077
1079
|
invoice.id
|
|
@@ -1104,7 +1106,7 @@ function InvoicesContainer() {
|
|
|
1104
1106
|
setLoading(true);
|
|
1105
1107
|
try {
|
|
1106
1108
|
const params = statusFilter !== "all" ? { status: statusFilter } : void 0;
|
|
1107
|
-
const data = await
|
|
1109
|
+
const data = await _chunk6OFANJTEjs.StripeInvoiceService.listInvoices(params);
|
|
1108
1110
|
setInvoices(data);
|
|
1109
1111
|
} catch (error) {
|
|
1110
1112
|
console.error("[InvoicesContainer] Failed to load invoices:", error);
|
|
@@ -1120,12 +1122,12 @@ function InvoicesContainer() {
|
|
|
1120
1122
|
setStatusFilter(value);
|
|
1121
1123
|
}, "handleFilterChange");
|
|
1122
1124
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-4", children: [
|
|
1123
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1124
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1125
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1126
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1127
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1128
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1125
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Tabs, { value: statusFilter, onValueChange: handleFilterChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.TabsList, { children: [
|
|
1126
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.TabsTrigger, { value: "all", children: "All" }),
|
|
1127
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.TabsTrigger, { value: "paid" /* PAID */, children: "Paid" }),
|
|
1128
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.TabsTrigger, { value: "open" /* OPEN */, children: "Open" }),
|
|
1129
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.TabsTrigger, { value: "void" /* VOID */, children: "Void" }),
|
|
1130
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.TabsTrigger, { value: "uncollectible" /* UNCOLLECTIBLE */, children: "Uncollectible" })
|
|
1129
1131
|
] }) }),
|
|
1130
1132
|
loading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-center py-8 text-muted-foreground", children: "Loading invoices..." }),
|
|
1131
1133
|
!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: [
|
|
@@ -1172,7 +1174,7 @@ function CancelSubscriptionDialog({
|
|
|
1172
1174
|
const onSubmit = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async (_values) => {
|
|
1173
1175
|
setIsSubmitting(true);
|
|
1174
1176
|
try {
|
|
1175
|
-
await
|
|
1177
|
+
await _chunk6OFANJTEjs.StripeSubscriptionService.cancelSubscription({
|
|
1176
1178
|
id: subscription.id,
|
|
1177
1179
|
cancelImmediately: false
|
|
1178
1180
|
});
|
|
@@ -1185,19 +1187,19 @@ function CancelSubscriptionDialog({
|
|
|
1185
1187
|
}
|
|
1186
1188
|
}, "onSubmit");
|
|
1187
1189
|
const periodEndDate = formatDate3(subscription.currentPeriodEnd);
|
|
1188
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1189
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1190
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1191
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1190
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.DialogContent, { className: "max-w-md", children: [
|
|
1191
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.DialogHeader, { children: [
|
|
1192
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.DialogTitle, { children: "Cancel Subscription" }),
|
|
1193
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.DialogDescription, { children: "Are you sure you want to cancel this subscription? This action cannot be undone." })
|
|
1192
1194
|
] }),
|
|
1193
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1195
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-col gap-y-4", children: [
|
|
1194
1196
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-primary/10 border-primary/30 text-foreground rounded-lg border p-3 text-sm", children: [
|
|
1195
1197
|
"Your subscription will remain active until ",
|
|
1196
1198
|
periodEndDate,
|
|
1197
1199
|
". You can continue using the service until then."
|
|
1198
1200
|
] }),
|
|
1199
1201
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1200
|
-
|
|
1202
|
+
_chunkNFCXUAE6js.FormTextarea,
|
|
1201
1203
|
{
|
|
1202
1204
|
form,
|
|
1203
1205
|
id: "reason",
|
|
@@ -1207,8 +1209,8 @@ function CancelSubscriptionDialog({
|
|
|
1207
1209
|
}
|
|
1208
1210
|
),
|
|
1209
1211
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-x-2 justify-end pt-2", children: [
|
|
1210
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1211
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1212
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Button, { type: "button", variant: "outline", onClick: () => onOpenChange(false), disabled: isSubmitting, children: "Keep Subscription" }),
|
|
1213
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Button, { type: "submit", variant: "destructive", disabled: isSubmitting, children: isSubmitting ? "Canceling..." : "Confirm Cancellation" })
|
|
1212
1214
|
] })
|
|
1213
1215
|
] }) })
|
|
1214
1216
|
] }) });
|
|
@@ -1257,7 +1259,7 @@ var cancelingConfig = {
|
|
|
1257
1259
|
};
|
|
1258
1260
|
function SubscriptionStatusBadge({ status, cancelAtPeriodEnd }) {
|
|
1259
1261
|
const config = cancelAtPeriodEnd ? cancelingConfig : statusConfig2[status] || statusConfig2["canceled" /* CANCELED */];
|
|
1260
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1262
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Badge, { variant: config.variant, children: config.label });
|
|
1261
1263
|
}
|
|
1262
1264
|
_chunk7QVYU63Ejs.__name.call(void 0, SubscriptionStatusBadge, "SubscriptionStatusBadge");
|
|
1263
1265
|
|
|
@@ -1284,7 +1286,7 @@ function formatPlanName2(price) {
|
|
|
1284
1286
|
_chunk7QVYU63Ejs.__name.call(void 0, formatPlanName2, "formatPlanName");
|
|
1285
1287
|
function formatBillingAmount(price) {
|
|
1286
1288
|
if (!_optionalChain([price, 'optionalAccess', _37 => _37.unitAmount])) return "N/A";
|
|
1287
|
-
return
|
|
1289
|
+
return _chunkNFCXUAE6js.formatCurrency.call(void 0, price.unitAmount, price.currency);
|
|
1288
1290
|
}
|
|
1289
1291
|
_chunk7QVYU63Ejs.__name.call(void 0, formatBillingAmount, "formatBillingAmount");
|
|
1290
1292
|
function SubscriptionDetails({
|
|
@@ -1299,7 +1301,7 @@ function SubscriptionDetails({
|
|
|
1299
1301
|
const handlePause = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1300
1302
|
setIsProcessing(true);
|
|
1301
1303
|
try {
|
|
1302
|
-
await
|
|
1304
|
+
await _chunk6OFANJTEjs.StripeSubscriptionService.pauseSubscription({ subscriptionId: subscription.id });
|
|
1303
1305
|
onSubscriptionChange();
|
|
1304
1306
|
} catch (error) {
|
|
1305
1307
|
console.error("[SubscriptionDetails] Failed to pause subscription:", error);
|
|
@@ -1310,7 +1312,7 @@ function SubscriptionDetails({
|
|
|
1310
1312
|
const handleResume = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1311
1313
|
setIsProcessing(true);
|
|
1312
1314
|
try {
|
|
1313
|
-
await
|
|
1315
|
+
await _chunk6OFANJTEjs.StripeSubscriptionService.resumeSubscription({ subscriptionId: subscription.id });
|
|
1314
1316
|
onSubscriptionChange();
|
|
1315
1317
|
} catch (error) {
|
|
1316
1318
|
console.error("[SubscriptionDetails] Failed to resume subscription:", error);
|
|
@@ -1320,7 +1322,7 @@ function SubscriptionDetails({
|
|
|
1320
1322
|
}, "handleResume");
|
|
1321
1323
|
const handleManageViaPortal = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1322
1324
|
try {
|
|
1323
|
-
const { url } = await
|
|
1325
|
+
const { url } = await _chunk6OFANJTEjs.StripeCustomerService.createPortalSession();
|
|
1324
1326
|
window.open(url, "_blank");
|
|
1325
1327
|
} catch (error) {
|
|
1326
1328
|
console.error("[SubscriptionDetails] Failed to create portal session:", error);
|
|
@@ -1330,10 +1332,10 @@ function SubscriptionDetails({
|
|
|
1330
1332
|
const canResume = subscription.status === "paused" /* PAUSED */;
|
|
1331
1333
|
const canCancel = subscription.status === "active" /* ACTIVE */ || subscription.status === "trialing" /* TRIALING */ || subscription.status === "paused" /* PAUSED */;
|
|
1332
1334
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1333
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1334
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1335
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1336
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1335
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.DialogContent, { className: "max-w-2xl", children: [
|
|
1336
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.DialogHeader, { children: [
|
|
1337
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.DialogTitle, { children: "Subscription Details" }),
|
|
1338
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.DialogDescription, { children: "View and manage your subscription" })
|
|
1337
1339
|
] }),
|
|
1338
1340
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
1339
1341
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
@@ -1375,11 +1377,11 @@ function SubscriptionDetails({
|
|
|
1375
1377
|
"."
|
|
1376
1378
|
] }) }),
|
|
1377
1379
|
/* @__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
|
-
canPause && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1380
|
-
canResume && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1381
|
-
canCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1382
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1380
|
+
onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Button, { variant: "default", onClick: () => onChangePlan(subscription), children: "Change Plan" }),
|
|
1381
|
+
canPause && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Button, { variant: "outline", onClick: handlePause, disabled: isProcessing, children: isProcessing ? "Pausing..." : "Pause" }),
|
|
1382
|
+
canResume && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Button, { variant: "outline", onClick: handleResume, disabled: isProcessing, children: isProcessing ? "Resuming..." : "Resume" }),
|
|
1383
|
+
canCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Button, { variant: "destructive", onClick: () => setShowCancel(true), children: "Cancel" }),
|
|
1384
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Button, { variant: "outline", onClick: handleManageViaPortal, children: "Manage via Portal" })
|
|
1383
1385
|
] })
|
|
1384
1386
|
] })
|
|
1385
1387
|
] }) }),
|
|
@@ -1426,36 +1428,36 @@ function SubscriptionsList({ subscriptions, onSubscriptionsChange, onChangePlan
|
|
|
1426
1428
|
setSelectedSub(subscription);
|
|
1427
1429
|
}, "handleRowClick");
|
|
1428
1430
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1429
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1430
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1431
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1432
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1433
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1434
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1435
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1431
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.Table, { children: [
|
|
1432
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.TableRow, { children: [
|
|
1433
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.TableHead, { children: "Status" }),
|
|
1434
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.TableHead, { children: "Plan" }),
|
|
1435
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.TableHead, { children: "Period" }),
|
|
1436
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.TableHead, { className: "text-end", children: "Amount" }),
|
|
1437
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.TableHead, { className: "text-end", children: "Actions" })
|
|
1436
1438
|
] }) }),
|
|
1437
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1439
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.TableBody, { children: subscriptions.map((subscription) => {
|
|
1438
1440
|
const price = subscription.price;
|
|
1439
|
-
const amount = _optionalChain([price, 'optionalAccess', _42 => _42.unitAmount]) ?
|
|
1441
|
+
const amount = _optionalChain([price, 'optionalAccess', _42 => _42.unitAmount]) ? _chunkNFCXUAE6js.formatCurrency.call(void 0, price.unitAmount, price.currency) : "0";
|
|
1440
1442
|
const period = `${formatDate3(subscription.currentPeriodStart)} - ${formatDate3(subscription.currentPeriodEnd)}`;
|
|
1441
1443
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1442
|
-
|
|
1444
|
+
_chunkNFCXUAE6js.TableRow,
|
|
1443
1445
|
{
|
|
1444
1446
|
onClick: () => handleRowClick(subscription),
|
|
1445
1447
|
className: "cursor-pointer hover:bg-muted/50",
|
|
1446
1448
|
children: [
|
|
1447
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1449
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1448
1450
|
SubscriptionStatusBadge,
|
|
1449
1451
|
{
|
|
1450
1452
|
status: subscription.status,
|
|
1451
1453
|
cancelAtPeriodEnd: subscription.cancelAtPeriodEnd
|
|
1452
1454
|
}
|
|
1453
1455
|
) }),
|
|
1454
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1455
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1456
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1457
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1458
|
-
|
|
1456
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.TableCell, { className: "font-medium", children: formatPlanName3(price) }),
|
|
1457
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.TableCell, { className: "text-muted-foreground text-sm", children: period }),
|
|
1458
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.TableCell, { className: "text-end font-medium", children: amount }),
|
|
1459
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.TableCell, { className: "text-end", children: (subscription.status === "active" /* ACTIVE */ || subscription.status === "trialing" /* TRIALING */) && onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1460
|
+
_chunkNFCXUAE6js.Button,
|
|
1459
1461
|
{
|
|
1460
1462
|
size: "sm",
|
|
1461
1463
|
variant: "outline",
|
|
@@ -1500,7 +1502,7 @@ function SubscriptionsContainer({ onOpenWizard, hasActiveRecurringSubscription }
|
|
|
1500
1502
|
const loadSubscriptions = _react.useCallback.call(void 0, async () => {
|
|
1501
1503
|
setLoading(true);
|
|
1502
1504
|
try {
|
|
1503
|
-
const fetchedSubscriptions = await
|
|
1505
|
+
const fetchedSubscriptions = await _chunk6OFANJTEjs.StripeSubscriptionService.listSubscriptions();
|
|
1504
1506
|
setSubscriptions(fetchedSubscriptions);
|
|
1505
1507
|
} catch (error) {
|
|
1506
1508
|
console.error("[SubscriptionsContainer] Failed to load subscriptions:", error);
|
|
@@ -1523,7 +1525,7 @@ function SubscriptionsContainer({ onOpenWizard, hasActiveRecurringSubscription }
|
|
|
1523
1525
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8" }),
|
|
1524
1526
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: "Subscriptions" })
|
|
1525
1527
|
] }),
|
|
1526
|
-
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1528
|
+
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _43 => _43()]), children: hasActiveRecurringSubscription ? "Purchase Add-ons" : "Subscribe to a Plan" })
|
|
1527
1529
|
] }),
|
|
1528
1530
|
criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BillingAlertBanner, { subscription }, subscription.id)),
|
|
1529
1531
|
subscriptions.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col items-center justify-center py-12 space-y-4", children: [
|
|
@@ -1531,7 +1533,7 @@ function SubscriptionsContainer({ onOpenWizard, hasActiveRecurringSubscription }
|
|
|
1531
1533
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
1532
1534
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium mb-2", children: "No Active Subscriptions" }),
|
|
1533
1535
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground mb-6", children: "Choose a subscription plan to get started with our services." }),
|
|
1534
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1536
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _44 => _44()]), children: "Subscribe to a Plan" })
|
|
1535
1537
|
] })
|
|
1536
1538
|
] }),
|
|
1537
1539
|
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -1552,9 +1554,9 @@ function IntervalToggle({ value, onChange, hasMonthly, hasYearly }) {
|
|
|
1552
1554
|
if (!hasMonthly || !hasYearly) {
|
|
1553
1555
|
return null;
|
|
1554
1556
|
}
|
|
1555
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1556
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1557
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1557
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Tabs, { value, onValueChange: (v) => onChange(v), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.TabsList, { children: [
|
|
1558
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.TabsTrigger, { value: "month", children: "Monthly" }),
|
|
1559
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.TabsTrigger, { value: "year", children: "Yearly" })
|
|
1558
1560
|
] }) });
|
|
1559
1561
|
}
|
|
1560
1562
|
_chunk7QVYU63Ejs.__name.call(void 0, IntervalToggle, "IntervalToggle");
|
|
@@ -1572,8 +1574,8 @@ function PricingCard({
|
|
|
1572
1574
|
}) {
|
|
1573
1575
|
const description = price.description || price.nickname || "Standard";
|
|
1574
1576
|
const features = price.features || [];
|
|
1575
|
-
const formattedPrice =
|
|
1576
|
-
const interval =
|
|
1577
|
+
const formattedPrice = _chunkNFCXUAE6js.formatCurrency.call(void 0, price.unitAmount, price.currency);
|
|
1578
|
+
const interval = _chunkNFCXUAE6js.formatInterval.call(void 0, price);
|
|
1577
1579
|
const handleKeyDown = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (e) => {
|
|
1578
1580
|
if ((e.key === "Enter" || e.key === " ") && !isDisabled && !isCurrentPlan) {
|
|
1579
1581
|
e.preventDefault();
|
|
@@ -1586,7 +1588,7 @@ function PricingCard({
|
|
|
1586
1588
|
}
|
|
1587
1589
|
}, "handleClick");
|
|
1588
1590
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1589
|
-
|
|
1591
|
+
_chunkNFCXUAE6js.Card,
|
|
1590
1592
|
{
|
|
1591
1593
|
role: "radio",
|
|
1592
1594
|
"aria-checked": isSelected,
|
|
@@ -1594,7 +1596,7 @@ function PricingCard({
|
|
|
1594
1596
|
tabIndex: isDisabled ? -1 : 0,
|
|
1595
1597
|
onKeyDown: handleKeyDown,
|
|
1596
1598
|
onClick: handleClick,
|
|
1597
|
-
className:
|
|
1599
|
+
className: _chunk6OFANJTEjs.cn.call(void 0,
|
|
1598
1600
|
"relative cursor-pointer transition-all duration-200 flex flex-col h-full",
|
|
1599
1601
|
"focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
1600
1602
|
isCurrentPlan && "bg-muted/30",
|
|
@@ -1604,9 +1606,9 @@ function PricingCard({
|
|
|
1604
1606
|
isLoading && "pointer-events-none"
|
|
1605
1607
|
),
|
|
1606
1608
|
children: [
|
|
1607
|
-
isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1608
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1609
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1609
|
+
isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Badge, { variant: "secondary", className: "absolute top-2 end-2", children: "Current" }),
|
|
1610
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.CardHeader, { className: "pb-2", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium", children: description }) }),
|
|
1611
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.CardContent, { className: "pb-4 grow", children: [
|
|
1610
1612
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mb-4", children: [
|
|
1611
1613
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-3xl font-bold", children: formattedPrice }),
|
|
1612
1614
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground ms-1", children: interval })
|
|
@@ -1616,8 +1618,8 @@ function PricingCard({
|
|
|
1616
1618
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-muted-foreground", children: feature })
|
|
1617
1619
|
] }, index)) })
|
|
1618
1620
|
] }),
|
|
1619
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1620
|
-
|
|
1621
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.CardFooter, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1622
|
+
_chunkNFCXUAE6js.Button,
|
|
1621
1623
|
{
|
|
1622
1624
|
variant: isCurrentPlan ? "secondary" : isSelected ? "default" : "outline",
|
|
1623
1625
|
className: "w-full",
|
|
@@ -1645,7 +1647,7 @@ function ProductPricingRow({
|
|
|
1645
1647
|
return null;
|
|
1646
1648
|
}
|
|
1647
1649
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-3", children: [
|
|
1648
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1650
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.SectionHeader, { children: product.name }),
|
|
1649
1651
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1650
1652
|
"div",
|
|
1651
1653
|
{
|
|
@@ -1745,15 +1747,15 @@ function ProductPricingList({
|
|
|
1745
1747
|
_chunk7QVYU63Ejs.__name.call(void 0, ProductPricingList, "ProductPricingList");
|
|
1746
1748
|
function ProductPricingListSkeleton() {
|
|
1747
1749
|
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: [
|
|
1748
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1750
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Skeleton, { className: "h-6 w-32" }),
|
|
1749
1751
|
/* @__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: [
|
|
1750
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1751
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1752
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Skeleton, { className: "h-6 w-24" }),
|
|
1753
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Skeleton, { className: "h-8 w-32" }),
|
|
1752
1754
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
1753
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1754
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1755
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Skeleton, { className: "h-4 w-full" }),
|
|
1756
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Skeleton, { className: "h-4 w-3/4" })
|
|
1755
1757
|
] }),
|
|
1756
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1758
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Skeleton, { className: "h-10 w-full" })
|
|
1757
1759
|
] }, cardIndex)) })
|
|
1758
1760
|
] }, rowIndex)) });
|
|
1759
1761
|
}
|
|
@@ -1767,18 +1769,18 @@ function ProrationPreview({ preview }) {
|
|
|
1767
1769
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
1768
1770
|
preview.lineItems.map((item, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between text-sm", children: [
|
|
1769
1771
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground", children: item.description }),
|
|
1770
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `font-medium ${item.amount < 0 ? "text-success" : "text-foreground"}`, children:
|
|
1772
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `font-medium ${item.amount < 0 ? "text-success" : "text-foreground"}`, children: _chunkNFCXUAE6js.formatCurrency.call(void 0, item.amount, preview.currency) })
|
|
1771
1773
|
] }, index)),
|
|
1772
1774
|
/* @__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: [
|
|
1773
1775
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-foreground", children: "Net Due Today" }),
|
|
1774
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-foreground", children:
|
|
1776
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-foreground", children: _chunkNFCXUAE6js.formatCurrency.call(void 0, preview.immediateCharge, preview.currency) })
|
|
1775
1777
|
] }) }),
|
|
1776
1778
|
preview.lineItems.length > 0 && preview.lineItems[0].period && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-muted-foreground mt-2 text-xs", children: [
|
|
1777
1779
|
"Next invoice on ",
|
|
1778
1780
|
formatDate3(preview.lineItems[0].period.end),
|
|
1779
1781
|
" for",
|
|
1780
1782
|
" ",
|
|
1781
|
-
|
|
1783
|
+
_chunkNFCXUAE6js.formatCurrency.call(void 0, preview.amountDue, preview.currency)
|
|
1782
1784
|
] })
|
|
1783
1785
|
] })
|
|
1784
1786
|
] });
|
|
@@ -1800,16 +1802,16 @@ function SubscriptionConfirmation({ price, isLoading, onConfirm, onCancel }) {
|
|
|
1800
1802
|
productDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-sm text-muted-foreground", children: productDescription })
|
|
1801
1803
|
] }),
|
|
1802
1804
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-lg font-semibold", children: [
|
|
1803
|
-
|
|
1804
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-normal text-muted-foreground", children:
|
|
1805
|
+
_chunkNFCXUAE6js.formatCurrency.call(void 0, price.unitAmount, price.currency),
|
|
1806
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-normal text-muted-foreground", children: _chunkNFCXUAE6js.formatInterval.call(void 0, price) })
|
|
1805
1807
|
] }),
|
|
1806
1808
|
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: [
|
|
1807
1809
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Check, { className: "h-4 w-4 text-primary" }),
|
|
1808
1810
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: feature })
|
|
1809
1811
|
] }, index)) }),
|
|
1810
1812
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-3 pt-2 border-t border-accent/30", children: [
|
|
1811
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1812
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1813
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Button, { variant: "outline", onClick: onCancel, disabled: isLoading, children: "Cancel" }),
|
|
1814
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Button, { onClick: onConfirm, disabled: isLoading, children: isLoading ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1813
1815
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "h-4 w-4 animate-spin me-2" }),
|
|
1814
1816
|
"Processing..."
|
|
1815
1817
|
] }) : "Subscribe" })
|
|
@@ -1880,7 +1882,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
1880
1882
|
onCloseRef.current = onClose;
|
|
1881
1883
|
const checkPaymentMethod = _react.useCallback.call(void 0, async () => {
|
|
1882
1884
|
try {
|
|
1883
|
-
const methods = await
|
|
1885
|
+
const methods = await _chunk6OFANJTEjs.StripeCustomerService.listPaymentMethods();
|
|
1884
1886
|
dispatch({ type: "SET_HAS_PAYMENT_METHOD", hasMethod: methods.length > 0 });
|
|
1885
1887
|
} catch (error) {
|
|
1886
1888
|
console.error("[useSubscriptionWizard] Failed to check payment methods:", error);
|
|
@@ -1904,7 +1906,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
1904
1906
|
const isTrialUpgrade = _optionalChain([subscription, 'optionalAccess', _55 => _55.status]) === "trialing" /* TRIALING */;
|
|
1905
1907
|
dispatch({ type: "SET_IS_TRIAL_SUBSCRIPTION", isTrial: isTrialUpgrade });
|
|
1906
1908
|
if (isTrialUpgrade && !state.hasPaymentMethod) {
|
|
1907
|
-
const methods = await
|
|
1909
|
+
const methods = await _chunk6OFANJTEjs.StripeCustomerService.listPaymentMethods();
|
|
1908
1910
|
if (methods.length === 0) {
|
|
1909
1911
|
dispatch({ type: "SET_STEP", step: "payment-method" });
|
|
1910
1912
|
dispatch({
|
|
@@ -1915,7 +1917,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
1915
1917
|
}
|
|
1916
1918
|
}
|
|
1917
1919
|
if (subscription && state.selectedPrice.id !== _optionalChain([subscription, 'access', _56 => _56.price, 'optionalAccess', _57 => _57.id])) {
|
|
1918
|
-
const preview = await
|
|
1920
|
+
const preview = await _chunk6OFANJTEjs.StripeSubscriptionService.getProrationPreview({
|
|
1919
1921
|
subscriptionId: subscription.id,
|
|
1920
1922
|
newPriceId: state.selectedPrice.id
|
|
1921
1923
|
});
|
|
@@ -1940,14 +1942,14 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
1940
1942
|
newPriceId: state.selectedPrice.id,
|
|
1941
1943
|
promotionCode: _optionalChain([state, 'access', _59 => _59.promotionCode, 'optionalAccess', _60 => _60.promotionCodeId])
|
|
1942
1944
|
};
|
|
1943
|
-
await
|
|
1945
|
+
await _chunk6OFANJTEjs.StripeSubscriptionService.changePlan(changePlanParams);
|
|
1944
1946
|
} else {
|
|
1945
1947
|
const createParams = {
|
|
1946
1948
|
id: _uuid.v4.call(void 0, ),
|
|
1947
1949
|
priceId: state.selectedPrice.id,
|
|
1948
1950
|
promotionCode: _optionalChain([state, 'access', _61 => _61.promotionCode, 'optionalAccess', _62 => _62.promotionCodeId])
|
|
1949
1951
|
};
|
|
1950
|
-
await
|
|
1952
|
+
await _chunk6OFANJTEjs.StripeSubscriptionService.createSubscription(createParams);
|
|
1951
1953
|
}
|
|
1952
1954
|
onSuccessRef.current();
|
|
1953
1955
|
onCloseRef.current();
|
|
@@ -1981,7 +1983,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
1981
1983
|
dispatch({ type: "SET_VALIDATING_PROMO_CODE", isValidating: true });
|
|
1982
1984
|
dispatch({ type: "SET_PROMO_CODE_ERROR", error: null });
|
|
1983
1985
|
try {
|
|
1984
|
-
const result = await
|
|
1986
|
+
const result = await _chunk6OFANJTEjs.StripePromotionCodeService.validatePromotionCode({
|
|
1985
1987
|
code,
|
|
1986
1988
|
stripePriceId: _optionalChain([state, 'access', _70 => _70.selectedPrice, 'optionalAccess', _71 => _71.id])
|
|
1987
1989
|
});
|
|
@@ -2088,7 +2090,7 @@ function WizardStepPlanSelection({
|
|
|
2088
2090
|
_react.useEffect.call(void 0, () => {
|
|
2089
2091
|
const loadProducts = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2090
2092
|
try {
|
|
2091
|
-
const fetchedProducts = await
|
|
2093
|
+
const fetchedProducts = await _chunk6OFANJTEjs.StripeProductService.listProducts({ active: true });
|
|
2092
2094
|
setProducts(fetchedProducts);
|
|
2093
2095
|
} catch (error) {
|
|
2094
2096
|
console.error("[WizardStepPlanSelection] Failed to load products:", error);
|
|
@@ -2139,7 +2141,7 @@ function WizardStepPlanSelection({
|
|
|
2139
2141
|
onSelectPrice: handleSelectPrice
|
|
2140
2142
|
}
|
|
2141
2143
|
),
|
|
2142
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex justify-end pt-4 border-t", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2144
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex justify-end pt-4 border-t", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Button, { onClick: onNext, disabled: !selectedPrice || isProcessing, children: isProcessing ? "Loading..." : "Next: Review" }) })
|
|
2143
2145
|
] });
|
|
2144
2146
|
}
|
|
2145
2147
|
_chunk7QVYU63Ejs.__name.call(void 0, WizardStepPlanSelection, "WizardStepPlanSelection");
|
|
@@ -2200,7 +2202,7 @@ function PromoCodeInput({
|
|
|
2200
2202
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success text-sm", children: formatDiscount(appliedCode) })
|
|
2201
2203
|
] }),
|
|
2202
2204
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2203
|
-
|
|
2205
|
+
_chunkNFCXUAE6js.Button,
|
|
2204
2206
|
{
|
|
2205
2207
|
variant: "ghost",
|
|
2206
2208
|
size: "sm",
|
|
@@ -2217,7 +2219,7 @@ function PromoCodeInput({
|
|
|
2217
2219
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
2218
2220
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
|
|
2219
2221
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2220
|
-
|
|
2222
|
+
_chunkNFCXUAE6js.Input,
|
|
2221
2223
|
{
|
|
2222
2224
|
placeholder: "Enter promo code",
|
|
2223
2225
|
value: code,
|
|
@@ -2227,7 +2229,7 @@ function PromoCodeInput({
|
|
|
2227
2229
|
className: "flex-1"
|
|
2228
2230
|
}
|
|
2229
2231
|
),
|
|
2230
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2232
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.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" }) : "Apply" })
|
|
2231
2233
|
] }),
|
|
2232
2234
|
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error })
|
|
2233
2235
|
] });
|
|
@@ -2292,14 +2294,14 @@ function WizardStepReview({
|
|
|
2292
2294
|
return `${promotionCode.discountValue}% off`;
|
|
2293
2295
|
}
|
|
2294
2296
|
if (promotionCode.discountType === "amount_off" && promotionCode.discountValue) {
|
|
2295
|
-
return `${
|
|
2297
|
+
return `${_chunkNFCXUAE6js.formatCurrency.call(void 0, promotionCode.discountValue, promotionCode.currency || selectedPrice.currency)} off`;
|
|
2296
2298
|
}
|
|
2297
2299
|
return null;
|
|
2298
2300
|
}, "getDiscountDescription");
|
|
2299
2301
|
const discountDescription = getDiscountDescription();
|
|
2300
2302
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
2301
2303
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-muted/50 rounded-lg p-4 space-y-3", children: [
|
|
2302
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2304
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.SectionHeader, { children: "Selected Plan" }),
|
|
2303
2305
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between items-center", children: [
|
|
2304
2306
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
2305
2307
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-medium", children: _optionalChain([selectedPrice, 'access', _92 => _92.product, 'optionalAccess', _93 => _93.name]) }),
|
|
@@ -2307,10 +2309,10 @@ function WizardStepReview({
|
|
|
2307
2309
|
] }),
|
|
2308
2310
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-end", children: [
|
|
2309
2311
|
discountedPrice !== null ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2310
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground line-through", children:
|
|
2311
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-success text-lg font-semibold", children:
|
|
2312
|
-
discountDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2313
|
-
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-semibold text-lg", children:
|
|
2312
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground line-through", children: _chunkNFCXUAE6js.formatCurrency.call(void 0, selectedPrice.unitAmount || 0, selectedPrice.currency) }),
|
|
2313
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-success text-lg font-semibold", children: _chunkNFCXUAE6js.formatCurrency.call(void 0, discountedPrice, selectedPrice.currency) }),
|
|
2314
|
+
discountDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Badge, { variant: "softGreen", children: discountDescription })
|
|
2315
|
+
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-semibold text-lg", children: _chunkNFCXUAE6js.formatCurrency.call(void 0, selectedPrice.unitAmount || 0, selectedPrice.currency) }),
|
|
2314
2316
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: formatInterval2(selectedPrice) })
|
|
2315
2317
|
] })
|
|
2316
2318
|
] })
|
|
@@ -2325,9 +2327,9 @@ function WizardStepReview({
|
|
|
2325
2327
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between text-sm", children: [
|
|
2326
2328
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `${isTrialUpgrade ? "text-warning" : "text-muted-foreground"}`, children: isTrialUpgrade ? "Amount to charge now:" : "Amount due now:" }),
|
|
2327
2329
|
/* @__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: [
|
|
2328
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "line-through text-muted-foreground me-2", children:
|
|
2329
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success", children:
|
|
2330
|
-
] }) :
|
|
2330
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "line-through text-muted-foreground me-2", children: _chunkNFCXUAE6js.formatCurrency.call(void 0, prorationPreview.immediateCharge, prorationPreview.currency) }),
|
|
2331
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success", children: _chunkNFCXUAE6js.formatCurrency.call(void 0, discountedImmediateCharge, prorationPreview.currency) })
|
|
2332
|
+
] }) : _chunkNFCXUAE6js.formatCurrency.call(void 0, prorationPreview.immediateCharge, prorationPreview.currency) })
|
|
2331
2333
|
] })
|
|
2332
2334
|
]
|
|
2333
2335
|
}
|
|
@@ -2351,15 +2353,15 @@ function WizardStepReview({
|
|
|
2351
2353
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "font-medium", children: "Payment Method" }),
|
|
2352
2354
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: hasPaymentMethod ? "A payment method is on file" : "No payment method on file" })
|
|
2353
2355
|
] }),
|
|
2354
|
-
!hasPaymentMethod && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2356
|
+
!hasPaymentMethod && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Button, { variant: "outline", onClick: onAddPaymentMethod, children: "Add Payment Method" })
|
|
2355
2357
|
] }) }),
|
|
2356
|
-
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2358
|
+
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.Alert, { variant: "destructive", children: [
|
|
2357
2359
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.AlertCircle, { className: "h-4 w-4" }),
|
|
2358
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2360
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.AlertDescription, { children: error })
|
|
2359
2361
|
] }),
|
|
2360
2362
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between pt-4 border-t", children: [
|
|
2361
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2362
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2363
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Button, { variant: "outline", onClick: onBack, disabled: isProcessing, children: "Back" }),
|
|
2364
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Button, { onClick: hasPaymentMethod ? onConfirm : onAddPaymentMethod, disabled: isProcessing, children: isProcessing ? "Processing..." : hasPaymentMethod ? isChangingPlan ? "Confirm Plan Change" : "Subscribe Now" : "Add Payment Method" })
|
|
2363
2365
|
] })
|
|
2364
2366
|
] });
|
|
2365
2367
|
}
|
|
@@ -2370,7 +2372,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, WizardStepReview, "WizardStepReview");
|
|
|
2370
2372
|
function WizardStepPaymentMethod({ onBack, onSuccess, isProcessing }) {
|
|
2371
2373
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
2372
2374
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
2373
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2375
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.SectionHeader, { children: "Add Payment Method" }),
|
|
2374
2376
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: "Enter your card details to complete your subscription" })
|
|
2375
2377
|
] }),
|
|
2376
2378
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodForm, { onSuccess, onCancel: onBack, isLoading: isProcessing })
|
|
@@ -2412,10 +2414,10 @@ function SubscriptionWizard({
|
|
|
2412
2414
|
const isChangePlanMode = !!subscription;
|
|
2413
2415
|
const dialogTitle = subscription ? "Change Subscription Plan" : isPurchasingAddons ? "Purchase Add-ons" : "Subscribe to a Plan";
|
|
2414
2416
|
const dialogDescription = subscription ? "Select a new plan for your subscription" : isPurchasingAddons ? "Select one-time products to purchase" : "Choose a subscription plan to get started";
|
|
2415
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2416
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2417
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2418
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2417
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.DialogContent, { className: "max-w-2xl", children: [
|
|
2418
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.DialogHeader, { children: [
|
|
2419
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.DialogTitle, { children: dialogTitle }),
|
|
2420
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.DialogDescription, { children: dialogDescription })
|
|
2419
2421
|
] }),
|
|
2420
2422
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, WizardProgressIndicator, { currentStep: state.step }),
|
|
2421
2423
|
state.step === "plan-selection" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -2498,15 +2500,15 @@ function UsageSummaryCard({ meter, summary }) {
|
|
|
2498
2500
|
const progressWidth = percentage !== null ? Math.min(percentage, 100) : 0;
|
|
2499
2501
|
const displayName = meter.displayName || meter.eventName;
|
|
2500
2502
|
const hasLimit = limit !== null && limit !== void 0;
|
|
2501
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2502
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2503
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.Card, { children: [
|
|
2504
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.CardHeader, { className: "flex flex-row items-center gap-x-3 pb-3", children: [
|
|
2503
2505
|
/* @__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" }) }),
|
|
2504
2506
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col", children: [
|
|
2505
2507
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium", children: displayName }),
|
|
2506
2508
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-xs", children: meter.id })
|
|
2507
2509
|
] })
|
|
2508
2510
|
] }),
|
|
2509
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2511
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.CardContent, { className: "flex flex-col gap-y-4", children: [
|
|
2510
2512
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
2511
2513
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-3xl font-bold", children: currentUsage.toLocaleString() }),
|
|
2512
2514
|
hasLimit && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-muted-foreground text-sm", children: [
|
|
@@ -2553,14 +2555,14 @@ function UsageContainer() {
|
|
|
2553
2555
|
const loadUsageData = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2554
2556
|
setLoading(true);
|
|
2555
2557
|
try {
|
|
2556
|
-
const fetchedSubscriptions = await
|
|
2558
|
+
const fetchedSubscriptions = await _chunk6OFANJTEjs.StripeSubscriptionService.listSubscriptions();
|
|
2557
2559
|
setSubscriptions(fetchedSubscriptions);
|
|
2558
2560
|
const hasMeteredSubscriptions2 = fetchedSubscriptions.some((sub) => _optionalChain([sub, 'access', _99 => _99.price, 'optionalAccess', _100 => _100.recurring, 'optionalAccess', _101 => _101.usageType]) === "metered");
|
|
2559
2561
|
if (!hasMeteredSubscriptions2) {
|
|
2560
2562
|
setLoading(false);
|
|
2561
2563
|
return;
|
|
2562
2564
|
}
|
|
2563
|
-
const fetchedMeters = await
|
|
2565
|
+
const fetchedMeters = await _chunk6OFANJTEjs.StripeUsageService.listMeters();
|
|
2564
2566
|
setMeters(fetchedMeters);
|
|
2565
2567
|
const summariesMap = {};
|
|
2566
2568
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -2568,7 +2570,7 @@ function UsageContainer() {
|
|
|
2568
2570
|
const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
|
|
2569
2571
|
for (const meter of fetchedMeters) {
|
|
2570
2572
|
try {
|
|
2571
|
-
const meterSummaries = await
|
|
2573
|
+
const meterSummaries = await _chunk6OFANJTEjs.StripeUsageService.getMeterSummaries({
|
|
2572
2574
|
meterId: meter.id,
|
|
2573
2575
|
startTime: startOfMonth,
|
|
2574
2576
|
endTime: endOfMonth
|
|
@@ -2633,22 +2635,22 @@ function UsageHistoryTable({ usageRecords }) {
|
|
|
2633
2635
|
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: "No usage history available." }) });
|
|
2634
2636
|
}
|
|
2635
2637
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
2636
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2637
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-clip rounded-lg border", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2638
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2639
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2640
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2641
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2642
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2638
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.SectionHeader, { level: 2, children: "Usage History" }),
|
|
2639
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-clip rounded-lg border", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.Table, { children: [
|
|
2640
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.TableRow, { children: [
|
|
2641
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.TableHead, { children: "Date & Time" }),
|
|
2642
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.TableHead, { children: "Meter Event" }),
|
|
2643
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.TableHead, { className: "text-end", children: "Quantity" }),
|
|
2644
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.TableHead, { children: "Event ID" })
|
|
2643
2645
|
] }) }),
|
|
2644
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2646
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.TableBody, { children: usageRecords.map((record) => {
|
|
2645
2647
|
const dateTime = formatDateTime(record.timestamp);
|
|
2646
2648
|
const quantity = record.quantity.toLocaleString();
|
|
2647
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2648
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2649
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2650
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2651
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2649
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.TableRow, { children: [
|
|
2650
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.TableCell, { className: "font-medium", children: dateTime }),
|
|
2651
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.TableCell, { className: "text-muted-foreground", children: record.meterEventName }),
|
|
2652
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.TableCell, { className: "text-end font-medium", children: quantity }),
|
|
2653
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.TableCell, { className: "text-muted-foreground text-sm tabular-nums", children: record.stripeEventId })
|
|
2652
2654
|
] }, record.id);
|
|
2653
2655
|
}) })
|
|
2654
2656
|
] }) })
|
|
@@ -2659,8 +2661,8 @@ _chunk7QVYU63Ejs.__name.call(void 0, UsageHistoryTable, "UsageHistoryTable");
|
|
|
2659
2661
|
// src/features/billing/components/modals/BillingDetailModal.tsx
|
|
2660
2662
|
|
|
2661
2663
|
function BillingDetailModal({ open, onOpenChange, title, children, className }) {
|
|
2662
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2663
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2664
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.DialogContent, { className: _nullishCoalesce(className, () => ( "max-w-4xl max-h-[90vh] overflow-y-auto")), children: [
|
|
2665
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.DialogHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.DialogTitle, { children: title }) }),
|
|
2664
2666
|
children
|
|
2665
2667
|
] }) });
|
|
2666
2668
|
}
|
|
@@ -2677,7 +2679,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
|
|
|
2677
2679
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-destructive text-sm font-medium", children: "Payment Failed" }),
|
|
2678
2680
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive mt-1 text-sm", children: "Your last payment failed. Please update your payment method to avoid service interruption." })
|
|
2679
2681
|
] }),
|
|
2680
|
-
onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2682
|
+
onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Button, { variant: "outline", size: "sm", onClick: onUpdatePayment, className: "text-destructive border-red-300", children: "Update Payment Method" })
|
|
2681
2683
|
] });
|
|
2682
2684
|
}
|
|
2683
2685
|
if (subscription.status === "trialing" /* TRIALING */ && subscription.trialEnd) {
|
|
@@ -2697,7 +2699,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
|
|
|
2697
2699
|
". Add a payment method to continue your subscription."
|
|
2698
2700
|
] })
|
|
2699
2701
|
] }),
|
|
2700
|
-
onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2702
|
+
onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Button, { variant: "outline", size: "sm", onClick: onAddPayment, className: "text-warning border-yellow-300", children: "Add Payment Method" })
|
|
2701
2703
|
] });
|
|
2702
2704
|
}
|
|
2703
2705
|
}
|
|
@@ -2748,7 +2750,7 @@ function BillingDashboardContainer() {
|
|
|
2748
2750
|
setNoCustomerExists(false);
|
|
2749
2751
|
let customer = null;
|
|
2750
2752
|
try {
|
|
2751
|
-
customer = await
|
|
2753
|
+
customer = await _chunk6OFANJTEjs.StripeCustomerService.getCustomer();
|
|
2752
2754
|
setData((prev) => ({ ...prev, customer }));
|
|
2753
2755
|
setErrors((prev) => ({ ...prev, customer: null }));
|
|
2754
2756
|
setNoCustomerExists(false);
|
|
@@ -2774,7 +2776,7 @@ function BillingDashboardContainer() {
|
|
|
2774
2776
|
}
|
|
2775
2777
|
const fetchSubscriptions = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2776
2778
|
try {
|
|
2777
|
-
const subscriptions2 = await
|
|
2779
|
+
const subscriptions2 = await _chunk6OFANJTEjs.StripeSubscriptionService.listSubscriptions();
|
|
2778
2780
|
setData((prev) => ({ ...prev, subscriptions: subscriptions2 }));
|
|
2779
2781
|
setErrors((prev) => ({ ...prev, subscriptions: null }));
|
|
2780
2782
|
return subscriptions2;
|
|
@@ -2788,7 +2790,7 @@ function BillingDashboardContainer() {
|
|
|
2788
2790
|
}, "fetchSubscriptions");
|
|
2789
2791
|
const fetchPaymentMethods = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2790
2792
|
try {
|
|
2791
|
-
const paymentMethods = await
|
|
2793
|
+
const paymentMethods = await _chunk6OFANJTEjs.StripeCustomerService.listPaymentMethods();
|
|
2792
2794
|
setData((prev) => ({ ...prev, paymentMethods }));
|
|
2793
2795
|
setErrors((prev) => ({ ...prev, paymentMethods: null }));
|
|
2794
2796
|
} catch (error) {
|
|
@@ -2800,7 +2802,7 @@ function BillingDashboardContainer() {
|
|
|
2800
2802
|
}, "fetchPaymentMethods");
|
|
2801
2803
|
const fetchInvoices = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2802
2804
|
try {
|
|
2803
|
-
const invoices = await
|
|
2805
|
+
const invoices = await _chunk6OFANJTEjs.StripeInvoiceService.listInvoices();
|
|
2804
2806
|
setData((prev) => ({ ...prev, invoices }));
|
|
2805
2807
|
setErrors((prev) => ({ ...prev, invoices: null }));
|
|
2806
2808
|
} catch (error) {
|
|
@@ -2823,7 +2825,7 @@ function BillingDashboardContainer() {
|
|
|
2823
2825
|
const handleCreateCustomer = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2824
2826
|
setCreatingCustomer(true);
|
|
2825
2827
|
try {
|
|
2826
|
-
await
|
|
2828
|
+
await _chunk6OFANJTEjs.StripeCustomerService.createCustomer();
|
|
2827
2829
|
setNoCustomerExists(false);
|
|
2828
2830
|
await fetchAllData();
|
|
2829
2831
|
} catch (error) {
|
|
@@ -2835,7 +2837,7 @@ function BillingDashboardContainer() {
|
|
|
2835
2837
|
}, "handleCreateCustomer");
|
|
2836
2838
|
const fetchUsageData = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2837
2839
|
try {
|
|
2838
|
-
const meters = await
|
|
2840
|
+
const meters = await _chunk6OFANJTEjs.StripeUsageService.listMeters();
|
|
2839
2841
|
setData((prev) => ({ ...prev, meters }));
|
|
2840
2842
|
const summariesMap = {};
|
|
2841
2843
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -2843,7 +2845,7 @@ function BillingDashboardContainer() {
|
|
|
2843
2845
|
const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
|
|
2844
2846
|
for (const meter of meters) {
|
|
2845
2847
|
try {
|
|
2846
|
-
const meterSummaries = await
|
|
2848
|
+
const meterSummaries = await _chunk6OFANJTEjs.StripeUsageService.getMeterSummaries({
|
|
2847
2849
|
meterId: meter.id,
|
|
2848
2850
|
startTime: startOfMonth,
|
|
2849
2851
|
endTime: endOfMonth
|
|
@@ -2921,18 +2923,18 @@ function BillingDashboardContainer() {
|
|
|
2921
2923
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-8 w-8" }),
|
|
2922
2924
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: "Billing" })
|
|
2923
2925
|
] }),
|
|
2924
|
-
isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2925
|
-
noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2926
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2926
|
+
isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.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" }) }) }),
|
|
2927
|
+
noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.Card, { children: [
|
|
2928
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.CardHeader, { className: "text-center", children: [
|
|
2927
2929
|
/* @__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" }) }),
|
|
2928
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2929
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2930
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.CardTitle, { children: "Set Up Billing" }),
|
|
2931
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.CardDescription, { children: "Your company doesn't have a billing account yet. Set one up to manage subscriptions, payment methods, and view invoices." })
|
|
2930
2932
|
] }),
|
|
2931
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2933
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.CardContent, { className: "flex justify-center pb-8", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Button, { onClick: handleCreateCustomer, disabled: creatingCustomer, size: "lg", children: creatingCustomer ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2932
2934
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "me-2 h-4 w-4 animate-spin" }),
|
|
2933
2935
|
"Setting up..."
|
|
2934
2936
|
] }) : "Set Up Billing Account" }) }),
|
|
2935
|
-
errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2937
|
+
errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.CardContent, { className: "pt-0", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-center text-destructive text-xs/relaxed", children: errors.customer }) })
|
|
2936
2938
|
] }),
|
|
2937
2939
|
!noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2938
2940
|
criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -3074,7 +3076,7 @@ function getStripePromise(publishableKey) {
|
|
|
3074
3076
|
}
|
|
3075
3077
|
_chunk7QVYU63Ejs.__name.call(void 0, getStripePromise, "getStripePromise");
|
|
3076
3078
|
function StripeProvider({ children }) {
|
|
3077
|
-
const publishableKey =
|
|
3079
|
+
const publishableKey = _chunk5W5MN7JPjs.getStripePublishableKey.call(void 0, );
|
|
3078
3080
|
const stripePromise = _react.useMemo.call(void 0, () => getStripePromise(publishableKey), [publishableKey]);
|
|
3079
3081
|
const options = _react.useMemo.call(void 0, () => ({}), []);
|
|
3080
3082
|
if (!publishableKey) {
|
|
@@ -3084,7 +3086,7 @@ function StripeProvider({ children }) {
|
|
|
3084
3086
|
}
|
|
3085
3087
|
_chunk7QVYU63Ejs.__name.call(void 0, StripeProvider, "StripeProvider");
|
|
3086
3088
|
function isStripeConfigured() {
|
|
3087
|
-
return !!
|
|
3089
|
+
return !!_chunk5W5MN7JPjs.getStripePublishableKey.call(void 0, );
|
|
3088
3090
|
}
|
|
3089
3091
|
_chunk7QVYU63Ejs.__name.call(void 0, isStripeConfigured, "isStripeConfigured");
|
|
3090
3092
|
|
|
@@ -3104,12 +3106,12 @@ function PriceArchiver({ price }) {
|
|
|
3104
3106
|
const isArchived = !price.active;
|
|
3105
3107
|
const scope = isArchived ? "restore" : "archive";
|
|
3106
3108
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
3107
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3109
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.Button, { variant: "outline", size: "sm", onClick: () => setOpen(true), children: [
|
|
3108
3110
|
isArchived ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RotateCcwIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ArchiveIcon, {}),
|
|
3109
3111
|
t(`billing.admin.prices.${scope}.confirm`)
|
|
3110
3112
|
] }),
|
|
3111
3113
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3112
|
-
|
|
3114
|
+
_chunkNFCXUAE6js.ConfirmDialog,
|
|
3113
3115
|
{
|
|
3114
3116
|
open,
|
|
3115
3117
|
onOpenChange: setOpen,
|
|
@@ -3123,7 +3125,7 @@ function PriceArchiver({ price }) {
|
|
|
3123
3125
|
if (isArchived) await restorePrice(price.id);
|
|
3124
3126
|
else await archivePrice(price.id);
|
|
3125
3127
|
} catch (error) {
|
|
3126
|
-
|
|
3128
|
+
_chunkNFCXUAE6js.errorToast.call(void 0, { title: t(`billing.admin.prices.${scope}.title`), error });
|
|
3127
3129
|
throw error;
|
|
3128
3130
|
}
|
|
3129
3131
|
}
|
|
@@ -3155,14 +3157,14 @@ function PriceEditorInternal({
|
|
|
3155
3157
|
onDialogOpenChange
|
|
3156
3158
|
}) {
|
|
3157
3159
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
3158
|
-
const router =
|
|
3160
|
+
const router = _chunk6OFANJTEjs.useI18nRouter.call(void 0, );
|
|
3159
3161
|
const { createPrice, updatePrice, productId: contextProductId } = usePriceContext();
|
|
3160
3162
|
const [allFeatures, setAllFeatures] = _react.useState.call(void 0, []);
|
|
3161
3163
|
const isEdit = !!price;
|
|
3162
3164
|
const targetProductId = _nullishCoalesce(_nullishCoalesce(productId, () => ( _optionalChain([price, 'optionalAccess', _117 => _117.product, 'optionalAccess', _118 => _118.id]))), () => ( contextProductId));
|
|
3163
3165
|
_react.useEffect.call(void 0, () => {
|
|
3164
3166
|
const fetchFeatures = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3165
|
-
setAllFeatures(await
|
|
3167
|
+
setAllFeatures(await _chunk6OFANJTEjs.FeatureService.findMany({}));
|
|
3166
3168
|
}, "fetchFeatures");
|
|
3167
3169
|
void fetchFeatures();
|
|
3168
3170
|
}, []);
|
|
@@ -3275,7 +3277,7 @@ function PriceEditorInternal({
|
|
|
3275
3277
|
warnedUnknownFor.current = fingerprint;
|
|
3276
3278
|
const { unknown } = resolvePlatformFeatures(seed.platformFeatures);
|
|
3277
3279
|
if (unknown.length > 0)
|
|
3278
|
-
|
|
3280
|
+
_chunk6OFANJTEjs.showToast.call(void 0, t("billing.admin.prices.import.warnings.unknownFeatures", { features: unknown.join(", ") }));
|
|
3279
3281
|
}, [seed, isEdit, allFeatures, resolvePlatformFeatures, t]);
|
|
3280
3282
|
const watchInterval = form.watch("interval");
|
|
3281
3283
|
const isRecurring = watchInterval !== "one_time";
|
|
@@ -3296,13 +3298,13 @@ function PriceEditorInternal({
|
|
|
3296
3298
|
{ id: "metered", text: t("billing.admin.prices.usage.metered") }
|
|
3297
3299
|
];
|
|
3298
3300
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3299
|
-
|
|
3301
|
+
_chunkNFCXUAE6js.EditorSheet,
|
|
3300
3302
|
{
|
|
3301
3303
|
form,
|
|
3302
3304
|
entityType: t("billing.admin.prices.entity"),
|
|
3303
3305
|
entityName: price ? priceLabel(price) : void 0,
|
|
3304
3306
|
isEdit,
|
|
3305
|
-
module:
|
|
3307
|
+
module: _chunk6OFANJTEjs.Modules.StripePrice,
|
|
3306
3308
|
size: "lg",
|
|
3307
3309
|
propagateChanges,
|
|
3308
3310
|
onSuccess,
|
|
@@ -3351,13 +3353,13 @@ function PriceEditorInternal({
|
|
|
3351
3353
|
dialogOpen,
|
|
3352
3354
|
onDialogOpenChange,
|
|
3353
3355
|
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
3354
|
-
isEdit && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3355
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3356
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3356
|
+
isEdit && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.Alert, { children: [
|
|
3357
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.AlertTitle, { children: t("billing.admin.prices.immutability.title") }),
|
|
3358
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.AlertDescription, { children: t("billing.admin.prices.immutability.description") })
|
|
3357
3359
|
] }),
|
|
3358
3360
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
|
|
3359
3361
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3360
|
-
|
|
3362
|
+
_chunkNFCXUAE6js.FormInput,
|
|
3361
3363
|
{
|
|
3362
3364
|
form,
|
|
3363
3365
|
id: "unitAmount",
|
|
@@ -3369,7 +3371,7 @@ function PriceEditorInternal({
|
|
|
3369
3371
|
}
|
|
3370
3372
|
),
|
|
3371
3373
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3372
|
-
|
|
3374
|
+
_chunkNFCXUAE6js.FormSelect,
|
|
3373
3375
|
{
|
|
3374
3376
|
form,
|
|
3375
3377
|
id: "currency",
|
|
@@ -3380,7 +3382,7 @@ function PriceEditorInternal({
|
|
|
3380
3382
|
)
|
|
3381
3383
|
] }),
|
|
3382
3384
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3383
|
-
|
|
3385
|
+
_chunkNFCXUAE6js.FormSelect,
|
|
3384
3386
|
{
|
|
3385
3387
|
form,
|
|
3386
3388
|
id: "interval",
|
|
@@ -3391,7 +3393,7 @@ function PriceEditorInternal({
|
|
|
3391
3393
|
),
|
|
3392
3394
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
|
|
3393
3395
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3394
|
-
|
|
3396
|
+
_chunkNFCXUAE6js.FormInput,
|
|
3395
3397
|
{
|
|
3396
3398
|
form,
|
|
3397
3399
|
id: "intervalCount",
|
|
@@ -3402,7 +3404,7 @@ function PriceEditorInternal({
|
|
|
3402
3404
|
}
|
|
3403
3405
|
),
|
|
3404
3406
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3405
|
-
|
|
3407
|
+
_chunkNFCXUAE6js.FormSelect,
|
|
3406
3408
|
{
|
|
3407
3409
|
form,
|
|
3408
3410
|
id: "usageType",
|
|
@@ -3413,7 +3415,7 @@ function PriceEditorInternal({
|
|
|
3413
3415
|
)
|
|
3414
3416
|
] }),
|
|
3415
3417
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3416
|
-
|
|
3418
|
+
_chunkNFCXUAE6js.FormInput,
|
|
3417
3419
|
{
|
|
3418
3420
|
form,
|
|
3419
3421
|
id: "nickname",
|
|
@@ -3422,7 +3424,7 @@ function PriceEditorInternal({
|
|
|
3422
3424
|
}
|
|
3423
3425
|
),
|
|
3424
3426
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3425
|
-
|
|
3427
|
+
_chunkNFCXUAE6js.FormTextarea,
|
|
3426
3428
|
{
|
|
3427
3429
|
form,
|
|
3428
3430
|
id: "description",
|
|
@@ -3432,7 +3434,7 @@ function PriceEditorInternal({
|
|
|
3432
3434
|
}
|
|
3433
3435
|
),
|
|
3434
3436
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3435
|
-
|
|
3437
|
+
_chunkNFCXUAE6js.FormInput,
|
|
3436
3438
|
{
|
|
3437
3439
|
form,
|
|
3438
3440
|
id: "token",
|
|
@@ -3442,10 +3444,10 @@ function PriceEditorInternal({
|
|
|
3442
3444
|
}
|
|
3443
3445
|
),
|
|
3444
3446
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-2", children: [
|
|
3445
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3447
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.FieldLabel, { children: t("billing.admin.prices.fields.features") }),
|
|
3446
3448
|
form.watch("features").map((_, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
|
|
3447
3449
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3448
|
-
|
|
3450
|
+
_chunkNFCXUAE6js.Input,
|
|
3449
3451
|
{
|
|
3450
3452
|
...form.register(`features.${index}`),
|
|
3451
3453
|
placeholder: t("billing.admin.prices.placeholders.feature", { index: index + 1 }),
|
|
@@ -3453,7 +3455,7 @@ function PriceEditorInternal({
|
|
|
3453
3455
|
}
|
|
3454
3456
|
),
|
|
3455
3457
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3456
|
-
|
|
3458
|
+
_chunkNFCXUAE6js.Button,
|
|
3457
3459
|
{
|
|
3458
3460
|
type: "button",
|
|
3459
3461
|
variant: "outline",
|
|
@@ -3468,7 +3470,7 @@ function PriceEditorInternal({
|
|
|
3468
3470
|
)
|
|
3469
3471
|
] }, index)),
|
|
3470
3472
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3471
|
-
|
|
3473
|
+
_chunkNFCXUAE6js.Button,
|
|
3472
3474
|
{
|
|
3473
3475
|
type: "button",
|
|
3474
3476
|
variant: "outline",
|
|
@@ -3483,12 +3485,12 @@ function PriceEditorInternal({
|
|
|
3483
3485
|
)
|
|
3484
3486
|
] }),
|
|
3485
3487
|
isRecurring && allFeatures.length > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-2", children: [
|
|
3486
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3488
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.FieldLabel, { children: t("billing.admin.prices.fields.platformFeatures") }),
|
|
3487
3489
|
/* @__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) => {
|
|
3488
3490
|
const isChecked = form.watch("featureIds").includes(feature.id);
|
|
3489
3491
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
3490
3492
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3491
|
-
|
|
3493
|
+
_chunkNFCXUAE6js.Checkbox,
|
|
3492
3494
|
{
|
|
3493
3495
|
id: `feature-${feature.id}`,
|
|
3494
3496
|
checked: isChecked,
|
|
@@ -3504,13 +3506,13 @@ function PriceEditorInternal({
|
|
|
3504
3506
|
}
|
|
3505
3507
|
}
|
|
3506
3508
|
),
|
|
3507
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3509
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.FieldLabel, { htmlFor: `feature-${feature.id}`, children: feature.name }),
|
|
3508
3510
|
feature.isCore && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.admin.prices.help.core") })
|
|
3509
3511
|
] }, feature.id);
|
|
3510
3512
|
}) })
|
|
3511
3513
|
] }),
|
|
3512
3514
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3513
|
-
|
|
3515
|
+
_chunkNFCXUAE6js.FormCheckbox,
|
|
3514
3516
|
{
|
|
3515
3517
|
form,
|
|
3516
3518
|
id: "isTrial",
|
|
@@ -3553,7 +3555,7 @@ var defaultContextValue = {
|
|
|
3553
3555
|
productId: void 0
|
|
3554
3556
|
};
|
|
3555
3557
|
function priceLabel(price) {
|
|
3556
|
-
return _nullishCoalesce(price.nickname, () => ( `${
|
|
3558
|
+
return _nullishCoalesce(price.nickname, () => ( `${_chunkNFCXUAE6js.formatCurrency.call(void 0, price.unitAmount, price.currency)} ${_chunkNFCXUAE6js.formatInterval.call(void 0, price)}`.trim()));
|
|
3557
3559
|
}
|
|
3558
3560
|
_chunk7QVYU63Ejs.__name.call(void 0, priceLabel, "priceLabel");
|
|
3559
3561
|
var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
@@ -3563,21 +3565,21 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3563
3565
|
productId: productIdProp
|
|
3564
3566
|
}) => {
|
|
3565
3567
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
3566
|
-
const generateUrl =
|
|
3567
|
-
const { hasRole } =
|
|
3568
|
+
const generateUrl = _chunkNFCXUAE6js.usePageUrlGenerator.call(void 0, );
|
|
3569
|
+
const { hasRole } = _chunkNFCXUAE6js.useCurrentUserContext.call(void 0, );
|
|
3568
3570
|
const [price, setPrice] = _react.useState.call(void 0,
|
|
3569
|
-
dehydratedPrice ?
|
|
3571
|
+
dehydratedPrice ? _chunk6OFANJTEjs.rehydrate.call(void 0, _chunk6OFANJTEjs.Modules.StripePrice, dehydratedPrice) : void 0
|
|
3570
3572
|
);
|
|
3571
3573
|
const [priceVersion, setPriceVersion] = _react.useState.call(void 0, 0);
|
|
3572
3574
|
const refreshPrices = _react.useCallback.call(void 0, () => setPriceVersion((value2) => value2 + 1), []);
|
|
3573
3575
|
const productId = _nullishCoalesce(productIdProp, () => ( _optionalChain([price, 'optionalAccess', _141 => _141.product, 'optionalAccess', _142 => _142.id])));
|
|
3574
3576
|
const reloadPrice = _react.useCallback.call(void 0, async () => {
|
|
3575
3577
|
if (!_optionalChain([price, 'optionalAccess', _143 => _143.id])) return;
|
|
3576
|
-
setPrice(await
|
|
3578
|
+
setPrice(await _chunk6OFANJTEjs.StripePriceService.getPrice({ id: price.id }));
|
|
3577
3579
|
}, [_optionalChain([price, 'optionalAccess', _144 => _144.id])]);
|
|
3578
3580
|
const createPrice = _react.useCallback.call(void 0,
|
|
3579
3581
|
async (input) => {
|
|
3580
|
-
const saved = await
|
|
3582
|
+
const saved = await _chunk6OFANJTEjs.StripePriceService.createPrice(input);
|
|
3581
3583
|
refreshPrices();
|
|
3582
3584
|
return saved;
|
|
3583
3585
|
},
|
|
@@ -3585,7 +3587,7 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3585
3587
|
);
|
|
3586
3588
|
const updatePrice = _react.useCallback.call(void 0,
|
|
3587
3589
|
async (input) => {
|
|
3588
|
-
const saved = await
|
|
3590
|
+
const saved = await _chunk6OFANJTEjs.StripePriceService.updatePrice(input);
|
|
3589
3591
|
setPrice(saved);
|
|
3590
3592
|
refreshPrices();
|
|
3591
3593
|
return saved;
|
|
@@ -3596,7 +3598,7 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3596
3598
|
async (id) => {
|
|
3597
3599
|
const target = _nullishCoalesce(id, () => ( _optionalChain([price, 'optionalAccess', _145 => _145.id])));
|
|
3598
3600
|
if (!target) return;
|
|
3599
|
-
await
|
|
3601
|
+
await _chunk6OFANJTEjs.StripePriceService.archivePrice({ id: target });
|
|
3600
3602
|
await reloadPrice();
|
|
3601
3603
|
refreshPrices();
|
|
3602
3604
|
},
|
|
@@ -3606,7 +3608,7 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3606
3608
|
async (id) => {
|
|
3607
3609
|
const target = _nullishCoalesce(id, () => ( _optionalChain([price, 'optionalAccess', _147 => _147.id])));
|
|
3608
3610
|
if (!target) return;
|
|
3609
|
-
await
|
|
3611
|
+
await _chunk6OFANJTEjs.StripePriceService.reactivatePrice({ id: target });
|
|
3610
3612
|
await reloadPrice();
|
|
3611
3613
|
refreshPrices();
|
|
3612
3614
|
},
|
|
@@ -3630,12 +3632,12 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3630
3632
|
if (!publishChrome) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceContext.Provider, { value, children });
|
|
3631
3633
|
const breadcrumb = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
3632
3634
|
const items = [
|
|
3633
|
-
{ name: t("billing.admin.products.title"), href: generateUrl({ page:
|
|
3635
|
+
{ name: t("billing.admin.products.title"), href: generateUrl({ page: _chunk6OFANJTEjs.Modules.StripeProduct }) }
|
|
3634
3636
|
];
|
|
3635
3637
|
if (_optionalChain([price, 'optionalAccess', _149 => _149.product]))
|
|
3636
3638
|
items.push({
|
|
3637
3639
|
name: price.product.name,
|
|
3638
|
-
href: generateUrl({ page:
|
|
3640
|
+
href: generateUrl({ page: _chunk6OFANJTEjs.Modules.StripeProduct, id: price.product.id })
|
|
3639
3641
|
});
|
|
3640
3642
|
if (price) items.push({ name: priceLabel(price) });
|
|
3641
3643
|
return items;
|
|
@@ -3644,7 +3646,7 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3644
3646
|
const response = { type: t("billing.admin.prices.title") };
|
|
3645
3647
|
if (!price) return response;
|
|
3646
3648
|
response.element = priceLabel(price);
|
|
3647
|
-
if (hasRole(
|
|
3649
|
+
if (hasRole(_chunkG4JR3SFVjs.getRoleId.call(void 0, ).Administrator)) {
|
|
3648
3650
|
response.functions = [
|
|
3649
3651
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceArchiver, { price }, "priceArchiver"),
|
|
3650
3652
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceEditor, { price, propagateChanges: setPrice }, "priceEditor")
|
|
@@ -3652,7 +3654,7 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3652
3654
|
}
|
|
3653
3655
|
return response;
|
|
3654
3656
|
}, "title");
|
|
3655
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3657
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceContext.Provider, { value, children }) });
|
|
3656
3658
|
}, "PriceProvider");
|
|
3657
3659
|
var usePriceContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => _nullishCoalesce(_react.useContext.call(void 0, PriceContext), () => ( defaultContextValue)), "usePriceContext");
|
|
3658
3660
|
|
|
@@ -3672,12 +3674,12 @@ function ProductArchiver({ product }) {
|
|
|
3672
3674
|
const isArchived = !product.active;
|
|
3673
3675
|
const scope = isArchived ? "restore" : "archive";
|
|
3674
3676
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
3675
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3677
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.Button, { variant: "outline", size: "sm", onClick: () => setOpen(true), children: [
|
|
3676
3678
|
isArchived ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RotateCcwIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ArchiveIcon, {}),
|
|
3677
3679
|
t(`billing.admin.products.${scope}.confirm`)
|
|
3678
3680
|
] }),
|
|
3679
3681
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3680
|
-
|
|
3682
|
+
_chunkNFCXUAE6js.ConfirmDialog,
|
|
3681
3683
|
{
|
|
3682
3684
|
open,
|
|
3683
3685
|
onOpenChange: setOpen,
|
|
@@ -3691,7 +3693,7 @@ function ProductArchiver({ product }) {
|
|
|
3691
3693
|
if (isArchived) await restoreProduct(product.id);
|
|
3692
3694
|
else await archiveProduct(product.id);
|
|
3693
3695
|
} catch (error) {
|
|
3694
|
-
|
|
3696
|
+
_chunkNFCXUAE6js.errorToast.call(void 0, { title: t(`billing.admin.products.${scope}.title`), error });
|
|
3695
3697
|
throw error;
|
|
3696
3698
|
}
|
|
3697
3699
|
}
|
|
@@ -3720,7 +3722,7 @@ function ProductEditorInternal({
|
|
|
3720
3722
|
onDialogOpenChange
|
|
3721
3723
|
}) {
|
|
3722
3724
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
3723
|
-
const router =
|
|
3725
|
+
const router = _chunk6OFANJTEjs.useI18nRouter.call(void 0, );
|
|
3724
3726
|
const { createProduct, updateProduct } = useProductContext();
|
|
3725
3727
|
const isEdit = !!product;
|
|
3726
3728
|
const formSchema2 = _react.useMemo.call(void 0,
|
|
@@ -3744,13 +3746,13 @@ function ProductEditorInternal({
|
|
|
3744
3746
|
defaultValues: getDefaultValues()
|
|
3745
3747
|
});
|
|
3746
3748
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3747
|
-
|
|
3749
|
+
_chunkNFCXUAE6js.EditorSheet,
|
|
3748
3750
|
{
|
|
3749
3751
|
form,
|
|
3750
3752
|
entityType: t("billing.admin.products.entity"),
|
|
3751
3753
|
entityName: _optionalChain([product, 'optionalAccess', _153 => _153.name]),
|
|
3752
3754
|
isEdit,
|
|
3753
|
-
module:
|
|
3755
|
+
module: _chunk6OFANJTEjs.Modules.StripeProduct,
|
|
3754
3756
|
size: "md",
|
|
3755
3757
|
propagateChanges,
|
|
3756
3758
|
onSuccess,
|
|
@@ -3767,7 +3769,7 @@ function ProductEditorInternal({
|
|
|
3767
3769
|
onDialogOpenChange,
|
|
3768
3770
|
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
3769
3771
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3770
|
-
|
|
3772
|
+
_chunkNFCXUAE6js.FormInput,
|
|
3771
3773
|
{
|
|
3772
3774
|
form,
|
|
3773
3775
|
id: "name",
|
|
@@ -3777,7 +3779,7 @@ function ProductEditorInternal({
|
|
|
3777
3779
|
}
|
|
3778
3780
|
),
|
|
3779
3781
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3780
|
-
|
|
3782
|
+
_chunkNFCXUAE6js.FormTextarea,
|
|
3781
3783
|
{
|
|
3782
3784
|
form,
|
|
3783
3785
|
id: "description",
|
|
@@ -3821,20 +3823,20 @@ var defaultContextValue2 = {
|
|
|
3821
3823
|
};
|
|
3822
3824
|
var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ children, dehydratedProduct, publishChrome = true }) => {
|
|
3823
3825
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
3824
|
-
const generateUrl =
|
|
3825
|
-
const { hasRole } =
|
|
3826
|
+
const generateUrl = _chunkNFCXUAE6js.usePageUrlGenerator.call(void 0, );
|
|
3827
|
+
const { hasRole } = _chunkNFCXUAE6js.useCurrentUserContext.call(void 0, );
|
|
3826
3828
|
const [product, setProduct] = _react.useState.call(void 0,
|
|
3827
|
-
dehydratedProduct ?
|
|
3829
|
+
dehydratedProduct ? _chunk6OFANJTEjs.rehydrate.call(void 0, _chunk6OFANJTEjs.Modules.StripeProduct, dehydratedProduct) : void 0
|
|
3828
3830
|
);
|
|
3829
3831
|
const [catalogueVersion, setCatalogueVersion] = _react.useState.call(void 0, 0);
|
|
3830
3832
|
const refreshCatalogue = _react.useCallback.call(void 0, () => setCatalogueVersion((value2) => value2 + 1), []);
|
|
3831
3833
|
const reloadProduct = _react.useCallback.call(void 0, async () => {
|
|
3832
3834
|
if (!_optionalChain([product, 'optionalAccess', _154 => _154.id])) return;
|
|
3833
|
-
setProduct(await
|
|
3835
|
+
setProduct(await _chunk6OFANJTEjs.StripeProductService.getProduct({ id: product.id }));
|
|
3834
3836
|
}, [_optionalChain([product, 'optionalAccess', _155 => _155.id])]);
|
|
3835
3837
|
const createProduct = _react.useCallback.call(void 0,
|
|
3836
3838
|
async (input) => {
|
|
3837
|
-
const saved = await
|
|
3839
|
+
const saved = await _chunk6OFANJTEjs.StripeProductService.createProduct(input);
|
|
3838
3840
|
refreshCatalogue();
|
|
3839
3841
|
return saved;
|
|
3840
3842
|
},
|
|
@@ -3842,7 +3844,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
3842
3844
|
);
|
|
3843
3845
|
const updateProduct = _react.useCallback.call(void 0,
|
|
3844
3846
|
async (input) => {
|
|
3845
|
-
const saved = await
|
|
3847
|
+
const saved = await _chunk6OFANJTEjs.StripeProductService.updateProduct(input);
|
|
3846
3848
|
setProduct(saved);
|
|
3847
3849
|
refreshCatalogue();
|
|
3848
3850
|
return saved;
|
|
@@ -3853,7 +3855,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
3853
3855
|
async (id) => {
|
|
3854
3856
|
const target = _nullishCoalesce(id, () => ( _optionalChain([product, 'optionalAccess', _156 => _156.id])));
|
|
3855
3857
|
if (!target) return;
|
|
3856
|
-
await
|
|
3858
|
+
await _chunk6OFANJTEjs.StripeProductService.archiveProduct({ id: target });
|
|
3857
3859
|
await reloadProduct();
|
|
3858
3860
|
refreshCatalogue();
|
|
3859
3861
|
},
|
|
@@ -3863,7 +3865,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
3863
3865
|
async (id) => {
|
|
3864
3866
|
const target = _nullishCoalesce(id, () => ( _optionalChain([product, 'optionalAccess', _158 => _158.id])));
|
|
3865
3867
|
if (!target) return;
|
|
3866
|
-
await
|
|
3868
|
+
await _chunk6OFANJTEjs.StripeProductService.reactivateProduct({ id: target });
|
|
3867
3869
|
await reloadProduct();
|
|
3868
3870
|
refreshCatalogue();
|
|
3869
3871
|
},
|
|
@@ -3898,7 +3900,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
3898
3900
|
{
|
|
3899
3901
|
name: t("billing.admin.products.title"),
|
|
3900
3902
|
// Linked only when it is NOT the current page.
|
|
3901
|
-
...product ? { href: generateUrl({ page:
|
|
3903
|
+
...product ? { href: generateUrl({ page: _chunk6OFANJTEjs.Modules.StripeProduct }) } : {}
|
|
3902
3904
|
}
|
|
3903
3905
|
];
|
|
3904
3906
|
if (product) items.push({ name: product.name });
|
|
@@ -3908,7 +3910,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
3908
3910
|
const response = { type: t("billing.admin.products.title") };
|
|
3909
3911
|
if (!product) return response;
|
|
3910
3912
|
response.element = product.name;
|
|
3911
|
-
if (hasRole(
|
|
3913
|
+
if (hasRole(_chunkG4JR3SFVjs.getRoleId.call(void 0, ).Administrator)) {
|
|
3912
3914
|
response.functions = [
|
|
3913
3915
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductArchiver, { product }, "productArchiver"),
|
|
3914
3916
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductEditor, { product, propagateChanges: setProduct }, "productEditor")
|
|
@@ -3916,7 +3918,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
3916
3918
|
}
|
|
3917
3919
|
return response;
|
|
3918
3920
|
}, "title");
|
|
3919
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3921
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductContext.Provider, { value, children }) });
|
|
3920
3922
|
}, "ProductProvider");
|
|
3921
3923
|
var useProductContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => _nullishCoalesce(_react.useContext.call(void 0, ProductContext), () => ( defaultContextValue2)), "useProductContext");
|
|
3922
3924
|
|
|
@@ -3925,56 +3927,56 @@ var useProductContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ()
|
|
|
3925
3927
|
|
|
3926
3928
|
function PriceDetails() {
|
|
3927
3929
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
3928
|
-
const generateUrl =
|
|
3930
|
+
const generateUrl = _chunkNFCXUAE6js.usePageUrlGenerator.call(void 0, );
|
|
3929
3931
|
const { price } = usePriceContext();
|
|
3930
3932
|
if (!price) return null;
|
|
3931
3933
|
const isRecurring = price.priceType === "recurring";
|
|
3932
3934
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-8", children: [
|
|
3933
3935
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
3934
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3936
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.SectionHeader, { children: t("billing.admin.prices.title") }),
|
|
3935
3937
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
3936
3938
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3937
|
-
|
|
3939
|
+
_chunkNFCXUAE6js.DetailField,
|
|
3938
3940
|
{
|
|
3939
3941
|
label: t("billing.admin.prices.fields.product"),
|
|
3940
|
-
value: price.product ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3942
|
+
value: price.product ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Link, { href: generateUrl({ page: _chunk6OFANJTEjs.Modules.StripeProduct, id: price.product.id }), children: price.product.name }) : "\u2014"
|
|
3941
3943
|
}
|
|
3942
3944
|
),
|
|
3943
3945
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3944
|
-
|
|
3946
|
+
_chunkNFCXUAE6js.DetailField,
|
|
3945
3947
|
{
|
|
3946
3948
|
label: t("billing.admin.prices.fields.status"),
|
|
3947
3949
|
value: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex flex-wrap items-center gap-1", children: [
|
|
3948
|
-
price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3949
|
-
price.isTrial && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3950
|
+
price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Badge, { variant: "softGreen", children: t("billing.admin.prices.status.active") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Badge, { variant: "softGray", children: t("billing.admin.prices.status.archived") }),
|
|
3951
|
+
price.isTrial && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Badge, { variant: "softBlue", children: t("billing.admin.prices.badge.trial") })
|
|
3950
3952
|
] })
|
|
3951
3953
|
}
|
|
3952
3954
|
),
|
|
3953
3955
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3954
|
-
|
|
3956
|
+
_chunkNFCXUAE6js.DetailField,
|
|
3955
3957
|
{
|
|
3956
3958
|
label: t("billing.admin.prices.fields.amount"),
|
|
3957
|
-
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children:
|
|
3959
|
+
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _chunkNFCXUAE6js.formatCurrency.call(void 0, price.unitAmount, price.currency) })
|
|
3958
3960
|
}
|
|
3959
3961
|
),
|
|
3960
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3962
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.DetailField, { label: t("billing.admin.prices.fields.currency"), value: price.currency.toUpperCase() }),
|
|
3961
3963
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3962
|
-
|
|
3964
|
+
_chunkNFCXUAE6js.DetailField,
|
|
3963
3965
|
{
|
|
3964
3966
|
label: t("billing.admin.prices.fields.type"),
|
|
3965
3967
|
value: isRecurring ? t("billing.admin.prices.type.recurring") : t("billing.admin.prices.type.oneTime")
|
|
3966
3968
|
}
|
|
3967
3969
|
),
|
|
3968
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3970
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.DetailField, { label: t("billing.admin.prices.fields.billing"), value: _chunkNFCXUAE6js.formatInterval.call(void 0, price) }),
|
|
3969
3971
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3970
|
-
|
|
3972
|
+
_chunkNFCXUAE6js.DetailField,
|
|
3971
3973
|
{
|
|
3972
3974
|
label: t("billing.admin.prices.fields.intervalCount"),
|
|
3973
3975
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _nullishCoalesce(_optionalChain([price, 'access', _160 => _160.recurring, 'optionalAccess', _161 => _161.intervalCount]), () => ( 1)) })
|
|
3974
3976
|
}
|
|
3975
3977
|
),
|
|
3976
3978
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3977
|
-
|
|
3979
|
+
_chunkNFCXUAE6js.DetailField,
|
|
3978
3980
|
{
|
|
3979
3981
|
label: t("billing.admin.prices.fields.usageType"),
|
|
3980
3982
|
value: _optionalChain([price, 'access', _162 => _162.recurring, 'optionalAccess', _163 => _163.usageType]) === "metered" ? t("billing.admin.prices.usage.metered") : t("billing.admin.prices.usage.licensed")
|
|
@@ -3983,24 +3985,24 @@ function PriceDetails() {
|
|
|
3983
3985
|
] })
|
|
3984
3986
|
] }),
|
|
3985
3987
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
3986
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3988
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.SectionHeader, { children: t("billing.admin.prices.fields.platformFeatures") }),
|
|
3987
3989
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
3988
3990
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3989
|
-
|
|
3991
|
+
_chunkNFCXUAE6js.DetailField,
|
|
3990
3992
|
{
|
|
3991
3993
|
label: t("billing.admin.prices.fields.token"),
|
|
3992
3994
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _nullishCoalesce(price.token, () => ( "\u2014")) })
|
|
3993
3995
|
}
|
|
3994
3996
|
),
|
|
3995
3997
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3996
|
-
|
|
3998
|
+
_chunkNFCXUAE6js.DetailField,
|
|
3997
3999
|
{
|
|
3998
4000
|
label: t("billing.admin.prices.fields.stripeId"),
|
|
3999
4001
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: price.stripePriceId })
|
|
4000
4002
|
}
|
|
4001
4003
|
),
|
|
4002
4004
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4003
|
-
|
|
4005
|
+
_chunkNFCXUAE6js.DetailField,
|
|
4004
4006
|
{
|
|
4005
4007
|
label: t("billing.admin.prices.fields.description"),
|
|
4006
4008
|
value: _nullishCoalesce(price.description, () => ( "\u2014")),
|
|
@@ -4008,7 +4010,7 @@ function PriceDetails() {
|
|
|
4008
4010
|
}
|
|
4009
4011
|
),
|
|
4010
4012
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4011
|
-
|
|
4013
|
+
_chunkNFCXUAE6js.DetailField,
|
|
4012
4014
|
{
|
|
4013
4015
|
label: t("billing.admin.prices.fields.features"),
|
|
4014
4016
|
className: "md:col-span-2",
|
|
@@ -4016,11 +4018,11 @@ function PriceDetails() {
|
|
|
4016
4018
|
}
|
|
4017
4019
|
),
|
|
4018
4020
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4019
|
-
|
|
4021
|
+
_chunkNFCXUAE6js.DetailField,
|
|
4020
4022
|
{
|
|
4021
4023
|
label: t("billing.admin.prices.fields.platformFeatures"),
|
|
4022
4024
|
className: "md:col-span-2",
|
|
4023
|
-
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,
|
|
4025
|
+
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, _chunkNFCXUAE6js.Badge, { variant: "softGray", children: feature.name }, feature.id)) }) : "\u2014"
|
|
4024
4026
|
}
|
|
4025
4027
|
)
|
|
4026
4028
|
] })
|
|
@@ -4034,7 +4036,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, PriceDetails, "PriceDetails");
|
|
|
4034
4036
|
function PriceContainer() {
|
|
4035
4037
|
const { price } = usePriceContext();
|
|
4036
4038
|
if (!price) return null;
|
|
4037
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4039
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.RoundPageContainer, { module: _chunk6OFANJTEjs.Modules.StripePrice, id: price.id, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceDetails, {}) });
|
|
4038
4040
|
}
|
|
4039
4041
|
_chunk7QVYU63Ejs.__name.call(void 0, PriceContainer, "PriceContainer");
|
|
4040
4042
|
|
|
@@ -4159,10 +4161,10 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4159
4161
|
const importInputRef = _react.useRef.call(void 0, null);
|
|
4160
4162
|
const [seed, setSeed] = _react.useState.call(void 0, void 0);
|
|
4161
4163
|
const [seedNonce, setSeedNonce] = _react.useState.call(void 0, 0);
|
|
4162
|
-
const data =
|
|
4163
|
-
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) =>
|
|
4164
|
+
const data = _chunkNFCXUAE6js.useDataListRetriever.call(void 0, {
|
|
4165
|
+
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunk6OFANJTEjs.StripePriceService.listPrices({ ...params, productId }), "retriever"),
|
|
4164
4166
|
retrieverParams: {},
|
|
4165
|
-
module:
|
|
4167
|
+
module: _chunk6OFANJTEjs.Modules.StripePrice
|
|
4166
4168
|
});
|
|
4167
4169
|
_react.useEffect.call(void 0, () => {
|
|
4168
4170
|
if (priceVersion > 0) void data.refresh();
|
|
@@ -4197,7 +4199,7 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4197
4199
|
openSeededEditor(transfer.price);
|
|
4198
4200
|
} catch (error) {
|
|
4199
4201
|
console.error("[PricesList] price import failed", error);
|
|
4200
|
-
|
|
4202
|
+
_chunkNFCXUAE6js.errorToast.call(void 0, {
|
|
4201
4203
|
title: t("billing.admin.prices.import.errors.title"),
|
|
4202
4204
|
error: t("billing.admin.prices.import.errors.invalid")
|
|
4203
4205
|
});
|
|
@@ -4216,7 +4218,7 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4216
4218
|
"create-price"
|
|
4217
4219
|
),
|
|
4218
4220
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _react.Fragment, { children: [
|
|
4219
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
4221
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkNFCXUAE6js.Button, { variant: "outline", size: "sm", type: "button", onClick: () => _optionalChain([importInputRef, 'access', _178 => _178.current, 'optionalAccess', _179 => _179.click, 'call', _180 => _180()]), children: [
|
|
4220
4222
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.UploadIcon, {}),
|
|
4221
4223
|
t("billing.admin.prices.actions.import")
|
|
4222
4224
|
] }),
|
|
@@ -4234,7 +4236,7 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4234
4236
|
];
|
|
4235
4237
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
4236
4238
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4237
|
-
|
|
4239
|
+
_chunkNFCXUAE6js.ContentListTable,
|
|
4238
4240
|
{
|
|
4239
4241
|
data,
|
|
4240
4242
|
fields: [
|
|
@@ -4245,13 +4247,13 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4245
4247
|
"status" /* status */,
|
|
4246
4248
|
"actions" /* actions */
|
|
4247
4249
|
],
|
|
4248
|
-
tableGeneratorType:
|
|
4250
|
+
tableGeneratorType: _chunk6OFANJTEjs.Modules.StripePrice,
|
|
4249
4251
|
functions,
|
|
4250
4252
|
context: tableContext,
|
|
4251
4253
|
fullWidth,
|
|
4252
4254
|
title: t("billing.admin.prices.title"),
|
|
4253
4255
|
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4254
|
-
|
|
4256
|
+
_chunkNFCXUAE6js.EmptyState,
|
|
4255
4257
|
{
|
|
4256
4258
|
icon: _lucidereact.DollarSignIcon,
|
|
4257
4259
|
title: t("billing.admin.prices.empty.title"),
|
|
@@ -4291,18 +4293,18 @@ function ProductDetails() {
|
|
|
4291
4293
|
const { product } = useProductContext();
|
|
4292
4294
|
if (!product) return null;
|
|
4293
4295
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4294
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4296
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.SectionHeader, { children: t("billing.admin.products.tabs.details") }),
|
|
4295
4297
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
4296
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4298
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.DetailField, { label: t("billing.admin.products.fields.name"), value: product.name }),
|
|
4297
4299
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4298
|
-
|
|
4300
|
+
_chunkNFCXUAE6js.DetailField,
|
|
4299
4301
|
{
|
|
4300
4302
|
label: t("billing.admin.products.fields.status"),
|
|
4301
|
-
value: product.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4303
|
+
value: product.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Badge, { variant: "softGreen", children: t("billing.admin.products.status.active") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.Badge, { variant: "softGray", children: t("billing.admin.products.status.archived") })
|
|
4302
4304
|
}
|
|
4303
4305
|
),
|
|
4304
4306
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4305
|
-
|
|
4307
|
+
_chunkNFCXUAE6js.DetailField,
|
|
4306
4308
|
{
|
|
4307
4309
|
label: t("billing.admin.products.fields.description"),
|
|
4308
4310
|
value: _nullishCoalesce(product.description, () => ( "\u2014")),
|
|
@@ -4310,14 +4312,14 @@ function ProductDetails() {
|
|
|
4310
4312
|
}
|
|
4311
4313
|
),
|
|
4312
4314
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4313
|
-
|
|
4315
|
+
_chunkNFCXUAE6js.DetailField,
|
|
4314
4316
|
{
|
|
4315
4317
|
label: t("billing.admin.products.fields.prices"),
|
|
4316
4318
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: product.stripePrices.length })
|
|
4317
4319
|
}
|
|
4318
4320
|
),
|
|
4319
4321
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4320
|
-
|
|
4322
|
+
_chunkNFCXUAE6js.DetailField,
|
|
4321
4323
|
{
|
|
4322
4324
|
label: t("billing.admin.products.fields.stripeId"),
|
|
4323
4325
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: product.stripeProductId })
|
|
@@ -4335,9 +4337,9 @@ function ProductContainer() {
|
|
|
4335
4337
|
const { product } = useProductContext();
|
|
4336
4338
|
if (!product) return null;
|
|
4337
4339
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4338
|
-
|
|
4340
|
+
_chunkNFCXUAE6js.RoundPageContainer,
|
|
4339
4341
|
{
|
|
4340
|
-
module:
|
|
4342
|
+
module: _chunk6OFANJTEjs.Modules.StripeProduct,
|
|
4341
4343
|
id: product.id,
|
|
4342
4344
|
tabs: [
|
|
4343
4345
|
{
|
|
@@ -4346,7 +4348,7 @@ function ProductContainer() {
|
|
|
4346
4348
|
content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductDetails, {})
|
|
4347
4349
|
},
|
|
4348
4350
|
{
|
|
4349
|
-
key:
|
|
4351
|
+
key: _chunk6OFANJTEjs.Modules.StripePrice,
|
|
4350
4352
|
label: t("billing.admin.prices.title"),
|
|
4351
4353
|
// publishChrome={false}: SharedProvider REPLACES its value for the
|
|
4352
4354
|
// subtree (SharedContext.tsx:35-37), so a nested provider publishing
|
|
@@ -4370,26 +4372,26 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductContainer, "ProductContainer");
|
|
|
4370
4372
|
function ProductsList({ fullWidth } = {}) {
|
|
4371
4373
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4372
4374
|
const { catalogueVersion } = useProductContext();
|
|
4373
|
-
const data =
|
|
4374
|
-
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) =>
|
|
4375
|
+
const data = _chunkNFCXUAE6js.useDataListRetriever.call(void 0, {
|
|
4376
|
+
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunk6OFANJTEjs.StripeProductService.listProducts(params), "retriever"),
|
|
4375
4377
|
retrieverParams: {},
|
|
4376
|
-
module:
|
|
4378
|
+
module: _chunk6OFANJTEjs.Modules.StripeProduct
|
|
4377
4379
|
});
|
|
4378
4380
|
_react.useEffect.call(void 0, () => {
|
|
4379
4381
|
if (catalogueVersion > 0) void data.refresh();
|
|
4380
4382
|
}, [catalogueVersion]);
|
|
4381
4383
|
const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductEditor, {}, "create-product")];
|
|
4382
4384
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4383
|
-
|
|
4385
|
+
_chunkNFCXUAE6js.ContentListTable,
|
|
4384
4386
|
{
|
|
4385
4387
|
data,
|
|
4386
4388
|
fields: ["name" /* name */, "status" /* status */, "prices" /* prices */],
|
|
4387
|
-
tableGeneratorType:
|
|
4389
|
+
tableGeneratorType: _chunk6OFANJTEjs.Modules.StripeProduct,
|
|
4388
4390
|
functions,
|
|
4389
4391
|
fullWidth,
|
|
4390
4392
|
title: t("billing.admin.products.title"),
|
|
4391
4393
|
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4392
|
-
|
|
4394
|
+
_chunkNFCXUAE6js.EmptyState,
|
|
4393
4395
|
{
|
|
4394
4396
|
icon: _lucidereact.PackageIcon,
|
|
4395
4397
|
title: t("billing.admin.products.empty.title"),
|
|
@@ -4404,7 +4406,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductsList, "ProductsList");
|
|
|
4404
4406
|
// src/features/billing/stripe-product/components/containers/ProductsListContainer.tsx
|
|
4405
4407
|
|
|
4406
4408
|
function ProductsListContainer() {
|
|
4407
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductProvider, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4409
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductProvider, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkNFCXUAE6js.RoundPageContainer, { module: _chunk6OFANJTEjs.Modules.StripeProduct, fullWidth: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductsList, { fullWidth: true }) }) });
|
|
4408
4410
|
}
|
|
4409
4411
|
_chunk7QVYU63Ejs.__name.call(void 0, ProductsListContainer, "ProductsListContainer");
|
|
4410
4412
|
|
|
@@ -4467,5 +4469,5 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductsListContainer, "ProductsListContain
|
|
|
4467
4469
|
|
|
4468
4470
|
|
|
4469
4471
|
|
|
4470
|
-
exports.BillingAlertBanner = BillingAlertBanner; exports.BillingDashboardContainer = BillingDashboardContainer; exports.BillingDetailModal = BillingDetailModal; exports.BillingUsageSummaryCard = BillingUsageSummaryCard; exports.CancelSubscriptionDialog = CancelSubscriptionDialog; 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.formatCurrency =
|
|
4472
|
+
exports.BillingAlertBanner = BillingAlertBanner; exports.BillingDashboardContainer = BillingDashboardContainer; exports.BillingDetailModal = BillingDetailModal; exports.BillingUsageSummaryCard = BillingUsageSummaryCard; exports.CancelSubscriptionDialog = CancelSubscriptionDialog; 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.formatCurrency = _chunkNFCXUAE6js.formatCurrency; exports.formatDate = formatDate3; exports.formatInterval = _chunkNFCXUAE6js.formatInterval; exports.isStripeConfigured = isStripeConfigured; exports.priceLabel = priceLabel; exports.usePriceContext = usePriceContext; exports.useProductContext = useProductContext;
|
|
4471
4473
|
//# sourceMappingURL=index.js.map
|