@carlonicora/nextjs-jsonapi 1.24.1 → 1.24.3
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-UCHRVVVZ.js → BlockNoteEditor-OFSTXGZX.js} +6 -6
- package/dist/{BlockNoteEditor-UCHRVVVZ.js.map → BlockNoteEditor-OFSTXGZX.js.map} +1 -1
- package/dist/{BlockNoteEditor-ZYZZ6B45.mjs → BlockNoteEditor-TJNLCNIP.mjs} +2 -2
- package/dist/billing/index.js +300 -303
- package/dist/billing/index.js.map +1 -1
- package/dist/billing/index.mjs +5 -8
- package/dist/billing/index.mjs.map +1 -1
- package/dist/{chunk-ILKUML3Z.js → chunk-EJALOG7L.js} +4002 -3923
- package/dist/chunk-EJALOG7L.js.map +1 -0
- package/dist/{chunk-CU4RXSNY.mjs → chunk-H5JZ5E7M.mjs} +4336 -4257
- package/dist/chunk-H5JZ5E7M.mjs.map +1 -0
- package/dist/client/index.js +2 -2
- package/dist/client/index.mjs +1 -1
- package/dist/components/index.d.mts +69 -34
- package/dist/components/index.d.ts +69 -34
- package/dist/components/index.js +20 -2
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +35 -17
- package/dist/contexts/index.js +2 -2
- package/dist/contexts/index.mjs +1 -1
- package/dist/scripts/generate-web-module/templates/components/editor.template.js +11 -13
- package/dist/scripts/generate-web-module/templates/components/editor.template.js.map +1 -1
- package/dist/scripts/generate-web-module/templates/components/multi-selector.template.d.ts.map +1 -1
- package/dist/scripts/generate-web-module/templates/components/multi-selector.template.js +13 -26
- package/dist/scripts/generate-web-module/templates/components/multi-selector.template.js.map +1 -1
- package/dist/scripts/generate-web-module/templates/components/selector.template.d.ts.map +1 -1
- package/dist/scripts/generate-web-module/templates/components/selector.template.js +59 -76
- package/dist/scripts/generate-web-module/templates/components/selector.template.js.map +1 -1
- package/dist/scripts/generate-web-module/transformers/field-mapper.d.ts.map +1 -1
- package/dist/scripts/generate-web-module/transformers/field-mapper.js +10 -12
- package/dist/scripts/generate-web-module/transformers/field-mapper.js.map +1 -1
- package/package.json +2 -2
- package/scripts/generate-web-module/templates/components/editor.template.ts +11 -13
- package/scripts/generate-web-module/templates/components/multi-selector.template.ts +13 -26
- package/scripts/generate-web-module/templates/components/selector.template.ts +59 -76
- package/scripts/generate-web-module/transformers/field-mapper.ts +10 -12
- package/src/components/forms/FormCheckbox.tsx +18 -24
- package/src/components/forms/FormDate.tsx +103 -116
- package/src/components/forms/FormDateTime.tsx +122 -130
- package/src/components/forms/FormFieldWrapper.tsx +54 -0
- package/src/components/forms/FormInput.tsx +58 -46
- package/src/components/forms/FormPassword.tsx +17 -24
- package/src/components/forms/FormPlaceAutocomplete.tsx +50 -75
- package/src/components/forms/FormSelect.tsx +29 -35
- package/src/components/forms/FormSlider.tsx +23 -27
- package/src/components/forms/FormSwitch.tsx +12 -14
- package/src/components/forms/FormTextarea.tsx +12 -19
- package/src/components/forms/__tests__/FormInput.test.tsx +4 -2
- package/src/components/forms/index.ts +1 -1
- package/src/components/pages/PageContentContainer.tsx +2 -1
- package/src/features/billing/stripe-price/components/forms/PriceEditor.tsx +9 -13
- package/src/features/company/components/forms/CompanyConfigurationSecurityForm.tsx +19 -33
- package/src/features/feature/components/forms/FormFeatures.tsx +3 -4
- package/src/features/role/components/forms/FormRoles.tsx +40 -51
- package/src/features/user/components/forms/UserMultiSelect.tsx +12 -29
- package/src/features/user/components/forms/UserSelector.tsx +79 -91
- package/src/hooks/__tests__/useDataListRetriever.test.ts +10 -1
- package/src/shadcnui/index.ts +2 -0
- package/src/shadcnui/ui/field.tsx +3 -3
- package/src/shadcnui/ui/form.tsx +17 -134
- package/src/shadcnui/ui/input-group.tsx +4 -4
- package/src/shadcnui/ui/resizable.tsx +8 -8
- package/dist/chunk-CU4RXSNY.mjs.map +0 -1
- package/dist/chunk-ILKUML3Z.js.map +0 -1
- package/src/components/forms/FormContainerGeneric.tsx +0 -39
- /package/dist/{BlockNoteEditor-ZYZZ6B45.mjs.map → BlockNoteEditor-TJNLCNIP.mjs.map} +0 -0
package/dist/billing/index.js
CHANGED
|
@@ -48,10 +48,7 @@
|
|
|
48
48
|
|
|
49
49
|
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
var _chunkILKUML3Zjs = require('../chunk-ILKUML3Z.js');
|
|
51
|
+
var _chunkEJALOG7Ljs = require('../chunk-EJALOG7L.js');
|
|
55
52
|
|
|
56
53
|
|
|
57
54
|
|
|
@@ -124,41 +121,41 @@ function SubscriptionSummaryCard({
|
|
|
124
121
|
onManageClick
|
|
125
122
|
}) {
|
|
126
123
|
if (loading) {
|
|
127
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
128
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
129
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
124
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.Card, { children: [
|
|
125
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
126
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.CardTitle, { className: "text-sm font-medium", children: "Subscriptions" }),
|
|
130
127
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
131
128
|
] }),
|
|
132
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
133
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
134
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
135
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
129
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.CardContent, { children: [
|
|
130
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
131
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Skeleton, { className: "h-4 w-24 mb-1" }),
|
|
132
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Skeleton, { className: "h-4 w-40" })
|
|
136
133
|
] })
|
|
137
134
|
] });
|
|
138
135
|
}
|
|
139
136
|
if (error) {
|
|
140
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
141
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
142
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
137
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.Card, { children: [
|
|
138
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
139
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.CardTitle, { className: "text-sm font-medium", children: "Subscriptions" }),
|
|
143
140
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
144
141
|
] }),
|
|
145
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
142
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-destructive", children: error }) })
|
|
146
143
|
] });
|
|
147
144
|
}
|
|
148
145
|
const activeSubscriptions = subscriptions.filter(
|
|
149
146
|
(sub) => sub.status === "active" /* ACTIVE */ || sub.status === "trialing" /* TRIALING */
|
|
150
147
|
);
|
|
151
148
|
const primarySubscription = activeSubscriptions[0];
|
|
152
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
153
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
154
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
149
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
|
|
150
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
151
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.CardTitle, { className: "text-sm font-medium", children: "Subscriptions" }),
|
|
155
152
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
156
153
|
] }),
|
|
157
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
154
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.CardContent, { children: subscriptions.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
158
155
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No active plan" }),
|
|
159
156
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Subscribe to get started" }),
|
|
160
157
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
161
|
-
|
|
158
|
+
_chunkEJALOG7Ljs.Button,
|
|
162
159
|
{
|
|
163
160
|
variant: "outline",
|
|
164
161
|
size: "sm",
|
|
@@ -176,7 +173,7 @@ function SubscriptionSummaryCard({
|
|
|
176
173
|
] }) : primarySubscription ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
177
174
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
178
175
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: formatPlanName(primarySubscription) }),
|
|
179
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
176
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Badge, { variant: primarySubscription.cancelAtPeriodEnd ? "secondary" : getStatusBadgeVariant(primarySubscription.status), children: primarySubscription.cancelAtPeriodEnd ? "Canceling" : primarySubscription.status })
|
|
180
177
|
] }),
|
|
181
178
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm text-muted-foreground", children: [
|
|
182
179
|
formatPrice(_optionalChain([primarySubscription, 'access', _10 => _10.price, 'optionalAccess', _11 => _11.unitAmount]), _optionalChain([primarySubscription, 'access', _12 => _12.price, 'optionalAccess', _13 => _13.currency])),
|
|
@@ -220,36 +217,36 @@ function PaymentMethodSummaryCard({
|
|
|
220
217
|
onManageClick
|
|
221
218
|
}) {
|
|
222
219
|
if (loading) {
|
|
223
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
224
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
225
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
220
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.Card, { children: [
|
|
221
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
222
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.CardTitle, { className: "text-sm font-medium", children: "Payment Method" }),
|
|
226
223
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
227
224
|
] }),
|
|
228
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
229
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
230
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
225
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.CardContent, { children: [
|
|
226
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
227
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Skeleton, { className: "h-4 w-24" })
|
|
231
228
|
] })
|
|
232
229
|
] });
|
|
233
230
|
}
|
|
234
231
|
if (error) {
|
|
235
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
236
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
237
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
232
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.Card, { children: [
|
|
233
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
234
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.CardTitle, { className: "text-sm font-medium", children: "Payment Method" }),
|
|
238
235
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
239
236
|
] }),
|
|
240
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
237
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-destructive", children: error }) })
|
|
241
238
|
] });
|
|
242
239
|
}
|
|
243
240
|
const defaultMethod = paymentMethods.find((pm) => pm.id === defaultPaymentMethodId) || paymentMethods[0];
|
|
244
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
245
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
246
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
241
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
|
|
242
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
243
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.CardTitle, { className: "text-sm font-medium", children: "Payment Method" }),
|
|
247
244
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
248
245
|
] }),
|
|
249
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
246
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.CardContent, { children: paymentMethods.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
250
247
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No payment method" }),
|
|
251
248
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Add a card to enable subscriptions" }),
|
|
252
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
249
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.Button, { variant: "outline", size: "sm", className: "mt-2", onClick: (e) => {
|
|
253
250
|
e.stopPropagation();
|
|
254
251
|
onManageClick();
|
|
255
252
|
}, children: [
|
|
@@ -314,52 +311,52 @@ function CustomerInfoCard({ customer, loading, error }) {
|
|
|
314
311
|
}
|
|
315
312
|
}, "handlePortalClick");
|
|
316
313
|
if (loading) {
|
|
317
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
318
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
319
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
314
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.Card, { children: [
|
|
315
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
316
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.CardTitle, { className: "text-sm font-medium", children: "Billing Account" }),
|
|
320
317
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
321
318
|
] }),
|
|
322
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
323
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
324
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
325
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
319
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.CardContent, { children: [
|
|
320
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
321
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Skeleton, { className: "h-4 w-48 mb-1" }),
|
|
322
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Skeleton, { className: "h-4 w-24" })
|
|
326
323
|
] })
|
|
327
324
|
] });
|
|
328
325
|
}
|
|
329
326
|
if (error) {
|
|
330
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
331
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
332
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
327
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.Card, { children: [
|
|
328
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
329
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.CardTitle, { className: "text-sm font-medium", children: "Billing Account" }),
|
|
333
330
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
334
331
|
] }),
|
|
335
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
332
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-destructive", children: error }) })
|
|
336
333
|
] });
|
|
337
334
|
}
|
|
338
335
|
if (!customer) {
|
|
339
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
340
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
341
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
336
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.Card, { children: [
|
|
337
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
338
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.CardTitle, { className: "text-sm font-medium", children: "Billing Account" }),
|
|
342
339
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
343
340
|
] }),
|
|
344
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
341
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.CardContent, { children: [
|
|
345
342
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "Not set up" }),
|
|
346
343
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Billing account will be created when you subscribe" })
|
|
347
344
|
] })
|
|
348
345
|
] });
|
|
349
346
|
}
|
|
350
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
351
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
352
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
347
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.Card, { children: [
|
|
348
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
349
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.CardTitle, { className: "text-sm font-medium", children: "Billing Account" }),
|
|
353
350
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
354
351
|
] }),
|
|
355
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
352
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
356
353
|
customer.name && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: customer.name }),
|
|
357
354
|
customer.email && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: customer.email }),
|
|
358
355
|
customer.balance !== void 0 && customer.balance !== 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm", children: [
|
|
359
356
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground", children: "Credit Balance: " }),
|
|
360
357
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: customer.balance < 0 ? "text-green-600" : "text-destructive", children: formatBalance(customer.balance, customer.currency) })
|
|
361
358
|
] }),
|
|
362
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
359
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.Button, { variant: "outline", size: "sm", className: "mt-2", onClick: handlePortalClick, disabled: portalLoading, children: [
|
|
363
360
|
portalLoading ? "Loading..." : "Manage in Stripe Portal",
|
|
364
361
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ExternalLink, { className: "h-4 w-4 ml-1" })
|
|
365
362
|
] })
|
|
@@ -403,42 +400,42 @@ function formatAmount(amount, currency) {
|
|
|
403
400
|
_chunk7QVYU63Ejs.__name.call(void 0, formatAmount, "formatAmount");
|
|
404
401
|
function InvoicesSummaryCard({ invoices, loading, error, onViewAllClick }) {
|
|
405
402
|
if (loading) {
|
|
406
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
407
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
408
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
403
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.Card, { children: [
|
|
404
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
405
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.CardTitle, { className: "text-sm font-medium", children: "Recent Invoices" }),
|
|
409
406
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
410
407
|
] }),
|
|
411
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
412
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
413
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
414
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
408
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.CardContent, { children: [
|
|
409
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Skeleton, { className: "h-6 w-24 mb-2" }),
|
|
410
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Skeleton, { className: "h-4 w-32 mb-1" }),
|
|
411
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Skeleton, { className: "h-4 w-20" })
|
|
415
412
|
] })
|
|
416
413
|
] });
|
|
417
414
|
}
|
|
418
415
|
if (error) {
|
|
419
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
420
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
421
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
416
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.Card, { children: [
|
|
417
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
418
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.CardTitle, { className: "text-sm font-medium", children: "Recent Invoices" }),
|
|
422
419
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
423
420
|
] }),
|
|
424
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
421
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-destructive", children: error }) })
|
|
425
422
|
] });
|
|
426
423
|
}
|
|
427
424
|
const latestInvoice = invoices[0];
|
|
428
425
|
const paidInvoices = invoices.filter((inv) => inv.status === "paid" /* PAID */);
|
|
429
426
|
const openInvoices = invoices.filter((inv) => inv.status === "open" /* OPEN */);
|
|
430
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
431
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
432
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
427
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewAllClick, children: [
|
|
428
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
429
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.CardTitle, { className: "text-sm font-medium", children: "Recent Invoices" }),
|
|
433
430
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
434
431
|
] }),
|
|
435
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
432
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.CardContent, { children: invoices.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
436
433
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No invoices yet" }),
|
|
437
434
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Invoices will appear after your first billing cycle" })
|
|
438
435
|
] }) : latestInvoice ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
439
436
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
440
437
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: formatAmount(latestInvoice.total, latestInvoice.currency) }),
|
|
441
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
438
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Badge, { variant: getStatusBadgeVariant2(latestInvoice.status), children: latestInvoice.status })
|
|
442
439
|
] }),
|
|
443
440
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: latestInvoice.stripeInvoiceNumber || `Invoice from ${formatDate2(latestInvoice.periodStart)}` }),
|
|
444
441
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-4 text-xs text-muted-foreground", children: [
|
|
@@ -478,24 +475,24 @@ function BillingUsageSummaryCard({
|
|
|
478
475
|
onViewDetailsClick
|
|
479
476
|
}) {
|
|
480
477
|
if (loading) {
|
|
481
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
482
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
483
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
478
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.Card, { children: [
|
|
479
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
480
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.CardTitle, { className: "text-sm font-medium", children: "Usage This Month" }),
|
|
484
481
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
485
482
|
] }),
|
|
486
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
487
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
488
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
483
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.CardContent, { children: [
|
|
484
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Skeleton, { className: "h-6 w-24 mb-2" }),
|
|
485
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Skeleton, { className: "h-4 w-32" })
|
|
489
486
|
] })
|
|
490
487
|
] });
|
|
491
488
|
}
|
|
492
489
|
if (error) {
|
|
493
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
494
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
495
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
490
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.Card, { children: [
|
|
491
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
492
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.CardTitle, { className: "text-sm font-medium", children: "Usage This Month" }),
|
|
496
493
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
497
494
|
] }),
|
|
498
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
495
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-destructive", children: error }) })
|
|
499
496
|
] });
|
|
500
497
|
}
|
|
501
498
|
const totalUsage = Object.values(summaries).reduce((acc, summary) => {
|
|
@@ -503,12 +500,12 @@ function BillingUsageSummaryCard({
|
|
|
503
500
|
}, 0);
|
|
504
501
|
const primaryMeter = meters.find((m) => _optionalChain([summaries, 'access', _23 => _23[m.id], 'optionalAccess', _24 => _24.aggregatedValue]));
|
|
505
502
|
const primarySummary = primaryMeter ? summaries[primaryMeter.id] : null;
|
|
506
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
507
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
508
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
503
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewDetailsClick, children: [
|
|
504
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
505
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.CardTitle, { className: "text-sm font-medium", children: "Usage This Month" }),
|
|
509
506
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
510
507
|
] }),
|
|
511
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
508
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.CardContent, { children: meters.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
512
509
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No meters" }),
|
|
513
510
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "No usage meters are configured" })
|
|
514
511
|
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
@@ -612,10 +609,10 @@ function PaymentMethodEditor({ open, onOpenChange, onSuccess }) {
|
|
|
612
609
|
setIsSubmitting(false);
|
|
613
610
|
}
|
|
614
611
|
}, "handleSubmit");
|
|
615
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
616
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
617
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
618
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
612
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.DialogContent, { className: "max-w-md", children: [
|
|
613
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.DialogHeader, { children: [
|
|
614
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.DialogTitle, { children: "Add Payment Method" }),
|
|
615
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.DialogDescription, { children: "Add a new payment method to your account. Your card information is securely processed by Stripe." })
|
|
619
616
|
] }),
|
|
620
617
|
loading && /* @__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..." }) }),
|
|
621
618
|
!loading && setupIntent && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: handleSubmit, className: "flex flex-col gap-y-4", children: [
|
|
@@ -640,22 +637,22 @@ function PaymentMethodEditor({ open, onOpenChange, onSuccess }) {
|
|
|
640
637
|
) }),
|
|
641
638
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
642
639
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
643
|
-
|
|
640
|
+
_chunkEJALOG7Ljs.Checkbox,
|
|
644
641
|
{
|
|
645
642
|
id: "setAsDefault",
|
|
646
643
|
checked: setAsDefault,
|
|
647
644
|
onCheckedChange: (checked) => setSetAsDefault(!!checked)
|
|
648
645
|
}
|
|
649
646
|
),
|
|
650
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
647
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Label, { htmlFor: "setAsDefault", className: "text-sm font-normal", children: "Set as default payment method" })
|
|
651
648
|
] }),
|
|
652
|
-
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
649
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.AlertDescription, { children: error }) }),
|
|
653
650
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-x-2", children: [
|
|
654
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
655
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
651
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Button, { type: "button", variant: "outline", onClick: () => onOpenChange(false), disabled: isSubmitting, children: "Cancel" }),
|
|
652
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Button, { type: "submit", disabled: !stripe || isSubmitting, children: isSubmitting ? "Processing..." : "Add Card" })
|
|
656
653
|
] })
|
|
657
654
|
] }),
|
|
658
|
-
!loading && !setupIntent && error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
655
|
+
!loading && !setupIntent && error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.AlertDescription, { children: error }) })
|
|
659
656
|
] }) });
|
|
660
657
|
}
|
|
661
658
|
_chunk7QVYU63Ejs.__name.call(void 0, PaymentMethodEditor, "PaymentMethodEditor");
|
|
@@ -714,22 +711,22 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
714
711
|
}
|
|
715
712
|
}, "handleRemove");
|
|
716
713
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
717
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
718
|
-
isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
719
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
714
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.Card, { className: "relative", children: [
|
|
715
|
+
isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Badge, { className: "absolute right-2 top-2 bg-green-100 text-green-800 hover:bg-green-100", children: "Default" }),
|
|
716
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.CardHeader, { className: "flex flex-row items-center justify-between pb-2", children: [
|
|
720
717
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
721
718
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-2xl", children: brandIcon }),
|
|
722
719
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium capitalize", children: brand })
|
|
723
720
|
] }),
|
|
724
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
725
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
726
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
727
|
-
!isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
728
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
721
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.DropdownMenu, { children: [
|
|
722
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.DropdownMenuTrigger, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Button, { render: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {}), nativeButton: false, variant: "ghost", size: "sm", disabled: loading, className: "h-8 w-8 p-0", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.MoreVertical, { className: "h-4 w-4" }) }) }),
|
|
723
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.DropdownMenuContent, { align: "end", children: [
|
|
724
|
+
!isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.DropdownMenuItem, { onClick: handleSetDefault, disabled: loading, children: "Set as Default" }),
|
|
725
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.DropdownMenuItem, { onClick: () => setShowRemoveDialog(true), disabled: loading, className: "text-red-600", children: "Remove" })
|
|
729
726
|
] })
|
|
730
727
|
] })
|
|
731
728
|
] }),
|
|
732
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
729
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-1", children: [
|
|
733
730
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-lg font-semibold", children: [
|
|
734
731
|
"\u2022\u2022\u2022\u2022 ",
|
|
735
732
|
last4
|
|
@@ -742,17 +739,17 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
742
739
|
] })
|
|
743
740
|
] }) })
|
|
744
741
|
] }),
|
|
745
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
746
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
747
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
748
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
742
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.AlertDialog, { open: showRemoveDialog, onOpenChange: setShowRemoveDialog, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.AlertDialogContent, { children: [
|
|
743
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.AlertDialogHeader, { children: [
|
|
744
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.AlertDialogTitle, { children: "Remove Payment Method" }),
|
|
745
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.AlertDialogDescription, { children: [
|
|
749
746
|
"Are you sure you want to remove this payment method? This action cannot be undone.",
|
|
750
747
|
isDefault && " This is your default payment method."
|
|
751
748
|
] })
|
|
752
749
|
] }),
|
|
753
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
754
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
755
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
750
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.AlertDialogFooter, { children: [
|
|
751
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.AlertDialogCancel, { disabled: loading, children: "Cancel" }),
|
|
752
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.AlertDialogAction, { onClick: handleRemove, disabled: loading, className: "bg-red-600 hover:bg-red-700", children: loading ? "Removing..." : "Remove" })
|
|
756
753
|
] })
|
|
757
754
|
] }) })
|
|
758
755
|
] });
|
|
@@ -795,14 +792,14 @@ function PaymentMethodsContainer() {
|
|
|
795
792
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8" }),
|
|
796
793
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-3xl font-bold", children: "Payment Methods" })
|
|
797
794
|
] }),
|
|
798
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
795
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Button, { onClick: () => setShowAddPaymentMethod(true), children: "Add Payment Method" })
|
|
799
796
|
] }),
|
|
800
797
|
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: [
|
|
801
798
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-16 w-16 text-muted-foreground" }),
|
|
802
799
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
803
800
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "mb-2 text-xl font-semibold", children: "No payment methods" }),
|
|
804
801
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mb-4 text-muted-foreground", children: "Add a payment method to enable subscriptions and secure checkout." }),
|
|
805
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
802
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Button, { onClick: () => setShowAddPaymentMethod(true), children: "Add Your First Card" })
|
|
806
803
|
] })
|
|
807
804
|
] }),
|
|
808
805
|
paymentMethods.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodsList, { paymentMethods, onUpdate: loadPaymentMethods }),
|
|
@@ -926,13 +923,13 @@ function InvoiceDetails({ invoice, open, onOpenChange, onInvoiceChange }) {
|
|
|
926
923
|
return invoice.stripeInvoiceId.slice(-8);
|
|
927
924
|
}, "getInvoiceNumber");
|
|
928
925
|
const productName = _optionalChain([invoice, 'access', _35 => _35.subscription, 'optionalAccess', _36 => _36.price, 'optionalAccess', _37 => _37.product, 'optionalAccess', _38 => _38.name]) || "Subscription";
|
|
929
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
930
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
931
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
926
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.DialogContent, { className: "max-w-2xl", children: [
|
|
927
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.DialogHeader, { children: [
|
|
928
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.DialogTitle, { children: [
|
|
932
929
|
"Invoice ",
|
|
933
930
|
getInvoiceNumber()
|
|
934
931
|
] }),
|
|
935
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
932
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.DialogDescription, { children: formatDate3(invoice.periodStart) })
|
|
936
933
|
] }),
|
|
937
934
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
938
935
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
@@ -997,15 +994,15 @@ function InvoiceDetails({ invoice, open, onOpenChange, onInvoiceChange }) {
|
|
|
997
994
|
] })
|
|
998
995
|
] }),
|
|
999
996
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2 pt-4 border-t", children: [
|
|
1000
|
-
invoice.stripePdfUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
997
|
+
invoice.stripePdfUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.Button, { variant: "outline", onClick: handleDownloadPDF, children: [
|
|
1001
998
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Download, { className: "mr-2 h-4 w-4" }),
|
|
1002
999
|
"Download PDF"
|
|
1003
1000
|
] }),
|
|
1004
|
-
invoice.status === "open" /* OPEN */ && invoice.attempted && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1001
|
+
invoice.status === "open" /* OPEN */ && invoice.attempted && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.Button, { variant: "default", onClick: handleRetryPayment, children: [
|
|
1005
1002
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RefreshCw, { className: "mr-2 h-4 w-4" }),
|
|
1006
1003
|
"Retry Payment"
|
|
1007
1004
|
] }),
|
|
1008
|
-
invoice.stripeHostedInvoiceUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1005
|
+
invoice.stripeHostedInvoiceUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.Button, { variant: "outline", onClick: handleViewInStripe, children: [
|
|
1009
1006
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ExternalLink, { className: "mr-2 h-4 w-4" }),
|
|
1010
1007
|
"View in Stripe"
|
|
1011
1008
|
] })
|
|
@@ -1029,30 +1026,30 @@ function InvoicesList({ invoices, onInvoicesChange }) {
|
|
|
1029
1026
|
return invoice.stripeInvoiceId.slice(-8);
|
|
1030
1027
|
}, "getInvoiceNumber");
|
|
1031
1028
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1032
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-hidden", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1033
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1034
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1035
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1036
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1037
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1038
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1029
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-hidden", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.Table, { children: [
|
|
1030
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.TableRow, { children: [
|
|
1031
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.TableHead, { children: "Invoice #" }),
|
|
1032
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.TableHead, { children: "Date" }),
|
|
1033
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.TableHead, { children: "Status" }),
|
|
1034
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.TableHead, { className: "text-right", children: "Amount" }),
|
|
1035
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.TableHead, { children: "Period" })
|
|
1039
1036
|
] }) }),
|
|
1040
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1037
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.TableBody, { children: invoices.map((invoice) => {
|
|
1041
1038
|
const invoiceNumber = getInvoiceNumber(invoice);
|
|
1042
1039
|
const date = formatDate3(invoice.periodStart);
|
|
1043
1040
|
const amount = formatCurrency(invoice.total, invoice.currency);
|
|
1044
1041
|
const period = `${formatDate3(invoice.periodStart)} - ${formatDate3(invoice.periodEnd)}`;
|
|
1045
1042
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1046
|
-
|
|
1043
|
+
_chunkEJALOG7Ljs.TableRow,
|
|
1047
1044
|
{
|
|
1048
1045
|
onClick: () => handleRowClick(invoice),
|
|
1049
1046
|
className: "cursor-pointer hover:bg-muted/50",
|
|
1050
1047
|
children: [
|
|
1051
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1052
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1053
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1054
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1055
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1048
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.TableCell, { className: "font-medium", children: invoiceNumber }),
|
|
1049
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.TableCell, { className: "text-muted-foreground text-sm", children: date }),
|
|
1050
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InvoiceStatusBadge, { status: invoice.status }) }),
|
|
1051
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.TableCell, { className: "text-right font-medium", children: amount }),
|
|
1052
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.TableCell, { className: "text-muted-foreground text-sm", children: period })
|
|
1056
1053
|
]
|
|
1057
1054
|
},
|
|
1058
1055
|
invoice.id
|
|
@@ -1101,12 +1098,12 @@ function InvoicesContainer() {
|
|
|
1101
1098
|
setStatusFilter(value);
|
|
1102
1099
|
}, "handleFilterChange");
|
|
1103
1100
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-4", children: [
|
|
1104
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1105
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1106
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1107
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1108
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1109
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1101
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Tabs, { value: statusFilter, onValueChange: handleFilterChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.TabsList, { children: [
|
|
1102
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.TabsTrigger, { value: "all", children: "All" }),
|
|
1103
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.TabsTrigger, { value: "paid" /* PAID */, children: "Paid" }),
|
|
1104
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.TabsTrigger, { value: "open" /* OPEN */, children: "Open" }),
|
|
1105
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.TabsTrigger, { value: "void" /* VOID */, children: "Void" }),
|
|
1106
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.TabsTrigger, { value: "uncollectible" /* UNCOLLECTIBLE */, children: "Uncollectible" })
|
|
1110
1107
|
] }) }),
|
|
1111
1108
|
loading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-center py-8 text-muted-foreground", children: "Loading invoices..." }),
|
|
1112
1109
|
!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: [
|
|
@@ -1228,20 +1225,20 @@ function CancelSubscriptionDialog({
|
|
|
1228
1225
|
}
|
|
1229
1226
|
}, "onSubmit");
|
|
1230
1227
|
const periodEndDate = formatDate3(subscription.currentPeriodEnd);
|
|
1231
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1232
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1233
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1234
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1228
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.DialogContent, { className: "max-w-md", children: [
|
|
1229
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.DialogHeader, { children: [
|
|
1230
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.DialogTitle, { children: "Cancel Subscription" }),
|
|
1231
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.DialogDescription, { children: "Are you sure you want to cancel this subscription? This action cannot be undone." })
|
|
1235
1232
|
] }),
|
|
1236
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1237
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1233
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-col gap-y-4", children: [
|
|
1234
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.FormCheckbox, { form, id: "cancelImmediately", name: "Cancel Immediately" }),
|
|
1238
1235
|
cancelImmediately ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "bg-red-50 border border-red-200 rounded-lg p-3 text-sm text-red-800", children: "Your subscription will be canceled immediately and you will lose access right away." }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-blue-50 border border-blue-200 rounded-lg p-3 text-sm text-blue-800", children: [
|
|
1239
1236
|
"Your subscription will remain active until ",
|
|
1240
1237
|
periodEndDate,
|
|
1241
1238
|
". You can continue using the service until then."
|
|
1242
1239
|
] }),
|
|
1243
1240
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1244
|
-
|
|
1241
|
+
_chunkEJALOG7Ljs.FormTextarea,
|
|
1245
1242
|
{
|
|
1246
1243
|
form,
|
|
1247
1244
|
id: "reason",
|
|
@@ -1251,8 +1248,8 @@ function CancelSubscriptionDialog({
|
|
|
1251
1248
|
}
|
|
1252
1249
|
),
|
|
1253
1250
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-x-2 justify-end pt-2", children: [
|
|
1254
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1255
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1251
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Button, { type: "button", variant: "outline", onClick: () => onOpenChange(false), disabled: isSubmitting, children: "Keep Subscription" }),
|
|
1252
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Button, { type: "submit", variant: "destructive", disabled: isSubmitting, children: isSubmitting ? "Canceling..." : "Confirm Cancellation" })
|
|
1256
1253
|
] })
|
|
1257
1254
|
] }) })
|
|
1258
1255
|
] }) });
|
|
@@ -1284,7 +1281,7 @@ function PricingCard({ price, isCurrentPlan = false, isSelected = false, isDisab
|
|
|
1284
1281
|
}
|
|
1285
1282
|
}, "handleClick");
|
|
1286
1283
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1287
|
-
|
|
1284
|
+
_chunkEJALOG7Ljs.Card,
|
|
1288
1285
|
{
|
|
1289
1286
|
role: "radio",
|
|
1290
1287
|
"aria-checked": isSelected,
|
|
@@ -1302,9 +1299,9 @@ function PricingCard({ price, isCurrentPlan = false, isSelected = false, isDisab
|
|
|
1302
1299
|
isLoading && "pointer-events-none"
|
|
1303
1300
|
),
|
|
1304
1301
|
children: [
|
|
1305
|
-
isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1306
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1307
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1302
|
+
isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Badge, { variant: "secondary", className: "absolute top-2 right-2", children: "Current" }),
|
|
1303
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.CardHeader, { className: "pb-2", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "font-semibold text-lg", children: description }) }),
|
|
1304
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.CardContent, { className: "pb-4 grow", children: [
|
|
1308
1305
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mb-4", children: [
|
|
1309
1306
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-3xl font-bold", children: formattedPrice }),
|
|
1310
1307
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground ml-1", children: interval })
|
|
@@ -1314,8 +1311,8 @@ function PricingCard({ price, isCurrentPlan = false, isSelected = false, isDisab
|
|
|
1314
1311
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-muted-foreground", children: feature })
|
|
1315
1312
|
] }, index)) })
|
|
1316
1313
|
] }),
|
|
1317
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1318
|
-
|
|
1314
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.CardFooter, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1315
|
+
_chunkEJALOG7Ljs.Button,
|
|
1319
1316
|
{
|
|
1320
1317
|
variant: isCurrentPlan ? "secondary" : isSelected ? "default" : "outline",
|
|
1321
1318
|
className: "w-full",
|
|
@@ -1369,26 +1366,26 @@ function PricingCardsGrid({
|
|
|
1369
1366
|
_chunk7QVYU63Ejs.__name.call(void 0, PricingCardsGrid, "PricingCardsGrid");
|
|
1370
1367
|
function PricingCardsGridSkeleton() {
|
|
1371
1368
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "space-y-8", children: [1, 2].map((productIndex) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-4", children: [
|
|
1372
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1373
|
-
/* @__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,
|
|
1374
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1375
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1369
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Skeleton, { className: "h-6 w-32" }),
|
|
1370
|
+
/* @__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, _chunkEJALOG7Ljs.Card, { className: "animate-pulse", children: [
|
|
1371
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.CardHeader, { className: "pb-2", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Skeleton, { className: "h-5 w-24" }) }),
|
|
1372
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.CardContent, { className: "pb-4", children: [
|
|
1376
1373
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mb-4", children: [
|
|
1377
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1378
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1374
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Skeleton, { className: "h-9 w-20 inline-block" }),
|
|
1375
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Skeleton, { className: "h-4 w-12 inline-block ml-2" })
|
|
1379
1376
|
] }),
|
|
1380
1377
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
1381
1378
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
1382
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1383
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1379
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Skeleton, { className: "h-4 w-4 rounded-full" }),
|
|
1380
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Skeleton, { className: "h-4 w-32" })
|
|
1384
1381
|
] }),
|
|
1385
1382
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
1386
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1387
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1383
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Skeleton, { className: "h-4 w-4 rounded-full" }),
|
|
1384
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Skeleton, { className: "h-4 w-28" })
|
|
1388
1385
|
] })
|
|
1389
1386
|
] })
|
|
1390
1387
|
] }),
|
|
1391
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1388
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.CardFooter, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Skeleton, { className: "h-9 w-full" }) })
|
|
1392
1389
|
] }, cardIndex)) })
|
|
1393
1390
|
] }, productIndex)) });
|
|
1394
1391
|
}
|
|
@@ -1577,16 +1574,16 @@ function SubscriptionEditor({
|
|
|
1577
1574
|
setSelectedPriceId(null);
|
|
1578
1575
|
setProrationPreview(null);
|
|
1579
1576
|
}, "handleCancel");
|
|
1580
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1581
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1582
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1583
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1577
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.DialogContent, { className: "max-w-4xl max-h-[90vh] overflow-y-auto", children: [
|
|
1578
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.DialogHeader, { children: [
|
|
1579
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.DialogTitle, { children: subscription ? "Change Plan" : "Subscribe to a Plan" }),
|
|
1580
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.DialogDescription, { children: subscription ? "Select a new plan to switch to. You'll see a proration preview before confirming." : "Choose a plan to start your subscription." })
|
|
1584
1581
|
] }),
|
|
1585
|
-
loadingPaymentMethods && !subscription ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex items-center justify-center py-8", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-muted-foreground", children: "Checking payment methods..." }) }) : !hasPaymentMethod && !subscription ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1586
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1587
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1582
|
+
loadingPaymentMethods && !subscription ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex items-center justify-center py-8", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-muted-foreground", children: "Checking payment methods..." }) }) : !hasPaymentMethod && !subscription ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.Alert, { variant: "destructive", children: [
|
|
1583
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.AlertTitle, { children: "Payment Method Required" }),
|
|
1584
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.AlertDescription, { className: "mt-2", children: [
|
|
1588
1585
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mb-4", children: paymentRequiredError ? "Your subscription could not be created because no payment method is on file." : "You need to add a payment method before you can subscribe to a plan." }),
|
|
1589
|
-
onAddPaymentMethod && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1586
|
+
onAddPaymentMethod && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Button, { onClick: onAddPaymentMethod, variant: "outline", children: "Add Payment Method" })
|
|
1590
1587
|
] })
|
|
1591
1588
|
] }) : paymentConfirmationState === "confirming" || isConfirming ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col items-center justify-center py-12 space-y-4", children: [
|
|
1592
1589
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "h-8 w-8 animate-spin text-primary" }),
|
|
@@ -1600,12 +1597,12 @@ function SubscriptionEditor({
|
|
|
1600
1597
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-medium text-green-600", children: "Payment successful!" }),
|
|
1601
1598
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: "Your subscription is now active." })
|
|
1602
1599
|
] })
|
|
1603
|
-
] }) : paymentConfirmationState === "error" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "space-y-4", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1604
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1605
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1600
|
+
] }) : paymentConfirmationState === "error" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "space-y-4", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.Alert, { variant: "destructive", children: [
|
|
1601
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.AlertTitle, { children: "Payment Failed" }),
|
|
1602
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.AlertDescription, { className: "mt-2", children: [
|
|
1606
1603
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mb-4", children: paymentError || "We couldn't process your payment. Please try again." }),
|
|
1607
1604
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1608
|
-
|
|
1605
|
+
_chunkEJALOG7Ljs.Button,
|
|
1609
1606
|
{
|
|
1610
1607
|
onClick: () => {
|
|
1611
1608
|
setPaymentConfirmationState("idle");
|
|
@@ -1634,8 +1631,8 @@ function SubscriptionEditor({
|
|
|
1634
1631
|
isEditMode && prorationPreview && !loadingProration && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-4", children: [
|
|
1635
1632
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProrationPreview, { preview: prorationPreview }),
|
|
1636
1633
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-3", children: [
|
|
1637
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1638
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1634
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Button, { variant: "outline", onClick: handleCancel, disabled: !!loadingPriceId, children: "Cancel" }),
|
|
1635
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Button, { onClick: handleConfirmPlanChange, disabled: !!loadingPriceId, children: loadingPriceId ? "Processing..." : "Confirm Plan Change" })
|
|
1639
1636
|
] })
|
|
1640
1637
|
] })
|
|
1641
1638
|
] })
|
|
@@ -1764,10 +1761,10 @@ function SubscriptionDetails({
|
|
|
1764
1761
|
const canResume = subscription.status === "paused" /* PAUSED */;
|
|
1765
1762
|
const canCancel = subscription.status === "active" /* ACTIVE */ || subscription.status === "trialing" /* TRIALING */ || subscription.status === "paused" /* PAUSED */;
|
|
1766
1763
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1767
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1768
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1769
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1770
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1764
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.DialogContent, { className: "max-w-2xl", children: [
|
|
1765
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.DialogHeader, { children: [
|
|
1766
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.DialogTitle, { children: "Subscription Details" }),
|
|
1767
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.DialogDescription, { children: "View and manage your subscription" })
|
|
1771
1768
|
] }),
|
|
1772
1769
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
1773
1770
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
@@ -1803,11 +1800,11 @@ function SubscriptionDetails({
|
|
|
1803
1800
|
"."
|
|
1804
1801
|
] }) }),
|
|
1805
1802
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2 pt-4 border-t", children: [
|
|
1806
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1807
|
-
canPause && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1808
|
-
canResume && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1809
|
-
canCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1810
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1803
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Button, { variant: "default", onClick: () => setShowEdit(true), children: "Change Plan" }),
|
|
1804
|
+
canPause && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Button, { variant: "outline", onClick: handlePause, disabled: isProcessing, children: isProcessing ? "Pausing..." : "Pause" }),
|
|
1805
|
+
canResume && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Button, { variant: "outline", onClick: handleResume, disabled: isProcessing, children: isProcessing ? "Resuming..." : "Resume" }),
|
|
1806
|
+
canCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Button, { variant: "destructive", onClick: () => setShowCancel(true), children: "Cancel" }),
|
|
1807
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Button, { variant: "outline", onClick: handleManageViaPortal, children: "Manage via Portal" })
|
|
1811
1808
|
] })
|
|
1812
1809
|
] })
|
|
1813
1810
|
] }) }),
|
|
@@ -1866,27 +1863,27 @@ function SubscriptionsList({ subscriptions, onSubscriptionsChange }) {
|
|
|
1866
1863
|
setSelectedSub(subscription);
|
|
1867
1864
|
}, "handleRowClick");
|
|
1868
1865
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1869
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-hidden", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1870
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1871
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1872
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1873
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1874
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1866
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-hidden", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.Table, { children: [
|
|
1867
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.TableRow, { children: [
|
|
1868
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.TableHead, { children: "Status" }),
|
|
1869
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.TableHead, { children: "Plan" }),
|
|
1870
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.TableHead, { children: "Period" }),
|
|
1871
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.TableHead, { className: "text-right", children: "Amount" })
|
|
1875
1872
|
] }) }),
|
|
1876
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1873
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.TableBody, { children: subscriptions.map((subscription) => {
|
|
1877
1874
|
const price = subscription.price;
|
|
1878
1875
|
const amount = _optionalChain([price, 'optionalAccess', _56 => _56.unitAmount]) ? formatCurrency(price.unitAmount, price.currency) : "N/A";
|
|
1879
1876
|
const period = `${formatDate3(subscription.currentPeriodStart)} - ${formatDate3(subscription.currentPeriodEnd)}`;
|
|
1880
1877
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1881
|
-
|
|
1878
|
+
_chunkEJALOG7Ljs.TableRow,
|
|
1882
1879
|
{
|
|
1883
1880
|
onClick: () => handleRowClick(subscription),
|
|
1884
1881
|
className: "cursor-pointer hover:bg-muted/50",
|
|
1885
1882
|
children: [
|
|
1886
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1887
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1888
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1889
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1883
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SubscriptionStatusBadge, { status: subscription.status, cancelAtPeriodEnd: subscription.cancelAtPeriodEnd }) }),
|
|
1884
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.TableCell, { className: "font-medium", children: formatPlanName3(price) }),
|
|
1885
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.TableCell, { className: "text-muted-foreground text-sm", children: period }),
|
|
1886
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.TableCell, { className: "text-right font-medium", children: amount })
|
|
1890
1887
|
]
|
|
1891
1888
|
},
|
|
1892
1889
|
subscription.id
|
|
@@ -2041,7 +2038,7 @@ function SubscriptionsContainer() {
|
|
|
2041
2038
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8" }),
|
|
2042
2039
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-3xl font-bold", children: "Subscriptions" })
|
|
2043
2040
|
] }),
|
|
2044
|
-
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2041
|
+
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Button, { onClick: () => setShowCreateSubscription(true), children: "Subscribe to a Plan" })
|
|
2045
2042
|
] }),
|
|
2046
2043
|
criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BillingAlertBanner, { subscription }, subscription.id)),
|
|
2047
2044
|
subscriptions.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
@@ -2059,12 +2056,12 @@ function SubscriptionsContainer() {
|
|
|
2059
2056
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: "Your subscription is now active." })
|
|
2060
2057
|
] })
|
|
2061
2058
|
] }),
|
|
2062
|
-
paymentConfirmationState === "error" && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2063
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2064
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2059
|
+
paymentConfirmationState === "error" && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.Alert, { variant: "destructive", children: [
|
|
2060
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.AlertTitle, { children: "Payment Failed" }),
|
|
2061
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.AlertDescription, { className: "mt-2", children: [
|
|
2065
2062
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mb-4", children: paymentError || "We couldn't process your payment. Please try again." }),
|
|
2066
2063
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2067
|
-
|
|
2064
|
+
_chunkEJALOG7Ljs.Button,
|
|
2068
2065
|
{
|
|
2069
2066
|
onClick: () => {
|
|
2070
2067
|
setPaymentConfirmationState("idle");
|
|
@@ -2158,15 +2155,15 @@ function UsageSummaryCard({ meter, summary }) {
|
|
|
2158
2155
|
const progressWidth = percentage !== null ? Math.min(percentage, 100) : 0;
|
|
2159
2156
|
const displayName = meter.displayName || meter.eventName;
|
|
2160
2157
|
const hasLimit = limit !== null && limit !== void 0;
|
|
2161
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2162
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2158
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.Card, { children: [
|
|
2159
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.CardHeader, { className: "flex flex-row items-center gap-x-3 pb-3", children: [
|
|
2163
2160
|
/* @__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" }) }),
|
|
2164
2161
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col", children: [
|
|
2165
2162
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "font-semibold", children: displayName }),
|
|
2166
2163
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-gray-500", children: meter.id })
|
|
2167
2164
|
] })
|
|
2168
2165
|
] }),
|
|
2169
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2166
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.CardContent, { className: "flex flex-col gap-y-4", children: [
|
|
2170
2167
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
2171
2168
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-3xl font-bold", children: currentUsage.toLocaleString() }),
|
|
2172
2169
|
hasLimit && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm text-gray-500", children: [
|
|
@@ -2294,21 +2291,21 @@ function UsageHistoryTable({ usageRecords }) {
|
|
|
2294
2291
|
}
|
|
2295
2292
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
2296
2293
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h2", { className: "text-xl font-semibold", children: "Usage History" }),
|
|
2297
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-hidden rounded-lg border", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2298
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2299
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2300
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2301
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2302
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2294
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-hidden rounded-lg border", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.Table, { children: [
|
|
2295
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.TableRow, { children: [
|
|
2296
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.TableHead, { children: "Date & Time" }),
|
|
2297
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.TableHead, { children: "Meter Event" }),
|
|
2298
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.TableHead, { className: "text-right", children: "Quantity" }),
|
|
2299
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.TableHead, { children: "Event ID" })
|
|
2303
2300
|
] }) }),
|
|
2304
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2301
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.TableBody, { children: usageRecords.map((record) => {
|
|
2305
2302
|
const dateTime = formatDateTime(record.timestamp);
|
|
2306
2303
|
const quantity = record.quantity.toLocaleString();
|
|
2307
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2308
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2309
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2310
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2311
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2304
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.TableRow, { children: [
|
|
2305
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.TableCell, { className: "font-medium", children: dateTime }),
|
|
2306
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.TableCell, { className: "text-muted-foreground", children: record.meterEventName }),
|
|
2307
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.TableCell, { className: "text-right font-medium", children: quantity }),
|
|
2308
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.TableCell, { className: "text-muted-foreground text-sm font-mono", children: record.stripeEventId })
|
|
2312
2309
|
] }, record.id);
|
|
2313
2310
|
}) })
|
|
2314
2311
|
] }) })
|
|
@@ -2325,8 +2322,8 @@ function BillingDetailModal({
|
|
|
2325
2322
|
children,
|
|
2326
2323
|
className
|
|
2327
2324
|
}) {
|
|
2328
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2329
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2325
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.DialogContent, { className: _nullishCoalesce(className, () => ( "max-w-4xl max-h-[90vh] overflow-y-auto")), children: [
|
|
2326
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.DialogHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.DialogTitle, { children: title }) }),
|
|
2330
2327
|
children
|
|
2331
2328
|
] }) });
|
|
2332
2329
|
}
|
|
@@ -2343,7 +2340,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
|
|
|
2343
2340
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "font-semibold text-red-900", children: "Payment Failed" }),
|
|
2344
2341
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-red-700 mt-1", children: "Your last payment failed. Please update your payment method to avoid service interruption." })
|
|
2345
2342
|
] }),
|
|
2346
|
-
onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2343
|
+
onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Button, { variant: "outline", size: "sm", onClick: onUpdatePayment, className: "border-red-300 text-red-700", children: "Update Payment Method" })
|
|
2347
2344
|
] });
|
|
2348
2345
|
}
|
|
2349
2346
|
if (subscription.status === "trialing" /* TRIALING */ && subscription.trialEnd) {
|
|
@@ -2363,7 +2360,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
|
|
|
2363
2360
|
". Add a payment method to continue your subscription."
|
|
2364
2361
|
] })
|
|
2365
2362
|
] }),
|
|
2366
|
-
onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2363
|
+
onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Button, { variant: "outline", size: "sm", onClick: onAddPayment, className: "border-yellow-300 text-yellow-700", children: "Add Payment Method" })
|
|
2367
2364
|
] });
|
|
2368
2365
|
}
|
|
2369
2366
|
}
|
|
@@ -2563,18 +2560,18 @@ function BillingDashboardContainer() {
|
|
|
2563
2560
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-8 w-8" }),
|
|
2564
2561
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-3xl font-bold", children: "Billing" })
|
|
2565
2562
|
] }),
|
|
2566
|
-
isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2567
|
-
noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2568
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2563
|
+
isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.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" }) }) }),
|
|
2564
|
+
noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.Card, { children: [
|
|
2565
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.CardHeader, { className: "text-center", children: [
|
|
2569
2566
|
/* @__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" }) }),
|
|
2570
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2571
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2567
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.CardTitle, { children: "Set Up Billing" }),
|
|
2568
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.CardDescription, { children: "Your company doesn't have a billing account yet. Set one up to manage subscriptions, payment methods, and view invoices." })
|
|
2572
2569
|
] }),
|
|
2573
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2570
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.CardContent, { className: "flex justify-center pb-8", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Button, { onClick: handleCreateCustomer, disabled: creatingCustomer, size: "lg", children: creatingCustomer ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2574
2571
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
2575
2572
|
"Setting up..."
|
|
2576
2573
|
] }) : "Set Up Billing Account" }) }),
|
|
2577
|
-
errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2574
|
+
errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.CardContent, { className: "pt-0", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-center text-sm text-destructive", children: errors.customer }) })
|
|
2578
2575
|
] }),
|
|
2579
2576
|
!noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2580
2577
|
criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -2814,10 +2811,10 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
2814
2811
|
{ id: "licensed", text: "Licensed (per unit)" },
|
|
2815
2812
|
{ id: "metered", text: "Metered (usage-based)" }
|
|
2816
2813
|
];
|
|
2817
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2818
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2819
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2820
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2814
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.DialogContent, { className: "max-w-2xl", children: [
|
|
2815
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.DialogHeader, { children: [
|
|
2816
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.DialogTitle, { children: isEditMode ? "Edit Price" : "Create Price" }),
|
|
2817
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.DialogDescription, { children: isEditMode ? "Update the price details. Note: Only nickname and active status can be changed." : "Create a new price for this product" })
|
|
2821
2818
|
] }),
|
|
2822
2819
|
isEditMode && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-blue-50 border border-blue-200 rounded-lg p-4 flex gap-x-3", children: [
|
|
2823
2820
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.AlertCircle, { className: "h-5 w-5 text-blue-600 flex-shrink-0 mt-0.5" }),
|
|
@@ -2826,10 +2823,10 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
2826
2823
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { children: "Due to Stripe's architecture, only the nickname and active status can be modified after creation. To change amount, currency, or billing interval, create a new price." })
|
|
2827
2824
|
] })
|
|
2828
2825
|
] }),
|
|
2829
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2826
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-col gap-y-4", children: [
|
|
2830
2827
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
|
|
2831
2828
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2832
|
-
|
|
2829
|
+
_chunkEJALOG7Ljs.FormInput,
|
|
2833
2830
|
{
|
|
2834
2831
|
form,
|
|
2835
2832
|
id: "unitAmount",
|
|
@@ -2839,10 +2836,10 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
2839
2836
|
isRequired: true
|
|
2840
2837
|
}
|
|
2841
2838
|
),
|
|
2842
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2839
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.FormSelect, { form, id: "currency", name: "Currency", values: currencyOptions, disabled: isEditMode })
|
|
2843
2840
|
] }),
|
|
2844
2841
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2845
|
-
|
|
2842
|
+
_chunkEJALOG7Ljs.FormSelect,
|
|
2846
2843
|
{
|
|
2847
2844
|
form,
|
|
2848
2845
|
id: "interval",
|
|
@@ -2853,7 +2850,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
2853
2850
|
),
|
|
2854
2851
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
|
|
2855
2852
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2856
|
-
|
|
2853
|
+
_chunkEJALOG7Ljs.FormInput,
|
|
2857
2854
|
{
|
|
2858
2855
|
form,
|
|
2859
2856
|
id: "intervalCount",
|
|
@@ -2864,7 +2861,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
2864
2861
|
}
|
|
2865
2862
|
),
|
|
2866
2863
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2867
|
-
|
|
2864
|
+
_chunkEJALOG7Ljs.FormSelect,
|
|
2868
2865
|
{
|
|
2869
2866
|
form,
|
|
2870
2867
|
id: "usageType",
|
|
@@ -2875,7 +2872,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
2875
2872
|
)
|
|
2876
2873
|
] }),
|
|
2877
2874
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2878
|
-
|
|
2875
|
+
_chunkEJALOG7Ljs.FormInput,
|
|
2879
2876
|
{
|
|
2880
2877
|
form,
|
|
2881
2878
|
id: "nickname",
|
|
@@ -2884,7 +2881,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
2884
2881
|
}
|
|
2885
2882
|
),
|
|
2886
2883
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2887
|
-
|
|
2884
|
+
_chunkEJALOG7Ljs.FormTextarea,
|
|
2888
2885
|
{
|
|
2889
2886
|
form,
|
|
2890
2887
|
id: "description",
|
|
@@ -2893,20 +2890,20 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
2893
2890
|
className: "min-h-24"
|
|
2894
2891
|
}
|
|
2895
2892
|
),
|
|
2896
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2897
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2893
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
2894
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Label, { children: "Features (optional)" }),
|
|
2898
2895
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
2899
2896
|
form.watch("features").map((_, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
|
|
2900
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2901
|
-
|
|
2897
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2898
|
+
_chunkEJALOG7Ljs.Input,
|
|
2902
2899
|
{
|
|
2903
2900
|
...form.register(`features.${index}`),
|
|
2904
2901
|
placeholder: `Feature ${index + 1}`,
|
|
2905
2902
|
className: "flex-1"
|
|
2906
2903
|
}
|
|
2907
|
-
)
|
|
2904
|
+
),
|
|
2908
2905
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2909
|
-
|
|
2906
|
+
_chunkEJALOG7Ljs.Button,
|
|
2910
2907
|
{
|
|
2911
2908
|
type: "button",
|
|
2912
2909
|
variant: "outline",
|
|
@@ -2923,7 +2920,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
2923
2920
|
)
|
|
2924
2921
|
] }, index)),
|
|
2925
2922
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2926
|
-
|
|
2923
|
+
_chunkEJALOG7Ljs.Button,
|
|
2927
2924
|
{
|
|
2928
2925
|
type: "button",
|
|
2929
2926
|
variant: "outline",
|
|
@@ -2941,8 +2938,8 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
2941
2938
|
)
|
|
2942
2939
|
] })
|
|
2943
2940
|
] }),
|
|
2944
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2945
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2941
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.FormCheckbox, { form, id: "active", name: "Active" }),
|
|
2942
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.CommonEditorButtons, { isEdit: isEditMode, form, disabled: isSubmitting, setOpen: onOpenChange })
|
|
2946
2943
|
] }) })
|
|
2947
2944
|
] }) });
|
|
2948
2945
|
}
|
|
@@ -3028,12 +3025,12 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3028
3025
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-4", children: [
|
|
3029
3026
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center justify-between mb-4", children: [
|
|
3030
3027
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "text-lg font-semibold", children: "Prices" }),
|
|
3031
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3028
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Button, { size: "sm", onClick: () => setShowCreatePrice(true), children: "Add Price" })
|
|
3032
3029
|
] }),
|
|
3033
3030
|
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: [
|
|
3034
3031
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.DollarSign, { className: "text-muted-foreground h-12 w-12" }),
|
|
3035
3032
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-sm", children: "No prices yet. Add a price to enable subscriptions." }),
|
|
3036
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3033
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Button, { size: "sm", onClick: () => setShowCreatePrice(true), children: "Add Price" })
|
|
3037
3034
|
] }),
|
|
3038
3035
|
prices.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4", children: prices.map((price) => {
|
|
3039
3036
|
const isArchiving = archivingPriceId === price.id;
|
|
@@ -3042,9 +3039,9 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3042
3039
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-start justify-between mb-3", children: [
|
|
3043
3040
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.DollarSign, { className: "h-5 w-5 text-primary" }),
|
|
3044
3041
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-1", children: [
|
|
3045
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3042
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.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" }) }),
|
|
3046
3043
|
price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3047
|
-
|
|
3044
|
+
_chunkEJALOG7Ljs.Button,
|
|
3048
3045
|
{
|
|
3049
3046
|
variant: "ghost",
|
|
3050
3047
|
size: "sm",
|
|
@@ -3054,7 +3051,7 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3054
3051
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Archive, { className: "h-4 w-4" })
|
|
3055
3052
|
}
|
|
3056
3053
|
) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3057
|
-
|
|
3054
|
+
_chunkEJALOG7Ljs.Button,
|
|
3058
3055
|
{
|
|
3059
3056
|
variant: "ghost",
|
|
3060
3057
|
size: "sm",
|
|
@@ -3105,20 +3102,20 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3105
3102
|
}
|
|
3106
3103
|
}
|
|
3107
3104
|
),
|
|
3108
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3109
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3110
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3111
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3105
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.AlertDialog, { open: !!priceToArchive, onOpenChange: (open) => !open && setPriceToArchive(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.AlertDialogContent, { children: [
|
|
3106
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.AlertDialogHeader, { children: [
|
|
3107
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.AlertDialogTitle, { children: "Archive Price" }),
|
|
3108
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.AlertDialogDescription, { children: [
|
|
3112
3109
|
"Are you sure you want to archive the price for",
|
|
3113
3110
|
" ",
|
|
3114
3111
|
priceToArchive && `${formatCurrency(priceToArchive.unitAmount, priceToArchive.currency)} ${formatInterval2(priceToArchive)}`,
|
|
3115
3112
|
"? This will prevent new subscriptions but existing ones will continue."
|
|
3116
3113
|
] })
|
|
3117
3114
|
] }),
|
|
3118
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3119
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3115
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.AlertDialogFooter, { children: [
|
|
3116
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.AlertDialogCancel, { disabled: !!archivingPriceId, children: "Cancel" }),
|
|
3120
3117
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3121
|
-
|
|
3118
|
+
_chunkEJALOG7Ljs.AlertDialogAction,
|
|
3122
3119
|
{
|
|
3123
3120
|
onClick: handleArchive,
|
|
3124
3121
|
disabled: !!archivingPriceId,
|
|
@@ -3128,20 +3125,20 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3128
3125
|
)
|
|
3129
3126
|
] })
|
|
3130
3127
|
] }) }),
|
|
3131
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3132
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3133
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3134
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3128
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.AlertDialog, { open: !!priceToReactivate, onOpenChange: (open) => !open && setPriceToReactivate(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.AlertDialogContent, { children: [
|
|
3129
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.AlertDialogHeader, { children: [
|
|
3130
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.AlertDialogTitle, { children: "Reactivate Price" }),
|
|
3131
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.AlertDialogDescription, { children: [
|
|
3135
3132
|
"Are you sure you want to reactivate the price for",
|
|
3136
3133
|
" ",
|
|
3137
3134
|
priceToReactivate && `${formatCurrency(priceToReactivate.unitAmount, priceToReactivate.currency)} ${formatInterval2(priceToReactivate)}`,
|
|
3138
3135
|
"? This will allow new subscriptions again."
|
|
3139
3136
|
] })
|
|
3140
3137
|
] }),
|
|
3141
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3142
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3138
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.AlertDialogFooter, { children: [
|
|
3139
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.AlertDialogCancel, { disabled: !!reactivatingPriceId, children: "Cancel" }),
|
|
3143
3140
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3144
|
-
|
|
3141
|
+
_chunkEJALOG7Ljs.AlertDialogAction,
|
|
3145
3142
|
{
|
|
3146
3143
|
onClick: handleReactivate,
|
|
3147
3144
|
disabled: !!reactivatingPriceId,
|
|
@@ -3207,15 +3204,15 @@ function ProductEditor({ product, open, onOpenChange, onSuccess }) {
|
|
|
3207
3204
|
setIsSubmitting(false);
|
|
3208
3205
|
}
|
|
3209
3206
|
}, "onSubmit");
|
|
3210
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3211
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3212
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3213
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3207
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.DialogContent, { className: "max-w-2xl", children: [
|
|
3208
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.DialogHeader, { children: [
|
|
3209
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.DialogTitle, { children: product ? "Edit Product" : "Create Product" }),
|
|
3210
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.DialogDescription, { children: product ? `Update the details for ${product.name}` : "Create a new product to offer to your customers" })
|
|
3214
3211
|
] }),
|
|
3215
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3216
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3212
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-col gap-y-4", children: [
|
|
3213
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.FormInput, { form, id: "name", name: "Product Name", placeholder: "Enter product name", isRequired: true }),
|
|
3217
3214
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3218
|
-
|
|
3215
|
+
_chunkEJALOG7Ljs.FormTextarea,
|
|
3219
3216
|
{
|
|
3220
3217
|
form,
|
|
3221
3218
|
id: "description",
|
|
@@ -3224,8 +3221,8 @@ function ProductEditor({ product, open, onOpenChange, onSuccess }) {
|
|
|
3224
3221
|
className: "min-h-32"
|
|
3225
3222
|
}
|
|
3226
3223
|
),
|
|
3227
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3228
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3224
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.FormCheckbox, { form, id: "active", name: "Active" }),
|
|
3225
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.CommonEditorButtons, { isEdit: !!product, form, disabled: isSubmitting, setOpen: onOpenChange })
|
|
3229
3226
|
] }) })
|
|
3230
3227
|
] }) });
|
|
3231
3228
|
}
|
|
@@ -3292,12 +3289,12 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3292
3289
|
] })
|
|
3293
3290
|
] }),
|
|
3294
3291
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
3295
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3292
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.Button, { variant: "outline", size: "sm", onClick: () => setEditingProduct(product), children: [
|
|
3296
3293
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Edit, { className: "h-4 w-4 mr-1" }),
|
|
3297
3294
|
"Edit"
|
|
3298
3295
|
] }),
|
|
3299
3296
|
product.active ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3300
|
-
|
|
3297
|
+
_chunkEJALOG7Ljs.Button,
|
|
3301
3298
|
{
|
|
3302
3299
|
variant: "outline",
|
|
3303
3300
|
size: "sm",
|
|
@@ -3309,7 +3306,7 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3309
3306
|
]
|
|
3310
3307
|
}
|
|
3311
3308
|
) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3312
|
-
|
|
3309
|
+
_chunkEJALOG7Ljs.Button,
|
|
3313
3310
|
{
|
|
3314
3311
|
variant: "outline",
|
|
3315
3312
|
size: "sm",
|
|
@@ -3321,7 +3318,7 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3321
3318
|
]
|
|
3322
3319
|
}
|
|
3323
3320
|
),
|
|
3324
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3321
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.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" }) })
|
|
3325
3322
|
] })
|
|
3326
3323
|
] }),
|
|
3327
3324
|
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 }) })
|
|
@@ -3339,19 +3336,19 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3339
3336
|
}
|
|
3340
3337
|
}
|
|
3341
3338
|
),
|
|
3342
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3343
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3344
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3345
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3339
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.AlertDialog, { open: !!productToArchive, onOpenChange: (open) => !open && setProductToArchive(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.AlertDialogContent, { children: [
|
|
3340
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.AlertDialogHeader, { children: [
|
|
3341
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.AlertDialogTitle, { children: "Archive Product" }),
|
|
3342
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.AlertDialogDescription, { children: [
|
|
3346
3343
|
'Are you sure you want to archive "',
|
|
3347
3344
|
_optionalChain([productToArchive, 'optionalAccess', _99 => _99.name]),
|
|
3348
3345
|
'"? This will deactivate it and it will no longer be available for new subscriptions.'
|
|
3349
3346
|
] })
|
|
3350
3347
|
] }),
|
|
3351
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3352
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3348
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.AlertDialogFooter, { children: [
|
|
3349
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.AlertDialogCancel, { disabled: !!archivingProductId, children: "Cancel" }),
|
|
3353
3350
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3354
|
-
|
|
3351
|
+
_chunkEJALOG7Ljs.AlertDialogAction,
|
|
3355
3352
|
{
|
|
3356
3353
|
onClick: handleArchive,
|
|
3357
3354
|
disabled: !!archivingProductId,
|
|
@@ -3361,19 +3358,19 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3361
3358
|
)
|
|
3362
3359
|
] })
|
|
3363
3360
|
] }) }),
|
|
3364
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3365
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3366
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3367
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3361
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.AlertDialog, { open: !!productToReactivate, onOpenChange: (open) => !open && setProductToReactivate(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.AlertDialogContent, { children: [
|
|
3362
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.AlertDialogHeader, { children: [
|
|
3363
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.AlertDialogTitle, { children: "Reactivate Product" }),
|
|
3364
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.AlertDialogDescription, { children: [
|
|
3368
3365
|
'Are you sure you want to reactivate "',
|
|
3369
3366
|
_optionalChain([productToReactivate, 'optionalAccess', _100 => _100.name]),
|
|
3370
3367
|
'"? This will make it available for new subscriptions again.'
|
|
3371
3368
|
] })
|
|
3372
3369
|
] }),
|
|
3373
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3374
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3370
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkEJALOG7Ljs.AlertDialogFooter, { children: [
|
|
3371
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.AlertDialogCancel, { disabled: !!reactivatingProductId, children: "Cancel" }),
|
|
3375
3372
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3376
|
-
|
|
3373
|
+
_chunkEJALOG7Ljs.AlertDialogAction,
|
|
3377
3374
|
{
|
|
3378
3375
|
onClick: handleReactivate,
|
|
3379
3376
|
disabled: !!reactivatingProductId,
|
|
@@ -3390,7 +3387,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductsList, "ProductsList");
|
|
|
3390
3387
|
// src/features/billing/stripe-product/components/containers/ProductsAdminContainer.tsx
|
|
3391
3388
|
|
|
3392
3389
|
function ProductsAdminContainer() {
|
|
3393
|
-
const { hasRole } =
|
|
3390
|
+
const { hasRole } = _chunkEJALOG7Ljs.useCurrentUserContext.call(void 0, );
|
|
3394
3391
|
const [products, setProducts] = _react.useState.call(void 0, []);
|
|
3395
3392
|
const [loading, setLoading] = _react.useState.call(void 0, true);
|
|
3396
3393
|
const [showCreateProduct, setShowCreateProduct] = _react.useState.call(void 0, false);
|
|
@@ -3420,14 +3417,14 @@ function ProductsAdminContainer() {
|
|
|
3420
3417
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Package, { className: "h-8 w-8" }),
|
|
3421
3418
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-3xl font-bold", children: "Product & Price Management" })
|
|
3422
3419
|
] }),
|
|
3423
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3420
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Button, { onClick: () => setShowCreateProduct(true), children: "Create Product" })
|
|
3424
3421
|
] }),
|
|
3425
3422
|
products.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-muted/50 flex flex-col items-center justify-center gap-y-4 rounded-lg border-2 border-dashed p-12", children: [
|
|
3426
3423
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Package, { className: "text-muted-foreground h-16 w-16" }),
|
|
3427
3424
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
3428
3425
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "mb-2 text-xl font-semibold", children: "No products yet" }),
|
|
3429
3426
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground mb-4", children: "Create your first product to start offering subscriptions to your customers." }),
|
|
3430
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3427
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEJALOG7Ljs.Button, { onClick: () => setShowCreateProduct(true), children: "Create Your First Product" })
|
|
3431
3428
|
] })
|
|
3432
3429
|
] }),
|
|
3433
3430
|
products.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductsList, { products, onProductsChange: loadProducts }),
|