@iblai/web-containers 1.72.0 → 1.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 (75) hide show
  1. package/dist/cjs/_virtual/index2.js +2 -2
  2. package/dist/cjs/_virtual/index3.js +2 -2
  3. package/dist/cjs/components/credit-balance.js +41 -69
  4. package/dist/cjs/components/credit-balance.js.map +1 -1
  5. package/dist/cjs/components/modals/contact-admin-modal.js +34 -0
  6. package/dist/cjs/components/modals/contact-admin-modal.js.map +1 -0
  7. package/dist/cjs/components/modals/upgrade-package-modal.js +279 -18
  8. package/dist/cjs/components/modals/upgrade-package-modal.js.map +1 -1
  9. package/dist/cjs/components/profile/add-credits-modal.js +167 -21
  10. package/dist/cjs/components/profile/add-credits-modal.js.map +1 -1
  11. package/dist/cjs/components/profile/auto-recharge-modal.js +1 -1
  12. package/dist/cjs/components/profile/auto-recharge-modal.js.map +1 -1
  13. package/dist/cjs/components/profile/billing-credits.js +4 -4
  14. package/dist/cjs/components/profile/billing-credits.js.map +1 -1
  15. package/dist/cjs/components/profile/billing.js +58 -99
  16. package/dist/cjs/components/profile/billing.js.map +1 -1
  17. package/dist/cjs/components/profile/pending-credit-top-up.js +216 -0
  18. package/dist/cjs/components/profile/pending-credit-top-up.js.map +1 -0
  19. package/dist/cjs/components/profile/use-complete-pending-credit-top-up.js +70 -0
  20. package/dist/cjs/components/profile/use-complete-pending-credit-top-up.js.map +1 -0
  21. package/dist/cjs/components/subscription-top-banner.js +121 -0
  22. package/dist/cjs/components/subscription-top-banner.js.map +1 -0
  23. package/dist/cjs/i18n/messages/en.json.js +122 -20
  24. package/dist/cjs/i18n/messages/en.json.js.map +1 -1
  25. package/dist/cjs/i18n/messages/es.json.js +124 -22
  26. package/dist/cjs/i18n/messages/es.json.js.map +1 -1
  27. package/dist/cjs/i18n/messages/fr.json.js +122 -20
  28. package/dist/cjs/i18n/messages/fr.json.js.map +1 -1
  29. package/dist/cjs/i18n/messages/zh.json.js +123 -21
  30. package/dist/cjs/i18n/messages/zh.json.js.map +1 -1
  31. package/dist/cjs/index.js +4 -0
  32. package/dist/cjs/index.js.map +1 -1
  33. package/dist/cjs/node_modules/.pnpm/css-mediaquery@0.1.2/node_modules/css-mediaquery/index.js +1 -1
  34. package/dist/cjs/node_modules/.pnpm/matchmediaquery@0.4.2/node_modules/matchmediaquery/index.js +1 -1
  35. package/dist/cjs/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/index.js +1 -1
  36. package/dist/cjs/web-containers/tsconfig.build.tsbuildinfo +1 -1
  37. package/dist/esm/_virtual/index2.js +2 -2
  38. package/dist/esm/_virtual/index3.js +2 -2
  39. package/dist/esm/components/credit-balance.js +44 -72
  40. package/dist/esm/components/credit-balance.js.map +1 -1
  41. package/dist/esm/components/modals/contact-admin-modal.js +32 -0
  42. package/dist/esm/components/modals/contact-admin-modal.js.map +1 -0
  43. package/dist/esm/components/modals/upgrade-package-modal.js +281 -20
  44. package/dist/esm/components/modals/upgrade-package-modal.js.map +1 -1
  45. package/dist/esm/components/profile/add-credits-modal.js +170 -24
  46. package/dist/esm/components/profile/add-credits-modal.js.map +1 -1
  47. package/dist/esm/components/profile/auto-recharge-modal.js +1 -1
  48. package/dist/esm/components/profile/auto-recharge-modal.js.map +1 -1
  49. package/dist/esm/components/profile/billing-credits.js +4 -4
  50. package/dist/esm/components/profile/billing-credits.js.map +1 -1
  51. package/dist/esm/components/profile/billing.js +60 -101
  52. package/dist/esm/components/profile/billing.js.map +1 -1
  53. package/dist/esm/components/profile/pending-credit-top-up.js +202 -0
  54. package/dist/esm/components/profile/pending-credit-top-up.js.map +1 -0
  55. package/dist/esm/components/profile/use-complete-pending-credit-top-up.js +68 -0
  56. package/dist/esm/components/profile/use-complete-pending-credit-top-up.js.map +1 -0
  57. package/dist/esm/components/subscription-top-banner.js +119 -0
  58. package/dist/esm/components/subscription-top-banner.js.map +1 -0
  59. package/dist/esm/i18n/messages/en.json.js +121 -21
  60. package/dist/esm/i18n/messages/en.json.js.map +1 -1
  61. package/dist/esm/i18n/messages/es.json.js +123 -23
  62. package/dist/esm/i18n/messages/es.json.js.map +1 -1
  63. package/dist/esm/i18n/messages/fr.json.js +121 -21
  64. package/dist/esm/i18n/messages/fr.json.js.map +1 -1
  65. package/dist/esm/i18n/messages/zh.json.js +122 -22
  66. package/dist/esm/i18n/messages/zh.json.js.map +1 -1
  67. package/dist/esm/index.js +2 -0
  68. package/dist/esm/index.js.map +1 -1
  69. package/dist/esm/node_modules/.pnpm/css-mediaquery@0.1.2/node_modules/css-mediaquery/index.js +1 -1
  70. package/dist/esm/node_modules/.pnpm/matchmediaquery@0.4.2/node_modules/matchmediaquery/index.js +1 -1
  71. package/dist/esm/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/index.js +1 -1
  72. package/dist/esm/web-containers/tsconfig.build.tsbuildinfo +1 -1
  73. package/dist/index.d.ts +95 -5
  74. package/dist/package.json +1 -1
  75. package/package.json +3 -3
