@carlonicora/nextjs-jsonapi 2.5.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{BlockNoteEditor-TIMGYKAA.js → BlockNoteEditor-3IZ7PMFM.js} +19 -19
- package/dist/{BlockNoteEditor-TIMGYKAA.js.map → BlockNoteEditor-3IZ7PMFM.js.map} +1 -1
- package/dist/{BlockNoteEditor-YFJMXJEU.mjs → BlockNoteEditor-G4XNDV2O.mjs} +4 -4
- package/dist/billing/index.d.mts +127 -46
- package/dist/billing/index.d.ts +127 -46
- package/dist/billing/index.js +1243 -1084
- package/dist/billing/index.js.map +1 -1
- package/dist/billing/index.mjs +983 -824
- package/dist/billing/index.mjs.map +1 -1
- package/dist/{chunk-RTOC53EZ.js → chunk-53B6NPGA.js} +34 -4
- package/dist/chunk-53B6NPGA.js.map +1 -0
- package/dist/{chunk-7HKJNUW7.js → chunk-5GVBUTS4.js} +1142 -953
- package/dist/chunk-5GVBUTS4.js.map +1 -0
- package/dist/{chunk-OTEDZ6YW.js → chunk-JKGEJGSD.js} +7 -7
- package/dist/{chunk-OTEDZ6YW.js.map → chunk-JKGEJGSD.js.map} +1 -1
- package/dist/{chunk-DJWNNV52.mjs → chunk-PHEFWL6L.mjs} +2 -2
- package/dist/{chunk-FS4RVV3K.mjs → chunk-TWXKAY34.mjs} +33 -3
- package/dist/chunk-TWXKAY34.mjs.map +1 -0
- package/dist/{chunk-G4YS52SO.mjs → chunk-WCX4CLRJ.mjs} +1607 -1418
- package/dist/chunk-WCX4CLRJ.mjs.map +1 -0
- package/dist/client/index.js +4 -4
- package/dist/client/index.mjs +3 -3
- package/dist/components/index.js +4 -4
- package/dist/components/index.mjs +3 -3
- package/dist/contexts/index.js +4 -4
- package/dist/contexts/index.mjs +3 -3
- package/dist/core/index.d.mts +17 -1
- package/dist/core/index.d.ts +17 -1
- package/dist/core/index.js +6 -2
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +5 -1
- package/dist/features/help/index.js +37 -37
- package/dist/features/help/index.mjs +3 -3
- package/dist/features/tokenusage/index.js +101 -101
- package/dist/features/tokenusage/index.mjs +3 -3
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -2
- package/dist/server/index.js +3 -3
- package/dist/server/index.mjs +1 -1
- package/package.json +1 -1
- package/src/client/index.ts +4 -0
- package/src/features/administration/components/AdminIndexContainer.tsx +1 -1
- package/src/features/administration/components/__tests__/AdminIndexContainer.spec.tsx +1 -1
- package/src/features/billing/contexts/PriceContext.tsx +202 -0
- package/src/features/billing/contexts/ProductContext.tsx +185 -0
- package/src/features/billing/contexts/__tests__/PriceContext.spec.tsx +89 -0
- package/src/features/billing/contexts/__tests__/ProductContext.spec.tsx +81 -0
- package/src/features/billing/contexts/index.ts +2 -1
- package/src/features/billing/i18n-keys.ts +88 -0
- package/src/features/billing/stripe-price/components/containers/PriceContainer.tsx +21 -0
- package/src/features/billing/stripe-price/components/containers/index.ts +1 -0
- package/src/features/billing/stripe-price/components/details/PriceDetails.tsx +131 -0
- package/src/features/billing/stripe-price/components/details/index.ts +1 -0
- package/src/features/billing/stripe-price/components/forms/PriceArchiver.tsx +55 -0
- package/src/features/billing/stripe-price/components/forms/PriceEditor.tsx +307 -374
- package/src/features/billing/stripe-price/components/forms/index.ts +3 -1
- package/src/features/billing/stripe-price/components/index.ts +2 -0
- package/src/features/billing/stripe-price/components/lists/PricesList.tsx +49 -267
- package/src/features/billing/stripe-price/data/index.ts +1 -0
- package/src/features/billing/stripe-price/data/stripe-price.fields.ts +8 -0
- package/src/features/billing/stripe-price/hooks/useStripePriceTableStructure.tsx +119 -0
- package/src/features/billing/stripe-price/stripe-price.module.ts +5 -1
- package/src/features/billing/stripe-product/components/containers/ProductContainer.tsx +45 -0
- package/src/features/billing/stripe-product/components/containers/ProductsListContainer.tsx +27 -0
- package/src/features/billing/stripe-product/components/containers/index.ts +2 -2
- package/src/features/billing/stripe-product/components/details/ProductDetails.tsx +45 -0
- package/src/features/billing/stripe-product/components/details/index.ts +1 -0
- package/src/features/billing/stripe-product/components/forms/ProductArchiver.tsx +55 -0
- package/src/features/billing/stripe-product/components/forms/ProductEditor.tsx +92 -81
- package/src/features/billing/stripe-product/components/forms/index.ts +3 -1
- package/src/features/billing/stripe-product/components/index.ts +1 -0
- package/src/features/billing/stripe-product/components/lists/ProductsList.tsx +45 -187
- package/src/features/billing/stripe-product/data/index.ts +1 -0
- package/src/features/billing/stripe-product/data/stripe-product.fields.ts +6 -0
- package/src/features/billing/stripe-product/hooks/useStripeProductTableStructure.tsx +80 -0
- package/src/features/billing/stripe-product/stripe-product.module.ts +5 -1
- package/src/features/user/components/forms/UserEditor.tsx +11 -2
- package/dist/chunk-7HKJNUW7.js.map +0 -1
- package/dist/chunk-FS4RVV3K.mjs.map +0 -1
- package/dist/chunk-G4YS52SO.mjs.map +0 -1
- package/dist/chunk-RTOC53EZ.js.map +0 -1
- package/src/features/billing/contexts/BillingContext.tsx +0 -95
- package/src/features/billing/stripe-product/components/containers/ProductsAdminContainer.tsx +0 -98
- package/src/features/billing/stripe-product/components/containers/ProductsAdminPageContainer.tsx +0 -27
- /package/dist/{BlockNoteEditor-YFJMXJEU.mjs.map → BlockNoteEditor-G4XNDV2O.mjs.map} +0 -0
- /package/dist/{chunk-DJWNNV52.mjs.map → chunk-PHEFWL6L.mjs.map} +0 -0
package/dist/billing/index.js
CHANGED
|
@@ -50,11 +50,9 @@
|
|
|
50
50
|
|
|
51
51
|
|
|
52
52
|
|
|
53
|
-
var _chunk7HKJNUW7js = require('../chunk-7HKJNUW7.js');
|
|
54
53
|
|
|
55
54
|
|
|
56
55
|
|
|
57
|
-
var _chunkOTEDZ6YWjs = require('../chunk-OTEDZ6YW.js');
|
|
58
56
|
|
|
59
57
|
|
|
60
58
|
|
|
@@ -64,9 +62,25 @@ var _chunkOTEDZ6YWjs = require('../chunk-OTEDZ6YW.js');
|
|
|
64
62
|
|
|
65
63
|
|
|
66
64
|
|
|
65
|
+
var _chunk5GVBUTS4js = require('../chunk-5GVBUTS4.js');
|
|
67
66
|
|
|
68
67
|
|
|
69
|
-
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
var _chunkJKGEJGSDjs = require('../chunk-JKGEJGSD.js');
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
var _chunk53B6NPGAjs = require('../chunk-53B6NPGA.js');
|
|
70
84
|
require('../chunk-LXKSUWAV.js');
|
|
71
85
|
require('../chunk-IBS6NI7D.js');
|
|
72
86
|
require('../chunk-FPO4DLZN.js');
|
|
@@ -117,41 +131,41 @@ function SubscriptionSummaryCard({
|
|
|
117
131
|
onManageClick
|
|
118
132
|
}) {
|
|
119
133
|
if (loading) {
|
|
120
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
121
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
122
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
134
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.Card, { children: [
|
|
135
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
136
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.CardTitle, { children: "Subscriptions" }),
|
|
123
137
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
124
138
|
] }),
|
|
125
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
126
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
127
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
128
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
139
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.CardContent, { children: [
|
|
140
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
141
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Skeleton, { className: "h-4 w-24 mb-1" }),
|
|
142
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Skeleton, { className: "h-4 w-40" })
|
|
129
143
|
] })
|
|
130
144
|
] });
|
|
131
145
|
}
|
|
132
146
|
if (error) {
|
|
133
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
134
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
135
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
147
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.Card, { children: [
|
|
148
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
149
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.CardTitle, { children: "Subscriptions" }),
|
|
136
150
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
137
151
|
] }),
|
|
138
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
152
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
139
153
|
] });
|
|
140
154
|
}
|
|
141
155
|
const activeSubscriptions = subscriptions.filter(
|
|
142
156
|
(sub) => sub.status === "active" /* ACTIVE */ || sub.status === "trialing" /* TRIALING */
|
|
143
157
|
);
|
|
144
158
|
const primarySubscription = activeSubscriptions[0];
|
|
145
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
146
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
147
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
159
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
|
|
160
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
161
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.CardTitle, { children: "Subscriptions" }),
|
|
148
162
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
149
163
|
] }),
|
|
150
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
164
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.CardContent, { children: subscriptions.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
151
165
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No active plan" }),
|
|
152
166
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Subscribe to get started" }),
|
|
153
167
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
154
|
-
|
|
168
|
+
_chunk5GVBUTS4js.Button,
|
|
155
169
|
{
|
|
156
170
|
variant: "outline",
|
|
157
171
|
size: "sm",
|
|
@@ -170,7 +184,7 @@ function SubscriptionSummaryCard({
|
|
|
170
184
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
171
185
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: formatPlanName(primarySubscription) }),
|
|
172
186
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
173
|
-
|
|
187
|
+
_chunk5GVBUTS4js.Badge,
|
|
174
188
|
{
|
|
175
189
|
variant: primarySubscription.cancelAtPeriodEnd ? "secondary" : getStatusBadgeVariant(primarySubscription.status),
|
|
176
190
|
children: primarySubscription.cancelAtPeriodEnd ? "Canceling" : primarySubscription.status
|
|
@@ -212,37 +226,37 @@ function PaymentMethodSummaryCard({
|
|
|
212
226
|
onManageClick
|
|
213
227
|
}) {
|
|
214
228
|
if (loading) {
|
|
215
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
216
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
217
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
229
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.Card, { children: [
|
|
230
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
231
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.CardTitle, { children: "Payment Method" }),
|
|
218
232
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
219
233
|
] }),
|
|
220
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
221
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
222
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
234
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.CardContent, { children: [
|
|
235
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
236
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Skeleton, { className: "h-4 w-24" })
|
|
223
237
|
] })
|
|
224
238
|
] });
|
|
225
239
|
}
|
|
226
240
|
if (error) {
|
|
227
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
228
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
229
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
241
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.Card, { children: [
|
|
242
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
243
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.CardTitle, { children: "Payment Method" }),
|
|
230
244
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
231
245
|
] }),
|
|
232
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
246
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
233
247
|
] });
|
|
234
248
|
}
|
|
235
249
|
const defaultMethod = paymentMethods.find((pm) => pm.id === defaultPaymentMethodId) || paymentMethods[0];
|
|
236
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
237
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
238
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
250
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
|
|
251
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
252
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.CardTitle, { children: "Payment Method" }),
|
|
239
253
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
240
254
|
] }),
|
|
241
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
255
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.CardContent, { children: paymentMethods.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
242
256
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No payment method" }),
|
|
243
257
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Add a card to enable subscriptions" }),
|
|
244
258
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
245
|
-
|
|
259
|
+
_chunk5GVBUTS4js.Button,
|
|
246
260
|
{
|
|
247
261
|
variant: "outline",
|
|
248
262
|
size: "sm",
|
|
@@ -306,7 +320,7 @@ function CustomerInfoCard({ customer, loading, error }) {
|
|
|
306
320
|
e.stopPropagation();
|
|
307
321
|
setPortalLoading(true);
|
|
308
322
|
try {
|
|
309
|
-
const { url } = await
|
|
323
|
+
const { url } = await _chunk53B6NPGAjs.StripeCustomerService.createPortalSession();
|
|
310
324
|
window.open(url, "_blank");
|
|
311
325
|
} catch (err) {
|
|
312
326
|
console.error("[CustomerInfoCard] Failed to create portal session:", err);
|
|
@@ -315,52 +329,52 @@ function CustomerInfoCard({ customer, loading, error }) {
|
|
|
315
329
|
}
|
|
316
330
|
}, "handlePortalClick");
|
|
317
331
|
if (loading) {
|
|
318
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
319
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
320
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
332
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.Card, { children: [
|
|
333
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
334
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.CardTitle, { children: "Billing Account" }),
|
|
321
335
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
322
336
|
] }),
|
|
323
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
324
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
325
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
326
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
337
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.CardContent, { children: [
|
|
338
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
339
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Skeleton, { className: "h-4 w-48 mb-1" }),
|
|
340
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Skeleton, { className: "h-4 w-24" })
|
|
327
341
|
] })
|
|
328
342
|
] });
|
|
329
343
|
}
|
|
330
344
|
if (error) {
|
|
331
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
332
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
333
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
345
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.Card, { children: [
|
|
346
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
347
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.CardTitle, { children: "Billing Account" }),
|
|
334
348
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
335
349
|
] }),
|
|
336
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
350
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
337
351
|
] });
|
|
338
352
|
}
|
|
339
353
|
if (!customer) {
|
|
340
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
341
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
342
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
354
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.Card, { children: [
|
|
355
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
356
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.CardTitle, { children: "Billing Account" }),
|
|
343
357
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
344
358
|
] }),
|
|
345
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
359
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.CardContent, { children: [
|
|
346
360
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "Not set up" }),
|
|
347
361
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Billing account will be created when you subscribe" })
|
|
348
362
|
] })
|
|
349
363
|
] });
|
|
350
364
|
}
|
|
351
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
352
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
353
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
365
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.Card, { children: [
|
|
366
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
367
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.CardTitle, { children: "Billing Account" }),
|
|
354
368
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
355
369
|
] }),
|
|
356
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
370
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
357
371
|
customer.name && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: customer.name }),
|
|
358
372
|
customer.email && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: customer.email }),
|
|
359
373
|
customer.balance !== void 0 && customer.balance !== 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm", children: [
|
|
360
374
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground", children: "Credit Balance: " }),
|
|
361
375
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: customer.balance < 0 ? "text-success" : "text-destructive", children: formatBalance(customer.balance, customer.currency) })
|
|
362
376
|
] }),
|
|
363
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
377
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.Button, { variant: "outline", size: "sm", className: "mt-2", onClick: handlePortalClick, disabled: portalLoading, children: [
|
|
364
378
|
portalLoading ? "Loading..." : "Manage in Stripe Portal",
|
|
365
379
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ExternalLink, { className: "h-4 w-4 ml-1" })
|
|
366
380
|
] })
|
|
@@ -404,42 +418,42 @@ function formatAmount(amount, currency) {
|
|
|
404
418
|
_chunk7QVYU63Ejs.__name.call(void 0, formatAmount, "formatAmount");
|
|
405
419
|
function InvoicesSummaryCard({ invoices, loading, error, onViewAllClick }) {
|
|
406
420
|
if (loading) {
|
|
407
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
408
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
409
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
421
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.Card, { children: [
|
|
422
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
423
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.CardTitle, { children: "Recent Invoices" }),
|
|
410
424
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
411
425
|
] }),
|
|
412
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
413
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
414
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
415
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
426
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.CardContent, { children: [
|
|
427
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Skeleton, { className: "h-6 w-24 mb-2" }),
|
|
428
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Skeleton, { className: "h-4 w-32 mb-1" }),
|
|
429
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Skeleton, { className: "h-4 w-20" })
|
|
416
430
|
] })
|
|
417
431
|
] });
|
|
418
432
|
}
|
|
419
433
|
if (error) {
|
|
420
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
421
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
422
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
434
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.Card, { children: [
|
|
435
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
436
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.CardTitle, { children: "Recent Invoices" }),
|
|
423
437
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
424
438
|
] }),
|
|
425
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
439
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
426
440
|
] });
|
|
427
441
|
}
|
|
428
442
|
const latestInvoice = invoices[0];
|
|
429
443
|
const paidInvoices = invoices.filter((inv) => inv.status === "paid" /* PAID */);
|
|
430
444
|
const openInvoices = invoices.filter((inv) => inv.status === "open" /* OPEN */);
|
|
431
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
432
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
433
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
445
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewAllClick, children: [
|
|
446
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
447
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.CardTitle, { children: "Recent Invoices" }),
|
|
434
448
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
435
449
|
] }),
|
|
436
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
450
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.CardContent, { children: invoices.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
437
451
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No invoices yet" }),
|
|
438
452
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Invoices will appear after your first billing cycle" })
|
|
439
453
|
] }) : latestInvoice ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
440
454
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
441
455
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: formatAmount(latestInvoice.total, latestInvoice.currency) }),
|
|
442
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
456
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Badge, { variant: getStatusBadgeVariant2(latestInvoice.status), children: latestInvoice.status })
|
|
443
457
|
] }),
|
|
444
458
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: latestInvoice.stripeInvoiceNumber || `Invoice from ${formatDate2(latestInvoice.periodStart)}` }),
|
|
445
459
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-4 text-xs text-muted-foreground", children: [
|
|
@@ -479,24 +493,24 @@ function BillingUsageSummaryCard({
|
|
|
479
493
|
onViewDetailsClick
|
|
480
494
|
}) {
|
|
481
495
|
if (loading) {
|
|
482
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
483
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
484
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
496
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.Card, { children: [
|
|
497
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
498
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.CardTitle, { children: "Usage This Month" }),
|
|
485
499
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
486
500
|
] }),
|
|
487
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
488
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
489
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
501
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.CardContent, { children: [
|
|
502
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Skeleton, { className: "h-6 w-24 mb-2" }),
|
|
503
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Skeleton, { className: "h-4 w-32" })
|
|
490
504
|
] })
|
|
491
505
|
] });
|
|
492
506
|
}
|
|
493
507
|
if (error) {
|
|
494
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
495
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
496
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
508
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.Card, { children: [
|
|
509
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
510
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.CardTitle, { children: "Usage This Month" }),
|
|
497
511
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
498
512
|
] }),
|
|
499
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
513
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
500
514
|
] });
|
|
501
515
|
}
|
|
502
516
|
const totalUsage = Object.values(summaries).reduce((acc, summary) => {
|
|
@@ -504,12 +518,12 @@ function BillingUsageSummaryCard({
|
|
|
504
518
|
}, 0);
|
|
505
519
|
const primaryMeter = meters.find((m) => _optionalChain([summaries, 'access', _17 => _17[m.id], 'optionalAccess', _18 => _18.aggregatedValue]));
|
|
506
520
|
const primarySummary = primaryMeter ? summaries[primaryMeter.id] : null;
|
|
507
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
508
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
509
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
521
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewDetailsClick, children: [
|
|
522
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
523
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.CardTitle, { children: "Usage This Month" }),
|
|
510
524
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
511
525
|
] }),
|
|
512
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
526
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.CardContent, { children: meters.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
513
527
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No meters" }),
|
|
514
528
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "No usage meters are configured" })
|
|
515
529
|
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
@@ -561,7 +575,7 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
|
|
|
561
575
|
const fetchSetupIntent = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
562
576
|
setLoading(true);
|
|
563
577
|
try {
|
|
564
|
-
const intent = await
|
|
578
|
+
const intent = await _chunk53B6NPGAjs.StripeCustomerService.createSetupIntent();
|
|
565
579
|
setSetupIntent(intent);
|
|
566
580
|
} catch (err) {
|
|
567
581
|
console.error("[PaymentMethodForm] Failed to create setup intent:", err);
|
|
@@ -599,7 +613,7 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
|
|
|
599
613
|
return;
|
|
600
614
|
}
|
|
601
615
|
if (setAsDefault && _optionalChain([confirmedSetupIntent, 'optionalAccess', _19 => _19.payment_method])) {
|
|
602
|
-
await
|
|
616
|
+
await _chunk53B6NPGAjs.StripeCustomerService.setDefaultPaymentMethod({
|
|
603
617
|
paymentMethodId: typeof confirmedSetupIntent.payment_method === "string" ? confirmedSetupIntent.payment_method : confirmedSetupIntent.payment_method.id
|
|
604
618
|
});
|
|
605
619
|
}
|
|
@@ -615,7 +629,7 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
|
|
|
615
629
|
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..." }) });
|
|
616
630
|
}
|
|
617
631
|
if (!setupIntent && error) {
|
|
618
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
632
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.AlertDescription, { children: error }) });
|
|
619
633
|
}
|
|
620
634
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: handleSubmit, className: "flex flex-col gap-y-4", children: [
|
|
621
635
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rounded-md border border-gray-300 p-3", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -638,13 +652,13 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
|
|
|
638
652
|
}
|
|
639
653
|
) }),
|
|
640
654
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
641
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
642
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
655
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Checkbox, { id: "setAsDefault", checked: setAsDefault, onCheckedChange: (checked) => setSetAsDefault(!!checked) }),
|
|
656
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Label, { htmlFor: "setAsDefault", className: "cursor-pointer font-normal", children: "Set as default payment method" })
|
|
643
657
|
] }),
|
|
644
|
-
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
658
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.AlertDescription, { children: error }) }),
|
|
645
659
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-x-2", children: [
|
|
646
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
647
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
660
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Button, { type: "button", variant: "outline", onClick: onCancel, disabled: isSubmitting || isLoading, children: "Cancel" }),
|
|
661
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Button, { type: "submit", disabled: !stripe || isSubmitting || isLoading, children: isSubmitting ? "Processing..." : "Add Card" })
|
|
648
662
|
] })
|
|
649
663
|
] });
|
|
650
664
|
}
|
|
@@ -660,10 +674,10 @@ function PaymentMethodEditor({ open, onOpenChange, onSuccess }) {
|
|
|
660
674
|
const handleCancel = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
661
675
|
onOpenChange(false);
|
|
662
676
|
}, "handleCancel");
|
|
663
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
664
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
665
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
666
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
677
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.DialogContent, { className: "max-w-md", children: [
|
|
678
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.DialogHeader, { children: [
|
|
679
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.DialogTitle, { children: "Add Payment Method" }),
|
|
680
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.DialogDescription, { children: "Add a new payment method to your account. Your card information is securely processed by Stripe." })
|
|
667
681
|
] }),
|
|
668
682
|
open && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodForm, { onSuccess: handleSuccess, onCancel: handleCancel })
|
|
669
683
|
] }) });
|
|
@@ -687,7 +701,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
687
701
|
_react.useEffect.call(void 0, () => {
|
|
688
702
|
const loadCustomer = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
689
703
|
try {
|
|
690
|
-
const fetchedCustomer = await
|
|
704
|
+
const fetchedCustomer = await _chunk53B6NPGAjs.StripeCustomerService.getCustomer();
|
|
691
705
|
setCustomer(fetchedCustomer);
|
|
692
706
|
} catch (error) {
|
|
693
707
|
console.error("[PaymentMethodCard] Failed to load customer:", error);
|
|
@@ -704,7 +718,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
704
718
|
const handleSetDefault = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
705
719
|
setLoading(true);
|
|
706
720
|
try {
|
|
707
|
-
await
|
|
721
|
+
await _chunk53B6NPGAjs.StripeCustomerService.setDefaultPaymentMethod({ paymentMethodId: paymentMethod.id });
|
|
708
722
|
onUpdate();
|
|
709
723
|
} catch (error) {
|
|
710
724
|
console.error("[PaymentMethodCard] Failed to set as default:", error);
|
|
@@ -715,7 +729,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
715
729
|
const handleRemove = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
716
730
|
setLoading(true);
|
|
717
731
|
try {
|
|
718
|
-
await
|
|
732
|
+
await _chunk53B6NPGAjs.StripeCustomerService.removePaymentMethod({ paymentMethodId: paymentMethod.id });
|
|
719
733
|
setShowRemoveDialog(false);
|
|
720
734
|
onUpdate();
|
|
721
735
|
} catch (error) {
|
|
@@ -724,16 +738,16 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
724
738
|
}
|
|
725
739
|
}, "handleRemove");
|
|
726
740
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
727
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
728
|
-
isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
729
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
741
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.Card, { className: "relative", children: [
|
|
742
|
+
isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Badge, { variant: "softGreen", className: "absolute right-2 top-2", children: "Default" }),
|
|
743
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.CardHeader, { className: "flex flex-row items-center justify-between pb-2", children: [
|
|
730
744
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
731
745
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-2xl", children: brandIcon }),
|
|
732
746
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium capitalize", children: brand })
|
|
733
747
|
] }),
|
|
734
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
735
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
736
|
-
|
|
748
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.DropdownMenu, { children: [
|
|
749
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.DropdownMenuTrigger, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
750
|
+
_chunk5GVBUTS4js.Button,
|
|
737
751
|
{
|
|
738
752
|
render: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {}),
|
|
739
753
|
nativeButton: false,
|
|
@@ -744,10 +758,10 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
744
758
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.MoreVertical, { className: "h-4 w-4" })
|
|
745
759
|
}
|
|
746
760
|
) }),
|
|
747
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
748
|
-
!isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
761
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.DropdownMenuContent, { align: "end", children: [
|
|
762
|
+
!isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.DropdownMenuItem, { onClick: handleSetDefault, disabled: loading, children: "Set as Default" }),
|
|
749
763
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
750
|
-
|
|
764
|
+
_chunk5GVBUTS4js.DropdownMenuItem,
|
|
751
765
|
{
|
|
752
766
|
onClick: () => setShowRemoveDialog(true),
|
|
753
767
|
disabled: loading,
|
|
@@ -758,7 +772,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
758
772
|
] })
|
|
759
773
|
] })
|
|
760
774
|
] }),
|
|
761
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
775
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-1", children: [
|
|
762
776
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-lg font-semibold", children: [
|
|
763
777
|
"\u2022\u2022\u2022\u2022 ",
|
|
764
778
|
last4
|
|
@@ -771,17 +785,17 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
771
785
|
] })
|
|
772
786
|
] }) })
|
|
773
787
|
] }),
|
|
774
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
775
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
776
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
777
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
788
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.AlertDialog, { open: showRemoveDialog, onOpenChange: setShowRemoveDialog, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.AlertDialogContent, { children: [
|
|
789
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.AlertDialogHeader, { children: [
|
|
790
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.AlertDialogTitle, { children: "Remove Payment Method" }),
|
|
791
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.AlertDialogDescription, { children: [
|
|
778
792
|
"Are you sure you want to remove this payment method? This action cannot be undone.",
|
|
779
793
|
isDefault && " This is your default payment method."
|
|
780
794
|
] })
|
|
781
795
|
] }),
|
|
782
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
783
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
784
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
796
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.AlertDialogFooter, { children: [
|
|
797
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.AlertDialogCancel, { disabled: loading, children: "Cancel" }),
|
|
798
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.AlertDialogAction, { onClick: handleRemove, disabled: loading, className: "bg-red-600 hover:bg-red-700", children: loading ? "Removing..." : "Remove" })
|
|
785
799
|
] })
|
|
786
800
|
] }) })
|
|
787
801
|
] });
|
|
@@ -804,7 +818,7 @@ function PaymentMethodsContainer() {
|
|
|
804
818
|
const loadPaymentMethods = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
805
819
|
setLoading(true);
|
|
806
820
|
try {
|
|
807
|
-
const fetchedPaymentMethods = await
|
|
821
|
+
const fetchedPaymentMethods = await _chunk53B6NPGAjs.StripeCustomerService.listPaymentMethods();
|
|
808
822
|
setPaymentMethods(fetchedPaymentMethods);
|
|
809
823
|
} catch (error) {
|
|
810
824
|
console.error("[PaymentMethodsContainer] Failed to load payment methods:", error);
|
|
@@ -824,14 +838,14 @@ function PaymentMethodsContainer() {
|
|
|
824
838
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8" }),
|
|
825
839
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: "Payment Methods" })
|
|
826
840
|
] }),
|
|
827
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
841
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Button, { onClick: () => setShowAddPaymentMethod(true), children: "Add Payment Method" })
|
|
828
842
|
] }),
|
|
829
843
|
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: [
|
|
830
844
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-16 w-16 text-muted-foreground" }),
|
|
831
845
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
832
846
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "mb-2 text-sm font-medium", children: "No payment methods" }),
|
|
833
847
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mb-4 text-muted-foreground", children: "Add a payment method to enable subscriptions and secure checkout." }),
|
|
834
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
848
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Button, { onClick: () => setShowAddPaymentMethod(true), children: "Add Your First Card" })
|
|
835
849
|
] })
|
|
836
850
|
] }),
|
|
837
851
|
paymentMethods.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodsList, { paymentMethods, onUpdate: loadPaymentMethods }),
|
|
@@ -853,36 +867,6 @@ _chunk7QVYU63Ejs.__name.call(void 0, PaymentMethodsContainer, "PaymentMethodsCon
|
|
|
853
867
|
// src/features/billing/stripe-invoice/components/lists/InvoicesList.tsx
|
|
854
868
|
|
|
855
869
|
|
|
856
|
-
// src/features/billing/components/utils/currency.ts
|
|
857
|
-
function formatInterval(price) {
|
|
858
|
-
if (price.priceType === "one_time" || !price.recurring) {
|
|
859
|
-
return "one-time";
|
|
860
|
-
}
|
|
861
|
-
const { interval, intervalCount } = price.recurring;
|
|
862
|
-
if (intervalCount === 1) {
|
|
863
|
-
return `/${interval}`;
|
|
864
|
-
}
|
|
865
|
-
const pluralInterval = interval === "day" ? "days" : interval === "week" ? "weeks" : interval === "month" ? "months" : "years";
|
|
866
|
-
return `/${intervalCount} ${pluralInterval}`;
|
|
867
|
-
}
|
|
868
|
-
_chunk7QVYU63Ejs.__name.call(void 0, formatInterval, "formatInterval");
|
|
869
|
-
function formatCurrency(amount, currency) {
|
|
870
|
-
if (amount === void 0) return "$0.00";
|
|
871
|
-
const dollars = amount / 100;
|
|
872
|
-
try {
|
|
873
|
-
return new Intl.NumberFormat("en-US", {
|
|
874
|
-
style: "currency",
|
|
875
|
-
currency: currency.toUpperCase(),
|
|
876
|
-
minimumFractionDigits: 2,
|
|
877
|
-
maximumFractionDigits: 2
|
|
878
|
-
}).format(dollars);
|
|
879
|
-
} catch (error) {
|
|
880
|
-
console.error("Error formatting currency:", error);
|
|
881
|
-
return `$${dollars.toFixed(2)}`;
|
|
882
|
-
}
|
|
883
|
-
}
|
|
884
|
-
_chunk7QVYU63Ejs.__name.call(void 0, formatCurrency, "formatCurrency");
|
|
885
|
-
|
|
886
870
|
// src/features/billing/components/utils/date.ts
|
|
887
871
|
function formatDate3(date) {
|
|
888
872
|
if (!date) return "N/A";
|
|
@@ -929,7 +913,7 @@ var statusConfig = {
|
|
|
929
913
|
};
|
|
930
914
|
function InvoiceStatusBadge({ status }) {
|
|
931
915
|
const config = statusConfig[status] || statusConfig["draft" /* DRAFT */];
|
|
932
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
916
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Badge, { variant: config.variant, children: config.label });
|
|
933
917
|
}
|
|
934
918
|
_chunk7QVYU63Ejs.__name.call(void 0, InvoiceStatusBadge, "InvoiceStatusBadge");
|
|
935
919
|
|
|
@@ -960,13 +944,13 @@ function InvoiceDetails({
|
|
|
960
944
|
return invoice.stripeInvoiceId.slice(-8);
|
|
961
945
|
}, "getInvoiceNumber");
|
|
962
946
|
const productName = _optionalChain([invoice, 'access', _29 => _29.subscription, 'optionalAccess', _30 => _30.price, 'optionalAccess', _31 => _31.product, 'optionalAccess', _32 => _32.name]) || "Subscription";
|
|
963
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
964
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
965
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
947
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.DialogContent, { className: "max-w-2xl", children: [
|
|
948
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.DialogHeader, { children: [
|
|
949
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.DialogTitle, { children: [
|
|
966
950
|
"Invoice ",
|
|
967
951
|
getInvoiceNumber()
|
|
968
952
|
] }),
|
|
969
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
953
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.DialogDescription, { children: formatDate3(invoice.periodStart) })
|
|
970
954
|
] }),
|
|
971
955
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
972
956
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
@@ -1004,42 +988,42 @@ function InvoiceDetails({
|
|
|
1004
988
|
] }) }),
|
|
1005
989
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "tbody", { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "tr", { className: "border-t", children: [
|
|
1006
990
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "td", { className: "p-3", children: productName }),
|
|
1007
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "td", { className: "p-3 text-right", children: formatCurrency(invoice.subtotal, invoice.currency) })
|
|
991
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "td", { className: "p-3 text-right", children: _chunk5GVBUTS4js.formatCurrency.call(void 0, invoice.subtotal, invoice.currency) })
|
|
1008
992
|
] }) })
|
|
1009
993
|
] }) })
|
|
1010
994
|
] }),
|
|
1011
995
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2 border-t pt-4", children: [
|
|
1012
996
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1013
997
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: "Subtotal:" }),
|
|
1014
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children: formatCurrency(invoice.subtotal, invoice.currency) })
|
|
998
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children: _chunk5GVBUTS4js.formatCurrency.call(void 0, invoice.subtotal, invoice.currency) })
|
|
1015
999
|
] }),
|
|
1016
1000
|
invoice.tax !== void 0 && invoice.tax > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1017
1001
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: "Tax:" }),
|
|
1018
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children: formatCurrency(invoice.tax, invoice.currency) })
|
|
1002
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children: _chunk5GVBUTS4js.formatCurrency.call(void 0, invoice.tax, invoice.currency) })
|
|
1019
1003
|
] }),
|
|
1020
1004
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between text-lg font-semibold border-t pt-2", children: [
|
|
1021
1005
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Total:" }),
|
|
1022
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: formatCurrency(invoice.total, invoice.currency) })
|
|
1006
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _chunk5GVBUTS4js.formatCurrency.call(void 0, invoice.total, invoice.currency) })
|
|
1023
1007
|
] }),
|
|
1024
1008
|
invoice.amountPaid > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1025
1009
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: "Amount Paid:" }),
|
|
1026
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-success", children: formatCurrency(invoice.amountPaid, invoice.currency) })
|
|
1010
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-success", children: _chunk5GVBUTS4js.formatCurrency.call(void 0, invoice.amountPaid, invoice.currency) })
|
|
1027
1011
|
] }),
|
|
1028
1012
|
invoice.amountRemaining > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1029
1013
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: "Amount Due:" }),
|
|
1030
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-destructive", children: formatCurrency(invoice.amountRemaining, invoice.currency) })
|
|
1014
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-destructive", children: _chunk5GVBUTS4js.formatCurrency.call(void 0, invoice.amountRemaining, invoice.currency) })
|
|
1031
1015
|
] })
|
|
1032
1016
|
] }),
|
|
1033
1017
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2 pt-4 border-t", children: [
|
|
1034
|
-
invoice.stripePdfUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1018
|
+
invoice.stripePdfUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.Button, { variant: "outline", onClick: handleDownloadPDF, children: [
|
|
1035
1019
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Download, { className: "mr-2 h-4 w-4" }),
|
|
1036
1020
|
"Download PDF"
|
|
1037
1021
|
] }),
|
|
1038
|
-
invoice.status === "open" /* OPEN */ && invoice.attempted && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1022
|
+
invoice.status === "open" /* OPEN */ && invoice.attempted && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.Button, { variant: "default", onClick: handleRetryPayment, children: [
|
|
1039
1023
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RefreshCw, { className: "mr-2 h-4 w-4" }),
|
|
1040
1024
|
"Retry Payment"
|
|
1041
1025
|
] }),
|
|
1042
|
-
invoice.stripeHostedInvoiceUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1026
|
+
invoice.stripeHostedInvoiceUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.Button, { variant: "outline", onClick: handleViewInStripe, children: [
|
|
1043
1027
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ExternalLink, { className: "mr-2 h-4 w-4" }),
|
|
1044
1028
|
"View in Stripe"
|
|
1045
1029
|
] })
|
|
@@ -1063,30 +1047,30 @@ function InvoicesList({ invoices, onInvoicesChange }) {
|
|
|
1063
1047
|
return invoice.stripeInvoiceId.slice(-8);
|
|
1064
1048
|
}, "getInvoiceNumber");
|
|
1065
1049
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1066
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1067
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1068
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1069
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1070
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1071
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1072
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1050
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.Table, { children: [
|
|
1051
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.TableRow, { children: [
|
|
1052
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.TableHead, { children: "Invoice #" }),
|
|
1053
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.TableHead, { children: "Date" }),
|
|
1054
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.TableHead, { children: "Status" }),
|
|
1055
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.TableHead, { className: "text-right", children: "Amount" }),
|
|
1056
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.TableHead, { children: "Period" })
|
|
1073
1057
|
] }) }),
|
|
1074
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1058
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.TableBody, { children: invoices.map((invoice) => {
|
|
1075
1059
|
const invoiceNumber = getInvoiceNumber(invoice);
|
|
1076
1060
|
const date = formatDate3(invoice.periodStart);
|
|
1077
|
-
const amount = formatCurrency(invoice.total, invoice.currency);
|
|
1061
|
+
const amount = _chunk5GVBUTS4js.formatCurrency.call(void 0, invoice.total, invoice.currency);
|
|
1078
1062
|
const period = `${formatDate3(invoice.periodStart)} - ${formatDate3(invoice.periodEnd)}`;
|
|
1079
1063
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1080
|
-
|
|
1064
|
+
_chunk5GVBUTS4js.TableRow,
|
|
1081
1065
|
{
|
|
1082
1066
|
onClick: () => handleRowClick(invoice),
|
|
1083
1067
|
className: "cursor-pointer hover:bg-muted/50",
|
|
1084
1068
|
children: [
|
|
1085
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1086
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1087
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1088
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1089
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1069
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.TableCell, { className: "font-medium", children: invoiceNumber }),
|
|
1070
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.TableCell, { className: "text-muted-foreground text-xs", children: date }),
|
|
1071
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InvoiceStatusBadge, { status: invoice.status }) }),
|
|
1072
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.TableCell, { className: "text-right font-medium", children: amount }),
|
|
1073
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.TableCell, { className: "text-muted-foreground text-xs", children: period })
|
|
1090
1074
|
]
|
|
1091
1075
|
},
|
|
1092
1076
|
invoice.id
|
|
@@ -1119,7 +1103,7 @@ function InvoicesContainer() {
|
|
|
1119
1103
|
setLoading(true);
|
|
1120
1104
|
try {
|
|
1121
1105
|
const params = statusFilter !== "all" ? { status: statusFilter } : void 0;
|
|
1122
|
-
const data = await
|
|
1106
|
+
const data = await _chunk53B6NPGAjs.StripeInvoiceService.listInvoices(params);
|
|
1123
1107
|
setInvoices(data);
|
|
1124
1108
|
} catch (error) {
|
|
1125
1109
|
console.error("[InvoicesContainer] Failed to load invoices:", error);
|
|
@@ -1135,12 +1119,12 @@ function InvoicesContainer() {
|
|
|
1135
1119
|
setStatusFilter(value);
|
|
1136
1120
|
}, "handleFilterChange");
|
|
1137
1121
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-4", children: [
|
|
1138
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1139
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1140
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1141
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1142
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1143
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1122
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Tabs, { value: statusFilter, onValueChange: handleFilterChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.TabsList, { children: [
|
|
1123
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.TabsTrigger, { value: "all", children: "All" }),
|
|
1124
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.TabsTrigger, { value: "paid" /* PAID */, children: "Paid" }),
|
|
1125
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.TabsTrigger, { value: "open" /* OPEN */, children: "Open" }),
|
|
1126
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.TabsTrigger, { value: "void" /* VOID */, children: "Void" }),
|
|
1127
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.TabsTrigger, { value: "uncollectible" /* UNCOLLECTIBLE */, children: "Uncollectible" })
|
|
1144
1128
|
] }) }),
|
|
1145
1129
|
loading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-center py-8 text-muted-foreground", children: "Loading invoices..." }),
|
|
1146
1130
|
!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: [
|
|
@@ -1187,7 +1171,7 @@ function CancelSubscriptionDialog({
|
|
|
1187
1171
|
const onSubmit = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async (_values) => {
|
|
1188
1172
|
setIsSubmitting(true);
|
|
1189
1173
|
try {
|
|
1190
|
-
await
|
|
1174
|
+
await _chunk53B6NPGAjs.StripeSubscriptionService.cancelSubscription({
|
|
1191
1175
|
id: subscription.id,
|
|
1192
1176
|
cancelImmediately: false
|
|
1193
1177
|
});
|
|
@@ -1200,19 +1184,19 @@ function CancelSubscriptionDialog({
|
|
|
1200
1184
|
}
|
|
1201
1185
|
}, "onSubmit");
|
|
1202
1186
|
const periodEndDate = formatDate3(subscription.currentPeriodEnd);
|
|
1203
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1204
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1205
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1206
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1187
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.DialogContent, { className: "max-w-md", children: [
|
|
1188
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.DialogHeader, { children: [
|
|
1189
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.DialogTitle, { children: "Cancel Subscription" }),
|
|
1190
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.DialogDescription, { children: "Are you sure you want to cancel this subscription? This action cannot be undone." })
|
|
1207
1191
|
] }),
|
|
1208
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1192
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-col gap-y-4", children: [
|
|
1209
1193
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-primary/10 border-primary/30 text-foreground rounded-lg border p-3 text-sm", children: [
|
|
1210
1194
|
"Your subscription will remain active until ",
|
|
1211
1195
|
periodEndDate,
|
|
1212
1196
|
". You can continue using the service until then."
|
|
1213
1197
|
] }),
|
|
1214
1198
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1215
|
-
|
|
1199
|
+
_chunk5GVBUTS4js.FormTextarea,
|
|
1216
1200
|
{
|
|
1217
1201
|
form,
|
|
1218
1202
|
id: "reason",
|
|
@@ -1222,8 +1206,8 @@ function CancelSubscriptionDialog({
|
|
|
1222
1206
|
}
|
|
1223
1207
|
),
|
|
1224
1208
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-x-2 justify-end pt-2", children: [
|
|
1225
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1226
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1209
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Button, { type: "button", variant: "outline", onClick: () => onOpenChange(false), disabled: isSubmitting, children: "Keep Subscription" }),
|
|
1210
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Button, { type: "submit", variant: "destructive", disabled: isSubmitting, children: isSubmitting ? "Canceling..." : "Confirm Cancellation" })
|
|
1227
1211
|
] })
|
|
1228
1212
|
] }) })
|
|
1229
1213
|
] }) });
|
|
@@ -1272,7 +1256,7 @@ var cancelingConfig = {
|
|
|
1272
1256
|
};
|
|
1273
1257
|
function SubscriptionStatusBadge({ status, cancelAtPeriodEnd }) {
|
|
1274
1258
|
const config = cancelAtPeriodEnd ? cancelingConfig : statusConfig2[status] || statusConfig2["canceled" /* CANCELED */];
|
|
1275
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1259
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Badge, { variant: config.variant, children: config.label });
|
|
1276
1260
|
}
|
|
1277
1261
|
_chunk7QVYU63Ejs.__name.call(void 0, SubscriptionStatusBadge, "SubscriptionStatusBadge");
|
|
1278
1262
|
|
|
@@ -1299,7 +1283,7 @@ function formatPlanName2(price) {
|
|
|
1299
1283
|
_chunk7QVYU63Ejs.__name.call(void 0, formatPlanName2, "formatPlanName");
|
|
1300
1284
|
function formatBillingAmount(price) {
|
|
1301
1285
|
if (!_optionalChain([price, 'optionalAccess', _37 => _37.unitAmount])) return "N/A";
|
|
1302
|
-
return formatCurrency(price.unitAmount, price.currency);
|
|
1286
|
+
return _chunk5GVBUTS4js.formatCurrency.call(void 0, price.unitAmount, price.currency);
|
|
1303
1287
|
}
|
|
1304
1288
|
_chunk7QVYU63Ejs.__name.call(void 0, formatBillingAmount, "formatBillingAmount");
|
|
1305
1289
|
function SubscriptionDetails({
|
|
@@ -1314,7 +1298,7 @@ function SubscriptionDetails({
|
|
|
1314
1298
|
const handlePause = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1315
1299
|
setIsProcessing(true);
|
|
1316
1300
|
try {
|
|
1317
|
-
await
|
|
1301
|
+
await _chunk53B6NPGAjs.StripeSubscriptionService.pauseSubscription({ subscriptionId: subscription.id });
|
|
1318
1302
|
onSubscriptionChange();
|
|
1319
1303
|
} catch (error) {
|
|
1320
1304
|
console.error("[SubscriptionDetails] Failed to pause subscription:", error);
|
|
@@ -1325,7 +1309,7 @@ function SubscriptionDetails({
|
|
|
1325
1309
|
const handleResume = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1326
1310
|
setIsProcessing(true);
|
|
1327
1311
|
try {
|
|
1328
|
-
await
|
|
1312
|
+
await _chunk53B6NPGAjs.StripeSubscriptionService.resumeSubscription({ subscriptionId: subscription.id });
|
|
1329
1313
|
onSubscriptionChange();
|
|
1330
1314
|
} catch (error) {
|
|
1331
1315
|
console.error("[SubscriptionDetails] Failed to resume subscription:", error);
|
|
@@ -1335,7 +1319,7 @@ function SubscriptionDetails({
|
|
|
1335
1319
|
}, "handleResume");
|
|
1336
1320
|
const handleManageViaPortal = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1337
1321
|
try {
|
|
1338
|
-
const { url } = await
|
|
1322
|
+
const { url } = await _chunk53B6NPGAjs.StripeCustomerService.createPortalSession();
|
|
1339
1323
|
window.open(url, "_blank");
|
|
1340
1324
|
} catch (error) {
|
|
1341
1325
|
console.error("[SubscriptionDetails] Failed to create portal session:", error);
|
|
@@ -1345,10 +1329,10 @@ function SubscriptionDetails({
|
|
|
1345
1329
|
const canResume = subscription.status === "paused" /* PAUSED */;
|
|
1346
1330
|
const canCancel = subscription.status === "active" /* ACTIVE */ || subscription.status === "trialing" /* TRIALING */ || subscription.status === "paused" /* PAUSED */;
|
|
1347
1331
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1348
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1349
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1350
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1351
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1332
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.DialogContent, { className: "max-w-2xl", children: [
|
|
1333
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.DialogHeader, { children: [
|
|
1334
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.DialogTitle, { children: "Subscription Details" }),
|
|
1335
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.DialogDescription, { children: "View and manage your subscription" })
|
|
1352
1336
|
] }),
|
|
1353
1337
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
1354
1338
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
@@ -1390,11 +1374,11 @@ function SubscriptionDetails({
|
|
|
1390
1374
|
"."
|
|
1391
1375
|
] }) }),
|
|
1392
1376
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2 pt-4 border-t", children: [
|
|
1393
|
-
onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1394
|
-
canPause && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1395
|
-
canResume && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1396
|
-
canCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1397
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1377
|
+
onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Button, { variant: "default", onClick: () => onChangePlan(subscription), children: "Change Plan" }),
|
|
1378
|
+
canPause && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Button, { variant: "outline", onClick: handlePause, disabled: isProcessing, children: isProcessing ? "Pausing..." : "Pause" }),
|
|
1379
|
+
canResume && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Button, { variant: "outline", onClick: handleResume, disabled: isProcessing, children: isProcessing ? "Resuming..." : "Resume" }),
|
|
1380
|
+
canCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Button, { variant: "destructive", onClick: () => setShowCancel(true), children: "Cancel" }),
|
|
1381
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Button, { variant: "outline", onClick: handleManageViaPortal, children: "Manage via Portal" })
|
|
1398
1382
|
] })
|
|
1399
1383
|
] })
|
|
1400
1384
|
] }) }),
|
|
@@ -1441,36 +1425,36 @@ function SubscriptionsList({ subscriptions, onSubscriptionsChange, onChangePlan
|
|
|
1441
1425
|
setSelectedSub(subscription);
|
|
1442
1426
|
}, "handleRowClick");
|
|
1443
1427
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1444
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1445
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1446
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1447
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1448
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1449
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1450
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1428
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.Table, { children: [
|
|
1429
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.TableRow, { children: [
|
|
1430
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.TableHead, { children: "Status" }),
|
|
1431
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.TableHead, { children: "Plan" }),
|
|
1432
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.TableHead, { children: "Period" }),
|
|
1433
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.TableHead, { className: "text-right", children: "Amount" }),
|
|
1434
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.TableHead, { className: "text-right", children: "Actions" })
|
|
1451
1435
|
] }) }),
|
|
1452
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1436
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.TableBody, { children: subscriptions.map((subscription) => {
|
|
1453
1437
|
const price = subscription.price;
|
|
1454
|
-
const amount = _optionalChain([price, 'optionalAccess', _42 => _42.unitAmount]) ? formatCurrency(price.unitAmount, price.currency) : "0";
|
|
1438
|
+
const amount = _optionalChain([price, 'optionalAccess', _42 => _42.unitAmount]) ? _chunk5GVBUTS4js.formatCurrency.call(void 0, price.unitAmount, price.currency) : "0";
|
|
1455
1439
|
const period = `${formatDate3(subscription.currentPeriodStart)} - ${formatDate3(subscription.currentPeriodEnd)}`;
|
|
1456
1440
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1457
|
-
|
|
1441
|
+
_chunk5GVBUTS4js.TableRow,
|
|
1458
1442
|
{
|
|
1459
1443
|
onClick: () => handleRowClick(subscription),
|
|
1460
1444
|
className: "cursor-pointer hover:bg-muted/50",
|
|
1461
1445
|
children: [
|
|
1462
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1446
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1463
1447
|
SubscriptionStatusBadge,
|
|
1464
1448
|
{
|
|
1465
1449
|
status: subscription.status,
|
|
1466
1450
|
cancelAtPeriodEnd: subscription.cancelAtPeriodEnd
|
|
1467
1451
|
}
|
|
1468
1452
|
) }),
|
|
1469
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1470
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1471
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1472
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1473
|
-
|
|
1453
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.TableCell, { className: "font-medium", children: formatPlanName3(price) }),
|
|
1454
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.TableCell, { className: "text-muted-foreground text-sm", children: period }),
|
|
1455
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.TableCell, { className: "text-right font-medium", children: amount }),
|
|
1456
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.TableCell, { className: "text-right", children: (subscription.status === "active" /* ACTIVE */ || subscription.status === "trialing" /* TRIALING */) && onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1457
|
+
_chunk5GVBUTS4js.Button,
|
|
1474
1458
|
{
|
|
1475
1459
|
size: "sm",
|
|
1476
1460
|
variant: "outline",
|
|
@@ -1515,7 +1499,7 @@ function SubscriptionsContainer({ onOpenWizard, hasActiveRecurringSubscription }
|
|
|
1515
1499
|
const loadSubscriptions = _react.useCallback.call(void 0, async () => {
|
|
1516
1500
|
setLoading(true);
|
|
1517
1501
|
try {
|
|
1518
|
-
const fetchedSubscriptions = await
|
|
1502
|
+
const fetchedSubscriptions = await _chunk53B6NPGAjs.StripeSubscriptionService.listSubscriptions();
|
|
1519
1503
|
setSubscriptions(fetchedSubscriptions);
|
|
1520
1504
|
} catch (error) {
|
|
1521
1505
|
console.error("[SubscriptionsContainer] Failed to load subscriptions:", error);
|
|
@@ -1538,7 +1522,7 @@ function SubscriptionsContainer({ onOpenWizard, hasActiveRecurringSubscription }
|
|
|
1538
1522
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8" }),
|
|
1539
1523
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: "Subscriptions" })
|
|
1540
1524
|
] }),
|
|
1541
|
-
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1525
|
+
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _43 => _43()]), children: hasActiveRecurringSubscription ? "Purchase Add-ons" : "Subscribe to a Plan" })
|
|
1542
1526
|
] }),
|
|
1543
1527
|
criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BillingAlertBanner, { subscription }, subscription.id)),
|
|
1544
1528
|
subscriptions.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col items-center justify-center py-12 space-y-4", children: [
|
|
@@ -1546,7 +1530,7 @@ function SubscriptionsContainer({ onOpenWizard, hasActiveRecurringSubscription }
|
|
|
1546
1530
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
1547
1531
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium mb-2", children: "No Active Subscriptions" }),
|
|
1548
1532
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground mb-6", children: "Choose a subscription plan to get started with our services." }),
|
|
1549
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1533
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _44 => _44()]), children: "Subscribe to a Plan" })
|
|
1550
1534
|
] })
|
|
1551
1535
|
] }),
|
|
1552
1536
|
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -1567,9 +1551,9 @@ function IntervalToggle({ value, onChange, hasMonthly, hasYearly }) {
|
|
|
1567
1551
|
if (!hasMonthly || !hasYearly) {
|
|
1568
1552
|
return null;
|
|
1569
1553
|
}
|
|
1570
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1571
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1572
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1554
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Tabs, { value, onValueChange: (v) => onChange(v), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.TabsList, { children: [
|
|
1555
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.TabsTrigger, { value: "month", children: "Monthly" }),
|
|
1556
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.TabsTrigger, { value: "year", children: "Yearly" })
|
|
1573
1557
|
] }) });
|
|
1574
1558
|
}
|
|
1575
1559
|
_chunk7QVYU63Ejs.__name.call(void 0, IntervalToggle, "IntervalToggle");
|
|
@@ -1587,8 +1571,8 @@ function PricingCard({
|
|
|
1587
1571
|
}) {
|
|
1588
1572
|
const description = price.description || price.nickname || "Standard";
|
|
1589
1573
|
const features = price.features || [];
|
|
1590
|
-
const formattedPrice = formatCurrency(price.unitAmount, price.currency);
|
|
1591
|
-
const interval = formatInterval(price);
|
|
1574
|
+
const formattedPrice = _chunk5GVBUTS4js.formatCurrency.call(void 0, price.unitAmount, price.currency);
|
|
1575
|
+
const interval = _chunk5GVBUTS4js.formatInterval.call(void 0, price);
|
|
1592
1576
|
const handleKeyDown = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (e) => {
|
|
1593
1577
|
if ((e.key === "Enter" || e.key === " ") && !isDisabled && !isCurrentPlan) {
|
|
1594
1578
|
e.preventDefault();
|
|
@@ -1601,7 +1585,7 @@ function PricingCard({
|
|
|
1601
1585
|
}
|
|
1602
1586
|
}, "handleClick");
|
|
1603
1587
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1604
|
-
|
|
1588
|
+
_chunk5GVBUTS4js.Card,
|
|
1605
1589
|
{
|
|
1606
1590
|
role: "radio",
|
|
1607
1591
|
"aria-checked": isSelected,
|
|
@@ -1609,7 +1593,7 @@ function PricingCard({
|
|
|
1609
1593
|
tabIndex: isDisabled ? -1 : 0,
|
|
1610
1594
|
onKeyDown: handleKeyDown,
|
|
1611
1595
|
onClick: handleClick,
|
|
1612
|
-
className:
|
|
1596
|
+
className: _chunk53B6NPGAjs.cn.call(void 0,
|
|
1613
1597
|
"relative cursor-pointer transition-all duration-200 flex flex-col h-full",
|
|
1614
1598
|
"focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
1615
1599
|
isCurrentPlan && "bg-muted/30",
|
|
@@ -1619,9 +1603,9 @@ function PricingCard({
|
|
|
1619
1603
|
isLoading && "pointer-events-none"
|
|
1620
1604
|
),
|
|
1621
1605
|
children: [
|
|
1622
|
-
isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1623
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1624
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1606
|
+
isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Badge, { variant: "secondary", className: "absolute top-2 right-2", children: "Current" }),
|
|
1607
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.CardHeader, { className: "pb-2", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium", children: description }) }),
|
|
1608
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.CardContent, { className: "pb-4 grow", children: [
|
|
1625
1609
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mb-4", children: [
|
|
1626
1610
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-3xl font-bold", children: formattedPrice }),
|
|
1627
1611
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground ml-1", children: interval })
|
|
@@ -1631,8 +1615,8 @@ function PricingCard({
|
|
|
1631
1615
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-muted-foreground", children: feature })
|
|
1632
1616
|
] }, index)) })
|
|
1633
1617
|
] }),
|
|
1634
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1635
|
-
|
|
1618
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.CardFooter, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1619
|
+
_chunk5GVBUTS4js.Button,
|
|
1636
1620
|
{
|
|
1637
1621
|
variant: isCurrentPlan ? "secondary" : isSelected ? "default" : "outline",
|
|
1638
1622
|
className: "w-full",
|
|
@@ -1660,7 +1644,7 @@ function ProductPricingRow({
|
|
|
1660
1644
|
return null;
|
|
1661
1645
|
}
|
|
1662
1646
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-3", children: [
|
|
1663
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1647
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.SectionHeader, { children: product.name }),
|
|
1664
1648
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1665
1649
|
"div",
|
|
1666
1650
|
{
|
|
@@ -1760,15 +1744,15 @@ function ProductPricingList({
|
|
|
1760
1744
|
_chunk7QVYU63Ejs.__name.call(void 0, ProductPricingList, "ProductPricingList");
|
|
1761
1745
|
function ProductPricingListSkeleton() {
|
|
1762
1746
|
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: [
|
|
1763
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1747
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Skeleton, { className: "h-6 w-32" }),
|
|
1764
1748
|
/* @__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: [
|
|
1765
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1766
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1749
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Skeleton, { className: "h-6 w-24" }),
|
|
1750
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Skeleton, { className: "h-8 w-32" }),
|
|
1767
1751
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
1768
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1769
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1752
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Skeleton, { className: "h-4 w-full" }),
|
|
1753
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Skeleton, { className: "h-4 w-3/4" })
|
|
1770
1754
|
] }),
|
|
1771
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1755
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Skeleton, { className: "h-10 w-full" })
|
|
1772
1756
|
] }, cardIndex)) })
|
|
1773
1757
|
] }, rowIndex)) });
|
|
1774
1758
|
}
|
|
@@ -1782,18 +1766,18 @@ function ProrationPreview({ preview }) {
|
|
|
1782
1766
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
1783
1767
|
preview.lineItems.map((item, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between text-sm", children: [
|
|
1784
1768
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground", children: item.description }),
|
|
1785
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `font-medium ${item.amount < 0 ? "text-success" : "text-foreground"}`, children: formatCurrency(item.amount, preview.currency) })
|
|
1769
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `font-medium ${item.amount < 0 ? "text-success" : "text-foreground"}`, children: _chunk5GVBUTS4js.formatCurrency.call(void 0, item.amount, preview.currency) })
|
|
1786
1770
|
] }, index)),
|
|
1787
1771
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border-primary/30 mt-2 border-t pt-2", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between font-semibold", children: [
|
|
1788
1772
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-foreground", children: "Net Due Today" }),
|
|
1789
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-foreground", children: formatCurrency(preview.immediateCharge, preview.currency) })
|
|
1773
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-foreground", children: _chunk5GVBUTS4js.formatCurrency.call(void 0, preview.immediateCharge, preview.currency) })
|
|
1790
1774
|
] }) }),
|
|
1791
1775
|
preview.lineItems.length > 0 && preview.lineItems[0].period && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-muted-foreground mt-2 text-xs", children: [
|
|
1792
1776
|
"Next invoice on ",
|
|
1793
1777
|
formatDate3(preview.lineItems[0].period.end),
|
|
1794
1778
|
" for",
|
|
1795
1779
|
" ",
|
|
1796
|
-
formatCurrency(preview.amountDue, preview.currency)
|
|
1780
|
+
_chunk5GVBUTS4js.formatCurrency.call(void 0, preview.amountDue, preview.currency)
|
|
1797
1781
|
] })
|
|
1798
1782
|
] })
|
|
1799
1783
|
] });
|
|
@@ -1815,16 +1799,16 @@ function SubscriptionConfirmation({ price, isLoading, onConfirm, onCancel }) {
|
|
|
1815
1799
|
productDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-sm text-muted-foreground", children: productDescription })
|
|
1816
1800
|
] }),
|
|
1817
1801
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-lg font-semibold", children: [
|
|
1818
|
-
formatCurrency(price.unitAmount, price.currency),
|
|
1819
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-normal text-muted-foreground", children: formatInterval(price) })
|
|
1802
|
+
_chunk5GVBUTS4js.formatCurrency.call(void 0, price.unitAmount, price.currency),
|
|
1803
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-normal text-muted-foreground", children: _chunk5GVBUTS4js.formatInterval.call(void 0, price) })
|
|
1820
1804
|
] }),
|
|
1821
1805
|
features.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "space-y-1", children: features.map((feature, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2 text-sm ", children: [
|
|
1822
1806
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Check, { className: "h-4 w-4 text-primary" }),
|
|
1823
1807
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: feature })
|
|
1824
1808
|
] }, index)) }),
|
|
1825
1809
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-3 pt-2 border-t border-accent/30", children: [
|
|
1826
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1827
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1810
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Button, { variant: "outline", onClick: onCancel, disabled: isLoading, children: "Cancel" }),
|
|
1811
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Button, { onClick: onConfirm, disabled: isLoading, children: isLoading ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1828
1812
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "h-4 w-4 animate-spin mr-2" }),
|
|
1829
1813
|
"Processing..."
|
|
1830
1814
|
] }) : "Subscribe" })
|
|
@@ -1895,7 +1879,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
1895
1879
|
onCloseRef.current = onClose;
|
|
1896
1880
|
const checkPaymentMethod = _react.useCallback.call(void 0, async () => {
|
|
1897
1881
|
try {
|
|
1898
|
-
const methods = await
|
|
1882
|
+
const methods = await _chunk53B6NPGAjs.StripeCustomerService.listPaymentMethods();
|
|
1899
1883
|
dispatch({ type: "SET_HAS_PAYMENT_METHOD", hasMethod: methods.length > 0 });
|
|
1900
1884
|
} catch (error) {
|
|
1901
1885
|
console.error("[useSubscriptionWizard] Failed to check payment methods:", error);
|
|
@@ -1919,7 +1903,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
1919
1903
|
const isTrialUpgrade = _optionalChain([subscription, 'optionalAccess', _55 => _55.status]) === "trialing" /* TRIALING */;
|
|
1920
1904
|
dispatch({ type: "SET_IS_TRIAL_SUBSCRIPTION", isTrial: isTrialUpgrade });
|
|
1921
1905
|
if (isTrialUpgrade && !state.hasPaymentMethod) {
|
|
1922
|
-
const methods = await
|
|
1906
|
+
const methods = await _chunk53B6NPGAjs.StripeCustomerService.listPaymentMethods();
|
|
1923
1907
|
if (methods.length === 0) {
|
|
1924
1908
|
dispatch({ type: "SET_STEP", step: "payment-method" });
|
|
1925
1909
|
dispatch({
|
|
@@ -1930,7 +1914,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
1930
1914
|
}
|
|
1931
1915
|
}
|
|
1932
1916
|
if (subscription && state.selectedPrice.id !== _optionalChain([subscription, 'access', _56 => _56.price, 'optionalAccess', _57 => _57.id])) {
|
|
1933
|
-
const preview = await
|
|
1917
|
+
const preview = await _chunk53B6NPGAjs.StripeSubscriptionService.getProrationPreview({
|
|
1934
1918
|
subscriptionId: subscription.id,
|
|
1935
1919
|
newPriceId: state.selectedPrice.id
|
|
1936
1920
|
});
|
|
@@ -1955,14 +1939,14 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
1955
1939
|
newPriceId: state.selectedPrice.id,
|
|
1956
1940
|
promotionCode: _optionalChain([state, 'access', _59 => _59.promotionCode, 'optionalAccess', _60 => _60.promotionCodeId])
|
|
1957
1941
|
};
|
|
1958
|
-
await
|
|
1942
|
+
await _chunk53B6NPGAjs.StripeSubscriptionService.changePlan(changePlanParams);
|
|
1959
1943
|
} else {
|
|
1960
1944
|
const createParams = {
|
|
1961
1945
|
id: _uuid.v4.call(void 0, ),
|
|
1962
1946
|
priceId: state.selectedPrice.id,
|
|
1963
1947
|
promotionCode: _optionalChain([state, 'access', _61 => _61.promotionCode, 'optionalAccess', _62 => _62.promotionCodeId])
|
|
1964
1948
|
};
|
|
1965
|
-
await
|
|
1949
|
+
await _chunk53B6NPGAjs.StripeSubscriptionService.createSubscription(createParams);
|
|
1966
1950
|
}
|
|
1967
1951
|
onSuccessRef.current();
|
|
1968
1952
|
onCloseRef.current();
|
|
@@ -1996,7 +1980,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
1996
1980
|
dispatch({ type: "SET_VALIDATING_PROMO_CODE", isValidating: true });
|
|
1997
1981
|
dispatch({ type: "SET_PROMO_CODE_ERROR", error: null });
|
|
1998
1982
|
try {
|
|
1999
|
-
const result = await
|
|
1983
|
+
const result = await _chunk53B6NPGAjs.StripePromotionCodeService.validatePromotionCode({
|
|
2000
1984
|
code,
|
|
2001
1985
|
stripePriceId: _optionalChain([state, 'access', _70 => _70.selectedPrice, 'optionalAccess', _71 => _71.id])
|
|
2002
1986
|
});
|
|
@@ -2103,7 +2087,7 @@ function WizardStepPlanSelection({
|
|
|
2103
2087
|
_react.useEffect.call(void 0, () => {
|
|
2104
2088
|
const loadProducts = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2105
2089
|
try {
|
|
2106
|
-
const fetchedProducts = await
|
|
2090
|
+
const fetchedProducts = await _chunk53B6NPGAjs.StripeProductService.listProducts({ active: true });
|
|
2107
2091
|
setProducts(fetchedProducts);
|
|
2108
2092
|
} catch (error) {
|
|
2109
2093
|
console.error("[WizardStepPlanSelection] Failed to load products:", error);
|
|
@@ -2154,7 +2138,7 @@ function WizardStepPlanSelection({
|
|
|
2154
2138
|
onSelectPrice: handleSelectPrice
|
|
2155
2139
|
}
|
|
2156
2140
|
),
|
|
2157
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex justify-end pt-4 border-t", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2141
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex justify-end pt-4 border-t", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Button, { onClick: onNext, disabled: !selectedPrice || isProcessing, children: isProcessing ? "Loading..." : "Next: Review" }) })
|
|
2158
2142
|
] });
|
|
2159
2143
|
}
|
|
2160
2144
|
_chunk7QVYU63Ejs.__name.call(void 0, WizardStepPlanSelection, "WizardStepPlanSelection");
|
|
@@ -2215,7 +2199,7 @@ function PromoCodeInput({
|
|
|
2215
2199
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success text-sm", children: formatDiscount(appliedCode) })
|
|
2216
2200
|
] }),
|
|
2217
2201
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2218
|
-
|
|
2202
|
+
_chunk5GVBUTS4js.Button,
|
|
2219
2203
|
{
|
|
2220
2204
|
variant: "ghost",
|
|
2221
2205
|
size: "sm",
|
|
@@ -2232,7 +2216,7 @@ function PromoCodeInput({
|
|
|
2232
2216
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
2233
2217
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
|
|
2234
2218
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2235
|
-
|
|
2219
|
+
_chunk5GVBUTS4js.Input,
|
|
2236
2220
|
{
|
|
2237
2221
|
placeholder: "Enter promo code",
|
|
2238
2222
|
value: code,
|
|
@@ -2242,7 +2226,7 @@ function PromoCodeInput({
|
|
|
2242
2226
|
className: "flex-1"
|
|
2243
2227
|
}
|
|
2244
2228
|
),
|
|
2245
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2229
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.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" })
|
|
2246
2230
|
] }),
|
|
2247
2231
|
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error })
|
|
2248
2232
|
] });
|
|
@@ -2307,14 +2291,14 @@ function WizardStepReview({
|
|
|
2307
2291
|
return `${promotionCode.discountValue}% off`;
|
|
2308
2292
|
}
|
|
2309
2293
|
if (promotionCode.discountType === "amount_off" && promotionCode.discountValue) {
|
|
2310
|
-
return `${formatCurrency(promotionCode.discountValue, promotionCode.currency || selectedPrice.currency)} off`;
|
|
2294
|
+
return `${_chunk5GVBUTS4js.formatCurrency.call(void 0, promotionCode.discountValue, promotionCode.currency || selectedPrice.currency)} off`;
|
|
2311
2295
|
}
|
|
2312
2296
|
return null;
|
|
2313
2297
|
}, "getDiscountDescription");
|
|
2314
2298
|
const discountDescription = getDiscountDescription();
|
|
2315
2299
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
2316
2300
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-muted/50 rounded-lg p-4 space-y-3", children: [
|
|
2317
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2301
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.SectionHeader, { children: "Selected Plan" }),
|
|
2318
2302
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between items-center", children: [
|
|
2319
2303
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
2320
2304
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-medium", children: _optionalChain([selectedPrice, 'access', _92 => _92.product, 'optionalAccess', _93 => _93.name]) }),
|
|
@@ -2322,10 +2306,10 @@ function WizardStepReview({
|
|
|
2322
2306
|
] }),
|
|
2323
2307
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-right", children: [
|
|
2324
2308
|
discountedPrice !== null ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2325
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground line-through", children: formatCurrency(selectedPrice.unitAmount || 0, selectedPrice.currency) }),
|
|
2326
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-success text-lg font-semibold", children: formatCurrency(discountedPrice, selectedPrice.currency) }),
|
|
2327
|
-
discountDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2328
|
-
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-semibold text-lg", children: formatCurrency(selectedPrice.unitAmount || 0, selectedPrice.currency) }),
|
|
2309
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground line-through", children: _chunk5GVBUTS4js.formatCurrency.call(void 0, selectedPrice.unitAmount || 0, selectedPrice.currency) }),
|
|
2310
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-success text-lg font-semibold", children: _chunk5GVBUTS4js.formatCurrency.call(void 0, discountedPrice, selectedPrice.currency) }),
|
|
2311
|
+
discountDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Badge, { variant: "softGreen", children: discountDescription })
|
|
2312
|
+
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-semibold text-lg", children: _chunk5GVBUTS4js.formatCurrency.call(void 0, selectedPrice.unitAmount || 0, selectedPrice.currency) }),
|
|
2329
2313
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: formatInterval2(selectedPrice) })
|
|
2330
2314
|
] })
|
|
2331
2315
|
] })
|
|
@@ -2340,9 +2324,9 @@ function WizardStepReview({
|
|
|
2340
2324
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between text-sm", children: [
|
|
2341
2325
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `${isTrialUpgrade ? "text-warning" : "text-muted-foreground"}`, children: isTrialUpgrade ? "Amount to charge now:" : "Amount due now:" }),
|
|
2342
2326
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `font-medium ${isTrialUpgrade ? "text-warning" : "text-foreground"}`, children: discountedImmediateCharge !== null ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2343
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "line-through text-muted-foreground mr-2", children: formatCurrency(prorationPreview.immediateCharge, prorationPreview.currency) }),
|
|
2344
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success", children: formatCurrency(discountedImmediateCharge, prorationPreview.currency) })
|
|
2345
|
-
] }) : formatCurrency(prorationPreview.immediateCharge, prorationPreview.currency) })
|
|
2327
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "line-through text-muted-foreground mr-2", children: _chunk5GVBUTS4js.formatCurrency.call(void 0, prorationPreview.immediateCharge, prorationPreview.currency) }),
|
|
2328
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success", children: _chunk5GVBUTS4js.formatCurrency.call(void 0, discountedImmediateCharge, prorationPreview.currency) })
|
|
2329
|
+
] }) : _chunk5GVBUTS4js.formatCurrency.call(void 0, prorationPreview.immediateCharge, prorationPreview.currency) })
|
|
2346
2330
|
] })
|
|
2347
2331
|
]
|
|
2348
2332
|
}
|
|
@@ -2366,15 +2350,15 @@ function WizardStepReview({
|
|
|
2366
2350
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "font-medium", children: "Payment Method" }),
|
|
2367
2351
|
/* @__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" })
|
|
2368
2352
|
] }),
|
|
2369
|
-
!hasPaymentMethod && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2353
|
+
!hasPaymentMethod && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Button, { variant: "outline", onClick: onAddPaymentMethod, children: "Add Payment Method" })
|
|
2370
2354
|
] }) }),
|
|
2371
|
-
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2355
|
+
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.Alert, { variant: "destructive", children: [
|
|
2372
2356
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.AlertCircle, { className: "h-4 w-4" }),
|
|
2373
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2357
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.AlertDescription, { children: error })
|
|
2374
2358
|
] }),
|
|
2375
2359
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between pt-4 border-t", children: [
|
|
2376
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2377
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2360
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Button, { variant: "outline", onClick: onBack, disabled: isProcessing, children: "Back" }),
|
|
2361
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Button, { onClick: hasPaymentMethod ? onConfirm : onAddPaymentMethod, disabled: isProcessing, children: isProcessing ? "Processing..." : hasPaymentMethod ? isChangingPlan ? "Confirm Plan Change" : "Subscribe Now" : "Add Payment Method" })
|
|
2378
2362
|
] })
|
|
2379
2363
|
] });
|
|
2380
2364
|
}
|
|
@@ -2385,7 +2369,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, WizardStepReview, "WizardStepReview");
|
|
|
2385
2369
|
function WizardStepPaymentMethod({ onBack, onSuccess, isProcessing }) {
|
|
2386
2370
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
2387
2371
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
2388
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2372
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.SectionHeader, { children: "Add Payment Method" }),
|
|
2389
2373
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: "Enter your card details to complete your subscription" })
|
|
2390
2374
|
] }),
|
|
2391
2375
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodForm, { onSuccess, onCancel: onBack, isLoading: isProcessing })
|
|
@@ -2427,10 +2411,10 @@ function SubscriptionWizard({
|
|
|
2427
2411
|
const isChangePlanMode = !!subscription;
|
|
2428
2412
|
const dialogTitle = subscription ? "Change Subscription Plan" : isPurchasingAddons ? "Purchase Add-ons" : "Subscribe to a Plan";
|
|
2429
2413
|
const dialogDescription = subscription ? "Select a new plan for your subscription" : isPurchasingAddons ? "Select one-time products to purchase" : "Choose a subscription plan to get started";
|
|
2430
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2431
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2432
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2433
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2414
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.DialogContent, { className: "max-w-2xl", children: [
|
|
2415
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.DialogHeader, { children: [
|
|
2416
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.DialogTitle, { children: dialogTitle }),
|
|
2417
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.DialogDescription, { children: dialogDescription })
|
|
2434
2418
|
] }),
|
|
2435
2419
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, WizardProgressIndicator, { currentStep: state.step }),
|
|
2436
2420
|
state.step === "plan-selection" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -2513,15 +2497,15 @@ function UsageSummaryCard({ meter, summary }) {
|
|
|
2513
2497
|
const progressWidth = percentage !== null ? Math.min(percentage, 100) : 0;
|
|
2514
2498
|
const displayName = meter.displayName || meter.eventName;
|
|
2515
2499
|
const hasLimit = limit !== null && limit !== void 0;
|
|
2516
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2517
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2500
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.Card, { children: [
|
|
2501
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.CardHeader, { className: "flex flex-row items-center gap-x-3 pb-3", children: [
|
|
2518
2502
|
/* @__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" }) }),
|
|
2519
2503
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col", children: [
|
|
2520
2504
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium", children: displayName }),
|
|
2521
2505
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-xs", children: meter.id })
|
|
2522
2506
|
] })
|
|
2523
2507
|
] }),
|
|
2524
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2508
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.CardContent, { className: "flex flex-col gap-y-4", children: [
|
|
2525
2509
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
2526
2510
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-3xl font-bold", children: currentUsage.toLocaleString() }),
|
|
2527
2511
|
hasLimit && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-muted-foreground text-sm", children: [
|
|
@@ -2568,14 +2552,14 @@ function UsageContainer() {
|
|
|
2568
2552
|
const loadUsageData = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2569
2553
|
setLoading(true);
|
|
2570
2554
|
try {
|
|
2571
|
-
const fetchedSubscriptions = await
|
|
2555
|
+
const fetchedSubscriptions = await _chunk53B6NPGAjs.StripeSubscriptionService.listSubscriptions();
|
|
2572
2556
|
setSubscriptions(fetchedSubscriptions);
|
|
2573
2557
|
const hasMeteredSubscriptions2 = fetchedSubscriptions.some((sub) => _optionalChain([sub, 'access', _99 => _99.price, 'optionalAccess', _100 => _100.recurring, 'optionalAccess', _101 => _101.usageType]) === "metered");
|
|
2574
2558
|
if (!hasMeteredSubscriptions2) {
|
|
2575
2559
|
setLoading(false);
|
|
2576
2560
|
return;
|
|
2577
2561
|
}
|
|
2578
|
-
const fetchedMeters = await
|
|
2562
|
+
const fetchedMeters = await _chunk53B6NPGAjs.StripeUsageService.listMeters();
|
|
2579
2563
|
setMeters(fetchedMeters);
|
|
2580
2564
|
const summariesMap = {};
|
|
2581
2565
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -2583,7 +2567,7 @@ function UsageContainer() {
|
|
|
2583
2567
|
const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
|
|
2584
2568
|
for (const meter of fetchedMeters) {
|
|
2585
2569
|
try {
|
|
2586
|
-
const meterSummaries = await
|
|
2570
|
+
const meterSummaries = await _chunk53B6NPGAjs.StripeUsageService.getMeterSummaries({
|
|
2587
2571
|
meterId: meter.id,
|
|
2588
2572
|
startTime: startOfMonth,
|
|
2589
2573
|
endTime: endOfMonth
|
|
@@ -2648,22 +2632,22 @@ function UsageHistoryTable({ usageRecords }) {
|
|
|
2648
2632
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rounded-lg border p-8 text-center", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground", children: "No usage history available." }) });
|
|
2649
2633
|
}
|
|
2650
2634
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
2651
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2652
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-clip rounded-lg border", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2653
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2654
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2655
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2656
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2657
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2635
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.SectionHeader, { level: 2, children: "Usage History" }),
|
|
2636
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-clip rounded-lg border", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.Table, { children: [
|
|
2637
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.TableRow, { children: [
|
|
2638
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.TableHead, { children: "Date & Time" }),
|
|
2639
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.TableHead, { children: "Meter Event" }),
|
|
2640
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.TableHead, { className: "text-right", children: "Quantity" }),
|
|
2641
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.TableHead, { children: "Event ID" })
|
|
2658
2642
|
] }) }),
|
|
2659
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2643
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.TableBody, { children: usageRecords.map((record) => {
|
|
2660
2644
|
const dateTime = formatDateTime(record.timestamp);
|
|
2661
2645
|
const quantity = record.quantity.toLocaleString();
|
|
2662
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2663
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2664
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2665
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2666
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2646
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.TableRow, { children: [
|
|
2647
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.TableCell, { className: "font-medium", children: dateTime }),
|
|
2648
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.TableCell, { className: "text-muted-foreground", children: record.meterEventName }),
|
|
2649
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.TableCell, { className: "text-right font-medium", children: quantity }),
|
|
2650
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.TableCell, { className: "text-muted-foreground text-sm tabular-nums", children: record.stripeEventId })
|
|
2667
2651
|
] }, record.id);
|
|
2668
2652
|
}) })
|
|
2669
2653
|
] }) })
|
|
@@ -2674,8 +2658,8 @@ _chunk7QVYU63Ejs.__name.call(void 0, UsageHistoryTable, "UsageHistoryTable");
|
|
|
2674
2658
|
// src/features/billing/components/modals/BillingDetailModal.tsx
|
|
2675
2659
|
|
|
2676
2660
|
function BillingDetailModal({ open, onOpenChange, title, children, className }) {
|
|
2677
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2678
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2661
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.DialogContent, { className: _nullishCoalesce(className, () => ( "max-w-4xl max-h-[90vh] overflow-y-auto")), children: [
|
|
2662
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.DialogHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.DialogTitle, { children: title }) }),
|
|
2679
2663
|
children
|
|
2680
2664
|
] }) });
|
|
2681
2665
|
}
|
|
@@ -2692,7 +2676,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
|
|
|
2692
2676
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-destructive text-sm font-medium", children: "Payment Failed" }),
|
|
2693
2677
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive mt-1 text-sm", children: "Your last payment failed. Please update your payment method to avoid service interruption." })
|
|
2694
2678
|
] }),
|
|
2695
|
-
onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2679
|
+
onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Button, { variant: "outline", size: "sm", onClick: onUpdatePayment, className: "text-destructive border-red-300", children: "Update Payment Method" })
|
|
2696
2680
|
] });
|
|
2697
2681
|
}
|
|
2698
2682
|
if (subscription.status === "trialing" /* TRIALING */ && subscription.trialEnd) {
|
|
@@ -2712,7 +2696,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
|
|
|
2712
2696
|
". Add a payment method to continue your subscription."
|
|
2713
2697
|
] })
|
|
2714
2698
|
] }),
|
|
2715
|
-
onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2699
|
+
onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Button, { variant: "outline", size: "sm", onClick: onAddPayment, className: "text-warning border-yellow-300", children: "Add Payment Method" })
|
|
2716
2700
|
] });
|
|
2717
2701
|
}
|
|
2718
2702
|
}
|
|
@@ -2763,7 +2747,7 @@ function BillingDashboardContainer() {
|
|
|
2763
2747
|
setNoCustomerExists(false);
|
|
2764
2748
|
let customer = null;
|
|
2765
2749
|
try {
|
|
2766
|
-
customer = await
|
|
2750
|
+
customer = await _chunk53B6NPGAjs.StripeCustomerService.getCustomer();
|
|
2767
2751
|
setData((prev) => ({ ...prev, customer }));
|
|
2768
2752
|
setErrors((prev) => ({ ...prev, customer: null }));
|
|
2769
2753
|
setNoCustomerExists(false);
|
|
@@ -2789,7 +2773,7 @@ function BillingDashboardContainer() {
|
|
|
2789
2773
|
}
|
|
2790
2774
|
const fetchSubscriptions = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2791
2775
|
try {
|
|
2792
|
-
const subscriptions2 = await
|
|
2776
|
+
const subscriptions2 = await _chunk53B6NPGAjs.StripeSubscriptionService.listSubscriptions();
|
|
2793
2777
|
setData((prev) => ({ ...prev, subscriptions: subscriptions2 }));
|
|
2794
2778
|
setErrors((prev) => ({ ...prev, subscriptions: null }));
|
|
2795
2779
|
return subscriptions2;
|
|
@@ -2803,7 +2787,7 @@ function BillingDashboardContainer() {
|
|
|
2803
2787
|
}, "fetchSubscriptions");
|
|
2804
2788
|
const fetchPaymentMethods = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2805
2789
|
try {
|
|
2806
|
-
const paymentMethods = await
|
|
2790
|
+
const paymentMethods = await _chunk53B6NPGAjs.StripeCustomerService.listPaymentMethods();
|
|
2807
2791
|
setData((prev) => ({ ...prev, paymentMethods }));
|
|
2808
2792
|
setErrors((prev) => ({ ...prev, paymentMethods: null }));
|
|
2809
2793
|
} catch (error) {
|
|
@@ -2815,7 +2799,7 @@ function BillingDashboardContainer() {
|
|
|
2815
2799
|
}, "fetchPaymentMethods");
|
|
2816
2800
|
const fetchInvoices = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2817
2801
|
try {
|
|
2818
|
-
const invoices = await
|
|
2802
|
+
const invoices = await _chunk53B6NPGAjs.StripeInvoiceService.listInvoices();
|
|
2819
2803
|
setData((prev) => ({ ...prev, invoices }));
|
|
2820
2804
|
setErrors((prev) => ({ ...prev, invoices: null }));
|
|
2821
2805
|
} catch (error) {
|
|
@@ -2838,7 +2822,7 @@ function BillingDashboardContainer() {
|
|
|
2838
2822
|
const handleCreateCustomer = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2839
2823
|
setCreatingCustomer(true);
|
|
2840
2824
|
try {
|
|
2841
|
-
await
|
|
2825
|
+
await _chunk53B6NPGAjs.StripeCustomerService.createCustomer();
|
|
2842
2826
|
setNoCustomerExists(false);
|
|
2843
2827
|
await fetchAllData();
|
|
2844
2828
|
} catch (error) {
|
|
@@ -2850,7 +2834,7 @@ function BillingDashboardContainer() {
|
|
|
2850
2834
|
}, "handleCreateCustomer");
|
|
2851
2835
|
const fetchUsageData = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2852
2836
|
try {
|
|
2853
|
-
const meters = await
|
|
2837
|
+
const meters = await _chunk53B6NPGAjs.StripeUsageService.listMeters();
|
|
2854
2838
|
setData((prev) => ({ ...prev, meters }));
|
|
2855
2839
|
const summariesMap = {};
|
|
2856
2840
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -2858,7 +2842,7 @@ function BillingDashboardContainer() {
|
|
|
2858
2842
|
const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
|
|
2859
2843
|
for (const meter of meters) {
|
|
2860
2844
|
try {
|
|
2861
|
-
const meterSummaries = await
|
|
2845
|
+
const meterSummaries = await _chunk53B6NPGAjs.StripeUsageService.getMeterSummaries({
|
|
2862
2846
|
meterId: meter.id,
|
|
2863
2847
|
startTime: startOfMonth,
|
|
2864
2848
|
endTime: endOfMonth
|
|
@@ -2936,18 +2920,18 @@ function BillingDashboardContainer() {
|
|
|
2936
2920
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-8 w-8" }),
|
|
2937
2921
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: "Billing" })
|
|
2938
2922
|
] }),
|
|
2939
|
-
isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2940
|
-
noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2941
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2923
|
+
isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.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" }) }) }),
|
|
2924
|
+
noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.Card, { children: [
|
|
2925
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.CardHeader, { className: "text-center", children: [
|
|
2942
2926
|
/* @__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" }) }),
|
|
2943
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2944
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2927
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.CardTitle, { children: "Set Up Billing" }),
|
|
2928
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.CardDescription, { children: "Your company doesn't have a billing account yet. Set one up to manage subscriptions, payment methods, and view invoices." })
|
|
2945
2929
|
] }),
|
|
2946
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2930
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.CardContent, { className: "flex justify-center pb-8", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Button, { onClick: handleCreateCustomer, disabled: creatingCustomer, size: "lg", children: creatingCustomer ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2947
2931
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
2948
2932
|
"Setting up..."
|
|
2949
2933
|
] }) : "Set Up Billing Account" }) }),
|
|
2950
|
-
errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2934
|
+
errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.CardContent, { className: "pt-0", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-center text-destructive text-xs/relaxed", children: errors.customer }) })
|
|
2951
2935
|
] }),
|
|
2952
2936
|
!noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2953
2937
|
criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -3089,7 +3073,7 @@ function getStripePromise(publishableKey) {
|
|
|
3089
3073
|
}
|
|
3090
3074
|
_chunk7QVYU63Ejs.__name.call(void 0, getStripePromise, "getStripePromise");
|
|
3091
3075
|
function StripeProvider({ children }) {
|
|
3092
|
-
const publishableKey =
|
|
3076
|
+
const publishableKey = _chunkJKGEJGSDjs.getStripePublishableKey.call(void 0, );
|
|
3093
3077
|
const stripePromise = _react.useMemo.call(void 0, () => getStripePromise(publishableKey), [publishableKey]);
|
|
3094
3078
|
const options = _react.useMemo.call(void 0, () => ({}), []);
|
|
3095
3079
|
if (!publishableKey) {
|
|
@@ -3099,127 +3083,54 @@ function StripeProvider({ children }) {
|
|
|
3099
3083
|
}
|
|
3100
3084
|
_chunk7QVYU63Ejs.__name.call(void 0, StripeProvider, "StripeProvider");
|
|
3101
3085
|
function isStripeConfigured() {
|
|
3102
|
-
return !!
|
|
3086
|
+
return !!_chunkJKGEJGSDjs.getStripePublishableKey.call(void 0, );
|
|
3103
3087
|
}
|
|
3104
3088
|
_chunk7QVYU63Ejs.__name.call(void 0, isStripeConfigured, "isStripeConfigured");
|
|
3105
3089
|
|
|
3106
|
-
// src/features/billing/contexts/
|
|
3090
|
+
// src/features/billing/contexts/PriceContext.tsx
|
|
3107
3091
|
var _nextintl = require('next-intl');
|
|
3108
3092
|
|
|
3109
3093
|
|
|
3110
|
-
// src/features/billing/stripe-
|
|
3111
|
-
|
|
3112
|
-
|
|
3094
|
+
// src/features/billing/stripe-price/components/forms/PriceArchiver.tsx
|
|
3113
3095
|
|
|
3114
3096
|
|
|
3115
3097
|
|
|
3116
3098
|
|
|
3117
|
-
function
|
|
3118
|
-
const
|
|
3119
|
-
const
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
name: _optionalChain([product, 'optionalAccess', _117 => _117.name]) || "",
|
|
3128
|
-
description: _optionalChain([product, 'optionalAccess', _118 => _118.description]) || "",
|
|
3129
|
-
active: _nullishCoalesce(_optionalChain([product, 'optionalAccess', _119 => _119.active]), () => ( true))
|
|
3130
|
-
}
|
|
3131
|
-
});
|
|
3132
|
-
const onSubmit = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async (values) => {
|
|
3133
|
-
setIsSubmitting(true);
|
|
3134
|
-
try {
|
|
3135
|
-
if (product) {
|
|
3136
|
-
await _chunkRTOC53EZjs.StripeProductService.updateProduct({
|
|
3137
|
-
id: product.id,
|
|
3138
|
-
name: values.name,
|
|
3139
|
-
description: values.description,
|
|
3140
|
-
active: values.active
|
|
3141
|
-
});
|
|
3142
|
-
} else {
|
|
3143
|
-
await _chunkRTOC53EZjs.StripeProductService.createProduct({
|
|
3144
|
-
id: _uuid.v4.call(void 0, ),
|
|
3145
|
-
name: values.name,
|
|
3146
|
-
description: values.description,
|
|
3147
|
-
active: values.active
|
|
3148
|
-
});
|
|
3149
|
-
}
|
|
3150
|
-
onSuccess();
|
|
3151
|
-
onOpenChange(false);
|
|
3152
|
-
} catch (error) {
|
|
3153
|
-
console.error("[ProductEditor] Failed to save product:", error);
|
|
3154
|
-
} finally {
|
|
3155
|
-
setIsSubmitting(false);
|
|
3156
|
-
}
|
|
3157
|
-
}, "onSubmit");
|
|
3158
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.DialogContent, { className: "max-w-2xl", children: [
|
|
3159
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.DialogHeader, { children: [
|
|
3160
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.DialogTitle, { children: product ? "Edit Product" : "Create Product" }),
|
|
3161
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.DialogDescription, { children: product ? `Update the details for ${product.name}` : "Create a new product to offer to your customers" })
|
|
3099
|
+
function PriceArchiver({ price }) {
|
|
3100
|
+
const t = _nextintl.useTranslations.call(void 0, );
|
|
3101
|
+
const { archivePrice, restorePrice } = usePriceContext();
|
|
3102
|
+
const [open, setOpen] = _react.useState.call(void 0, false);
|
|
3103
|
+
const isArchived = !price.active;
|
|
3104
|
+
const scope = isArchived ? "restore" : "archive";
|
|
3105
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
3106
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.Button, { variant: "outline", size: "sm", onClick: () => setOpen(true), children: [
|
|
3107
|
+
isArchived ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RotateCcwIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ArchiveIcon, {}),
|
|
3108
|
+
t(`billing.admin.prices.${scope}.confirm`)
|
|
3162
3109
|
] }),
|
|
3163
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3110
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3111
|
+
_chunk5GVBUTS4js.ConfirmDialog,
|
|
3112
|
+
{
|
|
3113
|
+
open,
|
|
3114
|
+
onOpenChange: setOpen,
|
|
3115
|
+
title: t(`billing.admin.prices.${scope}.title`),
|
|
3116
|
+
description: t(`billing.admin.prices.${scope}.description`, { label: priceLabel(price) }),
|
|
3117
|
+
confirmLabel: t(`billing.admin.prices.${scope}.confirm`),
|
|
3118
|
+
cancelLabel: t("ui.buttons.cancel"),
|
|
3119
|
+
destructive: !isArchived,
|
|
3120
|
+
onConfirm: async () => {
|
|
3121
|
+
try {
|
|
3122
|
+
if (isArchived) await restorePrice(price.id);
|
|
3123
|
+
else await archivePrice(price.id);
|
|
3124
|
+
} catch (error) {
|
|
3125
|
+
_chunk5GVBUTS4js.errorToast.call(void 0, { title: t(`billing.admin.prices.${scope}.title`), error });
|
|
3126
|
+
throw error;
|
|
3127
|
+
}
|
|
3173
3128
|
}
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
] }) })
|
|
3178
|
-
] }) });
|
|
3129
|
+
}
|
|
3130
|
+
)
|
|
3131
|
+
] });
|
|
3179
3132
|
}
|
|
3180
|
-
_chunk7QVYU63Ejs.__name.call(void 0,
|
|
3181
|
-
|
|
3182
|
-
// src/features/billing/contexts/BillingContext.tsx
|
|
3183
|
-
|
|
3184
|
-
var BillingContext = _react.createContext.call(void 0, void 0);
|
|
3185
|
-
var BillingProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ children }) => {
|
|
3186
|
-
const t = _nextintl.useTranslations.call(void 0, );
|
|
3187
|
-
const { hasRole } = _chunk7HKJNUW7js.useCurrentUserContext.call(void 0, );
|
|
3188
|
-
const [showCreateProduct, setShowCreateProduct] = _react.useState.call(void 0, false);
|
|
3189
|
-
const [refreshToken, setRefreshToken] = _react.useState.call(void 0, 0);
|
|
3190
|
-
const refresh = _react.useCallback.call(void 0, () => setRefreshToken((value) => value + 1), []);
|
|
3191
|
-
const breadcrumbs = [{ name: t(`billing.admin.products.title`) }];
|
|
3192
|
-
const title = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
3193
|
-
const response = { type: t(`billing.admin.products.title`) };
|
|
3194
|
-
if (hasRole(_chunkOTEDZ6YWjs.getRoleId.call(void 0, ).Administrator)) {
|
|
3195
|
-
response.functions = [
|
|
3196
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { onClick: () => setShowCreateProduct(true), children: t(`billing.admin.products.create`) }, "productEditorTrigger"),
|
|
3197
|
-
showCreateProduct ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3198
|
-
ProductEditor,
|
|
3199
|
-
{
|
|
3200
|
-
open: showCreateProduct,
|
|
3201
|
-
onOpenChange: setShowCreateProduct,
|
|
3202
|
-
onSuccess: () => {
|
|
3203
|
-
setShowCreateProduct(false);
|
|
3204
|
-
refresh();
|
|
3205
|
-
}
|
|
3206
|
-
},
|
|
3207
|
-
"productEditor"
|
|
3208
|
-
) : null
|
|
3209
|
-
];
|
|
3210
|
-
}
|
|
3211
|
-
return response;
|
|
3212
|
-
}, "title");
|
|
3213
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.SharedProvider, { value: { breadcrumbs, title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BillingContext.Provider, { value: { refreshToken, refresh }, children }) });
|
|
3214
|
-
}, "BillingProvider");
|
|
3215
|
-
var useBillingContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
3216
|
-
const context = _react.useContext.call(void 0, BillingContext);
|
|
3217
|
-
if (context === void 0) {
|
|
3218
|
-
throw new Error("useBillingContext must be used within a BillingProvider");
|
|
3219
|
-
}
|
|
3220
|
-
return context;
|
|
3221
|
-
}, "useBillingContext");
|
|
3222
|
-
var useOptionalBillingContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => _react.useContext.call(void 0, BillingContext), "useOptionalBillingContext");
|
|
3133
|
+
_chunk7QVYU63Ejs.__name.call(void 0, PriceArchiver, "PriceArchiver");
|
|
3223
3134
|
|
|
3224
3135
|
// src/features/billing/stripe-price/components/forms/PriceEditor.tsx
|
|
3225
3136
|
|
|
@@ -3229,764 +3140,1012 @@ var useOptionalBillingContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(voi
|
|
|
3229
3140
|
|
|
3230
3141
|
|
|
3231
3142
|
|
|
3232
|
-
|
|
3233
|
-
|
|
3143
|
+
|
|
3144
|
+
function PriceEditorInternal({
|
|
3145
|
+
productId,
|
|
3146
|
+
price,
|
|
3147
|
+
propagateChanges,
|
|
3148
|
+
onSuccess,
|
|
3149
|
+
trigger,
|
|
3150
|
+
forceShow,
|
|
3151
|
+
onClose,
|
|
3152
|
+
dialogOpen,
|
|
3153
|
+
onDialogOpenChange
|
|
3154
|
+
}) {
|
|
3155
|
+
const t = _nextintl.useTranslations.call(void 0, );
|
|
3156
|
+
const router = _chunkJKGEJGSDjs.useI18nRouter.call(void 0, );
|
|
3157
|
+
const { createPrice, updatePrice, productId: contextProductId } = usePriceContext();
|
|
3234
3158
|
const [allFeatures, setAllFeatures] = _react.useState.call(void 0, []);
|
|
3159
|
+
const isEdit = !!price;
|
|
3160
|
+
const targetProductId = _nullishCoalesce(_nullishCoalesce(productId, () => ( _optionalChain([price, 'optionalAccess', _117 => _117.product, 'optionalAccess', _118 => _118.id]))), () => ( contextProductId));
|
|
3235
3161
|
_react.useEffect.call(void 0, () => {
|
|
3236
3162
|
const fetchFeatures = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3237
|
-
|
|
3238
|
-
const features = await _chunkRTOC53EZjs.FeatureService.findMany({});
|
|
3239
|
-
setAllFeatures(features);
|
|
3240
|
-
} catch (error) {
|
|
3241
|
-
console.error("[PriceEditor] Failed to fetch features:", error);
|
|
3242
|
-
}
|
|
3163
|
+
setAllFeatures(await _chunk53B6NPGAjs.FeatureService.findMany({}));
|
|
3243
3164
|
}, "fetchFeatures");
|
|
3244
|
-
fetchFeatures();
|
|
3165
|
+
void fetchFeatures();
|
|
3245
3166
|
}, []);
|
|
3246
|
-
const formSchema2 =
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
const
|
|
3269
|
-
|
|
3167
|
+
const formSchema2 = _react.useMemo.call(void 0,
|
|
3168
|
+
() => _zod3.z.object({
|
|
3169
|
+
unitAmount: _zod3.z.preprocess(
|
|
3170
|
+
(value) => typeof value === "string" ? parseFloat(value) : value,
|
|
3171
|
+
_zod3.z.number().min(0, { message: t("billing.admin.prices.errors.amount") })
|
|
3172
|
+
),
|
|
3173
|
+
currency: _zod3.z.string().min(1, { message: t("billing.admin.prices.errors.currency") }),
|
|
3174
|
+
interval: _zod3.z.enum(["one_time", "day", "week", "month", "year"]),
|
|
3175
|
+
intervalCount: _zod3.z.preprocess(
|
|
3176
|
+
(value) => value === "" || value === void 0 ? void 0 : typeof value === "string" ? parseInt(value, 10) : value,
|
|
3177
|
+
_zod3.z.number().min(1).optional()
|
|
3178
|
+
),
|
|
3179
|
+
usageType: _zod3.z.enum(["licensed", "metered"]).optional(),
|
|
3180
|
+
nickname: _zod3.z.string().optional(),
|
|
3181
|
+
isTrial: _zod3.z.boolean(),
|
|
3182
|
+
description: _zod3.z.string().optional(),
|
|
3183
|
+
features: _zod3.z.array(_zod3.z.string()),
|
|
3184
|
+
token: _zod3.z.string(),
|
|
3185
|
+
featureIds: _zod3.z.array(_zod3.z.string())
|
|
3186
|
+
}),
|
|
3187
|
+
[t]
|
|
3188
|
+
);
|
|
3189
|
+
const getDefaultValues = _react.useCallback.call(void 0, () => {
|
|
3190
|
+
const coreFeatureIds = allFeatures.filter((feature) => feature.isCore).map((feature) => feature.id);
|
|
3191
|
+
return {
|
|
3192
|
+
unitAmount: _optionalChain([price, 'optionalAccess', _119 => _119.unitAmount]) ? price.unitAmount / 100 : 0,
|
|
3193
|
+
currency: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _120 => _120.currency]), () => ( "usd")),
|
|
3194
|
+
interval: _optionalChain([price, 'optionalAccess', _121 => _121.priceType]) === "one_time" ? "one_time" : _nullishCoalesce(_optionalChain([price, 'optionalAccess', _122 => _122.recurring, 'optionalAccess', _123 => _123.interval]), () => ( "month")),
|
|
3195
|
+
intervalCount: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _124 => _124.recurring, 'optionalAccess', _125 => _125.intervalCount]), () => ( 1)),
|
|
3196
|
+
usageType: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _126 => _126.recurring, 'optionalAccess', _127 => _127.usageType]), () => ( "licensed")),
|
|
3197
|
+
nickname: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _128 => _128.nickname]), () => ( "")),
|
|
3198
|
+
isTrial: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _129 => _129.isTrial]), () => ( false)),
|
|
3199
|
+
description: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _130 => _130.description]), () => ( "")),
|
|
3200
|
+
features: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _131 => _131.features]), () => ( [])),
|
|
3201
|
+
token: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _132 => _132.token, 'optionalAccess', _133 => _133.toString, 'call', _134 => _134()]), () => ( "")),
|
|
3202
|
+
featureIds: [.../* @__PURE__ */ new Set([..._nullishCoalesce(_optionalChain([price, 'optionalAccess', _135 => _135.priceFeatures, 'optionalAccess', _136 => _136.map, 'call', _137 => _137((f) => f.id)]), () => ( [])), ...coreFeatureIds])]
|
|
3203
|
+
};
|
|
3204
|
+
}, [price, allFeatures]);
|
|
3270
3205
|
const form = _reacthookform.useForm.call(void 0, {
|
|
3271
3206
|
resolver: _zod.zodResolver.call(void 0, formSchema2),
|
|
3272
|
-
defaultValues:
|
|
3273
|
-
unitAmount: defaultUnitAmount,
|
|
3274
|
-
currency: _optionalChain([price, 'optionalAccess', _124 => _124.currency]) || "usd",
|
|
3275
|
-
interval: _optionalChain([price, 'optionalAccess', _125 => _125.priceType]) === "one_time" ? "one_time" : _optionalChain([price, 'optionalAccess', _126 => _126.recurring, 'optionalAccess', _127 => _127.interval]) || "month",
|
|
3276
|
-
intervalCount: _optionalChain([price, 'optionalAccess', _128 => _128.recurring, 'optionalAccess', _129 => _129.intervalCount]) || 1,
|
|
3277
|
-
usageType: _optionalChain([price, 'optionalAccess', _130 => _130.recurring, 'optionalAccess', _131 => _131.usageType]) || "licensed",
|
|
3278
|
-
nickname: _optionalChain([price, 'optionalAccess', _132 => _132.nickname]) || "",
|
|
3279
|
-
active: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _133 => _133.active]), () => ( true)),
|
|
3280
|
-
isTrial: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _134 => _134.isTrial]), () => ( false)),
|
|
3281
|
-
description: _optionalChain([price, 'optionalAccess', _135 => _135.description]) || "",
|
|
3282
|
-
features: _optionalChain([price, 'optionalAccess', _136 => _136.features]) || [],
|
|
3283
|
-
token: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _137 => _137.token, 'optionalAccess', _138 => _138.toString, 'call', _139 => _139()]), () => ( "")),
|
|
3284
|
-
featureIds: defaultFeatureIds
|
|
3285
|
-
}
|
|
3207
|
+
defaultValues: getDefaultValues()
|
|
3286
3208
|
});
|
|
3287
|
-
_react.useEffect.call(void 0, () => {
|
|
3288
|
-
if (open) {
|
|
3289
|
-
const currentCoreFeatureIds = allFeatures.filter((f) => f.isCore).map((f) => f.id);
|
|
3290
|
-
const resetFeatureIds = [
|
|
3291
|
-
.../* @__PURE__ */ new Set([..._nullishCoalesce(_optionalChain([price, 'optionalAccess', _140 => _140.priceFeatures, 'optionalAccess', _141 => _141.map, 'call', _142 => _142((f) => f.id)]), () => ( [])), ...currentCoreFeatureIds])
|
|
3292
|
-
];
|
|
3293
|
-
form.reset({
|
|
3294
|
-
unitAmount: _optionalChain([price, 'optionalAccess', _143 => _143.unitAmount]) ? price.unitAmount / 100 : 0,
|
|
3295
|
-
currency: _optionalChain([price, 'optionalAccess', _144 => _144.currency]) || "usd",
|
|
3296
|
-
interval: _optionalChain([price, 'optionalAccess', _145 => _145.priceType]) === "one_time" ? "one_time" : _optionalChain([price, 'optionalAccess', _146 => _146.recurring, 'optionalAccess', _147 => _147.interval]) || "month",
|
|
3297
|
-
intervalCount: _optionalChain([price, 'optionalAccess', _148 => _148.recurring, 'optionalAccess', _149 => _149.intervalCount]) || 1,
|
|
3298
|
-
usageType: _optionalChain([price, 'optionalAccess', _150 => _150.recurring, 'optionalAccess', _151 => _151.usageType]) || "licensed",
|
|
3299
|
-
nickname: _optionalChain([price, 'optionalAccess', _152 => _152.nickname]) || "",
|
|
3300
|
-
active: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _153 => _153.active]), () => ( true)),
|
|
3301
|
-
isTrial: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _154 => _154.isTrial]), () => ( false)),
|
|
3302
|
-
description: _optionalChain([price, 'optionalAccess', _155 => _155.description]) || "",
|
|
3303
|
-
features: _optionalChain([price, 'optionalAccess', _156 => _156.features]) || [],
|
|
3304
|
-
token: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _157 => _157.token, 'optionalAccess', _158 => _158.toString, 'call', _159 => _159()]), () => ( "")),
|
|
3305
|
-
featureIds: resetFeatureIds
|
|
3306
|
-
});
|
|
3307
|
-
}
|
|
3308
|
-
}, [open, _optionalChain([price, 'optionalAccess', _160 => _160.id]), allFeatures]);
|
|
3309
3209
|
const watchInterval = form.watch("interval");
|
|
3310
3210
|
const isRecurring = watchInterval !== "one_time";
|
|
3311
|
-
const onSubmit = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async (values) => {
|
|
3312
|
-
setIsSubmitting(true);
|
|
3313
|
-
try {
|
|
3314
|
-
const unitAmountInCents = Math.round(values.unitAmount * 100);
|
|
3315
|
-
if (isEditMode) {
|
|
3316
|
-
await _chunkRTOC53EZjs.StripePriceService.updatePrice({
|
|
3317
|
-
id: price.id,
|
|
3318
|
-
nickname: values.nickname || void 0,
|
|
3319
|
-
description: values.description || void 0,
|
|
3320
|
-
features: values.features.filter((f) => f.trim()) || void 0,
|
|
3321
|
-
token: values.token ? parseInt(values.token, 10) : void 0,
|
|
3322
|
-
// Only include isTrial and featureIds for recurring prices
|
|
3323
|
-
..._optionalChain([price, 'optionalAccess', _161 => _161.priceType]) === "recurring" ? { isTrial: values.isTrial, featureIds: values.featureIds } : {}
|
|
3324
|
-
});
|
|
3325
|
-
} else {
|
|
3326
|
-
const createInput = {
|
|
3327
|
-
id: _uuid.v4.call(void 0, ),
|
|
3328
|
-
productId,
|
|
3329
|
-
currency: values.currency,
|
|
3330
|
-
unitAmount: unitAmountInCents
|
|
3331
|
-
};
|
|
3332
|
-
if (isRecurring) {
|
|
3333
|
-
createInput.recurring = {
|
|
3334
|
-
interval: values.interval,
|
|
3335
|
-
intervalCount: values.intervalCount || 1,
|
|
3336
|
-
usageType: values.usageType || "licensed"
|
|
3337
|
-
};
|
|
3338
|
-
}
|
|
3339
|
-
if (values.nickname) {
|
|
3340
|
-
createInput.nickname = values.nickname;
|
|
3341
|
-
}
|
|
3342
|
-
if (values.description) {
|
|
3343
|
-
createInput.description = values.description;
|
|
3344
|
-
}
|
|
3345
|
-
const filteredFeatures = values.features.filter((f) => f.trim());
|
|
3346
|
-
if (filteredFeatures.length > 0) {
|
|
3347
|
-
createInput.features = filteredFeatures;
|
|
3348
|
-
}
|
|
3349
|
-
if (values.token) {
|
|
3350
|
-
createInput.token = parseInt(values.token, 10);
|
|
3351
|
-
}
|
|
3352
|
-
if (isRecurring) {
|
|
3353
|
-
createInput.isTrial = values.isTrial;
|
|
3354
|
-
if (values.featureIds.length > 0) {
|
|
3355
|
-
createInput.featureIds = values.featureIds;
|
|
3356
|
-
}
|
|
3357
|
-
}
|
|
3358
|
-
await _chunkRTOC53EZjs.StripePriceService.createPrice(createInput);
|
|
3359
|
-
}
|
|
3360
|
-
onSuccess();
|
|
3361
|
-
onOpenChange(false);
|
|
3362
|
-
} catch (error) {
|
|
3363
|
-
console.error("[PriceEditor] Failed to save price:", error);
|
|
3364
|
-
} finally {
|
|
3365
|
-
setIsSubmitting(false);
|
|
3366
|
-
}
|
|
3367
|
-
}, "onSubmit");
|
|
3368
3211
|
const currencyOptions = [
|
|
3369
3212
|
{ id: "usd", text: "USD ($)" },
|
|
3370
3213
|
{ id: "eur", text: "EUR (\u20AC)" },
|
|
3371
3214
|
{ id: "gbp", text: "GBP (\xA3)" }
|
|
3372
3215
|
];
|
|
3373
3216
|
const intervalOptions = [
|
|
3374
|
-
{ id: "one_time", text: "
|
|
3375
|
-
{ id: "day", text: "
|
|
3376
|
-
{ id: "week", text: "
|
|
3377
|
-
{ id: "month", text: "
|
|
3378
|
-
{ id: "year", text: "
|
|
3217
|
+
{ id: "one_time", text: t("billing.admin.prices.interval.one_time") },
|
|
3218
|
+
{ id: "day", text: t("billing.admin.prices.interval.day") },
|
|
3219
|
+
{ id: "week", text: t("billing.admin.prices.interval.week") },
|
|
3220
|
+
{ id: "month", text: t("billing.admin.prices.interval.month") },
|
|
3221
|
+
{ id: "year", text: t("billing.admin.prices.interval.year") }
|
|
3379
3222
|
];
|
|
3380
3223
|
const usageTypeOptions = [
|
|
3381
|
-
{ id: "licensed", text: "
|
|
3382
|
-
{ id: "metered", text: "
|
|
3224
|
+
{ id: "licensed", text: t("billing.admin.prices.usage.licensed") },
|
|
3225
|
+
{ id: "metered", text: t("billing.admin.prices.usage.metered") }
|
|
3383
3226
|
];
|
|
3384
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3227
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3228
|
+
_chunk5GVBUTS4js.EditorSheet,
|
|
3229
|
+
{
|
|
3230
|
+
form,
|
|
3231
|
+
entityType: t("billing.admin.prices.entity"),
|
|
3232
|
+
entityName: price ? priceLabel(price) : void 0,
|
|
3233
|
+
isEdit,
|
|
3234
|
+
module: _chunk53B6NPGAjs.Modules.StripePrice,
|
|
3235
|
+
size: "lg",
|
|
3236
|
+
propagateChanges,
|
|
3237
|
+
onSuccess,
|
|
3238
|
+
onNavigate: (url) => router.push(url),
|
|
3239
|
+
onSubmit: async (values) => {
|
|
3240
|
+
const trimmedFeatures = values.features.filter((feature) => feature.trim());
|
|
3241
|
+
if (isEdit) {
|
|
3242
|
+
const patch = {
|
|
3243
|
+
id: price.id,
|
|
3244
|
+
nickname: values.nickname || void 0,
|
|
3245
|
+
description: values.description || void 0,
|
|
3246
|
+
features: trimmedFeatures.length > 0 ? trimmedFeatures : void 0,
|
|
3247
|
+
token: values.token ? parseInt(values.token, 10) : void 0,
|
|
3248
|
+
// Stripe one-time prices carry neither a trial flag nor platform
|
|
3249
|
+
// features, so those two only travel for recurring prices.
|
|
3250
|
+
...price.priceType === "recurring" ? { isTrial: values.isTrial, featureIds: values.featureIds } : {}
|
|
3251
|
+
};
|
|
3252
|
+
return await updatePrice(patch);
|
|
3253
|
+
}
|
|
3254
|
+
if (!targetProductId) throw new Error("PriceEditor requires a productId to create a price");
|
|
3255
|
+
const payload = {
|
|
3256
|
+
id: _uuid.v4.call(void 0, ),
|
|
3257
|
+
productId: targetProductId,
|
|
3258
|
+
currency: values.currency,
|
|
3259
|
+
unitAmount: Math.round(values.unitAmount * 100)
|
|
3260
|
+
};
|
|
3261
|
+
if (isRecurring) {
|
|
3262
|
+
payload.recurring = {
|
|
3263
|
+
interval: values.interval,
|
|
3264
|
+
intervalCount: _nullishCoalesce(values.intervalCount, () => ( 1)),
|
|
3265
|
+
usageType: _nullishCoalesce(values.usageType, () => ( "licensed"))
|
|
3266
|
+
};
|
|
3267
|
+
payload.isTrial = values.isTrial;
|
|
3268
|
+
if (values.featureIds.length > 0) payload.featureIds = values.featureIds;
|
|
3269
|
+
}
|
|
3270
|
+
if (values.nickname) payload.nickname = values.nickname;
|
|
3271
|
+
if (values.description) payload.description = values.description;
|
|
3272
|
+
if (trimmedFeatures.length > 0) payload.features = trimmedFeatures;
|
|
3273
|
+
if (values.token) payload.token = parseInt(values.token, 10);
|
|
3274
|
+
return await createPrice(payload);
|
|
3275
|
+
},
|
|
3276
|
+
onReset: getDefaultValues,
|
|
3277
|
+
trigger,
|
|
3278
|
+
forceShow,
|
|
3279
|
+
onClose,
|
|
3280
|
+
dialogOpen,
|
|
3281
|
+
onDialogOpenChange,
|
|
3282
|
+
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
3283
|
+
isEdit && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.Alert, { children: [
|
|
3284
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.AlertTitle, { children: t("billing.admin.prices.immutability.title") }),
|
|
3285
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.AlertDescription, { children: t("billing.admin.prices.immutability.description") })
|
|
3286
|
+
] }),
|
|
3287
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
|
|
3288
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3289
|
+
_chunk5GVBUTS4js.FormInput,
|
|
3290
|
+
{
|
|
3291
|
+
form,
|
|
3292
|
+
id: "unitAmount",
|
|
3293
|
+
type: "decimal",
|
|
3294
|
+
name: t("billing.admin.prices.fields.amount"),
|
|
3295
|
+
placeholder: t("billing.admin.prices.placeholders.amount"),
|
|
3296
|
+
disabled: isEdit,
|
|
3297
|
+
isRequired: true
|
|
3298
|
+
}
|
|
3299
|
+
),
|
|
3300
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3301
|
+
_chunk5GVBUTS4js.FormSelect,
|
|
3302
|
+
{
|
|
3303
|
+
form,
|
|
3304
|
+
id: "currency",
|
|
3305
|
+
name: t("billing.admin.prices.fields.currency"),
|
|
3306
|
+
values: currencyOptions,
|
|
3307
|
+
disabled: isEdit
|
|
3308
|
+
}
|
|
3309
|
+
)
|
|
3310
|
+
] }),
|
|
3398
3311
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3399
|
-
|
|
3312
|
+
_chunk5GVBUTS4js.FormSelect,
|
|
3400
3313
|
{
|
|
3401
3314
|
form,
|
|
3402
|
-
id: "
|
|
3403
|
-
name: "
|
|
3404
|
-
|
|
3405
|
-
disabled:
|
|
3406
|
-
isRequired: true
|
|
3315
|
+
id: "interval",
|
|
3316
|
+
name: t("billing.admin.prices.fields.interval"),
|
|
3317
|
+
values: intervalOptions,
|
|
3318
|
+
disabled: isEdit
|
|
3407
3319
|
}
|
|
3408
3320
|
),
|
|
3409
|
-
/* @__PURE__ */ _jsxruntime.
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3321
|
+
isRecurring && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
|
|
3322
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3323
|
+
_chunk5GVBUTS4js.FormInput,
|
|
3324
|
+
{
|
|
3325
|
+
form,
|
|
3326
|
+
id: "intervalCount",
|
|
3327
|
+
type: "number",
|
|
3328
|
+
name: t("billing.admin.prices.fields.intervalCount"),
|
|
3329
|
+
placeholder: t("billing.admin.prices.placeholders.intervalCount"),
|
|
3330
|
+
disabled: isEdit
|
|
3331
|
+
}
|
|
3332
|
+
),
|
|
3333
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3334
|
+
_chunk5GVBUTS4js.FormSelect,
|
|
3335
|
+
{
|
|
3336
|
+
form,
|
|
3337
|
+
id: "usageType",
|
|
3338
|
+
name: t("billing.admin.prices.fields.usageType"),
|
|
3339
|
+
values: usageTypeOptions,
|
|
3340
|
+
disabled: isEdit
|
|
3341
|
+
}
|
|
3342
|
+
)
|
|
3343
|
+
] }),
|
|
3422
3344
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3423
|
-
|
|
3345
|
+
_chunk5GVBUTS4js.FormInput,
|
|
3424
3346
|
{
|
|
3425
3347
|
form,
|
|
3426
|
-
id: "
|
|
3427
|
-
name: "
|
|
3428
|
-
placeholder: "
|
|
3429
|
-
type: "number",
|
|
3430
|
-
disabled: isEditMode
|
|
3348
|
+
id: "nickname",
|
|
3349
|
+
name: t("billing.admin.prices.fields.nickname"),
|
|
3350
|
+
placeholder: t("billing.admin.prices.placeholders.nickname")
|
|
3431
3351
|
}
|
|
3432
3352
|
),
|
|
3433
3353
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3434
|
-
|
|
3354
|
+
_chunk5GVBUTS4js.FormTextarea,
|
|
3435
3355
|
{
|
|
3436
3356
|
form,
|
|
3437
|
-
id: "
|
|
3438
|
-
name: "
|
|
3439
|
-
|
|
3440
|
-
|
|
3357
|
+
id: "description",
|
|
3358
|
+
name: t("billing.admin.prices.fields.description"),
|
|
3359
|
+
placeholder: t("billing.admin.prices.placeholders.description"),
|
|
3360
|
+
className: "min-h-24"
|
|
3441
3361
|
}
|
|
3442
|
-
)
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
{
|
|
3456
|
-
form,
|
|
3457
|
-
id: "description",
|
|
3458
|
-
name: "Description (optional)",
|
|
3459
|
-
placeholder: "Describe what this price tier includes...",
|
|
3460
|
-
className: "min-h-24"
|
|
3461
|
-
}
|
|
3462
|
-
),
|
|
3463
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.FormInput, { form, id: "token", name: "Token (optional)", placeholder: "Enter token value" }),
|
|
3464
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
3465
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Label, { children: "Features (optional)" }),
|
|
3466
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
3362
|
+
),
|
|
3363
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3364
|
+
_chunk5GVBUTS4js.FormInput,
|
|
3365
|
+
{
|
|
3366
|
+
form,
|
|
3367
|
+
id: "token",
|
|
3368
|
+
type: "number",
|
|
3369
|
+
name: t("billing.admin.prices.fields.token"),
|
|
3370
|
+
placeholder: t("billing.admin.prices.placeholders.token")
|
|
3371
|
+
}
|
|
3372
|
+
),
|
|
3373
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-2", children: [
|
|
3374
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.FieldLabel, { children: t("billing.admin.prices.fields.features") }),
|
|
3467
3375
|
form.watch("features").map((_, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
|
|
3468
3376
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3469
|
-
|
|
3377
|
+
_chunk5GVBUTS4js.Input,
|
|
3470
3378
|
{
|
|
3471
3379
|
...form.register(`features.${index}`),
|
|
3472
|
-
placeholder:
|
|
3380
|
+
placeholder: t("billing.admin.prices.placeholders.feature", { index: index + 1 }),
|
|
3473
3381
|
className: "flex-1"
|
|
3474
3382
|
}
|
|
3475
3383
|
),
|
|
3476
3384
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3477
|
-
|
|
3385
|
+
_chunk5GVBUTS4js.Button,
|
|
3478
3386
|
{
|
|
3479
3387
|
type: "button",
|
|
3480
3388
|
variant: "outline",
|
|
3481
3389
|
size: "icon",
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
},
|
|
3489
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.XIcon, { className: "h-4 w-4" })
|
|
3390
|
+
"aria-label": t("billing.admin.prices.actions.removeFeature"),
|
|
3391
|
+
onClick: () => form.setValue(
|
|
3392
|
+
"features",
|
|
3393
|
+
form.getValues("features").filter((_2, i) => i !== index)
|
|
3394
|
+
),
|
|
3395
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.XIcon, {})
|
|
3490
3396
|
}
|
|
3491
3397
|
)
|
|
3492
3398
|
] }, index)),
|
|
3493
3399
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3494
|
-
|
|
3400
|
+
_chunk5GVBUTS4js.Button,
|
|
3495
3401
|
{
|
|
3496
3402
|
type: "button",
|
|
3497
3403
|
variant: "outline",
|
|
3498
3404
|
size: "sm",
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
form.setValue("features", [...currentFeatures, ""]);
|
|
3502
|
-
},
|
|
3503
|
-
className: "mt-2",
|
|
3405
|
+
className: "self-start",
|
|
3406
|
+
onClick: () => form.setValue("features", [...form.getValues("features"), ""]),
|
|
3504
3407
|
children: [
|
|
3505
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.PlusIcon, {
|
|
3506
|
-
"
|
|
3408
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.PlusIcon, {}),
|
|
3409
|
+
t("billing.admin.prices.actions.addFeature")
|
|
3507
3410
|
]
|
|
3508
3411
|
}
|
|
3509
3412
|
)
|
|
3510
|
-
] })
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
const currentIds = form.getValues("featureIds");
|
|
3527
|
-
if (e.target.checked) {
|
|
3528
|
-
form.setValue("featureIds", [...currentIds, feature.id]);
|
|
3529
|
-
} else {
|
|
3530
|
-
if (!isCore) {
|
|
3413
|
+
] }),
|
|
3414
|
+
isRecurring && allFeatures.length > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-2", children: [
|
|
3415
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.FieldLabel, { children: t("billing.admin.prices.fields.platformFeatures") }),
|
|
3416
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex max-h-48 flex-col gap-y-2 overflow-y-auto rounded-md border p-4", children: allFeatures.map((feature) => {
|
|
3417
|
+
const isChecked = form.watch("featureIds").includes(feature.id);
|
|
3418
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
3419
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3420
|
+
_chunk5GVBUTS4js.Checkbox,
|
|
3421
|
+
{
|
|
3422
|
+
id: `feature-${feature.id}`,
|
|
3423
|
+
checked: isChecked,
|
|
3424
|
+
disabled: feature.isCore,
|
|
3425
|
+
onCheckedChange: (checked) => {
|
|
3426
|
+
const current = form.getValues("featureIds");
|
|
3427
|
+
if (checked) form.setValue("featureIds", [.../* @__PURE__ */ new Set([...current, feature.id])]);
|
|
3428
|
+
else if (!feature.isCore)
|
|
3531
3429
|
form.setValue(
|
|
3532
3430
|
"featureIds",
|
|
3533
|
-
|
|
3431
|
+
current.filter((id) => id !== feature.id)
|
|
3534
3432
|
);
|
|
3535
|
-
}
|
|
3536
3433
|
}
|
|
3537
|
-
}
|
|
3538
|
-
|
|
3539
|
-
}
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
id: "isTrial",
|
|
3561
|
-
name: "Trial Price",
|
|
3562
|
-
description: "Mark this as the trial subscription plan (only one price should be marked as trial)"
|
|
3563
|
-
}
|
|
3564
|
-
),
|
|
3565
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.CommonEditorButtons, { isEdit: isEditMode, form, disabled: isSubmitting, setOpen: onOpenChange })
|
|
3566
|
-
] }) })
|
|
3567
|
-
] }) });
|
|
3434
|
+
}
|
|
3435
|
+
),
|
|
3436
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.FieldLabel, { htmlFor: `feature-${feature.id}`, children: feature.name }),
|
|
3437
|
+
feature.isCore && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.admin.prices.help.core") })
|
|
3438
|
+
] }, feature.id);
|
|
3439
|
+
}) })
|
|
3440
|
+
] }),
|
|
3441
|
+
isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3442
|
+
_chunk5GVBUTS4js.FormCheckbox,
|
|
3443
|
+
{
|
|
3444
|
+
form,
|
|
3445
|
+
id: "isTrial",
|
|
3446
|
+
name: t("billing.admin.prices.fields.trial"),
|
|
3447
|
+
description: t("billing.admin.prices.help.trial")
|
|
3448
|
+
}
|
|
3449
|
+
)
|
|
3450
|
+
] })
|
|
3451
|
+
}
|
|
3452
|
+
);
|
|
3453
|
+
}
|
|
3454
|
+
_chunk7QVYU63Ejs.__name.call(void 0, PriceEditorInternal, "PriceEditorInternal");
|
|
3455
|
+
function PriceEditor(props) {
|
|
3456
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceEditorInternal, { ...props });
|
|
3568
3457
|
}
|
|
3569
3458
|
_chunk7QVYU63Ejs.__name.call(void 0, PriceEditor, "PriceEditor");
|
|
3570
3459
|
|
|
3571
|
-
// src/features/billing/
|
|
3460
|
+
// src/features/billing/contexts/PriceContext.tsx
|
|
3461
|
+
|
|
3462
|
+
var PriceContext = _react.createContext.call(void 0, void 0);
|
|
3463
|
+
var defaultContextValue = {
|
|
3464
|
+
price: void 0,
|
|
3465
|
+
setPrice: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
3466
|
+
}, "setPrice"),
|
|
3467
|
+
reloadPrice: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3468
|
+
}, "reloadPrice"),
|
|
3469
|
+
createPrice: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3470
|
+
throw new Error("createPrice requires a PriceProvider");
|
|
3471
|
+
}, "createPrice"),
|
|
3472
|
+
updatePrice: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3473
|
+
throw new Error("updatePrice requires a PriceProvider");
|
|
3474
|
+
}, "updatePrice"),
|
|
3475
|
+
archivePrice: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3476
|
+
}, "archivePrice"),
|
|
3477
|
+
restorePrice: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3478
|
+
}, "restorePrice"),
|
|
3479
|
+
priceVersion: 0,
|
|
3480
|
+
refreshPrices: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
3481
|
+
}, "refreshPrices"),
|
|
3482
|
+
productId: void 0
|
|
3483
|
+
};
|
|
3484
|
+
function priceLabel(price) {
|
|
3485
|
+
return _nullishCoalesce(price.nickname, () => ( `${_chunk5GVBUTS4js.formatCurrency.call(void 0, price.unitAmount, price.currency)} ${_chunk5GVBUTS4js.formatInterval.call(void 0, price)}`.trim()));
|
|
3486
|
+
}
|
|
3487
|
+
_chunk7QVYU63Ejs.__name.call(void 0, priceLabel, "priceLabel");
|
|
3488
|
+
var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
3489
|
+
children,
|
|
3490
|
+
dehydratedPrice,
|
|
3491
|
+
publishChrome = true,
|
|
3492
|
+
productId: productIdProp
|
|
3493
|
+
}) => {
|
|
3494
|
+
const t = _nextintl.useTranslations.call(void 0, );
|
|
3495
|
+
const generateUrl = _chunk5GVBUTS4js.usePageUrlGenerator.call(void 0, );
|
|
3496
|
+
const { hasRole } = _chunk5GVBUTS4js.useCurrentUserContext.call(void 0, );
|
|
3497
|
+
const [price, setPrice] = _react.useState.call(void 0,
|
|
3498
|
+
dehydratedPrice ? _chunk53B6NPGAjs.rehydrate.call(void 0, _chunk53B6NPGAjs.Modules.StripePrice, dehydratedPrice) : void 0
|
|
3499
|
+
);
|
|
3500
|
+
const [priceVersion, setPriceVersion] = _react.useState.call(void 0, 0);
|
|
3501
|
+
const refreshPrices = _react.useCallback.call(void 0, () => setPriceVersion((value2) => value2 + 1), []);
|
|
3502
|
+
const productId = _nullishCoalesce(productIdProp, () => ( _optionalChain([price, 'optionalAccess', _138 => _138.product, 'optionalAccess', _139 => _139.id])));
|
|
3503
|
+
const reloadPrice = _react.useCallback.call(void 0, async () => {
|
|
3504
|
+
if (!_optionalChain([price, 'optionalAccess', _140 => _140.id])) return;
|
|
3505
|
+
setPrice(await _chunk53B6NPGAjs.StripePriceService.getPrice({ id: price.id }));
|
|
3506
|
+
}, [_optionalChain([price, 'optionalAccess', _141 => _141.id])]);
|
|
3507
|
+
const createPrice = _react.useCallback.call(void 0,
|
|
3508
|
+
async (input) => {
|
|
3509
|
+
const saved = await _chunk53B6NPGAjs.StripePriceService.createPrice(input);
|
|
3510
|
+
refreshPrices();
|
|
3511
|
+
return saved;
|
|
3512
|
+
},
|
|
3513
|
+
[refreshPrices]
|
|
3514
|
+
);
|
|
3515
|
+
const updatePrice = _react.useCallback.call(void 0,
|
|
3516
|
+
async (input) => {
|
|
3517
|
+
const saved = await _chunk53B6NPGAjs.StripePriceService.updatePrice(input);
|
|
3518
|
+
setPrice(saved);
|
|
3519
|
+
refreshPrices();
|
|
3520
|
+
return saved;
|
|
3521
|
+
},
|
|
3522
|
+
[refreshPrices]
|
|
3523
|
+
);
|
|
3524
|
+
const archivePrice = _react.useCallback.call(void 0,
|
|
3525
|
+
async (id) => {
|
|
3526
|
+
const target = _nullishCoalesce(id, () => ( _optionalChain([price, 'optionalAccess', _142 => _142.id])));
|
|
3527
|
+
if (!target) return;
|
|
3528
|
+
await _chunk53B6NPGAjs.StripePriceService.archivePrice({ id: target });
|
|
3529
|
+
await reloadPrice();
|
|
3530
|
+
refreshPrices();
|
|
3531
|
+
},
|
|
3532
|
+
[_optionalChain([price, 'optionalAccess', _143 => _143.id]), reloadPrice, refreshPrices]
|
|
3533
|
+
);
|
|
3534
|
+
const restorePrice = _react.useCallback.call(void 0,
|
|
3535
|
+
async (id) => {
|
|
3536
|
+
const target = _nullishCoalesce(id, () => ( _optionalChain([price, 'optionalAccess', _144 => _144.id])));
|
|
3537
|
+
if (!target) return;
|
|
3538
|
+
await _chunk53B6NPGAjs.StripePriceService.reactivatePrice({ id: target });
|
|
3539
|
+
await reloadPrice();
|
|
3540
|
+
refreshPrices();
|
|
3541
|
+
},
|
|
3542
|
+
[_optionalChain([price, 'optionalAccess', _145 => _145.id]), reloadPrice, refreshPrices]
|
|
3543
|
+
);
|
|
3544
|
+
const value = _react.useMemo.call(void 0,
|
|
3545
|
+
() => ({
|
|
3546
|
+
price,
|
|
3547
|
+
setPrice,
|
|
3548
|
+
reloadPrice,
|
|
3549
|
+
createPrice,
|
|
3550
|
+
updatePrice,
|
|
3551
|
+
archivePrice,
|
|
3552
|
+
restorePrice,
|
|
3553
|
+
priceVersion,
|
|
3554
|
+
refreshPrices,
|
|
3555
|
+
productId
|
|
3556
|
+
}),
|
|
3557
|
+
[price, reloadPrice, createPrice, updatePrice, archivePrice, restorePrice, priceVersion, refreshPrices, productId]
|
|
3558
|
+
);
|
|
3559
|
+
if (!publishChrome) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceContext.Provider, { value, children });
|
|
3560
|
+
const breadcrumb = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
3561
|
+
const items = [
|
|
3562
|
+
{ name: t("billing.admin.products.title"), href: generateUrl({ page: _chunk53B6NPGAjs.Modules.StripeProduct }) }
|
|
3563
|
+
];
|
|
3564
|
+
if (_optionalChain([price, 'optionalAccess', _146 => _146.product]))
|
|
3565
|
+
items.push({
|
|
3566
|
+
name: price.product.name,
|
|
3567
|
+
href: generateUrl({ page: _chunk53B6NPGAjs.Modules.StripeProduct, id: price.product.id })
|
|
3568
|
+
});
|
|
3569
|
+
if (price) items.push({ name: priceLabel(price) });
|
|
3570
|
+
return items;
|
|
3571
|
+
}, "breadcrumb");
|
|
3572
|
+
const title = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
3573
|
+
const response = { type: t("billing.admin.prices.title") };
|
|
3574
|
+
if (!price) return response;
|
|
3575
|
+
response.element = priceLabel(price);
|
|
3576
|
+
if (hasRole(_chunkJKGEJGSDjs.getRoleId.call(void 0, ).Administrator)) {
|
|
3577
|
+
response.functions = [
|
|
3578
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceArchiver, { price }, "priceArchiver"),
|
|
3579
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceEditor, { price, propagateChanges: setPrice }, "priceEditor")
|
|
3580
|
+
];
|
|
3581
|
+
}
|
|
3582
|
+
return response;
|
|
3583
|
+
}, "title");
|
|
3584
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceContext.Provider, { value, children }) });
|
|
3585
|
+
}, "PriceProvider");
|
|
3586
|
+
var usePriceContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => _nullishCoalesce(_react.useContext.call(void 0, PriceContext), () => ( defaultContextValue)), "usePriceContext");
|
|
3572
3587
|
|
|
3588
|
+
// src/features/billing/contexts/ProductContext.tsx
|
|
3573
3589
|
|
|
3574
3590
|
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
const
|
|
3583
|
-
const
|
|
3584
|
-
const
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
} finally {
|
|
3592
|
-
setLoading(false);
|
|
3593
|
-
}
|
|
3594
|
-
}, "loadPrices");
|
|
3595
|
-
_react.useEffect.call(void 0, () => {
|
|
3596
|
-
loadPrices();
|
|
3597
|
-
}, [productId]);
|
|
3598
|
-
const handleArchive = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3599
|
-
if (!priceToArchive) {
|
|
3600
|
-
return;
|
|
3601
|
-
}
|
|
3602
|
-
setArchivingPriceId(priceToArchive.id);
|
|
3603
|
-
try {
|
|
3604
|
-
await _chunkRTOC53EZjs.StripePriceService.archivePrice({ id: priceToArchive.id });
|
|
3605
|
-
setPriceToArchive(null);
|
|
3606
|
-
await loadPrices();
|
|
3607
|
-
onPricesChange();
|
|
3608
|
-
} catch (error) {
|
|
3609
|
-
console.error("[PricesList] Failed to archive price:", error);
|
|
3610
|
-
} finally {
|
|
3611
|
-
setArchivingPriceId(null);
|
|
3612
|
-
}
|
|
3613
|
-
}, "handleArchive");
|
|
3614
|
-
const handleReactivate = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3615
|
-
if (!priceToReactivate) {
|
|
3616
|
-
return;
|
|
3617
|
-
}
|
|
3618
|
-
setReactivatingPriceId(priceToReactivate.id);
|
|
3619
|
-
try {
|
|
3620
|
-
await _chunkRTOC53EZjs.StripePriceService.reactivatePrice({ id: priceToReactivate.id });
|
|
3621
|
-
setPriceToReactivate(null);
|
|
3622
|
-
await loadPrices();
|
|
3623
|
-
onPricesChange();
|
|
3624
|
-
} catch (error) {
|
|
3625
|
-
console.error("[PricesList] Failed to reactivate price:", error);
|
|
3626
|
-
} finally {
|
|
3627
|
-
setReactivatingPriceId(null);
|
|
3628
|
-
}
|
|
3629
|
-
}, "handleReactivate");
|
|
3630
|
-
const formatInterval2 = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (price) => {
|
|
3631
|
-
if (price.priceType === "one_time") {
|
|
3632
|
-
return "one-time";
|
|
3633
|
-
}
|
|
3634
|
-
if (price.recurring) {
|
|
3635
|
-
const count = price.recurring.intervalCount;
|
|
3636
|
-
const interval = price.recurring.interval;
|
|
3637
|
-
if (count === 1) {
|
|
3638
|
-
return `/ ${interval}`;
|
|
3639
|
-
} else {
|
|
3640
|
-
return `/ ${count} ${interval}s`;
|
|
3641
|
-
}
|
|
3642
|
-
}
|
|
3643
|
-
return "";
|
|
3644
|
-
}, "formatInterval");
|
|
3645
|
-
if (loading) {
|
|
3646
|
-
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 prices..." }) });
|
|
3647
|
-
}
|
|
3648
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-4", children: [
|
|
3649
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center justify-between mb-4", children: [
|
|
3650
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "text-lg font-semibold", children: "Prices" }),
|
|
3651
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { size: "sm", onClick: () => setShowCreatePrice(true), children: "Add Price" })
|
|
3652
|
-
] }),
|
|
3653
|
-
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: [
|
|
3654
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.DollarSign, { className: "text-muted-foreground h-12 w-12" }),
|
|
3655
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-sm", children: "No prices yet. Add a price to enable subscriptions." }),
|
|
3656
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Button, { size: "sm", onClick: () => setShowCreatePrice(true), children: "Add Price" })
|
|
3591
|
+
|
|
3592
|
+
// src/features/billing/stripe-product/components/forms/ProductArchiver.tsx
|
|
3593
|
+
|
|
3594
|
+
|
|
3595
|
+
|
|
3596
|
+
|
|
3597
|
+
function ProductArchiver({ product }) {
|
|
3598
|
+
const t = _nextintl.useTranslations.call(void 0, );
|
|
3599
|
+
const { archiveProduct, restoreProduct } = useProductContext();
|
|
3600
|
+
const [open, setOpen] = _react.useState.call(void 0, false);
|
|
3601
|
+
const isArchived = !product.active;
|
|
3602
|
+
const scope = isArchived ? "restore" : "archive";
|
|
3603
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
3604
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk5GVBUTS4js.Button, { variant: "outline", size: "sm", onClick: () => setOpen(true), children: [
|
|
3605
|
+
isArchived ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RotateCcwIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ArchiveIcon, {}),
|
|
3606
|
+
t(`billing.admin.products.${scope}.confirm`)
|
|
3657
3607
|
] }),
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
const isReactivating = reactivatingPriceId === price.id;
|
|
3661
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "border rounded-lg bg-white p-4 hover:shadow-sm transition-shadow", children: [
|
|
3662
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-start justify-between mb-3", children: [
|
|
3663
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.DollarSign, { className: "h-5 w-5 text-primary" }),
|
|
3664
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-1", children: [
|
|
3665
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.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" }) }),
|
|
3666
|
-
price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3667
|
-
_chunk7HKJNUW7js.Button,
|
|
3668
|
-
{
|
|
3669
|
-
variant: "ghost",
|
|
3670
|
-
size: "sm",
|
|
3671
|
-
onClick: () => setPriceToArchive(price),
|
|
3672
|
-
className: "h-8 w-8 p-0",
|
|
3673
|
-
disabled: isArchiving,
|
|
3674
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Archive, { className: "h-4 w-4" })
|
|
3675
|
-
}
|
|
3676
|
-
) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3677
|
-
_chunk7HKJNUW7js.Button,
|
|
3678
|
-
{
|
|
3679
|
-
variant: "ghost",
|
|
3680
|
-
size: "sm",
|
|
3681
|
-
onClick: () => setPriceToReactivate(price),
|
|
3682
|
-
className: "h-8 w-8 p-0",
|
|
3683
|
-
disabled: isReactivating,
|
|
3684
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RotateCcw, { className: "h-4 w-4" })
|
|
3685
|
-
}
|
|
3686
|
-
)
|
|
3687
|
-
] })
|
|
3688
|
-
] }),
|
|
3689
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mb-2", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-2xl font-bold", children: [
|
|
3690
|
-
formatCurrency(price.unitAmount, price.currency),
|
|
3691
|
-
" ",
|
|
3692
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-sm font-normal", children: formatInterval2(price) })
|
|
3693
|
-
] }) }),
|
|
3694
|
-
_optionalChain([price, 'access', _162 => _162.metadata, 'optionalAccess', _163 => _163.nickname]) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm font-medium mb-2", children: price.metadata.nickname }),
|
|
3695
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2", children: [
|
|
3696
|
-
price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Badge, { variant: "softGreen", children: "Active" }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Badge, { variant: "softGray", children: "Inactive" }),
|
|
3697
|
-
_optionalChain([price, 'access', _164 => _164.recurring, 'optionalAccess', _165 => _165.usageType]) === "metered" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Badge, { variant: "softBlue", children: "Metered" }),
|
|
3698
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Badge, { variant: "softGray", className: "uppercase", children: price.currency })
|
|
3699
|
-
] })
|
|
3700
|
-
] }, price.id);
|
|
3701
|
-
}) }),
|
|
3702
|
-
showCreatePrice && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3703
|
-
PriceEditor,
|
|
3704
|
-
{
|
|
3705
|
-
productId,
|
|
3706
|
-
open: showCreatePrice,
|
|
3707
|
-
onOpenChange: setShowCreatePrice,
|
|
3708
|
-
onSuccess: () => {
|
|
3709
|
-
loadPrices();
|
|
3710
|
-
onPricesChange();
|
|
3711
|
-
}
|
|
3712
|
-
}
|
|
3713
|
-
),
|
|
3714
|
-
editingPrice && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3715
|
-
PriceEditor,
|
|
3608
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3609
|
+
_chunk5GVBUTS4js.ConfirmDialog,
|
|
3716
3610
|
{
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3611
|
+
open,
|
|
3612
|
+
onOpenChange: setOpen,
|
|
3613
|
+
title: t(`billing.admin.products.${scope}.title`),
|
|
3614
|
+
description: t(`billing.admin.products.${scope}.description`, { name: product.name }),
|
|
3615
|
+
confirmLabel: t(`billing.admin.products.${scope}.confirm`),
|
|
3616
|
+
cancelLabel: t("ui.buttons.cancel"),
|
|
3617
|
+
destructive: !isArchived,
|
|
3618
|
+
onConfirm: async () => {
|
|
3619
|
+
try {
|
|
3620
|
+
if (isArchived) await restoreProduct(product.id);
|
|
3621
|
+
else await archiveProduct(product.id);
|
|
3622
|
+
} catch (error) {
|
|
3623
|
+
_chunk5GVBUTS4js.errorToast.call(void 0, { title: t(`billing.admin.products.${scope}.title`), error });
|
|
3624
|
+
throw error;
|
|
3625
|
+
}
|
|
3725
3626
|
}
|
|
3726
3627
|
}
|
|
3727
|
-
)
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3628
|
+
)
|
|
3629
|
+
] });
|
|
3630
|
+
}
|
|
3631
|
+
_chunk7QVYU63Ejs.__name.call(void 0, ProductArchiver, "ProductArchiver");
|
|
3632
|
+
|
|
3633
|
+
// src/features/billing/stripe-product/components/forms/ProductEditor.tsx
|
|
3634
|
+
|
|
3635
|
+
|
|
3636
|
+
|
|
3637
|
+
|
|
3638
|
+
|
|
3639
|
+
|
|
3640
|
+
|
|
3641
|
+
function ProductEditorInternal({
|
|
3642
|
+
product,
|
|
3643
|
+
propagateChanges,
|
|
3644
|
+
onSuccess,
|
|
3645
|
+
trigger,
|
|
3646
|
+
forceShow,
|
|
3647
|
+
onClose,
|
|
3648
|
+
dialogOpen,
|
|
3649
|
+
onDialogOpenChange
|
|
3650
|
+
}) {
|
|
3651
|
+
const t = _nextintl.useTranslations.call(void 0, );
|
|
3652
|
+
const router = _chunkJKGEJGSDjs.useI18nRouter.call(void 0, );
|
|
3653
|
+
const { createProduct, updateProduct } = useProductContext();
|
|
3654
|
+
const isEdit = !!product;
|
|
3655
|
+
const formSchema2 = _react.useMemo.call(void 0,
|
|
3656
|
+
() => _zod3.z.object({
|
|
3657
|
+
id: _zod3.z.uuidv4(),
|
|
3658
|
+
name: _zod3.z.string().min(1, { message: t("billing.admin.products.errors.name") }),
|
|
3659
|
+
description: _zod3.z.string().optional()
|
|
3660
|
+
}),
|
|
3661
|
+
[t]
|
|
3662
|
+
);
|
|
3663
|
+
const getDefaultValues = _react.useCallback.call(void 0,
|
|
3664
|
+
() => ({
|
|
3665
|
+
id: _nullishCoalesce(_optionalChain([product, 'optionalAccess', _147 => _147.id]), () => ( _uuid.v4.call(void 0, ))),
|
|
3666
|
+
name: _nullishCoalesce(_optionalChain([product, 'optionalAccess', _148 => _148.name]), () => ( "")),
|
|
3667
|
+
description: _nullishCoalesce(_optionalChain([product, 'optionalAccess', _149 => _149.description]), () => ( ""))
|
|
3668
|
+
}),
|
|
3669
|
+
[product]
|
|
3670
|
+
);
|
|
3671
|
+
const form = _reacthookform.useForm.call(void 0, {
|
|
3672
|
+
resolver: _zod.zodResolver.call(void 0, formSchema2),
|
|
3673
|
+
defaultValues: getDefaultValues()
|
|
3674
|
+
});
|
|
3675
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3676
|
+
_chunk5GVBUTS4js.EditorSheet,
|
|
3677
|
+
{
|
|
3678
|
+
form,
|
|
3679
|
+
entityType: t("billing.admin.products.entity"),
|
|
3680
|
+
entityName: _optionalChain([product, 'optionalAccess', _150 => _150.name]),
|
|
3681
|
+
isEdit,
|
|
3682
|
+
module: _chunk53B6NPGAjs.Modules.StripeProduct,
|
|
3683
|
+
size: "md",
|
|
3684
|
+
propagateChanges,
|
|
3685
|
+
onSuccess,
|
|
3686
|
+
onNavigate: (url) => router.push(url),
|
|
3687
|
+
onSubmit: async (values) => {
|
|
3688
|
+
const payload = { id: values.id, name: values.name, description: values.description };
|
|
3689
|
+
return isEdit ? await updateProduct(payload) : await createProduct(payload);
|
|
3690
|
+
},
|
|
3691
|
+
onReset: getDefaultValues,
|
|
3692
|
+
trigger,
|
|
3693
|
+
forceShow,
|
|
3694
|
+
onClose,
|
|
3695
|
+
dialogOpen,
|
|
3696
|
+
onDialogOpenChange,
|
|
3697
|
+
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
3740
3698
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3741
|
-
|
|
3699
|
+
_chunk5GVBUTS4js.FormInput,
|
|
3742
3700
|
{
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3701
|
+
form,
|
|
3702
|
+
id: "name",
|
|
3703
|
+
name: t("billing.admin.products.fields.name"),
|
|
3704
|
+
placeholder: t("billing.admin.products.placeholders.name"),
|
|
3705
|
+
isRequired: true
|
|
3747
3706
|
}
|
|
3748
|
-
)
|
|
3749
|
-
] })
|
|
3750
|
-
] }) }),
|
|
3751
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.AlertDialog, { open: !!priceToReactivate, onOpenChange: (open) => !open && setPriceToReactivate(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.AlertDialogContent, { children: [
|
|
3752
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.AlertDialogHeader, { children: [
|
|
3753
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.AlertDialogTitle, { children: "Reactivate Price" }),
|
|
3754
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.AlertDialogDescription, { children: [
|
|
3755
|
-
"Are you sure you want to reactivate the price for",
|
|
3756
|
-
" ",
|
|
3757
|
-
priceToReactivate && `${formatCurrency(priceToReactivate.unitAmount, priceToReactivate.currency)} ${formatInterval2(priceToReactivate)}`,
|
|
3758
|
-
"? This will allow new subscriptions again."
|
|
3759
|
-
] })
|
|
3760
|
-
] }),
|
|
3761
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.AlertDialogFooter, { children: [
|
|
3762
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.AlertDialogCancel, { disabled: !!reactivatingPriceId, children: "Cancel" }),
|
|
3707
|
+
),
|
|
3763
3708
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3764
|
-
|
|
3709
|
+
_chunk5GVBUTS4js.FormTextarea,
|
|
3765
3710
|
{
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3711
|
+
form,
|
|
3712
|
+
id: "description",
|
|
3713
|
+
name: t("billing.admin.products.fields.description"),
|
|
3714
|
+
placeholder: t("billing.admin.products.placeholders.description"),
|
|
3715
|
+
className: "min-h-32"
|
|
3770
3716
|
}
|
|
3771
3717
|
)
|
|
3772
3718
|
] })
|
|
3773
|
-
|
|
3774
|
-
|
|
3719
|
+
}
|
|
3720
|
+
);
|
|
3775
3721
|
}
|
|
3776
|
-
_chunk7QVYU63Ejs.__name.call(void 0,
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3722
|
+
_chunk7QVYU63Ejs.__name.call(void 0, ProductEditorInternal, "ProductEditorInternal");
|
|
3723
|
+
function ProductEditor(props) {
|
|
3724
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductEditorInternal, { ...props });
|
|
3725
|
+
}
|
|
3726
|
+
_chunk7QVYU63Ejs.__name.call(void 0, ProductEditor, "ProductEditor");
|
|
3781
3727
|
|
|
3782
|
-
// src/features/billing/
|
|
3728
|
+
// src/features/billing/contexts/ProductContext.tsx
|
|
3729
|
+
|
|
3730
|
+
var ProductContext = _react.createContext.call(void 0, void 0);
|
|
3731
|
+
var defaultContextValue2 = {
|
|
3732
|
+
product: void 0,
|
|
3733
|
+
setProduct: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
3734
|
+
}, "setProduct"),
|
|
3735
|
+
reloadProduct: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3736
|
+
}, "reloadProduct"),
|
|
3737
|
+
createProduct: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3738
|
+
throw new Error("createProduct requires a ProductProvider");
|
|
3739
|
+
}, "createProduct"),
|
|
3740
|
+
updateProduct: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3741
|
+
throw new Error("updateProduct requires a ProductProvider");
|
|
3742
|
+
}, "updateProduct"),
|
|
3743
|
+
archiveProduct: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3744
|
+
}, "archiveProduct"),
|
|
3745
|
+
restoreProduct: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3746
|
+
}, "restoreProduct"),
|
|
3747
|
+
catalogueVersion: 0,
|
|
3748
|
+
refreshCatalogue: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
3749
|
+
}, "refreshCatalogue")
|
|
3750
|
+
};
|
|
3751
|
+
var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ children, dehydratedProduct, publishChrome = true }) => {
|
|
3752
|
+
const t = _nextintl.useTranslations.call(void 0, );
|
|
3753
|
+
const generateUrl = _chunk5GVBUTS4js.usePageUrlGenerator.call(void 0, );
|
|
3754
|
+
const { hasRole } = _chunk5GVBUTS4js.useCurrentUserContext.call(void 0, );
|
|
3755
|
+
const [product, setProduct] = _react.useState.call(void 0,
|
|
3756
|
+
dehydratedProduct ? _chunk53B6NPGAjs.rehydrate.call(void 0, _chunk53B6NPGAjs.Modules.StripeProduct, dehydratedProduct) : void 0
|
|
3757
|
+
);
|
|
3758
|
+
const [catalogueVersion, setCatalogueVersion] = _react.useState.call(void 0, 0);
|
|
3759
|
+
const refreshCatalogue = _react.useCallback.call(void 0, () => setCatalogueVersion((value2) => value2 + 1), []);
|
|
3760
|
+
const reloadProduct = _react.useCallback.call(void 0, async () => {
|
|
3761
|
+
if (!_optionalChain([product, 'optionalAccess', _151 => _151.id])) return;
|
|
3762
|
+
setProduct(await _chunk53B6NPGAjs.StripeProductService.getProduct({ id: product.id }));
|
|
3763
|
+
}, [_optionalChain([product, 'optionalAccess', _152 => _152.id])]);
|
|
3764
|
+
const createProduct = _react.useCallback.call(void 0,
|
|
3765
|
+
async (input) => {
|
|
3766
|
+
const saved = await _chunk53B6NPGAjs.StripeProductService.createProduct(input);
|
|
3767
|
+
refreshCatalogue();
|
|
3768
|
+
return saved;
|
|
3769
|
+
},
|
|
3770
|
+
[refreshCatalogue]
|
|
3771
|
+
);
|
|
3772
|
+
const updateProduct = _react.useCallback.call(void 0,
|
|
3773
|
+
async (input) => {
|
|
3774
|
+
const saved = await _chunk53B6NPGAjs.StripeProductService.updateProduct(input);
|
|
3775
|
+
setProduct(saved);
|
|
3776
|
+
refreshCatalogue();
|
|
3777
|
+
return saved;
|
|
3778
|
+
},
|
|
3779
|
+
[refreshCatalogue]
|
|
3780
|
+
);
|
|
3781
|
+
const archiveProduct = _react.useCallback.call(void 0,
|
|
3782
|
+
async (id) => {
|
|
3783
|
+
const target = _nullishCoalesce(id, () => ( _optionalChain([product, 'optionalAccess', _153 => _153.id])));
|
|
3784
|
+
if (!target) return;
|
|
3785
|
+
await _chunk53B6NPGAjs.StripeProductService.archiveProduct({ id: target });
|
|
3786
|
+
await reloadProduct();
|
|
3787
|
+
refreshCatalogue();
|
|
3788
|
+
},
|
|
3789
|
+
[_optionalChain([product, 'optionalAccess', _154 => _154.id]), reloadProduct, refreshCatalogue]
|
|
3790
|
+
);
|
|
3791
|
+
const restoreProduct = _react.useCallback.call(void 0,
|
|
3792
|
+
async (id) => {
|
|
3793
|
+
const target = _nullishCoalesce(id, () => ( _optionalChain([product, 'optionalAccess', _155 => _155.id])));
|
|
3794
|
+
if (!target) return;
|
|
3795
|
+
await _chunk53B6NPGAjs.StripeProductService.reactivateProduct({ id: target });
|
|
3796
|
+
await reloadProduct();
|
|
3797
|
+
refreshCatalogue();
|
|
3798
|
+
},
|
|
3799
|
+
[_optionalChain([product, 'optionalAccess', _156 => _156.id]), reloadProduct, refreshCatalogue]
|
|
3800
|
+
);
|
|
3801
|
+
const value = _react.useMemo.call(void 0,
|
|
3802
|
+
() => ({
|
|
3803
|
+
product,
|
|
3804
|
+
setProduct,
|
|
3805
|
+
reloadProduct,
|
|
3806
|
+
createProduct,
|
|
3807
|
+
updateProduct,
|
|
3808
|
+
archiveProduct,
|
|
3809
|
+
restoreProduct,
|
|
3810
|
+
catalogueVersion,
|
|
3811
|
+
refreshCatalogue
|
|
3812
|
+
}),
|
|
3813
|
+
[
|
|
3814
|
+
product,
|
|
3815
|
+
reloadProduct,
|
|
3816
|
+
createProduct,
|
|
3817
|
+
updateProduct,
|
|
3818
|
+
archiveProduct,
|
|
3819
|
+
restoreProduct,
|
|
3820
|
+
catalogueVersion,
|
|
3821
|
+
refreshCatalogue
|
|
3822
|
+
]
|
|
3823
|
+
);
|
|
3824
|
+
if (!publishChrome) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductContext.Provider, { value, children });
|
|
3825
|
+
const breadcrumb = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
3826
|
+
const items = [
|
|
3827
|
+
{
|
|
3828
|
+
name: t("billing.admin.products.title"),
|
|
3829
|
+
// Linked only when it is NOT the current page.
|
|
3830
|
+
...product ? { href: generateUrl({ page: _chunk53B6NPGAjs.Modules.StripeProduct }) } : {}
|
|
3831
|
+
}
|
|
3832
|
+
];
|
|
3833
|
+
if (product) items.push({ name: product.name });
|
|
3834
|
+
return items;
|
|
3835
|
+
}, "breadcrumb");
|
|
3836
|
+
const title = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
3837
|
+
const response = { type: t("billing.admin.products.title") };
|
|
3838
|
+
if (!product) return response;
|
|
3839
|
+
response.element = product.name;
|
|
3840
|
+
if (hasRole(_chunkJKGEJGSDjs.getRoleId.call(void 0, ).Administrator)) {
|
|
3841
|
+
response.functions = [
|
|
3842
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductArchiver, { product }, "productArchiver"),
|
|
3843
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductEditor, { product, propagateChanges: setProduct }, "productEditor")
|
|
3844
|
+
];
|
|
3845
|
+
}
|
|
3846
|
+
return response;
|
|
3847
|
+
}, "title");
|
|
3848
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductContext.Provider, { value, children }) });
|
|
3849
|
+
}, "ProductProvider");
|
|
3850
|
+
var useProductContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => _nullishCoalesce(_react.useContext.call(void 0, ProductContext), () => ( defaultContextValue2)), "useProductContext");
|
|
3783
3851
|
|
|
3852
|
+
// src/features/billing/stripe-price/components/details/PriceDetails.tsx
|
|
3784
3853
|
|
|
3785
3854
|
|
|
3786
|
-
function
|
|
3787
|
-
const
|
|
3788
|
-
const
|
|
3789
|
-
const
|
|
3790
|
-
|
|
3791
|
-
const
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
return;
|
|
3811
|
-
}
|
|
3812
|
-
setReactivatingProductId(productToReactivate.id);
|
|
3813
|
-
try {
|
|
3814
|
-
const _reactivatedProduct = await _chunkRTOC53EZjs.StripeProductService.reactivateProduct({ id: productToReactivate.id });
|
|
3815
|
-
setProductToReactivate(null);
|
|
3816
|
-
onProductsChange();
|
|
3817
|
-
} catch (_error) {
|
|
3818
|
-
} finally {
|
|
3819
|
-
setReactivatingProductId(null);
|
|
3820
|
-
}
|
|
3821
|
-
}, "handleReactivate");
|
|
3822
|
-
const toggleExpand = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (productId) => {
|
|
3823
|
-
setExpandedProductId(expandedProductId === productId ? null : productId);
|
|
3824
|
-
}, "toggleExpand");
|
|
3825
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-4", children: [
|
|
3826
|
-
products.map((product) => {
|
|
3827
|
-
const isExpanded = expandedProductId === product.id;
|
|
3828
|
-
const isArchiving = archivingProductId === product.id;
|
|
3829
|
-
const isReactivating = reactivatingProductId === product.id;
|
|
3830
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "border rounded-lg bg-white shadow-sm hover:shadow-md transition-shadow", children: [
|
|
3831
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center justify-between p-6", children: [
|
|
3832
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-4 flex-1", children: [
|
|
3833
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Package, { className: "h-6 w-6 text-primary" }),
|
|
3834
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex-1", children: [
|
|
3835
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
3836
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium", children: product.name }),
|
|
3837
|
-
product.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Badge, { variant: "softGreen", children: "Active" }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.Badge, { variant: "softGray", children: "Inactive" })
|
|
3838
|
-
] }),
|
|
3839
|
-
product.description && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-sm mt-1", children: product.description })
|
|
3855
|
+
function PriceDetails() {
|
|
3856
|
+
const t = _nextintl.useTranslations.call(void 0, );
|
|
3857
|
+
const generateUrl = _chunk5GVBUTS4js.usePageUrlGenerator.call(void 0, );
|
|
3858
|
+
const { price } = usePriceContext();
|
|
3859
|
+
if (!price) return null;
|
|
3860
|
+
const isRecurring = price.priceType === "recurring";
|
|
3861
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-8", children: [
|
|
3862
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
3863
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.SectionHeader, { children: t("billing.admin.prices.title") }),
|
|
3864
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
3865
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3866
|
+
_chunk5GVBUTS4js.DetailField,
|
|
3867
|
+
{
|
|
3868
|
+
label: t("billing.admin.prices.fields.product"),
|
|
3869
|
+
value: price.product ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Link, { href: generateUrl({ page: _chunk53B6NPGAjs.Modules.StripeProduct, id: price.product.id }), children: price.product.name }) : "\u2014"
|
|
3870
|
+
}
|
|
3871
|
+
),
|
|
3872
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3873
|
+
_chunk5GVBUTS4js.DetailField,
|
|
3874
|
+
{
|
|
3875
|
+
label: t("billing.admin.prices.fields.status"),
|
|
3876
|
+
value: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex flex-wrap items-center gap-1", children: [
|
|
3877
|
+
price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Badge, { variant: "softGreen", children: t("billing.admin.prices.status.active") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Badge, { variant: "softGray", children: t("billing.admin.prices.status.archived") }),
|
|
3878
|
+
price.isTrial && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Badge, { variant: "softBlue", children: t("billing.admin.prices.badge.trial") })
|
|
3840
3879
|
] })
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
size: "sm",
|
|
3852
|
-
onClick: () => setProductToArchive(product),
|
|
3853
|
-
disabled: isArchiving,
|
|
3854
|
-
children: [
|
|
3855
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Archive, { className: "h-4 w-4 mr-1" }),
|
|
3856
|
-
isArchiving ? "Archiving..." : "Archive"
|
|
3857
|
-
]
|
|
3858
|
-
}
|
|
3859
|
-
) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3860
|
-
_chunk7HKJNUW7js.Button,
|
|
3861
|
-
{
|
|
3862
|
-
variant: "outline",
|
|
3863
|
-
size: "sm",
|
|
3864
|
-
onClick: () => setProductToReactivate(product),
|
|
3865
|
-
disabled: isReactivating,
|
|
3866
|
-
children: [
|
|
3867
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RefreshCw, { className: "h-4 w-4 mr-1" }),
|
|
3868
|
-
isReactivating ? "Reactivating..." : "Reactivate"
|
|
3869
|
-
]
|
|
3870
|
-
}
|
|
3871
|
-
),
|
|
3872
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.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" }) })
|
|
3873
|
-
] })
|
|
3874
|
-
] }),
|
|
3875
|
-
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 }) })
|
|
3876
|
-
] }, product.id);
|
|
3877
|
-
}),
|
|
3878
|
-
editingProduct && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3879
|
-
ProductEditor,
|
|
3880
|
-
{
|
|
3881
|
-
product: editingProduct,
|
|
3882
|
-
open: !!editingProduct,
|
|
3883
|
-
onOpenChange: (open) => !open && setEditingProduct(null),
|
|
3884
|
-
onSuccess: () => {
|
|
3885
|
-
onProductsChange();
|
|
3886
|
-
setEditingProduct(null);
|
|
3887
|
-
}
|
|
3888
|
-
}
|
|
3889
|
-
),
|
|
3890
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.AlertDialog, { open: !!productToArchive, onOpenChange: (open) => !open && setProductToArchive(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.AlertDialogContent, { children: [
|
|
3891
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.AlertDialogHeader, { children: [
|
|
3892
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.AlertDialogTitle, { children: "Archive Product" }),
|
|
3893
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.AlertDialogDescription, { children: [
|
|
3894
|
-
'Are you sure you want to archive "',
|
|
3895
|
-
_optionalChain([productToArchive, 'optionalAccess', _166 => _166.name]),
|
|
3896
|
-
'"? This will deactivate it and it will no longer be available for new subscriptions.'
|
|
3897
|
-
] })
|
|
3898
|
-
] }),
|
|
3899
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.AlertDialogFooter, { children: [
|
|
3900
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.AlertDialogCancel, { disabled: !!archivingProductId, children: "Cancel" }),
|
|
3880
|
+
}
|
|
3881
|
+
),
|
|
3882
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3883
|
+
_chunk5GVBUTS4js.DetailField,
|
|
3884
|
+
{
|
|
3885
|
+
label: t("billing.admin.prices.fields.amount"),
|
|
3886
|
+
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _chunk5GVBUTS4js.formatCurrency.call(void 0, price.unitAmount, price.currency) })
|
|
3887
|
+
}
|
|
3888
|
+
),
|
|
3889
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.DetailField, { label: t("billing.admin.prices.fields.currency"), value: price.currency.toUpperCase() }),
|
|
3901
3890
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3902
|
-
|
|
3891
|
+
_chunk5GVBUTS4js.DetailField,
|
|
3892
|
+
{
|
|
3893
|
+
label: t("billing.admin.prices.fields.type"),
|
|
3894
|
+
value: isRecurring ? t("billing.admin.prices.type.recurring") : t("billing.admin.prices.type.oneTime")
|
|
3895
|
+
}
|
|
3896
|
+
),
|
|
3897
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.DetailField, { label: t("billing.admin.prices.fields.billing"), value: _chunk5GVBUTS4js.formatInterval.call(void 0, price) }),
|
|
3898
|
+
isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3899
|
+
_chunk5GVBUTS4js.DetailField,
|
|
3903
3900
|
{
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3901
|
+
label: t("billing.admin.prices.fields.intervalCount"),
|
|
3902
|
+
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _nullishCoalesce(_optionalChain([price, 'access', _157 => _157.recurring, 'optionalAccess', _158 => _158.intervalCount]), () => ( 1)) })
|
|
3903
|
+
}
|
|
3904
|
+
),
|
|
3905
|
+
isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3906
|
+
_chunk5GVBUTS4js.DetailField,
|
|
3907
|
+
{
|
|
3908
|
+
label: t("billing.admin.prices.fields.usageType"),
|
|
3909
|
+
value: _optionalChain([price, 'access', _159 => _159.recurring, 'optionalAccess', _160 => _160.usageType]) === "metered" ? t("billing.admin.prices.usage.metered") : t("billing.admin.prices.usage.licensed")
|
|
3908
3910
|
}
|
|
3909
3911
|
)
|
|
3910
3912
|
] })
|
|
3911
|
-
] })
|
|
3912
|
-
/* @__PURE__ */ _jsxruntime.
|
|
3913
|
-
/* @__PURE__ */ _jsxruntime.
|
|
3914
|
-
|
|
3915
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.AlertDialogDescription, { children: [
|
|
3916
|
-
'Are you sure you want to reactivate "',
|
|
3917
|
-
_optionalChain([productToReactivate, 'optionalAccess', _167 => _167.name]),
|
|
3918
|
-
'"? This will make it available for new subscriptions again.'
|
|
3919
|
-
] })
|
|
3920
|
-
] }),
|
|
3921
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk7HKJNUW7js.AlertDialogFooter, { children: [
|
|
3922
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk7HKJNUW7js.AlertDialogCancel, { disabled: !!reactivatingProductId, children: "Cancel" }),
|
|
3913
|
+
] }),
|
|
3914
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
3915
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.SectionHeader, { children: t("billing.admin.prices.fields.platformFeatures") }),
|
|
3916
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
3923
3917
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3924
|
-
|
|
3918
|
+
_chunk5GVBUTS4js.DetailField,
|
|
3925
3919
|
{
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3920
|
+
label: t("billing.admin.prices.fields.token"),
|
|
3921
|
+
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _nullishCoalesce(price.token, () => ( "\u2014")) })
|
|
3922
|
+
}
|
|
3923
|
+
),
|
|
3924
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3925
|
+
_chunk5GVBUTS4js.DetailField,
|
|
3926
|
+
{
|
|
3927
|
+
label: t("billing.admin.prices.fields.stripeId"),
|
|
3928
|
+
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: price.stripePriceId })
|
|
3929
|
+
}
|
|
3930
|
+
),
|
|
3931
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3932
|
+
_chunk5GVBUTS4js.DetailField,
|
|
3933
|
+
{
|
|
3934
|
+
label: t("billing.admin.prices.fields.description"),
|
|
3935
|
+
value: _nullishCoalesce(price.description, () => ( "\u2014")),
|
|
3936
|
+
className: "md:col-span-2"
|
|
3937
|
+
}
|
|
3938
|
+
),
|
|
3939
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3940
|
+
_chunk5GVBUTS4js.DetailField,
|
|
3941
|
+
{
|
|
3942
|
+
label: t("billing.admin.prices.fields.features"),
|
|
3943
|
+
className: "md:col-span-2",
|
|
3944
|
+
value: price.features && price.features.length > 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "ul", { className: "flex flex-col gap-1 text-sm", children: price.features.map((feature) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "li", { children: feature }, feature)) }) : "\u2014"
|
|
3945
|
+
}
|
|
3946
|
+
),
|
|
3947
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3948
|
+
_chunk5GVBUTS4js.DetailField,
|
|
3949
|
+
{
|
|
3950
|
+
label: t("billing.admin.prices.fields.platformFeatures"),
|
|
3951
|
+
className: "md:col-span-2",
|
|
3952
|
+
value: price.priceFeatures.length > 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "flex flex-wrap items-center gap-1", children: price.priceFeatures.map((feature) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Badge, { variant: "softGray", children: feature.name }, feature.id)) }) : "\u2014"
|
|
3930
3953
|
}
|
|
3931
3954
|
)
|
|
3932
3955
|
] })
|
|
3933
|
-
] })
|
|
3956
|
+
] })
|
|
3934
3957
|
] });
|
|
3935
3958
|
}
|
|
3936
|
-
_chunk7QVYU63Ejs.__name.call(void 0,
|
|
3959
|
+
_chunk7QVYU63Ejs.__name.call(void 0, PriceDetails, "PriceDetails");
|
|
3937
3960
|
|
|
3938
|
-
// src/features/billing/stripe-
|
|
3961
|
+
// src/features/billing/stripe-price/components/containers/PriceContainer.tsx
|
|
3939
3962
|
|
|
3940
|
-
function
|
|
3941
|
-
const {
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
}
|
|
3963
|
+
function PriceContainer() {
|
|
3964
|
+
const { price } = usePriceContext();
|
|
3965
|
+
if (!price) return null;
|
|
3966
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.RoundPageContainer, { module: _chunk53B6NPGAjs.Modules.StripePrice, id: price.id, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceDetails, {}) });
|
|
3967
|
+
}
|
|
3968
|
+
_chunk7QVYU63Ejs.__name.call(void 0, PriceContainer, "PriceContainer");
|
|
3969
|
+
|
|
3970
|
+
// src/features/billing/stripe-price/components/lists/PricesList.tsx
|
|
3971
|
+
|
|
3972
|
+
|
|
3973
|
+
|
|
3974
|
+
|
|
3975
|
+
function PricesList({ productId, fullWidth }) {
|
|
3976
|
+
const t = _nextintl.useTranslations.call(void 0, );
|
|
3977
|
+
const { priceVersion } = usePriceContext();
|
|
3978
|
+
const data = _chunk5GVBUTS4js.useDataListRetriever.call(void 0, {
|
|
3979
|
+
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunk53B6NPGAjs.StripePriceService.listPrices({ ...params, productId }), "retriever"),
|
|
3980
|
+
retrieverParams: {},
|
|
3981
|
+
module: _chunk53B6NPGAjs.Modules.StripePrice
|
|
3982
|
+
});
|
|
3960
3983
|
_react.useEffect.call(void 0, () => {
|
|
3961
|
-
|
|
3962
|
-
}, [
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3984
|
+
if (priceVersion > 0) void data.refresh();
|
|
3985
|
+
}, [priceVersion]);
|
|
3986
|
+
const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceEditor, { productId }, "create-price")];
|
|
3987
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3988
|
+
_chunk5GVBUTS4js.ContentListTable,
|
|
3989
|
+
{
|
|
3990
|
+
data,
|
|
3991
|
+
fields: [
|
|
3992
|
+
"nickname" /* nickname */,
|
|
3993
|
+
"amount" /* amount */,
|
|
3994
|
+
"interval" /* interval */,
|
|
3995
|
+
"token" /* token */,
|
|
3996
|
+
"status" /* status */
|
|
3997
|
+
],
|
|
3998
|
+
tableGeneratorType: _chunk53B6NPGAjs.Modules.StripePrice,
|
|
3999
|
+
functions,
|
|
4000
|
+
fullWidth,
|
|
4001
|
+
title: t("billing.admin.prices.title"),
|
|
4002
|
+
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4003
|
+
_chunk5GVBUTS4js.EmptyState,
|
|
4004
|
+
{
|
|
4005
|
+
icon: _lucidereact.DollarSignIcon,
|
|
4006
|
+
title: t("billing.admin.prices.empty.title"),
|
|
4007
|
+
description: t("billing.admin.prices.empty.description")
|
|
4008
|
+
}
|
|
4009
|
+
)
|
|
4010
|
+
}
|
|
4011
|
+
);
|
|
4012
|
+
}
|
|
4013
|
+
_chunk7QVYU63Ejs.__name.call(void 0, PricesList, "PricesList");
|
|
4014
|
+
|
|
4015
|
+
// src/features/billing/stripe-product/components/containers/ProductContainer.tsx
|
|
4016
|
+
|
|
4017
|
+
|
|
4018
|
+
// src/features/billing/stripe-product/components/details/ProductDetails.tsx
|
|
4019
|
+
|
|
4020
|
+
|
|
4021
|
+
function ProductDetails() {
|
|
4022
|
+
const t = _nextintl.useTranslations.call(void 0, );
|
|
4023
|
+
const { product } = useProductContext();
|
|
4024
|
+
if (!product) return null;
|
|
4025
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4026
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.SectionHeader, { children: t("billing.admin.products.tabs.details") }),
|
|
4027
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
4028
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.DetailField, { label: t("billing.admin.products.fields.name"), value: product.name }),
|
|
4029
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4030
|
+
_chunk5GVBUTS4js.DetailField,
|
|
4031
|
+
{
|
|
4032
|
+
label: t("billing.admin.products.fields.status"),
|
|
4033
|
+
value: product.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Badge, { variant: "softGreen", children: t("billing.admin.products.status.active") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.Badge, { variant: "softGray", children: t("billing.admin.products.status.archived") })
|
|
4034
|
+
}
|
|
4035
|
+
),
|
|
4036
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4037
|
+
_chunk5GVBUTS4js.DetailField,
|
|
4038
|
+
{
|
|
4039
|
+
label: t("billing.admin.products.fields.description"),
|
|
4040
|
+
value: _nullishCoalesce(product.description, () => ( "\u2014")),
|
|
4041
|
+
className: "md:col-span-2"
|
|
4042
|
+
}
|
|
4043
|
+
),
|
|
4044
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4045
|
+
_chunk5GVBUTS4js.DetailField,
|
|
4046
|
+
{
|
|
4047
|
+
label: t("billing.admin.products.fields.prices"),
|
|
4048
|
+
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: product.stripePrices.length })
|
|
4049
|
+
}
|
|
4050
|
+
),
|
|
4051
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4052
|
+
_chunk5GVBUTS4js.DetailField,
|
|
4053
|
+
{
|
|
4054
|
+
label: t("billing.admin.products.fields.stripeId"),
|
|
4055
|
+
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: product.stripeProductId })
|
|
4056
|
+
}
|
|
4057
|
+
)
|
|
3979
4058
|
] })
|
|
3980
4059
|
] });
|
|
3981
4060
|
}
|
|
3982
|
-
_chunk7QVYU63Ejs.__name.call(void 0,
|
|
4061
|
+
_chunk7QVYU63Ejs.__name.call(void 0, ProductDetails, "ProductDetails");
|
|
3983
4062
|
|
|
3984
|
-
// src/features/billing/stripe-product/components/containers/
|
|
4063
|
+
// src/features/billing/stripe-product/components/containers/ProductContainer.tsx
|
|
3985
4064
|
|
|
3986
|
-
function
|
|
3987
|
-
|
|
4065
|
+
function ProductContainer() {
|
|
4066
|
+
const t = _nextintl.useTranslations.call(void 0, );
|
|
4067
|
+
const { product } = useProductContext();
|
|
4068
|
+
if (!product) return null;
|
|
4069
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4070
|
+
_chunk5GVBUTS4js.RoundPageContainer,
|
|
4071
|
+
{
|
|
4072
|
+
module: _chunk53B6NPGAjs.Modules.StripeProduct,
|
|
4073
|
+
id: product.id,
|
|
4074
|
+
tabs: [
|
|
4075
|
+
{
|
|
4076
|
+
sectionKey: "details",
|
|
4077
|
+
label: t("billing.admin.products.tabs.details"),
|
|
4078
|
+
content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductDetails, {})
|
|
4079
|
+
},
|
|
4080
|
+
{
|
|
4081
|
+
key: _chunk53B6NPGAjs.Modules.StripePrice,
|
|
4082
|
+
label: t("billing.admin.prices.title"),
|
|
4083
|
+
// publishChrome={false}: SharedProvider REPLACES its value for the
|
|
4084
|
+
// subtree (SharedContext.tsx:35-37), so a nested provider publishing
|
|
4085
|
+
// chrome here would blank this page's own title.
|
|
4086
|
+
// No `fillHeight` and no `fullWidth` on the list: a ContentListTable in
|
|
4087
|
+
// a tab keeps its own bordered card and flows with the panel, exactly
|
|
4088
|
+
// as ThreatList does inside GoalContainer.
|
|
4089
|
+
content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceProvider, { productId: product.id, publishChrome: false, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PricesList, { productId: product.id }) })
|
|
4090
|
+
}
|
|
4091
|
+
]
|
|
4092
|
+
}
|
|
4093
|
+
);
|
|
3988
4094
|
}
|
|
3989
|
-
_chunk7QVYU63Ejs.__name.call(void 0,
|
|
4095
|
+
_chunk7QVYU63Ejs.__name.call(void 0, ProductContainer, "ProductContainer");
|
|
4096
|
+
|
|
4097
|
+
// src/features/billing/stripe-product/components/lists/ProductsList.tsx
|
|
4098
|
+
|
|
4099
|
+
|
|
4100
|
+
|
|
4101
|
+
|
|
4102
|
+
function ProductsList({ fullWidth } = {}) {
|
|
4103
|
+
const t = _nextintl.useTranslations.call(void 0, );
|
|
4104
|
+
const { catalogueVersion } = useProductContext();
|
|
4105
|
+
const data = _chunk5GVBUTS4js.useDataListRetriever.call(void 0, {
|
|
4106
|
+
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunk53B6NPGAjs.StripeProductService.listProducts(params), "retriever"),
|
|
4107
|
+
retrieverParams: {},
|
|
4108
|
+
module: _chunk53B6NPGAjs.Modules.StripeProduct
|
|
4109
|
+
});
|
|
4110
|
+
_react.useEffect.call(void 0, () => {
|
|
4111
|
+
if (catalogueVersion > 0) void data.refresh();
|
|
4112
|
+
}, [catalogueVersion]);
|
|
4113
|
+
const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductEditor, {}, "create-product")];
|
|
4114
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4115
|
+
_chunk5GVBUTS4js.ContentListTable,
|
|
4116
|
+
{
|
|
4117
|
+
data,
|
|
4118
|
+
fields: ["name" /* name */, "status" /* status */, "prices" /* prices */],
|
|
4119
|
+
tableGeneratorType: _chunk53B6NPGAjs.Modules.StripeProduct,
|
|
4120
|
+
functions,
|
|
4121
|
+
fullWidth,
|
|
4122
|
+
title: t("billing.admin.products.title"),
|
|
4123
|
+
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4124
|
+
_chunk5GVBUTS4js.EmptyState,
|
|
4125
|
+
{
|
|
4126
|
+
icon: _lucidereact.PackageIcon,
|
|
4127
|
+
title: t("billing.admin.products.empty.title"),
|
|
4128
|
+
description: t("billing.admin.products.empty.description")
|
|
4129
|
+
}
|
|
4130
|
+
)
|
|
4131
|
+
}
|
|
4132
|
+
);
|
|
4133
|
+
}
|
|
4134
|
+
_chunk7QVYU63Ejs.__name.call(void 0, ProductsList, "ProductsList");
|
|
4135
|
+
|
|
4136
|
+
// src/features/billing/stripe-product/components/containers/ProductsListContainer.tsx
|
|
4137
|
+
|
|
4138
|
+
function ProductsListContainer() {
|
|
4139
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductProvider, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5GVBUTS4js.RoundPageContainer, { module: _chunk53B6NPGAjs.Modules.StripeProduct, fullWidth: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductsList, { fullWidth: true }) }) });
|
|
4140
|
+
}
|
|
4141
|
+
_chunk7QVYU63Ejs.__name.call(void 0, ProductsListContainer, "ProductsListContainer");
|
|
4142
|
+
|
|
4143
|
+
|
|
4144
|
+
|
|
4145
|
+
|
|
4146
|
+
|
|
4147
|
+
|
|
4148
|
+
|
|
3990
4149
|
|
|
3991
4150
|
|
|
3992
4151
|
|
|
@@ -4035,5 +4194,5 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductsAdminPageContainer, "ProductsAdminP
|
|
|
4035
4194
|
|
|
4036
4195
|
|
|
4037
4196
|
|
|
4038
|
-
exports.BillingAlertBanner = BillingAlertBanner; exports.BillingDashboardContainer = BillingDashboardContainer; exports.BillingDetailModal = BillingDetailModal; exports.
|
|
4197
|
+
exports.BillingAlertBanner = BillingAlertBanner; exports.BillingDashboardContainer = BillingDashboardContainer; exports.BillingDetailModal = BillingDetailModal; exports.BillingUsageSummaryCard = BillingUsageSummaryCard; exports.CancelSubscriptionDialog = CancelSubscriptionDialog; exports.CustomerInfoCard = CustomerInfoCard; exports.IntervalToggle = IntervalToggle; exports.InvoiceDetails = InvoiceDetails; exports.InvoiceStatusBadge = InvoiceStatusBadge; exports.InvoicesContainer = InvoicesContainer; exports.InvoicesList = InvoicesList; exports.InvoicesSummaryCard = InvoicesSummaryCard; exports.PaymentMethodCard = PaymentMethodCard; exports.PaymentMethodEditor = PaymentMethodEditor; exports.PaymentMethodForm = PaymentMethodForm; exports.PaymentMethodSummaryCard = PaymentMethodSummaryCard; exports.PaymentMethodsContainer = PaymentMethodsContainer; exports.PaymentMethodsList = PaymentMethodsList; exports.PriceArchiver = PriceArchiver; exports.PriceContainer = PriceContainer; exports.PriceDetails = PriceDetails; exports.PriceEditor = PriceEditor; exports.PriceProvider = PriceProvider; exports.PricesList = PricesList; exports.PricingCard = PricingCard; exports.ProductArchiver = ProductArchiver; exports.ProductContainer = ProductContainer; exports.ProductDetails = ProductDetails; exports.ProductEditor = ProductEditor; exports.ProductPricingList = ProductPricingList; exports.ProductPricingRow = ProductPricingRow; exports.ProductProvider = ProductProvider; exports.ProductsList = ProductsList; exports.ProductsListContainer = ProductsListContainer; exports.PromoCodeInput = PromoCodeInput; exports.ProrationPreview = ProrationPreview; exports.StripeProvider = StripeProvider; exports.SubscriptionConfirmation = SubscriptionConfirmation; exports.SubscriptionDetails = SubscriptionDetails; exports.SubscriptionStatusBadge = SubscriptionStatusBadge; exports.SubscriptionSummaryCard = SubscriptionSummaryCard; exports.SubscriptionsContainer = SubscriptionsContainer; exports.SubscriptionsList = SubscriptionsList; exports.UsageContainer = UsageContainer; exports.UsageHistoryTable = UsageHistoryTable; exports.UsageSummaryCard = UsageSummaryCard; exports.UsageSummaryCards = UsageSummaryCards; exports.formatCurrency = _chunk5GVBUTS4js.formatCurrency; exports.formatDate = formatDate3; exports.formatInterval = _chunk5GVBUTS4js.formatInterval; exports.isStripeConfigured = isStripeConfigured; exports.priceLabel = priceLabel; exports.usePriceContext = usePriceContext; exports.useProductContext = useProductContext;
|
|
4039
4198
|
//# sourceMappingURL=index.js.map
|