@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;;;;"}
|
|
@@ -1,50 +1,196 @@
|
|
|
1
|
-
import { jsx, jsxs
|
|
2
|
-
import { useState } from 'react';
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { useState, useRef, useEffect } from 'react';
|
|
3
3
|
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter } from '../ui/dialog.js';
|
|
4
4
|
import { Button } from '../ui/button.js';
|
|
5
5
|
import { Input } from '../ui/input.js';
|
|
6
6
|
import { Label } from '../ui/label.js';
|
|
7
|
-
import { useTriggerAutoRechargeMutation } from '@iblai/data-layer';
|
|
7
|
+
import { useTriggerAutoRechargeMutation, useCreateStripeCustomerPortalMutation } from '@iblai/data-layer';
|
|
8
|
+
import { openExternalUrl, isTauri } from '@iblai/web-utils';
|
|
8
9
|
import { toast } from 'sonner';
|
|
9
10
|
import { useT } from '../../i18n/context.js';
|
|
10
11
|
import '../../packages/i18n/dist/index.esm.js';
|
|
12
|
+
import { cn } from '../../lib/utils.js';
|
|
13
|
+
import { normaliseTopUpAmountUsd, readTopUpErrorDetail, isPaymentMethodProblem, beginPendingCreditTopUp, clearPendingCreditTopUp } from './pending-credit-top-up.js';
|
|
11
14
|
import DollarSign from '../../node_modules/.pnpm/lucide-react@0.528.0_react@19.1.0/node_modules/lucide-react/dist/esm/icons/dollar-sign.js';
|
|
12
15
|
import CircleAlert from '../../node_modules/.pnpm/lucide-react@0.528.0_react@19.1.0/node_modules/lucide-react/dist/esm/icons/circle-alert.js';
|
|
13
16
|
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';
|
|
14
17
|
|
|
15
|
-
|
|
18
|
+
/** The backend refuses manual top-ups under this amount. */
|
|
19
|
+
const MIN_TOP_UP_USD = 0.5;
|
|
20
|
+
/** The amounts most people pick; anything else goes through "Other amount". */
|
|
21
|
+
const PRESET_AMOUNTS_USD = [20, 50, 100];
|
|
22
|
+
/**
|
|
23
|
+
* One "Add Credits" dialog for everyone: type an amount, confirm. Whether a
|
|
24
|
+
* payment method still has to be added is handled behind the button, not by
|
|
25
|
+
* a different entry point.
|
|
26
|
+
*/
|
|
27
|
+
function AddCreditsModal({ isOpen, onClose, tenant, username, hasPaymentMethod = true, }) {
|
|
16
28
|
const t = useT();
|
|
17
|
-
const [triggerAutoRecharge, { isLoading }] = useTriggerAutoRechargeMutation();
|
|
29
|
+
const [triggerAutoRecharge, { isLoading: isCharging }] = useTriggerAutoRechargeMutation();
|
|
30
|
+
const [createStripePortal] = useCreateStripeCustomerPortalMutation();
|
|
31
|
+
const [isRedirectingToStripe, setIsRedirectingToStripe] = useState(false);
|
|
18
32
|
const [amount, setAmount] = useState('');
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
33
|
+
// The amount field stays out of the way until "Other amount" is picked;
|
|
34
|
+
// a box click puts it away again, so the field only shows while it is the
|
|
35
|
+
// thing being used.
|
|
36
|
+
const [isCustomAmount, setIsCustomAmount] = useState(false);
|
|
37
|
+
const customAmountRef = useRef(null);
|
|
38
|
+
// The backend's sentence when the card on file was refused ("Your card has
|
|
39
|
+
// expired."). While set, the dialog offers Update Payment Method instead
|
|
40
|
+
// of the usual "will be charged" notice.
|
|
41
|
+
const [paymentMethodProblem, setPaymentMethodProblem] = useState(null);
|
|
42
|
+
// What to fix about the amount, shown under it.
|
|
43
|
+
const [amountError, setAmountError] = useState(null);
|
|
44
|
+
const isBusy = isCharging || isRedirectingToStripe;
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
var _a;
|
|
47
|
+
if (isCustomAmount)
|
|
48
|
+
(_a = customAmountRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
49
|
+
}, [isCustomAmount]);
|
|
50
|
+
// Back from Stripe through the browser's Back button, the page can come back
|
|
51
|
+
// from the back/forward cache still "Redirecting..."; unlock it.
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
const onPageShow = (event) => {
|
|
54
|
+
if (event.persisted)
|
|
55
|
+
setIsRedirectingToStripe(false);
|
|
56
|
+
};
|
|
57
|
+
window.addEventListener('pageshow', onPageShow);
|
|
58
|
+
return () => window.removeEventListener('pageshow', onPageShow);
|
|
59
|
+
}, []);
|
|
60
|
+
const pickPreset = (preset) => {
|
|
61
|
+
setIsCustomAmount(false);
|
|
62
|
+
setAmount(String(preset));
|
|
63
|
+
setAmountError(null);
|
|
64
|
+
};
|
|
65
|
+
const pickCustomAmount = () => {
|
|
66
|
+
setAmount('');
|
|
67
|
+
setIsCustomAmount(true);
|
|
68
|
+
setAmountError(null);
|
|
69
|
+
};
|
|
70
|
+
const reset = () => {
|
|
71
|
+
setAmount('');
|
|
72
|
+
setIsCustomAmount(false);
|
|
73
|
+
setPaymentMethodProblem(null);
|
|
74
|
+
setAmountError(null);
|
|
75
|
+
};
|
|
76
|
+
const chargeNow = async (amountUsd) => {
|
|
30
77
|
try {
|
|
31
|
-
await triggerAutoRecharge({
|
|
32
|
-
amount_usd: amount,
|
|
33
|
-
platform_key: tenant,
|
|
34
|
-
}).unwrap();
|
|
78
|
+
await triggerAutoRecharge({ amount_usd: amountUsd, platform_key: tenant }).unwrap();
|
|
35
79
|
toast.success(t('profileAddCreditsModal.creditsAddedSuccessfully'));
|
|
36
|
-
|
|
80
|
+
reset();
|
|
37
81
|
onClose();
|
|
38
82
|
}
|
|
39
83
|
catch (error) {
|
|
40
|
-
|
|
84
|
+
const detail = readTopUpErrorDetail(error);
|
|
85
|
+
// A refused card is explained in the dialog, next to its fix; anything
|
|
86
|
+
// else gets a toast.
|
|
87
|
+
if (isPaymentMethodProblem(error)) {
|
|
88
|
+
setPaymentMethodProblem(detail !== null && detail !== void 0 ? detail : t('profileAddCreditsModal.paymentMethodRefused'));
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
toast.error(detail !== null && detail !== void 0 ? detail : t('profileAddCreditsModal.failedToAddCredits'));
|
|
92
|
+
}
|
|
41
93
|
}
|
|
42
94
|
};
|
|
95
|
+
// No card yet: remember the amount, send the person to Stripe's
|
|
96
|
+
// payment-method page, and let the return page finish the charge. Only the
|
|
97
|
+
// after-completion URL carries the return params — leaving the portal by its
|
|
98
|
+
// back link brings them back with nothing to charge.
|
|
99
|
+
const addPaymentMethodThenCharge = async (amountUsd) => {
|
|
100
|
+
setIsRedirectingToStripe(true);
|
|
101
|
+
const currentUrl = window.location.href;
|
|
102
|
+
const { afterCompletionUrl } = beginPendingCreditTopUp({ tenant, amountUsd, currentUrl });
|
|
103
|
+
// The published API client still types this body as `{ return_url }`; the
|
|
104
|
+
// backend (and the regenerated api-core model) also take `flow_type` and
|
|
105
|
+
// `after_completion_url`. Passing a variable skips the literal-only check.
|
|
106
|
+
const requestBody = {
|
|
107
|
+
return_url: currentUrl,
|
|
108
|
+
flow_type: 'payment_method_update',
|
|
109
|
+
after_completion_url: afterCompletionUrl,
|
|
110
|
+
};
|
|
111
|
+
try {
|
|
112
|
+
const result = await createStripePortal({
|
|
113
|
+
org: tenant,
|
|
114
|
+
// @ts-expect-error - the published client has no userId; the regenerated api-core model does
|
|
115
|
+
userId: username,
|
|
116
|
+
requestBody,
|
|
117
|
+
}).unwrap();
|
|
118
|
+
if (result === null || result === void 0 ? void 0 : result.url) {
|
|
119
|
+
await openExternalUrl(result.url);
|
|
120
|
+
// The desktop app opens Stripe in the system browser and stays here,
|
|
121
|
+
// so the dialog must not stay locked on "Redirecting...".
|
|
122
|
+
if (isTauri())
|
|
123
|
+
setIsRedirectingToStripe(false);
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
throw new Error('No customer portal URL');
|
|
127
|
+
}
|
|
128
|
+
catch (_a) {
|
|
129
|
+
clearPendingCreditTopUp();
|
|
130
|
+
setIsRedirectingToStripe(false);
|
|
131
|
+
toast.error(t('profileAddCreditsModal.failedToOpenPaymentSettings'));
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
// The amount as "20.00", or null after telling the person what to fix.
|
|
135
|
+
const resolveAmount = () => {
|
|
136
|
+
if (!amount) {
|
|
137
|
+
setAmountError(t('profileAddCreditsModal.pleaseEnterAmount'));
|
|
138
|
+
return null;
|
|
139
|
+
}
|
|
140
|
+
const amountUsd = normaliseTopUpAmountUsd(amount);
|
|
141
|
+
if (amountUsd === null || parseFloat(amountUsd) < MIN_TOP_UP_USD) {
|
|
142
|
+
setAmountError(t('profileAddCreditsModal.pleaseEnterValidAmount'));
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
145
|
+
setAmountError(null);
|
|
146
|
+
return amountUsd;
|
|
147
|
+
};
|
|
148
|
+
const handleSubmit = async (e) => {
|
|
149
|
+
e.preventDefault();
|
|
150
|
+
const amountUsd = resolveAmount();
|
|
151
|
+
if (!amountUsd)
|
|
152
|
+
return;
|
|
153
|
+
if (hasPaymentMethod) {
|
|
154
|
+
await chargeNow(amountUsd);
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
await addPaymentMethodThenCharge(amountUsd);
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
// Same trip as having no card: save one on Stripe, charge on return.
|
|
161
|
+
const handleUpdatePaymentMethod = async () => {
|
|
162
|
+
const amountUsd = resolveAmount();
|
|
163
|
+
if (!amountUsd)
|
|
164
|
+
return;
|
|
165
|
+
await addPaymentMethodThenCharge(amountUsd);
|
|
166
|
+
};
|
|
43
167
|
const handleClose = () => {
|
|
44
|
-
|
|
168
|
+
setIsRedirectingToStripe(false);
|
|
169
|
+
reset();
|
|
45
170
|
onClose();
|
|
46
171
|
};
|
|
47
|
-
|
|
172
|
+
const submitLabel = hasPaymentMethod
|
|
173
|
+
? isCharging
|
|
174
|
+
? t('profileAddCreditsModal.processing')
|
|
175
|
+
: t('profileAddCreditsModal.addCredits')
|
|
176
|
+
: isRedirectingToStripe
|
|
177
|
+
? t('profileAddCreditsModal.redirecting')
|
|
178
|
+
: t('profileAddCreditsModal.continueToPayment');
|
|
179
|
+
return (jsx(Dialog, { open: isOpen, onOpenChange: handleClose, children: jsxs(DialogContent, { className: "max-w-md", children: [jsxs(DialogHeader, { children: [jsx(DialogTitle, { children: t('profileAddCreditsModal.title') }), jsx(DialogDescription, { children: hasPaymentMethod
|
|
180
|
+
? t('profileAddCreditsModal.description')
|
|
181
|
+
: t('profileAddCreditsModal.descriptionNoPaymentMethod') })] }), jsxs("form", { onSubmit: handleSubmit, className: "space-y-6", children: [jsxs("div", { className: "space-y-2", children: [jsx(Label, { htmlFor: isCustomAmount ? 'credit-amount' : undefined, className: "text-sm font-medium", children: t('profileAddCreditsModal.amountLabel') }), jsx("div", { role: "group", "aria-label": t('profileAddCreditsModal.quickAmounts'), className: "grid grid-cols-3 gap-3", children: PRESET_AMOUNTS_USD.map((preset) => {
|
|
182
|
+
const selected = !isCustomAmount && amount === String(preset);
|
|
183
|
+
return (jsxs("button", { type: "button", "aria-pressed": selected, disabled: isBusy, onClick: () => pickPreset(preset), className: cn('h-10 rounded-md border text-sm font-medium transition-colors', 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-1', 'disabled:cursor-not-allowed disabled:opacity-50', selected
|
|
184
|
+
? 'border-blue-600 bg-blue-50 text-blue-700 ring-1 ring-blue-600 dark:border-blue-500 dark:bg-blue-900/30 dark:text-blue-200 dark:ring-blue-500'
|
|
185
|
+
: 'border-gray-300 bg-white text-gray-700 hover:bg-gray-50 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-200 dark:hover:bg-gray-800'), children: ["$", preset] }, preset));
|
|
186
|
+
}) }), isCustomAmount ? (jsxs("div", { className: "relative", children: [jsx(DollarSign, { "aria-hidden": "true", className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-400" }), jsx(Input, { ref: customAmountRef, id: "credit-amount", type: "number", min: MIN_TOP_UP_USD, step: "0.01", placeholder: t('profileAddCreditsModal.customAmountPlaceholder'), value: amount, onChange: (e) => {
|
|
187
|
+
setAmount(e.target.value);
|
|
188
|
+
setAmountError(null);
|
|
189
|
+
}, disabled: isBusy, "aria-invalid": amountError ? true : undefined, "aria-describedby": amountError ? 'credit-amount-error' : undefined, className: "pl-9" })] })) : (jsx("button", { type: "button", disabled: isBusy, onClick: pickCustomAmount, className: "text-xs text-slate-500 underline-offset-2 hover:text-blue-600 hover:underline focus-visible:outline-none focus-visible:underline disabled:cursor-not-allowed disabled:opacity-50 dark:text-slate-400 dark:hover:text-blue-300", children: t('profileAddCreditsModal.otherAmount') })), amountError && (jsx("p", { id: "credit-amount-error", "aria-live": "polite", className: "text-xs text-red-600 dark:text-red-400", children: amountError }))] }), paymentMethodProblem ? (jsxs("div", { role: "alert", className: "space-y-3 rounded-lg border border-amber-200 bg-amber-50 p-3 dark:border-amber-800 dark:bg-amber-900/20", children: [jsxs("div", { className: "flex items-start gap-2", children: [jsx(CircleAlert, { "aria-hidden": "true", className: "mt-0.5 h-4 w-4 flex-shrink-0 text-amber-600 dark:text-amber-400" }), jsxs("p", { className: "text-xs text-amber-800 dark:text-amber-200", children: [paymentMethodProblem, " ", t('profileAddCreditsModal.paymentMethodProblemHint')] })] }), jsxs(Button, { type: "button", variant: "outline", size: "sm", disabled: isBusy, onClick: handleUpdatePaymentMethod, className: "ml-6", children: [isRedirectingToStripe && (jsx(LoaderCircle, { "aria-hidden": "true", className: "mr-2 h-4 w-4 animate-spin" })), isRedirectingToStripe
|
|
190
|
+
? t('profileAddCreditsModal.redirecting')
|
|
191
|
+
: t('profileAddCreditsModal.updatePaymentMethod')] })] })) : (jsxs("div", { className: "flex items-start gap-2 p-3 bg-blue-50 dark:bg-blue-900/20 rounded-lg border border-blue-100 dark:border-blue-800", children: [jsx(CircleAlert, { "aria-hidden": "true", className: "h-4 w-4 text-blue-500 mt-0.5 flex-shrink-0" }), jsx("p", { className: "text-xs text-blue-700 dark:text-blue-300", children: hasPaymentMethod
|
|
192
|
+
? t('profileAddCreditsModal.paymentMethodNotice')
|
|
193
|
+
: t('profileAddCreditsModal.paymentMethodSetupNotice') })] })), jsxs(DialogFooter, { className: "gap-2 sm:gap-0", children: [jsx(Button, { type: "button", variant: "outline", onClick: handleClose, disabled: isCharging, children: t('profileAddCreditsModal.cancel') }), jsxs(Button, { type: "submit", disabled: isBusy, className: "bg-gradient-to-r from-[#2563EB] to-[#93C5FD] hover:opacity-90 text-white", children: [isBusy && jsx(LoaderCircle, { "aria-hidden": "true", className: "mr-2 h-4 w-4 animate-spin" }), submitLabel] })] })] })] }) }));
|
|
48
194
|
}
|
|
49
195
|
|
|
50
196
|
export { AddCreditsModal as default };
|