@tesouro/embedded-components-loader 0.0.0-stage → 0.11.200

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 (42) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +7 -0
  3. package/README.md +316 -2
  4. package/dist/caretRange.d.ts +13 -0
  5. package/dist/caretRange.d.ts.map +1 -0
  6. package/dist/entries.generated.d.ts +34 -0
  7. package/dist/entries.generated.d.ts.map +1 -0
  8. package/dist/index.d.ts +19 -0
  9. package/dist/index.d.ts.map +1 -0
  10. package/dist/index.js +208 -0
  11. package/dist/loader.d.ts +66 -0
  12. package/dist/loader.d.ts.map +1 -0
  13. package/dist/react/experimental/BalanceHistoryWidget.d.ts +1382 -0
  14. package/dist/react/experimental/QuickViewWidget.d.ts +888 -0
  15. package/dist/react/experimental/RemoteCheckCapture.d.ts +714 -0
  16. package/dist/react/experimental/index.d.ts +1776 -0
  17. package/dist/react/index.d.ts +7429 -0
  18. package/dist/react/lib/AcceptDisclosuresWidget.d.ts +1457 -0
  19. package/dist/react/lib/BalancesWidget.d.ts +647 -0
  20. package/dist/react/lib/BankAccountOnboardingWidget.d.ts +2053 -0
  21. package/dist/react/lib/BankAccountsWidget.d.ts +773 -0
  22. package/dist/react/lib/BankingComplianceBannerWidget.d.ts +647 -0
  23. package/dist/react/lib/BillPayWidget.d.ts +651 -0
  24. package/dist/react/lib/CardDetailsWidget.d.ts +1647 -0
  25. package/dist/react/lib/CounterpartsWidget.d.ts +1698 -0
  26. package/dist/react/lib/CounterpartsWidgetPublic.d.ts +1697 -0
  27. package/dist/react/lib/CreditCardsWidget.d.ts +2153 -0
  28. package/dist/react/lib/DebitCardsWidget.d.ts +2149 -0
  29. package/dist/react/lib/ExpenseManagementWidget.d.ts +835 -0
  30. package/dist/react/lib/InsightsWidget.d.ts +696 -0
  31. package/dist/react/lib/LinkedAccountsWidget.d.ts +726 -0
  32. package/dist/react/lib/OfferWidget.d.ts +1421 -0
  33. package/dist/react/lib/ReceivablesWidget.d.ts +2556 -0
  34. package/dist/react/lib/RecentActivityWidget.d.ts +655 -0
  35. package/dist/react/lib/SettingsWidget.d.ts +775 -0
  36. package/dist/react/lib/TransfersWidget.d.ts +794 -0
  37. package/dist/react/lib/WidgetProvider.d.ts +1305 -0
  38. package/dist/react/lib/WidgetProviderPublic.d.ts +619 -0
  39. package/dist/react/lib/WidgetSuite.d.ts +5664 -0
  40. package/dist/stylesheet.d.ts +3 -0
  41. package/dist/stylesheet.d.ts.map +1 -0
  42. package/package.json +94 -4
