@tesouro/embedded-components-loader 0.0.0 → 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 +314 -5
  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 +93 -4
@@ -0,0 +1,1698 @@
1
+ import { ComponentType, AnchorHTMLAttributes, ReactNode, ErrorInfo } from 'react';
2
+
3
+ /**
4
+ Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
5
+
6
+ @category Type
7
+ */
8
+ type Primitive =
9
+ | null
10
+ | undefined
11
+ | string
12
+ | number
13
+ | boolean
14
+ | symbol
15
+ | bigint;
16
+
17
+ declare global {
18
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
19
+ interface SymbolConstructor {
20
+ readonly observable: symbol;
21
+ }
22
+ }
23
+
24
+ /**
25
+ Extract all optional keys from the given type.
26
+
27
+ This is useful when you want to create a new type that contains different type values for the optional keys only.
28
+
29
+ @example
30
+ ```
31
+ import type {OptionalKeysOf, Except} from 'type-fest';
32
+
33
+ interface User {
34
+ name: string;
35
+ surname: string;
36
+
37
+ luckyNumber?: number;
38
+ }
39
+
40
+ const REMOVE_FIELD = Symbol('remove field symbol');
41
+ type UpdateOperation<Entity extends object> = Except<Partial<Entity>, OptionalKeysOf<Entity>> & {
42
+ [Key in OptionalKeysOf<Entity>]?: Entity[Key] | typeof REMOVE_FIELD;
43
+ };
44
+
45
+ const update1: UpdateOperation<User> = {
46
+ name: 'Alice'
47
+ };
48
+
49
+ const update2: UpdateOperation<User> = {
50
+ name: 'Bob',
51
+ luckyNumber: REMOVE_FIELD
52
+ };
53
+ ```
54
+
55
+ @category Utilities
56
+ */
57
+ type OptionalKeysOf<BaseType extends object> =
58
+ BaseType extends unknown // For distributing `BaseType`
59
+ ? (keyof {
60
+ [Key in keyof BaseType as BaseType extends Record<Key, BaseType[Key]> ? never : Key]: never
61
+ }) & (keyof BaseType) // Intersect with `keyof BaseType` to ensure result of `OptionalKeysOf<BaseType>` is always assignable to `keyof BaseType`
62
+ : never; // Should never happen
63
+
64
+ /**
65
+ Extract all required keys from the given type.
66
+
67
+ This is useful when you want to create a new type that contains different type values for the required keys only or use the list of keys for validation purposes, etc...
68
+
69
+ @example
70
+ ```
71
+ import type {RequiredKeysOf} from 'type-fest';
72
+
73
+ declare function createValidation<Entity extends object, Key extends RequiredKeysOf<Entity> = RequiredKeysOf<Entity>>(field: Key, validator: (value: Entity[Key]) => boolean): ValidatorFn;
74
+
75
+ interface User {
76
+ name: string;
77
+ surname: string;
78
+
79
+ luckyNumber?: number;
80
+ }
81
+
82
+ const validator1 = createValidation<User>('name', value => value.length < 25);
83
+ const validator2 = createValidation<User>('surname', value => value.length < 25);
84
+ ```
85
+
86
+ @category Utilities
87
+ */
88
+ type RequiredKeysOf<BaseType extends object> =
89
+ BaseType extends unknown // For distributing `BaseType`
90
+ ? Exclude<keyof BaseType, OptionalKeysOf<BaseType>>
91
+ : never; // Should never happen
92
+
93
+ /**
94
+ Returns a boolean for whether the given type is `never`.
95
+
96
+ @link https://github.com/microsoft/TypeScript/issues/31751#issuecomment-498526919
97
+ @link https://stackoverflow.com/a/53984913/10292952
98
+ @link https://www.zhenghao.io/posts/ts-never
99
+
100
+ Useful in type utilities, such as checking if something does not occur.
101
+
102
+ @example
103
+ ```
104
+ import type {IsNever, And} from 'type-fest';
105
+
106
+ // https://github.com/andnp/SimplyTyped/blob/master/src/types/strings.ts
107
+ type AreStringsEqual<A extends string, B extends string> =
108
+ And<
109
+ IsNever<Exclude<A, B>> extends true ? true : false,
110
+ IsNever<Exclude<B, A>> extends true ? true : false
111
+ >;
112
+
113
+ type EndIfEqual<I extends string, O extends string> =
114
+ AreStringsEqual<I, O> extends true
115
+ ? never
116
+ : void;
117
+
118
+ function endIfEqual<I extends string, O extends string>(input: I, output: O): EndIfEqual<I, O> {
119
+ if (input === output) {
120
+ process.exit(0);
121
+ }
122
+ }
123
+
124
+ endIfEqual('abc', 'abc');
125
+ //=> never
126
+
127
+ endIfEqual('abc', '123');
128
+ //=> void
129
+ ```
130
+
131
+ @category Type Guard
132
+ @category Utilities
133
+ */
134
+ type IsNever<T> = [T] extends [never] ? true : false;
135
+
136
+ /**
137
+ An if-else-like type that resolves depending on whether the given type is `never`.
138
+
139
+ @see {@link IsNever}
140
+
141
+ @example
142
+ ```
143
+ import type {IfNever} from 'type-fest';
144
+
145
+ type ShouldBeTrue = IfNever<never>;
146
+ //=> true
147
+
148
+ type ShouldBeBar = IfNever<'not never', 'foo', 'bar'>;
149
+ //=> 'bar'
150
+ ```
151
+
152
+ @category Type Guard
153
+ @category Utilities
154
+ */
155
+ type IfNever<T, TypeIfNever = true, TypeIfNotNever = false> = (
156
+ IsNever<T> extends true ? TypeIfNever : TypeIfNotNever
157
+ );
158
+
159
+ // Can eventually be replaced with the built-in once this library supports
160
+ // TS5.4+ only. Tracked in https://github.com/sindresorhus/type-fest/issues/848
161
+ type NoInfer<T> = T extends infer U ? U : never;
162
+
163
+ /**
164
+ Returns a boolean for whether the given type is `any`.
165
+
166
+ @link https://stackoverflow.com/a/49928360/1490091
167
+
168
+ Useful in type utilities, such as disallowing `any`s to be passed to a function.
169
+
170
+ @example
171
+ ```
172
+ import type {IsAny} from 'type-fest';
173
+
174
+ const typedObject = {a: 1, b: 2} as const;
175
+ const anyObject: any = {a: 1, b: 2};
176
+
177
+ function get<O extends (IsAny<O> extends true ? {} : Record<string, number>), K extends keyof O = keyof O>(obj: O, key: K) {
178
+ return obj[key];
179
+ }
180
+
181
+ const typedA = get(typedObject, 'a');
182
+ //=> 1
183
+
184
+ const anyA = get(anyObject, 'a');
185
+ //=> any
186
+ ```
187
+
188
+ @category Type Guard
189
+ @category Utilities
190
+ */
191
+ type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false;
192
+
193
+ /**
194
+ Useful to flatten the type output to improve type hints shown in editors. And also to transform an interface into a type to aide with assignability.
195
+
196
+ @example
197
+ ```
198
+ import type {Simplify} from 'type-fest';
199
+
200
+ type PositionProps = {
201
+ top: number;
202
+ left: number;
203
+ };
204
+
205
+ type SizeProps = {
206
+ width: number;
207
+ height: number;
208
+ };
209
+
210
+ // In your editor, hovering over `Props` will show a flattened object with all the properties.
211
+ type Props = Simplify<PositionProps & SizeProps>;
212
+ ```
213
+
214
+ Sometimes it is desired to pass a value as a function argument that has a different type. At first inspection it may seem assignable, and then you discover it is not because the `value`'s type definition was defined as an interface. In the following example, `fn` requires an argument of type `Record<string, unknown>`. If the value is defined as a literal, then it is assignable. And if the `value` is defined as type using the `Simplify` utility the value is assignable. But if the `value` is defined as an interface, it is not assignable because the interface is not sealed and elsewhere a non-string property could be added to the interface.
215
+
216
+ If the type definition must be an interface (perhaps it was defined in a third-party npm package), then the `value` can be defined as `const value: Simplify<SomeInterface> = ...`. Then `value` will be assignable to the `fn` argument. Or the `value` can be cast as `Simplify<SomeInterface>` if you can't re-declare the `value`.
217
+
218
+ @example
219
+ ```
220
+ import type {Simplify} from 'type-fest';
221
+
222
+ interface SomeInterface {
223
+ foo: number;
224
+ bar?: string;
225
+ baz: number | undefined;
226
+ }
227
+
228
+ type SomeType = {
229
+ foo: number;
230
+ bar?: string;
231
+ baz: number | undefined;
232
+ };
233
+
234
+ const literal = {foo: 123, bar: 'hello', baz: 456};
235
+ const someType: SomeType = literal;
236
+ const someInterface: SomeInterface = literal;
237
+
238
+ function fn(object: Record<string, unknown>): void {}
239
+
240
+ fn(literal); // Good: literal object type is sealed
241
+ fn(someType); // Good: type is sealed
242
+ fn(someInterface); // Error: Index signature for type 'string' is missing in type 'someInterface'. Because `interface` can be re-opened
243
+ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface` into a `type`
244
+ ```
245
+
246
+ @link https://github.com/microsoft/TypeScript/issues/15300
247
+ @see SimplifyDeep
248
+ @category Object
249
+ */
250
+ type Simplify<T> = {[KeyType in keyof T]: T[KeyType]} & {};
251
+
252
+ /**
253
+ Omit any index signatures from the given object type, leaving only explicitly defined properties.
254
+
255
+ This is the counterpart of `PickIndexSignature`.
256
+
257
+ Use-cases:
258
+ - Remove overly permissive signatures from third-party types.
259
+
260
+ This type was taken from this [StackOverflow answer](https://stackoverflow.com/a/68261113/420747).
261
+
262
+ It relies on the fact that an empty object (`{}`) is assignable to an object with just an index signature, like `Record<string, unknown>`, but not to an object with explicitly defined keys, like `Record<'foo' | 'bar', unknown>`.
263
+
264
+ (The actual value type, `unknown`, is irrelevant and could be any type. Only the key type matters.)
265
+
266
+ ```
267
+ const indexed: Record<string, unknown> = {}; // Allowed
268
+
269
+ const keyed: Record<'foo', unknown> = {}; // Error
270
+ // => TS2739: Type '{}' is missing the following properties from type 'Record<"foo" | "bar", unknown>': foo, bar
271
+ ```
272
+
273
+ Instead of causing a type error like the above, you can also use a [conditional type](https://www.typescriptlang.org/docs/handbook/2/conditional-types.html) to test whether a type is assignable to another:
274
+
275
+ ```
276
+ type Indexed = {} extends Record<string, unknown>
277
+ ? '✅ `{}` is assignable to `Record<string, unknown>`'
278
+ : '❌ `{}` is NOT assignable to `Record<string, unknown>`';
279
+ // => '✅ `{}` is assignable to `Record<string, unknown>`'
280
+
281
+ type Keyed = {} extends Record<'foo' | 'bar', unknown>
282
+ ? "✅ `{}` is assignable to `Record<'foo' | 'bar', unknown>`"
283
+ : "❌ `{}` is NOT assignable to `Record<'foo' | 'bar', unknown>`";
284
+ // => "❌ `{}` is NOT assignable to `Record<'foo' | 'bar', unknown>`"
285
+ ```
286
+
287
+ Using a [mapped type](https://www.typescriptlang.org/docs/handbook/2/mapped-types.html#further-exploration), you can then check for each `KeyType` of `ObjectType`...
288
+
289
+ ```
290
+ import type {OmitIndexSignature} from 'type-fest';
291
+
292
+ type OmitIndexSignature<ObjectType> = {
293
+ [KeyType in keyof ObjectType // Map each key of `ObjectType`...
294
+ ]: ObjectType[KeyType]; // ...to its original value, i.e. `OmitIndexSignature<Foo> == Foo`.
295
+ };
296
+ ```
297
+
298
+ ...whether an empty object (`{}`) would be assignable to an object with that `KeyType` (`Record<KeyType, unknown>`)...
299
+
300
+ ```
301
+ import type {OmitIndexSignature} from 'type-fest';
302
+
303
+ type OmitIndexSignature<ObjectType> = {
304
+ [KeyType in keyof ObjectType
305
+ // Is `{}` assignable to `Record<KeyType, unknown>`?
306
+ as {} extends Record<KeyType, unknown>
307
+ ? ... // ✅ `{}` is assignable to `Record<KeyType, unknown>`
308
+ : ... // ❌ `{}` is NOT assignable to `Record<KeyType, unknown>`
309
+ ]: ObjectType[KeyType];
310
+ };
311
+ ```
312
+
313
+ If `{}` is assignable, it means that `KeyType` is an index signature and we want to remove it. If it is not assignable, `KeyType` is a "real" key and we want to keep it.
314
+
315
+ @example
316
+ ```
317
+ import type {OmitIndexSignature} from 'type-fest';
318
+
319
+ interface Example {
320
+ // These index signatures will be removed.
321
+ [x: string]: any
322
+ [x: number]: any
323
+ [x: symbol]: any
324
+ [x: `head-${string}`]: string
325
+ [x: `${string}-tail`]: string
326
+ [x: `head-${string}-tail`]: string
327
+ [x: `${bigint}`]: string
328
+ [x: `embedded-${number}`]: string
329
+
330
+ // These explicitly defined keys will remain.
331
+ foo: 'bar';
332
+ qux?: 'baz';
333
+ }
334
+
335
+ type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
336
+ // => { foo: 'bar'; qux?: 'baz' | undefined; }
337
+ ```
338
+
339
+ @see PickIndexSignature
340
+ @category Object
341
+ */
342
+ type OmitIndexSignature<ObjectType> = {
343
+ [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown>
344
+ ? never
345
+ : KeyType]: ObjectType[KeyType];
346
+ };
347
+
348
+ /**
349
+ Pick only index signatures from the given object type, leaving out all explicitly defined properties.
350
+
351
+ This is the counterpart of `OmitIndexSignature`.
352
+
353
+ @example
354
+ ```
355
+ import type {PickIndexSignature} from 'type-fest';
356
+
357
+ declare const symbolKey: unique symbol;
358
+
359
+ type Example = {
360
+ // These index signatures will remain.
361
+ [x: string]: unknown;
362
+ [x: number]: unknown;
363
+ [x: symbol]: unknown;
364
+ [x: `head-${string}`]: string;
365
+ [x: `${string}-tail`]: string;
366
+ [x: `head-${string}-tail`]: string;
367
+ [x: `${bigint}`]: string;
368
+ [x: `embedded-${number}`]: string;
369
+
370
+ // These explicitly defined keys will be removed.
371
+ ['kebab-case-key']: string;
372
+ [symbolKey]: string;
373
+ foo: 'bar';
374
+ qux?: 'baz';
375
+ };
376
+
377
+ type ExampleIndexSignature = PickIndexSignature<Example>;
378
+ // {
379
+ // [x: string]: unknown;
380
+ // [x: number]: unknown;
381
+ // [x: symbol]: unknown;
382
+ // [x: `head-${string}`]: string;
383
+ // [x: `${string}-tail`]: string;
384
+ // [x: `head-${string}-tail`]: string;
385
+ // [x: `${bigint}`]: string;
386
+ // [x: `embedded-${number}`]: string;
387
+ // }
388
+ ```
389
+
390
+ @see OmitIndexSignature
391
+ @category Object
392
+ */
393
+ type PickIndexSignature<ObjectType> = {
394
+ [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown>
395
+ ? KeyType
396
+ : never]: ObjectType[KeyType];
397
+ };
398
+
399
+ // Merges two objects without worrying about index signatures.
400
+ type SimpleMerge<Destination, Source> = {
401
+ [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key];
402
+ } & Source;
403
+
404
+ /**
405
+ Merge two types into a new type. Keys of the second type overrides keys of the first type.
406
+
407
+ @example
408
+ ```
409
+ import type {Merge} from 'type-fest';
410
+
411
+ interface Foo {
412
+ [x: string]: unknown;
413
+ [x: number]: unknown;
414
+ foo: string;
415
+ bar: symbol;
416
+ }
417
+
418
+ type Bar = {
419
+ [x: number]: number;
420
+ [x: symbol]: unknown;
421
+ bar: Date;
422
+ baz: boolean;
423
+ };
424
+
425
+ export type FooBar = Merge<Foo, Bar>;
426
+ // => {
427
+ // [x: string]: unknown;
428
+ // [x: number]: number;
429
+ // [x: symbol]: unknown;
430
+ // foo: string;
431
+ // bar: Date;
432
+ // baz: boolean;
433
+ // }
434
+ ```
435
+
436
+ @category Object
437
+ */
438
+ type Merge<Destination, Source> =
439
+ Simplify<
440
+ SimpleMerge<PickIndexSignature<Destination>, PickIndexSignature<Source>>
441
+ & SimpleMerge<OmitIndexSignature<Destination>, OmitIndexSignature<Source>>
442
+ >;
443
+
444
+ /**
445
+ An if-else-like type that resolves depending on whether the given type is `any`.
446
+
447
+ @see {@link IsAny}
448
+
449
+ @example
450
+ ```
451
+ import type {IfAny} from 'type-fest';
452
+
453
+ type ShouldBeTrue = IfAny<any>;
454
+ //=> true
455
+
456
+ type ShouldBeBar = IfAny<'not any', 'foo', 'bar'>;
457
+ //=> 'bar'
458
+ ```
459
+
460
+ @category Type Guard
461
+ @category Utilities
462
+ */
463
+ type IfAny<T, TypeIfAny = true, TypeIfNotAny = false> = (
464
+ IsAny<T> extends true ? TypeIfAny : TypeIfNotAny
465
+ );
466
+
467
+ /**
468
+ Matches any primitive, `void`, `Date`, or `RegExp` value.
469
+ */
470
+ type BuiltIns = Primitive | void | Date | RegExp;
471
+
472
+ /**
473
+ Merges user specified options with default options.
474
+
475
+ @example
476
+ ```
477
+ type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
478
+ type DefaultPathsOptions = {maxRecursionDepth: 10; leavesOnly: false};
479
+ type SpecifiedOptions = {leavesOnly: true};
480
+
481
+ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
482
+ //=> {maxRecursionDepth: 10; leavesOnly: true}
483
+ ```
484
+
485
+ @example
486
+ ```
487
+ // Complains if default values are not provided for optional options
488
+
489
+ type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
490
+ type DefaultPathsOptions = {maxRecursionDepth: 10};
491
+ type SpecifiedOptions = {};
492
+
493
+ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
494
+ // ~~~~~~~~~~~~~~~~~~~
495
+ // Property 'leavesOnly' is missing in type 'DefaultPathsOptions' but required in type '{ maxRecursionDepth: number; leavesOnly: boolean; }'.
496
+ ```
497
+
498
+ @example
499
+ ```
500
+ // Complains if an option's default type does not conform to the expected type
501
+
502
+ type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
503
+ type DefaultPathsOptions = {maxRecursionDepth: 10; leavesOnly: 'no'};
504
+ type SpecifiedOptions = {};
505
+
506
+ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
507
+ // ~~~~~~~~~~~~~~~~~~~
508
+ // Types of property 'leavesOnly' are incompatible. Type 'string' is not assignable to type 'boolean'.
509
+ ```
510
+
511
+ @example
512
+ ```
513
+ // Complains if an option's specified type does not conform to the expected type
514
+
515
+ type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
516
+ type DefaultPathsOptions = {maxRecursionDepth: 10; leavesOnly: false};
517
+ type SpecifiedOptions = {leavesOnly: 'yes'};
518
+
519
+ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
520
+ // ~~~~~~~~~~~~~~~~
521
+ // Types of property 'leavesOnly' are incompatible. Type 'string' is not assignable to type 'boolean'.
522
+ ```
523
+ */
524
+ type ApplyDefaultOptions<
525
+ Options extends object,
526
+ Defaults extends Simplify<Omit<Required<Options>, RequiredKeysOf<Options>> & Partial<Record<RequiredKeysOf<Options>, never>>>,
527
+ SpecifiedOptions extends Options,
528
+ > =
529
+ IfAny<SpecifiedOptions, Defaults,
530
+ IfNever<SpecifiedOptions, Defaults,
531
+ Simplify<Merge<Defaults, {
532
+ [Key in keyof SpecifiedOptions
533
+ as Key extends OptionalKeysOf<Options>
534
+ ? Extract<SpecifiedOptions[Key], undefined> extends never
535
+ ? Key
536
+ : never
537
+ : Key
538
+ ]: SpecifiedOptions[Key]
539
+ }> & Required<Options>> // `& Required<Options>` ensures that `ApplyDefaultOptions<SomeOption, ...>` is always assignable to `Required<SomeOption>`
540
+ >>;
541
+
542
+ /**
543
+ @see {@link PartialDeep}
544
+ */
545
+ type PartialDeepOptions = {
546
+ /**
547
+ Whether to affect the individual elements of arrays and tuples.
548
+
549
+ @default false
550
+ */
551
+ readonly recurseIntoArrays?: boolean;
552
+
553
+ /**
554
+ Allows `undefined` values in non-tuple arrays.
555
+
556
+ - When set to `true`, elements of non-tuple arrays can be `undefined`.
557
+ - When set to `false`, only explicitly defined elements are allowed in non-tuple arrays, ensuring stricter type checking.
558
+
559
+ @default true
560
+
561
+ @example
562
+ You can prevent `undefined` values in non-tuple arrays by passing `{recurseIntoArrays: true; allowUndefinedInNonTupleArrays: false}` as the second type argument:
563
+
564
+ ```
565
+ import type {PartialDeep} from 'type-fest';
566
+
567
+ type Settings = {
568
+ languages: string[];
569
+ };
570
+
571
+ declare const partialSettings: PartialDeep<Settings, {recurseIntoArrays: true; allowUndefinedInNonTupleArrays: false}>;
572
+
573
+ partialSettings.languages = [undefined]; // Error
574
+ partialSettings.languages = []; // Ok
575
+ ```
576
+ */
577
+ readonly allowUndefinedInNonTupleArrays?: boolean;
578
+ };
579
+
580
+ type DefaultPartialDeepOptions = {
581
+ recurseIntoArrays: false;
582
+ allowUndefinedInNonTupleArrays: true;
583
+ };
584
+
585
+ /**
586
+ Create a type from another type with all keys and nested keys set to optional.
587
+
588
+ Use-cases:
589
+ - Merging a default settings/config object with another object, the second object would be a deep partial of the default object.
590
+ - Mocking and testing complex entities, where populating an entire object with its keys would be redundant in terms of the mock or test.
591
+
592
+ @example
593
+ ```
594
+ import type {PartialDeep} from 'type-fest';
595
+
596
+ const settings: Settings = {
597
+ textEditor: {
598
+ fontSize: 14,
599
+ fontColor: '#000000',
600
+ fontWeight: 400
601
+ },
602
+ autocomplete: false,
603
+ autosave: true
604
+ };
605
+
606
+ const applySavedSettings = (savedSettings: PartialDeep<Settings>) => {
607
+ return {...settings, ...savedSettings};
608
+ }
609
+
610
+ settings = applySavedSettings({textEditor: {fontWeight: 500}});
611
+ ```
612
+
613
+ By default, this does not affect elements in array and tuple types. You can change this by passing `{recurseIntoArrays: true}` as the second type argument:
614
+
615
+ ```
616
+ import type {PartialDeep} from 'type-fest';
617
+
618
+ type Settings = {
619
+ languages: string[];
620
+ }
621
+
622
+ const partialSettings: PartialDeep<Settings, {recurseIntoArrays: true}> = {
623
+ languages: [undefined]
624
+ };
625
+ ```
626
+
627
+ @see {@link PartialDeepOptions}
628
+
629
+ @category Object
630
+ @category Array
631
+ @category Set
632
+ @category Map
633
+ */
634
+ type PartialDeep<T, Options extends PartialDeepOptions = {}> =
635
+ _PartialDeep<T, ApplyDefaultOptions<PartialDeepOptions, DefaultPartialDeepOptions, Options>>;
636
+
637
+ type _PartialDeep<T, Options extends Required<PartialDeepOptions>> = T extends BuiltIns | ((new (...arguments_: any[]) => unknown))
638
+ ? T
639
+ : IsNever<keyof T> extends true // For functions with no properties
640
+ ? T
641
+ : T extends Map<infer KeyType, infer ValueType>
642
+ ? PartialMapDeep<KeyType, ValueType, Options>
643
+ : T extends Set<infer ItemType>
644
+ ? PartialSetDeep<ItemType, Options>
645
+ : T extends ReadonlyMap<infer KeyType, infer ValueType>
646
+ ? PartialReadonlyMapDeep<KeyType, ValueType, Options>
647
+ : T extends ReadonlySet<infer ItemType>
648
+ ? PartialReadonlySetDeep<ItemType, Options>
649
+ : T extends object
650
+ ? T extends ReadonlyArray<infer ItemType> // Test for arrays/tuples, per https://github.com/microsoft/TypeScript/issues/35156
651
+ ? Options['recurseIntoArrays'] extends true
652
+ ? ItemType[] extends T // Test for arrays (non-tuples) specifically
653
+ ? readonly ItemType[] extends T // Differentiate readonly and mutable arrays
654
+ ? ReadonlyArray<_PartialDeep<Options['allowUndefinedInNonTupleArrays'] extends false ? ItemType : ItemType | undefined, Options>>
655
+ : Array<_PartialDeep<Options['allowUndefinedInNonTupleArrays'] extends false ? ItemType : ItemType | undefined, Options>>
656
+ : PartialObjectDeep<T, Options> // Tuples behave properly
657
+ : T // If they don't opt into array testing, just use the original type
658
+ : PartialObjectDeep<T, Options>
659
+ : unknown;
660
+
661
+ /**
662
+ Same as `PartialDeep`, but accepts only `Map`s and as inputs. Internal helper for `PartialDeep`.
663
+ */
664
+ type PartialMapDeep<KeyType, ValueType, Options extends Required<PartialDeepOptions>> = {} & Map<_PartialDeep<KeyType, Options>, _PartialDeep<ValueType, Options>>;
665
+
666
+ /**
667
+ Same as `PartialDeep`, but accepts only `Set`s as inputs. Internal helper for `PartialDeep`.
668
+ */
669
+ type PartialSetDeep<T, Options extends Required<PartialDeepOptions>> = {} & Set<_PartialDeep<T, Options>>;
670
+
671
+ /**
672
+ Same as `PartialDeep`, but accepts only `ReadonlyMap`s as inputs. Internal helper for `PartialDeep`.
673
+ */
674
+ type PartialReadonlyMapDeep<KeyType, ValueType, Options extends Required<PartialDeepOptions>> = {} & ReadonlyMap<_PartialDeep<KeyType, Options>, _PartialDeep<ValueType, Options>>;
675
+
676
+ /**
677
+ Same as `PartialDeep`, but accepts only `ReadonlySet`s as inputs. Internal helper for `PartialDeep`.
678
+ */
679
+ type PartialReadonlySetDeep<T, Options extends Required<PartialDeepOptions>> = {} & ReadonlySet<_PartialDeep<T, Options>>;
680
+
681
+ /**
682
+ Same as `PartialDeep`, but accepts only `object`s as inputs. Internal helper for `PartialDeep`.
683
+ */
684
+ type PartialObjectDeep<ObjectType extends object, Options extends Required<PartialDeepOptions>> =
685
+ (ObjectType extends (...arguments_: any) => unknown
686
+ ? (...arguments_: Parameters<ObjectType>) => ReturnType<ObjectType>
687
+ : {}) & ({
688
+ [KeyType in keyof ObjectType]?: _PartialDeep<ObjectType[KeyType], Options>
689
+ });
690
+
691
+ declare type FallbackProps = {
692
+ error: unknown;
693
+ resetErrorBoundary: (...args: unknown[]) => void;
694
+ };
695
+
696
+ type AuthToken = string | undefined;
697
+ interface Auth {
698
+ /**
699
+ * Which part of the request do we use to send the auth?
700
+ *
701
+ * @default 'header'
702
+ */
703
+ in?: 'header' | 'query' | 'cookie';
704
+ /**
705
+ * A unique identifier for the security scheme.
706
+ *
707
+ * Defined only when there are multiple security schemes whose `Auth`
708
+ * shape would otherwise be identical.
709
+ */
710
+ key?: string;
711
+ /**
712
+ * Header or query parameter name.
713
+ *
714
+ * @default 'Authorization'
715
+ */
716
+ name?: string;
717
+ scheme?: 'basic' | 'bearer';
718
+ type: 'apiKey' | 'http';
719
+ }
720
+
721
+ interface SerializerOptions<T> {
722
+ /**
723
+ * @default true
724
+ */
725
+ explode: boolean;
726
+ style: T;
727
+ }
728
+ type ArrayStyle = 'form' | 'spaceDelimited' | 'pipeDelimited';
729
+ type ObjectStyle = 'form' | 'deepObject';
730
+
731
+ type QuerySerializer = (query: Record<string, unknown>) => string;
732
+ type BodySerializer = (body: unknown) => unknown;
733
+ type QuerySerializerOptionsObject = {
734
+ allowReserved?: boolean;
735
+ array?: Partial<SerializerOptions<ArrayStyle>>;
736
+ object?: Partial<SerializerOptions<ObjectStyle>>;
737
+ };
738
+ type QuerySerializerOptions = QuerySerializerOptionsObject & {
739
+ /**
740
+ * Per-parameter serialization overrides. When provided, these settings
741
+ * override the global array/object settings for specific parameter names.
742
+ */
743
+ parameters?: Record<string, QuerySerializerOptionsObject>;
744
+ };
745
+
746
+ type HttpMethod = 'connect' | 'delete' | 'get' | 'head' | 'options' | 'patch' | 'post' | 'put' | 'trace';
747
+ type Client$1<RequestFn = never, Config = unknown, MethodFn = never, BuildUrlFn = never, SseFn = never> = {
748
+ /**
749
+ * Returns the final request URL.
750
+ */
751
+ buildUrl: BuildUrlFn;
752
+ getConfig: () => Config;
753
+ request: RequestFn;
754
+ setConfig: (config: Config) => Config;
755
+ } & {
756
+ [K in HttpMethod]: MethodFn;
757
+ } & ([SseFn] extends [never] ? {
758
+ sse?: never;
759
+ } : {
760
+ sse: {
761
+ [K in HttpMethod]: SseFn;
762
+ };
763
+ });
764
+ interface Config$1 {
765
+ /**
766
+ * Auth token or a function returning auth token. The resolved value will be
767
+ * added to the request payload as defined by its `security` array.
768
+ */
769
+ auth?: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken;
770
+ /**
771
+ * A function for serializing request body parameter. By default,
772
+ * {@link JSON.stringify()} will be used.
773
+ */
774
+ bodySerializer?: BodySerializer | null;
775
+ /**
776
+ * An object containing any HTTP headers that you want to pre-populate your
777
+ * `Headers` object with.
778
+ *
779
+ * {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more}
780
+ */
781
+ headers?: RequestInit['headers'] | Record<string, string | number | boolean | (string | number | boolean)[] | null | undefined | unknown>;
782
+ /**
783
+ * The request method.
784
+ *
785
+ * {@link https://developer.mozilla.org/docs/Web/API/fetch#method See more}
786
+ */
787
+ method?: Uppercase<HttpMethod>;
788
+ /**
789
+ * A function for serializing request query parameters. By default, arrays
790
+ * will be exploded in form style, objects will be exploded in deepObject
791
+ * style, and reserved characters are percent-encoded.
792
+ *
793
+ * This method will have no effect if the native `paramsSerializer()` Axios
794
+ * API function is used.
795
+ *
796
+ * {@link https://swagger.io/docs/specification/serialization/#query View examples}
797
+ */
798
+ querySerializer?: QuerySerializer | QuerySerializerOptions;
799
+ /**
800
+ * A function validating request data. This is useful if you want to ensure
801
+ * the request conforms to the desired shape, so it can be safely sent to
802
+ * the server.
803
+ */
804
+ requestValidator?: (data: unknown) => Promise<unknown>;
805
+ /**
806
+ * A function transforming response data before it's returned. This is useful
807
+ * for post-processing data, e.g., converting ISO strings into Date objects.
808
+ */
809
+ responseTransformer?: (data: unknown) => Promise<unknown>;
810
+ /**
811
+ * A function validating response data. This is useful if you want to ensure
812
+ * the response conforms to the desired shape, so it can be safely passed to
813
+ * the transformers and returned to the user.
814
+ */
815
+ responseValidator?: (data: unknown) => Promise<unknown>;
816
+ }
817
+
818
+ type ServerSentEventsOptions<TData = unknown> = Omit<RequestInit, 'method'> & Pick<Config$1, 'method' | 'responseTransformer' | 'responseValidator'> & {
819
+ /**
820
+ * Fetch API implementation. You can use this option to provide a custom
821
+ * fetch instance.
822
+ *
823
+ * @default globalThis.fetch
824
+ */
825
+ fetch?: typeof fetch;
826
+ /**
827
+ * Implementing clients can call request interceptors inside this hook.
828
+ */
829
+ onRequest?: (url: string, init: RequestInit) => Promise<Request>;
830
+ /**
831
+ * Callback invoked when a network or parsing error occurs during streaming.
832
+ *
833
+ * This option applies only if the endpoint returns a stream of events.
834
+ *
835
+ * @param error The error that occurred.
836
+ */
837
+ onSseError?: (error: unknown) => void;
838
+ /**
839
+ * Callback invoked when an event is streamed from the server.
840
+ *
841
+ * This option applies only if the endpoint returns a stream of events.
842
+ *
843
+ * @param event Event streamed from the server.
844
+ * @returns Nothing (void).
845
+ */
846
+ onSseEvent?: (event: StreamEvent<TData>) => void;
847
+ serializedBody?: RequestInit['body'];
848
+ /**
849
+ * Default retry delay in milliseconds.
850
+ *
851
+ * This option applies only if the endpoint returns a stream of events.
852
+ *
853
+ * @default 3000
854
+ */
855
+ sseDefaultRetryDelay?: number;
856
+ /**
857
+ * Maximum number of retry attempts before giving up.
858
+ */
859
+ sseMaxRetryAttempts?: number;
860
+ /**
861
+ * Maximum retry delay in milliseconds.
862
+ *
863
+ * Applies only when exponential backoff is used.
864
+ *
865
+ * This option applies only if the endpoint returns a stream of events.
866
+ *
867
+ * @default 30000
868
+ */
869
+ sseMaxRetryDelay?: number;
870
+ /**
871
+ * Optional sleep function for retry backoff.
872
+ *
873
+ * Defaults to using `setTimeout`.
874
+ */
875
+ sseSleepFn?: (ms: number) => Promise<void>;
876
+ url: string;
877
+ };
878
+ interface StreamEvent<TData = unknown> {
879
+ data: TData;
880
+ event?: string;
881
+ id?: string;
882
+ retry?: number;
883
+ }
884
+ type ServerSentEventsResult<TData = unknown, TReturn = void, TNext = unknown> = {
885
+ stream: AsyncGenerator<TData extends Record<string, unknown> ? TData[keyof TData] : TData, TReturn, TNext>;
886
+ };
887
+
888
+ type ErrInterceptor<Err, Res, Req, Options> = (error: Err,
889
+ /** response may be undefined due to a network error where no response object is produced */
890
+ response: Res | undefined,
891
+ /** request may be undefined, because error may be from building the request object itself */
892
+ request: Req | undefined, options: Options) => Err | Promise<Err>;
893
+ type ReqInterceptor<Req, Options> = (request: Req, options: Options) => Req | Promise<Req>;
894
+ type ResInterceptor<Res, Req, Options> = (response: Res, request: Req, options: Options) => Res | Promise<Res>;
895
+ declare class Interceptors<Interceptor> {
896
+ fns: Array<Interceptor | null>;
897
+ clear(): void;
898
+ eject(id: number | Interceptor): void;
899
+ exists(id: number | Interceptor): boolean;
900
+ getInterceptorIndex(id: number | Interceptor): number;
901
+ update(id: number | Interceptor, fn: Interceptor): number | Interceptor | false;
902
+ use(fn: Interceptor): number;
903
+ }
904
+ interface Middleware<Req, Res, Err, Options> {
905
+ error: Interceptors<ErrInterceptor<Err, Res, Req, Options>>;
906
+ request: Interceptors<ReqInterceptor<Req, Options>>;
907
+ response: Interceptors<ResInterceptor<Res, Req, Options>>;
908
+ }
909
+
910
+ type ResponseStyle = 'data' | 'fields';
911
+ interface Config<T extends ClientOptions$1 = ClientOptions$1> extends Omit<RequestInit, 'body' | 'headers' | 'method'>, Config$1 {
912
+ /**
913
+ * Base URL for all requests made by this client.
914
+ */
915
+ baseUrl?: T['baseUrl'];
916
+ /**
917
+ * Fetch API implementation. You can use this option to provide a custom
918
+ * fetch instance.
919
+ *
920
+ * @default globalThis.fetch
921
+ */
922
+ fetch?: typeof fetch;
923
+ /**
924
+ * Please don't use the Fetch client for Next.js applications. The `next`
925
+ * options won't have any effect.
926
+ *
927
+ * Install {@link https://www.npmjs.com/package/@hey-api/client-next `@hey-api/client-next`} instead.
928
+ */
929
+ next?: never;
930
+ /**
931
+ * Return the response data parsed in a specified format. By default, `auto`
932
+ * will infer the appropriate method from the `Content-Type` response header.
933
+ * You can override this behavior with any of the {@link Body} methods.
934
+ * Select `stream` if you don't want to parse response data at all.
935
+ *
936
+ * @default 'auto'
937
+ */
938
+ parseAs?: 'arrayBuffer' | 'auto' | 'blob' | 'formData' | 'json' | 'stream' | 'text';
939
+ /**
940
+ * Should we return only data or multiple fields (data, error, response, etc.)?
941
+ *
942
+ * @default 'fields'
943
+ */
944
+ responseStyle?: ResponseStyle;
945
+ /**
946
+ * Throw an error instead of returning it in the response?
947
+ *
948
+ * @default false
949
+ */
950
+ throwOnError?: T['throwOnError'];
951
+ }
952
+ interface RequestOptions<TData = unknown, TResponseStyle extends ResponseStyle = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string> extends Config<{
953
+ responseStyle: TResponseStyle;
954
+ throwOnError: ThrowOnError;
955
+ }>, Pick<ServerSentEventsOptions<TData>, 'onRequest' | 'onSseError' | 'onSseEvent' | 'sseDefaultRetryDelay' | 'sseMaxRetryAttempts' | 'sseMaxRetryDelay'> {
956
+ /**
957
+ * Any body that you want to add to your request.
958
+ *
959
+ * {@link https://developer.mozilla.org/docs/Web/API/fetch#body}
960
+ */
961
+ body?: unknown;
962
+ path?: Record<string, unknown>;
963
+ query?: Record<string, unknown>;
964
+ /**
965
+ * Security mechanism(s) to use for the request.
966
+ */
967
+ security?: ReadonlyArray<Auth>;
968
+ url: Url;
969
+ }
970
+ interface ResolvedRequestOptions<TResponseStyle extends ResponseStyle = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string> extends RequestOptions<unknown, TResponseStyle, ThrowOnError, Url> {
971
+ headers: Headers;
972
+ serializedBody?: string;
973
+ }
974
+ 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 : {
975
+ data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
976
+ request: Request;
977
+ response: Response;
978
+ }> : Promise<TResponseStyle extends 'data' ? (TData extends Record<string, unknown> ? TData[keyof TData] : TData) | undefined : ({
979
+ data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
980
+ error: undefined;
981
+ } | {
982
+ data: undefined;
983
+ error: TError extends Record<string, unknown> ? TError[keyof TError] : TError;
984
+ }) & {
985
+ /** request may be undefined, because error may be from building the request object itself */
986
+ request?: Request;
987
+ /** response may be undefined, because error may be from building the request object itself or from a network error */
988
+ response?: Response;
989
+ }>;
990
+ interface ClientOptions$1 {
991
+ baseUrl?: string;
992
+ responseStyle?: ResponseStyle;
993
+ throwOnError?: boolean;
994
+ }
995
+ 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>;
996
+ type SseFn = <TData = unknown, _TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<never, TResponseStyle, ThrowOnError>, 'method'>) => Promise<ServerSentEventsResult<TData>>;
997
+ 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>;
998
+ type BuildUrlFn = <TData extends {
999
+ body?: unknown;
1000
+ path?: Record<string, unknown>;
1001
+ query?: Record<string, unknown>;
1002
+ url: string;
1003
+ }>(options: TData & Options<TData>) => string;
1004
+ type Client = Client$1<RequestFn, Config, MethodFn, BuildUrlFn, SseFn> & {
1005
+ interceptors: Middleware<Request, Response, unknown, ResolvedRequestOptions>;
1006
+ };
1007
+ interface TDataShape {
1008
+ body?: unknown;
1009
+ headers?: unknown;
1010
+ path?: unknown;
1011
+ query?: unknown;
1012
+ url: string;
1013
+ }
1014
+ type OmitKeys<T, K> = Pick<T, Exclude<keyof T, K>>;
1015
+ 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'>);
1016
+
1017
+ type ClientOptions = {
1018
+ 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 & {});
1019
+ };
1020
+
1021
+ type EmbeddedClient = Client;
1022
+ type ExtractLiterals<T> = T extends string ? string extends T ? never : T : never;
1023
+ type BaseUrl = ExtractLiterals<ClientOptions['baseUrl']>;
1024
+
1025
+ interface LabelLabels {
1026
+ /**
1027
+ * How the field name and its requirement fragment compose. `{label}` is the
1028
+ * name, `{marker}` the asterisk or the note — reorder them freely, and note
1029
+ * that the space between them is part of this string.
1030
+ */
1031
+ composition: string;
1032
+ /** In the label's own colour, deliberately not `destructive`. */
1033
+ requiredMarker: string;
1034
+ /**
1035
+ * Screen-reader-only stand-in for the marker, for a control whose role does
1036
+ * not take `aria-required` — a popover trigger is a `button`, which does
1037
+ * not. Render it hidden and name it from the control's `aria-labelledby`.
1038
+ */
1039
+ requiredAccessibleText: string;
1040
+ optionalNote: string;
1041
+ /** "This has no meaning here", as against `optionalNote`'s "may be blank". */
1042
+ notApplicableNote: string;
1043
+ }
1044
+
1045
+ interface RequiredFieldsLegendLabels {
1046
+ /**
1047
+ * One string, so a translator can move the marker into whatever clause the
1048
+ * language wants. `{marker}` is substituted with `marker`, rendered
1049
+ * semi-bold; keep the placeholder when overriding.
1050
+ */
1051
+ instruction: string;
1052
+ marker: string;
1053
+ }
1054
+
1055
+ type LinkComponentProps = AnchorHTMLAttributes<HTMLAnchorElement> & {
1056
+ children?: ReactNode;
1057
+ };
1058
+ type LinkComponent = ComponentType<LinkComponentProps>;
1059
+ /**
1060
+ * The UI frameworks a widget's UI layer can render with.
1061
+ *
1062
+ * - `shadcn` — the shadcn/Tailwind implementation. This is the default and the
1063
+ * implicit fallback, so existing consumers that select nothing keep rendering
1064
+ * shadcn.
1065
+ * - `tecton` — the Tecton implementation.
1066
+ *
1067
+ * Declared as an `as const` object (not a TypeScript `enum`) per repo
1068
+ * convention.
1069
+ */
1070
+ declare const UIFramework: {
1071
+ readonly Shadcn: "shadcn";
1072
+ readonly Tecton: "tecton";
1073
+ };
1074
+ type UIFramework = (typeof UIFramework)[keyof typeof UIFramework];
1075
+
1076
+ /**
1077
+ * The settable fields of the widget config cascade.
1078
+ *
1079
+ * This is the type accepted by {@link setGlobalWidgetConfig} and all provider props.
1080
+ * It intentionally excludes `initResponse`, which is populated automatically by the
1081
+ * provider after a successful fetch and must never be set manually.
1082
+ *
1083
+ * The `null` vs `undefined` distinction on `widgetToken` and `organizationId` is intentional:
1084
+ * - `undefined` — not set at this level; inherit from the nearest ancestor or global store.
1085
+ * - `null` — explicitly cleared; downstream sees "no value" even if an ancestor had one
1086
+ * (e.g. after logout or deliberate de-scoping).
1087
+ *
1088
+ * @see {@link WidgetConfig} for the resolved output type (includes `initResponse`)
1089
+ * @see {@link RootWidgetProvider}
1090
+ * @see {@link WidgetProvider}
1091
+ * @see {@link setGlobalWidgetConfig}
1092
+ */
1093
+ interface WidgetConfigInput {
1094
+ /**
1095
+ * Base URL of the Tesouro embedded API (e.g. `"https://api.tesouro.com"`).
1096
+ *
1097
+ * When omitted the nearest ancestor's `baseUrl` or the global store value is used.
1098
+ * Changing this recreates the underlying HTTP client so all subsequent requests
1099
+ * go to the new host.
1100
+ */
1101
+ baseUrl?: BaseUrl;
1102
+ /**
1103
+ * Bearer token used to authenticate widget requests.
1104
+ *
1105
+ * Injected as `Authorization: Bearer <token>` on every outgoing request via an
1106
+ * interceptor on the scoped HTTP client. Token updates are picked up immediately
1107
+ * without recreating the client.
1108
+ *
1109
+ * - `string` — send this token on all requests from this level downward.
1110
+ * - `null` — explicitly cleared; no auth header is sent and fetching is suppressed.
1111
+ * - `undefined` — not set at this level; inherit from the nearest ancestor or global store.
1112
+ */
1113
+ widgetToken?: string | null;
1114
+ /**
1115
+ * Organization ID forwarded as the `x-organization-id` request header.
1116
+ *
1117
+ * Passed through {@link EmbedApiProvider} context rather than the auth interceptor,
1118
+ * so individual data-access hooks can opt in per-request.
1119
+ *
1120
+ * - `string` — use this organization for downstream data requests.
1121
+ * - `null` — explicitly cleared; queries that require an org ID will be disabled.
1122
+ * - `undefined` — not set at this level; inherit from the nearest ancestor or global store.
1123
+ *
1124
+ * When `undefined` across the **whole** cascade (no prop, no ancestor, no global
1125
+ * value), the resolved org defaults to the loaded `initResponse.organizationId`
1126
+ * (see {@link WidgetConfig.initResponse}) once the widget-init fetch settles. This
1127
+ * is the lowest-priority fallback — any explicit `string` or `null` at any cascade
1128
+ * level wins, and an explicit `null` is preserved and never falls back.
1129
+ *
1130
+ * Only an **explicit** ancestor org is inherited. An ancestor's *init-derived*
1131
+ * default does not propagate into a descendant that owns its own fetch (its own
1132
+ * `baseUrl`/`widgetToken`); such a descendant defaults to its own
1133
+ * `initResponse.organizationId` instead, so it never sends an ancestor's org with
1134
+ * its own token.
1135
+ */
1136
+ organizationId?: string | null;
1137
+ /**
1138
+ * Optional post-creation hook for the scoped HTTP client.
1139
+ *
1140
+ * Called once after the provider creates its scoped {@link EmbeddedClient} and
1141
+ * applies the built-in `Authorization: Bearer` interceptor. Receives the
1142
+ * fully-configured client and must return the client to be used for the lifetime of
1143
+ * this provider level — either the same instance (with additional interceptors
1144
+ * attached) or a new client entirely.
1145
+ *
1146
+ * **Order:** The built-in auth interceptor is always applied first. `configClient`
1147
+ * is called on top of it, so any interceptors you add here run after auth is set.
1148
+ *
1149
+ * **Any prop triggers a scoped client.** A {@link WidgetProvider} creates its own
1150
+ * scoped client whenever any prop is set — including `configClient` alone, without
1151
+ * `baseUrl` or `widgetToken`. Only a fully props-free pass-through provider skips
1152
+ * client creation and never calls this function.
1153
+ *
1154
+ * **Stability:** The function reference is included in the client creation memo's
1155
+ * dependency array. Passing an unstable (inline) function recreates the client on
1156
+ * every render. Stabilize with `useCallback` or define the function outside the
1157
+ * component.
1158
+ *
1159
+ * **Cascade:** Inherits from the nearest ancestor when `undefined`. A child
1160
+ * {@link WidgetProvider} that creates its own scoped client will use the resolved
1161
+ * `configClient` from the cascade unless it provides its own override.
1162
+ *
1163
+ * @example
1164
+ * ```tsx
1165
+ * const addLogging = useCallback(
1166
+ * (client: EmbeddedClient) => {
1167
+ * client.interceptors.request.use((req) => {
1168
+ * console.log('[widget]', req.method, req.url);
1169
+ * return req;
1170
+ * });
1171
+ * return client;
1172
+ * },
1173
+ * [],
1174
+ * );
1175
+ *
1176
+ * <RootWidgetProvider
1177
+ * baseUrl="https://api.tesouro.com"
1178
+ * widgetToken={token}
1179
+ * configClient={addLogging}
1180
+ * >
1181
+ * <App />
1182
+ * </RootWidgetProvider>
1183
+ * ```
1184
+ */
1185
+ configClient?: (client: EmbeddedClient) => EmbeddedClient;
1186
+ /**
1187
+ * Overrides the widget-gateway routing decision for the scoped HTTP client.
1188
+ *
1189
+ * Any caller reaching the Tesouro API with a widget token must route data
1190
+ * requests through the widget gateway: prefix the path with
1191
+ * `/api/widget-gateway/proxy` and carry the token as `X-Widget-Token`. The
1192
+ * provider applies both automatically per request when the request origin is
1193
+ * a known Tesouro API host (`WIDGET_GATEWAY_HOSTS`, derived from the
1194
+ * generated `ClientOptions['baseUrl']`); `/api/widget-gateway/*` paths (the
1195
+ * init round-trip) always pass through untouched.
1196
+ *
1197
+ * - `undefined` — decide from the request origin, as above. Inherits from
1198
+ * the nearest ancestor or global store like every other config field.
1199
+ * - `true` — always apply the rewrite, even for an unlisted base URL (e.g. a
1200
+ * custom domain in front of the gateway).
1201
+ * - `false` — never apply it. For hosts that route widget requests their own
1202
+ * way, such as a same-origin BFF whose `configClient` retargets every
1203
+ * request.
1204
+ *
1205
+ * Independent of {@link configClient}: a host that only adds a header keeps
1206
+ * the built-in routing, and the built-in interceptor runs before any
1207
+ * `configClient` interceptor.
1208
+ */
1209
+ gatewayRouting?: boolean;
1210
+ /**
1211
+ * Component the embedded widgets should render in place of plain `<a>` tags.
1212
+ *
1213
+ * Pass e.g. Next.js's `Link` to make in-app navigation use the host router.
1214
+ * Cascades like other config: provider prop > nearest ancestor > global store.
1215
+ * When no value is set anywhere, widgets fall back to a plain `<a>` element.
1216
+ */
1217
+ linkComponent?: LinkComponent;
1218
+ /**
1219
+ * Which UI framework the widget UI layer should render with.
1220
+ *
1221
+ * Lets a consuming context bind widgets to either the shadcn/Tailwind or the
1222
+ * Tecton implementation behind the same outward-facing API. The selection is
1223
+ * a presentation concern only — it cascades through the provider tree exactly
1224
+ * like {@link linkComponent} and is read by UI libraries via `useUIFramework`;
1225
+ * it never appears in any widget's feature-library or component props.
1226
+ *
1227
+ * - `'shadcn'` — the shadcn/Tailwind implementation.
1228
+ * - `'tecton'` — the Tecton implementation.
1229
+ * - `null` / `undefined` — not set at this level; inherit from the nearest
1230
+ * ancestor or global store, falling back to `shadcn` when unset everywhere.
1231
+ * `shadcn` is the implicit default, so existing consumers need no changes.
1232
+ */
1233
+ uiFramework?: UIFramework | null;
1234
+ }
1235
+ /**
1236
+ * Props shared by every analytics-owner-capable widget provider.
1237
+ *
1238
+ * Combines the full settable cascade ({@link WidgetConfigInput}) with the
1239
+ * analytics opt-out honored by analytics owners. Both {@link RootWidgetProvider}
1240
+ * and {@link WidgetProvider} build their public props on top of this; the latter
1241
+ * adds error-boundary props of its own.
1242
+ *
1243
+ * @see {@link WidgetConfigInput} for per-field cascade and `null` vs omitted semantics
1244
+ */
1245
+ interface WidgetProviderBaseProps extends WidgetConfigInput {
1246
+ /**
1247
+ * Opt out of all analytics capture and prevent PostHog from loading. Default `true`.
1248
+ *
1249
+ * Honored only by an analytics **owner** — a {@link RootWidgetProvider} or a
1250
+ * standalone {@link WidgetProvider} with no parent provider. When `false`,
1251
+ * owner-bound `track` calls in this subtree become no-ops and the PostHog
1252
+ * installer is never dynamically imported for this owner's environment.
1253
+ * Setting it on a nested {@link WidgetProvider} is ignored in v1 (a one-time
1254
+ * `console.warn` is emitted to make the no-op discoverable).
1255
+ */
1256
+ analytics?: boolean;
1257
+ }
1258
+
1259
+ /**
1260
+ * Copy for the states `WidgetProvider` renders *itself*, in place of the widget:
1261
+ * the error-boundary fallback and the disclosures gate. A host overrides any
1262
+ * subset through the `providerLabels` prop, which cascades like
1263
+ * `disclosuresAcceptance`.
1264
+ *
1265
+ * Not named `Labels` on the public surface: a widget's own `labels` prop is a
1266
+ * different thing, and these two travel together on every widget's props type.
1267
+ */
1268
+ interface WidgetProviderLabels {
1269
+ /** Default copy for the built-in error boundary fallback. */
1270
+ errorBoundaryFallback: string;
1271
+ /** Heading when init reports disclosures are required and not yet accepted. */
1272
+ disclosuresRequiredTitle: string;
1273
+ /** Heading while a token-only refresh leaves init stale for the live token. */
1274
+ disclosuresRefreshingTitle: string;
1275
+ /** Supporting copy while the accept action is withheld for a stale init. */
1276
+ disclosuresRefreshingDescription: string;
1277
+ }
1278
+
1279
+ /**
1280
+ * Props for {@link WidgetProvider}.
1281
+ *
1282
+ * All fields are optional. When **all** are omitted the provider is a transparent
1283
+ * pass-through: no fetch is issued and all resolved values cascade unchanged from
1284
+ * the nearest ancestor.
1285
+ */
1286
+ interface WidgetProviderProps extends WidgetProviderBaseProps {
1287
+ /**
1288
+ * Fallback rendered when a render-time exception is caught inside this
1289
+ * provider's subtree. Pass either a `ReactNode` (rendered directly) or a
1290
+ * render-prop receiving `{ error, resetErrorBoundary }` from
1291
+ * `react-error-boundary`. Default is a plain `role="alert"` div whose copy
1292
+ * comes from `providerLabels.errorBoundaryFallback`.
1293
+ */
1294
+ errorFallback?: ReactNode | ((props: FallbackProps) => ReactNode);
1295
+ /**
1296
+ * Called once when the boundary catches an error, before the fallback
1297
+ * renders. Use for telemetry / error tracking / partner logging. Exceptions
1298
+ * thrown from `onError` propagate per `react-error-boundary` semantics.
1299
+ */
1300
+ onError?: (error: unknown, info: ErrorInfo) => void;
1301
+ /**
1302
+ * Accept surface shown when the caller owes disclosures — an INVITED
1303
+ * teammate (including `NOT_REQUIRED` orgs, who still need Accept to
1304
+ * activate) or an ACTIVE user who owes a new version. Pass
1305
+ * `<AcceptDisclosuresWidget />`. Cascades like `linkComponent`.
1306
+ * WidgetProvider cannot import the widget itself (cycle).
1307
+ */
1308
+ disclosuresAcceptance?: ReactNode;
1309
+ /**
1310
+ * Overrides for the copy this provider renders in place of the widget: the
1311
+ * built-in error-boundary fallback and the disclosures gate. Any subset;
1312
+ * unlisted keys keep their defaults. Cascades like `linkComponent`.
1313
+ *
1314
+ * Named `providerLabels` rather than `labels` because a widget's own
1315
+ * `labels` prop sits alongside this one on the same props type.
1316
+ */
1317
+ providerLabels?: Partial<WidgetProviderLabels>;
1318
+ }
1319
+
1320
+ interface AddressFieldGroupLabels {
1321
+ line1: string;
1322
+ line2: string;
1323
+ city: string;
1324
+ state: string;
1325
+ statePlaceholder: string;
1326
+ postalCode: string;
1327
+ country: string;
1328
+ /** Fixed country display value (US-only locale in v1). */
1329
+ countryValue: string;
1330
+ /** The asterisk and "(optional)" copy this group's labels carry. */
1331
+ fieldMarkers: LabelLabels;
1332
+ }
1333
+ interface AchFieldGroupLabels {
1334
+ accountHolderName: string;
1335
+ routingNumber: string;
1336
+ accountNumber: string;
1337
+ routingNumberPlaceholder: string;
1338
+ accountNumberPlaceholder: string;
1339
+ /** The asterisk copy this group's labels carry. */
1340
+ fieldMarkers: LabelLabels;
1341
+ }
1342
+ interface CounterpartFormSheetLabels {
1343
+ createTitleOrganization: string;
1344
+ createTitleIndividual: string;
1345
+ editTitleOrganization: string;
1346
+ editTitleIndividual: string;
1347
+ createTitleCustomer: string;
1348
+ createTitleVendor: string;
1349
+ editTitleCustomer: string;
1350
+ editTitleVendor: string;
1351
+ createDescriptionCustomer: string;
1352
+ createDescriptionVendor: string;
1353
+ customerTypeHeading: string;
1354
+ vendorTypeHeading: string;
1355
+ businessTypeOption: string;
1356
+ businessTypeHint: string;
1357
+ personTypeOption: string;
1358
+ personTypeHint: string;
1359
+ profileHeading: string;
1360
+ addressHeading: string;
1361
+ customerAddressDescription: string;
1362
+ legalNameLabel: string;
1363
+ businessNameLabel: string;
1364
+ firstNameLabel: string;
1365
+ lastNameLabel: string;
1366
+ titleLabel: string;
1367
+ emailLabel: string;
1368
+ phoneLabel: string;
1369
+ /** Used by the inline fields; the sheet prefers the SSN/EIN keys and falls back to this. */
1370
+ taxIdLabel: string;
1371
+ taxIdSsnLabel: string;
1372
+ taxIdEinLabel: string;
1373
+ taxIdSsnPlaceholder: string;
1374
+ taxIdEinPlaceholder: string;
1375
+ customerTaxIdHelp: string;
1376
+ vendorTaxIdHelp: string;
1377
+ paymentRemindersLabel: string;
1378
+ paymentRemindersDescription: string;
1379
+ paymentMethodsHeading: string;
1380
+ paymentMethodsDescription: string;
1381
+ /**
1382
+ * @deprecated Superseded by `ach.accountHolderName`. Kept, and still
1383
+ * mapped in, so a consumer already shipping an override for this
1384
+ * already-published flat key doesn't silently lose it — this package is
1385
+ * published standalone, so removing a public field outright is a breaking
1386
+ * change even when nothing internal still reads it directly.
1387
+ */
1388
+ accountHolderNameLabel?: string;
1389
+ /** @deprecated Superseded by `ach.routingNumber`. See `accountHolderNameLabel`. */
1390
+ routingNumberLabel?: string;
1391
+ /** @deprecated Superseded by `ach.accountNumber`. See `accountHolderNameLabel`. */
1392
+ accountNumberLabel?: string;
1393
+ addAddress: string;
1394
+ cancelButton: string;
1395
+ /** @deprecated Superseded by `createButtonCustomer` / `createButtonVendor`. */
1396
+ createButton?: string;
1397
+ createButtonCustomer: string;
1398
+ createButtonVendor: string;
1399
+ saveButton: string;
1400
+ /** Screen-reader name and tooltip of the sheet's close (X) button. */
1401
+ close: string;
1402
+ address: AddressFieldGroupLabels;
1403
+ ach: AchFieldGroupLabels;
1404
+ /** Seeds `address.fieldMarkers` and `ach.fieldMarkers` unless set per group. */
1405
+ fieldMarkers: LabelLabels;
1406
+ /** Rendered by the sheet only, not by the inline field group. */
1407
+ requiredFieldsLegend: RequiredFieldsLegendLabels;
1408
+ }
1409
+ interface BankAccountFormSheetLabels {
1410
+ createTitle: string;
1411
+ editTitle: string;
1412
+ accountHolderNameLabel: string;
1413
+ accountNumberLabel: string;
1414
+ routingNumberLabel: string;
1415
+ accountNumberPlaceholder: string;
1416
+ routingNumberPlaceholder: string;
1417
+ helperText: string;
1418
+ cancelButton: string;
1419
+ saveButton: string;
1420
+ fieldMarkers: LabelLabels;
1421
+ }
1422
+ interface AddressFormSheetLabels {
1423
+ title: string;
1424
+ cancelButton: string;
1425
+ saveButton: string;
1426
+ /** Screen-reader name and tooltip of the sheet's close (X) button. */
1427
+ close: string;
1428
+ address: AddressFieldGroupLabels;
1429
+ /** Seeds `address.fieldMarkers` unless set on the group itself. */
1430
+ fieldMarkers: LabelLabels;
1431
+ requiredFieldsLegend: RequiredFieldsLegendLabels;
1432
+ }
1433
+ interface ConfirmDeleteDialogLabels {
1434
+ confirmButton: string;
1435
+ cancelButton: string;
1436
+ /** Screen-reader name and tooltip of the dialog's close (X) button. */
1437
+ close: string;
1438
+ }
1439
+
1440
+ /**
1441
+ * Overridable validation / error messages produced by the counterparts feature
1442
+ * layer and surfaced through each form's `errors` prop. Consumers override via
1443
+ * the widget's `messageLabels` prop, merged over {@link COUNTERPART_MESSAGE_LABELS_EN}.
1444
+ */
1445
+ interface CounterpartMessageLabels {
1446
+ legalNameRequired: string;
1447
+ firstNameRequired: string;
1448
+ lastNameRequired: string;
1449
+ emailRequired: string;
1450
+ emailInvalid: string;
1451
+ phoneInvalid: string;
1452
+ taxIdInvalid: string;
1453
+ addressLine1Required: string;
1454
+ cityRequired: string;
1455
+ stateRequired: string;
1456
+ postalCodeRequired: string;
1457
+ accountHolderNameRequired: string;
1458
+ routingNumberInvalid: string;
1459
+ accountNumberInvalid: string;
1460
+ /** Shown for a non-field-specific submit failure. */
1461
+ genericError: string;
1462
+ /** @deprecated Unused; the list labels its own warning. */
1463
+ amountsUnavailable: string;
1464
+ /** Delete confirmation title; `{name}` is replaced with the entity name. */
1465
+ deleteTitle: string;
1466
+ deleteBankAccountTitle: string;
1467
+ deleteBankAccountConfirm: string;
1468
+ deleteCounterpartMessage: string;
1469
+ deleteBankAccountMessage: string;
1470
+ /** @deprecated No longer shown. Use `customerAdded` / `vendorAdded`. */
1471
+ createSucceeded: string;
1472
+ /** @deprecated No longer shown. Use `customerUpdated` / `vendorUpdated`. */
1473
+ updateSucceeded: string;
1474
+ customerAdded: string;
1475
+ vendorAdded: string;
1476
+ customerUpdated: string;
1477
+ vendorUpdated: string;
1478
+ addressAdded: string;
1479
+ addressUpdated: string;
1480
+ bankAccountAdded: string;
1481
+ bankAccountUpdated: string;
1482
+ /**
1483
+ * @deprecated Used only when the delete controller gets no `counterpartType`;
1484
+ * users never see the word "counterpart". Use `customerDeleted` / `vendorDeleted`.
1485
+ */
1486
+ counterpartDeleted: string;
1487
+ customerDeleted: string;
1488
+ vendorDeleted: string;
1489
+ bankAccountDeleted: string;
1490
+ /** Error toast when a counterpart delete fails without an API message. */
1491
+ deleteCounterpartFailed: string;
1492
+ /** Error toast when a bank account delete fails without an API message. */
1493
+ deleteBankAccountFailed: string;
1494
+ }
1495
+
1496
+ /** Display statuses; overdue state is represented separately on the due date. */
1497
+ type BillBadgeStatus = 'draft' | 'ready_to_submit' | 'pending_approval' | 'ready_to_pay' | 'scheduled' | 'paid' | 'canceled' | 'rejected';
1498
+
1499
+ type BillStatusBadgeLabels = Record<BillBadgeStatus, string> & {
1500
+ unknown: string;
1501
+ };
1502
+
1503
+ interface ReceivableStatusBadgeLabels {
1504
+ draft: string;
1505
+ issuing: string;
1506
+ issued: string;
1507
+ failed: string;
1508
+ accepted: string;
1509
+ expired: string;
1510
+ declined: string;
1511
+ recurring: string;
1512
+ partially_paid: string;
1513
+ paid: string;
1514
+ overdue: string;
1515
+ uncollectible: string;
1516
+ canceled: string;
1517
+ deleted: string;
1518
+ unknown: string;
1519
+ }
1520
+
1521
+ interface CounterpartsScreenLabels {
1522
+ /** Customer-mode create action. */
1523
+ createButton: string;
1524
+ /** Vendor-mode create action. */
1525
+ vendorsCreateButton: string;
1526
+ columnName: string;
1527
+ columnBilledAmount: string;
1528
+ columnInvoicedAmount: string;
1529
+ columnReceivedAmount: string;
1530
+ columnAmountDue: string;
1531
+ columnTotalPaidToDate: string;
1532
+ columnBalanceDue: string;
1533
+ /**
1534
+ * A focused row's accessible name. The row itself is the control that
1535
+ * opens it, so the name says what Enter does. A template so locales own the
1536
+ * wording and order.
1537
+ */
1538
+ openRow: (counterpartName: string) => string;
1539
+ /** Shown in the name cell when a counterpart has no name. */
1540
+ unnamedCounterpart: string;
1541
+ searchPlaceholder: string;
1542
+ searchLabel: string;
1543
+ entityFilterLabel: string;
1544
+ entityFilterAll: string;
1545
+ entityFilterOrganization: string;
1546
+ entityFilterIndividual: string;
1547
+ filterChipRemove: string;
1548
+ typeChip: (value: string) => string;
1549
+ searchChip: (value: string) => string;
1550
+ clearAllFilters: string;
1551
+ customersEmptyTitle: string;
1552
+ customersEmptyDescription: string;
1553
+ customersEmptyAction: string;
1554
+ vendorsEmptyTitle: string;
1555
+ vendorsEmptyDescription: string;
1556
+ vendorsEmptyAction: string;
1557
+ customersFilterEmptyTitle: string;
1558
+ vendorsFilterEmptyTitle: string;
1559
+ filterEmptyDescription: string;
1560
+ filterEmptyAction: string;
1561
+ customersErrorTitle: string;
1562
+ customersErrorDescription: string;
1563
+ vendorsErrorTitle: string;
1564
+ vendorsErrorDescription: string;
1565
+ errorRetry: string;
1566
+ accessRestrictedTitle: string;
1567
+ accessRestrictedDescription: string;
1568
+ amountsUnavailable: string;
1569
+ amountsRetry: string;
1570
+ }
1571
+ interface CounterpartDetailsSheetLabels {
1572
+ loadingTitle: string;
1573
+ notFoundCustomerTitle: string;
1574
+ notFoundVendorTitle: string;
1575
+ notFoundCustomerDescription: string;
1576
+ notFoundVendorDescription: string;
1577
+ reloadFailed: string;
1578
+ openActionsMenu: string;
1579
+ closeAction: string;
1580
+ deleteCustomerAction: string;
1581
+ deleteVendorAction: string;
1582
+ summaryAmountDue: string;
1583
+ summaryBalanceDue: string;
1584
+ summaryBilled: string;
1585
+ summaryInvoiced: string;
1586
+ summaryReceived: string;
1587
+ summaryPaid: string;
1588
+ summaryRejected: string;
1589
+ overdueTag: string;
1590
+ /** Vendor footer action ("Add a bill"); the key predates the copy. */
1591
+ sendPaymentAction: string;
1592
+ issueInvoiceAction: string;
1593
+ recentCustomerDocumentsHeading: string;
1594
+ recentVendorDocumentsHeading: string;
1595
+ recentCustomerDocumentsDescription: string;
1596
+ recentVendorDocumentsDescription: string;
1597
+ /** Shown beside the recent-documents heading only when the host wires it. */
1598
+ viewAllDocumentsAction: string;
1599
+ subtitleTemplate: string;
1600
+ customerSubtitleLabel: string;
1601
+ vendorSubtitleLabel: string;
1602
+ entityTypePersonLabel: string;
1603
+ entityTypeBusinessLabel: string;
1604
+ remindersEnabledLabel: string;
1605
+ remindersDisabledLabel: string;
1606
+ paymentMethodTitle: string;
1607
+ customerDetailsHeading: string;
1608
+ vendorDetailsHeading: string;
1609
+ rowType: string;
1610
+ rowName: string;
1611
+ rowEmail: string;
1612
+ rowPaymentReminders: string;
1613
+ rowPhone: string;
1614
+ rowTaxIdSsn: string;
1615
+ rowTaxIdEin: string;
1616
+ showTaxId: string;
1617
+ hideTaxId: string;
1618
+ customerTaxIdHelp: string;
1619
+ vendorTaxIdHelp: string;
1620
+ addressHeading: string;
1621
+ noAddress: string;
1622
+ paymentMethodsHeading: string;
1623
+ paymentMethodsDescription: string;
1624
+ addPaymentMethodAction: string;
1625
+ editPaymentMethodAction: string;
1626
+ paymentMethodActionsMenu: string;
1627
+ deletePaymentMethodAction: string;
1628
+ incompletePaymentMethod: string;
1629
+ accountHolderLabel: string;
1630
+ accountNumberLabel: string;
1631
+ routingNumberLabel: string;
1632
+ noPaymentMethods: string;
1633
+ editButton: string;
1634
+ billStatusBadge: Partial<BillStatusBadgeLabels>;
1635
+ invoiceStatusBadge: Partial<ReceivableStatusBadgeLabels>;
1636
+ }
1637
+
1638
+ /** Whether this widget is showing customers (receivables) or vendors (payables). */
1639
+ type CounterpartMode = 'customer' | 'vendor';
1640
+
1641
+ /**
1642
+ * The counterpart a details-sheet action was invoked for. The name rides along
1643
+ * so a host filtering by it can label that filter without a second lookup.
1644
+ */
1645
+ interface CounterpartActionTarget {
1646
+ id: string;
1647
+ name: string;
1648
+ }
1649
+ interface CounterpartsWidgetOwnProps {
1650
+ /** Selects customer (receivables) or vendor (payables) behavior and copy. */
1651
+ counterpartType: CounterpartMode;
1652
+ pageSizeOptions?: number[];
1653
+ /**
1654
+ * Reveals a "View all" action beside the recent-documents heading in the
1655
+ * details sheet. Omit when the host has nowhere to send the user; the
1656
+ * standalone widget does not own a bills or invoices list.
1657
+ */
1658
+ onViewAllDocuments?: (counterpart: CounterpartActionTarget) => void;
1659
+ /**
1660
+ * Opens the host's create flow for this counterpart, behind the "Send a
1661
+ * payment" / "Issue an invoice" button, which is hidden while unwired.
1662
+ * The destination's own scope is the host's to check.
1663
+ */
1664
+ onCreateDocument?: (counterpart: CounterpartActionTarget) => void;
1665
+ screenLabels?: Partial<CounterpartsScreenLabels>;
1666
+ formLabels?: PartialDeep<CounterpartFormSheetLabels>;
1667
+ detailsLabels?: Partial<CounterpartDetailsSheetLabels>;
1668
+ bankAccountLabels?: PartialDeep<BankAccountFormSheetLabels>;
1669
+ /** @deprecated Unused; relabel the address through `formLabels.address`. */
1670
+ addressLabels?: PartialDeep<AddressFormSheetLabels>;
1671
+ deleteLabels?: Partial<ConfirmDeleteDialogLabels>;
1672
+ /** Overrides for validation / error / delete-prompt messages. */
1673
+ messageLabels?: Partial<CounterpartMessageLabels>;
1674
+ }
1675
+ /** Public props for {@link CounterpartsWidget}. */
1676
+ type CounterpartsWidgetProps = WidgetProviderProps & CounterpartsWidgetOwnProps;
1677
+
1678
+ /**
1679
+ * Public {@link CounterpartsWidget} — the integrator-facing widget.
1680
+ *
1681
+ * The workspace-internal component additionally accepts a `passThrough` prop
1682
+ * that tells it to give up its own analytics identity when a composing widget
1683
+ * (`ReceivablesWidget`'s Customers tab, `BillPayWidget`'s Vendors tab) mounts it to
1684
+ * inherit the host's identity instead (EMBD-5384). That choice is set **only**
1685
+ * by those composing widgets, never by integrators: an integrator's own
1686
+ * standalone mount must always claim its own identity.
1687
+ *
1688
+ * `CounterpartsWidgetProps` deliberately omits `passThrough`, so typed (TS)
1689
+ * consumers cannot pass it. This wrapper additionally strips any stray
1690
+ * `passThrough` a non-typed (JS) host might pass at runtime before
1691
+ * delegating, so the internal prop is unreachable from the published surface
1692
+ * in every case — the widget's declaration in the emitted types carries no
1693
+ * `passThrough`.
1694
+ */
1695
+ declare function CounterpartsWidget(props: CounterpartsWidgetProps): ReactNode;
1696
+
1697
+ export { CounterpartsWidget };
1698
+ export type { AddressFormSheetLabels, BankAccountFormSheetLabels, ConfirmDeleteDialogLabels, CounterpartActionTarget, CounterpartDetailsSheetLabels, CounterpartFormSheetLabels, CounterpartMessageLabels, CounterpartMode, CounterpartsScreenLabels, CounterpartsWidgetProps };