@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,835 @@
1
+ import * as React from 'react';
2
+ import { ComponentType, AnchorHTMLAttributes, ReactNode, ErrorInfo, Ref } from 'react';
3
+
4
+ declare type FallbackProps = {
5
+ error: unknown;
6
+ resetErrorBoundary: (...args: unknown[]) => void;
7
+ };
8
+
9
+ interface ExpensesHeaderLabels {
10
+ bankingTaglinePrefix: string;
11
+ settingsButtonAriaLabel: string;
12
+ }
13
+
14
+ interface ActionItemsListLabels {
15
+ heading: string;
16
+ reviewButton: string;
17
+ }
18
+
19
+ interface ExpensesTransactionsTableLabels {
20
+ loading: string;
21
+ dateColumn: string;
22
+ statusColumn: string;
23
+ merchantColumn: string;
24
+ cardholderColumn: string;
25
+ cardColumn: string;
26
+ departmentColumn: string;
27
+ receiptColumn: string;
28
+ amountColumn: string;
29
+ receiptPresentAriaLabel: string;
30
+ receiptMissingAriaLabel: string;
31
+ addReceiptAriaLabel: string;
32
+ addingReceiptAriaLabel: string;
33
+ /** Accessible name of a clickable row, e.g. "Review expense — Acme, $42.00". */
34
+ rowAriaLabel: (merchantLabel: string, amountLabel: string) => string;
35
+ }
36
+
37
+ interface ExpensesTransactionsFilterBarLabels {
38
+ searchPlaceholder: string;
39
+ searchAriaLabel: string;
40
+ filtersButtonAriaLabel: string;
41
+ clearAll: string;
42
+ dateRangeFieldLabel: string;
43
+ cardOnlyOn: string;
44
+ fieldDate: string;
45
+ fieldPaymentStatus: string;
46
+ fieldApprovalStatus: string;
47
+ fieldType: string;
48
+ fieldTeamMember: string;
49
+ fieldAmount: string;
50
+ fieldCardOnly: string;
51
+ }
52
+
53
+ interface Labels {
54
+ myTransactionsTab: string;
55
+ teamTransactionsTab: string;
56
+ policiesTab: string;
57
+ requirementsTab: string;
58
+ matchingTab: string;
59
+ tabCountAriaSuffix: string;
60
+ /** Accessible name of the spinner shown while `isLoading`. */
61
+ loading: string;
62
+ }
63
+
64
+ interface FileViewerLabels {
65
+ filePreview: string;
66
+ zoomIn: string;
67
+ zoomOut: string;
68
+ moreActions: string;
69
+ downloadAttachment: string;
70
+ deleteAttachment: string;
71
+ }
72
+
73
+ interface AccordionItemCardLabels {
74
+ spentFrom: string;
75
+ cardholder: string;
76
+ physical: string;
77
+ receipt: string;
78
+ memo: string;
79
+ requiredMarker: string;
80
+ missingInfoWarning: string;
81
+ noReceiptWarningTitle: string;
82
+ noReceiptWarningDescription: string;
83
+ receiptAutoMatchedBadge: string;
84
+ receiptMenuAriaLabel: string;
85
+ uploadDropdownUploadOption: string;
86
+ uploadDropdownFindReceiptOption: string;
87
+ uploadDropdownSubmitWithoutOption: string;
88
+ uploadedReceiptDownloadOption: string;
89
+ uploadedReceiptDeleteOption: string;
90
+ saveButton: string;
91
+ cancelButton: string;
92
+ emptyRejectionReason: string;
93
+ rule: string;
94
+ greaterThan: string;
95
+ lessThan: string;
96
+ systemDefaultApplied: string;
97
+ status: string;
98
+ autoApproval: string;
99
+ approved: string;
100
+ approvedBy: (approverName: string) => string;
101
+ rejected: string;
102
+ rejectedBy: (approverName: string) => string;
103
+ awaitingReview: string;
104
+ glCategory: string;
105
+ department: string;
106
+ location: string;
107
+ }
108
+
109
+ interface TransactionDetailsActionsLabels {
110
+ returnToExpenses: string;
111
+ cancel: string;
112
+ reject: string;
113
+ /**
114
+ * The primary-button pairs below are picked by the caller, which passes the
115
+ * finished string in `actions`; the footer never chooses between them.
116
+ */
117
+ approve: string;
118
+ approveReviewNext: string;
119
+ confirmRejection: string;
120
+ confirmRejectionReviewNext: string;
121
+ submitForApproval: string;
122
+ submitForApprovalReviewNext: string;
123
+ rejectionReasonLabel: string;
124
+ noReceiptReasonLabel: string;
125
+ requiredMarker: string;
126
+ reasonRequired: string;
127
+ /** e.g. "Review 2/7" above the bulk progress bar. */
128
+ bulkProgress: (currentItem: number, totalItems: number) => string;
129
+ bulkProgressAriaLabel: string;
130
+ actionFailed: string;
131
+ }
132
+
133
+ interface TransactionDetailsLabels {
134
+ screenReaderTitle: string;
135
+ loading: string;
136
+ screenReaderDescription: string;
137
+ contentTitle: string;
138
+ closeDialog: string;
139
+ requirementsCardTitle: string;
140
+ approvalsCardTitle: string;
141
+ accountingCardTitle: string;
142
+ auditHistoryCardTitle: string;
143
+ /** e.g. "$87.40 at Acme Coffee" — the dialog's one-line summary. */
144
+ amountAtMerchant: (amount: string, merchant: string) => string;
145
+ noReceiptAttached: string;
146
+ dropFilesHere: string;
147
+ clickToBrowse: string;
148
+ acceptedFileTypes: string;
149
+ uploadingReceipt: string;
150
+ uploadingReceiptBody: string;
151
+ readingReceipt: string;
152
+ loadFailed: string;
153
+ tryAgain: string;
154
+ }
155
+
156
+ type AuthToken = string | undefined;
157
+ interface Auth {
158
+ /**
159
+ * Which part of the request do we use to send the auth?
160
+ *
161
+ * @default 'header'
162
+ */
163
+ in?: 'header' | 'query' | 'cookie';
164
+ /**
165
+ * A unique identifier for the security scheme.
166
+ *
167
+ * Defined only when there are multiple security schemes whose `Auth`
168
+ * shape would otherwise be identical.
169
+ */
170
+ key?: string;
171
+ /**
172
+ * Header or query parameter name.
173
+ *
174
+ * @default 'Authorization'
175
+ */
176
+ name?: string;
177
+ scheme?: 'basic' | 'bearer';
178
+ type: 'apiKey' | 'http';
179
+ }
180
+
181
+ interface SerializerOptions<T> {
182
+ /**
183
+ * @default true
184
+ */
185
+ explode: boolean;
186
+ style: T;
187
+ }
188
+ type ArrayStyle = 'form' | 'spaceDelimited' | 'pipeDelimited';
189
+ type ObjectStyle = 'form' | 'deepObject';
190
+
191
+ type QuerySerializer = (query: Record<string, unknown>) => string;
192
+ type BodySerializer = (body: unknown) => unknown;
193
+ type QuerySerializerOptionsObject = {
194
+ allowReserved?: boolean;
195
+ array?: Partial<SerializerOptions<ArrayStyle>>;
196
+ object?: Partial<SerializerOptions<ObjectStyle>>;
197
+ };
198
+ type QuerySerializerOptions = QuerySerializerOptionsObject & {
199
+ /**
200
+ * Per-parameter serialization overrides. When provided, these settings
201
+ * override the global array/object settings for specific parameter names.
202
+ */
203
+ parameters?: Record<string, QuerySerializerOptionsObject>;
204
+ };
205
+
206
+ type HttpMethod = 'connect' | 'delete' | 'get' | 'head' | 'options' | 'patch' | 'post' | 'put' | 'trace';
207
+ type Client$1<RequestFn = never, Config = unknown, MethodFn = never, BuildUrlFn = never, SseFn = never> = {
208
+ /**
209
+ * Returns the final request URL.
210
+ */
211
+ buildUrl: BuildUrlFn;
212
+ getConfig: () => Config;
213
+ request: RequestFn;
214
+ setConfig: (config: Config) => Config;
215
+ } & {
216
+ [K in HttpMethod]: MethodFn;
217
+ } & ([SseFn] extends [never] ? {
218
+ sse?: never;
219
+ } : {
220
+ sse: {
221
+ [K in HttpMethod]: SseFn;
222
+ };
223
+ });
224
+ interface Config$1 {
225
+ /**
226
+ * Auth token or a function returning auth token. The resolved value will be
227
+ * added to the request payload as defined by its `security` array.
228
+ */
229
+ auth?: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken;
230
+ /**
231
+ * A function for serializing request body parameter. By default,
232
+ * {@link JSON.stringify()} will be used.
233
+ */
234
+ bodySerializer?: BodySerializer | null;
235
+ /**
236
+ * An object containing any HTTP headers that you want to pre-populate your
237
+ * `Headers` object with.
238
+ *
239
+ * {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more}
240
+ */
241
+ headers?: RequestInit['headers'] | Record<string, string | number | boolean | (string | number | boolean)[] | null | undefined | unknown>;
242
+ /**
243
+ * The request method.
244
+ *
245
+ * {@link https://developer.mozilla.org/docs/Web/API/fetch#method See more}
246
+ */
247
+ method?: Uppercase<HttpMethod>;
248
+ /**
249
+ * A function for serializing request query parameters. By default, arrays
250
+ * will be exploded in form style, objects will be exploded in deepObject
251
+ * style, and reserved characters are percent-encoded.
252
+ *
253
+ * This method will have no effect if the native `paramsSerializer()` Axios
254
+ * API function is used.
255
+ *
256
+ * {@link https://swagger.io/docs/specification/serialization/#query View examples}
257
+ */
258
+ querySerializer?: QuerySerializer | QuerySerializerOptions;
259
+ /**
260
+ * A function validating request data. This is useful if you want to ensure
261
+ * the request conforms to the desired shape, so it can be safely sent to
262
+ * the server.
263
+ */
264
+ requestValidator?: (data: unknown) => Promise<unknown>;
265
+ /**
266
+ * A function transforming response data before it's returned. This is useful
267
+ * for post-processing data, e.g., converting ISO strings into Date objects.
268
+ */
269
+ responseTransformer?: (data: unknown) => Promise<unknown>;
270
+ /**
271
+ * A function validating response data. This is useful if you want to ensure
272
+ * the response conforms to the desired shape, so it can be safely passed to
273
+ * the transformers and returned to the user.
274
+ */
275
+ responseValidator?: (data: unknown) => Promise<unknown>;
276
+ }
277
+
278
+ type ServerSentEventsOptions<TData = unknown> = Omit<RequestInit, 'method'> & Pick<Config$1, 'method' | 'responseTransformer' | 'responseValidator'> & {
279
+ /**
280
+ * Fetch API implementation. You can use this option to provide a custom
281
+ * fetch instance.
282
+ *
283
+ * @default globalThis.fetch
284
+ */
285
+ fetch?: typeof fetch;
286
+ /**
287
+ * Implementing clients can call request interceptors inside this hook.
288
+ */
289
+ onRequest?: (url: string, init: RequestInit) => Promise<Request>;
290
+ /**
291
+ * Callback invoked when a network or parsing error occurs during streaming.
292
+ *
293
+ * This option applies only if the endpoint returns a stream of events.
294
+ *
295
+ * @param error The error that occurred.
296
+ */
297
+ onSseError?: (error: unknown) => void;
298
+ /**
299
+ * Callback invoked when an event is streamed from the server.
300
+ *
301
+ * This option applies only if the endpoint returns a stream of events.
302
+ *
303
+ * @param event Event streamed from the server.
304
+ * @returns Nothing (void).
305
+ */
306
+ onSseEvent?: (event: StreamEvent<TData>) => void;
307
+ serializedBody?: RequestInit['body'];
308
+ /**
309
+ * Default retry delay in milliseconds.
310
+ *
311
+ * This option applies only if the endpoint returns a stream of events.
312
+ *
313
+ * @default 3000
314
+ */
315
+ sseDefaultRetryDelay?: number;
316
+ /**
317
+ * Maximum number of retry attempts before giving up.
318
+ */
319
+ sseMaxRetryAttempts?: number;
320
+ /**
321
+ * Maximum retry delay in milliseconds.
322
+ *
323
+ * Applies only when exponential backoff is used.
324
+ *
325
+ * This option applies only if the endpoint returns a stream of events.
326
+ *
327
+ * @default 30000
328
+ */
329
+ sseMaxRetryDelay?: number;
330
+ /**
331
+ * Optional sleep function for retry backoff.
332
+ *
333
+ * Defaults to using `setTimeout`.
334
+ */
335
+ sseSleepFn?: (ms: number) => Promise<void>;
336
+ url: string;
337
+ };
338
+ interface StreamEvent<TData = unknown> {
339
+ data: TData;
340
+ event?: string;
341
+ id?: string;
342
+ retry?: number;
343
+ }
344
+ type ServerSentEventsResult<TData = unknown, TReturn = void, TNext = unknown> = {
345
+ stream: AsyncGenerator<TData extends Record<string, unknown> ? TData[keyof TData] : TData, TReturn, TNext>;
346
+ };
347
+
348
+ type ErrInterceptor<Err, Res, Req, Options> = (error: Err,
349
+ /** response may be undefined due to a network error where no response object is produced */
350
+ response: Res | undefined,
351
+ /** request may be undefined, because error may be from building the request object itself */
352
+ request: Req | undefined, options: Options) => Err | Promise<Err>;
353
+ type ReqInterceptor<Req, Options> = (request: Req, options: Options) => Req | Promise<Req>;
354
+ type ResInterceptor<Res, Req, Options> = (response: Res, request: Req, options: Options) => Res | Promise<Res>;
355
+ declare class Interceptors<Interceptor> {
356
+ fns: Array<Interceptor | null>;
357
+ clear(): void;
358
+ eject(id: number | Interceptor): void;
359
+ exists(id: number | Interceptor): boolean;
360
+ getInterceptorIndex(id: number | Interceptor): number;
361
+ update(id: number | Interceptor, fn: Interceptor): number | Interceptor | false;
362
+ use(fn: Interceptor): number;
363
+ }
364
+ interface Middleware<Req, Res, Err, Options> {
365
+ error: Interceptors<ErrInterceptor<Err, Res, Req, Options>>;
366
+ request: Interceptors<ReqInterceptor<Req, Options>>;
367
+ response: Interceptors<ResInterceptor<Res, Req, Options>>;
368
+ }
369
+
370
+ type ResponseStyle = 'data' | 'fields';
371
+ interface Config<T extends ClientOptions$1 = ClientOptions$1> extends Omit<RequestInit, 'body' | 'headers' | 'method'>, Config$1 {
372
+ /**
373
+ * Base URL for all requests made by this client.
374
+ */
375
+ baseUrl?: T['baseUrl'];
376
+ /**
377
+ * Fetch API implementation. You can use this option to provide a custom
378
+ * fetch instance.
379
+ *
380
+ * @default globalThis.fetch
381
+ */
382
+ fetch?: typeof fetch;
383
+ /**
384
+ * Please don't use the Fetch client for Next.js applications. The `next`
385
+ * options won't have any effect.
386
+ *
387
+ * Install {@link https://www.npmjs.com/package/@hey-api/client-next `@hey-api/client-next`} instead.
388
+ */
389
+ next?: never;
390
+ /**
391
+ * Return the response data parsed in a specified format. By default, `auto`
392
+ * will infer the appropriate method from the `Content-Type` response header.
393
+ * You can override this behavior with any of the {@link Body} methods.
394
+ * Select `stream` if you don't want to parse response data at all.
395
+ *
396
+ * @default 'auto'
397
+ */
398
+ parseAs?: 'arrayBuffer' | 'auto' | 'blob' | 'formData' | 'json' | 'stream' | 'text';
399
+ /**
400
+ * Should we return only data or multiple fields (data, error, response, etc.)?
401
+ *
402
+ * @default 'fields'
403
+ */
404
+ responseStyle?: ResponseStyle;
405
+ /**
406
+ * Throw an error instead of returning it in the response?
407
+ *
408
+ * @default false
409
+ */
410
+ throwOnError?: T['throwOnError'];
411
+ }
412
+ interface RequestOptions<TData = unknown, TResponseStyle extends ResponseStyle = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string> extends Config<{
413
+ responseStyle: TResponseStyle;
414
+ throwOnError: ThrowOnError;
415
+ }>, Pick<ServerSentEventsOptions<TData>, 'onRequest' | 'onSseError' | 'onSseEvent' | 'sseDefaultRetryDelay' | 'sseMaxRetryAttempts' | 'sseMaxRetryDelay'> {
416
+ /**
417
+ * Any body that you want to add to your request.
418
+ *
419
+ * {@link https://developer.mozilla.org/docs/Web/API/fetch#body}
420
+ */
421
+ body?: unknown;
422
+ path?: Record<string, unknown>;
423
+ query?: Record<string, unknown>;
424
+ /**
425
+ * Security mechanism(s) to use for the request.
426
+ */
427
+ security?: ReadonlyArray<Auth>;
428
+ url: Url;
429
+ }
430
+ interface ResolvedRequestOptions<TResponseStyle extends ResponseStyle = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string> extends RequestOptions<unknown, TResponseStyle, ThrowOnError, Url> {
431
+ headers: Headers;
432
+ serializedBody?: string;
433
+ }
434
+ 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 : {
435
+ data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
436
+ request: Request;
437
+ response: Response;
438
+ }> : Promise<TResponseStyle extends 'data' ? (TData extends Record<string, unknown> ? TData[keyof TData] : TData) | undefined : ({
439
+ data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
440
+ error: undefined;
441
+ } | {
442
+ data: undefined;
443
+ error: TError extends Record<string, unknown> ? TError[keyof TError] : TError;
444
+ }) & {
445
+ /** request may be undefined, because error may be from building the request object itself */
446
+ request?: Request;
447
+ /** response may be undefined, because error may be from building the request object itself or from a network error */
448
+ response?: Response;
449
+ }>;
450
+ interface ClientOptions$1 {
451
+ baseUrl?: string;
452
+ responseStyle?: ResponseStyle;
453
+ throwOnError?: boolean;
454
+ }
455
+ 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>;
456
+ type SseFn = <TData = unknown, _TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<never, TResponseStyle, ThrowOnError>, 'method'>) => Promise<ServerSentEventsResult<TData>>;
457
+ 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>;
458
+ type BuildUrlFn = <TData extends {
459
+ body?: unknown;
460
+ path?: Record<string, unknown>;
461
+ query?: Record<string, unknown>;
462
+ url: string;
463
+ }>(options: TData & Options<TData>) => string;
464
+ type Client = Client$1<RequestFn, Config, MethodFn, BuildUrlFn, SseFn> & {
465
+ interceptors: Middleware<Request, Response, unknown, ResolvedRequestOptions>;
466
+ };
467
+ interface TDataShape {
468
+ body?: unknown;
469
+ headers?: unknown;
470
+ path?: unknown;
471
+ query?: unknown;
472
+ url: string;
473
+ }
474
+ type OmitKeys<T, K> = Pick<T, Exclude<keyof T, K>>;
475
+ 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'>);
476
+
477
+ type ClientOptions = {
478
+ 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 & {});
479
+ };
480
+
481
+ type EmbeddedClient = Client;
482
+ type ExtractLiterals<T> = T extends string ? string extends T ? never : T : never;
483
+ type BaseUrl = ExtractLiterals<ClientOptions['baseUrl']>;
484
+
485
+ /**
486
+ * The statuses the widget displays: the REST `ExpenseStatusEnum` minus
487
+ * `deleted`, which `toExpenseDisplayStatus` folds into `canceled`.
488
+ */
489
+ type ExpenseDisplayStatus = 'new' | 'approve_in_progress' | 'approved' | 'rejected' | 'canceled';
490
+ type ExpenseStatusBadgeLabels = Record<ExpenseDisplayStatus, string> & {
491
+ unknown: string;
492
+ readyToSubmit: string;
493
+ missingInfo: string;
494
+ };
495
+
496
+ type LinkComponentProps = AnchorHTMLAttributes<HTMLAnchorElement> & {
497
+ children?: ReactNode;
498
+ };
499
+ type LinkComponent = ComponentType<LinkComponentProps>;
500
+ /**
501
+ * The UI frameworks a widget's UI layer can render with.
502
+ *
503
+ * - `shadcn` — the shadcn/Tailwind implementation. This is the default and the
504
+ * implicit fallback, so existing consumers that select nothing keep rendering
505
+ * shadcn.
506
+ * - `tecton` — the Tecton implementation.
507
+ *
508
+ * Declared as an `as const` object (not a TypeScript `enum`) per repo
509
+ * convention.
510
+ */
511
+ declare const UIFramework: {
512
+ readonly Shadcn: "shadcn";
513
+ readonly Tecton: "tecton";
514
+ };
515
+ type UIFramework = (typeof UIFramework)[keyof typeof UIFramework];
516
+
517
+ /**
518
+ * The settable fields of the widget config cascade.
519
+ *
520
+ * This is the type accepted by {@link setGlobalWidgetConfig} and all provider props.
521
+ * It intentionally excludes `initResponse`, which is populated automatically by the
522
+ * provider after a successful fetch and must never be set manually.
523
+ *
524
+ * The `null` vs `undefined` distinction on `widgetToken` and `organizationId` is intentional:
525
+ * - `undefined` — not set at this level; inherit from the nearest ancestor or global store.
526
+ * - `null` — explicitly cleared; downstream sees "no value" even if an ancestor had one
527
+ * (e.g. after logout or deliberate de-scoping).
528
+ *
529
+ * @see {@link WidgetConfig} for the resolved output type (includes `initResponse`)
530
+ * @see {@link RootWidgetProvider}
531
+ * @see {@link WidgetProvider}
532
+ * @see {@link setGlobalWidgetConfig}
533
+ */
534
+ interface WidgetConfigInput {
535
+ /**
536
+ * Base URL of the Tesouro embedded API (e.g. `"https://api.tesouro.com"`).
537
+ *
538
+ * When omitted the nearest ancestor's `baseUrl` or the global store value is used.
539
+ * Changing this recreates the underlying HTTP client so all subsequent requests
540
+ * go to the new host.
541
+ */
542
+ baseUrl?: BaseUrl;
543
+ /**
544
+ * Bearer token used to authenticate widget requests.
545
+ *
546
+ * Injected as `Authorization: Bearer <token>` on every outgoing request via an
547
+ * interceptor on the scoped HTTP client. Token updates are picked up immediately
548
+ * without recreating the client.
549
+ *
550
+ * - `string` — send this token on all requests from this level downward.
551
+ * - `null` — explicitly cleared; no auth header is sent and fetching is suppressed.
552
+ * - `undefined` — not set at this level; inherit from the nearest ancestor or global store.
553
+ */
554
+ widgetToken?: string | null;
555
+ /**
556
+ * Organization ID forwarded as the `x-organization-id` request header.
557
+ *
558
+ * Passed through {@link EmbedApiProvider} context rather than the auth interceptor,
559
+ * so individual data-access hooks can opt in per-request.
560
+ *
561
+ * - `string` — use this organization for downstream data requests.
562
+ * - `null` — explicitly cleared; queries that require an org ID will be disabled.
563
+ * - `undefined` — not set at this level; inherit from the nearest ancestor or global store.
564
+ *
565
+ * When `undefined` across the **whole** cascade (no prop, no ancestor, no global
566
+ * value), the resolved org defaults to the loaded `initResponse.organizationId`
567
+ * (see {@link WidgetConfig.initResponse}) once the widget-init fetch settles. This
568
+ * is the lowest-priority fallback — any explicit `string` or `null` at any cascade
569
+ * level wins, and an explicit `null` is preserved and never falls back.
570
+ *
571
+ * Only an **explicit** ancestor org is inherited. An ancestor's *init-derived*
572
+ * default does not propagate into a descendant that owns its own fetch (its own
573
+ * `baseUrl`/`widgetToken`); such a descendant defaults to its own
574
+ * `initResponse.organizationId` instead, so it never sends an ancestor's org with
575
+ * its own token.
576
+ */
577
+ organizationId?: string | null;
578
+ /**
579
+ * Optional post-creation hook for the scoped HTTP client.
580
+ *
581
+ * Called once after the provider creates its scoped {@link EmbeddedClient} and
582
+ * applies the built-in `Authorization: Bearer` interceptor. Receives the
583
+ * fully-configured client and must return the client to be used for the lifetime of
584
+ * this provider level — either the same instance (with additional interceptors
585
+ * attached) or a new client entirely.
586
+ *
587
+ * **Order:** The built-in auth interceptor is always applied first. `configClient`
588
+ * is called on top of it, so any interceptors you add here run after auth is set.
589
+ *
590
+ * **Any prop triggers a scoped client.** A {@link WidgetProvider} creates its own
591
+ * scoped client whenever any prop is set — including `configClient` alone, without
592
+ * `baseUrl` or `widgetToken`. Only a fully props-free pass-through provider skips
593
+ * client creation and never calls this function.
594
+ *
595
+ * **Stability:** The function reference is included in the client creation memo's
596
+ * dependency array. Passing an unstable (inline) function recreates the client on
597
+ * every render. Stabilize with `useCallback` or define the function outside the
598
+ * component.
599
+ *
600
+ * **Cascade:** Inherits from the nearest ancestor when `undefined`. A child
601
+ * {@link WidgetProvider} that creates its own scoped client will use the resolved
602
+ * `configClient` from the cascade unless it provides its own override.
603
+ *
604
+ * @example
605
+ * ```tsx
606
+ * const addLogging = useCallback(
607
+ * (client: EmbeddedClient) => {
608
+ * client.interceptors.request.use((req) => {
609
+ * console.log('[widget]', req.method, req.url);
610
+ * return req;
611
+ * });
612
+ * return client;
613
+ * },
614
+ * [],
615
+ * );
616
+ *
617
+ * <RootWidgetProvider
618
+ * baseUrl="https://api.tesouro.com"
619
+ * widgetToken={token}
620
+ * configClient={addLogging}
621
+ * >
622
+ * <App />
623
+ * </RootWidgetProvider>
624
+ * ```
625
+ */
626
+ configClient?: (client: EmbeddedClient) => EmbeddedClient;
627
+ /**
628
+ * Overrides the widget-gateway routing decision for the scoped HTTP client.
629
+ *
630
+ * Any caller reaching the Tesouro API with a widget token must route data
631
+ * requests through the widget gateway: prefix the path with
632
+ * `/api/widget-gateway/proxy` and carry the token as `X-Widget-Token`. The
633
+ * provider applies both automatically per request when the request origin is
634
+ * a known Tesouro API host (`WIDGET_GATEWAY_HOSTS`, derived from the
635
+ * generated `ClientOptions['baseUrl']`); `/api/widget-gateway/*` paths (the
636
+ * init round-trip) always pass through untouched.
637
+ *
638
+ * - `undefined` — decide from the request origin, as above. Inherits from
639
+ * the nearest ancestor or global store like every other config field.
640
+ * - `true` — always apply the rewrite, even for an unlisted base URL (e.g. a
641
+ * custom domain in front of the gateway).
642
+ * - `false` — never apply it. For hosts that route widget requests their own
643
+ * way, such as a same-origin BFF whose `configClient` retargets every
644
+ * request.
645
+ *
646
+ * Independent of {@link configClient}: a host that only adds a header keeps
647
+ * the built-in routing, and the built-in interceptor runs before any
648
+ * `configClient` interceptor.
649
+ */
650
+ gatewayRouting?: boolean;
651
+ /**
652
+ * Component the embedded widgets should render in place of plain `<a>` tags.
653
+ *
654
+ * Pass e.g. Next.js's `Link` to make in-app navigation use the host router.
655
+ * Cascades like other config: provider prop > nearest ancestor > global store.
656
+ * When no value is set anywhere, widgets fall back to a plain `<a>` element.
657
+ */
658
+ linkComponent?: LinkComponent;
659
+ /**
660
+ * Which UI framework the widget UI layer should render with.
661
+ *
662
+ * Lets a consuming context bind widgets to either the shadcn/Tailwind or the
663
+ * Tecton implementation behind the same outward-facing API. The selection is
664
+ * a presentation concern only — it cascades through the provider tree exactly
665
+ * like {@link linkComponent} and is read by UI libraries via `useUIFramework`;
666
+ * it never appears in any widget's feature-library or component props.
667
+ *
668
+ * - `'shadcn'` — the shadcn/Tailwind implementation.
669
+ * - `'tecton'` — the Tecton implementation.
670
+ * - `null` / `undefined` — not set at this level; inherit from the nearest
671
+ * ancestor or global store, falling back to `shadcn` when unset everywhere.
672
+ * `shadcn` is the implicit default, so existing consumers need no changes.
673
+ */
674
+ uiFramework?: UIFramework | null;
675
+ }
676
+ /**
677
+ * Props shared by every analytics-owner-capable widget provider.
678
+ *
679
+ * Combines the full settable cascade ({@link WidgetConfigInput}) with the
680
+ * analytics opt-out honored by analytics owners. Both {@link RootWidgetProvider}
681
+ * and {@link WidgetProvider} build their public props on top of this; the latter
682
+ * adds error-boundary props of its own.
683
+ *
684
+ * @see {@link WidgetConfigInput} for per-field cascade and `null` vs omitted semantics
685
+ */
686
+ interface WidgetProviderBaseProps extends WidgetConfigInput {
687
+ /**
688
+ * Opt out of all analytics capture and prevent PostHog from loading. Default `true`.
689
+ *
690
+ * Honored only by an analytics **owner** — a {@link RootWidgetProvider} or a
691
+ * standalone {@link WidgetProvider} with no parent provider. When `false`,
692
+ * owner-bound `track` calls in this subtree become no-ops and the PostHog
693
+ * installer is never dynamically imported for this owner's environment.
694
+ * Setting it on a nested {@link WidgetProvider} is ignored in v1 (a one-time
695
+ * `console.warn` is emitted to make the no-op discoverable).
696
+ */
697
+ analytics?: boolean;
698
+ }
699
+
700
+ /**
701
+ * Copy for the states `WidgetProvider` renders *itself*, in place of the widget:
702
+ * the error-boundary fallback and the disclosures gate. A host overrides any
703
+ * subset through the `providerLabels` prop, which cascades like
704
+ * `disclosuresAcceptance`.
705
+ *
706
+ * Not named `Labels` on the public surface: a widget's own `labels` prop is a
707
+ * different thing, and these two travel together on every widget's props type.
708
+ */
709
+ interface WidgetProviderLabels {
710
+ /** Default copy for the built-in error boundary fallback. */
711
+ errorBoundaryFallback: string;
712
+ /** Heading when init reports disclosures are required and not yet accepted. */
713
+ disclosuresRequiredTitle: string;
714
+ /** Heading while a token-only refresh leaves init stale for the live token. */
715
+ disclosuresRefreshingTitle: string;
716
+ /** Supporting copy while the accept action is withheld for a stale init. */
717
+ disclosuresRefreshingDescription: string;
718
+ }
719
+
720
+ /**
721
+ * Props for {@link WidgetProvider}.
722
+ *
723
+ * All fields are optional. When **all** are omitted the provider is a transparent
724
+ * pass-through: no fetch is issued and all resolved values cascade unchanged from
725
+ * the nearest ancestor.
726
+ */
727
+ interface WidgetProviderProps extends WidgetProviderBaseProps {
728
+ /**
729
+ * Fallback rendered when a render-time exception is caught inside this
730
+ * provider's subtree. Pass either a `ReactNode` (rendered directly) or a
731
+ * render-prop receiving `{ error, resetErrorBoundary }` from
732
+ * `react-error-boundary`. Default is a plain `role="alert"` div whose copy
733
+ * comes from `providerLabels.errorBoundaryFallback`.
734
+ */
735
+ errorFallback?: ReactNode | ((props: FallbackProps) => ReactNode);
736
+ /**
737
+ * Called once when the boundary catches an error, before the fallback
738
+ * renders. Use for telemetry / error tracking / partner logging. Exceptions
739
+ * thrown from `onError` propagate per `react-error-boundary` semantics.
740
+ */
741
+ onError?: (error: unknown, info: ErrorInfo) => void;
742
+ /**
743
+ * Accept surface shown when the caller owes disclosures — an INVITED
744
+ * teammate (including `NOT_REQUIRED` orgs, who still need Accept to
745
+ * activate) or an ACTIVE user who owes a new version. Pass
746
+ * `<AcceptDisclosuresWidget />`. Cascades like `linkComponent`.
747
+ * WidgetProvider cannot import the widget itself (cycle).
748
+ */
749
+ disclosuresAcceptance?: ReactNode;
750
+ /**
751
+ * Overrides for the copy this provider renders in place of the widget: the
752
+ * built-in error-boundary fallback and the disclosures gate. Any subset;
753
+ * unlisted keys keep their defaults. Cascades like `linkComponent`.
754
+ *
755
+ * Named `providerLabels` rather than `labels` because a widget's own
756
+ * `labels` prop sits alongside this one on the same props type.
757
+ */
758
+ providerLabels?: Partial<WidgetProviderLabels>;
759
+ }
760
+
761
+ /**
762
+ * Aggregate outcome of a receipt batch after the backend finishes OCR and
763
+ * auto-matching. `stillProcessing` counts receipts that never reached a terminal
764
+ * state inside the host's budget, which is a neutral state, not a failure.
765
+ */
766
+ interface ReceiptMatchSummary {
767
+ total: number;
768
+ matched: number;
769
+ unmatched: number;
770
+ unreadable: number;
771
+ stillProcessing: number;
772
+ }
773
+ interface UploadReceiptWidgetProps {
774
+ emailAddress?: string;
775
+ onFileUpload?: (file: File) => unknown | Promise<unknown>;
776
+ /**
777
+ * Awaited after every file in the batch has uploaded. Resolve once the backend
778
+ * has finished OCR and auto-matching so the widget can report the outcome in
779
+ * the upload tray. Omit it and the widget stops at "Uploaded N attachments".
780
+ */
781
+ onAwaitMatching?: (uploadedCount: number) => Promise<ReceiptMatchSummary>;
782
+ isUploading?: boolean;
783
+ /** Lets the host start an upload without the popover, e.g. for a drop on its list. */
784
+ ref?: Ref<UploadReceiptHandle>;
785
+ }
786
+ interface UploadReceiptHandle {
787
+ upload: (files: File[]) => void;
788
+ }
789
+
790
+ interface ExpenseManagementWidgetOwnProps {
791
+ screenLabels?: Partial<Labels>;
792
+ headerLabels?: Partial<ExpensesHeaderLabels>;
793
+ transactionsTableLabels?: Partial<ExpensesTransactionsTableLabels>;
794
+ filterBarLabels?: Partial<ExpensesTransactionsFilterBarLabels>;
795
+ actionItemsLabels?: Partial<ActionItemsListLabels>;
796
+ statusBadgeLabels?: Partial<ExpenseStatusBadgeLabels>;
797
+ /** Copy for the full-screen review dialog opened from a row or an Action Item. */
798
+ transactionDetailsLabels?: Partial<TransactionDetailsLabels>;
799
+ transactionDetailsCardLabels?: Partial<AccordionItemCardLabels>;
800
+ transactionDetailsActionsLabels?: Partial<TransactionDetailsActionsLabels>;
801
+ fileViewerLabels?: Partial<FileViewerLabels>;
802
+ /** Renders the "Upload receipts" entry point in the header's actions slot. */
803
+ receiptUpload?: UploadReceiptWidgetProps;
804
+ /**
805
+ * Bank attribution header (name/logo/tagline) plus an optional settings
806
+ * entry point. The widget cannot fetch its own bank branding or navigate
807
+ * (host routing ban), so the host supplies both.
808
+ */
809
+ bankDisplayName?: string;
810
+ bankLogoSrc?: string;
811
+ bankLogoAlt?: string;
812
+ isBankingTaglineVisible?: boolean;
813
+ onSettingsClick?: () => void;
814
+ }
815
+ type ExpenseManagementWidgetProps = WidgetProviderProps & ExpenseManagementWidgetOwnProps;
816
+ /**
817
+ * Rebuilt for parity with the legacy `libs/embedded-banking/shared/expense-management`
818
+ * widget: bank attribution header, My/Team transactions tabs with count
819
+ * badges, Action Items, a searchable/filterable/paginated transactions table
820
+ * with status pills and per-row receipt markers, the full-screen review dialog
821
+ * (from a row or an Action Item's "Review"), the receipt-match sidebar (from
822
+ * the unmatched-receipts Action Item), and an Upload Receipts entry
823
+ * point — composed from `ExpensesScreen` rather than a monolithic UI
824
+ * component, following the `WidgetProvider` "Feature Component Pattern" the
825
+ * same way `ReceivablesWidget` does.
826
+ *
827
+ * Team tab visibility matches legacy: `ExpenseReadOrg`, or a direct-reports
828
+ * probe for people-managers without org-wide read. The Team list, its count
829
+ * and its Action Items share that one gate; the rows themselves are scoped by
830
+ * the backend (ADR-0003), never by ids the widget collects.
831
+ */
832
+ declare function ExpenseManagementWidget({ screenLabels, headerLabels, transactionsTableLabels, filterBarLabels, actionItemsLabels, statusBadgeLabels, transactionDetailsLabels, transactionDetailsCardLabels, transactionDetailsActionsLabels, fileViewerLabels, receiptUpload, bankDisplayName, bankLogoSrc, bankLogoAlt, isBankingTaglineVisible, onSettingsClick, ...widgetProviderProps }: ExpenseManagementWidgetProps): React.JSX.Element;
833
+
834
+ export { ExpenseManagementWidget };
835
+ export type { AccordionItemCardLabels, Labels as ExpenseManagementWidgetLabels, ExpenseManagementWidgetProps, ExpenseStatusBadgeLabels, FileViewerLabels, TransactionDetailsActionsLabels, TransactionDetailsLabels };