@iblai/iblai-js 2.71.1 → 2.73.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/dist/data-layer/playwright/billing-tab-helpers.d.ts +61 -48
  2. package/dist/data-layer/playwright/credit-balance-helpers.d.ts +40 -18
  3. package/dist/data-layer/playwright/index.d.ts +3 -2
  4. package/dist/data-layer/playwright/plan-picker-helpers.d.ts +26 -0
  5. package/dist/data-layer/playwright/spend-limits-helpers.d.ts +5 -4
  6. package/dist/playwright/index.cjs +306 -193
  7. package/dist/playwright/index.cjs.map +1 -1
  8. package/dist/playwright/index.d.ts +133 -71
  9. package/dist/playwright/index.esm.js +293 -194
  10. package/dist/playwright/index.esm.js.map +1 -1
  11. package/dist/playwright/playwright/billing-tab-helpers.d.ts +61 -48
  12. package/dist/playwright/playwright/credit-balance-helpers.d.ts +40 -18
  13. package/dist/playwright/playwright/index.d.ts +3 -2
  14. package/dist/playwright/playwright/plan-picker-helpers.d.ts +26 -0
  15. package/dist/playwright/playwright/spend-limits-helpers.d.ts +5 -4
  16. package/dist/security/playwright/billing-tab-helpers.d.ts +61 -48
  17. package/dist/security/playwright/credit-balance-helpers.d.ts +40 -18
  18. package/dist/security/playwright/index.d.ts +3 -2
  19. package/dist/security/playwright/plan-picker-helpers.d.ts +26 -0
  20. package/dist/security/playwright/spend-limits-helpers.d.ts +5 -4
  21. package/dist/web-containers/playwright/billing-tab-helpers.d.ts +61 -48
  22. package/dist/web-containers/playwright/credit-balance-helpers.d.ts +40 -18
  23. package/dist/web-containers/playwright/index.d.ts +3 -2
  24. package/dist/web-containers/playwright/plan-picker-helpers.d.ts +26 -0
  25. package/dist/web-containers/playwright/spend-limits-helpers.d.ts +5 -4
  26. package/dist/web-containers/source/add-credits-modal.js +170 -24
  27. package/dist/web-containers/source/add-credits-modal.js.map +1 -1
  28. package/dist/web-containers/source/auto-recharge-modal.js +1 -1
  29. package/dist/web-containers/source/auto-recharge-modal.js.map +1 -1
  30. package/dist/web-containers/source/billing-credits.js +4 -4
  31. package/dist/web-containers/source/billing-credits.js.map +1 -1
  32. package/dist/web-containers/source/billing.js +60 -101
  33. package/dist/web-containers/source/billing.js.map +1 -1
  34. package/dist/web-containers/source/components/credit-balance.js +44 -72
  35. package/dist/web-containers/source/components/credit-balance.js.map +1 -1
  36. package/dist/web-containers/source/components/modals/contact-admin-modal.js +32 -0
  37. package/dist/web-containers/source/components/modals/contact-admin-modal.js.map +1 -0
  38. package/dist/web-containers/source/components/modals/upgrade-package-modal.js +281 -20
  39. package/dist/web-containers/source/components/modals/upgrade-package-modal.js.map +1 -1
  40. package/dist/web-containers/source/components/profile/add-credits-modal.js +170 -24
  41. package/dist/web-containers/source/components/profile/add-credits-modal.js.map +1 -1
  42. package/dist/web-containers/source/components/profile/auto-recharge-modal.js +1 -1
  43. package/dist/web-containers/source/components/profile/auto-recharge-modal.js.map +1 -1
  44. package/dist/web-containers/source/components/profile/billing-credits.js +4 -4
  45. package/dist/web-containers/source/components/profile/billing-credits.js.map +1 -1
  46. package/dist/web-containers/source/components/profile/billing.js +60 -101
  47. package/dist/web-containers/source/components/profile/billing.js.map +1 -1
  48. package/dist/web-containers/source/components/profile/pending-credit-top-up.js +202 -0
  49. package/dist/web-containers/source/components/profile/pending-credit-top-up.js.map +1 -0
  50. package/dist/web-containers/source/components/profile/use-complete-pending-credit-top-up.js +68 -0
  51. package/dist/web-containers/source/components/profile/use-complete-pending-credit-top-up.js.map +1 -0
  52. package/dist/web-containers/source/components/subscription-top-banner.js +119 -0
  53. package/dist/web-containers/source/components/subscription-top-banner.js.map +1 -0
  54. package/dist/web-containers/source/components/welcome-chat/welcome-message.js +23 -3
  55. package/dist/web-containers/source/components/welcome-chat/welcome-message.js.map +1 -1
  56. package/dist/web-containers/source/contact-admin-modal.js +32 -0
  57. package/dist/web-containers/source/contact-admin-modal.js.map +1 -0
  58. package/dist/web-containers/source/credit-balance.js +44 -72
  59. package/dist/web-containers/source/credit-balance.js.map +1 -1
  60. package/dist/web-containers/source/en.json.js +125 -21
  61. package/dist/web-containers/source/en.json.js.map +1 -1
  62. package/dist/web-containers/source/es.json.js +127 -23
  63. package/dist/web-containers/source/es.json.js.map +1 -1
  64. package/dist/web-containers/source/fr.json.js +125 -21
  65. package/dist/web-containers/source/fr.json.js.map +1 -1
  66. package/dist/web-containers/source/i18n/messages/en.json.js +125 -21
  67. package/dist/web-containers/source/i18n/messages/en.json.js.map +1 -1
  68. package/dist/web-containers/source/i18n/messages/es.json.js +127 -23
  69. package/dist/web-containers/source/i18n/messages/es.json.js.map +1 -1
  70. package/dist/web-containers/source/i18n/messages/fr.json.js +125 -21
  71. package/dist/web-containers/source/i18n/messages/fr.json.js.map +1 -1
  72. package/dist/web-containers/source/i18n/messages/zh.json.js +126 -22
  73. package/dist/web-containers/source/i18n/messages/zh.json.js.map +1 -1
  74. package/dist/web-containers/source/messages/en.json.js +125 -21
  75. package/dist/web-containers/source/messages/en.json.js.map +1 -1
  76. package/dist/web-containers/source/messages/es.json.js +127 -23
  77. package/dist/web-containers/source/messages/es.json.js.map +1 -1
  78. package/dist/web-containers/source/messages/fr.json.js +125 -21
  79. package/dist/web-containers/source/messages/fr.json.js.map +1 -1
  80. package/dist/web-containers/source/messages/zh.json.js +126 -22
  81. package/dist/web-containers/source/messages/zh.json.js.map +1 -1
  82. package/dist/web-containers/source/modals/contact-admin-modal.js +32 -0
  83. package/dist/web-containers/source/modals/contact-admin-modal.js.map +1 -0
  84. package/dist/web-containers/source/modals/upgrade-package-modal.js +281 -20
  85. package/dist/web-containers/source/modals/upgrade-package-modal.js.map +1 -1
  86. package/dist/web-containers/source/pending-credit-top-up.js +202 -0
  87. package/dist/web-containers/source/pending-credit-top-up.js.map +1 -0
  88. package/dist/web-containers/source/profile/add-credits-modal.js +170 -24
  89. package/dist/web-containers/source/profile/add-credits-modal.js.map +1 -1
  90. package/dist/web-containers/source/profile/auto-recharge-modal.js +1 -1
  91. package/dist/web-containers/source/profile/auto-recharge-modal.js.map +1 -1
  92. package/dist/web-containers/source/profile/billing-credits.js +4 -4
  93. package/dist/web-containers/source/profile/billing-credits.js.map +1 -1
  94. package/dist/web-containers/source/profile/billing.js +60 -101
  95. package/dist/web-containers/source/profile/billing.js.map +1 -1
  96. package/dist/web-containers/source/profile/pending-credit-top-up.js +202 -0
  97. package/dist/web-containers/source/profile/pending-credit-top-up.js.map +1 -0
  98. package/dist/web-containers/source/profile/use-complete-pending-credit-top-up.js +68 -0
  99. package/dist/web-containers/source/profile/use-complete-pending-credit-top-up.js.map +1 -0
  100. package/dist/web-containers/source/subscription-top-banner.js +119 -0
  101. package/dist/web-containers/source/subscription-top-banner.js.map +1 -0
  102. package/dist/web-containers/source/tsconfig.build.tsbuildinfo +1 -1
  103. package/dist/web-containers/source/upgrade-package-modal.js +281 -20
  104. package/dist/web-containers/source/upgrade-package-modal.js.map +1 -1
  105. package/dist/web-containers/source/use-complete-pending-credit-top-up.js +68 -0
  106. package/dist/web-containers/source/use-complete-pending-credit-top-up.js.map +1 -0
  107. package/dist/web-containers/source/web-containers/tsconfig.build.tsbuildinfo +1 -1
  108. package/dist/web-containers/source/welcome-chat/welcome-message.js +23 -3
  109. package/dist/web-containers/source/welcome-chat/welcome-message.js.map +1 -1
  110. package/dist/web-containers/source/welcome-message.js +23 -3
  111. package/dist/web-containers/source/welcome-message.js.map +1 -1
  112. package/dist/web-containers/source/zh.json.js +126 -22
  113. package/dist/web-containers/source/zh.json.js.map +1 -1
  114. package/dist/web-utils/playwright/billing-tab-helpers.d.ts +61 -48
  115. package/dist/web-utils/playwright/credit-balance-helpers.d.ts +40 -18
  116. package/dist/web-utils/playwright/index.d.ts +3 -2
  117. package/dist/web-utils/playwright/plan-picker-helpers.d.ts +26 -0
  118. package/dist/web-utils/playwright/spend-limits-helpers.d.ts +5 -4
  119. package/package.json +5 -5
