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