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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +7 -0
  3. package/README.md +316 -2
  4. package/dist/caretRange.d.ts +13 -0
  5. package/dist/caretRange.d.ts.map +1 -0
  6. package/dist/entries.generated.d.ts +34 -0
  7. package/dist/entries.generated.d.ts.map +1 -0
  8. package/dist/index.d.ts +19 -0
  9. package/dist/index.d.ts.map +1 -0
  10. package/dist/index.js +208 -0
  11. package/dist/loader.d.ts +66 -0
  12. package/dist/loader.d.ts.map +1 -0
  13. package/dist/react/experimental/BalanceHistoryWidget.d.ts +1382 -0
  14. package/dist/react/experimental/QuickViewWidget.d.ts +888 -0
  15. package/dist/react/experimental/RemoteCheckCapture.d.ts +714 -0
  16. package/dist/react/experimental/index.d.ts +1776 -0
  17. package/dist/react/index.d.ts +7429 -0
  18. package/dist/react/lib/AcceptDisclosuresWidget.d.ts +1457 -0
  19. package/dist/react/lib/BalancesWidget.d.ts +647 -0
  20. package/dist/react/lib/BankAccountOnboardingWidget.d.ts +2053 -0
  21. package/dist/react/lib/BankAccountsWidget.d.ts +773 -0
  22. package/dist/react/lib/BankingComplianceBannerWidget.d.ts +647 -0
  23. package/dist/react/lib/BillPayWidget.d.ts +651 -0
  24. package/dist/react/lib/CardDetailsWidget.d.ts +1647 -0
  25. package/dist/react/lib/CounterpartsWidget.d.ts +1698 -0
  26. package/dist/react/lib/CounterpartsWidgetPublic.d.ts +1697 -0
  27. package/dist/react/lib/CreditCardsWidget.d.ts +2153 -0
  28. package/dist/react/lib/DebitCardsWidget.d.ts +2149 -0
  29. package/dist/react/lib/ExpenseManagementWidget.d.ts +835 -0
  30. package/dist/react/lib/InsightsWidget.d.ts +696 -0
  31. package/dist/react/lib/LinkedAccountsWidget.d.ts +726 -0
  32. package/dist/react/lib/OfferWidget.d.ts +1421 -0
  33. package/dist/react/lib/ReceivablesWidget.d.ts +2556 -0
  34. package/dist/react/lib/RecentActivityWidget.d.ts +655 -0
  35. package/dist/react/lib/SettingsWidget.d.ts +775 -0
  36. package/dist/react/lib/TransfersWidget.d.ts +794 -0
  37. package/dist/react/lib/WidgetProvider.d.ts +1305 -0
  38. package/dist/react/lib/WidgetProviderPublic.d.ts +619 -0
  39. package/dist/react/lib/WidgetSuite.d.ts +5664 -0
  40. package/dist/stylesheet.d.ts +3 -0
  41. package/dist/stylesheet.d.ts.map +1 -0
  42. package/package.json +94 -4