@@ -0,0 +1,216 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * A credit top-up that has to wait for a payment method.
5
+ *
6
+ * Someone without a card on file still just presses "Add Credits" and types an
7
+ * amount. We then send them to the Stripe customer portal to save a card, and
8
+ * when Stripe brings them back we charge that amount and add the credits —
9
+ * one trip instead of "add a card, come back, open Add Credits again".
10
+ *
11
+ * The amount travels on the portal's after-completion URL so the return page
12
+ * knows what was asked for, but the URL alone never charges anything: the
13
+ * amount is also written to localStorage under a one-time nonce before the
14
+ * redirect, and the charge only runs when the URL's nonce, amount and tenant
15
+ * all match that record and it is still fresh. The record is deleted the
16
+ * moment it is claimed, so a reload (or a second mounted surface) can't charge
17
+ * twice, and a crafted link can't charge an amount the person never entered.
18
+ *
19
+ * localStorage (not sessionStorage) because the Stripe portal is a full
20
+ * navigation and some hosts open it in a new tab.
21
+ */
22
+ const PENDING_CREDIT_TOP_UP_STORAGE_KEY = 'ibl_pending_credit_top_up';
23
+ /** Query params appended to the portal's after-completion URL. */
24
+ const CREDIT_TOP_UP_QUERY_PARAMS = {
25
+ nonce: 'credit_topup',
26
+ amount: 'credit_topup_amount',
27
+ };
28
+ /** A top-up that is not claimed within the hour is forgotten. */
29
+ const PENDING_CREDIT_TOP_UP_TTL_MS = 60 * 60 * 1000;
30
+ function getStorage() {
31
+ try {
32
+ if (typeof window === 'undefined' || !window.localStorage)
33
+ return null;
34
+ return window.localStorage;
35
+ }
36
+ catch (_a) {
37
+ return null;
38
+ }
39
+ }
40
+ function createNonce() {
41
+ const cryptoApi = typeof globalThis !== 'undefined' ? globalThis.crypto : undefined;
42
+ if (cryptoApi && typeof cryptoApi.randomUUID === 'function') {
43
+ return cryptoApi.randomUUID();
44
+ }
45
+ return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 12)}`;
46
+ }
47
+ /** Normalises any accepted amount input to the "25.00" form stored and sent. */
48
+ function normaliseTopUpAmountUsd(amount) {
49
+ const num = typeof amount === 'string' ? parseFloat(amount) : amount;
50
+ if (!Number.isFinite(num) || num <= 0)
51
+ return null;
52
+ return num.toFixed(2);
53
+ }
54
+ /** The pending record, if one is stored, well-formed and not expired. */
55
+ function readPendingCreditTopUp(now = Date.now()) {
56
+ const storage = getStorage();
57
+ if (!storage)
58
+ return null;
59
+ const raw = storage.getItem(PENDING_CREDIT_TOP_UP_STORAGE_KEY);
60
+ if (!raw)
61
+ return null;
62
+ try {
63
+ const parsed = JSON.parse(raw);
64
+ if (!parsed ||
65
+ typeof parsed.nonce !== 'string' ||
66
+ typeof parsed.amountUsd !== 'string' ||
67
+ typeof parsed.tenant !== 'string' ||
68
+ typeof parsed.createdAt !== 'number') {
69
+ storage.removeItem(PENDING_CREDIT_TOP_UP_STORAGE_KEY);
70
+ return null;
71
+ }
72
+ if (now - parsed.createdAt > PENDING_CREDIT_TOP_UP_TTL_MS) {
73
+ storage.removeItem(PENDING_CREDIT_TOP_UP_STORAGE_KEY);
74
+ return null;
75
+ }
76
+ return parsed;
77
+ }
78
+ catch (_a) {
79
+ storage.removeItem(PENDING_CREDIT_TOP_UP_STORAGE_KEY);
80
+ return null;
81
+ }
82
+ }
83
+ function clearPendingCreditTopUp() {
84
+ var _a;
85
+ (_a = getStorage()) === null || _a === void 0 ? void 0 : _a.removeItem(PENDING_CREDIT_TOP_UP_STORAGE_KEY);
86
+ }
87
+ /**
88
+ * Records the top-up to finish after the payment method is saved and returns
89
+ * the URL Stripe should send the person back to: `currentUrl` plus the amount
90
+ * and the one-time nonce. Any existing query (e.g. `profileTab=billing`) is
91
+ * kept so the person lands where they left.
92
+ */
93
+ function beginPendingCreditTopUp({ tenant, amountUsd, currentUrl, now = Date.now(), }) {
94
+ var _a;
95
+ const pending = {
96
+ nonce: createNonce(),
97
+ amountUsd,
98
+ tenant,
99
+ createdAt: now,
100
+ };
101
+ (_a = getStorage()) === null || _a === void 0 ? void 0 : _a.setItem(PENDING_CREDIT_TOP_UP_STORAGE_KEY, JSON.stringify(pending));
102
+ const url = new URL(currentUrl);
103
+ url.searchParams.set(CREDIT_TOP_UP_QUERY_PARAMS.nonce, pending.nonce);
104
+ url.searchParams.set(CREDIT_TOP_UP_QUERY_PARAMS.amount, pending.amountUsd);
105
+ return { pending, afterCompletionUrl: url.toString() };
106
+ }
107
+ /** True when the URL carries the top-up return params at all. */
108
+ function hasPendingCreditTopUpParams(url) {
109
+ try {
110
+ return new URL(url).searchParams.has(CREDIT_TOP_UP_QUERY_PARAMS.nonce);
111
+ }
112
+ catch (_a) {
113
+ return false;
114
+ }
115
+ }
116
+ /** The same URL without the top-up return params (for `history.replaceState`). */
117
+ function stripPendingCreditTopUpParams(url) {
118
+ try {
119
+ const parsed = new URL(url);
120
+ parsed.searchParams.delete(CREDIT_TOP_UP_QUERY_PARAMS.nonce);
121
+ parsed.searchParams.delete(CREDIT_TOP_UP_QUERY_PARAMS.amount);
122
+ return parsed.toString();
123
+ }
124
+ catch (_a) {
125
+ return url;
126
+ }
127
+ }
128
+ /**
129
+ * Claims the top-up the URL refers to: returns it, and deletes the stored
130
+ * record, only when the URL's nonce and amount match the record for this
131
+ * tenant. Returns null (and leaves nothing to claim) otherwise.
132
+ */
133
+ function claimPendingCreditTopUp({ url, tenant, now = Date.now(), }) {
134
+ let params;
135
+ try {
136
+ params = new URL(url).searchParams;
137
+ }
138
+ catch (_a) {
139
+ return null;
140
+ }
141
+ const nonce = params.get(CREDIT_TOP_UP_QUERY_PARAMS.nonce);
142
+ const amount = params.get(CREDIT_TOP_UP_QUERY_PARAMS.amount);
143
+ if (!nonce || !amount)
144
+ return null;
145
+ const pending = readPendingCreditTopUp(now);
146
+ if (!pending)
147
+ return null;
148
+ if (pending.nonce !== nonce || pending.tenant !== tenant)
149
+ return null;
150
+ if (normaliseTopUpAmountUsd(amount) !== pending.amountUsd)
151
+ return null;
152
+ clearPendingCreditTopUp();
153
+ return pending;
154
+ }
155
+ /**
156
+ * The backend's plain-sentence refusal from a rejected top-up call, whatever
157
+ * shape the data layer threw it in (`{ data: { detail } }`, `{ data: 'text' }`
158
+ * or a bare `{ detail }`). Undefined when there is none.
159
+ */
160
+ function readTopUpErrorDetail(error) {
161
+ if (!error || typeof error !== 'object')
162
+ return undefined;
163
+ const err = error;
164
+ if (typeof err.data === 'string' && err.data.trim())
165
+ return err.data;
166
+ if (err.data && typeof err.data === 'object') {
167
+ const detail = err.data.detail;
168
+ if (typeof detail === 'string' && detail.trim())
169
+ return detail;
170
+ }
171
+ if (typeof err.detail === 'string' && err.detail.trim())
172
+ return err.detail;
173
+ return undefined;
174
+ }
175
+ function readStringField(body, key) {
176
+ if (!body || typeof body !== 'object')
177
+ return undefined;
178
+ const value = body[key];
179
+ return typeof value === 'string' && value.trim() ? value : undefined;
180
+ }
181
+ function readTopUpError(error) {
182
+ if (!error || typeof error !== 'object')
183
+ return {};
184
+ const err = error;
185
+ const body = err.data && typeof err.data === 'object' ? err.data : error;
186
+ return {
187
+ detail: readTopUpErrorDetail(error),
188
+ code: readStringField(body, 'code'),
189
+ errorType: readStringField(body, 'error_type'),
190
+ };
191
+ }
192
+ /** Refusals that saving a (new) card on Stripe fixes. */
193
+ const PAYMENT_METHOD_ERROR_TYPES = new Set(['card_error', 'payment_method_error']);
194
+ /**
195
+ * True when the backend refused the top-up because of the payment method:
196
+ * the card on file was refused (expired, declined, …) or there is none.
197
+ */
198
+ function isPaymentMethodProblem(error) {
199
+ const { errorType } = readTopUpError(error);
200
+ return errorType !== undefined && PAYMENT_METHOD_ERROR_TYPES.has(errorType);
201
+ }
202
+
203
+ exports.CREDIT_TOP_UP_QUERY_PARAMS = CREDIT_TOP_UP_QUERY_PARAMS;
204
+ exports.PENDING_CREDIT_TOP_UP_STORAGE_KEY = PENDING_CREDIT_TOP_UP_STORAGE_KEY;
205
+ exports.PENDING_CREDIT_TOP_UP_TTL_MS = PENDING_CREDIT_TOP_UP_TTL_MS;
206
+ exports.beginPendingCreditTopUp = beginPendingCreditTopUp;
207
+ exports.claimPendingCreditTopUp = claimPendingCreditTopUp;
208
+ exports.clearPendingCreditTopUp = clearPendingCreditTopUp;
209
+ exports.hasPendingCreditTopUpParams = hasPendingCreditTopUpParams;
210
+ exports.isPaymentMethodProblem = isPaymentMethodProblem;
211
+ exports.normaliseTopUpAmountUsd = normaliseTopUpAmountUsd;
212
+ exports.readPendingCreditTopUp = readPendingCreditTopUp;
213
+ exports.readTopUpError = readTopUpError;
214
+ exports.readTopUpErrorDetail = readTopUpErrorDetail;
215
+ exports.stripPendingCreditTopUpParams = stripPendingCreditTopUpParams;
216
+ //# 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/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1,70 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+ var dataLayer = require('@iblai/data-layer');
5
+ var sonner = require('sonner');
6
+ var context = require('../../i18n/context.js');
7
+ require('../../packages/i18n/dist/index.esm.js');
8
+ var pendingCreditTopUp = require('./pending-credit-top-up.js');
9
+
10
+ function formatUsd(amount) {
11
+ const num = parseFloat(amount);
12
+ return Number.isFinite(num) ? `$${num.toFixed(2)}` : `$${amount}`;
13
+ }
14
+ /**
15
+ * Finishes a credit top-up that was waiting for a payment method (see
16
+ * `pending-credit-top-up.ts`). Mount it on every surface that offers
17
+ * "Add Credits" — the Billing tab and the navbar credit dropdown — so whichever
18
+ * one is on the page Stripe returns to charges the saved card for the amount
19
+ * the person entered, adds the credits, and says so in a toast. The billing
20
+ * query is invalidated by the mutation, so the balance on screen updates too.
21
+ *
22
+ * Claiming deletes the stored record first, so with both surfaces mounted only
23
+ * the first effect to run charges; the other finds nothing. The return params
24
+ * are removed from the address bar either way so a reload can't replay them.
25
+ */
26
+ function useCompletePendingCreditTopUp({ tenant, enabled = true, }) {
27
+ const t = context.useT();
28
+ const [triggerAutoRecharge] = dataLayer.useTriggerAutoRechargeMutation();
29
+ const [isCompleting, setIsCompleting] = React.useState(false);
30
+ const startedRef = React.useRef(false);
31
+ React.useEffect(() => {
32
+ if (!enabled || !tenant || startedRef.current)
33
+ return;
34
+ if (typeof window === 'undefined')
35
+ return;
36
+ const currentUrl = window.location.href;
37
+ if (!pendingCreditTopUp.hasPendingCreditTopUpParams(currentUrl))
38
+ return;
39
+ startedRef.current = true;
40
+ const pending = pendingCreditTopUp.claimPendingCreditTopUp({ url: currentUrl, tenant });
41
+ // A null state lets Next's patched replaceState sync the app router (and
42
+ // useSearchParams) with the new URL. Handing window.history.state back
43
+ // carries Next's internal marker, which makes it skip that sync, and a
44
+ // later router.replace built from the stale params would put the nonce
45
+ // and amount back in the address bar.
46
+ window.history.replaceState(null, '', pendingCreditTopUp.stripPendingCreditTopUpParams(currentUrl));
47
+ if (!pending)
48
+ return;
49
+ setIsCompleting(true);
50
+ const toastId = sonner.toast.loading(t('profileAddCreditsModal.addingCredits'));
51
+ triggerAutoRecharge({ amount_usd: pending.amountUsd, platform_key: tenant })
52
+ .unwrap()
53
+ .then(() => {
54
+ sonner.toast.success(t('profileAddCreditsModal.creditsAddedAfterPayment', {
55
+ amount: formatUsd(pending.amountUsd),
56
+ }), { id: toastId });
57
+ })
58
+ .catch((error) => {
59
+ var _a;
60
+ sonner.toast.error((_a = pendingCreditTopUp.readTopUpErrorDetail(error)) !== null && _a !== void 0 ? _a : t('profileAddCreditsModal.failedToAddCreditsAfterPayment'), { id: toastId });
61
+ })
62
+ .finally(() => setIsCompleting(false));
63
+ // The claim is one-shot by design (startedRef): re-runs from a changed
64
+ // dependency find nothing left to do.
65
+ }, [enabled, tenant, t, triggerAutoRecharge]);
66
+ return { isCompleting };
67
+ }
68
+
69
+ exports.useCompletePendingCreditTopUp = useCompletePendingCreditTopUp;
70
+ //# 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":["useT","useTriggerAutoRechargeMutation","useState","useRef","useEffect","hasPendingCreditTopUpParams","claimPendingCreditTopUp","stripPendingCreditTopUpParams","toast","readTopUpErrorDetail"],"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,IA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CAAC;AACA,aAAA,KAAK,CAAC,CAAC,KAAc,KAAI;;YACxBA,YAAK,CAAC,KAAK,CACT,CAAA,EAAA,GAAAC,uCAAoB,CAAC,KAAK,CAAC,MAAA,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,EAAA,GAAI,CAAC,CAAC,uDAAuD,CAAC,EACzF,EAAE,EAAE,EAAE,OAAO,EAAE,CAChB;AACH,QAAA,CAAC;aACA,OAAO,CAAC,MAAM,eAAe,CAAC,KAAK,CAAC,CAAC;;;IAG1C,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,mBAAmB,CAAC,CAAC;IAE7C,OAAO,EAAE,YAAY,EAAE;AACzB;;;;"}
@@ -0,0 +1,121 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var React = require('react');
5
+ var reactRedux = require('react-redux');
6
+ var webUtils = require('@iblai/web-utils');
7
+ var context = require('../i18n/context.js');
8
+ require('../packages/i18n/dist/index.esm.js');
9
+ var index = require('./top-banner/index.js');
10
+
11
+ const byId = (selector) => document.querySelector(selector);
12
+ /**
13
+ * The credits banner across the top of the app ("You've run out of credits…"),
14
+ * driven by the `topBanner` slice the subscription flow writes to. A non-admin
15
+ * whose organization ran out gets `ContactAdminModal` instead. Its button does what
16
+ * `useTopBannerButtonHandler` maps the banner's trigger to. Shows only for a
17
+ * signed-in person on a tenant with billing on.
18
+ *
19
+ * While shown it shortens the sidebar shell (`[data-slot="sidebar-*"]`) and
20
+ * the main content container by its own height so nothing scrolls under it,
21
+ * and puts everything back when closed.
22
+ */
23
+ function SubscriptionTopBanner({ hidden = false, parentContainerSelector = webUtils.SUBSCRIPTION_BANNER_PARENT_SELECTOR, }) {
24
+ const t = context.useT();
25
+ const stripeActivated = webUtils.useIsStripeActivated();
26
+ const topBannerOptions = reactRedux.useSelector((state) => { var _a; return (_a = state.topBanner) === null || _a === void 0 ? void 0 : _a.topBannerOptions; });
27
+ const getTopBannerButtonHandler = webUtils.useTopBannerButtonHandler();
28
+ const [initialStyles, setInitialStyles] = React.useState({});
29
+ React.useEffect(() => {
30
+ const sideBarWrapper = byId('[data-slot="sidebar-wrapper"]');
31
+ const mainContentContainer = byId('#main-content-container > div');
32
+ const sidebarContainer = byId('[data-slot="sidebar-container"]');
33
+ const sidebarInset = byId('[data-slot="sidebar-inset"]');
34
+ const body = byId('body');
35
+ setInitialStyles({
36
+ sideBarWrapper: sideBarWrapper
37
+ ? {
38
+ maxHeight: sideBarWrapper.style.maxHeight,
39
+ top: sideBarWrapper.style.top,
40
+ position: sideBarWrapper.style.position,
41
+ }
42
+ : undefined,
43
+ mainContentContainer: mainContentContainer
44
+ ? {
45
+ position: mainContentContainer.style.position,
46
+ top: mainContentContainer.style.top,
47
+ }
48
+ : undefined,
49
+ sidebarContainer: sidebarContainer
50
+ ? { top: sidebarContainer.style.top, height: sidebarContainer.style.height }
51
+ : undefined,
52
+ sidebarInset: sidebarInset
53
+ ? { top: sidebarInset.style.top, height: sidebarInset.style.height }
54
+ : undefined,
55
+ body: body ? { overflow: body.style.overflow } : undefined,
56
+ });
57
+ }, []);
58
+ const handleTopBannerLoad = (bannerRef) => {
59
+ if (!bannerRef)
60
+ return;
61
+ const bannerHeight = bannerRef.clientHeight;
62
+ const sideBarWrapper = byId('[data-slot="sidebar-wrapper"]');
63
+ if (sideBarWrapper) {
64
+ sideBarWrapper.style.maxHeight = `calc(100vh - ${bannerHeight}px)`;
65
+ sideBarWrapper.style.top = '3px';
66
+ sideBarWrapper.style.position = 'relative';
67
+ }
68
+ const mainContentContainer = byId('#main-content-container > div');
69
+ if (mainContentContainer) {
70
+ mainContentContainer.style.position = 'relative';
71
+ mainContentContainer.style.top = '-12px';
72
+ }
73
+ const sidebarContainer = byId('[data-slot="sidebar-container"]');
74
+ if (sidebarContainer) {
75
+ sidebarContainer.style.top = '48px';
76
+ sidebarContainer.style.height = `calc(100% - ${bannerHeight}px)`;
77
+ }
78
+ const sidebarInset = byId('[data-slot="sidebar-inset"]');
79
+ if (sidebarInset) {
80
+ sidebarInset.style.height = `calc(100dvh - ${bannerHeight}px)`;
81
+ }
82
+ const body = byId('body');
83
+ if (body) {
84
+ body.style.overflow = 'hidden';
85
+ }
86
+ };
87
+ const handleTopBannerClose = () => {
88
+ var _a;
89
+ const sideBarWrapper = byId('[data-slot="sidebar-wrapper"]');
90
+ if (sideBarWrapper && initialStyles.sideBarWrapper) {
91
+ sideBarWrapper.style.maxHeight = initialStyles.sideBarWrapper.maxHeight;
92
+ sideBarWrapper.style.top = initialStyles.sideBarWrapper.top;
93
+ sideBarWrapper.style.position = initialStyles.sideBarWrapper.position;
94
+ }
95
+ const mainContentContainer = byId('#main-content-container > div');
96
+ if (mainContentContainer && initialStyles.mainContentContainer) {
97
+ mainContentContainer.style.position = initialStyles.mainContentContainer.position;
98
+ mainContentContainer.style.top = initialStyles.mainContentContainer.top;
99
+ }
100
+ const sidebarContainer = byId('[data-slot="sidebar-container"]');
101
+ if (sidebarContainer && initialStyles.sidebarContainer) {
102
+ sidebarContainer.style.top = initialStyles.sidebarContainer.top;
103
+ sidebarContainer.style.height = initialStyles.sidebarContainer.height;
104
+ }
105
+ const sidebarInset = byId('[data-slot="sidebar-inset"]');
106
+ if (sidebarInset && initialStyles.sidebarInset) {
107
+ sidebarInset.style.height = initialStyles.sidebarInset.height;
108
+ }
109
+ const body = byId('body');
110
+ if (body) {
111
+ body.style.overflow = ((_a = initialStyles.body) === null || _a === void 0 ? void 0 : _a.overflow) || 'auto';
112
+ }
113
+ };
114
+ if (hidden || !(topBannerOptions === null || topBannerOptions === void 0 ? void 0 : topBannerOptions.enabled) || !stripeActivated || !webUtils.isLoggedIn()) {
115
+ return null;
116
+ }
117
+ return (jsxRuntime.jsx(index.TopBanner, { parentContainerSelector: parentContainerSelector, bannerText: topBannerOptions.bannerText, buttonHandler: getTopBannerButtonHandler(topBannerOptions.onUpgrade), buttonLabel: topBannerOptions.buttonLabel || t('creditBalance.upgrade'), loading: topBannerOptions.loading, tooltipText: topBannerOptions.tooltipText, onLoad: handleTopBannerLoad, onClose: handleTopBannerClose }));
118
+ }
119
+
120
+ exports.SubscriptionTopBanner = SubscriptionTopBanner;
121
+ //# sourceMappingURL=subscription-top-banner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscription-top-banner.js","sources":["../../../../../../src/components/subscription-top-banner.tsx"],"sourcesContent":[null],"names":["SUBSCRIPTION_BANNER_PARENT_SELECTOR","useT","useIsStripeActivated","useSelector","useTopBannerButtonHandler","useState","useEffect","isLoggedIn","_jsx","TopBanner"],"mappings":";;;;;;;;;;AA6BA,MAAM,IAAI,GAAG,CAAC,QAAgB,KAAK,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAuB;AAEzF;;;;;;;;;;AAUG;AACG,SAAU,qBAAqB,CAAC,EACpC,MAAM,GAAG,KAAK,EACd,uBAAuB,GAAGA,4CAAmC,GAClC,EAAA;AAC3B,IAAA,MAAM,CAAC,GAAGC,YAAI,EAAE;AAChB,IAAA,MAAM,eAAe,GAAGC,6BAAoB,EAAE;AAC9C,IAAA,MAAM,gBAAgB,GAAGC,sBAAW,CAClC,CAAC,KAAqC,KAAI,EAAA,IAAA,EAAA,CAAA,CAAC,OAAA,CAAA,EAAA,GAAA,KAAK,CAAC,SAAS,MAAA,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,MAAA,GAAA,EAAA,CAAE,gBAAgB,CAAA,CAAA,CAAA,CAC7E;AACD,IAAA,MAAM,yBAAyB,GAAGC,kCAAyB,EAAE;IAC7D,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAGC,cAAQ,CAAe,EAAE,CAAC;IAEpEC,eAAS,CAAC,MAAK;AACb,QAAA,MAAM,cAAc,GAAG,IAAI,CAAC,+BAA+B,CAAC;AAC5D,QAAA,MAAM,oBAAoB,GAAG,IAAI,CAAC,+BAA+B,CAAC;AAClE,QAAA,MAAM,gBAAgB,GAAG,IAAI,CAAC,iCAAiC,CA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,EAAE,EAAE;AAC7E,QAAA,OAAO,IAAI;IACb;IAEA,QACEC,cAAA,CAACC,eAAS,EAAA,EACR,uBAAuB,EAAE,uBAAuB,EAChD,UAAU,EAAE,gBAAgB,CAAC,UAAU,EACvC,aAAa,EAAE,yBAAyB,CAAC,gBAAgB,CAAC,SAAS,CAAC,EACpE,WAAW,EAAE,gBAAgB,CAAC,WAAW,IAAI,CAAC,CAAC,uBAAuB,CAAC,EACvE,OAAO,EAAE,gBAAgB,CAAC,OAAO,EACjC,WAAW,EAAE,gBAAgB,CAAC,WAAW,EACzC,MAAM,EAAE,mBAAmB,EAC3B,OAAO,EAAE,oBAAoB,EAAA,CAC7B;AAEN;;;;"}
@@ -2349,13 +2349,11 @@ var creditBalance = {
2349
2349
  billing: "Billing",
2350
2350
  planFree: "Free",
2351
2351
  planTrial: "Trial",
2352
- planPremium: "Premium",
2353
2352
  redirecting: "Redirecting...",
2354
- upgradePlan: "Upgrade Plan",
2353
+ upgrade: "Upgrade",
2354
+ changePlan: "Change Plan",
2355
2355
  manageUsage: "Manage Usage",
2356
- addCredits: "Add Credits",
2357
- manageBilling: "Manage Billing",
2358
- failedToOpenPaymentSettings: "Failed to open payment settings"
2356
+ addCredits: "Add Credits"
2359
2357
  };
2360
2358
  var integrationsTab = {
2361
2359
  tabSecrets: "Secrets",
@@ -3495,6 +3493,11 @@ var modalsChatActionBlockingOverlay = {
3495
3493
  stopScreenSharing: "Stop Screen Sharing",
3496
3494
  backgroundHandleDescription: "This window will handle your {actionLabel} in the background. You can close this window when you're done."
3497
3495
  };
3496
+ var modalsContactAdminModal = {
3497
+ title: "Your organization has run out of credits",
3498
+ description: "Please contact your administrator to continue using the platform.",
3499
+ contactNow: "Contact Now 🫶"
3500
+ };
3498
3501
  var modalsDisclaimerModal = {
3499
3502
  userAgreement: "User Agreement",
3500
3503
  submitting: "Submitting...",
@@ -3518,6 +3521,91 @@ var modalsPaywallModal = {
3518
3521
  thisIncludes: "This includes:",
3519
3522
  secureCheckout: "Secure checkout"
3520
3523
  };
3524
+ var planPicker = {
3525
+ title: "Choose Your Plan",
3526
+ description: "You're on a free trial. Pick the plan that fits how you work.",
3527
+ mostPopular: "Most Popular",
3528
+ choosePlan: "Choose {plan}",
3529
+ redirecting: "Redirecting...",
3530
+ updating: "Updating...",
3531
+ loadingPlans: "Loading plans...",
3532
+ loadFailed: "Couldn't load the plans. Please try again.",
3533
+ tryAgain: "Try Again",
3534
+ noPlans: "No plans are available right now. Please try again later.",
3535
+ changed: "You're now on the {plan} plan.",
3536
+ scheduled: "Your current plan ends on {date}. You'll be on {plan} after that.",
3537
+ scheduledSoon: "Your current plan ends at the end of the billing period. You'll be on {plan} after that.",
3538
+ changeFailed: "Couldn't change your plan. Please try again.",
3539
+ enterprise: {
3540
+ text: "For enterprise code ownership or AI transformation services,",
3541
+ link: "contact our team"
3542
+ },
3543
+ oneTimeCreditsText: "Just need more credits? Add a one-time top-up without changing your plan.",
3544
+ oneTimeCreditsCta: "Add One-Time Credits",
3545
+ changeTitle: "Change Your Plan",
3546
+ changeDescription: "You're on the {plan} plan. Upgrades are charged today.",
3547
+ currentPlan: "Current Plan",
3548
+ upgradeTo: "Upgrade to {plan}",
3549
+ downgradeTo: "Downgrade to {plan}",
3550
+ switchTo: "Switch to {plan}",
3551
+ perDay: "per day",
3552
+ perWeek: "per week",
3553
+ perMonth: "per month",
3554
+ perYear: "per year",
3555
+ forever: "forever",
3556
+ everyCount: "every {count} {interval}",
3557
+ days: "days",
3558
+ weeks: "weeks",
3559
+ months: "months",
3560
+ years: "years",
3561
+ singleLink: {
3562
+ feature1: "Your own workspace and agents",
3563
+ feature2: "Invite your team",
3564
+ feature3: "Add credits whenever you need more"
3565
+ },
3566
+ plans: {
3567
+ free: {
3568
+ name: "Free",
3569
+ tagline: "Get started",
3570
+ audience: "For one person trying things out",
3571
+ priceNote: "No credit card required",
3572
+ feature1: "**Monthly credits** to try agents, renewed each month",
3573
+ feature2: "Build agents on any model, trained on your own documents",
3574
+ feature3: "Chat on web, desktop and mobile",
3575
+ feature4: "Documentation and community support"
3576
+ },
3577
+ premium: {
3578
+ name: "Pro",
3579
+ tagline: "For everyday work",
3580
+ audience: "For professionals and small teams running agents every day",
3581
+ featuresLead: "Everything in Free, plus:",
3582
+ feature1: "**More credits every month**, with auto-recharge when you want it",
3583
+ feature2: "Voice, workflows and your tools through MCP",
3584
+ feature3: "Analytics, embedding and the API",
3585
+ feature4: "**Email support**"
3586
+ },
3587
+ max: {
3588
+ name: "Max",
3589
+ tagline: "For all-day work",
3590
+ audience: "For teams and departments that depend on agents",
3591
+ featuresLead: "Everything in Pro, plus:",
3592
+ feature1: "**A much larger monthly credit allowance**",
3593
+ feature2: "Evaluations, spend limits and monetization",
3594
+ feature3: "Roles and teams for access control",
3595
+ feature4: "**Priority support** and early access"
3596
+ },
3597
+ ultra: {
3598
+ name: "Ultra",
3599
+ tagline: "For your largest deployments",
3600
+ audience: "For organizations formalizing agents across many teams",
3601
+ featuresLead: "Everything in Max, plus:",
3602
+ feature1: "**The largest monthly credit allowance**",
3603
+ feature2: "Several organizations and single sign-on",
3604
+ feature3: "Hand-off to human agents",
3605
+ feature4: "**Dedicated support** and hands-on onboarding"
3606
+ }
3607
+ }
3608
+ };
3521
3609
  var modalsPromptGalleryModal = {
3522
3610
  promptGallery: "Prompt Gallery",
3523
3611
  dialogDescription: "View and edit custom prompts for your agent.",
@@ -4003,7 +4091,7 @@ var profileAccount = {
4003
4091
  descOrganization: "Manage your organization settings.",
4004
4092
  descSecrets: "Keys from other services, like OpenAI or Stripe, that ibl.ai and your agents use.",
4005
4093
  descApi: "Let your own software work with ibl.ai.",
4006
- descBilling: "Manage your billing and subscription.",
4094
+ descBilling: "Manage your credits and billing.",
4007
4095
  descMonetization: "Configure paywalls, pricing, and revenue.",
4008
4096
  descAdvanced: "Configure advanced organization settings.",
4009
4097
  descBasic: "Manage your basic account information and preferences.",
@@ -4027,15 +4115,28 @@ var profileAddCreditsModal = {
4027
4115
  title: "Add Credits",
4028
4116
  description: "Add credits to your account using your payment method on file.",
4029
4117
  amountLabel: "Amount (USD)",
4030
- amountHint: "Enter the amount you want to add to your credit balance",
4118
+ quickAmounts: "Quick amounts",
4119
+ customAmountPlaceholder: "Custom amount",
4120
+ otherAmount: "Other amount",
4031
4121
  paymentMethodNotice: "Your payment method on file will be charged for this amount.",
4032
4122
  cancel: "Cancel",
4033
4123
  processing: "Processing...",
4034
4124
  addCredits: "Add Credits",
4035
- pleaseEnterAmount: "Please enter an amount",
4036
- pleaseEnterValidAmount: "Please enter a valid amount greater than 0",
4125
+ pleaseEnterAmount: "Please choose an amount",
4126
+ pleaseEnterValidAmount: "Please enter an amount of at least $0.50",
4037
4127
  creditsAddedSuccessfully: "Credits added successfully",
4038
- failedToAddCredits: "Failed to add credits"
4128
+ failedToAddCredits: "Failed to add credits",
4129
+ descriptionNoPaymentMethod: "Add credits to your account. You'll add a payment method on Stripe first.",
4130
+ paymentMethodSetupNotice: "Once your payment method is saved on Stripe, we'll charge this amount and add your credits right away.",
4131
+ continueToPayment: "Continue",
4132
+ redirecting: "Redirecting...",
4133
+ failedToOpenPaymentSettings: "Failed to open payment settings",
4134
+ paymentMethodRefused: "Your payment method was refused.",
4135
+ paymentMethodProblemHint: "Update your payment method on Stripe and your credits will be added when you come back.",
4136
+ updatePaymentMethod: "Update Payment Method",
4137
+ addingCredits: "Adding your credits...",
4138
+ creditsAddedAfterPayment: "Payment method saved. {amount} in credits was added to your account.",
4139
+ failedToAddCreditsAfterPayment: "Your payment method was saved, but we couldn't add your credits. Try Add Credits again."
4039
4140
  };
4040
4141
  var profileAdmin = {
4041
4142
  readLess: "Read less",
@@ -4083,19 +4184,17 @@ var profileAutoRechargeModal = {
4083
4184
  failedToUpdateUsageSettings: "Failed to update usage settings"
4084
4185
  };
4085
4186
  var profileBilling = {
4086
- failedToOpenPaymentSettings: "Failed to open payment settings",
4087
- trialEndsOn: "Trial ends on {date} · {days} days remaining",
4088
- renewsOn: "Renews on {date}",
4089
- youAreOnFreePlan: "You are on the Free plan",
4090
- manageSubscriptionAndBilling: "Manage your subscription and billing details",
4091
- planSectionTitle: "Plan",
4092
4187
  redirecting: "Redirecting...",
4188
+ tabCredits: "Credits",
4189
+ trialDescription: "You're on a free trial. Choose a plan to get your own workspace and add credits.",
4190
+ trialDescriptionWithEnd: "You're on a free trial that ends on {date} ({days} days left). Choose a plan to get your own workspace and add credits.",
4191
+ freePlanDescription: "You're on the Free plan. Add credits whenever you need more.",
4192
+ freePlanNoPaymentMethodDescription: "You're on the Free plan. Add credits whenever you need more. You'll add a payment method the first time.",
4093
4193
  upgrade: "Upgrade",
4094
- currentBadge: "Current",
4194
+ changePlan: "Change Plan",
4195
+ planDescription: "You're on the {plan} plan. Add credits whenever you need more.",
4095
4196
  creditsSectionTitle: "Credits",
4096
- creditsDescription: "Track your available credits and usage.",
4097
4197
  addCredits: "Add Credits",
4098
- manageBilling: "Manage Billing",
4099
4198
  availableLabel: "Available",
4100
4199
  creditsUsdEquivalent: "≈ {amount}",
4101
4200
  creditsConversionHint: "{credits} credits = $1",
@@ -4118,7 +4217,6 @@ var profileBilling = {
4118
4217
  unlimited: "Unlimited",
4119
4218
  autoRechargeDisabledMessage: "Auto recharge is currently disabled. Enable it to keep your balance topped up without interruption.",
4120
4219
  billingTabsAriaLabel: "Billing sections",
4121
- tabPlanAndCredits: "Plan & Credits",
4122
4220
  tabSpendLimits: "Spend Limits",
4123
4221
  tabAgentLimits: "Agent Limits",
4124
4222
  tabUserLimits: "User Limits"
@@ -9032,9 +9130,11 @@ var en = {
9032
9130
  mentorsMentorSelectionGrid: mentorsMentorSelectionGrid,
9033
9131
  modalsAddPromptModal: modalsAddPromptModal,
9034
9132
  modalsChatActionBlockingOverlay: modalsChatActionBlockingOverlay,
9133
+ modalsContactAdminModal: modalsContactAdminModal,
9035
9134
  modalsDisclaimerModal: modalsDisclaimerModal,
9036
9135
  modalsEditPromptModal: modalsEditPromptModal,
9037
9136
  modalsPaywallModal: modalsPaywallModal,
9137
+ planPicker: planPicker,
9038
9138
  modalsPromptGalleryModal: modalsPromptGalleryModal,
9039
9139
  modalsUserProfileModal: modalsUserProfileModal,
9040
9140
  modalsVoiceChatModal: modalsVoiceChatModal,
@@ -9374,6 +9474,7 @@ exports.memoryTabSavedMemoriesModal = memoryTabSavedMemoriesModal;
9374
9474
  exports.mentorsMentorSelectionGrid = mentorsMentorSelectionGrid;
9375
9475
  exports.modalsAddPromptModal = modalsAddPromptModal;
9376
9476
  exports.modalsChatActionBlockingOverlay = modalsChatActionBlockingOverlay;
9477
+ exports.modalsContactAdminModal = modalsContactAdminModal;
9377
9478
  exports.modalsDisclaimerModal = modalsDisclaimerModal;
9378
9479
  exports.modalsEditPromptModal = modalsEditPromptModal;
9379
9480
  exports.modalsPaywallModal = modalsPaywallModal;
@@ -9396,6 +9497,7 @@ exports.onboardingOnboardingWizard = onboardingOnboardingWizard;
9396
9497
  exports.onboardingUserOnboarding = onboardingUserOnboarding;
9397
9498
  exports.pipChat = pipChat;
9398
9499
  exports.placementExam = placementExam;
9500
+ exports.planPicker = planPicker;
9399
9501
  exports.platformNavbar = platformNavbar;
9400
9502
  exports.platformSidebar = platformSidebar;
9401
9503
  exports.privacyAuditLog = privacyAuditLog;