@burdenoff/microfe-billing 2026.821.1 → 2026.825.2
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/BillingAdminRoutes.js.map +1 -1
- package/dist/billing/BillingRoot.js.map +1 -1
- package/dist/billing/BillingUserRoutes.js.map +1 -1
- package/dist/billing/hooks/useBillingAccountSelection.js.map +1 -1
- package/dist/billing/hooks/useBillingEventEmitter.js.map +1 -1
- package/dist/billing/hooks/useBillingNavigate.js.map +1 -1
- package/dist/billing/hooks/useBillingPermissions.js.map +1 -1
- package/dist/billing/hooks/useDefaultBillingCurrency.js.map +1 -1
- package/dist/billing/modules/addons/components/FloatingCartDrawer.js.map +1 -1
- package/dist/billing/modules/addons/hooks/useAddons.js.map +1 -1
- package/dist/billing/modules/addons/pages/AddonBrowseDetailPage.js.map +1 -1
- package/dist/billing/modules/addons/pages/AddonCreatePage.js.map +1 -1
- package/dist/billing/modules/addons/pages/AddonDetailPage.js.map +1 -1
- package/dist/billing/modules/addons/pages/AddonEditPage.js.map +1 -1
- package/dist/billing/modules/addons/pages/AddonsBrowsePage.js.map +1 -1
- package/dist/billing/modules/addons/pages/AddonsListPage.js.map +1 -1
- package/dist/billing/modules/addons/store/addonCartStore.js.map +1 -1
- package/dist/billing/modules/affiliate/api.js.map +1 -1
- package/dist/billing/modules/affiliate/pages/AffiliateDashboardPage.js +107 -107
- package/dist/billing/modules/affiliate/pages/AffiliateDashboardPage.js.map +1 -1
- package/dist/billing/modules/analytics/pages/AnalyticsPage.js +80 -81
- package/dist/billing/modules/analytics/pages/AnalyticsPage.js.map +1 -1
- package/dist/billing/modules/billing/hooks/useInvoices.js.map +1 -1
- package/dist/billing/modules/billing/hooks/useRefunds.js.map +1 -1
- package/dist/billing/modules/billing/hooks/useTransactions.js.map +1 -1
- package/dist/billing/modules/billing/pages/InvoiceDetailPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/InvoicesListPage.js +1 -1
- package/dist/billing/modules/billing/pages/InvoicesListPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/PaymentMethodsPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/RefundsPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/TransactionsPage.js.map +1 -1
- package/dist/billing/modules/billing/pages/UserRefundsPage.js +127 -127
- package/dist/billing/modules/billing/pages/UserRefundsPage.js.map +1 -1
- package/dist/billing/modules/checkout/components/BillingAccountSelector.js.map +1 -1
- package/dist/billing/modules/checkout/components/CompleteBillingAccountModal.js.map +1 -1
- package/dist/billing/modules/checkout/components/CreditsAmountInput.js.map +1 -1
- package/dist/billing/modules/checkout/components/NativeCheckoutView.js.map +1 -1
- package/dist/billing/modules/checkout/components/OrderSummary.js.map +1 -1
- package/dist/billing/modules/checkout/components/PromoCodeInput.js.map +1 -1
- package/dist/billing/modules/checkout/components/RazorpayPaymentButton.js.map +1 -1
- package/dist/billing/modules/checkout/components/SimpleAutoPayToggle.js.map +1 -1
- package/dist/billing/modules/checkout/components/StoreShippingSection.js.map +1 -1
- package/dist/billing/modules/checkout/components/StripePaymentForm.js.map +1 -1
- package/dist/billing/modules/checkout/components/SubscriptionSelector.js.map +1 -1
- package/dist/billing/modules/checkout/components/UnifiedPaymentMethodSelector.js.map +1 -1
- package/dist/billing/modules/checkout/components/WorkspaceQuotaAssignmentModal.js.map +1 -1
- package/dist/billing/modules/checkout/hooks/useCheckout.js +0 -1
- package/dist/billing/modules/checkout/hooks/useCheckout.js.map +1 -1
- package/dist/billing/modules/checkout/hooks/useNativeCheckout.js.map +1 -1
- package/dist/billing/modules/checkout/hooks/usePaymentProviders.js.map +1 -1
- package/dist/billing/modules/checkout/hooks/usePaymentStatusPolling.js.map +1 -1
- package/dist/billing/modules/checkout/hooks/useStoreShipping.js.map +1 -1
- package/dist/billing/modules/checkout/pages/CheckoutPage.js +412 -395
- package/dist/billing/modules/checkout/pages/CheckoutPage.js.map +1 -1
- package/dist/billing/modules/checkout/utils/storeOrder.js.map +1 -1
- package/dist/billing/modules/coupons/pages/CouponDetailPage.js.map +1 -1
- package/dist/billing/modules/coupons/pages/CouponsListPage.js.map +1 -1
- package/dist/billing/modules/coupons/pages/CreateCouponPage.js.map +1 -1
- package/dist/billing/modules/coupons/pages/EditCouponPage.js.map +1 -1
- package/dist/billing/modules/credits/hooks/useCredits.js.map +1 -1
- package/dist/billing/modules/credits/pages/AdminCreditsPage.js.map +1 -1
- package/dist/billing/modules/credits/pages/CreditTransactionsPage.js.map +1 -1
- package/dist/billing/modules/credits/pages/CreditWithdrawalPage.js.map +1 -1
- package/dist/billing/modules/credits/pages/CreditsPage.js.map +1 -1
- package/dist/billing/modules/dashboard/components/ActiveSubscriptionCard.js.map +1 -1
- package/dist/billing/modules/dashboard/components/AddPaymentMethodModal.js.map +1 -1
- package/dist/billing/modules/dashboard/components/BillingAccountCard.js.map +1 -1
- package/dist/billing/modules/dashboard/components/CreateBillingAccountModal.js.map +1 -1
- package/dist/billing/modules/dashboard/components/PaymentMethodsSection.js.map +1 -1
- package/dist/billing/modules/dashboard/components/RecommendedAddonsSection.js.map +1 -1
- package/dist/billing/modules/dashboard/hooks/useBillingOverviewData.js.map +1 -1
- package/dist/billing/modules/dashboard/hooks/useDashboard.js.map +1 -1
- package/dist/billing/modules/dashboard/pages/OverviewPage.js.map +1 -1
- package/dist/billing/modules/discounts/pages/DiscountsListPage.js.map +1 -1
- package/dist/billing/modules/earnings/api.js.map +1 -1
- package/dist/billing/modules/earnings/pages/DeveloperRevenueAdminPage.js +145 -145
- package/dist/billing/modules/earnings/pages/DeveloperRevenueAdminPage.js.map +1 -1
- package/dist/billing/modules/earnings/pages/EarningsPage.js +133 -133
- package/dist/billing/modules/earnings/pages/EarningsPage.js.map +1 -1
- package/dist/billing/modules/earnings/pages/PayoutAdminPage.js +7 -9
- package/dist/billing/modules/earnings/pages/PayoutAdminPage.js.map +1 -1
- package/dist/billing/modules/earnings/pages/PayoutsPage.js +95 -95
- package/dist/billing/modules/earnings/pages/PayoutsPage.js.map +1 -1
- package/dist/billing/modules/plans/constants/featuredQuotas.js.map +1 -1
- package/dist/billing/modules/plans/hooks/usePlans.js.map +1 -1
- package/dist/billing/modules/plans/hooks/useQuotas.js.map +1 -1
- package/dist/billing/modules/plans/pages/PlanAssignFreePage.js.map +1 -1
- package/dist/billing/modules/plans/pages/PlanBrowseDetailPage.js.map +1 -1
- package/dist/billing/modules/plans/pages/PlanCreatePage.js.map +1 -1
- package/dist/billing/modules/plans/pages/PlanDetailPage.js.map +1 -1
- package/dist/billing/modules/plans/pages/PlanEditPage.js.map +1 -1
- package/dist/billing/modules/plans/pages/PlansBrowsePage.js.map +1 -1
- package/dist/billing/modules/plans/pages/PlansListPage.js.map +1 -1
- package/dist/billing/modules/promotions/pages/CreatePromotionPage.js.map +1 -1
- package/dist/billing/modules/promotions/pages/PromotionsListPage.js.map +1 -1
- package/dist/billing/modules/quota/hooks/useQuotaTemplates.js.map +1 -1
- package/dist/billing/modules/quota/pages/QuotaAssignFreePage.js.map +1 -1
- package/dist/billing/modules/quota/pages/QuotaTemplateCreatePage.js.map +1 -1
- package/dist/billing/modules/quota/pages/QuotaTemplateDetailPage.js.map +1 -1
- package/dist/billing/modules/quota/pages/QuotaTemplateEditPage.js.map +1 -1
- package/dist/billing/modules/quota/pages/QuotaTemplatesListPage.js.map +1 -1
- package/dist/billing/modules/settings/pages/SettingsPage.js.map +1 -1
- package/dist/billing/modules/settings/pages/TeamPermissionsPage.js.map +1 -1
- package/dist/billing/modules/store/pages/StoreCheckoutPage.js +5 -6
- package/dist/billing/modules/store/pages/StoreCheckoutPage.js.map +1 -1
- package/dist/billing/modules/subscriptions/components/ManageSeatsModal.js.map +1 -1
- package/dist/billing/modules/subscriptions/hooks/useSubscriptions.js.map +1 -1
- package/dist/billing/modules/subscriptions/pages/SubscriptionDetailPage.js.map +1 -1
- package/dist/billing/modules/subscriptions/pages/SubscriptionsListPage.js.map +1 -1
- package/dist/billing/modules/subscriptions/pages/UpgradeSubscriptionPage.js.map +1 -1
- package/dist/billing/modules/usage/hooks/useUsage.js +14 -9
- package/dist/billing/modules/usage/hooks/useUsage.js.map +1 -1
- package/dist/billing/modules/usage/pages/UsagePage.js +481 -453
- package/dist/billing/modules/usage/pages/UsagePage.js.map +1 -1
- package/dist/billing/providers/BillingProvider.js.map +1 -1
- package/dist/billing/shared/components/AccessDenied.js.map +1 -1
- package/dist/billing/shared/components/ActorIdentity.js.map +1 -1
- package/dist/billing/shared/components/CurrencyPriceOverridesEditor.js.map +1 -1
- package/dist/billing/shared/components/EmptyState.js.map +1 -1
- package/dist/billing/shared/components/PageHeader.js.map +1 -1
- package/dist/billing/shared/components/ServerError.js.map +1 -1
- package/dist/billing/shared/components/StatCard.js.map +1 -1
- package/dist/billing/shared/hooks/useActorProfiles.js.map +1 -1
- package/dist/billing/shared/types/graphql.js.map +1 -1
- package/dist/billing/shared/ui/Card.js.map +1 -1
- package/dist/billing/shared/ui/MetricCard.js.map +1 -1
- package/dist/billing/shared/ui/ProgressBar.js.map +1 -1
- package/dist/billing/shared/ui/StatusPill.js.map +1 -1
- package/dist/billing/shared/utils/directBillingGraphql.js.map +1 -1
- package/dist/billing/shared/utils/error.js.map +1 -1
- package/dist/billing/shared/utils/format.js.map +1 -1
- package/dist/billing/shared/utils/gatewayGraphql.js.map +1 -1
- package/dist/billing/shared/utils/navigation.js.map +1 -1
- package/dist/billing/shared/utils/paymentTheme.js.map +1 -1
- package/dist/billing/shared/utils/planFeatureQuantity.js.map +1 -1
- package/dist/billing/shared/utils/status.js.map +1 -1
- package/dist/billing/shared/utils/tokens.js.map +1 -1
- package/dist/generated/global-operations.js +5 -1
- package/dist/generated/global-operations.js.map +1 -1
- package/dist/generated/global-types.js.map +1 -1
- package/dist/generated/wspace-operations.js +1 -1
- package/dist/generated/wspace-operations.js.map +1 -1
- package/dist/node_modules/@capacitor/core/dist/index.js +1 -1
- package/dist/node_modules/@capacitor/core/dist/index.js.map +1 -1
- package/package.json +13 -10
|
@@ -40,16 +40,28 @@ import { useI18n as Ye } from "@burdenoff/fe-libs/shared/providers/shell/I18nPro
|
|
|
40
40
|
import { getProfileScopedKey as Xe } from "@burdenoff/fe-libs/shared/utils";
|
|
41
41
|
import { PagePurpose as Ze } from "@burdenoff/fe-libs/ui";
|
|
42
42
|
//#region src/billing/modules/checkout/pages/CheckoutPage.tsx
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
function Qe(e) {
|
|
44
|
+
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 : {
|
|
45
|
+
...e,
|
|
46
|
+
id: e.id,
|
|
47
|
+
name: e.name,
|
|
48
|
+
email: e.email,
|
|
49
|
+
currency: e.currency,
|
|
50
|
+
creditAmount: e.creditAmount,
|
|
51
|
+
isActive: e.isActive,
|
|
52
|
+
billingAddresses: e.billingAddresses === null ? null : e.billingAddresses?.flatMap((e) => e ? [{ ...e }] : [])
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
var $e = () => {
|
|
56
|
+
let { t: $e } = Ye(), h = (e, t) => {
|
|
57
|
+
let n = $e(e);
|
|
46
58
|
return n === e ? t : n;
|
|
47
|
-
}, { planId:
|
|
59
|
+
}, { planId: et, addonId: tt, storeOrderId: g } = qe(), _ = se(), nt = Ke(), v = nt.state, rt = a(), { emit: y } = r(), { orgId: b, stripePublishableKey: it, razorpayKey: at, apiGatewayUrl: ot, authToken: st, currentUser: ct, workspaceId: x } = e(), { productSlug: lt } = Je(), ut = Ne(null), dt = x ? [{
|
|
48
60
|
id: x,
|
|
49
61
|
name: "Current workspace"
|
|
50
|
-
}] : [], { items: S, clearCart:
|
|
62
|
+
}] : [], { items: S, clearCart: ft, _hasHydrated: C } = oe(), w = nt.pathname.includes("/checkout/addons") && !tt, T = nt.pathname.includes("/checkout/store") && !!g, E = w ? "ADDON" : T ? "ORDER" : v?.purchaseType ?? (et ? "PLAN" : tt ? "ADDON" : "CREDITS"), D = v?.itemId ?? et ?? tt ?? g, [pt, mt] = u(!1), ht = Ne(!1), [gt, _t] = u(!1), [vt, yt] = u([]), [bt, xt] = u(null), [O, k] = u("select"), [A, St] = u(null), [Ct, j] = u(null), [M, wt] = u(null), [Tt, Et] = u("card");
|
|
51
63
|
c(() => {
|
|
52
|
-
if (
|
|
64
|
+
if (O !== "success" || !M) return;
|
|
53
65
|
let e = typeof window < "u" ? window.localStorage.getItem(Xe("boff-referral-attribution")) : null;
|
|
54
66
|
if (!e) return;
|
|
55
67
|
let t;
|
|
@@ -59,192 +71,197 @@ var Qe = () => {
|
|
|
59
71
|
return;
|
|
60
72
|
}
|
|
61
73
|
if (!t.journeyId && !t.codeId) return;
|
|
62
|
-
let n =
|
|
63
|
-
|
|
74
|
+
let n = M.transactionId || A?.paymentId || A?.orderId || g || D || E, r = `${t.journeyId ?? "journey"}:${n}`;
|
|
75
|
+
ut.current !== r && (ut.current = r, ce({
|
|
64
76
|
journeyId: t.journeyId,
|
|
65
77
|
codeId: t.codeId,
|
|
66
78
|
eventType: E === "ORDER" ? "STORE_PURCHASE" : "PAID_CONVERSION",
|
|
67
|
-
productSlug:
|
|
68
|
-
actorUserId:
|
|
69
|
-
orderId:
|
|
70
|
-
billingAccountId:
|
|
79
|
+
productSlug: lt,
|
|
80
|
+
actorUserId: ct?.id,
|
|
81
|
+
orderId: M.transactionId || A?.paymentId || A?.orderId,
|
|
82
|
+
billingAccountId: M.billingAccountId,
|
|
71
83
|
storeOrderId: E === "ORDER" ? g : void 0,
|
|
72
|
-
valueAmount:
|
|
73
|
-
currency:
|
|
84
|
+
valueAmount: M.total,
|
|
85
|
+
currency: M.currency,
|
|
74
86
|
mode: "billing-checkout",
|
|
75
87
|
metadata: {
|
|
76
88
|
purchaseType: E,
|
|
77
|
-
billingAccountName:
|
|
89
|
+
billingAccountName: M.billingAccountName
|
|
78
90
|
}
|
|
79
91
|
}, {
|
|
80
|
-
apiGatewayUrl:
|
|
81
|
-
authToken:
|
|
92
|
+
apiGatewayUrl: ot,
|
|
93
|
+
authToken: st,
|
|
82
94
|
orgId: b
|
|
83
95
|
}).catch(() => {
|
|
84
|
-
|
|
96
|
+
ut.current = null;
|
|
85
97
|
}));
|
|
86
98
|
}, [
|
|
87
|
-
at,
|
|
88
99
|
ot,
|
|
89
|
-
st
|
|
100
|
+
st,
|
|
101
|
+
ct?.id,
|
|
90
102
|
D,
|
|
91
|
-
|
|
103
|
+
O,
|
|
92
104
|
b,
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
105
|
+
A?.orderId,
|
|
106
|
+
A?.paymentId,
|
|
107
|
+
lt,
|
|
108
|
+
M,
|
|
97
109
|
E,
|
|
98
110
|
g
|
|
99
111
|
]);
|
|
100
|
-
let [
|
|
112
|
+
let [N, P] = u(1), F = le({
|
|
101
113
|
defaultCurrency: "USD",
|
|
102
114
|
upgradeFromSubscriptionId: v?.upgradeFromSubscriptionId,
|
|
103
115
|
downgradeFromSubscriptionId: v?.downgradeFromSubscriptionId
|
|
104
|
-
}), { config:
|
|
105
|
-
paymentId:
|
|
106
|
-
billingAccountId:
|
|
107
|
-
paymentType:
|
|
116
|
+
}), { config: Dt, stripeEnabled: Ot, razorpayEnabled: kt } = fe(), { elapsedTime: At, error: jt } = pe({
|
|
117
|
+
paymentId: O === "processing" ? A?.paymentId ?? null : null,
|
|
118
|
+
billingAccountId: F.billingAccount?.id ?? M?.billingAccountId ?? null,
|
|
119
|
+
paymentType: Tt,
|
|
108
120
|
pollingInterval: 5e3,
|
|
109
121
|
maxPollingTime: 3e5,
|
|
110
122
|
onSuccess: (e) => {
|
|
111
|
-
if (e.transactionId &&
|
|
123
|
+
if (e.transactionId && wt((t) => t && {
|
|
112
124
|
...t,
|
|
113
125
|
transactionId: e.transactionId
|
|
114
|
-
}),
|
|
115
|
-
let e = (
|
|
126
|
+
}), k("success"), w && ft(), (E === "PLAN" || E === "ADDON") && x) {
|
|
127
|
+
let e = (I?.getPlan?.features ?? []).filter((e) => e != null).filter((e) => e.quota?.name && Ae(e.quota.name)).map((e) => {
|
|
116
128
|
let t = e.quota?.limits, n = t && "value" in t ? Number(t.value) : null, r = t && "type" in t ? String(t.type) : "number";
|
|
117
129
|
return {
|
|
118
130
|
quotaName: e.quota.name,
|
|
119
|
-
productId:
|
|
131
|
+
productId: I?.getPlan?.context?.productId ?? "platform",
|
|
120
132
|
limit: r === "number" ? n : null,
|
|
121
133
|
noLimit: r !== "number",
|
|
122
134
|
resetPeriod: "NEVER",
|
|
123
135
|
quotaMode: "dedicated"
|
|
124
136
|
};
|
|
125
137
|
});
|
|
126
|
-
e.length > 0 && (
|
|
138
|
+
e.length > 0 && (yt(e), Gt().then((e) => {
|
|
127
139
|
let t = e.data?.getActiveSubscriptions?.find((e) => e.planId === D);
|
|
128
|
-
t &&
|
|
129
|
-
}), (
|
|
140
|
+
t && xt(t.id);
|
|
141
|
+
}), (dt.length === 1 || dt.length > 1) && _t(!0));
|
|
130
142
|
}
|
|
131
143
|
},
|
|
132
144
|
onFailure: (e) => {
|
|
133
|
-
|
|
145
|
+
j(e.failureReason || "Payment failed"), k("error");
|
|
134
146
|
},
|
|
135
147
|
onTimeout: () => {
|
|
136
|
-
|
|
148
|
+
j("Payment verification timed out. Please check your billing history for the payment status."), k("error");
|
|
137
149
|
}
|
|
138
|
-
}), { data:
|
|
150
|
+
}), { data: Mt, loading: Nt, refetch: Pt } = ee({}), { data: I, loading: Ft } = re({
|
|
139
151
|
variables: { id: D },
|
|
140
152
|
skip: E !== "PLAN" || !D
|
|
141
|
-
}), { data:
|
|
153
|
+
}), { data: L, loading: It } = ie({
|
|
142
154
|
variables: { addonIDs: D ? [D] : [] },
|
|
143
155
|
skip: E !== "ADDON" || !D || T
|
|
144
|
-
}), { data:
|
|
156
|
+
}), { data: R } = ae({
|
|
145
157
|
variables: { id: g },
|
|
146
158
|
skip: !T || !g
|
|
147
|
-
}),
|
|
148
|
-
let e =
|
|
159
|
+
}), Lt = l(() => {
|
|
160
|
+
let e = R?.getStoreOrder?.lineItems;
|
|
149
161
|
return Array.isArray(e) ? e : [];
|
|
150
|
-
}, [
|
|
162
|
+
}, [R]), z = T && Lt.some((e) => String(e.itemType).toUpperCase() === "PHYSICAL"), Rt = Me(R?.getStoreOrder?.currency), [B, zt] = u({
|
|
151
163
|
shippingAddressId: null,
|
|
152
164
|
shippingMethodId: null,
|
|
153
165
|
shippingCost: 0,
|
|
154
166
|
destinationCountry: null
|
|
155
|
-
}), [
|
|
156
|
-
variables: { billingAccountId:
|
|
157
|
-
skip: !
|
|
158
|
-
}), { data:
|
|
159
|
-
variables: { billingAccountId:
|
|
160
|
-
skip: !
|
|
161
|
-
}),
|
|
167
|
+
}), [Bt] = De(), { data: Vt, loading: Ht } = ne({
|
|
168
|
+
variables: { billingAccountId: F.billingAccount?.id },
|
|
169
|
+
skip: !F.billingAccount?.id
|
|
170
|
+
}), { data: Ut, loading: Wt, refetch: Gt } = o({
|
|
171
|
+
variables: { billingAccountId: F.billingAccount?.id },
|
|
172
|
+
skip: !F.billingAccount?.id || E !== "ADDON" && E !== "PLAN" || T
|
|
173
|
+
}), V = l(() => Ut?.getActiveSubscriptions ?? [], [Ut]), H = l(() => !F.selectedSubscriptionId || V.length === 0 ? null : V.find((e) => e.id === F.selectedSubscriptionId) ?? null, [F.selectedSubscriptionId, V]), U = F.items[0]?.type === "CREDITS" ? F.items[0].quantity : 100, { data: Kt, loading: qt } = te({
|
|
162
174
|
variables: {
|
|
163
|
-
creditAmount:
|
|
164
|
-
currency:
|
|
175
|
+
creditAmount: U,
|
|
176
|
+
currency: F.selectedCurrency || "USD"
|
|
165
177
|
},
|
|
166
178
|
skip: E !== "CREDITS"
|
|
167
|
-
}),
|
|
168
|
-
if (!
|
|
169
|
-
let e =
|
|
179
|
+
}), W = l(() => Kt?.getCostOfCredits?.amount && U > 0 ? Kt.getCostOfCredits.amount / U : .01, [Kt, U]), G = l(() => Vt?.getPaymentMethods ?? [], [Vt]), K = l(() => Mt?.myBillingAccounts ?? [], [Mt]), q = l(() => {
|
|
180
|
+
if (!F.billingAccount) return;
|
|
181
|
+
let e = K.find((e) => e.id === F.billingAccount?.id)?.billingAddresses;
|
|
170
182
|
if (e && e.length > 0) return e[0]?.country || void 0;
|
|
171
|
-
}, [
|
|
183
|
+
}, [F.billingAccount, K]), [Jt, Yt] = u(null);
|
|
172
184
|
c(() => {
|
|
173
|
-
if (
|
|
185
|
+
if (q) if (q === "IN") F.selectedCurrency !== "INR" && F.setCurrency("INR"), kt && Jt !== q && F.selectedProvider !== "CREDITS" && (F.setPaymentProvider("RAZORPAY"), Yt(q));
|
|
174
186
|
else {
|
|
175
|
-
if (
|
|
176
|
-
let e =
|
|
177
|
-
|
|
187
|
+
if (F.selectedCurrency === "INR") {
|
|
188
|
+
let e = F.billingAccount?.currency, t = e && e !== "INR" ? e : "USD";
|
|
189
|
+
F.setCurrency(t);
|
|
178
190
|
}
|
|
179
|
-
|
|
191
|
+
F.selectedProvider === "RAZORPAY" && (F.setPaymentProvider("STRIPE"), Yt(q));
|
|
180
192
|
}
|
|
181
193
|
}, [
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
])
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
+
q,
|
|
195
|
+
F.selectedCurrency,
|
|
196
|
+
F.selectedProvider,
|
|
197
|
+
F.setCurrency,
|
|
198
|
+
F.setPaymentProvider,
|
|
199
|
+
F.billingAccount?.currency,
|
|
200
|
+
kt,
|
|
201
|
+
Jt
|
|
202
|
+
]);
|
|
203
|
+
let { availableCredits: Xt, billingAccount: Zt, canPayWithCredits: Qt, selectedCurrency: J, selectedPaymentMethodId: $t, selectedProvider: en, setCurrency: Y, setPaymentProvider: X, setSelectedPaymentMethodId: tn, total: nn } = F;
|
|
204
|
+
c(() => {
|
|
205
|
+
if (!Zt?.currency || q === "IN") return;
|
|
206
|
+
let e = Zt.currency;
|
|
207
|
+
e !== "INR" && J !== e && Y(e);
|
|
194
208
|
}, [
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
R.setCurrency
|
|
209
|
+
q,
|
|
210
|
+
Zt,
|
|
211
|
+
J,
|
|
212
|
+
Y
|
|
200
213
|
]), c(() => {
|
|
201
|
-
if (
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
R.setPaymentProvider("CREDITS"), R.setSelectedPaymentMethodId(null);
|
|
205
|
-
return;
|
|
206
|
-
}
|
|
207
|
-
if (J.length > 0 && !R.selectedPaymentMethodId) {
|
|
208
|
-
let e = J.find((e) => e.isDefault && e.isVerified), t = J.find((e) => e.isVerified), n = e || t;
|
|
209
|
-
if (n) {
|
|
210
|
-
R.setSelectedPaymentMethodId(n.id), n.razorpayPaymentMethodId ? R.setPaymentProvider("RAZORPAY") : n.stripePaymentMethodId && R.setPaymentProvider("STRIPE");
|
|
214
|
+
if (!(en !== "AUTO" && en !== null)) {
|
|
215
|
+
if (Qt && Xt >= nn) {
|
|
216
|
+
X("CREDITS"), tn(null);
|
|
211
217
|
return;
|
|
212
218
|
}
|
|
219
|
+
if (G.length > 0 && !$t) {
|
|
220
|
+
let e = G.find((e) => e.isDefault && e.isVerified), t = G.find((e) => e.isVerified), n = e || t;
|
|
221
|
+
if (n) {
|
|
222
|
+
tn(n.id), n.razorpayPaymentMethodId ? X("RAZORPAY") : n.stripePaymentMethodId && X("STRIPE");
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
213
226
|
}
|
|
214
227
|
}, [
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
228
|
+
Xt,
|
|
229
|
+
Qt,
|
|
230
|
+
nn,
|
|
231
|
+
G,
|
|
232
|
+
$t,
|
|
233
|
+
en,
|
|
234
|
+
X,
|
|
235
|
+
tn
|
|
219
236
|
]);
|
|
220
237
|
let [Z, Q] = u(!1);
|
|
221
238
|
c(() => {
|
|
222
|
-
if (!T || Z || !
|
|
223
|
-
let e = Me(
|
|
224
|
-
|
|
239
|
+
if (!T || Z || !R?.getStoreOrder) return;
|
|
240
|
+
let e = Me(R.getStoreOrder.currency);
|
|
241
|
+
J !== e && Y(e);
|
|
225
242
|
}, [
|
|
226
243
|
T,
|
|
227
244
|
Z,
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
R
|
|
245
|
+
J,
|
|
246
|
+
Y,
|
|
247
|
+
R
|
|
231
248
|
]), c(() => {
|
|
232
|
-
if (E === "PLAN" &&
|
|
233
|
-
let e =
|
|
234
|
-
|
|
249
|
+
if (E === "PLAN" && I?.getPlan?.pricingModel === "PER_SEAT") {
|
|
250
|
+
let e = I.getPlan.minSeats ?? 1;
|
|
251
|
+
P((t) => t < e ? e : t);
|
|
235
252
|
}
|
|
236
|
-
}, [
|
|
237
|
-
E === "PLAN" &&
|
|
238
|
-
}, [
|
|
253
|
+
}, [I, E]), c(() => {
|
|
254
|
+
E === "PLAN" && I?.getPlan?.pricingModel === "PER_SEAT" && Z && Q(!1);
|
|
255
|
+
}, [N]), c(() => {
|
|
239
256
|
if (!Z) {
|
|
240
257
|
if (w && C && S.length > 0) {
|
|
241
|
-
|
|
258
|
+
F.clearItems();
|
|
242
259
|
for (let e of S) {
|
|
243
260
|
let t = e.addon, n = t.features?.map((e) => ({
|
|
244
261
|
id: e.quota?.id || e.id,
|
|
245
262
|
name: e.quota?.name || "Feature",
|
|
246
263
|
limits: e.quota?.limits
|
|
247
|
-
})) || [], r =
|
|
264
|
+
})) || [], r = F.selectedCurrency || "USD", i = t.currencyPrices?.[r] ?? t.price, a = {
|
|
248
265
|
id: t.id,
|
|
249
266
|
type: "ADDON",
|
|
250
267
|
name: t.name,
|
|
@@ -256,25 +273,25 @@ var Qe = () => {
|
|
|
256
273
|
features: n,
|
|
257
274
|
metadata: { addonId: t.id }
|
|
258
275
|
};
|
|
259
|
-
|
|
276
|
+
F.addItem(a);
|
|
260
277
|
}
|
|
261
278
|
Q(!0);
|
|
262
279
|
return;
|
|
263
280
|
}
|
|
264
|
-
if (E === "PLAN" &&
|
|
265
|
-
let e =
|
|
281
|
+
if (E === "PLAN" && I?.getPlan) {
|
|
282
|
+
let e = I.getPlan, t = e.features?.map((e) => ({
|
|
266
283
|
id: e.quota?.id || e.id,
|
|
267
284
|
name: e.quota?.name || "Feature",
|
|
268
285
|
limits: e.quota?.limits
|
|
269
|
-
})) || [], n =
|
|
286
|
+
})) || [], n = F.selectedCurrency || "USD", r = e.currencyPrices, i = e.pricingModel === "PER_SEAT", a;
|
|
270
287
|
if (i && e.pricePerSeat) {
|
|
271
288
|
let t = r?.[n];
|
|
272
|
-
a = (typeof t == "object" && t?.perSeat ? t.perSeat : e.pricePerSeat) *
|
|
289
|
+
a = (typeof t == "object" && t?.perSeat ? t.perSeat : e.pricePerSeat) * N;
|
|
273
290
|
} else {
|
|
274
291
|
let t = r?.[n];
|
|
275
292
|
a = typeof t == "number" ? t : e.price;
|
|
276
293
|
}
|
|
277
|
-
let o = i ?
|
|
294
|
+
let o = i ? N : 1, ee = {
|
|
278
295
|
id: e.id,
|
|
279
296
|
type: "PLAN",
|
|
280
297
|
name: e.name,
|
|
@@ -290,13 +307,13 @@ var Qe = () => {
|
|
|
290
307
|
seatCount: i ? o : void 0
|
|
291
308
|
}
|
|
292
309
|
};
|
|
293
|
-
|
|
294
|
-
} else if (E === "ADDON" && !w &&
|
|
295
|
-
let e =
|
|
310
|
+
F.addItem(ee), Q(!0);
|
|
311
|
+
} else if (E === "ADDON" && !w && L?.getSelectedAddons?.[0]) {
|
|
312
|
+
let e = L.getSelectedAddons[0], t = e.features?.map((e) => ({
|
|
296
313
|
id: e.quota?.id || e.id,
|
|
297
314
|
name: e.quota?.name || "Feature",
|
|
298
315
|
limits: e.quota?.limits
|
|
299
|
-
})) || [], n =
|
|
316
|
+
})) || [], n = F.selectedCurrency || "USD", r = e.currencyPrices?.[n] ?? e.price, i = {
|
|
300
317
|
id: e.id,
|
|
301
318
|
type: "ADDON",
|
|
302
319
|
name: e.name,
|
|
@@ -308,10 +325,10 @@ var Qe = () => {
|
|
|
308
325
|
features: t,
|
|
309
326
|
metadata: { addonId: e.id }
|
|
310
327
|
};
|
|
311
|
-
|
|
312
|
-
} else if (T &&
|
|
313
|
-
let e =
|
|
314
|
-
for (let e of t)
|
|
328
|
+
F.addItem(i), Q(!0);
|
|
329
|
+
} else if (T && R?.getStoreOrder) {
|
|
330
|
+
let e = R.getStoreOrder, t = je(e);
|
|
331
|
+
for (let e of t) F.addItem(e);
|
|
315
332
|
Q(!0);
|
|
316
333
|
} else if (E === "CREDITS") {
|
|
317
334
|
let e = {
|
|
@@ -319,48 +336,48 @@ var Qe = () => {
|
|
|
319
336
|
type: "CREDITS",
|
|
320
337
|
name: "Credits",
|
|
321
338
|
description: "Purchase credits for your account",
|
|
322
|
-
price:
|
|
323
|
-
currency:
|
|
339
|
+
price: W,
|
|
340
|
+
currency: F.selectedCurrency || "USD",
|
|
324
341
|
quantity: 100
|
|
325
342
|
};
|
|
326
|
-
|
|
343
|
+
F.addItem(e), Q(!0);
|
|
327
344
|
}
|
|
328
345
|
}
|
|
329
346
|
}, [
|
|
330
347
|
E,
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
348
|
+
I,
|
|
349
|
+
L,
|
|
350
|
+
R,
|
|
351
|
+
F.addItem,
|
|
352
|
+
F.clearItems,
|
|
336
353
|
v?.quantity,
|
|
337
354
|
Z,
|
|
338
355
|
w,
|
|
339
356
|
T,
|
|
340
357
|
S,
|
|
341
358
|
C,
|
|
342
|
-
|
|
343
|
-
|
|
359
|
+
W,
|
|
360
|
+
F.selectedCurrency
|
|
344
361
|
]), c(() => {
|
|
345
|
-
if (!(!T || !Z ||
|
|
346
|
-
for (let e of
|
|
347
|
-
let t = e.price *
|
|
348
|
-
|
|
362
|
+
if (!(!T || !Z || F.conversionRate <= 1)) {
|
|
363
|
+
for (let e of F.items) if (e.type === "ORDER" && e.currency !== F.selectedCurrency) {
|
|
364
|
+
let t = e.price * F.conversionRate;
|
|
365
|
+
F.updateItemPrice(e.id, t, F.selectedCurrency);
|
|
349
366
|
}
|
|
350
367
|
}
|
|
351
368
|
}, [
|
|
352
369
|
T,
|
|
353
370
|
Z,
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
371
|
+
F.conversionRate,
|
|
372
|
+
F.selectedCurrency,
|
|
373
|
+
F.updateItemPrice
|
|
357
374
|
]);
|
|
358
375
|
let $ = Ne(null);
|
|
359
376
|
c(() => {
|
|
360
|
-
if (
|
|
361
|
-
let e =
|
|
377
|
+
if (z) if (B.shippingCost > 0) {
|
|
378
|
+
let e = F.selectedCurrency, t = Rt !== e && F.conversionRate > 1 ? B.shippingCost * F.conversionRate : B.shippingCost, n = $.current;
|
|
362
379
|
if (n && n.price === t && n.currency === e) return;
|
|
363
|
-
n === null ?
|
|
380
|
+
n === null ? F.addItem({
|
|
364
381
|
id: Ee,
|
|
365
382
|
type: "ORDER",
|
|
366
383
|
name: "Shipping",
|
|
@@ -371,89 +388,89 @@ var Qe = () => {
|
|
|
371
388
|
storeOrderId: g,
|
|
372
389
|
isShipping: !0
|
|
373
390
|
}
|
|
374
|
-
}) :
|
|
391
|
+
}) : F.updateItemPrice(Ee, t, e), $.current = {
|
|
375
392
|
price: t,
|
|
376
393
|
currency: e
|
|
377
394
|
};
|
|
378
|
-
} else $.current !== null && ($.current = null,
|
|
395
|
+
} else $.current !== null && ($.current = null, F.removeItem(Ee));
|
|
379
396
|
}, [
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
397
|
+
z,
|
|
398
|
+
B.shippingCost,
|
|
399
|
+
Rt,
|
|
400
|
+
F.selectedCurrency,
|
|
401
|
+
F.conversionRate,
|
|
385
402
|
g,
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
403
|
+
F.addItem,
|
|
404
|
+
F.updateItemPrice,
|
|
405
|
+
F.removeItem
|
|
389
406
|
]), c(() => {
|
|
390
|
-
if (E === "CREDITS" && Z &&
|
|
391
|
-
let e =
|
|
392
|
-
e && e.price !==
|
|
407
|
+
if (E === "CREDITS" && Z && W > 0) {
|
|
408
|
+
let e = F.items.find((e) => e.id === "credits-purchase");
|
|
409
|
+
e && e.price !== W && F.updateItemPrice("credits-purchase", W);
|
|
393
410
|
}
|
|
394
411
|
}, [
|
|
395
412
|
E,
|
|
396
413
|
Z,
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
414
|
+
W,
|
|
415
|
+
F.items,
|
|
416
|
+
F.updateItemPrice
|
|
400
417
|
]), c(() => {
|
|
401
|
-
if (!Z ||
|
|
402
|
-
let e =
|
|
403
|
-
for (let t of
|
|
404
|
-
let n =
|
|
405
|
-
(t.price !== n || t.currency !== e) &&
|
|
418
|
+
if (!Z || F.items.length === 0) return;
|
|
419
|
+
let e = F.selectedCurrency || "USD";
|
|
420
|
+
for (let t of F.items) if (t.type === "PLAN" && I?.getPlan) {
|
|
421
|
+
let n = I.getPlan.currencyPrices?.[e] ?? I.getPlan.price;
|
|
422
|
+
(t.price !== n || t.currency !== e) && F.updateItemPrice(t.id, n, e);
|
|
406
423
|
} else if (t.type === "ADDON") {
|
|
407
|
-
if (!w &&
|
|
408
|
-
let n =
|
|
409
|
-
(t.price !== r || t.currency !== e) &&
|
|
424
|
+
if (!w && L?.getSelectedAddons?.[0]) {
|
|
425
|
+
let n = L.getSelectedAddons[0], r = n.currencyPrices?.[e] ?? n.price;
|
|
426
|
+
(t.price !== r || t.currency !== e) && F.updateItemPrice(t.id, r, e);
|
|
410
427
|
}
|
|
411
428
|
if (w) {
|
|
412
429
|
let n = S.find((e) => e.addon.id === t.id);
|
|
413
430
|
if (n) {
|
|
414
431
|
let r = n.addon.currencyPrices?.[e] ?? n.addon.price;
|
|
415
|
-
(t.price !== r || t.currency !== e) &&
|
|
432
|
+
(t.price !== r || t.currency !== e) && F.updateItemPrice(t.id, r, e);
|
|
416
433
|
}
|
|
417
434
|
}
|
|
418
435
|
}
|
|
419
436
|
}, [
|
|
420
|
-
|
|
437
|
+
F.selectedCurrency,
|
|
421
438
|
Z,
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
439
|
+
F.items,
|
|
440
|
+
F.updateItemPrice,
|
|
441
|
+
I,
|
|
442
|
+
L,
|
|
426
443
|
S,
|
|
427
444
|
w
|
|
428
445
|
]), c(() => {
|
|
429
|
-
if (
|
|
446
|
+
if (K.length > 0 && !F.billingAccount) {
|
|
430
447
|
if (v?.billingAccountId) {
|
|
431
|
-
let e =
|
|
448
|
+
let e = K.find((e) => e.id === v.billingAccountId);
|
|
432
449
|
if (e) {
|
|
433
|
-
|
|
450
|
+
F.setBillingAccount(e);
|
|
434
451
|
return;
|
|
435
452
|
}
|
|
436
453
|
}
|
|
437
454
|
if (b) {
|
|
438
455
|
let e = i(b);
|
|
439
456
|
if (e) {
|
|
440
|
-
let t =
|
|
457
|
+
let t = K.find((t) => t.id === e);
|
|
441
458
|
if (t) {
|
|
442
|
-
|
|
459
|
+
F.setBillingAccount(t);
|
|
443
460
|
return;
|
|
444
461
|
}
|
|
445
462
|
}
|
|
446
463
|
}
|
|
447
|
-
|
|
464
|
+
F.setBillingAccount(K[0]);
|
|
448
465
|
}
|
|
449
466
|
}, [
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
467
|
+
K,
|
|
468
|
+
F.billingAccount,
|
|
469
|
+
F.setBillingAccount,
|
|
453
470
|
v?.billingAccountId,
|
|
454
471
|
b
|
|
455
472
|
]);
|
|
456
|
-
let
|
|
473
|
+
let rn = !!(v?.upgradeFromSubscriptionId || v?.downgradeFromSubscriptionId);
|
|
457
474
|
c(() => {
|
|
458
475
|
w && C && S.length === 0 && !Z && _("/addons", { replace: !0 });
|
|
459
476
|
}, [
|
|
@@ -463,70 +480,70 @@ var Qe = () => {
|
|
|
463
480
|
Z,
|
|
464
481
|
_
|
|
465
482
|
]);
|
|
466
|
-
let
|
|
467
|
-
billingAccountId:
|
|
483
|
+
let an = de({
|
|
484
|
+
billingAccountId: F.billingAccount?.id,
|
|
468
485
|
purchaseType: E,
|
|
469
486
|
productId: D
|
|
470
|
-
}),
|
|
471
|
-
if (!
|
|
472
|
-
let e =
|
|
473
|
-
if (
|
|
474
|
-
|
|
487
|
+
}), on = s(async () => {
|
|
488
|
+
if (!F.billingAccount) return;
|
|
489
|
+
let e = ht.current;
|
|
490
|
+
if (ht.current = !1, !e && !Te(F.billingAccount)) {
|
|
491
|
+
mt(!0);
|
|
475
492
|
return;
|
|
476
493
|
}
|
|
477
|
-
if (
|
|
478
|
-
let e = (await
|
|
494
|
+
if (j(null), z) try {
|
|
495
|
+
let e = (await Bt({ variables: { input: {
|
|
479
496
|
orderId: g,
|
|
480
|
-
shippingMethodId:
|
|
481
|
-
...
|
|
497
|
+
shippingMethodId: B.shippingMethodId,
|
|
498
|
+
...B.shippingAddressId ? { shippingAddressId: B.shippingAddressId } : {}
|
|
482
499
|
} } })).data?.setStoreOrderShipping?.shippingCost;
|
|
483
|
-
typeof e == "number" && e !==
|
|
500
|
+
typeof e == "number" && e !== B.shippingCost && zt((t) => ({
|
|
484
501
|
...t,
|
|
485
502
|
shippingCost: e
|
|
486
503
|
}));
|
|
487
504
|
} catch {
|
|
488
|
-
|
|
505
|
+
j("Could not save your shipping details. Please review your delivery address and try again."), k("error");
|
|
489
506
|
return;
|
|
490
507
|
}
|
|
491
|
-
let t =
|
|
508
|
+
let t = F.billingAccount.creditAmount ?? 0, n = [...F.items], r = F.total, i = await F.initiatePayment();
|
|
492
509
|
if (i.success) {
|
|
493
510
|
if (y("billing.checkout.initiated", {
|
|
494
511
|
route: "/billing/checkout",
|
|
495
512
|
entityId: i.paymentId ?? i.orderId,
|
|
496
513
|
source: "checkout",
|
|
497
514
|
amount: i.total || r,
|
|
498
|
-
currency: i.currency ||
|
|
499
|
-
}),
|
|
515
|
+
currency: i.currency || F.selectedCurrency
|
|
516
|
+
}), F.selectedProvider === "CREDITS") {
|
|
500
517
|
y("billing.credits.spent", {
|
|
501
518
|
route: "/billing/checkout",
|
|
502
519
|
entityId: i.orderId,
|
|
503
520
|
source: "checkout",
|
|
504
521
|
amount: r,
|
|
505
522
|
currency: "CREDITS"
|
|
506
|
-
}),
|
|
523
|
+
}), wt({
|
|
507
524
|
items: n,
|
|
508
525
|
total: r,
|
|
509
|
-
billingAccountName:
|
|
510
|
-
billingAccountId:
|
|
526
|
+
billingAccountName: F.billingAccount.name,
|
|
527
|
+
billingAccountId: F.billingAccount.id,
|
|
511
528
|
previousBalance: t,
|
|
512
529
|
newBalance: t - r,
|
|
513
530
|
paymentMethod: "credits",
|
|
514
531
|
currency: "Credits",
|
|
515
532
|
transactionId: i.orderId
|
|
516
|
-
}),
|
|
533
|
+
}), Et("credits"), St({ paymentId: i.orderId }), k("processing");
|
|
517
534
|
return;
|
|
518
535
|
}
|
|
519
|
-
|
|
536
|
+
wt({
|
|
520
537
|
items: n,
|
|
521
538
|
total: i.total || r,
|
|
522
|
-
billingAccountName:
|
|
523
|
-
billingAccountId:
|
|
539
|
+
billingAccountName: F.billingAccount.name,
|
|
540
|
+
billingAccountId: F.billingAccount.id,
|
|
524
541
|
previousBalance: t,
|
|
525
542
|
newBalance: t,
|
|
526
543
|
paymentMethod: "card",
|
|
527
|
-
currency: i.currency ||
|
|
544
|
+
currency: i.currency || F.selectedCurrency,
|
|
528
545
|
transactionId: i.paymentId
|
|
529
|
-
}),
|
|
546
|
+
}), Et("card"), St({
|
|
530
547
|
clientSecret: i.clientSecret,
|
|
531
548
|
orderId: i.orderId,
|
|
532
549
|
razorpayKeyId: i.razorpayKeyId,
|
|
@@ -538,56 +555,56 @@ var Qe = () => {
|
|
|
538
555
|
prefillContact: i.prefillContact,
|
|
539
556
|
total: i.total,
|
|
540
557
|
currency: i.currency
|
|
541
|
-
}), i.paymentComplete ?
|
|
558
|
+
}), i.paymentComplete ? k("processing") : k("payment");
|
|
542
559
|
} else y("billing.checkout.failed", {
|
|
543
560
|
route: "/billing/checkout",
|
|
544
561
|
source: "checkout",
|
|
545
562
|
reason: i.error || "Payment initiation failed"
|
|
546
|
-
}),
|
|
563
|
+
}), j(i.error || "Payment initiation failed"), k("error");
|
|
547
564
|
}, [
|
|
548
|
-
|
|
565
|
+
F,
|
|
549
566
|
y,
|
|
550
|
-
|
|
551
|
-
|
|
567
|
+
z,
|
|
568
|
+
B,
|
|
552
569
|
g,
|
|
553
|
-
|
|
554
|
-
]),
|
|
570
|
+
Bt
|
|
571
|
+
]), sn = s((e) => {
|
|
555
572
|
y("billing.payment.succeeded", {
|
|
556
573
|
route: "/billing/checkout",
|
|
557
|
-
entityId:
|
|
574
|
+
entityId: A?.paymentId ?? A?.orderId,
|
|
558
575
|
source: "checkout"
|
|
559
|
-
}),
|
|
576
|
+
}), St((e) => e), k("processing");
|
|
560
577
|
}, [
|
|
561
578
|
y,
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
]),
|
|
579
|
+
A?.orderId,
|
|
580
|
+
A?.paymentId
|
|
581
|
+
]), cn = s((e) => {
|
|
565
582
|
y("billing.payment.failed", {
|
|
566
583
|
route: "/billing/checkout",
|
|
567
|
-
entityId:
|
|
584
|
+
entityId: A?.paymentId ?? A?.orderId,
|
|
568
585
|
source: "checkout",
|
|
569
586
|
reason: e
|
|
570
|
-
}),
|
|
587
|
+
}), j(e), k("error");
|
|
571
588
|
}, [
|
|
572
589
|
y,
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
]),
|
|
576
|
-
|
|
577
|
-
}, [
|
|
578
|
-
if (!
|
|
590
|
+
A?.orderId,
|
|
591
|
+
A?.paymentId
|
|
592
|
+
]), ln = s((e) => {
|
|
593
|
+
F.updateItemQuantity("credits-purchase", e);
|
|
594
|
+
}, [F]);
|
|
595
|
+
if (!rt.canProcessPayment) return /* @__PURE__ */ p(t, { message: "You don't have permission to make purchases." });
|
|
579
596
|
if (ue()) return /* @__PURE__ */ p(me, {
|
|
580
597
|
purchaseType: E,
|
|
581
598
|
productId: D,
|
|
582
|
-
billingAccountId:
|
|
583
|
-
nativeCheckout:
|
|
599
|
+
billingAccountId: F.billingAccount?.id,
|
|
600
|
+
nativeCheckout: an,
|
|
584
601
|
onBack: () => _("dashboard")
|
|
585
602
|
});
|
|
586
|
-
let
|
|
603
|
+
let un = Nt || Ft && E === "PLAN" || It && E === "ADDON" && !w || w && !C;
|
|
587
604
|
if (w && C && S.length === 0 && !Z) return null;
|
|
588
|
-
let
|
|
605
|
+
let dn = () => {
|
|
589
606
|
if (w) {
|
|
590
|
-
let e =
|
|
607
|
+
let e = F.items.length;
|
|
591
608
|
return `Purchase ${e} Add-on${e === 1 ? "" : "s"}`;
|
|
592
609
|
}
|
|
593
610
|
switch (E) {
|
|
@@ -596,7 +613,7 @@ var Qe = () => {
|
|
|
596
613
|
case "ADDON": return "Purchase Add-on";
|
|
597
614
|
default: return "Checkout";
|
|
598
615
|
}
|
|
599
|
-
},
|
|
616
|
+
}, fn = () => {
|
|
600
617
|
switch (E) {
|
|
601
618
|
case "CREDITS": return /* @__PURE__ */ p(Re, { className: "size-6" });
|
|
602
619
|
case "PLAN": return /* @__PURE__ */ p(Be, { className: "size-6" });
|
|
@@ -604,7 +621,7 @@ var Qe = () => {
|
|
|
604
621
|
default: return /* @__PURE__ */ p(Ue, { className: "size-6" });
|
|
605
622
|
}
|
|
606
623
|
};
|
|
607
|
-
if (
|
|
624
|
+
if (un) return /* @__PURE__ */ p("div", {
|
|
608
625
|
className: "flex items-center justify-center min-h-[400px]",
|
|
609
626
|
children: /* @__PURE__ */ m("div", {
|
|
610
627
|
className: "text-center space-y-4",
|
|
@@ -614,10 +631,10 @@ var Qe = () => {
|
|
|
614
631
|
})]
|
|
615
632
|
})
|
|
616
633
|
});
|
|
617
|
-
if (
|
|
634
|
+
if (O === "success") {
|
|
618
635
|
let e = (e) => {
|
|
619
|
-
if (!
|
|
620
|
-
let t =
|
|
636
|
+
if (!M) return `${e.toFixed(2)}`;
|
|
637
|
+
let t = M.currency;
|
|
621
638
|
return t === "Credits" ? `${e.toFixed(2)} Credits` : `${{
|
|
622
639
|
INR: "₹",
|
|
623
640
|
USD: "$",
|
|
@@ -641,7 +658,7 @@ var Qe = () => {
|
|
|
641
658
|
children: h("billing.checkout.purchaseCompleted", "Your purchase has been completed successfully.")
|
|
642
659
|
})] })]
|
|
643
660
|
}),
|
|
644
|
-
|
|
661
|
+
M && /* @__PURE__ */ m("div", {
|
|
645
662
|
className: "bg-bg-surface border border-border-subtle rounded-lg overflow-hidden",
|
|
646
663
|
children: [
|
|
647
664
|
/* @__PURE__ */ m("div", {
|
|
@@ -651,7 +668,7 @@ var Qe = () => {
|
|
|
651
668
|
children: [/* @__PURE__ */ p(Ve, { className: "size-4" }), h("billing.checkout.itemsPurchased", "Items Purchased")]
|
|
652
669
|
}), /* @__PURE__ */ p("div", {
|
|
653
670
|
className: "space-y-2",
|
|
654
|
-
children:
|
|
671
|
+
children: M.items.map((t) => /* @__PURE__ */ m("div", {
|
|
655
672
|
className: "flex items-center justify-between",
|
|
656
673
|
children: [/* @__PURE__ */ m("div", {
|
|
657
674
|
className: "flex items-center gap-2",
|
|
@@ -685,7 +702,7 @@ var Qe = () => {
|
|
|
685
702
|
children: h("billing.checkout.paymentMethod", "Payment Method")
|
|
686
703
|
}), /* @__PURE__ */ p("div", {
|
|
687
704
|
className: "flex items-center gap-2",
|
|
688
|
-
children:
|
|
705
|
+
children: M.paymentMethod === "credits" ? /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(We, { className: "size-4 text-status-warning-text" }), /* @__PURE__ */ p("span", {
|
|
689
706
|
className: "font-medium text-text-primary",
|
|
690
707
|
children: h("billing.checkout.credits", "Credits")
|
|
691
708
|
})] }) : /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(ze, { className: "size-4 text-accent-blue" }), /* @__PURE__ */ p("span", {
|
|
@@ -699,12 +716,12 @@ var Qe = () => {
|
|
|
699
716
|
children: h("billing.checkout.totalPaid", "Total Paid")
|
|
700
717
|
}), /* @__PURE__ */ p("p", {
|
|
701
718
|
className: "font-bold text-lg text-text-primary",
|
|
702
|
-
children: e(
|
|
719
|
+
children: e(M.total)
|
|
703
720
|
})]
|
|
704
721
|
})]
|
|
705
722
|
})
|
|
706
723
|
}),
|
|
707
|
-
|
|
724
|
+
M.paymentMethod === "credits" && /* @__PURE__ */ m("div", {
|
|
708
725
|
className: "p-4 border-b border-border-subtle",
|
|
709
726
|
children: [/* @__PURE__ */ m("h3", {
|
|
710
727
|
className: "font-semibold text-text-primary mb-3 flex items-center gap-2",
|
|
@@ -719,7 +736,7 @@ var Qe = () => {
|
|
|
719
736
|
children: h("billing.checkout.previousBalance", "Previous Balance")
|
|
720
737
|
}), /* @__PURE__ */ p("p", {
|
|
721
738
|
className: "font-semibold text-text-primary",
|
|
722
|
-
children: t(
|
|
739
|
+
children: t(M.previousBalance)
|
|
723
740
|
})]
|
|
724
741
|
}),
|
|
725
742
|
/* @__PURE__ */ p(Fe, { className: "size-5 text-text-secondary shrink-0" }),
|
|
@@ -730,7 +747,7 @@ var Qe = () => {
|
|
|
730
747
|
children: h("billing.checkout.newBalance", "New Balance")
|
|
731
748
|
}), /* @__PURE__ */ p("p", {
|
|
732
749
|
className: "font-semibold text-status-success-text",
|
|
733
|
-
children: t(
|
|
750
|
+
children: t(M.newBalance)
|
|
734
751
|
})]
|
|
735
752
|
})
|
|
736
753
|
]
|
|
@@ -745,15 +762,15 @@ var Qe = () => {
|
|
|
745
762
|
children: h("billing.checkout.billingAccount", "Billing Account")
|
|
746
763
|
}), /* @__PURE__ */ p("p", {
|
|
747
764
|
className: "font-medium text-text-primary",
|
|
748
|
-
children:
|
|
749
|
-
})] }),
|
|
765
|
+
children: M.billingAccountName
|
|
766
|
+
})] }), M.transactionId && /* @__PURE__ */ m("div", {
|
|
750
767
|
className: "text-right",
|
|
751
768
|
children: [/* @__PURE__ */ p("p", {
|
|
752
769
|
className: "text-xs text-text-secondary mb-1",
|
|
753
770
|
children: h("billing.checkout.transactionId", "Transaction ID")
|
|
754
771
|
}), /* @__PURE__ */ m("p", {
|
|
755
772
|
className: "font-mono text-xs text-text-secondary",
|
|
756
|
-
children: [
|
|
773
|
+
children: [M.transactionId.slice(0, 8), "..."]
|
|
757
774
|
})]
|
|
758
775
|
})]
|
|
759
776
|
})
|
|
@@ -775,17 +792,17 @@ var Qe = () => {
|
|
|
775
792
|
})]
|
|
776
793
|
})
|
|
777
794
|
]
|
|
778
|
-
}),
|
|
779
|
-
billingAccountId:
|
|
780
|
-
subscriptionId:
|
|
781
|
-
quotas:
|
|
782
|
-
workspaces:
|
|
795
|
+
}), gt && vt.length > 0 && x && bt && /* @__PURE__ */ p(ke, {
|
|
796
|
+
billingAccountId: M?.billingAccountId ?? "",
|
|
797
|
+
subscriptionId: bt,
|
|
798
|
+
quotas: vt,
|
|
799
|
+
workspaces: dt,
|
|
783
800
|
currentWorkspaceId: x,
|
|
784
|
-
onAssigned: () =>
|
|
785
|
-
onSkip: () =>
|
|
801
|
+
onAssigned: () => _t(!1),
|
|
802
|
+
onSkip: () => _t(!1)
|
|
786
803
|
})] });
|
|
787
804
|
}
|
|
788
|
-
if (
|
|
805
|
+
if (O === "error") return /* @__PURE__ */ p("div", {
|
|
789
806
|
className: "max-w-lg mx-auto p-6",
|
|
790
807
|
children: /* @__PURE__ */ m("div", {
|
|
791
808
|
className: "text-center space-y-6",
|
|
@@ -799,7 +816,7 @@ var Qe = () => {
|
|
|
799
816
|
children: h("billing.checkout.paymentFailed", "Payment Failed")
|
|
800
817
|
}), /* @__PURE__ */ p("p", {
|
|
801
818
|
className: "text-text-secondary mt-2",
|
|
802
|
-
children:
|
|
819
|
+
children: Ct || jt || F.error || h("billing.checkout.genericError", "Something went wrong. Please try again.")
|
|
803
820
|
})] }),
|
|
804
821
|
/* @__PURE__ */ m("div", {
|
|
805
822
|
className: "flex gap-3 justify-center",
|
|
@@ -811,7 +828,7 @@ var Qe = () => {
|
|
|
811
828
|
}), /* @__PURE__ */ p("button", {
|
|
812
829
|
type: "button",
|
|
813
830
|
onClick: () => {
|
|
814
|
-
|
|
831
|
+
k("select"), j(null), F.reset();
|
|
815
832
|
},
|
|
816
833
|
className: "px-4 py-2 rounded-lg bg-action-primary-bg text-action-primary-text hover:bg-action-primary-bgHover",
|
|
817
834
|
children: h("billing.checkout.tryAgain", "Try Again")
|
|
@@ -820,7 +837,7 @@ var Qe = () => {
|
|
|
820
837
|
]
|
|
821
838
|
})
|
|
822
839
|
});
|
|
823
|
-
if (
|
|
840
|
+
if (O === "processing") return /* @__PURE__ */ p("div", {
|
|
824
841
|
className: "max-w-lg mx-auto p-6",
|
|
825
842
|
children: /* @__PURE__ */ m("div", {
|
|
826
843
|
className: "text-center space-y-6",
|
|
@@ -848,7 +865,7 @@ var Qe = () => {
|
|
|
848
865
|
children: ((e) => {
|
|
849
866
|
let t = Math.floor(e / 1e3);
|
|
850
867
|
return `${Math.floor(t / 60)}:${(t % 60).toString().padStart(2, "0")}`;
|
|
851
|
-
})(
|
|
868
|
+
})(At)
|
|
852
869
|
})
|
|
853
870
|
]
|
|
854
871
|
}), /* @__PURE__ */ p("p", {
|
|
@@ -860,13 +877,13 @@ var Qe = () => {
|
|
|
860
877
|
className: "w-full bg-bg-sunken rounded-full h-2 overflow-hidden",
|
|
861
878
|
children: /* @__PURE__ */ p("div", {
|
|
862
879
|
className: "bg-action-primary-bg h-2 rounded-full transition-all duration-1000",
|
|
863
|
-
style: { width: `${Math.min(
|
|
880
|
+
style: { width: `${Math.min(At / 3e5 * 100, 100)}%` }
|
|
864
881
|
})
|
|
865
882
|
}),
|
|
866
|
-
|
|
883
|
+
At > 3e4 && /* @__PURE__ */ p("button", {
|
|
867
884
|
type: "button",
|
|
868
885
|
onClick: () => {
|
|
869
|
-
|
|
886
|
+
k("error"), j("Payment verification was cancelled. Please check your billing history.");
|
|
870
887
|
},
|
|
871
888
|
className: "text-sm text-text-secondary hover:text-text-primary underline",
|
|
872
889
|
children: h("billing.checkout.cancelAndCheckHistory", "Cancel and check billing history")
|
|
@@ -874,19 +891,19 @@ var Qe = () => {
|
|
|
874
891
|
]
|
|
875
892
|
})
|
|
876
893
|
});
|
|
877
|
-
if (
|
|
894
|
+
if (O === "payment" && A) {
|
|
878
895
|
let e = (e, t) => `${{
|
|
879
896
|
INR: "₹",
|
|
880
897
|
USD: "$",
|
|
881
898
|
EUR: "€",
|
|
882
899
|
GBP: "£"
|
|
883
|
-
}[t] || t + " "}${e.toFixed(2)}`, t =
|
|
900
|
+
}[t] || t + " "}${e.toFixed(2)}`, t = A.currency || F.selectedCurrency, r = A.total ?? F.total;
|
|
884
901
|
return /* @__PURE__ */ m("div", {
|
|
885
902
|
className: "max-w-2xl mx-auto p-4 sm:p-6 space-y-6",
|
|
886
903
|
children: [
|
|
887
904
|
/* @__PURE__ */ m("button", {
|
|
888
905
|
type: "button",
|
|
889
|
-
onClick: () =>
|
|
906
|
+
onClick: () => k("select"),
|
|
890
907
|
className: "flex items-center gap-2 text-sm text-text-secondary hover:text-text-primary",
|
|
891
908
|
children: [/* @__PURE__ */ p(Pe, { className: "size-4" }), h("billing.checkout.backToCheckout", "Back to checkout")]
|
|
892
909
|
}),
|
|
@@ -901,7 +918,7 @@ var Qe = () => {
|
|
|
901
918
|
className: "font-semibold text-text-primary flex items-center gap-2",
|
|
902
919
|
children: [/* @__PURE__ */ p(Ve, { className: "size-4" }), h("billing.checkout.paymentSummary", "Payment Summary")]
|
|
903
920
|
}),
|
|
904
|
-
|
|
921
|
+
F.billingAccount && /* @__PURE__ */ m("div", {
|
|
905
922
|
className: "p-3 bg-bg-sunken rounded-lg space-y-1",
|
|
906
923
|
children: [
|
|
907
924
|
/* @__PURE__ */ p("div", {
|
|
@@ -910,15 +927,15 @@ var Qe = () => {
|
|
|
910
927
|
}),
|
|
911
928
|
/* @__PURE__ */ p("div", {
|
|
912
929
|
className: "font-medium text-text-primary",
|
|
913
|
-
children:
|
|
930
|
+
children: F.billingAccount.name
|
|
914
931
|
}),
|
|
915
932
|
/* @__PURE__ */ p("div", {
|
|
916
933
|
className: "text-sm text-text-secondary",
|
|
917
|
-
children:
|
|
934
|
+
children: F.billingAccount.email
|
|
918
935
|
})
|
|
919
936
|
]
|
|
920
937
|
}),
|
|
921
|
-
E === "ADDON" &&
|
|
938
|
+
E === "ADDON" && F.selectedSubscriptionId && H && /* @__PURE__ */ m("div", {
|
|
922
939
|
className: "p-3 bg-bg-sunken rounded-lg space-y-1",
|
|
923
940
|
children: [
|
|
924
941
|
/* @__PURE__ */ p("div", {
|
|
@@ -927,11 +944,11 @@ var Qe = () => {
|
|
|
927
944
|
}),
|
|
928
945
|
/* @__PURE__ */ p("div", {
|
|
929
946
|
className: "font-medium text-text-primary",
|
|
930
|
-
children:
|
|
947
|
+
children: H.plan?.name || h("billing.checkout.subscription", "Subscription")
|
|
931
948
|
}),
|
|
932
|
-
|
|
949
|
+
H.plan?.product?.name && /* @__PURE__ */ p("div", {
|
|
933
950
|
className: "text-sm text-text-secondary",
|
|
934
|
-
children:
|
|
951
|
+
children: H.plan.product.name
|
|
935
952
|
})
|
|
936
953
|
]
|
|
937
954
|
}),
|
|
@@ -939,7 +956,7 @@ var Qe = () => {
|
|
|
939
956
|
className: "space-y-2 text-sm",
|
|
940
957
|
children: [
|
|
941
958
|
(() => {
|
|
942
|
-
let n =
|
|
959
|
+
let n = F.taxRate, i = n > 0 ? r / (1 + n) : r, a = n > 0 ? r - i : 0;
|
|
943
960
|
return /* @__PURE__ */ m(f, { children: [
|
|
944
961
|
/* @__PURE__ */ m("div", {
|
|
945
962
|
className: "flex justify-between",
|
|
@@ -951,16 +968,16 @@ var Qe = () => {
|
|
|
951
968
|
children: e(i, t)
|
|
952
969
|
})]
|
|
953
970
|
}),
|
|
954
|
-
|
|
971
|
+
F.discountAmount > 0 && /* @__PURE__ */ m("div", {
|
|
955
972
|
className: "flex justify-between text-status-success-text",
|
|
956
|
-
children: [/* @__PURE__ */ p("span", { children: h("billing.checkout.discount", "Discount") }), /* @__PURE__ */ m("span", { children: ["-", e(
|
|
973
|
+
children: [/* @__PURE__ */ p("span", { children: h("billing.checkout.discount", "Discount") }), /* @__PURE__ */ m("span", { children: ["-", e(F.discountAmount, t)] })]
|
|
957
974
|
}),
|
|
958
975
|
a > 0 && /* @__PURE__ */ m("div", {
|
|
959
976
|
className: "flex justify-between",
|
|
960
977
|
children: [/* @__PURE__ */ m("span", {
|
|
961
978
|
className: "text-text-secondary",
|
|
962
979
|
children: [
|
|
963
|
-
|
|
980
|
+
F.taxType || h("billing.checkout.tax", "Tax"),
|
|
964
981
|
" (",
|
|
965
982
|
(n * 100).toFixed(0),
|
|
966
983
|
"%)"
|
|
@@ -987,23 +1004,23 @@ var Qe = () => {
|
|
|
987
1004
|
})
|
|
988
1005
|
]
|
|
989
1006
|
}),
|
|
990
|
-
|
|
1007
|
+
F.selectedProvider === "STRIPE" && A.clientSecret && /* @__PURE__ */ p("div", {
|
|
991
1008
|
className: "rounded-lg border border-border-subtle bg-bg-surface overflow-hidden",
|
|
992
1009
|
children: /* @__PURE__ */ p("div", {
|
|
993
1010
|
className: "p-4 space-y-4",
|
|
994
1011
|
children: /* @__PURE__ */ p(ye, {
|
|
995
|
-
clientSecret:
|
|
996
|
-
publishableKey:
|
|
997
|
-
amount: Math.round((
|
|
998
|
-
currency:
|
|
999
|
-
onSuccess:
|
|
1000
|
-
onError:
|
|
1001
|
-
onCancel: () =>
|
|
1002
|
-
isCompletingExistingPayment: !!
|
|
1012
|
+
clientSecret: A.clientSecret,
|
|
1013
|
+
publishableKey: it || Dt?.stripePublishableKey || "",
|
|
1014
|
+
amount: Math.round((A.total ?? F.total) * 100),
|
|
1015
|
+
currency: A.currency || F.selectedCurrency,
|
|
1016
|
+
onSuccess: sn,
|
|
1017
|
+
onError: cn,
|
|
1018
|
+
onCancel: () => k("select"),
|
|
1019
|
+
isCompletingExistingPayment: !!F.selectedPaymentMethodId
|
|
1003
1020
|
})
|
|
1004
1021
|
})
|
|
1005
1022
|
}),
|
|
1006
|
-
|
|
1023
|
+
F.selectedProvider === "RAZORPAY" && A.orderId && /* @__PURE__ */ p("div", {
|
|
1007
1024
|
className: "rounded-lg border border-border-subtle bg-bg-surface overflow-hidden",
|
|
1008
1025
|
children: /* @__PURE__ */ m("div", {
|
|
1009
1026
|
className: "p-4 space-y-4",
|
|
@@ -1011,27 +1028,27 @@ var Qe = () => {
|
|
|
1011
1028
|
className: "flex items-center gap-2 cursor-pointer",
|
|
1012
1029
|
children: [/* @__PURE__ */ p("input", {
|
|
1013
1030
|
type: "checkbox",
|
|
1014
|
-
checked:
|
|
1015
|
-
onChange: (e) =>
|
|
1031
|
+
checked: F.saveCard,
|
|
1032
|
+
onChange: (e) => F.setSaveCard(e.target.checked),
|
|
1016
1033
|
className: "size-4 rounded border-border-subtle text-text-link focus:ring-[var(--color-focus-ring)]"
|
|
1017
1034
|
}), /* @__PURE__ */ p("span", {
|
|
1018
1035
|
className: "text-sm text-text-secondary",
|
|
1019
1036
|
children: "Save card for future purchases"
|
|
1020
1037
|
})]
|
|
1021
1038
|
}), /* @__PURE__ */ p(be, {
|
|
1022
|
-
orderId:
|
|
1023
|
-
keyId:
|
|
1024
|
-
amount: Math.round((
|
|
1025
|
-
currency:
|
|
1026
|
-
customerId:
|
|
1039
|
+
orderId: A.orderId,
|
|
1040
|
+
keyId: A.razorpayKeyId || at || "",
|
|
1041
|
+
amount: Math.round((A.total ?? F.total) * 100),
|
|
1042
|
+
currency: A.currency || "INR",
|
|
1043
|
+
customerId: A.razorpayCustomerId,
|
|
1027
1044
|
prefill: {
|
|
1028
|
-
name:
|
|
1029
|
-
email:
|
|
1030
|
-
contact:
|
|
1045
|
+
name: A.prefillName,
|
|
1046
|
+
email: A.prefillEmail,
|
|
1047
|
+
contact: A.prefillContact
|
|
1031
1048
|
},
|
|
1032
|
-
onSuccess: (e) =>
|
|
1033
|
-
onError:
|
|
1034
|
-
onCancel: () =>
|
|
1049
|
+
onSuccess: (e) => sn(e.razorpay_payment_id),
|
|
1050
|
+
onError: cn,
|
|
1051
|
+
onCancel: () => k("select")
|
|
1035
1052
|
})]
|
|
1036
1053
|
})
|
|
1037
1054
|
})
|
|
@@ -1051,10 +1068,10 @@ var Qe = () => {
|
|
|
1051
1068
|
className: "flex items-center gap-3 mb-6",
|
|
1052
1069
|
children: [/* @__PURE__ */ p("div", {
|
|
1053
1070
|
className: "p-2 rounded-lg bg-[var(--color-accent-soft)] text-text-link",
|
|
1054
|
-
children:
|
|
1071
|
+
children: fn()
|
|
1055
1072
|
}), /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("h1", {
|
|
1056
1073
|
className: "text-2xl font-bold text-text-primary",
|
|
1057
|
-
children:
|
|
1074
|
+
children: dn()
|
|
1058
1075
|
}), /* @__PURE__ */ p("p", {
|
|
1059
1076
|
className: "text-sm text-text-secondary",
|
|
1060
1077
|
children: "Complete your purchase securely"
|
|
@@ -1121,58 +1138,58 @@ var Qe = () => {
|
|
|
1121
1138
|
children: [/* @__PURE__ */ m("div", {
|
|
1122
1139
|
className: "lg:col-span-3 space-y-6 order-2 lg:order-1",
|
|
1123
1140
|
children: [
|
|
1124
|
-
E === "CREDITS" &&
|
|
1141
|
+
E === "CREDITS" && F.items[0] && /* @__PURE__ */ p("div", {
|
|
1125
1142
|
className: "rounded-lg border border-border-subtle bg-bg-surface p-4 sm:p-6",
|
|
1126
1143
|
children: /* @__PURE__ */ p(ve, {
|
|
1127
|
-
value:
|
|
1128
|
-
onChange:
|
|
1129
|
-
costPerCredit:
|
|
1130
|
-
currency:
|
|
1131
|
-
disabled:
|
|
1144
|
+
value: F.items[0].quantity,
|
|
1145
|
+
onChange: ln,
|
|
1146
|
+
costPerCredit: W,
|
|
1147
|
+
currency: F.selectedCurrency,
|
|
1148
|
+
disabled: qt
|
|
1132
1149
|
})
|
|
1133
1150
|
}),
|
|
1134
1151
|
/* @__PURE__ */ m("div", {
|
|
1135
1152
|
className: "rounded-lg border border-border-subtle bg-bg-surface p-4 sm:p-6 space-y-4",
|
|
1136
1153
|
children: [/* @__PURE__ */ p(he, {
|
|
1137
|
-
accounts:
|
|
1138
|
-
selectedAccountId:
|
|
1139
|
-
onSelect:
|
|
1140
|
-
isLoading:
|
|
1141
|
-
disabled:
|
|
1142
|
-
disabledMessage:
|
|
1143
|
-
}), E === "ADDON" && !T &&
|
|
1144
|
-
subscriptions:
|
|
1145
|
-
selectedSubscriptionId:
|
|
1146
|
-
onSelect:
|
|
1147
|
-
isLoading:
|
|
1154
|
+
accounts: K,
|
|
1155
|
+
selectedAccountId: F.billingAccount?.id ?? null,
|
|
1156
|
+
onSelect: F.setBillingAccount,
|
|
1157
|
+
isLoading: Nt,
|
|
1158
|
+
disabled: rn,
|
|
1159
|
+
disabledMessage: rn ? "Billing account is locked for plan changes" : void 0
|
|
1160
|
+
}), E === "ADDON" && !T && F.billingAccount && /* @__PURE__ */ p(xe, {
|
|
1161
|
+
subscriptions: V,
|
|
1162
|
+
selectedSubscriptionId: F.selectedSubscriptionId,
|
|
1163
|
+
onSelect: F.setSelectedSubscriptionId,
|
|
1164
|
+
isLoading: Wt
|
|
1148
1165
|
})]
|
|
1149
1166
|
}),
|
|
1150
|
-
|
|
1167
|
+
z && /* @__PURE__ */ p(Oe, {
|
|
1151
1168
|
storeOrderId: g,
|
|
1152
|
-
currency:
|
|
1153
|
-
onChange:
|
|
1169
|
+
currency: F.selectedCurrency,
|
|
1170
|
+
onChange: zt
|
|
1154
1171
|
}),
|
|
1155
1172
|
/* @__PURE__ */ m("div", {
|
|
1156
1173
|
className: "rounded-lg border border-border-subtle bg-bg-surface p-4 sm:p-6 space-y-4",
|
|
1157
1174
|
children: [
|
|
1158
1175
|
/* @__PURE__ */ p(Ce, {
|
|
1159
|
-
savedPaymentMethods:
|
|
1160
|
-
selectedPaymentMethodId:
|
|
1161
|
-
onSelectSavedCard:
|
|
1162
|
-
selectedProvider:
|
|
1163
|
-
onSelectProvider:
|
|
1164
|
-
stripeEnabled:
|
|
1165
|
-
razorpayEnabled:
|
|
1166
|
-
canPayWithCredits:
|
|
1167
|
-
availableCredits:
|
|
1168
|
-
totalAmount:
|
|
1169
|
-
billingCountry:
|
|
1170
|
-
saveCard:
|
|
1171
|
-
onSaveCardChange:
|
|
1172
|
-
autoRenewEnabled: E === "PLAN" &&
|
|
1173
|
-
isLoading:
|
|
1176
|
+
savedPaymentMethods: G,
|
|
1177
|
+
selectedPaymentMethodId: F.selectedPaymentMethodId,
|
|
1178
|
+
onSelectSavedCard: F.setSelectedPaymentMethodId,
|
|
1179
|
+
selectedProvider: F.selectedProvider,
|
|
1180
|
+
onSelectProvider: F.setPaymentProvider,
|
|
1181
|
+
stripeEnabled: Ot,
|
|
1182
|
+
razorpayEnabled: kt,
|
|
1183
|
+
canPayWithCredits: F.canPayWithCredits && F.hasEnoughCredits,
|
|
1184
|
+
availableCredits: F.availableCredits,
|
|
1185
|
+
totalAmount: F.subtotalUSD,
|
|
1186
|
+
billingCountry: q,
|
|
1187
|
+
saveCard: F.saveCard,
|
|
1188
|
+
onSaveCardChange: F.setSaveCard,
|
|
1189
|
+
autoRenewEnabled: E === "PLAN" && F.autoRenew,
|
|
1190
|
+
isLoading: Ht
|
|
1174
1191
|
}),
|
|
1175
|
-
|
|
1192
|
+
F.selectedProvider !== "CREDITS" && F.selectedProvider !== "AUTO" && /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p("div", { className: "border-t border-border-subtle" }), /* @__PURE__ */ p("div", {
|
|
1176
1193
|
className: "bg-bg-sunken p-4 rounded-button",
|
|
1177
1194
|
children: /* @__PURE__ */ m("div", {
|
|
1178
1195
|
className: "flex items-start gap-3",
|
|
@@ -1191,7 +1208,7 @@ var Qe = () => {
|
|
|
1191
1208
|
className: "flex-1 text-sm",
|
|
1192
1209
|
children: [/* @__PURE__ */ m("p", {
|
|
1193
1210
|
className: "font-medium text-text-primary mb-1",
|
|
1194
|
-
children: ["Currency: ",
|
|
1211
|
+
children: ["Currency: ", F.selectedCurrency]
|
|
1195
1212
|
}), /* @__PURE__ */ m("p", {
|
|
1196
1213
|
className: "text-text-secondary text-xs",
|
|
1197
1214
|
children: [
|
|
@@ -1199,30 +1216,30 @@ var Qe = () => {
|
|
|
1199
1216
|
" ",
|
|
1200
1217
|
/* @__PURE__ */ p("strong", {
|
|
1201
1218
|
className: "text-text-primary",
|
|
1202
|
-
children:
|
|
1219
|
+
children: F.selectedCurrency
|
|
1203
1220
|
}),
|
|
1204
1221
|
" ",
|
|
1205
1222
|
"based on your billing account settings.",
|
|
1206
|
-
|
|
1223
|
+
F.selectedCurrency === "INR" && " GST will be applied at checkout."
|
|
1207
1224
|
]
|
|
1208
1225
|
})]
|
|
1209
1226
|
})]
|
|
1210
1227
|
})
|
|
1211
1228
|
})] }),
|
|
1212
|
-
E === "PLAN" &&
|
|
1229
|
+
E === "PLAN" && I?.getPlan?.pricingModel === "PER_SEAT" && /* @__PURE__ */ p("div", {
|
|
1213
1230
|
className: "border-t border-border-subtle pt-4",
|
|
1214
1231
|
children: /* @__PURE__ */ m("div", {
|
|
1215
1232
|
className: "space-y-3",
|
|
1216
1233
|
children: [/* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("label", {
|
|
1217
1234
|
className: "text-sm font-medium text-text-primary",
|
|
1218
1235
|
children: "Number of seats"
|
|
1219
|
-
}),
|
|
1236
|
+
}), I.getPlan.minSeats && /* @__PURE__ */ m("p", {
|
|
1220
1237
|
className: "text-xs text-text-secondary mt-0.5",
|
|
1221
1238
|
children: [
|
|
1222
1239
|
"Minimum ",
|
|
1223
|
-
|
|
1240
|
+
I.getPlan.minSeats,
|
|
1224
1241
|
" seat",
|
|
1225
|
-
|
|
1242
|
+
I.getPlan.minSeats === 1 ? "" : "s",
|
|
1226
1243
|
" required"
|
|
1227
1244
|
]
|
|
1228
1245
|
})] }), /* @__PURE__ */ m("div", {
|
|
@@ -1230,44 +1247,44 @@ var Qe = () => {
|
|
|
1230
1247
|
children: [
|
|
1231
1248
|
/* @__PURE__ */ p("button", {
|
|
1232
1249
|
type: "button",
|
|
1233
|
-
onClick: () =>
|
|
1234
|
-
disabled:
|
|
1250
|
+
onClick: () => P((e) => Math.max(I.getPlan?.minSeats ?? 1, e - 1)),
|
|
1251
|
+
disabled: N <= (I.getPlan.minSeats ?? 1),
|
|
1235
1252
|
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",
|
|
1236
1253
|
children: "−"
|
|
1237
1254
|
}),
|
|
1238
1255
|
/* @__PURE__ */ p("input", {
|
|
1239
1256
|
type: "number",
|
|
1240
|
-
value:
|
|
1241
|
-
min:
|
|
1242
|
-
max:
|
|
1257
|
+
value: N,
|
|
1258
|
+
min: I.getPlan.minSeats ?? 1,
|
|
1259
|
+
max: I.getPlan.maxSeats ?? 999,
|
|
1243
1260
|
onChange: (e) => {
|
|
1244
1261
|
let t = parseInt(e.target.value, 10);
|
|
1245
|
-
isNaN(t) ||
|
|
1262
|
+
isNaN(t) || P(Math.max(I.getPlan?.minSeats ?? 1, t));
|
|
1246
1263
|
},
|
|
1247
1264
|
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)]"
|
|
1248
1265
|
}),
|
|
1249
1266
|
/* @__PURE__ */ p("button", {
|
|
1250
1267
|
type: "button",
|
|
1251
|
-
onClick: () =>
|
|
1252
|
-
disabled:
|
|
1268
|
+
onClick: () => P((e) => Math.min(I.getPlan?.maxSeats ?? 999, e + 1)),
|
|
1269
|
+
disabled: N >= (I.getPlan.maxSeats ?? 999),
|
|
1253
1270
|
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",
|
|
1254
1271
|
children: "+"
|
|
1255
1272
|
}),
|
|
1256
|
-
|
|
1273
|
+
I.getPlan.pricePerSeat && /* @__PURE__ */ m("span", {
|
|
1257
1274
|
className: "text-sm text-text-secondary",
|
|
1258
1275
|
children: [
|
|
1259
1276
|
"×",
|
|
1260
1277
|
" ",
|
|
1261
|
-
|
|
1278
|
+
I.getPlan.pricePerSeat.toLocaleString("en", {
|
|
1262
1279
|
style: "currency",
|
|
1263
|
-
currency:
|
|
1280
|
+
currency: I.getPlan.currency ?? "USD"
|
|
1264
1281
|
}),
|
|
1265
1282
|
" ",
|
|
1266
1283
|
"=",
|
|
1267
1284
|
" ",
|
|
1268
|
-
(
|
|
1285
|
+
(I.getPlan.pricePerSeat * N).toLocaleString("en", {
|
|
1269
1286
|
style: "currency",
|
|
1270
|
-
currency:
|
|
1287
|
+
currency: I.getPlan.currency ?? "USD"
|
|
1271
1288
|
}),
|
|
1272
1289
|
"/mo"
|
|
1273
1290
|
]
|
|
@@ -1290,46 +1307,46 @@ var Qe = () => {
|
|
|
1290
1307
|
/* @__PURE__ */ p("div", {
|
|
1291
1308
|
className: "p-4",
|
|
1292
1309
|
children: /* @__PURE__ */ p(ge, {
|
|
1293
|
-
items:
|
|
1294
|
-
subtotal:
|
|
1295
|
-
discountAmount:
|
|
1296
|
-
taxAmount:
|
|
1297
|
-
taxRate:
|
|
1298
|
-
taxType:
|
|
1299
|
-
total:
|
|
1300
|
-
currency:
|
|
1301
|
-
isCalculatingTax:
|
|
1302
|
-
showInCredits:
|
|
1303
|
-
onUpdateQuantity: E !== "PLAN" && E !== "ORDER" ?
|
|
1304
|
-
onRemoveItem:
|
|
1310
|
+
items: F.items,
|
|
1311
|
+
subtotal: F.subtotal,
|
|
1312
|
+
discountAmount: F.discountAmount,
|
|
1313
|
+
taxAmount: F.taxAmount,
|
|
1314
|
+
taxRate: F.taxRate,
|
|
1315
|
+
taxType: F.taxType,
|
|
1316
|
+
total: F.total,
|
|
1317
|
+
currency: F.selectedCurrency,
|
|
1318
|
+
isCalculatingTax: F.isCalculatingTax,
|
|
1319
|
+
showInCredits: F.selectedProvider === "CREDITS",
|
|
1320
|
+
onUpdateQuantity: E !== "PLAN" && E !== "ORDER" ? F.updateItemQuantity : void 0,
|
|
1321
|
+
onRemoveItem: F.removeItem,
|
|
1305
1322
|
isEditable: E !== "PLAN" && E !== "ORDER"
|
|
1306
1323
|
})
|
|
1307
1324
|
}),
|
|
1308
1325
|
/* @__PURE__ */ p("div", {
|
|
1309
1326
|
className: "px-4 pb-4 border-t border-border-subtle pt-4",
|
|
1310
1327
|
children: /* @__PURE__ */ p(_e, {
|
|
1311
|
-
value:
|
|
1312
|
-
onChange:
|
|
1313
|
-
onValidate: async () => await
|
|
1314
|
-
onClear:
|
|
1315
|
-
isApplied:
|
|
1316
|
-
discountValue:
|
|
1317
|
-
discountType:
|
|
1318
|
-
isValidating:
|
|
1328
|
+
value: F.promoCode,
|
|
1329
|
+
onChange: F.setPromoCode,
|
|
1330
|
+
onValidate: async () => await F.validatePromoCode(),
|
|
1331
|
+
onClear: F.clearPromoCode,
|
|
1332
|
+
isApplied: F.promoDiscount > 0,
|
|
1333
|
+
discountValue: F.promoDiscount,
|
|
1334
|
+
discountType: F.promoDiscountType,
|
|
1335
|
+
isValidating: F.isProcessing
|
|
1319
1336
|
})
|
|
1320
1337
|
}),
|
|
1321
|
-
E === "PLAN" &&
|
|
1338
|
+
E === "PLAN" && F.selectedProvider !== "CREDITS" && F.selectedProvider !== "AUTO" && (() => {
|
|
1322
1339
|
let e = "", t = !1, n = !1;
|
|
1323
|
-
if (
|
|
1324
|
-
let r =
|
|
1340
|
+
if (F.selectedPaymentMethodId) {
|
|
1341
|
+
let r = G.find((e) => e.id === F.selectedPaymentMethodId);
|
|
1325
1342
|
r && (e = `${r.type === "CREDIT_CARD" || r.type === "DEBIT_CARD" ? "Card" : r.type}${r.last4 ? ` •••• ${r.last4}` : ""}`, t = !0, n = !1);
|
|
1326
|
-
} else (
|
|
1343
|
+
} else (F.selectedProvider === "RAZORPAY" || F.selectedProvider === "STRIPE") && (e = F.selectedProvider === "RAZORPAY" ? "new card (Razorpay)" : "new card (Stripe)", t = !0, n = !0);
|
|
1327
1344
|
return /* @__PURE__ */ p("div", {
|
|
1328
1345
|
className: "px-4 pb-4",
|
|
1329
1346
|
children: /* @__PURE__ */ p(Se, {
|
|
1330
|
-
enabled:
|
|
1347
|
+
enabled: F.autoRenew,
|
|
1331
1348
|
onToggle: (e) => {
|
|
1332
|
-
|
|
1349
|
+
F.setAutoRenew(e), e && F.selectedPaymentMethodId && F.setAutoRenewPaymentMethodId(F.selectedPaymentMethodId);
|
|
1333
1350
|
},
|
|
1334
1351
|
hasPaymentMethodSelected: t,
|
|
1335
1352
|
selectedPaymentMethodDisplay: e,
|
|
@@ -1341,10 +1358,10 @@ var Qe = () => {
|
|
|
1341
1358
|
}),
|
|
1342
1359
|
/* @__PURE__ */ p("button", {
|
|
1343
1360
|
type: "button",
|
|
1344
|
-
onClick:
|
|
1345
|
-
disabled:
|
|
1361
|
+
onClick: on,
|
|
1362
|
+
disabled: F.isProcessing || !F.billingAccount || F.items.length === 0 || E === "ADDON" && !T && Wt || E === "ADDON" && !T && V.length === 0 || E === "ADDON" && !T && !F.selectedSubscriptionId || z && (!B.shippingAddressId || !B.shippingMethodId),
|
|
1346
1363
|
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",
|
|
1347
|
-
children:
|
|
1364
|
+
children: F.isProcessing ? /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(d, { className: "size-5 animate-spin" }), "Processing…"] }) : F.selectedProvider === "CREDITS" ? "Pay with Credits" : "Proceed to Payment"
|
|
1348
1365
|
}),
|
|
1349
1366
|
/* @__PURE__ */ p("p", {
|
|
1350
1367
|
className: "text-center text-xs text-text-secondary",
|
|
@@ -1354,22 +1371,22 @@ var Qe = () => {
|
|
|
1354
1371
|
})
|
|
1355
1372
|
})]
|
|
1356
1373
|
}),
|
|
1357
|
-
|
|
1358
|
-
billingAccountId:
|
|
1359
|
-
hasPhone: !!
|
|
1360
|
-
hasAddress: !!(
|
|
1374
|
+
pt && F.billingAccount && /* @__PURE__ */ p(we, {
|
|
1375
|
+
billingAccountId: F.billingAccount.id,
|
|
1376
|
+
hasPhone: !!F.billingAccount.contactNumber?.trim(),
|
|
1377
|
+
hasAddress: !!(F.billingAccount.billingAddresses?.[0]?.line1?.trim() && F.billingAccount.billingAddresses?.[0]?.postalCode?.trim()),
|
|
1361
1378
|
onCompleted: () => {
|
|
1362
|
-
|
|
1363
|
-
let t = (e.data?.myBillingAccounts ?? []).find((e) => e
|
|
1364
|
-
t &&
|
|
1379
|
+
ht.current = !0, mt(!1), on(), Pt().then((e) => {
|
|
1380
|
+
let t = (e.data?.myBillingAccounts ?? []).map(Qe).find((e) => e?.id === F.billingAccount?.id);
|
|
1381
|
+
t && F.setBillingAccount(t);
|
|
1365
1382
|
});
|
|
1366
1383
|
},
|
|
1367
|
-
onCancel: () =>
|
|
1384
|
+
onCancel: () => mt(!1)
|
|
1368
1385
|
})
|
|
1369
1386
|
]
|
|
1370
1387
|
});
|
|
1371
1388
|
};
|
|
1372
1389
|
//#endregion
|
|
1373
|
-
export {
|
|
1390
|
+
export { $e as CheckoutPage };
|
|
1374
1391
|
|
|
1375
1392
|
//# sourceMappingURL=CheckoutPage.js.map
|