@@ -1,15 +1,15 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import { useState } from 'react';
3
- import { useT } from '../../i18n/context.js';
3
+ import { useT, useWebContainersLocale } from '../../i18n/context.js';
4
4
  import '../../packages/i18n/dist/index.esm.js';
5
5
  import { Button } from '../ui/button.js';
6
6
  import { Skeleton } from '../ui/skeleton.js';
7
7
  import { Tabs, TabsList, TabsTrigger, TabsContent } from '../ui/tabs.js';
8
- import { useGetAccountBillingInfoQuery, useGetCreditTransactionsQuery, useCreateStripeCustomerPortalMutation } from '@iblai/data-layer';
9
- import { useStripeUpgrade, openExternalUrl } from '@iblai/web-utils';
10
- import { toast } from 'sonner';
8
+ import { useGetAccountBillingInfoQuery, useGetCreditTransactionsQuery } from '@iblai/data-layer';
11
9
  import AutoRechargeModal from './auto-recharge-modal.js';
12
10
  import AddCreditsModal from './add-credits-modal.js';
11
+ import { UpgradePackageModal } from '../modals/upgrade-package-modal.js';
12
+ import { useCompletePendingCreditTopUp } from './use-complete-pending-credit-top-up.js';
13
13
  import { CardInfoIcon } from '../analytics/card-info-icon.js';
14
14
  import { cn } from '../../lib/utils.js';
15
15
  import { SpendLimitsSection } from '../spend-caps/spend-limits-section.js';
@@ -17,17 +17,15 @@ import { AgentLimitsSection } from '../spend-caps/agent-limits-section.js';
17
17
  import { UserLimitsSection } from '../spend-caps/user-limits-section.js';
18
18
  import { NewUserDefaultSection } from '../spend-caps/new-user-default-section.js';
19
19
  import { resolveCreditsPerUsd, resolveCreditsPerUsdFromTransactions, resolveAvailableCreditsUsd, formatCreditsPerUsd } from './billing-credits.js';
20
- 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';
21
20
  import Sparkles from '../../node_modules/.pnpm/lucide-react@0.528.0_react@19.1.0/node_modules/lucide-react/dist/esm/icons/sparkles.js';
