@carlonicora/nextjs-jsonapi 1.129.0 → 1.130.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{BlockNoteEditor-RG2YQDMQ.js → BlockNoteEditor-AI5C4PBZ.js} +11 -11
- package/dist/BlockNoteEditor-AI5C4PBZ.js.map +1 -0
- package/dist/{BlockNoteEditor-WIAQJ5HM.mjs → BlockNoteEditor-KARBUMFE.mjs} +4 -4
- package/dist/BlockNoteEditor-KARBUMFE.mjs.map +1 -0
- package/dist/billing/index.js +398 -389
- package/dist/billing/index.js.map +1 -1
- package/dist/billing/index.mjs +131 -122
- package/dist/billing/index.mjs.map +1 -1
- package/dist/{chunk-YQTMNZQB.js → chunk-BHZVFSDR.js} +158 -89
- package/dist/chunk-BHZVFSDR.js.map +1 -0
- package/dist/{chunk-F54XZKPY.mjs → chunk-NXHNJCY2.mjs} +2119 -2050
- package/dist/chunk-NXHNJCY2.mjs.map +1 -0
- package/dist/client/index.js +2 -2
- package/dist/client/index.mjs +1 -1
- package/dist/components/index.d.mts +20 -2
- package/dist/components/index.d.ts +20 -2
- package/dist/components/index.js +8 -2
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +7 -1
- package/dist/contexts/index.js +2 -2
- package/dist/contexts/index.mjs +1 -1
- package/dist/features/help/index.js +32 -31
- package/dist/features/help/index.js.map +1 -1
- package/dist/features/help/index.mjs +3 -2
- package/dist/features/help/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/containers/ReactMarkdownContainer.tsx +2 -2
- package/src/components/editors/BlockNoteDiffInlineContent.tsx +10 -10
- package/src/components/editors/BlockNoteEditor.tsx +2 -2
- package/src/components/forms/FormCheckbox.tsx +2 -2
- package/src/components/forms/FormFieldWrapper.tsx +1 -1
- package/src/components/forms/FormSlider.tsx +1 -1
- package/src/components/forms/GdprConsentCheckbox.tsx +1 -1
- package/src/components/hero/EntitySection.tsx +2 -1
- package/src/components/index.ts +1 -0
- package/src/components/typography/DetailField.tsx +35 -0
- package/src/components/typography/MicroLabel.tsx +21 -0
- package/src/components/typography/SectionHeader.tsx +18 -0
- package/src/components/typography/index.ts +6 -0
- package/src/features/assistant/components/parts/AssistantEmptyState.tsx +2 -1
- package/src/features/assistant/components/parts/AssistantSidebar.tsx +2 -1
- package/src/features/auth/components/buttons/GoogleSignInButton.tsx +1 -1
- package/src/features/auth/components/forms/Register.tsx +1 -1
- package/src/features/auth/components/forms/TwoFactorChallenge.tsx +3 -3
- package/src/features/auth/components/two-factor/BackupCodesDialog.tsx +1 -1
- package/src/features/auth/components/two-factor/TotpInput.tsx +2 -2
- package/src/features/auth/components/two-factor/TwoFactorSettings.tsx +3 -3
- package/src/features/billing/components/cards/BillingUsageSummaryCard.tsx +4 -4
- package/src/features/billing/components/cards/CustomerInfoCard.tsx +6 -6
- package/src/features/billing/components/cards/InvoicesSummaryCard.tsx +5 -5
- package/src/features/billing/components/cards/PaymentMethodSummaryCard.tsx +4 -4
- package/src/features/billing/components/cards/SubscriptionSummaryCard.tsx +4 -4
- package/src/features/billing/components/containers/BillingDashboardContainer.tsx +2 -2
- package/src/features/billing/components/widgets/BillingAlertBanner.tsx +8 -8
- package/src/features/billing/stripe-customer/components/containers/PaymentMethodsContainer.tsx +2 -2
- package/src/features/billing/stripe-customer/components/details/PaymentMethodCard.tsx +8 -2
- package/src/features/billing/stripe-customer/components/forms/PaymentMethodForm.tsx +1 -1
- package/src/features/billing/stripe-invoice/components/details/InvoiceDetails.tsx +16 -18
- package/src/features/billing/stripe-invoice/components/lists/InvoicesList.tsx +2 -2
- package/src/features/billing/stripe-invoice/components/widgets/InvoiceStatusBadge.tsx +8 -7
- package/src/features/billing/stripe-price/components/lists/PricesList.tsx +6 -13
- package/src/features/billing/stripe-product/components/containers/ProductsAdminContainer.tsx +3 -3
- package/src/features/billing/stripe-product/components/lists/ProductsList.tsx +4 -7
- package/src/features/billing/stripe-promotion-code/components/PromoCodeInput.tsx +6 -6
- package/src/features/billing/stripe-subscription/components/containers/SubscriptionsContainer.tsx +2 -2
- package/src/features/billing/stripe-subscription/components/details/SubscriptionDetails.tsx +10 -10
- package/src/features/billing/stripe-subscription/components/widgets/PricingCard.tsx +2 -2
- package/src/features/billing/stripe-subscription/components/widgets/ProductPricingRow.tsx +2 -1
- package/src/features/billing/stripe-subscription/components/widgets/ProrationPreview.tsx +1 -1
- package/src/features/billing/stripe-subscription/components/widgets/SubscriptionStatusBadge.tsx +12 -11
- package/src/features/billing/stripe-subscription/components/wizards/WizardStepPaymentMethod.tsx +2 -1
- package/src/features/billing/stripe-subscription/components/wizards/WizardStepReview.tsx +10 -13
- package/src/features/billing/stripe-usage/components/containers/UsageContainer.tsx +2 -2
- package/src/features/billing/stripe-usage/components/details/UsageSummaryCard.tsx +6 -6
- package/src/features/billing/stripe-usage/components/lists/UsageHistoryTable.tsx +3 -2
- package/src/features/company/components/details/CompanyContent.tsx +4 -7
- package/src/features/company/components/details/TokenStatusIndicator.tsx +5 -5
- package/src/features/company/components/forms/CompanyDeleter.tsx +1 -1
- package/src/features/company/components/forms/CompanyEditor.tsx +3 -2
- package/src/features/content/components/lists/ContentsList.tsx +2 -1
- package/src/features/feature/components/forms/FormFeatures.tsx +6 -1
- package/src/features/help/components/HelpTOC.tsx +2 -3
- package/src/features/how-to/components/containers/HowToCommand.tsx +3 -3
- package/src/features/how-to/components/containers/HowToCommandViewer.tsx +4 -1
- package/src/features/notification/components/containers/NotificationsListContainer.tsx +1 -1
- package/src/features/notification/components/modals/NotificationModal.tsx +2 -2
- package/src/features/oauth/components/OAuthClientCard.tsx +1 -1
- package/src/features/oauth/components/OAuthClientDetail.tsx +5 -9
- package/src/features/oauth/components/OAuthClientForm.tsx +3 -3
- package/src/features/oauth/components/OAuthClientList.tsx +5 -4
- package/src/features/oauth/components/OAuthClientSecretDisplay.tsx +3 -3
- package/src/features/oauth/components/OAuthRedirectUriInput.tsx +1 -1
- package/src/features/oauth/components/OAuthScopeSelector.tsx +2 -2
- package/src/features/oauth/components/consent/OAuthConsentHeader.tsx +1 -1
- package/src/features/oauth/components/consent/OAuthConsentScreen.tsx +1 -1
- package/src/features/oauth/components/consent/OAuthScopeList.tsx +2 -3
- package/src/features/rbac/components/RbacContainer.tsx +1 -1
- package/src/features/rbac/components/RbacPermissionCell.tsx +2 -2
- package/src/features/rbac/components/RbacPermissionPicker.tsx +3 -3
- package/src/features/referral/components/ReferralWidget.tsx +7 -6
- package/src/features/waitlist/components/forms/WaitlistForm.tsx +3 -2
- package/src/features/waitlist/components/forms/WaitlistQuestionnaireRenderer.tsx +1 -1
- package/src/features/waitlist/components/lists/WaitlistList.tsx +2 -1
- package/src/features/waitlist/components/sections/WaitlistConfirmation.tsx +3 -2
- package/src/features/waitlist/components/sections/WaitlistSuccessState.tsx +2 -1
- package/src/features/waitlist/hooks/useWaitlistTableStructure.tsx +1 -1
- package/src/shadcnui/custom/link.tsx +7 -1
- package/src/shadcnui/ui/alert.tsx +1 -1
- package/src/shadcnui/ui/badge.tsx +7 -0
- package/src/shadcnui/ui/button.tsx +1 -1
- package/src/shadcnui/ui/chart.tsx +1 -3
- package/dist/BlockNoteEditor-RG2YQDMQ.js.map +0 -1
- package/dist/BlockNoteEditor-WIAQJ5HM.mjs.map +0 -1
- package/dist/chunk-F54XZKPY.mjs.map +0 -1
- package/dist/chunk-YQTMNZQB.js.map +0 -1
package/dist/billing/index.js
CHANGED
|
@@ -47,7 +47,8 @@
|
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
|
|
51
|
+
var _chunkBHZVFSDRjs = require('../chunk-BHZVFSDR.js');
|
|
51
52
|
|
|
52
53
|
|
|
53
54
|
|
|
@@ -113,41 +114,41 @@ function SubscriptionSummaryCard({
|
|
|
113
114
|
onManageClick
|
|
114
115
|
}) {
|
|
115
116
|
if (loading) {
|
|
116
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
117
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
118
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
117
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.Card, { children: [
|
|
118
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
119
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.CardTitle, { children: "Subscriptions" }),
|
|
119
120
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
120
121
|
] }),
|
|
121
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
122
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
123
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
124
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
122
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.CardContent, { children: [
|
|
123
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
124
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Skeleton, { className: "h-4 w-24 mb-1" }),
|
|
125
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Skeleton, { className: "h-4 w-40" })
|
|
125
126
|
] })
|
|
126
127
|
] });
|
|
127
128
|
}
|
|
128
129
|
if (error) {
|
|
129
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
130
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
131
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
130
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.Card, { children: [
|
|
131
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
132
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.CardTitle, { children: "Subscriptions" }),
|
|
132
133
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
133
134
|
] }),
|
|
134
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
135
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
135
136
|
] });
|
|
136
137
|
}
|
|
137
138
|
const activeSubscriptions = subscriptions.filter(
|
|
138
139
|
(sub) => sub.status === "active" /* ACTIVE */ || sub.status === "trialing" /* TRIALING */
|
|
139
140
|
);
|
|
140
141
|
const primarySubscription = activeSubscriptions[0];
|
|
141
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
142
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
143
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
142
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
|
|
143
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
144
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.CardTitle, { children: "Subscriptions" }),
|
|
144
145
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
145
146
|
] }),
|
|
146
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
147
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.CardContent, { children: subscriptions.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
147
148
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No active plan" }),
|
|
148
149
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Subscribe to get started" }),
|
|
149
150
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
150
|
-
|
|
151
|
+
_chunkBHZVFSDRjs.Button,
|
|
151
152
|
{
|
|
152
153
|
variant: "outline",
|
|
153
154
|
size: "sm",
|
|
@@ -166,7 +167,7 @@ function SubscriptionSummaryCard({
|
|
|
166
167
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
167
168
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: formatPlanName(primarySubscription) }),
|
|
168
169
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
169
|
-
|
|
170
|
+
_chunkBHZVFSDRjs.Badge,
|
|
170
171
|
{
|
|
171
172
|
variant: primarySubscription.cancelAtPeriodEnd ? "secondary" : getStatusBadgeVariant(primarySubscription.status),
|
|
172
173
|
children: primarySubscription.cancelAtPeriodEnd ? "Canceling" : primarySubscription.status
|
|
@@ -208,37 +209,37 @@ function PaymentMethodSummaryCard({
|
|
|
208
209
|
onManageClick
|
|
209
210
|
}) {
|
|
210
211
|
if (loading) {
|
|
211
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
212
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
213
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
212
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.Card, { children: [
|
|
213
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
214
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.CardTitle, { children: "Payment Method" }),
|
|
214
215
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
215
216
|
] }),
|
|
216
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
217
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
218
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
217
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.CardContent, { children: [
|
|
218
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
219
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Skeleton, { className: "h-4 w-24" })
|
|
219
220
|
] })
|
|
220
221
|
] });
|
|
221
222
|
}
|
|
222
223
|
if (error) {
|
|
223
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
224
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
225
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
224
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.Card, { children: [
|
|
225
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
226
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.CardTitle, { children: "Payment Method" }),
|
|
226
227
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
227
228
|
] }),
|
|
228
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
229
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
229
230
|
] });
|
|
230
231
|
}
|
|
231
232
|
const defaultMethod = paymentMethods.find((pm) => pm.id === defaultPaymentMethodId) || paymentMethods[0];
|
|
232
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
233
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
234
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
233
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
|
|
234
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
235
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.CardTitle, { children: "Payment Method" }),
|
|
235
236
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
236
237
|
] }),
|
|
237
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
238
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.CardContent, { children: paymentMethods.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
238
239
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No payment method" }),
|
|
239
240
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Add a card to enable subscriptions" }),
|
|
240
241
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
241
|
-
|
|
242
|
+
_chunkBHZVFSDRjs.Button,
|
|
242
243
|
{
|
|
243
244
|
variant: "outline",
|
|
244
245
|
size: "sm",
|
|
@@ -311,52 +312,52 @@ function CustomerInfoCard({ customer, loading, error }) {
|
|
|
311
312
|
}
|
|
312
313
|
}, "handlePortalClick");
|
|
313
314
|
if (loading) {
|
|
314
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
315
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
316
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
315
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.Card, { children: [
|
|
316
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
317
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.CardTitle, { children: "Billing Account" }),
|
|
317
318
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
318
319
|
] }),
|
|
319
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
320
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
321
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
322
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
320
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.CardContent, { children: [
|
|
321
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
322
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Skeleton, { className: "h-4 w-48 mb-1" }),
|
|
323
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Skeleton, { className: "h-4 w-24" })
|
|
323
324
|
] })
|
|
324
325
|
] });
|
|
325
326
|
}
|
|
326
327
|
if (error) {
|
|
327
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
328
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
329
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
328
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.Card, { children: [
|
|
329
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
330
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.CardTitle, { children: "Billing Account" }),
|
|
330
331
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
331
332
|
] }),
|
|
332
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
333
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
333
334
|
] });
|
|
334
335
|
}
|
|
335
336
|
if (!customer) {
|
|
336
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
337
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
338
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
337
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.Card, { children: [
|
|
338
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
339
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.CardTitle, { children: "Billing Account" }),
|
|
339
340
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
340
341
|
] }),
|
|
341
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
342
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.CardContent, { children: [
|
|
342
343
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "Not set up" }),
|
|
343
344
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Billing account will be created when you subscribe" })
|
|
344
345
|
] })
|
|
345
346
|
] });
|
|
346
347
|
}
|
|
347
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
348
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
349
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
348
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.Card, { children: [
|
|
349
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
350
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.CardTitle, { children: "Billing Account" }),
|
|
350
351
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
351
352
|
] }),
|
|
352
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
353
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
353
354
|
customer.name && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: customer.name }),
|
|
354
355
|
customer.email && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: customer.email }),
|
|
355
356
|
customer.balance !== void 0 && customer.balance !== 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm", children: [
|
|
356
357
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground", children: "Credit Balance: " }),
|
|
357
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: customer.balance < 0 ? "text-
|
|
358
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: customer.balance < 0 ? "text-success" : "text-destructive", children: formatBalance(customer.balance, customer.currency) })
|
|
358
359
|
] }),
|
|
359
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
360
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.Button, { variant: "outline", size: "sm", className: "mt-2", onClick: handlePortalClick, disabled: portalLoading, children: [
|
|
360
361
|
portalLoading ? "Loading..." : "Manage in Stripe Portal",
|
|
361
362
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ExternalLink, { className: "h-4 w-4 ml-1" })
|
|
362
363
|
] })
|
|
@@ -400,42 +401,42 @@ function formatAmount(amount, currency) {
|
|
|
400
401
|
_chunk7QVYU63Ejs.__name.call(void 0, formatAmount, "formatAmount");
|
|
401
402
|
function InvoicesSummaryCard({ invoices, loading, error, onViewAllClick }) {
|
|
402
403
|
if (loading) {
|
|
403
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
404
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
405
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
404
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.Card, { children: [
|
|
405
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
406
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.CardTitle, { children: "Recent Invoices" }),
|
|
406
407
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
407
408
|
] }),
|
|
408
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
409
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
410
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
411
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
409
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.CardContent, { children: [
|
|
410
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Skeleton, { className: "h-6 w-24 mb-2" }),
|
|
411
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Skeleton, { className: "h-4 w-32 mb-1" }),
|
|
412
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Skeleton, { className: "h-4 w-20" })
|
|
412
413
|
] })
|
|
413
414
|
] });
|
|
414
415
|
}
|
|
415
416
|
if (error) {
|
|
416
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
417
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
418
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
417
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.Card, { children: [
|
|
418
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
419
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.CardTitle, { children: "Recent Invoices" }),
|
|
419
420
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
420
421
|
] }),
|
|
421
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
422
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
422
423
|
] });
|
|
423
424
|
}
|
|
424
425
|
const latestInvoice = invoices[0];
|
|
425
426
|
const paidInvoices = invoices.filter((inv) => inv.status === "paid" /* PAID */);
|
|
426
427
|
const openInvoices = invoices.filter((inv) => inv.status === "open" /* OPEN */);
|
|
427
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
428
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
429
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
428
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewAllClick, children: [
|
|
429
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
430
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.CardTitle, { children: "Recent Invoices" }),
|
|
430
431
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
431
432
|
] }),
|
|
432
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
433
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.CardContent, { children: invoices.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
433
434
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No invoices yet" }),
|
|
434
435
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "Invoices will appear after your first billing cycle" })
|
|
435
436
|
] }) : latestInvoice ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
436
437
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
437
438
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: formatAmount(latestInvoice.total, latestInvoice.currency) }),
|
|
438
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
439
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Badge, { variant: getStatusBadgeVariant2(latestInvoice.status), children: latestInvoice.status })
|
|
439
440
|
] }),
|
|
440
441
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: latestInvoice.stripeInvoiceNumber || `Invoice from ${formatDate2(latestInvoice.periodStart)}` }),
|
|
441
442
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-4 text-xs text-muted-foreground", children: [
|
|
@@ -443,7 +444,7 @@ function InvoicesSummaryCard({ invoices, loading, error, onViewAllClick }) {
|
|
|
443
444
|
paidInvoices.length,
|
|
444
445
|
" paid"
|
|
445
446
|
] }),
|
|
446
|
-
openInvoices.length > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "text-
|
|
447
|
+
openInvoices.length > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "text-warning", children: [
|
|
447
448
|
openInvoices.length,
|
|
448
449
|
" open"
|
|
449
450
|
] }),
|
|
@@ -475,24 +476,24 @@ function BillingUsageSummaryCard({
|
|
|
475
476
|
onViewDetailsClick
|
|
476
477
|
}) {
|
|
477
478
|
if (loading) {
|
|
478
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
479
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
480
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
479
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.Card, { children: [
|
|
480
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
481
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.CardTitle, { children: "Usage This Month" }),
|
|
481
482
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
482
483
|
] }),
|
|
483
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
484
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
485
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
484
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.CardContent, { children: [
|
|
485
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Skeleton, { className: "h-6 w-24 mb-2" }),
|
|
486
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Skeleton, { className: "h-4 w-32" })
|
|
486
487
|
] })
|
|
487
488
|
] });
|
|
488
489
|
}
|
|
489
490
|
if (error) {
|
|
490
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
491
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
492
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
491
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.Card, { children: [
|
|
492
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
493
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.CardTitle, { children: "Usage This Month" }),
|
|
493
494
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
494
495
|
] }),
|
|
495
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
496
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
496
497
|
] });
|
|
497
498
|
}
|
|
498
499
|
const totalUsage = Object.values(summaries).reduce((acc, summary) => {
|
|
@@ -500,12 +501,12 @@ function BillingUsageSummaryCard({
|
|
|
500
501
|
}, 0);
|
|
501
502
|
const primaryMeter = meters.find((m) => _optionalChain([summaries, 'access', _17 => _17[m.id], 'optionalAccess', _18 => _18.aggregatedValue]));
|
|
502
503
|
const primarySummary = primaryMeter ? summaries[primaryMeter.id] : null;
|
|
503
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
504
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
505
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
504
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewDetailsClick, children: [
|
|
505
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
506
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.CardTitle, { children: "Usage This Month" }),
|
|
506
507
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
507
508
|
] }),
|
|
508
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
509
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.CardContent, { children: meters.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
509
510
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "No meters" }),
|
|
510
511
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "No usage meters are configured" })
|
|
511
512
|
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
@@ -611,7 +612,7 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
|
|
|
611
612
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex items-center justify-center py-8", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground", children: "Loading payment form..." }) });
|
|
612
613
|
}
|
|
613
614
|
if (!setupIntent && error) {
|
|
614
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
615
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.AlertDescription, { children: error }) });
|
|
615
616
|
}
|
|
616
617
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: handleSubmit, className: "flex flex-col gap-y-4", children: [
|
|
617
618
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rounded-md border border-gray-300 p-3", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -634,13 +635,13 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
|
|
|
634
635
|
}
|
|
635
636
|
) }),
|
|
636
637
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
637
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
638
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
638
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Checkbox, { id: "setAsDefault", checked: setAsDefault, onCheckedChange: (checked) => setSetAsDefault(!!checked) }),
|
|
639
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Label, { htmlFor: "setAsDefault", className: "font-normal", children: "Set as default payment method" })
|
|
639
640
|
] }),
|
|
640
|
-
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
641
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.AlertDescription, { children: error }) }),
|
|
641
642
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-x-2", children: [
|
|
642
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
643
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
643
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Button, { type: "button", variant: "outline", onClick: onCancel, disabled: isSubmitting || isLoading, children: "Cancel" }),
|
|
644
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Button, { type: "submit", disabled: !stripe || isSubmitting || isLoading, children: isSubmitting ? "Processing..." : "Add Card" })
|
|
644
645
|
] })
|
|
645
646
|
] });
|
|
646
647
|
}
|
|
@@ -656,10 +657,10 @@ function PaymentMethodEditor({ open, onOpenChange, onSuccess }) {
|
|
|
656
657
|
const handleCancel = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
657
658
|
onOpenChange(false);
|
|
658
659
|
}, "handleCancel");
|
|
659
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
660
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
661
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
662
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
660
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.DialogContent, { className: "max-w-md", children: [
|
|
661
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.DialogHeader, { children: [
|
|
662
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.DialogTitle, { children: "Add Payment Method" }),
|
|
663
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.DialogDescription, { children: "Add a new payment method to your account. Your card information is securely processed by Stripe." })
|
|
663
664
|
] }),
|
|
664
665
|
open && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodForm, { onSuccess: handleSuccess, onCancel: handleCancel })
|
|
665
666
|
] }) });
|
|
@@ -720,16 +721,16 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
720
721
|
}
|
|
721
722
|
}, "handleRemove");
|
|
722
723
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
723
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
724
|
-
isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
725
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
724
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.Card, { className: "relative", children: [
|
|
725
|
+
isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Badge, { variant: "softGreen", className: "absolute right-2 top-2", children: "Default" }),
|
|
726
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.CardHeader, { className: "flex flex-row items-center justify-between pb-2", children: [
|
|
726
727
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
727
728
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-2xl", children: brandIcon }),
|
|
728
729
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium capitalize", children: brand })
|
|
729
730
|
] }),
|
|
730
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
731
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
732
|
-
|
|
731
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.DropdownMenu, { children: [
|
|
732
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.DropdownMenuTrigger, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
733
|
+
_chunkBHZVFSDRjs.Button,
|
|
733
734
|
{
|
|
734
735
|
render: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {}),
|
|
735
736
|
nativeButton: false,
|
|
@@ -740,13 +741,21 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
740
741
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.MoreVertical, { className: "h-4 w-4" })
|
|
741
742
|
}
|
|
742
743
|
) }),
|
|
743
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
744
|
-
!isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
745
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
744
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.DropdownMenuContent, { align: "end", children: [
|
|
745
|
+
!isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.DropdownMenuItem, { onClick: handleSetDefault, disabled: loading, children: "Set as Default" }),
|
|
746
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
747
|
+
_chunkBHZVFSDRjs.DropdownMenuItem,
|
|
748
|
+
{
|
|
749
|
+
onClick: () => setShowRemoveDialog(true),
|
|
750
|
+
disabled: loading,
|
|
751
|
+
className: "text-destructive",
|
|
752
|
+
children: "Remove"
|
|
753
|
+
}
|
|
754
|
+
)
|
|
746
755
|
] })
|
|
747
756
|
] })
|
|
748
757
|
] }),
|
|
749
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
758
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-1", children: [
|
|
750
759
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-lg font-semibold", children: [
|
|
751
760
|
"\u2022\u2022\u2022\u2022 ",
|
|
752
761
|
last4
|
|
@@ -759,17 +768,17 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
759
768
|
] })
|
|
760
769
|
] }) })
|
|
761
770
|
] }),
|
|
762
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
763
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
764
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
765
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
771
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.AlertDialog, { open: showRemoveDialog, onOpenChange: setShowRemoveDialog, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.AlertDialogContent, { children: [
|
|
772
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.AlertDialogHeader, { children: [
|
|
773
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.AlertDialogTitle, { children: "Remove Payment Method" }),
|
|
774
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.AlertDialogDescription, { children: [
|
|
766
775
|
"Are you sure you want to remove this payment method? This action cannot be undone.",
|
|
767
776
|
isDefault && " This is your default payment method."
|
|
768
777
|
] })
|
|
769
778
|
] }),
|
|
770
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
771
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
772
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
779
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.AlertDialogFooter, { children: [
|
|
780
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.AlertDialogCancel, { disabled: loading, children: "Cancel" }),
|
|
781
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.AlertDialogAction, { onClick: handleRemove, disabled: loading, className: "bg-red-600 hover:bg-red-700", children: loading ? "Removing..." : "Remove" })
|
|
773
782
|
] })
|
|
774
783
|
] }) })
|
|
775
784
|
] });
|
|
@@ -810,16 +819,16 @@ function PaymentMethodsContainer() {
|
|
|
810
819
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center justify-between", children: [
|
|
811
820
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
812
821
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8" }),
|
|
813
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-3xl font-
|
|
822
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: "Payment Methods" })
|
|
814
823
|
] }),
|
|
815
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
824
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Button, { onClick: () => setShowAddPaymentMethod(true), children: "Add Payment Method" })
|
|
816
825
|
] }),
|
|
817
826
|
paymentMethods.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col items-center justify-center gap-y-4 rounded-lg border-2 border-dashed border-gray-300 bg-muted/50 p-12", children: [
|
|
818
827
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-16 w-16 text-muted-foreground" }),
|
|
819
828
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
820
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "mb-2 text-
|
|
829
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "mb-2 text-sm font-medium", children: "No payment methods" }),
|
|
821
830
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mb-4 text-muted-foreground", children: "Add a payment method to enable subscriptions and secure checkout." }),
|
|
822
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
831
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Button, { onClick: () => setShowAddPaymentMethod(true), children: "Add Your First Card" })
|
|
823
832
|
] })
|
|
824
833
|
] }),
|
|
825
834
|
paymentMethods.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodsList, { paymentMethods, onUpdate: loadPaymentMethods }),
|
|
@@ -896,28 +905,28 @@ _chunk7QVYU63Ejs.__name.call(void 0, formatDate3, "formatDate");
|
|
|
896
905
|
var statusConfig = {
|
|
897
906
|
["draft" /* DRAFT */]: {
|
|
898
907
|
label: "Draft",
|
|
899
|
-
|
|
908
|
+
variant: "softGray"
|
|
900
909
|
},
|
|
901
910
|
["open" /* OPEN */]: {
|
|
902
911
|
label: "Open",
|
|
903
|
-
|
|
912
|
+
variant: "softBlue"
|
|
904
913
|
},
|
|
905
914
|
["paid" /* PAID */]: {
|
|
906
915
|
label: "Paid",
|
|
907
|
-
|
|
916
|
+
variant: "softGreen"
|
|
908
917
|
},
|
|
909
918
|
["void" /* VOID */]: {
|
|
910
919
|
label: "Void",
|
|
911
|
-
|
|
920
|
+
variant: "softGray"
|
|
912
921
|
},
|
|
913
922
|
["uncollectible" /* UNCOLLECTIBLE */]: {
|
|
914
923
|
label: "Uncollectible",
|
|
915
|
-
|
|
924
|
+
variant: "softRed"
|
|
916
925
|
}
|
|
917
926
|
};
|
|
918
927
|
function InvoiceStatusBadge({ status }) {
|
|
919
928
|
const config = statusConfig[status] || statusConfig["draft" /* DRAFT */];
|
|
920
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
929
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Badge, { variant: config.variant, children: config.label });
|
|
921
930
|
}
|
|
922
931
|
_chunk7QVYU63Ejs.__name.call(void 0, InvoiceStatusBadge, "InvoiceStatusBadge");
|
|
923
932
|
|
|
@@ -948,13 +957,13 @@ function InvoiceDetails({
|
|
|
948
957
|
return invoice.stripeInvoiceId.slice(-8);
|
|
949
958
|
}, "getInvoiceNumber");
|
|
950
959
|
const productName = _optionalChain([invoice, 'access', _29 => _29.subscription, 'optionalAccess', _30 => _30.price, 'optionalAccess', _31 => _31.product, 'optionalAccess', _32 => _32.name]) || "Subscription";
|
|
951
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
952
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
953
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
960
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.DialogContent, { className: "max-w-2xl", children: [
|
|
961
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.DialogHeader, { children: [
|
|
962
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.DialogTitle, { children: [
|
|
954
963
|
"Invoice ",
|
|
955
964
|
getInvoiceNumber()
|
|
956
965
|
] }),
|
|
957
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
966
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.DialogDescription, { children: formatDate3(invoice.periodStart) })
|
|
958
967
|
] }),
|
|
959
968
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
960
969
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
@@ -963,24 +972,24 @@ function InvoiceDetails({
|
|
|
963
972
|
] }),
|
|
964
973
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-4", children: [
|
|
965
974
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
966
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-
|
|
967
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "
|
|
975
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: "Billing Period:" }),
|
|
976
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm", children: [
|
|
968
977
|
formatDate3(invoice.periodStart),
|
|
969
978
|
" - ",
|
|
970
979
|
formatDate3(invoice.periodEnd)
|
|
971
980
|
] })
|
|
972
981
|
] }),
|
|
973
982
|
invoice.dueDate && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
974
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-
|
|
975
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "
|
|
983
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: "Due Date:" }),
|
|
984
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm", children: formatDate3(invoice.dueDate) })
|
|
976
985
|
] }),
|
|
977
986
|
invoice.paidAt && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
978
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-
|
|
979
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "
|
|
987
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: "Paid Date:" }),
|
|
988
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm", children: formatDate3(invoice.paidAt) })
|
|
980
989
|
] }),
|
|
981
990
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
982
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-
|
|
983
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "
|
|
991
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: "Attempt Count:" }),
|
|
992
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm", children: invoice.attemptCount })
|
|
984
993
|
] })
|
|
985
994
|
] }),
|
|
986
995
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
@@ -998,36 +1007,36 @@ function InvoiceDetails({
|
|
|
998
1007
|
] }),
|
|
999
1008
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2 border-t pt-4", children: [
|
|
1000
1009
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1001
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-
|
|
1002
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "
|
|
1010
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: "Subtotal:" }),
|
|
1011
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children: formatCurrency(invoice.subtotal, invoice.currency) })
|
|
1003
1012
|
] }),
|
|
1004
1013
|
invoice.tax !== void 0 && invoice.tax > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1005
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-
|
|
1006
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "
|
|
1014
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: "Tax:" }),
|
|
1015
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children: formatCurrency(invoice.tax, invoice.currency) })
|
|
1007
1016
|
] }),
|
|
1008
1017
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between text-lg font-semibold border-t pt-2", children: [
|
|
1009
1018
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Total:" }),
|
|
1010
1019
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: formatCurrency(invoice.total, invoice.currency) })
|
|
1011
1020
|
] }),
|
|
1012
1021
|
invoice.amountPaid > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1013
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-
|
|
1014
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "
|
|
1022
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: "Amount Paid:" }),
|
|
1023
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-success", children: formatCurrency(invoice.amountPaid, invoice.currency) })
|
|
1015
1024
|
] }),
|
|
1016
1025
|
invoice.amountRemaining > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1017
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-
|
|
1018
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "
|
|
1026
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: "Amount Due:" }),
|
|
1027
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-destructive", children: formatCurrency(invoice.amountRemaining, invoice.currency) })
|
|
1019
1028
|
] })
|
|
1020
1029
|
] }),
|
|
1021
1030
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2 pt-4 border-t", children: [
|
|
1022
|
-
invoice.stripePdfUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1031
|
+
invoice.stripePdfUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.Button, { variant: "outline", onClick: handleDownloadPDF, children: [
|
|
1023
1032
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Download, { className: "mr-2 h-4 w-4" }),
|
|
1024
1033
|
"Download PDF"
|
|
1025
1034
|
] }),
|
|
1026
|
-
invoice.status === "open" /* OPEN */ && invoice.attempted && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1035
|
+
invoice.status === "open" /* OPEN */ && invoice.attempted && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.Button, { variant: "default", onClick: handleRetryPayment, children: [
|
|
1027
1036
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RefreshCw, { className: "mr-2 h-4 w-4" }),
|
|
1028
1037
|
"Retry Payment"
|
|
1029
1038
|
] }),
|
|
1030
|
-
invoice.stripeHostedInvoiceUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1039
|
+
invoice.stripeHostedInvoiceUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.Button, { variant: "outline", onClick: handleViewInStripe, children: [
|
|
1031
1040
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ExternalLink, { className: "mr-2 h-4 w-4" }),
|
|
1032
1041
|
"View in Stripe"
|
|
1033
1042
|
] })
|
|
@@ -1051,30 +1060,30 @@ function InvoicesList({ invoices, onInvoicesChange }) {
|
|
|
1051
1060
|
return invoice.stripeInvoiceId.slice(-8);
|
|
1052
1061
|
}, "getInvoiceNumber");
|
|
1053
1062
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1054
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1055
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1056
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1057
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1058
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1059
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1060
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1063
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.Table, { children: [
|
|
1064
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.TableRow, { children: [
|
|
1065
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.TableHead, { children: "Invoice #" }),
|
|
1066
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.TableHead, { children: "Date" }),
|
|
1067
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.TableHead, { children: "Status" }),
|
|
1068
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.TableHead, { className: "text-right", children: "Amount" }),
|
|
1069
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.TableHead, { children: "Period" })
|
|
1061
1070
|
] }) }),
|
|
1062
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1071
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.TableBody, { children: invoices.map((invoice) => {
|
|
1063
1072
|
const invoiceNumber = getInvoiceNumber(invoice);
|
|
1064
1073
|
const date = formatDate3(invoice.periodStart);
|
|
1065
1074
|
const amount = formatCurrency(invoice.total, invoice.currency);
|
|
1066
1075
|
const period = `${formatDate3(invoice.periodStart)} - ${formatDate3(invoice.periodEnd)}`;
|
|
1067
1076
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1068
|
-
|
|
1077
|
+
_chunkBHZVFSDRjs.TableRow,
|
|
1069
1078
|
{
|
|
1070
1079
|
onClick: () => handleRowClick(invoice),
|
|
1071
1080
|
className: "cursor-pointer hover:bg-muted/50",
|
|
1072
1081
|
children: [
|
|
1073
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1074
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1075
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1076
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1077
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1082
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.TableCell, { className: "font-medium", children: invoiceNumber }),
|
|
1083
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.TableCell, { className: "text-muted-foreground text-xs", children: date }),
|
|
1084
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InvoiceStatusBadge, { status: invoice.status }) }),
|
|
1085
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.TableCell, { className: "text-right font-medium", children: amount }),
|
|
1086
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.TableCell, { className: "text-muted-foreground text-xs", children: period })
|
|
1078
1087
|
]
|
|
1079
1088
|
},
|
|
1080
1089
|
invoice.id
|
|
@@ -1123,12 +1132,12 @@ function InvoicesContainer() {
|
|
|
1123
1132
|
setStatusFilter(value);
|
|
1124
1133
|
}, "handleFilterChange");
|
|
1125
1134
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-4", children: [
|
|
1126
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1127
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1128
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1129
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1130
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1131
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1135
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Tabs, { value: statusFilter, onValueChange: handleFilterChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.TabsList, { children: [
|
|
1136
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.TabsTrigger, { value: "all", children: "All" }),
|
|
1137
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.TabsTrigger, { value: "paid" /* PAID */, children: "Paid" }),
|
|
1138
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.TabsTrigger, { value: "open" /* OPEN */, children: "Open" }),
|
|
1139
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.TabsTrigger, { value: "void" /* VOID */, children: "Void" }),
|
|
1140
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.TabsTrigger, { value: "uncollectible" /* UNCOLLECTIBLE */, children: "Uncollectible" })
|
|
1132
1141
|
] }) }),
|
|
1133
1142
|
loading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-center py-8 text-muted-foreground", children: "Loading invoices..." }),
|
|
1134
1143
|
!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: [
|
|
@@ -1188,19 +1197,19 @@ function CancelSubscriptionDialog({
|
|
|
1188
1197
|
}
|
|
1189
1198
|
}, "onSubmit");
|
|
1190
1199
|
const periodEndDate = formatDate3(subscription.currentPeriodEnd);
|
|
1191
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1192
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1193
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1194
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1200
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.DialogContent, { className: "max-w-md", children: [
|
|
1201
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.DialogHeader, { children: [
|
|
1202
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.DialogTitle, { children: "Cancel Subscription" }),
|
|
1203
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.DialogDescription, { children: "Are you sure you want to cancel this subscription? This action cannot be undone." })
|
|
1195
1204
|
] }),
|
|
1196
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1205
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-col gap-y-4", children: [
|
|
1197
1206
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-blue-50 border border-blue-200 rounded-lg p-3 text-sm text-blue-800", children: [
|
|
1198
1207
|
"Your subscription will remain active until ",
|
|
1199
1208
|
periodEndDate,
|
|
1200
1209
|
". You can continue using the service until then."
|
|
1201
1210
|
] }),
|
|
1202
1211
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1203
|
-
|
|
1212
|
+
_chunkBHZVFSDRjs.FormTextarea,
|
|
1204
1213
|
{
|
|
1205
1214
|
form,
|
|
1206
1215
|
id: "reason",
|
|
@@ -1210,8 +1219,8 @@ function CancelSubscriptionDialog({
|
|
|
1210
1219
|
}
|
|
1211
1220
|
),
|
|
1212
1221
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-x-2 justify-end pt-2", children: [
|
|
1213
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1214
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1222
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Button, { type: "button", variant: "outline", onClick: () => onOpenChange(false), disabled: isSubmitting, children: "Keep Subscription" }),
|
|
1223
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Button, { type: "submit", variant: "destructive", disabled: isSubmitting, children: isSubmitting ? "Canceling..." : "Confirm Cancellation" })
|
|
1215
1224
|
] })
|
|
1216
1225
|
] }) })
|
|
1217
1226
|
] }) });
|
|
@@ -1223,44 +1232,44 @@ _chunk7QVYU63Ejs.__name.call(void 0, CancelSubscriptionDialog, "CancelSubscripti
|
|
|
1223
1232
|
var statusConfig2 = {
|
|
1224
1233
|
["active" /* ACTIVE */]: {
|
|
1225
1234
|
label: "Active",
|
|
1226
|
-
|
|
1235
|
+
variant: "softGreen"
|
|
1227
1236
|
},
|
|
1228
1237
|
["trialing" /* TRIALING */]: {
|
|
1229
1238
|
label: "Trial",
|
|
1230
|
-
|
|
1239
|
+
variant: "softBlue"
|
|
1231
1240
|
},
|
|
1232
1241
|
["past_due" /* PAST_DUE */]: {
|
|
1233
1242
|
label: "Past Due",
|
|
1234
|
-
|
|
1243
|
+
variant: "softRed"
|
|
1235
1244
|
},
|
|
1236
1245
|
["canceled" /* CANCELED */]: {
|
|
1237
1246
|
label: "Canceled",
|
|
1238
|
-
|
|
1247
|
+
variant: "softGray"
|
|
1239
1248
|
},
|
|
1240
1249
|
["paused" /* PAUSED */]: {
|
|
1241
1250
|
label: "Paused",
|
|
1242
|
-
|
|
1251
|
+
variant: "softYellow"
|
|
1243
1252
|
},
|
|
1244
1253
|
["unpaid" /* UNPAID */]: {
|
|
1245
1254
|
label: "Unpaid",
|
|
1246
|
-
|
|
1255
|
+
variant: "softOrange"
|
|
1247
1256
|
},
|
|
1248
1257
|
["incomplete" /* INCOMPLETE */]: {
|
|
1249
1258
|
label: "Incomplete",
|
|
1250
|
-
|
|
1259
|
+
variant: "softGray"
|
|
1251
1260
|
},
|
|
1252
1261
|
["incomplete_expired" /* INCOMPLETE_EXPIRED */]: {
|
|
1253
1262
|
label: "Expired",
|
|
1254
|
-
|
|
1263
|
+
variant: "softGray"
|
|
1255
1264
|
}
|
|
1256
1265
|
};
|
|
1257
1266
|
var cancelingConfig = {
|
|
1258
1267
|
label: "Canceling",
|
|
1259
|
-
|
|
1268
|
+
variant: "softAmber"
|
|
1260
1269
|
};
|
|
1261
1270
|
function SubscriptionStatusBadge({ status, cancelAtPeriodEnd }) {
|
|
1262
1271
|
const config = cancelAtPeriodEnd ? cancelingConfig : statusConfig2[status] || statusConfig2["canceled" /* CANCELED */];
|
|
1263
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1272
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Badge, { variant: config.variant, children: config.label });
|
|
1264
1273
|
}
|
|
1265
1274
|
_chunk7QVYU63Ejs.__name.call(void 0, SubscriptionStatusBadge, "SubscriptionStatusBadge");
|
|
1266
1275
|
|
|
@@ -1333,14 +1342,14 @@ function SubscriptionDetails({
|
|
|
1333
1342
|
const canResume = subscription.status === "paused" /* PAUSED */;
|
|
1334
1343
|
const canCancel = subscription.status === "active" /* ACTIVE */ || subscription.status === "trialing" /* TRIALING */ || subscription.status === "paused" /* PAUSED */;
|
|
1335
1344
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1336
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1337
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1338
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1339
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1345
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.DialogContent, { className: "max-w-2xl", children: [
|
|
1346
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.DialogHeader, { children: [
|
|
1347
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.DialogTitle, { children: "Subscription Details" }),
|
|
1348
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.DialogDescription, { children: "View and manage your subscription" })
|
|
1340
1349
|
] }),
|
|
1341
1350
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
1342
1351
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
1343
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-
|
|
1352
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: "Status:" }),
|
|
1344
1353
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1345
1354
|
SubscriptionStatusBadge,
|
|
1346
1355
|
{
|
|
@@ -1351,38 +1360,38 @@ function SubscriptionDetails({
|
|
|
1351
1360
|
] }),
|
|
1352
1361
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
1353
1362
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1354
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-
|
|
1355
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "
|
|
1363
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: "Plan:" }),
|
|
1364
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children: formatPlanName2(subscription.price) })
|
|
1356
1365
|
] }),
|
|
1357
1366
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1358
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-
|
|
1359
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "
|
|
1367
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: "Billing Amount:" }),
|
|
1368
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children: formatBillingAmount(subscription.price) })
|
|
1360
1369
|
] })
|
|
1361
1370
|
] }),
|
|
1362
1371
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "space-y-2", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1363
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-
|
|
1364
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "
|
|
1372
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: "Current Period:" }),
|
|
1373
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "text-sm", children: [
|
|
1365
1374
|
formatDate3(subscription.currentPeriodStart),
|
|
1366
1375
|
" - ",
|
|
1367
1376
|
formatDate3(subscription.currentPeriodEnd)
|
|
1368
1377
|
] })
|
|
1369
1378
|
] }) }),
|
|
1370
1379
|
subscription.trialEnd && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1371
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-
|
|
1372
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "
|
|
1380
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: "Trial Ends:" }),
|
|
1381
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children: formatDate3(subscription.trialEnd) })
|
|
1373
1382
|
] }),
|
|
1374
|
-
subscription.cancelAtPeriodEnd && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "bg-yellow-50 border border-yellow-200 rounded-lg p-3", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-
|
|
1383
|
+
subscription.cancelAtPeriodEnd && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "bg-yellow-50 border border-yellow-200 rounded-lg p-3", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-warning text-xs/relaxed", children: [
|
|
1375
1384
|
"This subscription will be canceled at the end of the current period on",
|
|
1376
1385
|
" ",
|
|
1377
1386
|
formatDate3(subscription.currentPeriodEnd),
|
|
1378
1387
|
"."
|
|
1379
1388
|
] }) }),
|
|
1380
1389
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2 pt-4 border-t", children: [
|
|
1381
|
-
onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1382
|
-
canPause && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1383
|
-
canResume && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1384
|
-
canCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1385
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1390
|
+
onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Button, { variant: "default", onClick: () => onChangePlan(subscription), children: "Change Plan" }),
|
|
1391
|
+
canPause && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Button, { variant: "outline", onClick: handlePause, disabled: isProcessing, children: isProcessing ? "Pausing..." : "Pause" }),
|
|
1392
|
+
canResume && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Button, { variant: "outline", onClick: handleResume, disabled: isProcessing, children: isProcessing ? "Resuming..." : "Resume" }),
|
|
1393
|
+
canCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Button, { variant: "destructive", onClick: () => setShowCancel(true), children: "Cancel" }),
|
|
1394
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Button, { variant: "outline", onClick: handleManageViaPortal, children: "Manage via Portal" })
|
|
1386
1395
|
] })
|
|
1387
1396
|
] })
|
|
1388
1397
|
] }) }),
|
|
@@ -1429,36 +1438,36 @@ function SubscriptionsList({ subscriptions, onSubscriptionsChange, onChangePlan
|
|
|
1429
1438
|
setSelectedSub(subscription);
|
|
1430
1439
|
}, "handleRowClick");
|
|
1431
1440
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1432
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1433
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1434
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1435
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1436
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1437
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1438
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1441
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.Table, { children: [
|
|
1442
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.TableRow, { children: [
|
|
1443
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.TableHead, { children: "Status" }),
|
|
1444
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.TableHead, { children: "Plan" }),
|
|
1445
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.TableHead, { children: "Period" }),
|
|
1446
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.TableHead, { className: "text-right", children: "Amount" }),
|
|
1447
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.TableHead, { className: "text-right", children: "Actions" })
|
|
1439
1448
|
] }) }),
|
|
1440
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1449
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.TableBody, { children: subscriptions.map((subscription) => {
|
|
1441
1450
|
const price = subscription.price;
|
|
1442
1451
|
const amount = _optionalChain([price, 'optionalAccess', _42 => _42.unitAmount]) ? formatCurrency(price.unitAmount, price.currency) : "0";
|
|
1443
1452
|
const period = `${formatDate3(subscription.currentPeriodStart)} - ${formatDate3(subscription.currentPeriodEnd)}`;
|
|
1444
1453
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1445
|
-
|
|
1454
|
+
_chunkBHZVFSDRjs.TableRow,
|
|
1446
1455
|
{
|
|
1447
1456
|
onClick: () => handleRowClick(subscription),
|
|
1448
1457
|
className: "cursor-pointer hover:bg-muted/50",
|
|
1449
1458
|
children: [
|
|
1450
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1459
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1451
1460
|
SubscriptionStatusBadge,
|
|
1452
1461
|
{
|
|
1453
1462
|
status: subscription.status,
|
|
1454
1463
|
cancelAtPeriodEnd: subscription.cancelAtPeriodEnd
|
|
1455
1464
|
}
|
|
1456
1465
|
) }),
|
|
1457
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1458
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1459
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1460
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1461
|
-
|
|
1466
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.TableCell, { className: "font-medium", children: formatPlanName3(price) }),
|
|
1467
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.TableCell, { className: "text-muted-foreground text-sm", children: period }),
|
|
1468
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.TableCell, { className: "text-right font-medium", children: amount }),
|
|
1469
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.TableCell, { className: "text-right", children: (subscription.status === "active" /* ACTIVE */ || subscription.status === "trialing" /* TRIALING */) && onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1470
|
+
_chunkBHZVFSDRjs.Button,
|
|
1462
1471
|
{
|
|
1463
1472
|
size: "sm",
|
|
1464
1473
|
variant: "outline",
|
|
@@ -1524,17 +1533,17 @@ function SubscriptionsContainer({ onOpenWizard, hasActiveRecurringSubscription }
|
|
|
1524
1533
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center justify-between", children: [
|
|
1525
1534
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
1526
1535
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8" }),
|
|
1527
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-3xl font-
|
|
1536
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: "Subscriptions" })
|
|
1528
1537
|
] }),
|
|
1529
|
-
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1538
|
+
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _43 => _43()]), children: hasActiveRecurringSubscription ? "Purchase Add-ons" : "Subscribe to a Plan" })
|
|
1530
1539
|
] }),
|
|
1531
1540
|
criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BillingAlertBanner, { subscription }, subscription.id)),
|
|
1532
1541
|
subscriptions.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col items-center justify-center py-12 space-y-4", children: [
|
|
1533
1542
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-16 w-16 text-muted-foreground" }),
|
|
1534
1543
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
1535
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-
|
|
1544
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium mb-2", children: "No Active Subscriptions" }),
|
|
1536
1545
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground mb-6", children: "Choose a subscription plan to get started with our services." }),
|
|
1537
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1546
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _44 => _44()]), children: "Subscribe to a Plan" })
|
|
1538
1547
|
] })
|
|
1539
1548
|
] }),
|
|
1540
1549
|
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -1555,9 +1564,9 @@ function IntervalToggle({ value, onChange, hasMonthly, hasYearly }) {
|
|
|
1555
1564
|
if (!hasMonthly || !hasYearly) {
|
|
1556
1565
|
return null;
|
|
1557
1566
|
}
|
|
1558
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1559
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1560
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1567
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Tabs, { value, onValueChange: (v) => onChange(v), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.TabsList, { children: [
|
|
1568
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.TabsTrigger, { value: "month", children: "Monthly" }),
|
|
1569
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.TabsTrigger, { value: "year", children: "Yearly" })
|
|
1561
1570
|
] }) });
|
|
1562
1571
|
}
|
|
1563
1572
|
_chunk7QVYU63Ejs.__name.call(void 0, IntervalToggle, "IntervalToggle");
|
|
@@ -1589,7 +1598,7 @@ function PricingCard({
|
|
|
1589
1598
|
}
|
|
1590
1599
|
}, "handleClick");
|
|
1591
1600
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1592
|
-
|
|
1601
|
+
_chunkBHZVFSDRjs.Card,
|
|
1593
1602
|
{
|
|
1594
1603
|
role: "radio",
|
|
1595
1604
|
"aria-checked": isSelected,
|
|
@@ -1607,20 +1616,20 @@ function PricingCard({
|
|
|
1607
1616
|
isLoading && "pointer-events-none"
|
|
1608
1617
|
),
|
|
1609
1618
|
children: [
|
|
1610
|
-
isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1611
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1612
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1619
|
+
isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Badge, { variant: "secondary", className: "absolute top-2 right-2", children: "Current" }),
|
|
1620
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.CardHeader, { className: "pb-2", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium", children: description }) }),
|
|
1621
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.CardContent, { className: "pb-4 grow", children: [
|
|
1613
1622
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mb-4", children: [
|
|
1614
1623
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-3xl font-bold", children: formattedPrice }),
|
|
1615
1624
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground ml-1", children: interval })
|
|
1616
1625
|
] }),
|
|
1617
1626
|
features.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "ul", { className: "space-y-2", children: features.map((feature, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "li", { className: "flex items-start gap-2", children: [
|
|
1618
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Check, { className: "
|
|
1627
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Check, { className: "text-success mt-0.5 h-4 w-4 shrink-0" }),
|
|
1619
1628
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-muted-foreground", children: feature })
|
|
1620
1629
|
] }, index)) })
|
|
1621
1630
|
] }),
|
|
1622
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1623
|
-
|
|
1631
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.CardFooter, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1632
|
+
_chunkBHZVFSDRjs.Button,
|
|
1624
1633
|
{
|
|
1625
1634
|
variant: isCurrentPlan ? "secondary" : isSelected ? "default" : "outline",
|
|
1626
1635
|
className: "w-full",
|
|
@@ -1648,7 +1657,7 @@ function ProductPricingRow({
|
|
|
1648
1657
|
return null;
|
|
1649
1658
|
}
|
|
1650
1659
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-3", children: [
|
|
1651
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1660
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.SectionHeader, { children: product.name }),
|
|
1652
1661
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1653
1662
|
"div",
|
|
1654
1663
|
{
|
|
@@ -1748,15 +1757,15 @@ function ProductPricingList({
|
|
|
1748
1757
|
_chunk7QVYU63Ejs.__name.call(void 0, ProductPricingList, "ProductPricingList");
|
|
1749
1758
|
function ProductPricingListSkeleton() {
|
|
1750
1759
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "space-y-6", children: [1, 2].map((rowIndex) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-3", children: [
|
|
1751
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1760
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Skeleton, { className: "h-6 w-32" }),
|
|
1752
1761
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4", children: [1, 2, 3].map((cardIndex) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "p-4 rounded-lg border animate-pulse space-y-3", children: [
|
|
1753
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1754
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1762
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Skeleton, { className: "h-6 w-24" }),
|
|
1763
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Skeleton, { className: "h-8 w-32" }),
|
|
1755
1764
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
1756
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1757
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1765
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Skeleton, { className: "h-4 w-full" }),
|
|
1766
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Skeleton, { className: "h-4 w-3/4" })
|
|
1758
1767
|
] }),
|
|
1759
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1768
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Skeleton, { className: "h-10 w-full" })
|
|
1760
1769
|
] }, cardIndex)) })
|
|
1761
1770
|
] }, rowIndex)) });
|
|
1762
1771
|
}
|
|
@@ -1770,7 +1779,7 @@ function ProrationPreview({ preview }) {
|
|
|
1770
1779
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
1771
1780
|
preview.lineItems.map((item, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between text-sm", children: [
|
|
1772
1781
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-blue-800", children: item.description }),
|
|
1773
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `font-medium ${item.amount < 0 ? "text-
|
|
1782
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `font-medium ${item.amount < 0 ? "text-success" : "text-blue-900"}`, children: formatCurrency(item.amount, preview.currency) })
|
|
1774
1783
|
] }, index)),
|
|
1775
1784
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border-t border-blue-200 pt-2 mt-2", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between font-semibold", children: [
|
|
1776
1785
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-blue-900", children: "Net Due Today" }),
|
|
@@ -1811,8 +1820,8 @@ function SubscriptionConfirmation({ price, isLoading, onConfirm, onCancel }) {
|
|
|
1811
1820
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: feature })
|
|
1812
1821
|
] }, index)) }),
|
|
1813
1822
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-3 pt-2 border-t border-accent/30", children: [
|
|
1814
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1815
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1823
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Button, { variant: "outline", onClick: onCancel, disabled: isLoading, children: "Cancel" }),
|
|
1824
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Button, { onClick: onConfirm, disabled: isLoading, children: isLoading ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1816
1825
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "h-4 w-4 animate-spin mr-2" }),
|
|
1817
1826
|
"Processing..."
|
|
1818
1827
|
] }) : "Subscribe" })
|
|
@@ -2142,7 +2151,7 @@ function WizardStepPlanSelection({
|
|
|
2142
2151
|
onSelectPrice: handleSelectPrice
|
|
2143
2152
|
}
|
|
2144
2153
|
),
|
|
2145
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex justify-end pt-4 border-t", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2154
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex justify-end pt-4 border-t", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Button, { onClick: onNext, disabled: !selectedPrice || isProcessing, children: isProcessing ? "Loading..." : "Next: Review" }) })
|
|
2146
2155
|
] });
|
|
2147
2156
|
}
|
|
2148
2157
|
_chunk7QVYU63Ejs.__name.call(void 0, WizardStepPlanSelection, "WizardStepPlanSelection");
|
|
@@ -2198,29 +2207,29 @@ function PromoCodeInput({
|
|
|
2198
2207
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
2199
2208
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center justify-between p-3 bg-green-50 border border-green-200 rounded-lg", children: [
|
|
2200
2209
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
2201
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Check, { className: "h-4 w-4
|
|
2202
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "font-medium
|
|
2203
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-
|
|
2210
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Check, { className: "text-success h-4 w-4" }),
|
|
2211
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success font-medium", children: appliedCode.code }),
|
|
2212
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success text-sm", children: formatDiscount(appliedCode) })
|
|
2204
2213
|
] }),
|
|
2205
2214
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2206
|
-
|
|
2215
|
+
_chunkBHZVFSDRjs.Button,
|
|
2207
2216
|
{
|
|
2208
2217
|
variant: "ghost",
|
|
2209
2218
|
size: "sm",
|
|
2210
2219
|
onClick: onRemove,
|
|
2211
2220
|
disabled,
|
|
2212
|
-
className: "text-
|
|
2221
|
+
className: "text-success hover:bg-green-100 hover:text-success",
|
|
2213
2222
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.X, { className: "h-4 w-4" })
|
|
2214
2223
|
}
|
|
2215
2224
|
)
|
|
2216
2225
|
] }),
|
|
2217
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-
|
|
2226
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-success text-sm", children: formatDuration(appliedCode) })
|
|
2218
2227
|
] });
|
|
2219
2228
|
}
|
|
2220
2229
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
2221
2230
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
|
|
2222
2231
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2223
|
-
|
|
2232
|
+
_chunkBHZVFSDRjs.Input,
|
|
2224
2233
|
{
|
|
2225
2234
|
placeholder: "Enter promo code",
|
|
2226
2235
|
value: code,
|
|
@@ -2230,9 +2239,9 @@ function PromoCodeInput({
|
|
|
2230
2239
|
className: "flex-1"
|
|
2231
2240
|
}
|
|
2232
2241
|
),
|
|
2233
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2242
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Button, { variant: "outline", onClick: handleApply, disabled: disabled || isValidating || !code.trim(), children: isValidating ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "h-4 w-4 animate-spin" }) : "Apply" })
|
|
2234
2243
|
] }),
|
|
2235
|
-
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-
|
|
2244
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error })
|
|
2236
2245
|
] });
|
|
2237
2246
|
}
|
|
2238
2247
|
_chunk7QVYU63Ejs.__name.call(void 0, PromoCodeInput, "PromoCodeInput");
|
|
@@ -2302,7 +2311,7 @@ function WizardStepReview({
|
|
|
2302
2311
|
const discountDescription = getDiscountDescription();
|
|
2303
2312
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
2304
2313
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-muted/50 rounded-lg p-4 space-y-3", children: [
|
|
2305
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2314
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.SectionHeader, { children: "Selected Plan" }),
|
|
2306
2315
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between items-center", children: [
|
|
2307
2316
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
2308
2317
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-medium", children: _optionalChain([selectedPrice, 'access', _92 => _92.product, 'optionalAccess', _93 => _93.name]) }),
|
|
@@ -2311,8 +2320,8 @@ function WizardStepReview({
|
|
|
2311
2320
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-right", children: [
|
|
2312
2321
|
discountedPrice !== null ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2313
2322
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground line-through", children: formatCurrency(selectedPrice.unitAmount || 0, selectedPrice.currency) }),
|
|
2314
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "
|
|
2315
|
-
discountDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2323
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-success text-lg font-semibold", children: formatCurrency(discountedPrice, selectedPrice.currency) }),
|
|
2324
|
+
discountDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Badge, { variant: "softGreen", children: discountDescription })
|
|
2316
2325
|
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-semibold text-lg", children: formatCurrency(selectedPrice.unitAmount || 0, selectedPrice.currency) }),
|
|
2317
2326
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: formatInterval2(selectedPrice) })
|
|
2318
2327
|
] })
|
|
@@ -2323,13 +2332,13 @@ function WizardStepReview({
|
|
|
2323
2332
|
{
|
|
2324
2333
|
className: `${isTrialUpgrade ? "bg-amber-50 border-amber-200" : "bg-blue-50 border-blue-200"} border rounded-lg p-4 space-y-2`,
|
|
2325
2334
|
children: [
|
|
2326
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: `font-medium ${isTrialUpgrade ? "text-
|
|
2327
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: `text-sm ${isTrialUpgrade ? "text-
|
|
2335
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: `font-medium ${isTrialUpgrade ? "text-warning" : "text-blue-800"}`, children: isTrialUpgrade ? "Trial Upgrade" : "Proration Summary" }),
|
|
2336
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: `text-sm ${isTrialUpgrade ? "text-warning" : "text-blue-700"}`, children: isTrialUpgrade ? "Your trial will end immediately and you will be charged the full price." : "Your next charge will be adjusted to account for the plan change." }),
|
|
2328
2337
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between text-sm", children: [
|
|
2329
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `${isTrialUpgrade ? "text-
|
|
2330
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `font-medium ${isTrialUpgrade ? "text-
|
|
2338
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `${isTrialUpgrade ? "text-warning" : "text-blue-600"}`, children: isTrialUpgrade ? "Amount to charge now:" : "Amount due now:" }),
|
|
2339
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `font-medium ${isTrialUpgrade ? "text-warning" : "text-blue-800"}`, children: discountedImmediateCharge !== null ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2331
2340
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "line-through text-muted-foreground mr-2", children: formatCurrency(prorationPreview.immediateCharge, prorationPreview.currency) }),
|
|
2332
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-
|
|
2341
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success", children: formatCurrency(discountedImmediateCharge, prorationPreview.currency) })
|
|
2333
2342
|
] }) : formatCurrency(prorationPreview.immediateCharge, prorationPreview.currency) })
|
|
2334
2343
|
] })
|
|
2335
2344
|
]
|
|
@@ -2354,15 +2363,15 @@ function WizardStepReview({
|
|
|
2354
2363
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "font-medium", children: "Payment Method" }),
|
|
2355
2364
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: hasPaymentMethod ? "A payment method is on file" : "No payment method on file" })
|
|
2356
2365
|
] }),
|
|
2357
|
-
!hasPaymentMethod && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2366
|
+
!hasPaymentMethod && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Button, { variant: "outline", onClick: onAddPaymentMethod, children: "Add Payment Method" })
|
|
2358
2367
|
] }) }),
|
|
2359
|
-
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2368
|
+
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.Alert, { variant: "destructive", children: [
|
|
2360
2369
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.AlertCircle, { className: "h-4 w-4" }),
|
|
2361
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2370
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.AlertDescription, { children: error })
|
|
2362
2371
|
] }),
|
|
2363
2372
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between pt-4 border-t", children: [
|
|
2364
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2365
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2373
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Button, { variant: "outline", onClick: onBack, disabled: isProcessing, children: "Back" }),
|
|
2374
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Button, { onClick: hasPaymentMethod ? onConfirm : onAddPaymentMethod, disabled: isProcessing, children: isProcessing ? "Processing..." : hasPaymentMethod ? isChangingPlan ? "Confirm Plan Change" : "Subscribe Now" : "Add Payment Method" })
|
|
2366
2375
|
] })
|
|
2367
2376
|
] });
|
|
2368
2377
|
}
|
|
@@ -2373,7 +2382,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, WizardStepReview, "WizardStepReview");
|
|
|
2373
2382
|
function WizardStepPaymentMethod({ onBack, onSuccess, isProcessing }) {
|
|
2374
2383
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
2375
2384
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
2376
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2385
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.SectionHeader, { children: "Add Payment Method" }),
|
|
2377
2386
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: "Enter your card details to complete your subscription" })
|
|
2378
2387
|
] }),
|
|
2379
2388
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodForm, { onSuccess, onCancel: onBack, isLoading: isProcessing })
|
|
@@ -2415,10 +2424,10 @@ function SubscriptionWizard({
|
|
|
2415
2424
|
const isChangePlanMode = !!subscription;
|
|
2416
2425
|
const dialogTitle = subscription ? "Change Subscription Plan" : isPurchasingAddons ? "Purchase Add-ons" : "Subscribe to a Plan";
|
|
2417
2426
|
const dialogDescription = subscription ? "Select a new plan for your subscription" : isPurchasingAddons ? "Select one-time products to purchase" : "Choose a subscription plan to get started";
|
|
2418
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2419
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2420
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2421
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2427
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.DialogContent, { className: "max-w-2xl", children: [
|
|
2428
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.DialogHeader, { children: [
|
|
2429
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.DialogTitle, { children: dialogTitle }),
|
|
2430
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.DialogDescription, { children: dialogDescription })
|
|
2422
2431
|
] }),
|
|
2423
2432
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, WizardProgressIndicator, { currentStep: state.step }),
|
|
2424
2433
|
state.step === "plan-selection" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -2501,18 +2510,18 @@ function UsageSummaryCard({ meter, summary }) {
|
|
|
2501
2510
|
const progressWidth = percentage !== null ? Math.min(percentage, 100) : 0;
|
|
2502
2511
|
const displayName = meter.displayName || meter.eventName;
|
|
2503
2512
|
const hasLimit = limit !== null && limit !== void 0;
|
|
2504
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2505
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2513
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.Card, { children: [
|
|
2514
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.CardHeader, { className: "flex flex-row items-center gap-x-3 pb-3", children: [
|
|
2506
2515
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex h-10 w-10 items-center justify-center rounded-lg bg-blue-100 text-blue-600", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-5 w-5" }) }),
|
|
2507
2516
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col", children: [
|
|
2508
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "font-
|
|
2509
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-
|
|
2517
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium", children: displayName }),
|
|
2518
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-xs", children: meter.id })
|
|
2510
2519
|
] })
|
|
2511
2520
|
] }),
|
|
2512
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2521
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.CardContent, { className: "flex flex-col gap-y-4", children: [
|
|
2513
2522
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
2514
2523
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-3xl font-bold", children: currentUsage.toLocaleString() }),
|
|
2515
|
-
hasLimit && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-
|
|
2524
|
+
hasLimit && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-muted-foreground text-sm", children: [
|
|
2516
2525
|
"of ",
|
|
2517
2526
|
limit.toLocaleString(),
|
|
2518
2527
|
" used"
|
|
@@ -2520,12 +2529,12 @@ function UsageSummaryCard({ meter, summary }) {
|
|
|
2520
2529
|
] }),
|
|
2521
2530
|
hasLimit ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-2", children: [
|
|
2522
2531
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-2 w-full overflow-hidden rounded-full bg-gray-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: `h-full transition-all ${progressColor}`, style: { width: `${progressWidth}%` } }) }),
|
|
2523
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-
|
|
2532
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-muted-foreground text-sm", children: [
|
|
2524
2533
|
_optionalChain([percentage, 'optionalAccess', _97 => _97.toFixed, 'call', _98 => _98(1)]),
|
|
2525
2534
|
"% used"
|
|
2526
2535
|
] })
|
|
2527
|
-
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-
|
|
2528
|
-
summary && summary.start && summary.end && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border-t pt-3", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-
|
|
2536
|
+
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-sm", children: "No limit set" }),
|
|
2537
|
+
summary && summary.start && summary.end && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border-t pt-3", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-muted-foreground text-xs", children: [
|
|
2529
2538
|
"Period: ",
|
|
2530
2539
|
formatDate4(summary.start),
|
|
2531
2540
|
" - ",
|
|
@@ -2599,12 +2608,12 @@ function UsageContainer() {
|
|
|
2599
2608
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-6", children: [
|
|
2600
2609
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
2601
2610
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-8 w-8" }),
|
|
2602
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-3xl font-
|
|
2611
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: "Usage Tracking" })
|
|
2603
2612
|
] }),
|
|
2604
2613
|
meters.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 border-gray-300 p-12", children: [
|
|
2605
2614
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "text-muted-foreground h-16 w-16" }),
|
|
2606
2615
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
2607
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "mb-2 text-
|
|
2616
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "mb-2 text-sm font-medium", children: "No usage meters configured" }),
|
|
2608
2617
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground", children: "Usage tracking will appear here when you have metered subscriptions with configured meters." })
|
|
2609
2618
|
] })
|
|
2610
2619
|
] }),
|
|
@@ -2636,22 +2645,22 @@ function UsageHistoryTable({ usageRecords }) {
|
|
|
2636
2645
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rounded-lg border p-8 text-center", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground", children: "No usage history available." }) });
|
|
2637
2646
|
}
|
|
2638
2647
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
2639
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2640
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-clip rounded-lg border", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2641
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2642
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2643
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2644
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2645
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2648
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.SectionHeader, { level: 2, children: "Usage History" }),
|
|
2649
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-clip rounded-lg border", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.Table, { children: [
|
|
2650
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.TableRow, { children: [
|
|
2651
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.TableHead, { children: "Date & Time" }),
|
|
2652
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.TableHead, { children: "Meter Event" }),
|
|
2653
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.TableHead, { className: "text-right", children: "Quantity" }),
|
|
2654
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.TableHead, { children: "Event ID" })
|
|
2646
2655
|
] }) }),
|
|
2647
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2656
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.TableBody, { children: usageRecords.map((record) => {
|
|
2648
2657
|
const dateTime = formatDateTime(record.timestamp);
|
|
2649
2658
|
const quantity = record.quantity.toLocaleString();
|
|
2650
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2651
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2652
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2653
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2654
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2659
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.TableRow, { children: [
|
|
2660
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.TableCell, { className: "font-medium", children: dateTime }),
|
|
2661
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.TableCell, { className: "text-muted-foreground", children: record.meterEventName }),
|
|
2662
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.TableCell, { className: "text-right font-medium", children: quantity }),
|
|
2663
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.TableCell, { className: "text-muted-foreground text-sm tabular-nums", children: record.stripeEventId })
|
|
2655
2664
|
] }, record.id);
|
|
2656
2665
|
}) })
|
|
2657
2666
|
] }) })
|
|
@@ -2662,8 +2671,8 @@ _chunk7QVYU63Ejs.__name.call(void 0, UsageHistoryTable, "UsageHistoryTable");
|
|
|
2662
2671
|
// src/features/billing/components/modals/BillingDetailModal.tsx
|
|
2663
2672
|
|
|
2664
2673
|
function BillingDetailModal({ open, onOpenChange, title, children, className }) {
|
|
2665
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2666
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2674
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.DialogContent, { className: _nullishCoalesce(className, () => ( "max-w-4xl max-h-[90vh] overflow-y-auto")), children: [
|
|
2675
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.DialogHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.DialogTitle, { children: title }) }),
|
|
2667
2676
|
children
|
|
2668
2677
|
] }) });
|
|
2669
2678
|
}
|
|
@@ -2675,12 +2684,12 @@ _chunk7QVYU63Ejs.__name.call(void 0, BillingDetailModal, "BillingDetailModal");
|
|
|
2675
2684
|
function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
|
|
2676
2685
|
if (subscription.status === "past_due" /* PAST_DUE */) {
|
|
2677
2686
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-red-50 border border-red-200 rounded-lg p-4 flex items-start gap-x-3", children: [
|
|
2678
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.AlertCircle, { className: "
|
|
2687
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.AlertCircle, { className: "text-destructive mt-0.5 h-5 w-5" }),
|
|
2679
2688
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex-1", children: [
|
|
2680
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "
|
|
2681
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-
|
|
2689
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-destructive text-sm font-medium", children: "Payment Failed" }),
|
|
2690
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive mt-1 text-sm", children: "Your last payment failed. Please update your payment method to avoid service interruption." })
|
|
2682
2691
|
] }),
|
|
2683
|
-
onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2692
|
+
onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Button, { variant: "outline", size: "sm", onClick: onUpdatePayment, className: "text-destructive border-red-300", children: "Update Payment Method" })
|
|
2684
2693
|
] });
|
|
2685
2694
|
}
|
|
2686
2695
|
if (subscription.status === "trialing" /* TRIALING */ && subscription.trialEnd) {
|
|
@@ -2689,10 +2698,10 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
|
|
|
2689
2698
|
const daysRemaining = Math.ceil((trialEnd.getTime() - now.getTime()) / (1e3 * 60 * 60 * 24));
|
|
2690
2699
|
if (daysRemaining <= 7) {
|
|
2691
2700
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-yellow-50 border border-yellow-200 rounded-lg p-4 flex items-start gap-x-3", children: [
|
|
2692
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.AlertCircle, { className: "
|
|
2701
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.AlertCircle, { className: "text-warning mt-0.5 h-5 w-5" }),
|
|
2693
2702
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex-1", children: [
|
|
2694
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "
|
|
2695
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-
|
|
2703
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-warning text-sm font-medium", children: "Trial Ending Soon" }),
|
|
2704
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-warning mt-1 text-sm", children: [
|
|
2696
2705
|
"Your trial ends in ",
|
|
2697
2706
|
daysRemaining,
|
|
2698
2707
|
" ",
|
|
@@ -2700,7 +2709,7 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
|
|
|
2700
2709
|
". Add a payment method to continue your subscription."
|
|
2701
2710
|
] })
|
|
2702
2711
|
] }),
|
|
2703
|
-
onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2712
|
+
onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Button, { variant: "outline", size: "sm", onClick: onAddPayment, className: "text-warning border-yellow-300", children: "Add Payment Method" })
|
|
2704
2713
|
] });
|
|
2705
2714
|
}
|
|
2706
2715
|
}
|
|
@@ -2922,20 +2931,20 @@ function BillingDashboardContainer() {
|
|
|
2922
2931
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-6", children: [
|
|
2923
2932
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
2924
2933
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-8 w-8" }),
|
|
2925
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-3xl font-
|
|
2934
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: "Billing" })
|
|
2926
2935
|
] }),
|
|
2927
|
-
isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2928
|
-
noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2929
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2936
|
+
isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.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" }) }) }),
|
|
2937
|
+
noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.Card, { children: [
|
|
2938
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.CardHeader, { className: "text-center", children: [
|
|
2930
2939
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-primary/10", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8 text-primary" }) }),
|
|
2931
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2932
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2940
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.CardTitle, { children: "Set Up Billing" }),
|
|
2941
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.CardDescription, { children: "Your company doesn't have a billing account yet. Set one up to manage subscriptions, payment methods, and view invoices." })
|
|
2933
2942
|
] }),
|
|
2934
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2943
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.CardContent, { className: "flex justify-center pb-8", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Button, { onClick: handleCreateCustomer, disabled: creatingCustomer, size: "lg", children: creatingCustomer ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2935
2944
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
2936
2945
|
"Setting up..."
|
|
2937
2946
|
] }) : "Set Up Billing Account" }) }),
|
|
2938
|
-
errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2947
|
+
errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.CardContent, { className: "pt-0", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-center text-destructive text-xs/relaxed", children: errors.customer }) })
|
|
2939
2948
|
] }),
|
|
2940
2949
|
!noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2941
2950
|
criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -3251,10 +3260,10 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3251
3260
|
{ id: "licensed", text: "Licensed (per unit)" },
|
|
3252
3261
|
{ id: "metered", text: "Metered (usage-based)" }
|
|
3253
3262
|
];
|
|
3254
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3255
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3256
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3257
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3263
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.DialogContent, { className: "max-w-2xl", children: [
|
|
3264
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.DialogHeader, { children: [
|
|
3265
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.DialogTitle, { children: isEditMode ? "Edit Price" : "Create Price" }),
|
|
3266
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.DialogDescription, { children: isEditMode ? "Update the price details. Note: Only nickname and active status can be changed." : "Create a new price for this product" })
|
|
3258
3267
|
] }),
|
|
3259
3268
|
isEditMode && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-blue-50 border border-blue-200 rounded-lg p-4 flex gap-x-3", children: [
|
|
3260
3269
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.AlertCircle, { className: "h-5 w-5 text-blue-600 flex-shrink-0 mt-0.5" }),
|
|
@@ -3263,10 +3272,10 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3263
3272
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { children: "Due to Stripe's architecture, only the nickname and active status can be modified after creation. To change amount, currency, or billing interval, create a new price." })
|
|
3264
3273
|
] })
|
|
3265
3274
|
] }),
|
|
3266
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3275
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-col gap-y-4", children: [
|
|
3267
3276
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
|
|
3268
3277
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3269
|
-
|
|
3278
|
+
_chunkBHZVFSDRjs.FormInput,
|
|
3270
3279
|
{
|
|
3271
3280
|
form,
|
|
3272
3281
|
id: "unitAmount",
|
|
@@ -3276,10 +3285,10 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3276
3285
|
isRequired: true
|
|
3277
3286
|
}
|
|
3278
3287
|
),
|
|
3279
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3288
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.FormSelect, { form, id: "currency", name: "Currency", values: currencyOptions, disabled: isEditMode })
|
|
3280
3289
|
] }),
|
|
3281
3290
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3282
|
-
|
|
3291
|
+
_chunkBHZVFSDRjs.FormSelect,
|
|
3283
3292
|
{
|
|
3284
3293
|
form,
|
|
3285
3294
|
id: "interval",
|
|
@@ -3290,7 +3299,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3290
3299
|
),
|
|
3291
3300
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
|
|
3292
3301
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3293
|
-
|
|
3302
|
+
_chunkBHZVFSDRjs.FormInput,
|
|
3294
3303
|
{
|
|
3295
3304
|
form,
|
|
3296
3305
|
id: "intervalCount",
|
|
@@ -3301,7 +3310,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3301
3310
|
}
|
|
3302
3311
|
),
|
|
3303
3312
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3304
|
-
|
|
3313
|
+
_chunkBHZVFSDRjs.FormSelect,
|
|
3305
3314
|
{
|
|
3306
3315
|
form,
|
|
3307
3316
|
id: "usageType",
|
|
@@ -3312,7 +3321,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3312
3321
|
)
|
|
3313
3322
|
] }),
|
|
3314
3323
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3315
|
-
|
|
3324
|
+
_chunkBHZVFSDRjs.FormInput,
|
|
3316
3325
|
{
|
|
3317
3326
|
form,
|
|
3318
3327
|
id: "nickname",
|
|
@@ -3321,7 +3330,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3321
3330
|
}
|
|
3322
3331
|
),
|
|
3323
3332
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3324
|
-
|
|
3333
|
+
_chunkBHZVFSDRjs.FormTextarea,
|
|
3325
3334
|
{
|
|
3326
3335
|
form,
|
|
3327
3336
|
id: "description",
|
|
@@ -3330,13 +3339,13 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3330
3339
|
className: "min-h-24"
|
|
3331
3340
|
}
|
|
3332
3341
|
),
|
|
3333
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3342
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.FormInput, { form, id: "token", name: "Token (optional)", placeholder: "Enter token value" }),
|
|
3334
3343
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
3335
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3344
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Label, { children: "Features (optional)" }),
|
|
3336
3345
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
3337
3346
|
form.watch("features").map((_, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
|
|
3338
3347
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3339
|
-
|
|
3348
|
+
_chunkBHZVFSDRjs.Input,
|
|
3340
3349
|
{
|
|
3341
3350
|
...form.register(`features.${index}`),
|
|
3342
3351
|
placeholder: `Feature ${index + 1}`,
|
|
@@ -3344,7 +3353,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3344
3353
|
}
|
|
3345
3354
|
),
|
|
3346
3355
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3347
|
-
|
|
3356
|
+
_chunkBHZVFSDRjs.Button,
|
|
3348
3357
|
{
|
|
3349
3358
|
type: "button",
|
|
3350
3359
|
variant: "outline",
|
|
@@ -3361,7 +3370,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3361
3370
|
)
|
|
3362
3371
|
] }, index)),
|
|
3363
3372
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3364
|
-
|
|
3373
|
+
_chunkBHZVFSDRjs.Button,
|
|
3365
3374
|
{
|
|
3366
3375
|
type: "button",
|
|
3367
3376
|
variant: "outline",
|
|
@@ -3380,7 +3389,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3380
3389
|
] })
|
|
3381
3390
|
] }),
|
|
3382
3391
|
isRecurring && allFeatures.length > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
3383
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3392
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Label, { children: "Platform Features" }),
|
|
3384
3393
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-md p-4 space-y-2 max-h-48 overflow-y-auto", children: allFeatures.map((feature) => {
|
|
3385
3394
|
const isCore = feature.isCore;
|
|
3386
3395
|
const isChecked = form.watch("featureIds").includes(feature.id);
|
|
@@ -3422,9 +3431,9 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3422
3431
|
] }, feature.id);
|
|
3423
3432
|
}) })
|
|
3424
3433
|
] }),
|
|
3425
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3434
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.FormCheckbox, { form, id: "active", name: "Active" }),
|
|
3426
3435
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3427
|
-
|
|
3436
|
+
_chunkBHZVFSDRjs.FormCheckbox,
|
|
3428
3437
|
{
|
|
3429
3438
|
form,
|
|
3430
3439
|
id: "isTrial",
|
|
@@ -3432,7 +3441,7 @@ function PriceEditor({ productId, price, open, onOpenChange, onSuccess }) {
|
|
|
3432
3441
|
description: "Mark this as the trial subscription plan (only one price should be marked as trial)"
|
|
3433
3442
|
}
|
|
3434
3443
|
),
|
|
3435
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3444
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.CommonEditorButtons, { isEdit: isEditMode, form, disabled: isSubmitting, setOpen: onOpenChange })
|
|
3436
3445
|
] }) })
|
|
3437
3446
|
] }) });
|
|
3438
3447
|
}
|
|
@@ -3518,12 +3527,12 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3518
3527
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-4", children: [
|
|
3519
3528
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center justify-between mb-4", children: [
|
|
3520
3529
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "text-lg font-semibold", children: "Prices" }),
|
|
3521
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3530
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Button, { size: "sm", onClick: () => setShowCreatePrice(true), children: "Add Price" })
|
|
3522
3531
|
] }),
|
|
3523
3532
|
prices.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-background flex flex-col items-center justify-center gap-y-3 rounded-lg border border-dashed p-8", children: [
|
|
3524
3533
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.DollarSign, { className: "text-muted-foreground h-12 w-12" }),
|
|
3525
3534
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-sm", children: "No prices yet. Add a price to enable subscriptions." }),
|
|
3526
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3535
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Button, { size: "sm", onClick: () => setShowCreatePrice(true), children: "Add Price" })
|
|
3527
3536
|
] }),
|
|
3528
3537
|
prices.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4", children: prices.map((price) => {
|
|
3529
3538
|
const isArchiving = archivingPriceId === price.id;
|
|
@@ -3532,9 +3541,9 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3532
3541
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-start justify-between mb-3", children: [
|
|
3533
3542
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.DollarSign, { className: "h-5 w-5 text-primary" }),
|
|
3534
3543
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-1", children: [
|
|
3535
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3544
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Button, { variant: "ghost", size: "sm", onClick: () => setEditingPrice(price), className: "h-8 w-8 p-0", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Edit, { className: "h-4 w-4" }) }),
|
|
3536
3545
|
price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3537
|
-
|
|
3546
|
+
_chunkBHZVFSDRjs.Button,
|
|
3538
3547
|
{
|
|
3539
3548
|
variant: "ghost",
|
|
3540
3549
|
size: "sm",
|
|
@@ -3544,7 +3553,7 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3544
3553
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Archive, { className: "h-4 w-4" })
|
|
3545
3554
|
}
|
|
3546
3555
|
) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3547
|
-
|
|
3556
|
+
_chunkBHZVFSDRjs.Button,
|
|
3548
3557
|
{
|
|
3549
3558
|
variant: "ghost",
|
|
3550
3559
|
size: "sm",
|
|
@@ -3563,9 +3572,9 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3563
3572
|
] }) }),
|
|
3564
3573
|
_optionalChain([price, 'access', _158 => _158.metadata, 'optionalAccess', _159 => _159.nickname]) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm font-medium mb-2", children: price.metadata.nickname }),
|
|
3565
3574
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2", children: [
|
|
3566
|
-
price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3567
|
-
_optionalChain([price, 'access', _160 => _160.recurring, 'optionalAccess', _161 => _161.usageType]) === "metered" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3568
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3575
|
+
price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Badge, { variant: "softGreen", children: "Active" }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Badge, { variant: "softGray", children: "Inactive" }),
|
|
3576
|
+
_optionalChain([price, 'access', _160 => _160.recurring, 'optionalAccess', _161 => _161.usageType]) === "metered" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Badge, { variant: "softBlue", children: "Metered" }),
|
|
3577
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Badge, { variant: "softGray", className: "uppercase", children: price.currency })
|
|
3569
3578
|
] })
|
|
3570
3579
|
] }, price.id);
|
|
3571
3580
|
}) }),
|
|
@@ -3595,20 +3604,20 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3595
3604
|
}
|
|
3596
3605
|
}
|
|
3597
3606
|
),
|
|
3598
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3599
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3600
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3601
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3607
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.AlertDialog, { open: !!priceToArchive, onOpenChange: (open) => !open && setPriceToArchive(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.AlertDialogContent, { children: [
|
|
3608
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.AlertDialogHeader, { children: [
|
|
3609
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.AlertDialogTitle, { children: "Archive Price" }),
|
|
3610
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.AlertDialogDescription, { children: [
|
|
3602
3611
|
"Are you sure you want to archive the price for",
|
|
3603
3612
|
" ",
|
|
3604
3613
|
priceToArchive && `${formatCurrency(priceToArchive.unitAmount, priceToArchive.currency)} ${formatInterval2(priceToArchive)}`,
|
|
3605
3614
|
"? This will prevent new subscriptions but existing ones will continue."
|
|
3606
3615
|
] })
|
|
3607
3616
|
] }),
|
|
3608
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3609
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3617
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.AlertDialogFooter, { children: [
|
|
3618
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.AlertDialogCancel, { disabled: !!archivingPriceId, children: "Cancel" }),
|
|
3610
3619
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3611
|
-
|
|
3620
|
+
_chunkBHZVFSDRjs.AlertDialogAction,
|
|
3612
3621
|
{
|
|
3613
3622
|
onClick: handleArchive,
|
|
3614
3623
|
disabled: !!archivingPriceId,
|
|
@@ -3618,20 +3627,20 @@ function PricesList({ productId, onPricesChange }) {
|
|
|
3618
3627
|
)
|
|
3619
3628
|
] })
|
|
3620
3629
|
] }) }),
|
|
3621
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3622
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3623
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3624
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3630
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.AlertDialog, { open: !!priceToReactivate, onOpenChange: (open) => !open && setPriceToReactivate(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.AlertDialogContent, { children: [
|
|
3631
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.AlertDialogHeader, { children: [
|
|
3632
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.AlertDialogTitle, { children: "Reactivate Price" }),
|
|
3633
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.AlertDialogDescription, { children: [
|
|
3625
3634
|
"Are you sure you want to reactivate the price for",
|
|
3626
3635
|
" ",
|
|
3627
3636
|
priceToReactivate && `${formatCurrency(priceToReactivate.unitAmount, priceToReactivate.currency)} ${formatInterval2(priceToReactivate)}`,
|
|
3628
3637
|
"? This will allow new subscriptions again."
|
|
3629
3638
|
] })
|
|
3630
3639
|
] }),
|
|
3631
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3632
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3640
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.AlertDialogFooter, { children: [
|
|
3641
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.AlertDialogCancel, { disabled: !!reactivatingPriceId, children: "Cancel" }),
|
|
3633
3642
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3634
|
-
|
|
3643
|
+
_chunkBHZVFSDRjs.AlertDialogAction,
|
|
3635
3644
|
{
|
|
3636
3645
|
onClick: handleReactivate,
|
|
3637
3646
|
disabled: !!reactivatingPriceId,
|
|
@@ -3697,15 +3706,15 @@ function ProductEditor({ product, open, onOpenChange, onSuccess }) {
|
|
|
3697
3706
|
setIsSubmitting(false);
|
|
3698
3707
|
}
|
|
3699
3708
|
}, "onSubmit");
|
|
3700
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3701
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3702
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3703
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3709
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.DialogContent, { className: "max-w-2xl", children: [
|
|
3710
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.DialogHeader, { children: [
|
|
3711
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.DialogTitle, { children: product ? "Edit Product" : "Create Product" }),
|
|
3712
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.DialogDescription, { children: product ? `Update the details for ${product.name}` : "Create a new product to offer to your customers" })
|
|
3704
3713
|
] }),
|
|
3705
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3706
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3714
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-col gap-y-4", children: [
|
|
3715
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.FormInput, { form, id: "name", name: "Product Name", placeholder: "Enter product name", isRequired: true }),
|
|
3707
3716
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3708
|
-
|
|
3717
|
+
_chunkBHZVFSDRjs.FormTextarea,
|
|
3709
3718
|
{
|
|
3710
3719
|
form,
|
|
3711
3720
|
id: "description",
|
|
@@ -3714,8 +3723,8 @@ function ProductEditor({ product, open, onOpenChange, onSuccess }) {
|
|
|
3714
3723
|
className: "min-h-32"
|
|
3715
3724
|
}
|
|
3716
3725
|
),
|
|
3717
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3718
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3726
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.FormCheckbox, { form, id: "active", name: "Active" }),
|
|
3727
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.CommonEditorButtons, { isEdit: !!product, form, disabled: isSubmitting, setOpen: onOpenChange })
|
|
3719
3728
|
] }) })
|
|
3720
3729
|
] }) });
|
|
3721
3730
|
}
|
|
@@ -3775,19 +3784,19 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3775
3784
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Package, { className: "h-6 w-6 text-primary" }),
|
|
3776
3785
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex-1", children: [
|
|
3777
3786
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
3778
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-
|
|
3779
|
-
product.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3787
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium", children: product.name }),
|
|
3788
|
+
product.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Badge, { variant: "softGreen", children: "Active" }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Badge, { variant: "softGray", children: "Inactive" })
|
|
3780
3789
|
] }),
|
|
3781
3790
|
product.description && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-sm mt-1", children: product.description })
|
|
3782
3791
|
] })
|
|
3783
3792
|
] }),
|
|
3784
3793
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
3785
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3794
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.Button, { variant: "outline", size: "sm", onClick: () => setEditingProduct(product), children: [
|
|
3786
3795
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Edit, { className: "h-4 w-4 mr-1" }),
|
|
3787
3796
|
"Edit"
|
|
3788
3797
|
] }),
|
|
3789
3798
|
product.active ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3790
|
-
|
|
3799
|
+
_chunkBHZVFSDRjs.Button,
|
|
3791
3800
|
{
|
|
3792
3801
|
variant: "outline",
|
|
3793
3802
|
size: "sm",
|
|
@@ -3799,7 +3808,7 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3799
3808
|
]
|
|
3800
3809
|
}
|
|
3801
3810
|
) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3802
|
-
|
|
3811
|
+
_chunkBHZVFSDRjs.Button,
|
|
3803
3812
|
{
|
|
3804
3813
|
variant: "outline",
|
|
3805
3814
|
size: "sm",
|
|
@@ -3811,7 +3820,7 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3811
3820
|
]
|
|
3812
3821
|
}
|
|
3813
3822
|
),
|
|
3814
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3823
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Button, { variant: "ghost", size: "sm", onClick: () => toggleExpand(product.id), children: isExpanded ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ChevronUp, { className: "h-5 w-5" }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ChevronDown, { className: "h-5 w-5" }) })
|
|
3815
3824
|
] })
|
|
3816
3825
|
] }),
|
|
3817
3826
|
isExpanded && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border-t bg-muted/30 p-6", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PricesList, { productId: product.id, onPricesChange: onProductsChange }) })
|
|
@@ -3829,19 +3838,19 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3829
3838
|
}
|
|
3830
3839
|
}
|
|
3831
3840
|
),
|
|
3832
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3833
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3834
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3835
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3841
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.AlertDialog, { open: !!productToArchive, onOpenChange: (open) => !open && setProductToArchive(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.AlertDialogContent, { children: [
|
|
3842
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.AlertDialogHeader, { children: [
|
|
3843
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.AlertDialogTitle, { children: "Archive Product" }),
|
|
3844
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.AlertDialogDescription, { children: [
|
|
3836
3845
|
'Are you sure you want to archive "',
|
|
3837
3846
|
_optionalChain([productToArchive, 'optionalAccess', _165 => _165.name]),
|
|
3838
3847
|
'"? This will deactivate it and it will no longer be available for new subscriptions.'
|
|
3839
3848
|
] })
|
|
3840
3849
|
] }),
|
|
3841
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3842
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3850
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.AlertDialogFooter, { children: [
|
|
3851
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.AlertDialogCancel, { disabled: !!archivingProductId, children: "Cancel" }),
|
|
3843
3852
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3844
|
-
|
|
3853
|
+
_chunkBHZVFSDRjs.AlertDialogAction,
|
|
3845
3854
|
{
|
|
3846
3855
|
onClick: handleArchive,
|
|
3847
3856
|
disabled: !!archivingProductId,
|
|
@@ -3851,19 +3860,19 @@ function ProductsList({ products, onProductsChange }) {
|
|
|
3851
3860
|
)
|
|
3852
3861
|
] })
|
|
3853
3862
|
] }) }),
|
|
3854
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3855
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3856
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3857
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3863
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.AlertDialog, { open: !!productToReactivate, onOpenChange: (open) => !open && setProductToReactivate(null), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.AlertDialogContent, { children: [
|
|
3864
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.AlertDialogHeader, { children: [
|
|
3865
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.AlertDialogTitle, { children: "Reactivate Product" }),
|
|
3866
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.AlertDialogDescription, { children: [
|
|
3858
3867
|
'Are you sure you want to reactivate "',
|
|
3859
3868
|
_optionalChain([productToReactivate, 'optionalAccess', _166 => _166.name]),
|
|
3860
3869
|
'"? This will make it available for new subscriptions again.'
|
|
3861
3870
|
] })
|
|
3862
3871
|
] }),
|
|
3863
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3864
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3872
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkBHZVFSDRjs.AlertDialogFooter, { children: [
|
|
3873
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.AlertDialogCancel, { disabled: !!reactivatingProductId, children: "Cancel" }),
|
|
3865
3874
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3866
|
-
|
|
3875
|
+
_chunkBHZVFSDRjs.AlertDialogAction,
|
|
3867
3876
|
{
|
|
3868
3877
|
onClick: handleReactivate,
|
|
3869
3878
|
disabled: !!reactivatingProductId,
|
|
@@ -3880,12 +3889,12 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductsList, "ProductsList");
|
|
|
3880
3889
|
// src/features/billing/stripe-product/components/containers/ProductsAdminContainer.tsx
|
|
3881
3890
|
|
|
3882
3891
|
function ProductsAdminContainer() {
|
|
3883
|
-
const { hasRole } =
|
|
3892
|
+
const { hasRole } = _chunkBHZVFSDRjs.useCurrentUserContext.call(void 0, );
|
|
3884
3893
|
const [products, setProducts] = _react.useState.call(void 0, []);
|
|
3885
3894
|
const [loading, setLoading] = _react.useState.call(void 0, true);
|
|
3886
3895
|
const [showCreateProduct, setShowCreateProduct] = _react.useState.call(void 0, false);
|
|
3887
3896
|
if (!hasRole(_chunkXTLTQQ7Xjs.getRoleId.call(void 0, ).Administrator)) {
|
|
3888
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex h-64 items-center justify-center", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-
|
|
3897
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex h-64 items-center justify-center", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: "Permission denied. Administrator access required." }) });
|
|
3889
3898
|
}
|
|
3890
3899
|
const loadProducts = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3891
3900
|
setLoading(true);
|
|
@@ -3908,16 +3917,16 @@ function ProductsAdminContainer() {
|
|
|
3908
3917
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center justify-between", children: [
|
|
3909
3918
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
3910
3919
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Package, { className: "h-8 w-8" }),
|
|
3911
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-3xl font-
|
|
3920
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: "Product & Price Management" })
|
|
3912
3921
|
] }),
|
|
3913
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3922
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Button, { onClick: () => setShowCreateProduct(true), children: "Create Product" })
|
|
3914
3923
|
] }),
|
|
3915
3924
|
products.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-muted/50 flex flex-col items-center justify-center gap-y-4 rounded-lg border-2 border-dashed p-12", children: [
|
|
3916
3925
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Package, { className: "text-muted-foreground h-16 w-16" }),
|
|
3917
3926
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
3918
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "mb-2 text-
|
|
3927
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "mb-2 text-sm font-medium", children: "No products yet" }),
|
|
3919
3928
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground mb-4", children: "Create your first product to start offering subscriptions to your customers." }),
|
|
3920
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3929
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkBHZVFSDRjs.Button, { onClick: () => setShowCreateProduct(true), children: "Create Your First Product" })
|
|
3921
3930
|
] })
|
|
3922
3931
|
] }),
|
|
3923
3932
|
products.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductsList, { products, onProductsChange: loadProducts }),
|