@@ -0,0 +1,794 @@
1
+ import * as React from 'react';
2
+ import { ComponentType, AnchorHTMLAttributes, ReactNode, ErrorInfo } from 'react';
3
+
4
+ declare type FallbackProps = {
5
+ error: unknown;
6
+ resetErrorBoundary: (...args: unknown[]) => void;
7
+ };
8
+
9
+ type AuthToken = string | undefined;
10
+ interface Auth {
11
+ /**
12
+ * Which part of the request do we use to send the auth?
13
+ *
14
+ * @default 'header'
15
+ */
16
+ in?: 'header' | 'query' | 'cookie';
17
+ /**
18
+ * A unique identifier for the security scheme.
19
+ *
20
+ * Defined only when there are multiple security schemes whose `Auth`
21
+ * shape would otherwise be identical.
22
+ */
23
+ key?: string;
24
+ /**
25
+ * Header or query parameter name.
26
+ *
27
+ * @default 'Authorization'
28
+ */
29
+ name?: string;
30
+ scheme?: 'basic' | 'bearer';
31
+ type: 'apiKey' | 'http';
32
+ }
33
+
34
+ interface SerializerOptions<T> {
35
+ /**
36
+ * @default true
37
+ */
38
+ explode: boolean;
39
+ style: T;
40
+ }
41
+ type ArrayStyle = 'form' | 'spaceDelimited' | 'pipeDelimited';
42
+ type ObjectStyle = 'form' | 'deepObject';
43
+
44
+ type QuerySerializer = (query: Record<string, unknown>) => string;
45
+ type BodySerializer = (body: unknown) => unknown;
46
+ type QuerySerializerOptionsObject = {
47
+ allowReserved?: boolean;
48
+ array?: Partial<SerializerOptions<ArrayStyle>>;
49
+ object?: Partial<SerializerOptions<ObjectStyle>>;
50
+ };
51
+ type QuerySerializerOptions = QuerySerializerOptionsObject & {
52
+ /**
53
+ * Per-parameter serialization overrides. When provided, these settings
54
+ * override the global array/object settings for specific parameter names.
55
+ */
56
+ parameters?: Record<string, QuerySerializerOptionsObject>;
57
+ };
58
+
59
+ type HttpMethod = 'connect' | 'delete' | 'get' | 'head' | 'options' | 'patch' | 'post' | 'put' | 'trace';
60
+ type Client$1<RequestFn = never, Config = unknown, MethodFn = never, BuildUrlFn = never, SseFn = never> = {
61
+ /**
62
+ * Returns the final request URL.
63
+ */
64
+ buildUrl: BuildUrlFn;
65
+ getConfig: () => Config;
66
+ request: RequestFn;
67
+ setConfig: (config: Config) => Config;
68
+ } & {
69
+ [K in HttpMethod]: MethodFn;
70
+ } & ([SseFn] extends [never] ? {
71
+ sse?: never;
72
+ } : {
73
+ sse: {
74
+ [K in HttpMethod]: SseFn;
75
+ };
76
+ });
77
+ interface Config$1 {
78
+ /**
79
+ * Auth token or a function returning auth token. The resolved value will be
80
+ * added to the request payload as defined by its `security` array.
81
+ */
82
+ auth?: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken;
83
+ /**
84
+ * A function for serializing request body parameter. By default,
85
+ * {@link JSON.stringify()} will be used.
86
+ */
87
+ bodySerializer?: BodySerializer | null;
88
+ /**
89
+ * An object containing any HTTP headers that you want to pre-populate your
90
+ * `Headers` object with.
91
+ *
92
+ * {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more}
93
+ */
94
+ headers?: RequestInit['headers'] | Record<string, string | number | boolean | (string | number | boolean)[] | null | undefined | unknown>;
95
+ /**
96
+ * The request method.
97
+ *
98
+ * {@link https://developer.mozilla.org/docs/Web/API/fetch#method See more}
99
+ */
100
+ method?: Uppercase<HttpMethod>;
101
+ /**
102
+ * A function for serializing request query parameters. By default, arrays
103
+ * will be exploded in form style, objects will be exploded in deepObject
104
+ * style, and reserved characters are percent-encoded.
105
+ *
106
+ * This method will have no effect if the native `paramsSerializer()` Axios
107
+ * API function is used.
108
+ *
109
+ * {@link https://swagger.io/docs/specification/serialization/#query View examples}
110
+ */
111
+ querySerializer?: QuerySerializer | QuerySerializerOptions;
112
+ /**
113
+ * A function validating request data. This is useful if you want to ensure
114
+ * the request conforms to the desired shape, so it can be safely sent to
115
+ * the server.
116
+ */
117
+ requestValidator?: (data: unknown) => Promise<unknown>;
118
+ /**
119
+ * A function transforming response data before it's returned. This is useful
120
+ * for post-processing data, e.g., converting ISO strings into Date objects.
121
+ */
122
+ responseTransformer?: (data: unknown) => Promise<unknown>;
123
+ /**
124
+ * A function validating response data. This is useful if you want to ensure
125
+ * the response conforms to the desired shape, so it can be safely passed to
126
+ * the transformers and returned to the user.
127
+ */
128
+ responseValidator?: (data: unknown) => Promise<unknown>;
129
+ }
130
+
131
+ type ServerSentEventsOptions<TData = unknown> = Omit<RequestInit, 'method'> & Pick<Config$1, 'method' | 'responseTransformer' | 'responseValidator'> & {
132
+ /**
133
+ * Fetch API implementation. You can use this option to provide a custom
134
+ * fetch instance.
135
+ *
136
+ * @default globalThis.fetch
137
+ */
138
+ fetch?: typeof fetch;
139
+ /**
140
+ * Implementing clients can call request interceptors inside this hook.
141
+ */
142
+ onRequest?: (url: string, init: RequestInit) => Promise<Request>;
143
+ /**
144
+ * Callback invoked when a network or parsing error occurs during streaming.
145
+ *
146
+ * This option applies only if the endpoint returns a stream of events.
147
+ *
148
+ * @param error The error that occurred.
149
+ */
150
+ onSseError?: (error: unknown) => void;
151
+ /**
152
+ * Callback invoked when an event is streamed from the server.
153
+ *
154
+ * This option applies only if the endpoint returns a stream of events.
155
+ *
156
+ * @param event Event streamed from the server.
157
+ * @returns Nothing (void).
158
+ */
159
+ onSseEvent?: (event: StreamEvent<TData>) => void;
160
+ serializedBody?: RequestInit['body'];
161
+ /**
162
+ * Default retry delay in milliseconds.
163
+ *
164
+ * This option applies only if the endpoint returns a stream of events.
165
+ *
166
+ * @default 3000
167
+ */
168
+ sseDefaultRetryDelay?: number;
169
+ /**
170
+ * Maximum number of retry attempts before giving up.
171
+ */
172
+ sseMaxRetryAttempts?: number;
173
+ /**
174
+ * Maximum retry delay in milliseconds.
175
+ *
176
+ * Applies only when exponential backoff is used.
177
+ *
178
+ * This option applies only if the endpoint returns a stream of events.
179
+ *
180
+ * @default 30000
181
+ */
182
+ sseMaxRetryDelay?: number;
183
+ /**
184
+ * Optional sleep function for retry backoff.
185
+ *
186
+ * Defaults to using `setTimeout`.
187
+ */
188
+ sseSleepFn?: (ms: number) => Promise<void>;
189
+ url: string;
190
+ };
191
+ interface StreamEvent<TData = unknown> {
192
+ data: TData;
193
+ event?: string;
194
+ id?: string;
195
+ retry?: number;
196
+ }
197
+ type ServerSentEventsResult<TData = unknown, TReturn = void, TNext = unknown> = {
198
+ stream: AsyncGenerator<TData extends Record<string, unknown> ? TData[keyof TData] : TData, TReturn, TNext>;
199
+ };
200
+
201
+ type ErrInterceptor<Err, Res, Req, Options> = (error: Err,
202
+ /** response may be undefined due to a network error where no response object is produced */
203
+ response: Res | undefined,
204
+ /** request may be undefined, because error may be from building the request object itself */
205
+ request: Req | undefined, options: Options) => Err | Promise<Err>;
206
+ type ReqInterceptor<Req, Options> = (request: Req, options: Options) => Req | Promise<Req>;
207
+ type ResInterceptor<Res, Req, Options> = (response: Res, request: Req, options: Options) => Res | Promise<Res>;
208
+ declare class Interceptors<Interceptor> {
209
+ fns: Array<Interceptor | null>;
210
+ clear(): void;
211
+ eject(id: number | Interceptor): void;
212
+ exists(id: number | Interceptor): boolean;
213
+ getInterceptorIndex(id: number | Interceptor): number;
214
+ update(id: number | Interceptor, fn: Interceptor): number | Interceptor | false;
215
+ use(fn: Interceptor): number;
216
+ }
217
+ interface Middleware<Req, Res, Err, Options> {
218
+ error: Interceptors<ErrInterceptor<Err, Res, Req, Options>>;
219
+ request: Interceptors<ReqInterceptor<Req, Options>>;
220
+ response: Interceptors<ResInterceptor<Res, Req, Options>>;
221
+ }
222
+
223
+ type ResponseStyle = 'data' | 'fields';
224
+ interface Config<T extends ClientOptions$1 = ClientOptions$1> extends Omit<RequestInit, 'body' | 'headers' | 'method'>, Config$1 {
225
+ /**
226
+ * Base URL for all requests made by this client.
227
+ */
228
+ baseUrl?: T['baseUrl'];
229
+ /**
230
+ * Fetch API implementation. You can use this option to provide a custom
231
+ * fetch instance.
232
+ *
233
+ * @default globalThis.fetch
234
+ */
235
+ fetch?: typeof fetch;
236
+ /**
237
+ * Please don't use the Fetch client for Next.js applications. The `next`
238
+ * options won't have any effect.
239
+ *
240
+ * Install {@link https://www.npmjs.com/package/@hey-api/client-next `@hey-api/client-next`} instead.
241
+ */
242
+ next?: never;
243
+ /**
244
+ * Return the response data parsed in a specified format. By default, `auto`
245
+ * will infer the appropriate method from the `Content-Type` response header.
246
+ * You can override this behavior with any of the {@link Body} methods.
247
+ * Select `stream` if you don't want to parse response data at all.
248
+ *
249
+ * @default 'auto'
250
+ */
251
+ parseAs?: 'arrayBuffer' | 'auto' | 'blob' | 'formData' | 'json' | 'stream' | 'text';
252
+ /**
253
+ * Should we return only data or multiple fields (data, error, response, etc.)?
254
+ *
255
+ * @default 'fields'
256
+ */
257
+ responseStyle?: ResponseStyle;
258
+ /**
259
+ * Throw an error instead of returning it in the response?
260
+ *
261
+ * @default false
262
+ */
263
+ throwOnError?: T['throwOnError'];
264
+ }
265
+ interface RequestOptions<TData = unknown, TResponseStyle extends ResponseStyle = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string> extends Config<{
266
+ responseStyle: TResponseStyle;
267
+ throwOnError: ThrowOnError;
268
+ }>, Pick<ServerSentEventsOptions<TData>, 'onRequest' | 'onSseError' | 'onSseEvent' | 'sseDefaultRetryDelay' | 'sseMaxRetryAttempts' | 'sseMaxRetryDelay'> {
269
+ /**
270
+ * Any body that you want to add to your request.
271
+ *
272
+ * {@link https://developer.mozilla.org/docs/Web/API/fetch#body}
273
+ */
274
+ body?: unknown;
275
+ path?: Record<string, unknown>;
276
+ query?: Record<string, unknown>;
277
+ /**
278
+ * Security mechanism(s) to use for the request.
279
+ */
280
+ security?: ReadonlyArray<Auth>;
281
+ url: Url;
282
+ }
283
+ interface ResolvedRequestOptions<TResponseStyle extends ResponseStyle = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string> extends RequestOptions<unknown, TResponseStyle, ThrowOnError, Url> {
284
+ headers: Headers;
285
+ serializedBody?: string;
286
+ }
287
+ type RequestResult<TData = unknown, TError = unknown, ThrowOnError extends boolean = boolean, TResponseStyle extends ResponseStyle = 'fields'> = ThrowOnError extends true ? Promise<TResponseStyle extends 'data' ? TData extends Record<string, unknown> ? TData[keyof TData] : TData : {
288
+ data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
289
+ request: Request;
290
+ response: Response;
291
+ }> : Promise<TResponseStyle extends 'data' ? (TData extends Record<string, unknown> ? TData[keyof TData] : TData) | undefined : ({
292
+ data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
293
+ error: undefined;
294
+ } | {
295
+ data: undefined;
296
+ error: TError extends Record<string, unknown> ? TError[keyof TError] : TError;
297
+ }) & {
298
+ /** request may be undefined, because error may be from building the request object itself */
299
+ request?: Request;
300
+ /** response may be undefined, because error may be from building the request object itself or from a network error */
301
+ response?: Response;
302
+ }>;
303
+ interface ClientOptions$1 {
304
+ baseUrl?: string;
305
+ responseStyle?: ResponseStyle;
306
+ throwOnError?: boolean;
307
+ }
308
+ type MethodFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'>) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
309
+ type SseFn = <TData = unknown, _TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<never, TResponseStyle, ThrowOnError>, 'method'>) => Promise<ServerSentEventsResult<TData>>;
310
+ type RequestFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'> & Pick<Required<RequestOptions<TData, TResponseStyle, ThrowOnError>>, 'method'>) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
311
+ type BuildUrlFn = <TData extends {
312
+ body?: unknown;
313
+ path?: Record<string, unknown>;
314
+ query?: Record<string, unknown>;
315
+ url: string;
316
+ }>(options: TData & Options<TData>) => string;
317
+ type Client = Client$1<RequestFn, Config, MethodFn, BuildUrlFn, SseFn> & {
318
+ interceptors: Middleware<Request, Response, unknown, ResolvedRequestOptions>;
319
+ };
320
+ interface TDataShape {
321
+ body?: unknown;
322
+ headers?: unknown;
323
+ path?: unknown;
324
+ query?: unknown;
325
+ url: string;
326
+ }
327
+ type OmitKeys<T, K> = Pick<T, Exclude<keyof T, K>>;
328
+ type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown, TResponseStyle extends ResponseStyle = 'fields'> = OmitKeys<RequestOptions<TResponse, TResponseStyle, ThrowOnError>, 'body' | 'path' | 'query' | 'url'> & ([TData] extends [never] ? unknown : Omit<TData, 'url'>);
329
+
330
+ type ClientOptions = {
331
+ baseUrl: 'https://api.stage.tesouro.com' | 'https://api.sandbox.stage.tesouro.com' | 'https://api.stage.business-banking.app' | 'https://api.tesouro.com' | 'https://api.sandbox.tesouro.com' | 'https://api.business-banking.app' | (string & {});
332
+ };
333
+
334
+ type EmbeddedClient = Client;
335
+ type ExtractLiterals<T> = T extends string ? string extends T ? never : T : never;
336
+ type BaseUrl = ExtractLiterals<ClientOptions['baseUrl']>;
337
+
338
+ type LinkComponentProps = AnchorHTMLAttributes<HTMLAnchorElement> & {
339
+ children?: ReactNode;
340
+ };
341
+ type LinkComponent = ComponentType<LinkComponentProps>;
342
+ /**
343
+ * The UI frameworks a widget's UI layer can render with.
344
+ *
345
+ * - `shadcn` — the shadcn/Tailwind implementation. This is the default and the
346
+ * implicit fallback, so existing consumers that select nothing keep rendering
347
+ * shadcn.
348
+ * - `tecton` — the Tecton implementation.
349
+ *
350
+ * Declared as an `as const` object (not a TypeScript `enum`) per repo
351
+ * convention.
352
+ */
353
+ declare const UIFramework: {
354
+ readonly Shadcn: "shadcn";
355
+ readonly Tecton: "tecton";
356
+ };
357
+ type UIFramework = (typeof UIFramework)[keyof typeof UIFramework];
358
+
359
+ /**
360
+ * The settable fields of the widget config cascade.
361
+ *
362
+ * This is the type accepted by {@link setGlobalWidgetConfig} and all provider props.
363
+ * It intentionally excludes `initResponse`, which is populated automatically by the
364
+ * provider after a successful fetch and must never be set manually.
365
+ *
366
+ * The `null` vs `undefined` distinction on `widgetToken` and `organizationId` is intentional:
367
+ * - `undefined` — not set at this level; inherit from the nearest ancestor or global store.
368
+ * - `null` — explicitly cleared; downstream sees "no value" even if an ancestor had one
369
+ * (e.g. after logout or deliberate de-scoping).
370
+ *
371
+ * @see {@link WidgetConfig} for the resolved output type (includes `initResponse`)
372
+ * @see {@link RootWidgetProvider}
373
+ * @see {@link WidgetProvider}
374
+ * @see {@link setGlobalWidgetConfig}
375
+ */
376
+ interface WidgetConfigInput {
377
+ /**
378
+ * Base URL of the Tesouro embedded API (e.g. `"https://api.tesouro.com"`).
379
+ *
380
+ * When omitted the nearest ancestor's `baseUrl` or the global store value is used.
381
+ * Changing this recreates the underlying HTTP client so all subsequent requests
382
+ * go to the new host.
383
+ */
384
+ baseUrl?: BaseUrl;
385
+ /**
386
+ * Bearer token used to authenticate widget requests.
387
+ *
388
+ * Injected as `Authorization: Bearer <token>` on every outgoing request via an
389
+ * interceptor on the scoped HTTP client. Token updates are picked up immediately
390
+ * without recreating the client.
391
+ *
392
+ * - `string` — send this token on all requests from this level downward.
393
+ * - `null` — explicitly cleared; no auth header is sent and fetching is suppressed.
394
+ * - `undefined` — not set at this level; inherit from the nearest ancestor or global store.
395
+ */
396
+ widgetToken?: string | null;
397
+ /**
398
+ * Organization ID forwarded as the `x-organization-id` request header.
399
+ *
400
+ * Passed through {@link EmbedApiProvider} context rather than the auth interceptor,
401
+ * so individual data-access hooks can opt in per-request.
402
+ *
403
+ * - `string` — use this organization for downstream data requests.
404
+ * - `null` — explicitly cleared; queries that require an org ID will be disabled.
405
+ * - `undefined` — not set at this level; inherit from the nearest ancestor or global store.
406
+ *
407
+ * When `undefined` across the **whole** cascade (no prop, no ancestor, no global
408
+ * value), the resolved org defaults to the loaded `initResponse.organizationId`
409
+ * (see {@link WidgetConfig.initResponse}) once the widget-init fetch settles. This
410
+ * is the lowest-priority fallback — any explicit `string` or `null` at any cascade
411
+ * level wins, and an explicit `null` is preserved and never falls back.
412
+ *
413
+ * Only an **explicit** ancestor org is inherited. An ancestor's *init-derived*
414
+ * default does not propagate into a descendant that owns its own fetch (its own
415
+ * `baseUrl`/`widgetToken`); such a descendant defaults to its own
416
+ * `initResponse.organizationId` instead, so it never sends an ancestor's org with
417
+ * its own token.
418
+ */
419
+ organizationId?: string | null;
420
+ /**
421
+ * Optional post-creation hook for the scoped HTTP client.
422
+ *
423
+ * Called once after the provider creates its scoped {@link EmbeddedClient} and
424
+ * applies the built-in `Authorization: Bearer` interceptor. Receives the
425
+ * fully-configured client and must return the client to be used for the lifetime of
426
+ * this provider level — either the same instance (with additional interceptors
427
+ * attached) or a new client entirely.
428
+ *
429
+ * **Order:** The built-in auth interceptor is always applied first. `configClient`
430
+ * is called on top of it, so any interceptors you add here run after auth is set.
431
+ *
432
+ * **Any prop triggers a scoped client.** A {@link WidgetProvider} creates its own
433
+ * scoped client whenever any prop is set — including `configClient` alone, without
434
+ * `baseUrl` or `widgetToken`. Only a fully props-free pass-through provider skips
435
+ * client creation and never calls this function.
436
+ *
437
+ * **Stability:** The function reference is included in the client creation memo's
438
+ * dependency array. Passing an unstable (inline) function recreates the client on
439
+ * every render. Stabilize with `useCallback` or define the function outside the
440
+ * component.
441
+ *
442
+ * **Cascade:** Inherits from the nearest ancestor when `undefined`. A child
443
+ * {@link WidgetProvider} that creates its own scoped client will use the resolved
444
+ * `configClient` from the cascade unless it provides its own override.
445
+ *
446
+ * @example
447
+ * ```tsx
448
+ * const addLogging = useCallback(
449
+ * (client: EmbeddedClient) => {
450
+ * client.interceptors.request.use((req) => {
451
+ * console.log('[widget]', req.method, req.url);
452
+ * return req;
453
+ * });
454
+ * return client;
455
+ * },
456
+ * [],
457
+ * );
458
+ *
459
+ * <RootWidgetProvider
460
+ * baseUrl="https://api.tesouro.com"
461
+ * widgetToken={token}
462
+ * configClient={addLogging}
463
+ * >
464
+ * <App />
465
+ * </RootWidgetProvider>
466
+ * ```
467
+ */
468
+ configClient?: (client: EmbeddedClient) => EmbeddedClient;
469
+ /**
470
+ * Overrides the widget-gateway routing decision for the scoped HTTP client.
471
+ *
472
+ * Any caller reaching the Tesouro API with a widget token must route data
473
+ * requests through the widget gateway: prefix the path with
474
+ * `/api/widget-gateway/proxy` and carry the token as `X-Widget-Token`. The
475
+ * provider applies both automatically per request when the request origin is
476
+ * a known Tesouro API host (`WIDGET_GATEWAY_HOSTS`, derived from the
477
+ * generated `ClientOptions['baseUrl']`); `/api/widget-gateway/*` paths (the
478
+ * init round-trip) always pass through untouched.
479
+ *
480
+ * - `undefined` — decide from the request origin, as above. Inherits from
481
+ * the nearest ancestor or global store like every other config field.
482
+ * - `true` — always apply the rewrite, even for an unlisted base URL (e.g. a
483
+ * custom domain in front of the gateway).
484
+ * - `false` — never apply it. For hosts that route widget requests their own
485
+ * way, such as a same-origin BFF whose `configClient` retargets every
486
+ * request.
487
+ *
488
+ * Independent of {@link configClient}: a host that only adds a header keeps
489
+ * the built-in routing, and the built-in interceptor runs before any
490
+ * `configClient` interceptor.
491
+ */
492
+ gatewayRouting?: boolean;
493
+ /**
494
+ * Component the embedded widgets should render in place of plain `<a>` tags.
495
+ *
496
+ * Pass e.g. Next.js's `Link` to make in-app navigation use the host router.
497
+ * Cascades like other config: provider prop > nearest ancestor > global store.
498
+ * When no value is set anywhere, widgets fall back to a plain `<a>` element.
499
+ */
500
+ linkComponent?: LinkComponent;
501
+ /**
502
+ * Which UI framework the widget UI layer should render with.
503
+ *
504
+ * Lets a consuming context bind widgets to either the shadcn/Tailwind or the
505
+ * Tecton implementation behind the same outward-facing API. The selection is
506
+ * a presentation concern only — it cascades through the provider tree exactly
507
+ * like {@link linkComponent} and is read by UI libraries via `useUIFramework`;
508
+ * it never appears in any widget's feature-library or component props.
509
+ *
510
+ * - `'shadcn'` — the shadcn/Tailwind implementation.
511
+ * - `'tecton'` — the Tecton implementation.
512
+ * - `null` / `undefined` — not set at this level; inherit from the nearest
513
+ * ancestor or global store, falling back to `shadcn` when unset everywhere.
514
+ * `shadcn` is the implicit default, so existing consumers need no changes.
515
+ */
516
+ uiFramework?: UIFramework | null;
517
+ }
518
+ /**
519
+ * Props shared by every analytics-owner-capable widget provider.
520
+ *
521
+ * Combines the full settable cascade ({@link WidgetConfigInput}) with the
522
+ * analytics opt-out honored by analytics owners. Both {@link RootWidgetProvider}
523
+ * and {@link WidgetProvider} build their public props on top of this; the latter
524
+ * adds error-boundary props of its own.
525
+ *
526
+ * @see {@link WidgetConfigInput} for per-field cascade and `null` vs omitted semantics
527
+ */
528
+ interface WidgetProviderBaseProps extends WidgetConfigInput {
529
+ /**
530
+ * Opt out of all analytics capture and prevent PostHog from loading. Default `true`.
531
+ *
532
+ * Honored only by an analytics **owner** — a {@link RootWidgetProvider} or a
533
+ * standalone {@link WidgetProvider} with no parent provider. When `false`,
534
+ * owner-bound `track` calls in this subtree become no-ops and the PostHog
535
+ * installer is never dynamically imported for this owner's environment.
536
+ * Setting it on a nested {@link WidgetProvider} is ignored in v1 (a one-time
537
+ * `console.warn` is emitted to make the no-op discoverable).
538
+ */
539
+ analytics?: boolean;
540
+ }
541
+
542
+ /**
543
+ * Copy for the states `WidgetProvider` renders *itself*, in place of the widget:
544
+ * the error-boundary fallback and the disclosures gate. A host overrides any
545
+ * subset through the `providerLabels` prop, which cascades like
546
+ * `disclosuresAcceptance`.
547
+ *
548
+ * Not named `Labels` on the public surface: a widget's own `labels` prop is a
549
+ * different thing, and these two travel together on every widget's props type.
550
+ */
551
+ interface WidgetProviderLabels {
552
+ /** Default copy for the built-in error boundary fallback. */
553
+ errorBoundaryFallback: string;
554
+ /** Heading when init reports disclosures are required and not yet accepted. */
555
+ disclosuresRequiredTitle: string;
556
+ /** Heading while a token-only refresh leaves init stale for the live token. */
557
+ disclosuresRefreshingTitle: string;
558
+ /** Supporting copy while the accept action is withheld for a stale init. */
559
+ disclosuresRefreshingDescription: string;
560
+ }
561
+
562
+ /**
563
+ * Props for {@link WidgetProvider}.
564
+ *
565
+ * All fields are optional. When **all** are omitted the provider is a transparent
566
+ * pass-through: no fetch is issued and all resolved values cascade unchanged from
567
+ * the nearest ancestor.
568
+ */
569
+ interface WidgetProviderProps extends WidgetProviderBaseProps {
570
+ /**
571
+ * Fallback rendered when a render-time exception is caught inside this
572
+ * provider's subtree. Pass either a `ReactNode` (rendered directly) or a
573
+ * render-prop receiving `{ error, resetErrorBoundary }` from
574
+ * `react-error-boundary`. Default is a plain `role="alert"` div whose copy
575
+ * comes from `providerLabels.errorBoundaryFallback`.
576
+ */
577
+ errorFallback?: ReactNode | ((props: FallbackProps) => ReactNode);
578
+ /**
579
+ * Called once when the boundary catches an error, before the fallback
580
+ * renders. Use for telemetry / error tracking / partner logging. Exceptions
581
+ * thrown from `onError` propagate per `react-error-boundary` semantics.
582
+ */
583
+ onError?: (error: unknown, info: ErrorInfo) => void;
584
+ /**
585
+ * Accept surface shown when the caller owes disclosures — an INVITED
586
+ * teammate (including `NOT_REQUIRED` orgs, who still need Accept to
587
+ * activate) or an ACTIVE user who owes a new version. Pass
588
+ * `<AcceptDisclosuresWidget />`. Cascades like `linkComponent`.
589
+ * WidgetProvider cannot import the widget itself (cycle).
590
+ */
591
+ disclosuresAcceptance?: ReactNode;
592
+ /**
593
+ * Overrides for the copy this provider renders in place of the widget: the
594
+ * built-in error-boundary fallback and the disclosures gate. Any subset;
595
+ * unlisted keys keep their defaults. Cascades like `linkComponent`.
596
+ *
597
+ * Named `providerLabels` rather than `labels` because a widget's own
598
+ * `labels` prop sits alongside this one on the same props type.
599
+ */
600
+ providerLabels?: Partial<WidgetProviderLabels>;
601
+ }
602
+
603
+ interface TransfersWidgetLabels {
604
+ widgetTitle: string;
605
+ transferMoneyCta: string;
606
+ /** Tooltip when the transfer CTA is disabled for insufficient eligible accounts. */
607
+ transferMoneyCtaDisabledTooltip: string;
608
+ /** Fallback when an account has no nickname in lists or options. */
609
+ accountFallbackName: string;
610
+ /** @deprecated No longer rendered. */
611
+ embeddedAccountMaskPrefix: string;
612
+ /** @deprecated No longer rendered. */
613
+ modalReviewAccountNumberPrefix: string;
614
+ /** @deprecated No longer rendered; the list shows From and To columns. */
615
+ listAccountsSeparator: string;
616
+ tableHeaderDate: string;
617
+ tableHeaderStatus: string;
618
+ tableHeaderAmount: string;
619
+ /** The From column header and the panel's From label. */
620
+ transferFromLabel: string;
621
+ /** The To column header and the panel's To label. */
622
+ transferToLabel: string;
623
+ /** Row's accessible name. `{amount}`, `{from}` and `{to}` are filled in. */
624
+ rowAriaLabel: string;
625
+ /** Account kind, the muted line under an account's name. */
626
+ accountKindInternal: string;
627
+ accountKindExternal: string;
628
+ /** @deprecated No longer rendered. */
629
+ externalAccountBadge: string;
630
+ /** @deprecated No longer rendered; the detail panel explains a return. */
631
+ returnShortReasonAccountClosed: string;
632
+ /** @deprecated No longer rendered; the detail panel explains a return. */
633
+ returnShortReasonInvalidAccountDetails: string;
634
+ /** @deprecated No longer rendered; the detail panel explains a return. */
635
+ returnShortReasonAccountCannotReceive: string;
636
+ /** @deprecated No longer rendered; the detail panel explains a return. */
637
+ returnShortReasonRefusedByReceiver: string;
638
+ /** Name for an external account with no nickname. */
639
+ externalAccountFallbackName: string;
640
+ /** Suffix after an account name in sentences. `{last4}` is filled in. */
641
+ accountMaskTemplate: string;
642
+ /** `{last4}` is filled in. */
643
+ accountNumberEndingIn: string;
644
+ showAccountNumber: string;
645
+ hideAccountNumber: string;
646
+ detailTitle: string;
647
+ /** Screen-reader name of the detail panel's close button. */
648
+ detailClose: string;
649
+ detailInitiatedByLabel: string;
650
+ detailInitiatedOnLabel: string;
651
+ returnedTitleAccountClosed: string;
652
+ returnedTitleInvalidAccountDetails: string;
653
+ returnedTitleAccountCannotReceive: string;
654
+ returnedTitleRefusedByReceiver: string;
655
+ returnedTitleGeneric: string;
656
+ returnedExplanationAccountClosed: string;
657
+ returnedExplanationInvalidAccountDetails: string;
658
+ returnedExplanationAccountCannotReceive: string;
659
+ returnedExplanationRefusedByReceiver: string;
660
+ returnedExplanationGeneric: string;
661
+ /** `{amount}` and `{account}` are filled in. */
662
+ returnedRefundSentence: string;
663
+ /** `{account}` is filled in. */
664
+ returnedPausedSentence: string;
665
+ returnedLinkAccountCta: string;
666
+ loadingLabel: string;
667
+ loadErrorTitle: string;
668
+ loadErrorDescription: string;
669
+ loadErrorRetry: string;
670
+ emptyTitle: string;
671
+ emptyDescription: string;
672
+ paginationRowsPerPage: string;
673
+ paginationPreviousPage: string;
674
+ paginationNextPage: string;
675
+ modalTitle: string;
676
+ /** Shown under the title on the accounts step (e.g. ACH timing). */
677
+ modalAccountsSubtitle: string;
678
+ /** `{current}` and `{total}` are filled in. */
679
+ modalStepLabel: string;
680
+ /** @deprecated Use `modalFromLabel`. */
681
+ modalFromAccountPlaceholder: string;
682
+ /** @deprecated Use `modalToLabel`. */
683
+ modalToAccountPlaceholder: string;
684
+ /** @deprecated Use `modalContinue`. */
685
+ modalAccountsConfirm: string;
686
+ /** @deprecated No longer rendered. */
687
+ modalStepAccounts: string;
688
+ /** @deprecated No longer rendered. */
689
+ modalStepAmount: string;
690
+ /** @deprecated No longer rendered. */
691
+ modalStepReview: string;
692
+ /** @deprecated No longer rendered. */
693
+ modalStepResult: string;
694
+ modalFromLabel: string;
695
+ modalToLabel: string;
696
+ modalAmountLabel: string;
697
+ /** Placeholder for the amount input (e.g. "0.00"). */
698
+ modalAmountPlaceholder: string;
699
+ modalFromRequiredError: string;
700
+ modalToRequiredError: string;
701
+ modalContinue: string;
702
+ modalBack: string;
703
+ /** @deprecated Use `modalConfirmTransfer`. */
704
+ modalSubmit: string;
705
+ modalClose: string;
706
+ modalReviewHeading: string;
707
+ /** @deprecated Use `modalFromLabel`. */
708
+ modalReviewFromAccountLabel: string;
709
+ /** @deprecated Use `modalToLabel`. */
710
+ modalReviewToAccountLabel: string;
711
+ /** @deprecated No longer rendered. */
712
+ modalAvailableBalanceCaption: string;
713
+ modalConfirmTransfer: string;
714
+ /** @deprecated Use `modalBack`. */
715
+ modalGoBack: string;
716
+ /** @deprecated No longer rendered. */
717
+ modalSuccessTitle: string;
718
+ /** @deprecated No longer rendered. */
719
+ modalSuccessDescription: string;
720
+ modalResultSuccessTitle: string;
721
+ modalResultDescription: string;
722
+ modalDone: string;
723
+ /** @deprecated No longer rendered. */
724
+ modalResultErrorTitle: string;
725
+ /** @deprecated No longer rendered. */
726
+ modalResultTransferMessagePrefix: string;
727
+ /** @deprecated No longer rendered. */
728
+ modalResultSuccessMessageSuffix: string;
729
+ /** @deprecated No longer rendered. */
730
+ modalResultErrorMessageSuffix: string;
731
+ /** @deprecated Use `modalDone`. */
732
+ modalBackToTransfers: string;
733
+ modalSelectPlaceholder: string;
734
+ rowStatusCompleted: string;
735
+ rowStatusPending: string;
736
+ rowStatusFailed: string;
737
+ rowStatusReturned: string;
738
+ /** @deprecated No longer rendered. */
739
+ rowTypeInternal: string;
740
+ /** @deprecated No longer rendered. */
741
+ rowTypeToExternal: string;
742
+ /** @deprecated No longer rendered. */
743
+ rowTypeFromExternal: string;
744
+ modalAmountInvalidError: string;
745
+ /** Shown under the amount field when the from (embedded) balance is too low. */
746
+ modalInsufficientFundsError: string;
747
+ /** Resets from, to, and amount on the accounts step. */
748
+ modalClearSelections: string;
749
+ modalUnsupportedPairError: string;
750
+ modalSubmitFailedError: string;
751
+ }
752
+ declare const TRANSFERS_WIDGET_LABELS_EN: TransfersWidgetLabels;
753
+
754
+ interface FeatureLabels {
755
+ unavailableLabel: string;
756
+ /** @deprecated No longer rendered; the list shows From and To columns. */
757
+ routeSeparator: string;
758
+ defaultCurrencyCode: string;
759
+ defaultSecCode: string;
760
+ /** Prefix before the page's row range, e.g. "Viewing 1-25". */
761
+ viewingRangeLabel: string;
762
+ }
763
+ declare const DEFAULT_FEATURE_LABELS: FeatureLabels;
764
+
765
+ interface TransfersWidgetPassthroughProps {
766
+ labels?: Partial<TransfersWidgetLabels>;
767
+ featureLabels?: Partial<FeatureLabels>;
768
+ /**
769
+ * Whether the transfer money modal is showing. Supplying it makes the modal
770
+ * controlled: the widget reports every open and close through
771
+ * `onTransferMoneyOpenChange` and changes nothing on screen until the host
772
+ * supplies a new value. Omit to let the widget own it.
773
+ */
774
+ isTransferMoneyOpen?: boolean;
775
+ /** The modal's state on first render, for a host that only wants to seed it. */
776
+ defaultIsTransferMoneyOpen?: boolean;
777
+ /**
778
+ * Called on every open and close — the CTA, the modal's own dismissals, and
779
+ * the close that follows a completed transfer — whether or not the modal is
780
+ * controlled.
781
+ */
782
+ onTransferMoneyOpenChange?: (open: boolean) => void;
783
+ /**
784
+ * Called from a returned transfer's "Link a new account" button. The button
785
+ * shows only when this is passed; wire it to the host's link-account flow.
786
+ */
787
+ onLinkAccountClick?: () => void;
788
+ }
789
+ interface TransfersWidgetProps extends WidgetProviderProps, TransfersWidgetPassthroughProps {
790
+ }
791
+ declare function TransfersWidget({ labels, featureLabels, isTransferMoneyOpen, defaultIsTransferMoneyOpen, onTransferMoneyOpenChange, onLinkAccountClick, ...widgetProviderProps }: TransfersWidgetProps): React.JSX.Element;
792
+
793
+ export { DEFAULT_FEATURE_LABELS as TRANSFERS_FEATURE_LABELS_EN, TRANSFERS_WIDGET_LABELS_EN, TransfersWidget };
794
+ export type { FeatureLabels as TransfersWidgetFeatureLabels, TransfersWidgetLabels, TransfersWidgetProps };