@@ -0,0 +1,1647 @@
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
+ /** Accessible copy for the panel header's controls. */
698
+ interface CardDetailsHeaderLabels {
699
+ /** Fallback title when the card has no nickname. */
700
+ untitledCard: string;
701
+ /** Accessible name for the kebab that opens the card actions menu. */
702
+ menuTriggerAriaLabel: string;
703
+ /** Accessible name for the close (X) control. */
704
+ closeAriaLabel: string;
705
+ }
706
+ /** Accessible copy for the simplified card face. */
707
+ interface CardDetailsCardFaceLabels {
708
+ /** Alt text for the bank logo when the caller supplies no `bankLogoAlt`. */
709
+ bankLogoAlt: string;
710
+ }
711
+ /** Row headings and per-row copy affordance names for the details table. */
712
+ interface CardDetailsFieldLabels {
713
+ detailsHeading: string;
714
+ cardholder: string;
715
+ nickname: string;
716
+ /**
717
+ * Heading for the billing-address block: one heading, with a copy control
718
+ * beside each populated address line.
719
+ */
720
+ billingAddress: string;
721
+ /** Sub-header over the merchant categories / velocity control rows. */
722
+ cardControlsHeading: string;
723
+ allowedCategories: string;
724
+ spendLimit: string;
725
+ perTransactionMax: string;
726
+ /** Stands in for a row whose value the card does not carry. */
727
+ emptyValue: string;
728
+ /** @deprecated The cardholder detail has no copy control. */
729
+ copyCardholderAriaLabel: string;
730
+ /** @deprecated The nickname detail has no copy control. */
731
+ copyNicknameAriaLabel: string;
732
+ /** @deprecated Address lines have individual copy controls. */
733
+ copyBillingAddressAriaLabel: string;
734
+ copyBillingAddressLine1AriaLabel: string;
735
+ copyBillingAddressLine2AriaLabel: string;
736
+ copyBillingAddressCityStateAriaLabel: string;
737
+ copyBillingAddressPostalCodeAriaLabel: string;
738
+ copiedLabel: string;
739
+ }
740
+ /** Copy for the controls the owner can switch on alongside the details. */
741
+ interface CardDetailsActionLabels {
742
+ /** Primary control that opens the Activate Card form. */
743
+ activateCard: string;
744
+ /** Secondary control that asks the owner to reveal the card's credentials. */
745
+ viewCard: string;
746
+ /** The same control, once the credentials are on screen. */
747
+ hideCard: string;
748
+ }
749
+ /** Copy for the nickname row's inline editor. */
750
+ interface CardDetailsNicknameLabels {
751
+ edit: string;
752
+ /** Accessible name for the control that opens the editor. */
753
+ editAriaLabel: string;
754
+ /** Accessible name for the editor's text field. */
755
+ inputAriaLabel: string;
756
+ save: string;
757
+ cancel: string;
758
+ /** Shown under the editor when the save failed. */
759
+ errorDescription: string;
760
+ }
761
+ /** Copy for the card lock control and for the locked card it produces. */
762
+ interface CardDetailsLockLabels {
763
+ lockCard: string;
764
+ /** The same control, once the card is locked. */
765
+ unlockCard: string;
766
+ /** Pill stamped across the card face while it is locked. */
767
+ cardFaceLabel: string;
768
+ /** Sentence under the controls while the card is locked. */
769
+ lockedDescription: string;
770
+ /**
771
+ * The same sentence for a reader who has no Unlock control, so it stops short
772
+ * of promising one. Reachable: reveal and lock are entitled separately, so a
773
+ * session can see a locked card it cannot unlock.
774
+ */
775
+ lockedDescriptionWithoutUnlock: string;
776
+ /** Shown next to the control when a lock change failed. */
777
+ errorDescription: string;
778
+ }
779
+ /**
780
+ * Copy for the revealed card credentials. The values themselves never have a
781
+ * default here — the panel is handed them or renders the field blank.
782
+ */
783
+ interface CardDetailsCredentialsLabels {
784
+ cardNumber: string;
785
+ expirationDate: string;
786
+ securityCode: string;
787
+ copyCardNumberAriaLabel: string;
788
+ copyExpirationDateAriaLabel: string;
789
+ copySecurityCodeAriaLabel: string;
790
+ copiedLabel: string;
791
+ /** Shown next to the control when the reveal failed. */
792
+ errorDescription: string;
793
+ }
794
+ /** Copy for the three non-loaded screens. */
795
+ interface CardDetailsStatusScreenLabels {
796
+ /** Accessible name announced while the panel is loading. */
797
+ loadingAriaLabel: string;
798
+ errorTitle: string;
799
+ errorDescription: string;
800
+ errorRetry: string;
801
+ notFoundTitle: string;
802
+ notFoundDescription: string;
803
+ }
804
+ interface CardDetailsPanelLabels {
805
+ header: CardDetailsHeaderLabels;
806
+ cardFace: CardDetailsCardFaceLabels;
807
+ fields: CardDetailsFieldLabels;
808
+ actions: CardDetailsActionLabels;
809
+ nickname: CardDetailsNicknameLabels;
810
+ lock: CardDetailsLockLabels;
811
+ credentials: CardDetailsCredentialsLabels;
812
+ status: CardDetailsStatusScreenLabels;
813
+ }
814
+
815
+ /** Chrome around the form. */
816
+ interface ActivateCardHeaderLabels {
817
+ title: string;
818
+ /** Accessible name for the close (X) control. */
819
+ closeAriaLabel: string;
820
+ }
821
+ /** Accessible copy for the card face this panel reuses. */
822
+ interface ActivateCardCardFaceLabels {
823
+ /** Alt text for the bank logo when the caller supplies no `bankLogoAlt`. */
824
+ bankLogoAlt: string;
825
+ }
826
+ /** Field headings, placeholders and the copy behind each affordance. */
827
+ interface ActivateCardFieldLabels {
828
+ expirationDate: string;
829
+ expirationDatePlaceholder: string;
830
+ securityCode: string;
831
+ securityCodePlaceholder: string;
832
+ /** Accessible name for the (?) control that reveals the explanation. */
833
+ securityCodeInfoAriaLabel: string;
834
+ /** The explanation itself, shown in the tooltip. */
835
+ securityCodeInfo: string;
836
+ }
837
+ /** One message per failure the panel can mark. */
838
+ interface ActivateCardValidationLabels {
839
+ impossibleMonth: string;
840
+ pastExpiration: string;
841
+ /**
842
+ * Shown when the server rejects the pair. Names both values because the
843
+ * verify endpoint withholds which one missed — see `ActivateCardFormErrors`.
844
+ */
845
+ verificationRejected: string;
846
+ }
847
+ /** The CTA and the two screens that replace or accompany the form. */
848
+ interface ActivateCardStatusLabels {
849
+ submit: string;
850
+ /** Accessible name announced while the activation is in flight. */
851
+ submittingAriaLabel: string;
852
+ successTitle: string;
853
+ successDescription: string;
854
+ successCardholderLabel: string;
855
+ successLastFourLabel: string;
856
+ successFormatLabel: string;
857
+ /** Label for the optional post-success control. */
858
+ done: string;
859
+ /** Fallback failure copy when the owner supplies no `errorMessage`. */
860
+ errorDescription: string;
861
+ }
862
+ interface ActivateCardPanelLabels {
863
+ header: ActivateCardHeaderLabels;
864
+ cardFace: ActivateCardCardFaceLabels;
865
+ fields: ActivateCardFieldLabels;
866
+ validation: ActivateCardValidationLabels;
867
+ status: ActivateCardStatusLabels;
868
+ }
869
+
870
+ type AuthToken = string | undefined;
871
+ interface Auth {
872
+ /**
873
+ * Which part of the request do we use to send the auth?
874
+ *
875
+ * @default 'header'
876
+ */
877
+ in?: 'header' | 'query' | 'cookie';
878
+ /**
879
+ * A unique identifier for the security scheme.
880
+ *
881
+ * Defined only when there are multiple security schemes whose `Auth`
882
+ * shape would otherwise be identical.
883
+ */
884
+ key?: string;
885
+ /**
886
+ * Header or query parameter name.
887
+ *
888
+ * @default 'Authorization'
889
+ */
890
+ name?: string;
891
+ scheme?: 'basic' | 'bearer';
892
+ type: 'apiKey' | 'http';
893
+ }
894
+
895
+ interface SerializerOptions<T> {
896
+ /**
897
+ * @default true
898
+ */
899
+ explode: boolean;
900
+ style: T;
901
+ }
902
+ type ArrayStyle = 'form' | 'spaceDelimited' | 'pipeDelimited';
903
+ type ObjectStyle = 'form' | 'deepObject';
904
+
905
+ type QuerySerializer = (query: Record<string, unknown>) => string;
906
+ type BodySerializer = (body: unknown) => unknown;
907
+ type QuerySerializerOptionsObject = {
908
+ allowReserved?: boolean;
909
+ array?: Partial<SerializerOptions<ArrayStyle>>;
910
+ object?: Partial<SerializerOptions<ObjectStyle>>;
911
+ };
912
+ type QuerySerializerOptions = QuerySerializerOptionsObject & {
913
+ /**
914
+ * Per-parameter serialization overrides. When provided, these settings
915
+ * override the global array/object settings for specific parameter names.
916
+ */
917
+ parameters?: Record<string, QuerySerializerOptionsObject>;
918
+ };
919
+
920
+ type HttpMethod = 'connect' | 'delete' | 'get' | 'head' | 'options' | 'patch' | 'post' | 'put' | 'trace';
921
+ type Client$1<RequestFn = never, Config = unknown, MethodFn = never, BuildUrlFn = never, SseFn = never> = {
922
+ /**
923
+ * Returns the final request URL.
924
+ */
925
+ buildUrl: BuildUrlFn;
926
+ getConfig: () => Config;
927
+ request: RequestFn;
928
+ setConfig: (config: Config) => Config;
929
+ } & {
930
+ [K in HttpMethod]: MethodFn;
931
+ } & ([SseFn] extends [never] ? {
932
+ sse?: never;
933
+ } : {
934
+ sse: {
935
+ [K in HttpMethod]: SseFn;
936
+ };
937
+ });
938
+ interface Config$1 {
939
+ /**
940
+ * Auth token or a function returning auth token. The resolved value will be
941
+ * added to the request payload as defined by its `security` array.
942
+ */
943
+ auth?: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken;
944
+ /**
945
+ * A function for serializing request body parameter. By default,
946
+ * {@link JSON.stringify()} will be used.
947
+ */
948
+ bodySerializer?: BodySerializer | null;
949
+ /**
950
+ * An object containing any HTTP headers that you want to pre-populate your
951
+ * `Headers` object with.
952
+ *
953
+ * {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more}
954
+ */
955
+ headers?: RequestInit['headers'] | Record<string, string | number | boolean | (string | number | boolean)[] | null | undefined | unknown>;
956
+ /**
957
+ * The request method.
958
+ *
959
+ * {@link https://developer.mozilla.org/docs/Web/API/fetch#method See more}
960
+ */
961
+ method?: Uppercase<HttpMethod>;
962
+ /**
963
+ * A function for serializing request query parameters. By default, arrays
964
+ * will be exploded in form style, objects will be exploded in deepObject
965
+ * style, and reserved characters are percent-encoded.
966
+ *
967
+ * This method will have no effect if the native `paramsSerializer()` Axios
968
+ * API function is used.
969
+ *
970
+ * {@link https://swagger.io/docs/specification/serialization/#query View examples}
971
+ */
972
+ querySerializer?: QuerySerializer | QuerySerializerOptions;
973
+ /**
974
+ * A function validating request data. This is useful if you want to ensure
975
+ * the request conforms to the desired shape, so it can be safely sent to
976
+ * the server.
977
+ */
978
+ requestValidator?: (data: unknown) => Promise<unknown>;
979
+ /**
980
+ * A function transforming response data before it's returned. This is useful
981
+ * for post-processing data, e.g., converting ISO strings into Date objects.
982
+ */
983
+ responseTransformer?: (data: unknown) => Promise<unknown>;
984
+ /**
985
+ * A function validating response data. This is useful if you want to ensure
986
+ * the response conforms to the desired shape, so it can be safely passed to
987
+ * the transformers and returned to the user.
988
+ */
989
+ responseValidator?: (data: unknown) => Promise<unknown>;
990
+ }
991
+
992
+ type ServerSentEventsOptions<TData = unknown> = Omit<RequestInit, 'method'> & Pick<Config$1, 'method' | 'responseTransformer' | 'responseValidator'> & {
993
+ /**
994
+ * Fetch API implementation. You can use this option to provide a custom
995
+ * fetch instance.
996
+ *
997
+ * @default globalThis.fetch
998
+ */
999
+ fetch?: typeof fetch;
1000
+ /**
1001
+ * Implementing clients can call request interceptors inside this hook.
1002
+ */
1003
+ onRequest?: (url: string, init: RequestInit) => Promise<Request>;
1004
+ /**
1005
+ * Callback invoked when a network or parsing error occurs during streaming.
1006
+ *
1007
+ * This option applies only if the endpoint returns a stream of events.
1008
+ *
1009
+ * @param error The error that occurred.
1010
+ */
1011
+ onSseError?: (error: unknown) => void;
1012
+ /**
1013
+ * Callback invoked when an event is streamed from the server.
1014
+ *
1015
+ * This option applies only if the endpoint returns a stream of events.
1016
+ *
1017
+ * @param event Event streamed from the server.
1018
+ * @returns Nothing (void).
1019
+ */
1020
+ onSseEvent?: (event: StreamEvent<TData>) => void;
1021
+ serializedBody?: RequestInit['body'];
1022
+ /**
1023
+ * Default retry delay in milliseconds.
1024
+ *
1025
+ * This option applies only if the endpoint returns a stream of events.
1026
+ *
1027
+ * @default 3000
1028
+ */
1029
+ sseDefaultRetryDelay?: number;
1030
+ /**
1031
+ * Maximum number of retry attempts before giving up.
1032
+ */
1033
+ sseMaxRetryAttempts?: number;
1034
+ /**
1035
+ * Maximum retry delay in milliseconds.
1036
+ *
1037
+ * Applies only when exponential backoff is used.
1038
+ *
1039
+ * This option applies only if the endpoint returns a stream of events.
1040
+ *
1041
+ * @default 30000
1042
+ */
1043
+ sseMaxRetryDelay?: number;
1044
+ /**
1045
+ * Optional sleep function for retry backoff.
1046
+ *
1047
+ * Defaults to using `setTimeout`.
1048
+ */
1049
+ sseSleepFn?: (ms: number) => Promise<void>;
1050
+ url: string;
1051
+ };
1052
+ interface StreamEvent<TData = unknown> {
1053
+ data: TData;
1054
+ event?: string;
1055
+ id?: string;
1056
+ retry?: number;
1057
+ }
1058
+ type ServerSentEventsResult<TData = unknown, TReturn = void, TNext = unknown> = {
1059
+ stream: AsyncGenerator<TData extends Record<string, unknown> ? TData[keyof TData] : TData, TReturn, TNext>;
1060
+ };
1061
+
1062
+ type ErrInterceptor<Err, Res, Req, Options> = (error: Err,
1063
+ /** response may be undefined due to a network error where no response object is produced */
1064
+ response: Res | undefined,
1065
+ /** request may be undefined, because error may be from building the request object itself */
1066
+ request: Req | undefined, options: Options) => Err | Promise<Err>;
1067
+ type ReqInterceptor<Req, Options> = (request: Req, options: Options) => Req | Promise<Req>;
1068
+ type ResInterceptor<Res, Req, Options> = (response: Res, request: Req, options: Options) => Res | Promise<Res>;
1069
+ declare class Interceptors<Interceptor> {
1070
+ fns: Array<Interceptor | null>;
1071
+ clear(): void;
1072
+ eject(id: number | Interceptor): void;
1073
+ exists(id: number | Interceptor): boolean;
1074
+ getInterceptorIndex(id: number | Interceptor): number;
1075
+ update(id: number | Interceptor, fn: Interceptor): number | Interceptor | false;
1076
+ use(fn: Interceptor): number;
1077
+ }
1078
+ interface Middleware<Req, Res, Err, Options> {
1079
+ error: Interceptors<ErrInterceptor<Err, Res, Req, Options>>;
1080
+ request: Interceptors<ReqInterceptor<Req, Options>>;
1081
+ response: Interceptors<ResInterceptor<Res, Req, Options>>;
1082
+ }
1083
+
1084
+ type ResponseStyle = 'data' | 'fields';
1085
+ interface Config<T extends ClientOptions$1 = ClientOptions$1> extends Omit<RequestInit, 'body' | 'headers' | 'method'>, Config$1 {
1086
+ /**
1087
+ * Base URL for all requests made by this client.
1088
+ */
1089
+ baseUrl?: T['baseUrl'];
1090
+ /**
1091
+ * Fetch API implementation. You can use this option to provide a custom
1092
+ * fetch instance.
1093
+ *
1094
+ * @default globalThis.fetch
1095
+ */
1096
+ fetch?: typeof fetch;
1097
+ /**
1098
+ * Please don't use the Fetch client for Next.js applications. The `next`
1099
+ * options won't have any effect.
1100
+ *
1101
+ * Install {@link https://www.npmjs.com/package/@hey-api/client-next `@hey-api/client-next`} instead.
1102
+ */
1103
+ next?: never;
1104
+ /**
1105
+ * Return the response data parsed in a specified format. By default, `auto`
1106
+ * will infer the appropriate method from the `Content-Type` response header.
1107
+ * You can override this behavior with any of the {@link Body} methods.
1108
+ * Select `stream` if you don't want to parse response data at all.
1109
+ *
1110
+ * @default 'auto'
1111
+ */
1112
+ parseAs?: 'arrayBuffer' | 'auto' | 'blob' | 'formData' | 'json' | 'stream' | 'text';
1113
+ /**
1114
+ * Should we return only data or multiple fields (data, error, response, etc.)?
1115
+ *
1116
+ * @default 'fields'
1117
+ */
1118
+ responseStyle?: ResponseStyle;
1119
+ /**
1120
+ * Throw an error instead of returning it in the response?
1121
+ *
1122
+ * @default false
1123
+ */
1124
+ throwOnError?: T['throwOnError'];
1125
+ }
1126
+ interface RequestOptions<TData = unknown, TResponseStyle extends ResponseStyle = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string> extends Config<{
1127
+ responseStyle: TResponseStyle;
1128
+ throwOnError: ThrowOnError;
1129
+ }>, Pick<ServerSentEventsOptions<TData>, 'onRequest' | 'onSseError' | 'onSseEvent' | 'sseDefaultRetryDelay' | 'sseMaxRetryAttempts' | 'sseMaxRetryDelay'> {
1130
+ /**
1131
+ * Any body that you want to add to your request.
1132
+ *
1133
+ * {@link https://developer.mozilla.org/docs/Web/API/fetch#body}
1134
+ */
1135
+ body?: unknown;
1136
+ path?: Record<string, unknown>;
1137
+ query?: Record<string, unknown>;
1138
+ /**
1139
+ * Security mechanism(s) to use for the request.
1140
+ */
1141
+ security?: ReadonlyArray<Auth>;
1142
+ url: Url;
1143
+ }
1144
+ interface ResolvedRequestOptions<TResponseStyle extends ResponseStyle = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string> extends RequestOptions<unknown, TResponseStyle, ThrowOnError, Url> {
1145
+ headers: Headers;
1146
+ serializedBody?: string;
1147
+ }
1148
+ 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 : {
1149
+ data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
1150
+ request: Request;
1151
+ response: Response;
1152
+ }> : Promise<TResponseStyle extends 'data' ? (TData extends Record<string, unknown> ? TData[keyof TData] : TData) | undefined : ({
1153
+ data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
1154
+ error: undefined;
1155
+ } | {
1156
+ data: undefined;
1157
+ error: TError extends Record<string, unknown> ? TError[keyof TError] : TError;
1158
+ }) & {
1159
+ /** request may be undefined, because error may be from building the request object itself */
1160
+ request?: Request;
1161
+ /** response may be undefined, because error may be from building the request object itself or from a network error */
1162
+ response?: Response;
1163
+ }>;
1164
+ interface ClientOptions$1 {
1165
+ baseUrl?: string;
1166
+ responseStyle?: ResponseStyle;
1167
+ throwOnError?: boolean;
1168
+ }
1169
+ 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>;
1170
+ type SseFn = <TData = unknown, _TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<never, TResponseStyle, ThrowOnError>, 'method'>) => Promise<ServerSentEventsResult<TData>>;
1171
+ 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>;
1172
+ type BuildUrlFn = <TData extends {
1173
+ body?: unknown;
1174
+ path?: Record<string, unknown>;
1175
+ query?: Record<string, unknown>;
1176
+ url: string;
1177
+ }>(options: TData & Options<TData>) => string;
1178
+ type Client = Client$1<RequestFn, Config, MethodFn, BuildUrlFn, SseFn> & {
1179
+ interceptors: Middleware<Request, Response, unknown, ResolvedRequestOptions>;
1180
+ };
1181
+ interface TDataShape {
1182
+ body?: unknown;
1183
+ headers?: unknown;
1184
+ path?: unknown;
1185
+ query?: unknown;
1186
+ url: string;
1187
+ }
1188
+ type OmitKeys<T, K> = Pick<T, Exclude<keyof T, K>>;
1189
+ 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'>);
1190
+
1191
+ type ClientOptions = {
1192
+ 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 & {});
1193
+ };
1194
+ type CreditCardStatus = 'PENDING_ACTIVATION' | 'ACTIVE' | 'LOCKED' | 'CLOSED';
1195
+ type CreditCardType = 'DIGITAL' | 'PHYSICAL';
1196
+ /**
1197
+ * The rolling period a velocity control's amount and usage limits are evaluated over.
1198
+ * `TRANSACTION` applies the limit per-transaction and therefore carries no usage limit.
1199
+ */
1200
+ type VelocityWindow = 'DAY' | 'LIFETIME' | 'MONTH' | 'TRANSACTION' | 'WEEK';
1201
+
1202
+ type EmbeddedClient = Client;
1203
+ type ExtractLiterals<T> = T extends string ? string extends T ? never : T : never;
1204
+ type BaseUrl = ExtractLiterals<ClientOptions['baseUrl']>;
1205
+
1206
+ type LinkComponentProps = AnchorHTMLAttributes<HTMLAnchorElement> & {
1207
+ children?: ReactNode;
1208
+ };
1209
+ type LinkComponent = ComponentType<LinkComponentProps>;
1210
+ /**
1211
+ * The UI frameworks a widget's UI layer can render with.
1212
+ *
1213
+ * - `shadcn` — the shadcn/Tailwind implementation. This is the default and the
1214
+ * implicit fallback, so existing consumers that select nothing keep rendering
1215
+ * shadcn.
1216
+ * - `tecton` — the Tecton implementation.
1217
+ *
1218
+ * Declared as an `as const` object (not a TypeScript `enum`) per repo
1219
+ * convention.
1220
+ */
1221
+ declare const UIFramework: {
1222
+ readonly Shadcn: "shadcn";
1223
+ readonly Tecton: "tecton";
1224
+ };
1225
+ type UIFramework = (typeof UIFramework)[keyof typeof UIFramework];
1226
+
1227
+ /**
1228
+ * The settable fields of the widget config cascade.
1229
+ *
1230
+ * This is the type accepted by {@link setGlobalWidgetConfig} and all provider props.
1231
+ * It intentionally excludes `initResponse`, which is populated automatically by the
1232
+ * provider after a successful fetch and must never be set manually.
1233
+ *
1234
+ * The `null` vs `undefined` distinction on `widgetToken` and `organizationId` is intentional:
1235
+ * - `undefined` — not set at this level; inherit from the nearest ancestor or global store.
1236
+ * - `null` — explicitly cleared; downstream sees "no value" even if an ancestor had one
1237
+ * (e.g. after logout or deliberate de-scoping).
1238
+ *
1239
+ * @see {@link WidgetConfig} for the resolved output type (includes `initResponse`)
1240
+ * @see {@link RootWidgetProvider}
1241
+ * @see {@link WidgetProvider}
1242
+ * @see {@link setGlobalWidgetConfig}
1243
+ */
1244
+ interface WidgetConfigInput {
1245
+ /**
1246
+ * Base URL of the Tesouro embedded API (e.g. `"https://api.tesouro.com"`).
1247
+ *
1248
+ * When omitted the nearest ancestor's `baseUrl` or the global store value is used.
1249
+ * Changing this recreates the underlying HTTP client so all subsequent requests
1250
+ * go to the new host.
1251
+ */
1252
+ baseUrl?: BaseUrl;
1253
+ /**
1254
+ * Bearer token used to authenticate widget requests.
1255
+ *
1256
+ * Injected as `Authorization: Bearer <token>` on every outgoing request via an
1257
+ * interceptor on the scoped HTTP client. Token updates are picked up immediately
1258
+ * without recreating the client.
1259
+ *
1260
+ * - `string` — send this token on all requests from this level downward.
1261
+ * - `null` — explicitly cleared; no auth header is sent and fetching is suppressed.
1262
+ * - `undefined` — not set at this level; inherit from the nearest ancestor or global store.
1263
+ */
1264
+ widgetToken?: string | null;
1265
+ /**
1266
+ * Organization ID forwarded as the `x-organization-id` request header.
1267
+ *
1268
+ * Passed through {@link EmbedApiProvider} context rather than the auth interceptor,
1269
+ * so individual data-access hooks can opt in per-request.
1270
+ *
1271
+ * - `string` — use this organization for downstream data requests.
1272
+ * - `null` — explicitly cleared; queries that require an org ID will be disabled.
1273
+ * - `undefined` — not set at this level; inherit from the nearest ancestor or global store.
1274
+ *
1275
+ * When `undefined` across the **whole** cascade (no prop, no ancestor, no global
1276
+ * value), the resolved org defaults to the loaded `initResponse.organizationId`
1277
+ * (see {@link WidgetConfig.initResponse}) once the widget-init fetch settles. This
1278
+ * is the lowest-priority fallback — any explicit `string` or `null` at any cascade
1279
+ * level wins, and an explicit `null` is preserved and never falls back.
1280
+ *
1281
+ * Only an **explicit** ancestor org is inherited. An ancestor's *init-derived*
1282
+ * default does not propagate into a descendant that owns its own fetch (its own
1283
+ * `baseUrl`/`widgetToken`); such a descendant defaults to its own
1284
+ * `initResponse.organizationId` instead, so it never sends an ancestor's org with
1285
+ * its own token.
1286
+ */
1287
+ organizationId?: string | null;
1288
+ /**
1289
+ * Optional post-creation hook for the scoped HTTP client.
1290
+ *
1291
+ * Called once after the provider creates its scoped {@link EmbeddedClient} and
1292
+ * applies the built-in `Authorization: Bearer` interceptor. Receives the
1293
+ * fully-configured client and must return the client to be used for the lifetime of
1294
+ * this provider level — either the same instance (with additional interceptors
1295
+ * attached) or a new client entirely.
1296
+ *
1297
+ * **Order:** The built-in auth interceptor is always applied first. `configClient`
1298
+ * is called on top of it, so any interceptors you add here run after auth is set.
1299
+ *
1300
+ * **Any prop triggers a scoped client.** A {@link WidgetProvider} creates its own
1301
+ * scoped client whenever any prop is set — including `configClient` alone, without
1302
+ * `baseUrl` or `widgetToken`. Only a fully props-free pass-through provider skips
1303
+ * client creation and never calls this function.
1304
+ *
1305
+ * **Stability:** The function reference is included in the client creation memo's
1306
+ * dependency array. Passing an unstable (inline) function recreates the client on
1307
+ * every render. Stabilize with `useCallback` or define the function outside the
1308
+ * component.
1309
+ *
1310
+ * **Cascade:** Inherits from the nearest ancestor when `undefined`. A child
1311
+ * {@link WidgetProvider} that creates its own scoped client will use the resolved
1312
+ * `configClient` from the cascade unless it provides its own override.
1313
+ *
1314
+ * @example
1315
+ * ```tsx
1316
+ * const addLogging = useCallback(
1317
+ * (client: EmbeddedClient) => {
1318
+ * client.interceptors.request.use((req) => {
1319
+ * console.log('[widget]', req.method, req.url);
1320
+ * return req;
1321
+ * });
1322
+ * return client;
1323
+ * },
1324
+ * [],
1325
+ * );
1326
+ *
1327
+ * <RootWidgetProvider
1328
+ * baseUrl="https://api.tesouro.com"
1329
+ * widgetToken={token}
1330
+ * configClient={addLogging}
1331
+ * >
1332
+ * <App />
1333
+ * </RootWidgetProvider>
1334
+ * ```
1335
+ */
1336
+ configClient?: (client: EmbeddedClient) => EmbeddedClient;
1337
+ /**
1338
+ * Overrides the widget-gateway routing decision for the scoped HTTP client.
1339
+ *
1340
+ * Any caller reaching the Tesouro API with a widget token must route data
1341
+ * requests through the widget gateway: prefix the path with
1342
+ * `/api/widget-gateway/proxy` and carry the token as `X-Widget-Token`. The
1343
+ * provider applies both automatically per request when the request origin is
1344
+ * a known Tesouro API host (`WIDGET_GATEWAY_HOSTS`, derived from the
1345
+ * generated `ClientOptions['baseUrl']`); `/api/widget-gateway/*` paths (the
1346
+ * init round-trip) always pass through untouched.
1347
+ *
1348
+ * - `undefined` — decide from the request origin, as above. Inherits from
1349
+ * the nearest ancestor or global store like every other config field.
1350
+ * - `true` — always apply the rewrite, even for an unlisted base URL (e.g. a
1351
+ * custom domain in front of the gateway).
1352
+ * - `false` — never apply it. For hosts that route widget requests their own
1353
+ * way, such as a same-origin BFF whose `configClient` retargets every
1354
+ * request.
1355
+ *
1356
+ * Independent of {@link configClient}: a host that only adds a header keeps
1357
+ * the built-in routing, and the built-in interceptor runs before any
1358
+ * `configClient` interceptor.
1359
+ */
1360
+ gatewayRouting?: boolean;
1361
+ /**
1362
+ * Component the embedded widgets should render in place of plain `<a>` tags.
1363
+ *
1364
+ * Pass e.g. Next.js's `Link` to make in-app navigation use the host router.
1365
+ * Cascades like other config: provider prop > nearest ancestor > global store.
1366
+ * When no value is set anywhere, widgets fall back to a plain `<a>` element.
1367
+ */
1368
+ linkComponent?: LinkComponent;
1369
+ /**
1370
+ * Which UI framework the widget UI layer should render with.
1371
+ *
1372
+ * Lets a consuming context bind widgets to either the shadcn/Tailwind or the
1373
+ * Tecton implementation behind the same outward-facing API. The selection is
1374
+ * a presentation concern only — it cascades through the provider tree exactly
1375
+ * like {@link linkComponent} and is read by UI libraries via `useUIFramework`;
1376
+ * it never appears in any widget's feature-library or component props.
1377
+ *
1378
+ * - `'shadcn'` — the shadcn/Tailwind implementation.
1379
+ * - `'tecton'` — the Tecton implementation.
1380
+ * - `null` / `undefined` — not set at this level; inherit from the nearest
1381
+ * ancestor or global store, falling back to `shadcn` when unset everywhere.
1382
+ * `shadcn` is the implicit default, so existing consumers need no changes.
1383
+ */
1384
+ uiFramework?: UIFramework | null;
1385
+ }
1386
+ /**
1387
+ * Props shared by every analytics-owner-capable widget provider.
1388
+ *
1389
+ * Combines the full settable cascade ({@link WidgetConfigInput}) with the
1390
+ * analytics opt-out honored by analytics owners. Both {@link RootWidgetProvider}
1391
+ * and {@link WidgetProvider} build their public props on top of this; the latter
1392
+ * adds error-boundary props of its own.
1393
+ *
1394
+ * @see {@link WidgetConfigInput} for per-field cascade and `null` vs omitted semantics
1395
+ */
1396
+ interface WidgetProviderBaseProps extends WidgetConfigInput {
1397
+ /**
1398
+ * Opt out of all analytics capture and prevent PostHog from loading. Default `true`.
1399
+ *
1400
+ * Honored only by an analytics **owner** — a {@link RootWidgetProvider} or a
1401
+ * standalone {@link WidgetProvider} with no parent provider. When `false`,
1402
+ * owner-bound `track` calls in this subtree become no-ops and the PostHog
1403
+ * installer is never dynamically imported for this owner's environment.
1404
+ * Setting it on a nested {@link WidgetProvider} is ignored in v1 (a one-time
1405
+ * `console.warn` is emitted to make the no-op discoverable).
1406
+ */
1407
+ analytics?: boolean;
1408
+ }
1409
+
1410
+ /**
1411
+ * Copy for the states `WidgetProvider` renders *itself*, in place of the widget:
1412
+ * the error-boundary fallback and the disclosures gate. A host overrides any
1413
+ * subset through the `providerLabels` prop, which cascades like
1414
+ * `disclosuresAcceptance`.
1415
+ *
1416
+ * Not named `Labels` on the public surface: a widget's own `labels` prop is a
1417
+ * different thing, and these two travel together on every widget's props type.
1418
+ */
1419
+ interface WidgetProviderLabels {
1420
+ /** Default copy for the built-in error boundary fallback. */
1421
+ errorBoundaryFallback: string;
1422
+ /** Heading when init reports disclosures are required and not yet accepted. */
1423
+ disclosuresRequiredTitle: string;
1424
+ /** Heading while a token-only refresh leaves init stale for the live token. */
1425
+ disclosuresRefreshingTitle: string;
1426
+ /** Supporting copy while the accept action is withheld for a stale init. */
1427
+ disclosuresRefreshingDescription: string;
1428
+ }
1429
+
1430
+ /**
1431
+ * Props for {@link WidgetProvider}.
1432
+ *
1433
+ * All fields are optional. When **all** are omitted the provider is a transparent
1434
+ * pass-through: no fetch is issued and all resolved values cascade unchanged from
1435
+ * the nearest ancestor.
1436
+ */
1437
+ interface WidgetProviderProps extends WidgetProviderBaseProps {
1438
+ /**
1439
+ * Fallback rendered when a render-time exception is caught inside this
1440
+ * provider's subtree. Pass either a `ReactNode` (rendered directly) or a
1441
+ * render-prop receiving `{ error, resetErrorBoundary }` from
1442
+ * `react-error-boundary`. Default is a plain `role="alert"` div whose copy
1443
+ * comes from `providerLabels.errorBoundaryFallback`.
1444
+ */
1445
+ errorFallback?: ReactNode | ((props: FallbackProps) => ReactNode);
1446
+ /**
1447
+ * Called once when the boundary catches an error, before the fallback
1448
+ * renders. Use for telemetry / error tracking / partner logging. Exceptions
1449
+ * thrown from `onError` propagate per `react-error-boundary` semantics.
1450
+ */
1451
+ onError?: (error: unknown, info: ErrorInfo) => void;
1452
+ /**
1453
+ * Accept surface shown when the caller owes disclosures — an INVITED
1454
+ * teammate (including `NOT_REQUIRED` orgs, who still need Accept to
1455
+ * activate) or an ACTIVE user who owes a new version. Pass
1456
+ * `<AcceptDisclosuresWidget />`. Cascades like `linkComponent`.
1457
+ * WidgetProvider cannot import the widget itself (cycle).
1458
+ */
1459
+ disclosuresAcceptance?: ReactNode;
1460
+ /**
1461
+ * Overrides for the copy this provider renders in place of the widget: the
1462
+ * built-in error-boundary fallback and the disclosures gate. Any subset;
1463
+ * unlisted keys keep their defaults. Cascades like `linkComponent`.
1464
+ *
1465
+ * Named `providerLabels` rather than `labels` because a widget's own
1466
+ * `labels` prop sits alongside this one on the same props type.
1467
+ */
1468
+ providerLabels?: Partial<WidgetProviderLabels>;
1469
+ }
1470
+
1471
+ /**
1472
+ * Which issuing product a card belongs to. A card list shows exactly one
1473
+ * program at a time, and the value selects the endpoint the data-access layer
1474
+ * calls: `credit` → `/embedded-banking/v1/credit-cards`, `debit` →
1475
+ * `/embedded-banking/v1/debit-cards`.
1476
+ *
1477
+ * Defined here rather than in either widget because `CardsWidget` and
1478
+ * `CardDetailsWidget` both publish it as a required public prop. Declared
1479
+ * inline in each, the literal would become public API twice with no single
1480
+ * definition — and `cards-widget/ui` ↔ `card-details-widget/ui` imports are
1481
+ * lint-banned while the reverse feature import would be an Nx cycle, so
1482
+ * `shared/feature` is the only home that serves both without duplication.
1483
+ *
1484
+ * Deliberately **not** the generated `CardTypeEnum` (`credit | debit | prepaid
1485
+ * | unknown`), which greps as an exact match for this concept but belongs to
1486
+ * the unrelated snake_case third-party schema family (its sibling fields are
1487
+ * `card_type`, `last4`, `background_color`) and carries two members neither
1488
+ * widget supports. In this codebase "card type" is the DIGITAL/PHYSICAL form
1489
+ * factor instead — see `CardType` in `./cardPresentation`.
1490
+ *
1491
+ * Const-object-plus-type rather than a bare union, mirroring `UIFramework` in
1492
+ * `shared/ui` — the other two-member literal that ships as a public prop type.
1493
+ */
1494
+ declare const CardProgram: {
1495
+ readonly Credit: "credit";
1496
+ readonly Debit: "debit";
1497
+ };
1498
+ type CardProgram = (typeof CardProgram)[keyof typeof CardProgram];
1499
+
1500
+ /**
1501
+ * A card's lifecycle status, program-agnostic. Aliases the credit union because
1502
+ * one of the two has to be the base; the parity assertions below are what keep
1503
+ * that choice arbitrary.
1504
+ */
1505
+ type CardStatus = CreditCardStatus;
1506
+ /**
1507
+ * A card's physical form factor — the codebase's meaning of "card type". The
1508
+ * credit/debit axis is `CardProgram`, not this.
1509
+ */
1510
+ type CardType = CreditCardType;
1511
+
1512
+ /**
1513
+ * Copy the **feature** layer owns, as opposed to the panel's own
1514
+ * `CardDetailsPanelLabels`.
1515
+ *
1516
+ * The split follows where the string is resolved, not where it is painted. A
1517
+ * status badge word is chosen by mapping a generated `cardStatus` enum member,
1518
+ * which is a data-access-typed decision the presentational layer is not allowed
1519
+ * to make — so it is overridable here even though the panel renders it. The
1520
+ * panel's own labels stay with the panel.
1521
+ */
1522
+ interface CardDetailsFeatureLabels {
1523
+ /** @deprecated Unused: copy buttons confirm themselves. */
1524
+ copySuccessToast: string;
1525
+ /**
1526
+ * Toast shown when activation is refused because the card is no longer
1527
+ * awaiting it. Resolved here rather than in the panel because it is an
1528
+ * API outcome, and because the panel closes as it fires.
1529
+ */
1530
+ activationConflictToast: string;
1531
+ /**
1532
+ * Toast shown when a lock change is refused because the card is no longer in
1533
+ * a state that accepts one. Same reason as `activationConflictToast`: it is an
1534
+ * API outcome, not something the panel can know.
1535
+ */
1536
+ lockConflictToast: string;
1537
+ /** Confirmation toast after the nickname is saved. */
1538
+ nicknameUpdatedToast: string;
1539
+ /**
1540
+ * Toast shown when a nickname save is refused because the card moved on. The
1541
+ * editor closes as it fires, so the reader lands on the refetched name.
1542
+ */
1543
+ nicknameConflictToast: string;
1544
+ /**
1545
+ * Replaces the panel's generic reveal error when the credentials call was
1546
+ * refused (HTTP 403).
1547
+ *
1548
+ * It lives here rather than on the panel because deciding that a failure was a
1549
+ * refusal means reading the error, which is this layer's job — the panel is
1550
+ * handed one already-chosen sentence either way, and its own
1551
+ * `credentials.errorDescription` still covers every other failure.
1552
+ *
1553
+ * The wording deliberately does not tell the reader to ask for a permission.
1554
+ * Reading a debit card and reading its credentials take the same scope, so a
1555
+ * reader looking at this panel already holds it; a 403 here means the call was
1556
+ * refused for this session, which asking an admin for a role will not fix.
1557
+ */
1558
+ revealNotPermittedDescription: string;
1559
+ /** @deprecated Unused: the card face no longer shows program wording. */
1560
+ programLabels: Record<CardProgram, string>;
1561
+ /** Status badge wording, keyed on the generated card status. */
1562
+ statusLabels: Record<CardStatus, string>;
1563
+ /** Form-factor subtitle wording, keyed on the generated card type. */
1564
+ formFactorLabels: Record<CardType, string>;
1565
+ /**
1566
+ * A velocity control's reset-period wording, keyed on the generated
1567
+ * `velocityWindow`. Used to build the spend limit row, e.g. "$500 / month".
1568
+ * `TRANSACTION` is unused there (it drives the separate per-transaction max
1569
+ * row instead) but is still a real enum member, so it stays in the map.
1570
+ */
1571
+ velocityWindowLabels: Record<VelocityWindow, string>;
1572
+ }
1573
+
1574
+ interface CardDetailsWidgetProps extends WidgetProviderProps {
1575
+ /** Id of the card to show. */
1576
+ cardId: string;
1577
+ /**
1578
+ * Which issuing product `cardId` belongs to. **Required, with no default** —
1579
+ * it selects the endpoint the card is fetched from, and a wrong guess would
1580
+ * 404 a card that exists. `CardsWidget` publishes the same required prop, so
1581
+ * one value configures a list and its detail panel together.
1582
+ *
1583
+ * A JavaScript consumer, or a host passing a route param straight through, can
1584
+ * still get a value past the type. **There is no catch-all and no default:**
1585
+ * anything that is not explicitly one of the two programs fetches nothing and
1586
+ * renders the panel's error state with no retry, and the reason is named on the
1587
+ * console. That covers an absent prop (`undefined` / `null`) as well as an
1588
+ * unrecognised one (`'prepaid'`, a case-wrong `'Credit'`), because the widget
1589
+ * cannot know which product to ask about in either case.
1590
+ *
1591
+ * A host that resolves the program asynchronously should gate its own render on
1592
+ * it rather than mounting this widget without it — an absent program is not
1593
+ * read as "still loading".
1594
+ */
1595
+ cardProgram: CardProgram;
1596
+ /**
1597
+ * Called when the header's close control is pressed. Omitting it renders no
1598
+ * close control at all: a standalone card page has nothing to close back to,
1599
+ * while a host rendering the panel in a drawer supplies this and suppresses
1600
+ * its own chrome's close button so the two do not sit side by side.
1601
+ */
1602
+ onClose?: () => void;
1603
+ /** Overrides for the panel's own copy. */
1604
+ labels?: PartialDeep<CardDetailsPanelLabels>;
1605
+ /** Overrides for the Activate Card form's copy. */
1606
+ activateLabels?: PartialDeep<ActivateCardPanelLabels>;
1607
+ /** Overrides for the copy this layer resolves — see `CardDetailsFeatureLabels`. */
1608
+ featureLabels?: PartialDeep<CardDetailsFeatureLabels>;
1609
+ /**
1610
+ * Full per-tenant plastic art (EMBD-5466) — the same asset `CreateCardWidget`
1611
+ * shows for this tenant, e.g. from `CardsWidgetProps.cardArtSrc`. Takes
1612
+ * priority over `bankLogoSrc`, per `CardFace`'s own doc comment. Same
1613
+ * PLAT-1179 / embedded ADR 0005 reason as `bankLogoSrc` below: the package
1614
+ * ships no card artwork of its own, so a host or white-label config supplies
1615
+ * this rather than a bundled lookup table.
1616
+ */
1617
+ cardArtSrc?: string;
1618
+ /**
1619
+ * Bank logo for the card face. The widget ships no bank artwork of its own and
1620
+ * resolves none from the init response: an embeddable library must not depend
1621
+ * on a Tesouro-hosted asset a host page's content-security policy can block,
1622
+ * and a bundled bank-name→URL table would put internal CDN links in the
1623
+ * published package (PLAT-1179, embedded ADR 0005). Omit it and the card face
1624
+ * renders without a logo rather than with a placeholder. Ignored when
1625
+ * `cardArtSrc` is supplied.
1626
+ */
1627
+ bankLogoSrc?: string;
1628
+ bankLogoAlt?: string;
1629
+ }
1630
+ /**
1631
+ * Read-only details for one card, standalone-capable.
1632
+ *
1633
+ * Provides its own `WidgetProvider`, so it renders with nothing above it — a
1634
+ * partner can mount it on a real `/cards/[id]` page. Nested inside another
1635
+ * widget's provider with no auth props of its own, it inherits that init
1636
+ * response and `QueryClient` instead, costing no second `/init` call and sharing
1637
+ * one cache with the list that opened it. Do not forward `baseUrl` or
1638
+ * `widgetToken` into it from a parent widget: either one flips this provider into
1639
+ * fetch mode and buys a redundant init request per open.
1640
+ *
1641
+ * Both placements are covered by specs, because they take different code paths
1642
+ * through the provider and this export exists for the standalone one.
1643
+ */
1644
+ declare function CardDetailsWidget({ baseUrl, widgetToken, organizationId, configClient, gatewayRouting, linkComponent, uiFramework, errorFallback, onError, analytics, disclosuresAcceptance, providerLabels, ...innerProps }: CardDetailsWidgetProps): React.JSX.Element;
1645
+
1646
+ export { CardDetailsWidget };
1647
+ export type { ActivateCardPanelLabels, CardDetailsFeatureLabels, CardDetailsPanelLabels as CardDetailsWidgetLabels, CardDetailsWidgetProps };