@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.
- package/LICENSE +201 -0
- package/NOTICE +7 -0
- package/README.md +314 -5
- package/dist/caretRange.d.ts +13 -0
- package/dist/caretRange.d.ts.map +1 -0
- package/dist/entries.generated.d.ts +34 -0
- package/dist/entries.generated.d.ts.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +208 -0
- package/dist/loader.d.ts +66 -0
- package/dist/loader.d.ts.map +1 -0
- package/dist/react/experimental/BalanceHistoryWidget.d.ts +1382 -0
- package/dist/react/experimental/QuickViewWidget.d.ts +888 -0
- package/dist/react/experimental/RemoteCheckCapture.d.ts +714 -0
- package/dist/react/experimental/index.d.ts +1776 -0
- package/dist/react/index.d.ts +7429 -0
- package/dist/react/lib/AcceptDisclosuresWidget.d.ts +1457 -0
- package/dist/react/lib/BalancesWidget.d.ts +647 -0
- package/dist/react/lib/BankAccountOnboardingWidget.d.ts +2053 -0
- package/dist/react/lib/BankAccountsWidget.d.ts +773 -0
- package/dist/react/lib/BankingComplianceBannerWidget.d.ts +647 -0
- package/dist/react/lib/BillPayWidget.d.ts +651 -0
- package/dist/react/lib/CardDetailsWidget.d.ts +1647 -0
- package/dist/react/lib/CounterpartsWidget.d.ts +1698 -0
- package/dist/react/lib/CounterpartsWidgetPublic.d.ts +1697 -0
- package/dist/react/lib/CreditCardsWidget.d.ts +2153 -0
- package/dist/react/lib/DebitCardsWidget.d.ts +2149 -0
- package/dist/react/lib/ExpenseManagementWidget.d.ts +835 -0
- package/dist/react/lib/InsightsWidget.d.ts +696 -0
- package/dist/react/lib/LinkedAccountsWidget.d.ts +726 -0
- package/dist/react/lib/OfferWidget.d.ts +1421 -0
- package/dist/react/lib/ReceivablesWidget.d.ts +2556 -0
- package/dist/react/lib/RecentActivityWidget.d.ts +655 -0
- package/dist/react/lib/SettingsWidget.d.ts +775 -0
- package/dist/react/lib/TransfersWidget.d.ts +794 -0
- package/dist/react/lib/WidgetProvider.d.ts +1305 -0
- package/dist/react/lib/WidgetProviderPublic.d.ts +619 -0
- package/dist/react/lib/WidgetSuite.d.ts +5664 -0
- package/dist/stylesheet.d.ts +3 -0
- package/dist/stylesheet.d.ts.map +1 -0
- package/package.json +93 -4
|
@@ -0,0 +1,2053 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ComponentType, AnchorHTMLAttributes, ReactNode, ErrorInfo } from 'react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
|
|
6
|
+
|
|
7
|
+
@category Type
|
|
8
|
+
*/
|
|
9
|
+
type Primitive =
|
|
10
|
+
| null
|
|
11
|
+
| undefined
|
|
12
|
+
| string
|
|
13
|
+
| number
|
|
14
|
+
| boolean
|
|
15
|
+
| symbol
|
|
16
|
+
| bigint;
|
|
17
|
+
|
|
18
|
+
declare global {
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
20
|
+
interface SymbolConstructor {
|
|
21
|
+
readonly observable: symbol;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
Extract all optional keys from the given type.
|
|
27
|
+
|
|
28
|
+
This is useful when you want to create a new type that contains different type values for the optional keys only.
|
|
29
|
+
|
|
30
|
+
@example
|
|
31
|
+
```
|
|
32
|
+
import type {OptionalKeysOf, Except} from 'type-fest';
|
|
33
|
+
|
|
34
|
+
interface User {
|
|
35
|
+
name: string;
|
|
36
|
+
surname: string;
|
|
37
|
+
|
|
38
|
+
luckyNumber?: number;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const REMOVE_FIELD = Symbol('remove field symbol');
|
|
42
|
+
type UpdateOperation<Entity extends object> = Except<Partial<Entity>, OptionalKeysOf<Entity>> & {
|
|
43
|
+
[Key in OptionalKeysOf<Entity>]?: Entity[Key] | typeof REMOVE_FIELD;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const update1: UpdateOperation<User> = {
|
|
47
|
+
name: 'Alice'
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const update2: UpdateOperation<User> = {
|
|
51
|
+
name: 'Bob',
|
|
52
|
+
luckyNumber: REMOVE_FIELD
|
|
53
|
+
};
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
@category Utilities
|
|
57
|
+
*/
|
|
58
|
+
type OptionalKeysOf<BaseType extends object> =
|
|
59
|
+
BaseType extends unknown // For distributing `BaseType`
|
|
60
|
+
? (keyof {
|
|
61
|
+
[Key in keyof BaseType as BaseType extends Record<Key, BaseType[Key]> ? never : Key]: never
|
|
62
|
+
}) & (keyof BaseType) // Intersect with `keyof BaseType` to ensure result of `OptionalKeysOf<BaseType>` is always assignable to `keyof BaseType`
|
|
63
|
+
: never; // Should never happen
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
Extract all required keys from the given type.
|
|
67
|
+
|
|
68
|
+
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...
|
|
69
|
+
|
|
70
|
+
@example
|
|
71
|
+
```
|
|
72
|
+
import type {RequiredKeysOf} from 'type-fest';
|
|
73
|
+
|
|
74
|
+
declare function createValidation<Entity extends object, Key extends RequiredKeysOf<Entity> = RequiredKeysOf<Entity>>(field: Key, validator: (value: Entity[Key]) => boolean): ValidatorFn;
|
|
75
|
+
|
|
76
|
+
interface User {
|
|
77
|
+
name: string;
|
|
78
|
+
surname: string;
|
|
79
|
+
|
|
80
|
+
luckyNumber?: number;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const validator1 = createValidation<User>('name', value => value.length < 25);
|
|
84
|
+
const validator2 = createValidation<User>('surname', value => value.length < 25);
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
@category Utilities
|
|
88
|
+
*/
|
|
89
|
+
type RequiredKeysOf<BaseType extends object> =
|
|
90
|
+
BaseType extends unknown // For distributing `BaseType`
|
|
91
|
+
? Exclude<keyof BaseType, OptionalKeysOf<BaseType>>
|
|
92
|
+
: never; // Should never happen
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
Returns a boolean for whether the given type is `never`.
|
|
96
|
+
|
|
97
|
+
@link https://github.com/microsoft/TypeScript/issues/31751#issuecomment-498526919
|
|
98
|
+
@link https://stackoverflow.com/a/53984913/10292952
|
|
99
|
+
@link https://www.zhenghao.io/posts/ts-never
|
|
100
|
+
|
|
101
|
+
Useful in type utilities, such as checking if something does not occur.
|
|
102
|
+
|
|
103
|
+
@example
|
|
104
|
+
```
|
|
105
|
+
import type {IsNever, And} from 'type-fest';
|
|
106
|
+
|
|
107
|
+
// https://github.com/andnp/SimplyTyped/blob/master/src/types/strings.ts
|
|
108
|
+
type AreStringsEqual<A extends string, B extends string> =
|
|
109
|
+
And<
|
|
110
|
+
IsNever<Exclude<A, B>> extends true ? true : false,
|
|
111
|
+
IsNever<Exclude<B, A>> extends true ? true : false
|
|
112
|
+
>;
|
|
113
|
+
|
|
114
|
+
type EndIfEqual<I extends string, O extends string> =
|
|
115
|
+
AreStringsEqual<I, O> extends true
|
|
116
|
+
? never
|
|
117
|
+
: void;
|
|
118
|
+
|
|
119
|
+
function endIfEqual<I extends string, O extends string>(input: I, output: O): EndIfEqual<I, O> {
|
|
120
|
+
if (input === output) {
|
|
121
|
+
process.exit(0);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
endIfEqual('abc', 'abc');
|
|
126
|
+
//=> never
|
|
127
|
+
|
|
128
|
+
endIfEqual('abc', '123');
|
|
129
|
+
//=> void
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
@category Type Guard
|
|
133
|
+
@category Utilities
|
|
134
|
+
*/
|
|
135
|
+
type IsNever<T> = [T] extends [never] ? true : false;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
An if-else-like type that resolves depending on whether the given type is `never`.
|
|
139
|
+
|
|
140
|
+
@see {@link IsNever}
|
|
141
|
+
|
|
142
|
+
@example
|
|
143
|
+
```
|
|
144
|
+
import type {IfNever} from 'type-fest';
|
|
145
|
+
|
|
146
|
+
type ShouldBeTrue = IfNever<never>;
|
|
147
|
+
//=> true
|
|
148
|
+
|
|
149
|
+
type ShouldBeBar = IfNever<'not never', 'foo', 'bar'>;
|
|
150
|
+
//=> 'bar'
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
@category Type Guard
|
|
154
|
+
@category Utilities
|
|
155
|
+
*/
|
|
156
|
+
type IfNever<T, TypeIfNever = true, TypeIfNotNever = false> = (
|
|
157
|
+
IsNever<T> extends true ? TypeIfNever : TypeIfNotNever
|
|
158
|
+
);
|
|
159
|
+
|
|
160
|
+
// Can eventually be replaced with the built-in once this library supports
|
|
161
|
+
// TS5.4+ only. Tracked in https://github.com/sindresorhus/type-fest/issues/848
|
|
162
|
+
type NoInfer<T> = T extends infer U ? U : never;
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
Returns a boolean for whether the given type is `any`.
|
|
166
|
+
|
|
167
|
+
@link https://stackoverflow.com/a/49928360/1490091
|
|
168
|
+
|
|
169
|
+
Useful in type utilities, such as disallowing `any`s to be passed to a function.
|
|
170
|
+
|
|
171
|
+
@example
|
|
172
|
+
```
|
|
173
|
+
import type {IsAny} from 'type-fest';
|
|
174
|
+
|
|
175
|
+
const typedObject = {a: 1, b: 2} as const;
|
|
176
|
+
const anyObject: any = {a: 1, b: 2};
|
|
177
|
+
|
|
178
|
+
function get<O extends (IsAny<O> extends true ? {} : Record<string, number>), K extends keyof O = keyof O>(obj: O, key: K) {
|
|
179
|
+
return obj[key];
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
const typedA = get(typedObject, 'a');
|
|
183
|
+
//=> 1
|
|
184
|
+
|
|
185
|
+
const anyA = get(anyObject, 'a');
|
|
186
|
+
//=> any
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
@category Type Guard
|
|
190
|
+
@category Utilities
|
|
191
|
+
*/
|
|
192
|
+
type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false;
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
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.
|
|
196
|
+
|
|
197
|
+
@example
|
|
198
|
+
```
|
|
199
|
+
import type {Simplify} from 'type-fest';
|
|
200
|
+
|
|
201
|
+
type PositionProps = {
|
|
202
|
+
top: number;
|
|
203
|
+
left: number;
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
type SizeProps = {
|
|
207
|
+
width: number;
|
|
208
|
+
height: number;
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
// In your editor, hovering over `Props` will show a flattened object with all the properties.
|
|
212
|
+
type Props = Simplify<PositionProps & SizeProps>;
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
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.
|
|
216
|
+
|
|
217
|
+
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`.
|
|
218
|
+
|
|
219
|
+
@example
|
|
220
|
+
```
|
|
221
|
+
import type {Simplify} from 'type-fest';
|
|
222
|
+
|
|
223
|
+
interface SomeInterface {
|
|
224
|
+
foo: number;
|
|
225
|
+
bar?: string;
|
|
226
|
+
baz: number | undefined;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
type SomeType = {
|
|
230
|
+
foo: number;
|
|
231
|
+
bar?: string;
|
|
232
|
+
baz: number | undefined;
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
const literal = {foo: 123, bar: 'hello', baz: 456};
|
|
236
|
+
const someType: SomeType = literal;
|
|
237
|
+
const someInterface: SomeInterface = literal;
|
|
238
|
+
|
|
239
|
+
function fn(object: Record<string, unknown>): void {}
|
|
240
|
+
|
|
241
|
+
fn(literal); // Good: literal object type is sealed
|
|
242
|
+
fn(someType); // Good: type is sealed
|
|
243
|
+
fn(someInterface); // Error: Index signature for type 'string' is missing in type 'someInterface'. Because `interface` can be re-opened
|
|
244
|
+
fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface` into a `type`
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
@link https://github.com/microsoft/TypeScript/issues/15300
|
|
248
|
+
@see SimplifyDeep
|
|
249
|
+
@category Object
|
|
250
|
+
*/
|
|
251
|
+
type Simplify<T> = {[KeyType in keyof T]: T[KeyType]} & {};
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
Omit any index signatures from the given object type, leaving only explicitly defined properties.
|
|
255
|
+
|
|
256
|
+
This is the counterpart of `PickIndexSignature`.
|
|
257
|
+
|
|
258
|
+
Use-cases:
|
|
259
|
+
- Remove overly permissive signatures from third-party types.
|
|
260
|
+
|
|
261
|
+
This type was taken from this [StackOverflow answer](https://stackoverflow.com/a/68261113/420747).
|
|
262
|
+
|
|
263
|
+
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>`.
|
|
264
|
+
|
|
265
|
+
(The actual value type, `unknown`, is irrelevant and could be any type. Only the key type matters.)
|
|
266
|
+
|
|
267
|
+
```
|
|
268
|
+
const indexed: Record<string, unknown> = {}; // Allowed
|
|
269
|
+
|
|
270
|
+
const keyed: Record<'foo', unknown> = {}; // Error
|
|
271
|
+
// => TS2739: Type '{}' is missing the following properties from type 'Record<"foo" | "bar", unknown>': foo, bar
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
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:
|
|
275
|
+
|
|
276
|
+
```
|
|
277
|
+
type Indexed = {} extends Record<string, unknown>
|
|
278
|
+
? '✅ `{}` is assignable to `Record<string, unknown>`'
|
|
279
|
+
: '❌ `{}` is NOT assignable to `Record<string, unknown>`';
|
|
280
|
+
// => '✅ `{}` is assignable to `Record<string, unknown>`'
|
|
281
|
+
|
|
282
|
+
type Keyed = {} extends Record<'foo' | 'bar', unknown>
|
|
283
|
+
? "✅ `{}` is assignable to `Record<'foo' | 'bar', unknown>`"
|
|
284
|
+
: "❌ `{}` is NOT assignable to `Record<'foo' | 'bar', unknown>`";
|
|
285
|
+
// => "❌ `{}` is NOT assignable to `Record<'foo' | 'bar', unknown>`"
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
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`...
|
|
289
|
+
|
|
290
|
+
```
|
|
291
|
+
import type {OmitIndexSignature} from 'type-fest';
|
|
292
|
+
|
|
293
|
+
type OmitIndexSignature<ObjectType> = {
|
|
294
|
+
[KeyType in keyof ObjectType // Map each key of `ObjectType`...
|
|
295
|
+
]: ObjectType[KeyType]; // ...to its original value, i.e. `OmitIndexSignature<Foo> == Foo`.
|
|
296
|
+
};
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
...whether an empty object (`{}`) would be assignable to an object with that `KeyType` (`Record<KeyType, unknown>`)...
|
|
300
|
+
|
|
301
|
+
```
|
|
302
|
+
import type {OmitIndexSignature} from 'type-fest';
|
|
303
|
+
|
|
304
|
+
type OmitIndexSignature<ObjectType> = {
|
|
305
|
+
[KeyType in keyof ObjectType
|
|
306
|
+
// Is `{}` assignable to `Record<KeyType, unknown>`?
|
|
307
|
+
as {} extends Record<KeyType, unknown>
|
|
308
|
+
? ... // ✅ `{}` is assignable to `Record<KeyType, unknown>`
|
|
309
|
+
: ... // ❌ `{}` is NOT assignable to `Record<KeyType, unknown>`
|
|
310
|
+
]: ObjectType[KeyType];
|
|
311
|
+
};
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
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.
|
|
315
|
+
|
|
316
|
+
@example
|
|
317
|
+
```
|
|
318
|
+
import type {OmitIndexSignature} from 'type-fest';
|
|
319
|
+
|
|
320
|
+
interface Example {
|
|
321
|
+
// These index signatures will be removed.
|
|
322
|
+
[x: string]: any
|
|
323
|
+
[x: number]: any
|
|
324
|
+
[x: symbol]: any
|
|
325
|
+
[x: `head-${string}`]: string
|
|
326
|
+
[x: `${string}-tail`]: string
|
|
327
|
+
[x: `head-${string}-tail`]: string
|
|
328
|
+
[x: `${bigint}`]: string
|
|
329
|
+
[x: `embedded-${number}`]: string
|
|
330
|
+
|
|
331
|
+
// These explicitly defined keys will remain.
|
|
332
|
+
foo: 'bar';
|
|
333
|
+
qux?: 'baz';
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
|
|
337
|
+
// => { foo: 'bar'; qux?: 'baz' | undefined; }
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
@see PickIndexSignature
|
|
341
|
+
@category Object
|
|
342
|
+
*/
|
|
343
|
+
type OmitIndexSignature<ObjectType> = {
|
|
344
|
+
[KeyType in keyof ObjectType as {} extends Record<KeyType, unknown>
|
|
345
|
+
? never
|
|
346
|
+
: KeyType]: ObjectType[KeyType];
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
Pick only index signatures from the given object type, leaving out all explicitly defined properties.
|
|
351
|
+
|
|
352
|
+
This is the counterpart of `OmitIndexSignature`.
|
|
353
|
+
|
|
354
|
+
@example
|
|
355
|
+
```
|
|
356
|
+
import type {PickIndexSignature} from 'type-fest';
|
|
357
|
+
|
|
358
|
+
declare const symbolKey: unique symbol;
|
|
359
|
+
|
|
360
|
+
type Example = {
|
|
361
|
+
// These index signatures will remain.
|
|
362
|
+
[x: string]: unknown;
|
|
363
|
+
[x: number]: unknown;
|
|
364
|
+
[x: symbol]: unknown;
|
|
365
|
+
[x: `head-${string}`]: string;
|
|
366
|
+
[x: `${string}-tail`]: string;
|
|
367
|
+
[x: `head-${string}-tail`]: string;
|
|
368
|
+
[x: `${bigint}`]: string;
|
|
369
|
+
[x: `embedded-${number}`]: string;
|
|
370
|
+
|
|
371
|
+
// These explicitly defined keys will be removed.
|
|
372
|
+
['kebab-case-key']: string;
|
|
373
|
+
[symbolKey]: string;
|
|
374
|
+
foo: 'bar';
|
|
375
|
+
qux?: 'baz';
|
|
376
|
+
};
|
|
377
|
+
|
|
378
|
+
type ExampleIndexSignature = PickIndexSignature<Example>;
|
|
379
|
+
// {
|
|
380
|
+
// [x: string]: unknown;
|
|
381
|
+
// [x: number]: unknown;
|
|
382
|
+
// [x: symbol]: unknown;
|
|
383
|
+
// [x: `head-${string}`]: string;
|
|
384
|
+
// [x: `${string}-tail`]: string;
|
|
385
|
+
// [x: `head-${string}-tail`]: string;
|
|
386
|
+
// [x: `${bigint}`]: string;
|
|
387
|
+
// [x: `embedded-${number}`]: string;
|
|
388
|
+
// }
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
@see OmitIndexSignature
|
|
392
|
+
@category Object
|
|
393
|
+
*/
|
|
394
|
+
type PickIndexSignature<ObjectType> = {
|
|
395
|
+
[KeyType in keyof ObjectType as {} extends Record<KeyType, unknown>
|
|
396
|
+
? KeyType
|
|
397
|
+
: never]: ObjectType[KeyType];
|
|
398
|
+
};
|
|
399
|
+
|
|
400
|
+
// Merges two objects without worrying about index signatures.
|
|
401
|
+
type SimpleMerge<Destination, Source> = {
|
|
402
|
+
[Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key];
|
|
403
|
+
} & Source;
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
Merge two types into a new type. Keys of the second type overrides keys of the first type.
|
|
407
|
+
|
|
408
|
+
@example
|
|
409
|
+
```
|
|
410
|
+
import type {Merge} from 'type-fest';
|
|
411
|
+
|
|
412
|
+
interface Foo {
|
|
413
|
+
[x: string]: unknown;
|
|
414
|
+
[x: number]: unknown;
|
|
415
|
+
foo: string;
|
|
416
|
+
bar: symbol;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
type Bar = {
|
|
420
|
+
[x: number]: number;
|
|
421
|
+
[x: symbol]: unknown;
|
|
422
|
+
bar: Date;
|
|
423
|
+
baz: boolean;
|
|
424
|
+
};
|
|
425
|
+
|
|
426
|
+
export type FooBar = Merge<Foo, Bar>;
|
|
427
|
+
// => {
|
|
428
|
+
// [x: string]: unknown;
|
|
429
|
+
// [x: number]: number;
|
|
430
|
+
// [x: symbol]: unknown;
|
|
431
|
+
// foo: string;
|
|
432
|
+
// bar: Date;
|
|
433
|
+
// baz: boolean;
|
|
434
|
+
// }
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
@category Object
|
|
438
|
+
*/
|
|
439
|
+
type Merge<Destination, Source> =
|
|
440
|
+
Simplify<
|
|
441
|
+
SimpleMerge<PickIndexSignature<Destination>, PickIndexSignature<Source>>
|
|
442
|
+
& SimpleMerge<OmitIndexSignature<Destination>, OmitIndexSignature<Source>>
|
|
443
|
+
>;
|
|
444
|
+
|
|
445
|
+
/**
|
|
446
|
+
An if-else-like type that resolves depending on whether the given type is `any`.
|
|
447
|
+
|
|
448
|
+
@see {@link IsAny}
|
|
449
|
+
|
|
450
|
+
@example
|
|
451
|
+
```
|
|
452
|
+
import type {IfAny} from 'type-fest';
|
|
453
|
+
|
|
454
|
+
type ShouldBeTrue = IfAny<any>;
|
|
455
|
+
//=> true
|
|
456
|
+
|
|
457
|
+
type ShouldBeBar = IfAny<'not any', 'foo', 'bar'>;
|
|
458
|
+
//=> 'bar'
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
@category Type Guard
|
|
462
|
+
@category Utilities
|
|
463
|
+
*/
|
|
464
|
+
type IfAny<T, TypeIfAny = true, TypeIfNotAny = false> = (
|
|
465
|
+
IsAny<T> extends true ? TypeIfAny : TypeIfNotAny
|
|
466
|
+
);
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
Matches any primitive, `void`, `Date`, or `RegExp` value.
|
|
470
|
+
*/
|
|
471
|
+
type BuiltIns = Primitive | void | Date | RegExp;
|
|
472
|
+
|
|
473
|
+
/**
|
|
474
|
+
Merges user specified options with default options.
|
|
475
|
+
|
|
476
|
+
@example
|
|
477
|
+
```
|
|
478
|
+
type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
|
|
479
|
+
type DefaultPathsOptions = {maxRecursionDepth: 10; leavesOnly: false};
|
|
480
|
+
type SpecifiedOptions = {leavesOnly: true};
|
|
481
|
+
|
|
482
|
+
type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
|
|
483
|
+
//=> {maxRecursionDepth: 10; leavesOnly: true}
|
|
484
|
+
```
|
|
485
|
+
|
|
486
|
+
@example
|
|
487
|
+
```
|
|
488
|
+
// Complains if default values are not provided for optional options
|
|
489
|
+
|
|
490
|
+
type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
|
|
491
|
+
type DefaultPathsOptions = {maxRecursionDepth: 10};
|
|
492
|
+
type SpecifiedOptions = {};
|
|
493
|
+
|
|
494
|
+
type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
|
|
495
|
+
// ~~~~~~~~~~~~~~~~~~~
|
|
496
|
+
// Property 'leavesOnly' is missing in type 'DefaultPathsOptions' but required in type '{ maxRecursionDepth: number; leavesOnly: boolean; }'.
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
@example
|
|
500
|
+
```
|
|
501
|
+
// Complains if an option's default type does not conform to the expected type
|
|
502
|
+
|
|
503
|
+
type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
|
|
504
|
+
type DefaultPathsOptions = {maxRecursionDepth: 10; leavesOnly: 'no'};
|
|
505
|
+
type SpecifiedOptions = {};
|
|
506
|
+
|
|
507
|
+
type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
|
|
508
|
+
// ~~~~~~~~~~~~~~~~~~~
|
|
509
|
+
// Types of property 'leavesOnly' are incompatible. Type 'string' is not assignable to type 'boolean'.
|
|
510
|
+
```
|
|
511
|
+
|
|
512
|
+
@example
|
|
513
|
+
```
|
|
514
|
+
// Complains if an option's specified type does not conform to the expected type
|
|
515
|
+
|
|
516
|
+
type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
|
|
517
|
+
type DefaultPathsOptions = {maxRecursionDepth: 10; leavesOnly: false};
|
|
518
|
+
type SpecifiedOptions = {leavesOnly: 'yes'};
|
|
519
|
+
|
|
520
|
+
type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
|
|
521
|
+
// ~~~~~~~~~~~~~~~~
|
|
522
|
+
// Types of property 'leavesOnly' are incompatible. Type 'string' is not assignable to type 'boolean'.
|
|
523
|
+
```
|
|
524
|
+
*/
|
|
525
|
+
type ApplyDefaultOptions<
|
|
526
|
+
Options extends object,
|
|
527
|
+
Defaults extends Simplify<Omit<Required<Options>, RequiredKeysOf<Options>> & Partial<Record<RequiredKeysOf<Options>, never>>>,
|
|
528
|
+
SpecifiedOptions extends Options,
|
|
529
|
+
> =
|
|
530
|
+
IfAny<SpecifiedOptions, Defaults,
|
|
531
|
+
IfNever<SpecifiedOptions, Defaults,
|
|
532
|
+
Simplify<Merge<Defaults, {
|
|
533
|
+
[Key in keyof SpecifiedOptions
|
|
534
|
+
as Key extends OptionalKeysOf<Options>
|
|
535
|
+
? Extract<SpecifiedOptions[Key], undefined> extends never
|
|
536
|
+
? Key
|
|
537
|
+
: never
|
|
538
|
+
: Key
|
|
539
|
+
]: SpecifiedOptions[Key]
|
|
540
|
+
}> & Required<Options>> // `& Required<Options>` ensures that `ApplyDefaultOptions<SomeOption, ...>` is always assignable to `Required<SomeOption>`
|
|
541
|
+
>>;
|
|
542
|
+
|
|
543
|
+
/**
|
|
544
|
+
@see {@link PartialDeep}
|
|
545
|
+
*/
|
|
546
|
+
type PartialDeepOptions = {
|
|
547
|
+
/**
|
|
548
|
+
Whether to affect the individual elements of arrays and tuples.
|
|
549
|
+
|
|
550
|
+
@default false
|
|
551
|
+
*/
|
|
552
|
+
readonly recurseIntoArrays?: boolean;
|
|
553
|
+
|
|
554
|
+
/**
|
|
555
|
+
Allows `undefined` values in non-tuple arrays.
|
|
556
|
+
|
|
557
|
+
- When set to `true`, elements of non-tuple arrays can be `undefined`.
|
|
558
|
+
- When set to `false`, only explicitly defined elements are allowed in non-tuple arrays, ensuring stricter type checking.
|
|
559
|
+
|
|
560
|
+
@default true
|
|
561
|
+
|
|
562
|
+
@example
|
|
563
|
+
You can prevent `undefined` values in non-tuple arrays by passing `{recurseIntoArrays: true; allowUndefinedInNonTupleArrays: false}` as the second type argument:
|
|
564
|
+
|
|
565
|
+
```
|
|
566
|
+
import type {PartialDeep} from 'type-fest';
|
|
567
|
+
|
|
568
|
+
type Settings = {
|
|
569
|
+
languages: string[];
|
|
570
|
+
};
|
|
571
|
+
|
|
572
|
+
declare const partialSettings: PartialDeep<Settings, {recurseIntoArrays: true; allowUndefinedInNonTupleArrays: false}>;
|
|
573
|
+
|
|
574
|
+
partialSettings.languages = [undefined]; // Error
|
|
575
|
+
partialSettings.languages = []; // Ok
|
|
576
|
+
```
|
|
577
|
+
*/
|
|
578
|
+
readonly allowUndefinedInNonTupleArrays?: boolean;
|
|
579
|
+
};
|
|
580
|
+
|
|
581
|
+
type DefaultPartialDeepOptions = {
|
|
582
|
+
recurseIntoArrays: false;
|
|
583
|
+
allowUndefinedInNonTupleArrays: true;
|
|
584
|
+
};
|
|
585
|
+
|
|
586
|
+
/**
|
|
587
|
+
Create a type from another type with all keys and nested keys set to optional.
|
|
588
|
+
|
|
589
|
+
Use-cases:
|
|
590
|
+
- Merging a default settings/config object with another object, the second object would be a deep partial of the default object.
|
|
591
|
+
- Mocking and testing complex entities, where populating an entire object with its keys would be redundant in terms of the mock or test.
|
|
592
|
+
|
|
593
|
+
@example
|
|
594
|
+
```
|
|
595
|
+
import type {PartialDeep} from 'type-fest';
|
|
596
|
+
|
|
597
|
+
const settings: Settings = {
|
|
598
|
+
textEditor: {
|
|
599
|
+
fontSize: 14,
|
|
600
|
+
fontColor: '#000000',
|
|
601
|
+
fontWeight: 400
|
|
602
|
+
},
|
|
603
|
+
autocomplete: false,
|
|
604
|
+
autosave: true
|
|
605
|
+
};
|
|
606
|
+
|
|
607
|
+
const applySavedSettings = (savedSettings: PartialDeep<Settings>) => {
|
|
608
|
+
return {...settings, ...savedSettings};
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
settings = applySavedSettings({textEditor: {fontWeight: 500}});
|
|
612
|
+
```
|
|
613
|
+
|
|
614
|
+
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:
|
|
615
|
+
|
|
616
|
+
```
|
|
617
|
+
import type {PartialDeep} from 'type-fest';
|
|
618
|
+
|
|
619
|
+
type Settings = {
|
|
620
|
+
languages: string[];
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
const partialSettings: PartialDeep<Settings, {recurseIntoArrays: true}> = {
|
|
624
|
+
languages: [undefined]
|
|
625
|
+
};
|
|
626
|
+
```
|
|
627
|
+
|
|
628
|
+
@see {@link PartialDeepOptions}
|
|
629
|
+
|
|
630
|
+
@category Object
|
|
631
|
+
@category Array
|
|
632
|
+
@category Set
|
|
633
|
+
@category Map
|
|
634
|
+
*/
|
|
635
|
+
type PartialDeep<T, Options extends PartialDeepOptions = {}> =
|
|
636
|
+
_PartialDeep<T, ApplyDefaultOptions<PartialDeepOptions, DefaultPartialDeepOptions, Options>>;
|
|
637
|
+
|
|
638
|
+
type _PartialDeep<T, Options extends Required<PartialDeepOptions>> = T extends BuiltIns | ((new (...arguments_: any[]) => unknown))
|
|
639
|
+
? T
|
|
640
|
+
: IsNever<keyof T> extends true // For functions with no properties
|
|
641
|
+
? T
|
|
642
|
+
: T extends Map<infer KeyType, infer ValueType>
|
|
643
|
+
? PartialMapDeep<KeyType, ValueType, Options>
|
|
644
|
+
: T extends Set<infer ItemType>
|
|
645
|
+
? PartialSetDeep<ItemType, Options>
|
|
646
|
+
: T extends ReadonlyMap<infer KeyType, infer ValueType>
|
|
647
|
+
? PartialReadonlyMapDeep<KeyType, ValueType, Options>
|
|
648
|
+
: T extends ReadonlySet<infer ItemType>
|
|
649
|
+
? PartialReadonlySetDeep<ItemType, Options>
|
|
650
|
+
: T extends object
|
|
651
|
+
? T extends ReadonlyArray<infer ItemType> // Test for arrays/tuples, per https://github.com/microsoft/TypeScript/issues/35156
|
|
652
|
+
? Options['recurseIntoArrays'] extends true
|
|
653
|
+
? ItemType[] extends T // Test for arrays (non-tuples) specifically
|
|
654
|
+
? readonly ItemType[] extends T // Differentiate readonly and mutable arrays
|
|
655
|
+
? ReadonlyArray<_PartialDeep<Options['allowUndefinedInNonTupleArrays'] extends false ? ItemType : ItemType | undefined, Options>>
|
|
656
|
+
: Array<_PartialDeep<Options['allowUndefinedInNonTupleArrays'] extends false ? ItemType : ItemType | undefined, Options>>
|
|
657
|
+
: PartialObjectDeep<T, Options> // Tuples behave properly
|
|
658
|
+
: T // If they don't opt into array testing, just use the original type
|
|
659
|
+
: PartialObjectDeep<T, Options>
|
|
660
|
+
: unknown;
|
|
661
|
+
|
|
662
|
+
/**
|
|
663
|
+
Same as `PartialDeep`, but accepts only `Map`s and as inputs. Internal helper for `PartialDeep`.
|
|
664
|
+
*/
|
|
665
|
+
type PartialMapDeep<KeyType, ValueType, Options extends Required<PartialDeepOptions>> = {} & Map<_PartialDeep<KeyType, Options>, _PartialDeep<ValueType, Options>>;
|
|
666
|
+
|
|
667
|
+
/**
|
|
668
|
+
Same as `PartialDeep`, but accepts only `Set`s as inputs. Internal helper for `PartialDeep`.
|
|
669
|
+
*/
|
|
670
|
+
type PartialSetDeep<T, Options extends Required<PartialDeepOptions>> = {} & Set<_PartialDeep<T, Options>>;
|
|
671
|
+
|
|
672
|
+
/**
|
|
673
|
+
Same as `PartialDeep`, but accepts only `ReadonlyMap`s as inputs. Internal helper for `PartialDeep`.
|
|
674
|
+
*/
|
|
675
|
+
type PartialReadonlyMapDeep<KeyType, ValueType, Options extends Required<PartialDeepOptions>> = {} & ReadonlyMap<_PartialDeep<KeyType, Options>, _PartialDeep<ValueType, Options>>;
|
|
676
|
+
|
|
677
|
+
/**
|
|
678
|
+
Same as `PartialDeep`, but accepts only `ReadonlySet`s as inputs. Internal helper for `PartialDeep`.
|
|
679
|
+
*/
|
|
680
|
+
type PartialReadonlySetDeep<T, Options extends Required<PartialDeepOptions>> = {} & ReadonlySet<_PartialDeep<T, Options>>;
|
|
681
|
+
|
|
682
|
+
/**
|
|
683
|
+
Same as `PartialDeep`, but accepts only `object`s as inputs. Internal helper for `PartialDeep`.
|
|
684
|
+
*/
|
|
685
|
+
type PartialObjectDeep<ObjectType extends object, Options extends Required<PartialDeepOptions>> =
|
|
686
|
+
(ObjectType extends (...arguments_: any) => unknown
|
|
687
|
+
? (...arguments_: Parameters<ObjectType>) => ReturnType<ObjectType>
|
|
688
|
+
: {}) & ({
|
|
689
|
+
[KeyType in keyof ObjectType]?: _PartialDeep<ObjectType[KeyType], Options>
|
|
690
|
+
});
|
|
691
|
+
|
|
692
|
+
declare type FallbackProps = {
|
|
693
|
+
error: unknown;
|
|
694
|
+
resetErrorBoundary: (...args: unknown[]) => void;
|
|
695
|
+
};
|
|
696
|
+
|
|
697
|
+
/**
|
|
698
|
+
* Host-facing domain shapes for bank-account onboarding prefill and widget
|
|
699
|
+
* state. Owned by the feature layer so the published API does not re-export
|
|
700
|
+
* UI form view-models as the business contract.
|
|
701
|
+
*/
|
|
702
|
+
type CompanyStructureValue = 'CORPORATION_PUBLIC' | 'CORPORATION_PRIVATE' | 'CORPORATION_NOT_FOR_PROFIT' | 'LLC' | 'LLP' | 'PARTNERSHIP' | 'SOLE_PROPRIETORSHIP' | 'GOVERNMENT' | 'COOPERATIVE' | 'ASSOCIATION' | 'OTHER';
|
|
703
|
+
interface BusinessDetailsValues {
|
|
704
|
+
companyLegalName: string;
|
|
705
|
+
companyDbaName: string;
|
|
706
|
+
businessAddress: string;
|
|
707
|
+
city: string;
|
|
708
|
+
state: string;
|
|
709
|
+
zipCode: string;
|
|
710
|
+
companyPhoneNumber: string;
|
|
711
|
+
companyStructure: CompanyStructureValue | '';
|
|
712
|
+
website: string;
|
|
713
|
+
taxId: string;
|
|
714
|
+
/**
|
|
715
|
+
* Set only when resuming. While present, a blank field means keep the stored
|
|
716
|
+
* tax id rather than missing, so the applicant need not retype it.
|
|
717
|
+
*/
|
|
718
|
+
taxIdOnFileLast4?: string;
|
|
719
|
+
/**
|
|
720
|
+
* Structure the stored tax id was filed under. A change across the
|
|
721
|
+
* sole-proprietorship line changes its type, so it can no longer be kept.
|
|
722
|
+
*/
|
|
723
|
+
taxIdOnFileStructure?: CompanyStructureValue;
|
|
724
|
+
naicsCode: string;
|
|
725
|
+
isAuthorized: boolean | null;
|
|
726
|
+
isCheckboxChecked: boolean;
|
|
727
|
+
}
|
|
728
|
+
interface PersonalDetailsValues {
|
|
729
|
+
firstName: string;
|
|
730
|
+
lastName: string;
|
|
731
|
+
dateOfBirth: Date | undefined;
|
|
732
|
+
ssn: string;
|
|
733
|
+
/**
|
|
734
|
+
* Set only when resuming. While present, a blank field means keep the stored
|
|
735
|
+
* SSN rather than missing, so the applicant need not retype it.
|
|
736
|
+
*/
|
|
737
|
+
ssnOnFileLast4?: string;
|
|
738
|
+
homeAddress: string;
|
|
739
|
+
city: string;
|
|
740
|
+
state: string;
|
|
741
|
+
zipCode: string;
|
|
742
|
+
mobilePhoneNumber: string;
|
|
743
|
+
workEmail: string;
|
|
744
|
+
ownsOver25Percent: boolean | null;
|
|
745
|
+
ownershipPercentage: number | null;
|
|
746
|
+
}
|
|
747
|
+
interface AdditionalOwner {
|
|
748
|
+
/**
|
|
749
|
+
* Identifier of an owner already stored on the application. Present only on
|
|
750
|
+
* a resumed owner; omitted for one the applicant just added, which is what
|
|
751
|
+
* tells the server to create rather than update.
|
|
752
|
+
*/
|
|
753
|
+
id?: string;
|
|
754
|
+
firstName: string;
|
|
755
|
+
lastName: string;
|
|
756
|
+
dateOfBirth: Date | undefined;
|
|
757
|
+
ssn: string;
|
|
758
|
+
/**
|
|
759
|
+
* Set only for a resumed owner carrying an `id`, which is what makes the write
|
|
760
|
+
* a merge. Blank then means keep. Without an id the write creates a new row,
|
|
761
|
+
* so an omitted identifier would store the owner without one.
|
|
762
|
+
*/
|
|
763
|
+
ssnOnFileLast4?: string;
|
|
764
|
+
homeAddress: string;
|
|
765
|
+
city: string;
|
|
766
|
+
state: string;
|
|
767
|
+
zipCode: string;
|
|
768
|
+
mobilePhoneNumber: string;
|
|
769
|
+
ownsOver25Percent: boolean | null;
|
|
770
|
+
ownershipPercentage: number | null;
|
|
771
|
+
/**
|
|
772
|
+
* Client-only, never sent. False (or absent) for an owner the application
|
|
773
|
+
* prefilled from what the API already holds: the applicant has to read it
|
|
774
|
+
* back and confirm it before the step can continue. Entering or editing an
|
|
775
|
+
* owner sets it, since the applicant has then seen every field.
|
|
776
|
+
*/
|
|
777
|
+
reviewed?: boolean;
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
type AuthToken = string | undefined;
|
|
781
|
+
interface Auth {
|
|
782
|
+
/**
|
|
783
|
+
* Which part of the request do we use to send the auth?
|
|
784
|
+
*
|
|
785
|
+
* @default 'header'
|
|
786
|
+
*/
|
|
787
|
+
in?: 'header' | 'query' | 'cookie';
|
|
788
|
+
/**
|
|
789
|
+
* A unique identifier for the security scheme.
|
|
790
|
+
*
|
|
791
|
+
* Defined only when there are multiple security schemes whose `Auth`
|
|
792
|
+
* shape would otherwise be identical.
|
|
793
|
+
*/
|
|
794
|
+
key?: string;
|
|
795
|
+
/**
|
|
796
|
+
* Header or query parameter name.
|
|
797
|
+
*
|
|
798
|
+
* @default 'Authorization'
|
|
799
|
+
*/
|
|
800
|
+
name?: string;
|
|
801
|
+
scheme?: 'basic' | 'bearer';
|
|
802
|
+
type: 'apiKey' | 'http';
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
interface SerializerOptions<T> {
|
|
806
|
+
/**
|
|
807
|
+
* @default true
|
|
808
|
+
*/
|
|
809
|
+
explode: boolean;
|
|
810
|
+
style: T;
|
|
811
|
+
}
|
|
812
|
+
type ArrayStyle = 'form' | 'spaceDelimited' | 'pipeDelimited';
|
|
813
|
+
type ObjectStyle = 'form' | 'deepObject';
|
|
814
|
+
|
|
815
|
+
type QuerySerializer = (query: Record<string, unknown>) => string;
|
|
816
|
+
type BodySerializer = (body: unknown) => unknown;
|
|
817
|
+
type QuerySerializerOptionsObject = {
|
|
818
|
+
allowReserved?: boolean;
|
|
819
|
+
array?: Partial<SerializerOptions<ArrayStyle>>;
|
|
820
|
+
object?: Partial<SerializerOptions<ObjectStyle>>;
|
|
821
|
+
};
|
|
822
|
+
type QuerySerializerOptions = QuerySerializerOptionsObject & {
|
|
823
|
+
/**
|
|
824
|
+
* Per-parameter serialization overrides. When provided, these settings
|
|
825
|
+
* override the global array/object settings for specific parameter names.
|
|
826
|
+
*/
|
|
827
|
+
parameters?: Record<string, QuerySerializerOptionsObject>;
|
|
828
|
+
};
|
|
829
|
+
|
|
830
|
+
type HttpMethod = 'connect' | 'delete' | 'get' | 'head' | 'options' | 'patch' | 'post' | 'put' | 'trace';
|
|
831
|
+
type Client$1<RequestFn = never, Config = unknown, MethodFn = never, BuildUrlFn = never, SseFn = never> = {
|
|
832
|
+
/**
|
|
833
|
+
* Returns the final request URL.
|
|
834
|
+
*/
|
|
835
|
+
buildUrl: BuildUrlFn;
|
|
836
|
+
getConfig: () => Config;
|
|
837
|
+
request: RequestFn;
|
|
838
|
+
setConfig: (config: Config) => Config;
|
|
839
|
+
} & {
|
|
840
|
+
[K in HttpMethod]: MethodFn;
|
|
841
|
+
} & ([SseFn] extends [never] ? {
|
|
842
|
+
sse?: never;
|
|
843
|
+
} : {
|
|
844
|
+
sse: {
|
|
845
|
+
[K in HttpMethod]: SseFn;
|
|
846
|
+
};
|
|
847
|
+
});
|
|
848
|
+
interface Config$1 {
|
|
849
|
+
/**
|
|
850
|
+
* Auth token or a function returning auth token. The resolved value will be
|
|
851
|
+
* added to the request payload as defined by its `security` array.
|
|
852
|
+
*/
|
|
853
|
+
auth?: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken;
|
|
854
|
+
/**
|
|
855
|
+
* A function for serializing request body parameter. By default,
|
|
856
|
+
* {@link JSON.stringify()} will be used.
|
|
857
|
+
*/
|
|
858
|
+
bodySerializer?: BodySerializer | null;
|
|
859
|
+
/**
|
|
860
|
+
* An object containing any HTTP headers that you want to pre-populate your
|
|
861
|
+
* `Headers` object with.
|
|
862
|
+
*
|
|
863
|
+
* {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more}
|
|
864
|
+
*/
|
|
865
|
+
headers?: RequestInit['headers'] | Record<string, string | number | boolean | (string | number | boolean)[] | null | undefined | unknown>;
|
|
866
|
+
/**
|
|
867
|
+
* The request method.
|
|
868
|
+
*
|
|
869
|
+
* {@link https://developer.mozilla.org/docs/Web/API/fetch#method See more}
|
|
870
|
+
*/
|
|
871
|
+
method?: Uppercase<HttpMethod>;
|
|
872
|
+
/**
|
|
873
|
+
* A function for serializing request query parameters. By default, arrays
|
|
874
|
+
* will be exploded in form style, objects will be exploded in deepObject
|
|
875
|
+
* style, and reserved characters are percent-encoded.
|
|
876
|
+
*
|
|
877
|
+
* This method will have no effect if the native `paramsSerializer()` Axios
|
|
878
|
+
* API function is used.
|
|
879
|
+
*
|
|
880
|
+
* {@link https://swagger.io/docs/specification/serialization/#query View examples}
|
|
881
|
+
*/
|
|
882
|
+
querySerializer?: QuerySerializer | QuerySerializerOptions;
|
|
883
|
+
/**
|
|
884
|
+
* A function validating request data. This is useful if you want to ensure
|
|
885
|
+
* the request conforms to the desired shape, so it can be safely sent to
|
|
886
|
+
* the server.
|
|
887
|
+
*/
|
|
888
|
+
requestValidator?: (data: unknown) => Promise<unknown>;
|
|
889
|
+
/**
|
|
890
|
+
* A function transforming response data before it's returned. This is useful
|
|
891
|
+
* for post-processing data, e.g., converting ISO strings into Date objects.
|
|
892
|
+
*/
|
|
893
|
+
responseTransformer?: (data: unknown) => Promise<unknown>;
|
|
894
|
+
/**
|
|
895
|
+
* A function validating response data. This is useful if you want to ensure
|
|
896
|
+
* the response conforms to the desired shape, so it can be safely passed to
|
|
897
|
+
* the transformers and returned to the user.
|
|
898
|
+
*/
|
|
899
|
+
responseValidator?: (data: unknown) => Promise<unknown>;
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
type ServerSentEventsOptions<TData = unknown> = Omit<RequestInit, 'method'> & Pick<Config$1, 'method' | 'responseTransformer' | 'responseValidator'> & {
|
|
903
|
+
/**
|
|
904
|
+
* Fetch API implementation. You can use this option to provide a custom
|
|
905
|
+
* fetch instance.
|
|
906
|
+
*
|
|
907
|
+
* @default globalThis.fetch
|
|
908
|
+
*/
|
|
909
|
+
fetch?: typeof fetch;
|
|
910
|
+
/**
|
|
911
|
+
* Implementing clients can call request interceptors inside this hook.
|
|
912
|
+
*/
|
|
913
|
+
onRequest?: (url: string, init: RequestInit) => Promise<Request>;
|
|
914
|
+
/**
|
|
915
|
+
* Callback invoked when a network or parsing error occurs during streaming.
|
|
916
|
+
*
|
|
917
|
+
* This option applies only if the endpoint returns a stream of events.
|
|
918
|
+
*
|
|
919
|
+
* @param error The error that occurred.
|
|
920
|
+
*/
|
|
921
|
+
onSseError?: (error: unknown) => void;
|
|
922
|
+
/**
|
|
923
|
+
* Callback invoked when an event is streamed from the server.
|
|
924
|
+
*
|
|
925
|
+
* This option applies only if the endpoint returns a stream of events.
|
|
926
|
+
*
|
|
927
|
+
* @param event Event streamed from the server.
|
|
928
|
+
* @returns Nothing (void).
|
|
929
|
+
*/
|
|
930
|
+
onSseEvent?: (event: StreamEvent<TData>) => void;
|
|
931
|
+
serializedBody?: RequestInit['body'];
|
|
932
|
+
/**
|
|
933
|
+
* Default retry delay in milliseconds.
|
|
934
|
+
*
|
|
935
|
+
* This option applies only if the endpoint returns a stream of events.
|
|
936
|
+
*
|
|
937
|
+
* @default 3000
|
|
938
|
+
*/
|
|
939
|
+
sseDefaultRetryDelay?: number;
|
|
940
|
+
/**
|
|
941
|
+
* Maximum number of retry attempts before giving up.
|
|
942
|
+
*/
|
|
943
|
+
sseMaxRetryAttempts?: number;
|
|
944
|
+
/**
|
|
945
|
+
* Maximum retry delay in milliseconds.
|
|
946
|
+
*
|
|
947
|
+
* Applies only when exponential backoff is used.
|
|
948
|
+
*
|
|
949
|
+
* This option applies only if the endpoint returns a stream of events.
|
|
950
|
+
*
|
|
951
|
+
* @default 30000
|
|
952
|
+
*/
|
|
953
|
+
sseMaxRetryDelay?: number;
|
|
954
|
+
/**
|
|
955
|
+
* Optional sleep function for retry backoff.
|
|
956
|
+
*
|
|
957
|
+
* Defaults to using `setTimeout`.
|
|
958
|
+
*/
|
|
959
|
+
sseSleepFn?: (ms: number) => Promise<void>;
|
|
960
|
+
url: string;
|
|
961
|
+
};
|
|
962
|
+
interface StreamEvent<TData = unknown> {
|
|
963
|
+
data: TData;
|
|
964
|
+
event?: string;
|
|
965
|
+
id?: string;
|
|
966
|
+
retry?: number;
|
|
967
|
+
}
|
|
968
|
+
type ServerSentEventsResult<TData = unknown, TReturn = void, TNext = unknown> = {
|
|
969
|
+
stream: AsyncGenerator<TData extends Record<string, unknown> ? TData[keyof TData] : TData, TReturn, TNext>;
|
|
970
|
+
};
|
|
971
|
+
|
|
972
|
+
type ErrInterceptor<Err, Res, Req, Options> = (error: Err,
|
|
973
|
+
/** response may be undefined due to a network error where no response object is produced */
|
|
974
|
+
response: Res | undefined,
|
|
975
|
+
/** request may be undefined, because error may be from building the request object itself */
|
|
976
|
+
request: Req | undefined, options: Options) => Err | Promise<Err>;
|
|
977
|
+
type ReqInterceptor<Req, Options> = (request: Req, options: Options) => Req | Promise<Req>;
|
|
978
|
+
type ResInterceptor<Res, Req, Options> = (response: Res, request: Req, options: Options) => Res | Promise<Res>;
|
|
979
|
+
declare class Interceptors<Interceptor> {
|
|
980
|
+
fns: Array<Interceptor | null>;
|
|
981
|
+
clear(): void;
|
|
982
|
+
eject(id: number | Interceptor): void;
|
|
983
|
+
exists(id: number | Interceptor): boolean;
|
|
984
|
+
getInterceptorIndex(id: number | Interceptor): number;
|
|
985
|
+
update(id: number | Interceptor, fn: Interceptor): number | Interceptor | false;
|
|
986
|
+
use(fn: Interceptor): number;
|
|
987
|
+
}
|
|
988
|
+
interface Middleware<Req, Res, Err, Options> {
|
|
989
|
+
error: Interceptors<ErrInterceptor<Err, Res, Req, Options>>;
|
|
990
|
+
request: Interceptors<ReqInterceptor<Req, Options>>;
|
|
991
|
+
response: Interceptors<ResInterceptor<Res, Req, Options>>;
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
type ResponseStyle = 'data' | 'fields';
|
|
995
|
+
interface Config<T extends ClientOptions$1 = ClientOptions$1> extends Omit<RequestInit, 'body' | 'headers' | 'method'>, Config$1 {
|
|
996
|
+
/**
|
|
997
|
+
* Base URL for all requests made by this client.
|
|
998
|
+
*/
|
|
999
|
+
baseUrl?: T['baseUrl'];
|
|
1000
|
+
/**
|
|
1001
|
+
* Fetch API implementation. You can use this option to provide a custom
|
|
1002
|
+
* fetch instance.
|
|
1003
|
+
*
|
|
1004
|
+
* @default globalThis.fetch
|
|
1005
|
+
*/
|
|
1006
|
+
fetch?: typeof fetch;
|
|
1007
|
+
/**
|
|
1008
|
+
* Please don't use the Fetch client for Next.js applications. The `next`
|
|
1009
|
+
* options won't have any effect.
|
|
1010
|
+
*
|
|
1011
|
+
* Install {@link https://www.npmjs.com/package/@hey-api/client-next `@hey-api/client-next`} instead.
|
|
1012
|
+
*/
|
|
1013
|
+
next?: never;
|
|
1014
|
+
/**
|
|
1015
|
+
* Return the response data parsed in a specified format. By default, `auto`
|
|
1016
|
+
* will infer the appropriate method from the `Content-Type` response header.
|
|
1017
|
+
* You can override this behavior with any of the {@link Body} methods.
|
|
1018
|
+
* Select `stream` if you don't want to parse response data at all.
|
|
1019
|
+
*
|
|
1020
|
+
* @default 'auto'
|
|
1021
|
+
*/
|
|
1022
|
+
parseAs?: 'arrayBuffer' | 'auto' | 'blob' | 'formData' | 'json' | 'stream' | 'text';
|
|
1023
|
+
/**
|
|
1024
|
+
* Should we return only data or multiple fields (data, error, response, etc.)?
|
|
1025
|
+
*
|
|
1026
|
+
* @default 'fields'
|
|
1027
|
+
*/
|
|
1028
|
+
responseStyle?: ResponseStyle;
|
|
1029
|
+
/**
|
|
1030
|
+
* Throw an error instead of returning it in the response?
|
|
1031
|
+
*
|
|
1032
|
+
* @default false
|
|
1033
|
+
*/
|
|
1034
|
+
throwOnError?: T['throwOnError'];
|
|
1035
|
+
}
|
|
1036
|
+
interface RequestOptions<TData = unknown, TResponseStyle extends ResponseStyle = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string> extends Config<{
|
|
1037
|
+
responseStyle: TResponseStyle;
|
|
1038
|
+
throwOnError: ThrowOnError;
|
|
1039
|
+
}>, Pick<ServerSentEventsOptions<TData>, 'onRequest' | 'onSseError' | 'onSseEvent' | 'sseDefaultRetryDelay' | 'sseMaxRetryAttempts' | 'sseMaxRetryDelay'> {
|
|
1040
|
+
/**
|
|
1041
|
+
* Any body that you want to add to your request.
|
|
1042
|
+
*
|
|
1043
|
+
* {@link https://developer.mozilla.org/docs/Web/API/fetch#body}
|
|
1044
|
+
*/
|
|
1045
|
+
body?: unknown;
|
|
1046
|
+
path?: Record<string, unknown>;
|
|
1047
|
+
query?: Record<string, unknown>;
|
|
1048
|
+
/**
|
|
1049
|
+
* Security mechanism(s) to use for the request.
|
|
1050
|
+
*/
|
|
1051
|
+
security?: ReadonlyArray<Auth>;
|
|
1052
|
+
url: Url;
|
|
1053
|
+
}
|
|
1054
|
+
interface ResolvedRequestOptions<TResponseStyle extends ResponseStyle = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string> extends RequestOptions<unknown, TResponseStyle, ThrowOnError, Url> {
|
|
1055
|
+
headers: Headers;
|
|
1056
|
+
serializedBody?: string;
|
|
1057
|
+
}
|
|
1058
|
+
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 : {
|
|
1059
|
+
data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
|
|
1060
|
+
request: Request;
|
|
1061
|
+
response: Response;
|
|
1062
|
+
}> : Promise<TResponseStyle extends 'data' ? (TData extends Record<string, unknown> ? TData[keyof TData] : TData) | undefined : ({
|
|
1063
|
+
data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
|
|
1064
|
+
error: undefined;
|
|
1065
|
+
} | {
|
|
1066
|
+
data: undefined;
|
|
1067
|
+
error: TError extends Record<string, unknown> ? TError[keyof TError] : TError;
|
|
1068
|
+
}) & {
|
|
1069
|
+
/** request may be undefined, because error may be from building the request object itself */
|
|
1070
|
+
request?: Request;
|
|
1071
|
+
/** response may be undefined, because error may be from building the request object itself or from a network error */
|
|
1072
|
+
response?: Response;
|
|
1073
|
+
}>;
|
|
1074
|
+
interface ClientOptions$1 {
|
|
1075
|
+
baseUrl?: string;
|
|
1076
|
+
responseStyle?: ResponseStyle;
|
|
1077
|
+
throwOnError?: boolean;
|
|
1078
|
+
}
|
|
1079
|
+
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>;
|
|
1080
|
+
type SseFn = <TData = unknown, _TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<never, TResponseStyle, ThrowOnError>, 'method'>) => Promise<ServerSentEventsResult<TData>>;
|
|
1081
|
+
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>;
|
|
1082
|
+
type BuildUrlFn = <TData extends {
|
|
1083
|
+
body?: unknown;
|
|
1084
|
+
path?: Record<string, unknown>;
|
|
1085
|
+
query?: Record<string, unknown>;
|
|
1086
|
+
url: string;
|
|
1087
|
+
}>(options: TData & Options<TData>) => string;
|
|
1088
|
+
type Client = Client$1<RequestFn, Config, MethodFn, BuildUrlFn, SseFn> & {
|
|
1089
|
+
interceptors: Middleware<Request, Response, unknown, ResolvedRequestOptions>;
|
|
1090
|
+
};
|
|
1091
|
+
interface TDataShape {
|
|
1092
|
+
body?: unknown;
|
|
1093
|
+
headers?: unknown;
|
|
1094
|
+
path?: unknown;
|
|
1095
|
+
query?: unknown;
|
|
1096
|
+
url: string;
|
|
1097
|
+
}
|
|
1098
|
+
type OmitKeys<T, K> = Pick<T, Exclude<keyof T, K>>;
|
|
1099
|
+
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'>);
|
|
1100
|
+
|
|
1101
|
+
type ClientOptions = {
|
|
1102
|
+
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 & {});
|
|
1103
|
+
};
|
|
1104
|
+
|
|
1105
|
+
type EmbeddedClient = Client;
|
|
1106
|
+
type ExtractLiterals<T> = T extends string ? string extends T ? never : T : never;
|
|
1107
|
+
type BaseUrl = ExtractLiterals<ClientOptions['baseUrl']>;
|
|
1108
|
+
|
|
1109
|
+
/**
|
|
1110
|
+
* Why the onboarding entry point is hidden from the signed-in user.
|
|
1111
|
+
*
|
|
1112
|
+
* Offer and bank-account onboarding both self-suppress from this, and
|
|
1113
|
+
* "nothing rendered" is indistinguishable between the reasons from the outside
|
|
1114
|
+
* — which makes a support question ("why doesn't this user see onboarding?")
|
|
1115
|
+
* unanswerable without a signal. Every onboarding suppression therefore emits
|
|
1116
|
+
* its reason (analytics event + `console.debug`), so the answer is a query
|
|
1117
|
+
* rather than a guess.
|
|
1118
|
+
*/
|
|
1119
|
+
declare const OnboardingSuppressionReason: {
|
|
1120
|
+
/** This user already has an account: their own widget-init status is ACTIVE or INACTIVE. */
|
|
1121
|
+
readonly UserAlreadyOnboarded: "user_already_onboarded";
|
|
1122
|
+
/**
|
|
1123
|
+
* This user was invited to an organization that already exists (widget-init
|
|
1124
|
+
* status INVITED), so the business is not theirs to apply for. Kept separate
|
|
1125
|
+
* from `UserAlreadyOnboarded` because it is not true that they are onboarded —
|
|
1126
|
+
* their account is pending disclosure acceptance — and conflating the two
|
|
1127
|
+
* would misreport why onboarding is hidden.
|
|
1128
|
+
*/
|
|
1129
|
+
readonly UserInvitedToOrganization: "user_invited_to_organization";
|
|
1130
|
+
/** The organization's bank-account application is COMPLETE — the business is onboarded. */
|
|
1131
|
+
readonly OrganizationApplicationComplete: "organization_application_complete";
|
|
1132
|
+
/**
|
|
1133
|
+
* Another member of the organization has a bank-account application in
|
|
1134
|
+
* progress. The backend allows one application per organization, so a
|
|
1135
|
+
* colleague must not start a second one.
|
|
1136
|
+
*/
|
|
1137
|
+
readonly OrganizationApplicationStartedByOther: "organization_application_started_by_other";
|
|
1138
|
+
/**
|
|
1139
|
+
* The organization's bank-account application was denied more than 30 days
|
|
1140
|
+
* ago, so the denial notice has stopped showing (EMBD-6174).
|
|
1141
|
+
*/
|
|
1142
|
+
readonly OrganizationApplicationDenialExpired: "organization_application_denial_expired";
|
|
1143
|
+
/**
|
|
1144
|
+
* The organization's bank-account application is in a status this widget
|
|
1145
|
+
* has no copy for, so it hides rather than offer a second application.
|
|
1146
|
+
*/
|
|
1147
|
+
readonly OrganizationApplicationStatusUnrecognized: "organization_application_status_unrecognized";
|
|
1148
|
+
};
|
|
1149
|
+
type OnboardingSuppressionReason = (typeof OnboardingSuppressionReason)[keyof typeof OnboardingSuppressionReason];
|
|
1150
|
+
|
|
1151
|
+
type LinkComponentProps = AnchorHTMLAttributes<HTMLAnchorElement> & {
|
|
1152
|
+
children?: ReactNode;
|
|
1153
|
+
};
|
|
1154
|
+
type LinkComponent = ComponentType<LinkComponentProps>;
|
|
1155
|
+
/**
|
|
1156
|
+
* The UI frameworks a widget's UI layer can render with.
|
|
1157
|
+
*
|
|
1158
|
+
* - `shadcn` — the shadcn/Tailwind implementation. This is the default and the
|
|
1159
|
+
* implicit fallback, so existing consumers that select nothing keep rendering
|
|
1160
|
+
* shadcn.
|
|
1161
|
+
* - `tecton` — the Tecton implementation.
|
|
1162
|
+
*
|
|
1163
|
+
* Declared as an `as const` object (not a TypeScript `enum`) per repo
|
|
1164
|
+
* convention.
|
|
1165
|
+
*/
|
|
1166
|
+
declare const UIFramework: {
|
|
1167
|
+
readonly Shadcn: "shadcn";
|
|
1168
|
+
readonly Tecton: "tecton";
|
|
1169
|
+
};
|
|
1170
|
+
type UIFramework = (typeof UIFramework)[keyof typeof UIFramework];
|
|
1171
|
+
|
|
1172
|
+
/**
|
|
1173
|
+
* The settable fields of the widget config cascade.
|
|
1174
|
+
*
|
|
1175
|
+
* This is the type accepted by {@link setGlobalWidgetConfig} and all provider props.
|
|
1176
|
+
* It intentionally excludes `initResponse`, which is populated automatically by the
|
|
1177
|
+
* provider after a successful fetch and must never be set manually.
|
|
1178
|
+
*
|
|
1179
|
+
* The `null` vs `undefined` distinction on `widgetToken` and `organizationId` is intentional:
|
|
1180
|
+
* - `undefined` — not set at this level; inherit from the nearest ancestor or global store.
|
|
1181
|
+
* - `null` — explicitly cleared; downstream sees "no value" even if an ancestor had one
|
|
1182
|
+
* (e.g. after logout or deliberate de-scoping).
|
|
1183
|
+
*
|
|
1184
|
+
* @see {@link WidgetConfig} for the resolved output type (includes `initResponse`)
|
|
1185
|
+
* @see {@link RootWidgetProvider}
|
|
1186
|
+
* @see {@link WidgetProvider}
|
|
1187
|
+
* @see {@link setGlobalWidgetConfig}
|
|
1188
|
+
*/
|
|
1189
|
+
interface WidgetConfigInput {
|
|
1190
|
+
/**
|
|
1191
|
+
* Base URL of the Tesouro embedded API (e.g. `"https://api.tesouro.com"`).
|
|
1192
|
+
*
|
|
1193
|
+
* When omitted the nearest ancestor's `baseUrl` or the global store value is used.
|
|
1194
|
+
* Changing this recreates the underlying HTTP client so all subsequent requests
|
|
1195
|
+
* go to the new host.
|
|
1196
|
+
*/
|
|
1197
|
+
baseUrl?: BaseUrl;
|
|
1198
|
+
/**
|
|
1199
|
+
* Bearer token used to authenticate widget requests.
|
|
1200
|
+
*
|
|
1201
|
+
* Injected as `Authorization: Bearer <token>` on every outgoing request via an
|
|
1202
|
+
* interceptor on the scoped HTTP client. Token updates are picked up immediately
|
|
1203
|
+
* without recreating the client.
|
|
1204
|
+
*
|
|
1205
|
+
* - `string` — send this token on all requests from this level downward.
|
|
1206
|
+
* - `null` — explicitly cleared; no auth header is sent and fetching is suppressed.
|
|
1207
|
+
* - `undefined` — not set at this level; inherit from the nearest ancestor or global store.
|
|
1208
|
+
*/
|
|
1209
|
+
widgetToken?: string | null;
|
|
1210
|
+
/**
|
|
1211
|
+
* Organization ID forwarded as the `x-organization-id` request header.
|
|
1212
|
+
*
|
|
1213
|
+
* Passed through {@link EmbedApiProvider} context rather than the auth interceptor,
|
|
1214
|
+
* so individual data-access hooks can opt in per-request.
|
|
1215
|
+
*
|
|
1216
|
+
* - `string` — use this organization for downstream data requests.
|
|
1217
|
+
* - `null` — explicitly cleared; queries that require an org ID will be disabled.
|
|
1218
|
+
* - `undefined` — not set at this level; inherit from the nearest ancestor or global store.
|
|
1219
|
+
*
|
|
1220
|
+
* When `undefined` across the **whole** cascade (no prop, no ancestor, no global
|
|
1221
|
+
* value), the resolved org defaults to the loaded `initResponse.organizationId`
|
|
1222
|
+
* (see {@link WidgetConfig.initResponse}) once the widget-init fetch settles. This
|
|
1223
|
+
* is the lowest-priority fallback — any explicit `string` or `null` at any cascade
|
|
1224
|
+
* level wins, and an explicit `null` is preserved and never falls back.
|
|
1225
|
+
*
|
|
1226
|
+
* Only an **explicit** ancestor org is inherited. An ancestor's *init-derived*
|
|
1227
|
+
* default does not propagate into a descendant that owns its own fetch (its own
|
|
1228
|
+
* `baseUrl`/`widgetToken`); such a descendant defaults to its own
|
|
1229
|
+
* `initResponse.organizationId` instead, so it never sends an ancestor's org with
|
|
1230
|
+
* its own token.
|
|
1231
|
+
*/
|
|
1232
|
+
organizationId?: string | null;
|
|
1233
|
+
/**
|
|
1234
|
+
* Optional post-creation hook for the scoped HTTP client.
|
|
1235
|
+
*
|
|
1236
|
+
* Called once after the provider creates its scoped {@link EmbeddedClient} and
|
|
1237
|
+
* applies the built-in `Authorization: Bearer` interceptor. Receives the
|
|
1238
|
+
* fully-configured client and must return the client to be used for the lifetime of
|
|
1239
|
+
* this provider level — either the same instance (with additional interceptors
|
|
1240
|
+
* attached) or a new client entirely.
|
|
1241
|
+
*
|
|
1242
|
+
* **Order:** The built-in auth interceptor is always applied first. `configClient`
|
|
1243
|
+
* is called on top of it, so any interceptors you add here run after auth is set.
|
|
1244
|
+
*
|
|
1245
|
+
* **Any prop triggers a scoped client.** A {@link WidgetProvider} creates its own
|
|
1246
|
+
* scoped client whenever any prop is set — including `configClient` alone, without
|
|
1247
|
+
* `baseUrl` or `widgetToken`. Only a fully props-free pass-through provider skips
|
|
1248
|
+
* client creation and never calls this function.
|
|
1249
|
+
*
|
|
1250
|
+
* **Stability:** The function reference is included in the client creation memo's
|
|
1251
|
+
* dependency array. Passing an unstable (inline) function recreates the client on
|
|
1252
|
+
* every render. Stabilize with `useCallback` or define the function outside the
|
|
1253
|
+
* component.
|
|
1254
|
+
*
|
|
1255
|
+
* **Cascade:** Inherits from the nearest ancestor when `undefined`. A child
|
|
1256
|
+
* {@link WidgetProvider} that creates its own scoped client will use the resolved
|
|
1257
|
+
* `configClient` from the cascade unless it provides its own override.
|
|
1258
|
+
*
|
|
1259
|
+
* @example
|
|
1260
|
+
* ```tsx
|
|
1261
|
+
* const addLogging = useCallback(
|
|
1262
|
+
* (client: EmbeddedClient) => {
|
|
1263
|
+
* client.interceptors.request.use((req) => {
|
|
1264
|
+
* console.log('[widget]', req.method, req.url);
|
|
1265
|
+
* return req;
|
|
1266
|
+
* });
|
|
1267
|
+
* return client;
|
|
1268
|
+
* },
|
|
1269
|
+
* [],
|
|
1270
|
+
* );
|
|
1271
|
+
*
|
|
1272
|
+
* <RootWidgetProvider
|
|
1273
|
+
* baseUrl="https://api.tesouro.com"
|
|
1274
|
+
* widgetToken={token}
|
|
1275
|
+
* configClient={addLogging}
|
|
1276
|
+
* >
|
|
1277
|
+
* <App />
|
|
1278
|
+
* </RootWidgetProvider>
|
|
1279
|
+
* ```
|
|
1280
|
+
*/
|
|
1281
|
+
configClient?: (client: EmbeddedClient) => EmbeddedClient;
|
|
1282
|
+
/**
|
|
1283
|
+
* Overrides the widget-gateway routing decision for the scoped HTTP client.
|
|
1284
|
+
*
|
|
1285
|
+
* Any caller reaching the Tesouro API with a widget token must route data
|
|
1286
|
+
* requests through the widget gateway: prefix the path with
|
|
1287
|
+
* `/api/widget-gateway/proxy` and carry the token as `X-Widget-Token`. The
|
|
1288
|
+
* provider applies both automatically per request when the request origin is
|
|
1289
|
+
* a known Tesouro API host (`WIDGET_GATEWAY_HOSTS`, derived from the
|
|
1290
|
+
* generated `ClientOptions['baseUrl']`); `/api/widget-gateway/*` paths (the
|
|
1291
|
+
* init round-trip) always pass through untouched.
|
|
1292
|
+
*
|
|
1293
|
+
* - `undefined` — decide from the request origin, as above. Inherits from
|
|
1294
|
+
* the nearest ancestor or global store like every other config field.
|
|
1295
|
+
* - `true` — always apply the rewrite, even for an unlisted base URL (e.g. a
|
|
1296
|
+
* custom domain in front of the gateway).
|
|
1297
|
+
* - `false` — never apply it. For hosts that route widget requests their own
|
|
1298
|
+
* way, such as a same-origin BFF whose `configClient` retargets every
|
|
1299
|
+
* request.
|
|
1300
|
+
*
|
|
1301
|
+
* Independent of {@link configClient}: a host that only adds a header keeps
|
|
1302
|
+
* the built-in routing, and the built-in interceptor runs before any
|
|
1303
|
+
* `configClient` interceptor.
|
|
1304
|
+
*/
|
|
1305
|
+
gatewayRouting?: boolean;
|
|
1306
|
+
/**
|
|
1307
|
+
* Component the embedded widgets should render in place of plain `<a>` tags.
|
|
1308
|
+
*
|
|
1309
|
+
* Pass e.g. Next.js's `Link` to make in-app navigation use the host router.
|
|
1310
|
+
* Cascades like other config: provider prop > nearest ancestor > global store.
|
|
1311
|
+
* When no value is set anywhere, widgets fall back to a plain `<a>` element.
|
|
1312
|
+
*/
|
|
1313
|
+
linkComponent?: LinkComponent;
|
|
1314
|
+
/**
|
|
1315
|
+
* Which UI framework the widget UI layer should render with.
|
|
1316
|
+
*
|
|
1317
|
+
* Lets a consuming context bind widgets to either the shadcn/Tailwind or the
|
|
1318
|
+
* Tecton implementation behind the same outward-facing API. The selection is
|
|
1319
|
+
* a presentation concern only — it cascades through the provider tree exactly
|
|
1320
|
+
* like {@link linkComponent} and is read by UI libraries via `useUIFramework`;
|
|
1321
|
+
* it never appears in any widget's feature-library or component props.
|
|
1322
|
+
*
|
|
1323
|
+
* - `'shadcn'` — the shadcn/Tailwind implementation.
|
|
1324
|
+
* - `'tecton'` — the Tecton implementation.
|
|
1325
|
+
* - `null` / `undefined` — not set at this level; inherit from the nearest
|
|
1326
|
+
* ancestor or global store, falling back to `shadcn` when unset everywhere.
|
|
1327
|
+
* `shadcn` is the implicit default, so existing consumers need no changes.
|
|
1328
|
+
*/
|
|
1329
|
+
uiFramework?: UIFramework | null;
|
|
1330
|
+
}
|
|
1331
|
+
/**
|
|
1332
|
+
* Props shared by every analytics-owner-capable widget provider.
|
|
1333
|
+
*
|
|
1334
|
+
* Combines the full settable cascade ({@link WidgetConfigInput}) with the
|
|
1335
|
+
* analytics opt-out honored by analytics owners. Both {@link RootWidgetProvider}
|
|
1336
|
+
* and {@link WidgetProvider} build their public props on top of this; the latter
|
|
1337
|
+
* adds error-boundary props of its own.
|
|
1338
|
+
*
|
|
1339
|
+
* @see {@link WidgetConfigInput} for per-field cascade and `null` vs omitted semantics
|
|
1340
|
+
*/
|
|
1341
|
+
interface WidgetProviderBaseProps extends WidgetConfigInput {
|
|
1342
|
+
/**
|
|
1343
|
+
* Opt out of all analytics capture and prevent PostHog from loading. Default `true`.
|
|
1344
|
+
*
|
|
1345
|
+
* Honored only by an analytics **owner** — a {@link RootWidgetProvider} or a
|
|
1346
|
+
* standalone {@link WidgetProvider} with no parent provider. When `false`,
|
|
1347
|
+
* owner-bound `track` calls in this subtree become no-ops and the PostHog
|
|
1348
|
+
* installer is never dynamically imported for this owner's environment.
|
|
1349
|
+
* Setting it on a nested {@link WidgetProvider} is ignored in v1 (a one-time
|
|
1350
|
+
* `console.warn` is emitted to make the no-op discoverable).
|
|
1351
|
+
*/
|
|
1352
|
+
analytics?: boolean;
|
|
1353
|
+
}
|
|
1354
|
+
|
|
1355
|
+
/**
|
|
1356
|
+
* Copy for the states `WidgetProvider` renders *itself*, in place of the widget:
|
|
1357
|
+
* the error-boundary fallback and the disclosures gate. A host overrides any
|
|
1358
|
+
* subset through the `providerLabels` prop, which cascades like
|
|
1359
|
+
* `disclosuresAcceptance`.
|
|
1360
|
+
*
|
|
1361
|
+
* Not named `Labels` on the public surface: a widget's own `labels` prop is a
|
|
1362
|
+
* different thing, and these two travel together on every widget's props type.
|
|
1363
|
+
*/
|
|
1364
|
+
interface WidgetProviderLabels {
|
|
1365
|
+
/** Default copy for the built-in error boundary fallback. */
|
|
1366
|
+
errorBoundaryFallback: string;
|
|
1367
|
+
/** Heading when init reports disclosures are required and not yet accepted. */
|
|
1368
|
+
disclosuresRequiredTitle: string;
|
|
1369
|
+
/** Heading while a token-only refresh leaves init stale for the live token. */
|
|
1370
|
+
disclosuresRefreshingTitle: string;
|
|
1371
|
+
/** Supporting copy while the accept action is withheld for a stale init. */
|
|
1372
|
+
disclosuresRefreshingDescription: string;
|
|
1373
|
+
}
|
|
1374
|
+
|
|
1375
|
+
/**
|
|
1376
|
+
* Props for {@link WidgetProvider}.
|
|
1377
|
+
*
|
|
1378
|
+
* All fields are optional. When **all** are omitted the provider is a transparent
|
|
1379
|
+
* pass-through: no fetch is issued and all resolved values cascade unchanged from
|
|
1380
|
+
* the nearest ancestor.
|
|
1381
|
+
*/
|
|
1382
|
+
interface WidgetProviderProps extends WidgetProviderBaseProps {
|
|
1383
|
+
/**
|
|
1384
|
+
* Fallback rendered when a render-time exception is caught inside this
|
|
1385
|
+
* provider's subtree. Pass either a `ReactNode` (rendered directly) or a
|
|
1386
|
+
* render-prop receiving `{ error, resetErrorBoundary }` from
|
|
1387
|
+
* `react-error-boundary`. Default is a plain `role="alert"` div whose copy
|
|
1388
|
+
* comes from `providerLabels.errorBoundaryFallback`.
|
|
1389
|
+
*/
|
|
1390
|
+
errorFallback?: ReactNode | ((props: FallbackProps) => ReactNode);
|
|
1391
|
+
/**
|
|
1392
|
+
* Called once when the boundary catches an error, before the fallback
|
|
1393
|
+
* renders. Use for telemetry / error tracking / partner logging. Exceptions
|
|
1394
|
+
* thrown from `onError` propagate per `react-error-boundary` semantics.
|
|
1395
|
+
*/
|
|
1396
|
+
onError?: (error: unknown, info: ErrorInfo) => void;
|
|
1397
|
+
/**
|
|
1398
|
+
* Accept surface shown when the caller owes disclosures — an INVITED
|
|
1399
|
+
* teammate (including `NOT_REQUIRED` orgs, who still need Accept to
|
|
1400
|
+
* activate) or an ACTIVE user who owes a new version. Pass
|
|
1401
|
+
* `<AcceptDisclosuresWidget />`. Cascades like `linkComponent`.
|
|
1402
|
+
* WidgetProvider cannot import the widget itself (cycle).
|
|
1403
|
+
*/
|
|
1404
|
+
disclosuresAcceptance?: ReactNode;
|
|
1405
|
+
/**
|
|
1406
|
+
* Overrides for the copy this provider renders in place of the widget: the
|
|
1407
|
+
* built-in error-boundary fallback and the disclosures gate. Any subset;
|
|
1408
|
+
* unlisted keys keep their defaults. Cascades like `linkComponent`.
|
|
1409
|
+
*
|
|
1410
|
+
* Named `providerLabels` rather than `labels` because a widget's own
|
|
1411
|
+
* `labels` prop sits alongside this one on the same props type.
|
|
1412
|
+
*/
|
|
1413
|
+
providerLabels?: Partial<WidgetProviderLabels>;
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1416
|
+
declare const USStateAbbreviation: {
|
|
1417
|
+
readonly Alabama: "AL";
|
|
1418
|
+
readonly Alaska: "AK";
|
|
1419
|
+
readonly Arizona: "AZ";
|
|
1420
|
+
readonly Arkansas: "AR";
|
|
1421
|
+
readonly California: "CA";
|
|
1422
|
+
readonly Colorado: "CO";
|
|
1423
|
+
readonly Connecticut: "CT";
|
|
1424
|
+
readonly Delaware: "DE";
|
|
1425
|
+
readonly DistrictOfColumbia: "DC";
|
|
1426
|
+
readonly Florida: "FL";
|
|
1427
|
+
readonly Georgia: "GA";
|
|
1428
|
+
readonly Hawaii: "HI";
|
|
1429
|
+
readonly Idaho: "ID";
|
|
1430
|
+
readonly Illinois: "IL";
|
|
1431
|
+
readonly Indiana: "IN";
|
|
1432
|
+
readonly Iowa: "IA";
|
|
1433
|
+
readonly Kansas: "KS";
|
|
1434
|
+
readonly Kentucky: "KY";
|
|
1435
|
+
readonly Louisiana: "LA";
|
|
1436
|
+
readonly Maine: "ME";
|
|
1437
|
+
readonly Maryland: "MD";
|
|
1438
|
+
readonly Massachusetts: "MA";
|
|
1439
|
+
readonly Michigan: "MI";
|
|
1440
|
+
readonly Minnesota: "MN";
|
|
1441
|
+
readonly Mississippi: "MS";
|
|
1442
|
+
readonly Missouri: "MO";
|
|
1443
|
+
readonly Montana: "MT";
|
|
1444
|
+
readonly Nebraska: "NE";
|
|
1445
|
+
readonly Nevada: "NV";
|
|
1446
|
+
readonly NewHampshire: "NH";
|
|
1447
|
+
readonly NewJersey: "NJ";
|
|
1448
|
+
readonly NewMexico: "NM";
|
|
1449
|
+
readonly NewYork: "NY";
|
|
1450
|
+
readonly NorthCarolina: "NC";
|
|
1451
|
+
readonly NorthDakota: "ND";
|
|
1452
|
+
readonly Ohio: "OH";
|
|
1453
|
+
readonly Oklahoma: "OK";
|
|
1454
|
+
readonly Oregon: "OR";
|
|
1455
|
+
readonly Pennsylvania: "PA";
|
|
1456
|
+
readonly RhodeIsland: "RI";
|
|
1457
|
+
readonly SouthCarolina: "SC";
|
|
1458
|
+
readonly SouthDakota: "SD";
|
|
1459
|
+
readonly Tennessee: "TN";
|
|
1460
|
+
readonly Texas: "TX";
|
|
1461
|
+
readonly Utah: "UT";
|
|
1462
|
+
readonly Vermont: "VT";
|
|
1463
|
+
readonly Virginia: "VA";
|
|
1464
|
+
readonly Washington: "WA";
|
|
1465
|
+
readonly WestVirginia: "WV";
|
|
1466
|
+
readonly Wisconsin: "WI";
|
|
1467
|
+
readonly Wyoming: "WY";
|
|
1468
|
+
};
|
|
1469
|
+
type USStateAbbreviation = (typeof USStateAbbreviation)[keyof typeof USStateAbbreviation];
|
|
1470
|
+
|
|
1471
|
+
/**
|
|
1472
|
+
* Legal disclosure URLs for the onboarding agreement step.
|
|
1473
|
+
*
|
|
1474
|
+
* Resolved by the host application (e.g. from white-label `onboardingTerms`
|
|
1475
|
+
* or bank disclosure PDFs) and passed into the widget — the published package
|
|
1476
|
+
* must not hard-code host/bank lookups.
|
|
1477
|
+
*/
|
|
1478
|
+
interface DisclosureLinks {
|
|
1479
|
+
termsHref?: string;
|
|
1480
|
+
privacyHref?: string;
|
|
1481
|
+
electronicCommunicationHref?: string;
|
|
1482
|
+
patriotActHref?: string;
|
|
1483
|
+
}
|
|
1484
|
+
|
|
1485
|
+
interface AdditionalOwnersLabels {
|
|
1486
|
+
heading: string;
|
|
1487
|
+
/** Why owners are asked for, under the heading. */
|
|
1488
|
+
subheading: string;
|
|
1489
|
+
/**
|
|
1490
|
+
* @deprecated Unused since the section always shows `subheading`, and the
|
|
1491
|
+
* empty state carries its own body. Kept so existing overrides still
|
|
1492
|
+
* type-check.
|
|
1493
|
+
*/
|
|
1494
|
+
emptySubheading: string;
|
|
1495
|
+
/** Asks whether the applicant is a beneficial owner, given the business name. */
|
|
1496
|
+
applicantOwnsQuestionTemplate: (businessName: string) => string;
|
|
1497
|
+
/** Stands in for the business name in the copy above until one is entered. */
|
|
1498
|
+
businessNameFallback: string;
|
|
1499
|
+
applicantOwnsYes: string;
|
|
1500
|
+
applicantOwnsNo: string;
|
|
1501
|
+
/** Badge beside the applicant's name in their own editor. */
|
|
1502
|
+
applicantBadge: string;
|
|
1503
|
+
/** The applicant's share field in their editor. */
|
|
1504
|
+
applicantOwnershipPercentage: string;
|
|
1505
|
+
/** Says where the read-only summary in the applicant's editor comes from. */
|
|
1506
|
+
applicantDetailsSourceNote: string;
|
|
1507
|
+
/** Summary parts in the applicant's editor, joined by `applicantSummarySeparator`. */
|
|
1508
|
+
applicantBornTemplate: (dateOfBirth: string) => string;
|
|
1509
|
+
applicantSsnEndingTemplate: (last4: string) => string;
|
|
1510
|
+
applicantSummarySeparator: string;
|
|
1511
|
+
/** Link from the applicant's editor back to the Personal details step. */
|
|
1512
|
+
editPersonalDetails: string;
|
|
1513
|
+
/** Accessible name of the pencil on the applicant's own row. */
|
|
1514
|
+
editApplicantOwnership: string;
|
|
1515
|
+
/** The owners section title on the Review step. */
|
|
1516
|
+
reviewSectionTitle: string;
|
|
1517
|
+
primaryOwnerShareLabel: string;
|
|
1518
|
+
/** Empty-state title, shown while nobody is listed. */
|
|
1519
|
+
emptyOwnersText: string;
|
|
1520
|
+
/** Empty-state body, given the business name. */
|
|
1521
|
+
emptyOwnersBodyTemplate: (businessName: string) => string;
|
|
1522
|
+
/** The empty state's own add button, which stands in for `addOwner`. */
|
|
1523
|
+
emptyOwnersAddOwner: string;
|
|
1524
|
+
addOwner: string;
|
|
1525
|
+
edit: string;
|
|
1526
|
+
/** Replaces the edit icon on an owner row whose details are incomplete. */
|
|
1527
|
+
completeDetails: string;
|
|
1528
|
+
remove: string;
|
|
1529
|
+
/** The applicant's own row: they are removed from the Personal step instead. */
|
|
1530
|
+
removePrimaryOwnerDisabled: string;
|
|
1531
|
+
/**
|
|
1532
|
+
* @deprecated Unused since the applicant edits their share in their own row.
|
|
1533
|
+
* Kept so existing overrides still type-check.
|
|
1534
|
+
*/
|
|
1535
|
+
editPrimaryOwnerDisabled: string;
|
|
1536
|
+
/**
|
|
1537
|
+
* @deprecated Unused since the applicant edits their share in their own row.
|
|
1538
|
+
* Kept so existing overrides still type-check.
|
|
1539
|
+
*/
|
|
1540
|
+
editPrimaryOwnerTooltip: string;
|
|
1541
|
+
/** Hover/focus tooltip on the applicant's disabled trash: why it is locked. */
|
|
1542
|
+
removePrimaryOwnerTooltip: string;
|
|
1543
|
+
/** Opens the read-only review of an owner the applicant has not confirmed. */
|
|
1544
|
+
startReview: string;
|
|
1545
|
+
deleteOwner: string;
|
|
1546
|
+
editOwner: string;
|
|
1547
|
+
confirmDetails: string;
|
|
1548
|
+
/** Screen-reader text for each row's status icon. */
|
|
1549
|
+
statusComplete: string;
|
|
1550
|
+
statusMissing: string;
|
|
1551
|
+
statusUnreviewed: string;
|
|
1552
|
+
inlineEditHeadingTemplate: (name: string) => string;
|
|
1553
|
+
missingFieldsAlert: string;
|
|
1554
|
+
allFieldsRequiredNote: string;
|
|
1555
|
+
reviewDateOfBirth: string;
|
|
1556
|
+
reviewSsn: string;
|
|
1557
|
+
reviewPhone: string;
|
|
1558
|
+
reviewHomeAddress: string;
|
|
1559
|
+
cancel: string;
|
|
1560
|
+
save: string;
|
|
1561
|
+
close: string;
|
|
1562
|
+
addOwnerSubmit: string;
|
|
1563
|
+
saveOwnerSubmit: string;
|
|
1564
|
+
ownerNameColumn: string;
|
|
1565
|
+
ownerShareColumn: string;
|
|
1566
|
+
ownerActionsColumn: string;
|
|
1567
|
+
formHeadingAdd: string;
|
|
1568
|
+
/**
|
|
1569
|
+
* @deprecated Unused since a saved owner is edited in its own row, under
|
|
1570
|
+
* `inlineEditHeadingTemplate`. Kept so existing overrides still type-check.
|
|
1571
|
+
*/
|
|
1572
|
+
formHeadingEdit: string;
|
|
1573
|
+
firstName: string;
|
|
1574
|
+
lastName: string;
|
|
1575
|
+
dateOfBirth: string;
|
|
1576
|
+
dateOfBirthPlaceholder: string;
|
|
1577
|
+
/** Shown under the date of birth field until it has an error. */
|
|
1578
|
+
dateOfBirthHint: string;
|
|
1579
|
+
/** A complete date that cannot be a birth date: in the future, or before 1900. */
|
|
1580
|
+
dateOfBirthInvalidError: string;
|
|
1581
|
+
ssn: string;
|
|
1582
|
+
/** Shown when an SSN is already stored and need not be retyped. */
|
|
1583
|
+
ssnOnFileTemplate: (last4: string) => string;
|
|
1584
|
+
ssnInvalid: string;
|
|
1585
|
+
ssnShow: string;
|
|
1586
|
+
ssnHide: string;
|
|
1587
|
+
homeAddress: string;
|
|
1588
|
+
city: string;
|
|
1589
|
+
state: string;
|
|
1590
|
+
statePlaceholder: string;
|
|
1591
|
+
zipCode: string;
|
|
1592
|
+
zipCodeInvalid: string;
|
|
1593
|
+
mobilePhoneNumber: string;
|
|
1594
|
+
mobilePhoneNumberInvalid: string;
|
|
1595
|
+
ownershipPercentage: string;
|
|
1596
|
+
ownershipPercentagePlaceholder: string;
|
|
1597
|
+
ownershipPercentageMinError: string;
|
|
1598
|
+
ownershipPercentageMaxError: string;
|
|
1599
|
+
/** Shown under a required field the user left blank. */
|
|
1600
|
+
requiredFieldError: string;
|
|
1601
|
+
/** Shown under a filled-in field that fails a rule with no message of its own. */
|
|
1602
|
+
invalidFieldError: string;
|
|
1603
|
+
/** Shown on an owners-list row whose saved details are incomplete or invalid. */
|
|
1604
|
+
ownerIncompleteError: string;
|
|
1605
|
+
/** Shown above the owner table when Next is pressed with the owner editor open. */
|
|
1606
|
+
ownerEditorOpenError: string;
|
|
1607
|
+
/** Required-field marker appended to field labels (e.g. ` *`). */
|
|
1608
|
+
requiredFieldMarker: string;
|
|
1609
|
+
/** Suffix shown after ownership percentage inputs (e.g. `%`). */
|
|
1610
|
+
percentSuffix: string;
|
|
1611
|
+
deleteOwnerHeading: string;
|
|
1612
|
+
deleteOwnerPromptBeforeName: string;
|
|
1613
|
+
deleteOwnerPromptAfterName: string;
|
|
1614
|
+
deleteOwnerConfirm: string;
|
|
1615
|
+
totalOwnershipExceedsTemplate: (total: number) => string;
|
|
1616
|
+
stateTitles?: Partial<Record<USStateAbbreviation, string>>;
|
|
1617
|
+
}
|
|
1618
|
+
declare const ADDITIONAL_OWNERS_LABELS_EN: AdditionalOwnersLabels;
|
|
1619
|
+
|
|
1620
|
+
interface BusinessDetailsLabels {
|
|
1621
|
+
heading: string;
|
|
1622
|
+
subheading: string;
|
|
1623
|
+
/** Shown at the top of the edit form, explaining `requiredFieldMarker`. */
|
|
1624
|
+
requiredFieldsNote: string;
|
|
1625
|
+
/** Appended to each required field's label. */
|
|
1626
|
+
requiredFieldMarker: string;
|
|
1627
|
+
companyLegalName: string;
|
|
1628
|
+
companyDbaName: string;
|
|
1629
|
+
businessAddress: string;
|
|
1630
|
+
city: string;
|
|
1631
|
+
state: string;
|
|
1632
|
+
statePlaceholder: string;
|
|
1633
|
+
zipCode: string;
|
|
1634
|
+
zipCodeInvalid: string;
|
|
1635
|
+
companyPhoneNumber: string;
|
|
1636
|
+
companyPhoneNumberInvalid: string;
|
|
1637
|
+
/** Shown under a required field the user left blank. */
|
|
1638
|
+
requiredFieldError: string;
|
|
1639
|
+
/** Shown under a filled-in field that fails a rule with no message of its own. */
|
|
1640
|
+
invalidFieldError: string;
|
|
1641
|
+
companyStructure: string;
|
|
1642
|
+
companyStructurePlaceholder: string;
|
|
1643
|
+
website: string;
|
|
1644
|
+
websiteInvalid: string;
|
|
1645
|
+
taxId: string;
|
|
1646
|
+
taxIdInvalid: string;
|
|
1647
|
+
/** Shown when a tax id is already stored and need not be retyped. */
|
|
1648
|
+
taxIdOnFileTemplate: (last4: string) => string;
|
|
1649
|
+
naicsCode: string;
|
|
1650
|
+
naicsCodePlaceholder: string;
|
|
1651
|
+
isAuthorizedQuestion: string;
|
|
1652
|
+
isAuthorizedYes: string;
|
|
1653
|
+
isAuthorizedNo: string;
|
|
1654
|
+
/** Heading above the attestation checkboxes on the terms step. */
|
|
1655
|
+
disclosuresHeading: string;
|
|
1656
|
+
disclosuresSubheading: string;
|
|
1657
|
+
/** Bold lead-in naming the disclosure checkbox, before its agreement copy. */
|
|
1658
|
+
disclosureAgreementLead: string;
|
|
1659
|
+
/** Use `{bankName}` for the sponsoring bank (e.g. "Zenith Bank"). */
|
|
1660
|
+
acceptDisclosuresPrefix: string;
|
|
1661
|
+
termsOfUse: string;
|
|
1662
|
+
privacyPolicy: string;
|
|
1663
|
+
acceptDisclosuresTermsPrivacyJoin: string;
|
|
1664
|
+
acceptDisclosuresAfterPrivacy: string;
|
|
1665
|
+
electronicCommunication: string;
|
|
1666
|
+
acceptDisclosuresAfterElectronic: string;
|
|
1667
|
+
patriotAct: string;
|
|
1668
|
+
/** Shown under an unticked attestation once Next has been pressed. */
|
|
1669
|
+
consentRequiredError: string;
|
|
1670
|
+
companyStructureOptions: Record<'CORPORATION_PUBLIC' | 'CORPORATION_PRIVATE' | 'CORPORATION_NOT_FOR_PROFIT' | 'LLC' | 'LLP' | 'PARTNERSHIP' | 'SOLE_PROPRIETORSHIP' | 'GOVERNMENT' | 'COOPERATIVE' | 'ASSOCIATION' | 'OTHER', string>;
|
|
1671
|
+
naicsTitles?: Record<string, string>;
|
|
1672
|
+
stateTitles?: Partial<Record<USStateAbbreviation, string>>;
|
|
1673
|
+
}
|
|
1674
|
+
declare const BUSINESS_DETAILS_LABELS_EN: BusinessDetailsLabels;
|
|
1675
|
+
|
|
1676
|
+
interface PersonalDetailsLabels {
|
|
1677
|
+
heading: string;
|
|
1678
|
+
subheading: string;
|
|
1679
|
+
/** Shown at the top of the edit form, explaining `requiredFieldMarker`. */
|
|
1680
|
+
requiredFieldsNote: string;
|
|
1681
|
+
/** Appended to each required field's label. */
|
|
1682
|
+
requiredFieldMarker: string;
|
|
1683
|
+
firstName: string;
|
|
1684
|
+
lastName: string;
|
|
1685
|
+
dateOfBirth: string;
|
|
1686
|
+
dateOfBirthPlaceholder: string;
|
|
1687
|
+
/** Shown under the date of birth field until it has an error. */
|
|
1688
|
+
dateOfBirthHint: string;
|
|
1689
|
+
/** A complete date that cannot be a birth date: in the future, or before 1900. */
|
|
1690
|
+
dateOfBirthInvalidError: string;
|
|
1691
|
+
dateOfBirthMinAgeError: string;
|
|
1692
|
+
ssn: string;
|
|
1693
|
+
/** Shown when an SSN is already stored and need not be retyped. */
|
|
1694
|
+
ssnOnFileTemplate: (last4: string) => string;
|
|
1695
|
+
ssnInvalid: string;
|
|
1696
|
+
ssnShow: string;
|
|
1697
|
+
ssnHide: string;
|
|
1698
|
+
homeAddress: string;
|
|
1699
|
+
city: string;
|
|
1700
|
+
state: string;
|
|
1701
|
+
statePlaceholder: string;
|
|
1702
|
+
zipCode: string;
|
|
1703
|
+
zipCodeInvalid: string;
|
|
1704
|
+
mobilePhoneNumber: string;
|
|
1705
|
+
mobilePhoneNumberInvalid: string;
|
|
1706
|
+
workEmail: string;
|
|
1707
|
+
workEmailInvalid: string;
|
|
1708
|
+
/** Shown under a required field the user left blank. */
|
|
1709
|
+
requiredFieldError: string;
|
|
1710
|
+
/** Shown under a filled-in field that fails a rule with no message of its own. */
|
|
1711
|
+
invalidFieldError: string;
|
|
1712
|
+
ownsOver25Question: string;
|
|
1713
|
+
ownsOver25SummaryLabel: string;
|
|
1714
|
+
ownsOver25Yes: string;
|
|
1715
|
+
ownsOver25No: string;
|
|
1716
|
+
ownershipPercentage: string;
|
|
1717
|
+
ownershipPercentagePlaceholder: string;
|
|
1718
|
+
ownershipPercentageRangeError: string;
|
|
1719
|
+
/** Suffix shown after ownership percentage inputs (e.g. `%`). */
|
|
1720
|
+
percentSuffix: string;
|
|
1721
|
+
stateTitles?: Partial<Record<USStateAbbreviation, string>>;
|
|
1722
|
+
}
|
|
1723
|
+
declare const PERSONAL_DETAILS_LABELS_EN: PersonalDetailsLabels;
|
|
1724
|
+
|
|
1725
|
+
interface ResultLabels {
|
|
1726
|
+
loadingMessage: string;
|
|
1727
|
+
successHeadingLine1: string;
|
|
1728
|
+
successBody: string;
|
|
1729
|
+
pendingHeadingLine1: string;
|
|
1730
|
+
pendingBody: string;
|
|
1731
|
+
pendingEmailBoxLead: string;
|
|
1732
|
+
navigateToDashboard: string;
|
|
1733
|
+
/** Use `{bankName}` for the sponsoring bank (e.g. "Zenith Bank"). */
|
|
1734
|
+
bankLogoAlt: string;
|
|
1735
|
+
/** Use `{bankName}` for the sponsoring bank (e.g. "Zenith Bank"). */
|
|
1736
|
+
fdicDisclaimer: string;
|
|
1737
|
+
}
|
|
1738
|
+
declare const RESULT_LABELS_EN: ResultLabels;
|
|
1739
|
+
|
|
1740
|
+
interface ApplicationReviewLabels {
|
|
1741
|
+
/** Visible text of each section's edit button. */
|
|
1742
|
+
editButton: string;
|
|
1743
|
+
/** Shown in a section that has no rows to list (e.g. no other owners). */
|
|
1744
|
+
emptySection: string;
|
|
1745
|
+
}
|
|
1746
|
+
|
|
1747
|
+
interface DeleteApplicationDialogLabels {
|
|
1748
|
+
title: string;
|
|
1749
|
+
/**
|
|
1750
|
+
* The description is split around the emphasised name of the save control so
|
|
1751
|
+
* the bold run can be restyled without translators touching markup.
|
|
1752
|
+
*/
|
|
1753
|
+
descriptionBeforeEmphasis: string;
|
|
1754
|
+
descriptionEmphasis: string;
|
|
1755
|
+
descriptionAfterEmphasis: string;
|
|
1756
|
+
/** Closes the prompt and returns to the form. */
|
|
1757
|
+
keepEditingButton: string;
|
|
1758
|
+
/** Permanently deletes the application. */
|
|
1759
|
+
deleteButton: string;
|
|
1760
|
+
/** Accessible name and tooltip of the dialog's close (X) button. */
|
|
1761
|
+
close: string;
|
|
1762
|
+
}
|
|
1763
|
+
|
|
1764
|
+
interface ApplicationDeletedScreenLabels {
|
|
1765
|
+
title: string;
|
|
1766
|
+
body: string;
|
|
1767
|
+
/** Restarts the flow on a fresh, empty application. */
|
|
1768
|
+
startNewApplicationButton: string;
|
|
1769
|
+
}
|
|
1770
|
+
|
|
1771
|
+
/**
|
|
1772
|
+
* Values the application-status copy can interpolate. The bank name comes from
|
|
1773
|
+
* widget init with `fallbackBankName` applied, so it is never missing. The rest
|
|
1774
|
+
* come from the `application-status` read, already formatted, and are absent
|
|
1775
|
+
* when it does not carry them (older applications have no recorded dates), so
|
|
1776
|
+
* every label has copy for both.
|
|
1777
|
+
*
|
|
1778
|
+
* There is no applicant email: the read does not return one, so the copy for
|
|
1779
|
+
* the caller's own application says "you" / "your email" where the mocks say
|
|
1780
|
+
* "[applicant email]".
|
|
1781
|
+
*/
|
|
1782
|
+
interface ApplicationStatusLabelValues {
|
|
1783
|
+
bankName: string;
|
|
1784
|
+
/** The applicant's full name, for either ownership. */
|
|
1785
|
+
applicantName?: string;
|
|
1786
|
+
/** When the application was started, formatted by `formatDate`. */
|
|
1787
|
+
startedOn?: string;
|
|
1788
|
+
/** When the application was submitted, formatted by `formatDate`. */
|
|
1789
|
+
submittedOn?: string;
|
|
1790
|
+
/** When the application was denied, formatted by `formatDate`. */
|
|
1791
|
+
deniedOn?: string;
|
|
1792
|
+
}
|
|
1793
|
+
/** Copy for one application state's card. */
|
|
1794
|
+
interface ApplicationStatusNoticeLabels {
|
|
1795
|
+
chipLabel: string;
|
|
1796
|
+
/** Omit for a state whose mock has no heading (the denied states). */
|
|
1797
|
+
heading?: (values: ApplicationStatusLabelValues) => string;
|
|
1798
|
+
body: (values: ApplicationStatusLabelValues) => string[];
|
|
1799
|
+
}
|
|
1800
|
+
/**
|
|
1801
|
+
* The card shown in place of the form when the organization already has a
|
|
1802
|
+
* bank-account application (EMBD-6174).
|
|
1803
|
+
*/
|
|
1804
|
+
interface ApplicationStatusLabels {
|
|
1805
|
+
/** Card title, e.g. "Nail It! Cash Account application". */
|
|
1806
|
+
title: string;
|
|
1807
|
+
/** Sponsor line opposite the title. Use `{bankName}` for the bank. */
|
|
1808
|
+
bankDisclosure: string;
|
|
1809
|
+
/**
|
|
1810
|
+
* The re-check control under the card, shown only when the host opts in with
|
|
1811
|
+
* `showApplicationStatusRefresh`.
|
|
1812
|
+
*/
|
|
1813
|
+
checkAgain: string;
|
|
1814
|
+
/**
|
|
1815
|
+
* Formats an application date (an ISO date-time from the status read). A
|
|
1816
|
+
* label, not a hardcoded formatter, so a host can localize it with the copy.
|
|
1817
|
+
*/
|
|
1818
|
+
formatDate: (isoDateTime: string) => string;
|
|
1819
|
+
draftStartedByOther: ApplicationStatusNoticeLabels;
|
|
1820
|
+
submittedByYou: ApplicationStatusNoticeLabels;
|
|
1821
|
+
submittedByOther: ApplicationStatusNoticeLabels;
|
|
1822
|
+
deniedByYou: ApplicationStatusNoticeLabels;
|
|
1823
|
+
deniedByOther: ApplicationStatusNoticeLabels;
|
|
1824
|
+
/**
|
|
1825
|
+
* Shown when a re-check moves a card to a status this widget has nothing to
|
|
1826
|
+
* say about (one added after it shipped, say), so the
|
|
1827
|
+
* re-check control still has somewhere to live.
|
|
1828
|
+
*/
|
|
1829
|
+
unavailable: ApplicationStatusNoticeLabels;
|
|
1830
|
+
}
|
|
1831
|
+
declare const APPLICATION_STATUS_LABELS_EN: ApplicationStatusLabels;
|
|
1832
|
+
interface BankAccountOnboardingWidgetLabels {
|
|
1833
|
+
/** In flow order (EMBD-5910): personal, business and owners, review, terms. */
|
|
1834
|
+
stepIndicator: {
|
|
1835
|
+
personal: string;
|
|
1836
|
+
business: string;
|
|
1837
|
+
review: string;
|
|
1838
|
+
terms: string;
|
|
1839
|
+
done: string;
|
|
1840
|
+
};
|
|
1841
|
+
businessDetails: PartialDeep<BusinessDetailsLabels>;
|
|
1842
|
+
personalDetails: Partial<PersonalDetailsLabels>;
|
|
1843
|
+
additionalOwners: Partial<AdditionalOwnersLabels>;
|
|
1844
|
+
/** The review step's summary cards. Section titles reuse each step's own. */
|
|
1845
|
+
applicationReview: Partial<ApplicationReviewLabels>;
|
|
1846
|
+
result: ResultLabels;
|
|
1847
|
+
/**
|
|
1848
|
+
* The prompt confirming "Delete application". Its bold run
|
|
1849
|
+
* defaults to `saveAndClose`, so it names the footer's save control.
|
|
1850
|
+
*/
|
|
1851
|
+
deleteApplicationDialog: Partial<DeleteApplicationDialogLabels>;
|
|
1852
|
+
/** The screen shown in place of the form once the application is deleted. */
|
|
1853
|
+
applicationDeleted: Partial<ApplicationDeletedScreenLabels>;
|
|
1854
|
+
/** Visible text of the footer's Back control on every step. */
|
|
1855
|
+
back: string;
|
|
1856
|
+
/**
|
|
1857
|
+
* The footer's Next control, naming the step it leads to. Keyed by the step
|
|
1858
|
+
* Next lands on; the terms step shows `submit` instead.
|
|
1859
|
+
*/
|
|
1860
|
+
nextToStep: {
|
|
1861
|
+
business: string;
|
|
1862
|
+
review: string;
|
|
1863
|
+
terms: string;
|
|
1864
|
+
};
|
|
1865
|
+
/**
|
|
1866
|
+
* The Back control's accessible name, naming the step it returns to. Its
|
|
1867
|
+
* visible text stays `back`. Keyed by the step Back lands on.
|
|
1868
|
+
*/
|
|
1869
|
+
backToStepAriaLabel: {
|
|
1870
|
+
personal: string;
|
|
1871
|
+
business: string;
|
|
1872
|
+
review: string;
|
|
1873
|
+
};
|
|
1874
|
+
submit: string;
|
|
1875
|
+
saveAndClose: string;
|
|
1876
|
+
/** The destructive footer control that opens the delete prompt. */
|
|
1877
|
+
deleteApplication: string;
|
|
1878
|
+
/**
|
|
1879
|
+
* @deprecated No longer shown: a confirmed delete now replaces the form with
|
|
1880
|
+
* a confirmation screen, labelled through `applicationDeleted`. Kept so
|
|
1881
|
+
* existing overrides still compile.
|
|
1882
|
+
*/
|
|
1883
|
+
applicationDeletedToast: string;
|
|
1884
|
+
/** Shown after "Save and continue later" or the close prompt's "Save changes" writes the application. */
|
|
1885
|
+
applicationSavedToast: string;
|
|
1886
|
+
businessReviewTitle: string;
|
|
1887
|
+
businessReviewSubtitle: string;
|
|
1888
|
+
personalReviewTitle: string;
|
|
1889
|
+
personalReviewSubtitle: string;
|
|
1890
|
+
reviewTitle: string;
|
|
1891
|
+
reviewSubtitle: string;
|
|
1892
|
+
/** Names the review step's owners edit button for assistive tech. */
|
|
1893
|
+
reviewOwnersEditAriaLabel: string;
|
|
1894
|
+
termsTitle: string;
|
|
1895
|
+
termsSubtitle: string;
|
|
1896
|
+
/** Shown when Next is pressed while an owner still needs reviewing. */
|
|
1897
|
+
ownersNeedReviewError: string;
|
|
1898
|
+
/** Shown when submitting the application fails. */
|
|
1899
|
+
submitFailedError: string;
|
|
1900
|
+
/** Shown when saving the application fails. */
|
|
1901
|
+
genericRetryError: string;
|
|
1902
|
+
/** Shown when deleting the application fails. */
|
|
1903
|
+
deleteFailedError?: string;
|
|
1904
|
+
/** Shown when the close prompt's "Save changes" has nothing valid to write. */
|
|
1905
|
+
saveDraftNothingValidError: string;
|
|
1906
|
+
/** Used when init has no bank name for disclaimers / result branding. */
|
|
1907
|
+
fallbackBankName: string;
|
|
1908
|
+
/**
|
|
1909
|
+
* Shell footer disclaimer. Use `{bankName}` for the sponsoring bank
|
|
1910
|
+
* (e.g. "Zenith Bank").
|
|
1911
|
+
*/
|
|
1912
|
+
shellFdicDisclaimer: string;
|
|
1913
|
+
/** The card shown instead of the form for an existing application. */
|
|
1914
|
+
applicationStatus: ApplicationStatusLabels;
|
|
1915
|
+
}
|
|
1916
|
+
|
|
1917
|
+
/**
|
|
1918
|
+
* Markers saying the server already holds an identifier. They make a blank
|
|
1919
|
+
* field valid and drop the identifier from the write, so a host that set one on
|
|
1920
|
+
* a fresh application would submit without an SSN or tax id.
|
|
1921
|
+
*/
|
|
1922
|
+
declare const STORED_IDENTIFIER_MARKERS: readonly ["ssnOnFileLast4", "taxIdOnFileLast4", "taxIdOnFileStructure"];
|
|
1923
|
+
type StoredIdentifierMarker = (typeof STORED_IDENTIFIER_MARKERS)[number];
|
|
1924
|
+
/** Host-supplied initial values, which may never carry the markers. */
|
|
1925
|
+
type HostSupplied<T> = Omit<T, StoredIdentifierMarker>;
|
|
1926
|
+
/** Host-supplied owners, which may not carry an id either. */
|
|
1927
|
+
type HostSuppliedOwner = Omit<AdditionalOwner, StoredIdentifierMarker | 'id'>;
|
|
1928
|
+
|
|
1929
|
+
interface BankAccountOnboardingWidgetInnerProps {
|
|
1930
|
+
onEmbeddedOnboardingCompletedSuccessfully: () => void;
|
|
1931
|
+
onNavigateToDashboard: () => void;
|
|
1932
|
+
/**
|
|
1933
|
+
* Notified once the widget determines it will render nothing, with why. A
|
|
1934
|
+
* host that mounts this widget based on its own copy of the same status (to
|
|
1935
|
+
* avoid a network round trip per widget instance, say) can end up
|
|
1936
|
+
* disagreeing with the widget's own live check — its request could still be
|
|
1937
|
+
* in flight, retrying, or have failed independently. This is the widget's
|
|
1938
|
+
* own resolution of "should I show anything, and why", so a host can use it
|
|
1939
|
+
* to swap to its real content instead of leaving this widget's empty render
|
|
1940
|
+
* in place.
|
|
1941
|
+
*
|
|
1942
|
+
* Only two reasons mean an account is provisioned, which matters for a host
|
|
1943
|
+
* deciding whether to also unlock account-scoped navigation:
|
|
1944
|
+
* - `UserAlreadyOnboarded`: the signed-in user already has an account.
|
|
1945
|
+
* - `OrganizationApplicationComplete`: the organization's application is
|
|
1946
|
+
* complete.
|
|
1947
|
+
*
|
|
1948
|
+
* The rest mean no account yet:
|
|
1949
|
+
* - `UserInvitedToOrganization`: invited to an organization that has an
|
|
1950
|
+
* account, but has not yet accepted its disclosures.
|
|
1951
|
+
* - `OrganizationApplicationStartedByOther`: another member's application is
|
|
1952
|
+
* still in flight.
|
|
1953
|
+
* - `OrganizationApplicationDenialExpired`: the application was denied more
|
|
1954
|
+
* than 30 days ago.
|
|
1955
|
+
* - `OrganizationApplicationStatusUnrecognized`: the application has a status
|
|
1956
|
+
* the widget does not recognize.
|
|
1957
|
+
*/
|
|
1958
|
+
onSuppressed?: (reason: OnboardingSuppressionReason) => void;
|
|
1959
|
+
labels?: PartialDeep<BankAccountOnboardingWidgetLabels>;
|
|
1960
|
+
initialBusinessDetails?: Partial<BusinessDetailsValues>;
|
|
1961
|
+
initialPersonalDetails?: Partial<PersonalDetailsValues>;
|
|
1962
|
+
initialAdditionalOwners?: AdditionalOwner[];
|
|
1963
|
+
/**
|
|
1964
|
+
* The application this session is carrying on with, when the applicant
|
|
1965
|
+
* already started one. Set by the resume layer, not by hosts.
|
|
1966
|
+
*/
|
|
1967
|
+
initialApplicationId?: string | null;
|
|
1968
|
+
/**
|
|
1969
|
+
* The token the resume read that produced `initialApplicationId` was made
|
|
1970
|
+
* under. Set by the resume layer, not by hosts.
|
|
1971
|
+
*/
|
|
1972
|
+
initialBoundAuthEpoch?: number;
|
|
1973
|
+
/**
|
|
1974
|
+
* Which sections the resumed application already holds everything on screen
|
|
1975
|
+
* for. Set by the resume layer, not by hosts; without it nothing counts as
|
|
1976
|
+
* held, so a save sends what it can.
|
|
1977
|
+
*/
|
|
1978
|
+
initialWrittenSections?: WrittenSections;
|
|
1979
|
+
/**
|
|
1980
|
+
* The application this session may still write to, with the auth epoch it
|
|
1981
|
+
* was bound under, or null once there is none. Reported up to the session
|
|
1982
|
+
* scope, not to hosts.
|
|
1983
|
+
*/
|
|
1984
|
+
onEditableDraftChange?: (draft: {
|
|
1985
|
+
applicationId: string;
|
|
1986
|
+
authEpoch: number;
|
|
1987
|
+
} | null) => void;
|
|
1988
|
+
/**
|
|
1989
|
+
* Called once the applicant has deleted the application, so the session
|
|
1990
|
+
* scope can show the deleted screen and later start a fresh one. Set by the
|
|
1991
|
+
* session scope, not by hosts.
|
|
1992
|
+
*/
|
|
1993
|
+
onApplicationDeleted?: () => void;
|
|
1994
|
+
/**
|
|
1995
|
+
* Called when a re-read of the status replaces a status card with the
|
|
1996
|
+
* form, so the session scope can re-take the resume decision it froze while
|
|
1997
|
+
* the card was showing. Set by the session scope, not by hosts.
|
|
1998
|
+
*/
|
|
1999
|
+
onNoticeReplacedByForm?: () => void;
|
|
2000
|
+
/**
|
|
2001
|
+
* Moves focus to the form's title, or to the status card's when the restart
|
|
2002
|
+
* lands on one, when it mounts. Set by the session scope after "Start a new
|
|
2003
|
+
* application", whose button unmounts with the deleted screen. Not set by
|
|
2004
|
+
* hosts.
|
|
2005
|
+
*/
|
|
2006
|
+
focusFormOnMount?: boolean;
|
|
2007
|
+
/**
|
|
2008
|
+
* Called once whatever `focusFormOnMount` focused has mounted, so the
|
|
2009
|
+
* session scope can drop the flag. Set by the session scope, not by hosts.
|
|
2010
|
+
*/
|
|
2011
|
+
onFocusFormOnMountDone?: () => void;
|
|
2012
|
+
bankLogoSrc?: string;
|
|
2013
|
+
/**
|
|
2014
|
+
* Host-resolved disclosure URLs for the business-details agreement step.
|
|
2015
|
+
* The published widget does not look up white-label/bank maps itself.
|
|
2016
|
+
*/
|
|
2017
|
+
disclosureLinks?: DisclosureLinks;
|
|
2018
|
+
/**
|
|
2019
|
+
* Puts a "Check again" control under the application status card, which
|
|
2020
|
+
* re-reads the organization's application.
|
|
2021
|
+
*
|
|
2022
|
+
* The widget providers disable `refetchOnWindowFocus`, so without it a
|
|
2023
|
+
* session looking at a colleague's application has no way to see that
|
|
2024
|
+
* colleague finish short of a reload. Opt-in because a host with its own
|
|
2025
|
+
* refresh affordance (or one that remounts the widget) would get two. The
|
|
2026
|
+
* control renders only with the card, never over the form or the widget's
|
|
2027
|
+
* own processing and result screens.
|
|
2028
|
+
*/
|
|
2029
|
+
showApplicationStatusRefresh?: boolean;
|
|
2030
|
+
/**
|
|
2031
|
+
* Called with `true` when the widget starts processing a submitted
|
|
2032
|
+
* application, and with `false` if it unmounts after that. In between, the
|
|
2033
|
+
* widget keeps its processing or result screen up whatever the status read
|
|
2034
|
+
* says, so a host that would otherwise replace the widget on a status change
|
|
2035
|
+
* (as `WidgetSuite` does when the widget would render nothing) should leave
|
|
2036
|
+
* it mounted while this is `true`.
|
|
2037
|
+
*/
|
|
2038
|
+
onResultPhaseChange?: (isInResultPhase: boolean) => void;
|
|
2039
|
+
}
|
|
2040
|
+
type BankAccountOnboardingWidgetProps = WidgetProviderProps & Omit<BankAccountOnboardingWidgetInnerProps, 'initialApplicationId' | 'initialBoundAuthEpoch' | 'initialWrittenSections' | 'initialBusinessDetails' | 'initialPersonalDetails' | 'initialAdditionalOwners' | 'onEditableDraftChange' | 'onApplicationDeleted' | 'onNoticeReplacedByForm' | 'focusFormOnMount' | 'onFocusFormOnMountDone'> & {
|
|
2041
|
+
initialBusinessDetails?: Partial<HostSupplied<BusinessDetailsValues>>;
|
|
2042
|
+
initialPersonalDetails?: Partial<HostSupplied<PersonalDetailsValues>>;
|
|
2043
|
+
initialAdditionalOwners?: HostSuppliedOwner[];
|
|
2044
|
+
};
|
|
2045
|
+
/** Which sections the server holds as the form shows them. */
|
|
2046
|
+
interface WrittenSections {
|
|
2047
|
+
business: boolean;
|
|
2048
|
+
owners: boolean;
|
|
2049
|
+
}
|
|
2050
|
+
declare function BankAccountOnboardingWidget({ baseUrl, widgetToken, organizationId, configClient, gatewayRouting, linkComponent, uiFramework, errorFallback, onError, analytics, disclosuresAcceptance, providerLabels, ...innerProps }: BankAccountOnboardingWidgetProps): React.JSX.Element;
|
|
2051
|
+
|
|
2052
|
+
export { ADDITIONAL_OWNERS_LABELS_EN, APPLICATION_STATUS_LABELS_EN, BUSINESS_DETAILS_LABELS_EN, BankAccountOnboardingWidget, OnboardingSuppressionReason, PERSONAL_DETAILS_LABELS_EN, RESULT_LABELS_EN };
|
|
2053
|
+
export type { AdditionalOwner, AdditionalOwnersLabels, ApplicationStatusLabelValues, ApplicationStatusLabels, ApplicationStatusNoticeLabels, BankAccountOnboardingWidgetLabels, BankAccountOnboardingWidgetProps, BusinessDetailsLabels, BusinessDetailsValues, CompanyStructureValue, DisclosureLinks, PersonalDetailsLabels, PersonalDetailsValues, ResultLabels };
|