@carlonicora/nextjs-jsonapi 1.108.0 → 1.109.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AssistantInterface-BYgI5z1-.d.mts → AssistantInterface-B1c8FhGA.d.mts} +2 -0
- package/dist/{AssistantInterface-DfDcz0gJ.d.ts → AssistantInterface-BBUHxOCd.d.ts} +2 -0
- package/dist/{AssistantMessageInterface-BpEhx2pC.d.ts → AssistantMessageInterface-Cs1yb-gF.d.ts} +3 -1
- package/dist/{AssistantMessageInterface-DJ3Me16Y.d.mts → AssistantMessageInterface-DQ3mH5L8.d.mts} +3 -1
- package/dist/{AuthComponent-B6DIk8Vf.d.ts → AuthComponent-Cd7lcYif.d.ts} +1 -1
- package/dist/{AuthComponent-BKI0ZbtD.d.mts → AuthComponent-DdxCFgUZ.d.mts} +1 -1
- package/dist/{BlockNoteEditor-2AXSTGGG.js → BlockNoteEditor-3XYBZLWO.js} +20 -19
- package/dist/BlockNoteEditor-3XYBZLWO.js.map +1 -0
- package/dist/{BlockNoteEditor-XVIBGXHF.mjs → BlockNoteEditor-EBFZG7AL.mjs} +5 -4
- package/dist/{BlockNoteEditor-XVIBGXHF.mjs.map → BlockNoteEditor-EBFZG7AL.mjs.map} +1 -1
- package/dist/{auth.interface-BBUgMZzs.d.ts → auth.interface-8b601idJ.d.ts} +1 -1
- package/dist/{auth.interface-XYEREOD6.d.mts → auth.interface-CXBF8Mhi.d.mts} +1 -1
- package/dist/billing/index.js +347 -346
- package/dist/billing/index.js.map +1 -1
- package/dist/billing/index.mjs +4 -3
- package/dist/billing/index.mjs.map +1 -1
- package/dist/chunk-3J7RQBF3.js +123 -0
- package/dist/chunk-3J7RQBF3.js.map +1 -0
- package/dist/{chunk-VLDLERJN.js → chunk-7E3O52U5.js} +15 -8
- package/dist/chunk-7E3O52U5.js.map +1 -0
- package/dist/{chunk-RXXZGPC3.js → chunk-CFI4WZ5R.js} +159 -113
- package/dist/chunk-CFI4WZ5R.js.map +1 -0
- package/dist/chunk-CQID6RCF.mjs +38 -0
- package/dist/chunk-CQID6RCF.mjs.map +1 -0
- package/dist/{chunk-56XBGQGU.mjs → chunk-CRTVAQEK.mjs} +42 -27
- package/dist/chunk-CRTVAQEK.mjs.map +1 -0
- package/dist/{chunk-N3NVIPSU.mjs → chunk-MSNNAHDB.mjs} +129 -83
- package/dist/{chunk-N3NVIPSU.mjs.map → chunk-MSNNAHDB.mjs.map} +1 -1
- package/dist/chunk-MZTKPPET.mjs +123 -0
- package/dist/chunk-MZTKPPET.mjs.map +1 -0
- package/dist/{chunk-HC3JFN3C.js → chunk-UHO3KUUH.js} +838 -823
- package/dist/chunk-UHO3KUUH.js.map +1 -0
- package/dist/{chunk-CFECWLHH.mjs → chunk-UOYIWJEJ.mjs} +10 -3
- package/dist/chunk-UOYIWJEJ.mjs.map +1 -0
- package/dist/chunk-YQQHAFBS.js +38 -0
- package/dist/chunk-YQQHAFBS.js.map +1 -0
- package/dist/client/index.d.mts +8 -16
- package/dist/client/index.d.ts +8 -16
- package/dist/client/index.js +5 -4
- package/dist/client/index.js.map +1 -1
- package/dist/client/index.mjs +4 -3
- package/dist/components/index.d.mts +6 -5
- package/dist/components/index.d.ts +6 -5
- package/dist/components/index.js +5 -4
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +4 -3
- package/dist/{config-CLQynoaa.d.ts → config-CN23v3eJ.d.ts} +4 -1
- package/dist/{config-k61pe_o2.d.mts → config-gh88Qn4h.d.mts} +4 -1
- package/dist/contexts/index.d.mts +18 -7
- package/dist/contexts/index.d.ts +18 -7
- package/dist/contexts/index.js +5 -4
- package/dist/contexts/index.js.map +1 -1
- package/dist/contexts/index.mjs +4 -3
- package/dist/core/index.d.mts +44 -11
- package/dist/core/index.d.ts +44 -11
- package/dist/core/index.js +2 -2
- package/dist/core/index.mjs +1 -1
- package/dist/features/help/index.css +29 -0
- package/dist/features/help/index.css.map +1 -0
- package/dist/features/help/index.d.mts +115 -0
- package/dist/features/help/index.d.ts +115 -0
- package/dist/features/help/index.js +532 -0
- package/dist/features/help/index.js.map +1 -0
- package/dist/features/help/index.mjs +532 -0
- package/dist/features/help/index.mjs.map +1 -0
- package/dist/features/help/server/createHelpAssetRouteHandler.d.mts +11 -0
- package/dist/features/help/server/createHelpAssetRouteHandler.d.ts +11 -0
- package/dist/features/help/server/createHelpAssetRouteHandler.js +43 -0
- package/dist/features/help/server/createHelpAssetRouteHandler.js.map +1 -0
- package/dist/features/help/server/createHelpAssetRouteHandler.mjs +43 -0
- package/dist/features/help/server/createHelpAssetRouteHandler.mjs.map +1 -0
- package/dist/features/help/server.d.mts +71 -0
- package/dist/features/help/server.d.ts +71 -0
- package/dist/features/help/server.js +123 -0
- package/dist/features/help/server.js.map +1 -0
- package/dist/features/help/server.mjs +123 -0
- package/dist/features/help/server.mjs.map +1 -0
- package/dist/help-content-config.interface-B9L02u9i.d.mts +50 -0
- package/dist/help-content-config.interface-B9L02u9i.d.ts +50 -0
- package/dist/index.d.mts +10 -8
- package/dist/index.d.ts +10 -8
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -2
- package/dist/{notification.interface-aLEJbA_g.d.ts → notification.interface-C1T1C2ee.d.ts} +1 -100
- package/dist/{notification.interface-DLZGtV7Z.d.mts → notification.interface-DIxR23eS.d.mts} +1 -100
- package/dist/{s3.service-CVgLWaDc.d.mts → s3.service-0BTClOYO.d.mts} +2 -2
- package/dist/{s3.service-SLlX0Zbz.d.ts → s3.service-CT27Fm1s.d.ts} +2 -2
- package/dist/server/index.d.mts +4 -3
- package/dist/server/index.d.ts +4 -3
- package/dist/server/index.js +3 -3
- package/dist/server/index.mjs +1 -1
- package/dist/types-CQSjy7et.d.mts +101 -0
- package/dist/types-DHOxe8rc.d.ts +101 -0
- package/dist/usePageUrlGenerator-tjq2mlDV.d.ts +14 -0
- package/dist/usePageUrlGenerator-uOnyJ6j2.d.mts +14 -0
- package/dist/{useSocket-BkxHHujj.d.mts → useSocket-B1fMIr17.d.mts} +1 -1
- package/dist/{useSocket-CMDjWFYm.d.ts → useSocket-BdJTBXKv.d.ts} +1 -1
- package/package.json +20 -1
- package/src/client/config.ts +9 -1
- package/src/core/registry/helpStore.ts +45 -0
- package/src/features/assistant/contexts/AssistantContext.tsx +35 -19
- package/src/features/assistant/contexts/__tests__/AssistantContext.spec.tsx +66 -6
- package/src/features/assistant/data/Assistant.ts +2 -0
- package/src/features/assistant/data/AssistantInterface.ts +2 -0
- package/src/features/assistant/data/AssistantService.ts +18 -8
- package/src/features/assistant-message/components/parts/MessageSourcesPanel.tsx +6 -4
- package/src/features/assistant-message/components/parts/tabs/ContentsTab.tsx +5 -1
- package/src/features/assistant-message/components/parts/tabs/ReferencesTab.tsx +2 -1
- package/src/features/assistant-message/data/AssistantMessage.ts +27 -1
- package/src/features/assistant-message/data/AssistantMessageInterface.ts +1 -0
- package/src/features/assistant-message/data/__tests__/AssistantMessage.spec.ts +7 -3
- package/src/features/help/components/HelpArticleBody.tsx +54 -0
- package/src/features/help/components/HelpAskAi.tsx +36 -0
- package/src/features/help/components/HelpAssistantSheet.tsx +53 -0
- package/src/features/help/components/HelpHeader.tsx +40 -0
- package/src/features/help/components/HelpHint.tsx +77 -0
- package/src/features/help/components/HelpSearchResultRow.tsx +51 -0
- package/src/features/help/components/HelpSideNav.tsx +84 -0
- package/src/features/help/components/HelpTOC.tsx +49 -0
- package/src/features/help/components/__tests__/HelpAskAi.spec.tsx +68 -0
- package/src/features/help/components/__tests__/HelpAssistantSheet.spec.tsx +36 -0
- package/src/features/help/components/__tests__/HelpHint.spec.tsx +50 -0
- package/src/features/help/components/__tests__/HelpSearchResultRow.spec.tsx +59 -0
- package/src/features/help/components/__tests__/HelpSideNav.spec.tsx +52 -0
- package/src/features/help/components/mdx/Callout.tsx +21 -0
- package/src/features/help/components/mdx/EntityRef.tsx +18 -0
- package/src/features/help/components/mdx/KeyBinding.tsx +6 -0
- package/src/features/help/components/mdx/Related.tsx +33 -0
- package/src/features/help/components/mdx/Screenshot.tsx +9 -0
- package/src/features/help/components/mdx/Steps.tsx +21 -0
- package/src/features/help/components/mdx/Video.tsx +8 -0
- package/src/features/help/components/mdx/mdx-server-components.ts +23 -0
- package/src/features/help/components/mdx/mdxComponents.ts +9 -0
- package/src/features/help/contexts/HelpContext.spec.tsx +28 -0
- package/src/features/help/contexts/HelpContext.tsx +24 -0
- package/src/features/help/hooks/useHelp.ts +1 -0
- package/src/features/help/hooks/useHelpArticle.ts +7 -0
- package/src/features/help/hooks/useHelpFilter.ts +27 -0
- package/src/features/help/hooks/useHelpManifest.ts +5 -0
- package/src/features/help/i18n-keys.ts +34 -0
- package/src/features/help/index.ts +27 -0
- package/src/features/help/interfaces/help-content-config.interface.ts +17 -0
- package/src/features/help/server/__tests__/createHelpAssetRouteHandler.spec.ts +43 -0
- package/src/features/help/server/createHelpAssetRouteHandler.ts +35 -0
- package/src/features/help/server/generateHelpArticleMetadata.ts +18 -0
- package/src/features/help/server/generateHelpArticleStaticParams.ts +7 -0
- package/src/features/help/server/generateHelpModeStaticParams.ts +5 -0
- package/src/features/help/server/getHelpContent.ts +17 -0
- package/src/features/help/server/index.ts +8 -0
- package/src/features/help/server/serializeHelpArticle.tsx +46 -0
- package/src/features/help/server-entry.ts +20 -0
- package/src/features/help/types/help-article.types.ts +37 -0
- package/src/features/help/utils/__tests__/helpNavigation.spec.ts +70 -0
- package/src/features/help/utils/articleUrl.ts +13 -0
- package/src/features/help/utils/helpNavigation.ts +29 -0
- package/src/features/how-to/HowToModule.ts +1 -1
- package/src/features/how-to/data/HowTo.ts +21 -3
- package/src/features/how-to/data/HowToInterface.ts +1 -0
- package/src/index.ts +4 -0
- package/dist/BlockNoteEditor-2AXSTGGG.js.map +0 -1
- package/dist/chunk-56XBGQGU.mjs.map +0 -1
- package/dist/chunk-CFECWLHH.mjs.map +0 -1
- package/dist/chunk-HC3JFN3C.js.map +0 -1
- package/dist/chunk-RXXZGPC3.js.map +0 -1
- package/dist/chunk-VLDLERJN.js.map +0 -1
package/dist/billing/index.js
CHANGED
|
@@ -47,11 +47,12 @@
|
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
|
|
50
|
-
var
|
|
50
|
+
var _chunkUHO3KUUHjs = require('../chunk-UHO3KUUH.js');
|
|
51
51
|
|
|
52
52
|
|
|
53
53
|
|
|
54
|
-
var
|
|
54
|
+
var _chunk7E3O52U5js = require('../chunk-7E3O52U5.js');
|
|
55
|
+
require('../chunk-YQQHAFBS.js');
|
|
55
56
|
|
|
56
57
|
|
|
57
58
|
|
|
@@ -62,7 +63,7 @@ var _chunkVLDLERJNjs = require('../chunk-VLDLERJN.js');
|
|
|
62
63
|
|
|
63
64
|
|
|
64
65
|
|
|
65
|
-
var
|
|
66
|
+
var _chunkCFI4WZ5Rjs = require('../chunk-CFI4WZ5R.js');
|
|
66
67
|
require('../chunk-LXKSUWAV.js');
|
|
67
68
|
require('../chunk-IBS6NI7D.js');
|
|
68
69
|
require('../chunk-J5LROFGL.js');
|
|
@@ -113,41 +114,41 @@ function SubscriptionSummaryCard({
|
|
|
113
114
|
onManageClick
|
|
114
115
|
}) {
|
|
115
116
|
if (loading) {
|
|
116
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
117
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
118
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
117
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.Card, { children: [
|
|
118
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
119
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.CardTitle, { className: "text-sm font-medium", children: "Subscriptions" }),
|
|
119
120
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
120
121
|
] }),
|
|
121
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
122
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
123
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
124
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
122
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.CardContent, { children: [
|
|
123
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
124
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Skeleton, { className: "h-4 w-24 mb-1" }),
|
|
125
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Skeleton, { className: "h-4 w-40" })
|
|
125
126
|
] })
|
|
126
127
|
] });
|
|
127
128
|
}
|
|
128
129
|
if (error) {
|
|
129
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
130
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
131
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
130
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.Card, { children: [
|
|
131
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
132
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.CardTitle, { className: "text-sm font-medium", children: "Subscriptions" }),
|
|
132
133
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
133
134
|
] }),
|
|
134
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
135
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-destructive", children: error }) })
|
|
135
136
|
] });
|
|
136
137
|
}
|
|
137
138
|
const activeSubscriptions = subscriptions.filter(
|
|
138
139
|
(sub) => sub.status === "active" /* ACTIVE */ || sub.status === "trialing" /* TRIALING */
|
|
139
140
|
);
|
|
140
141
|
const primarySubscription = activeSubscriptions[0];
|
|
141
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
142
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
143
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
142
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
|
|
143
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
144
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.CardTitle, { className: "text-sm font-medium", children: "Subscriptions" }),
|
|
144
145
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
145
146
|
] }),
|
|
146
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
147
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.CardContent, { children: subscriptions.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
147
148
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No active plan" }),
|
|
148
149
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Subscribe to get started" }),
|
|
149
150
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
150
|
-
|
|
151
|
+
_chunkUHO3KUUHjs.Button,
|
|
151
152
|
{
|
|
152
153
|
variant: "outline",
|
|
153
154
|
size: "sm",
|
|
@@ -166,7 +167,7 @@ function SubscriptionSummaryCard({
|
|
|
166
167
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
167
168
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: formatPlanName(primarySubscription) }),
|
|
168
169
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
169
|
-
|
|
170
|
+
_chunkUHO3KUUHjs.Badge,
|
|
170
171
|
{
|
|
171
172
|
variant: primarySubscription.cancelAtPeriodEnd ? "secondary" : getStatusBadgeVariant(primarySubscription.status),
|
|
172
173
|
children: primarySubscription.cancelAtPeriodEnd ? "Canceling" : primarySubscription.status
|
|
@@ -208,37 +209,37 @@ function PaymentMethodSummaryCard({
|
|
|
208
209
|
onManageClick
|
|
209
210
|
}) {
|
|
210
211
|
if (loading) {
|
|
211
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
212
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
213
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
212
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.Card, { children: [
|
|
213
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
214
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.CardTitle, { className: "text-sm font-medium", children: "Payment Method" }),
|
|
214
215
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
215
216
|
] }),
|
|
216
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
217
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
218
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
217
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.CardContent, { children: [
|
|
218
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
219
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Skeleton, { className: "h-4 w-24" })
|
|
219
220
|
] })
|
|
220
221
|
] });
|
|
221
222
|
}
|
|
222
223
|
if (error) {
|
|
223
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
224
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
225
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
224
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.Card, { children: [
|
|
225
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
226
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.CardTitle, { className: "text-sm font-medium", children: "Payment Method" }),
|
|
226
227
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
227
228
|
] }),
|
|
228
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
229
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-destructive", children: error }) })
|
|
229
230
|
] });
|
|
230
231
|
}
|
|
231
232
|
const defaultMethod = paymentMethods.find((pm) => pm.id === defaultPaymentMethodId) || paymentMethods[0];
|
|
232
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
233
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
234
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
233
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
|
|
234
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
235
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.CardTitle, { className: "text-sm font-medium", children: "Payment Method" }),
|
|
235
236
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
236
237
|
] }),
|
|
237
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
238
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.CardContent, { children: paymentMethods.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
238
239
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No payment method" }),
|
|
239
240
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Add a card to enable subscriptions" }),
|
|
240
241
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
241
|
-
|
|
242
|
+
_chunkUHO3KUUHjs.Button,
|
|
242
243
|
{
|
|
243
244
|
variant: "outline",
|
|
244
245
|
size: "sm",
|
|
@@ -302,7 +303,7 @@ function CustomerInfoCard({ customer, loading, error }) {
|
|
|
302
303
|
e.stopPropagation();
|
|
303
304
|
setPortalLoading(true);
|
|
304
305
|
try {
|
|
305
|
-
const { url } = await
|
|
306
|
+
const { url } = await _chunkCFI4WZ5Rjs.StripeCustomerService.createPortalSession();
|
|
306
307
|
window.open(url, "_blank");
|
|
307
308
|
} catch (err) {
|
|
308
309
|
console.error("[CustomerInfoCard] Failed to create portal session:", err);
|
|
@@ -311,52 +312,52 @@ function CustomerInfoCard({ customer, loading, error }) {
|
|
|
311
312
|
}
|
|
312
313
|
}, "handlePortalClick");
|
|
313
314
|
if (loading) {
|
|
314
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
315
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
316
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
315
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.Card, { children: [
|
|
316
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
317
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.CardTitle, { className: "text-sm font-medium", children: "Billing Account" }),
|
|
317
318
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
318
319
|
] }),
|
|
319
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
320
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
321
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
322
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
320
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.CardContent, { children: [
|
|
321
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
322
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Skeleton, { className: "h-4 w-48 mb-1" }),
|
|
323
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Skeleton, { className: "h-4 w-24" })
|
|
323
324
|
] })
|
|
324
325
|
] });
|
|
325
326
|
}
|
|
326
327
|
if (error) {
|
|
327
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
328
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
329
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
328
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.Card, { children: [
|
|
329
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
330
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.CardTitle, { className: "text-sm font-medium", children: "Billing Account" }),
|
|
330
331
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
331
332
|
] }),
|
|
332
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
333
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-destructive", children: error }) })
|
|
333
334
|
] });
|
|
334
335
|
}
|
|
335
336
|
if (!customer) {
|
|
336
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
337
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
338
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
337
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.Card, { children: [
|
|
338
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
339
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.CardTitle, { className: "text-sm font-medium", children: "Billing Account" }),
|
|
339
340
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
340
341
|
] }),
|
|
341
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
342
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.CardContent, { children: [
|
|
342
343
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "Not set up" }),
|
|
343
344
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Billing account will be created when you subscribe" })
|
|
344
345
|
] })
|
|
345
346
|
] });
|
|
346
347
|
}
|
|
347
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
348
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
349
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
348
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.Card, { children: [
|
|
349
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
350
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.CardTitle, { className: "text-sm font-medium", children: "Billing Account" }),
|
|
350
351
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
351
352
|
] }),
|
|
352
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
353
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
353
354
|
customer.name && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: customer.name }),
|
|
354
355
|
customer.email && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: customer.email }),
|
|
355
356
|
customer.balance !== void 0 && customer.balance !== 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm", children: [
|
|
356
357
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground", children: "Credit Balance: " }),
|
|
357
358
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: customer.balance < 0 ? "text-green-600" : "text-destructive", children: formatBalance(customer.balance, customer.currency) })
|
|
358
359
|
] }),
|
|
359
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
360
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.Button, { variant: "outline", size: "sm", className: "mt-2", onClick: handlePortalClick, disabled: portalLoading, children: [
|
|
360
361
|
portalLoading ? "Loading..." : "Manage in Stripe Portal",
|
|
361
362
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ExternalLink, { className: "h-4 w-4 ml-1" })
|
|
362
363
|
] })
|
|
@@ -400,42 +401,42 @@ function formatAmount(amount, currency) {
|
|
|
400
401
|
_chunk7QVYU63Ejs.__name.call(void 0, formatAmount, "formatAmount");
|
|
401
402
|
function InvoicesSummaryCard({ invoices, loading, error, onViewAllClick }) {
|
|
402
403
|
if (loading) {
|
|
403
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
404
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
405
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
404
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.Card, { children: [
|
|
405
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
406
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.CardTitle, { className: "text-sm font-medium", children: "Recent Invoices" }),
|
|
406
407
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
407
408
|
] }),
|
|
408
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
409
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
410
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
411
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
409
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.CardContent, { children: [
|
|
410
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Skeleton, { className: "h-6 w-24 mb-2" }),
|
|
411
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Skeleton, { className: "h-4 w-32 mb-1" }),
|
|
412
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Skeleton, { className: "h-4 w-20" })
|
|
412
413
|
] })
|
|
413
414
|
] });
|
|
414
415
|
}
|
|
415
416
|
if (error) {
|
|
416
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
417
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
418
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
417
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.Card, { children: [
|
|
418
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
419
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.CardTitle, { className: "text-sm font-medium", children: "Recent Invoices" }),
|
|
419
420
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
420
421
|
] }),
|
|
421
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
422
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-destructive", children: error }) })
|
|
422
423
|
] });
|
|
423
424
|
}
|
|
424
425
|
const latestInvoice = invoices[0];
|
|
425
426
|
const paidInvoices = invoices.filter((inv) => inv.status === "paid" /* PAID */);
|
|
426
427
|
const openInvoices = invoices.filter((inv) => inv.status === "open" /* OPEN */);
|
|
427
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
428
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
429
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
428
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewAllClick, children: [
|
|
429
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
430
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.CardTitle, { className: "text-sm font-medium", children: "Recent Invoices" }),
|
|
430
431
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
431
432
|
] }),
|
|
432
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
433
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.CardContent, { children: invoices.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
433
434
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No invoices yet" }),
|
|
434
435
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Invoices will appear after your first billing cycle" })
|
|
435
436
|
] }) : latestInvoice ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
436
437
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
437
438
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: formatAmount(latestInvoice.total, latestInvoice.currency) }),
|
|
438
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
439
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Badge, { variant: getStatusBadgeVariant2(latestInvoice.status), children: latestInvoice.status })
|
|
439
440
|
] }),
|
|
440
441
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: latestInvoice.stripeInvoiceNumber || `Invoice from ${formatDate2(latestInvoice.periodStart)}` }),
|
|
441
442
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-4 text-xs text-muted-foreground", children: [
|
|
@@ -475,24 +476,24 @@ function BillingUsageSummaryCard({
|
|
|
475
476
|
onViewDetailsClick
|
|
476
477
|
}) {
|
|
477
478
|
if (loading) {
|
|
478
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
479
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
480
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
479
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.Card, { children: [
|
|
480
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
481
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.CardTitle, { className: "text-sm font-medium", children: "Usage This Month" }),
|
|
481
482
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
482
483
|
] }),
|
|
483
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
484
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
485
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
484
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.CardContent, { children: [
|
|
485
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Skeleton, { className: "h-6 w-24 mb-2" }),
|
|
486
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Skeleton, { className: "h-4 w-32" })
|
|
486
487
|
] })
|
|
487
488
|
] });
|
|
488
489
|
}
|
|
489
490
|
if (error) {
|
|
490
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
491
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
492
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
491
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.Card, { children: [
|
|
492
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
493
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.CardTitle, { className: "text-sm font-medium", children: "Usage This Month" }),
|
|
493
494
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
494
495
|
] }),
|
|
495
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
496
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-destructive", children: error }) })
|
|
496
497
|
] });
|
|
497
498
|
}
|
|
498
499
|
const totalUsage = Object.values(summaries).reduce((acc, summary) => {
|
|
@@ -500,12 +501,12 @@ function BillingUsageSummaryCard({
|
|
|
500
501
|
}, 0);
|
|
501
502
|
const primaryMeter = meters.find((m) => _optionalChain([summaries, 'access', _17 => _17[m.id], 'optionalAccess', _18 => _18.aggregatedValue]));
|
|
502
503
|
const primarySummary = primaryMeter ? summaries[primaryMeter.id] : null;
|
|
503
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
504
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
505
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
504
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewDetailsClick, children: [
|
|
505
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
506
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.CardTitle, { className: "text-sm font-medium", children: "Usage This Month" }),
|
|
506
507
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
507
508
|
] }),
|
|
508
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
509
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.CardContent, { children: meters.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
509
510
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No meters" }),
|
|
510
511
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "No usage meters are configured" })
|
|
511
512
|
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
@@ -557,7 +558,7 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
|
|
|
557
558
|
const fetchSetupIntent = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
558
559
|
setLoading(true);
|
|
559
560
|
try {
|
|
560
|
-
const intent = await
|
|
561
|
+
const intent = await _chunkCFI4WZ5Rjs.StripeCustomerService.createSetupIntent();
|
|
561
562
|
setSetupIntent(intent);
|
|
562
563
|
} catch (err) {
|
|
563
564
|
console.error("[PaymentMethodForm] Failed to create setup intent:", err);
|
|
@@ -595,7 +596,7 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
|
|
|
595
596
|
return;
|
|
596
597
|
}
|
|
597
598
|
if (setAsDefault && _optionalChain([confirmedSetupIntent, 'optionalAccess', _19 => _19.payment_method])) {
|
|
598
|
-
await
|
|
599
|
+
await _chunkCFI4WZ5Rjs.StripeCustomerService.setDefaultPaymentMethod({
|
|
599
600
|
paymentMethodId: typeof confirmedSetupIntent.payment_method === "string" ? confirmedSetupIntent.payment_method : confirmedSetupIntent.payment_method.id
|
|
600
601
|
});
|
|
601
602
|
}
|
|
@@ -611,7 +612,7 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
|
|
|
611
612
|
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..." }) });
|
|
612
613
|
}
|
|
613
614
|
if (!setupIntent && error) {
|
|
614
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
615
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.AlertDescription, { children: error }) });
|
|
615
616
|
}
|
|
616
617
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: handleSubmit, className: "flex flex-col gap-y-4", children: [
|
|
617
618
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rounded-md border border-gray-300 p-3", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -634,13 +635,13 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
|
|
|
634
635
|
}
|
|
635
636
|
) }),
|
|
636
637
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
637
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
638
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
638
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Checkbox, { id: "setAsDefault", checked: setAsDefault, onCheckedChange: (checked) => setSetAsDefault(!!checked) }),
|
|
639
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Label, { htmlFor: "setAsDefault", className: "text-sm font-normal", children: "Set as default payment method" })
|
|
639
640
|
] }),
|
|
640
|
-
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
641
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.AlertDescription, { children: error }) }),
|
|
641
642
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-x-2", children: [
|
|
642
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
643
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
643
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Button, { type: "button", variant: "outline", onClick: onCancel, disabled: isSubmitting || isLoading, children: "Cancel" }),
|
|
644
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Button, { type: "submit", disabled: !stripe || isSubmitting || isLoading, children: isSubmitting ? "Processing..." : "Add Card" })
|
|
644
645
|
] })
|
|
645
646
|
] });
|
|
646
647
|
}
|
|
@@ -656,10 +657,10 @@ function PaymentMethodEditor({ open, onOpenChange, onSuccess }) {
|
|
|
656
657
|
const handleCancel = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
657
658
|
onOpenChange(false);
|
|
658
659
|
}, "handleCancel");
|
|
659
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
660
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
661
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
662
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
660
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.DialogContent, { className: "max-w-md", children: [
|
|
661
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.DialogHeader, { children: [
|
|
662
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.DialogTitle, { children: "Add Payment Method" }),
|
|
663
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.DialogDescription, { children: "Add a new payment method to your account. Your card information is securely processed by Stripe." })
|
|
663
664
|
] }),
|
|
664
665
|
open && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodForm, { onSuccess: handleSuccess, onCancel: handleCancel })
|
|
665
666
|
] }) });
|
|
@@ -683,7 +684,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
683
684
|
_react.useEffect.call(void 0, () => {
|
|
684
685
|
const loadCustomer = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
685
686
|
try {
|
|
686
|
-
const fetchedCustomer = await
|
|
687
|
+
const fetchedCustomer = await _chunkCFI4WZ5Rjs.StripeCustomerService.getCustomer();
|
|
687
688
|
setCustomer(fetchedCustomer);
|
|
688
689
|
} catch (error) {
|
|
689
690
|
console.error("[PaymentMethodCard] Failed to load customer:", error);
|
|
@@ -700,7 +701,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
700
701
|
const handleSetDefault = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
701
702
|
setLoading(true);
|
|
702
703
|
try {
|
|
703
|
-
await
|
|
704
|
+
await _chunkCFI4WZ5Rjs.StripeCustomerService.setDefaultPaymentMethod({ paymentMethodId: paymentMethod.id });
|
|
704
705
|
onUpdate();
|
|
705
706
|
} catch (error) {
|
|
706
707
|
console.error("[PaymentMethodCard] Failed to set as default:", error);
|
|
@@ -711,7 +712,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
711
712
|
const handleRemove = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
712
713
|
setLoading(true);
|
|
713
714
|
try {
|
|
714
|
-
await
|
|
715
|
+
await _chunkCFI4WZ5Rjs.StripeCustomerService.removePaymentMethod({ paymentMethodId: paymentMethod.id });
|
|
715
716
|
setShowRemoveDialog(false);
|
|
716
717
|
onUpdate();
|
|
717
718
|
} catch (error) {
|
|
@@ -720,16 +721,16 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
720
721
|
}
|
|
721
722
|
}, "handleRemove");
|
|
722
723
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
723
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
724
|
-
isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
725
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
724
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.Card, { className: "relative", children: [
|
|
725
|
+
isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Badge, { className: "absolute right-2 top-2 bg-green-100 text-green-800 hover:bg-green-100", children: "Default" }),
|
|
726
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.CardHeader, { className: "flex flex-row items-center justify-between pb-2", children: [
|
|
726
727
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
727
728
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-2xl", children: brandIcon }),
|
|
728
729
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium capitalize", children: brand })
|
|
729
730
|
] }),
|
|
730
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
731
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
732
|
-
|
|
731
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.DropdownMenu, { children: [
|
|
732
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.DropdownMenuTrigger, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
733
|
+
_chunkUHO3KUUHjs.Button,
|
|
733
734
|
{
|
|
734
735
|
render: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {}),
|
|
735
736
|
nativeButton: false,
|
|
@@ -740,13 +741,13 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
740
741
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.MoreVertical, { className: "h-4 w-4" })
|
|
741
742
|
}
|
|
742
743
|
) }),
|
|
743
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
744
|
-
!isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
745
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
744
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.DropdownMenuContent, { align: "end", children: [
|
|
745
|
+
!isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.DropdownMenuItem, { onClick: handleSetDefault, disabled: loading, children: "Set as Default" }),
|
|
746
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.DropdownMenuItem, { onClick: () => setShowRemoveDialog(true), disabled: loading, className: "text-red-600", children: "Remove" })
|
|
746
747
|
] })
|
|
747
748
|
] })
|
|
748
749
|
] }),
|
|
749
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
750
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-1", children: [
|
|
750
751
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-lg font-semibold", children: [
|
|
751
752
|
"\u2022\u2022\u2022\u2022 ",
|
|
752
753
|
last4
|
|
@@ -759,17 +760,17 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
759
760
|
] })
|
|
760
761
|
] }) })
|
|
761
762
|
] }),
|
|
762
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
763
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
764
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
765
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
763
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.AlertDialog, { open: showRemoveDialog, onOpenChange: setShowRemoveDialog, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.AlertDialogContent, { children: [
|
|
764
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.AlertDialogHeader, { children: [
|
|
765
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.AlertDialogTitle, { children: "Remove Payment Method" }),
|
|
766
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.AlertDialogDescription, { children: [
|
|
766
767
|
"Are you sure you want to remove this payment method? This action cannot be undone.",
|
|
767
768
|
isDefault && " This is your default payment method."
|
|
768
769
|
] })
|
|
769
770
|
] }),
|
|
770
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
771
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
772
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
771
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.AlertDialogFooter, { children: [
|
|
772
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.AlertDialogCancel, { disabled: loading, children: "Cancel" }),
|
|
773
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.AlertDialogAction, { onClick: handleRemove, disabled: loading, className: "bg-red-600 hover:bg-red-700", children: loading ? "Removing..." : "Remove" })
|
|
773
774
|
] })
|
|
774
775
|
] }) })
|
|
775
776
|
] });
|
|
@@ -792,7 +793,7 @@ function PaymentMethodsContainer() {
|
|
|
792
793
|
const loadPaymentMethods = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
793
794
|
setLoading(true);
|
|
794
795
|
try {
|
|
795
|
-
const fetchedPaymentMethods = await
|
|
796
|
+
const fetchedPaymentMethods = await _chunkCFI4WZ5Rjs.StripeCustomerService.listPaymentMethods();
|
|
796
797
|
setPaymentMethods(fetchedPaymentMethods);
|
|
797
798
|
} catch (error) {
|
|
798
799
|
console.error("[PaymentMethodsContainer] Failed to load payment methods:", error);
|
|
@@ -812,14 +813,14 @@ function PaymentMethodsContainer() {
|
|
|
812
813
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8" }),
|
|
813
814
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-3xl font-bold", children: "Payment Methods" })
|
|
814
815
|
] }),
|
|
815
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
816
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Button, { onClick: () => setShowAddPaymentMethod(true), children: "Add Payment Method" })
|
|
816
817
|
] }),
|
|
817
818
|
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: [
|
|
818
819
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-16 w-16 text-muted-foreground" }),
|
|
819
820
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
820
821
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "mb-2 text-xl font-semibold", children: "No payment methods" }),
|
|
821
822
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mb-4 text-muted-foreground", children: "Add a payment method to enable subscriptions and secure checkout." }),
|
|
822
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
823
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Button, { onClick: () => setShowAddPaymentMethod(true), children: "Add Your First Card" })
|
|
823
824
|
] })
|
|
824
825
|
] }),
|
|
825
826
|
paymentMethods.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodsList, { paymentMethods, onUpdate: loadPaymentMethods }),
|
|
@@ -948,13 +949,13 @@ function InvoiceDetails({
|
|
|
948
949
|
return invoice.stripeInvoiceId.slice(-8);
|
|
949
950
|
}, "getInvoiceNumber");
|
|
950
951
|
const productName = _optionalChain([invoice, 'access', _29 => _29.subscription, 'optionalAccess', _30 => _30.price, 'optionalAccess', _31 => _31.product, 'optionalAccess', _32 => _32.name]) || "Subscription";
|
|
951
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
952
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
953
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
952
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.DialogContent, { className: "max-w-2xl", children: [
|
|
953
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.DialogHeader, { children: [
|
|
954
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.DialogTitle, { children: [
|
|
954
955
|
"Invoice ",
|
|
955
956
|
getInvoiceNumber()
|
|
956
957
|
] }),
|
|
957
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
958
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.DialogDescription, { children: formatDate3(invoice.periodStart) })
|
|
958
959
|
] }),
|
|
959
960
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
960
961
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
@@ -1019,15 +1020,15 @@ function InvoiceDetails({
|
|
|
1019
1020
|
] })
|
|
1020
1021
|
] }),
|
|
1021
1022
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2 pt-4 border-t", children: [
|
|
1022
|
-
invoice.stripePdfUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1023
|
+
invoice.stripePdfUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.Button, { variant: "outline", onClick: handleDownloadPDF, children: [
|
|
1023
1024
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Download, { className: "mr-2 h-4 w-4" }),
|
|
1024
1025
|
"Download PDF"
|
|
1025
1026
|
] }),
|
|
1026
|
-
invoice.status === "open" /* OPEN */ && invoice.attempted && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1027
|
+
invoice.status === "open" /* OPEN */ && invoice.attempted && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.Button, { variant: "default", onClick: handleRetryPayment, children: [
|
|
1027
1028
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RefreshCw, { className: "mr-2 h-4 w-4" }),
|
|
1028
1029
|
"Retry Payment"
|
|
1029
1030
|
] }),
|
|
1030
|
-
invoice.stripeHostedInvoiceUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1031
|
+
invoice.stripeHostedInvoiceUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.Button, { variant: "outline", onClick: handleViewInStripe, children: [
|
|
1031
1032
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ExternalLink, { className: "mr-2 h-4 w-4" }),
|
|
1032
1033
|
"View in Stripe"
|
|
1033
1034
|
] })
|
|
@@ -1051,30 +1052,30 @@ function InvoicesList({ invoices, onInvoicesChange }) {
|
|
|
1051
1052
|
return invoice.stripeInvoiceId.slice(-8);
|
|
1052
1053
|
}, "getInvoiceNumber");
|
|
1053
1054
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1054
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1055
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1056
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1057
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1058
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1059
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1060
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1055
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.Table, { children: [
|
|
1056
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.TableRow, { children: [
|
|
1057
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.TableHead, { children: "Invoice #" }),
|
|
1058
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.TableHead, { children: "Date" }),
|
|
1059
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.TableHead, { children: "Status" }),
|
|
1060
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.TableHead, { className: "text-right", children: "Amount" }),
|
|
1061
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.TableHead, { children: "Period" })
|
|
1061
1062
|
] }) }),
|
|
1062
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1063
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.TableBody, { children: invoices.map((invoice) => {
|
|
1063
1064
|
const invoiceNumber = getInvoiceNumber(invoice);
|
|
1064
1065
|
const date = formatDate3(invoice.periodStart);
|
|
1065
1066
|
const amount = formatCurrency(invoice.total, invoice.currency);
|
|
1066
1067
|
const period = `${formatDate3(invoice.periodStart)} - ${formatDate3(invoice.periodEnd)}`;
|
|
1067
1068
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1068
|
-
|
|
1069
|
+
_chunkUHO3KUUHjs.TableRow,
|
|
1069
1070
|
{
|
|
1070
1071
|
onClick: () => handleRowClick(invoice),
|
|
1071
1072
|
className: "cursor-pointer hover:bg-muted/50",
|
|
1072
1073
|
children: [
|
|
1073
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1074
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1075
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1076
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1077
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1074
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.TableCell, { className: "font-medium", children: invoiceNumber }),
|
|
1075
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.TableCell, { className: "text-muted-foreground text-sm", children: date }),
|
|
1076
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InvoiceStatusBadge, { status: invoice.status }) }),
|
|
1077
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.TableCell, { className: "text-right font-medium", children: amount }),
|
|
1078
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.TableCell, { className: "text-muted-foreground text-sm", children: period })
|
|
1078
1079
|
]
|
|
1079
1080
|
},
|
|
1080
1081
|
invoice.id
|
|
@@ -1107,7 +1108,7 @@ function InvoicesContainer() {
|
|
|
1107
1108
|
setLoading(true);
|
|
1108
1109
|
try {
|
|
1109
1110
|
const params = statusFilter !== "all" ? { status: statusFilter } : void 0;
|
|
1110
|
-
const data = await
|
|
1111
|
+
const data = await _chunkCFI4WZ5Rjs.StripeInvoiceService.listInvoices(params);
|
|
1111
1112
|
setInvoices(data);
|
|
1112
1113
|
} catch (error) {
|
|
1113
1114
|
console.error("[InvoicesContainer] Failed to load invoices:", error);
|
|
@@ -1123,12 +1124,12 @@ function InvoicesContainer() {
|
|
|
1123
1124
|
setStatusFilter(value);
|
|
1124
1125
|
}, "handleFilterChange");
|
|
1125
1126
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-4", children: [
|
|
1126
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1127
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1128
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1129
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1130
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1131
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1127
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Tabs, { value: statusFilter, onValueChange: handleFilterChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.TabsList, { children: [
|
|
1128
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.TabsTrigger, { value: "all", children: "All" }),
|
|
1129
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.TabsTrigger, { value: "paid" /* PAID */, children: "Paid" }),
|
|
1130
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.TabsTrigger, { value: "open" /* OPEN */, children: "Open" }),
|
|
1131
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.TabsTrigger, { value: "void" /* VOID */, children: "Void" }),
|
|
1132
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.TabsTrigger, { value: "uncollectible" /* UNCOLLECTIBLE */, children: "Uncollectible" })
|
|
1132
1133
|
] }) }),
|
|
1133
1134
|
loading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-center py-8 text-muted-foreground", children: "Loading invoices..." }),
|
|
1134
1135
|
!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: [
|
|
@@ -1175,7 +1176,7 @@ function CancelSubscriptionDialog({
|
|
|
1175
1176
|
const onSubmit = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async (_values) => {
|
|
1176
1177
|
setIsSubmitting(true);
|
|
1177
1178
|
try {
|
|
1178
|
-
await
|
|
1179
|
+
await _chunkCFI4WZ5Rjs.StripeSubscriptionService.cancelSubscription({
|
|
1179
1180
|
id: subscription.id,
|
|
1180
1181
|
cancelImmediately: false
|
|
1181
1182
|
});
|
|
@@ -1188,19 +1189,19 @@ function CancelSubscriptionDialog({
|
|
|
1188
1189
|
}
|
|
1189
1190
|
}, "onSubmit");
|
|
1190
1191
|
const periodEndDate = formatDate3(subscription.currentPeriodEnd);
|
|
1191
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1192
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1193
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1194
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1192
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.DialogContent, { className: "max-w-md", children: [
|
|
1193
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.DialogHeader, { children: [
|
|
1194
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.DialogTitle, { children: "Cancel Subscription" }),
|
|
1195
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.DialogDescription, { children: "Are you sure you want to cancel this subscription? This action cannot be undone." })
|
|
1195
1196
|
] }),
|
|
1196
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1197
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-col gap-y-4", children: [
|
|
1197
1198
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-blue-50 border border-blue-200 rounded-lg p-3 text-sm text-blue-800", children: [
|
|
1198
1199
|
"Your subscription will remain active until ",
|
|
1199
1200
|
periodEndDate,
|
|
1200
1201
|
". You can continue using the service until then."
|
|
1201
1202
|
] }),
|
|
1202
1203
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1203
|
-
|
|
1204
|
+
_chunkUHO3KUUHjs.FormTextarea,
|
|
1204
1205
|
{
|
|
1205
1206
|
form,
|
|
1206
1207
|
id: "reason",
|
|
@@ -1210,8 +1211,8 @@ function CancelSubscriptionDialog({
|
|
|
1210
1211
|
}
|
|
1211
1212
|
),
|
|
1212
1213
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-x-2 justify-end pt-2", children: [
|
|
1213
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1214
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1214
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Button, { type: "button", variant: "outline", onClick: () => onOpenChange(false), disabled: isSubmitting, children: "Keep Subscription" }),
|
|
1215
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Button, { type: "submit", variant: "destructive", disabled: isSubmitting, children: isSubmitting ? "Canceling..." : "Confirm Cancellation" })
|
|
1215
1216
|
] })
|
|
1216
1217
|
] }) })
|
|
1217
1218
|
] }) });
|
|
@@ -1302,7 +1303,7 @@ function SubscriptionDetails({
|
|
|
1302
1303
|
const handlePause = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1303
1304
|
setIsProcessing(true);
|
|
1304
1305
|
try {
|
|
1305
|
-
await
|
|
1306
|
+
await _chunkCFI4WZ5Rjs.StripeSubscriptionService.pauseSubscription({ subscriptionId: subscription.id });
|
|
1306
1307
|
onSubscriptionChange();
|
|
1307
1308
|
} catch (error) {
|
|
1308
1309
|
console.error("[SubscriptionDetails] Failed to pause subscription:", error);
|
|
@@ -1313,7 +1314,7 @@ function SubscriptionDetails({
|
|
|
1313
1314
|
const handleResume = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1314
1315
|
setIsProcessing(true);
|
|
1315
1316
|
try {
|
|
1316
|
-
await
|
|
1317
|
+
await _chunkCFI4WZ5Rjs.StripeSubscriptionService.resumeSubscription({ subscriptionId: subscription.id });
|
|
1317
1318
|
onSubscriptionChange();
|
|
1318
1319
|
} catch (error) {
|
|
1319
1320
|
console.error("[SubscriptionDetails] Failed to resume subscription:", error);
|
|
@@ -1323,7 +1324,7 @@ function SubscriptionDetails({
|
|
|
1323
1324
|
}, "handleResume");
|
|
1324
1325
|
const handleManageViaPortal = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1325
1326
|
try {
|
|
1326
|
-
const { url } = await
|
|
1327
|
+
const { url } = await _chunkCFI4WZ5Rjs.StripeCustomerService.createPortalSession();
|
|
1327
1328
|
window.open(url, "_blank");
|
|
1328
1329
|
} catch (error) {
|
|
1329
1330
|
console.error("[SubscriptionDetails] Failed to create portal session:", error);
|
|
@@ -1333,10 +1334,10 @@ function SubscriptionDetails({
|
|
|
1333
1334
|
const canResume = subscription.status === "paused" /* PAUSED */;
|
|
1334
1335
|
const canCancel = subscription.status === "active" /* ACTIVE */ || subscription.status === "trialing" /* TRIALING */ || subscription.status === "paused" /* PAUSED */;
|
|
1335
1336
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1336
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1337
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1338
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1339
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1337
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.DialogContent, { className: "max-w-2xl", children: [
|
|
1338
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.DialogHeader, { children: [
|
|
1339
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.DialogTitle, { children: "Subscription Details" }),
|
|
1340
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.DialogDescription, { children: "View and manage your subscription" })
|
|
1340
1341
|
] }),
|
|
1341
1342
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
1342
1343
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
@@ -1378,11 +1379,11 @@ function SubscriptionDetails({
|
|
|
1378
1379
|
"."
|
|
1379
1380
|
] }) }),
|
|
1380
1381
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2 pt-4 border-t", children: [
|
|
1381
|
-
onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1382
|
-
canPause && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1383
|
-
canResume && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1384
|
-
canCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1385
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1382
|
+
onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Button, { variant: "default", onClick: () => onChangePlan(subscription), children: "Change Plan" }),
|
|
1383
|
+
canPause && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Button, { variant: "outline", onClick: handlePause, disabled: isProcessing, children: isProcessing ? "Pausing..." : "Pause" }),
|
|
1384
|
+
canResume && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Button, { variant: "outline", onClick: handleResume, disabled: isProcessing, children: isProcessing ? "Resuming..." : "Resume" }),
|
|
1385
|
+
canCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Button, { variant: "destructive", onClick: () => setShowCancel(true), children: "Cancel" }),
|
|
1386
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Button, { variant: "outline", onClick: handleManageViaPortal, children: "Manage via Portal" })
|
|
1386
1387
|
] })
|
|
1387
1388
|
] })
|
|
1388
1389
|
] }) }),
|
|
@@ -1429,36 +1430,36 @@ function SubscriptionsList({ subscriptions, onSubscriptionsChange, onChangePlan
|
|
|
1429
1430
|
setSelectedSub(subscription);
|
|
1430
1431
|
}, "handleRowClick");
|
|
1431
1432
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1432
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1433
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1434
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1435
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1436
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1437
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1438
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1433
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.Table, { children: [
|
|
1434
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.TableRow, { children: [
|
|
1435
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.TableHead, { children: "Status" }),
|
|
1436
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.TableHead, { children: "Plan" }),
|
|
1437
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.TableHead, { children: "Period" }),
|
|
1438
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.TableHead, { className: "text-right", children: "Amount" }),
|
|
1439
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.TableHead, { className: "text-right", children: "Actions" })
|
|
1439
1440
|
] }) }),
|
|
1440
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1441
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.TableBody, { children: subscriptions.map((subscription) => {
|
|
1441
1442
|
const price = subscription.price;
|
|
1442
1443
|
const amount = _optionalChain([price, 'optionalAccess', _42 => _42.unitAmount]) ? formatCurrency(price.unitAmount, price.currency) : "0";
|
|
1443
1444
|
const period = `${formatDate3(subscription.currentPeriodStart)} - ${formatDate3(subscription.currentPeriodEnd)}`;
|
|
1444
1445
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1445
|
-
|
|
1446
|
+
_chunkUHO3KUUHjs.TableRow,
|
|
1446
1447
|
{
|
|
1447
1448
|
onClick: () => handleRowClick(subscription),
|
|
1448
1449
|
className: "cursor-pointer hover:bg-muted/50",
|
|
1449
1450
|
children: [
|
|
1450
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1451
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1451
1452
|
SubscriptionStatusBadge,
|
|
1452
1453
|
{
|
|
1453
1454
|
status: subscription.status,
|
|
1454
1455
|
cancelAtPeriodEnd: subscription.cancelAtPeriodEnd
|
|
1455
1456
|
}
|
|
1456
1457
|
) }),
|
|
1457
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1458
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1459
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1460
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1461
|
-
|
|
1458
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.TableCell, { className: "font-medium", children: formatPlanName3(price) }),
|
|
1459
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.TableCell, { className: "text-muted-foreground text-sm", children: period }),
|
|
1460
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.TableCell, { className: "text-right font-medium", children: amount }),
|
|
1461
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.TableCell, { className: "text-right", children: (subscription.status === "active" /* ACTIVE */ || subscription.status === "trialing" /* TRIALING */) && onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1462
|
+
_chunkUHO3KUUHjs.Button,
|
|
1462
1463
|
{
|
|
1463
1464
|
size: "sm",
|
|
1464
1465
|
variant: "outline",
|
|
@@ -1503,7 +1504,7 @@ function SubscriptionsContainer({ onOpenWizard, hasActiveRecurringSubscription }
|
|
|
1503
1504
|
const loadSubscriptions = _react.useCallback.call(void 0, async () => {
|
|
1504
1505
|
setLoading(true);
|
|
1505
1506
|
try {
|
|
1506
|
-
const fetchedSubscriptions = await
|
|
1507
|
+
const fetchedSubscriptions = await _chunkCFI4WZ5Rjs.StripeSubscriptionService.listSubscriptions();
|
|
1507
1508
|
setSubscriptions(fetchedSubscriptions);
|
|
1508
1509
|
} catch (error) {
|
|
1509
1510
|
console.error("[SubscriptionsContainer] Failed to load subscriptions:", error);
|
|
@@ -1526,7 +1527,7 @@ function SubscriptionsContainer({ onOpenWizard, hasActiveRecurringSubscription }
|
|
|
1526
1527
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8" }),
|
|
1527
1528
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-3xl font-bold", children: "Subscriptions" })
|
|
1528
1529
|
] }),
|
|
1529
|
-
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1530
|
+
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _43 => _43()]), children: hasActiveRecurringSubscription ? "Purchase Add-ons" : "Subscribe to a Plan" })
|
|
1530
1531
|
] }),
|
|
1531
1532
|
criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BillingAlertBanner, { subscription }, subscription.id)),
|
|
1532
1533
|
subscriptions.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col items-center justify-center py-12 space-y-4", children: [
|
|
@@ -1534,7 +1535,7 @@ function SubscriptionsContainer({ onOpenWizard, hasActiveRecurringSubscription }
|
|
|
1534
1535
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
1535
1536
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-xl font-semibold mb-2", children: "No Active Subscriptions" }),
|
|
1536
1537
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground mb-6", children: "Choose a subscription plan to get started with our services." }),
|
|
1537
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1538
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _44 => _44()]), children: "Subscribe to a Plan" })
|
|
1538
1539
|
] })
|
|
1539
1540
|
] }),
|
|
1540
1541
|
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -1555,9 +1556,9 @@ function IntervalToggle({ value, onChange, hasMonthly, hasYearly }) {
|
|
|
1555
1556
|
if (!hasMonthly || !hasYearly) {
|
|
1556
1557
|
return null;
|
|
1557
1558
|
}
|
|
1558
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1559
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1560
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1559
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Tabs, { value, onValueChange: (v) => onChange(v), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.TabsList, { children: [
|
|
1560
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.TabsTrigger, { value: "month", children: "Monthly" }),
|
|
1561
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.TabsTrigger, { value: "year", children: "Yearly" })
|
|
1561
1562
|
] }) });
|
|
1562
1563
|
}
|
|
1563
1564
|
_chunk7QVYU63Ejs.__name.call(void 0, IntervalToggle, "IntervalToggle");
|
|
@@ -1589,7 +1590,7 @@ function PricingCard({
|
|
|
1589
1590
|
}
|
|
1590
1591
|
}, "handleClick");
|
|
1591
1592
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1592
|
-
|
|
1593
|
+
_chunkUHO3KUUHjs.Card,
|
|
1593
1594
|
{
|
|
1594
1595
|
role: "radio",
|
|
1595
1596
|
"aria-checked": isSelected,
|
|
@@ -1597,7 +1598,7 @@ function PricingCard({
|
|
|
1597
1598
|
tabIndex: isDisabled ? -1 : 0,
|
|
1598
1599
|
onKeyDown: handleKeyDown,
|
|
1599
1600
|
onClick: handleClick,
|
|
1600
|
-
className:
|
|
1601
|
+
className: _chunkCFI4WZ5Rjs.cn.call(void 0,
|
|
1601
1602
|
"relative cursor-pointer transition-all duration-200 flex flex-col h-full",
|
|
1602
1603
|
"focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
1603
1604
|
isCurrentPlan && "bg-muted/30",
|
|
@@ -1607,9 +1608,9 @@ function PricingCard({
|
|
|
1607
1608
|
isLoading && "pointer-events-none"
|
|
1608
1609
|
),
|
|
1609
1610
|
children: [
|
|
1610
|
-
isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1611
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1612
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1611
|
+
isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Badge, { variant: "secondary", className: "absolute top-2 right-2", children: "Current" }),
|
|
1612
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.CardHeader, { className: "pb-2", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "font-semibold text-lg", children: description }) }),
|
|
1613
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.CardContent, { className: "pb-4 grow", children: [
|
|
1613
1614
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mb-4", children: [
|
|
1614
1615
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-3xl font-bold", children: formattedPrice }),
|
|
1615
1616
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground ml-1", children: interval })
|
|
@@ -1619,8 +1620,8 @@ function PricingCard({
|
|
|
1619
1620
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-muted-foreground", children: feature })
|
|
1620
1621
|
] }, index)) })
|
|
1621
1622
|
] }),
|
|
1622
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1623
|
-
|
|
1623
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.CardFooter, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1624
|
+
_chunkUHO3KUUHjs.Button,
|
|
1624
1625
|
{
|
|
1625
1626
|
variant: isCurrentPlan ? "secondary" : isSelected ? "default" : "outline",
|
|
1626
1627
|
className: "w-full",
|
|
@@ -1748,15 +1749,15 @@ function ProductPricingList({
|
|
|
1748
1749
|
_chunk7QVYU63Ejs.__name.call(void 0, ProductPricingList, "ProductPricingList");
|
|
1749
1750
|
function ProductPricingListSkeleton() {
|
|
1750
1751
|
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: [
|
|
1751
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1752
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Skeleton, { className: "h-6 w-32" }),
|
|
1752
1753
|
/* @__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: [
|
|
1753
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1754
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1754
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Skeleton, { className: "h-6 w-24" }),
|
|
1755
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Skeleton, { className: "h-8 w-32" }),
|
|
1755
1756
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
1756
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1757
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1757
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Skeleton, { className: "h-4 w-full" }),
|
|
1758
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Skeleton, { className: "h-4 w-3/4" })
|
|
1758
1759
|
] }),
|
|
1759
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1760
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Skeleton, { className: "h-10 w-full" })
|
|
1760
1761
|
] }, cardIndex)) })
|
|
1761
1762
|
] }, rowIndex)) });
|
|
1762
1763
|
}
|
|
@@ -1811,8 +1812,8 @@ function SubscriptionConfirmation({ price, isLoading, onConfirm, onCancel }) {
|
|
|
1811
1812
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: feature })
|
|
1812
1813
|
] }, index)) }),
|
|
1813
1814
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-3 pt-2 border-t border-accent/30", children: [
|
|
1814
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1815
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1815
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Button, { variant: "outline", onClick: onCancel, disabled: isLoading, children: "Cancel" }),
|
|
1816
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Button, { onClick: onConfirm, disabled: isLoading, children: isLoading ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1816
1817
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "h-4 w-4 animate-spin mr-2" }),
|
|
1817
1818
|
"Processing..."
|
|
1818
1819
|
] }) : "Subscribe" })
|
|
@@ -1883,7 +1884,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
1883
1884
|
onCloseRef.current = onClose;
|
|
1884
1885
|
const checkPaymentMethod = _react.useCallback.call(void 0, async () => {
|
|
1885
1886
|
try {
|
|
1886
|
-
const methods = await
|
|
1887
|
+
const methods = await _chunkCFI4WZ5Rjs.StripeCustomerService.listPaymentMethods();
|
|
1887
1888
|
dispatch({ type: "SET_HAS_PAYMENT_METHOD", hasMethod: methods.length > 0 });
|
|
1888
1889
|
} catch (error) {
|
|
1889
1890
|
console.error("[useSubscriptionWizard] Failed to check payment methods:", error);
|
|
@@ -1907,7 +1908,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
1907
1908
|
const isTrialUpgrade = _optionalChain([subscription, 'optionalAccess', _55 => _55.status]) === "trialing" /* TRIALING */;
|
|
1908
1909
|
dispatch({ type: "SET_IS_TRIAL_SUBSCRIPTION", isTrial: isTrialUpgrade });
|
|
1909
1910
|
if (isTrialUpgrade && !state.hasPaymentMethod) {
|
|
1910
|
-
const methods = await
|
|
1911
|
+
const methods = await _chunkCFI4WZ5Rjs.StripeCustomerService.listPaymentMethods();
|
|
1911
1912
|
if (methods.length === 0) {
|
|
1912
1913
|
dispatch({ type: "SET_STEP", step: "payment-method" });
|
|
1913
1914
|
dispatch({
|
|
@@ -1918,7 +1919,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
1918
1919
|
}
|
|
1919
1920
|
}
|
|
1920
1921
|
if (subscription && state.selectedPrice.id !== _optionalChain([subscription, 'access', _56 => _56.price, 'optionalAccess', _57 => _57.id])) {
|
|
1921
|
-
const preview = await
|
|
1922
|
+
const preview = await _chunkCFI4WZ5Rjs.StripeSubscriptionService.getProrationPreview({
|
|
1922
1923
|
subscriptionId: subscription.id,
|
|
1923
1924
|
newPriceId: state.selectedPrice.id
|
|
1924
1925
|
});
|
|
@@ -1943,14 +1944,14 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
1943
1944
|
newPriceId: state.selectedPrice.id,
|
|
1944
1945
|
promotionCode: _optionalChain([state, 'access', _59 => _59.promotionCode, 'optionalAccess', _60 => _60.promotionCodeId])
|
|
1945
1946
|
};
|
|
1946
|
-
await
|
|
1947
|
+
await _chunkCFI4WZ5Rjs.StripeSubscriptionService.changePlan(changePlanParams);
|
|
1947
1948
|
} else {
|
|
1948
1949
|
const createParams = {
|
|
1949
1950
|
id: _uuid.v4.call(void 0, ),
|
|
1950
1951
|
priceId: state.selectedPrice.id,
|
|
1951
1952
|
promotionCode: _optionalChain([state, 'access', _61 => _61.promotionCode, 'optionalAccess', _62 => _62.promotionCodeId])
|
|
1952
1953
|
};
|
|
1953
|
-
await
|
|
1954
|
+
await _chunkCFI4WZ5Rjs.StripeSubscriptionService.createSubscription(createParams);
|
|
1954
1955
|
}
|
|
1955
1956
|
onSuccessRef.current();
|
|
1956
1957
|
onCloseRef.current();
|
|
@@ -1984,7 +1985,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
1984
1985
|
dispatch({ type: "SET_VALIDATING_PROMO_CODE", isValidating: true });
|
|
1985
1986
|
dispatch({ type: "SET_PROMO_CODE_ERROR", error: null });
|
|
1986
1987
|
try {
|
|
1987
|
-
const result = await
|
|
1988
|
+
const result = await _chunkCFI4WZ5Rjs.StripePromotionCodeService.validatePromotionCode({
|
|
1988
1989
|
code,
|
|
1989
1990
|
stripePriceId: _optionalChain([state, 'access', _70 => _70.selectedPrice, 'optionalAccess', _71 => _71.id])
|
|
1990
1991
|
});
|
|
@@ -2091,7 +2092,7 @@ function WizardStepPlanSelection({
|
|
|
2091
2092
|
_react.useEffect.call(void 0, () => {
|
|
2092
2093
|
const loadProducts = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2093
2094
|
try {
|
|
2094
|
-
const fetchedProducts = await
|
|
2095
|
+
const fetchedProducts = await _chunkCFI4WZ5Rjs.StripeProductService.listProducts({ active: true });
|
|
2095
2096
|
setProducts(fetchedProducts);
|
|
2096
2097
|
} catch (error) {
|
|
2097
2098
|
console.error("[WizardStepPlanSelection] Failed to load products:", error);
|
|
@@ -2142,7 +2143,7 @@ function WizardStepPlanSelection({
|
|
|
2142
2143
|
onSelectPrice: handleSelectPrice
|
|
2143
2144
|
}
|
|
2144
2145
|
),
|
|
2145
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex justify-end pt-4 border-t", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2146
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex justify-end pt-4 border-t", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Button, { onClick: onNext, disabled: !selectedPrice || isProcessing, children: isProcessing ? "Loading..." : "Next: Review" }) })
|
|
2146
2147
|
] });
|
|
2147
2148
|
}
|
|
2148
2149
|
_chunk7QVYU63Ejs.__name.call(void 0, WizardStepPlanSelection, "WizardStepPlanSelection");
|
|
@@ -2203,7 +2204,7 @@ function PromoCodeInput({
|
|
|
2203
2204
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-green-600", children: formatDiscount(appliedCode) })
|
|
2204
2205
|
] }),
|
|
2205
2206
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2206
|
-
|
|
2207
|
+
_chunkUHO3KUUHjs.Button,
|
|
2207
2208
|
{
|
|
2208
2209
|
variant: "ghost",
|
|
2209
2210
|
size: "sm",
|
|
@@ -2220,7 +2221,7 @@ function PromoCodeInput({
|
|
|
2220
2221
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
2221
2222
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
|
|
2222
2223
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2223
|
-
|
|
2224
|
+
_chunkUHO3KUUHjs.Input,
|
|
2224
2225
|
{
|
|
2225
2226
|
placeholder: "Enter promo code",
|
|
2226
2227
|
value: code,
|
|
@@ -2230,7 +2231,7 @@ function PromoCodeInput({
|
|
|
2230
2231
|
className: "flex-1"
|
|
2231
2232
|
}
|
|
2232
2233
|
),
|
|
2233
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2234
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.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" })
|
|
2234
2235
|
] }),
|
|
2235
2236
|
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-red-500", children: error })
|
|
2236
2237
|
] });
|
|
@@ -2354,15 +2355,15 @@ function WizardStepReview({
|
|
|
2354
2355
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "font-medium", children: "Payment Method" }),
|
|
2355
2356
|
/* @__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" })
|
|
2356
2357
|
] }),
|
|
2357
|
-
!hasPaymentMethod && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2358
|
+
!hasPaymentMethod && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Button, { variant: "outline", onClick: onAddPaymentMethod, children: "Add Payment Method" })
|
|
2358
2359
|
] }) }),
|
|
2359
|
-
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2360
|
+
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.Alert, { variant: "destructive", children: [
|
|
2360
2361
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.AlertCircle, { className: "h-4 w-4" }),
|
|
2361
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2362
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.AlertDescription, { children: error })
|
|
2362
2363
|
] }),
|
|
2363
2364
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between pt-4 border-t", children: [
|
|
2364
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2365
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2365
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Button, { variant: "outline", onClick: onBack, disabled: isProcessing, children: "Back" }),
|
|
2366
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Button, { onClick: hasPaymentMethod ? onConfirm : onAddPaymentMethod, disabled: isProcessing, children: isProcessing ? "Processing..." : hasPaymentMethod ? isChangingPlan ? "Confirm Plan Change" : "Subscribe Now" : "Add Payment Method" })
|
|
2366
2367
|
] })
|
|
2367
2368
|
] });
|
|
2368
2369
|
}
|
|
@@ -2415,10 +2416,10 @@ function SubscriptionWizard({
|
|
|
2415
2416
|
const isChangePlanMode = !!subscription;
|
|
2416
2417
|
const dialogTitle = subscription ? "Change Subscription Plan" : isPurchasingAddons ? "Purchase Add-ons" : "Subscribe to a Plan";
|
|
2417
2418
|
const dialogDescription = subscription ? "Select a new plan for your subscription" : isPurchasingAddons ? "Select one-time products to purchase" : "Choose a subscription plan to get started";
|
|
2418
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2419
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2420
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2421
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2419
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.DialogContent, { className: "max-w-2xl", children: [
|
|
2420
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.DialogHeader, { children: [
|
|
2421
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.DialogTitle, { children: dialogTitle }),
|
|
2422
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.DialogDescription, { children: dialogDescription })
|
|
2422
2423
|
] }),
|
|
2423
2424
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, WizardProgressIndicator, { currentStep: state.step }),
|
|
2424
2425
|
state.step === "plan-selection" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -2501,15 +2502,15 @@ function UsageSummaryCard({ meter, summary }) {
|
|
|
2501
2502
|
const progressWidth = percentage !== null ? Math.min(percentage, 100) : 0;
|
|
2502
2503
|
const displayName = meter.displayName || meter.eventName;
|
|
2503
2504
|
const hasLimit = limit !== null && limit !== void 0;
|
|
2504
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2505
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2505
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.Card, { children: [
|
|
2506
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.CardHeader, { className: "flex flex-row items-center gap-x-3 pb-3", children: [
|
|
2506
2507
|
/* @__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" }) }),
|
|
2507
2508
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col", children: [
|
|
2508
2509
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "font-semibold", children: displayName }),
|
|
2509
2510
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-gray-500", children: meter.id })
|
|
2510
2511
|
] })
|
|
2511
2512
|
] }),
|
|
2512
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2513
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.CardContent, { className: "flex flex-col gap-y-4", children: [
|
|
2513
2514
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
2514
2515
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-3xl font-bold", children: currentUsage.toLocaleString() }),
|
|
2515
2516
|
hasLimit && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm text-gray-500", children: [
|
|
@@ -2556,14 +2557,14 @@ function UsageContainer() {
|
|
|
2556
2557
|
const loadUsageData = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2557
2558
|
setLoading(true);
|
|
2558
2559
|
try {
|
|
2559
|
-
const fetchedSubscriptions = await
|
|
2560
|
+
const fetchedSubscriptions = await _chunkCFI4WZ5Rjs.StripeSubscriptionService.listSubscriptions();
|
|
2560
2561
|
setSubscriptions(fetchedSubscriptions);
|
|
2561
2562
|
const hasMeteredSubscriptions2 = fetchedSubscriptions.some((sub) => _optionalChain([sub, 'access', _99 => _99.price, 'optionalAccess', _100 => _100.recurring, 'optionalAccess', _101 => _101.usageType]) === "metered");
|
|
2562
2563
|
if (!hasMeteredSubscriptions2) {
|
|
2563
2564
|
setLoading(false);
|
|
2564
2565
|
return;
|
|
2565
2566
|
}
|
|
2566
|
-
const fetchedMeters = await
|
|
2567
|
+
const fetchedMeters = await _chunkCFI4WZ5Rjs.StripeUsageService.listMeters();
|
|
2567
2568
|
setMeters(fetchedMeters);
|
|
2568
2569
|
const summariesMap = {};
|
|
2569
2570
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -2571,7 +2572,7 @@ function UsageContainer() {
|
|
|
2571
2572
|
const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
|
|
2572
2573
|
for (const meter of fetchedMeters) {
|
|
2573
2574
|
try {
|
|
2574
|
-
const meterSummaries = await
|
|
2575
|
+
const meterSummaries = await _chunkCFI4WZ5Rjs.StripeUsageService.getMeterSummaries({
|
|
2575
2576
|
meterId: meter.id,
|
|
2576
2577
|
startTime: startOfMonth,
|
|
2577
2578
|
endTime: endOfMonth
|
|
@@ -2637,21 +2638,21 @@ function UsageHistoryTable({ usageRecords }) {
|
|
|
2637
2638
|
}
|
|
2638
2639
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
2639
2640
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h2", { className: "text-xl font-semibold", children: "Usage History" }),
|
|
2640
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-clip rounded-lg border", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2641
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2642
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2643
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2644
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2645
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2641
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-clip rounded-lg border", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.Table, { children: [
|
|
2642
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.TableRow, { children: [
|
|
2643
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.TableHead, { children: "Date & Time" }),
|
|
2644
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.TableHead, { children: "Meter Event" }),
|
|
2645
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.TableHead, { className: "text-right", children: "Quantity" }),
|
|
2646
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.TableHead, { children: "Event ID" })
|
|
2646
2647
|
] }) }),
|
|
2647
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2648
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.TableBody, { children: usageRecords.map((record) => {
|
|
2648
2649
|
const dateTime = formatDateTime(record.timestamp);
|
|
2649
2650
|
const quantity = record.quantity.toLocaleString();
|
|
2650
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2651
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2652
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2653
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2654
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2651
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.TableRow, { children: [
|
|
2652
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.TableCell, { className: "font-medium", children: dateTime }),
|
|
2653
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.TableCell, { className: "text-muted-foreground", children: record.meterEventName }),
|
|
2654
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.TableCell, { className: "text-right font-medium", children: quantity }),
|
|
2655
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.TableCell, { className: "text-muted-foreground text-sm font-mono", children: record.stripeEventId })
|
|
2655
2656
|
] }, record.id);
|
|
2656
2657
|
}) })
|
|
2657
2658
|
] }) })
|
|
@@ -2662,8 +2663,8 @@ _chunk7QVYU63Ejs.__name.call(void 0, UsageHistoryTable, "UsageHistoryTable");
|
|
|
2662
2663
|
// src/features/billing/components/modals/BillingDetailModal.tsx
|
|
2663
2664
|
|
|
2664
2665
|
function BillingDetailModal({ open, onOpenChange, title, children, className }) {
|
|
2665
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2666
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2666
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.DialogContent, { className: _nullishCoalesce(className, () => ( "max-w-4xl max-h-[90vh] overflow-y-auto")), children: [
|
|
2667
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.DialogHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.DialogTitle, { children: title }) }),
|
|
2667
2668
|
children
|
|
2668
2669
|
] }) });
|
|
2669
2670
|
}
|
|
@@ -2680,7 +2681,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
|
|
|
2680
2681
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "font-semibold text-red-900", children: "Payment Failed" }),
|
|
2681
2682
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-red-700 mt-1", children: "Your last payment failed. Please update your payment method to avoid service interruption." })
|
|
2682
2683
|
] }),
|
|
2683
|
-
onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2684
|
+
onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Button, { variant: "outline", size: "sm", onClick: onUpdatePayment, className: "border-red-300 text-red-700", children: "Update Payment Method" })
|
|
2684
2685
|
] });
|
|
2685
2686
|
}
|
|
2686
2687
|
if (subscription.status === "trialing" /* TRIALING */ && subscription.trialEnd) {
|
|
@@ -2700,7 +2701,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
|
|
|
2700
2701
|
". Add a payment method to continue your subscription."
|
|
2701
2702
|
] })
|
|
2702
2703
|
] }),
|
|
2703
|
-
onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2704
|
+
onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Button, { variant: "outline", size: "sm", onClick: onAddPayment, className: "border-yellow-300 text-yellow-700", children: "Add Payment Method" })
|
|
2704
2705
|
] });
|
|
2705
2706
|
}
|
|
2706
2707
|
}
|
|
@@ -2751,7 +2752,7 @@ function BillingDashboardContainer() {
|
|
|
2751
2752
|
setNoCustomerExists(false);
|
|
2752
2753
|
let customer = null;
|
|
2753
2754
|
try {
|
|
2754
|
-
customer = await
|
|
2755
|
+
customer = await _chunkCFI4WZ5Rjs.StripeCustomerService.getCustomer();
|
|
2755
2756
|
setData((prev) => ({ ...prev, customer }));
|
|
2756
2757
|
setErrors((prev) => ({ ...prev, customer: null }));
|
|
2757
2758
|
setNoCustomerExists(false);
|
|
@@ -2776,7 +2777,7 @@ function BillingDashboardContainer() {
|
|
|
2776
2777
|
if (customer) {
|
|
2777
2778
|
const fetchSubscriptions = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2778
2779
|
try {
|
|
2779
|
-
const subscriptions2 = await
|
|
2780
|
+
const subscriptions2 = await _chunkCFI4WZ5Rjs.StripeSubscriptionService.listSubscriptions();
|
|
2780
2781
|
setData((prev) => ({ ...prev, subscriptions: subscriptions2 }));
|
|
2781
2782
|
setErrors((prev) => ({ ...prev, subscriptions: null }));
|
|
2782
2783
|
return subscriptions2;
|
|
@@ -2790,7 +2791,7 @@ function BillingDashboardContainer() {
|
|
|
2790
2791
|
}, "fetchSubscriptions");
|
|
2791
2792
|
const fetchPaymentMethods = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2792
2793
|
try {
|
|
2793
|
-
const paymentMethods = await
|
|
2794
|
+
const paymentMethods = await _chunkCFI4WZ5Rjs.StripeCustomerService.listPaymentMethods();
|
|
2794
2795
|
setData((prev) => ({ ...prev, paymentMethods }));
|
|
2795
2796
|
setErrors((prev) => ({ ...prev, paymentMethods: null }));
|
|
2796
2797
|
} catch (error) {
|
|
@@ -2802,7 +2803,7 @@ function BillingDashboardContainer() {
|
|
|
2802
2803
|
}, "fetchPaymentMethods");
|
|
2803
2804
|
const fetchInvoices = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2804
2805
|
try {
|
|
2805
|
-
const invoices = await
|
|
2806
|
+
const invoices = await _chunkCFI4WZ5Rjs.StripeInvoiceService.listInvoices();
|
|
2806
2807
|
setData((prev) => ({ ...prev, invoices }));
|
|
2807
2808
|
setErrors((prev) => ({ ...prev, invoices: null }));
|
|
2808
2809
|
} catch (error) {
|
|
@@ -2826,7 +2827,7 @@ function BillingDashboardContainer() {
|
|
|
2826
2827
|
const handleCreateCustomer = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2827
2828
|
setCreatingCustomer(true);
|
|
2828
2829
|
try {
|
|
2829
|
-
await
|
|
2830
|
+
await _chunkCFI4WZ5Rjs.StripeCustomerService.createCustomer();
|
|
2830
2831
|
setNoCustomerExists(false);
|
|
2831
2832
|
await fetchAllData();
|
|
2832
2833
|
} catch (error) {
|
|
@@ -2838,7 +2839,7 @@ function BillingDashboardContainer() {
|
|
|
2838
2839
|
}, "handleCreateCustomer");
|
|
2839
2840
|
const fetchUsageData = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2840
2841
|
try {
|
|
2841
|
-
const meters = await
|
|
2842
|
+
const meters = await _chunkCFI4WZ5Rjs.StripeUsageService.listMeters();
|
|
2842
2843
|
setData((prev) => ({ ...prev, meters }));
|
|
2843
2844
|
const summariesMap = {};
|
|
2844
2845
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -2846,7 +2847,7 @@ function BillingDashboardContainer() {
|
|
|
2846
2847
|
const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
|
|
2847
2848
|
for (const meter of meters) {
|
|
2848
2849
|
try {
|
|
2849
|
-
const meterSummaries = await
|
|
2850
|
+
const meterSummaries = await _chunkCFI4WZ5Rjs.StripeUsageService.getMeterSummaries({
|
|
2850
2851
|
meterId: meter.id,
|
|
2851
2852
|
startTime: startOfMonth,
|
|
2852
2853
|
endTime: endOfMonth
|
|
@@ -2924,18 +2925,18 @@ function BillingDashboardContainer() {
|
|
|
2924
2925
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-8 w-8" }),
|
|
2925
2926
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-3xl font-bold", children: "Billing" })
|
|
2926
2927
|
] }),
|
|
2927
|
-
isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2928
|
-
noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2929
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2928
|
+
isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.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" }) }) }),
|
|
2929
|
+
noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.Card, { children: [
|
|
2930
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.CardHeader, { className: "text-center", children: [
|
|
2930
2931
|
/* @__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" }) }),
|
|
2931
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2932
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2932
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.CardTitle, { children: "Set Up Billing" }),
|
|
2933
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.CardDescription, { children: "Your company doesn't have a billing account yet. Set one up to manage subscriptions, payment methods, and view invoices." })
|
|
2933
2934
|
] }),
|
|
2934
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2935
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.CardContent, { className: "flex justify-center pb-8", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Button, { onClick: handleCreateCustomer, disabled: creatingCustomer, size: "lg", children: creatingCustomer ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2935
2936
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
2936
2937
|
"Setting up..."
|
|
2937
2938
|
] }) : "Set Up Billing Account" }) }),
|
|
2938
|
-
errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2939
|
+
errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.CardContent, { className: "pt-0", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-center text-sm text-destructive", children: errors.customer }) })
|
|
2939
2940
|
] }),
|
|
2940
2941
|
!noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2941
2942
|
criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -3077,7 +3078,7 @@ function getStripePromise(publishableKey) {
|
|
|
3077
3078
|
}
|
|
3078
3079
|
_chunk7QVYU63Ejs.__name.call(void 0, getStripePromise, "getStripePromise");
|
|
3079
3080
|
function StripeProvider({ children }) {
|
|
3080
|
-
const publishableKey =
|
|
3081
|
+
const publishableKey = _chunk7E3O52U5js.getStripePublishableKey.call(void 0, );
|
|
3081
3082
|
const stripePromise = _react.useMemo.call(void 0, () => getStripePromise(publishableKey), [publishableKey]);
|
|
3082
3083
|
const options = _react.useMemo.call(void 0, () => ({}), []);
|
|
3083
3084
|
if (!publishableKey) {
|
|
@@ -3087,7 +3088,7 @@ function StripeProvider({ children }) {
|
|
|
3087
3088
|
}
|
|
3088
3089
|
_chunk7QVYU63Ejs.__name.call(void 0, StripeProvider, "StripeProvider");
|
|
3089
3090
|
function isStripeConfigured() {
|
|
3090
|
-
return !!
|
|
3091
|
+
return !!_chunk7E3O52U5js.getStripePublishableKey.call(void 0, );
|
|
3091
3092
|
}
|
|
3092
3093
|
_chunk7QVYU63Ejs.__name.call(void 0, isStripeConfigured, "isStripeConfigured");
|
|
3093
3094
|
|
|
@@ -3105,7 +3106,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3105
3106
|
_react.useEffect.call(void 0, () => {
|
|
3106
3107
|
const fetchFeatures = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3107
3108
|
try {
|
|
3108
|
-
const features = await
|
|
3109
|
+
const features = await _chunkCFI4WZ5Rjs.FeatureService.findMany({});
|
|
3109
3110
|
setAllFeatures(features);
|
|
3110
3111
|
} catch (error) {
|
|
3111
3112
|
console.error("[PriceEditor] Failed to fetch features:", error);
|
|
@@ -3183,7 +3184,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3183
3184
|
try {
|
|
3184
3185
|
const unitAmountInCents = Math.round(values.unitAmount * 100);
|
|
3185
3186
|
if (isEditMode) {
|
|
3186
|
-
await
|
|
3187
|
+
await _chunkCFI4WZ5Rjs.StripePriceService.updatePrice({
|
|
3187
3188
|
id: price.id,
|
|
3188
3189
|
nickname: values.nickname || void 0,
|
|
3189
3190
|
description: values.description || void 0,
|
|
@@ -3225,7 +3226,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3225
3226
|
createInput.featureIds = values.featureIds;
|
|
3226
3227
|
}
|
|
3227
3228
|
}
|
|
3228
|
-
await
|
|
3229
|
+
await _chunkCFI4WZ5Rjs.StripePriceService.createPrice(createInput);
|
|
3229
3230
|
}
|
|
3230
3231
|
onSuccess();
|
|
3231
3232
|
onOpenChange(false);
|
|
@@ -3251,10 +3252,10 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3251
3252
|
{ id: "licensed", text: "Licensed (per unit)" },
|
|
3252
3253
|
{ id: "metered", text: "Metered (usage-based)" }
|
|
3253
3254
|
];
|
|
3254
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3255
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3256
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3257
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3255
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.DialogContent, { className: "max-w-2xl", children: [
|
|
3256
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.DialogHeader, { children: [
|
|
3257
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.DialogTitle, { children: isEditMode ? "Edit Price" : "Create Price" }),
|
|
3258
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.DialogDescription, { children: isEditMode ? "Update the price details. Note: Only nickname and active status can be changed." : "Create a new price for this product" })
|
|
3258
3259
|
] }),
|
|
3259
3260
|
isEditMode && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-blue-50 border border-blue-200 rounded-lg p-4 flex gap-x-3", children: [
|
|
3260
3261
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.AlertCircle, { className: "h-5 w-5 text-blue-600 flex-shrink-0 mt-0.5" }),
|
|
@@ -3263,10 +3264,10 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3263
3264
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { children: "Due to Stripe's architecture, only the nickname and active status can be modified after creation. To change amount, currency, or billing interval, create a new price." })
|
|
3264
3265
|
] })
|
|
3265
3266
|
] }),
|
|
3266
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3267
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-col gap-y-4", children: [
|
|
3267
3268
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
|
|
3268
3269
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3269
|
-
|
|
3270
|
+
_chunkUHO3KUUHjs.FormInput,
|
|
3270
3271
|
{
|
|
3271
3272
|
form,
|
|
3272
3273
|
id: "unitAmount",
|
|
@@ -3276,10 +3277,10 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3276
3277
|
isRequired: true
|
|
3277
3278
|
}
|
|
3278
3279
|
),
|
|
3279
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3280
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.FormSelect, { form, id: "currency", name: "Currency", values: currencyOptions, disabled: isEditMode })
|
|
3280
3281
|
] }),
|
|
3281
3282
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3282
|
-
|
|
3283
|
+
_chunkUHO3KUUHjs.FormSelect,
|
|
3283
3284
|
{
|
|
3284
3285
|
form,
|
|
3285
3286
|
id: "interval",
|
|
@@ -3290,7 +3291,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3290
3291
|
),
|
|
3291
3292
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
|
|
3292
3293
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3293
|
-
|
|
3294
|
+
_chunkUHO3KUUHjs.FormInput,
|
|
3294
3295
|
{
|
|
3295
3296
|
form,
|
|
3296
3297
|
id: "intervalCount",
|
|
@@ -3301,7 +3302,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3301
3302
|
}
|
|
3302
3303
|
),
|
|
3303
3304
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3304
|
-
|
|
3305
|
+
_chunkUHO3KUUHjs.FormSelect,
|
|
3305
3306
|
{
|
|
3306
3307
|
form,
|
|
3307
3308
|
id: "usageType",
|
|
@@ -3312,7 +3313,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3312
3313
|
)
|
|
3313
3314
|
] }),
|
|
3314
3315
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3315
|
-
|
|
3316
|
+
_chunkUHO3KUUHjs.FormInput,
|
|
3316
3317
|
{
|
|
3317
3318
|
form,
|
|
3318
3319
|
id: "nickname",
|
|
@@ -3321,7 +3322,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3321
3322
|
}
|
|
3322
3323
|
),
|
|
3323
3324
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3324
|
-
|
|
3325
|
+
_chunkUHO3KUUHjs.FormTextarea,
|
|
3325
3326
|
{
|
|
3326
3327
|
form,
|
|
3327
3328
|
id: "description",
|
|
@@ -3330,13 +3331,13 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3330
3331
|
className: "min-h-24"
|
|
3331
3332
|
}
|
|
3332
3333
|
),
|
|
3333
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3334
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.FormInput, { form, id: "token", name: "Token (optional)", placeholder: "Enter token value" }),
|
|
3334
3335
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
3335
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3336
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Label, { children: "Features (optional)" }),
|
|
3336
3337
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
3337
3338
|
form.watch("features").map((_, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
|
|
3338
3339
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3339
|
-
|
|
3340
|
+
_chunkUHO3KUUHjs.Input,
|
|
3340
3341
|
{
|
|
3341
3342
|
...form.register(`features.${index}`),
|
|
3342
3343
|
placeholder: `Feature ${index + 1}`,
|
|
@@ -3344,7 +3345,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3344
3345
|
}
|
|
3345
3346
|
),
|
|
3346
3347
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3347
|
-
|
|
3348
|
+
_chunkUHO3KUUHjs.Button,
|
|
3348
3349
|
{
|
|
3349
3350
|
type: "button",
|
|
3350
3351
|
variant: "outline",
|
|
@@ -3361,7 +3362,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3361
3362
|
)
|
|
3362
3363
|
] }, index)),
|
|
3363
3364
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3364
|
-
|
|
3365
|
+
_chunkUHO3KUUHjs.Button,
|
|
3365
3366
|
{
|
|
3366
3367
|
type: "button",
|
|
3367
3368
|
variant: "outline",
|
|
@@ -3380,7 +3381,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3380
3381
|
] })
|
|
3381
3382
|
] }),
|
|
3382
3383
|
isRecurring && allFeatures.length > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
3383
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3384
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Label, { children: "Platform Features" }),
|
|
3384
3385
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-md p-4 space-y-2 max-h-48 overflow-y-auto", children: allFeatures.map((feature) => {
|
|
3385
3386
|
const isCore = feature.isCore;
|
|
3386
3387
|
const isChecked = form.watch("featureIds").includes(feature.id);
|
|
@@ -3422,9 +3423,9 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3422
3423
|
] }, feature.id);
|
|
3423
3424
|
}) })
|
|
3424
3425
|
] }),
|
|
3425
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3426
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.FormCheckbox, { form, id: "active", name: "Active" }),
|
|
3426
3427
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3427
|
-
|
|
3428
|
+
_chunkUHO3KUUHjs.FormCheckbox,
|
|
3428
3429
|
{
|
|
3429
3430
|
form,
|
|
3430
3431
|
id: "isTrial",
|
|
@@ -3432,7 +3433,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3432
3433
|
description: "Mark this as the trial subscription plan (only one price should be marked as trial)"
|
|
3433
3434
|
}
|
|
3434
3435
|
),
|
|
3435
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3436
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.CommonEditorButtons, { isEdit: isEditMode, form, disabled: isSubmitting, setOpen: onOpenChange })
|
|
3436
3437
|
] }) })
|
|
3437
3438
|
] }) });
|
|
3438
3439
|
}
|
|
@@ -3454,7 +3455,7 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3454
3455
|
const loadPrices = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3455
3456
|
setLoading(true);
|
|
3456
3457
|
try {
|
|
3457
|
-
const fetchedPrices = await
|
|
3458
|
+
const fetchedPrices = await _chunkCFI4WZ5Rjs.StripePriceService.listPrices({ productId });
|
|
3458
3459
|
setPrices(fetchedPrices);
|
|
3459
3460
|
} catch (error) {
|
|
3460
3461
|
console.error("[PricesList] Failed to load prices:", error);
|
|
@@ -3471,7 +3472,7 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3471
3472
|
}
|
|
3472
3473
|
setArchivingPriceId(priceToArchive.id);
|
|
3473
3474
|
try {
|
|
3474
|
-
await
|
|
3475
|
+
await _chunkCFI4WZ5Rjs.StripePriceService.archivePrice({ id: priceToArchive.id });
|
|
3475
3476
|
setPriceToArchive(null);
|
|
3476
3477
|
await loadPrices();
|
|
3477
3478
|
onPricesChange();
|
|
@@ -3487,7 +3488,7 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3487
3488
|
}
|
|
3488
3489
|
setReactivatingPriceId(priceToReactivate.id);
|
|
3489
3490
|
try {
|
|
3490
|
-
await
|
|
3491
|
+
await _chunkCFI4WZ5Rjs.StripePriceService.reactivatePrice({ id: priceToReactivate.id });
|
|
3491
3492
|
setPriceToReactivate(null);
|
|
3492
3493
|
await loadPrices();
|
|
3493
3494
|
onPricesChange();
|
|
@@ -3518,12 +3519,12 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3518
3519
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-4", children: [
|
|
3519
3520
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center justify-between mb-4", children: [
|
|
3520
3521
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "text-lg font-semibold", children: "Prices" }),
|
|
3521
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3522
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Button, { size: "sm", onClick: () => setShowCreatePrice(true), children: "Add Price" })
|
|
3522
3523
|
] }),
|
|
3523
3524
|
prices.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-background flex flex-col items-center justify-center gap-y-3 rounded-lg border border-dashed p-8", children: [
|
|
3524
3525
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.DollarSign, { className: "text-muted-foreground h-12 w-12" }),
|
|
3525
3526
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-sm", children: "No prices yet. Add a price to enable subscriptions." }),
|
|
3526
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3527
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Button, { size: "sm", onClick: () => setShowCreatePrice(true), children: "Add Price" })
|
|
3527
3528
|
] }),
|
|
3528
3529
|
prices.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4", children: prices.map((price) => {
|
|
3529
3530
|
const isArchiving = archivingPriceId === price.id;
|
|
@@ -3532,9 +3533,9 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3532
3533
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-start justify-between mb-3", children: [
|
|
3533
3534
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.DollarSign, { className: "h-5 w-5 text-primary" }),
|
|
3534
3535
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-1", children: [
|
|
3535
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3536
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Button, { variant: "ghost", size: "sm", onClick: () => setEditingPrice(price), className: "h-8 w-8 p-0", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Edit, { className: "h-4 w-4" }) }),
|
|
3536
3537
|
price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3537
|
-
|
|
3538
|
+
_chunkUHO3KUUHjs.Button,
|
|
3538
3539
|
{
|
|
3539
3540
|
variant: "ghost",
|
|
3540
3541
|
size: "sm",
|
|
@@ -3544,7 +3545,7 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3544
3545
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Archive, { className: "h-4 w-4" })
|
|
3545
3546
|
}
|
|
3546
3547
|
) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3547
|
-
|
|
3548
|
+
_chunkUHO3KUUHjs.Button,
|
|
3548
3549
|
{
|
|
3549
3550
|
variant: "ghost",
|
|
3550
3551
|
size: "sm",
|
|
@@ -3595,20 +3596,20 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3595
3596
|
}
|
|
3596
3597
|
}
|
|
3597
3598
|
),
|
|
3598
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3599
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3600
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3601
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3599
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.AlertDialog, { open: !!priceToArchive, onOpenChange: (open) => !open && setPriceToArchive(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.AlertDialogContent, { children: [
|
|
3600
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.AlertDialogHeader, { children: [
|
|
3601
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.AlertDialogTitle, { children: "Archive Price" }),
|
|
3602
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.AlertDialogDescription, { children: [
|
|
3602
3603
|
"Are you sure you want to archive the price for",
|
|
3603
3604
|
" ",
|
|
3604
3605
|
priceToArchive && `${formatCurrency(priceToArchive.unitAmount, priceToArchive.currency)} ${formatInterval2(priceToArchive)}`,
|
|
3605
3606
|
"? This will prevent new subscriptions but existing ones will continue."
|
|
3606
3607
|
] })
|
|
3607
3608
|
] }),
|
|
3608
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3609
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3609
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.AlertDialogFooter, { children: [
|
|
3610
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.AlertDialogCancel, { disabled: !!archivingPriceId, children: "Cancel" }),
|
|
3610
3611
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3611
|
-
|
|
3612
|
+
_chunkUHO3KUUHjs.AlertDialogAction,
|
|
3612
3613
|
{
|
|
3613
3614
|
onClick: handleArchive,
|
|
3614
3615
|
disabled: !!archivingPriceId,
|
|
@@ -3618,20 +3619,20 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3618
3619
|
)
|
|
3619
3620
|
] })
|
|
3620
3621
|
] }) }),
|
|
3621
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3622
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3623
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3624
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3622
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.AlertDialog, { open: !!priceToReactivate, onOpenChange: (open) => !open && setPriceToReactivate(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.AlertDialogContent, { children: [
|
|
3623
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.AlertDialogHeader, { children: [
|
|
3624
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.AlertDialogTitle, { children: "Reactivate Price" }),
|
|
3625
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.AlertDialogDescription, { children: [
|
|
3625
3626
|
"Are you sure you want to reactivate the price for",
|
|
3626
3627
|
" ",
|
|
3627
3628
|
priceToReactivate && `${formatCurrency(priceToReactivate.unitAmount, priceToReactivate.currency)} ${formatInterval2(priceToReactivate)}`,
|
|
3628
3629
|
"? This will allow new subscriptions again."
|
|
3629
3630
|
] })
|
|
3630
3631
|
] }),
|
|
3631
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3632
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3632
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.AlertDialogFooter, { children: [
|
|
3633
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.AlertDialogCancel, { disabled: !!reactivatingPriceId, children: "Cancel" }),
|
|
3633
3634
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3634
|
-
|
|
3635
|
+
_chunkUHO3KUUHjs.AlertDialogAction,
|
|
3635
3636
|
{
|
|
3636
3637
|
onClick: handleReactivate,
|
|
3637
3638
|
disabled: !!reactivatingPriceId,
|
|
@@ -3675,14 +3676,14 @@ function ProductEditor({ product, open, onOpenChange, onSuccess }) {
|
|
|
3675
3676
|
setIsSubmitting(true);
|
|
3676
3677
|
try {
|
|
3677
3678
|
if (product) {
|
|
3678
|
-
await
|
|
3679
|
+
await _chunkCFI4WZ5Rjs.StripeProductService.updateProduct({
|
|
3679
3680
|
id: product.id,
|
|
3680
3681
|
name: values.name,
|
|
3681
3682
|
description: values.description,
|
|
3682
3683
|
active: values.active
|
|
3683
3684
|
});
|
|
3684
3685
|
} else {
|
|
3685
|
-
await
|
|
3686
|
+
await _chunkCFI4WZ5Rjs.StripeProductService.createProduct({
|
|
3686
3687
|
id: _uuid.v4.call(void 0, ),
|
|
3687
3688
|
name: values.name,
|
|
3688
3689
|
description: values.description,
|
|
@@ -3697,15 +3698,15 @@ function ProductEditor({ product, open, onOpenChange, onSuccess }) {
|
|
|
3697
3698
|
setIsSubmitting(false);
|
|
3698
3699
|
}
|
|
3699
3700
|
}, "onSubmit");
|
|
3700
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3701
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3702
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3703
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3701
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.DialogContent, { className: "max-w-2xl", children: [
|
|
3702
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.DialogHeader, { children: [
|
|
3703
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.DialogTitle, { children: product ? "Edit Product" : "Create Product" }),
|
|
3704
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.DialogDescription, { children: product ? `Update the details for ${product.name}` : "Create a new product to offer to your customers" })
|
|
3704
3705
|
] }),
|
|
3705
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3706
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3706
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-col gap-y-4", children: [
|
|
3707
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.FormInput, { form, id: "name", name: "Product Name", placeholder: "Enter product name", isRequired: true }),
|
|
3707
3708
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3708
|
-
|
|
3709
|
+
_chunkUHO3KUUHjs.FormTextarea,
|
|
3709
3710
|
{
|
|
3710
3711
|
form,
|
|
3711
3712
|
id: "description",
|
|
@@ -3714,8 +3715,8 @@ function ProductEditor({ product, open, onOpenChange, onSuccess }) {
|
|
|
3714
3715
|
className: "min-h-32"
|
|
3715
3716
|
}
|
|
3716
3717
|
),
|
|
3717
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3718
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3718
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.FormCheckbox, { form, id: "active", name: "Active" }),
|
|
3719
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.CommonEditorButtons, { isEdit: !!product, form, disabled: isSubmitting, setOpen: onOpenChange })
|
|
3719
3720
|
] }) })
|
|
3720
3721
|
] }) });
|
|
3721
3722
|
}
|
|
@@ -3738,7 +3739,7 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3738
3739
|
}
|
|
3739
3740
|
setArchivingProductId(productToArchive.id);
|
|
3740
3741
|
try {
|
|
3741
|
-
const _archivedProduct = await
|
|
3742
|
+
const _archivedProduct = await _chunkCFI4WZ5Rjs.StripeProductService.archiveProduct({ id: productToArchive.id });
|
|
3742
3743
|
setProductToArchive(null);
|
|
3743
3744
|
onProductsChange();
|
|
3744
3745
|
} catch (_error) {
|
|
@@ -3753,7 +3754,7 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3753
3754
|
}
|
|
3754
3755
|
setReactivatingProductId(productToReactivate.id);
|
|
3755
3756
|
try {
|
|
3756
|
-
const _reactivatedProduct = await
|
|
3757
|
+
const _reactivatedProduct = await _chunkCFI4WZ5Rjs.StripeProductService.reactivateProduct({ id: productToReactivate.id });
|
|
3757
3758
|
setProductToReactivate(null);
|
|
3758
3759
|
onProductsChange();
|
|
3759
3760
|
} catch (_error) {
|
|
@@ -3782,12 +3783,12 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3782
3783
|
] })
|
|
3783
3784
|
] }),
|
|
3784
3785
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
3785
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3786
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.Button, { variant: "outline", size: "sm", onClick: () => setEditingProduct(product), children: [
|
|
3786
3787
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Edit, { className: "h-4 w-4 mr-1" }),
|
|
3787
3788
|
"Edit"
|
|
3788
3789
|
] }),
|
|
3789
3790
|
product.active ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3790
|
-
|
|
3791
|
+
_chunkUHO3KUUHjs.Button,
|
|
3791
3792
|
{
|
|
3792
3793
|
variant: "outline",
|
|
3793
3794
|
size: "sm",
|
|
@@ -3799,7 +3800,7 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3799
3800
|
]
|
|
3800
3801
|
}
|
|
3801
3802
|
) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3802
|
-
|
|
3803
|
+
_chunkUHO3KUUHjs.Button,
|
|
3803
3804
|
{
|
|
3804
3805
|
variant: "outline",
|
|
3805
3806
|
size: "sm",
|
|
@@ -3811,7 +3812,7 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3811
3812
|
]
|
|
3812
3813
|
}
|
|
3813
3814
|
),
|
|
3814
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3815
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Button, { variant: "ghost", size: "sm", onClick: () => toggleExpand(product.id), children: isExpanded ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ChevronUp, { className: "h-5 w-5" }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ChevronDown, { className: "h-5 w-5" }) })
|
|
3815
3816
|
] })
|
|
3816
3817
|
] }),
|
|
3817
3818
|
isExpanded && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border-t bg-muted/30 p-6", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PricesList, { productId: product.id, onPricesChange: onProductsChange }) })
|
|
@@ -3829,19 +3830,19 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3829
3830
|
}
|
|
3830
3831
|
}
|
|
3831
3832
|
),
|
|
3832
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3833
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3834
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3835
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3833
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.AlertDialog, { open: !!productToArchive, onOpenChange: (open) => !open && setProductToArchive(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.AlertDialogContent, { children: [
|
|
3834
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.AlertDialogHeader, { children: [
|
|
3835
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.AlertDialogTitle, { children: "Archive Product" }),
|
|
3836
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.AlertDialogDescription, { children: [
|
|
3836
3837
|
'Are you sure you want to archive "',
|
|
3837
3838
|
_optionalChain([productToArchive, 'optionalAccess', _165 => _165.name]),
|
|
3838
3839
|
'"? This will deactivate it and it will no longer be available for new subscriptions.'
|
|
3839
3840
|
] })
|
|
3840
3841
|
] }),
|
|
3841
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3842
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3842
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.AlertDialogFooter, { children: [
|
|
3843
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.AlertDialogCancel, { disabled: !!archivingProductId, children: "Cancel" }),
|
|
3843
3844
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3844
|
-
|
|
3845
|
+
_chunkUHO3KUUHjs.AlertDialogAction,
|
|
3845
3846
|
{
|
|
3846
3847
|
onClick: handleArchive,
|
|
3847
3848
|
disabled: !!archivingProductId,
|
|
@@ -3851,19 +3852,19 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3851
3852
|
)
|
|
3852
3853
|
] })
|
|
3853
3854
|
] }) }),
|
|
3854
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3855
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3856
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3857
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3855
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.AlertDialog, { open: !!productToReactivate, onOpenChange: (open) => !open && setProductToReactivate(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.AlertDialogContent, { children: [
|
|
3856
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.AlertDialogHeader, { children: [
|
|
3857
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.AlertDialogTitle, { children: "Reactivate Product" }),
|
|
3858
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.AlertDialogDescription, { children: [
|
|
3858
3859
|
'Are you sure you want to reactivate "',
|
|
3859
3860
|
_optionalChain([productToReactivate, 'optionalAccess', _166 => _166.name]),
|
|
3860
3861
|
'"? This will make it available for new subscriptions again.'
|
|
3861
3862
|
] })
|
|
3862
3863
|
] }),
|
|
3863
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3864
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3864
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkUHO3KUUHjs.AlertDialogFooter, { children: [
|
|
3865
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.AlertDialogCancel, { disabled: !!reactivatingProductId, children: "Cancel" }),
|
|
3865
3866
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3866
|
-
|
|
3867
|
+
_chunkUHO3KUUHjs.AlertDialogAction,
|
|
3867
3868
|
{
|
|
3868
3869
|
onClick: handleReactivate,
|
|
3869
3870
|
disabled: !!reactivatingProductId,
|
|
@@ -3880,17 +3881,17 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductsList, "ProductsList");
|
|
|
3880
3881
|
// src/features/billing/stripe-product/components/containers/ProductsAdminContainer.tsx
|
|
3881
3882
|
|
|
3882
3883
|
function ProductsAdminContainer() {
|
|
3883
|
-
const { hasRole } =
|
|
3884
|
+
const { hasRole } = _chunkUHO3KUUHjs.useCurrentUserContext.call(void 0, );
|
|
3884
3885
|
const [products, setProducts] = _react.useState.call(void 0, []);
|
|
3885
3886
|
const [loading, setLoading] = _react.useState.call(void 0, true);
|
|
3886
3887
|
const [showCreateProduct, setShowCreateProduct] = _react.useState.call(void 0, false);
|
|
3887
|
-
if (!hasRole(
|
|
3888
|
+
if (!hasRole(_chunk7E3O52U5js.getRoleId.call(void 0, ).Administrator)) {
|
|
3888
3889
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex h-64 items-center justify-center", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-red-600 font-semibold", children: "Permission denied. Administrator access required." }) });
|
|
3889
3890
|
}
|
|
3890
3891
|
const loadProducts = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3891
3892
|
setLoading(true);
|
|
3892
3893
|
try {
|
|
3893
|
-
const fetchedProducts = await
|
|
3894
|
+
const fetchedProducts = await _chunkCFI4WZ5Rjs.StripeProductService.listProducts();
|
|
3894
3895
|
setProducts(fetchedProducts);
|
|
3895
3896
|
} catch (error) {
|
|
3896
3897
|
console.error("[ProductsAdminContainer] Failed to load products:", error);
|
|
@@ -3910,14 +3911,14 @@ function ProductsAdminContainer() {
|
|
|
3910
3911
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Package, { className: "h-8 w-8" }),
|
|
3911
3912
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-3xl font-bold", children: "Product & Price Management" })
|
|
3912
3913
|
] }),
|
|
3913
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3914
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Button, { onClick: () => setShowCreateProduct(true), children: "Create Product" })
|
|
3914
3915
|
] }),
|
|
3915
3916
|
products.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-muted/50 flex flex-col items-center justify-center gap-y-4 rounded-lg border-2 border-dashed p-12", children: [
|
|
3916
3917
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Package, { className: "text-muted-foreground h-16 w-16" }),
|
|
3917
3918
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
3918
3919
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "mb-2 text-xl font-semibold", children: "No products yet" }),
|
|
3919
3920
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground mb-4", children: "Create your first product to start offering subscriptions to your customers." }),
|
|
3920
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3921
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkUHO3KUUHjs.Button, { onClick: () => setShowCreateProduct(true), children: "Create Your First Product" })
|
|
3921
3922
|
] })
|
|
3922
3923
|
] }),
|
|
3923
3924
|
products.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductsList, { products, onProductsChange: loadProducts }),
|