@carlonicora/nextjs-jsonapi 4.1.2 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AssistantMessageInterface-CubxuBIJ.d.ts → AssistantMessageInterface-DHJJO_Z_.d.ts} +1 -1
- package/dist/{AssistantMessageInterface-sHjI2zPN.d.mts → AssistantMessageInterface-S7oyERTT.d.mts} +1 -1
- package/dist/{BlockNoteEditor-VOYKZOP5.mjs → BlockNoteEditor-HXAHDJA7.mjs} +34 -27
- package/dist/BlockNoteEditor-HXAHDJA7.mjs.map +1 -0
- package/dist/{BlockNoteEditor-BENYTTCZ.js → BlockNoteEditor-LLCZDFLZ.js} +50 -43
- package/dist/BlockNoteEditor-LLCZDFLZ.js.map +1 -0
- package/dist/{BlockNoteViewer-USLR4Y7C.js → BlockNoteViewer-77CCTC2U.js} +3 -3
- package/dist/{BlockNoteViewer-USLR4Y7C.js.map → BlockNoteViewer-77CCTC2U.js.map} +1 -1
- package/dist/{BlockNoteViewer-Y2ZM4ESA.mjs → BlockNoteViewer-MDPO6BXN.mjs} +2 -2
- package/dist/{auth.interface-Df4vXbNz.d.mts → auth.interface-CeFCz9NU.d.mts} +1 -1
- package/dist/{auth.interface-BzI4onI_.d.ts → auth.interface-D1R7VVky.d.ts} +1 -1
- package/dist/billing/index.d.mts +40 -6
- package/dist/billing/index.d.ts +40 -6
- package/dist/billing/index.js +806 -774
- package/dist/billing/index.js.map +1 -1
- package/dist/billing/index.mjs +494 -462
- package/dist/billing/index.mjs.map +1 -1
- package/dist/{chunk-6ISF5KNQ.mjs → chunk-2VXDZRYY.mjs} +1103 -816
- package/dist/chunk-2VXDZRYY.mjs.map +1 -0
- package/dist/{chunk-4BZJ4LAB.js → chunk-4ORLPEK7.js} +136 -104
- package/dist/chunk-4ORLPEK7.js.map +1 -0
- package/dist/{chunk-ZZ6E33FO.mjs → chunk-6DRSSW5O.mjs} +36 -4
- package/dist/chunk-6DRSSW5O.mjs.map +1 -0
- package/dist/{chunk-KS6WZP2E.js → chunk-6SMJRAE3.js} +4 -4
- package/dist/{chunk-KS6WZP2E.js.map → chunk-6SMJRAE3.js.map} +1 -1
- package/dist/{chunk-WQ77CUUZ.js → chunk-GPXYQMOZ.js} +7 -7
- package/dist/{chunk-WQ77CUUZ.js.map → chunk-GPXYQMOZ.js.map} +1 -1
- package/dist/{chunk-46S3KPLU.mjs → chunk-ILFFC6BG.mjs} +2 -2
- package/dist/{chunk-HZVVRIJQ.mjs → chunk-IUS2RHCX.mjs} +2 -2
- package/dist/{chunk-F7RNBGHS.js → chunk-KJMMBUOA.js} +3 -3
- package/dist/{chunk-F7RNBGHS.js.map → chunk-KJMMBUOA.js.map} +1 -1
- package/dist/{chunk-ZO3QQ5CQ.mjs → chunk-MQDR6MEE.mjs} +2 -2
- package/dist/{chunk-ORU7KLCY.js → chunk-VDVIUDY5.js} +1445 -1158
- package/dist/chunk-VDVIUDY5.js.map +1 -0
- package/dist/client/index.d.mts +20 -6
- package/dist/client/index.d.ts +20 -6
- package/dist/client/index.js +6 -4
- package/dist/client/index.js.map +1 -1
- package/dist/client/index.mjs +5 -3
- package/dist/components/index.d.mts +59 -21
- package/dist/components/index.d.ts +59 -21
- package/dist/components/index.js +4 -4
- package/dist/components/index.mjs +3 -3
- package/dist/{config-CEAq4Ozy.d.mts → config-BP2vyddw.d.mts} +5 -0
- package/dist/{config-DydDHCfb.d.ts → config-BhW2QrRD.d.ts} +5 -0
- package/dist/contexts/index.d.mts +4 -4
- package/dist/contexts/index.d.ts +4 -4
- package/dist/contexts/index.js +4 -4
- package/dist/contexts/index.mjs +3 -3
- package/dist/core/index.d.mts +17 -9
- package/dist/core/index.d.ts +17 -9
- package/dist/core/index.js +4 -2
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +3 -1
- package/dist/features/analytics/index.d.mts +1 -1
- package/dist/features/analytics/index.d.ts +1 -1
- package/dist/features/analytics/index.js +122 -122
- package/dist/features/analytics/index.mjs +4 -4
- package/dist/features/analytics/server.js +4 -4
- package/dist/features/analytics/server.mjs +2 -2
- package/dist/features/help/index.d.mts +1 -1
- package/dist/features/help/index.d.ts +1 -1
- package/dist/features/help/index.js +42 -40
- package/dist/features/help/index.js.map +1 -1
- package/dist/features/help/index.mjs +8 -6
- package/dist/features/help/index.mjs.map +1 -1
- package/dist/features/tokenusage/index.js +125 -125
- package/dist/features/tokenusage/index.mjs +4 -4
- package/dist/index.d.mts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -2
- package/dist/{notification.interface-P_pNfzZQ.d.mts → notification.interface-BB6GPpZY.d.mts} +1 -1
- package/dist/{notification.interface-BNCvnVCW.d.ts → notification.interface-CmAGrijJ.d.ts} +1 -1
- package/dist/{s3.service-CbUa6a-8.d.ts → s3.service-C-4YpEMu.d.ts} +7 -3
- package/dist/{s3.service-DAp8FbuG.d.mts → s3.service-dVj-nxMl.d.mts} +7 -3
- package/dist/server/index.d.mts +4 -4
- package/dist/server/index.d.ts +4 -4
- package/dist/server/index.js +3 -3
- package/dist/server/index.mjs +2 -2
- package/dist/{useSocket-BHVIyigI.d.ts → useSocket-B0H9pmmH.d.ts} +1 -1
- package/dist/{useSocket-B9gTbuCj.d.mts → useSocket-B5RQb6v2.d.mts} +1 -1
- package/dist/{user.interface-CrmwJLYW.d.ts → user.interface-C0ZdsBZj.d.ts} +2 -0
- package/dist/{user.interface-CSaGWFbg.d.mts → user.interface-CIWGlbqM.d.mts} +2 -0
- package/package.json +1 -1
- package/src/components/containers/RoundPageContainer.tsx +3 -1
- package/src/components/containers/RoundPageContainerTitle.tsx +5 -2
- package/src/components/editors/BlockNoteEditor.tsx +31 -15
- package/src/components/editors/BlockNoteEditorAiActions.tsx +11 -7
- package/src/components/editors/__tests__/BlockNoteEditorAiActions.test.ts +10 -3
- package/src/components/errors/ErrorDetails.tsx +5 -2
- package/src/components/forms/CommonAssociationForm.tsx +1 -1
- package/src/components/forms/EntityMultiSelector.tsx +6 -2
- package/src/components/forms/EntitySelector.tsx +4 -1
- package/src/components/forms/FileUploader.tsx +3 -2
- package/src/components/forms/MultiFileUploader.tsx +3 -1
- package/src/components/navigations/Breadcrumb.tsx +3 -2
- package/src/components/navigations/Header.tsx +3 -1
- package/src/components/navigations/MobileNavigationBar.tsx +3 -1
- package/src/components/navigations/__tests__/Header.spec.tsx +2 -2
- package/src/components/tables/cells/cell.id.tsx +13 -2
- package/src/core/abstracts/AbstractService.ts +3 -3
- package/src/core/abstracts/ClientAbstractService.ts +3 -2
- package/src/features/assistant-action/components/ApprovalActionCard.tsx +74 -5
- package/src/features/assistant-action/components/__tests__/ApprovalActionCard.spec.tsx +81 -0
- package/src/features/assistant-message/components/parts/RelevanceMeter.tsx +4 -1
- package/src/features/assistant-message/components/parts/tabs/UsersTab.tsx +2 -1
- package/src/features/auth/components/buttons/GoogleSignInButton.tsx +4 -1
- package/src/features/auth/components/details/LandingComponent.tsx +1 -1
- package/src/features/auth/components/forms/ForgotPassword.tsx +1 -1
- package/src/features/auth/components/forms/Login.tsx +1 -1
- package/src/features/auth/components/forms/Register.tsx +1 -1
- package/src/features/auth/components/forms/ResetPassword.tsx +2 -2
- package/src/features/auth/components/two-factor/BackupCodesDialog.tsx +1 -1
- package/src/features/auth/components/two-factor/PasskeyButton.tsx +1 -1
- package/src/features/billing/components/cards/BillingUsageSummaryCard.tsx +21 -11
- package/src/features/billing/components/cards/CustomerInfoCard.tsx +16 -13
- package/src/features/billing/components/cards/InvoicesSummaryCard.tsx +33 -21
- package/src/features/billing/components/cards/PaymentMethodSummaryCard.tsx +20 -10
- package/src/features/billing/components/cards/SubscriptionSummaryCard.tsx +35 -22
- package/src/features/billing/components/containers/BillingDashboardContainer.tsx +24 -24
- package/src/features/billing/components/utils/__tests__/billing-formatters.spec.ts +63 -0
- package/src/features/billing/components/utils/currency.ts +67 -10
- package/src/features/billing/components/utils/date.ts +9 -4
- package/src/features/billing/components/utils/format-options.ts +20 -0
- package/src/features/billing/components/utils/index.ts +3 -1
- package/src/features/billing/components/utils/useBillingFormatOptions.ts +11 -0
- package/src/features/billing/components/widgets/BillingAlertBanner.tsx +8 -9
- package/src/features/billing/contexts/PriceContext.tsx +18 -6
- package/src/features/billing/i18n-keys.ts +212 -0
- package/src/features/billing/stripe-customer/components/containers/PaymentMethodsContainer.tsx +8 -8
- package/src/features/billing/stripe-customer/components/details/PaymentMethodCard.tsx +11 -9
- package/src/features/billing/stripe-customer/components/forms/PaymentMethodEditor.tsx +4 -4
- package/src/features/billing/stripe-customer/components/forms/PaymentMethodForm.tsx +9 -7
- package/src/features/billing/stripe-invoice/components/containers/InvoicesContainer.tsx +10 -8
- package/src/features/billing/stripe-invoice/components/details/InvoiceDetails.tsx +34 -29
- package/src/features/billing/stripe-invoice/components/lists/InvoicesList.tsx +12 -9
- package/src/features/billing/stripe-invoice/components/widgets/InvoiceStatusBadge.tsx +9 -6
- package/src/features/billing/stripe-price/components/details/PriceDetails.tsx +4 -3
- package/src/features/billing/stripe-price/components/forms/PriceArchiver.tsx +3 -1
- package/src/features/billing/stripe-price/components/forms/PriceEditor.tsx +3 -1
- package/src/features/billing/stripe-price/hooks/useStripePriceTableStructure.tsx +6 -5
- package/src/features/billing/stripe-promotion-code/components/PromoCodeInput.tsx +12 -7
- package/src/features/billing/stripe-promotion-code/data/stripe-promotion-code.service.ts +3 -1
- package/src/features/billing/stripe-subscription/components/containers/SubscriptionsContainer.tsx +10 -6
- package/src/features/billing/stripe-subscription/components/details/SubscriptionDetails.tsx +44 -29
- package/src/features/billing/stripe-subscription/components/forms/CancelSubscriptionDialog.tsx +14 -11
- package/src/features/billing/stripe-subscription/components/lists/SubscriptionsList.tsx +20 -17
- package/src/features/billing/stripe-subscription/components/widgets/IntervalToggle.tsx +4 -2
- package/src/features/billing/stripe-subscription/components/widgets/PricingCard.tsx +16 -7
- package/src/features/billing/stripe-subscription/components/widgets/ProductPricingList.tsx +3 -1
- package/src/features/billing/stripe-subscription/components/widgets/ProductPricingRow.tsx +3 -1
- package/src/features/billing/stripe-subscription/components/widgets/ProrationPreview.tsx +12 -7
- package/src/features/billing/stripe-subscription/components/widgets/SubscriptionConfirmation.tsx +11 -8
- package/src/features/billing/stripe-subscription/components/widgets/SubscriptionStatusBadge.tsx +13 -10
- package/src/features/billing/stripe-subscription/components/wizards/SubscriptionWizard.tsx +8 -6
- package/src/features/billing/stripe-subscription/components/wizards/WizardProgressIndicator.tsx +7 -4
- package/src/features/billing/stripe-subscription/components/wizards/WizardStepPaymentMethod.tsx +4 -2
- package/src/features/billing/stripe-subscription/components/wizards/WizardStepPlanSelection.tsx +3 -1
- package/src/features/billing/stripe-subscription/components/wizards/WizardStepReview.tsx +37 -28
- package/src/features/billing/stripe-subscription/hooks/useConfirmSubscriptionPayment.ts +9 -7
- package/src/features/billing/stripe-subscription/hooks/useSubscriptionWizard.ts +20 -9
- package/src/features/billing/stripe-usage/components/containers/UsageContainer.tsx +6 -6
- package/src/features/billing/stripe-usage/components/details/UsageSummaryCard.tsx +24 -9
- package/src/features/billing/stripe-usage/components/lists/UsageHistoryTable.tsx +16 -12
- package/src/features/company/components/details/TokenStatusIndicator.tsx +7 -5
- package/src/features/company/components/forms/CompanyEditor.tsx +2 -2
- package/src/features/help/components/HelpArticleBody.tsx +1 -1
- package/src/features/help/components/HelpHeader.tsx +1 -1
- package/src/features/help/components/HelpSideNav.tsx +1 -1
- package/src/features/help/i18n-keys.ts +2 -0
- package/src/features/notification/components/common/NotificationErrorBoundary.tsx +17 -12
- package/src/features/notification/components/containers/NotificationsListContainer.tsx +4 -2
- package/src/features/notification/components/notifications/Notification.tsx +6 -3
- package/src/features/notification/contexts/NotificationContext.tsx +9 -4
- package/src/features/notification/contexts/__tests__/NotificationContext.spec.tsx +13 -0
- package/src/features/notification/hooks/useNotificationTableStructure.tsx +4 -2
- package/src/features/oauth/components/OAuthClientCard.tsx +13 -7
- package/src/features/oauth/components/OAuthClientDetail.tsx +34 -30
- package/src/features/oauth/components/OAuthClientForm.tsx +24 -24
- package/src/features/oauth/components/OAuthClientList.tsx +10 -6
- package/src/features/oauth/components/OAuthClientSecretDisplay.tsx +10 -8
- package/src/features/oauth/components/OAuthRedirectUriInput.tsx +9 -13
- package/src/features/oauth/components/OAuthScopeSelector.tsx +15 -6
- package/src/features/oauth/components/__tests__/OAuthClientForm.spec.tsx +11 -9
- package/src/features/oauth/components/consent/OAuthScopeList.tsx +4 -2
- package/src/features/oauth/hooks/__tests__/useOAuthScopeText.spec.ts +30 -0
- package/src/features/oauth/hooks/index.ts +1 -0
- package/src/features/oauth/hooks/useOAuthClient.ts +11 -5
- package/src/features/oauth/hooks/useOAuthClients.ts +9 -3
- package/src/features/oauth/hooks/useOAuthConsent.ts +11 -5
- package/src/features/oauth/hooks/useOAuthScopeText.ts +33 -0
- package/src/features/rbac/components/RbacByRoleContainer.tsx +7 -6
- package/src/features/rbac/components/RbacContainer.tsx +7 -6
- package/src/features/rbac/contexts/RbacContext.tsx +3 -3
- package/src/features/user/components/containers/UserContainer.tsx +3 -1
- package/src/features/user/data/__tests__/user.test.ts +66 -0
- package/src/features/user/data/user.interface.ts +2 -0
- package/src/features/user/data/user.service.ts +9 -0
- package/src/features/user/data/user.ts +7 -0
- package/src/features/waitlist/components/forms/WaitlistForm.tsx +1 -1
- package/src/features/waitlist/components/lists/WaitlistList.tsx +1 -1
- package/src/i18n/__tests__/config.test.ts +21 -1
- package/src/i18n/config.ts +13 -0
- package/src/i18n/index.ts +1 -0
- package/src/shadcnui/custom/multi-select.tsx +47 -14
- package/src/shadcnui/custom/multiple-selector.tsx +14 -2
- package/src/shadcnui/ui/__tests__/use-ui-text.test.tsx +76 -0
- package/src/shadcnui/ui/breadcrumb.tsx +9 -2
- package/src/shadcnui/ui/carousel.tsx +15 -4
- package/src/shadcnui/ui/dialog.tsx +15 -2
- package/src/shadcnui/ui/sheet.tsx +6 -1
- package/src/shadcnui/ui/sidebar.tsx +33 -7
- package/src/shadcnui/ui/spinner.tsx +6 -1
- package/src/shadcnui/ui/use-ui-text.ts +49 -0
- package/src/utils/__tests__/date-formatter.test.ts +24 -1
- package/src/utils/date-formatter.ts +16 -0
- package/src/utils/index.ts +1 -1
- package/dist/BlockNoteEditor-BENYTTCZ.js.map +0 -1
- package/dist/BlockNoteEditor-VOYKZOP5.mjs.map +0 -1
- package/dist/chunk-4BZJ4LAB.js.map +0 -1
- package/dist/chunk-6ISF5KNQ.mjs.map +0 -1
- package/dist/chunk-ORU7KLCY.js.map +0 -1
- package/dist/chunk-ZZ6E33FO.mjs.map +0 -1
- /package/dist/{BlockNoteViewer-Y2ZM4ESA.mjs.map → BlockNoteViewer-MDPO6BXN.mjs.map} +0 -0
- /package/dist/{chunk-46S3KPLU.mjs.map → chunk-ILFFC6BG.mjs.map} +0 -0
- /package/dist/{chunk-HZVVRIJQ.mjs.map → chunk-IUS2RHCX.mjs.map} +0 -0
- /package/dist/{chunk-ZO3QQ5CQ.mjs.map → chunk-MQDR6MEE.mjs.map} +0 -0
package/dist/billing/index.js
CHANGED
|
@@ -62,10 +62,13 @@
|
|
|
62
62
|
|
|
63
63
|
|
|
64
64
|
|
|
65
|
-
var _chunkORU7KLCYjs = require('../chunk-ORU7KLCY.js');
|
|
66
65
|
|
|
67
66
|
|
|
68
|
-
|
|
67
|
+
|
|
68
|
+
var _chunkVDVIUDY5js = require('../chunk-VDVIUDY5.js');
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
var _chunkGPXYQMOZjs = require('../chunk-GPXYQMOZ.js');
|
|
69
72
|
|
|
70
73
|
|
|
71
74
|
var _chunkG4JR3SFVjs = require('../chunk-G4JR3SFV.js');
|
|
@@ -83,7 +86,10 @@ var _chunkG4JR3SFVjs = require('../chunk-G4JR3SFV.js');
|
|
|
83
86
|
|
|
84
87
|
|
|
85
88
|
|
|
86
|
-
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
var _chunk4ORLPEK7js = require('../chunk-4ORLPEK7.js');
|
|
87
93
|
require('../chunk-LXKSUWAV.js');
|
|
88
94
|
require('../chunk-JTPRJNT2.js');
|
|
89
95
|
require('../chunk-GHE4VT2R.js');
|
|
@@ -93,8 +99,10 @@ require('../chunk-3EPNHTMH.js');
|
|
|
93
99
|
var _chunk7QVYU63Ejs = require('../chunk-7QVYU63E.js');
|
|
94
100
|
|
|
95
101
|
// src/features/billing/components/cards/SubscriptionSummaryCard.tsx
|
|
102
|
+
var _nextintl = require('next-intl');
|
|
96
103
|
var _lucidereact = require('lucide-react');
|
|
97
104
|
var _jsxruntime = require('react/jsx-runtime');
|
|
105
|
+
var SUBSCRIPTION_STATUSES = Object.values(_chunk4ORLPEK7js.SubscriptionStatus);
|
|
98
106
|
function getStatusBadgeVariant(status) {
|
|
99
107
|
switch (status) {
|
|
100
108
|
case "active" /* ACTIVE */:
|
|
@@ -110,21 +118,13 @@ function getStatusBadgeVariant(status) {
|
|
|
110
118
|
}
|
|
111
119
|
}
|
|
112
120
|
_chunk7QVYU63Ejs.__name.call(void 0, getStatusBadgeVariant, "getStatusBadgeVariant");
|
|
113
|
-
function
|
|
114
|
-
return new Date(date).toLocaleDateString(void 0, {
|
|
115
|
-
year: "numeric",
|
|
116
|
-
month: "short",
|
|
117
|
-
day: "numeric"
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
_chunk7QVYU63Ejs.__name.call(void 0, formatDate, "formatDate");
|
|
121
|
-
function formatPlanName(subscription) {
|
|
121
|
+
function formatPlanName(subscription, fallback) {
|
|
122
122
|
const productName = _optionalChain([subscription, 'access', _3 => _3.price, 'optionalAccess', _4 => _4.product, 'optionalAccess', _5 => _5.name]) || "";
|
|
123
123
|
const nickname = _optionalChain([subscription, 'access', _6 => _6.price, 'optionalAccess', _7 => _7.nickname]) || "";
|
|
124
124
|
if (productName && nickname) {
|
|
125
125
|
return `${productName} - ${nickname}`;
|
|
126
126
|
}
|
|
127
|
-
return productName || nickname ||
|
|
127
|
+
return productName || nickname || fallback;
|
|
128
128
|
}
|
|
129
129
|
_chunk7QVYU63Ejs.__name.call(void 0, formatPlanName, "formatPlanName");
|
|
130
130
|
function SubscriptionSummaryCard({
|
|
@@ -133,42 +133,44 @@ function SubscriptionSummaryCard({
|
|
|
133
133
|
error,
|
|
134
134
|
onManageClick
|
|
135
135
|
}) {
|
|
136
|
+
const t = _nextintl.useTranslations.call(void 0, );
|
|
137
|
+
const fmt = _chunkVDVIUDY5js.useBillingFormatOptions.call(void 0, );
|
|
136
138
|
if (loading) {
|
|
137
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
138
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
139
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
139
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.Card, { children: [
|
|
140
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
141
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.CardTitle, { children: t("billing.ui.subscriptions.title") }),
|
|
140
142
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
141
143
|
] }),
|
|
142
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
143
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
144
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
145
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
144
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.CardContent, { children: [
|
|
145
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
146
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Skeleton, { className: "h-4 w-24 mb-1" }),
|
|
147
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Skeleton, { className: "h-4 w-40" })
|
|
146
148
|
] })
|
|
147
149
|
] });
|
|
148
150
|
}
|
|
149
151
|
if (error) {
|
|
150
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
151
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
152
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
152
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.Card, { children: [
|
|
153
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
154
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.CardTitle, { children: t("billing.ui.subscriptions.title") }),
|
|
153
155
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
154
156
|
] }),
|
|
155
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
157
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
156
158
|
] });
|
|
157
159
|
}
|
|
158
160
|
const activeSubscriptions = subscriptions.filter(
|
|
159
161
|
(sub) => sub.status === "active" /* ACTIVE */ || sub.status === "trialing" /* TRIALING */
|
|
160
162
|
);
|
|
161
163
|
const primarySubscription = activeSubscriptions[0];
|
|
162
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
163
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
164
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
164
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
|
|
165
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
166
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.CardTitle, { children: t("billing.ui.subscriptions.title") }),
|
|
165
167
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-4 w-4 text-muted-foreground" })
|
|
166
168
|
] }),
|
|
167
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
168
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "
|
|
169
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "
|
|
169
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.CardContent, { children: subscriptions.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
170
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: t("billing.ui.cards.subscriptions.empty_title") }),
|
|
171
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.subscriptions.empty_description") }),
|
|
170
172
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
171
|
-
|
|
173
|
+
_chunkVDVIUDY5js.Button,
|
|
172
174
|
{
|
|
173
175
|
variant: "outline",
|
|
174
176
|
size: "sm",
|
|
@@ -178,28 +180,30 @@ function SubscriptionSummaryCard({
|
|
|
178
180
|
onManageClick();
|
|
179
181
|
},
|
|
180
182
|
children: [
|
|
181
|
-
"
|
|
183
|
+
t("billing.ui.cards.subscriptions.view_plans"),
|
|
182
184
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ChevronRight, { className: "h-4 w-4 ms-1 rtl:rotate-180" })
|
|
183
185
|
]
|
|
184
186
|
}
|
|
185
187
|
)
|
|
186
188
|
] }) : primarySubscription ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
187
189
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
188
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: formatPlanName(primarySubscription) }),
|
|
190
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: formatPlanName(primarySubscription, t("billing.ui.cards.subscriptions.fallback_name")) }),
|
|
189
191
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
190
|
-
|
|
192
|
+
_chunkVDVIUDY5js.Badge,
|
|
191
193
|
{
|
|
192
194
|
variant: primarySubscription.cancelAtPeriodEnd ? "secondary" : getStatusBadgeVariant(primarySubscription.status),
|
|
193
|
-
children: primarySubscription.cancelAtPeriodEnd ? "
|
|
195
|
+
children: primarySubscription.cancelAtPeriodEnd ? t("billing.ui.cards.subscriptions.canceling") : SUBSCRIPTION_STATUSES.includes(primarySubscription.status) ? t(`billing.ui.subscription_status.${primarySubscription.status}`) : primarySubscription.status
|
|
194
196
|
}
|
|
195
197
|
)
|
|
196
198
|
] }),
|
|
197
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: !_optionalChain([primarySubscription, 'access', _8 => _8.price, 'optionalAccess', _9 => _9.isTrial]) ?
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
199
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: !_optionalChain([primarySubscription, 'access', _8 => _8.price, 'optionalAccess', _9 => _9.isTrial]) ? t("billing.ui.cards.subscriptions.ends_on", {
|
|
200
|
+
date: _chunkVDVIUDY5js.formatDate.call(void 0, primarySubscription.currentPeriodEnd, fmt)
|
|
201
|
+
}) : primarySubscription.cancelAtPeriodEnd ? t("billing.ui.cards.subscriptions.cancels_on", {
|
|
202
|
+
date: _chunkVDVIUDY5js.formatDate.call(void 0, primarySubscription.currentPeriodEnd, fmt)
|
|
203
|
+
}) : t("billing.ui.cards.subscriptions.renews_on", {
|
|
204
|
+
date: _chunkVDVIUDY5js.formatDate.call(void 0, primarySubscription.currentPeriodEnd, fmt)
|
|
205
|
+
}) }),
|
|
206
|
+
activeSubscriptions.length > 1 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.subscriptions.more", { count: activeSubscriptions.length - 1 }) })
|
|
203
207
|
] }) : null })
|
|
204
208
|
] });
|
|
205
209
|
}
|
|
@@ -208,6 +212,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, SubscriptionSummaryCard, "SubscriptionSumma
|
|
|
208
212
|
// src/features/billing/components/cards/PaymentMethodSummaryCard.tsx
|
|
209
213
|
|
|
210
214
|
|
|
215
|
+
|
|
211
216
|
function getCardBrandIcon(brand) {
|
|
212
217
|
const brandMap = {
|
|
213
218
|
visa: "Visa",
|
|
@@ -228,38 +233,39 @@ function PaymentMethodSummaryCard({
|
|
|
228
233
|
error,
|
|
229
234
|
onManageClick
|
|
230
235
|
}) {
|
|
236
|
+
const t = _nextintl.useTranslations.call(void 0, );
|
|
231
237
|
if (loading) {
|
|
232
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
233
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
234
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
238
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.Card, { children: [
|
|
239
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
240
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.CardTitle, { children: t("billing.ui.payment_method.title") }),
|
|
235
241
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
236
242
|
] }),
|
|
237
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
238
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
239
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
243
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.CardContent, { children: [
|
|
244
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
245
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Skeleton, { className: "h-4 w-24" })
|
|
240
246
|
] })
|
|
241
247
|
] });
|
|
242
248
|
}
|
|
243
249
|
if (error) {
|
|
244
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
245
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
246
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
250
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.Card, { children: [
|
|
251
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
252
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.CardTitle, { children: t("billing.ui.payment_method.title") }),
|
|
247
253
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
248
254
|
] }),
|
|
249
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
255
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
250
256
|
] });
|
|
251
257
|
}
|
|
252
258
|
const defaultMethod = paymentMethods.find((pm) => pm.id === defaultPaymentMethodId) || paymentMethods[0];
|
|
253
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
254
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
255
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
259
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onManageClick, children: [
|
|
260
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
261
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.CardTitle, { children: t("billing.ui.payment_method.title") }),
|
|
256
262
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-4 w-4 text-muted-foreground" })
|
|
257
263
|
] }),
|
|
258
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
259
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "
|
|
260
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "
|
|
264
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.CardContent, { children: paymentMethods.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
265
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: t("billing.ui.cards.payment_method.empty_title") }),
|
|
266
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.payment_method.empty_description") }),
|
|
261
267
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
262
|
-
|
|
268
|
+
_chunkVDVIUDY5js.Button,
|
|
263
269
|
{
|
|
264
270
|
variant: "outline",
|
|
265
271
|
size: "sm",
|
|
@@ -269,7 +275,7 @@ function PaymentMethodSummaryCard({
|
|
|
269
275
|
onManageClick();
|
|
270
276
|
},
|
|
271
277
|
children: [
|
|
272
|
-
"
|
|
278
|
+
t("billing.ui.cards.payment_method.add_card"),
|
|
273
279
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ChevronRight, { className: "h-4 w-4 ms-1 rtl:rotate-180" })
|
|
274
280
|
]
|
|
275
281
|
}
|
|
@@ -280,24 +286,13 @@ function PaymentMethodSummaryCard({
|
|
|
280
286
|
" ****",
|
|
281
287
|
defaultMethod.card.last4
|
|
282
288
|
] }),
|
|
283
|
-
/* @__PURE__ */ _jsxruntime.
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
defaultMethod.card.expYear
|
|
288
|
-
] }),
|
|
289
|
-
paymentMethods.length > 1 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-xs text-muted-foreground", children: [
|
|
290
|
-
"+",
|
|
291
|
-
paymentMethods.length - 1,
|
|
292
|
-
" more card(s)"
|
|
293
|
-
] })
|
|
289
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: t("billing.ui.payment_method.expires", {
|
|
290
|
+
date: `${String(defaultMethod.card.expMonth).padStart(2, "0")}/${defaultMethod.card.expYear}`
|
|
291
|
+
}) }),
|
|
292
|
+
paymentMethods.length > 1 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.payment_method.more_cards", { count: paymentMethods.length - 1 }) })
|
|
294
293
|
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
295
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: _optionalChain([defaultMethod, 'optionalAccess', _11 => _11.type]) || "
|
|
296
|
-
paymentMethods.length > 1 && /* @__PURE__ */ _jsxruntime.
|
|
297
|
-
"+",
|
|
298
|
-
paymentMethods.length - 1,
|
|
299
|
-
" more method(s)"
|
|
300
|
-
] })
|
|
294
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: _optionalChain([defaultMethod, 'optionalAccess', _11 => _11.type]) || t("billing.ui.payment_method.title") }),
|
|
295
|
+
paymentMethods.length > 1 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.payment_method.more_methods", { count: paymentMethods.length - 1 }) })
|
|
301
296
|
] }) })
|
|
302
297
|
] });
|
|
303
298
|
}
|
|
@@ -305,25 +300,27 @@ _chunk7QVYU63Ejs.__name.call(void 0, PaymentMethodSummaryCard, "PaymentMethodSum
|
|
|
305
300
|
|
|
306
301
|
// src/features/billing/components/cards/CustomerInfoCard.tsx
|
|
307
302
|
|
|
303
|
+
|
|
308
304
|
var _react = require('react');
|
|
309
305
|
|
|
310
|
-
function formatBalance(balance, currency) {
|
|
311
|
-
if (balance === void 0 || balance === 0) return "$0.00";
|
|
306
|
+
function formatBalance(balance, currency, locale) {
|
|
312
307
|
const currencyCode = _optionalChain([currency, 'optionalAccess', _12 => _12.toUpperCase, 'call', _13 => _13()]) || "USD";
|
|
313
|
-
const displayBalance = -balance;
|
|
314
|
-
return new Intl.NumberFormat(
|
|
308
|
+
const displayBalance = balance ? -balance : 0;
|
|
309
|
+
return new Intl.NumberFormat(locale, {
|
|
315
310
|
style: "currency",
|
|
316
311
|
currency: currencyCode
|
|
317
312
|
}).format(displayBalance / 100);
|
|
318
313
|
}
|
|
319
314
|
_chunk7QVYU63Ejs.__name.call(void 0, formatBalance, "formatBalance");
|
|
320
315
|
function CustomerInfoCard({ customer, loading, error }) {
|
|
316
|
+
const t = _nextintl.useTranslations.call(void 0, );
|
|
317
|
+
const locale = _chunk4ORLPEK7js.useI18nLocale.call(void 0, );
|
|
321
318
|
const [portalLoading, setPortalLoading] = _react.useState.call(void 0, false);
|
|
322
319
|
const handlePortalClick = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async (e) => {
|
|
323
320
|
e.stopPropagation();
|
|
324
321
|
setPortalLoading(true);
|
|
325
322
|
try {
|
|
326
|
-
const { url } = await
|
|
323
|
+
const { url } = await _chunk4ORLPEK7js.StripeCustomerService.createPortalSession();
|
|
327
324
|
window.open(url, "_blank");
|
|
328
325
|
} catch (err) {
|
|
329
326
|
console.error("[CustomerInfoCard] Failed to create portal session:", err);
|
|
@@ -332,53 +329,56 @@ function CustomerInfoCard({ customer, loading, error }) {
|
|
|
332
329
|
}
|
|
333
330
|
}, "handlePortalClick");
|
|
334
331
|
if (loading) {
|
|
335
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
336
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
337
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
332
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.Card, { children: [
|
|
333
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
334
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.CardTitle, { children: t("billing.ui.cards.customer.title") }),
|
|
338
335
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
339
336
|
] }),
|
|
340
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
341
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
342
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
343
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
337
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.CardContent, { children: [
|
|
338
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Skeleton, { className: "h-6 w-32 mb-2" }),
|
|
339
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Skeleton, { className: "h-4 w-48 mb-1" }),
|
|
340
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Skeleton, { className: "h-4 w-24" })
|
|
344
341
|
] })
|
|
345
342
|
] });
|
|
346
343
|
}
|
|
347
344
|
if (error) {
|
|
348
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
349
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
350
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
345
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.Card, { children: [
|
|
346
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
347
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.CardTitle, { children: t("billing.ui.cards.customer.title") }),
|
|
351
348
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
352
349
|
] }),
|
|
353
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
350
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
354
351
|
] });
|
|
355
352
|
}
|
|
356
353
|
if (!customer) {
|
|
357
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
358
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
359
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
354
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.Card, { children: [
|
|
355
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
356
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.CardTitle, { children: t("billing.ui.cards.customer.title") }),
|
|
360
357
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
361
358
|
] }),
|
|
362
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
363
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "
|
|
364
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "
|
|
359
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.CardContent, { children: [
|
|
360
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: t("billing.ui.cards.customer.not_set_up") }),
|
|
361
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.customer.not_set_up_description") })
|
|
365
362
|
] })
|
|
366
363
|
] });
|
|
367
364
|
}
|
|
368
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
369
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
370
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
365
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.Card, { children: [
|
|
366
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
367
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.CardTitle, { children: t("billing.ui.cards.customer.title") }),
|
|
371
368
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.User, { className: "h-4 w-4 text-muted-foreground" })
|
|
372
369
|
] }),
|
|
373
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
370
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
374
371
|
customer.name && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: customer.name }),
|
|
375
372
|
customer.email && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: customer.email }),
|
|
376
373
|
customer.balance !== void 0 && customer.balance !== 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm", children: [
|
|
377
|
-
/* @__PURE__ */ _jsxruntime.
|
|
378
|
-
|
|
374
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "text-muted-foreground", children: [
|
|
375
|
+
t("billing.ui.cards.customer.credit_balance"),
|
|
376
|
+
" "
|
|
377
|
+
] }),
|
|
378
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: customer.balance < 0 ? "text-success" : "text-destructive", children: formatBalance(customer.balance, customer.currency, locale) })
|
|
379
379
|
] }),
|
|
380
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
381
|
-
portalLoading ? "
|
|
380
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.Button, { variant: "outline", size: "sm", className: "mt-2", onClick: handlePortalClick, disabled: portalLoading, children: [
|
|
381
|
+
portalLoading ? t("common.loading") : t("billing.ui.cards.customer.manage_portal"),
|
|
382
382
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ExternalLink, { className: "h-4 w-4 ms-1" })
|
|
383
383
|
] })
|
|
384
384
|
] }) })
|
|
@@ -389,6 +389,8 @@ _chunk7QVYU63Ejs.__name.call(void 0, CustomerInfoCard, "CustomerInfoCard");
|
|
|
389
389
|
// src/features/billing/components/cards/InvoicesSummaryCard.tsx
|
|
390
390
|
|
|
391
391
|
|
|
392
|
+
|
|
393
|
+
var INVOICE_STATUSES = Object.values(_chunk4ORLPEK7js.InvoiceStatus);
|
|
392
394
|
function getStatusBadgeVariant2(status) {
|
|
393
395
|
switch (status) {
|
|
394
396
|
case "paid" /* PAID */:
|
|
@@ -403,73 +405,61 @@ function getStatusBadgeVariant2(status) {
|
|
|
403
405
|
}
|
|
404
406
|
}
|
|
405
407
|
_chunk7QVYU63Ejs.__name.call(void 0, getStatusBadgeVariant2, "getStatusBadgeVariant");
|
|
406
|
-
function
|
|
407
|
-
return new Date(date).toLocaleDateString(void 0, {
|
|
408
|
-
year: "numeric",
|
|
409
|
-
month: "short",
|
|
410
|
-
day: "numeric"
|
|
411
|
-
});
|
|
412
|
-
}
|
|
413
|
-
_chunk7QVYU63Ejs.__name.call(void 0, formatDate2, "formatDate");
|
|
414
|
-
function formatAmount(amount, currency) {
|
|
408
|
+
function formatAmount(amount, currency, locale) {
|
|
415
409
|
const currencyCode = _optionalChain([currency, 'optionalAccess', _14 => _14.toUpperCase, 'call', _15 => _15()]) || "USD";
|
|
416
|
-
return new Intl.NumberFormat(
|
|
410
|
+
return new Intl.NumberFormat(locale, {
|
|
417
411
|
style: "currency",
|
|
418
412
|
currency: currencyCode
|
|
419
413
|
}).format(amount / 100);
|
|
420
414
|
}
|
|
421
415
|
_chunk7QVYU63Ejs.__name.call(void 0, formatAmount, "formatAmount");
|
|
422
416
|
function InvoicesSummaryCard({ invoices, loading, error, onViewAllClick }) {
|
|
417
|
+
const t = _nextintl.useTranslations.call(void 0, );
|
|
418
|
+
const fmt = _chunkVDVIUDY5js.useBillingFormatOptions.call(void 0, );
|
|
423
419
|
if (loading) {
|
|
424
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
425
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
426
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
420
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.Card, { children: [
|
|
421
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
422
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.CardTitle, { children: t("billing.ui.cards.invoices.title") }),
|
|
427
423
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
428
424
|
] }),
|
|
429
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
430
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
431
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
432
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
425
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.CardContent, { children: [
|
|
426
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Skeleton, { className: "h-6 w-24 mb-2" }),
|
|
427
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Skeleton, { className: "h-4 w-32 mb-1" }),
|
|
428
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Skeleton, { className: "h-4 w-20" })
|
|
433
429
|
] })
|
|
434
430
|
] });
|
|
435
431
|
}
|
|
436
432
|
if (error) {
|
|
437
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
438
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
439
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
433
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.Card, { children: [
|
|
434
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
435
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.CardTitle, { children: t("billing.ui.cards.invoices.title") }),
|
|
440
436
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
441
437
|
] }),
|
|
442
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
438
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
443
439
|
] });
|
|
444
440
|
}
|
|
445
441
|
const latestInvoice = invoices[0];
|
|
446
442
|
const paidInvoices = invoices.filter((inv) => inv.status === "paid" /* PAID */);
|
|
447
443
|
const openInvoices = invoices.filter((inv) => inv.status === "open" /* OPEN */);
|
|
448
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
449
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
450
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
444
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewAllClick, children: [
|
|
445
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
446
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.CardTitle, { children: t("billing.ui.cards.invoices.title") }),
|
|
451
447
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ReceiptIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
452
448
|
] }),
|
|
453
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
454
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "
|
|
455
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "
|
|
449
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.CardContent, { children: invoices.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
450
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: t("billing.ui.invoices.empty_title") }),
|
|
451
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.invoices.empty_description") })
|
|
456
452
|
] }) : latestInvoice ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
457
453
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
|
|
458
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: formatAmount(latestInvoice.total, latestInvoice.currency) }),
|
|
459
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
454
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: formatAmount(latestInvoice.total, latestInvoice.currency, fmt.locale) }),
|
|
455
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Badge, { variant: getStatusBadgeVariant2(latestInvoice.status), children: INVOICE_STATUSES.includes(latestInvoice.status) ? t(`billing.ui.invoice_status.${latestInvoice.status}`) : latestInvoice.status })
|
|
460
456
|
] }),
|
|
461
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: latestInvoice.stripeInvoiceNumber ||
|
|
457
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: latestInvoice.stripeInvoiceNumber || t("billing.ui.cards.invoices.invoice_from", { date: _chunkVDVIUDY5js.formatDate.call(void 0, latestInvoice.periodStart, fmt) }) }),
|
|
462
458
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-4 text-xs text-muted-foreground", children: [
|
|
463
|
-
paidInvoices.length > 0 && /* @__PURE__ */ _jsxruntime.
|
|
464
|
-
|
|
465
|
-
" paid"
|
|
466
|
-
] }),
|
|
467
|
-
openInvoices.length > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "text-warning", children: [
|
|
468
|
-
openInvoices.length,
|
|
469
|
-
" open"
|
|
470
|
-
] }),
|
|
459
|
+
paidInvoices.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: t("billing.ui.cards.invoices.paid_count", { count: paidInvoices.length }) }),
|
|
460
|
+
openInvoices.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-warning", children: t("billing.ui.cards.invoices.open_count", { count: openInvoices.length }) }),
|
|
471
461
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex items-center", children: [
|
|
472
|
-
"
|
|
462
|
+
t("billing.ui.cards.view_all"),
|
|
473
463
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ChevronRight, { className: "h-3 w-3 ms-1 rtl:rotate-180" })
|
|
474
464
|
] })
|
|
475
465
|
] })
|
|
@@ -481,8 +471,9 @@ _chunk7QVYU63Ejs.__name.call(void 0, InvoicesSummaryCard, "InvoicesSummaryCard")
|
|
|
481
471
|
// src/features/billing/components/cards/BillingUsageSummaryCard.tsx
|
|
482
472
|
|
|
483
473
|
|
|
484
|
-
|
|
485
|
-
|
|
474
|
+
|
|
475
|
+
function formatNumber(value, locale) {
|
|
476
|
+
return new Intl.NumberFormat(locale, {
|
|
486
477
|
notation: "compact",
|
|
487
478
|
compactDisplay: "short"
|
|
488
479
|
}).format(value);
|
|
@@ -495,25 +486,27 @@ function BillingUsageSummaryCard({
|
|
|
495
486
|
error,
|
|
496
487
|
onViewDetailsClick
|
|
497
488
|
}) {
|
|
489
|
+
const t = _nextintl.useTranslations.call(void 0, );
|
|
490
|
+
const locale = _chunk4ORLPEK7js.useI18nLocale.call(void 0, );
|
|
498
491
|
if (loading) {
|
|
499
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
500
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
501
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
492
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.Card, { children: [
|
|
493
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
494
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.CardTitle, { children: t("billing.ui.cards.usage.title") }),
|
|
502
495
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
503
496
|
] }),
|
|
504
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
505
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
506
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
497
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.CardContent, { children: [
|
|
498
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Skeleton, { className: "h-6 w-24 mb-2" }),
|
|
499
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Skeleton, { className: "h-4 w-32" })
|
|
507
500
|
] })
|
|
508
501
|
] });
|
|
509
502
|
}
|
|
510
503
|
if (error) {
|
|
511
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
512
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
513
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
504
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.Card, { children: [
|
|
505
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
506
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.CardTitle, { children: t("billing.ui.cards.usage.title") }),
|
|
514
507
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
515
508
|
] }),
|
|
516
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
509
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error }) })
|
|
517
510
|
] });
|
|
518
511
|
}
|
|
519
512
|
const totalUsage = Object.values(summaries).reduce((acc, summary) => {
|
|
@@ -521,31 +514,24 @@ function BillingUsageSummaryCard({
|
|
|
521
514
|
}, 0);
|
|
522
515
|
const primaryMeter = meters.find((m) => _optionalChain([summaries, 'access', _17 => _17[m.id], 'optionalAccess', _18 => _18.aggregatedValue]));
|
|
523
516
|
const primarySummary = primaryMeter ? summaries[primaryMeter.id] : null;
|
|
524
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
525
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
526
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
517
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.Card, { className: "cursor-pointer hover:bg-accent/50 transition-colors", onClick: onViewDetailsClick, children: [
|
|
518
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.CardHeader, { className: "flex flex-row items-center justify-between space-y-0 pb-2", children: [
|
|
519
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.CardTitle, { children: t("billing.ui.cards.usage.title") }),
|
|
527
520
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-4 w-4 text-muted-foreground" })
|
|
528
521
|
] }),
|
|
529
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
530
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: "
|
|
531
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: "
|
|
522
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.CardContent, { children: meters.length === 0 ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
523
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold text-muted-foreground", children: t("billing.ui.cards.usage.no_meters") }),
|
|
524
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.usage.no_meters_description") })
|
|
532
525
|
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
533
|
-
/* @__PURE__ */ _jsxruntime.
|
|
534
|
-
formatNumber(totalUsage),
|
|
535
|
-
" units"
|
|
536
|
-
] }),
|
|
526
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xl font-bold", children: t("billing.ui.cards.usage.units", { value: formatNumber(totalUsage, locale) }) }),
|
|
537
527
|
primaryMeter && primarySummary && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm text-muted-foreground", children: [
|
|
538
528
|
primaryMeter.displayName,
|
|
539
529
|
": ",
|
|
540
|
-
formatNumber(primarySummary.aggregatedValue)
|
|
541
|
-
] }),
|
|
542
|
-
meters.length > 1 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-xs text-muted-foreground", children: [
|
|
543
|
-
"Across ",
|
|
544
|
-
meters.length,
|
|
545
|
-
" meters"
|
|
530
|
+
formatNumber(primarySummary.aggregatedValue, locale)
|
|
546
531
|
] }),
|
|
532
|
+
meters.length > 1 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-muted-foreground", children: t("billing.ui.cards.usage.across_meters", { count: meters.length }) }),
|
|
547
533
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex items-center text-xs text-muted-foreground", children: [
|
|
548
|
-
"
|
|
534
|
+
t("billing.ui.cards.view_details"),
|
|
549
535
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ChevronRight, { className: "h-3 w-3 ms-1 rtl:rotate-180" })
|
|
550
536
|
] })
|
|
551
537
|
] }) })
|
|
@@ -555,6 +541,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, BillingUsageSummaryCard, "BillingUsageSumma
|
|
|
555
541
|
|
|
556
542
|
// src/features/billing/components/containers/BillingDashboardContainer.tsx
|
|
557
543
|
|
|
544
|
+
|
|
558
545
|
var _navigation = require('next/navigation');
|
|
559
546
|
|
|
560
547
|
|
|
@@ -562,11 +549,17 @@ var _navigation = require('next/navigation');
|
|
|
562
549
|
|
|
563
550
|
|
|
564
551
|
|
|
552
|
+
|
|
553
|
+
// src/features/billing/stripe-customer/components/forms/PaymentMethodEditor.tsx
|
|
554
|
+
|
|
555
|
+
|
|
565
556
|
// src/features/billing/stripe-customer/components/forms/PaymentMethodForm.tsx
|
|
557
|
+
|
|
566
558
|
var _reactstripejs = require('@stripe/react-stripe-js');
|
|
567
559
|
|
|
568
560
|
|
|
569
561
|
function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
|
|
562
|
+
const t = _nextintl.useTranslations.call(void 0, );
|
|
570
563
|
const stripe = _reactstripejs.useStripe.call(void 0, );
|
|
571
564
|
const elements = _reactstripejs.useElements.call(void 0, );
|
|
572
565
|
const [setupIntent, setSetupIntent] = _react.useState.call(void 0, null);
|
|
@@ -578,11 +571,11 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
|
|
|
578
571
|
const fetchSetupIntent = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
579
572
|
setLoading(true);
|
|
580
573
|
try {
|
|
581
|
-
const intent = await
|
|
574
|
+
const intent = await _chunk4ORLPEK7js.StripeCustomerService.createSetupIntent();
|
|
582
575
|
setSetupIntent(intent);
|
|
583
576
|
} catch (err) {
|
|
584
577
|
console.error("[PaymentMethodForm] Failed to create setup intent:", err);
|
|
585
|
-
setError("
|
|
578
|
+
setError(t("billing.ui.payment_form.errors.init"));
|
|
586
579
|
} finally {
|
|
587
580
|
setLoading(false);
|
|
588
581
|
}
|
|
@@ -611,28 +604,28 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
|
|
|
611
604
|
);
|
|
612
605
|
if (stripeError) {
|
|
613
606
|
console.error("[PaymentMethodForm] Stripe error:", stripeError);
|
|
614
|
-
setError(stripeError.message || "
|
|
607
|
+
setError(stripeError.message || t("billing.ui.payment_form.errors.add"));
|
|
615
608
|
setIsSubmitting(false);
|
|
616
609
|
return;
|
|
617
610
|
}
|
|
618
611
|
if (setAsDefault && _optionalChain([confirmedSetupIntent, 'optionalAccess', _19 => _19.payment_method])) {
|
|
619
|
-
await
|
|
612
|
+
await _chunk4ORLPEK7js.StripeCustomerService.setDefaultPaymentMethod({
|
|
620
613
|
paymentMethodId: typeof confirmedSetupIntent.payment_method === "string" ? confirmedSetupIntent.payment_method : confirmedSetupIntent.payment_method.id
|
|
621
614
|
});
|
|
622
615
|
}
|
|
623
616
|
onSuccess();
|
|
624
617
|
} catch (err) {
|
|
625
618
|
console.error("[PaymentMethodForm] Error:", err);
|
|
626
|
-
setError(err.message || "
|
|
619
|
+
setError(err.message || t("billing.ui.payment_form.errors.unexpected"));
|
|
627
620
|
} finally {
|
|
628
621
|
setIsSubmitting(false);
|
|
629
622
|
}
|
|
630
623
|
}, "handleSubmit");
|
|
631
624
|
if (loading) {
|
|
632
|
-
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: "
|
|
625
|
+
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: t("billing.ui.payment_form.loading") }) });
|
|
633
626
|
}
|
|
634
627
|
if (!setupIntent && error) {
|
|
635
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
628
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.AlertDescription, { children: error }) });
|
|
636
629
|
}
|
|
637
630
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: handleSubmit, className: "flex flex-col gap-y-4", children: [
|
|
638
631
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rounded-md border border-gray-300 p-3", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -655,13 +648,13 @@ function PaymentMethodForm({ onSuccess, onCancel, isLoading = false }) {
|
|
|
655
648
|
}
|
|
656
649
|
) }),
|
|
657
650
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
658
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
659
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
651
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Checkbox, { id: "setAsDefault", checked: setAsDefault, onCheckedChange: (checked) => setSetAsDefault(!!checked) }),
|
|
652
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Label, { htmlFor: "setAsDefault", className: "cursor-pointer font-normal", children: t("billing.ui.payment_form.set_default") })
|
|
660
653
|
] }),
|
|
661
|
-
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
654
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Alert, { variant: "destructive", className: "bg-red-50 border-red-200", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.AlertDescription, { children: error }) }),
|
|
662
655
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-x-2", children: [
|
|
663
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
664
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
656
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Button, { type: "button", variant: "outline", onClick: onCancel, disabled: isSubmitting || isLoading, children: t("ui.buttons.cancel") }),
|
|
657
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Button, { type: "submit", disabled: !stripe || isSubmitting || isLoading, children: isSubmitting ? t("billing.ui.wizard.review.processing") : t("billing.ui.cards.payment_method.add_card") })
|
|
665
658
|
] })
|
|
666
659
|
] });
|
|
667
660
|
}
|
|
@@ -670,6 +663,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, PaymentMethodForm, "PaymentMethodForm");
|
|
|
670
663
|
// src/features/billing/stripe-customer/components/forms/PaymentMethodEditor.tsx
|
|
671
664
|
|
|
672
665
|
function PaymentMethodEditor({ open, onOpenChange, onSuccess }) {
|
|
666
|
+
const t = _nextintl.useTranslations.call(void 0, );
|
|
673
667
|
const handleSuccess = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
674
668
|
onSuccess();
|
|
675
669
|
onOpenChange(false);
|
|
@@ -677,10 +671,10 @@ function PaymentMethodEditor({ open, onOpenChange, onSuccess }) {
|
|
|
677
671
|
const handleCancel = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
678
672
|
onOpenChange(false);
|
|
679
673
|
}, "handleCancel");
|
|
680
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
681
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
682
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
683
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
674
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.DialogContent, { className: "max-w-md", children: [
|
|
675
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.DialogHeader, { children: [
|
|
676
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.DialogTitle, { children: t("billing.ui.payment_methods.add") }),
|
|
677
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.DialogDescription, { children: t("billing.ui.payment_methods.add_description") })
|
|
684
678
|
] }),
|
|
685
679
|
open && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodForm, { onSuccess: handleSuccess, onCancel: handleCancel })
|
|
686
680
|
] }) });
|
|
@@ -691,6 +685,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, PaymentMethodEditor, "PaymentMethodEditor")
|
|
|
691
685
|
|
|
692
686
|
|
|
693
687
|
|
|
688
|
+
|
|
694
689
|
var brandIcons = {
|
|
695
690
|
visa: "\u{1F4B3}",
|
|
696
691
|
mastercard: "\u{1F4B3}",
|
|
@@ -698,13 +693,14 @@ var brandIcons = {
|
|
|
698
693
|
discover: "\u{1F4B3}"
|
|
699
694
|
};
|
|
700
695
|
function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
696
|
+
const t = _nextintl.useTranslations.call(void 0, );
|
|
701
697
|
const [loading, setLoading] = _react.useState.call(void 0, false);
|
|
702
698
|
const [customer, setCustomer] = _react.useState.call(void 0, null);
|
|
703
699
|
const [showRemoveDialog, setShowRemoveDialog] = _react.useState.call(void 0, false);
|
|
704
700
|
_react.useEffect.call(void 0, () => {
|
|
705
701
|
const loadCustomer = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
706
702
|
try {
|
|
707
|
-
const fetchedCustomer = await
|
|
703
|
+
const fetchedCustomer = await _chunk4ORLPEK7js.StripeCustomerService.getCustomer();
|
|
708
704
|
setCustomer(fetchedCustomer);
|
|
709
705
|
} catch (error) {
|
|
710
706
|
console.error("[PaymentMethodCard] Failed to load customer:", error);
|
|
@@ -721,7 +717,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
721
717
|
const handleSetDefault = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
722
718
|
setLoading(true);
|
|
723
719
|
try {
|
|
724
|
-
await
|
|
720
|
+
await _chunk4ORLPEK7js.StripeCustomerService.setDefaultPaymentMethod({ paymentMethodId: paymentMethod.id });
|
|
725
721
|
onUpdate();
|
|
726
722
|
} catch (error) {
|
|
727
723
|
console.error("[PaymentMethodCard] Failed to set as default:", error);
|
|
@@ -732,7 +728,7 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
732
728
|
const handleRemove = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
733
729
|
setLoading(true);
|
|
734
730
|
try {
|
|
735
|
-
await
|
|
731
|
+
await _chunk4ORLPEK7js.StripeCustomerService.removePaymentMethod({ paymentMethodId: paymentMethod.id });
|
|
736
732
|
setShowRemoveDialog(false);
|
|
737
733
|
onUpdate();
|
|
738
734
|
} catch (error) {
|
|
@@ -741,16 +737,16 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
741
737
|
}
|
|
742
738
|
}, "handleRemove");
|
|
743
739
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
744
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
745
|
-
isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
746
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
740
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.Card, { className: "relative", children: [
|
|
741
|
+
isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Badge, { variant: "softGreen", className: "absolute end-2 top-2", children: t("billing.ui.payment_methods.default") }),
|
|
742
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.CardHeader, { className: "flex flex-row items-center justify-between pb-2", children: [
|
|
747
743
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
748
744
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-2xl", children: brandIcon }),
|
|
749
745
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium capitalize", children: brand })
|
|
750
746
|
] }),
|
|
751
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
752
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
753
|
-
|
|
747
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.DropdownMenu, { children: [
|
|
748
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.DropdownMenuTrigger, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
749
|
+
_chunkVDVIUDY5js.Button,
|
|
754
750
|
{
|
|
755
751
|
render: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {}),
|
|
756
752
|
nativeButton: false,
|
|
@@ -761,44 +757,39 @@ function PaymentMethodCard({ paymentMethod, onUpdate }) {
|
|
|
761
757
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.MoreVertical, { className: "h-4 w-4" })
|
|
762
758
|
}
|
|
763
759
|
) }),
|
|
764
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
765
|
-
!isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
760
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.DropdownMenuContent, { align: "end", children: [
|
|
761
|
+
!isDefault && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.DropdownMenuItem, { onClick: handleSetDefault, disabled: loading, children: t("billing.ui.payment_methods.set_default") }),
|
|
766
762
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
767
|
-
|
|
763
|
+
_chunkVDVIUDY5js.DropdownMenuItem,
|
|
768
764
|
{
|
|
769
765
|
onClick: () => setShowRemoveDialog(true),
|
|
770
766
|
disabled: loading,
|
|
771
767
|
className: "text-destructive",
|
|
772
|
-
children: "
|
|
768
|
+
children: t("ui.buttons.remove")
|
|
773
769
|
}
|
|
774
770
|
)
|
|
775
771
|
] })
|
|
776
772
|
] })
|
|
777
773
|
] }),
|
|
778
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
774
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.CardContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-1", children: [
|
|
779
775
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-lg font-semibold", children: [
|
|
780
776
|
"\u2022\u2022\u2022\u2022 ",
|
|
781
777
|
last4
|
|
782
778
|
] }),
|
|
783
|
-
/* @__PURE__ */ _jsxruntime.
|
|
784
|
-
"Expires ",
|
|
785
|
-
String(expMonth).padStart(2, "0"),
|
|
786
|
-
"/",
|
|
787
|
-
expYear
|
|
788
|
-
] })
|
|
779
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: t("billing.ui.payment_method.expires", { date: `${String(expMonth).padStart(2, "0")}/${expYear}` }) })
|
|
789
780
|
] }) })
|
|
790
781
|
] }),
|
|
791
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
792
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
793
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
794
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
795
|
-
"
|
|
796
|
-
isDefault && "
|
|
782
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.AlertDialog, { open: showRemoveDialog, onOpenChange: setShowRemoveDialog, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.AlertDialogContent, { children: [
|
|
783
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.AlertDialogHeader, { children: [
|
|
784
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.AlertDialogTitle, { children: t("billing.ui.payment_methods.remove_title") }),
|
|
785
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.AlertDialogDescription, { children: [
|
|
786
|
+
t("billing.ui.payment_methods.remove_description"),
|
|
787
|
+
isDefault && ` ${t("billing.ui.payment_methods.remove_default_warning")}`
|
|
797
788
|
] })
|
|
798
789
|
] }),
|
|
799
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
800
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
801
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
790
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.AlertDialogFooter, { children: [
|
|
791
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.AlertDialogCancel, { disabled: loading, children: t("ui.buttons.cancel") }),
|
|
792
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.AlertDialogAction, { onClick: handleRemove, disabled: loading, className: "bg-red-600 hover:bg-red-700", children: loading ? t("billing.ui.payment_methods.removing") : t("ui.buttons.remove") })
|
|
802
793
|
] })
|
|
803
794
|
] }) })
|
|
804
795
|
] });
|
|
@@ -815,13 +806,14 @@ _chunk7QVYU63Ejs.__name.call(void 0, PaymentMethodsList, "PaymentMethodsList");
|
|
|
815
806
|
// src/features/billing/stripe-customer/components/containers/PaymentMethodsContainer.tsx
|
|
816
807
|
|
|
817
808
|
function PaymentMethodsContainer() {
|
|
809
|
+
const t = _nextintl.useTranslations.call(void 0, );
|
|
818
810
|
const [paymentMethods, setPaymentMethods] = _react.useState.call(void 0, []);
|
|
819
811
|
const [loading, setLoading] = _react.useState.call(void 0, true);
|
|
820
812
|
const [showAddPaymentMethod, setShowAddPaymentMethod] = _react.useState.call(void 0, false);
|
|
821
813
|
const loadPaymentMethods = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
822
814
|
setLoading(true);
|
|
823
815
|
try {
|
|
824
|
-
const fetchedPaymentMethods = await
|
|
816
|
+
const fetchedPaymentMethods = await _chunk4ORLPEK7js.StripeCustomerService.listPaymentMethods();
|
|
825
817
|
setPaymentMethods(fetchedPaymentMethods);
|
|
826
818
|
} catch (error) {
|
|
827
819
|
console.error("[PaymentMethodsContainer] Failed to load payment methods:", error);
|
|
@@ -833,22 +825,22 @@ function PaymentMethodsContainer() {
|
|
|
833
825
|
loadPaymentMethods();
|
|
834
826
|
}, []);
|
|
835
827
|
if (loading) {
|
|
836
|
-
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-muted-foreground", children: "
|
|
828
|
+
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-muted-foreground", children: t("billing.ui.payment_methods.loading") }) });
|
|
837
829
|
}
|
|
838
830
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-6", children: [
|
|
839
831
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center justify-between", children: [
|
|
840
832
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
841
833
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8" }),
|
|
842
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: "
|
|
834
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: t("billing.ui.payment_methods.title") })
|
|
843
835
|
] }),
|
|
844
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
836
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Button, { onClick: () => setShowAddPaymentMethod(true), children: t("billing.ui.payment_methods.add") })
|
|
845
837
|
] }),
|
|
846
838
|
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: [
|
|
847
839
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-16 w-16 text-muted-foreground" }),
|
|
848
840
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
849
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "mb-2 text-sm font-medium", children: "
|
|
850
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mb-4 text-muted-foreground", children: "
|
|
851
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
841
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "mb-2 text-sm font-medium", children: t("billing.ui.payment_methods.empty_title") }),
|
|
842
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mb-4 text-muted-foreground", children: t("billing.ui.payment_methods.empty_description") }),
|
|
843
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Button, { onClick: () => setShowAddPaymentMethod(true), children: t("billing.ui.payment_methods.add_first") })
|
|
852
844
|
] })
|
|
853
845
|
] }),
|
|
854
846
|
paymentMethods.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodsList, { paymentMethods, onUpdate: loadPaymentMethods }),
|
|
@@ -867,56 +859,44 @@ _chunk7QVYU63Ejs.__name.call(void 0, PaymentMethodsContainer, "PaymentMethodsCon
|
|
|
867
859
|
// src/features/billing/stripe-invoice/components/containers/InvoicesContainer.tsx
|
|
868
860
|
|
|
869
861
|
|
|
862
|
+
|
|
870
863
|
// src/features/billing/stripe-invoice/components/lists/InvoicesList.tsx
|
|
871
864
|
|
|
872
865
|
|
|
873
|
-
// src/features/billing/components/utils/date.ts
|
|
874
|
-
function formatDate3(date) {
|
|
875
|
-
if (!date) return "N/A";
|
|
876
|
-
const dateObj = typeof date === "string" ? new Date(date) : date;
|
|
877
|
-
try {
|
|
878
|
-
return new Intl.DateTimeFormat("en-US", {
|
|
879
|
-
month: "short",
|
|
880
|
-
day: "numeric",
|
|
881
|
-
year: "numeric"
|
|
882
|
-
}).format(dateObj);
|
|
883
|
-
} catch (error) {
|
|
884
|
-
console.error("Error formatting date:", error);
|
|
885
|
-
return "Invalid Date";
|
|
886
|
-
}
|
|
887
|
-
}
|
|
888
|
-
_chunk7QVYU63Ejs.__name.call(void 0, formatDate3, "formatDate");
|
|
889
866
|
|
|
890
867
|
// src/features/billing/stripe-invoice/components/details/InvoiceDetails.tsx
|
|
891
868
|
|
|
892
869
|
|
|
870
|
+
|
|
893
871
|
// src/features/billing/stripe-invoice/components/widgets/InvoiceStatusBadge.tsx
|
|
894
872
|
|
|
873
|
+
|
|
895
874
|
var statusConfig = {
|
|
896
875
|
["draft" /* DRAFT */]: {
|
|
897
|
-
label: "
|
|
876
|
+
label: "billing.ui.invoice_status.draft",
|
|
898
877
|
variant: "softGray"
|
|
899
878
|
},
|
|
900
879
|
["open" /* OPEN */]: {
|
|
901
|
-
label: "
|
|
880
|
+
label: "billing.ui.invoice_status.open",
|
|
902
881
|
variant: "softBlue"
|
|
903
882
|
},
|
|
904
883
|
["paid" /* PAID */]: {
|
|
905
|
-
label: "
|
|
884
|
+
label: "billing.ui.invoice_status.paid",
|
|
906
885
|
variant: "softGreen"
|
|
907
886
|
},
|
|
908
887
|
["void" /* VOID */]: {
|
|
909
|
-
label: "
|
|
888
|
+
label: "billing.ui.invoice_status.void",
|
|
910
889
|
variant: "softGray"
|
|
911
890
|
},
|
|
912
891
|
["uncollectible" /* UNCOLLECTIBLE */]: {
|
|
913
|
-
label: "
|
|
892
|
+
label: "billing.ui.invoice_status.uncollectible",
|
|
914
893
|
variant: "softRed"
|
|
915
894
|
}
|
|
916
895
|
};
|
|
917
896
|
function InvoiceStatusBadge({ status }) {
|
|
897
|
+
const t = _nextintl.useTranslations.call(void 0, );
|
|
918
898
|
const config = statusConfig[status] || statusConfig["draft" /* DRAFT */];
|
|
919
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
899
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Badge, { variant: config.variant, children: t(config.label) });
|
|
920
900
|
}
|
|
921
901
|
_chunk7QVYU63Ejs.__name.call(void 0, InvoiceStatusBadge, "InvoiceStatusBadge");
|
|
922
902
|
|
|
@@ -928,6 +908,8 @@ function InvoiceDetails({
|
|
|
928
908
|
onOpenChange,
|
|
929
909
|
onInvoiceChange: _onInvoiceChange
|
|
930
910
|
}) {
|
|
911
|
+
const t = _nextintl.useTranslations.call(void 0, );
|
|
912
|
+
const fmt = _chunkVDVIUDY5js.useBillingFormatOptions.call(void 0, );
|
|
931
913
|
const handleDownloadPDF = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
932
914
|
if (invoice.stripePdfUrl) {
|
|
933
915
|
window.open(invoice.stripePdfUrl, "_blank");
|
|
@@ -946,89 +928,86 @@ function InvoiceDetails({
|
|
|
946
928
|
}
|
|
947
929
|
return invoice.stripeInvoiceId.slice(-8);
|
|
948
930
|
}, "getInvoiceNumber");
|
|
949
|
-
const productName = _optionalChain([invoice, 'access', _29 => _29.subscription, 'optionalAccess', _30 => _30.price, 'optionalAccess', _31 => _31.product, 'optionalAccess', _32 => _32.name]) || "
|
|
950
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
951
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
952
|
-
/* @__PURE__ */ _jsxruntime.
|
|
953
|
-
|
|
954
|
-
getInvoiceNumber()
|
|
955
|
-
] }),
|
|
956
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkORU7KLCYjs.DialogDescription, { children: formatDate3(invoice.periodStart) })
|
|
931
|
+
const productName = _optionalChain([invoice, 'access', _29 => _29.subscription, 'optionalAccess', _30 => _30.price, 'optionalAccess', _31 => _31.product, 'optionalAccess', _32 => _32.name]) || t("billing.ui.cards.subscriptions.fallback_name");
|
|
932
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.DialogContent, { className: "max-w-2xl", children: [
|
|
933
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.DialogHeader, { children: [
|
|
934
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.DialogTitle, { children: t("billing.ui.invoice.title", { number: getInvoiceNumber() }) }),
|
|
935
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.DialogDescription, { children: _chunkVDVIUDY5js.formatDate.call(void 0, invoice.periodStart, fmt) })
|
|
957
936
|
] }),
|
|
958
937
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
959
938
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
960
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium text-muted-foreground", children: "
|
|
939
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-medium text-muted-foreground", children: t("billing.ui.labels.status") }),
|
|
961
940
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, InvoiceStatusBadge, { status: invoice.status })
|
|
962
941
|
] }),
|
|
963
942
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-4", children: [
|
|
964
943
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
965
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: "
|
|
944
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.billing_period") }),
|
|
966
945
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm", children: [
|
|
967
|
-
|
|
946
|
+
_chunkVDVIUDY5js.formatDate.call(void 0, invoice.periodStart, fmt),
|
|
968
947
|
" - ",
|
|
969
|
-
|
|
948
|
+
_chunkVDVIUDY5js.formatDate.call(void 0, invoice.periodEnd, fmt)
|
|
970
949
|
] })
|
|
971
950
|
] }),
|
|
972
951
|
invoice.dueDate && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
973
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: "
|
|
974
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm", children:
|
|
952
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.due_date") }),
|
|
953
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm", children: _chunkVDVIUDY5js.formatDate.call(void 0, invoice.dueDate, fmt) })
|
|
975
954
|
] }),
|
|
976
955
|
invoice.paidAt && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
977
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: "
|
|
978
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm", children:
|
|
956
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.paid_date") }),
|
|
957
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm", children: _chunkVDVIUDY5js.formatDate.call(void 0, invoice.paidAt, fmt) })
|
|
979
958
|
] }),
|
|
980
959
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
981
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: "
|
|
960
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.attempt_count") }),
|
|
982
961
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm", children: invoice.attemptCount })
|
|
983
962
|
] })
|
|
984
963
|
] }),
|
|
985
964
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
986
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "text-sm font-medium text-muted-foreground mb-2", children: "
|
|
965
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "text-sm font-medium text-muted-foreground mb-2", children: t("billing.ui.invoice.line_items") }),
|
|
987
966
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "table", { className: "w-full", children: [
|
|
988
967
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "thead", { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "tr", { children: [
|
|
989
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "th", { className: "text-start p-3 text-sm font-medium", children: "
|
|
990
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "th", { className: "text-end p-3 text-sm font-medium", children: "
|
|
968
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "th", { className: "text-start p-3 text-sm font-medium", children: t("billing.ui.columns.description") }),
|
|
969
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "th", { className: "text-end p-3 text-sm font-medium", children: t("billing.ui.columns.amount") })
|
|
991
970
|
] }) }),
|
|
992
971
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "tbody", { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "tr", { className: "border-t", children: [
|
|
993
972
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "td", { className: "p-3", children: productName }),
|
|
994
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "td", { className: "p-3 text-end", children:
|
|
973
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "td", { className: "p-3 text-end", children: _chunkVDVIUDY5js.formatCurrency.call(void 0, invoice.subtotal, invoice.currency, fmt) })
|
|
995
974
|
] }) })
|
|
996
975
|
] }) })
|
|
997
976
|
] }),
|
|
998
977
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2 border-t pt-4", children: [
|
|
999
978
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1000
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: "
|
|
1001
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children:
|
|
979
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.subtotal") }),
|
|
980
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children: _chunkVDVIUDY5js.formatCurrency.call(void 0, invoice.subtotal, invoice.currency, fmt) })
|
|
1002
981
|
] }),
|
|
1003
982
|
invoice.tax !== void 0 && invoice.tax > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1004
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: "
|
|
1005
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children:
|
|
983
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.tax") }),
|
|
984
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children: _chunkVDVIUDY5js.formatCurrency.call(void 0, invoice.tax, invoice.currency, fmt) })
|
|
1006
985
|
] }),
|
|
1007
986
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between text-lg font-semibold border-t pt-2", children: [
|
|
1008
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "
|
|
1009
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children:
|
|
987
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: t("billing.ui.invoice.total") }),
|
|
988
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _chunkVDVIUDY5js.formatCurrency.call(void 0, invoice.total, invoice.currency, fmt) })
|
|
1010
989
|
] }),
|
|
1011
990
|
invoice.amountPaid > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1012
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: "
|
|
1013
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-success", children:
|
|
991
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.amount_paid") }),
|
|
992
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-success", children: _chunkVDVIUDY5js.formatCurrency.call(void 0, invoice.amountPaid, invoice.currency, fmt) })
|
|
1014
993
|
] }),
|
|
1015
994
|
invoice.amountRemaining > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1016
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: "
|
|
1017
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-destructive", children:
|
|
995
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.invoice.amount_due") }),
|
|
996
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-destructive", children: _chunkVDVIUDY5js.formatCurrency.call(void 0, invoice.amountRemaining, invoice.currency, fmt) })
|
|
1018
997
|
] })
|
|
1019
998
|
] }),
|
|
1020
999
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2 pt-4 border-t", children: [
|
|
1021
|
-
invoice.stripePdfUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1000
|
+
invoice.stripePdfUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.Button, { variant: "outline", onClick: handleDownloadPDF, children: [
|
|
1022
1001
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Download, { className: "me-2 h-4 w-4" }),
|
|
1023
|
-
"
|
|
1002
|
+
t("billing.ui.invoice.download_pdf")
|
|
1024
1003
|
] }),
|
|
1025
|
-
invoice.status === "open" /* OPEN */ && invoice.attempted && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1004
|
+
invoice.status === "open" /* OPEN */ && invoice.attempted && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.Button, { variant: "default", onClick: handleRetryPayment, children: [
|
|
1026
1005
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RefreshCw, { className: "me-2 h-4 w-4" }),
|
|
1027
|
-
"
|
|
1006
|
+
t("billing.ui.invoice.retry_payment")
|
|
1028
1007
|
] }),
|
|
1029
|
-
invoice.stripeHostedInvoiceUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1008
|
+
invoice.stripeHostedInvoiceUrl && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.Button, { variant: "outline", onClick: handleViewInStripe, children: [
|
|
1030
1009
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ExternalLink, { className: "me-2 h-4 w-4" }),
|
|
1031
|
-
"
|
|
1010
|
+
t("billing.ui.invoice.view_in_stripe")
|
|
1032
1011
|
] })
|
|
1033
1012
|
] })
|
|
1034
1013
|
] })
|
|
@@ -1039,6 +1018,8 @@ _chunk7QVYU63Ejs.__name.call(void 0, InvoiceDetails, "InvoiceDetails");
|
|
|
1039
1018
|
// src/features/billing/stripe-invoice/components/lists/InvoicesList.tsx
|
|
1040
1019
|
|
|
1041
1020
|
function InvoicesList({ invoices, onInvoicesChange }) {
|
|
1021
|
+
const t = _nextintl.useTranslations.call(void 0, );
|
|
1022
|
+
const fmt = _chunkVDVIUDY5js.useBillingFormatOptions.call(void 0, );
|
|
1042
1023
|
const [selectedInvoice, setSelectedInvoice] = _react.useState.call(void 0, null);
|
|
1043
1024
|
const handleRowClick = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (invoice) => {
|
|
1044
1025
|
setSelectedInvoice(invoice);
|
|
@@ -1050,30 +1031,30 @@ function InvoicesList({ invoices, onInvoicesChange }) {
|
|
|
1050
1031
|
return invoice.stripeInvoiceId.slice(-8);
|
|
1051
1032
|
}, "getInvoiceNumber");
|
|
1052
1033
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1053
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1054
|
-
/* @__PURE__ */ _jsxruntime.jsx.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,
|
|
1034
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.Table, { children: [
|
|
1035
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.TableRow, { children: [
|
|
1036
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.TableHead, { children: t("billing.ui.columns.invoice_number") }),
|
|
1037
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.TableHead, { children: t("billing.ui.columns.date") }),
|
|
1038
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.TableHead, { children: t("billing.ui.columns.status") }),
|
|
1039
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.TableHead, { className: "text-end", children: t("billing.ui.columns.amount") }),
|
|
1040
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.TableHead, { children: t("billing.ui.columns.period") })
|
|
1060
1041
|
] }) }),
|
|
1061
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1042
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.TableBody, { children: invoices.map((invoice) => {
|
|
1062
1043
|
const invoiceNumber = getInvoiceNumber(invoice);
|
|
1063
|
-
const date =
|
|
1064
|
-
const amount =
|
|
1065
|
-
const period = `${
|
|
1044
|
+
const date = _chunkVDVIUDY5js.formatDate.call(void 0, invoice.periodStart, fmt);
|
|
1045
|
+
const amount = _chunkVDVIUDY5js.formatCurrency.call(void 0, invoice.total, invoice.currency, fmt);
|
|
1046
|
+
const period = `${_chunkVDVIUDY5js.formatDate.call(void 0, invoice.periodStart, fmt)} - ${_chunkVDVIUDY5js.formatDate.call(void 0, invoice.periodEnd, fmt)}`;
|
|
1066
1047
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1067
|
-
|
|
1048
|
+
_chunkVDVIUDY5js.TableRow,
|
|
1068
1049
|
{
|
|
1069
1050
|
onClick: () => handleRowClick(invoice),
|
|
1070
1051
|
className: "cursor-pointer hover:bg-muted/50",
|
|
1071
1052
|
children: [
|
|
1072
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
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,
|
|
1053
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.TableCell, { className: "font-medium", children: invoiceNumber }),
|
|
1054
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.TableCell, { className: "text-muted-foreground text-xs", children: date }),
|
|
1055
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InvoiceStatusBadge, { status: invoice.status }) }),
|
|
1056
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.TableCell, { className: "text-end font-medium", children: amount }),
|
|
1057
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.TableCell, { className: "text-muted-foreground text-xs", children: period })
|
|
1077
1058
|
]
|
|
1078
1059
|
},
|
|
1079
1060
|
invoice.id
|
|
@@ -1099,6 +1080,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, InvoicesList, "InvoicesList");
|
|
|
1099
1080
|
// src/features/billing/stripe-invoice/components/containers/InvoicesContainer.tsx
|
|
1100
1081
|
|
|
1101
1082
|
function InvoicesContainer() {
|
|
1083
|
+
const t = _nextintl.useTranslations.call(void 0, );
|
|
1102
1084
|
const [invoices, setInvoices] = _react.useState.call(void 0, []);
|
|
1103
1085
|
const [loading, setLoading] = _react.useState.call(void 0, true);
|
|
1104
1086
|
const [statusFilter, setStatusFilter] = _react.useState.call(void 0, "all");
|
|
@@ -1106,7 +1088,7 @@ function InvoicesContainer() {
|
|
|
1106
1088
|
setLoading(true);
|
|
1107
1089
|
try {
|
|
1108
1090
|
const params = statusFilter !== "all" ? { status: statusFilter } : void 0;
|
|
1109
|
-
const data = await
|
|
1091
|
+
const data = await _chunk4ORLPEK7js.StripeInvoiceService.listInvoices(params);
|
|
1110
1092
|
setInvoices(data);
|
|
1111
1093
|
} catch (error) {
|
|
1112
1094
|
console.error("[InvoicesContainer] Failed to load invoices:", error);
|
|
@@ -1122,17 +1104,17 @@ function InvoicesContainer() {
|
|
|
1122
1104
|
setStatusFilter(value);
|
|
1123
1105
|
}, "handleFilterChange");
|
|
1124
1106
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-4", children: [
|
|
1125
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
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,
|
|
1107
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Tabs, { value: statusFilter, onValueChange: handleFilterChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.TabsList, { children: [
|
|
1108
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.TabsTrigger, { value: "all", children: t("billing.ui.invoices.filter_all") }),
|
|
1109
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.TabsTrigger, { value: "paid" /* PAID */, children: t("billing.ui.invoice_status.paid") }),
|
|
1110
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.TabsTrigger, { value: "open" /* OPEN */, children: t("billing.ui.invoice_status.open") }),
|
|
1111
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.TabsTrigger, { value: "void" /* VOID */, children: t("billing.ui.invoice_status.void") }),
|
|
1112
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.TabsTrigger, { value: "uncollectible" /* UNCOLLECTIBLE */, children: t("billing.ui.invoice_status.uncollectible") })
|
|
1131
1113
|
] }) }),
|
|
1132
|
-
loading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-center py-8 text-muted-foreground", children: "
|
|
1114
|
+
loading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-center py-8 text-muted-foreground", children: t("billing.ui.invoices.loading") }),
|
|
1133
1115
|
!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: [
|
|
1134
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-lg font-medium text-muted-foreground mb-2", children: "
|
|
1135
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: "
|
|
1116
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-lg font-medium text-muted-foreground mb-2", children: t("billing.ui.invoices.empty_title") }),
|
|
1117
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: t("billing.ui.invoices.empty_description") })
|
|
1136
1118
|
] }),
|
|
1137
1119
|
!loading && invoices.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InvoicesList, { invoices, onInvoicesChange: loadInvoices })
|
|
1138
1120
|
] });
|
|
@@ -1143,13 +1125,17 @@ _chunk7QVYU63Ejs.__name.call(void 0, InvoicesContainer, "InvoicesContainer");
|
|
|
1143
1125
|
|
|
1144
1126
|
|
|
1145
1127
|
|
|
1128
|
+
|
|
1146
1129
|
// src/features/billing/stripe-subscription/components/lists/SubscriptionsList.tsx
|
|
1147
1130
|
|
|
1148
1131
|
|
|
1132
|
+
|
|
1149
1133
|
// src/features/billing/stripe-subscription/components/details/SubscriptionDetails.tsx
|
|
1150
1134
|
|
|
1151
1135
|
|
|
1136
|
+
|
|
1152
1137
|
// src/features/billing/stripe-subscription/components/forms/CancelSubscriptionDialog.tsx
|
|
1138
|
+
|
|
1153
1139
|
var _zod = require('@hookform/resolvers/zod');
|
|
1154
1140
|
|
|
1155
1141
|
var _reacthookform = require('react-hook-form');
|
|
@@ -1164,6 +1150,8 @@ function CancelSubscriptionDialog({
|
|
|
1164
1150
|
onOpenChange,
|
|
1165
1151
|
onSuccess
|
|
1166
1152
|
}) {
|
|
1153
|
+
const t = _nextintl.useTranslations.call(void 0, );
|
|
1154
|
+
const fmt = _chunkVDVIUDY5js.useBillingFormatOptions.call(void 0, );
|
|
1167
1155
|
const [isSubmitting, setIsSubmitting] = _react.useState.call(void 0, false);
|
|
1168
1156
|
const form = _reacthookform.useForm.call(void 0, {
|
|
1169
1157
|
resolver: _zod.zodResolver.call(void 0, formSchema),
|
|
@@ -1174,7 +1162,7 @@ function CancelSubscriptionDialog({
|
|
|
1174
1162
|
const onSubmit = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async (_values) => {
|
|
1175
1163
|
setIsSubmitting(true);
|
|
1176
1164
|
try {
|
|
1177
|
-
await
|
|
1165
|
+
await _chunk4ORLPEK7js.StripeSubscriptionService.cancelSubscription({
|
|
1178
1166
|
id: subscription.id,
|
|
1179
1167
|
cancelImmediately: false
|
|
1180
1168
|
});
|
|
@@ -1186,31 +1174,27 @@ function CancelSubscriptionDialog({
|
|
|
1186
1174
|
setIsSubmitting(false);
|
|
1187
1175
|
}
|
|
1188
1176
|
}, "onSubmit");
|
|
1189
|
-
const periodEndDate =
|
|
1190
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1191
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1192
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1193
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1177
|
+
const periodEndDate = _chunkVDVIUDY5js.formatDate.call(void 0, subscription.currentPeriodEnd, fmt);
|
|
1178
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.DialogContent, { className: "max-w-md", children: [
|
|
1179
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.DialogHeader, { children: [
|
|
1180
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.DialogTitle, { children: t("billing.ui.subscription.cancel.title") }),
|
|
1181
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.DialogDescription, { children: t("billing.ui.subscription.cancel.description") })
|
|
1194
1182
|
] }),
|
|
1195
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1196
|
-
/* @__PURE__ */ _jsxruntime.
|
|
1197
|
-
"Your subscription will remain active until ",
|
|
1198
|
-
periodEndDate,
|
|
1199
|
-
". You can continue using the service until then."
|
|
1200
|
-
] }),
|
|
1183
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Form, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: form.handleSubmit(onSubmit), className: "flex flex-col gap-y-4", children: [
|
|
1184
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "bg-primary/10 border-primary/30 text-foreground rounded-lg border p-3 text-sm", children: t("billing.ui.subscription.cancel.remains_active", { date: periodEndDate }) }),
|
|
1201
1185
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1202
|
-
|
|
1186
|
+
_chunkVDVIUDY5js.FormTextarea,
|
|
1203
1187
|
{
|
|
1204
1188
|
form,
|
|
1205
1189
|
id: "reason",
|
|
1206
|
-
name: "
|
|
1207
|
-
placeholder: "
|
|
1190
|
+
name: t("billing.ui.subscription.cancel.reason"),
|
|
1191
|
+
placeholder: t("billing.ui.subscription.cancel.reason_placeholder"),
|
|
1208
1192
|
className: "min-h-24"
|
|
1209
1193
|
}
|
|
1210
1194
|
),
|
|
1211
1195
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-x-2 justify-end pt-2", children: [
|
|
1212
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1213
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1196
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Button, { type: "button", variant: "outline", onClick: () => onOpenChange(false), disabled: isSubmitting, children: t("billing.ui.subscription.cancel.keep") }),
|
|
1197
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Button, { type: "submit", variant: "destructive", disabled: isSubmitting, children: isSubmitting ? t("billing.ui.subscription.cancel.canceling") : t("billing.ui.subscription.cancel.confirm") })
|
|
1214
1198
|
] })
|
|
1215
1199
|
] }) })
|
|
1216
1200
|
] }) });
|
|
@@ -1219,74 +1203,76 @@ _chunk7QVYU63Ejs.__name.call(void 0, CancelSubscriptionDialog, "CancelSubscripti
|
|
|
1219
1203
|
|
|
1220
1204
|
// src/features/billing/stripe-subscription/components/widgets/SubscriptionStatusBadge.tsx
|
|
1221
1205
|
|
|
1206
|
+
|
|
1222
1207
|
var statusConfig2 = {
|
|
1223
1208
|
["active" /* ACTIVE */]: {
|
|
1224
|
-
label: "
|
|
1209
|
+
label: "billing.ui.subscription_status.active",
|
|
1225
1210
|
variant: "softGreen"
|
|
1226
1211
|
},
|
|
1227
1212
|
["trialing" /* TRIALING */]: {
|
|
1228
|
-
label: "
|
|
1213
|
+
label: "billing.ui.subscription_status.trialing",
|
|
1229
1214
|
variant: "softBlue"
|
|
1230
1215
|
},
|
|
1231
1216
|
["past_due" /* PAST_DUE */]: {
|
|
1232
|
-
label: "
|
|
1217
|
+
label: "billing.ui.subscription_status.past_due",
|
|
1233
1218
|
variant: "softRed"
|
|
1234
1219
|
},
|
|
1235
1220
|
["canceled" /* CANCELED */]: {
|
|
1236
|
-
label: "
|
|
1221
|
+
label: "billing.ui.subscription_status.canceled",
|
|
1237
1222
|
variant: "softGray"
|
|
1238
1223
|
},
|
|
1239
1224
|
["paused" /* PAUSED */]: {
|
|
1240
|
-
label: "
|
|
1225
|
+
label: "billing.ui.subscription_status.paused",
|
|
1241
1226
|
variant: "softYellow"
|
|
1242
1227
|
},
|
|
1243
1228
|
["unpaid" /* UNPAID */]: {
|
|
1244
|
-
label: "
|
|
1229
|
+
label: "billing.ui.subscription_status.unpaid",
|
|
1245
1230
|
variant: "softOrange"
|
|
1246
1231
|
},
|
|
1247
1232
|
["incomplete" /* INCOMPLETE */]: {
|
|
1248
|
-
label: "
|
|
1233
|
+
label: "billing.ui.subscription_status.incomplete",
|
|
1249
1234
|
variant: "softGray"
|
|
1250
1235
|
},
|
|
1251
1236
|
["incomplete_expired" /* INCOMPLETE_EXPIRED */]: {
|
|
1252
|
-
label: "
|
|
1237
|
+
label: "billing.ui.subscription_status.incomplete_expired",
|
|
1253
1238
|
variant: "softGray"
|
|
1254
1239
|
}
|
|
1255
1240
|
};
|
|
1256
1241
|
var cancelingConfig = {
|
|
1257
|
-
label: "
|
|
1242
|
+
label: "billing.ui.cards.subscriptions.canceling",
|
|
1258
1243
|
variant: "softAmber"
|
|
1259
1244
|
};
|
|
1260
1245
|
function SubscriptionStatusBadge({ status, cancelAtPeriodEnd }) {
|
|
1246
|
+
const t = _nextintl.useTranslations.call(void 0, );
|
|
1261
1247
|
const config = cancelAtPeriodEnd ? cancelingConfig : statusConfig2[status] || statusConfig2["canceled" /* CANCELED */];
|
|
1262
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1248
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Badge, { variant: config.variant, children: t(config.label) });
|
|
1263
1249
|
}
|
|
1264
1250
|
_chunk7QVYU63Ejs.__name.call(void 0, SubscriptionStatusBadge, "SubscriptionStatusBadge");
|
|
1265
1251
|
|
|
1266
1252
|
// src/features/billing/stripe-subscription/components/details/SubscriptionDetails.tsx
|
|
1267
1253
|
|
|
1268
|
-
function formatPlanName2(price) {
|
|
1269
|
-
if (!price) return "
|
|
1254
|
+
function formatPlanName2(price, t) {
|
|
1255
|
+
if (!price) return t("billing.ui.not_available");
|
|
1270
1256
|
const productName = _optionalChain([price, 'access', _33 => _33.product, 'optionalAccess', _34 => _34.name]) || "";
|
|
1271
1257
|
const nickname = price.nickname || "";
|
|
1272
1258
|
let interval = "";
|
|
1273
1259
|
if (_optionalChain([price, 'access', _35 => _35.recurring, 'optionalAccess', _36 => _36.interval])) {
|
|
1274
1260
|
const intervalMap = {
|
|
1275
|
-
day: "
|
|
1276
|
-
week: "
|
|
1277
|
-
month: "
|
|
1278
|
-
year: "
|
|
1261
|
+
day: t("billing.admin.prices.interval.day"),
|
|
1262
|
+
week: t("billing.admin.prices.interval.week"),
|
|
1263
|
+
month: t("billing.admin.prices.interval.month"),
|
|
1264
|
+
year: t("billing.admin.prices.interval.year")
|
|
1279
1265
|
};
|
|
1280
1266
|
interval = intervalMap[price.recurring.interval] || price.recurring.interval;
|
|
1281
1267
|
}
|
|
1282
1268
|
const parts = [productName, nickname].filter(Boolean);
|
|
1283
1269
|
const planLabel = parts.join(" - ");
|
|
1284
|
-
return interval ? `${planLabel} (${interval})` : planLabel || "
|
|
1270
|
+
return interval ? `${planLabel} (${interval})` : planLabel || t("billing.ui.not_available");
|
|
1285
1271
|
}
|
|
1286
1272
|
_chunk7QVYU63Ejs.__name.call(void 0, formatPlanName2, "formatPlanName");
|
|
1287
|
-
function formatBillingAmount(price) {
|
|
1288
|
-
if (!_optionalChain([price, 'optionalAccess', _37 => _37.unitAmount])) return
|
|
1289
|
-
return
|
|
1273
|
+
function formatBillingAmount(price, notAvailable, fmt) {
|
|
1274
|
+
if (!_optionalChain([price, 'optionalAccess', _37 => _37.unitAmount])) return notAvailable;
|
|
1275
|
+
return _chunkVDVIUDY5js.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt);
|
|
1290
1276
|
}
|
|
1291
1277
|
_chunk7QVYU63Ejs.__name.call(void 0, formatBillingAmount, "formatBillingAmount");
|
|
1292
1278
|
function SubscriptionDetails({
|
|
@@ -1296,12 +1282,14 @@ function SubscriptionDetails({
|
|
|
1296
1282
|
onSubscriptionChange,
|
|
1297
1283
|
onChangePlan
|
|
1298
1284
|
}) {
|
|
1285
|
+
const t = _nextintl.useTranslations.call(void 0, );
|
|
1286
|
+
const fmt = _chunkVDVIUDY5js.useBillingFormatOptions.call(void 0, );
|
|
1299
1287
|
const [showCancel, setShowCancel] = _react.useState.call(void 0, false);
|
|
1300
1288
|
const [isProcessing, setIsProcessing] = _react.useState.call(void 0, false);
|
|
1301
1289
|
const handlePause = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1302
1290
|
setIsProcessing(true);
|
|
1303
1291
|
try {
|
|
1304
|
-
await
|
|
1292
|
+
await _chunk4ORLPEK7js.StripeSubscriptionService.pauseSubscription({ subscriptionId: subscription.id });
|
|
1305
1293
|
onSubscriptionChange();
|
|
1306
1294
|
} catch (error) {
|
|
1307
1295
|
console.error("[SubscriptionDetails] Failed to pause subscription:", error);
|
|
@@ -1312,7 +1300,7 @@ function SubscriptionDetails({
|
|
|
1312
1300
|
const handleResume = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1313
1301
|
setIsProcessing(true);
|
|
1314
1302
|
try {
|
|
1315
|
-
await
|
|
1303
|
+
await _chunk4ORLPEK7js.StripeSubscriptionService.resumeSubscription({ subscriptionId: subscription.id });
|
|
1316
1304
|
onSubscriptionChange();
|
|
1317
1305
|
} catch (error) {
|
|
1318
1306
|
console.error("[SubscriptionDetails] Failed to resume subscription:", error);
|
|
@@ -1322,7 +1310,7 @@ function SubscriptionDetails({
|
|
|
1322
1310
|
}, "handleResume");
|
|
1323
1311
|
const handleManageViaPortal = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
1324
1312
|
try {
|
|
1325
|
-
const { url } = await
|
|
1313
|
+
const { url } = await _chunk4ORLPEK7js.StripeCustomerService.createPortalSession();
|
|
1326
1314
|
window.open(url, "_blank");
|
|
1327
1315
|
} catch (error) {
|
|
1328
1316
|
console.error("[SubscriptionDetails] Failed to create portal session:", error);
|
|
@@ -1332,14 +1320,14 @@ function SubscriptionDetails({
|
|
|
1332
1320
|
const canResume = subscription.status === "paused" /* PAUSED */;
|
|
1333
1321
|
const canCancel = subscription.status === "active" /* ACTIVE */ || subscription.status === "trialing" /* TRIALING */ || subscription.status === "paused" /* PAUSED */;
|
|
1334
1322
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1335
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1336
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1337
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1338
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1323
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.DialogContent, { className: "max-w-2xl", children: [
|
|
1324
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.DialogHeader, { children: [
|
|
1325
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.DialogTitle, { children: t("billing.ui.subscription.details_title") }),
|
|
1326
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.DialogDescription, { children: t("billing.ui.subscription.details_description") })
|
|
1339
1327
|
] }),
|
|
1340
1328
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
1341
1329
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
1342
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: "
|
|
1330
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.labels.status") }),
|
|
1343
1331
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1344
1332
|
SubscriptionStatusBadge,
|
|
1345
1333
|
{
|
|
@@ -1350,38 +1338,35 @@ function SubscriptionDetails({
|
|
|
1350
1338
|
] }),
|
|
1351
1339
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
1352
1340
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1353
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: "
|
|
1354
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children: formatPlanName2(subscription.price) })
|
|
1341
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.labels.plan") }),
|
|
1342
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children: formatPlanName2(subscription.price, t) })
|
|
1355
1343
|
] }),
|
|
1356
1344
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1357
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: "
|
|
1358
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children: formatBillingAmount(subscription.price) })
|
|
1345
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.subscription.billing_amount") }),
|
|
1346
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children: formatBillingAmount(subscription.price, t("billing.ui.not_available"), fmt) })
|
|
1359
1347
|
] })
|
|
1360
1348
|
] }),
|
|
1361
1349
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "space-y-2", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1362
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: "
|
|
1350
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.subscription.current_period") }),
|
|
1363
1351
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "text-sm", children: [
|
|
1364
|
-
|
|
1352
|
+
_chunkVDVIUDY5js.formatDate.call(void 0, subscription.currentPeriodStart, fmt),
|
|
1365
1353
|
" - ",
|
|
1366
|
-
|
|
1354
|
+
_chunkVDVIUDY5js.formatDate.call(void 0, subscription.currentPeriodEnd, fmt)
|
|
1367
1355
|
] })
|
|
1368
1356
|
] }) }),
|
|
1369
1357
|
subscription.trialEnd && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between", children: [
|
|
1370
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: "
|
|
1371
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children:
|
|
1358
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.ui.subscription.trial_ends") }),
|
|
1359
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children: _chunkVDVIUDY5js.formatDate.call(void 0, subscription.trialEnd, fmt) })
|
|
1372
1360
|
] }),
|
|
1373
|
-
subscription.cancelAtPeriodEnd && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "bg-warning/15 border-warning/30 rounded-lg border p-3", children: /* @__PURE__ */ _jsxruntime.
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
formatDate3(subscription.currentPeriodEnd),
|
|
1377
|
-
"."
|
|
1378
|
-
] }) }),
|
|
1361
|
+
subscription.cancelAtPeriodEnd && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "bg-warning/15 border-warning/30 rounded-lg border p-3", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-warning text-xs/relaxed", children: t("billing.ui.subscription.cancel_at_period_end", {
|
|
1362
|
+
date: _chunkVDVIUDY5js.formatDate.call(void 0, subscription.currentPeriodEnd, fmt)
|
|
1363
|
+
}) }) }),
|
|
1379
1364
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-wrap gap-2 pt-4 border-t", children: [
|
|
1380
|
-
onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1381
|
-
canPause && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1382
|
-
canResume && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1383
|
-
canCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1384
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1365
|
+
onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Button, { variant: "default", onClick: () => onChangePlan(subscription), children: t("billing.ui.subscription.change_plan") }),
|
|
1366
|
+
canPause && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Button, { variant: "outline", onClick: handlePause, disabled: isProcessing, children: isProcessing ? t("billing.ui.subscription.pausing") : t("billing.ui.subscription.pause") }),
|
|
1367
|
+
canResume && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Button, { variant: "outline", onClick: handleResume, disabled: isProcessing, children: isProcessing ? t("billing.ui.subscription.resuming") : t("billing.ui.subscription.resume") }),
|
|
1368
|
+
canCancel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Button, { variant: "destructive", onClick: () => setShowCancel(true), children: t("ui.buttons.cancel") }),
|
|
1369
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Button, { variant: "outline", onClick: handleManageViaPortal, children: t("billing.ui.subscription.manage_portal") })
|
|
1385
1370
|
] })
|
|
1386
1371
|
] })
|
|
1387
1372
|
] }) }),
|
|
@@ -1403,61 +1388,63 @@ _chunk7QVYU63Ejs.__name.call(void 0, SubscriptionDetails, "SubscriptionDetails")
|
|
|
1403
1388
|
|
|
1404
1389
|
// src/features/billing/stripe-subscription/components/lists/SubscriptionsList.tsx
|
|
1405
1390
|
|
|
1406
|
-
function formatPlanName3(price) {
|
|
1407
|
-
if (!price) return "
|
|
1391
|
+
function formatPlanName3(price, t) {
|
|
1392
|
+
if (!price) return t("billing.ui.not_available");
|
|
1408
1393
|
const productName = _optionalChain([price, 'access', _38 => _38.product, 'optionalAccess', _39 => _39.name]) || "";
|
|
1409
1394
|
const nickname = price.nickname || "";
|
|
1410
1395
|
let interval = "";
|
|
1411
1396
|
if (_optionalChain([price, 'access', _40 => _40.recurring, 'optionalAccess', _41 => _41.interval])) {
|
|
1412
1397
|
const intervalMap = {
|
|
1413
|
-
day: "
|
|
1414
|
-
week: "
|
|
1415
|
-
month: "
|
|
1416
|
-
year: "
|
|
1398
|
+
day: t("billing.admin.prices.interval.day"),
|
|
1399
|
+
week: t("billing.admin.prices.interval.week"),
|
|
1400
|
+
month: t("billing.admin.prices.interval.month"),
|
|
1401
|
+
year: t("billing.admin.prices.interval.year")
|
|
1417
1402
|
};
|
|
1418
1403
|
interval = intervalMap[price.recurring.interval] || price.recurring.interval;
|
|
1419
1404
|
}
|
|
1420
1405
|
const parts = [productName, nickname].filter(Boolean);
|
|
1421
1406
|
const planLabel = parts.join(" - ");
|
|
1422
|
-
return interval ? `${planLabel} (${interval})` : planLabel || "
|
|
1407
|
+
return interval ? `${planLabel} (${interval})` : planLabel || t("billing.ui.not_available");
|
|
1423
1408
|
}
|
|
1424
1409
|
_chunk7QVYU63Ejs.__name.call(void 0, formatPlanName3, "formatPlanName");
|
|
1425
1410
|
function SubscriptionsList({ subscriptions, onSubscriptionsChange, onChangePlan }) {
|
|
1411
|
+
const t = _nextintl.useTranslations.call(void 0, );
|
|
1412
|
+
const fmt = _chunkVDVIUDY5js.useBillingFormatOptions.call(void 0, );
|
|
1426
1413
|
const [selectedSub, setSelectedSub] = _react.useState.call(void 0, null);
|
|
1427
1414
|
const handleRowClick = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (subscription) => {
|
|
1428
1415
|
setSelectedSub(subscription);
|
|
1429
1416
|
}, "handleRowClick");
|
|
1430
1417
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1431
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1432
|
-
/* @__PURE__ */ _jsxruntime.jsx.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,
|
|
1418
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg overflow-clip", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.Table, { children: [
|
|
1419
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.TableRow, { children: [
|
|
1420
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.TableHead, { children: t("billing.ui.columns.status") }),
|
|
1421
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.TableHead, { children: t("billing.ui.columns.plan") }),
|
|
1422
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.TableHead, { children: t("billing.ui.columns.period") }),
|
|
1423
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.TableHead, { className: "text-end", children: t("billing.ui.columns.amount") }),
|
|
1424
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.TableHead, { className: "text-end", children: t("billing.ui.columns.actions") })
|
|
1438
1425
|
] }) }),
|
|
1439
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1426
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.TableBody, { children: subscriptions.map((subscription) => {
|
|
1440
1427
|
const price = subscription.price;
|
|
1441
|
-
const amount = _optionalChain([price, 'optionalAccess', _42 => _42.unitAmount]) ?
|
|
1442
|
-
const period = `${
|
|
1428
|
+
const amount = _optionalChain([price, 'optionalAccess', _42 => _42.unitAmount]) ? _chunkVDVIUDY5js.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt) : "0";
|
|
1429
|
+
const period = `${_chunkVDVIUDY5js.formatDate.call(void 0, subscription.currentPeriodStart, fmt)} - ${_chunkVDVIUDY5js.formatDate.call(void 0, subscription.currentPeriodEnd, fmt)}`;
|
|
1443
1430
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1444
|
-
|
|
1431
|
+
_chunkVDVIUDY5js.TableRow,
|
|
1445
1432
|
{
|
|
1446
1433
|
onClick: () => handleRowClick(subscription),
|
|
1447
1434
|
className: "cursor-pointer hover:bg-muted/50",
|
|
1448
1435
|
children: [
|
|
1449
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1436
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.TableCell, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1450
1437
|
SubscriptionStatusBadge,
|
|
1451
1438
|
{
|
|
1452
1439
|
status: subscription.status,
|
|
1453
1440
|
cancelAtPeriodEnd: subscription.cancelAtPeriodEnd
|
|
1454
1441
|
}
|
|
1455
1442
|
) }),
|
|
1456
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1457
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1458
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1459
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1460
|
-
|
|
1443
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.TableCell, { className: "font-medium", children: formatPlanName3(price, t) }),
|
|
1444
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.TableCell, { className: "text-muted-foreground text-sm", children: period }),
|
|
1445
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.TableCell, { className: "text-end font-medium", children: amount }),
|
|
1446
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.TableCell, { className: "text-end", children: (subscription.status === "active" /* ACTIVE */ || subscription.status === "trialing" /* TRIALING */) && onChangePlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1447
|
+
_chunkVDVIUDY5js.Button,
|
|
1461
1448
|
{
|
|
1462
1449
|
size: "sm",
|
|
1463
1450
|
variant: "outline",
|
|
@@ -1465,7 +1452,7 @@ function SubscriptionsList({ subscriptions, onSubscriptionsChange, onChangePlan
|
|
|
1465
1452
|
e.stopPropagation();
|
|
1466
1453
|
onChangePlan(subscription);
|
|
1467
1454
|
},
|
|
1468
|
-
children: "
|
|
1455
|
+
children: t("billing.ui.subscription.upgrade")
|
|
1469
1456
|
}
|
|
1470
1457
|
) })
|
|
1471
1458
|
]
|
|
@@ -1497,12 +1484,13 @@ _chunk7QVYU63Ejs.__name.call(void 0, SubscriptionsList, "SubscriptionsList");
|
|
|
1497
1484
|
// src/features/billing/stripe-subscription/components/containers/SubscriptionsContainer.tsx
|
|
1498
1485
|
|
|
1499
1486
|
function SubscriptionsContainer({ onOpenWizard, hasActiveRecurringSubscription }) {
|
|
1487
|
+
const t = _nextintl.useTranslations.call(void 0, );
|
|
1500
1488
|
const [subscriptions, setSubscriptions] = _react.useState.call(void 0, []);
|
|
1501
1489
|
const [loading, setLoading] = _react.useState.call(void 0, true);
|
|
1502
1490
|
const loadSubscriptions = _react.useCallback.call(void 0, async () => {
|
|
1503
1491
|
setLoading(true);
|
|
1504
1492
|
try {
|
|
1505
|
-
const fetchedSubscriptions = await
|
|
1493
|
+
const fetchedSubscriptions = await _chunk4ORLPEK7js.StripeSubscriptionService.listSubscriptions();
|
|
1506
1494
|
setSubscriptions(fetchedSubscriptions);
|
|
1507
1495
|
} catch (error) {
|
|
1508
1496
|
console.error("[SubscriptionsContainer] Failed to load subscriptions:", error);
|
|
@@ -1517,23 +1505,23 @@ function SubscriptionsContainer({ onOpenWizard, hasActiveRecurringSubscription }
|
|
|
1517
1505
|
(sub) => sub.status === "past_due" /* PAST_DUE */ || sub.status === "trialing" /* TRIALING */ && sub.trialEnd && new Date(sub.trialEnd).getTime() - (/* @__PURE__ */ new Date()).getTime() <= 7 * 24 * 60 * 60 * 1e3
|
|
1518
1506
|
);
|
|
1519
1507
|
if (loading) {
|
|
1520
|
-
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-muted-foreground", children: "
|
|
1508
|
+
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-muted-foreground", children: t("billing.ui.subscriptions.loading") }) });
|
|
1521
1509
|
}
|
|
1522
1510
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-6", children: [
|
|
1523
1511
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center justify-between", children: [
|
|
1524
1512
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
1525
1513
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-8 w-8" }),
|
|
1526
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: "
|
|
1514
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: t("billing.ui.subscriptions.title") })
|
|
1527
1515
|
] }),
|
|
1528
|
-
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1516
|
+
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _43 => _43()]), children: hasActiveRecurringSubscription ? t("billing.ui.subscriptions.purchase_addons") : t("billing.ui.subscriptions.subscribe") })
|
|
1529
1517
|
] }),
|
|
1530
1518
|
criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BillingAlertBanner, { subscription }, subscription.id)),
|
|
1531
1519
|
subscriptions.length === 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col items-center justify-center py-12 space-y-4", children: [
|
|
1532
1520
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.CreditCard, { className: "h-16 w-16 text-muted-foreground" }),
|
|
1533
1521
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
1534
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium mb-2", children: "
|
|
1535
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground mb-6", children: "
|
|
1536
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1522
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium mb-2", children: t("billing.ui.subscriptions.empty_title") }),
|
|
1523
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground mb-6", children: t("billing.ui.subscriptions.empty_description") }),
|
|
1524
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Button, { onClick: () => _optionalChain([onOpenWizard, 'optionalCall', _44 => _44()]), children: t("billing.ui.subscriptions.subscribe") })
|
|
1537
1525
|
] })
|
|
1538
1526
|
] }),
|
|
1539
1527
|
subscriptions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -1550,13 +1538,15 @@ _chunk7QVYU63Ejs.__name.call(void 0, SubscriptionsContainer, "SubscriptionsConta
|
|
|
1550
1538
|
|
|
1551
1539
|
// src/features/billing/stripe-subscription/components/widgets/IntervalToggle.tsx
|
|
1552
1540
|
|
|
1541
|
+
|
|
1553
1542
|
function IntervalToggle({ value, onChange, hasMonthly, hasYearly }) {
|
|
1543
|
+
const t = _nextintl.useTranslations.call(void 0, );
|
|
1554
1544
|
if (!hasMonthly || !hasYearly) {
|
|
1555
1545
|
return null;
|
|
1556
1546
|
}
|
|
1557
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1558
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1559
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1547
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Tabs, { value, onValueChange: (v) => onChange(v), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.TabsList, { children: [
|
|
1548
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.TabsTrigger, { value: "month", children: t("billing.admin.prices.interval.month") }),
|
|
1549
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.TabsTrigger, { value: "year", children: t("billing.admin.prices.interval.year") })
|
|
1560
1550
|
] }) });
|
|
1561
1551
|
}
|
|
1562
1552
|
_chunk7QVYU63Ejs.__name.call(void 0, IntervalToggle, "IntervalToggle");
|
|
@@ -1564,6 +1554,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, IntervalToggle, "IntervalToggle");
|
|
|
1564
1554
|
// src/features/billing/stripe-subscription/components/widgets/PricingCard.tsx
|
|
1565
1555
|
|
|
1566
1556
|
|
|
1557
|
+
|
|
1567
1558
|
function PricingCard({
|
|
1568
1559
|
price,
|
|
1569
1560
|
isCurrentPlan = false,
|
|
@@ -1572,10 +1563,12 @@ function PricingCard({
|
|
|
1572
1563
|
isLoading = false,
|
|
1573
1564
|
onSelect
|
|
1574
1565
|
}) {
|
|
1575
|
-
const
|
|
1566
|
+
const t = _nextintl.useTranslations.call(void 0, );
|
|
1567
|
+
const fmt = _chunkVDVIUDY5js.useBillingFormatOptions.call(void 0, );
|
|
1568
|
+
const description = price.description || price.nickname || t("billing.ui.pricing.standard");
|
|
1576
1569
|
const features = price.features || [];
|
|
1577
|
-
const formattedPrice =
|
|
1578
|
-
const interval =
|
|
1570
|
+
const formattedPrice = _chunkVDVIUDY5js.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt);
|
|
1571
|
+
const interval = _chunkVDVIUDY5js.formatInterval.call(void 0, price, fmt);
|
|
1579
1572
|
const handleKeyDown = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (e) => {
|
|
1580
1573
|
if ((e.key === "Enter" || e.key === " ") && !isDisabled && !isCurrentPlan) {
|
|
1581
1574
|
e.preventDefault();
|
|
@@ -1588,15 +1581,15 @@ function PricingCard({
|
|
|
1588
1581
|
}
|
|
1589
1582
|
}, "handleClick");
|
|
1590
1583
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1591
|
-
|
|
1584
|
+
_chunkVDVIUDY5js.Card,
|
|
1592
1585
|
{
|
|
1593
1586
|
role: "radio",
|
|
1594
1587
|
"aria-checked": isSelected,
|
|
1595
|
-
"aria-label":
|
|
1588
|
+
"aria-label": t("billing.ui.pricing.card_aria", { description, price: formattedPrice, interval }),
|
|
1596
1589
|
tabIndex: isDisabled ? -1 : 0,
|
|
1597
1590
|
onKeyDown: handleKeyDown,
|
|
1598
1591
|
onClick: handleClick,
|
|
1599
|
-
className:
|
|
1592
|
+
className: _chunk4ORLPEK7js.cn.call(void 0,
|
|
1600
1593
|
"relative cursor-pointer transition-all duration-200 flex flex-col h-full",
|
|
1601
1594
|
"focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
1602
1595
|
isCurrentPlan && "bg-muted/30",
|
|
@@ -1606,9 +1599,9 @@ function PricingCard({
|
|
|
1606
1599
|
isLoading && "pointer-events-none"
|
|
1607
1600
|
),
|
|
1608
1601
|
children: [
|
|
1609
|
-
isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1610
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1611
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1602
|
+
isCurrentPlan && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Badge, { variant: "secondary", className: "absolute top-2 end-2", children: t("billing.ui.pricing.current") }),
|
|
1603
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.CardHeader, { className: "pb-2", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium", children: description }) }),
|
|
1604
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.CardContent, { className: "pb-4 grow", children: [
|
|
1612
1605
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mb-4", children: [
|
|
1613
1606
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-3xl font-bold", children: formattedPrice }),
|
|
1614
1607
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground ms-1", children: interval })
|
|
@@ -1618,13 +1611,13 @@ function PricingCard({
|
|
|
1618
1611
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-muted-foreground", children: feature })
|
|
1619
1612
|
] }, index)) })
|
|
1620
1613
|
] }),
|
|
1621
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1622
|
-
|
|
1614
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.CardFooter, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1615
|
+
_chunkVDVIUDY5js.Button,
|
|
1623
1616
|
{
|
|
1624
1617
|
variant: isCurrentPlan ? "secondary" : isSelected ? "default" : "outline",
|
|
1625
1618
|
className: "w-full",
|
|
1626
1619
|
disabled: isDisabled || isCurrentPlan || isLoading,
|
|
1627
|
-
children: isLoading ? "
|
|
1620
|
+
children: isLoading ? t("billing.ui.wizard.review.processing") : isCurrentPlan ? t("billing.ui.pricing.current_plan") : isSelected ? t("billing.ui.pricing.selected") : t("billing.ui.wizard.steps.select_plan")
|
|
1628
1621
|
}
|
|
1629
1622
|
) })
|
|
1630
1623
|
]
|
|
@@ -1633,8 +1626,12 @@ function PricingCard({
|
|
|
1633
1626
|
}
|
|
1634
1627
|
_chunk7QVYU63Ejs.__name.call(void 0, PricingCard, "PricingCard");
|
|
1635
1628
|
|
|
1629
|
+
// src/features/billing/stripe-subscription/components/widgets/ProductPricingList.tsx
|
|
1630
|
+
|
|
1631
|
+
|
|
1636
1632
|
// src/features/billing/stripe-subscription/components/widgets/ProductPricingRow.tsx
|
|
1637
1633
|
|
|
1634
|
+
|
|
1638
1635
|
function ProductPricingRow({
|
|
1639
1636
|
product,
|
|
1640
1637
|
prices,
|
|
@@ -1643,17 +1640,18 @@ function ProductPricingRow({
|
|
|
1643
1640
|
loadingPriceId,
|
|
1644
1641
|
onSelectPrice
|
|
1645
1642
|
}) {
|
|
1643
|
+
const t = _nextintl.useTranslations.call(void 0, );
|
|
1646
1644
|
if (prices.length === 0) {
|
|
1647
1645
|
return null;
|
|
1648
1646
|
}
|
|
1649
1647
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-3", children: [
|
|
1650
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1648
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.SectionHeader, { children: product.name }),
|
|
1651
1649
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1652
1650
|
"div",
|
|
1653
1651
|
{
|
|
1654
1652
|
className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",
|
|
1655
1653
|
role: "radiogroup",
|
|
1656
|
-
"aria-label":
|
|
1654
|
+
"aria-label": t("billing.ui.pricing.options_aria", { name: product.name }),
|
|
1657
1655
|
children: prices.sort((a, b) => (_nullishCoalesce(a.unitAmount, () => ( 0))) - (_nullishCoalesce(b.unitAmount, () => ( 0)))).map((price) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1658
1656
|
PricingCard,
|
|
1659
1657
|
{
|
|
@@ -1703,11 +1701,12 @@ function ProductPricingList({
|
|
|
1703
1701
|
hideRecurringPrices = false,
|
|
1704
1702
|
hideOneTimePrices = false
|
|
1705
1703
|
}) {
|
|
1704
|
+
const t = _nextintl.useTranslations.call(void 0, );
|
|
1706
1705
|
if (loading) {
|
|
1707
1706
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductPricingListSkeleton, {});
|
|
1708
1707
|
}
|
|
1709
1708
|
if (products.length === 0) {
|
|
1710
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-center py-8 text-muted-foreground", children: "
|
|
1709
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-center py-8 text-muted-foreground", children: t("billing.ui.pricing.no_plans") });
|
|
1711
1710
|
}
|
|
1712
1711
|
const sortedProducts = [...products].sort((a, b) => {
|
|
1713
1712
|
const aRecurring = isRecurringProduct(a.stripePrices || []);
|
|
@@ -1747,15 +1746,15 @@ function ProductPricingList({
|
|
|
1747
1746
|
_chunk7QVYU63Ejs.__name.call(void 0, ProductPricingList, "ProductPricingList");
|
|
1748
1747
|
function ProductPricingListSkeleton() {
|
|
1749
1748
|
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: [
|
|
1750
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1749
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Skeleton, { className: "h-6 w-32" }),
|
|
1751
1750
|
/* @__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: [
|
|
1752
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1753
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1751
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Skeleton, { className: "h-6 w-24" }),
|
|
1752
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Skeleton, { className: "h-8 w-32" }),
|
|
1754
1753
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
1755
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1756
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1754
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Skeleton, { className: "h-4 w-full" }),
|
|
1755
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Skeleton, { className: "h-4 w-3/4" })
|
|
1757
1756
|
] }),
|
|
1758
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1757
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Skeleton, { className: "h-10 w-full" })
|
|
1759
1758
|
] }, cardIndex)) })
|
|
1760
1759
|
] }, rowIndex)) });
|
|
1761
1760
|
}
|
|
@@ -1763,25 +1762,25 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductPricingListSkeleton, "ProductPricing
|
|
|
1763
1762
|
|
|
1764
1763
|
// src/features/billing/stripe-subscription/components/widgets/ProrationPreview.tsx
|
|
1765
1764
|
|
|
1765
|
+
|
|
1766
1766
|
function ProrationPreview({ preview }) {
|
|
1767
|
+
const t = _nextintl.useTranslations.call(void 0, );
|
|
1768
|
+
const fmt = _chunkVDVIUDY5js.useBillingFormatOptions.call(void 0, );
|
|
1767
1769
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-primary/10 border-primary/30 rounded-lg border p-4", children: [
|
|
1768
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "text-primary mb-3 font-semibold", children: "
|
|
1770
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "text-primary mb-3 font-semibold", children: t("billing.ui.proration.title") }),
|
|
1769
1771
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
1770
1772
|
preview.lineItems.map((item, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between text-sm", children: [
|
|
1771
1773
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground", children: item.description }),
|
|
1772
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `font-medium ${item.amount < 0 ? "text-success" : "text-foreground"}`, children:
|
|
1774
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `font-medium ${item.amount < 0 ? "text-success" : "text-foreground"}`, children: _chunkVDVIUDY5js.formatCurrency.call(void 0, item.amount, preview.currency, fmt) })
|
|
1773
1775
|
] }, index)),
|
|
1774
1776
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border-primary/30 mt-2 border-t pt-2", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between font-semibold", children: [
|
|
1775
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-foreground", children: "
|
|
1776
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-foreground", children:
|
|
1777
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-foreground", children: t("billing.ui.proration.net_due_today") }),
|
|
1778
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-foreground", children: _chunkVDVIUDY5js.formatCurrency.call(void 0, preview.immediateCharge, preview.currency, fmt) })
|
|
1777
1779
|
] }) }),
|
|
1778
|
-
preview.lineItems.length > 0 && preview.lineItems[0].period && /* @__PURE__ */ _jsxruntime.
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
" ",
|
|
1783
|
-
_chunkORU7KLCYjs.formatCurrency.call(void 0, preview.amountDue, preview.currency)
|
|
1784
|
-
] })
|
|
1780
|
+
preview.lineItems.length > 0 && preview.lineItems[0].period && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-muted-foreground mt-2 text-xs", children: t("billing.ui.proration.next_invoice", {
|
|
1781
|
+
date: _chunkVDVIUDY5js.formatDate.call(void 0, preview.lineItems[0].period.end, fmt),
|
|
1782
|
+
amount: _chunkVDVIUDY5js.formatCurrency.call(void 0, preview.amountDue, preview.currency, fmt)
|
|
1783
|
+
}) })
|
|
1785
1784
|
] })
|
|
1786
1785
|
] });
|
|
1787
1786
|
}
|
|
@@ -1790,31 +1789,34 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProrationPreview, "ProrationPreview");
|
|
|
1790
1789
|
// src/features/billing/stripe-subscription/components/widgets/SubscriptionConfirmation.tsx
|
|
1791
1790
|
|
|
1792
1791
|
|
|
1792
|
+
|
|
1793
1793
|
function SubscriptionConfirmation({ price, isLoading, onConfirm, onCancel }) {
|
|
1794
|
-
const
|
|
1794
|
+
const t = _nextintl.useTranslations.call(void 0, );
|
|
1795
|
+
const fmt = _chunkVDVIUDY5js.useBillingFormatOptions.call(void 0, );
|
|
1796
|
+
const productName = _optionalChain([price, 'access', _50 => _50.product, 'optionalAccess', _51 => _51.name]) || price.nickname || t("billing.ui.wizard.review.selected_plan");
|
|
1795
1797
|
const productDescription = _optionalChain([price, 'access', _52 => _52.product, 'optionalAccess', _53 => _53.description]) || price.description;
|
|
1796
1798
|
const features = price.features || [];
|
|
1797
1799
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-accent/10 border border-accent/30 rounded-lg p-4", children: [
|
|
1798
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "font-semibold mb-3", children: "
|
|
1800
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "font-semibold mb-3", children: t("billing.ui.confirmation.title") }),
|
|
1799
1801
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-3", children: [
|
|
1800
1802
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
1801
1803
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "font-medium", children: productName }),
|
|
1802
1804
|
productDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-sm text-muted-foreground", children: productDescription })
|
|
1803
1805
|
] }),
|
|
1804
1806
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-lg font-semibold", children: [
|
|
1805
|
-
|
|
1806
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-normal text-muted-foreground", children:
|
|
1807
|
+
_chunkVDVIUDY5js.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt),
|
|
1808
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm font-normal text-muted-foreground", children: _chunkVDVIUDY5js.formatInterval.call(void 0, price, fmt) })
|
|
1807
1809
|
] }),
|
|
1808
1810
|
features.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "space-y-1", children: features.map((feature, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2 text-sm ", children: [
|
|
1809
1811
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Check, { className: "h-4 w-4 text-primary" }),
|
|
1810
1812
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: feature })
|
|
1811
1813
|
] }, index)) }),
|
|
1812
1814
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-3 pt-2 border-t border-accent/30", children: [
|
|
1813
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1814
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1815
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Button, { variant: "outline", onClick: onCancel, disabled: isLoading, children: t("ui.buttons.cancel") }),
|
|
1816
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Button, { onClick: onConfirm, disabled: isLoading, children: isLoading ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1815
1817
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "h-4 w-4 animate-spin me-2" }),
|
|
1816
|
-
"
|
|
1817
|
-
] }) : "
|
|
1818
|
+
t("billing.ui.wizard.review.processing")
|
|
1819
|
+
] }) : t("billing.ui.confirmation.subscribe") })
|
|
1818
1820
|
] })
|
|
1819
1821
|
] })
|
|
1820
1822
|
] });
|
|
@@ -1824,8 +1826,10 @@ _chunk7QVYU63Ejs.__name.call(void 0, SubscriptionConfirmation, "SubscriptionConf
|
|
|
1824
1826
|
// src/features/billing/stripe-subscription/components/wizards/SubscriptionWizard.tsx
|
|
1825
1827
|
|
|
1826
1828
|
|
|
1829
|
+
|
|
1827
1830
|
// src/features/billing/stripe-subscription/hooks/useSubscriptionWizard.ts
|
|
1828
1831
|
|
|
1832
|
+
|
|
1829
1833
|
var _uuid = require('uuid');
|
|
1830
1834
|
var initialState = {
|
|
1831
1835
|
step: "plan-selection",
|
|
@@ -1872,6 +1876,8 @@ function wizardReducer(state, action) {
|
|
|
1872
1876
|
}
|
|
1873
1877
|
_chunk7QVYU63Ejs.__name.call(void 0, wizardReducer, "wizardReducer");
|
|
1874
1878
|
function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
1879
|
+
const t = _nextintl.useTranslations.call(void 0, );
|
|
1880
|
+
const locale = _chunk4ORLPEK7js.useI18nLocale.call(void 0, );
|
|
1875
1881
|
const [state, dispatch] = _react.useReducer.call(void 0, wizardReducer, {
|
|
1876
1882
|
...initialState,
|
|
1877
1883
|
selectedPrice: _optionalChain([subscription, 'optionalAccess', _54 => _54.price]) || null
|
|
@@ -1882,7 +1888,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
1882
1888
|
onCloseRef.current = onClose;
|
|
1883
1889
|
const checkPaymentMethod = _react.useCallback.call(void 0, async () => {
|
|
1884
1890
|
try {
|
|
1885
|
-
const methods = await
|
|
1891
|
+
const methods = await _chunk4ORLPEK7js.StripeCustomerService.listPaymentMethods();
|
|
1886
1892
|
dispatch({ type: "SET_HAS_PAYMENT_METHOD", hasMethod: methods.length > 0 });
|
|
1887
1893
|
} catch (error) {
|
|
1888
1894
|
console.error("[useSubscriptionWizard] Failed to check payment methods:", error);
|
|
@@ -1906,18 +1912,18 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
1906
1912
|
const isTrialUpgrade = _optionalChain([subscription, 'optionalAccess', _55 => _55.status]) === "trialing" /* TRIALING */;
|
|
1907
1913
|
dispatch({ type: "SET_IS_TRIAL_SUBSCRIPTION", isTrial: isTrialUpgrade });
|
|
1908
1914
|
if (isTrialUpgrade && !state.hasPaymentMethod) {
|
|
1909
|
-
const methods = await
|
|
1915
|
+
const methods = await _chunk4ORLPEK7js.StripeCustomerService.listPaymentMethods();
|
|
1910
1916
|
if (methods.length === 0) {
|
|
1911
1917
|
dispatch({ type: "SET_STEP", step: "payment-method" });
|
|
1912
1918
|
dispatch({
|
|
1913
1919
|
type: "SET_ERROR",
|
|
1914
|
-
error: "
|
|
1920
|
+
error: t("billing.ui.wizard.errors.payment_method_required")
|
|
1915
1921
|
});
|
|
1916
1922
|
return;
|
|
1917
1923
|
}
|
|
1918
1924
|
}
|
|
1919
1925
|
if (subscription && state.selectedPrice.id !== _optionalChain([subscription, 'access', _56 => _56.price, 'optionalAccess', _57 => _57.id])) {
|
|
1920
|
-
const preview = await
|
|
1926
|
+
const preview = await _chunk4ORLPEK7js.StripeSubscriptionService.getProrationPreview({
|
|
1921
1927
|
subscriptionId: subscription.id,
|
|
1922
1928
|
newPriceId: state.selectedPrice.id
|
|
1923
1929
|
});
|
|
@@ -1926,11 +1932,11 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
1926
1932
|
dispatch({ type: "SET_STEP", step: "review" });
|
|
1927
1933
|
} catch (error) {
|
|
1928
1934
|
console.error("[useSubscriptionWizard] Error preparing review:", error);
|
|
1929
|
-
dispatch({ type: "SET_ERROR", error: _optionalChain([error, 'optionalAccess', _58 => _58.message]) || "
|
|
1935
|
+
dispatch({ type: "SET_ERROR", error: _optionalChain([error, 'optionalAccess', _58 => _58.message]) || t("billing.ui.wizard.errors.prepare_review") });
|
|
1930
1936
|
} finally {
|
|
1931
1937
|
dispatch({ type: "SET_PROCESSING", isProcessing: false });
|
|
1932
1938
|
}
|
|
1933
|
-
}, [state.selectedPrice, state.hasPaymentMethod, subscription, checkPaymentMethod]);
|
|
1939
|
+
}, [state.selectedPrice, state.hasPaymentMethod, subscription, checkPaymentMethod, t]);
|
|
1934
1940
|
const confirmSubscription = _react.useCallback.call(void 0, async () => {
|
|
1935
1941
|
if (!state.selectedPrice) return;
|
|
1936
1942
|
dispatch({ type: "SET_PROCESSING", isProcessing: true });
|
|
@@ -1942,14 +1948,14 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
1942
1948
|
newPriceId: state.selectedPrice.id,
|
|
1943
1949
|
promotionCode: _optionalChain([state, 'access', _59 => _59.promotionCode, 'optionalAccess', _60 => _60.promotionCodeId])
|
|
1944
1950
|
};
|
|
1945
|
-
await
|
|
1951
|
+
await _chunk4ORLPEK7js.StripeSubscriptionService.changePlan(changePlanParams);
|
|
1946
1952
|
} else {
|
|
1947
1953
|
const createParams = {
|
|
1948
1954
|
id: _uuid.v4.call(void 0, ),
|
|
1949
1955
|
priceId: state.selectedPrice.id,
|
|
1950
1956
|
promotionCode: _optionalChain([state, 'access', _61 => _61.promotionCode, 'optionalAccess', _62 => _62.promotionCodeId])
|
|
1951
1957
|
};
|
|
1952
|
-
await
|
|
1958
|
+
await _chunk4ORLPEK7js.StripeSubscriptionService.createSubscription(createParams);
|
|
1953
1959
|
}
|
|
1954
1960
|
onSuccessRef.current();
|
|
1955
1961
|
onCloseRef.current();
|
|
@@ -1957,7 +1963,7 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
1957
1963
|
if (_optionalChain([error, 'optionalAccess', _63 => _63.status]) === 409 || _optionalChain([error, 'optionalAccess', _64 => _64.response, 'optionalAccess', _65 => _65.status]) === 409) {
|
|
1958
1964
|
dispatch({
|
|
1959
1965
|
type: "SET_ERROR",
|
|
1960
|
-
error: "
|
|
1966
|
+
error: t("billing.ui.wizard.errors.already_subscribed")
|
|
1961
1967
|
});
|
|
1962
1968
|
return;
|
|
1963
1969
|
}
|
|
@@ -1966,11 +1972,11 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
1966
1972
|
dispatch({ type: "SET_STEP", step: "payment-method" });
|
|
1967
1973
|
return;
|
|
1968
1974
|
}
|
|
1969
|
-
dispatch({ type: "SET_ERROR", error: _optionalChain([error, 'optionalAccess', _69 => _69.message]) || "
|
|
1975
|
+
dispatch({ type: "SET_ERROR", error: _optionalChain([error, 'optionalAccess', _69 => _69.message]) || t("billing.ui.wizard.errors.process_subscription") });
|
|
1970
1976
|
} finally {
|
|
1971
1977
|
dispatch({ type: "SET_PROCESSING", isProcessing: false });
|
|
1972
1978
|
}
|
|
1973
|
-
}, [state.selectedPrice, state.promotionCode, subscription]);
|
|
1979
|
+
}, [state.selectedPrice, state.promotionCode, subscription, t]);
|
|
1974
1980
|
const handlePaymentMethodSuccess = _react.useCallback.call(void 0, async () => {
|
|
1975
1981
|
dispatch({ type: "SET_HAS_PAYMENT_METHOD", hasMethod: true });
|
|
1976
1982
|
dispatch({ type: "SET_STEP", step: "review" });
|
|
@@ -1983,23 +1989,30 @@ function useSubscriptionWizard({ subscription, onSuccess, onClose }) {
|
|
|
1983
1989
|
dispatch({ type: "SET_VALIDATING_PROMO_CODE", isValidating: true });
|
|
1984
1990
|
dispatch({ type: "SET_PROMO_CODE_ERROR", error: null });
|
|
1985
1991
|
try {
|
|
1986
|
-
const result = await
|
|
1992
|
+
const result = await _chunk4ORLPEK7js.StripePromotionCodeService.validatePromotionCode({
|
|
1987
1993
|
code,
|
|
1988
|
-
stripePriceId: _optionalChain([state, 'access', _70 => _70.selectedPrice, 'optionalAccess', _71 => _71.id])
|
|
1994
|
+
stripePriceId: _optionalChain([state, 'access', _70 => _70.selectedPrice, 'optionalAccess', _71 => _71.id]),
|
|
1995
|
+
language: locale
|
|
1989
1996
|
});
|
|
1990
1997
|
if (result.valid) {
|
|
1991
1998
|
dispatch({ type: "SET_PROMOTION_CODE", code: result });
|
|
1992
1999
|
} else {
|
|
1993
|
-
dispatch({
|
|
2000
|
+
dispatch({
|
|
2001
|
+
type: "SET_PROMO_CODE_ERROR",
|
|
2002
|
+
error: result.errorMessage || t("billing.ui.wizard.errors.invalid_promo_code")
|
|
2003
|
+
});
|
|
1994
2004
|
}
|
|
1995
2005
|
} catch (error) {
|
|
1996
2006
|
console.error("[useSubscriptionWizard] Promo code validation error:", error);
|
|
1997
|
-
dispatch({
|
|
2007
|
+
dispatch({
|
|
2008
|
+
type: "SET_PROMO_CODE_ERROR",
|
|
2009
|
+
error: _optionalChain([error, 'optionalAccess', _72 => _72.message]) || t("billing.ui.wizard.errors.validate_promo_code")
|
|
2010
|
+
});
|
|
1998
2011
|
} finally {
|
|
1999
2012
|
dispatch({ type: "SET_VALIDATING_PROMO_CODE", isValidating: false });
|
|
2000
2013
|
}
|
|
2001
2014
|
},
|
|
2002
|
-
[_optionalChain([state, 'access', _73 => _73.selectedPrice, 'optionalAccess', _74 => _74.id])]
|
|
2015
|
+
[_optionalChain([state, 'access', _73 => _73.selectedPrice, 'optionalAccess', _74 => _74.id]), t, locale]
|
|
2003
2016
|
);
|
|
2004
2017
|
const clearPromoCode = _react.useCallback.call(void 0, () => {
|
|
2005
2018
|
dispatch({ type: "SET_PROMOTION_CODE", code: null });
|
|
@@ -2042,16 +2055,18 @@ _chunk7QVYU63Ejs.__name.call(void 0, useSubscriptionWizard, "useSubscriptionWiza
|
|
|
2042
2055
|
// src/features/billing/stripe-subscription/components/wizards/WizardProgressIndicator.tsx
|
|
2043
2056
|
|
|
2044
2057
|
|
|
2058
|
+
|
|
2045
2059
|
var STEPS = [
|
|
2046
|
-
{ key: "plan-selection", label: "
|
|
2047
|
-
{ key: "review", label: "
|
|
2048
|
-
{ key: "payment-method", label: "
|
|
2060
|
+
{ key: "plan-selection", label: "billing.ui.wizard.steps.select_plan" },
|
|
2061
|
+
{ key: "review", label: "billing.ui.wizard.steps.review" },
|
|
2062
|
+
{ key: "payment-method", label: "billing.ui.wizard.steps.payment" }
|
|
2049
2063
|
];
|
|
2050
2064
|
function getStepIndex(step) {
|
|
2051
2065
|
return STEPS.findIndex((s) => s.key === step);
|
|
2052
2066
|
}
|
|
2053
2067
|
_chunk7QVYU63Ejs.__name.call(void 0, getStepIndex, "getStepIndex");
|
|
2054
2068
|
function WizardProgressIndicator({ currentStep }) {
|
|
2069
|
+
const t = _nextintl.useTranslations.call(void 0, );
|
|
2055
2070
|
const currentIndex = getStepIndex(currentStep);
|
|
2056
2071
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex items-center justify-center gap-x-2 py-4", children: STEPS.map((step, index) => {
|
|
2057
2072
|
const isCompleted = index < currentIndex;
|
|
@@ -2064,7 +2079,7 @@ function WizardProgressIndicator({ currentStep }) {
|
|
|
2064
2079
|
children: isCompleted ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Check, { className: "h-4 w-4" }) : index + 1
|
|
2065
2080
|
}
|
|
2066
2081
|
),
|
|
2067
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `text-sm ${isCurrent ? "font-medium text-foreground" : "text-muted-foreground"}`, children: step.label }),
|
|
2082
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `text-sm ${isCurrent ? "font-medium text-foreground" : "text-muted-foreground"}`, children: t(step.label) }),
|
|
2068
2083
|
index < STEPS.length - 1 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: `h-0.5 w-8 ${index < currentIndex ? "bg-primary" : "bg-muted"}` })
|
|
2069
2084
|
] }, step.key);
|
|
2070
2085
|
}) });
|
|
@@ -2074,6 +2089,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, WizardProgressIndicator, "WizardProgressInd
|
|
|
2074
2089
|
// src/features/billing/stripe-subscription/components/wizards/WizardStepPlanSelection.tsx
|
|
2075
2090
|
|
|
2076
2091
|
|
|
2092
|
+
|
|
2077
2093
|
function WizardStepPlanSelection({
|
|
2078
2094
|
selectedPrice,
|
|
2079
2095
|
selectedInterval,
|
|
@@ -2085,12 +2101,13 @@ function WizardStepPlanSelection({
|
|
|
2085
2101
|
onNext,
|
|
2086
2102
|
isProcessing
|
|
2087
2103
|
}) {
|
|
2104
|
+
const t = _nextintl.useTranslations.call(void 0, );
|
|
2088
2105
|
const [products, setProducts] = _react.useState.call(void 0, []);
|
|
2089
2106
|
const [loading, setLoading] = _react.useState.call(void 0, true);
|
|
2090
2107
|
_react.useEffect.call(void 0, () => {
|
|
2091
2108
|
const loadProducts = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2092
2109
|
try {
|
|
2093
|
-
const fetchedProducts = await
|
|
2110
|
+
const fetchedProducts = await _chunk4ORLPEK7js.StripeProductService.listProducts({ active: true });
|
|
2094
2111
|
setProducts(fetchedProducts);
|
|
2095
2112
|
} catch (error) {
|
|
2096
2113
|
console.error("[WizardStepPlanSelection] Failed to load products:", error);
|
|
@@ -2141,7 +2158,7 @@ function WizardStepPlanSelection({
|
|
|
2141
2158
|
onSelectPrice: handleSelectPrice
|
|
2142
2159
|
}
|
|
2143
2160
|
),
|
|
2144
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex justify-end pt-4 border-t", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2161
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex justify-end pt-4 border-t", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Button, { onClick: onNext, disabled: !selectedPrice || isProcessing, children: isProcessing ? t("common.loading") : t("billing.ui.wizard.next_review") }) })
|
|
2145
2162
|
] });
|
|
2146
2163
|
}
|
|
2147
2164
|
_chunk7QVYU63Ejs.__name.call(void 0, WizardStepPlanSelection, "WizardStepPlanSelection");
|
|
@@ -2149,10 +2166,12 @@ _chunk7QVYU63Ejs.__name.call(void 0, WizardStepPlanSelection, "WizardStepPlanSel
|
|
|
2149
2166
|
// src/features/billing/stripe-subscription/components/wizards/WizardStepReview.tsx
|
|
2150
2167
|
|
|
2151
2168
|
|
|
2169
|
+
|
|
2152
2170
|
// src/features/billing/stripe-promotion-code/components/PromoCodeInput.tsx
|
|
2153
2171
|
|
|
2154
2172
|
|
|
2155
2173
|
|
|
2174
|
+
|
|
2156
2175
|
function PromoCodeInput({
|
|
2157
2176
|
appliedCode,
|
|
2158
2177
|
isValidating,
|
|
@@ -2161,6 +2180,8 @@ function PromoCodeInput({
|
|
|
2161
2180
|
onRemove,
|
|
2162
2181
|
disabled = false
|
|
2163
2182
|
}) {
|
|
2183
|
+
const t = _nextintl.useTranslations.call(void 0, );
|
|
2184
|
+
const locale = _chunk4ORLPEK7js.useI18nLocale.call(void 0, );
|
|
2164
2185
|
const [code, setCode] = _react.useState.call(void 0, "");
|
|
2165
2186
|
const handleApply = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
2166
2187
|
if (code.trim()) {
|
|
@@ -2175,20 +2196,20 @@ function PromoCodeInput({
|
|
|
2175
2196
|
}, "handleKeyDown");
|
|
2176
2197
|
const formatDiscount = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (result) => {
|
|
2177
2198
|
if (result.discountType === "percent_off") {
|
|
2178
|
-
return
|
|
2199
|
+
return t("billing.ui.wizard.review.percent_off", { value: String(result.discountValue) });
|
|
2179
2200
|
}
|
|
2180
2201
|
const amount = (result.discountValue || 0) / 100;
|
|
2181
2202
|
const currency = _optionalChain([result, 'access', _80 => _80.currency, 'optionalAccess', _81 => _81.toUpperCase, 'call', _82 => _82()]) || "USD";
|
|
2182
|
-
return `${currency} ${
|
|
2203
|
+
return t("billing.ui.wizard.review.amount_off", { amount: `${currency} ${_chunkVDVIUDY5js.formatFixed.call(void 0, amount, locale, 2)}` });
|
|
2183
2204
|
}, "formatDiscount");
|
|
2184
2205
|
const formatDuration = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (result) => {
|
|
2185
2206
|
switch (result.duration) {
|
|
2186
2207
|
case "forever":
|
|
2187
|
-
return "
|
|
2208
|
+
return t("billing.ui.promo_code.duration_forever");
|
|
2188
2209
|
case "once":
|
|
2189
|
-
return "
|
|
2210
|
+
return t("billing.ui.promo_code.duration_once");
|
|
2190
2211
|
case "repeating":
|
|
2191
|
-
return
|
|
2212
|
+
return t("billing.ui.promo_code.duration_repeating", { months: String(result.durationInMonths) });
|
|
2192
2213
|
default:
|
|
2193
2214
|
return "";
|
|
2194
2215
|
}
|
|
@@ -2202,7 +2223,7 @@ function PromoCodeInput({
|
|
|
2202
2223
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success text-sm", children: formatDiscount(appliedCode) })
|
|
2203
2224
|
] }),
|
|
2204
2225
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2205
|
-
|
|
2226
|
+
_chunkVDVIUDY5js.Button,
|
|
2206
2227
|
{
|
|
2207
2228
|
variant: "ghost",
|
|
2208
2229
|
size: "sm",
|
|
@@ -2219,9 +2240,9 @@ function PromoCodeInput({
|
|
|
2219
2240
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-2", children: [
|
|
2220
2241
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
|
|
2221
2242
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2222
|
-
|
|
2243
|
+
_chunkVDVIUDY5js.Input,
|
|
2223
2244
|
{
|
|
2224
|
-
placeholder: "
|
|
2245
|
+
placeholder: t("billing.ui.promo_code.placeholder"),
|
|
2225
2246
|
value: code,
|
|
2226
2247
|
onChange: (e) => setCode(e.target.value.toUpperCase()),
|
|
2227
2248
|
onKeyDown: handleKeyDown,
|
|
@@ -2229,7 +2250,7 @@ function PromoCodeInput({
|
|
|
2229
2250
|
className: "flex-1"
|
|
2230
2251
|
}
|
|
2231
2252
|
),
|
|
2232
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2253
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.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" }) : t("billing.ui.promo_code.apply") })
|
|
2233
2254
|
] }),
|
|
2234
2255
|
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive text-xs/relaxed", children: error })
|
|
2235
2256
|
] });
|
|
@@ -2255,14 +2276,16 @@ function WizardStepReview({
|
|
|
2255
2276
|
onRemovePromoCode,
|
|
2256
2277
|
isTrialUpgrade
|
|
2257
2278
|
}) {
|
|
2279
|
+
const t = _nextintl.useTranslations.call(void 0, );
|
|
2280
|
+
const fmt = _chunkVDVIUDY5js.useBillingFormatOptions.call(void 0, );
|
|
2258
2281
|
if (!selectedPrice) {
|
|
2259
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-center py-8 text-muted-foreground", children: "
|
|
2282
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-center py-8 text-muted-foreground", children: t("billing.ui.wizard.review.no_plan") });
|
|
2260
2283
|
}
|
|
2261
2284
|
const isChangingPlan = subscription && _optionalChain([subscription, 'access', _84 => _84.price, 'optionalAccess', _85 => _85.id]) !== selectedPrice.id;
|
|
2262
2285
|
const formatInterval2 = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (price) => {
|
|
2263
|
-
if (price.priceType === "one_time") return "
|
|
2286
|
+
if (price.priceType === "one_time") return t("billing.ui.wizard.review.interval_one_time");
|
|
2264
2287
|
const interval = _optionalChain([price, 'access', _86 => _86.recurring, 'optionalAccess', _87 => _87.interval]) || "month";
|
|
2265
|
-
return interval === "year" ? "
|
|
2288
|
+
return interval === "year" ? t("billing.ui.wizard.review.interval_yearly") : t("billing.ui.wizard.review.interval_monthly");
|
|
2266
2289
|
}, "formatInterval");
|
|
2267
2290
|
const calculateDiscountedPrice = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
2268
2291
|
if (!_optionalChain([promotionCode, 'optionalAccess', _88 => _88.valid]) || !selectedPrice.unitAmount) return null;
|
|
@@ -2291,17 +2314,19 @@ function WizardStepReview({
|
|
|
2291
2314
|
const getDiscountDescription = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
2292
2315
|
if (!_optionalChain([promotionCode, 'optionalAccess', _91 => _91.valid])) return null;
|
|
2293
2316
|
if (promotionCode.discountType === "percent_off" && promotionCode.discountValue) {
|
|
2294
|
-
return
|
|
2317
|
+
return t("billing.ui.wizard.review.percent_off", { value: promotionCode.discountValue });
|
|
2295
2318
|
}
|
|
2296
2319
|
if (promotionCode.discountType === "amount_off" && promotionCode.discountValue) {
|
|
2297
|
-
return
|
|
2320
|
+
return t("billing.ui.wizard.review.amount_off", {
|
|
2321
|
+
amount: _chunkVDVIUDY5js.formatCurrency.call(void 0, promotionCode.discountValue, promotionCode.currency || selectedPrice.currency, fmt)
|
|
2322
|
+
});
|
|
2298
2323
|
}
|
|
2299
2324
|
return null;
|
|
2300
2325
|
}, "getDiscountDescription");
|
|
2301
2326
|
const discountDescription = getDiscountDescription();
|
|
2302
2327
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
2303
2328
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "bg-muted/50 rounded-lg p-4 space-y-3", children: [
|
|
2304
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2329
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.SectionHeader, { children: t("billing.ui.wizard.review.selected_plan") }),
|
|
2305
2330
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between items-center", children: [
|
|
2306
2331
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
2307
2332
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-medium", children: _optionalChain([selectedPrice, 'access', _92 => _92.product, 'optionalAccess', _93 => _93.name]) }),
|
|
@@ -2309,10 +2334,10 @@ function WizardStepReview({
|
|
|
2309
2334
|
] }),
|
|
2310
2335
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-end", children: [
|
|
2311
2336
|
discountedPrice !== null ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2312
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground line-through", children:
|
|
2313
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-success text-lg font-semibold", children:
|
|
2314
|
-
discountDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2315
|
-
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-semibold text-lg", children:
|
|
2337
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground line-through", children: _chunkVDVIUDY5js.formatCurrency.call(void 0, selectedPrice.unitAmount || 0, selectedPrice.currency, fmt) }),
|
|
2338
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-success text-lg font-semibold", children: _chunkVDVIUDY5js.formatCurrency.call(void 0, discountedPrice, selectedPrice.currency, fmt) }),
|
|
2339
|
+
discountDescription && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Badge, { variant: "softGreen", children: discountDescription })
|
|
2340
|
+
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "font-semibold text-lg", children: _chunkVDVIUDY5js.formatCurrency.call(void 0, selectedPrice.unitAmount || 0, selectedPrice.currency, fmt) }),
|
|
2316
2341
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: formatInterval2(selectedPrice) })
|
|
2317
2342
|
] })
|
|
2318
2343
|
] })
|
|
@@ -2322,20 +2347,20 @@ function WizardStepReview({
|
|
|
2322
2347
|
{
|
|
2323
2348
|
className: `${isTrialUpgrade ? "bg-warning/15 border-warning/30" : "bg-primary/10 border-primary/30"} space-y-2 rounded-lg border p-4`,
|
|
2324
2349
|
children: [
|
|
2325
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: `font-medium ${isTrialUpgrade ? "text-warning" : "text-primary"}`, children: isTrialUpgrade ? "
|
|
2326
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: `text-sm ${isTrialUpgrade ? "text-warning" : "text-foreground"}`, children: isTrialUpgrade ? "
|
|
2350
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: `font-medium ${isTrialUpgrade ? "text-warning" : "text-primary"}`, children: isTrialUpgrade ? t("billing.ui.wizard.review.trial_upgrade") : t("billing.ui.wizard.review.proration_summary") }),
|
|
2351
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: `text-sm ${isTrialUpgrade ? "text-warning" : "text-foreground"}`, children: isTrialUpgrade ? t("billing.ui.wizard.review.trial_upgrade_description") : t("billing.ui.wizard.review.proration_description") }),
|
|
2327
2352
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between text-sm", children: [
|
|
2328
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `${isTrialUpgrade ? "text-warning" : "text-muted-foreground"}`, children: isTrialUpgrade ? "
|
|
2353
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `${isTrialUpgrade ? "text-warning" : "text-muted-foreground"}`, children: isTrialUpgrade ? t("billing.ui.wizard.review.charge_now") : t("billing.ui.wizard.review.due_now") }),
|
|
2329
2354
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: `font-medium ${isTrialUpgrade ? "text-warning" : "text-foreground"}`, children: discountedImmediateCharge !== null ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2330
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "line-through text-muted-foreground me-2", children:
|
|
2331
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success", children:
|
|
2332
|
-
] }) :
|
|
2355
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "line-through text-muted-foreground me-2", children: _chunkVDVIUDY5js.formatCurrency.call(void 0, prorationPreview.immediateCharge, prorationPreview.currency, fmt) }),
|
|
2356
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-success", children: _chunkVDVIUDY5js.formatCurrency.call(void 0, discountedImmediateCharge, prorationPreview.currency, fmt) })
|
|
2357
|
+
] }) : _chunkVDVIUDY5js.formatCurrency.call(void 0, prorationPreview.immediateCharge, prorationPreview.currency, fmt) })
|
|
2333
2358
|
] })
|
|
2334
2359
|
]
|
|
2335
2360
|
}
|
|
2336
2361
|
),
|
|
2337
2362
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "border rounded-lg p-4 space-y-3", children: [
|
|
2338
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "font-medium", children: "
|
|
2363
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "font-medium", children: t("billing.ui.wizard.review.promotion_code") }),
|
|
2339
2364
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2340
2365
|
PromoCodeInput,
|
|
2341
2366
|
{
|
|
@@ -2350,18 +2375,18 @@ function WizardStepReview({
|
|
|
2350
2375
|
] }),
|
|
2351
2376
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border rounded-lg p-4", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between items-center", children: [
|
|
2352
2377
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
2353
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "font-medium", children: "
|
|
2354
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: hasPaymentMethod ? "
|
|
2378
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "font-medium", children: t("billing.ui.payment_method.title") }),
|
|
2379
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: hasPaymentMethod ? t("billing.ui.wizard.review.payment_on_file") : t("billing.ui.wizard.review.no_payment_on_file") })
|
|
2355
2380
|
] }),
|
|
2356
|
-
!hasPaymentMethod && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2381
|
+
!hasPaymentMethod && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Button, { variant: "outline", onClick: onAddPaymentMethod, children: t("billing.ui.payment_methods.add") })
|
|
2357
2382
|
] }) }),
|
|
2358
|
-
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2383
|
+
error && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.Alert, { variant: "destructive", children: [
|
|
2359
2384
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.AlertCircle, { className: "h-4 w-4" }),
|
|
2360
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2385
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.AlertDescription, { children: error })
|
|
2361
2386
|
] }),
|
|
2362
2387
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-between pt-4 border-t", children: [
|
|
2363
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2364
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2388
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Button, { variant: "outline", onClick: onBack, disabled: isProcessing, children: t("billing.ui.wizard.back") }),
|
|
2389
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Button, { onClick: hasPaymentMethod ? onConfirm : onAddPaymentMethod, disabled: isProcessing, children: isProcessing ? t("billing.ui.wizard.review.processing") : hasPaymentMethod ? isChangingPlan ? t("billing.ui.wizard.review.confirm_change") : t("billing.ui.wizard.review.subscribe_now") : t("billing.ui.payment_methods.add") })
|
|
2365
2390
|
] })
|
|
2366
2391
|
] });
|
|
2367
2392
|
}
|
|
@@ -2369,11 +2394,13 @@ _chunk7QVYU63Ejs.__name.call(void 0, WizardStepReview, "WizardStepReview");
|
|
|
2369
2394
|
|
|
2370
2395
|
// src/features/billing/stripe-subscription/components/wizards/WizardStepPaymentMethod.tsx
|
|
2371
2396
|
|
|
2397
|
+
|
|
2372
2398
|
function WizardStepPaymentMethod({ onBack, onSuccess, isProcessing }) {
|
|
2399
|
+
const t = _nextintl.useTranslations.call(void 0, );
|
|
2373
2400
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "space-y-6", children: [
|
|
2374
2401
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
2375
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2376
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: "
|
|
2402
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.SectionHeader, { children: t("billing.ui.payment_methods.add") }),
|
|
2403
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-muted-foreground", children: t("billing.ui.wizard.payment_description") })
|
|
2377
2404
|
] }),
|
|
2378
2405
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, PaymentMethodForm, { onSuccess, onCancel: onBack, isLoading: isProcessing })
|
|
2379
2406
|
] });
|
|
@@ -2389,6 +2416,7 @@ function SubscriptionWizard({
|
|
|
2389
2416
|
hasActiveRecurringSubscription,
|
|
2390
2417
|
subscription
|
|
2391
2418
|
}) {
|
|
2419
|
+
const t = _nextintl.useTranslations.call(void 0, );
|
|
2392
2420
|
const handleClose = _react.useCallback.call(void 0, () => onOpenChange(false), [onOpenChange]);
|
|
2393
2421
|
const { state, actions } = useSubscriptionWizard({
|
|
2394
2422
|
subscription,
|
|
@@ -2412,12 +2440,12 @@ function SubscriptionWizard({
|
|
|
2412
2440
|
}, [open, actions.reset]);
|
|
2413
2441
|
const isPurchasingAddons = hasActiveRecurringSubscription && !subscription;
|
|
2414
2442
|
const isChangePlanMode = !!subscription;
|
|
2415
|
-
const dialogTitle = subscription ? "
|
|
2416
|
-
const dialogDescription = subscription ? "
|
|
2417
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2418
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2419
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2420
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2443
|
+
const dialogTitle = subscription ? t("billing.ui.wizard.change_title") : isPurchasingAddons ? t("billing.ui.subscriptions.purchase_addons") : t("billing.ui.subscriptions.subscribe");
|
|
2444
|
+
const dialogDescription = subscription ? t("billing.ui.wizard.change_description") : isPurchasingAddons ? t("billing.ui.wizard.addons_description") : t("billing.ui.wizard.subscribe_description");
|
|
2445
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.DialogContent, { className: "max-w-2xl", children: [
|
|
2446
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.DialogHeader, { children: [
|
|
2447
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.DialogTitle, { children: dialogTitle }),
|
|
2448
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.DialogDescription, { children: dialogDescription })
|
|
2421
2449
|
] }),
|
|
2422
2450
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, WizardProgressIndicator, { currentStep: state.step }),
|
|
2423
2451
|
state.step === "plan-selection" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -2470,9 +2498,11 @@ _chunk7QVYU63Ejs.__name.call(void 0, SubscriptionWizard, "SubscriptionWizard");
|
|
|
2470
2498
|
|
|
2471
2499
|
|
|
2472
2500
|
|
|
2501
|
+
|
|
2473
2502
|
// src/features/billing/stripe-usage/components/details/UsageSummaryCard.tsx
|
|
2474
2503
|
|
|
2475
2504
|
|
|
2505
|
+
|
|
2476
2506
|
function getProgressColor(percentage) {
|
|
2477
2507
|
if (percentage === null) return "bg-blue-500";
|
|
2478
2508
|
if (percentage >= 90) return "bg-red-500";
|
|
@@ -2480,19 +2510,21 @@ function getProgressColor(percentage) {
|
|
|
2480
2510
|
return "bg-green-500";
|
|
2481
2511
|
}
|
|
2482
2512
|
_chunk7QVYU63Ejs.__name.call(void 0, getProgressColor, "getProgressColor");
|
|
2483
|
-
function
|
|
2484
|
-
if (!date) return "
|
|
2513
|
+
function formatDate2(date, { locale, t }) {
|
|
2514
|
+
if (!date) return t("billing.ui.not_available");
|
|
2485
2515
|
try {
|
|
2486
|
-
return new Intl.DateTimeFormat(
|
|
2516
|
+
return new Intl.DateTimeFormat(locale, {
|
|
2487
2517
|
month: "short",
|
|
2488
2518
|
day: "numeric"
|
|
2489
2519
|
}).format(new Date(date));
|
|
2490
2520
|
} catch (_error) {
|
|
2491
|
-
return "
|
|
2521
|
+
return t("billing.ui.invalid_date");
|
|
2492
2522
|
}
|
|
2493
2523
|
}
|
|
2494
|
-
_chunk7QVYU63Ejs.__name.call(void 0,
|
|
2524
|
+
_chunk7QVYU63Ejs.__name.call(void 0, formatDate2, "formatDate");
|
|
2495
2525
|
function UsageSummaryCard({ meter, summary }) {
|
|
2526
|
+
const t = _nextintl.useTranslations.call(void 0, );
|
|
2527
|
+
const fmt = _chunkVDVIUDY5js.useBillingFormatOptions.call(void 0, );
|
|
2496
2528
|
const currentUsage = _nullishCoalesce(_optionalChain([summary, 'optionalAccess', _96 => _96.aggregatedValue]), () => ( 0));
|
|
2497
2529
|
const limit = meter.limit;
|
|
2498
2530
|
const percentage = limit && limit > 0 ? currentUsage / limit * 100 : null;
|
|
@@ -2500,36 +2532,29 @@ function UsageSummaryCard({ meter, summary }) {
|
|
|
2500
2532
|
const progressWidth = percentage !== null ? Math.min(percentage, 100) : 0;
|
|
2501
2533
|
const displayName = meter.displayName || meter.eventName;
|
|
2502
2534
|
const hasLimit = limit !== null && limit !== void 0;
|
|
2503
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2504
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2535
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.Card, { children: [
|
|
2536
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.CardHeader, { className: "flex flex-row items-center gap-x-3 pb-3", children: [
|
|
2505
2537
|
/* @__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" }) }),
|
|
2506
2538
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col", children: [
|
|
2507
2539
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-medium", children: displayName }),
|
|
2508
2540
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-xs", children: meter.id })
|
|
2509
2541
|
] })
|
|
2510
2542
|
] }),
|
|
2511
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2543
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.CardContent, { className: "flex flex-col gap-y-4", children: [
|
|
2512
2544
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
2513
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-3xl font-bold", children: currentUsage.toLocaleString() }),
|
|
2514
|
-
hasLimit && /* @__PURE__ */ _jsxruntime.
|
|
2515
|
-
"of ",
|
|
2516
|
-
limit.toLocaleString(),
|
|
2517
|
-
" used"
|
|
2518
|
-
] })
|
|
2545
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-3xl font-bold", children: currentUsage.toLocaleString(fmt.locale) }),
|
|
2546
|
+
hasLimit && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-sm", children: t("billing.ui.usage.of_limit_used", { limit: limit.toLocaleString(fmt.locale) }) })
|
|
2519
2547
|
] }),
|
|
2520
2548
|
hasLimit ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-2", children: [
|
|
2521
2549
|
/* @__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}%` } }) }),
|
|
2522
|
-
/* @__PURE__ */ _jsxruntime.
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
" - ",
|
|
2531
|
-
formatDate4(summary.end)
|
|
2532
|
-
] }) })
|
|
2550
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-sm", children: t("billing.ui.usage.percent_used", {
|
|
2551
|
+
value: percentage !== null ? _chunkVDVIUDY5js.formatFixed.call(void 0, percentage, fmt.locale, 1) : ""
|
|
2552
|
+
}) })
|
|
2553
|
+
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-sm", children: t("billing.ui.usage.no_limit") }),
|
|
2554
|
+
summary && summary.start && summary.end && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border-t pt-3", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground text-xs", children: t("billing.ui.usage.period", {
|
|
2555
|
+
start: formatDate2(summary.start, fmt),
|
|
2556
|
+
end: formatDate2(summary.end, fmt)
|
|
2557
|
+
}) }) })
|
|
2533
2558
|
] })
|
|
2534
2559
|
] });
|
|
2535
2560
|
}
|
|
@@ -2545,6 +2570,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, UsageSummaryCards, "UsageSummaryCards");
|
|
|
2545
2570
|
// src/features/billing/stripe-usage/components/containers/UsageContainer.tsx
|
|
2546
2571
|
|
|
2547
2572
|
function UsageContainer() {
|
|
2573
|
+
const t = _nextintl.useTranslations.call(void 0, );
|
|
2548
2574
|
const [meters, setMeters] = _react.useState.call(void 0, []);
|
|
2549
2575
|
const [summaries, setSummaries] = _react.useState.call(void 0, {});
|
|
2550
2576
|
const [loading, setLoading] = _react.useState.call(void 0, true);
|
|
@@ -2555,14 +2581,14 @@ function UsageContainer() {
|
|
|
2555
2581
|
const loadUsageData = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2556
2582
|
setLoading(true);
|
|
2557
2583
|
try {
|
|
2558
|
-
const fetchedSubscriptions = await
|
|
2584
|
+
const fetchedSubscriptions = await _chunk4ORLPEK7js.StripeSubscriptionService.listSubscriptions();
|
|
2559
2585
|
setSubscriptions(fetchedSubscriptions);
|
|
2560
|
-
const hasMeteredSubscriptions2 = fetchedSubscriptions.some((sub) => _optionalChain([sub, 'access',
|
|
2586
|
+
const hasMeteredSubscriptions2 = fetchedSubscriptions.some((sub) => _optionalChain([sub, 'access', _97 => _97.price, 'optionalAccess', _98 => _98.recurring, 'optionalAccess', _99 => _99.usageType]) === "metered");
|
|
2561
2587
|
if (!hasMeteredSubscriptions2) {
|
|
2562
2588
|
setLoading(false);
|
|
2563
2589
|
return;
|
|
2564
2590
|
}
|
|
2565
|
-
const fetchedMeters = await
|
|
2591
|
+
const fetchedMeters = await _chunk4ORLPEK7js.StripeUsageService.listMeters();
|
|
2566
2592
|
setMeters(fetchedMeters);
|
|
2567
2593
|
const summariesMap = {};
|
|
2568
2594
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -2570,7 +2596,7 @@ function UsageContainer() {
|
|
|
2570
2596
|
const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
|
|
2571
2597
|
for (const meter of fetchedMeters) {
|
|
2572
2598
|
try {
|
|
2573
|
-
const meterSummaries = await
|
|
2599
|
+
const meterSummaries = await _chunk4ORLPEK7js.StripeUsageService.getMeterSummaries({
|
|
2574
2600
|
meterId: meter.id,
|
|
2575
2601
|
startTime: startOfMonth,
|
|
2576
2602
|
endTime: endOfMonth
|
|
@@ -2588,23 +2614,23 @@ function UsageContainer() {
|
|
|
2588
2614
|
setLoading(false);
|
|
2589
2615
|
}
|
|
2590
2616
|
}, "loadUsageData");
|
|
2591
|
-
const hasMeteredSubscriptions = subscriptions.some((sub) => _optionalChain([sub, 'access',
|
|
2617
|
+
const hasMeteredSubscriptions = subscriptions.some((sub) => _optionalChain([sub, 'access', _100 => _100.price, 'optionalAccess', _101 => _101.recurring, 'optionalAccess', _102 => _102.usageType]) === "metered");
|
|
2592
2618
|
if (!loading && !hasMeteredSubscriptions) {
|
|
2593
2619
|
return null;
|
|
2594
2620
|
}
|
|
2595
2621
|
if (loading) {
|
|
2596
|
-
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-muted-foreground", children: "
|
|
2622
|
+
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-muted-foreground", children: t("billing.ui.usage.loading") }) });
|
|
2597
2623
|
}
|
|
2598
2624
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-6", children: [
|
|
2599
2625
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
2600
2626
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "h-8 w-8" }),
|
|
2601
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: "
|
|
2627
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: t("billing.ui.usage.title") })
|
|
2602
2628
|
] }),
|
|
2603
2629
|
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: [
|
|
2604
2630
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Activity, { className: "text-muted-foreground h-16 w-16" }),
|
|
2605
2631
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center", children: [
|
|
2606
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "mb-2 text-sm font-medium", children: "
|
|
2607
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground", children: "
|
|
2632
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "mb-2 text-sm font-medium", children: t("billing.ui.usage.empty_title") }),
|
|
2633
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-muted-foreground", children: t("billing.ui.usage.empty_description") })
|
|
2608
2634
|
] })
|
|
2609
2635
|
] }),
|
|
2610
2636
|
meters.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, UsageSummaryCards, { meters, summaries })
|
|
@@ -2614,11 +2640,12 @@ _chunk7QVYU63Ejs.__name.call(void 0, UsageContainer, "UsageContainer");
|
|
|
2614
2640
|
|
|
2615
2641
|
// src/features/billing/stripe-usage/components/lists/UsageHistoryTable.tsx
|
|
2616
2642
|
|
|
2617
|
-
|
|
2618
|
-
|
|
2643
|
+
|
|
2644
|
+
function formatDateTime(date, { locale, t }) {
|
|
2645
|
+
if (!date) return t("billing.ui.not_available");
|
|
2619
2646
|
const dateObj = typeof date === "string" ? new Date(date) : date;
|
|
2620
2647
|
try {
|
|
2621
|
-
return new Intl.DateTimeFormat(
|
|
2648
|
+
return new Intl.DateTimeFormat(locale, {
|
|
2622
2649
|
month: "short",
|
|
2623
2650
|
day: "numeric",
|
|
2624
2651
|
year: "numeric",
|
|
@@ -2626,31 +2653,33 @@ function formatDateTime(date) {
|
|
|
2626
2653
|
minute: "2-digit"
|
|
2627
2654
|
}).format(dateObj);
|
|
2628
2655
|
} catch (_error) {
|
|
2629
|
-
return "
|
|
2656
|
+
return t("billing.ui.invalid_date");
|
|
2630
2657
|
}
|
|
2631
2658
|
}
|
|
2632
2659
|
_chunk7QVYU63Ejs.__name.call(void 0, formatDateTime, "formatDateTime");
|
|
2633
2660
|
function UsageHistoryTable({ usageRecords }) {
|
|
2661
|
+
const t = _nextintl.useTranslations.call(void 0, );
|
|
2662
|
+
const fmt = _chunkVDVIUDY5js.useBillingFormatOptions.call(void 0, );
|
|
2634
2663
|
if (usageRecords.length === 0) {
|
|
2635
|
-
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: "
|
|
2664
|
+
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: t("billing.ui.usage.history_empty") }) });
|
|
2636
2665
|
}
|
|
2637
2666
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
2638
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2639
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-clip rounded-lg border", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2640
|
-
/* @__PURE__ */ _jsxruntime.jsx.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,
|
|
2667
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.SectionHeader, { level: 2, children: t("billing.ui.usage.history_title") }),
|
|
2668
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "overflow-clip rounded-lg border", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.Table, { children: [
|
|
2669
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.TableHeader, { className: "bg-muted", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.TableRow, { children: [
|
|
2670
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.TableHead, { children: t("billing.ui.columns.date_time") }),
|
|
2671
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.TableHead, { children: t("billing.ui.columns.meter_event") }),
|
|
2672
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.TableHead, { className: "text-end", children: t("billing.ui.columns.quantity") }),
|
|
2673
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.TableHead, { children: t("billing.ui.columns.event_id") })
|
|
2645
2674
|
] }) }),
|
|
2646
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2647
|
-
const dateTime = formatDateTime(record.timestamp);
|
|
2648
|
-
const quantity = record.quantity.toLocaleString();
|
|
2649
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2650
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2651
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2652
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2653
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2675
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.TableBody, { children: usageRecords.map((record) => {
|
|
2676
|
+
const dateTime = formatDateTime(record.timestamp, fmt);
|
|
2677
|
+
const quantity = record.quantity.toLocaleString(fmt.locale);
|
|
2678
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.TableRow, { children: [
|
|
2679
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.TableCell, { className: "font-medium", children: dateTime }),
|
|
2680
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.TableCell, { className: "text-muted-foreground", children: record.meterEventName }),
|
|
2681
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.TableCell, { className: "text-end font-medium", children: quantity }),
|
|
2682
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.TableCell, { className: "text-muted-foreground text-sm tabular-nums", children: record.stripeEventId })
|
|
2654
2683
|
] }, record.id);
|
|
2655
2684
|
}) })
|
|
2656
2685
|
] }) })
|
|
@@ -2661,8 +2690,8 @@ _chunk7QVYU63Ejs.__name.call(void 0, UsageHistoryTable, "UsageHistoryTable");
|
|
|
2661
2690
|
// src/features/billing/components/modals/BillingDetailModal.tsx
|
|
2662
2691
|
|
|
2663
2692
|
function BillingDetailModal({ open, onOpenChange, title, children, className }) {
|
|
2664
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2665
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2693
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Dialog, { open, onOpenChange, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.DialogContent, { className: _nullishCoalesce(className, () => ( "max-w-4xl max-h-[90vh] overflow-y-auto")), children: [
|
|
2694
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.DialogHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.DialogTitle, { children: title }) }),
|
|
2666
2695
|
children
|
|
2667
2696
|
] }) });
|
|
2668
2697
|
}
|
|
@@ -2671,15 +2700,17 @@ _chunk7QVYU63Ejs.__name.call(void 0, BillingDetailModal, "BillingDetailModal");
|
|
|
2671
2700
|
// src/features/billing/components/widgets/BillingAlertBanner.tsx
|
|
2672
2701
|
|
|
2673
2702
|
|
|
2703
|
+
|
|
2674
2704
|
function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
|
|
2705
|
+
const t = _nextintl.useTranslations.call(void 0, );
|
|
2675
2706
|
if (subscription.status === "past_due" /* PAST_DUE */) {
|
|
2676
2707
|
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: [
|
|
2677
2708
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.AlertCircle, { className: "text-destructive mt-0.5 h-5 w-5" }),
|
|
2678
2709
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex-1", children: [
|
|
2679
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-destructive text-sm font-medium", children: "
|
|
2680
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive mt-1 text-sm", children: "
|
|
2710
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-destructive text-sm font-medium", children: t("billing.ui.alert.payment_failed_title") }),
|
|
2711
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-destructive mt-1 text-sm", children: t("billing.ui.alert.payment_failed_description") })
|
|
2681
2712
|
] }),
|
|
2682
|
-
onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2713
|
+
onUpdatePayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Button, { variant: "outline", size: "sm", onClick: onUpdatePayment, className: "text-destructive border-red-300", children: t("billing.ui.alert.update_payment_method") })
|
|
2683
2714
|
] });
|
|
2684
2715
|
}
|
|
2685
2716
|
if (subscription.status === "trialing" /* TRIALING */ && subscription.trialEnd) {
|
|
@@ -2690,16 +2721,10 @@ function BillingAlertBanner({ subscription, onUpdatePayment, onAddPayment }) {
|
|
|
2690
2721
|
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: [
|
|
2691
2722
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.AlertCircle, { className: "text-warning mt-0.5 h-5 w-5" }),
|
|
2692
2723
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex-1", children: [
|
|
2693
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-warning text-sm font-medium", children: "
|
|
2694
|
-
/* @__PURE__ */ _jsxruntime.
|
|
2695
|
-
"Your trial ends in ",
|
|
2696
|
-
daysRemaining,
|
|
2697
|
-
" ",
|
|
2698
|
-
daysRemaining === 1 ? "day" : "days",
|
|
2699
|
-
". Add a payment method to continue your subscription."
|
|
2700
|
-
] })
|
|
2724
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-warning text-sm font-medium", children: t("billing.ui.alert.trial_ending_title") }),
|
|
2725
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-warning mt-1 text-sm", children: t("billing.ui.alert.trial_ending_description", { count: daysRemaining }) })
|
|
2701
2726
|
] }),
|
|
2702
|
-
onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2727
|
+
onAddPayment && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Button, { variant: "outline", size: "sm", onClick: onAddPayment, className: "text-warning border-yellow-300", children: t("billing.ui.payment_methods.add") })
|
|
2703
2728
|
] });
|
|
2704
2729
|
}
|
|
2705
2730
|
}
|
|
@@ -2710,6 +2735,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, BillingAlertBanner, "BillingAlertBanner");
|
|
|
2710
2735
|
// src/features/billing/components/containers/BillingDashboardContainer.tsx
|
|
2711
2736
|
|
|
2712
2737
|
function BillingDashboardContainer() {
|
|
2738
|
+
const t = _nextintl.useTranslations.call(void 0, );
|
|
2713
2739
|
const [data, setData] = _react.useState.call(void 0, {
|
|
2714
2740
|
customer: null,
|
|
2715
2741
|
subscriptions: [],
|
|
@@ -2739,27 +2765,27 @@ function BillingDashboardContainer() {
|
|
|
2739
2765
|
const [showWizard, setShowWizard] = _react.useState.call(void 0, false);
|
|
2740
2766
|
const [editingSubscription, setEditingSubscription] = _react.useState.call(void 0, null);
|
|
2741
2767
|
const hasMeteredSubscriptions = _react.useCallback.call(void 0, () => {
|
|
2742
|
-
return data.subscriptions.some((sub) => _optionalChain([sub, 'access',
|
|
2768
|
+
return data.subscriptions.some((sub) => _optionalChain([sub, 'access', _103 => _103.price, 'optionalAccess', _104 => _104.recurring, 'optionalAccess', _105 => _105.usageType]) === "metered");
|
|
2743
2769
|
}, [data.subscriptions]);
|
|
2744
2770
|
const hasActiveRecurringSubscription = _react.useMemo.call(void 0, () => {
|
|
2745
2771
|
return data.subscriptions.some(
|
|
2746
|
-
(sub) => (sub.status === "active" /* ACTIVE */ || sub.status === "trialing" /* TRIALING */) && _optionalChain([sub, 'access',
|
|
2772
|
+
(sub) => (sub.status === "active" /* ACTIVE */ || sub.status === "trialing" /* TRIALING */) && _optionalChain([sub, 'access', _106 => _106.price, 'optionalAccess', _107 => _107.priceType]) === "recurring"
|
|
2747
2773
|
);
|
|
2748
2774
|
}, [data.subscriptions]);
|
|
2749
2775
|
const fetchAllData = _react.useCallback.call(void 0, async () => {
|
|
2750
2776
|
setNoCustomerExists(false);
|
|
2751
2777
|
let customer = null;
|
|
2752
2778
|
try {
|
|
2753
|
-
customer = await
|
|
2779
|
+
customer = await _chunk4ORLPEK7js.StripeCustomerService.getCustomer();
|
|
2754
2780
|
setData((prev) => ({ ...prev, customer }));
|
|
2755
2781
|
setErrors((prev) => ({ ...prev, customer: null }));
|
|
2756
2782
|
setNoCustomerExists(false);
|
|
2757
2783
|
} catch (error) {
|
|
2758
2784
|
console.error("[BillingDashboard] Failed to load customer:", error);
|
|
2759
|
-
if (_optionalChain([error, 'optionalAccess',
|
|
2785
|
+
if (_optionalChain([error, 'optionalAccess', _108 => _108.status]) === 404) {
|
|
2760
2786
|
setNoCustomerExists(true);
|
|
2761
2787
|
} else {
|
|
2762
|
-
setErrors((prev) => ({ ...prev, customer: "
|
|
2788
|
+
setErrors((prev) => ({ ...prev, customer: "billing.ui.dashboard.errors.load_customer" }));
|
|
2763
2789
|
}
|
|
2764
2790
|
} finally {
|
|
2765
2791
|
setLoading((prev) => ({ ...prev, customer: false }));
|
|
@@ -2776,13 +2802,13 @@ function BillingDashboardContainer() {
|
|
|
2776
2802
|
}
|
|
2777
2803
|
const fetchSubscriptions = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2778
2804
|
try {
|
|
2779
|
-
const subscriptions2 = await
|
|
2805
|
+
const subscriptions2 = await _chunk4ORLPEK7js.StripeSubscriptionService.listSubscriptions();
|
|
2780
2806
|
setData((prev) => ({ ...prev, subscriptions: subscriptions2 }));
|
|
2781
2807
|
setErrors((prev) => ({ ...prev, subscriptions: null }));
|
|
2782
2808
|
return subscriptions2;
|
|
2783
2809
|
} catch (error) {
|
|
2784
2810
|
console.error("[BillingDashboard] Failed to load subscriptions:", error);
|
|
2785
|
-
setErrors((prev) => ({ ...prev, subscriptions: "
|
|
2811
|
+
setErrors((prev) => ({ ...prev, subscriptions: "billing.ui.dashboard.errors.load_subscriptions" }));
|
|
2786
2812
|
return [];
|
|
2787
2813
|
} finally {
|
|
2788
2814
|
setLoading((prev) => ({ ...prev, subscriptions: false }));
|
|
@@ -2790,31 +2816,31 @@ function BillingDashboardContainer() {
|
|
|
2790
2816
|
}, "fetchSubscriptions");
|
|
2791
2817
|
const fetchPaymentMethods = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2792
2818
|
try {
|
|
2793
|
-
const paymentMethods = await
|
|
2819
|
+
const paymentMethods = await _chunk4ORLPEK7js.StripeCustomerService.listPaymentMethods();
|
|
2794
2820
|
setData((prev) => ({ ...prev, paymentMethods }));
|
|
2795
2821
|
setErrors((prev) => ({ ...prev, paymentMethods: null }));
|
|
2796
2822
|
} catch (error) {
|
|
2797
2823
|
console.error("[BillingDashboard] Failed to load payment methods:", error);
|
|
2798
|
-
setErrors((prev) => ({ ...prev, paymentMethods: "
|
|
2824
|
+
setErrors((prev) => ({ ...prev, paymentMethods: "billing.ui.dashboard.errors.load_payment_methods" }));
|
|
2799
2825
|
} finally {
|
|
2800
2826
|
setLoading((prev) => ({ ...prev, paymentMethods: false }));
|
|
2801
2827
|
}
|
|
2802
2828
|
}, "fetchPaymentMethods");
|
|
2803
2829
|
const fetchInvoices = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2804
2830
|
try {
|
|
2805
|
-
const invoices = await
|
|
2831
|
+
const invoices = await _chunk4ORLPEK7js.StripeInvoiceService.listInvoices();
|
|
2806
2832
|
setData((prev) => ({ ...prev, invoices }));
|
|
2807
2833
|
setErrors((prev) => ({ ...prev, invoices: null }));
|
|
2808
2834
|
} catch (error) {
|
|
2809
2835
|
console.error("[BillingDashboard] Failed to load invoices:", error);
|
|
2810
|
-
setErrors((prev) => ({ ...prev, invoices: "
|
|
2836
|
+
setErrors((prev) => ({ ...prev, invoices: "billing.ui.dashboard.errors.load_invoices" }));
|
|
2811
2837
|
} finally {
|
|
2812
2838
|
setLoading((prev) => ({ ...prev, invoices: false }));
|
|
2813
2839
|
}
|
|
2814
2840
|
}, "fetchInvoices");
|
|
2815
2841
|
const [subscriptions] = await Promise.all([fetchSubscriptions(), fetchPaymentMethods(), fetchInvoices()]);
|
|
2816
2842
|
const hasMetered = subscriptions.some(
|
|
2817
|
-
(sub) => _optionalChain([sub, 'access',
|
|
2843
|
+
(sub) => _optionalChain([sub, 'access', _109 => _109.price, 'optionalAccess', _110 => _110.recurring, 'optionalAccess', _111 => _111.usageType]) === "metered"
|
|
2818
2844
|
);
|
|
2819
2845
|
if (hasMetered) {
|
|
2820
2846
|
await fetchUsageData();
|
|
@@ -2825,19 +2851,19 @@ function BillingDashboardContainer() {
|
|
|
2825
2851
|
const handleCreateCustomer = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2826
2852
|
setCreatingCustomer(true);
|
|
2827
2853
|
try {
|
|
2828
|
-
await
|
|
2854
|
+
await _chunk4ORLPEK7js.StripeCustomerService.createCustomer();
|
|
2829
2855
|
setNoCustomerExists(false);
|
|
2830
2856
|
await fetchAllData();
|
|
2831
2857
|
} catch (error) {
|
|
2832
2858
|
console.error("[BillingDashboard] Failed to create customer:", error);
|
|
2833
|
-
setErrors((prev) => ({ ...prev, customer: "
|
|
2859
|
+
setErrors((prev) => ({ ...prev, customer: "billing.ui.dashboard.errors.setup" }));
|
|
2834
2860
|
} finally {
|
|
2835
2861
|
setCreatingCustomer(false);
|
|
2836
2862
|
}
|
|
2837
2863
|
}, "handleCreateCustomer");
|
|
2838
2864
|
const fetchUsageData = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
2839
2865
|
try {
|
|
2840
|
-
const meters = await
|
|
2866
|
+
const meters = await _chunk4ORLPEK7js.StripeUsageService.listMeters();
|
|
2841
2867
|
setData((prev) => ({ ...prev, meters }));
|
|
2842
2868
|
const summariesMap = {};
|
|
2843
2869
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -2845,7 +2871,7 @@ function BillingDashboardContainer() {
|
|
|
2845
2871
|
const endOfMonth = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
|
|
2846
2872
|
for (const meter of meters) {
|
|
2847
2873
|
try {
|
|
2848
|
-
const meterSummaries = await
|
|
2874
|
+
const meterSummaries = await _chunk4ORLPEK7js.StripeUsageService.getMeterSummaries({
|
|
2849
2875
|
meterId: meter.id,
|
|
2850
2876
|
startTime: startOfMonth,
|
|
2851
2877
|
endTime: endOfMonth
|
|
@@ -2860,7 +2886,7 @@ function BillingDashboardContainer() {
|
|
|
2860
2886
|
setErrors((prev) => ({ ...prev, usage: null }));
|
|
2861
2887
|
} catch (error) {
|
|
2862
2888
|
console.error("[BillingDashboard] Failed to load usage data:", error);
|
|
2863
|
-
setErrors((prev) => ({ ...prev, usage: "
|
|
2889
|
+
setErrors((prev) => ({ ...prev, usage: "billing.ui.dashboard.errors.load_usage" }));
|
|
2864
2890
|
} finally {
|
|
2865
2891
|
setLoading((prev) => ({ ...prev, usage: false }));
|
|
2866
2892
|
}
|
|
@@ -2906,13 +2932,13 @@ function BillingDashboardContainer() {
|
|
|
2906
2932
|
const getModalTitle = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (type) => {
|
|
2907
2933
|
switch (type) {
|
|
2908
2934
|
case "subscriptions":
|
|
2909
|
-
return "
|
|
2935
|
+
return t("billing.ui.dashboard.modal.subscriptions");
|
|
2910
2936
|
case "payment-methods":
|
|
2911
|
-
return "
|
|
2937
|
+
return t("billing.ui.payment_methods.title");
|
|
2912
2938
|
case "invoices":
|
|
2913
|
-
return "
|
|
2939
|
+
return t("billing.ui.dashboard.modal.invoices");
|
|
2914
2940
|
case "usage":
|
|
2915
|
-
return "
|
|
2941
|
+
return t("billing.ui.usage.title");
|
|
2916
2942
|
default:
|
|
2917
2943
|
return "";
|
|
2918
2944
|
}
|
|
@@ -2921,20 +2947,20 @@ function BillingDashboardContainer() {
|
|
|
2921
2947
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-6", children: [
|
|
2922
2948
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-3", children: [
|
|
2923
2949
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Wallet, { className: "h-8 w-8" }),
|
|
2924
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: "
|
|
2950
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h1", { className: "text-primary text-3xl font-semibold", children: t("billing.title") })
|
|
2925
2951
|
] }),
|
|
2926
|
-
isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2927
|
-
noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2928
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2952
|
+
isInitialLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Card, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.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" }) }) }),
|
|
2953
|
+
noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.Card, { children: [
|
|
2954
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.CardHeader, { className: "text-center", children: [
|
|
2929
2955
|
/* @__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" }) }),
|
|
2930
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2931
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2956
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.CardTitle, { children: t("billing.ui.dashboard.setup_title") }),
|
|
2957
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.CardDescription, { children: t("billing.ui.dashboard.setup_description") })
|
|
2932
2958
|
] }),
|
|
2933
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2959
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.CardContent, { className: "flex justify-center pb-8", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Button, { onClick: handleCreateCustomer, disabled: creatingCustomer, size: "lg", children: creatingCustomer ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2934
2960
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Loader2, { className: "me-2 h-4 w-4 animate-spin" }),
|
|
2935
|
-
"
|
|
2936
|
-
] }) : "
|
|
2937
|
-
errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2961
|
+
t("billing.ui.dashboard.setting_up")
|
|
2962
|
+
] }) : t("billing.ui.dashboard.setup_button") }) }),
|
|
2963
|
+
errors.customer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.CardContent, { className: "pt-0", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-center text-destructive text-xs/relaxed", children: t(errors.customer) }) })
|
|
2938
2964
|
] }),
|
|
2939
2965
|
!noCustomerExists && !isInitialLoading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
2940
2966
|
criticalSubscriptions.map((subscription) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -2952,7 +2978,7 @@ function BillingDashboardContainer() {
|
|
|
2952
2978
|
{
|
|
2953
2979
|
subscriptions: data.subscriptions,
|
|
2954
2980
|
loading: loading.subscriptions,
|
|
2955
|
-
error: errors.subscriptions
|
|
2981
|
+
error: errors.subscriptions ? t(errors.subscriptions) : void 0,
|
|
2956
2982
|
onManageClick: () => {
|
|
2957
2983
|
if (data.subscriptions.length === 0) {
|
|
2958
2984
|
setShowWizard(true);
|
|
@@ -2966,9 +2992,9 @@ function BillingDashboardContainer() {
|
|
|
2966
2992
|
PaymentMethodSummaryCard,
|
|
2967
2993
|
{
|
|
2968
2994
|
paymentMethods: data.paymentMethods,
|
|
2969
|
-
defaultPaymentMethodId: _optionalChain([data, 'access',
|
|
2995
|
+
defaultPaymentMethodId: _optionalChain([data, 'access', _112 => _112.customer, 'optionalAccess', _113 => _113.defaultPaymentMethodId]),
|
|
2970
2996
|
loading: loading.paymentMethods,
|
|
2971
|
-
error: errors.paymentMethods
|
|
2997
|
+
error: errors.paymentMethods ? t(errors.paymentMethods) : void 0,
|
|
2972
2998
|
onManageClick: () => setActiveModal("payment-methods")
|
|
2973
2999
|
}
|
|
2974
3000
|
),
|
|
@@ -2977,7 +3003,7 @@ function BillingDashboardContainer() {
|
|
|
2977
3003
|
{
|
|
2978
3004
|
customer: data.customer,
|
|
2979
3005
|
loading: loading.customer,
|
|
2980
|
-
error: errors.customer
|
|
3006
|
+
error: errors.customer ? t(errors.customer) : void 0
|
|
2981
3007
|
}
|
|
2982
3008
|
),
|
|
2983
3009
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -2985,7 +3011,7 @@ function BillingDashboardContainer() {
|
|
|
2985
3011
|
{
|
|
2986
3012
|
invoices: data.invoices,
|
|
2987
3013
|
loading: loading.invoices,
|
|
2988
|
-
error: errors.invoices
|
|
3014
|
+
error: errors.invoices ? t(errors.invoices) : void 0,
|
|
2989
3015
|
onViewAllClick: () => setActiveModal("invoices")
|
|
2990
3016
|
}
|
|
2991
3017
|
),
|
|
@@ -2995,7 +3021,7 @@ function BillingDashboardContainer() {
|
|
|
2995
3021
|
meters: data.meters,
|
|
2996
3022
|
summaries: data.meterSummaries,
|
|
2997
3023
|
loading: loading.usage,
|
|
2998
|
-
error: errors.usage
|
|
3024
|
+
error: errors.usage ? t(errors.usage) : void 0,
|
|
2999
3025
|
onViewDetailsClick: () => setActiveModal("usage")
|
|
3000
3026
|
}
|
|
3001
3027
|
)
|
|
@@ -3067,7 +3093,7 @@ function getStripePromise(publishableKey) {
|
|
|
3067
3093
|
if (!publishableKey) {
|
|
3068
3094
|
return Promise.resolve(null);
|
|
3069
3095
|
}
|
|
3070
|
-
if (_optionalChain([stripePromiseCache, 'optionalAccess',
|
|
3096
|
+
if (_optionalChain([stripePromiseCache, 'optionalAccess', _114 => _114.key]) === publishableKey) {
|
|
3071
3097
|
return stripePromiseCache.promise;
|
|
3072
3098
|
}
|
|
3073
3099
|
const promise = _stripejs.loadStripe.call(void 0, publishableKey);
|
|
@@ -3076,7 +3102,7 @@ function getStripePromise(publishableKey) {
|
|
|
3076
3102
|
}
|
|
3077
3103
|
_chunk7QVYU63Ejs.__name.call(void 0, getStripePromise, "getStripePromise");
|
|
3078
3104
|
function StripeProvider({ children }) {
|
|
3079
|
-
const publishableKey =
|
|
3105
|
+
const publishableKey = _chunkGPXYQMOZjs.getStripePublishableKey.call(void 0, );
|
|
3080
3106
|
const stripePromise = _react.useMemo.call(void 0, () => getStripePromise(publishableKey), [publishableKey]);
|
|
3081
3107
|
const options = _react.useMemo.call(void 0, () => ({}), []);
|
|
3082
3108
|
if (!publishableKey) {
|
|
@@ -3086,12 +3112,12 @@ function StripeProvider({ children }) {
|
|
|
3086
3112
|
}
|
|
3087
3113
|
_chunk7QVYU63Ejs.__name.call(void 0, StripeProvider, "StripeProvider");
|
|
3088
3114
|
function isStripeConfigured() {
|
|
3089
|
-
return !!
|
|
3115
|
+
return !!_chunkGPXYQMOZjs.getStripePublishableKey.call(void 0, );
|
|
3090
3116
|
}
|
|
3091
3117
|
_chunk7QVYU63Ejs.__name.call(void 0, isStripeConfigured, "isStripeConfigured");
|
|
3092
3118
|
|
|
3093
3119
|
// src/features/billing/contexts/PriceContext.tsx
|
|
3094
|
-
|
|
3120
|
+
|
|
3095
3121
|
|
|
3096
3122
|
|
|
3097
3123
|
// src/features/billing/stripe-price/components/forms/PriceArchiver.tsx
|
|
@@ -3101,22 +3127,23 @@ var _nextintl = require('next-intl');
|
|
|
3101
3127
|
|
|
3102
3128
|
function PriceArchiver({ price }) {
|
|
3103
3129
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
3130
|
+
const fmt = _chunkVDVIUDY5js.useBillingFormatOptions.call(void 0, );
|
|
3104
3131
|
const { archivePrice, restorePrice } = usePriceContext();
|
|
3105
3132
|
const [open, setOpen] = _react.useState.call(void 0, false);
|
|
3106
3133
|
const isArchived = !price.active;
|
|
3107
3134
|
const scope = isArchived ? "restore" : "archive";
|
|
3108
3135
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
3109
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3136
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.Button, { variant: "outline", size: "sm", onClick: () => setOpen(true), children: [
|
|
3110
3137
|
isArchived ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RotateCcwIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ArchiveIcon, {}),
|
|
3111
3138
|
t(`billing.admin.prices.${scope}.confirm`)
|
|
3112
3139
|
] }),
|
|
3113
3140
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3114
|
-
|
|
3141
|
+
_chunkVDVIUDY5js.ConfirmDialog,
|
|
3115
3142
|
{
|
|
3116
3143
|
open,
|
|
3117
3144
|
onOpenChange: setOpen,
|
|
3118
3145
|
title: t(`billing.admin.prices.${scope}.title`),
|
|
3119
|
-
description: t(`billing.admin.prices.${scope}.description`, { label: priceLabel(price) }),
|
|
3146
|
+
description: t(`billing.admin.prices.${scope}.description`, { label: priceLabel(price, fmt) }),
|
|
3120
3147
|
confirmLabel: t(`billing.admin.prices.${scope}.confirm`),
|
|
3121
3148
|
cancelLabel: t("ui.buttons.cancel"),
|
|
3122
3149
|
destructive: !isArchived,
|
|
@@ -3125,7 +3152,7 @@ function PriceArchiver({ price }) {
|
|
|
3125
3152
|
if (isArchived) await restorePrice(price.id);
|
|
3126
3153
|
else await archivePrice(price.id);
|
|
3127
3154
|
} catch (error) {
|
|
3128
|
-
|
|
3155
|
+
_chunkVDVIUDY5js.errorToast.call(void 0, { title: t(`billing.admin.prices.${scope}.title`), error });
|
|
3129
3156
|
throw error;
|
|
3130
3157
|
}
|
|
3131
3158
|
}
|
|
@@ -3157,14 +3184,15 @@ function PriceEditorInternal({
|
|
|
3157
3184
|
onDialogOpenChange
|
|
3158
3185
|
}) {
|
|
3159
3186
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
3160
|
-
const
|
|
3187
|
+
const fmt = _chunkVDVIUDY5js.useBillingFormatOptions.call(void 0, );
|
|
3188
|
+
const router = _chunk4ORLPEK7js.useI18nRouter.call(void 0, );
|
|
3161
3189
|
const { createPrice, updatePrice, productId: contextProductId } = usePriceContext();
|
|
3162
3190
|
const [allFeatures, setAllFeatures] = _react.useState.call(void 0, []);
|
|
3163
3191
|
const isEdit = !!price;
|
|
3164
|
-
const targetProductId = _nullishCoalesce(_nullishCoalesce(productId, () => ( _optionalChain([price, 'optionalAccess',
|
|
3192
|
+
const targetProductId = _nullishCoalesce(_nullishCoalesce(productId, () => ( _optionalChain([price, 'optionalAccess', _115 => _115.product, 'optionalAccess', _116 => _116.id]))), () => ( contextProductId));
|
|
3165
3193
|
_react.useEffect.call(void 0, () => {
|
|
3166
3194
|
const fetchFeatures = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, async () => {
|
|
3167
|
-
setAllFeatures(await
|
|
3195
|
+
setAllFeatures(await _chunk4ORLPEK7js.FeatureService.findMany({}));
|
|
3168
3196
|
}, "fetchFeatures");
|
|
3169
3197
|
void fetchFeatures();
|
|
3170
3198
|
}, []);
|
|
@@ -3240,22 +3268,22 @@ function PriceEditorInternal({
|
|
|
3240
3268
|
// `.toString()`, for the same reason the schema keeps the token
|
|
3241
3269
|
// pipeline string-based: a seeded `0` must survive as "0" and not be
|
|
3242
3270
|
// dropped as falsy.
|
|
3243
|
-
token: _nullishCoalesce(_optionalChain([seed, 'access',
|
|
3271
|
+
token: _nullishCoalesce(_optionalChain([seed, 'access', _117 => _117.token, 'optionalAccess', _118 => _118.toString, 'call', _119 => _119()]), () => ( "")),
|
|
3244
3272
|
featureIds: [.../* @__PURE__ */ new Set([...resolvePlatformFeatures(seed.platformFeatures).ids, ...coreFeatureIds])]
|
|
3245
3273
|
};
|
|
3246
3274
|
}
|
|
3247
3275
|
return {
|
|
3248
|
-
unitAmount: _optionalChain([price, 'optionalAccess',
|
|
3249
|
-
currency: _nullishCoalesce(_optionalChain([price, 'optionalAccess',
|
|
3250
|
-
interval: _optionalChain([price, 'optionalAccess',
|
|
3251
|
-
intervalCount: _nullishCoalesce(_optionalChain([price, 'optionalAccess',
|
|
3252
|
-
usageType: _nullishCoalesce(_optionalChain([price, 'optionalAccess',
|
|
3253
|
-
nickname: _nullishCoalesce(_optionalChain([price, 'optionalAccess',
|
|
3254
|
-
isTrial: _nullishCoalesce(_optionalChain([price, 'optionalAccess',
|
|
3255
|
-
description: _nullishCoalesce(_optionalChain([price, 'optionalAccess',
|
|
3256
|
-
features: _nullishCoalesce(_optionalChain([price, 'optionalAccess',
|
|
3257
|
-
token: _nullishCoalesce(_optionalChain([price, 'optionalAccess',
|
|
3258
|
-
featureIds: [.../* @__PURE__ */ new Set([..._nullishCoalesce(_optionalChain([price, 'optionalAccess',
|
|
3276
|
+
unitAmount: _optionalChain([price, 'optionalAccess', _120 => _120.unitAmount]) ? price.unitAmount / 100 : 0,
|
|
3277
|
+
currency: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _121 => _121.currency]), () => ( "usd")),
|
|
3278
|
+
interval: _optionalChain([price, 'optionalAccess', _122 => _122.priceType]) === "one_time" ? "one_time" : _nullishCoalesce(_optionalChain([price, 'optionalAccess', _123 => _123.recurring, 'optionalAccess', _124 => _124.interval]), () => ( "month")),
|
|
3279
|
+
intervalCount: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _125 => _125.recurring, 'optionalAccess', _126 => _126.intervalCount]), () => ( 1)),
|
|
3280
|
+
usageType: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _127 => _127.recurring, 'optionalAccess', _128 => _128.usageType]), () => ( "licensed")),
|
|
3281
|
+
nickname: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _129 => _129.nickname]), () => ( "")),
|
|
3282
|
+
isTrial: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _130 => _130.isTrial]), () => ( false)),
|
|
3283
|
+
description: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _131 => _131.description]), () => ( "")),
|
|
3284
|
+
features: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _132 => _132.features]), () => ( [])),
|
|
3285
|
+
token: _nullishCoalesce(_optionalChain([price, 'optionalAccess', _133 => _133.token, 'optionalAccess', _134 => _134.toString, 'call', _135 => _135()]), () => ( "")),
|
|
3286
|
+
featureIds: [.../* @__PURE__ */ new Set([..._nullishCoalesce(_optionalChain([price, 'optionalAccess', _136 => _136.priceFeatures, 'optionalAccess', _137 => _137.map, 'call', _138 => _138((f) => f.id)]), () => ( [])), ...coreFeatureIds])]
|
|
3259
3287
|
};
|
|
3260
3288
|
}, [price, seed, allFeatures, resolvePlatformFeatures]);
|
|
3261
3289
|
const form = _reacthookform.useForm.call(void 0, {
|
|
@@ -3277,7 +3305,7 @@ function PriceEditorInternal({
|
|
|
3277
3305
|
warnedUnknownFor.current = fingerprint;
|
|
3278
3306
|
const { unknown } = resolvePlatformFeatures(seed.platformFeatures);
|
|
3279
3307
|
if (unknown.length > 0)
|
|
3280
|
-
|
|
3308
|
+
_chunk4ORLPEK7js.showToast.call(void 0, t("billing.admin.prices.import.warnings.unknownFeatures", { features: unknown.join(", ") }));
|
|
3281
3309
|
}, [seed, isEdit, allFeatures, resolvePlatformFeatures, t]);
|
|
3282
3310
|
const watchInterval = form.watch("interval");
|
|
3283
3311
|
const isRecurring = watchInterval !== "one_time";
|
|
@@ -3298,13 +3326,13 @@ function PriceEditorInternal({
|
|
|
3298
3326
|
{ id: "metered", text: t("billing.admin.prices.usage.metered") }
|
|
3299
3327
|
];
|
|
3300
3328
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3301
|
-
|
|
3329
|
+
_chunkVDVIUDY5js.EditorSheet,
|
|
3302
3330
|
{
|
|
3303
3331
|
form,
|
|
3304
3332
|
entityType: t("billing.admin.prices.entity"),
|
|
3305
|
-
entityName: price ? priceLabel(price) : void 0,
|
|
3333
|
+
entityName: price ? priceLabel(price, fmt) : void 0,
|
|
3306
3334
|
isEdit,
|
|
3307
|
-
module:
|
|
3335
|
+
module: _chunk4ORLPEK7js.Modules.StripePrice,
|
|
3308
3336
|
size: "lg",
|
|
3309
3337
|
propagateChanges,
|
|
3310
3338
|
onSuccess,
|
|
@@ -3353,13 +3381,13 @@ function PriceEditorInternal({
|
|
|
3353
3381
|
dialogOpen,
|
|
3354
3382
|
onDialogOpenChange,
|
|
3355
3383
|
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
3356
|
-
isEdit && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3357
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3358
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3384
|
+
isEdit && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.Alert, { children: [
|
|
3385
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.AlertTitle, { children: t("billing.admin.prices.immutability.title") }),
|
|
3386
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.AlertDescription, { children: t("billing.admin.prices.immutability.description") })
|
|
3359
3387
|
] }),
|
|
3360
3388
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
|
|
3361
3389
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3362
|
-
|
|
3390
|
+
_chunkVDVIUDY5js.FormInput,
|
|
3363
3391
|
{
|
|
3364
3392
|
form,
|
|
3365
3393
|
id: "unitAmount",
|
|
@@ -3371,7 +3399,7 @@ function PriceEditorInternal({
|
|
|
3371
3399
|
}
|
|
3372
3400
|
),
|
|
3373
3401
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3374
|
-
|
|
3402
|
+
_chunkVDVIUDY5js.FormSelect,
|
|
3375
3403
|
{
|
|
3376
3404
|
form,
|
|
3377
3405
|
id: "currency",
|
|
@@ -3382,7 +3410,7 @@ function PriceEditorInternal({
|
|
|
3382
3410
|
)
|
|
3383
3411
|
] }),
|
|
3384
3412
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3385
|
-
|
|
3413
|
+
_chunkVDVIUDY5js.FormSelect,
|
|
3386
3414
|
{
|
|
3387
3415
|
form,
|
|
3388
3416
|
id: "interval",
|
|
@@ -3393,7 +3421,7 @@ function PriceEditorInternal({
|
|
|
3393
3421
|
),
|
|
3394
3422
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-x-4", children: [
|
|
3395
3423
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3396
|
-
|
|
3424
|
+
_chunkVDVIUDY5js.FormInput,
|
|
3397
3425
|
{
|
|
3398
3426
|
form,
|
|
3399
3427
|
id: "intervalCount",
|
|
@@ -3404,7 +3432,7 @@ function PriceEditorInternal({
|
|
|
3404
3432
|
}
|
|
3405
3433
|
),
|
|
3406
3434
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3407
|
-
|
|
3435
|
+
_chunkVDVIUDY5js.FormSelect,
|
|
3408
3436
|
{
|
|
3409
3437
|
form,
|
|
3410
3438
|
id: "usageType",
|
|
@@ -3415,7 +3443,7 @@ function PriceEditorInternal({
|
|
|
3415
3443
|
)
|
|
3416
3444
|
] }),
|
|
3417
3445
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3418
|
-
|
|
3446
|
+
_chunkVDVIUDY5js.FormInput,
|
|
3419
3447
|
{
|
|
3420
3448
|
form,
|
|
3421
3449
|
id: "nickname",
|
|
@@ -3424,7 +3452,7 @@ function PriceEditorInternal({
|
|
|
3424
3452
|
}
|
|
3425
3453
|
),
|
|
3426
3454
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3427
|
-
|
|
3455
|
+
_chunkVDVIUDY5js.FormTextarea,
|
|
3428
3456
|
{
|
|
3429
3457
|
form,
|
|
3430
3458
|
id: "description",
|
|
@@ -3434,7 +3462,7 @@ function PriceEditorInternal({
|
|
|
3434
3462
|
}
|
|
3435
3463
|
),
|
|
3436
3464
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3437
|
-
|
|
3465
|
+
_chunkVDVIUDY5js.FormInput,
|
|
3438
3466
|
{
|
|
3439
3467
|
form,
|
|
3440
3468
|
id: "token",
|
|
@@ -3444,10 +3472,10 @@ function PriceEditorInternal({
|
|
|
3444
3472
|
}
|
|
3445
3473
|
),
|
|
3446
3474
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-2", children: [
|
|
3447
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3475
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.FieldLabel, { children: t("billing.admin.prices.fields.features") }),
|
|
3448
3476
|
form.watch("features").map((_, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
|
|
3449
3477
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3450
|
-
|
|
3478
|
+
_chunkVDVIUDY5js.Input,
|
|
3451
3479
|
{
|
|
3452
3480
|
...form.register(`features.${index}`),
|
|
3453
3481
|
placeholder: t("billing.admin.prices.placeholders.feature", { index: index + 1 }),
|
|
@@ -3455,7 +3483,7 @@ function PriceEditorInternal({
|
|
|
3455
3483
|
}
|
|
3456
3484
|
),
|
|
3457
3485
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3458
|
-
|
|
3486
|
+
_chunkVDVIUDY5js.Button,
|
|
3459
3487
|
{
|
|
3460
3488
|
type: "button",
|
|
3461
3489
|
variant: "outline",
|
|
@@ -3470,7 +3498,7 @@ function PriceEditorInternal({
|
|
|
3470
3498
|
)
|
|
3471
3499
|
] }, index)),
|
|
3472
3500
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3473
|
-
|
|
3501
|
+
_chunkVDVIUDY5js.Button,
|
|
3474
3502
|
{
|
|
3475
3503
|
type: "button",
|
|
3476
3504
|
variant: "outline",
|
|
@@ -3485,12 +3513,12 @@ function PriceEditorInternal({
|
|
|
3485
3513
|
)
|
|
3486
3514
|
] }),
|
|
3487
3515
|
isRecurring && allFeatures.length > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-y-2", children: [
|
|
3488
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3516
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.FieldLabel, { children: t("billing.admin.prices.fields.platformFeatures") }),
|
|
3489
3517
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex max-h-48 flex-col gap-y-2 overflow-y-auto rounded-md border p-4", children: allFeatures.map((feature) => {
|
|
3490
3518
|
const isChecked = form.watch("featureIds").includes(feature.id);
|
|
3491
3519
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-x-2", children: [
|
|
3492
3520
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3493
|
-
|
|
3521
|
+
_chunkVDVIUDY5js.Checkbox,
|
|
3494
3522
|
{
|
|
3495
3523
|
id: `feature-${feature.id}`,
|
|
3496
3524
|
checked: isChecked,
|
|
@@ -3506,13 +3534,13 @@ function PriceEditorInternal({
|
|
|
3506
3534
|
}
|
|
3507
3535
|
}
|
|
3508
3536
|
),
|
|
3509
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3537
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.FieldLabel, { htmlFor: `feature-${feature.id}`, children: feature.name }),
|
|
3510
3538
|
feature.isCore && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-muted-foreground text-xs", children: t("billing.admin.prices.help.core") })
|
|
3511
3539
|
] }, feature.id);
|
|
3512
3540
|
}) })
|
|
3513
3541
|
] }),
|
|
3514
3542
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3515
|
-
|
|
3543
|
+
_chunkVDVIUDY5js.FormCheckbox,
|
|
3516
3544
|
{
|
|
3517
3545
|
form,
|
|
3518
3546
|
id: "isTrial",
|
|
@@ -3554,8 +3582,8 @@ var defaultContextValue = {
|
|
|
3554
3582
|
}, "refreshPrices"),
|
|
3555
3583
|
productId: void 0
|
|
3556
3584
|
};
|
|
3557
|
-
function priceLabel(price) {
|
|
3558
|
-
return _nullishCoalesce(price.nickname, () => ( `${
|
|
3585
|
+
function priceLabel(price, fmt = {}) {
|
|
3586
|
+
return _nullishCoalesce(price.nickname, () => ( `${_chunkVDVIUDY5js.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt)} ${_chunkVDVIUDY5js.formatInterval.call(void 0, price, fmt)}`.trim()));
|
|
3559
3587
|
}
|
|
3560
3588
|
_chunk7QVYU63Ejs.__name.call(void 0, priceLabel, "priceLabel");
|
|
3561
3589
|
var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
@@ -3565,21 +3593,22 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3565
3593
|
productId: productIdProp
|
|
3566
3594
|
}) => {
|
|
3567
3595
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
3568
|
-
const
|
|
3569
|
-
const
|
|
3596
|
+
const fmt = _chunkVDVIUDY5js.useBillingFormatOptions.call(void 0, );
|
|
3597
|
+
const generateUrl = _chunkVDVIUDY5js.usePageUrlGenerator.call(void 0, );
|
|
3598
|
+
const { hasRole } = _chunkVDVIUDY5js.useCurrentUserContext.call(void 0, );
|
|
3570
3599
|
const [price, setPrice] = _react.useState.call(void 0,
|
|
3571
|
-
dehydratedPrice ?
|
|
3600
|
+
dehydratedPrice ? _chunk4ORLPEK7js.rehydrate.call(void 0, _chunk4ORLPEK7js.Modules.StripePrice, dehydratedPrice) : void 0
|
|
3572
3601
|
);
|
|
3573
3602
|
const [priceVersion, setPriceVersion] = _react.useState.call(void 0, 0);
|
|
3574
3603
|
const refreshPrices = _react.useCallback.call(void 0, () => setPriceVersion((value2) => value2 + 1), []);
|
|
3575
|
-
const productId = _nullishCoalesce(productIdProp, () => ( _optionalChain([price, 'optionalAccess',
|
|
3604
|
+
const productId = _nullishCoalesce(productIdProp, () => ( _optionalChain([price, 'optionalAccess', _139 => _139.product, 'optionalAccess', _140 => _140.id])));
|
|
3576
3605
|
const reloadPrice = _react.useCallback.call(void 0, async () => {
|
|
3577
|
-
if (!_optionalChain([price, 'optionalAccess',
|
|
3578
|
-
setPrice(await
|
|
3579
|
-
}, [_optionalChain([price, 'optionalAccess',
|
|
3606
|
+
if (!_optionalChain([price, 'optionalAccess', _141 => _141.id])) return;
|
|
3607
|
+
setPrice(await _chunk4ORLPEK7js.StripePriceService.getPrice({ id: price.id }));
|
|
3608
|
+
}, [_optionalChain([price, 'optionalAccess', _142 => _142.id])]);
|
|
3580
3609
|
const createPrice = _react.useCallback.call(void 0,
|
|
3581
3610
|
async (input) => {
|
|
3582
|
-
const saved = await
|
|
3611
|
+
const saved = await _chunk4ORLPEK7js.StripePriceService.createPrice(input);
|
|
3583
3612
|
refreshPrices();
|
|
3584
3613
|
return saved;
|
|
3585
3614
|
},
|
|
@@ -3587,7 +3616,7 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3587
3616
|
);
|
|
3588
3617
|
const updatePrice = _react.useCallback.call(void 0,
|
|
3589
3618
|
async (input) => {
|
|
3590
|
-
const saved = await
|
|
3619
|
+
const saved = await _chunk4ORLPEK7js.StripePriceService.updatePrice(input);
|
|
3591
3620
|
setPrice(saved);
|
|
3592
3621
|
refreshPrices();
|
|
3593
3622
|
return saved;
|
|
@@ -3596,23 +3625,23 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3596
3625
|
);
|
|
3597
3626
|
const archivePrice = _react.useCallback.call(void 0,
|
|
3598
3627
|
async (id) => {
|
|
3599
|
-
const target = _nullishCoalesce(id, () => ( _optionalChain([price, 'optionalAccess',
|
|
3628
|
+
const target = _nullishCoalesce(id, () => ( _optionalChain([price, 'optionalAccess', _143 => _143.id])));
|
|
3600
3629
|
if (!target) return;
|
|
3601
|
-
await
|
|
3630
|
+
await _chunk4ORLPEK7js.StripePriceService.archivePrice({ id: target });
|
|
3602
3631
|
await reloadPrice();
|
|
3603
3632
|
refreshPrices();
|
|
3604
3633
|
},
|
|
3605
|
-
[_optionalChain([price, 'optionalAccess',
|
|
3634
|
+
[_optionalChain([price, 'optionalAccess', _144 => _144.id]), reloadPrice, refreshPrices]
|
|
3606
3635
|
);
|
|
3607
3636
|
const restorePrice = _react.useCallback.call(void 0,
|
|
3608
3637
|
async (id) => {
|
|
3609
|
-
const target = _nullishCoalesce(id, () => ( _optionalChain([price, 'optionalAccess',
|
|
3638
|
+
const target = _nullishCoalesce(id, () => ( _optionalChain([price, 'optionalAccess', _145 => _145.id])));
|
|
3610
3639
|
if (!target) return;
|
|
3611
|
-
await
|
|
3640
|
+
await _chunk4ORLPEK7js.StripePriceService.reactivatePrice({ id: target });
|
|
3612
3641
|
await reloadPrice();
|
|
3613
3642
|
refreshPrices();
|
|
3614
3643
|
},
|
|
3615
|
-
[_optionalChain([price, 'optionalAccess',
|
|
3644
|
+
[_optionalChain([price, 'optionalAccess', _146 => _146.id]), reloadPrice, refreshPrices]
|
|
3616
3645
|
);
|
|
3617
3646
|
const value = _react.useMemo.call(void 0,
|
|
3618
3647
|
() => ({
|
|
@@ -3632,20 +3661,20 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3632
3661
|
if (!publishChrome) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceContext.Provider, { value, children });
|
|
3633
3662
|
const breadcrumb = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
3634
3663
|
const items = [
|
|
3635
|
-
{ name: t("billing.admin.products.title"), href: generateUrl({ page:
|
|
3664
|
+
{ name: t("billing.admin.products.title"), href: generateUrl({ page: _chunk4ORLPEK7js.Modules.StripeProduct }) }
|
|
3636
3665
|
];
|
|
3637
|
-
if (_optionalChain([price, 'optionalAccess',
|
|
3666
|
+
if (_optionalChain([price, 'optionalAccess', _147 => _147.product]))
|
|
3638
3667
|
items.push({
|
|
3639
3668
|
name: price.product.name,
|
|
3640
|
-
href: generateUrl({ page:
|
|
3669
|
+
href: generateUrl({ page: _chunk4ORLPEK7js.Modules.StripeProduct, id: price.product.id })
|
|
3641
3670
|
});
|
|
3642
|
-
if (price) items.push({ name: priceLabel(price) });
|
|
3671
|
+
if (price) items.push({ name: priceLabel(price, fmt) });
|
|
3643
3672
|
return items;
|
|
3644
3673
|
}, "breadcrumb");
|
|
3645
3674
|
const title = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => {
|
|
3646
3675
|
const response = { type: t("billing.admin.prices.title") };
|
|
3647
3676
|
if (!price) return response;
|
|
3648
|
-
response.element = priceLabel(price);
|
|
3677
|
+
response.element = priceLabel(price, fmt);
|
|
3649
3678
|
if (hasRole(_chunkG4JR3SFVjs.getRoleId.call(void 0, ).Administrator)) {
|
|
3650
3679
|
response.functions = [
|
|
3651
3680
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceArchiver, { price }, "priceArchiver"),
|
|
@@ -3654,7 +3683,7 @@ var PriceProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({
|
|
|
3654
3683
|
}
|
|
3655
3684
|
return response;
|
|
3656
3685
|
}, "title");
|
|
3657
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3686
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceContext.Provider, { value, children }) });
|
|
3658
3687
|
}, "PriceProvider");
|
|
3659
3688
|
var usePriceContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => _nullishCoalesce(_react.useContext.call(void 0, PriceContext), () => ( defaultContextValue)), "usePriceContext");
|
|
3660
3689
|
|
|
@@ -3674,12 +3703,12 @@ function ProductArchiver({ product }) {
|
|
|
3674
3703
|
const isArchived = !product.active;
|
|
3675
3704
|
const scope = isArchived ? "restore" : "archive";
|
|
3676
3705
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
3677
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
3706
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.Button, { variant: "outline", size: "sm", onClick: () => setOpen(true), children: [
|
|
3678
3707
|
isArchived ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RotateCcwIcon, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ArchiveIcon, {}),
|
|
3679
3708
|
t(`billing.admin.products.${scope}.confirm`)
|
|
3680
3709
|
] }),
|
|
3681
3710
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3682
|
-
|
|
3711
|
+
_chunkVDVIUDY5js.ConfirmDialog,
|
|
3683
3712
|
{
|
|
3684
3713
|
open,
|
|
3685
3714
|
onOpenChange: setOpen,
|
|
@@ -3693,7 +3722,7 @@ function ProductArchiver({ product }) {
|
|
|
3693
3722
|
if (isArchived) await restoreProduct(product.id);
|
|
3694
3723
|
else await archiveProduct(product.id);
|
|
3695
3724
|
} catch (error) {
|
|
3696
|
-
|
|
3725
|
+
_chunkVDVIUDY5js.errorToast.call(void 0, { title: t(`billing.admin.products.${scope}.title`), error });
|
|
3697
3726
|
throw error;
|
|
3698
3727
|
}
|
|
3699
3728
|
}
|
|
@@ -3722,7 +3751,7 @@ function ProductEditorInternal({
|
|
|
3722
3751
|
onDialogOpenChange
|
|
3723
3752
|
}) {
|
|
3724
3753
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
3725
|
-
const router =
|
|
3754
|
+
const router = _chunk4ORLPEK7js.useI18nRouter.call(void 0, );
|
|
3726
3755
|
const { createProduct, updateProduct } = useProductContext();
|
|
3727
3756
|
const isEdit = !!product;
|
|
3728
3757
|
const formSchema2 = _react.useMemo.call(void 0,
|
|
@@ -3735,9 +3764,9 @@ function ProductEditorInternal({
|
|
|
3735
3764
|
);
|
|
3736
3765
|
const getDefaultValues = _react.useCallback.call(void 0,
|
|
3737
3766
|
() => ({
|
|
3738
|
-
id: _nullishCoalesce(_optionalChain([product, 'optionalAccess',
|
|
3739
|
-
name: _nullishCoalesce(_optionalChain([product, 'optionalAccess',
|
|
3740
|
-
description: _nullishCoalesce(_optionalChain([product, 'optionalAccess',
|
|
3767
|
+
id: _nullishCoalesce(_optionalChain([product, 'optionalAccess', _148 => _148.id]), () => ( _uuid.v4.call(void 0, ))),
|
|
3768
|
+
name: _nullishCoalesce(_optionalChain([product, 'optionalAccess', _149 => _149.name]), () => ( "")),
|
|
3769
|
+
description: _nullishCoalesce(_optionalChain([product, 'optionalAccess', _150 => _150.description]), () => ( ""))
|
|
3741
3770
|
}),
|
|
3742
3771
|
[product]
|
|
3743
3772
|
);
|
|
@@ -3746,13 +3775,13 @@ function ProductEditorInternal({
|
|
|
3746
3775
|
defaultValues: getDefaultValues()
|
|
3747
3776
|
});
|
|
3748
3777
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3749
|
-
|
|
3778
|
+
_chunkVDVIUDY5js.EditorSheet,
|
|
3750
3779
|
{
|
|
3751
3780
|
form,
|
|
3752
3781
|
entityType: t("billing.admin.products.entity"),
|
|
3753
|
-
entityName: _optionalChain([product, 'optionalAccess',
|
|
3782
|
+
entityName: _optionalChain([product, 'optionalAccess', _151 => _151.name]),
|
|
3754
3783
|
isEdit,
|
|
3755
|
-
module:
|
|
3784
|
+
module: _chunk4ORLPEK7js.Modules.StripeProduct,
|
|
3756
3785
|
size: "md",
|
|
3757
3786
|
propagateChanges,
|
|
3758
3787
|
onSuccess,
|
|
@@ -3769,7 +3798,7 @@ function ProductEditorInternal({
|
|
|
3769
3798
|
onDialogOpenChange,
|
|
3770
3799
|
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
3771
3800
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3772
|
-
|
|
3801
|
+
_chunkVDVIUDY5js.FormInput,
|
|
3773
3802
|
{
|
|
3774
3803
|
form,
|
|
3775
3804
|
id: "name",
|
|
@@ -3779,7 +3808,7 @@ function ProductEditorInternal({
|
|
|
3779
3808
|
}
|
|
3780
3809
|
),
|
|
3781
3810
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3782
|
-
|
|
3811
|
+
_chunkVDVIUDY5js.FormTextarea,
|
|
3783
3812
|
{
|
|
3784
3813
|
form,
|
|
3785
3814
|
id: "description",
|
|
@@ -3823,20 +3852,20 @@ var defaultContextValue2 = {
|
|
|
3823
3852
|
};
|
|
3824
3853
|
var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ children, dehydratedProduct, publishChrome = true }) => {
|
|
3825
3854
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
3826
|
-
const generateUrl =
|
|
3827
|
-
const { hasRole } =
|
|
3855
|
+
const generateUrl = _chunkVDVIUDY5js.usePageUrlGenerator.call(void 0, );
|
|
3856
|
+
const { hasRole } = _chunkVDVIUDY5js.useCurrentUserContext.call(void 0, );
|
|
3828
3857
|
const [product, setProduct] = _react.useState.call(void 0,
|
|
3829
|
-
dehydratedProduct ?
|
|
3858
|
+
dehydratedProduct ? _chunk4ORLPEK7js.rehydrate.call(void 0, _chunk4ORLPEK7js.Modules.StripeProduct, dehydratedProduct) : void 0
|
|
3830
3859
|
);
|
|
3831
3860
|
const [catalogueVersion, setCatalogueVersion] = _react.useState.call(void 0, 0);
|
|
3832
3861
|
const refreshCatalogue = _react.useCallback.call(void 0, () => setCatalogueVersion((value2) => value2 + 1), []);
|
|
3833
3862
|
const reloadProduct = _react.useCallback.call(void 0, async () => {
|
|
3834
|
-
if (!_optionalChain([product, 'optionalAccess',
|
|
3835
|
-
setProduct(await
|
|
3836
|
-
}, [_optionalChain([product, 'optionalAccess',
|
|
3863
|
+
if (!_optionalChain([product, 'optionalAccess', _152 => _152.id])) return;
|
|
3864
|
+
setProduct(await _chunk4ORLPEK7js.StripeProductService.getProduct({ id: product.id }));
|
|
3865
|
+
}, [_optionalChain([product, 'optionalAccess', _153 => _153.id])]);
|
|
3837
3866
|
const createProduct = _react.useCallback.call(void 0,
|
|
3838
3867
|
async (input) => {
|
|
3839
|
-
const saved = await
|
|
3868
|
+
const saved = await _chunk4ORLPEK7js.StripeProductService.createProduct(input);
|
|
3840
3869
|
refreshCatalogue();
|
|
3841
3870
|
return saved;
|
|
3842
3871
|
},
|
|
@@ -3844,7 +3873,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
3844
3873
|
);
|
|
3845
3874
|
const updateProduct = _react.useCallback.call(void 0,
|
|
3846
3875
|
async (input) => {
|
|
3847
|
-
const saved = await
|
|
3876
|
+
const saved = await _chunk4ORLPEK7js.StripeProductService.updateProduct(input);
|
|
3848
3877
|
setProduct(saved);
|
|
3849
3878
|
refreshCatalogue();
|
|
3850
3879
|
return saved;
|
|
@@ -3853,23 +3882,23 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
3853
3882
|
);
|
|
3854
3883
|
const archiveProduct = _react.useCallback.call(void 0,
|
|
3855
3884
|
async (id) => {
|
|
3856
|
-
const target = _nullishCoalesce(id, () => ( _optionalChain([product, 'optionalAccess',
|
|
3885
|
+
const target = _nullishCoalesce(id, () => ( _optionalChain([product, 'optionalAccess', _154 => _154.id])));
|
|
3857
3886
|
if (!target) return;
|
|
3858
|
-
await
|
|
3887
|
+
await _chunk4ORLPEK7js.StripeProductService.archiveProduct({ id: target });
|
|
3859
3888
|
await reloadProduct();
|
|
3860
3889
|
refreshCatalogue();
|
|
3861
3890
|
},
|
|
3862
|
-
[_optionalChain([product, 'optionalAccess',
|
|
3891
|
+
[_optionalChain([product, 'optionalAccess', _155 => _155.id]), reloadProduct, refreshCatalogue]
|
|
3863
3892
|
);
|
|
3864
3893
|
const restoreProduct = _react.useCallback.call(void 0,
|
|
3865
3894
|
async (id) => {
|
|
3866
|
-
const target = _nullishCoalesce(id, () => ( _optionalChain([product, 'optionalAccess',
|
|
3895
|
+
const target = _nullishCoalesce(id, () => ( _optionalChain([product, 'optionalAccess', _156 => _156.id])));
|
|
3867
3896
|
if (!target) return;
|
|
3868
|
-
await
|
|
3897
|
+
await _chunk4ORLPEK7js.StripeProductService.reactivateProduct({ id: target });
|
|
3869
3898
|
await reloadProduct();
|
|
3870
3899
|
refreshCatalogue();
|
|
3871
3900
|
},
|
|
3872
|
-
[_optionalChain([product, 'optionalAccess',
|
|
3901
|
+
[_optionalChain([product, 'optionalAccess', _157 => _157.id]), reloadProduct, refreshCatalogue]
|
|
3873
3902
|
);
|
|
3874
3903
|
const value = _react.useMemo.call(void 0,
|
|
3875
3904
|
() => ({
|
|
@@ -3900,7 +3929,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
3900
3929
|
{
|
|
3901
3930
|
name: t("billing.admin.products.title"),
|
|
3902
3931
|
// Linked only when it is NOT the current page.
|
|
3903
|
-
...product ? { href: generateUrl({ page:
|
|
3932
|
+
...product ? { href: generateUrl({ page: _chunk4ORLPEK7js.Modules.StripeProduct }) } : {}
|
|
3904
3933
|
}
|
|
3905
3934
|
];
|
|
3906
3935
|
if (product) items.push({ name: product.name });
|
|
@@ -3918,7 +3947,7 @@ var ProductProvider = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ({ ch
|
|
|
3918
3947
|
}
|
|
3919
3948
|
return response;
|
|
3920
3949
|
}, "title");
|
|
3921
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3950
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.SharedProvider, { value: { breadcrumbs: breadcrumb(), title: title() }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductContext.Provider, { value, children }) });
|
|
3922
3951
|
}, "ProductProvider");
|
|
3923
3952
|
var useProductContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, () => _nullishCoalesce(_react.useContext.call(void 0, ProductContext), () => ( defaultContextValue2)), "useProductContext");
|
|
3924
3953
|
|
|
@@ -3927,82 +3956,83 @@ var useProductContext = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, ()
|
|
|
3927
3956
|
|
|
3928
3957
|
function PriceDetails() {
|
|
3929
3958
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
3930
|
-
const
|
|
3959
|
+
const fmt = _chunkVDVIUDY5js.useBillingFormatOptions.call(void 0, );
|
|
3960
|
+
const generateUrl = _chunkVDVIUDY5js.usePageUrlGenerator.call(void 0, );
|
|
3931
3961
|
const { price } = usePriceContext();
|
|
3932
3962
|
if (!price) return null;
|
|
3933
3963
|
const isRecurring = price.priceType === "recurring";
|
|
3934
3964
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-8", children: [
|
|
3935
3965
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
3936
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3966
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.SectionHeader, { children: t("billing.admin.prices.title") }),
|
|
3937
3967
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
3938
3968
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3939
|
-
|
|
3969
|
+
_chunkVDVIUDY5js.DetailField,
|
|
3940
3970
|
{
|
|
3941
3971
|
label: t("billing.admin.prices.fields.product"),
|
|
3942
|
-
value: price.product ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3972
|
+
value: price.product ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Link, { href: generateUrl({ page: _chunk4ORLPEK7js.Modules.StripeProduct, id: price.product.id }), children: price.product.name }) : "\u2014"
|
|
3943
3973
|
}
|
|
3944
3974
|
),
|
|
3945
3975
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3946
|
-
|
|
3976
|
+
_chunkVDVIUDY5js.DetailField,
|
|
3947
3977
|
{
|
|
3948
3978
|
label: t("billing.admin.prices.fields.status"),
|
|
3949
3979
|
value: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "flex flex-wrap items-center gap-1", children: [
|
|
3950
|
-
price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3951
|
-
price.isTrial && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3980
|
+
price.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Badge, { variant: "softGreen", children: t("billing.admin.prices.status.active") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Badge, { variant: "softGray", children: t("billing.admin.prices.status.archived") }),
|
|
3981
|
+
price.isTrial && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Badge, { variant: "softBlue", children: t("billing.admin.prices.badge.trial") })
|
|
3952
3982
|
] })
|
|
3953
3983
|
}
|
|
3954
3984
|
),
|
|
3955
3985
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3956
|
-
|
|
3986
|
+
_chunkVDVIUDY5js.DetailField,
|
|
3957
3987
|
{
|
|
3958
3988
|
label: t("billing.admin.prices.fields.amount"),
|
|
3959
|
-
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children:
|
|
3989
|
+
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _chunkVDVIUDY5js.formatCurrency.call(void 0, price.unitAmount, price.currency, fmt) })
|
|
3960
3990
|
}
|
|
3961
3991
|
),
|
|
3962
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3992
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.DetailField, { label: t("billing.admin.prices.fields.currency"), value: price.currency.toUpperCase() }),
|
|
3963
3993
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3964
|
-
|
|
3994
|
+
_chunkVDVIUDY5js.DetailField,
|
|
3965
3995
|
{
|
|
3966
3996
|
label: t("billing.admin.prices.fields.type"),
|
|
3967
3997
|
value: isRecurring ? t("billing.admin.prices.type.recurring") : t("billing.admin.prices.type.oneTime")
|
|
3968
3998
|
}
|
|
3969
3999
|
),
|
|
3970
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4000
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.DetailField, { label: t("billing.admin.prices.fields.billing"), value: _chunkVDVIUDY5js.formatInterval.call(void 0, price, fmt) }),
|
|
3971
4001
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3972
|
-
|
|
4002
|
+
_chunkVDVIUDY5js.DetailField,
|
|
3973
4003
|
{
|
|
3974
4004
|
label: t("billing.admin.prices.fields.intervalCount"),
|
|
3975
|
-
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _nullishCoalesce(_optionalChain([price, 'access',
|
|
4005
|
+
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _nullishCoalesce(_optionalChain([price, 'access', _158 => _158.recurring, 'optionalAccess', _159 => _159.intervalCount]), () => ( 1)) })
|
|
3976
4006
|
}
|
|
3977
4007
|
),
|
|
3978
4008
|
isRecurring && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3979
|
-
|
|
4009
|
+
_chunkVDVIUDY5js.DetailField,
|
|
3980
4010
|
{
|
|
3981
4011
|
label: t("billing.admin.prices.fields.usageType"),
|
|
3982
|
-
value: _optionalChain([price, 'access',
|
|
4012
|
+
value: _optionalChain([price, 'access', _160 => _160.recurring, 'optionalAccess', _161 => _161.usageType]) === "metered" ? t("billing.admin.prices.usage.metered") : t("billing.admin.prices.usage.licensed")
|
|
3983
4013
|
}
|
|
3984
4014
|
)
|
|
3985
4015
|
] })
|
|
3986
4016
|
] }),
|
|
3987
4017
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
3988
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4018
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.SectionHeader, { children: t("billing.admin.prices.fields.platformFeatures") }),
|
|
3989
4019
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
3990
4020
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3991
|
-
|
|
4021
|
+
_chunkVDVIUDY5js.DetailField,
|
|
3992
4022
|
{
|
|
3993
4023
|
label: t("billing.admin.prices.fields.token"),
|
|
3994
4024
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: _nullishCoalesce(price.token, () => ( "\u2014")) })
|
|
3995
4025
|
}
|
|
3996
4026
|
),
|
|
3997
4027
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3998
|
-
|
|
4028
|
+
_chunkVDVIUDY5js.DetailField,
|
|
3999
4029
|
{
|
|
4000
4030
|
label: t("billing.admin.prices.fields.stripeId"),
|
|
4001
4031
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: price.stripePriceId })
|
|
4002
4032
|
}
|
|
4003
4033
|
),
|
|
4004
4034
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4005
|
-
|
|
4035
|
+
_chunkVDVIUDY5js.DetailField,
|
|
4006
4036
|
{
|
|
4007
4037
|
label: t("billing.admin.prices.fields.description"),
|
|
4008
4038
|
value: _nullishCoalesce(price.description, () => ( "\u2014")),
|
|
@@ -4010,7 +4040,7 @@ function PriceDetails() {
|
|
|
4010
4040
|
}
|
|
4011
4041
|
),
|
|
4012
4042
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4013
|
-
|
|
4043
|
+
_chunkVDVIUDY5js.DetailField,
|
|
4014
4044
|
{
|
|
4015
4045
|
label: t("billing.admin.prices.fields.features"),
|
|
4016
4046
|
className: "md:col-span-2",
|
|
@@ -4018,11 +4048,11 @@ function PriceDetails() {
|
|
|
4018
4048
|
}
|
|
4019
4049
|
),
|
|
4020
4050
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4021
|
-
|
|
4051
|
+
_chunkVDVIUDY5js.DetailField,
|
|
4022
4052
|
{
|
|
4023
4053
|
label: t("billing.admin.prices.fields.platformFeatures"),
|
|
4024
4054
|
className: "md:col-span-2",
|
|
4025
|
-
value: price.priceFeatures.length > 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "flex flex-wrap items-center gap-1", children: price.priceFeatures.map((feature) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4055
|
+
value: price.priceFeatures.length > 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "flex flex-wrap items-center gap-1", children: price.priceFeatures.map((feature) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Badge, { variant: "softGray", children: feature.name }, feature.id)) }) : "\u2014"
|
|
4026
4056
|
}
|
|
4027
4057
|
)
|
|
4028
4058
|
] })
|
|
@@ -4036,7 +4066,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, PriceDetails, "PriceDetails");
|
|
|
4036
4066
|
function PriceContainer() {
|
|
4037
4067
|
const { price } = usePriceContext();
|
|
4038
4068
|
if (!price) return null;
|
|
4039
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4069
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.RoundPageContainer, { module: _chunk4ORLPEK7js.Modules.StripePrice, id: price.id, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PriceDetails, {}) });
|
|
4040
4070
|
}
|
|
4041
4071
|
_chunk7QVYU63Ejs.__name.call(void 0, PriceContainer, "PriceContainer");
|
|
4042
4072
|
|
|
@@ -4080,25 +4110,25 @@ function priceToSeed(price) {
|
|
|
4080
4110
|
const priceType = readOptional(() => price.priceType);
|
|
4081
4111
|
const currency = readOptional(() => price.currency);
|
|
4082
4112
|
const recurring = price.recurring;
|
|
4083
|
-
const interval = priceType === "one_time" ? "one_time" : _nullishCoalesce(_optionalChain([recurring, 'optionalAccess',
|
|
4113
|
+
const interval = priceType === "one_time" ? "one_time" : _nullishCoalesce(_optionalChain([recurring, 'optionalAccess', _162 => _162.interval]), () => ( "month"));
|
|
4084
4114
|
const seed = {
|
|
4085
4115
|
unitAmount: _nullishCoalesce(price.unitAmount, () => ( 0)),
|
|
4086
4116
|
currency: _nullishCoalesce(currency, () => ( "usd")),
|
|
4087
4117
|
interval
|
|
4088
4118
|
};
|
|
4089
4119
|
if (interval !== "one_time") {
|
|
4090
|
-
if (typeof _optionalChain([recurring, 'optionalAccess',
|
|
4091
|
-
if (_optionalChain([recurring, 'optionalAccess',
|
|
4120
|
+
if (typeof _optionalChain([recurring, 'optionalAccess', _163 => _163.intervalCount]) === "number") seed.intervalCount = recurring.intervalCount;
|
|
4121
|
+
if (_optionalChain([recurring, 'optionalAccess', _164 => _164.usageType])) seed.usageType = recurring.usageType;
|
|
4092
4122
|
}
|
|
4093
|
-
const nickname = _optionalChain([price, 'access',
|
|
4123
|
+
const nickname = _optionalChain([price, 'access', _165 => _165.nickname, 'optionalAccess', _166 => _166.trim, 'call', _167 => _167()]);
|
|
4094
4124
|
if (nickname) seed.nickname = nickname;
|
|
4095
|
-
const description = _optionalChain([price, 'access',
|
|
4125
|
+
const description = _optionalChain([price, 'access', _168 => _168.description, 'optionalAccess', _169 => _169.trim, 'call', _170 => _170()]);
|
|
4096
4126
|
if (description) seed.description = description;
|
|
4097
4127
|
const features = nonEmptyStrings(price.features);
|
|
4098
4128
|
if (features.length > 0) seed.features = features;
|
|
4099
4129
|
if (typeof price.token === "number" && !Number.isNaN(price.token)) seed.token = price.token;
|
|
4100
4130
|
if (typeof price.isTrial === "boolean") seed.isTrial = price.isTrial;
|
|
4101
|
-
const platformFeatures = nonEmptyStrings(_optionalChain([price, 'access',
|
|
4131
|
+
const platformFeatures = nonEmptyStrings(_optionalChain([price, 'access', _171 => _171.priceFeatures, 'optionalAccess', _172 => _172.map, 'call', _173 => _173((feature) => feature.name)]));
|
|
4102
4132
|
if (platformFeatures.length > 0) seed.platformFeatures = platformFeatures;
|
|
4103
4133
|
return seed;
|
|
4104
4134
|
}
|
|
@@ -4161,10 +4191,10 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4161
4191
|
const importInputRef = _react.useRef.call(void 0, null);
|
|
4162
4192
|
const [seed, setSeed] = _react.useState.call(void 0, void 0);
|
|
4163
4193
|
const [seedNonce, setSeedNonce] = _react.useState.call(void 0, 0);
|
|
4164
|
-
const data =
|
|
4165
|
-
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) =>
|
|
4194
|
+
const data = _chunkVDVIUDY5js.useDataListRetriever.call(void 0, {
|
|
4195
|
+
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunk4ORLPEK7js.StripePriceService.listPrices({ ...params, productId }), "retriever"),
|
|
4166
4196
|
retrieverParams: {},
|
|
4167
|
-
module:
|
|
4197
|
+
module: _chunk4ORLPEK7js.Modules.StripePrice
|
|
4168
4198
|
});
|
|
4169
4199
|
_react.useEffect.call(void 0, () => {
|
|
4170
4200
|
if (priceVersion > 0) void data.refresh();
|
|
@@ -4191,7 +4221,7 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4191
4221
|
const onImportFileChange = _react.useCallback.call(void 0,
|
|
4192
4222
|
async (event) => {
|
|
4193
4223
|
const input = event.target;
|
|
4194
|
-
const file = _optionalChain([input, 'access',
|
|
4224
|
+
const file = _optionalChain([input, 'access', _174 => _174.files, 'optionalAccess', _175 => _175[0]]);
|
|
4195
4225
|
input.value = "";
|
|
4196
4226
|
if (!file) return;
|
|
4197
4227
|
try {
|
|
@@ -4199,7 +4229,7 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4199
4229
|
openSeededEditor(transfer.price);
|
|
4200
4230
|
} catch (error) {
|
|
4201
4231
|
console.error("[PricesList] price import failed", error);
|
|
4202
|
-
|
|
4232
|
+
_chunkVDVIUDY5js.errorToast.call(void 0, {
|
|
4203
4233
|
title: t("billing.admin.prices.import.errors.title"),
|
|
4204
4234
|
error: t("billing.admin.prices.import.errors.invalid")
|
|
4205
4235
|
});
|
|
@@ -4218,7 +4248,7 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4218
4248
|
"create-price"
|
|
4219
4249
|
),
|
|
4220
4250
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _react.Fragment, { children: [
|
|
4221
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
4251
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVDVIUDY5js.Button, { variant: "outline", size: "sm", type: "button", onClick: () => _optionalChain([importInputRef, 'access', _176 => _176.current, 'optionalAccess', _177 => _177.click, 'call', _178 => _178()]), children: [
|
|
4222
4252
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.UploadIcon, {}),
|
|
4223
4253
|
t("billing.admin.prices.actions.import")
|
|
4224
4254
|
] }),
|
|
@@ -4236,7 +4266,7 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4236
4266
|
];
|
|
4237
4267
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
4238
4268
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4239
|
-
|
|
4269
|
+
_chunkVDVIUDY5js.ContentListTable,
|
|
4240
4270
|
{
|
|
4241
4271
|
data,
|
|
4242
4272
|
fields: [
|
|
@@ -4247,13 +4277,13 @@ function PricesList({ productId, fullWidth }) {
|
|
|
4247
4277
|
"status" /* status */,
|
|
4248
4278
|
"actions" /* actions */
|
|
4249
4279
|
],
|
|
4250
|
-
tableGeneratorType:
|
|
4280
|
+
tableGeneratorType: _chunk4ORLPEK7js.Modules.StripePrice,
|
|
4251
4281
|
functions,
|
|
4252
4282
|
context: tableContext,
|
|
4253
4283
|
fullWidth,
|
|
4254
4284
|
title: t("billing.admin.prices.title"),
|
|
4255
4285
|
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4256
|
-
|
|
4286
|
+
_chunkVDVIUDY5js.EmptyState,
|
|
4257
4287
|
{
|
|
4258
4288
|
icon: _lucidereact.DollarSignIcon,
|
|
4259
4289
|
title: t("billing.admin.prices.empty.title"),
|
|
@@ -4293,18 +4323,18 @@ function ProductDetails() {
|
|
|
4293
4323
|
const { product } = useProductContext();
|
|
4294
4324
|
if (!product) return null;
|
|
4295
4325
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex w-full flex-col gap-y-4", children: [
|
|
4296
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4326
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.SectionHeader, { children: t("billing.admin.products.tabs.details") }),
|
|
4297
4327
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2", children: [
|
|
4298
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4328
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.DetailField, { label: t("billing.admin.products.fields.name"), value: product.name }),
|
|
4299
4329
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4300
|
-
|
|
4330
|
+
_chunkVDVIUDY5js.DetailField,
|
|
4301
4331
|
{
|
|
4302
4332
|
label: t("billing.admin.products.fields.status"),
|
|
4303
|
-
value: product.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4333
|
+
value: product.active ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Badge, { variant: "softGreen", children: t("billing.admin.products.status.active") }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.Badge, { variant: "softGray", children: t("billing.admin.products.status.archived") })
|
|
4304
4334
|
}
|
|
4305
4335
|
),
|
|
4306
4336
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4307
|
-
|
|
4337
|
+
_chunkVDVIUDY5js.DetailField,
|
|
4308
4338
|
{
|
|
4309
4339
|
label: t("billing.admin.products.fields.description"),
|
|
4310
4340
|
value: _nullishCoalesce(product.description, () => ( "\u2014")),
|
|
@@ -4312,14 +4342,14 @@ function ProductDetails() {
|
|
|
4312
4342
|
}
|
|
4313
4343
|
),
|
|
4314
4344
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4315
|
-
|
|
4345
|
+
_chunkVDVIUDY5js.DetailField,
|
|
4316
4346
|
{
|
|
4317
4347
|
label: t("billing.admin.products.fields.prices"),
|
|
4318
4348
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: product.stripePrices.length })
|
|
4319
4349
|
}
|
|
4320
4350
|
),
|
|
4321
4351
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4322
|
-
|
|
4352
|
+
_chunkVDVIUDY5js.DetailField,
|
|
4323
4353
|
{
|
|
4324
4354
|
label: t("billing.admin.products.fields.stripeId"),
|
|
4325
4355
|
value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "tabular-nums", children: product.stripeProductId })
|
|
@@ -4337,9 +4367,9 @@ function ProductContainer() {
|
|
|
4337
4367
|
const { product } = useProductContext();
|
|
4338
4368
|
if (!product) return null;
|
|
4339
4369
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4340
|
-
|
|
4370
|
+
_chunkVDVIUDY5js.RoundPageContainer,
|
|
4341
4371
|
{
|
|
4342
|
-
module:
|
|
4372
|
+
module: _chunk4ORLPEK7js.Modules.StripeProduct,
|
|
4343
4373
|
id: product.id,
|
|
4344
4374
|
tabs: [
|
|
4345
4375
|
{
|
|
@@ -4348,7 +4378,7 @@ function ProductContainer() {
|
|
|
4348
4378
|
content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductDetails, {})
|
|
4349
4379
|
},
|
|
4350
4380
|
{
|
|
4351
|
-
key:
|
|
4381
|
+
key: _chunk4ORLPEK7js.Modules.StripePrice,
|
|
4352
4382
|
label: t("billing.admin.prices.title"),
|
|
4353
4383
|
// publishChrome={false}: SharedProvider REPLACES its value for the
|
|
4354
4384
|
// subtree (SharedContext.tsx:35-37), so a nested provider publishing
|
|
@@ -4372,26 +4402,26 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductContainer, "ProductContainer");
|
|
|
4372
4402
|
function ProductsList({ fullWidth } = {}) {
|
|
4373
4403
|
const t = _nextintl.useTranslations.call(void 0, );
|
|
4374
4404
|
const { catalogueVersion } = useProductContext();
|
|
4375
|
-
const data =
|
|
4376
|
-
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) =>
|
|
4405
|
+
const data = _chunkVDVIUDY5js.useDataListRetriever.call(void 0, {
|
|
4406
|
+
retriever: /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (params) => _chunk4ORLPEK7js.StripeProductService.listProducts(params), "retriever"),
|
|
4377
4407
|
retrieverParams: {},
|
|
4378
|
-
module:
|
|
4408
|
+
module: _chunk4ORLPEK7js.Modules.StripeProduct
|
|
4379
4409
|
});
|
|
4380
4410
|
_react.useEffect.call(void 0, () => {
|
|
4381
4411
|
if (catalogueVersion > 0) void data.refresh();
|
|
4382
4412
|
}, [catalogueVersion]);
|
|
4383
4413
|
const functions = [/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductEditor, {}, "create-product")];
|
|
4384
4414
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4385
|
-
|
|
4415
|
+
_chunkVDVIUDY5js.ContentListTable,
|
|
4386
4416
|
{
|
|
4387
4417
|
data,
|
|
4388
4418
|
fields: ["name" /* name */, "status" /* status */, "prices" /* prices */],
|
|
4389
|
-
tableGeneratorType:
|
|
4419
|
+
tableGeneratorType: _chunk4ORLPEK7js.Modules.StripeProduct,
|
|
4390
4420
|
functions,
|
|
4391
4421
|
fullWidth,
|
|
4392
4422
|
title: t("billing.admin.products.title"),
|
|
4393
4423
|
emptyState: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4394
|
-
|
|
4424
|
+
_chunkVDVIUDY5js.EmptyState,
|
|
4395
4425
|
{
|
|
4396
4426
|
icon: _lucidereact.PackageIcon,
|
|
4397
4427
|
title: t("billing.admin.products.empty.title"),
|
|
@@ -4406,7 +4436,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductsList, "ProductsList");
|
|
|
4406
4436
|
// src/features/billing/stripe-product/components/containers/ProductsListContainer.tsx
|
|
4407
4437
|
|
|
4408
4438
|
function ProductsListContainer() {
|
|
4409
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductProvider, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4439
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductProvider, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVDVIUDY5js.RoundPageContainer, { module: _chunk4ORLPEK7js.Modules.StripeProduct, fullWidth: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ProductsList, { fullWidth: true }) }) });
|
|
4410
4440
|
}
|
|
4411
4441
|
_chunk7QVYU63Ejs.__name.call(void 0, ProductsListContainer, "ProductsListContainer");
|
|
4412
4442
|
|
|
@@ -4469,5 +4499,7 @@ _chunk7QVYU63Ejs.__name.call(void 0, ProductsListContainer, "ProductsListContain
|
|
|
4469
4499
|
|
|
4470
4500
|
|
|
4471
4501
|
|
|
4472
|
-
|
|
4502
|
+
|
|
4503
|
+
|
|
4504
|
+
exports.BillingAlertBanner = BillingAlertBanner; exports.BillingDashboardContainer = BillingDashboardContainer; exports.BillingDetailModal = BillingDetailModal; exports.BillingUsageSummaryCard = BillingUsageSummaryCard; exports.CancelSubscriptionDialog = CancelSubscriptionDialog; exports.CustomerInfoCard = CustomerInfoCard; exports.IntervalToggle = IntervalToggle; exports.InvoiceDetails = InvoiceDetails; exports.InvoiceStatusBadge = InvoiceStatusBadge; exports.InvoicesContainer = InvoicesContainer; exports.InvoicesList = InvoicesList; exports.InvoicesSummaryCard = InvoicesSummaryCard; exports.PaymentMethodCard = PaymentMethodCard; exports.PaymentMethodEditor = PaymentMethodEditor; exports.PaymentMethodForm = PaymentMethodForm; exports.PaymentMethodSummaryCard = PaymentMethodSummaryCard; exports.PaymentMethodsContainer = PaymentMethodsContainer; exports.PaymentMethodsList = PaymentMethodsList; exports.PriceArchiver = PriceArchiver; exports.PriceContainer = PriceContainer; exports.PriceDetails = PriceDetails; exports.PriceEditor = PriceEditor; exports.PriceProvider = PriceProvider; exports.PricesList = PricesList; exports.PricingCard = PricingCard; exports.ProductArchiver = ProductArchiver; exports.ProductContainer = ProductContainer; exports.ProductDetails = ProductDetails; exports.ProductEditor = ProductEditor; exports.ProductPricingList = ProductPricingList; exports.ProductPricingRow = ProductPricingRow; exports.ProductProvider = ProductProvider; exports.ProductsList = ProductsList; exports.ProductsListContainer = ProductsListContainer; exports.PromoCodeInput = PromoCodeInput; exports.ProrationPreview = ProrationPreview; exports.StripeProvider = StripeProvider; exports.SubscriptionConfirmation = SubscriptionConfirmation; exports.SubscriptionDetails = SubscriptionDetails; exports.SubscriptionStatusBadge = SubscriptionStatusBadge; exports.SubscriptionSummaryCard = SubscriptionSummaryCard; exports.SubscriptionWizard = SubscriptionWizard; exports.SubscriptionsContainer = SubscriptionsContainer; exports.SubscriptionsList = SubscriptionsList; exports.UsageContainer = UsageContainer; exports.UsageHistoryTable = UsageHistoryTable; exports.UsageSummaryCard = UsageSummaryCard; exports.UsageSummaryCards = UsageSummaryCards; exports.WizardProgressIndicator = WizardProgressIndicator; exports.WizardStepPaymentMethod = WizardStepPaymentMethod; exports.WizardStepPlanSelection = WizardStepPlanSelection; exports.WizardStepReview = WizardStepReview; exports.formatCurrency = _chunkVDVIUDY5js.formatCurrency; exports.formatDate = _chunkVDVIUDY5js.formatDate; exports.formatFixed = _chunkVDVIUDY5js.formatFixed; exports.formatInterval = _chunkVDVIUDY5js.formatInterval; exports.isStripeConfigured = isStripeConfigured; exports.priceLabel = priceLabel; exports.useBillingFormatOptions = _chunkVDVIUDY5js.useBillingFormatOptions; exports.usePriceContext = usePriceContext; exports.useProductContext = useProductContext;
|
|
4473
4505
|
//# sourceMappingURL=index.js.map
|