@burdenoff/microfe-billing 2026.1113.1 → 2026.1113.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/billing/BillingRoot.js +83 -77
- package/dist/billing/BillingRoot.js.map +1 -1
- package/dist/billing/modules/addons/pages/AddonBrowseDetailPage.js +78 -78
- package/dist/billing/modules/addons/pages/AddonCreatePage.js +70 -70
- package/dist/billing/modules/addons/pages/AddonDetailPage.js +72 -72
- package/dist/billing/modules/addons/pages/AddonEditPage.js +79 -79
- package/dist/billing/modules/addons/pages/AddonsBrowsePage.js +224 -224
- package/dist/billing/modules/addons/pages/AddonsListPage.js +186 -186
- package/dist/billing/modules/affiliate/pages/AffiliateDashboardPage.js +168 -168
- package/dist/billing/modules/affiliate/pages/AffiliateDashboardPage.js.map +1 -1
- package/dist/billing/modules/analytics/pages/AnalyticsPage.js +88 -88
- package/dist/billing/modules/billing/hooks/index.js +5 -5
- package/dist/billing/modules/billing/hooks/useInvoices.js +39 -20
- package/dist/billing/modules/billing/hooks/useInvoices.js.map +1 -1
- package/dist/billing/modules/billing/index.js +14 -14
- package/dist/billing/modules/billing/pages/BillingWebhookLogsPage.js +92 -92
- package/dist/billing/modules/billing/pages/InvoiceDetailPage.js +160 -160
- package/dist/billing/modules/billing/pages/InvoiceDetailPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/InvoicesListPage.js +100 -100
- package/dist/billing/modules/billing/pages/OrderCallbackLogsPage.js +105 -105
- package/dist/billing/modules/billing/pages/PaymentMethodsPage.js +37 -37
- package/dist/billing/modules/billing/pages/RefundIssueLogsPage.js +41 -41
- package/dist/billing/modules/billing/pages/RefundsPage.js +334 -334
- package/dist/billing/modules/billing/pages/RefundsPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/TransactionsPage.js +174 -174
- package/dist/billing/modules/billing/pages/TransactionsPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/UserRefundsPage.js +24 -24
- package/dist/billing/modules/billing/pages/UserRefundsPage.js.map +1 -1
- package/dist/billing/modules/checkout/components/OrderSummary.js +71 -71
- package/dist/billing/modules/checkout/pages/CheckoutPage.js +646 -625
- package/dist/billing/modules/checkout/pages/CheckoutPage.js.map +1 -1
- package/dist/billing/modules/checkout/utils/checkoutOptions.d.ts +23 -0
- package/dist/billing/modules/checkout/utils/checkoutOptions.js +8 -0
- package/dist/billing/modules/checkout/utils/checkoutOptions.js.map +1 -0
- package/dist/billing/modules/coupons/pages/CouponDetailPage.js +112 -112
- package/dist/billing/modules/coupons/pages/CouponsListPage.js +118 -118
- package/dist/billing/modules/coupons/pages/CouponsListPage.js.map +1 -1
- package/dist/billing/modules/coupons/pages/CreateCouponPage.js +119 -119
- package/dist/billing/modules/coupons/pages/EditCouponPage.js +82 -82
- package/dist/billing/modules/credits/pages/AdminCreditsPage.js +30 -30
- package/dist/billing/modules/credits/pages/CreditTransactionsPage.js +77 -77
- package/dist/billing/modules/credits/pages/CreditWithdrawalPage.js +144 -144
- package/dist/billing/modules/credits/pages/CreditsPage.js +67 -67
- package/dist/billing/modules/dashboard/pages/OverviewPage.js +594 -442
- package/dist/billing/modules/dashboard/pages/OverviewPage.js.map +1 -1
- package/dist/billing/modules/dashboard/utils/overviewSummary.d.ts +46 -0
- package/dist/billing/modules/dashboard/utils/overviewSummary.js +37 -0
- package/dist/billing/modules/dashboard/utils/overviewSummary.js.map +1 -0
- package/dist/billing/modules/discounts/pages/DiscountsListPage.js +199 -199
- package/dist/billing/modules/discounts/pages/DiscountsListPage.js.map +1 -1
- package/dist/billing/modules/earnings/pages/DeveloperRevenueAdminPage.js +64 -64
- package/dist/billing/modules/earnings/pages/DeveloperRevenueOrgDetailPage.js +122 -122
- package/dist/billing/modules/earnings/pages/DeveloperRevenueOrgDetailPage.js.map +1 -1
- package/dist/billing/modules/earnings/pages/EarningsPage.js +102 -102
- package/dist/billing/modules/earnings/pages/EarningsPage.js.map +1 -1
- package/dist/billing/modules/earnings/pages/PayoutAdminPage.js +178 -178
- package/dist/billing/modules/earnings/pages/PayoutAdminPage.js.map +1 -1
- package/dist/billing/modules/earnings/pages/PayoutsPage.js +107 -107
- package/dist/billing/modules/earnings/pages/PayoutsPage.js.map +1 -1
- package/dist/billing/modules/plans/pages/PlanAssignFreePage.js +54 -54
- package/dist/billing/modules/plans/pages/PlanBrowseDetailPage.js +94 -94
- package/dist/billing/modules/plans/pages/PlanCreatePage.js +73 -73
- package/dist/billing/modules/plans/pages/PlanDetailPage.js +96 -96
- package/dist/billing/modules/plans/pages/PlanEditPage.js +16 -16
- package/dist/billing/modules/plans/pages/PlanEditPage.js.map +1 -1
- package/dist/billing/modules/plans/pages/PlansBrowsePage.js +143 -143
- package/dist/billing/modules/plans/pages/PlansBrowsePage.js.map +1 -1
- package/dist/billing/modules/plans/pages/PlansListPage.js +88 -88
- package/dist/billing/modules/plans/utils/planAction.d.ts +9 -0
- package/dist/billing/modules/plans/utils/planAction.js +4 -1
- package/dist/billing/modules/plans/utils/planAction.js.map +1 -1
- package/dist/billing/modules/promotions/pages/CreatePromotionPage.js +60 -60
- package/dist/billing/modules/promotions/pages/PromotionsListPage.js +37 -37
- package/dist/billing/modules/quota/pages/QuotaAssignFreePage.js +62 -62
- package/dist/billing/modules/quota/pages/QuotaPage.js +1 -1
- package/dist/billing/modules/quota/pages/QuotaTemplateCreatePage.js +69 -69
- package/dist/billing/modules/quota/pages/QuotaTemplateDetailPage.js +76 -76
- package/dist/billing/modules/quota/pages/QuotaTemplateEditPage.js +80 -80
- package/dist/billing/modules/quota/pages/QuotaTemplatesListPage.js +95 -95
- package/dist/billing/modules/settings/pages/SettingsPage.js +134 -134
- package/dist/billing/modules/settings/pages/SettingsPage.js.map +1 -1
- package/dist/billing/modules/settings/pages/TeamPermissionsPage.js +62 -62
- package/dist/billing/modules/settings/pages/TeamPermissionsPage.js.map +1 -1
- package/dist/billing/modules/subscriptions/components/ManageSeatsModal.js +36 -36
- package/dist/billing/modules/subscriptions/pages/SubscriptionDetailPage.js +534 -410
- package/dist/billing/modules/subscriptions/pages/SubscriptionDetailPage.js.map +1 -1
- package/dist/billing/modules/subscriptions/pages/SubscriptionsListPage.js +111 -111
- package/dist/billing/modules/subscriptions/pages/UpgradeSubscriptionPage.js +166 -160
- package/dist/billing/modules/subscriptions/pages/UpgradeSubscriptionPage.js.map +1 -1
- package/dist/billing/modules/subscriptions/utils/subscriptionDetailView.d.ts +30 -0
- package/dist/billing/modules/subscriptions/utils/subscriptionDetailView.js +20 -0
- package/dist/billing/modules/subscriptions/utils/subscriptionDetailView.js.map +1 -0
- package/dist/billing/modules/subscriptions/utils/upgradeAccess.d.ts +10 -0
- package/dist/billing/modules/subscriptions/utils/upgradeAccess.js +7 -0
- package/dist/billing/modules/subscriptions/utils/upgradeAccess.js.map +1 -0
- package/dist/billing/modules/usage/pages/UsagePage.js +722 -591
- package/dist/billing/modules/usage/pages/UsagePage.js.map +1 -1
- package/dist/billing/modules/usage/utils/usageHealth.d.ts +63 -0
- package/dist/billing/modules/usage/utils/usageHealth.js +43 -0
- package/dist/billing/modules/usage/utils/usageHealth.js.map +1 -0
- package/dist/billing/shared/components/EmptyState.js +3 -3
- package/dist/billing/shared/components/MoneyActionDialog.js +12 -12
- package/dist/billing/shared/ui/MetricCard.js +13 -13
- package/dist/billing/shared/utils/format.js +16 -4
- package/dist/billing/shared/utils/format.js.map +1 -1
- package/dist/billing/shared/utils/index.js +8 -8
- package/dist/generated/global-operations.js +294 -286
- package/dist/generated/global-operations.js.map +1 -1
- package/package.json +2 -2
|
@@ -5,44 +5,46 @@ import { PageHeader as r } from "../../../shared/components/PageHeader.js";
|
|
|
5
5
|
import { useBillingPermissions as i } from "../../../hooks/useBillingPermissions.js";
|
|
6
6
|
import { useBilling as a } from "../../../providers/BillingProvider.js";
|
|
7
7
|
import "../../../shared/components/index.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { useIsFluidgridsVariant as o } from "../../../hooks/useBillingVariant.js";
|
|
9
|
+
import { customisedCheckoutOptions as ee } from "../utils/checkoutOptions.js";
|
|
10
|
+
import { useAddonCartStore as te } from "../../addons/store/addonCartStore.js";
|
|
11
|
+
import { useMyWorkspaces as s } from "../../usage/hooks/useUsage.js";
|
|
10
12
|
import "../hooks/index.js";
|
|
11
|
-
import { isNativeIAPAvailable as
|
|
12
|
-
import { NativeCheckoutView as
|
|
13
|
-
import { WebCheckoutRedirectView as
|
|
14
|
-
import { getStoredBillingAccountId as
|
|
15
|
-
import { useCheckout as
|
|
16
|
-
import { useNativeCheckout as
|
|
17
|
-
import { usePaymentProviders as
|
|
18
|
-
import { usePaymentStatusPolling as
|
|
19
|
-
import { useGetActiveSubscriptionsCheckoutQuery as
|
|
13
|
+
import { isNativeIAPAvailable as c } from "../../../lib/native-purchases.js";
|
|
14
|
+
import { NativeCheckoutView as ne } from "../components/NativeCheckoutView.js";
|
|
15
|
+
import { WebCheckoutRedirectView as re } from "../components/WebCheckoutRedirectView.js";
|
|
16
|
+
import { getStoredBillingAccountId as ie } from "../../../hooks/useBillingAccountSelection.js";
|
|
17
|
+
import { useCheckout as ae } from "../hooks/useCheckout.js";
|
|
18
|
+
import { useNativeCheckout as oe } from "../hooks/useNativeCheckout.js";
|
|
19
|
+
import { usePaymentProviders as se } from "../hooks/usePaymentProviders.js";
|
|
20
|
+
import { usePaymentStatusPolling as ce } from "../hooks/usePaymentStatusPolling.js";
|
|
21
|
+
import { useGetActiveSubscriptionsCheckoutQuery as le, useGetBillingAccountsCheckoutQuery as ue, useGetCostOfCreditsCheckoutQuery as de, useGetPaymentMethodsCheckoutQuery as fe, useGetPlanCheckoutQuery as pe, useGetSelectedAddonCheckoutQuery as me, useGetStoreOrderCheckoutQuery as he } from "../../../../generated/global-operations.js";
|
|
20
22
|
import "../components/index.js";
|
|
21
|
-
import { WorkspaceQuotaAssignmentModal as
|
|
22
|
-
import { BillingAccountSelector as
|
|
23
|
-
import { OrderSummary as
|
|
24
|
-
import { PromoCodeInput as
|
|
25
|
-
import { CreditsAmountInput as
|
|
26
|
-
import { StripePaymentForm as
|
|
27
|
-
import { RazorpayPaymentButton as
|
|
28
|
-
import { SubscriptionSelector as
|
|
29
|
-
import { SimpleAutoPayToggle as
|
|
30
|
-
import { UnifiedPaymentMethodSelector as
|
|
31
|
-
import { CompleteBillingAccountModal as
|
|
32
|
-
import { StoreShippingSection as
|
|
33
|
-
import { buildStoreOrderCheckoutItems as
|
|
34
|
-
import { STORE_SHIPPING_ITEM_ID as
|
|
35
|
-
import { recordAffiliateEvent as
|
|
36
|
-
import { useCallback as l, useEffect as u, useMemo as d, useRef as
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
43
|
-
import {
|
|
23
|
+
import { WorkspaceQuotaAssignmentModal as ge, isWorkspaceScopedQuota as _e } from "../components/WorkspaceQuotaAssignmentModal.js";
|
|
24
|
+
import { BillingAccountSelector as ve } from "../components/BillingAccountSelector.js";
|
|
25
|
+
import { OrderSummary as ye } from "../components/OrderSummary.js";
|
|
26
|
+
import { PromoCodeInput as be } from "../components/PromoCodeInput.js";
|
|
27
|
+
import { CreditsAmountInput as xe } from "../components/CreditsAmountInput.js";
|
|
28
|
+
import { StripePaymentForm as Se } from "../components/StripePaymentForm.js";
|
|
29
|
+
import { RazorpayPaymentButton as Ce } from "../components/RazorpayPaymentButton.js";
|
|
30
|
+
import { SubscriptionSelector as we } from "../components/SubscriptionSelector.js";
|
|
31
|
+
import { SimpleAutoPayToggle as Te } from "../components/SimpleAutoPayToggle.js";
|
|
32
|
+
import { UnifiedPaymentMethodSelector as Ee } from "../components/UnifiedPaymentMethodSelector.js";
|
|
33
|
+
import { CompleteBillingAccountModal as De, isBillingAccountComplete as Oe } from "../components/CompleteBillingAccountModal.js";
|
|
34
|
+
import { StoreShippingSection as ke } from "../components/StoreShippingSection.js";
|
|
35
|
+
import { buildStoreOrderCheckoutItems as Ae, normalizeStoreOrderCurrency as je } from "../utils/storeOrder.js";
|
|
36
|
+
import { STORE_SHIPPING_ITEM_ID as Me, useSetStoreOrderShipping as Ne } from "../hooks/useStoreShipping.js";
|
|
37
|
+
import { recordAffiliateEvent as Pe } from "../../affiliate/api.js";
|
|
38
|
+
import { useCallback as l, useEffect as u, useMemo as d, useRef as Fe, useState as f } from "react";
|
|
39
|
+
import { OptionalFields as Ie, PagePurpose as Le } from "@burdenoff/fe-libs/ui";
|
|
40
|
+
import { ArrowLeft as Re, ArrowRight as ze, Blocks as Be, CheckCircle as Ve, Coins as He, CreditCard as Ue, Loader2 as We, Package as Ge, Receipt as Ke, RefreshCw as qe, ShoppingCart as Je, Wallet as Ye, XCircle as Xe } from "lucide-react";
|
|
41
|
+
import { useLocation as Ze, useParams as Qe } from "react-router";
|
|
42
|
+
import { useAppShell as $e } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
43
|
+
import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
44
|
+
import { useI18n as et } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
45
|
+
import { getProfileScopedKey as tt } from "@burdenoff/fe-libs/shared/utils";
|
|
44
46
|
// src/billing/modules/checkout/pages/CheckoutPage.tsx
|
|
45
|
-
function
|
|
47
|
+
function nt(e) {
|
|
46
48
|
return typeof e.id != "string" || typeof e.name != "string" || typeof e.email != "string" || typeof e.currency != "string" || typeof e.creditAmount != "number" || typeof e.isActive != "boolean" ? null : {
|
|
47
49
|
...e,
|
|
48
50
|
id: e.id,
|
|
@@ -54,17 +56,17 @@ function Qe(e) {
|
|
|
54
56
|
billingAddresses: e.billingAddresses === null ? null : e.billingAddresses?.flatMap((e) => e ? [{ ...e }] : [])
|
|
55
57
|
};
|
|
56
58
|
}
|
|
57
|
-
var
|
|
58
|
-
let { t:
|
|
59
|
-
let n =
|
|
59
|
+
var rt = () => {
|
|
60
|
+
let { t: rt } = et(), g = o(), _ = (e, t) => {
|
|
61
|
+
let n = rt(e);
|
|
60
62
|
return n === e ? t : n;
|
|
61
|
-
}, { planId:
|
|
63
|
+
}, { planId: it, addonId: at, storeOrderId: v } = Qe(), y = e(), b = Ze(), x = b.state, ot = i(), { emit: S } = t(), { orgId: C, stripePublishableKey: st, razorpayKey: ct, apiGatewayUrl: lt, authToken: ut, currentUser: dt, workspaceId: w } = a(), { productSlug: ft } = $e(), pt = Fe(null), { workspaces: mt } = s(), ht = mt.length > 0 ? mt : w ? [{
|
|
62
64
|
id: w,
|
|
63
65
|
name: "Current workspace"
|
|
64
|
-
}] : [], { items: T, clearCart:
|
|
66
|
+
}] : [], { items: T, clearCart: gt, _hasHydrated: E } = te(), D = b.pathname.includes("/checkout/addons") && !at, O = b.pathname.includes("/checkout/store") && !!v, k = D ? "ADDON" : O ? "ORDER" : x?.purchaseType ?? (it ? "PLAN" : at ? "ADDON" : "CREDITS"), A = x?.itemId ?? it ?? at ?? v, [_t, vt] = f(!1), yt = Fe(!1), [bt, xt] = f(!1), [St, Ct] = f([]), [wt, Tt] = f(null), [j, M] = f("select"), [N, Et] = f(null), [Dt, P] = f(null), [F, Ot] = f(null), [kt, At] = f("card");
|
|
65
67
|
u(() => {
|
|
66
68
|
if (j !== "success" || !F) return;
|
|
67
|
-
let e = typeof window < "u" ? window.localStorage.getItem(
|
|
69
|
+
let e = typeof window < "u" ? window.localStorage.getItem(tt("boff-referral-attribution")) : null;
|
|
68
70
|
if (!e) return;
|
|
69
71
|
let t;
|
|
70
72
|
try {
|
|
@@ -74,12 +76,12 @@ var $e = () => {
|
|
|
74
76
|
}
|
|
75
77
|
if (!t.journeyId && !t.codeId) return;
|
|
76
78
|
let n = F.transactionId || N?.paymentId || N?.orderId || v || A || k, r = `${t.journeyId ?? "journey"}:${n}`;
|
|
77
|
-
|
|
79
|
+
pt.current !== r && (pt.current = r, Pe({
|
|
78
80
|
journeyId: t.journeyId,
|
|
79
81
|
codeId: t.codeId,
|
|
80
82
|
eventType: k === "ORDER" ? "STORE_PURCHASE" : "PAID_CONVERSION",
|
|
81
|
-
productSlug:
|
|
82
|
-
actorUserId:
|
|
83
|
+
productSlug: ft,
|
|
84
|
+
actorUserId: dt?.id,
|
|
83
85
|
orderId: F.transactionId || N?.paymentId || N?.orderId,
|
|
84
86
|
billingAccountId: F.billingAccountId,
|
|
85
87
|
storeOrderId: k === "ORDER" ? v : void 0,
|
|
@@ -91,56 +93,56 @@ var $e = () => {
|
|
|
91
93
|
billingAccountName: F.billingAccountName
|
|
92
94
|
}
|
|
93
95
|
}, {
|
|
94
|
-
apiGatewayUrl:
|
|
95
|
-
authToken:
|
|
96
|
+
apiGatewayUrl: lt,
|
|
97
|
+
authToken: ut,
|
|
96
98
|
orgId: C
|
|
97
99
|
}).catch(() => {
|
|
98
|
-
|
|
100
|
+
pt.current = null;
|
|
99
101
|
}));
|
|
100
102
|
}, [
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
103
|
+
lt,
|
|
104
|
+
ut,
|
|
105
|
+
dt?.id,
|
|
104
106
|
A,
|
|
105
107
|
j,
|
|
106
108
|
C,
|
|
107
109
|
N?.orderId,
|
|
108
110
|
N?.paymentId,
|
|
109
|
-
|
|
111
|
+
ft,
|
|
110
112
|
F,
|
|
111
113
|
k,
|
|
112
114
|
v
|
|
113
115
|
]);
|
|
114
|
-
let [I,
|
|
116
|
+
let [I, jt] = f(1), L = ae({
|
|
115
117
|
defaultCurrency: "USD",
|
|
116
118
|
upgradeFromSubscriptionId: x?.upgradeFromSubscriptionId,
|
|
117
119
|
downgradeFromSubscriptionId: x?.downgradeFromSubscriptionId
|
|
118
|
-
}), { config:
|
|
120
|
+
}), { config: Mt, stripeEnabled: Nt, razorpayEnabled: Pt } = se(), { elapsedTime: Ft, error: It } = ce({
|
|
119
121
|
paymentId: j === "processing" ? N?.paymentId ?? null : null,
|
|
120
|
-
billingAccountId:
|
|
121
|
-
paymentType:
|
|
122
|
+
billingAccountId: L.billingAccount?.id ?? F?.billingAccountId ?? null,
|
|
123
|
+
paymentType: kt,
|
|
122
124
|
pollingInterval: 5e3,
|
|
123
125
|
maxPollingTime: 3e5,
|
|
124
126
|
onSuccess: (e) => {
|
|
125
|
-
if (e.transactionId &&
|
|
127
|
+
if (e.transactionId && Ot((t) => t && {
|
|
126
128
|
...t,
|
|
127
129
|
transactionId: e.transactionId
|
|
128
|
-
}), M("success"), D &&
|
|
129
|
-
let e = (
|
|
130
|
+
}), M("success"), D && gt(), (k === "PLAN" || k === "ADDON") && w) {
|
|
131
|
+
let e = (R?.getPlan?.features ?? []).filter((e) => e != null).filter((e) => e.quota?.name && _e(e.quota.name)).map((e) => {
|
|
130
132
|
let t = e.quota?.limits, n = t && "type" in t ? String(t.type) : "number", r = e.context && "quantity" in e.context ? Number(e.context.quantity) : null, i = t && "value" in t ? Number(t.value) : null, a = r ?? i;
|
|
131
133
|
return {
|
|
132
134
|
quotaName: e.quota.name,
|
|
133
|
-
productId:
|
|
135
|
+
productId: R?.getPlan?.context?.productId ?? "platform",
|
|
134
136
|
limit: n === "number" ? a : null,
|
|
135
137
|
noLimit: n !== "number",
|
|
136
138
|
resetPeriod: "NEVER",
|
|
137
139
|
quotaMode: "dedicated"
|
|
138
140
|
};
|
|
139
141
|
});
|
|
140
|
-
e.length > 0 && (
|
|
142
|
+
e.length > 0 && (Ct(e), Xt().then((e) => {
|
|
141
143
|
let t = e.data?.getActiveSubscriptions?.find((e) => e.planId === A);
|
|
142
|
-
t &&
|
|
143
|
-
}),
|
|
144
|
+
t && Tt(t.id);
|
|
145
|
+
}), ht.length > 1 && xt(!0));
|
|
144
146
|
}
|
|
145
147
|
},
|
|
146
148
|
onFailure: (e) => {
|
|
@@ -149,113 +151,113 @@ var $e = () => {
|
|
|
149
151
|
onTimeout: () => {
|
|
150
152
|
P("Payment verification timed out. Please check your billing history for the payment status."), M("error");
|
|
151
153
|
}
|
|
152
|
-
}), { data:
|
|
154
|
+
}), { data: Lt, loading: Rt, refetch: zt } = ue({}), { data: R, loading: Bt } = pe({
|
|
153
155
|
variables: { id: A },
|
|
154
156
|
skip: k !== "PLAN" || !A
|
|
155
|
-
}), { data:
|
|
157
|
+
}), { data: z, loading: Vt } = me({
|
|
156
158
|
variables: { addonIDs: A ? [A] : [] },
|
|
157
159
|
skip: k !== "ADDON" || !A || O
|
|
158
|
-
}), { data:
|
|
160
|
+
}), { data: B } = he({
|
|
159
161
|
variables: { id: v },
|
|
160
162
|
skip: !O || !v
|
|
161
|
-
}),
|
|
162
|
-
let e =
|
|
163
|
+
}), V = k === "PLAN" ? R?.getPlan?.nativeProductId ?? A : k === "ADDON" && !D ? z?.getSelectedAddons?.[0]?.nativeProductId ?? A : void 0, Ht = d(() => {
|
|
164
|
+
let e = B?.getStoreOrder?.lineItems;
|
|
163
165
|
return Array.isArray(e) ? e : [];
|
|
164
|
-
}, [
|
|
166
|
+
}, [B]), H = O && Ht.some((e) => String(e.itemType).toUpperCase() === "PHYSICAL"), Ut = je(B?.getStoreOrder?.currency), [U, Wt] = f({
|
|
165
167
|
shippingAddressId: null,
|
|
166
168
|
shippingMethodId: null,
|
|
167
169
|
shippingCost: 0,
|
|
168
170
|
destinationCountry: null
|
|
169
|
-
}), [
|
|
170
|
-
variables: { billingAccountId:
|
|
171
|
-
skip: !
|
|
172
|
-
}), { data:
|
|
173
|
-
variables: { billingAccountId:
|
|
174
|
-
skip: !
|
|
175
|
-
}),
|
|
171
|
+
}), [Gt] = Ne(), { data: Kt, loading: qt } = fe({
|
|
172
|
+
variables: { billingAccountId: L.billingAccount?.id ?? "" },
|
|
173
|
+
skip: !L.billingAccount?.id
|
|
174
|
+
}), { data: Jt, loading: Yt, refetch: Xt } = le({
|
|
175
|
+
variables: { billingAccountId: L.billingAccount?.id ?? "" },
|
|
176
|
+
skip: !L.billingAccount?.id || k !== "ADDON" && k !== "PLAN" || O
|
|
177
|
+
}), W = d(() => Jt?.getActiveSubscriptions ?? [], [Jt]), G = d(() => !L.selectedSubscriptionId || W.length === 0 ? null : W.find((e) => e.id === L.selectedSubscriptionId) ?? null, [L.selectedSubscriptionId, W]), K = L.items[0]?.type === "CREDITS" ? L.items[0].quantity : 100, { data: Zt, loading: Qt } = de({
|
|
176
178
|
variables: {
|
|
177
|
-
creditAmount:
|
|
178
|
-
currency:
|
|
179
|
+
creditAmount: K,
|
|
180
|
+
currency: L.selectedCurrency || "USD"
|
|
179
181
|
},
|
|
180
182
|
skip: k !== "CREDITS"
|
|
181
|
-
}),
|
|
182
|
-
if (!
|
|
183
|
-
let e =
|
|
183
|
+
}), q = d(() => Zt?.getCostOfCredits?.amount && K > 0 ? Zt.getCostOfCredits.amount / K : .01, [Zt, K]), J = d(() => Kt?.getPaymentMethods ?? [], [Kt]), Y = d(() => Lt?.myBillingAccounts ?? [], [Lt]), X = d(() => {
|
|
184
|
+
if (!L.billingAccount) return;
|
|
185
|
+
let e = Y.find((e) => e.id === L.billingAccount?.id)?.billingAddresses;
|
|
184
186
|
if (e && e.length > 0) return e[0]?.country || void 0;
|
|
185
|
-
}, [
|
|
187
|
+
}, [L.billingAccount, Y]), [$t, en] = f(null);
|
|
186
188
|
u(() => {
|
|
187
|
-
if (
|
|
188
|
-
if (
|
|
189
|
+
if (X) {
|
|
190
|
+
if (X === "IN") L.selectedCurrency !== "INR" && L.setCurrency("INR"), Pt && $t !== X && L.selectedProvider !== "CREDITS" && (L.setPaymentProvider("RAZORPAY"), en(X));
|
|
189
191
|
else {
|
|
190
|
-
if (
|
|
191
|
-
let e =
|
|
192
|
-
|
|
192
|
+
if (L.selectedCurrency === "INR") {
|
|
193
|
+
let e = L.billingAccount?.currency, t = e && e !== "INR" ? e : "USD";
|
|
194
|
+
L.setCurrency(t);
|
|
193
195
|
}
|
|
194
|
-
|
|
196
|
+
L.selectedProvider === "RAZORPAY" && (L.setPaymentProvider("STRIPE"), en(X));
|
|
195
197
|
}
|
|
196
198
|
}
|
|
197
199
|
}, [
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
200
|
+
X,
|
|
201
|
+
L.selectedCurrency,
|
|
202
|
+
L.selectedProvider,
|
|
203
|
+
L.setCurrency,
|
|
204
|
+
L.setPaymentProvider,
|
|
205
|
+
L.billingAccount?.currency,
|
|
206
|
+
Pt,
|
|
207
|
+
$t
|
|
206
208
|
]);
|
|
207
|
-
let { billingAccount:
|
|
209
|
+
let { billingAccount: tn, canPayWithCredits: nn, hasEnoughCredits: rn, selectedCurrency: an, selectedPaymentMethodId: on, selectedProvider: sn, setCurrency: cn, setPaymentProvider: ln, setSelectedPaymentMethodId: un } = L;
|
|
208
210
|
u(() => {
|
|
209
|
-
if (!
|
|
210
|
-
let e =
|
|
211
|
-
e !== "INR" &&
|
|
211
|
+
if (!tn?.currency || X === "IN") return;
|
|
212
|
+
let e = tn.currency;
|
|
213
|
+
e !== "INR" && an !== e && cn(e);
|
|
212
214
|
}, [
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
215
|
+
X,
|
|
216
|
+
tn,
|
|
217
|
+
an,
|
|
218
|
+
cn
|
|
217
219
|
]), u(() => {
|
|
218
|
-
if (
|
|
219
|
-
if (
|
|
220
|
-
else if (
|
|
221
|
-
let e =
|
|
220
|
+
if (sn === "AUTO" || sn === null) {
|
|
221
|
+
if (nn && rn) ln("CREDITS"), un(null);
|
|
222
|
+
else if (J.length > 0 && !on) {
|
|
223
|
+
let e = J.find((e) => e.isDefault && e.isVerified), t = J.find((e) => e.isVerified), n = e || t;
|
|
222
224
|
if (n) {
|
|
223
|
-
|
|
225
|
+
un(n.id), n.razorpayPaymentMethodId ? ln("RAZORPAY") : n.stripePaymentMethodId && ln("STRIPE");
|
|
224
226
|
return;
|
|
225
227
|
}
|
|
226
228
|
}
|
|
227
229
|
}
|
|
228
230
|
}, [
|
|
229
|
-
|
|
230
|
-
Qt,
|
|
231
|
-
Y,
|
|
232
|
-
en,
|
|
233
|
-
tn,
|
|
231
|
+
nn,
|
|
234
232
|
rn,
|
|
235
|
-
|
|
233
|
+
J,
|
|
234
|
+
on,
|
|
235
|
+
sn,
|
|
236
|
+
ln,
|
|
237
|
+
un
|
|
236
238
|
]);
|
|
237
|
-
let [
|
|
239
|
+
let [Z, Q] = f(!1);
|
|
238
240
|
u(() => {
|
|
239
|
-
if (!O ||
|
|
240
|
-
let e =
|
|
241
|
-
|
|
241
|
+
if (!O || Z || !B?.getStoreOrder) return;
|
|
242
|
+
let e = je(B.getStoreOrder.currency);
|
|
243
|
+
an !== e && cn(e);
|
|
242
244
|
}, [
|
|
243
245
|
O,
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
246
|
+
Z,
|
|
247
|
+
an,
|
|
248
|
+
cn,
|
|
249
|
+
B
|
|
248
250
|
]), u(() => {
|
|
249
|
-
if (k === "PLAN" &&
|
|
250
|
-
let e =
|
|
251
|
-
|
|
251
|
+
if (k === "PLAN" && R?.getPlan?.pricingModel === "PER_SEAT") {
|
|
252
|
+
let e = R.getPlan.minSeats ?? 1;
|
|
253
|
+
jt((t) => t < e ? e : t);
|
|
252
254
|
}
|
|
253
|
-
}, [
|
|
254
|
-
k === "PLAN" &&
|
|
255
|
+
}, [R, k]), u(() => {
|
|
256
|
+
k === "PLAN" && R?.getPlan?.pricingModel === "PER_SEAT" && Z && Q(!1);
|
|
255
257
|
}, [I]), u(() => {
|
|
256
|
-
if (!
|
|
258
|
+
if (!Z) {
|
|
257
259
|
if (D && E && T.length > 0) {
|
|
258
|
-
|
|
260
|
+
L.clearItems();
|
|
259
261
|
for (let e of T) {
|
|
260
262
|
let t = e.addon, n = t.features?.map((e) => {
|
|
261
263
|
let t = e.quota?.limits, n = e.context && "quantity" in e.context ? Number(e.context.quantity) : void 0;
|
|
@@ -267,7 +269,7 @@ var $e = () => {
|
|
|
267
269
|
value: n
|
|
268
270
|
} : t
|
|
269
271
|
};
|
|
270
|
-
}) || [], r =
|
|
272
|
+
}) || [], r = L.selectedCurrency || "USD", i = t.currencyPrices, a = i?.[r] ?? t.price, o = i?.USD ?? t.price, ee = {
|
|
271
273
|
id: t.id,
|
|
272
274
|
type: "ADDON",
|
|
273
275
|
name: t.name,
|
|
@@ -279,11 +281,11 @@ var $e = () => {
|
|
|
279
281
|
features: n,
|
|
280
282
|
metadata: { addonId: t.id }
|
|
281
283
|
};
|
|
282
|
-
|
|
284
|
+
L.addItem(ee);
|
|
283
285
|
}
|
|
284
|
-
|
|
285
|
-
} else if (k === "PLAN" &&
|
|
286
|
-
let e =
|
|
286
|
+
Q(!0);
|
|
287
|
+
} else if (k === "PLAN" && R?.getPlan) {
|
|
288
|
+
let e = R.getPlan, t = e.features?.map((e) => {
|
|
287
289
|
let t = e.quota?.limits, n = e.context && "quantity" in e.context ? Number(e.context.quantity) : void 0;
|
|
288
290
|
return {
|
|
289
291
|
id: e.quota?.id || e.id,
|
|
@@ -293,7 +295,7 @@ var $e = () => {
|
|
|
293
295
|
value: n
|
|
294
296
|
} : t
|
|
295
297
|
};
|
|
296
|
-
}) || [], n =
|
|
298
|
+
}) || [], n = L.selectedCurrency || "USD", r = e.currencyPrices, i = e.pricingModel === "PER_SEAT", a;
|
|
297
299
|
if (i && e.pricePerSeat) {
|
|
298
300
|
let t = r?.[n];
|
|
299
301
|
a = (typeof t == "object" && t?.perSeat ? t.perSeat : e.pricePerSeat) * I;
|
|
@@ -301,25 +303,25 @@ var $e = () => {
|
|
|
301
303
|
let t = r?.[n];
|
|
302
304
|
a = typeof t == "number" ? t : e.price;
|
|
303
305
|
}
|
|
304
|
-
let o = r?.USD, ee = typeof o == "number" ? o : e.price,
|
|
306
|
+
let o = r?.USD, ee = typeof o == "number" ? o : e.price, te = typeof o == "object" && o?.perSeat ? o.perSeat : e.pricePerSeat, s = i ? I : 1, c = {
|
|
305
307
|
id: e.id,
|
|
306
308
|
type: "PLAN",
|
|
307
309
|
name: e.name,
|
|
308
310
|
description: typeof e.context == "object" && e.context !== null ? e.context.description : typeof e.context == "string" ? e.context : void 0,
|
|
309
311
|
price: a,
|
|
310
|
-
priceUSD: i && e.pricePerSeat ? (
|
|
312
|
+
priceUSD: i && e.pricePerSeat ? (te ?? e.pricePerSeat) * s : ee,
|
|
311
313
|
currency: n,
|
|
312
|
-
quantity:
|
|
314
|
+
quantity: s,
|
|
313
315
|
features: t,
|
|
314
316
|
metadata: {
|
|
315
317
|
planId: e.id,
|
|
316
318
|
duration: e.duration,
|
|
317
|
-
seatCount: i ?
|
|
319
|
+
seatCount: i ? s : void 0
|
|
318
320
|
}
|
|
319
321
|
};
|
|
320
|
-
|
|
321
|
-
} else if (k === "ADDON" && !D &&
|
|
322
|
-
let e =
|
|
322
|
+
L.addItem(c), Q(!0);
|
|
323
|
+
} else if (k === "ADDON" && !D && z?.getSelectedAddons?.[0]) {
|
|
324
|
+
let e = z.getSelectedAddons[0], t = e.features?.map((e) => {
|
|
323
325
|
let t = e.quota?.limits, n = e.context && "quantity" in e.context ? Number(e.context.quantity) : void 0;
|
|
324
326
|
return {
|
|
325
327
|
id: e.quota?.id || e.id,
|
|
@@ -329,7 +331,7 @@ var $e = () => {
|
|
|
329
331
|
value: n
|
|
330
332
|
} : t
|
|
331
333
|
};
|
|
332
|
-
}) || [], n =
|
|
334
|
+
}) || [], n = L.selectedCurrency || "USD", r = e.currencyPrices, i = r?.[n] ?? e.price, a = r?.USD ?? e.price, o = {
|
|
333
335
|
id: e.id,
|
|
334
336
|
type: "ADDON",
|
|
335
337
|
name: e.name,
|
|
@@ -341,63 +343,63 @@ var $e = () => {
|
|
|
341
343
|
features: t,
|
|
342
344
|
metadata: { addonId: e.id }
|
|
343
345
|
};
|
|
344
|
-
|
|
345
|
-
} else if (O &&
|
|
346
|
-
|
|
347
|
-
let e =
|
|
348
|
-
for (let e of t)
|
|
349
|
-
|
|
346
|
+
L.addItem(o), Q(!0);
|
|
347
|
+
} else if (O && B?.getStoreOrder) {
|
|
348
|
+
L.clearItems();
|
|
349
|
+
let e = B.getStoreOrder, t = Ae(e);
|
|
350
|
+
for (let e of t) L.addItem(e);
|
|
351
|
+
Q(!0);
|
|
350
352
|
} else if (k === "CREDITS") {
|
|
351
|
-
let e =
|
|
353
|
+
let e = L.selectedCurrency || "USD", t = {
|
|
352
354
|
id: "credits-purchase",
|
|
353
355
|
type: "CREDITS",
|
|
354
356
|
name: "Credits",
|
|
355
357
|
description: "Purchase credits for your account",
|
|
356
|
-
price:
|
|
358
|
+
price: q,
|
|
357
359
|
currency: e,
|
|
358
360
|
quantity: 100
|
|
359
361
|
};
|
|
360
|
-
|
|
362
|
+
L.addItem(t), Q(!0);
|
|
361
363
|
}
|
|
362
364
|
}
|
|
363
365
|
}, [
|
|
364
366
|
k,
|
|
367
|
+
R,
|
|
365
368
|
z,
|
|
366
369
|
B,
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
R.clearItems,
|
|
370
|
+
L.addItem,
|
|
371
|
+
L.clearItems,
|
|
370
372
|
x?.quantity,
|
|
371
|
-
|
|
373
|
+
Z,
|
|
372
374
|
D,
|
|
373
375
|
O,
|
|
374
376
|
T,
|
|
375
377
|
E,
|
|
376
|
-
|
|
377
|
-
|
|
378
|
+
q,
|
|
379
|
+
L.selectedCurrency
|
|
378
380
|
]), u(() => {
|
|
379
|
-
if (O &&
|
|
380
|
-
for (let e of
|
|
381
|
-
let t = e.price *
|
|
382
|
-
|
|
381
|
+
if (O && Z && L.convertedAmount !== null) {
|
|
382
|
+
for (let e of L.items) if (e.type === "ORDER" && e.currency !== L.selectedCurrency) {
|
|
383
|
+
let t = e.price * L.conversionRate;
|
|
384
|
+
L.updateItemPrice(e.id, t, L.selectedCurrency);
|
|
383
385
|
}
|
|
384
386
|
}
|
|
385
387
|
}, [
|
|
386
388
|
O,
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
389
|
+
Z,
|
|
390
|
+
L.convertedAmount,
|
|
391
|
+
L.conversionRate,
|
|
392
|
+
L.selectedCurrency,
|
|
393
|
+
L.updateItemPrice
|
|
392
394
|
]);
|
|
393
|
-
let
|
|
395
|
+
let dn = Fe(null);
|
|
394
396
|
u(() => {
|
|
395
|
-
if (
|
|
396
|
-
if (
|
|
397
|
-
let e =
|
|
397
|
+
if (H) {
|
|
398
|
+
if (U.shippingCost > 0) {
|
|
399
|
+
let e = L.selectedCurrency, t = Ut !== e && L.convertedAmount !== null ? U.shippingCost * L.conversionRate : U.shippingCost, n = dn.current;
|
|
398
400
|
if (n && n.price === t && n.currency === e) return;
|
|
399
|
-
n === null ?
|
|
400
|
-
id:
|
|
401
|
+
n === null ? L.addItem({
|
|
402
|
+
id: Me,
|
|
401
403
|
type: "ORDER",
|
|
402
404
|
name: "Shipping",
|
|
403
405
|
price: t,
|
|
@@ -407,118 +409,118 @@ var $e = () => {
|
|
|
407
409
|
storeOrderId: v,
|
|
408
410
|
isShipping: !0
|
|
409
411
|
}
|
|
410
|
-
}) :
|
|
412
|
+
}) : L.updateItemPrice(Me, t, e), dn.current = {
|
|
411
413
|
price: t,
|
|
412
414
|
currency: e
|
|
413
415
|
};
|
|
414
|
-
} else
|
|
416
|
+
} else dn.current !== null && (dn.current = null, L.removeItem(Me));
|
|
415
417
|
}
|
|
416
418
|
}, [
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
419
|
+
H,
|
|
420
|
+
U.shippingCost,
|
|
421
|
+
Ut,
|
|
422
|
+
L.selectedCurrency,
|
|
423
|
+
L.conversionRate,
|
|
424
|
+
L.convertedAmount,
|
|
423
425
|
v,
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
426
|
+
L.addItem,
|
|
427
|
+
L.updateItemPrice,
|
|
428
|
+
L.removeItem
|
|
427
429
|
]), u(() => {
|
|
428
|
-
if (k === "CREDITS" &&
|
|
429
|
-
let e =
|
|
430
|
-
e && e.price !==
|
|
430
|
+
if (k === "CREDITS" && Z && q > 0) {
|
|
431
|
+
let e = L.items.find((e) => e.id === "credits-purchase");
|
|
432
|
+
e && e.price !== q && L.updateItemPrice("credits-purchase", q);
|
|
431
433
|
}
|
|
432
434
|
}, [
|
|
433
435
|
k,
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
436
|
+
Z,
|
|
437
|
+
q,
|
|
438
|
+
L.items,
|
|
439
|
+
L.updateItemPrice
|
|
438
440
|
]), u(() => {
|
|
439
|
-
if (!
|
|
440
|
-
let e =
|
|
441
|
-
for (let t of
|
|
442
|
-
let n =
|
|
443
|
-
(t.price !== n || t.currency !== e) &&
|
|
441
|
+
if (!Z || L.items.length === 0) return;
|
|
442
|
+
let e = L.selectedCurrency || "USD";
|
|
443
|
+
for (let t of L.items) if (t.type === "PLAN" && R?.getPlan) {
|
|
444
|
+
let n = R.getPlan.currencyPrices?.[e] ?? R.getPlan.price;
|
|
445
|
+
(t.price !== n || t.currency !== e) && L.updateItemPrice(t.id, n, e);
|
|
444
446
|
} else if (t.type === "ADDON") {
|
|
445
|
-
if (!D &&
|
|
446
|
-
let n =
|
|
447
|
-
(t.price !== r || t.currency !== e) &&
|
|
447
|
+
if (!D && z?.getSelectedAddons?.[0]) {
|
|
448
|
+
let n = z.getSelectedAddons[0], r = n.currencyPrices?.[e] ?? n.price;
|
|
449
|
+
(t.price !== r || t.currency !== e) && L.updateItemPrice(t.id, r, e);
|
|
448
450
|
}
|
|
449
451
|
if (D) {
|
|
450
452
|
let n = T.find((e) => e.addon.id === t.id);
|
|
451
453
|
if (n) {
|
|
452
454
|
let r = n.addon.currencyPrices?.[e] ?? n.addon.price;
|
|
453
|
-
(t.price !== r || t.currency !== e) &&
|
|
455
|
+
(t.price !== r || t.currency !== e) && L.updateItemPrice(t.id, r, e);
|
|
454
456
|
}
|
|
455
457
|
}
|
|
456
458
|
}
|
|
457
459
|
}, [
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
460
|
+
L.selectedCurrency,
|
|
461
|
+
Z,
|
|
462
|
+
L.items,
|
|
463
|
+
L.updateItemPrice,
|
|
464
|
+
R,
|
|
462
465
|
z,
|
|
463
|
-
B,
|
|
464
466
|
T,
|
|
465
467
|
D
|
|
466
468
|
]), u(() => {
|
|
467
|
-
if (
|
|
469
|
+
if (Y.length > 0 && !L.billingAccount) {
|
|
468
470
|
if (x?.billingAccountId) {
|
|
469
|
-
let e =
|
|
471
|
+
let e = Y.find((e) => e.id === x.billingAccountId);
|
|
470
472
|
if (e) {
|
|
471
|
-
|
|
473
|
+
L.setBillingAccount(e);
|
|
472
474
|
return;
|
|
473
475
|
}
|
|
474
476
|
}
|
|
475
477
|
if (C) {
|
|
476
|
-
let e =
|
|
478
|
+
let e = ie(C);
|
|
477
479
|
if (e) {
|
|
478
|
-
let t =
|
|
480
|
+
let t = Y.find((t) => t.id === e);
|
|
479
481
|
if (t) {
|
|
480
|
-
|
|
482
|
+
L.setBillingAccount(t);
|
|
481
483
|
return;
|
|
482
484
|
}
|
|
483
485
|
}
|
|
484
486
|
}
|
|
485
|
-
|
|
487
|
+
L.setBillingAccount(Y[0]);
|
|
486
488
|
}
|
|
487
489
|
}, [
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
490
|
+
Y,
|
|
491
|
+
L.billingAccount,
|
|
492
|
+
L.setBillingAccount,
|
|
491
493
|
x?.billingAccountId,
|
|
492
494
|
C
|
|
493
495
|
]);
|
|
494
|
-
let
|
|
496
|
+
let fn = !!(x?.upgradeFromSubscriptionId || x?.downgradeFromSubscriptionId);
|
|
495
497
|
u(() => {
|
|
496
|
-
D && E && T.length === 0 && !
|
|
498
|
+
D && E && T.length === 0 && !Z && y("/addons", { replace: !0 });
|
|
497
499
|
}, [
|
|
498
500
|
E,
|
|
499
501
|
T.length,
|
|
500
502
|
D,
|
|
501
|
-
|
|
503
|
+
Z,
|
|
502
504
|
y
|
|
503
505
|
]);
|
|
504
|
-
let
|
|
505
|
-
billingAccountId:
|
|
506
|
+
let pn = oe({
|
|
507
|
+
billingAccountId: L.billingAccount?.id,
|
|
506
508
|
purchaseType: k,
|
|
507
|
-
productId:
|
|
508
|
-
}),
|
|
509
|
-
if (!
|
|
510
|
-
let e =
|
|
511
|
-
if (
|
|
512
|
-
|
|
509
|
+
productId: V
|
|
510
|
+
}), mn = l(async () => {
|
|
511
|
+
if (!L.billingAccount) return;
|
|
512
|
+
let e = yt.current;
|
|
513
|
+
if (yt.current = !1, !e && !Oe(L.billingAccount)) {
|
|
514
|
+
vt(!0);
|
|
513
515
|
return;
|
|
514
516
|
}
|
|
515
|
-
if (P(null),
|
|
516
|
-
let e = (await
|
|
517
|
+
if (P(null), H) try {
|
|
518
|
+
let e = (await Gt({ variables: { input: {
|
|
517
519
|
orderId: v,
|
|
518
|
-
shippingMethodId:
|
|
519
|
-
...
|
|
520
|
+
shippingMethodId: U.shippingMethodId,
|
|
521
|
+
...U.shippingAddressId ? { shippingAddressId: U.shippingAddressId } : {}
|
|
520
522
|
} } })).data?.setStoreOrderShipping?.shippingCost;
|
|
521
|
-
typeof e == "number" && e !==
|
|
523
|
+
typeof e == "number" && e !== U.shippingCost && Wt((t) => ({
|
|
522
524
|
...t,
|
|
523
525
|
shippingCost: e
|
|
524
526
|
}));
|
|
@@ -526,45 +528,45 @@ var $e = () => {
|
|
|
526
528
|
P(e instanceof Error && e.message ? e.message : "Could not save your shipping details. Please review your delivery address and try again."), M("error");
|
|
527
529
|
return;
|
|
528
530
|
}
|
|
529
|
-
let t =
|
|
531
|
+
let t = L.billingAccount.creditAmount ?? 0, n = [...L.items], r = L.total, i = L.creditsRequired, a = await L.initiatePayment();
|
|
530
532
|
if (a.success) {
|
|
531
533
|
if (S("billing.checkout.initiated", {
|
|
532
534
|
route: "/billing/checkout",
|
|
533
535
|
entityId: a.paymentId ?? a.orderId,
|
|
534
536
|
source: "checkout",
|
|
535
537
|
amount: a.total || r,
|
|
536
|
-
currency: a.currency ||
|
|
537
|
-
}),
|
|
538
|
+
currency: a.currency || L.selectedCurrency
|
|
539
|
+
}), L.selectedProvider === "CREDITS") {
|
|
538
540
|
S("billing.credits.spent", {
|
|
539
541
|
route: "/billing/checkout",
|
|
540
542
|
entityId: a.orderId,
|
|
541
543
|
source: "checkout",
|
|
542
544
|
amount: i,
|
|
543
545
|
currency: "CREDITS"
|
|
544
|
-
}),
|
|
546
|
+
}), Ot({
|
|
545
547
|
items: n,
|
|
546
548
|
total: i,
|
|
547
|
-
billingAccountName:
|
|
548
|
-
billingAccountId:
|
|
549
|
+
billingAccountName: L.billingAccount.name,
|
|
550
|
+
billingAccountId: L.billingAccount.id,
|
|
549
551
|
previousBalance: t,
|
|
550
552
|
newBalance: t - i,
|
|
551
553
|
paymentMethod: "credits",
|
|
552
554
|
currency: "Credits",
|
|
553
555
|
transactionId: a.orderId
|
|
554
|
-
}),
|
|
556
|
+
}), At("credits"), Et({ paymentId: a.orderId }), M("processing");
|
|
555
557
|
return;
|
|
556
558
|
}
|
|
557
|
-
|
|
559
|
+
Ot({
|
|
558
560
|
items: n,
|
|
559
561
|
total: a.total || r,
|
|
560
|
-
billingAccountName:
|
|
561
|
-
billingAccountId:
|
|
562
|
+
billingAccountName: L.billingAccount.name,
|
|
563
|
+
billingAccountId: L.billingAccount.id,
|
|
562
564
|
previousBalance: t,
|
|
563
565
|
newBalance: t,
|
|
564
566
|
paymentMethod: "card",
|
|
565
|
-
currency: a.currency ||
|
|
567
|
+
currency: a.currency || L.selectedCurrency,
|
|
566
568
|
transactionId: a.paymentId
|
|
567
|
-
}),
|
|
569
|
+
}), At("card"), Et({
|
|
568
570
|
clientSecret: a.clientSecret,
|
|
569
571
|
orderId: a.orderId,
|
|
570
572
|
razorpayKeyId: a.razorpayKeyId,
|
|
@@ -583,24 +585,24 @@ var $e = () => {
|
|
|
583
585
|
reason: a.error || "Payment initiation failed"
|
|
584
586
|
}), P(a.error || "Payment initiation failed"), M("error");
|
|
585
587
|
}, [
|
|
586
|
-
|
|
588
|
+
L,
|
|
587
589
|
S,
|
|
590
|
+
H,
|
|
588
591
|
U,
|
|
589
|
-
W,
|
|
590
592
|
v,
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
]),
|
|
593
|
+
Ut,
|
|
594
|
+
Gt
|
|
595
|
+
]), hn = l((e) => {
|
|
594
596
|
S("billing.payment.succeeded", {
|
|
595
597
|
route: "/billing/checkout",
|
|
596
598
|
entityId: N?.paymentId ?? N?.orderId,
|
|
597
599
|
source: "checkout"
|
|
598
|
-
}),
|
|
600
|
+
}), Et((e) => e), M("processing");
|
|
599
601
|
}, [
|
|
600
602
|
S,
|
|
601
603
|
N?.orderId,
|
|
602
604
|
N?.paymentId
|
|
603
|
-
]),
|
|
605
|
+
]), gn = l((e) => {
|
|
604
606
|
S("billing.payment.failed", {
|
|
605
607
|
route: "/billing/checkout",
|
|
606
608
|
entityId: N?.paymentId ?? N?.orderId,
|
|
@@ -611,41 +613,41 @@ var $e = () => {
|
|
|
611
613
|
S,
|
|
612
614
|
N?.orderId,
|
|
613
615
|
N?.paymentId
|
|
614
|
-
]),
|
|
615
|
-
|
|
616
|
-
}, [
|
|
617
|
-
if (!
|
|
618
|
-
if (
|
|
616
|
+
]), _n = l((e) => {
|
|
617
|
+
L.updateItemQuantity("credits-purchase", e);
|
|
618
|
+
}, [L]);
|
|
619
|
+
if (!ot.canProcessPayment) return /* @__PURE__ */ m(n, { message: "You don't have permission to make purchases." });
|
|
620
|
+
if (c() && k === "PLAN" && (Bt || Rt)) return /* @__PURE__ */ m("div", {
|
|
619
621
|
className: "flex min-h-[240px] items-center justify-center",
|
|
620
|
-
children: /* @__PURE__ */
|
|
622
|
+
children: /* @__PURE__ */ m(We, {
|
|
621
623
|
className: "size-6 animate-spin text-[--color-primary]",
|
|
622
624
|
"aria-label": "Loading"
|
|
623
625
|
})
|
|
624
626
|
});
|
|
625
|
-
if (
|
|
627
|
+
if (c() && k !== "PLAN") return /* @__PURE__ */ m(re, {
|
|
626
628
|
purchaseType: k,
|
|
627
629
|
path: b.pathname + b.search,
|
|
628
|
-
billingAccountId:
|
|
630
|
+
billingAccountId: L.billingAccount?.id,
|
|
629
631
|
onBack: () => y("dashboard")
|
|
630
632
|
});
|
|
631
|
-
if (
|
|
633
|
+
if (c() && k === "PLAN" && V) return /* @__PURE__ */ m(ne, {
|
|
632
634
|
purchaseType: k,
|
|
633
|
-
productId:
|
|
634
|
-
billingAccountId:
|
|
635
|
-
nativeCheckout:
|
|
635
|
+
productId: V,
|
|
636
|
+
billingAccountId: L.billingAccount?.id,
|
|
637
|
+
nativeCheckout: pn,
|
|
636
638
|
onBack: () => y("dashboard")
|
|
637
639
|
});
|
|
638
|
-
if (
|
|
640
|
+
if (c() && k === "PLAN" && !V) return /* @__PURE__ */ m(re, {
|
|
639
641
|
purchaseType: k,
|
|
640
642
|
path: b.pathname + b.search,
|
|
641
|
-
billingAccountId:
|
|
643
|
+
billingAccountId: L.billingAccount?.id,
|
|
642
644
|
onBack: () => y("dashboard")
|
|
643
645
|
});
|
|
644
|
-
let
|
|
645
|
-
if (D && E && T.length === 0 && !
|
|
646
|
-
let
|
|
646
|
+
let vn = Rt || Bt && k === "PLAN" || Vt && k === "ADDON" && !D || D && !E;
|
|
647
|
+
if (D && E && T.length === 0 && !Z) return null;
|
|
648
|
+
let yn = () => {
|
|
647
649
|
if (D) {
|
|
648
|
-
let e =
|
|
650
|
+
let e = L.items.length;
|
|
649
651
|
return `Purchase ${e} Add-on${e === 1 ? "" : "s"}`;
|
|
650
652
|
}
|
|
651
653
|
switch (k) {
|
|
@@ -654,19 +656,19 @@ var $e = () => {
|
|
|
654
656
|
case "ADDON": return "Purchase Add-on";
|
|
655
657
|
default: return "Checkout";
|
|
656
658
|
}
|
|
657
|
-
},
|
|
659
|
+
}, bn = () => {
|
|
658
660
|
switch (k) {
|
|
659
|
-
case "CREDITS": return /* @__PURE__ */
|
|
660
|
-
case "PLAN": return /* @__PURE__ */
|
|
661
|
-
case "ADDON": return /* @__PURE__ */
|
|
662
|
-
default: return /* @__PURE__ */
|
|
661
|
+
case "CREDITS": return /* @__PURE__ */ m(He, { className: "size-6" });
|
|
662
|
+
case "PLAN": return /* @__PURE__ */ m(Ge, { className: "size-6" });
|
|
663
|
+
case "ADDON": return /* @__PURE__ */ m(Be, { className: "size-6" });
|
|
664
|
+
default: return /* @__PURE__ */ m(Je, { className: "size-6" });
|
|
663
665
|
}
|
|
664
666
|
};
|
|
665
|
-
if (
|
|
667
|
+
if (vn) return /* @__PURE__ */ m("div", {
|
|
666
668
|
className: "flex items-center justify-center min-h-[400px]",
|
|
667
|
-
children: /* @__PURE__ */
|
|
669
|
+
children: /* @__PURE__ */ h("div", {
|
|
668
670
|
className: "text-center space-y-4",
|
|
669
|
-
children: [/* @__PURE__ */
|
|
671
|
+
children: [/* @__PURE__ */ m(We, { className: "size-8 animate-spin mx-auto text-text-link" }), /* @__PURE__ */ m("p", {
|
|
670
672
|
className: "text-text-secondary",
|
|
671
673
|
children: _("billing.checkout.loadingCheckout", "Loading checkout...")
|
|
672
674
|
})]
|
|
@@ -687,110 +689,110 @@ var $e = () => {
|
|
|
687
689
|
let t = e.price * e.quantity;
|
|
688
690
|
return F.total * (t / n);
|
|
689
691
|
};
|
|
690
|
-
return /* @__PURE__ */
|
|
692
|
+
return /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ h("div", {
|
|
691
693
|
className: "max-w-2xl mx-auto p-6 space-y-6",
|
|
692
694
|
children: [
|
|
693
|
-
/* @__PURE__ */
|
|
695
|
+
/* @__PURE__ */ h("div", {
|
|
694
696
|
className: "text-center space-y-4",
|
|
695
|
-
children: [/* @__PURE__ */
|
|
697
|
+
children: [/* @__PURE__ */ m("div", {
|
|
696
698
|
className: "inline-flex p-4 rounded-full bg-status-success-bg-subtle text-status-success-text",
|
|
697
|
-
children: /* @__PURE__ */
|
|
698
|
-
}), /* @__PURE__ */
|
|
699
|
+
children: /* @__PURE__ */ m(Ve, { className: "size-12" })
|
|
700
|
+
}), /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("h1", {
|
|
699
701
|
className: "text-2xl font-bold text-text-primary",
|
|
700
702
|
children: _("billing.checkout.paymentSuccessful", "Payment Successful!")
|
|
701
|
-
}), /* @__PURE__ */
|
|
703
|
+
}), /* @__PURE__ */ m("p", {
|
|
702
704
|
className: "text-text-secondary mt-2",
|
|
703
705
|
children: _("billing.checkout.purchaseCompleted", "Your purchase has been completed successfully.")
|
|
704
706
|
})] })]
|
|
705
707
|
}),
|
|
706
|
-
F && /* @__PURE__ */
|
|
708
|
+
F && /* @__PURE__ */ h("div", {
|
|
707
709
|
className: "bg-bg-surface border border-border-subtle rounded-lg overflow-hidden",
|
|
708
710
|
children: [
|
|
709
|
-
/* @__PURE__ */
|
|
711
|
+
/* @__PURE__ */ h("div", {
|
|
710
712
|
className: "p-4 border-b border-border-subtle",
|
|
711
|
-
children: [/* @__PURE__ */
|
|
713
|
+
children: [/* @__PURE__ */ h("h3", {
|
|
712
714
|
className: "font-semibold text-text-primary mb-3 flex items-center gap-2",
|
|
713
|
-
children: [/* @__PURE__ */
|
|
714
|
-
}), /* @__PURE__ */
|
|
715
|
+
children: [/* @__PURE__ */ m(Ke, { className: "size-4" }), _("billing.checkout.itemsPurchased", "Items Purchased")]
|
|
716
|
+
}), /* @__PURE__ */ m("div", {
|
|
715
717
|
className: "space-y-2",
|
|
716
|
-
children: F.items.map((t) => /* @__PURE__ */
|
|
718
|
+
children: F.items.map((t) => /* @__PURE__ */ h("div", {
|
|
717
719
|
className: "flex items-center justify-between",
|
|
718
|
-
children: [/* @__PURE__ */
|
|
720
|
+
children: [/* @__PURE__ */ h("div", {
|
|
719
721
|
className: "flex items-center gap-2",
|
|
720
722
|
children: [
|
|
721
|
-
t.type === "PLAN" && /* @__PURE__ */
|
|
722
|
-
t.type === "ADDON" && /* @__PURE__ */
|
|
723
|
-
t.type === "CREDITS" && /* @__PURE__ */
|
|
724
|
-
t.type === "ORDER" && /* @__PURE__ */
|
|
725
|
-
/* @__PURE__ */
|
|
723
|
+
t.type === "PLAN" && /* @__PURE__ */ m(Ge, { className: "size-4 text-accent-blue" }),
|
|
724
|
+
t.type === "ADDON" && /* @__PURE__ */ m(Be, { className: "size-4 text-accent-purple" }),
|
|
725
|
+
t.type === "CREDITS" && /* @__PURE__ */ m(He, { className: "size-4 text-status-warning-text" }),
|
|
726
|
+
t.type === "ORDER" && /* @__PURE__ */ m(Je, { className: "size-4 text-status-success-text" }),
|
|
727
|
+
/* @__PURE__ */ m("span", {
|
|
726
728
|
className: "text-text-primary",
|
|
727
729
|
children: t.name
|
|
728
730
|
}),
|
|
729
|
-
t.quantity > 1 && /* @__PURE__ */
|
|
731
|
+
t.quantity > 1 && /* @__PURE__ */ h("span", {
|
|
730
732
|
className: "text-xs text-text-secondary",
|
|
731
733
|
children: ["x", t.quantity]
|
|
732
734
|
})
|
|
733
735
|
]
|
|
734
|
-
}), /* @__PURE__ */
|
|
736
|
+
}), /* @__PURE__ */ m("span", {
|
|
735
737
|
className: "text-text-secondary",
|
|
736
738
|
children: e(F.paymentMethod === "credits" ? r(t) : t.price * t.quantity)
|
|
737
739
|
})]
|
|
738
740
|
}, t.id))
|
|
739
741
|
})]
|
|
740
742
|
}),
|
|
741
|
-
/* @__PURE__ */
|
|
743
|
+
/* @__PURE__ */ m("div", {
|
|
742
744
|
className: "p-4 border-b border-border-subtle bg-bg-sunken",
|
|
743
|
-
children: /* @__PURE__ */
|
|
745
|
+
children: /* @__PURE__ */ h("div", {
|
|
744
746
|
className: "grid grid-cols-2 gap-4",
|
|
745
|
-
children: [/* @__PURE__ */
|
|
747
|
+
children: [/* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("p", {
|
|
746
748
|
className: "text-xs text-text-secondary mb-1",
|
|
747
749
|
children: _("billing.checkout.paymentMethod", "Payment Method")
|
|
748
|
-
}), /* @__PURE__ */
|
|
750
|
+
}), /* @__PURE__ */ m("div", {
|
|
749
751
|
className: "flex items-center gap-2",
|
|
750
|
-
children: F.paymentMethod === "credits" ? /* @__PURE__ */
|
|
752
|
+
children: F.paymentMethod === "credits" ? /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m(Ye, { className: "size-4 text-status-warning-text" }), /* @__PURE__ */ m("span", {
|
|
751
753
|
className: "font-medium text-text-primary",
|
|
752
754
|
children: _("billing.checkout.credits", "Credits")
|
|
753
|
-
})] }) : /* @__PURE__ */
|
|
755
|
+
})] }) : /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m(Ue, { className: "size-4 text-accent-blue" }), /* @__PURE__ */ m("span", {
|
|
754
756
|
className: "font-medium text-text-primary",
|
|
755
757
|
children: _("billing.checkout.card", "Card")
|
|
756
758
|
})] })
|
|
757
|
-
})] }), /* @__PURE__ */
|
|
759
|
+
})] }), /* @__PURE__ */ h("div", {
|
|
758
760
|
className: "text-right",
|
|
759
|
-
children: [/* @__PURE__ */
|
|
761
|
+
children: [/* @__PURE__ */ m("p", {
|
|
760
762
|
className: "text-xs text-text-secondary mb-1",
|
|
761
763
|
children: _("billing.checkout.totalPaid", "Total Paid")
|
|
762
|
-
}), /* @__PURE__ */
|
|
764
|
+
}), /* @__PURE__ */ m("p", {
|
|
763
765
|
className: "font-bold text-lg text-text-primary",
|
|
764
766
|
children: e(F.total)
|
|
765
767
|
})]
|
|
766
768
|
})]
|
|
767
769
|
})
|
|
768
770
|
}),
|
|
769
|
-
F.paymentMethod === "credits" && /* @__PURE__ */
|
|
771
|
+
F.paymentMethod === "credits" && /* @__PURE__ */ h("div", {
|
|
770
772
|
className: "p-4 border-b border-border-subtle",
|
|
771
|
-
children: [/* @__PURE__ */
|
|
773
|
+
children: [/* @__PURE__ */ h("h3", {
|
|
772
774
|
className: "font-semibold text-text-primary mb-3 flex items-center gap-2",
|
|
773
|
-
children: [/* @__PURE__ */
|
|
774
|
-
}), /* @__PURE__ */
|
|
775
|
+
children: [/* @__PURE__ */ m(Ye, { className: "size-4" }), _("billing.checkout.creditBalance", "Credit Balance")]
|
|
776
|
+
}), /* @__PURE__ */ h("div", {
|
|
775
777
|
className: "flex items-center gap-4",
|
|
776
778
|
children: [
|
|
777
|
-
/* @__PURE__ */
|
|
779
|
+
/* @__PURE__ */ h("div", {
|
|
778
780
|
className: "flex-1 text-center p-3 rounded-lg bg-bg-sunken",
|
|
779
|
-
children: [/* @__PURE__ */
|
|
781
|
+
children: [/* @__PURE__ */ m("p", {
|
|
780
782
|
className: "text-xs text-text-secondary mb-1",
|
|
781
783
|
children: _("billing.checkout.previousBalance", "Previous Balance")
|
|
782
|
-
}), /* @__PURE__ */
|
|
784
|
+
}), /* @__PURE__ */ m("p", {
|
|
783
785
|
className: "font-semibold text-text-primary",
|
|
784
786
|
children: t(F.previousBalance)
|
|
785
787
|
})]
|
|
786
788
|
}),
|
|
787
|
-
/* @__PURE__ */
|
|
788
|
-
/* @__PURE__ */
|
|
789
|
+
/* @__PURE__ */ m(ze, { className: "size-5 text-text-secondary shrink-0" }),
|
|
790
|
+
/* @__PURE__ */ h("div", {
|
|
789
791
|
className: "flex-1 text-center p-3 rounded-lg bg-status-success-bg-subtle",
|
|
790
|
-
children: [/* @__PURE__ */
|
|
792
|
+
children: [/* @__PURE__ */ m("p", {
|
|
791
793
|
className: "text-xs text-text-secondary mb-1",
|
|
792
794
|
children: _("billing.checkout.newBalance", "New Balance")
|
|
793
|
-
}), /* @__PURE__ */
|
|
795
|
+
}), /* @__PURE__ */ m("p", {
|
|
794
796
|
className: "font-semibold text-status-success-text",
|
|
795
797
|
children: t(F.newBalance)
|
|
796
798
|
})]
|
|
@@ -798,22 +800,22 @@ var $e = () => {
|
|
|
798
800
|
]
|
|
799
801
|
})]
|
|
800
802
|
}),
|
|
801
|
-
/* @__PURE__ */
|
|
803
|
+
/* @__PURE__ */ m("div", {
|
|
802
804
|
className: "p-4 bg-bg-sunken",
|
|
803
|
-
children: /* @__PURE__ */
|
|
805
|
+
children: /* @__PURE__ */ h("div", {
|
|
804
806
|
className: "flex items-center justify-between",
|
|
805
|
-
children: [/* @__PURE__ */
|
|
807
|
+
children: [/* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("p", {
|
|
806
808
|
className: "text-xs text-text-secondary mb-1",
|
|
807
809
|
children: _("billing.checkout.billingAccount", "Billing Account")
|
|
808
|
-
}), /* @__PURE__ */
|
|
810
|
+
}), /* @__PURE__ */ m("p", {
|
|
809
811
|
className: "font-medium text-text-primary",
|
|
810
812
|
children: F.billingAccountName
|
|
811
|
-
})] }), F.transactionId && /* @__PURE__ */
|
|
813
|
+
})] }), F.transactionId && /* @__PURE__ */ h("div", {
|
|
812
814
|
className: "text-right",
|
|
813
|
-
children: [/* @__PURE__ */
|
|
815
|
+
children: [/* @__PURE__ */ m("p", {
|
|
814
816
|
className: "text-xs text-text-secondary mb-1",
|
|
815
817
|
children: _("billing.checkout.transactionId", "Transaction ID")
|
|
816
|
-
}), /* @__PURE__ */
|
|
818
|
+
}), /* @__PURE__ */ h("p", {
|
|
817
819
|
className: "font-mono text-xs text-text-secondary",
|
|
818
820
|
children: [F.transactionId.slice(0, 8), "..."]
|
|
819
821
|
})]
|
|
@@ -822,14 +824,14 @@ var $e = () => {
|
|
|
822
824
|
})
|
|
823
825
|
]
|
|
824
826
|
}),
|
|
825
|
-
/* @__PURE__ */
|
|
827
|
+
/* @__PURE__ */ h("div", {
|
|
826
828
|
className: "flex flex-col sm:flex-row gap-3 justify-center pt-2",
|
|
827
|
-
children: [/* @__PURE__ */
|
|
829
|
+
children: [/* @__PURE__ */ m("button", {
|
|
828
830
|
type: "button",
|
|
829
831
|
onClick: () => y("/overview"),
|
|
830
832
|
className: "px-6 py-3 text-sm font-medium bg-action-primary-bg text-action-primary-text rounded-lg hover:bg-action-primary-bgHover transition-colors",
|
|
831
833
|
children: _("billing.checkout.backToOverview", "Back to Overview")
|
|
832
|
-
}), /* @__PURE__ */
|
|
834
|
+
}), /* @__PURE__ */ m("button", {
|
|
833
835
|
type: "button",
|
|
834
836
|
onClick: () => y("/subscriptions"),
|
|
835
837
|
className: "px-6 py-3 text-sm font-medium border border-border-subtle text-text-primary rounded-lg hover:bg-bg-sunken transition-colors",
|
|
@@ -837,43 +839,43 @@ var $e = () => {
|
|
|
837
839
|
})]
|
|
838
840
|
})
|
|
839
841
|
]
|
|
840
|
-
}),
|
|
842
|
+
}), bt && St.length > 0 && w && wt && /* @__PURE__ */ m(ge, {
|
|
841
843
|
billingAccountId: F?.billingAccountId ?? "",
|
|
842
|
-
subscriptionId:
|
|
843
|
-
quotas:
|
|
844
|
-
workspaces:
|
|
844
|
+
subscriptionId: wt,
|
|
845
|
+
quotas: St,
|
|
846
|
+
workspaces: ht,
|
|
845
847
|
currentWorkspaceId: w,
|
|
846
|
-
onAssigned: () =>
|
|
847
|
-
onSkip: () =>
|
|
848
|
+
onAssigned: () => xt(!1),
|
|
849
|
+
onSkip: () => xt(!1)
|
|
848
850
|
})] });
|
|
849
851
|
}
|
|
850
|
-
if (j === "error") return /* @__PURE__ */
|
|
852
|
+
if (j === "error") return /* @__PURE__ */ m("div", {
|
|
851
853
|
className: "max-w-lg mx-auto p-6",
|
|
852
|
-
children: /* @__PURE__ */
|
|
854
|
+
children: /* @__PURE__ */ h("div", {
|
|
853
855
|
className: "text-center space-y-6",
|
|
854
856
|
children: [
|
|
855
|
-
/* @__PURE__ */
|
|
857
|
+
/* @__PURE__ */ m("div", {
|
|
856
858
|
className: "inline-flex p-4 rounded-full bg-status-error-bg-subtle text-status-error-text",
|
|
857
|
-
children: /* @__PURE__ */
|
|
859
|
+
children: /* @__PURE__ */ m(Xe, { className: "size-12" })
|
|
858
860
|
}),
|
|
859
|
-
/* @__PURE__ */
|
|
861
|
+
/* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("h1", {
|
|
860
862
|
className: "text-2xl font-bold text-text-primary",
|
|
861
863
|
children: _("billing.checkout.paymentFailed", "Payment Failed")
|
|
862
|
-
}), /* @__PURE__ */
|
|
864
|
+
}), /* @__PURE__ */ m("p", {
|
|
863
865
|
className: "text-text-secondary mt-2",
|
|
864
|
-
children:
|
|
866
|
+
children: Dt || It || L.error || _("billing.checkout.genericError", "Something went wrong. Please try again.")
|
|
865
867
|
})] }),
|
|
866
|
-
/* @__PURE__ */
|
|
868
|
+
/* @__PURE__ */ h("div", {
|
|
867
869
|
className: "flex gap-3 justify-center",
|
|
868
|
-
children: [/* @__PURE__ */
|
|
870
|
+
children: [/* @__PURE__ */ m("button", {
|
|
869
871
|
type: "button",
|
|
870
872
|
onClick: () => y(-1),
|
|
871
873
|
className: "px-4 py-2 rounded-lg border border-border-subtle hover:bg-bg-sunken",
|
|
872
874
|
children: _("billing.checkout.goBack", "Go Back")
|
|
873
|
-
}), /* @__PURE__ */
|
|
875
|
+
}), /* @__PURE__ */ m("button", {
|
|
874
876
|
type: "button",
|
|
875
877
|
onClick: () => {
|
|
876
|
-
M("select"), P(null),
|
|
878
|
+
M("select"), P(null), L.reset();
|
|
877
879
|
},
|
|
878
880
|
className: "px-4 py-2 rounded-lg bg-action-primary-bg text-action-primary-text hover:bg-action-primary-bgHover",
|
|
879
881
|
children: _("billing.checkout.tryAgain", "Try Again")
|
|
@@ -882,50 +884,50 @@ var $e = () => {
|
|
|
882
884
|
]
|
|
883
885
|
})
|
|
884
886
|
});
|
|
885
|
-
if (j === "processing") return /* @__PURE__ */
|
|
887
|
+
if (j === "processing") return /* @__PURE__ */ m("div", {
|
|
886
888
|
className: "max-w-lg mx-auto p-6",
|
|
887
|
-
children: /* @__PURE__ */
|
|
889
|
+
children: /* @__PURE__ */ h("div", {
|
|
888
890
|
className: "text-center space-y-6",
|
|
889
891
|
children: [
|
|
890
|
-
/* @__PURE__ */
|
|
892
|
+
/* @__PURE__ */ m("div", {
|
|
891
893
|
className: "inline-flex p-4 rounded-full bg-[var(--color-accent-soft)] text-text-link",
|
|
892
|
-
children: /* @__PURE__ */
|
|
894
|
+
children: /* @__PURE__ */ m(We, { className: "size-12 animate-spin" })
|
|
893
895
|
}),
|
|
894
|
-
/* @__PURE__ */
|
|
896
|
+
/* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("h1", {
|
|
895
897
|
className: "text-2xl font-bold text-text-primary",
|
|
896
898
|
children: _("billing.checkout.verifyingPayment", "Verifying Payment")
|
|
897
|
-
}), /* @__PURE__ */
|
|
899
|
+
}), /* @__PURE__ */ m("p", {
|
|
898
900
|
className: "text-text-secondary mt-2",
|
|
899
901
|
children: _("billing.checkout.verifyingPaymentDescription", "Please wait while we confirm your payment...")
|
|
900
902
|
})] }),
|
|
901
|
-
/* @__PURE__ */
|
|
903
|
+
/* @__PURE__ */ h("div", {
|
|
902
904
|
className: "bg-bg-sunken rounded-lg p-4",
|
|
903
|
-
children: [/* @__PURE__ */
|
|
905
|
+
children: [/* @__PURE__ */ h("p", {
|
|
904
906
|
className: "text-sm text-text-secondary",
|
|
905
907
|
children: [
|
|
906
908
|
_("billing.checkout.timeElapsed", "Time elapsed:"),
|
|
907
909
|
" ",
|
|
908
|
-
/* @__PURE__ */
|
|
910
|
+
/* @__PURE__ */ m("span", {
|
|
909
911
|
className: "font-mono font-medium text-text-primary",
|
|
910
912
|
children: ((e) => {
|
|
911
913
|
let t = Math.floor(e / 1e3);
|
|
912
914
|
return `${Math.floor(t / 60)}:${(t % 60).toString().padStart(2, "0")}`;
|
|
913
|
-
})(
|
|
915
|
+
})(Ft)
|
|
914
916
|
})
|
|
915
917
|
]
|
|
916
|
-
}), /* @__PURE__ */
|
|
918
|
+
}), /* @__PURE__ */ m("p", {
|
|
917
919
|
className: "text-xs text-text-secondary mt-1",
|
|
918
920
|
children: _("billing.checkout.keepPageOpen", "This may take a few moments. Please don't close this page.")
|
|
919
921
|
})]
|
|
920
922
|
}),
|
|
921
|
-
/* @__PURE__ */
|
|
923
|
+
/* @__PURE__ */ m("div", {
|
|
922
924
|
className: "w-full bg-bg-sunken rounded-full h-2 overflow-hidden",
|
|
923
|
-
children: /* @__PURE__ */
|
|
925
|
+
children: /* @__PURE__ */ m("div", {
|
|
924
926
|
className: "bg-action-primary-bg h-2 rounded-full transition-all duration-1000",
|
|
925
|
-
style: { width: `${Math.min(
|
|
927
|
+
style: { width: `${Math.min(Ft / 3e5 * 100, 100)}%` }
|
|
926
928
|
})
|
|
927
929
|
}),
|
|
928
|
-
|
|
930
|
+
Ft > 3e4 && /* @__PURE__ */ m("button", {
|
|
929
931
|
type: "button",
|
|
930
932
|
onClick: () => {
|
|
931
933
|
M("error"), P("Payment verification was cancelled. Please check your billing history.");
|
|
@@ -942,105 +944,105 @@ var $e = () => {
|
|
|
942
944
|
USD: "$",
|
|
943
945
|
EUR: "€",
|
|
944
946
|
GBP: "£"
|
|
945
|
-
}[t] || t + " "}${e.toFixed(2)}`, t = N.currency ||
|
|
946
|
-
return /* @__PURE__ */
|
|
947
|
+
}[t] || t + " "}${e.toFixed(2)}`, t = N.currency || L.selectedCurrency, n = N.total ?? L.total;
|
|
948
|
+
return /* @__PURE__ */ h("div", {
|
|
947
949
|
className: "max-w-2xl mx-auto p-4 sm:p-6 space-y-6",
|
|
948
950
|
children: [
|
|
949
|
-
/* @__PURE__ */
|
|
951
|
+
/* @__PURE__ */ h("button", {
|
|
950
952
|
type: "button",
|
|
951
953
|
onClick: () => M("select"),
|
|
952
954
|
className: "flex items-center gap-2 text-sm text-text-secondary hover:text-text-primary",
|
|
953
|
-
children: [/* @__PURE__ */
|
|
955
|
+
children: [/* @__PURE__ */ m(Re, { className: "size-4" }), _("billing.checkout.backToCheckout", "Back to checkout")]
|
|
954
956
|
}),
|
|
955
|
-
/* @__PURE__ */
|
|
957
|
+
/* @__PURE__ */ m(r, {
|
|
956
958
|
title: _("billing.checkout.completePayment", "Complete Payment"),
|
|
957
959
|
description: _("billing.checkout.completePaymentDescription", "Enter your payment details to complete the purchase")
|
|
958
960
|
}),
|
|
959
|
-
/* @__PURE__ */
|
|
961
|
+
/* @__PURE__ */ h("div", {
|
|
960
962
|
className: "rounded-lg border border-border-subtle bg-bg-surface p-4 space-y-4",
|
|
961
963
|
children: [
|
|
962
|
-
/* @__PURE__ */
|
|
964
|
+
/* @__PURE__ */ h("h3", {
|
|
963
965
|
className: "font-semibold text-text-primary flex items-center gap-2",
|
|
964
|
-
children: [/* @__PURE__ */
|
|
966
|
+
children: [/* @__PURE__ */ m(Ke, { className: "size-4" }), _("billing.checkout.paymentSummary", "Payment Summary")]
|
|
965
967
|
}),
|
|
966
|
-
|
|
968
|
+
L.billingAccount && /* @__PURE__ */ h("div", {
|
|
967
969
|
className: "p-3 bg-bg-sunken rounded-lg space-y-1",
|
|
968
970
|
children: [
|
|
969
|
-
/* @__PURE__ */
|
|
971
|
+
/* @__PURE__ */ m("div", {
|
|
970
972
|
className: "text-xs text-text-secondary uppercase tracking-wide",
|
|
971
973
|
children: _("billing.checkout.billingAccount", "Billing Account")
|
|
972
974
|
}),
|
|
973
|
-
/* @__PURE__ */
|
|
975
|
+
/* @__PURE__ */ m("div", {
|
|
974
976
|
className: "font-medium text-text-primary",
|
|
975
|
-
children:
|
|
977
|
+
children: L.billingAccount.name
|
|
976
978
|
}),
|
|
977
|
-
/* @__PURE__ */
|
|
979
|
+
/* @__PURE__ */ m("div", {
|
|
978
980
|
className: "text-sm text-text-secondary",
|
|
979
|
-
children:
|
|
981
|
+
children: L.billingAccount.email
|
|
980
982
|
})
|
|
981
983
|
]
|
|
982
984
|
}),
|
|
983
|
-
k === "ADDON" &&
|
|
985
|
+
k === "ADDON" && L.selectedSubscriptionId && G && /* @__PURE__ */ h("div", {
|
|
984
986
|
className: "p-3 bg-bg-sunken rounded-lg space-y-1",
|
|
985
987
|
children: [
|
|
986
|
-
/* @__PURE__ */
|
|
988
|
+
/* @__PURE__ */ m("div", {
|
|
987
989
|
className: "text-xs text-text-secondary uppercase tracking-wide",
|
|
988
990
|
children: _("billing.checkout.addingToSubscription", "Adding to Subscription")
|
|
989
991
|
}),
|
|
990
|
-
/* @__PURE__ */
|
|
992
|
+
/* @__PURE__ */ m("div", {
|
|
991
993
|
className: "font-medium text-text-primary",
|
|
992
|
-
children:
|
|
994
|
+
children: G.plan?.name || _("billing.checkout.subscription", "Subscription")
|
|
993
995
|
}),
|
|
994
|
-
|
|
996
|
+
G.plan?.product?.name && /* @__PURE__ */ m("div", {
|
|
995
997
|
className: "text-sm text-text-secondary",
|
|
996
|
-
children:
|
|
998
|
+
children: G.plan.product.name
|
|
997
999
|
})
|
|
998
1000
|
]
|
|
999
1001
|
}),
|
|
1000
|
-
/* @__PURE__ */
|
|
1002
|
+
/* @__PURE__ */ h("div", {
|
|
1001
1003
|
className: "space-y-2 text-sm",
|
|
1002
1004
|
children: [
|
|
1003
1005
|
(() => {
|
|
1004
|
-
let r =
|
|
1005
|
-
return /* @__PURE__ */
|
|
1006
|
-
/* @__PURE__ */
|
|
1006
|
+
let r = L.taxRate, i = r > 0 ? n / (1 + r) : n, a = r > 0 ? n - i : 0;
|
|
1007
|
+
return /* @__PURE__ */ h(p, { children: [
|
|
1008
|
+
/* @__PURE__ */ h("div", {
|
|
1007
1009
|
className: "flex justify-between",
|
|
1008
|
-
children: [/* @__PURE__ */
|
|
1010
|
+
children: [/* @__PURE__ */ m("span", {
|
|
1009
1011
|
className: "text-text-secondary",
|
|
1010
1012
|
children: _("billing.checkout.subtotal", "Subtotal")
|
|
1011
|
-
}), /* @__PURE__ */
|
|
1013
|
+
}), /* @__PURE__ */ m("span", {
|
|
1012
1014
|
className: "text-text-primary",
|
|
1013
1015
|
children: e(i, t)
|
|
1014
1016
|
})]
|
|
1015
1017
|
}),
|
|
1016
|
-
|
|
1018
|
+
L.discountAmount > 0 && /* @__PURE__ */ h("div", {
|
|
1017
1019
|
className: "flex justify-between text-status-success-text",
|
|
1018
|
-
children: [/* @__PURE__ */
|
|
1020
|
+
children: [/* @__PURE__ */ m("span", { children: _("billing.checkout.discount", "Discount") }), /* @__PURE__ */ h("span", { children: ["-", e(L.discountAmount, t)] })]
|
|
1019
1021
|
}),
|
|
1020
|
-
a > 0 && /* @__PURE__ */
|
|
1022
|
+
a > 0 && /* @__PURE__ */ h("div", {
|
|
1021
1023
|
className: "flex justify-between",
|
|
1022
|
-
children: [/* @__PURE__ */
|
|
1024
|
+
children: [/* @__PURE__ */ h("span", {
|
|
1023
1025
|
className: "text-text-secondary",
|
|
1024
1026
|
children: [
|
|
1025
|
-
|
|
1027
|
+
L.taxType || _("billing.checkout.tax", "Tax"),
|
|
1026
1028
|
" (",
|
|
1027
1029
|
(r * 100).toFixed(0),
|
|
1028
1030
|
"%)"
|
|
1029
1031
|
]
|
|
1030
|
-
}), /* @__PURE__ */
|
|
1032
|
+
}), /* @__PURE__ */ m("span", {
|
|
1031
1033
|
className: "text-text-primary",
|
|
1032
1034
|
children: e(a, t)
|
|
1033
1035
|
})]
|
|
1034
1036
|
})
|
|
1035
1037
|
] });
|
|
1036
1038
|
})(),
|
|
1037
|
-
/* @__PURE__ */
|
|
1038
|
-
/* @__PURE__ */
|
|
1039
|
+
/* @__PURE__ */ m("div", { className: "border-t border-border-subtle my-2" }),
|
|
1040
|
+
/* @__PURE__ */ h("div", {
|
|
1039
1041
|
className: "flex justify-between font-semibold",
|
|
1040
|
-
children: [/* @__PURE__ */
|
|
1042
|
+
children: [/* @__PURE__ */ m("span", {
|
|
1041
1043
|
className: "text-text-primary",
|
|
1042
1044
|
children: _("billing.checkout.total", "Total")
|
|
1043
|
-
}), /* @__PURE__ */
|
|
1045
|
+
}), /* @__PURE__ */ m("span", {
|
|
1044
1046
|
className: "text-lg text-text-primary",
|
|
1045
1047
|
children: e(n, t)
|
|
1046
1048
|
})]
|
|
@@ -1049,41 +1051,41 @@ var $e = () => {
|
|
|
1049
1051
|
})
|
|
1050
1052
|
]
|
|
1051
1053
|
}),
|
|
1052
|
-
|
|
1054
|
+
L.selectedProvider === "STRIPE" && N.clientSecret && /* @__PURE__ */ m("div", {
|
|
1053
1055
|
className: "rounded-lg border border-border-subtle bg-bg-surface overflow-hidden",
|
|
1054
|
-
children: /* @__PURE__ */
|
|
1056
|
+
children: /* @__PURE__ */ m("div", {
|
|
1055
1057
|
className: "p-4 space-y-4",
|
|
1056
|
-
children: /* @__PURE__ */
|
|
1058
|
+
children: /* @__PURE__ */ m(Se, {
|
|
1057
1059
|
clientSecret: N.clientSecret,
|
|
1058
|
-
publishableKey:
|
|
1059
|
-
amount: Math.round((N.total ??
|
|
1060
|
-
currency: N.currency ||
|
|
1061
|
-
onSuccess:
|
|
1062
|
-
onError:
|
|
1060
|
+
publishableKey: st || Mt?.stripePublishableKey || "",
|
|
1061
|
+
amount: Math.round((N.total ?? L.total) * 100),
|
|
1062
|
+
currency: N.currency || L.selectedCurrency,
|
|
1063
|
+
onSuccess: hn,
|
|
1064
|
+
onError: gn,
|
|
1063
1065
|
onCancel: () => M("select"),
|
|
1064
|
-
isCompletingExistingPayment: !!
|
|
1066
|
+
isCompletingExistingPayment: !!L.selectedPaymentMethodId
|
|
1065
1067
|
})
|
|
1066
1068
|
})
|
|
1067
1069
|
}),
|
|
1068
|
-
|
|
1070
|
+
L.selectedProvider === "RAZORPAY" && N.orderId && /* @__PURE__ */ m("div", {
|
|
1069
1071
|
className: "rounded-lg border border-border-subtle bg-bg-surface overflow-hidden",
|
|
1070
|
-
children: /* @__PURE__ */
|
|
1072
|
+
children: /* @__PURE__ */ h("div", {
|
|
1071
1073
|
className: "p-4 space-y-4",
|
|
1072
|
-
children: [/* @__PURE__ */
|
|
1074
|
+
children: [/* @__PURE__ */ h("label", {
|
|
1073
1075
|
className: "flex items-center gap-2 cursor-pointer",
|
|
1074
|
-
children: [/* @__PURE__ */
|
|
1076
|
+
children: [/* @__PURE__ */ m("input", {
|
|
1075
1077
|
type: "checkbox",
|
|
1076
|
-
checked:
|
|
1077
|
-
onChange: (e) =>
|
|
1078
|
+
checked: L.saveCard,
|
|
1079
|
+
onChange: (e) => L.setSaveCard(e.target.checked),
|
|
1078
1080
|
className: "size-4 rounded border-border-subtle text-text-link focus:ring-[var(--color-focus-ring)]"
|
|
1079
|
-
}), /* @__PURE__ */
|
|
1081
|
+
}), /* @__PURE__ */ m("span", {
|
|
1080
1082
|
className: "text-sm text-text-secondary",
|
|
1081
1083
|
children: "Save card for future purchases"
|
|
1082
1084
|
})]
|
|
1083
|
-
}), /* @__PURE__ */
|
|
1085
|
+
}), /* @__PURE__ */ m(Ce, {
|
|
1084
1086
|
orderId: N.orderId,
|
|
1085
|
-
keyId: N.razorpayKeyId ||
|
|
1086
|
-
amount: Math.round((N.total ??
|
|
1087
|
+
keyId: N.razorpayKeyId || ct || "",
|
|
1088
|
+
amount: Math.round((N.total ?? L.total) * 100),
|
|
1087
1089
|
currency: N.currency || "INR",
|
|
1088
1090
|
customerId: N.razorpayCustomerId,
|
|
1089
1091
|
prefill: {
|
|
@@ -1091,8 +1093,8 @@ var $e = () => {
|
|
|
1091
1093
|
email: N.prefillEmail,
|
|
1092
1094
|
contact: N.prefillContact
|
|
1093
1095
|
},
|
|
1094
|
-
onSuccess: (e) =>
|
|
1095
|
-
onError:
|
|
1096
|
+
onSuccess: (e) => hn(e.razorpay_payment_id),
|
|
1097
|
+
onError: gn,
|
|
1096
1098
|
onCancel: () => M("select")
|
|
1097
1099
|
})]
|
|
1098
1100
|
})
|
|
@@ -1100,316 +1102,335 @@ var $e = () => {
|
|
|
1100
1102
|
]
|
|
1101
1103
|
});
|
|
1102
1104
|
}
|
|
1103
|
-
|
|
1105
|
+
let $ = k === "PLAN" && R?.getPlan?.pricingModel === "PER_SEAT" ? /* @__PURE__ */ m("div", {
|
|
1106
|
+
className: g ? "px-4 pt-4" : "border-t border-border-subtle pt-4",
|
|
1107
|
+
children: /* @__PURE__ */ h("div", {
|
|
1108
|
+
className: "space-y-3",
|
|
1109
|
+
children: [/* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("label", {
|
|
1110
|
+
className: "text-sm font-medium text-text-primary",
|
|
1111
|
+
children: "Number of seats"
|
|
1112
|
+
}), R.getPlan.minSeats && /* @__PURE__ */ h("p", {
|
|
1113
|
+
className: "text-xs text-text-secondary mt-0.5",
|
|
1114
|
+
children: [
|
|
1115
|
+
"Minimum ",
|
|
1116
|
+
R.getPlan.minSeats,
|
|
1117
|
+
" seat",
|
|
1118
|
+
R.getPlan.minSeats === 1 ? "" : "s",
|
|
1119
|
+
" required"
|
|
1120
|
+
]
|
|
1121
|
+
})] }), /* @__PURE__ */ h("div", {
|
|
1122
|
+
className: "flex items-center gap-3",
|
|
1123
|
+
children: [
|
|
1124
|
+
/* @__PURE__ */ m("button", {
|
|
1125
|
+
type: "button",
|
|
1126
|
+
onClick: () => jt((e) => Math.max(R.getPlan?.minSeats ?? 1, e - 1)),
|
|
1127
|
+
disabled: I <= (R.getPlan.minSeats ?? 1),
|
|
1128
|
+
className: "size-9 rounded-button border border-border-subtle flex items-center justify-center hover:bg-action-ghost-bgHover disabled:opacity-40 disabled:cursor-not-allowed transition-colors text-text-primary",
|
|
1129
|
+
children: "−"
|
|
1130
|
+
}),
|
|
1131
|
+
/* @__PURE__ */ m("input", {
|
|
1132
|
+
type: "number",
|
|
1133
|
+
value: I,
|
|
1134
|
+
min: R.getPlan.minSeats ?? 1,
|
|
1135
|
+
max: R.getPlan.maxSeats ?? 999,
|
|
1136
|
+
onChange: (e) => {
|
|
1137
|
+
let t = parseInt(e.target.value, 10);
|
|
1138
|
+
isNaN(t) || jt(Math.max(R.getPlan?.minSeats ?? 1, t));
|
|
1139
|
+
},
|
|
1140
|
+
className: "w-20 h-9 text-center border border-border-subtle rounded-button bg-bg-surface text-text-primary text-sm focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
|
|
1141
|
+
}),
|
|
1142
|
+
/* @__PURE__ */ m("button", {
|
|
1143
|
+
type: "button",
|
|
1144
|
+
onClick: () => jt((e) => Math.min(R.getPlan?.maxSeats ?? 999, e + 1)),
|
|
1145
|
+
disabled: I >= (R.getPlan.maxSeats ?? 999),
|
|
1146
|
+
className: "size-9 rounded-button border border-border-subtle flex items-center justify-center hover:bg-action-ghost-bgHover disabled:opacity-40 disabled:cursor-not-allowed transition-colors text-text-primary",
|
|
1147
|
+
children: "+"
|
|
1148
|
+
}),
|
|
1149
|
+
R.getPlan.pricePerSeat && /* @__PURE__ */ h("span", {
|
|
1150
|
+
className: "text-sm text-text-secondary",
|
|
1151
|
+
children: [
|
|
1152
|
+
"×",
|
|
1153
|
+
" ",
|
|
1154
|
+
R.getPlan.pricePerSeat.toLocaleString("en", {
|
|
1155
|
+
style: "currency",
|
|
1156
|
+
currency: R.getPlan.currency ?? "USD"
|
|
1157
|
+
}),
|
|
1158
|
+
" ",
|
|
1159
|
+
"=",
|
|
1160
|
+
" ",
|
|
1161
|
+
(R.getPlan.pricePerSeat * I).toLocaleString("en", {
|
|
1162
|
+
style: "currency",
|
|
1163
|
+
currency: R.getPlan.currency ?? "USD"
|
|
1164
|
+
}),
|
|
1165
|
+
"/mo"
|
|
1166
|
+
]
|
|
1167
|
+
})
|
|
1168
|
+
]
|
|
1169
|
+
})]
|
|
1170
|
+
})
|
|
1171
|
+
}) : null, xn = L.selectedProvider === "CREDITS" ? null : /* @__PURE__ */ m("div", {
|
|
1172
|
+
className: g ? "px-4 pb-4 pt-4" : "px-4 pb-4 border-t border-border-subtle pt-4",
|
|
1173
|
+
children: /* @__PURE__ */ m(be, {
|
|
1174
|
+
value: L.promoCode,
|
|
1175
|
+
onChange: L.setPromoCode,
|
|
1176
|
+
onValidate: async () => await L.validatePromoCode(),
|
|
1177
|
+
onClear: L.clearPromoCode,
|
|
1178
|
+
isApplied: L.promoDiscount > 0,
|
|
1179
|
+
discountValue: L.promoDiscount,
|
|
1180
|
+
discountType: L.promoDiscountType,
|
|
1181
|
+
isValidating: L.isProcessing
|
|
1182
|
+
})
|
|
1183
|
+
}), Sn = k === "PLAN" && L.selectedProvider !== "CREDITS" && L.selectedProvider !== "AUTO" ? (() => {
|
|
1184
|
+
let e = "", t = !1, n = !1;
|
|
1185
|
+
if (L.selectedPaymentMethodId) {
|
|
1186
|
+
let r = J.find((e) => e.id === L.selectedPaymentMethodId);
|
|
1187
|
+
r && (e = `${r.type === "CREDIT_CARD" || r.type === "DEBIT_CARD" ? "Card" : r.type}${r.last4 ? ` •••• ${r.last4}` : ""}`, t = !0, n = !1);
|
|
1188
|
+
} else (L.selectedProvider === "RAZORPAY" || L.selectedProvider === "STRIPE") && (e = L.selectedProvider === "RAZORPAY" ? "new card (Razorpay)" : "new card (Stripe)", t = !0, n = !0);
|
|
1189
|
+
return /* @__PURE__ */ m("div", {
|
|
1190
|
+
className: g ? "px-4 pb-4 pt-4" : "px-4 pb-4",
|
|
1191
|
+
children: /* @__PURE__ */ m(Te, {
|
|
1192
|
+
enabled: L.autoRenew,
|
|
1193
|
+
onToggle: (e) => {
|
|
1194
|
+
L.setAutoRenew(e), e && L.selectedPaymentMethodId && L.setAutoRenewPaymentMethodId(L.selectedPaymentMethodId);
|
|
1195
|
+
},
|
|
1196
|
+
hasPaymentMethodSelected: t,
|
|
1197
|
+
selectedPaymentMethodDisplay: e,
|
|
1198
|
+
isNewCard: n
|
|
1199
|
+
})
|
|
1200
|
+
});
|
|
1201
|
+
})() : null, Cn = ee({
|
|
1202
|
+
seatCount: I,
|
|
1203
|
+
minSeats: R?.getPlan?.minSeats ?? 1,
|
|
1204
|
+
hasSeatOption: $ !== null,
|
|
1205
|
+
promoApplied: L.promoDiscount > 0,
|
|
1206
|
+
autoRenew: L.autoRenew,
|
|
1207
|
+
hasAutoRenewOption: Sn !== null
|
|
1208
|
+
}), wn = Cn.length > 0 ? _("billing.checkout.moreOptionsChanged", "{{count}} changed").replace("{{count}}", String(Cn.length)) : _("billing.checkout.moreOptionsHint", "Seats, promo code and auto-renew");
|
|
1209
|
+
return /* @__PURE__ */ h("div", {
|
|
1104
1210
|
className: "max-w-6xl mx-auto p-4 sm:p-6",
|
|
1105
1211
|
children: [
|
|
1106
|
-
/* @__PURE__ */
|
|
1212
|
+
/* @__PURE__ */ h("button", {
|
|
1107
1213
|
type: "button",
|
|
1108
1214
|
onClick: () => y(-1),
|
|
1109
1215
|
className: "flex items-center gap-2 text-sm text-text-secondary hover:text-text-primary mb-4",
|
|
1110
|
-
children: [/* @__PURE__ */
|
|
1216
|
+
children: [/* @__PURE__ */ m(Re, { className: "size-4" }), "Back"]
|
|
1111
1217
|
}),
|
|
1112
|
-
/* @__PURE__ */
|
|
1218
|
+
/* @__PURE__ */ h("div", {
|
|
1113
1219
|
className: "flex items-center gap-3 mb-6",
|
|
1114
|
-
children: [/* @__PURE__ */
|
|
1220
|
+
children: [/* @__PURE__ */ m("div", {
|
|
1115
1221
|
className: "p-2 rounded-lg bg-[var(--color-accent-soft)] text-text-link",
|
|
1116
|
-
children:
|
|
1117
|
-
}), /* @__PURE__ */
|
|
1222
|
+
children: bn()
|
|
1223
|
+
}), /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("h1", {
|
|
1118
1224
|
className: "text-2xl font-bold text-text-primary",
|
|
1119
|
-
children:
|
|
1120
|
-
}), /* @__PURE__ */
|
|
1225
|
+
children: yn()
|
|
1226
|
+
}), /* @__PURE__ */ m("p", {
|
|
1121
1227
|
className: "text-sm text-text-secondary",
|
|
1122
1228
|
children: "Complete your purchase securely"
|
|
1123
1229
|
})] })]
|
|
1124
1230
|
}),
|
|
1125
|
-
/* @__PURE__ */
|
|
1231
|
+
/* @__PURE__ */ m(Le, {
|
|
1126
1232
|
className: "mb-6",
|
|
1127
1233
|
children: _("billing.checkout.purpose", "Review what you are buying — plan, add-ons or credits — pick the billing account and payment method, apply any discount code, and pay. Taxes and the final total are shown before you confirm.")
|
|
1128
1234
|
}),
|
|
1129
|
-
x?.upgradeFromSubscriptionId && x?.currentPlanName && /* @__PURE__ */
|
|
1235
|
+
x?.upgradeFromSubscriptionId && x?.currentPlanName && /* @__PURE__ */ m("div", {
|
|
1130
1236
|
className: "mb-6 p-4 rounded-lg border border-border-subtle bg-status-info-bg-subtle",
|
|
1131
|
-
children: /* @__PURE__ */
|
|
1237
|
+
children: /* @__PURE__ */ h("div", {
|
|
1132
1238
|
className: "flex items-center gap-3",
|
|
1133
|
-
children: [/* @__PURE__ */
|
|
1239
|
+
children: [/* @__PURE__ */ m("div", {
|
|
1134
1240
|
className: "p-2 rounded-full bg-status-info-bg-subtle",
|
|
1135
|
-
children: /* @__PURE__ */
|
|
1136
|
-
}), /* @__PURE__ */
|
|
1241
|
+
children: /* @__PURE__ */ m(qe, { className: "size-4 text-accent-blue" })
|
|
1242
|
+
}), /* @__PURE__ */ h("div", {
|
|
1137
1243
|
className: "flex-1",
|
|
1138
|
-
children: [/* @__PURE__ */
|
|
1244
|
+
children: [/* @__PURE__ */ h("p", {
|
|
1139
1245
|
className: "text-sm font-medium text-status-info-text",
|
|
1140
1246
|
children: [
|
|
1141
1247
|
"Upgrading from:",
|
|
1142
1248
|
" ",
|
|
1143
|
-
/* @__PURE__ */
|
|
1249
|
+
/* @__PURE__ */ m("span", {
|
|
1144
1250
|
className: "font-semibold",
|
|
1145
1251
|
children: x.currentPlanName
|
|
1146
1252
|
})
|
|
1147
1253
|
]
|
|
1148
|
-
}), /* @__PURE__ */
|
|
1254
|
+
}), /* @__PURE__ */ m("p", {
|
|
1149
1255
|
className: "text-xs text-status-info-text mt-0.5",
|
|
1150
1256
|
children: "Your current subscription will be marked as upgraded and quotas will transfer to the new plan."
|
|
1151
1257
|
})]
|
|
1152
1258
|
})]
|
|
1153
1259
|
})
|
|
1154
1260
|
}),
|
|
1155
|
-
x?.downgradeFromSubscriptionId && x?.currentPlanName && /* @__PURE__ */
|
|
1261
|
+
x?.downgradeFromSubscriptionId && x?.currentPlanName && /* @__PURE__ */ m("div", {
|
|
1156
1262
|
className: "mb-6 p-4 rounded-lg border border-status-warning-border bg-status-warning-bg-subtle",
|
|
1157
|
-
children: /* @__PURE__ */
|
|
1263
|
+
children: /* @__PURE__ */ h("div", {
|
|
1158
1264
|
className: "flex items-center gap-3",
|
|
1159
|
-
children: [/* @__PURE__ */
|
|
1265
|
+
children: [/* @__PURE__ */ m("div", {
|
|
1160
1266
|
className: "p-2 rounded-full bg-status-warning-bg-subtle",
|
|
1161
|
-
children: /* @__PURE__ */
|
|
1162
|
-
}), /* @__PURE__ */
|
|
1267
|
+
children: /* @__PURE__ */ m(qe, { className: "size-4 text-status-warning-text" })
|
|
1268
|
+
}), /* @__PURE__ */ h("div", {
|
|
1163
1269
|
className: "flex-1",
|
|
1164
|
-
children: [/* @__PURE__ */
|
|
1270
|
+
children: [/* @__PURE__ */ h("p", {
|
|
1165
1271
|
className: "text-sm font-medium text-status-warning-text",
|
|
1166
1272
|
children: [
|
|
1167
1273
|
"Downgrading from:",
|
|
1168
1274
|
" ",
|
|
1169
|
-
/* @__PURE__ */
|
|
1275
|
+
/* @__PURE__ */ m("span", {
|
|
1170
1276
|
className: "font-semibold",
|
|
1171
1277
|
children: x.currentPlanName
|
|
1172
1278
|
})
|
|
1173
1279
|
]
|
|
1174
|
-
}), /* @__PURE__ */
|
|
1280
|
+
}), /* @__PURE__ */ m("p", {
|
|
1175
1281
|
className: "text-xs text-status-warning-text mt-0.5",
|
|
1176
1282
|
children: "Your current plan stays active until it expires, you keep all its features until then. After expiry, only the new plan applies."
|
|
1177
1283
|
})]
|
|
1178
1284
|
})]
|
|
1179
1285
|
})
|
|
1180
1286
|
}),
|
|
1181
|
-
/* @__PURE__ */
|
|
1287
|
+
/* @__PURE__ */ h("div", {
|
|
1182
1288
|
className: "grid gap-6 lg:grid-cols-5",
|
|
1183
|
-
children: [/* @__PURE__ */
|
|
1289
|
+
children: [/* @__PURE__ */ h("div", {
|
|
1184
1290
|
className: "lg:col-span-3 space-y-6 order-2 lg:order-1",
|
|
1185
1291
|
children: [
|
|
1186
|
-
k === "CREDITS" &&
|
|
1292
|
+
k === "CREDITS" && L.items[0] && /* @__PURE__ */ m("div", {
|
|
1187
1293
|
className: "rounded-lg border border-border-subtle bg-bg-surface p-4 sm:p-6",
|
|
1188
|
-
children: /* @__PURE__ */
|
|
1189
|
-
value:
|
|
1190
|
-
onChange:
|
|
1191
|
-
costPerCredit:
|
|
1192
|
-
currency:
|
|
1193
|
-
disabled:
|
|
1294
|
+
children: /* @__PURE__ */ m(xe, {
|
|
1295
|
+
value: L.items[0].quantity,
|
|
1296
|
+
onChange: _n,
|
|
1297
|
+
costPerCredit: q,
|
|
1298
|
+
currency: L.selectedCurrency,
|
|
1299
|
+
disabled: Qt
|
|
1194
1300
|
})
|
|
1195
1301
|
}),
|
|
1196
|
-
/* @__PURE__ */
|
|
1302
|
+
/* @__PURE__ */ h("div", {
|
|
1197
1303
|
className: "rounded-lg border border-border-subtle bg-bg-surface p-4 sm:p-6 space-y-4",
|
|
1198
|
-
children: [/* @__PURE__ */
|
|
1199
|
-
accounts:
|
|
1200
|
-
selectedAccountId:
|
|
1201
|
-
onSelect:
|
|
1202
|
-
isLoading:
|
|
1203
|
-
disabled:
|
|
1204
|
-
disabledMessage:
|
|
1205
|
-
}), k === "ADDON" && !O &&
|
|
1206
|
-
subscriptions:
|
|
1207
|
-
selectedSubscriptionId:
|
|
1208
|
-
onSelect:
|
|
1209
|
-
isLoading:
|
|
1304
|
+
children: [/* @__PURE__ */ m(ve, {
|
|
1305
|
+
accounts: Y,
|
|
1306
|
+
selectedAccountId: L.billingAccount?.id ?? null,
|
|
1307
|
+
onSelect: L.setBillingAccount,
|
|
1308
|
+
isLoading: Rt,
|
|
1309
|
+
disabled: fn,
|
|
1310
|
+
disabledMessage: fn ? "Billing account is locked for plan changes" : void 0
|
|
1311
|
+
}), k === "ADDON" && !O && L.billingAccount && /* @__PURE__ */ m(we, {
|
|
1312
|
+
subscriptions: W,
|
|
1313
|
+
selectedSubscriptionId: L.selectedSubscriptionId,
|
|
1314
|
+
onSelect: L.setSelectedSubscriptionId,
|
|
1315
|
+
isLoading: Yt
|
|
1210
1316
|
})]
|
|
1211
1317
|
}),
|
|
1212
|
-
|
|
1318
|
+
H && /* @__PURE__ */ m(ke, {
|
|
1213
1319
|
storeOrderId: v,
|
|
1214
|
-
currency:
|
|
1215
|
-
onChange:
|
|
1320
|
+
currency: L.selectedCurrency,
|
|
1321
|
+
onChange: Wt
|
|
1216
1322
|
}),
|
|
1217
|
-
/* @__PURE__ */
|
|
1323
|
+
/* @__PURE__ */ h("div", {
|
|
1218
1324
|
className: "rounded-lg border border-border-subtle bg-bg-surface p-4 sm:p-6 space-y-4",
|
|
1219
1325
|
children: [
|
|
1220
|
-
/* @__PURE__ */
|
|
1221
|
-
savedPaymentMethods:
|
|
1222
|
-
selectedPaymentMethodId:
|
|
1223
|
-
onSelectSavedCard:
|
|
1224
|
-
selectedProvider:
|
|
1225
|
-
onSelectProvider:
|
|
1226
|
-
stripeEnabled:
|
|
1227
|
-
razorpayEnabled:
|
|
1228
|
-
canPayWithCredits:
|
|
1229
|
-
availableCredits:
|
|
1230
|
-
creditsRequired:
|
|
1231
|
-
billingCountry:
|
|
1232
|
-
saveCard:
|
|
1233
|
-
onSaveCardChange:
|
|
1234
|
-
autoRenewEnabled: k === "PLAN" &&
|
|
1235
|
-
isLoading:
|
|
1326
|
+
/* @__PURE__ */ m(Ee, {
|
|
1327
|
+
savedPaymentMethods: J,
|
|
1328
|
+
selectedPaymentMethodId: L.selectedPaymentMethodId,
|
|
1329
|
+
onSelectSavedCard: L.setSelectedPaymentMethodId,
|
|
1330
|
+
selectedProvider: L.selectedProvider,
|
|
1331
|
+
onSelectProvider: L.setPaymentProvider,
|
|
1332
|
+
stripeEnabled: Nt,
|
|
1333
|
+
razorpayEnabled: Pt,
|
|
1334
|
+
canPayWithCredits: L.canPayWithCredits,
|
|
1335
|
+
availableCredits: L.availableCredits,
|
|
1336
|
+
creditsRequired: L.creditsRequired,
|
|
1337
|
+
billingCountry: X,
|
|
1338
|
+
saveCard: L.saveCard,
|
|
1339
|
+
onSaveCardChange: L.setSaveCard,
|
|
1340
|
+
autoRenewEnabled: k === "PLAN" && L.autoRenew,
|
|
1341
|
+
isLoading: qt
|
|
1236
1342
|
}),
|
|
1237
|
-
|
|
1343
|
+
L.selectedProvider !== "CREDITS" && L.selectedProvider !== "AUTO" && /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m("div", { className: "border-t border-border-subtle" }), /* @__PURE__ */ m("div", {
|
|
1238
1344
|
className: "bg-bg-sunken p-4 rounded-button",
|
|
1239
|
-
children: /* @__PURE__ */
|
|
1345
|
+
children: /* @__PURE__ */ h("div", {
|
|
1240
1346
|
className: "flex items-start gap-3",
|
|
1241
|
-
children: [/* @__PURE__ */
|
|
1347
|
+
children: [/* @__PURE__ */ m("svg", {
|
|
1242
1348
|
className: "size-5 text-text-secondary mt-0.5",
|
|
1243
1349
|
fill: "none",
|
|
1244
1350
|
stroke: "currentColor",
|
|
1245
1351
|
viewBox: "0 0 24 24",
|
|
1246
|
-
children: /* @__PURE__ */
|
|
1352
|
+
children: /* @__PURE__ */ m("path", {
|
|
1247
1353
|
strokeLinecap: "round",
|
|
1248
1354
|
strokeLinejoin: "round",
|
|
1249
1355
|
strokeWidth: 2,
|
|
1250
1356
|
d: "M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
|
|
1251
1357
|
})
|
|
1252
|
-
}), /* @__PURE__ */
|
|
1358
|
+
}), /* @__PURE__ */ h("div", {
|
|
1253
1359
|
className: "flex-1 text-sm",
|
|
1254
|
-
children: [/* @__PURE__ */
|
|
1360
|
+
children: [/* @__PURE__ */ h("p", {
|
|
1255
1361
|
className: "font-medium text-text-primary mb-1",
|
|
1256
|
-
children: ["Currency: ",
|
|
1257
|
-
}), /* @__PURE__ */
|
|
1362
|
+
children: ["Currency: ", L.selectedCurrency]
|
|
1363
|
+
}), /* @__PURE__ */ h("p", {
|
|
1258
1364
|
className: "text-text-secondary text-xs",
|
|
1259
1365
|
children: [
|
|
1260
1366
|
"All prices are shown in",
|
|
1261
1367
|
" ",
|
|
1262
|
-
/* @__PURE__ */
|
|
1368
|
+
/* @__PURE__ */ m("strong", {
|
|
1263
1369
|
className: "text-text-primary",
|
|
1264
|
-
children:
|
|
1370
|
+
children: L.selectedCurrency
|
|
1265
1371
|
}),
|
|
1266
1372
|
" ",
|
|
1267
1373
|
"based on your billing account settings.",
|
|
1268
|
-
|
|
1374
|
+
L.selectedCurrency === "INR" && " GST will be applied at checkout."
|
|
1269
1375
|
]
|
|
1270
1376
|
})]
|
|
1271
1377
|
})]
|
|
1272
1378
|
})
|
|
1273
1379
|
})] }),
|
|
1274
|
-
|
|
1275
|
-
className: "border-t border-border-subtle pt-4",
|
|
1276
|
-
children: /* @__PURE__ */ g("div", {
|
|
1277
|
-
className: "space-y-3",
|
|
1278
|
-
children: [/* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h("label", {
|
|
1279
|
-
className: "text-sm font-medium text-text-primary",
|
|
1280
|
-
children: "Number of seats"
|
|
1281
|
-
}), z.getPlan.minSeats && /* @__PURE__ */ g("p", {
|
|
1282
|
-
className: "text-xs text-text-secondary mt-0.5",
|
|
1283
|
-
children: [
|
|
1284
|
-
"Minimum ",
|
|
1285
|
-
z.getPlan.minSeats,
|
|
1286
|
-
" seat",
|
|
1287
|
-
z.getPlan.minSeats === 1 ? "" : "s",
|
|
1288
|
-
" required"
|
|
1289
|
-
]
|
|
1290
|
-
})] }), /* @__PURE__ */ g("div", {
|
|
1291
|
-
className: "flex items-center gap-3",
|
|
1292
|
-
children: [
|
|
1293
|
-
/* @__PURE__ */ h("button", {
|
|
1294
|
-
type: "button",
|
|
1295
|
-
onClick: () => L((e) => Math.max(z.getPlan?.minSeats ?? 1, e - 1)),
|
|
1296
|
-
disabled: I <= (z.getPlan.minSeats ?? 1),
|
|
1297
|
-
className: "size-9 rounded-button border border-border-subtle flex items-center justify-center hover:bg-action-ghost-bgHover disabled:opacity-40 disabled:cursor-not-allowed transition-colors text-text-primary",
|
|
1298
|
-
children: "−"
|
|
1299
|
-
}),
|
|
1300
|
-
/* @__PURE__ */ h("input", {
|
|
1301
|
-
type: "number",
|
|
1302
|
-
value: I,
|
|
1303
|
-
min: z.getPlan.minSeats ?? 1,
|
|
1304
|
-
max: z.getPlan.maxSeats ?? 999,
|
|
1305
|
-
onChange: (e) => {
|
|
1306
|
-
let t = parseInt(e.target.value, 10);
|
|
1307
|
-
isNaN(t) || L(Math.max(z.getPlan?.minSeats ?? 1, t));
|
|
1308
|
-
},
|
|
1309
|
-
className: "w-20 h-9 text-center border border-border-subtle rounded-button bg-bg-surface text-text-primary text-sm focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
|
|
1310
|
-
}),
|
|
1311
|
-
/* @__PURE__ */ h("button", {
|
|
1312
|
-
type: "button",
|
|
1313
|
-
onClick: () => L((e) => Math.min(z.getPlan?.maxSeats ?? 999, e + 1)),
|
|
1314
|
-
disabled: I >= (z.getPlan.maxSeats ?? 999),
|
|
1315
|
-
className: "size-9 rounded-button border border-border-subtle flex items-center justify-center hover:bg-action-ghost-bgHover disabled:opacity-40 disabled:cursor-not-allowed transition-colors text-text-primary",
|
|
1316
|
-
children: "+"
|
|
1317
|
-
}),
|
|
1318
|
-
z.getPlan.pricePerSeat && /* @__PURE__ */ g("span", {
|
|
1319
|
-
className: "text-sm text-text-secondary",
|
|
1320
|
-
children: [
|
|
1321
|
-
"×",
|
|
1322
|
-
" ",
|
|
1323
|
-
z.getPlan.pricePerSeat.toLocaleString("en", {
|
|
1324
|
-
style: "currency",
|
|
1325
|
-
currency: z.getPlan.currency ?? "USD"
|
|
1326
|
-
}),
|
|
1327
|
-
" ",
|
|
1328
|
-
"=",
|
|
1329
|
-
" ",
|
|
1330
|
-
(z.getPlan.pricePerSeat * I).toLocaleString("en", {
|
|
1331
|
-
style: "currency",
|
|
1332
|
-
currency: z.getPlan.currency ?? "USD"
|
|
1333
|
-
}),
|
|
1334
|
-
"/mo"
|
|
1335
|
-
]
|
|
1336
|
-
})
|
|
1337
|
-
]
|
|
1338
|
-
})]
|
|
1339
|
-
})
|
|
1340
|
-
})
|
|
1380
|
+
!g && $
|
|
1341
1381
|
]
|
|
1342
1382
|
})
|
|
1343
1383
|
]
|
|
1344
|
-
}), /* @__PURE__ */
|
|
1384
|
+
}), /* @__PURE__ */ m("div", {
|
|
1345
1385
|
className: "lg:col-span-2 order-1 lg:order-2",
|
|
1346
|
-
children: /* @__PURE__ */
|
|
1386
|
+
children: /* @__PURE__ */ h("div", {
|
|
1347
1387
|
className: "lg:sticky lg:top-6 space-y-4",
|
|
1348
1388
|
children: [
|
|
1349
|
-
/* @__PURE__ */
|
|
1389
|
+
/* @__PURE__ */ h("div", {
|
|
1350
1390
|
className: "rounded-lg border border-border-subtle bg-bg-surface",
|
|
1351
1391
|
children: [
|
|
1352
|
-
/* @__PURE__ */
|
|
1392
|
+
/* @__PURE__ */ m("div", {
|
|
1353
1393
|
className: "p-4",
|
|
1354
|
-
children: /* @__PURE__ */
|
|
1355
|
-
items:
|
|
1356
|
-
subtotal:
|
|
1357
|
-
discountAmount:
|
|
1358
|
-
taxAmount:
|
|
1359
|
-
taxRate:
|
|
1360
|
-
taxType:
|
|
1361
|
-
total:
|
|
1362
|
-
currency:
|
|
1363
|
-
isCalculatingTax:
|
|
1364
|
-
showInCredits:
|
|
1365
|
-
creditsRequired:
|
|
1366
|
-
onUpdateQuantity: k !== "PLAN" && k !== "ORDER" ?
|
|
1367
|
-
onRemoveItem:
|
|
1394
|
+
children: /* @__PURE__ */ m(ye, {
|
|
1395
|
+
items: L.items,
|
|
1396
|
+
subtotal: L.subtotal,
|
|
1397
|
+
discountAmount: L.discountAmount,
|
|
1398
|
+
taxAmount: L.taxAmount,
|
|
1399
|
+
taxRate: L.taxRate,
|
|
1400
|
+
taxType: L.taxType,
|
|
1401
|
+
total: L.total,
|
|
1402
|
+
currency: L.selectedCurrency,
|
|
1403
|
+
isCalculatingTax: L.isCalculatingTax,
|
|
1404
|
+
showInCredits: L.selectedProvider === "CREDITS",
|
|
1405
|
+
creditsRequired: L.creditsRequired,
|
|
1406
|
+
onUpdateQuantity: k !== "PLAN" && k !== "ORDER" ? L.updateItemQuantity : void 0,
|
|
1407
|
+
onRemoveItem: L.removeItem,
|
|
1368
1408
|
isEditable: k !== "PLAN" && k !== "ORDER"
|
|
1369
1409
|
})
|
|
1370
1410
|
}),
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
k === "PLAN" && R.selectedProvider !== "CREDITS" && R.selectedProvider !== "AUTO" && (() => {
|
|
1385
|
-
let e = "", t = !1, n = !1;
|
|
1386
|
-
if (R.selectedPaymentMethodId) {
|
|
1387
|
-
let r = Y.find((e) => e.id === R.selectedPaymentMethodId);
|
|
1388
|
-
r && (e = `${r.type === "CREDIT_CARD" || r.type === "DEBIT_CARD" ? "Card" : r.type}${r.last4 ? ` •••• ${r.last4}` : ""}`, t = !0, n = !1);
|
|
1389
|
-
} else (R.selectedProvider === "RAZORPAY" || R.selectedProvider === "STRIPE") && (e = R.selectedProvider === "RAZORPAY" ? "new card (Razorpay)" : "new card (Stripe)", t = !0, n = !0);
|
|
1390
|
-
return /* @__PURE__ */ h("div", {
|
|
1391
|
-
className: "px-4 pb-4",
|
|
1392
|
-
children: /* @__PURE__ */ h(Ce, {
|
|
1393
|
-
enabled: R.autoRenew,
|
|
1394
|
-
onToggle: (e) => {
|
|
1395
|
-
R.setAutoRenew(e), e && R.selectedPaymentMethodId && R.setAutoRenewPaymentMethodId(R.selectedPaymentMethodId);
|
|
1396
|
-
},
|
|
1397
|
-
hasPaymentMethodSelected: t,
|
|
1398
|
-
selectedPaymentMethodDisplay: e,
|
|
1399
|
-
isNewCard: n
|
|
1400
|
-
})
|
|
1401
|
-
});
|
|
1402
|
-
})()
|
|
1411
|
+
!g && xn,
|
|
1412
|
+
!g && Sn
|
|
1413
|
+
]
|
|
1414
|
+
}),
|
|
1415
|
+
g && ($ || xn || Sn) && /* @__PURE__ */ h(Ie, {
|
|
1416
|
+
storageKey: "billing.checkout.more",
|
|
1417
|
+
label: _("billing.checkout.moreOptions", "More options"),
|
|
1418
|
+
description: wn,
|
|
1419
|
+
contentClassName: "px-0 py-0 space-y-0",
|
|
1420
|
+
children: [
|
|
1421
|
+
$,
|
|
1422
|
+
xn,
|
|
1423
|
+
Sn
|
|
1403
1424
|
]
|
|
1404
1425
|
}),
|
|
1405
|
-
/* @__PURE__ */
|
|
1426
|
+
/* @__PURE__ */ m("button", {
|
|
1406
1427
|
type: "button",
|
|
1407
|
-
onClick:
|
|
1408
|
-
disabled:
|
|
1428
|
+
onClick: mn,
|
|
1429
|
+
disabled: L.isProcessing || !L.billingAccount || L.items.length === 0 || L.selectedProvider === "CREDITS" && !rn || k === "ADDON" && !O && Yt || k === "ADDON" && !O && W.length === 0 || k === "ADDON" && !O && !L.selectedSubscriptionId || H && (!U.shippingAddressId || !U.shippingMethodId),
|
|
1409
1430
|
className: "w-full px-6 py-4 rounded-lg bg-action-primary-bg text-action-primary-text font-semibold\n hover:bg-action-primary-bgHover disabled:opacity-50 disabled:cursor-not-allowed\n transition-colors flex items-center justify-center gap-2",
|
|
1410
|
-
children:
|
|
1431
|
+
children: L.isProcessing ? /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m(We, { className: "size-5 animate-spin" }), "Processing…"] }) : L.selectedProvider === "CREDITS" ? "Pay with Credits" : "Proceed to Payment"
|
|
1411
1432
|
}),
|
|
1412
|
-
/* @__PURE__ */
|
|
1433
|
+
/* @__PURE__ */ m("p", {
|
|
1413
1434
|
className: "text-center text-xs text-text-secondary",
|
|
1414
1435
|
children: "🔒 Secure checkout with 256-bit SSL encryption"
|
|
1415
1436
|
})
|
|
@@ -1417,21 +1438,21 @@ var $e = () => {
|
|
|
1417
1438
|
})
|
|
1418
1439
|
})]
|
|
1419
1440
|
}),
|
|
1420
|
-
|
|
1421
|
-
billingAccountId:
|
|
1422
|
-
hasPhone: !!
|
|
1423
|
-
hasAddress: !!(
|
|
1441
|
+
_t && L.billingAccount && /* @__PURE__ */ m(De, {
|
|
1442
|
+
billingAccountId: L.billingAccount.id,
|
|
1443
|
+
hasPhone: !!L.billingAccount.contactNumber?.trim(),
|
|
1444
|
+
hasAddress: !!(L.billingAccount.billingAddresses?.[0]?.line1?.trim() && L.billingAccount.billingAddresses?.[0]?.postalCode?.trim()),
|
|
1424
1445
|
onCompleted: () => {
|
|
1425
|
-
|
|
1426
|
-
let t = (e.data?.myBillingAccounts ?? []).map(
|
|
1427
|
-
t &&
|
|
1446
|
+
yt.current = !0, vt(!1), mn(), zt().then((e) => {
|
|
1447
|
+
let t = (e.data?.myBillingAccounts ?? []).map(nt).find((e) => e?.id === L.billingAccount?.id);
|
|
1448
|
+
t && L.setBillingAccount(t);
|
|
1428
1449
|
});
|
|
1429
1450
|
},
|
|
1430
|
-
onCancel: () =>
|
|
1451
|
+
onCancel: () => vt(!1)
|
|
1431
1452
|
})
|
|
1432
1453
|
]
|
|
1433
1454
|
});
|
|
1434
1455
|
};
|
|
1435
|
-
export {
|
|
1456
|
+
export { rt as CheckoutPage };
|
|
1436
1457
|
|
|
1437
1458
|
//# sourceMappingURL=CheckoutPage.js.map
|