@iblai/iblai-js 2.72.0 → 2.73.1
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/data-layer/playwright/billing-tab-helpers.d.ts +61 -48
- package/dist/data-layer/playwright/credit-balance-helpers.d.ts +40 -18
- package/dist/data-layer/playwright/index.d.ts +3 -2
- package/dist/data-layer/playwright/plan-picker-helpers.d.ts +26 -0
- package/dist/data-layer/playwright/spend-limits-helpers.d.ts +5 -4
- package/dist/playwright/index.cjs +306 -193
- package/dist/playwright/index.cjs.map +1 -1
- package/dist/playwright/index.d.ts +133 -71
- package/dist/playwright/index.esm.js +293 -194
- package/dist/playwright/index.esm.js.map +1 -1
- package/dist/playwright/playwright/billing-tab-helpers.d.ts +61 -48
- package/dist/playwright/playwright/credit-balance-helpers.d.ts +40 -18
- package/dist/playwright/playwright/index.d.ts +3 -2
- package/dist/playwright/playwright/plan-picker-helpers.d.ts +26 -0
- package/dist/playwright/playwright/spend-limits-helpers.d.ts +5 -4
- package/dist/security/playwright/billing-tab-helpers.d.ts +61 -48
- package/dist/security/playwright/credit-balance-helpers.d.ts +40 -18
- package/dist/security/playwright/index.d.ts +3 -2
- package/dist/security/playwright/plan-picker-helpers.d.ts +26 -0
- package/dist/security/playwright/spend-limits-helpers.d.ts +5 -4
- package/dist/web-containers/playwright/billing-tab-helpers.d.ts +61 -48
- package/dist/web-containers/playwright/credit-balance-helpers.d.ts +40 -18
- package/dist/web-containers/playwright/index.d.ts +3 -2
- package/dist/web-containers/playwright/plan-picker-helpers.d.ts +26 -0
- package/dist/web-containers/playwright/spend-limits-helpers.d.ts +5 -4
- package/dist/web-containers/source/add-credits-modal.js +170 -24
- package/dist/web-containers/source/add-credits-modal.js.map +1 -1
- package/dist/web-containers/source/auto-recharge-modal.js +1 -1
- package/dist/web-containers/source/auto-recharge-modal.js.map +1 -1
- package/dist/web-containers/source/billing-credits.js +4 -4
- package/dist/web-containers/source/billing-credits.js.map +1 -1
- package/dist/web-containers/source/billing.js +60 -101
- package/dist/web-containers/source/billing.js.map +1 -1
- package/dist/web-containers/source/components/credit-balance.js +44 -72
- package/dist/web-containers/source/components/credit-balance.js.map +1 -1
- package/dist/web-containers/source/components/modals/contact-admin-modal.js +32 -0
- package/dist/web-containers/source/components/modals/contact-admin-modal.js.map +1 -0
- package/dist/web-containers/source/components/modals/upgrade-package-modal.js +281 -20
- package/dist/web-containers/source/components/modals/upgrade-package-modal.js.map +1 -1
- package/dist/web-containers/source/components/profile/add-credits-modal.js +170 -24
- package/dist/web-containers/source/components/profile/add-credits-modal.js.map +1 -1
- package/dist/web-containers/source/components/profile/auto-recharge-modal.js +1 -1
- package/dist/web-containers/source/components/profile/auto-recharge-modal.js.map +1 -1
- package/dist/web-containers/source/components/profile/billing-credits.js +4 -4
- package/dist/web-containers/source/components/profile/billing-credits.js.map +1 -1
- package/dist/web-containers/source/components/profile/billing.js +60 -101
- package/dist/web-containers/source/components/profile/billing.js.map +1 -1
- package/dist/web-containers/source/components/profile/pending-credit-top-up.js +202 -0
- package/dist/web-containers/source/components/profile/pending-credit-top-up.js.map +1 -0
- package/dist/web-containers/source/components/profile/use-complete-pending-credit-top-up.js +68 -0
- package/dist/web-containers/source/components/profile/use-complete-pending-credit-top-up.js.map +1 -0
- package/dist/web-containers/source/components/subscription-top-banner.js +119 -0
- package/dist/web-containers/source/components/subscription-top-banner.js.map +1 -0
- package/dist/web-containers/source/components/workflows/workflow-editor.js +28 -8
- package/dist/web-containers/source/components/workflows/workflow-editor.js.map +1 -1
- package/dist/web-containers/source/contact-admin-modal.js +32 -0
- package/dist/web-containers/source/contact-admin-modal.js.map +1 -0
- package/dist/web-containers/source/credit-balance.js +44 -72
- package/dist/web-containers/source/credit-balance.js.map +1 -1
- package/dist/web-containers/source/en.json.js +121 -21
- package/dist/web-containers/source/en.json.js.map +1 -1
- package/dist/web-containers/source/es.json.js +123 -23
- package/dist/web-containers/source/es.json.js.map +1 -1
- package/dist/web-containers/source/fr.json.js +121 -21
- package/dist/web-containers/source/fr.json.js.map +1 -1
- package/dist/web-containers/source/i18n/messages/en.json.js +121 -21
- package/dist/web-containers/source/i18n/messages/en.json.js.map +1 -1
- package/dist/web-containers/source/i18n/messages/es.json.js +123 -23
- package/dist/web-containers/source/i18n/messages/es.json.js.map +1 -1
- package/dist/web-containers/source/i18n/messages/fr.json.js +121 -21
- package/dist/web-containers/source/i18n/messages/fr.json.js.map +1 -1
- package/dist/web-containers/source/i18n/messages/zh.json.js +122 -22
- package/dist/web-containers/source/i18n/messages/zh.json.js.map +1 -1
- package/dist/web-containers/source/messages/en.json.js +121 -21
- package/dist/web-containers/source/messages/en.json.js.map +1 -1
- package/dist/web-containers/source/messages/es.json.js +123 -23
- package/dist/web-containers/source/messages/es.json.js.map +1 -1
- package/dist/web-containers/source/messages/fr.json.js +121 -21
- package/dist/web-containers/source/messages/fr.json.js.map +1 -1
- package/dist/web-containers/source/messages/zh.json.js +122 -22
- package/dist/web-containers/source/messages/zh.json.js.map +1 -1
- package/dist/web-containers/source/modals/contact-admin-modal.js +32 -0
- package/dist/web-containers/source/modals/contact-admin-modal.js.map +1 -0
- package/dist/web-containers/source/modals/upgrade-package-modal.js +281 -20
- package/dist/web-containers/source/modals/upgrade-package-modal.js.map +1 -1
- package/dist/web-containers/source/pending-credit-top-up.js +202 -0
- package/dist/web-containers/source/pending-credit-top-up.js.map +1 -0
- package/dist/web-containers/source/profile/add-credits-modal.js +170 -24
- package/dist/web-containers/source/profile/add-credits-modal.js.map +1 -1
- package/dist/web-containers/source/profile/auto-recharge-modal.js +1 -1
- package/dist/web-containers/source/profile/auto-recharge-modal.js.map +1 -1
- package/dist/web-containers/source/profile/billing-credits.js +4 -4
- package/dist/web-containers/source/profile/billing-credits.js.map +1 -1
- package/dist/web-containers/source/profile/billing.js +60 -101
- package/dist/web-containers/source/profile/billing.js.map +1 -1
- package/dist/web-containers/source/profile/pending-credit-top-up.js +202 -0
- package/dist/web-containers/source/profile/pending-credit-top-up.js.map +1 -0
- package/dist/web-containers/source/profile/use-complete-pending-credit-top-up.js +68 -0
- package/dist/web-containers/source/profile/use-complete-pending-credit-top-up.js.map +1 -0
- package/dist/web-containers/source/subscription-top-banner.js +119 -0
- package/dist/web-containers/source/subscription-top-banner.js.map +1 -0
- package/dist/web-containers/source/tsconfig.build.tsbuildinfo +1 -1
- package/dist/web-containers/source/upgrade-package-modal.js +281 -20
- package/dist/web-containers/source/upgrade-package-modal.js.map +1 -1
- package/dist/web-containers/source/use-complete-pending-credit-top-up.js +68 -0
- package/dist/web-containers/source/use-complete-pending-credit-top-up.js.map +1 -0
- package/dist/web-containers/source/web-containers/tsconfig.build.tsbuildinfo +1 -1
- package/dist/web-containers/source/workflow-editor.js +28 -8
- package/dist/web-containers/source/workflow-editor.js.map +1 -1
- package/dist/web-containers/source/workflows/workflow-editor.js +28 -8
- package/dist/web-containers/source/workflows/workflow-editor.js.map +1 -1
- package/dist/web-containers/source/zh.json.js +122 -22
- package/dist/web-containers/source/zh.json.js.map +1 -1
- package/dist/web-utils/playwright/billing-tab-helpers.d.ts +61 -48
- package/dist/web-utils/playwright/credit-balance-helpers.d.ts +40 -18
- package/dist/web-utils/playwright/index.d.ts +3 -2
- package/dist/web-utils/playwright/plan-picker-helpers.d.ts +26 -0
- package/dist/web-utils/playwright/spend-limits-helpers.d.ts +5 -4
- package/package.json +5 -5
|
@@ -1,33 +1,294 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { useState, useEffect } from 'react';
|
|
2
3
|
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription } from '../ui/dialog.js';
|
|
3
4
|
import { Button } from '../ui/button.js';
|
|
4
|
-
import {
|
|
5
|
+
import { Skeleton } from '../ui/skeleton.js';
|
|
6
|
+
import { toast } from 'sonner';
|
|
7
|
+
import { useSubscriptionConfig, useStripeUpgrade, STRIPE_PLAN_FALLBACK_NAMES, openExternalUrl, StripePlanChangeRefused, STRIPE_PLAN_KEYS } from '@iblai/web-utils';
|
|
5
8
|
import { cn } from '../../lib/utils.js';
|
|
6
|
-
import
|
|
7
|
-
import
|
|
9
|
+
import { useT, useWebContainersLocale } from '../../i18n/context.js';
|
|
10
|
+
import '../../packages/i18n/dist/index.esm.js';
|
|
11
|
+
import Coins from '../../node_modules/.pnpm/lucide-react@0.528.0_react@19.1.0/node_modules/lucide-react/dist/esm/icons/coins.js';
|
|
8
12
|
import LoaderCircle from '../../node_modules/.pnpm/lucide-react@0.528.0_react@19.1.0/node_modules/lucide-react/dist/esm/icons/loader-circle.js';
|
|
9
|
-
import
|
|
13
|
+
import Check from '../../node_modules/.pnpm/lucide-react@0.528.0_react@19.1.0/node_modules/lucide-react/dist/esm/icons/check.js';
|
|
14
|
+
import Users from '../../node_modules/.pnpm/lucide-react@0.528.0_react@19.1.0/node_modules/lucide-react/dist/esm/icons/users.js';
|
|
10
15
|
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
const DEFAULT_ENTERPRISE_CONTACT_URL = 'https://ibl.ai/contact';
|
|
17
|
+
/** The plan the picker marks "Most Popular" for a trial user. */
|
|
18
|
+
const HIGHLIGHTED_PLAN_KEY = 'premium';
|
|
19
|
+
const GRADIENT_BUTTON_CLASS = 'h-9 w-full px-4 rounded-lg border-0 text-white text-[14px] font-medium leading-5 bg-[linear-gradient(to_right,rgb(56,161,229),rgb(114,132,255))] hover:opacity-90 transition-opacity disabled:opacity-70';
|
|
20
|
+
function isKnownKey(key) {
|
|
21
|
+
return STRIPE_PLAN_KEYS.includes(key);
|
|
22
|
+
}
|
|
23
|
+
/** Position of a plan in the product's order; unknown keys sort after the known ones. */
|
|
24
|
+
function planRank(key) {
|
|
25
|
+
const index = STRIPE_PLAN_KEYS.indexOf(key);
|
|
26
|
+
return index === -1 ? STRIPE_PLAN_KEYS.length : index;
|
|
27
|
+
}
|
|
28
|
+
const MAX_FEATURES = 12;
|
|
29
|
+
/** `t()` hands back the key itself when a message is missing; treat that as "no value". */
|
|
30
|
+
function messageOrNull(value, key) {
|
|
31
|
+
return value && value !== key && !value.startsWith('planPicker.') ? value : null;
|
|
32
|
+
}
|
|
33
|
+
/** Renders a bullet, with the `**...**` part in bold. */
|
|
34
|
+
function FeatureText({ text }) {
|
|
35
|
+
const parts = text.split('**');
|
|
36
|
+
if (parts.length < 3)
|
|
37
|
+
return jsx("span", { children: text });
|
|
38
|
+
return (jsx("span", { children: parts.map((part, index) => index % 2 === 1 ? (jsx("strong", { className: "font-semibold text-[#101828] dark:text-gray-100", children: part }, index)) : (jsx("span", { children: part }, index))) }));
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* What the card says about a plan: the product's own words for the four known
|
|
42
|
+
* plans (localized), the backend's name and description for any other key. The
|
|
43
|
+
* bullets are the host's (`hostFeatures`, by plan key) when it gives any for the
|
|
44
|
+
* plan, the built-in ones otherwise.
|
|
45
|
+
*/
|
|
46
|
+
function usePlanCopy(hostFeatures) {
|
|
47
|
+
const t = useT();
|
|
48
|
+
return (plan) => {
|
|
49
|
+
var _a, _b, _c;
|
|
50
|
+
const fromHost = ((_a = hostFeatures === null || hostFeatures === void 0 ? void 0 : hostFeatures[plan.key]) !== null && _a !== void 0 ? _a : [])
|
|
51
|
+
.map((feature) => feature.trim())
|
|
52
|
+
.filter(Boolean);
|
|
53
|
+
if (!isKnownKey(plan.key)) {
|
|
54
|
+
return { name: plan.name, tagline: plan.description, features: fromHost };
|
|
55
|
+
}
|
|
56
|
+
const base = `planPicker.plans.${plan.key}`;
|
|
57
|
+
const features = [...fromHost];
|
|
58
|
+
for (let n = 1; fromHost.length === 0 && n <= MAX_FEATURES; n += 1) {
|
|
59
|
+
const key = `${base}.feature${n}`;
|
|
60
|
+
const text = messageOrNull(t(key), key);
|
|
61
|
+
if (!text)
|
|
62
|
+
break;
|
|
63
|
+
features.push(text);
|
|
64
|
+
}
|
|
65
|
+
const priceNote = plan.key === 'free' ? t(`${base}.priceNote`) : undefined;
|
|
66
|
+
const featuresLead = (_b = messageOrNull(t(`${base}.featuresLead`), `${base}.featuresLead`)) !== null && _b !== void 0 ? _b : undefined;
|
|
67
|
+
const audience = (_c = messageOrNull(t(`${base}.audience`), `${base}.audience`)) !== null && _c !== void 0 ? _c : undefined;
|
|
68
|
+
return {
|
|
69
|
+
name: t(`${base}.name`),
|
|
70
|
+
tagline: t(`${base}.tagline`),
|
|
71
|
+
priceNote,
|
|
72
|
+
featuresLead,
|
|
73
|
+
features,
|
|
74
|
+
audience,
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
function formatPlanPrice(plan, locale) {
|
|
79
|
+
if (plan.priceAmount === null)
|
|
80
|
+
return null;
|
|
81
|
+
const currency = (plan.priceCurrency || 'usd').toUpperCase();
|
|
82
|
+
// Whole amounts read as "$17", anything else keeps its cents ("$12.50").
|
|
83
|
+
const fractionDigits = Number.isInteger(plan.priceAmount) ? 0 : 2;
|
|
84
|
+
try {
|
|
85
|
+
return new Intl.NumberFormat(locale, {
|
|
86
|
+
style: 'currency',
|
|
87
|
+
currency,
|
|
88
|
+
minimumFractionDigits: fractionDigits,
|
|
89
|
+
maximumFractionDigits: fractionDigits,
|
|
90
|
+
}).format(plan.priceAmount);
|
|
91
|
+
}
|
|
92
|
+
catch (_a) {
|
|
93
|
+
return `${currency} ${plan.priceAmount}`;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
function usePlanInterval() {
|
|
97
|
+
const t = useT();
|
|
98
|
+
return (plan) => {
|
|
99
|
+
var _a;
|
|
100
|
+
// A $0 plan is free for good: say so where a paid plan shows its period.
|
|
101
|
+
if (plan.priceAmount === 0)
|
|
102
|
+
return t('planPicker.forever');
|
|
103
|
+
if (!plan.priceInterval || plan.priceAmount === null)
|
|
104
|
+
return null;
|
|
105
|
+
const count = (_a = plan.priceIntervalCount) !== null && _a !== void 0 ? _a : 1;
|
|
106
|
+
if (count > 1) {
|
|
107
|
+
const plural = { day: 'days', week: 'weeks', month: 'months', year: 'years' }[plan.priceInterval];
|
|
108
|
+
return t('planPicker.everyCount', { count, interval: t(`planPicker.${plural}`) });
|
|
109
|
+
}
|
|
110
|
+
const per = { day: 'perDay', week: 'perWeek', month: 'perMonth', year: 'perYear' }[plan.priceInterval];
|
|
111
|
+
return t(`planPicker.${per}`);
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
function PlanCard({ plan, copy, priceLabel, intervalLabel, chip, isCurrent, ctaLabel, isChoosing, busyLabel, disabled, onChoose, }) {
|
|
115
|
+
const t = useT();
|
|
116
|
+
const outlined = (chip === null || chip === void 0 ? void 0 : chip.tone) === 'blue';
|
|
117
|
+
return (jsxs("div", { "data-testid": `plan-card-${plan.key}`, "data-current": isCurrent ? 'true' : undefined, role: "group", "aria-labelledby": `plan-card-${plan.key}-name`, className: cn(
|
|
118
|
+
// Each card spans the five shared rows of the picker grid (header, price,
|
|
119
|
+
// button, bullets, audience), so those land on the same lines across the row.
|
|
120
|
+
'relative grid grid-rows-subgrid row-span-5 rounded-xl border bg-white p-5 dark:bg-gray-950', outlined
|
|
121
|
+
? 'border-[#155dfc] shadow-[0_0_0_1px_#155dfc]'
|
|
122
|
+
: 'border-[#e5e7eb] dark:border-gray-800'), children: [chip && (jsx("span", { className: cn('absolute -top-2.5 left-5 rounded-full px-2.5 py-0.5 text-[11px] font-semibold uppercase tracking-wide', chip.tone === 'blue'
|
|
123
|
+
? 'bg-[#155dfc] text-white'
|
|
124
|
+
: 'border border-[#e5e7eb] bg-[#f3f4f6] text-[#4a5565] dark:border-gray-700 dark:bg-gray-800 dark:text-gray-300'), children: chip.label })), jsxs("div", { children: [jsx("h3", { id: `plan-card-${plan.key}-name`, className: "text-[16px] font-semibold leading-6 text-[#101828] dark:text-gray-100", children: copy.name }), jsx("p", { className: "mt-1 text-[13px] leading-5 text-[#4a5565] dark:text-gray-400", children: copy.tagline })] }), jsxs("div", { className: "mt-4", children: [priceLabel && (jsxs("div", { className: "flex items-baseline gap-1.5", children: [jsx("span", { className: "text-[28px] font-semibold leading-8 text-[#101828] dark:text-gray-100", children: priceLabel }), intervalLabel && (jsx("span", { className: "text-[13px] leading-5 text-[#6a7282] dark:text-gray-400", children: intervalLabel }))] })), copy.priceNote && (jsx("p", { className: "mt-1 text-[12px] leading-4 text-[#6a7282] dark:text-gray-400", children: copy.priceNote }))] }), jsx("div", { className: "mt-4 self-end", children: isCurrent ? (jsx(Button, { type: "button", variant: "outline", disabled: true, "aria-disabled": "true", className: "h-9 w-full px-4 text-[14px] font-medium disabled:opacity-100 disabled:text-[#4a5565] dark:disabled:text-gray-300", children: t('planPicker.currentPlan') })) : (jsx(Button, { type: "button", onClick: onChoose, disabled: disabled, className: GRADIENT_BUTTON_CLASS, children: isChoosing ? (jsxs(Fragment, { children: [jsx(LoaderCircle, { className: "h-4 w-4 animate-spin", "aria-hidden": "true" }), jsx("span", { children: busyLabel })] })) : (ctaLabel) })) }), jsx("div", { className: "mt-4", children: copy.features.length > 0 && (jsxs(Fragment, { children: [copy.featuresLead && (jsx("p", { className: "mb-2 text-[13px] font-semibold leading-5 text-[#101828] dark:text-gray-100", children: copy.featuresLead })), jsx("ul", { className: "space-y-2", children: copy.features.map((feature) => (jsxs("li", { className: "flex items-start gap-2 text-[13px] leading-5 text-[#364153] dark:text-gray-300", children: [jsx(Check, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-[#155dfc]", strokeWidth: 3, "aria-hidden": "true" }), jsx(FeatureText, { text: feature })] }, feature))) })] })) }), jsx("div", { className: "mt-4", children: copy.audience && (jsxs("p", { "data-testid": `plan-audience-${plan.key}`, className: "flex items-start gap-2 border-t border-[#e5e7eb] pt-3 text-[13px] leading-5 text-[#4a5565] dark:border-gray-800 dark:text-gray-400", children: [jsx(Users, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-[#6a7282]", "aria-hidden": "true" }), jsx("span", { children: copy.audience })] })) })] }));
|
|
125
|
+
}
|
|
126
|
+
function gridClassFor(count) {
|
|
127
|
+
if (count <= 1)
|
|
128
|
+
return 'grid gap-3 max-w-sm mx-auto';
|
|
129
|
+
if (count === 2)
|
|
130
|
+
return 'grid gap-3 sm:grid-cols-2 max-w-2xl mx-auto';
|
|
131
|
+
if (count === 3)
|
|
132
|
+
return 'grid gap-3 sm:grid-cols-2 lg:grid-cols-3';
|
|
133
|
+
return 'grid gap-3 sm:grid-cols-2 lg:grid-cols-4';
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* The plan picker: one card per plan the platform offers (names and prices from
|
|
137
|
+
* Stripe through the pricing-page session), each with a button that opens that
|
|
138
|
+
* plan's Stripe checkout. A free-trial user picks their first plan; an account
|
|
139
|
+
* already on a plan (`currentPlanKey`) sees it marked "Current Plan" and can
|
|
140
|
+
* upgrade or downgrade to another. The person comes back to their workspace
|
|
141
|
+
* through the backend's checkout callback.
|
|
142
|
+
*
|
|
143
|
+
* With `checkoutUrl` it offers that single link instead (an app's direct join URL).
|
|
144
|
+
*/
|
|
145
|
+
function UpgradePackageModal({ open, onClose, redirectUrl, sourcePlatformKey, mainPlatformKey, currentUserEmail, currentPlanKey, checkoutUrl, title, description, ctaLabel, features, planFeatures, footerNote, enterpriseContactUrl = DEFAULT_ENTERPRISE_CONTACT_URL, onPlanChanged, onAddCredits, className, }) {
|
|
146
|
+
var _a;
|
|
147
|
+
const t = useT();
|
|
148
|
+
const locale = useWebContainersLocale();
|
|
149
|
+
const { planFeatures: configPlanFeatures } = useSubscriptionConfig();
|
|
150
|
+
const planCopy = usePlanCopy(planFeatures !== null && planFeatures !== void 0 ? planFeatures : configPlanFeatures);
|
|
151
|
+
const planInterval = usePlanInterval();
|
|
152
|
+
const { plans, isLoadingPlans, plansError, loadPlans, choosePlan, changePlan } = useStripeUpgrade({
|
|
18
153
|
redirectUrl,
|
|
19
154
|
sourcePlatformKey,
|
|
20
155
|
mainPlatformKey,
|
|
21
156
|
currentUserEmail,
|
|
22
157
|
});
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
158
|
+
const [choosingKey, setChoosingKey] = useState(null);
|
|
159
|
+
useEffect(() => {
|
|
160
|
+
if (open && !checkoutUrl) {
|
|
161
|
+
void (loadPlans === null || loadPlans === void 0 ? void 0 : loadPlans());
|
|
162
|
+
}
|
|
163
|
+
if (!open)
|
|
164
|
+
setChoosingKey(null);
|
|
165
|
+
}, [open, checkoutUrl, loadPlans]);
|
|
166
|
+
const singleLinkPlan = checkoutUrl
|
|
167
|
+
? {
|
|
168
|
+
key: 'free',
|
|
169
|
+
name: t('planPicker.plans.free.name'),
|
|
170
|
+
description: '',
|
|
171
|
+
checkoutUrl,
|
|
172
|
+
stripeProductId: null,
|
|
173
|
+
priceAmount: null,
|
|
174
|
+
priceCurrency: null,
|
|
175
|
+
priceInterval: null,
|
|
176
|
+
priceIntervalCount: null,
|
|
177
|
+
}
|
|
178
|
+
: null;
|
|
179
|
+
const offers = singleLinkPlan ? [singleLinkPlan] : (plans !== null && plans !== void 0 ? plans : []);
|
|
180
|
+
// Enterprise is not a plan: code ownership and services are sold by the team, so
|
|
181
|
+
// a banner above the plans leads to the contact page instead of a fifth card.
|
|
182
|
+
const showEnterprise = Boolean(!singleLinkPlan && enterpriseContactUrl && offers.length > 0);
|
|
183
|
+
const isChangeMode = Boolean(currentPlanKey) && !singleLinkPlan;
|
|
184
|
+
const formatDate = (date) => new Intl.DateTimeFormat(locale, { month: 'long', day: 'numeric', year: 'numeric' }).format(date);
|
|
185
|
+
const handleChoose = async (plan) => {
|
|
186
|
+
setChoosingKey(plan.key);
|
|
187
|
+
try {
|
|
188
|
+
if (checkoutUrl) {
|
|
189
|
+
await openExternalUrl(checkoutUrl);
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
if (!isChangeMode) {
|
|
193
|
+
await choosePlan(plan);
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
// Already on a plan: the backend swaps or ends the subscription, or asks
|
|
197
|
+
// for a checkout (then the hook has opened it and the plan is set on return).
|
|
198
|
+
const result = await changePlan(plan);
|
|
199
|
+
if (result.status === 'checkout')
|
|
200
|
+
return;
|
|
201
|
+
const name = planCopy(plan).name;
|
|
202
|
+
if (result.status === 'scheduled') {
|
|
203
|
+
toast.success(result.effectiveAt
|
|
204
|
+
? t('planPicker.scheduled', { date: formatDate(result.effectiveAt), plan: name })
|
|
205
|
+
: t('planPicker.scheduledSoon', { plan: name }));
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
toast.success(t('planPicker.changed', { plan: name }));
|
|
209
|
+
}
|
|
210
|
+
onPlanChanged === null || onPlanChanged === void 0 ? void 0 : onPlanChanged(result);
|
|
211
|
+
onClose();
|
|
212
|
+
}
|
|
213
|
+
catch (error) {
|
|
214
|
+
toast.error(error instanceof StripePlanChangeRefused ? error.message : t('planPicker.changeFailed'));
|
|
215
|
+
}
|
|
216
|
+
finally {
|
|
217
|
+
setChoosingKey(null);
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
const currentOffer = isChangeMode
|
|
221
|
+
? ((_a = offers.find((offer) => offer.key === currentPlanKey)) !== null && _a !== void 0 ? _a : null)
|
|
222
|
+
: null;
|
|
223
|
+
const currentPlanName = currentOffer
|
|
224
|
+
? planCopy(currentOffer).name
|
|
225
|
+
: currentPlanKey
|
|
226
|
+
? STRIPE_PLAN_FALLBACK_NAMES[currentPlanKey] || currentPlanKey
|
|
227
|
+
: '';
|
|
228
|
+
// Until the first load answers, `plans` is still null: show skeletons rather
|
|
229
|
+
// than a one-frame "no plans" message before the effect kicks in.
|
|
230
|
+
const isLoading = !checkoutUrl &&
|
|
231
|
+
!plansError &&
|
|
232
|
+
(Boolean(isLoadingPlans) || plans == null) &&
|
|
233
|
+
offers.length === 0;
|
|
234
|
+
const skeletonCount = (plans === null || plans === void 0 ? void 0 : plans.length) || 4;
|
|
235
|
+
const ctaFor = (plan, name) => {
|
|
236
|
+
if (!isChangeMode || !currentPlanKey)
|
|
237
|
+
return t('planPicker.choosePlan', { plan: name });
|
|
238
|
+
const diff = planRank(plan.key) - planRank(currentPlanKey);
|
|
239
|
+
if (diff > 0)
|
|
240
|
+
return t('planPicker.upgradeTo', { plan: name });
|
|
241
|
+
if (diff < 0)
|
|
242
|
+
return t('planPicker.downgradeTo', { plan: name });
|
|
243
|
+
return t('planPicker.switchTo', { plan: name });
|
|
244
|
+
};
|
|
245
|
+
let body;
|
|
246
|
+
if (isLoading) {
|
|
247
|
+
body = (jsxs("div", { className: gridClassFor(skeletonCount), "aria-busy": "true", children: [jsx("span", { role: "status", className: "sr-only", children: t('planPicker.loadingPlans') }), Array.from({ length: skeletonCount }, (_, i) => (jsxs("div", { className: "row-span-5 rounded-xl border border-[#e5e7eb] p-5 dark:border-gray-800", children: [jsx(Skeleton, { className: "h-5 w-24" }), jsx(Skeleton, { className: "mt-2 h-4 w-32" }), jsx(Skeleton, { className: "mt-5 h-8 w-20" }), jsx(Skeleton, { className: "mt-5 h-9 w-full" }), jsx(Skeleton, { className: "mt-5 h-4 w-full" }), jsx(Skeleton, { className: "mt-2 h-4 w-5/6" })] }, i)))] }));
|
|
248
|
+
}
|
|
249
|
+
else if (!checkoutUrl && plansError) {
|
|
250
|
+
body = (jsxs("div", { className: "flex flex-col items-center gap-3 py-8 text-center", children: [jsx("p", { role: "alert", className: "text-[14px] leading-5 text-[#4a5565] dark:text-gray-400", children: t('planPicker.loadFailed') }), jsx(Button, { type: "button", variant: "outline", className: "h-9 px-4 text-[14px] font-medium", onClick: () => void loadPlans(), children: t('planPicker.tryAgain') })] }));
|
|
251
|
+
}
|
|
252
|
+
else if (offers.length === 0) {
|
|
253
|
+
body = (jsx("p", { className: "py-8 text-center text-[14px] leading-5 text-[#4a5565] dark:text-gray-400", children: t('planPicker.noPlans') }));
|
|
254
|
+
}
|
|
255
|
+
else {
|
|
256
|
+
body = (jsx("div", { className: gridClassFor(offers.length), children: offers.map((plan) => {
|
|
257
|
+
const copy = singleLinkPlan
|
|
258
|
+
? {
|
|
259
|
+
name: t('planPicker.plans.free.name'),
|
|
260
|
+
tagline: t('planPicker.plans.free.tagline'),
|
|
261
|
+
priceNote: footerNote !== null && footerNote !== void 0 ? footerNote : t('planPicker.plans.free.priceNote'),
|
|
262
|
+
features: features !== null && features !== void 0 ? features : [
|
|
263
|
+
t('planPicker.singleLink.feature1'),
|
|
264
|
+
t('planPicker.singleLink.feature2'),
|
|
265
|
+
t('planPicker.singleLink.feature3'),
|
|
266
|
+
],
|
|
267
|
+
}
|
|
268
|
+
: planCopy(plan);
|
|
269
|
+
const isCurrent = isChangeMode && plan.key === currentPlanKey;
|
|
270
|
+
let chip = null;
|
|
271
|
+
if (isCurrent) {
|
|
272
|
+
chip = { label: t('planPicker.currentPlan'), tone: 'gray' };
|
|
273
|
+
}
|
|
274
|
+
else if (!isChangeMode && !singleLinkPlan && offers.length > 1) {
|
|
275
|
+
chip =
|
|
276
|
+
plan.key === HIGHLIGHTED_PLAN_KEY
|
|
277
|
+
? { label: t('planPicker.mostPopular'), tone: 'blue' }
|
|
278
|
+
: null;
|
|
279
|
+
}
|
|
280
|
+
return (jsx(PlanCard, { plan: plan, copy: copy, priceLabel: formatPlanPrice(plan, locale), intervalLabel: planInterval(plan), chip: chip, isCurrent: isCurrent, ctaLabel: singleLinkPlan
|
|
281
|
+
? (ctaLabel !== null && ctaLabel !== void 0 ? ctaLabel : t('planPicker.choosePlan', { plan: copy.name }))
|
|
282
|
+
: ctaFor(plan, copy.name), isChoosing: choosingKey === plan.key,
|
|
283
|
+
// A plan change usually happens in place; only a checkout leaves the page.
|
|
284
|
+
busyLabel: isChangeMode ? t('planPicker.updating') : t('planPicker.redirecting'), disabled: choosingKey !== null, onChoose: () => void handleChoose(plan) }, plan.key));
|
|
285
|
+
}) }));
|
|
286
|
+
}
|
|
287
|
+
const defaultTitle = isChangeMode ? t('planPicker.changeTitle') : t('planPicker.title');
|
|
288
|
+
const defaultDescription = isChangeMode
|
|
289
|
+
? t('planPicker.changeDescription', { plan: currentPlanName })
|
|
290
|
+
: t('planPicker.description');
|
|
291
|
+
return (jsx(Dialog, { open: open, onOpenChange: (isOpen) => !isOpen && onClose(), children: jsxs(DialogContent, { className: cn('flex max-h-[90vh] w-[94vw] max-w-5xl flex-col gap-0 overflow-hidden rounded-[10px] border border-[#e5e5e5] p-0 shadow-[0_10px_15px_-3px_rgba(0,0,0,0.1),0_4px_6px_-4px_rgba(0,0,0,0.1)] dark:border-gray-800', className), children: [jsx("div", { className: "flex-shrink-0 border-b border-[#e5e7eb] bg-[linear-gradient(135deg,#f5f8ff_0%,#ffffff_100%)] px-6 pb-5 pt-6 pr-14 dark:border-gray-800 dark:bg-none", children: jsxs(DialogHeader, { className: "space-y-1.5 text-left sm:text-left", children: [jsx(DialogTitle, { className: "text-[20px] font-semibold leading-7 tracking-tight text-[#101828] dark:text-gray-100", children: title !== null && title !== void 0 ? title : defaultTitle }), jsxs(DialogDescription, { className: "text-[14px] font-normal leading-[22px] text-[#4a5565] dark:text-gray-400", children: [description !== null && description !== void 0 ? description : defaultDescription, showEnterprise && (jsxs("span", { "data-testid": "plan-picker-enterprise", children: [' ', t('planPicker.enterprise.text'), ' ', jsx("a", { href: enterpriseContactUrl, target: "_blank", rel: "noopener noreferrer", className: "font-medium text-[#155dfc] underline underline-offset-2 hover:text-[#1447e6] focus:outline-none focus-visible:ring-2 focus-visible:ring-[#1447e6] focus-visible:ring-offset-1 rounded-sm", children: t('planPicker.enterprise.link') }), "."] }))] })] }) }), jsxs("div", { className: "min-h-0 flex-1 overflow-y-auto overflow-x-hidden px-6 py-5", children: [onAddCredits && isChangeMode && offers.length > 0 && (jsxs("div", { "data-testid": "plan-picker-one-time-credits", className: "mb-5 flex flex-col gap-3 rounded-xl border border-dashed border-[#d0e0ff] bg-[#f5f8ff] px-5 py-4 sm:flex-row sm:items-center sm:justify-between dark:border-gray-700 dark:bg-gray-900", children: [jsxs("p", { className: "flex items-start gap-2 text-[14px] leading-5 text-[#364153] dark:text-gray-300", children: [jsx(Coins, { className: "mt-0.5 h-4 w-4 shrink-0 text-[#155dfc]", "aria-hidden": "true" }), jsx("span", { children: t('planPicker.oneTimeCreditsText') })] }), jsx(Button, { type: "button", variant: "outline", className: "h-9 shrink-0 self-start bg-white px-4 text-[14px] font-medium sm:self-center dark:bg-gray-950", onClick: onAddCredits, children: t('planPicker.oneTimeCreditsCta') })] })), body] })] }) }));
|
|
31
292
|
}
|
|
32
293
|
|
|
33
294
|
export { UpgradePackageModal };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upgrade-package-modal.js","sources":["../../../../../../../src/components/modals/upgrade-package-modal.tsx"],"sourcesContent":[null],"names":["_jsx","_jsxs","Loader2"],"mappings":";;;;;;;;;;AA+BA,MAAM,gBAAgB,GAAG;IACvB,4BAA4B;IAC5B,uCAAuC;IACvC,iCAAiC;CAClC;SAEe,mBAAmB,CAAC,EAClC,IAAI,EACJ,OAAO,EACP,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,KAAK,GAAG,mCAAmC,EAC3C,WAAW,GAAG,uFAAuF,EACrG,QAAQ,GAAG,kBAAkB,EAC7B,QAAQ,GAAG,gBAAgB,EAC3B,UAAU,GAAG,0CAA0C,EACvD,SAAS,GACgB,EAAA;AACzB,IAAA,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,GAAG,gBAAgB,CAAC;QACpD,WAAW;QACX,iBAAiB;QACjB,eAAe;QACf,gBAAgB;AACjB,KAAA,CAAC;IAEF,QACEA,IAAC,MAAM,EAAA,EAAC,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,MAAM,KAAK,CAAC,MAAM,IAAI,OAAO,EAAE,EAAA,QAAA,EAChEC,IAAA,CAAC,aAAa,EAAA,EACZ,SAAS,EAAE,EAAE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AAA,EAAA,CAEvED,GAAA,CAAA,MAAA,EAAA,EAAM,SAAS,EAAC,oFAAoF,EAAA,QAAA,EAClGA,GAAA,CAAC,KAAK,EAAA,EAAC,SAAS,EAAC,wBAAwB,EAAC,WAAW,EAAE,CAAC,EAAA,CAAI,EAAA,CACvD,EACPA,GAAA,CAAA,MAAA,EAAA,EAAM,SAAS,EAAC,aAAa,EAAA,QAAA,EAAE,OAAO,GAAQ,CAAA,EAAA,EANzC,GAAG,CAOL,CACN,CAAC,EAAA,CACC,CACN,EAEDA,GAAA,CAAC,MAAM,EAAA,EACL,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,OAAO,WAAW,GAAG,eAAe,CAAC,WAAW,CAAC,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC,EACnF,QAAQ,EAAE,SAAS,EACnB,SAAS,EAAC,+MAA+M,EAAA,QAAA,EAExN,SAAS,IACRC,4BACED,GAAA,CAACE,YAAO,IAAC,SAAS,EAAC,sBAAsB,EAAA,CAAG,EAC5CF,GAAA,CAAA,MAAA,EAAA,EAAA,QAAA,EAAA,gBAAA,EAAA,CAA2B,IAC1B,KAEH,QAAQ,CACT,EAAA,CACM,EAER,UAAU,KACTC,cAAK,SAAS,EAAC,gGAAgG,EAAA,QAAA,EAAA,CAC7GD,GAAA,CAAC,UAAU,EAAA,EAAC,SAAS,EAAC,aAAa,EAAA,aAAA,EAAa,MAAM,GAAG,EACzDA,GAAA,CAAA,MAAA,EAAA,EAAA,QAAA,EAAO,UAAU,EAAA,CAAQ,CAAA,EAAA,CACrB,CACP,CAAA,EAAA,CACG,CAAA,EAAA,CACQ,EAAA,CACT;AAEb;;;;"}
|
|
1
|
+
{"version":3,"file":"upgrade-package-modal.js","sources":["../../../../../../../src/components/modals/upgrade-package-modal.tsx"],"sourcesContent":[null],"names":["_jsx","_jsxs","_Fragment","Loader2"],"mappings":";;;;;;;;;;;;;;;AA8EA,MAAM,8BAA8B,GAAG,wBAAwB;AAI/D;AACA,MAAM,o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AC1B,MAAM,EAAC,QAAQ,EACf,GAAG,EAAC,qBAAqB,EACzB,SAAS,EAAC,0LAA0L,YAEnM,CAAC,CAAC,4BAA4B,CAAC,EAAA,CAC9B,SAEC,CACR,CAAA,EAAA,CACiB,IACP,EAAA,CACX,EAENC,IAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,4DAA4D,aAExE,YAAY,IAAI,YAAY,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,KAChDA,6BACc,8BAA8B,EAC1C,SAAS,EAAC,uLAAuL,aAEjMA,IAAA,CAAA,GAAA,EAAA,EAAG,SAAS,EAAC,gFAAgF,EAAA,QAAA,EAAA,CAC3FD,GAAA,CAAC,KAAK,EAAA,EAAC,SAAS,EAAC,wCAAwC,EAAA,aAAA,EAAa,MAAM,EAAA,CAAG,EAC/EA,wBAAO,CAAC,CAAC,+BAA+B,CAAC,EAAA,CAAQ,IAC/C,EACJA,GAAA,CAAC,MAAM,EAAA,EACL,IAAI,EAAC,QAAQ,EACb,OAAO,EAAC,SAAS,EACjB,SAAS,EAAC,+FAA+F,EACzG,OAAO,EAAE,YAAY,EAAA,QAAA,EAEpB,CAAC,CAAC,8BAA8B,CAAC,EAAA,CAC3B,IACL,CACP,EACA,IAAI,CAAA,EAAA,CACD,CAAA,EAAA,CACQ,EAAA,CACT;AAEb;;;;"}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A credit top-up that has to wait for a payment method.
|
|
3
|
+
*
|
|
4
|
+
* Someone without a card on file still just presses "Add Credits" and types an
|
|
5
|
+
* amount. We then send them to the Stripe customer portal to save a card, and
|
|
6
|
+
* when Stripe brings them back we charge that amount and add the credits —
|
|
7
|
+
* one trip instead of "add a card, come back, open Add Credits again".
|
|
8
|
+
*
|
|
9
|
+
* The amount travels on the portal's after-completion URL so the return page
|
|
10
|
+
* knows what was asked for, but the URL alone never charges anything: the
|
|
11
|
+
* amount is also written to localStorage under a one-time nonce before the
|
|
12
|
+
* redirect, and the charge only runs when the URL's nonce, amount and tenant
|
|
13
|
+
* all match that record and it is still fresh. The record is deleted the
|
|
14
|
+
* moment it is claimed, so a reload (or a second mounted surface) can't charge
|
|
15
|
+
* twice, and a crafted link can't charge an amount the person never entered.
|
|
16
|
+
*
|
|
17
|
+
* localStorage (not sessionStorage) because the Stripe portal is a full
|
|
18
|
+
* navigation and some hosts open it in a new tab.
|
|
19
|
+
*/
|
|
20
|
+
const PENDING_CREDIT_TOP_UP_STORAGE_KEY = 'ibl_pending_credit_top_up';
|
|
21
|
+
/** Query params appended to the portal's after-completion URL. */
|
|
22
|
+
const CREDIT_TOP_UP_QUERY_PARAMS = {
|
|
23
|
+
nonce: 'credit_topup',
|
|
24
|
+
amount: 'credit_topup_amount',
|
|
25
|
+
};
|
|
26
|
+
/** A top-up that is not claimed within the hour is forgotten. */
|
|
27
|
+
const PENDING_CREDIT_TOP_UP_TTL_MS = 60 * 60 * 1000;
|
|
28
|
+
function getStorage() {
|
|
29
|
+
try {
|
|
30
|
+
if (typeof window === 'undefined' || !window.localStorage)
|
|
31
|
+
return null;
|
|
32
|
+
return window.localStorage;
|
|
33
|
+
}
|
|
34
|
+
catch (_a) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function createNonce() {
|
|
39
|
+
const cryptoApi = typeof globalThis !== 'undefined' ? globalThis.crypto : undefined;
|
|
40
|
+
if (cryptoApi && typeof cryptoApi.randomUUID === 'function') {
|
|
41
|
+
return cryptoApi.randomUUID();
|
|
42
|
+
}
|
|
43
|
+
return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 12)}`;
|
|
44
|
+
}
|
|
45
|
+
/** Normalises any accepted amount input to the "25.00" form stored and sent. */
|
|
46
|
+
function normaliseTopUpAmountUsd(amount) {
|
|
47
|
+
const num = typeof amount === 'string' ? parseFloat(amount) : amount;
|
|
48
|
+
if (!Number.isFinite(num) || num <= 0)
|
|
49
|
+
return null;
|
|
50
|
+
return num.toFixed(2);
|
|
51
|
+
}
|
|
52
|
+
/** The pending record, if one is stored, well-formed and not expired. */
|
|
53
|
+
function readPendingCreditTopUp(now = Date.now()) {
|
|
54
|
+
const storage = getStorage();
|
|
55
|
+
if (!storage)
|
|
56
|
+
return null;
|
|
57
|
+
const raw = storage.getItem(PENDING_CREDIT_TOP_UP_STORAGE_KEY);
|
|
58
|
+
if (!raw)
|
|
59
|
+
return null;
|
|
60
|
+
try {
|
|
61
|
+
const parsed = JSON.parse(raw);
|
|
62
|
+
if (!parsed ||
|
|
63
|
+
typeof parsed.nonce !== 'string' ||
|
|
64
|
+
typeof parsed.amountUsd !== 'string' ||
|
|
65
|
+
typeof parsed.tenant !== 'string' ||
|
|
66
|
+
typeof parsed.createdAt !== 'number') {
|
|
67
|
+
storage.removeItem(PENDING_CREDIT_TOP_UP_STORAGE_KEY);
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
if (now - parsed.createdAt > PENDING_CREDIT_TOP_UP_TTL_MS) {
|
|
71
|
+
storage.removeItem(PENDING_CREDIT_TOP_UP_STORAGE_KEY);
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
return parsed;
|
|
75
|
+
}
|
|
76
|
+
catch (_a) {
|
|
77
|
+
storage.removeItem(PENDING_CREDIT_TOP_UP_STORAGE_KEY);
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function clearPendingCreditTopUp() {
|
|
82
|
+
var _a;
|
|
83
|
+
(_a = getStorage()) === null || _a === void 0 ? void 0 : _a.removeItem(PENDING_CREDIT_TOP_UP_STORAGE_KEY);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Records the top-up to finish after the payment method is saved and returns
|
|
87
|
+
* the URL Stripe should send the person back to: `currentUrl` plus the amount
|
|
88
|
+
* and the one-time nonce. Any existing query (e.g. `profileTab=billing`) is
|
|
89
|
+
* kept so the person lands where they left.
|
|
90
|
+
*/
|
|
91
|
+
function beginPendingCreditTopUp({ tenant, amountUsd, currentUrl, now = Date.now(), }) {
|
|
92
|
+
var _a;
|
|
93
|
+
const pending = {
|
|
94
|
+
nonce: createNonce(),
|
|
95
|
+
amountUsd,
|
|
96
|
+
tenant,
|
|
97
|
+
createdAt: now,
|
|
98
|
+
};
|
|
99
|
+
(_a = getStorage()) === null || _a === void 0 ? void 0 : _a.setItem(PENDING_CREDIT_TOP_UP_STORAGE_KEY, JSON.stringify(pending));
|
|
100
|
+
const url = new URL(currentUrl);
|
|
101
|
+
url.searchParams.set(CREDIT_TOP_UP_QUERY_PARAMS.nonce, pending.nonce);
|
|
102
|
+
url.searchParams.set(CREDIT_TOP_UP_QUERY_PARAMS.amount, pending.amountUsd);
|
|
103
|
+
return { pending, afterCompletionUrl: url.toString() };
|
|
104
|
+
}
|
|
105
|
+
/** True when the URL carries the top-up return params at all. */
|
|
106
|
+
function hasPendingCreditTopUpParams(url) {
|
|
107
|
+
try {
|
|
108
|
+
return new URL(url).searchParams.has(CREDIT_TOP_UP_QUERY_PARAMS.nonce);
|
|
109
|
+
}
|
|
110
|
+
catch (_a) {
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
/** The same URL without the top-up return params (for `history.replaceState`). */
|
|
115
|
+
function stripPendingCreditTopUpParams(url) {
|
|
116
|
+
try {
|
|
117
|
+
const parsed = new URL(url);
|
|
118
|
+
parsed.searchParams.delete(CREDIT_TOP_UP_QUERY_PARAMS.nonce);
|
|
119
|
+
parsed.searchParams.delete(CREDIT_TOP_UP_QUERY_PARAMS.amount);
|
|
120
|
+
return parsed.toString();
|
|
121
|
+
}
|
|
122
|
+
catch (_a) {
|
|
123
|
+
return url;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Claims the top-up the URL refers to: returns it, and deletes the stored
|
|
128
|
+
* record, only when the URL's nonce and amount match the record for this
|
|
129
|
+
* tenant. Returns null (and leaves nothing to claim) otherwise.
|
|
130
|
+
*/
|
|
131
|
+
function claimPendingCreditTopUp({ url, tenant, now = Date.now(), }) {
|
|
132
|
+
let params;
|
|
133
|
+
try {
|
|
134
|
+
params = new URL(url).searchParams;
|
|
135
|
+
}
|
|
136
|
+
catch (_a) {
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
const nonce = params.get(CREDIT_TOP_UP_QUERY_PARAMS.nonce);
|
|
140
|
+
const amount = params.get(CREDIT_TOP_UP_QUERY_PARAMS.amount);
|
|
141
|
+
if (!nonce || !amount)
|
|
142
|
+
return null;
|
|
143
|
+
const pending = readPendingCreditTopUp(now);
|
|
144
|
+
if (!pending)
|
|
145
|
+
return null;
|
|
146
|
+
if (pending.nonce !== nonce || pending.tenant !== tenant)
|
|
147
|
+
return null;
|
|
148
|
+
if (normaliseTopUpAmountUsd(amount) !== pending.amountUsd)
|
|
149
|
+
return null;
|
|
150
|
+
clearPendingCreditTopUp();
|
|
151
|
+
return pending;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* The backend's plain-sentence refusal from a rejected top-up call, whatever
|
|
155
|
+
* shape the data layer threw it in (`{ data: { detail } }`, `{ data: 'text' }`
|
|
156
|
+
* or a bare `{ detail }`). Undefined when there is none.
|
|
157
|
+
*/
|
|
158
|
+
function readTopUpErrorDetail(error) {
|
|
159
|
+
if (!error || typeof error !== 'object')
|
|
160
|
+
return undefined;
|
|
161
|
+
const err = error;
|
|
162
|
+
if (typeof err.data === 'string' && err.data.trim())
|
|
163
|
+
return err.data;
|
|
164
|
+
if (err.data && typeof err.data === 'object') {
|
|
165
|
+
const detail = err.data.detail;
|
|
166
|
+
if (typeof detail === 'string' && detail.trim())
|
|
167
|
+
return detail;
|
|
168
|
+
}
|
|
169
|
+
if (typeof err.detail === 'string' && err.detail.trim())
|
|
170
|
+
return err.detail;
|
|
171
|
+
return undefined;
|
|
172
|
+
}
|
|
173
|
+
function readStringField(body, key) {
|
|
174
|
+
if (!body || typeof body !== 'object')
|
|
175
|
+
return undefined;
|
|
176
|
+
const value = body[key];
|
|
177
|
+
return typeof value === 'string' && value.trim() ? value : undefined;
|
|
178
|
+
}
|
|
179
|
+
function readTopUpError(error) {
|
|
180
|
+
if (!error || typeof error !== 'object')
|
|
181
|
+
return {};
|
|
182
|
+
const err = error;
|
|
183
|
+
const body = err.data && typeof err.data === 'object' ? err.data : error;
|
|
184
|
+
return {
|
|
185
|
+
detail: readTopUpErrorDetail(error),
|
|
186
|
+
code: readStringField(body, 'code'),
|
|
187
|
+
errorType: readStringField(body, 'error_type'),
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
/** Refusals that saving a (new) card on Stripe fixes. */
|
|
191
|
+
const PAYMENT_METHOD_ERROR_TYPES = new Set(['card_error', 'payment_method_error']);
|
|
192
|
+
/**
|
|
193
|
+
* True when the backend refused the top-up because of the payment method:
|
|
194
|
+
* the card on file was refused (expired, declined, …) or there is none.
|
|
195
|
+
*/
|
|
196
|
+
function isPaymentMethodProblem(error) {
|
|
197
|
+
const { errorType } = readTopUpError(error);
|
|
198
|
+
return errorType !== undefined && PAYMENT_METHOD_ERROR_TYPES.has(errorType);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export { CREDIT_TOP_UP_QUERY_PARAMS, PENDING_CREDIT_TOP_UP_STORAGE_KEY, PENDING_CREDIT_TOP_UP_TTL_MS, beginPendingCreditTopUp, claimPendingCreditTopUp, clearPendingCreditTopUp, hasPendingCreditTopUpParams, isPaymentMethodProblem, normaliseTopUpAmountUsd, readPendingCreditTopUp, readTopUpError, readTopUpErrorDetail, stripPendingCreditTopUpParams };
|
|
202
|
+
//# sourceMappingURL=pending-credit-top-up.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pending-credit-top-up.js","sources":["../../../../../../../src/components/profile/pending-credit-top-up.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;AAkBG;AAEI,MAAM,iCAAiC,GAAG;AAEjD;A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