22
- import Wallet from '../../node_modules/.pnpm/lucide-react@0.528.0_react@19.1.0/node_modules/lucide-react/dist/esm/icons/wallet.js';
23
21
 
24
- function formatCredits(credits) {
22
+ function formatCredits(credits, locale) {
25
23
  if (credits === null || credits === undefined || Number.isNaN(credits))
26
24
  return '0';
27
- return credits.toLocaleString('en-US');
25
+ return credits.toLocaleString(locale);
28
26
  }
29
- function formatRenewalDate(dateString) {
30
- return new Date(dateString).toLocaleDateString('en-US', {
27
+ function formatDate(dateString, locale) {
28
+ return new Date(dateString).toLocaleDateString(locale, {
31
29
  month: 'short',
32
30
  day: 'numeric',
33
31
  year: 'numeric',
@@ -40,13 +38,6 @@ function getDaysRemaining(dateString) {
40
38
  const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
41
39
  return Math.max(0, diffDays);
42
40
  }
43
- function formatPlanLabel(plan) {
44
- if (plan === 'free_trial')
45
- return 'Trial';
46
- if (!plan || plan.toLowerCase().includes('free'))
47
- return 'Free';
48
- return 'Premium';
49
- }
50
41
  function formatUsd(value) {
51
42
  if (value === null || value === undefined || value === '')
52
43
  return '—';
@@ -64,69 +55,40 @@ function Stat({ label, value, hint, info }) {
64
55
  function SectionSkeleton({ withBody = false }) {
65
56
  return (jsxs("div", { className: "rounded-lg border border-[#e5e5e5] bg-white shadow-[0_1px_2px_0_rgba(0,0,0,0.05)] dark:bg-zinc-900 dark:border-zinc-800", children: [jsxs("div", { className: "flex flex-col gap-2 p-4 sm:flex-row sm:items-start sm:justify-between", children: [jsxs("div", { className: "space-y-2", children: [jsx(Skeleton, { className: "h-5 w-32" }), jsx(Skeleton, { className: "h-4 w-56" })] }), jsx(Skeleton, { className: "h-9 w-32" })] }), withBody && (jsx("div", { className: "border-t border-[#e5e7eb] dark:border-zinc-800 px-4 py-3", children: jsx("div", { className: "grid grid-cols-1 gap-4 sm:grid-cols-3", children: [0, 1, 2].map((i) => (jsxs("div", { className: "space-y-2", children: [jsx(Skeleton, { className: "h-3 w-20" }), jsx(Skeleton, { className: "h-6 w-24" })] }, i))) }) }))] }));
66
57
  }
58
+ /**
59
+ * Billing for a credits-based product: every account is on a plan (Free unless
60
+ * the backend names another) and buys credits as needed. Change Plan opens the
61
+ * plan picker once the backend says which plan the account is on. A free-trial
62
+ * user (main tenant) picks a plan first, since credits live on their own
63
+ * workspace.
64
+ *
65
+ * Adding credits is one button whether or not a card is on file: without one,
66
+ * the Add Credits dialog sends the person to Stripe to save a card and the
67
+ * charge for the amount they entered runs automatically when they come back.
68
+ */
67
69
  function BillingTab({ tenant, userActiveApp = null, username, mainPlatformKey, currentUserEmail, redirectUrl, }) {
68
- var _a, _b, _c;
70
+ var _a, _b, _c, _d;
69
71
  const t = useT();
72
+ const locale = useWebContainersLocale();
70
73
  const [isAutoRechargeModalOpen, setIsAutoRechargeModalOpen] = useState(false);
71
74
  const [isAddCreditsModalOpen, setIsAddCreditsModalOpen] = useState(false);
72
- const [isRedirectingToPaymentSettings, setIsRedirectingToPaymentSettings] = useState(false);
73
- const { isLoading: isUpgrading, handleUpgrade } = useStripeUpgrade({
74
- redirectUrl: redirectUrl !== null && redirectUrl !== void 0 ? redirectUrl : (typeof window !== 'undefined' ? window.location.href : ''),
75
- sourcePlatformKey: tenant,
76
- mainPlatformKey,
77
- currentUserEmail,
78
- });
79
- const { data: billingInfo, isLoading: isBillingInfoLoading } = useGetAccountBillingInfoQuery({ platform_key: tenant }, { refetchOnMountOrArgChange: true });
75
+ const [isPlanPickerOpen, setIsPlanPickerOpen] = useState(false);
76
+ // Finishes a top-up that was waiting for a payment method when Stripe
77
+ // returns here (the Billing tab is the usual return page).
78
+ useCompletePendingCreditTopUp({ tenant });
79
+ // Where Stripe sends the person after checkout: back here unless the host says otherwise.
80
+ const planPickerRedirectUrl = redirectUrl !== null && redirectUrl !== void 0 ? redirectUrl : (typeof window !== 'undefined' ? window.location.href : '');
81
+ const { data: billingInfo, isLoading: isBillingInfoLoading, refetch: refetchBillingInfo, } = useGetAccountBillingInfoQuery({ platform_key: tenant }, { refetchOnMountOrArgChange: true });
80
82
  // Top-up rows carry both the credits granted and the dollars paid — the
81
83
  // pair that reveals this environment's credits-per-USD rate for the
82
84
  // dollar-equivalent balance display.
83
85
  const { data: addTransactions } = useGetCreditTransactionsQuery({ platform_key: tenant, transaction_type: 'add' }, { skip: !tenant });
84
- const [createStripePortal] = useCreateStripeCustomerPortalMutation();
85
- const handleBilling = async ({ extraRequestBody = {}, }) => {
86
- return await createStripePortal({
87
- org: tenant,
88
- // @ts-expect-error - userId is not in the generated API types
89
- userId: username,
90
- requestBody: {
91
- return_url: window.location.href,
92
- ...(extraRequestBody || {}),
93
- },
94
- }).unwrap();
95
- };
96
- const handleSetupPaymentMethod = async () => {
97
- setIsRedirectingToPaymentSettings(true);
98
- try {
99
- const result = await handleBilling({
100
- extraRequestBody: {
101
- flow_type: 'payment_method_update',
102
- after_completion_url: window.location.href,
103
- },
104
- });
105
- if (result === null || result === void 0 ? void 0 : result.url) {
106
- await openExternalUrl(result.url);
107
- }
108
- else {
109
- setIsRedirectingToPaymentSettings(false);
110
- toast.error(t('profileBilling.failedToOpenPaymentSettings'));
111
- }
112
- }
113
- catch (_a) {
114
- setIsRedirectingToPaymentSettings(false);
115
- toast.error(t('profileBilling.failedToOpenPaymentSettings'));
116
- }
117
- };
118
86
  if (isBillingInfoLoading) {
119
- return (jsx("div", { className: "container mx-auto max-w-7xl !mt-0", children: jsxs("div", { className: "space-y-4", children: [jsx(SectionSkeleton, {}), jsx(SectionSkeleton, { withBody: true }), jsx(SectionSkeleton, { withBody: true })] }) }));
87
+ return (jsx("div", { className: "container mx-auto max-w-7xl !mt-0", children: jsxs("div", { className: "space-y-4", children: [jsx(SectionSkeleton, { withBody: true }), jsx(SectionSkeleton, { withBody: true })] }) }));
120
88
  }
121
89
  const billing = billingInfo;
122
- const isFreePlan = formatPlanLabel(billing === null || billing === void 0 ? void 0 : billing.current_plan) === 'Free' ||
123
- (Boolean(billing === null || billing === void 0 ? void 0 : billing.free_trial) && (billing === null || billing === void 0 ? void 0 : billing.platform_key) !== mainPlatformKey);
124
90
  const isTrialPlan = Boolean(billing === null || billing === void 0 ? void 0 : billing.free_trial) && (billing === null || billing === void 0 ? void 0 : billing.platform_key) === mainPlatformKey;
125
- const planLabel = isFreePlan
126
- ? 'Free'
127
- : isTrialPlan
128
- ? 'Trial'
129
- : 'Premium';
91
+ const hasPaymentMethod = Boolean(billing === null || billing === void 0 ? void 0 : billing.has_payment_method);
130
92
  const availableCredits = (_a = Number(billing === null || billing === void 0 ? void 0 : billing.available_credits)) !== null && _a !== void 0 ? _a : 0;
131
93
  const consumedCredits = (billing === null || billing === void 0 ? void 0 : billing.consumed_credits) != null ? parseInt(billing.consumed_credits, 10) : null;
132
94
  // Recharging is priced in dollars, so the balance shows its dollar value
@@ -143,47 +105,39 @@ function BillingTab({ tenant, userActiveApp = null, username, mainPlatformKey, c
143
105
  t('profileBilling.creditsUsdEquivalent', { amount: formatUsd(availableCreditsUsd) }),
144
106
  creditsPerUsd != null
145
107
  ? t('profileBilling.creditsConversionHint', {
146
- credits: formatCreditsPerUsd(creditsPerUsd),
108
+ credits: formatCreditsPerUsd(creditsPerUsd, locale),
147
109
  })
148
110
  : null,
149
111
  ]
150
112
  .filter(Boolean)
151
113
  .join(' · ')
152
114
  : undefined;
153
- const hasPaymentMethod = Boolean(billing === null || billing === void 0 ? void 0 : billing.has_payment_method);
154
115
  const isAutoRechargeEnabled = Boolean(billing === null || billing === void 0 ? void 0 : billing.auto_recharge_enabled);
155
116
  const spendingLimitRaw = billing === null || billing === void 0 ? void 0 : billing.auto_recharge_spending_limit_usd;
156
117
  const isUnlimitedSpendingLimit = !spendingLimitRaw || parseFloat(spendingLimitRaw || '0') === 0;
157
- const subscription = userActiveApp === null || userActiveApp === void 0 ? void 0 : userActiveApp.subscription;
158
- const onActiveSubscription = Boolean((subscription === null || subscription === void 0 ? void 0 : subscription.active) && (subscription === null || subscription === void 0 ? void 0 : subscription.subscription_ends) && (subscription === null || subscription === void 0 ? void 0 : subscription.subscription_starts));
159
- const planDescription = (() => {
160
- if (planLabel === 'Trial' && (subscription === null || subscription === void 0 ? void 0 : subscription.subscription_ends)) {
161
- return t('profileBilling.trialEndsOn', {
162
- date: formatRenewalDate(subscription.subscription_ends),
163
- days: getDaysRemaining(subscription.subscription_ends),
164
- });
165
- }
166
- if (planLabel === 'Premium' && onActiveSubscription && (subscription === null || subscription === void 0 ? void 0 : subscription.subscription_ends)) {
167
- return t('profileBilling.renewsOn', {
168
- date: formatRenewalDate(subscription.subscription_ends),
169
- });
170
- }
171
- if (planLabel === 'Free') {
172
- return t('profileBilling.youAreOnFreePlan');
173
- }
174
- return t('profileBilling.manageSubscriptionAndBilling');
175
- })();
176
- return (jsxs("div", { className: "container mx-auto max-w-7xl !mt-0", children: [jsxs(Tabs, { defaultValue: "plan", "aria-label": t('profileBilling.billingTabsAriaLabel'), children: [jsxs(TabsList, { "aria-label": t('profileBilling.billingTabsAriaLabel'), className: "max-w-full overflow-x-auto justify-start px-1", children: [jsx(TabsTrigger, { value: "plan", children: t('profileBilling.tabPlanAndCredits') }), jsx(TabsTrigger, { value: "spend-limits", children: t('profileBilling.tabSpendLimits') }), jsx(TabsTrigger, { value: "agent-limits", children: t('profileBilling.tabAgentLimits') }), jsx(TabsTrigger, { value: "user-limits", children: t('profileBilling.tabUserLimits') })] }), jsx(TabsContent, { className: "mt-4", value: "plan", children: jsxs("div", { className: "space-y-4", children: [jsxs("div", { className: "grid grid-cols-1 items-start gap-4 lg:grid-cols-3", children: [jsx(Section, { title: t('profileBilling.planSectionTitle'), testId: "billing-plan-section", description: planDescription, className: "lg:col-span-1 lg:h-full", action: isFreePlan || isTrialPlan ? (jsxs(Button, { onClick: () => handleUpgrade('premium'), disabled: isUpgrading, className: "h-9 px-4 text-[14px] font-medium text-white bg-gradient-to-r from-[rgb(56,161,229)] to-[rgb(114,132,255)] hover:opacity-90 disabled:opacity-70", children: [isUpgrading ? (jsx(LoaderCircle, { className: "h-4 w-4 animate-spin" })) : (jsx(Sparkles, { className: "h-4 w-4" })), isUpgrading ? t('profileBilling.redirecting') : t('profileBilling.upgrade')] })) : undefined, children: jsxs("div", { className: "flex items-center gap-2", children: [jsx("span", { "data-testid": "billing-plan-label", className: "text-[18px] font-semibold leading-7 text-[#101828] dark:text-gray-100", children: planLabel }), jsx("span", { className: "rounded-full px-2.5 py-0.5 text-[12px] font-medium", style: {
177
- backgroundColor: '#f5f8ff',
178
- color: '#155dfc',
179
- border: '1px solid #d0e0ff',
180
- }, children: t('profileBilling.currentBadge') })] }) }), jsx(Section, { title: t('profileBilling.creditsSectionTitle'), testId: "billing-credits-section", description: t('profileBilling.creditsDescription'), className: "lg:col-span-2 lg:h-full", action: isFreePlan || isTrialPlan ? undefined : hasPaymentMethod ? (jsx(Button, { variant: "outline", onClick: () => setIsAddCreditsModalOpen(true), className: "h-9 px-4 text-[14px] font-medium", children: t('profileBilling.addCredits') })) : (jsxs(Button, { onClick: handleSetupPaymentMethod, disabled: isRedirectingToPaymentSettings, className: "h-9 px-4 text-[14px] font-medium bg-gradient-to-r from-[#2563EB] to-[#93C5FD] hover:opacity-90 text-white", children: [isRedirectingToPaymentSettings ? (jsx(LoaderCircle, { className: "h-4 w-4 animate-spin" })) : (jsx(Wallet, { className: "h-4 w-4" })), isRedirectingToPaymentSettings
181
- ? t('profileBilling.redirecting')
182
- : t('profileBilling.manageBilling')] })), children: jsxs("div", { className: "grid grid-cols-1 gap-4 sm:grid-cols-3", children: [jsx(Stat, { label: t('profileBilling.availableLabel'), value: t('profileBilling.creditsUnit', {
183
- amount: formatCredits(availableCredits),
184
- }), hint: availableCreditsHint }), consumedCredits != null && (jsx(Stat, { label: t('profileBilling.consumedLabel'), value: t('profileBilling.creditsUnit', {
185
- amount: formatCredits(consumedCredits),
186
- }), info: t('profileBilling.usedThisPeriod') })), (billing === null || billing === void 0 ? void 0 : billing.credits_reset_date) && (jsx(Stat, { label: t('profileBilling.resetsOnLabel'), value: formatRenewalDate(billing.credits_reset_date), info: t('profileBilling.nextResetDate') }))] }) })] }), !isFreePlan && !isTrialPlan && hasPaymentMethod && (jsx(Section, { title: t('profileBilling.autoRechargeSectionTitle'), testId: "billing-auto-recharge-section", description: t('profileBilling.autoRechargeDescription'), action: jsxs("div", { className: "flex items-center gap-3", children: [jsx("span", { "data-testid": "billing-auto-recharge-status", className: "rounded-full px-2.5 py-0.5 text-[12px] font-medium", style: {
118
+ const trialEnds = (_d = userActiveApp === null || userActiveApp === void 0 ? void 0 : userActiveApp.subscription) === null || _d === void 0 ? void 0 : _d.subscription_ends;
119
+ const creditsDescription = isTrialPlan
120
+ ? trialEnds
121
+ ? t('profileBilling.trialDescriptionWithEnd', {
122
+ date: formatDate(trialEnds, locale),
123
+ days: getDaysRemaining(trialEnds),
124
+ })
125
+ : t('profileBilling.trialDescription')
126
+ : (billing === null || billing === void 0 ? void 0 : billing.plan_name)
127
+ ? t('profileBilling.planDescription', { plan: billing.plan_name })
128
+ : hasPaymentMethod
129
+ ? t('profileBilling.freePlanDescription')
130
+ : t('profileBilling.freePlanNoPaymentMethodDescription');
131
+ // Changing plans needs the backend to say which plan this is.
132
+ const currentPlanKey = !isTrialPlan && (billing === null || billing === void 0 ? void 0 : billing.plan_key) ? billing.plan_key : null;
133
+ // One primary action: trial users pick a plan (the picker opens Stripe);
134
+ // everyone else adds credits (the dialog collects a card first when none is on file).
135
+ const creditsAction = isTrialPlan ? (jsxs(Button, { onClick: () => setIsPlanPickerOpen(true), className: "h-9 px-4 text-[14px] font-medium text-white bg-gradient-to-r from-[rgb(56,161,229)] to-[rgb(114,132,255)] hover:opacity-90", children: [jsx(Sparkles, { className: "h-4 w-4" }), t('profileBilling.upgrade')] })) : (jsxs("div", { className: "flex items-center gap-3", children: [currentPlanKey && (jsx(Button, { variant: "outline", onClick: () => setIsPlanPickerOpen(true), className: "h-9 px-4 text-[14px] font-medium", children: t('profileBilling.changePlan') })), jsx(Button, { onClick: () => setIsAddCreditsModalOpen(true), className: "h-9 px-4 text-[14px] font-medium bg-gradient-to-r from-[#2563EB] to-[#93C5FD] hover:opacity-90 text-white", children: t('profileBilling.addCredits') })] }));
136
+ return (jsxs("div", { className: "container mx-auto max-w-7xl !mt-0", children: [jsxs(Tabs, { defaultValue: "credits", "aria-label": t('profileBilling.billingTabsAriaLabel'), children: [jsxs(TabsList, { "aria-label": t('profileBilling.billingTabsAriaLabel'), className: "max-w-full overflow-x-auto justify-start px-1", children: [jsx(TabsTrigger, { value: "credits", children: t('profileBilling.tabCredits') }), jsx(TabsTrigger, { value: "spend-limits", children: t('profileBilling.tabSpendLimits') }), jsx(TabsTrigger, { value: "agent-limits", children: t('profileBilling.tabAgentLimits') }), jsx(TabsTrigger, { value: "user-limits", children: t('profileBilling.tabUserLimits') })] }), jsx(TabsContent, { className: "mt-4", value: "credits", children: jsxs("div", { className: "space-y-4", children: [jsx(Section, { title: t('profileBilling.creditsSectionTitle'), testId: "billing-credits-section", description: creditsDescription, action: creditsAction, children: jsxs("div", { className: "grid grid-cols-1 gap-4 sm:grid-cols-3", children: [jsx(Stat, { label: t('profileBilling.availableLabel'), value: t('profileBilling.creditsUnit', {
137
+ amount: formatCredits(availableCredits, locale),
138
+ }), hint: availableCreditsHint }), consumedCredits != null && (jsx(Stat, { label: t('profileBilling.consumedLabel'), value: t('profileBilling.creditsUnit', {
139
+ amount: formatCredits(consumedCredits, locale),
140
+ }), info: t('profileBilling.usedThisPeriod') })), (billing === null || billing === void 0 ? void 0 : billing.credits_reset_date) && (jsx(Stat, { label: t('profileBilling.resetsOnLabel'), value: formatDate(billing.credits_reset_date, locale), info: t('profileBilling.nextResetDate') }))] }) }), !isTrialPlan && hasPaymentMethod && (jsx(Section, { title: t('profileBilling.autoRechargeSectionTitle'), testId: "billing-auto-recharge-section", description: t('profileBilling.autoRechargeDescription'), action: jsxs("div", { className: "flex items-center gap-3", children: [jsx("span", { "data-testid": "billing-auto-recharge-status", className: "rounded-full px-2.5 py-0.5 text-[12px] font-medium", style: {
187
141
  backgroundColor: isAutoRechargeEnabled ? '#f5f8ff' : '#f3f4f6',
188
142
  color: isAutoRechargeEnabled ? '#155dfc' : '#6a7282',
189
143
  border: `1px solid ${isAutoRechargeEnabled ? '#d0e0ff' : '#e5e7eb'}`,
@@ -191,7 +145,12 @@ function BillingTab({ tenant, userActiveApp = null, username, mainPlatformKey, c
191
145
  ? t('profileBilling.enabled')
192
146
  : t('profileBilling.disabled') }), jsx(Button, { variant: "outline", onClick: () => setIsAutoRechargeModalOpen(true), className: "h-9 px-4 text-[14px] font-medium", children: t('profileBilling.manageUsage') })] }), children: isAutoRechargeEnabled ? (jsxs("div", { className: "grid grid-cols-1 gap-4 sm:grid-cols-3", children: [jsx(Stat, { label: t('profileBilling.thresholdLabel'), value: formatUsd(billing === null || billing === void 0 ? void 0 : billing.auto_recharge_threshold_usd), info: t('profileBilling.thresholdHint') }), jsx(Stat, { label: t('profileBilling.rechargeAmountLabel'), value: formatUsd(billing === null || billing === void 0 ? void 0 : billing.auto_recharge_amount_usd), info: t('profileBilling.rechargeAmountHint') }), jsx(Stat, { label: t('profileBilling.spendingLimitLabel'), value: isUnlimitedSpendingLimit
193
147
  ? t('profileBilling.unlimited')
194
- : formatUsd(spendingLimitRaw), info: t('profileBilling.spendingLimitHint') })] })) : (jsx("p", { className: "text-[14px] font-normal leading-5 text-[#4a5565] dark:text-gray-400", children: t('profileBilling.autoRechargeDisabledMessage') })) }))] }) }), jsx(TabsContent, { className: "mt-4", value: "spend-limits", children: jsx(SpendLimitsSection, { tenantKey: tenant }) }), jsx(TabsContent, { className: "mt-4", value: "agent-limits", children: jsx(AgentLimitsSection, { tenantKey: tenant, username: username }) }), jsx(TabsContent, { className: "mt-4", value: "user-limits", children: jsxs("div", { className: "space-y-4", children: [jsx(UserLimitsSection, { tenantKey: tenant }), jsx(NewUserDefaultSection, { tenantKey: tenant })] }) })] }), jsx(AutoRechargeModal, { tenant: tenant, isOpen: isAutoRechargeModalOpen, onClose: () => setIsAutoRechargeModalOpen(false) }), jsx(AddCreditsModal, { tenant: tenant, isOpen: isAddCreditsModalOpen, onClose: () => setIsAddCreditsModalOpen(false) })] }));
148
+ : formatUsd(spendingLimitRaw), info: t('profileBilling.spendingLimitHint') })] })) : (jsx("p", { className: "text-[14px] font-normal leading-5 text-[#4a5565] dark:text-gray-400", children: t('profileBilling.autoRechargeDisabledMessage') })) }))] }) }), jsx(TabsContent, { className: "mt-4", value: "spend-limits", children: jsx(SpendLimitsSection, { tenantKey: tenant }) }), jsx(TabsContent, { className: "mt-4", value: "agent-limits", children: jsx(AgentLimitsSection, { tenantKey: tenant, username: username }) }), jsx(TabsContent, { className: "mt-4", value: "user-limits", children: jsxs("div", { className: "space-y-4", children: [jsx(UserLimitsSection, { tenantKey: tenant }), jsx(NewUserDefaultSection, { tenantKey: tenant })] }) })] }), jsx(AutoRechargeModal, { tenant: tenant, isOpen: isAutoRechargeModalOpen, onClose: () => setIsAutoRechargeModalOpen(false) }), jsx(AddCreditsModal, { tenant: tenant, username: username, hasPaymentMethod: hasPaymentMethod, isOpen: isAddCreditsModalOpen, onClose: () => setIsAddCreditsModalOpen(false) }), jsx(UpgradePackageModal, { open: isPlanPickerOpen, onClose: () => setIsPlanPickerOpen(false), redirectUrl: planPickerRedirectUrl, sourcePlatformKey: tenant, mainPlatformKey: mainPlatformKey, currentUserEmail: currentUserEmail, currentPlanKey: currentPlanKey, onPlanChanged: () => {
149
+ void refetchBillingInfo();
150
+ }, onAddCredits: () => {
151
+ setIsPlanPickerOpen(false);
152
+ setIsAddCreditsModalOpen(true);
153
+ } })] }));
195
154
  }
196
155
 
197
156
  export { BillingTab as default };
@@ -1 +1 @@
1
- {"version":3,"file":"billing.js","sources":["../../../../../../../src/components/profile/billing.tsx"],"sourcesContent":[null],"names":["_jsxs","_jsx","Loader2"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA+BA,SAAS,aAAa,CAAC,OAAkC,EAAA;AACvD,IAAA,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK,SAAS,IAAI,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC;AAAE,QAAA,OAAO,GAAG;AAClF,IAAA,OAAO,OAAO,CAAC,cAAc,CAAC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CACT,EAEPA,IAAC,iBAAiB,EAAA,EAChB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,uBAAuB,EAC/B,OAAO,EAAE,MAAM,0BAA0B,CAAC,KAAK,CAAC,EAAA,CAChD,EAEFA,GAAA,CAAC,eAAe,EAAA,EACd,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,qBAAqB,EAC7B,OAAO,EAAE,MAAM,wBAAwB,CAAC,KAAK,CAAC,EAAA,CAC9C,CAAA,EAAA,CACE;AAEV;;;;"}
1
+ {"version":3,"file":"billing.js","sources":["../../../../../../../src/components/profile/billing.tsx"],"sourcesContent":[null],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA2BA,SAAS,aAAa,CAAC,OAAkC,EAAE,MAAc,EAAA;AACvE,IAAA,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK,SAAS,IAAI,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC;AAAE,QAAA,OAAO,GAAG;AAClF,IAAA,OAAO,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC;AACvC;AAEA,SAAS,UAAU,CAAC,UAAkB,EAAE,MAAc,EAAA;IACpD,OAAO,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;AACrD,QAAA,KAAK,EAAE,OAAO;AACd,QAAA,GAAG,EAAE,SAAS;AACd,QAAA,IAAI,EAAE,SAAS;AAChB,KAAA,CAAC;AACJ;AAEA,SAAS,gBAAgB,CAAC,UAAkB,EAAA;AAC1C,IAAA,MAAM,OAAO,GAAG,IAAI,IAAI,CAAC,UAAU,CAAC;AACpC,IAAA,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE;IACtB,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,EAAE,GAAG,GAAG,CAAC,OAAO,EAAE;AAClD,IAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,GAAG,EAAE,GAAG,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,eAAe,EAAA,EACd,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,gBAAgB,EAAE,gBAAgB,EAClC,MAAM,EAAE,qBAAqB,EAC7B,OAAO,EAAE,MAAM,wBAAwB,CAAC,KAAK,CAAC,EAAA,CAC9C,EAEFA,GAAA,CAAC,mBAAmB,IAClB,IAAI,EAAE,gBAAgB,EACtB,OAAO,EAAE,MAAM,mBAAmB,CAAC,KAAK,CAAC,EACzC,WAAW,EAAE,qBAAqB,EAClC,iBAAiB,EAAE,MAAM,EACzB,eAAe,EAAE,eAAe,EAChC,gBAAgB,EAAE,gBAAgB,EAClC,cAAc,EAAE,cAAc,EAC9B,aAAa,EAAE,MAAK;oBAClB,KAAK,kBAAkB,EAAE;AAC3B,gBAAA,CAAC,EACD,YAAY,EAAE,MAAK;oBACjB,mBAAmB,CAAC,KAAK,CAAC;oBAC1B,wBAAwB,CAAC,IAAI,CAAC;gBAChC,CAAC,EAAA,CACD,CAAA,EAAA,CACE;AAEV;;;;"}
@@ -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;AACO,MAAM,0BAA0B,GAAG;AACxC,IAAA,KAAK,EAAE,cAAc;AACrB,IAAA,MAAM,EAAE,qBAAqB;;AAG/B;MACa,4BAA4B,GAAG,EAAE,GAAG,EAAE,GAAG;AAUtD,SAAS,UAAU,GAAA;AACjB,IAAA,IAAI;QACF,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,CAAC,MAAM,CAAC,YAAY;AAAE,YAAA,OAAO,IAAI;QACtE,OAAO,MAAM,CAAC,YAAY;IAC5B;AAAE,IAAA,OAAA,EAAA,EAAM;AACN,QAAA,OAAO,IAAI;IACb;AACF;AAEA,SAAS,WAAW,GAAA;AAClB,IAAA,MAAM,SAAS,GAAG,OAAO,UAAU,KAAK,WAAW,GAAG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,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,GAAG,KAAK,GAAG,SAAS;AACtE;AAEM,SAAU,cAAc,CAAC,KAAc,EAAA;AAC3C,IAAA,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;AAAE,QAAA,OAAO,EAAE;IAClD,MAAM,GAAG,GAAG,KAA2B;IACvC,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,IAAI,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ,GAAG,GAAG,CAAC,IAAI,GAAG,KAAK;IACxE,OAAO;AACL,QAAA,MAAM,EAAE,oBAAoB,CAAC,KAAK,CAAC;AACnC,QAAA,IAAI,EAAE,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC;AACnC,QAAA,SAAS,EAAE,eAAe,CAAC,IAAI,EAAE,YAAY,CAAC;KAC/C;AACH;AAEA;AACA,MAAM,0BAA0B,GAAG,IAAI,GAAG,CAAC,CAAC,YAAY,EAAE,sBAAsB,CAAC,CAAC;AAElF;;;AAGG;AACG,SAAU,sBAAsB,CAAC,KAAc,EAAA;IACnD,MAAM,EAAE,SAAS,EAAE,GAAG,cAAc,CAAC,KAAK,CAAC;IAC3C,OAAO,SAAS,KAAK,SAAS,IAAI,0BAA0B,CAAC,GAAG,CAAC,SAAS,CAAC;AAC7E;;;;"}
@@ -0,0 +1,68 @@
1
+ import { useState, useRef, useEffect } from 'react';
2
+ import { useTriggerAutoRechargeMutation } from '@iblai/data-layer';
3
+ import { toast } from 'sonner';
4
+ import { useT } from '../../i18n/context.js';
5
+ import '../../packages/i18n/dist/index.esm.js';
6
+ import { hasPendingCreditTopUpParams, claimPendingCreditTopUp, stripPendingCreditTopUpParams, readTopUpErrorDetail } from './pending-credit-top-up.js';
7
+
8
+ function formatUsd(amount) {
9
+ const num = parseFloat(amount);
10
+ return Number.isFinite(num) ? `$${num.toFixed(2)}` : `$${amount}`;
11
+ }
12
+ /**
13
+ * Finishes a credit top-up that was waiting for a payment method (see
14
+ * `pending-credit-top-up.ts`). Mount it on every surface that offers
15
+ * "Add Credits" — the Billing tab and the navbar credit dropdown — so whichever
16
+ * one is on the page Stripe returns to charges the saved card for the amount
17
+ * the person entered, adds the credits, and says so in a toast. The billing
18
+ * query is invalidated by the mutation, so the balance on screen updates too.
19
+ *
20
+ * Claiming deletes the stored record first, so with both surfaces mounted only
21
+ * the first effect to run charges; the other finds nothing. The return params
22
+ * are removed from the address bar either way so a reload can't replay them.
23
+ */
24
+ function useCompletePendingCreditTopUp({ tenant, enabled = true, }) {
25
+ const t = useT();
26
+ const [triggerAutoRecharge] = useTriggerAutoRechargeMutation();
27
+ const [isCompleting, setIsCompleting] = useState(false);
28
+ const startedRef = useRef(false);
29
+ useEffect(() => {
30
+ if (!enabled || !tenant || startedRef.current)
31
+ return;
32
+ if (typeof window === 'undefined')
33
+ return;
34
+ const currentUrl = window.location.href;
35
+ if (!hasPendingCreditTopUpParams(currentUrl))
36
+ return;
37
+ startedRef.current = true;
38
+ const pending = claimPendingCreditTopUp({ url: currentUrl, tenant });
39
+ // A null state lets Next's patched replaceState sync the app router (and
40
+ // useSearchParams) with the new URL. Handing window.history.state back
41
+ // carries Next's internal marker, which makes it skip that sync, and a
42
+ // later router.replace built from the stale params would put the nonce
43
+ // and amount back in the address bar.
44
+ window.history.replaceState(null, '', stripPendingCreditTopUpParams(currentUrl));
45
+ if (!pending)
46
+ return;
47
+ setIsCompleting(true);
48
+ const toastId = toast.loading(t('profileAddCreditsModal.addingCredits'));
49
+ triggerAutoRecharge({ amount_usd: pending.amountUsd, platform_key: tenant })
50
+ .unwrap()
51
+ .then(() => {
52
+ toast.success(t('profileAddCreditsModal.creditsAddedAfterPayment', {
53
+ amount: formatUsd(pending.amountUsd),
54
+ }), { id: toastId });
55
+ })
56
+ .catch((error) => {
57
+ var _a;
58
+ toast.error((_a = readTopUpErrorDetail(error)) !== null && _a !== void 0 ? _a : t('profileAddCreditsModal.failedToAddCreditsAfterPayment'), { id: toastId });
59
+ })
60
+ .finally(() => setIsCompleting(false));
61
+ // The claim is one-shot by design (startedRef): re-runs from a changed
62
+ // dependency find nothing left to do.
63
+ }, [enabled, tenant, t, triggerAutoRecharge]);
64
+ return { isCompleting };
65
+ }
66
+
67
+ export { useCompletePendingCreditTopUp };
68
+ //# sourceMappingURL=use-complete-pending-credit-top-up.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-complete-pending-credit-top-up.js","sources":["../../../../../../../src/components/profile/use-complete-pending-credit-top-up.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;AAaA,SAAS,SAAS,CAAC,MAAc,EAAA;AAC/B,IAAA,MAAM,GAAG,GAAG,UAAU,CAAC,MAAM,CAAC;IAC9B,OAAO,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAA,CAAA,EAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA,CAAE,GAAG,CAAA,CAAA,EAAI,MAAM,CAAA,CAAE;AACnE;AAEA;;;;;;;;;;;AAWG;AACG,SAAU,6BAA6B,CAAC,EAC5C,MAAM,EACN,OAAO,GAAG,IAAI,GAIf,EAAA;AACC,IAAA,MAAM,CAAC,GAAG,IAAI,EAAE;AAChB,IAAA,MAAM,CAAC,mBAAmB,CAAC,GAAG,8BAA8B,EAAE;IAC9D,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC;AACvD,IAAA,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC;IAEhC,SAAS,CAAC,MAAK;QACb,IAAI,CAAC,OAAO,IAAI,CAAC,MAAM,IAAI,UAAU,CAAC,OAAO;YAAE;QAC/C,IAAI,OAAO,MAAM,KAAK,WAAW;YAAE;AACnC,QAAA,MAAM,UAAU,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI;AACvC,QAAA,IAAI,CAAC,2BAA2B,CAAC,UAAU,CAAC;YAAE;AAE9C,QAAA,UAAU,C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