@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,2149 @@
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
+ type LinkComponentProps = AnchorHTMLAttributes<HTMLAnchorElement> & {
698
+ children?: ReactNode;
699
+ };
700
+ type LinkComponent = ComponentType<LinkComponentProps>;
701
+ /**
702
+ * The UI frameworks a widget's UI layer can render with.
703
+ *
704
+ * - `shadcn` — the shadcn/Tailwind implementation. This is the default and the
705
+ * implicit fallback, so existing consumers that select nothing keep rendering
706
+ * shadcn.
707
+ * - `tecton` — the Tecton implementation.
708
+ *
709
+ * Declared as an `as const` object (not a TypeScript `enum`) per repo
710
+ * convention.
711
+ */
712
+ declare const UIFramework: {
713
+ readonly Shadcn: "shadcn";
714
+ readonly Tecton: "tecton";
715
+ };
716
+ type UIFramework = (typeof UIFramework)[keyof typeof UIFramework];
717
+
718
+ interface PaginationFooterLabels {
719
+ rowsPerPageLabel: string;
720
+ previousPageButton: string;
721
+ nextPageButton: string;
722
+ }
723
+
724
+ interface CardsListColumnHeaderLabels {
725
+ cardName: string;
726
+ fundingAccount: string;
727
+ cardholder: string;
728
+ status: string;
729
+ limit: string;
730
+ }
731
+ /**
732
+ * Screen-reader-only copy naming the details sheet a row click opens.
733
+ *
734
+ * Both strings are invisible by design: the sheet's visible header belongs to
735
+ * whatever the owner slots into it (`CardDetailsPanel`, via `CardsWidget`), and a
736
+ * second visible title would duplicate it. They exist because the sheet is a
737
+ * dialog, and a dialog without an accessible name is announced as nothing.
738
+ */
739
+ interface CardsListDetailsSheetLabels {
740
+ /** Accessible name for the sheet. */
741
+ title: string;
742
+ /** Accessible description, announced after the name. */
743
+ description: string;
744
+ }
745
+ /**
746
+ * Every user-facing string the cards list renders, including screen-reader-only
747
+ * copy and the decorative separators.
748
+ *
749
+ * There is intentionally **no** card-type or card-status map here: the row
750
+ * arrives with `typeLabel` and `statusLabel` already resolved, so the
751
+ * `DIGITAL`/`PHYSICAL` and `PENDING_ACTIVATION`/`ACTIVE`/`LOCKED`/`CLOSED` maps
752
+ * live in `shared/feature` keyed on the generated types (EMBD-4404 amendment;
753
+ * see `statusBadge.ts`). That is also where the "label keys carry the code term,
754
+ * values carry the copy" rule applies — `digital`, never `virtual`, so a later
755
+ * wording change is not a breaking rename.
756
+ */
757
+ interface CardsListLabels {
758
+ /**
759
+ * Accessible name for the list region. Not a heading: the list renders none,
760
+ * because whoever mounts it names it (embedded ADR 0010).
761
+ */
762
+ regionLabel: string;
763
+ columnHeaders: CardsListColumnHeaderLabels;
764
+ /** Screen-reader name for the unheaded trailing row-actions column. */
765
+ rowActionsColumn: string;
766
+ showMyCardsToggle: string;
767
+ createCardButton: string;
768
+ activateButton: string;
769
+ /** Accessible name for a row's Activate button; the card name is appended. */
770
+ activateButtonForCard: string;
771
+ /** Accessible name for a row, which opens the card; card name appended. */
772
+ selectCardButton: string;
773
+ /** Separator between a card's nickname and its last four digits. */
774
+ cardNameSeparator: string;
775
+ /** Stands in for the limit when a card has none set. */
776
+ noLimit: string;
777
+ /** Announced while a page of cards is loading. */
778
+ loadingLabel: string;
779
+ emptyTitle: string;
780
+ emptyDescription: string;
781
+ accessRestrictedTitle: string;
782
+ errorTitle: string;
783
+ errorDescription: string;
784
+ retryButton: string;
785
+ pagination: PaginationFooterLabels;
786
+ /**
787
+ * Copy for the details sheet a row click opens. Rendered by
788
+ * `CardsListDetailsSheet` rather than by the table, but part of this surface
789
+ * because it is one screen and one `labels` prop — the same reason `pagination`
790
+ * sits here for a footer that lives in `shared/ui`.
791
+ */
792
+ detailsSheet: CardsListDetailsSheetLabels;
793
+ /**
794
+ * Screen-reader copy for the same sheet when Create card is slotted in, rather
795
+ * than a selected card's details. Same chrome, different accessible name.
796
+ */
797
+ createSheet: CardsListDetailsSheetLabels;
798
+ }
799
+
800
+ type AuthToken = string | undefined;
801
+ interface Auth {
802
+ /**
803
+ * Which part of the request do we use to send the auth?
804
+ *
805
+ * @default 'header'
806
+ */
807
+ in?: 'header' | 'query' | 'cookie';
808
+ /**
809
+ * A unique identifier for the security scheme.
810
+ *
811
+ * Defined only when there are multiple security schemes whose `Auth`
812
+ * shape would otherwise be identical.
813
+ */
814
+ key?: string;
815
+ /**
816
+ * Header or query parameter name.
817
+ *
818
+ * @default 'Authorization'
819
+ */
820
+ name?: string;
821
+ scheme?: 'basic' | 'bearer';
822
+ type: 'apiKey' | 'http';
823
+ }
824
+
825
+ interface SerializerOptions<T> {
826
+ /**
827
+ * @default true
828
+ */
829
+ explode: boolean;
830
+ style: T;
831
+ }
832
+ type ArrayStyle = 'form' | 'spaceDelimited' | 'pipeDelimited';
833
+ type ObjectStyle = 'form' | 'deepObject';
834
+
835
+ type QuerySerializer = (query: Record<string, unknown>) => string;
836
+ type BodySerializer = (body: unknown) => unknown;
837
+ type QuerySerializerOptionsObject = {
838
+ allowReserved?: boolean;
839
+ array?: Partial<SerializerOptions<ArrayStyle>>;
840
+ object?: Partial<SerializerOptions<ObjectStyle>>;
841
+ };
842
+ type QuerySerializerOptions = QuerySerializerOptionsObject & {
843
+ /**
844
+ * Per-parameter serialization overrides. When provided, these settings
845
+ * override the global array/object settings for specific parameter names.
846
+ */
847
+ parameters?: Record<string, QuerySerializerOptionsObject>;
848
+ };
849
+
850
+ type HttpMethod = 'connect' | 'delete' | 'get' | 'head' | 'options' | 'patch' | 'post' | 'put' | 'trace';
851
+ type Client$1<RequestFn = never, Config = unknown, MethodFn = never, BuildUrlFn = never, SseFn = never> = {
852
+ /**
853
+ * Returns the final request URL.
854
+ */
855
+ buildUrl: BuildUrlFn;
856
+ getConfig: () => Config;
857
+ request: RequestFn;
858
+ setConfig: (config: Config) => Config;
859
+ } & {
860
+ [K in HttpMethod]: MethodFn;
861
+ } & ([SseFn] extends [never] ? {
862
+ sse?: never;
863
+ } : {
864
+ sse: {
865
+ [K in HttpMethod]: SseFn;
866
+ };
867
+ });
868
+ interface Config$1 {
869
+ /**
870
+ * Auth token or a function returning auth token. The resolved value will be
871
+ * added to the request payload as defined by its `security` array.
872
+ */
873
+ auth?: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken;
874
+ /**
875
+ * A function for serializing request body parameter. By default,
876
+ * {@link JSON.stringify()} will be used.
877
+ */
878
+ bodySerializer?: BodySerializer | null;
879
+ /**
880
+ * An object containing any HTTP headers that you want to pre-populate your
881
+ * `Headers` object with.
882
+ *
883
+ * {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more}
884
+ */
885
+ headers?: RequestInit['headers'] | Record<string, string | number | boolean | (string | number | boolean)[] | null | undefined | unknown>;
886
+ /**
887
+ * The request method.
888
+ *
889
+ * {@link https://developer.mozilla.org/docs/Web/API/fetch#method See more}
890
+ */
891
+ method?: Uppercase<HttpMethod>;
892
+ /**
893
+ * A function for serializing request query parameters. By default, arrays
894
+ * will be exploded in form style, objects will be exploded in deepObject
895
+ * style, and reserved characters are percent-encoded.
896
+ *
897
+ * This method will have no effect if the native `paramsSerializer()` Axios
898
+ * API function is used.
899
+ *
900
+ * {@link https://swagger.io/docs/specification/serialization/#query View examples}
901
+ */
902
+ querySerializer?: QuerySerializer | QuerySerializerOptions;
903
+ /**
904
+ * A function validating request data. This is useful if you want to ensure
905
+ * the request conforms to the desired shape, so it can be safely sent to
906
+ * the server.
907
+ */
908
+ requestValidator?: (data: unknown) => Promise<unknown>;
909
+ /**
910
+ * A function transforming response data before it's returned. This is useful
911
+ * for post-processing data, e.g., converting ISO strings into Date objects.
912
+ */
913
+ responseTransformer?: (data: unknown) => Promise<unknown>;
914
+ /**
915
+ * A function validating response data. This is useful if you want to ensure
916
+ * the response conforms to the desired shape, so it can be safely passed to
917
+ * the transformers and returned to the user.
918
+ */
919
+ responseValidator?: (data: unknown) => Promise<unknown>;
920
+ }
921
+
922
+ type ServerSentEventsOptions<TData = unknown> = Omit<RequestInit, 'method'> & Pick<Config$1, 'method' | 'responseTransformer' | 'responseValidator'> & {
923
+ /**
924
+ * Fetch API implementation. You can use this option to provide a custom
925
+ * fetch instance.
926
+ *
927
+ * @default globalThis.fetch
928
+ */
929
+ fetch?: typeof fetch;
930
+ /**
931
+ * Implementing clients can call request interceptors inside this hook.
932
+ */
933
+ onRequest?: (url: string, init: RequestInit) => Promise<Request>;
934
+ /**
935
+ * Callback invoked when a network or parsing error occurs during streaming.
936
+ *
937
+ * This option applies only if the endpoint returns a stream of events.
938
+ *
939
+ * @param error The error that occurred.
940
+ */
941
+ onSseError?: (error: unknown) => void;
942
+ /**
943
+ * Callback invoked when an event is streamed from the server.
944
+ *
945
+ * This option applies only if the endpoint returns a stream of events.
946
+ *
947
+ * @param event Event streamed from the server.
948
+ * @returns Nothing (void).
949
+ */
950
+ onSseEvent?: (event: StreamEvent<TData>) => void;
951
+ serializedBody?: RequestInit['body'];
952
+ /**
953
+ * Default retry delay in milliseconds.
954
+ *
955
+ * This option applies only if the endpoint returns a stream of events.
956
+ *
957
+ * @default 3000
958
+ */
959
+ sseDefaultRetryDelay?: number;
960
+ /**
961
+ * Maximum number of retry attempts before giving up.
962
+ */
963
+ sseMaxRetryAttempts?: number;
964
+ /**
965
+ * Maximum retry delay in milliseconds.
966
+ *
967
+ * Applies only when exponential backoff is used.
968
+ *
969
+ * This option applies only if the endpoint returns a stream of events.
970
+ *
971
+ * @default 30000
972
+ */
973
+ sseMaxRetryDelay?: number;
974
+ /**
975
+ * Optional sleep function for retry backoff.
976
+ *
977
+ * Defaults to using `setTimeout`.
978
+ */
979
+ sseSleepFn?: (ms: number) => Promise<void>;
980
+ url: string;
981
+ };
982
+ interface StreamEvent<TData = unknown> {
983
+ data: TData;
984
+ event?: string;
985
+ id?: string;
986
+ retry?: number;
987
+ }
988
+ type ServerSentEventsResult<TData = unknown, TReturn = void, TNext = unknown> = {
989
+ stream: AsyncGenerator<TData extends Record<string, unknown> ? TData[keyof TData] : TData, TReturn, TNext>;
990
+ };
991
+
992
+ type ErrInterceptor<Err, Res, Req, Options> = (error: Err,
993
+ /** response may be undefined due to a network error where no response object is produced */
994
+ response: Res | undefined,
995
+ /** request may be undefined, because error may be from building the request object itself */
996
+ request: Req | undefined, options: Options) => Err | Promise<Err>;
997
+ type ReqInterceptor<Req, Options> = (request: Req, options: Options) => Req | Promise<Req>;
998
+ type ResInterceptor<Res, Req, Options> = (response: Res, request: Req, options: Options) => Res | Promise<Res>;
999
+ declare class Interceptors<Interceptor> {
1000
+ fns: Array<Interceptor | null>;
1001
+ clear(): void;
1002
+ eject(id: number | Interceptor): void;
1003
+ exists(id: number | Interceptor): boolean;
1004
+ getInterceptorIndex(id: number | Interceptor): number;
1005
+ update(id: number | Interceptor, fn: Interceptor): number | Interceptor | false;
1006
+ use(fn: Interceptor): number;
1007
+ }
1008
+ interface Middleware<Req, Res, Err, Options> {
1009
+ error: Interceptors<ErrInterceptor<Err, Res, Req, Options>>;
1010
+ request: Interceptors<ReqInterceptor<Req, Options>>;
1011
+ response: Interceptors<ResInterceptor<Res, Req, Options>>;
1012
+ }
1013
+
1014
+ type ResponseStyle = 'data' | 'fields';
1015
+ interface Config<T extends ClientOptions$1 = ClientOptions$1> extends Omit<RequestInit, 'body' | 'headers' | 'method'>, Config$1 {
1016
+ /**
1017
+ * Base URL for all requests made by this client.
1018
+ */
1019
+ baseUrl?: T['baseUrl'];
1020
+ /**
1021
+ * Fetch API implementation. You can use this option to provide a custom
1022
+ * fetch instance.
1023
+ *
1024
+ * @default globalThis.fetch
1025
+ */
1026
+ fetch?: typeof fetch;
1027
+ /**
1028
+ * Please don't use the Fetch client for Next.js applications. The `next`
1029
+ * options won't have any effect.
1030
+ *
1031
+ * Install {@link https://www.npmjs.com/package/@hey-api/client-next `@hey-api/client-next`} instead.
1032
+ */
1033
+ next?: never;
1034
+ /**
1035
+ * Return the response data parsed in a specified format. By default, `auto`
1036
+ * will infer the appropriate method from the `Content-Type` response header.
1037
+ * You can override this behavior with any of the {@link Body} methods.
1038
+ * Select `stream` if you don't want to parse response data at all.
1039
+ *
1040
+ * @default 'auto'
1041
+ */
1042
+ parseAs?: 'arrayBuffer' | 'auto' | 'blob' | 'formData' | 'json' | 'stream' | 'text';
1043
+ /**
1044
+ * Should we return only data or multiple fields (data, error, response, etc.)?
1045
+ *
1046
+ * @default 'fields'
1047
+ */
1048
+ responseStyle?: ResponseStyle;
1049
+ /**
1050
+ * Throw an error instead of returning it in the response?
1051
+ *
1052
+ * @default false
1053
+ */
1054
+ throwOnError?: T['throwOnError'];
1055
+ }
1056
+ interface RequestOptions<TData = unknown, TResponseStyle extends ResponseStyle = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string> extends Config<{
1057
+ responseStyle: TResponseStyle;
1058
+ throwOnError: ThrowOnError;
1059
+ }>, Pick<ServerSentEventsOptions<TData>, 'onRequest' | 'onSseError' | 'onSseEvent' | 'sseDefaultRetryDelay' | 'sseMaxRetryAttempts' | 'sseMaxRetryDelay'> {
1060
+ /**
1061
+ * Any body that you want to add to your request.
1062
+ *
1063
+ * {@link https://developer.mozilla.org/docs/Web/API/fetch#body}
1064
+ */
1065
+ body?: unknown;
1066
+ path?: Record<string, unknown>;
1067
+ query?: Record<string, unknown>;
1068
+ /**
1069
+ * Security mechanism(s) to use for the request.
1070
+ */
1071
+ security?: ReadonlyArray<Auth>;
1072
+ url: Url;
1073
+ }
1074
+ interface ResolvedRequestOptions<TResponseStyle extends ResponseStyle = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string> extends RequestOptions<unknown, TResponseStyle, ThrowOnError, Url> {
1075
+ headers: Headers;
1076
+ serializedBody?: string;
1077
+ }
1078
+ 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 : {
1079
+ data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
1080
+ request: Request;
1081
+ response: Response;
1082
+ }> : Promise<TResponseStyle extends 'data' ? (TData extends Record<string, unknown> ? TData[keyof TData] : TData) | undefined : ({
1083
+ data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
1084
+ error: undefined;
1085
+ } | {
1086
+ data: undefined;
1087
+ error: TError extends Record<string, unknown> ? TError[keyof TError] : TError;
1088
+ }) & {
1089
+ /** request may be undefined, because error may be from building the request object itself */
1090
+ request?: Request;
1091
+ /** response may be undefined, because error may be from building the request object itself or from a network error */
1092
+ response?: Response;
1093
+ }>;
1094
+ interface ClientOptions$1 {
1095
+ baseUrl?: string;
1096
+ responseStyle?: ResponseStyle;
1097
+ throwOnError?: boolean;
1098
+ }
1099
+ 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>;
1100
+ type SseFn = <TData = unknown, _TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<never, TResponseStyle, ThrowOnError>, 'method'>) => Promise<ServerSentEventsResult<TData>>;
1101
+ 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>;
1102
+ type BuildUrlFn = <TData extends {
1103
+ body?: unknown;
1104
+ path?: Record<string, unknown>;
1105
+ query?: Record<string, unknown>;
1106
+ url: string;
1107
+ }>(options: TData & Options<TData>) => string;
1108
+ type Client = Client$1<RequestFn, Config, MethodFn, BuildUrlFn, SseFn> & {
1109
+ interceptors: Middleware<Request, Response, unknown, ResolvedRequestOptions>;
1110
+ };
1111
+ interface TDataShape {
1112
+ body?: unknown;
1113
+ headers?: unknown;
1114
+ path?: unknown;
1115
+ query?: unknown;
1116
+ url: string;
1117
+ }
1118
+ type OmitKeys<T, K> = Pick<T, Exclude<keyof T, K>>;
1119
+ 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'>);
1120
+
1121
+ type ClientOptions = {
1122
+ 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 & {});
1123
+ };
1124
+ type CreditCardStatus = 'PENDING_ACTIVATION' | 'ACTIVE' | 'LOCKED' | 'CLOSED';
1125
+ type CreditCardType = 'DIGITAL' | 'PHYSICAL';
1126
+ /**
1127
+ * The rolling period a velocity control's amount and usage limits are evaluated over.
1128
+ * `TRANSACTION` applies the limit per-transaction and therefore carries no usage limit.
1129
+ */
1130
+ type VelocityWindow = 'DAY' | 'LIFETIME' | 'MONTH' | 'TRANSACTION' | 'WEEK';
1131
+
1132
+ type EmbeddedClient = Client;
1133
+ type ExtractLiterals<T> = T extends string ? string extends T ? never : T : never;
1134
+ type BaseUrl = ExtractLiterals<ClientOptions['baseUrl']>;
1135
+
1136
+ /**
1137
+ * The settable fields of the widget config cascade.
1138
+ *
1139
+ * This is the type accepted by {@link setGlobalWidgetConfig} and all provider props.
1140
+ * It intentionally excludes `initResponse`, which is populated automatically by the
1141
+ * provider after a successful fetch and must never be set manually.
1142
+ *
1143
+ * The `null` vs `undefined` distinction on `widgetToken` and `organizationId` is intentional:
1144
+ * - `undefined` — not set at this level; inherit from the nearest ancestor or global store.
1145
+ * - `null` — explicitly cleared; downstream sees "no value" even if an ancestor had one
1146
+ * (e.g. after logout or deliberate de-scoping).
1147
+ *
1148
+ * @see {@link WidgetConfig} for the resolved output type (includes `initResponse`)
1149
+ * @see {@link RootWidgetProvider}
1150
+ * @see {@link WidgetProvider}
1151
+ * @see {@link setGlobalWidgetConfig}
1152
+ */
1153
+ interface WidgetConfigInput {
1154
+ /**
1155
+ * Base URL of the Tesouro embedded API (e.g. `"https://api.tesouro.com"`).
1156
+ *
1157
+ * When omitted the nearest ancestor's `baseUrl` or the global store value is used.
1158
+ * Changing this recreates the underlying HTTP client so all subsequent requests
1159
+ * go to the new host.
1160
+ */
1161
+ baseUrl?: BaseUrl;
1162
+ /**
1163
+ * Bearer token used to authenticate widget requests.
1164
+ *
1165
+ * Injected as `Authorization: Bearer <token>` on every outgoing request via an
1166
+ * interceptor on the scoped HTTP client. Token updates are picked up immediately
1167
+ * without recreating the client.
1168
+ *
1169
+ * - `string` — send this token on all requests from this level downward.
1170
+ * - `null` — explicitly cleared; no auth header is sent and fetching is suppressed.
1171
+ * - `undefined` — not set at this level; inherit from the nearest ancestor or global store.
1172
+ */
1173
+ widgetToken?: string | null;
1174
+ /**
1175
+ * Organization ID forwarded as the `x-organization-id` request header.
1176
+ *
1177
+ * Passed through {@link EmbedApiProvider} context rather than the auth interceptor,
1178
+ * so individual data-access hooks can opt in per-request.
1179
+ *
1180
+ * - `string` — use this organization for downstream data requests.
1181
+ * - `null` — explicitly cleared; queries that require an org ID will be disabled.
1182
+ * - `undefined` — not set at this level; inherit from the nearest ancestor or global store.
1183
+ *
1184
+ * When `undefined` across the **whole** cascade (no prop, no ancestor, no global
1185
+ * value), the resolved org defaults to the loaded `initResponse.organizationId`
1186
+ * (see {@link WidgetConfig.initResponse}) once the widget-init fetch settles. This
1187
+ * is the lowest-priority fallback — any explicit `string` or `null` at any cascade
1188
+ * level wins, and an explicit `null` is preserved and never falls back.
1189
+ *
1190
+ * Only an **explicit** ancestor org is inherited. An ancestor's *init-derived*
1191
+ * default does not propagate into a descendant that owns its own fetch (its own
1192
+ * `baseUrl`/`widgetToken`); such a descendant defaults to its own
1193
+ * `initResponse.organizationId` instead, so it never sends an ancestor's org with
1194
+ * its own token.
1195
+ */
1196
+ organizationId?: string | null;
1197
+ /**
1198
+ * Optional post-creation hook for the scoped HTTP client.
1199
+ *
1200
+ * Called once after the provider creates its scoped {@link EmbeddedClient} and
1201
+ * applies the built-in `Authorization: Bearer` interceptor. Receives the
1202
+ * fully-configured client and must return the client to be used for the lifetime of
1203
+ * this provider level — either the same instance (with additional interceptors
1204
+ * attached) or a new client entirely.
1205
+ *
1206
+ * **Order:** The built-in auth interceptor is always applied first. `configClient`
1207
+ * is called on top of it, so any interceptors you add here run after auth is set.
1208
+ *
1209
+ * **Any prop triggers a scoped client.** A {@link WidgetProvider} creates its own
1210
+ * scoped client whenever any prop is set — including `configClient` alone, without
1211
+ * `baseUrl` or `widgetToken`. Only a fully props-free pass-through provider skips
1212
+ * client creation and never calls this function.
1213
+ *
1214
+ * **Stability:** The function reference is included in the client creation memo's
1215
+ * dependency array. Passing an unstable (inline) function recreates the client on
1216
+ * every render. Stabilize with `useCallback` or define the function outside the
1217
+ * component.
1218
+ *
1219
+ * **Cascade:** Inherits from the nearest ancestor when `undefined`. A child
1220
+ * {@link WidgetProvider} that creates its own scoped client will use the resolved
1221
+ * `configClient` from the cascade unless it provides its own override.
1222
+ *
1223
+ * @example
1224
+ * ```tsx
1225
+ * const addLogging = useCallback(
1226
+ * (client: EmbeddedClient) => {
1227
+ * client.interceptors.request.use((req) => {
1228
+ * console.log('[widget]', req.method, req.url);
1229
+ * return req;
1230
+ * });
1231
+ * return client;
1232
+ * },
1233
+ * [],
1234
+ * );
1235
+ *
1236
+ * <RootWidgetProvider
1237
+ * baseUrl="https://api.tesouro.com"
1238
+ * widgetToken={token}
1239
+ * configClient={addLogging}
1240
+ * >
1241
+ * <App />
1242
+ * </RootWidgetProvider>
1243
+ * ```
1244
+ */
1245
+ configClient?: (client: EmbeddedClient) => EmbeddedClient;
1246
+ /**
1247
+ * Overrides the widget-gateway routing decision for the scoped HTTP client.
1248
+ *
1249
+ * Any caller reaching the Tesouro API with a widget token must route data
1250
+ * requests through the widget gateway: prefix the path with
1251
+ * `/api/widget-gateway/proxy` and carry the token as `X-Widget-Token`. The
1252
+ * provider applies both automatically per request when the request origin is
1253
+ * a known Tesouro API host (`WIDGET_GATEWAY_HOSTS`, derived from the
1254
+ * generated `ClientOptions['baseUrl']`); `/api/widget-gateway/*` paths (the
1255
+ * init round-trip) always pass through untouched.
1256
+ *
1257
+ * - `undefined` — decide from the request origin, as above. Inherits from
1258
+ * the nearest ancestor or global store like every other config field.
1259
+ * - `true` — always apply the rewrite, even for an unlisted base URL (e.g. a
1260
+ * custom domain in front of the gateway).
1261
+ * - `false` — never apply it. For hosts that route widget requests their own
1262
+ * way, such as a same-origin BFF whose `configClient` retargets every
1263
+ * request.
1264
+ *
1265
+ * Independent of {@link configClient}: a host that only adds a header keeps
1266
+ * the built-in routing, and the built-in interceptor runs before any
1267
+ * `configClient` interceptor.
1268
+ */
1269
+ gatewayRouting?: boolean;
1270
+ /**
1271
+ * Component the embedded widgets should render in place of plain `<a>` tags.
1272
+ *
1273
+ * Pass e.g. Next.js's `Link` to make in-app navigation use the host router.
1274
+ * Cascades like other config: provider prop > nearest ancestor > global store.
1275
+ * When no value is set anywhere, widgets fall back to a plain `<a>` element.
1276
+ */
1277
+ linkComponent?: LinkComponent;
1278
+ /**
1279
+ * Which UI framework the widget UI layer should render with.
1280
+ *
1281
+ * Lets a consuming context bind widgets to either the shadcn/Tailwind or the
1282
+ * Tecton implementation behind the same outward-facing API. The selection is
1283
+ * a presentation concern only — it cascades through the provider tree exactly
1284
+ * like {@link linkComponent} and is read by UI libraries via `useUIFramework`;
1285
+ * it never appears in any widget's feature-library or component props.
1286
+ *
1287
+ * - `'shadcn'` — the shadcn/Tailwind implementation.
1288
+ * - `'tecton'` — the Tecton implementation.
1289
+ * - `null` / `undefined` — not set at this level; inherit from the nearest
1290
+ * ancestor or global store, falling back to `shadcn` when unset everywhere.
1291
+ * `shadcn` is the implicit default, so existing consumers need no changes.
1292
+ */
1293
+ uiFramework?: UIFramework | null;
1294
+ }
1295
+ /**
1296
+ * Props shared by every analytics-owner-capable widget provider.
1297
+ *
1298
+ * Combines the full settable cascade ({@link WidgetConfigInput}) with the
1299
+ * analytics opt-out honored by analytics owners. Both {@link RootWidgetProvider}
1300
+ * and {@link WidgetProvider} build their public props on top of this; the latter
1301
+ * adds error-boundary props of its own.
1302
+ *
1303
+ * @see {@link WidgetConfigInput} for per-field cascade and `null` vs omitted semantics
1304
+ */
1305
+ interface WidgetProviderBaseProps extends WidgetConfigInput {
1306
+ /**
1307
+ * Opt out of all analytics capture and prevent PostHog from loading. Default `true`.
1308
+ *
1309
+ * Honored only by an analytics **owner** — a {@link RootWidgetProvider} or a
1310
+ * standalone {@link WidgetProvider} with no parent provider. When `false`,
1311
+ * owner-bound `track` calls in this subtree become no-ops and the PostHog
1312
+ * installer is never dynamically imported for this owner's environment.
1313
+ * Setting it on a nested {@link WidgetProvider} is ignored in v1 (a one-time
1314
+ * `console.warn` is emitted to make the no-op discoverable).
1315
+ */
1316
+ analytics?: boolean;
1317
+ }
1318
+
1319
+ /**
1320
+ * Copy for the states `WidgetProvider` renders *itself*, in place of the widget:
1321
+ * the error-boundary fallback and the disclosures gate. A host overrides any
1322
+ * subset through the `providerLabels` prop, which cascades like
1323
+ * `disclosuresAcceptance`.
1324
+ *
1325
+ * Not named `Labels` on the public surface: a widget's own `labels` prop is a
1326
+ * different thing, and these two travel together on every widget's props type.
1327
+ */
1328
+ interface WidgetProviderLabels {
1329
+ /** Default copy for the built-in error boundary fallback. */
1330
+ errorBoundaryFallback: string;
1331
+ /** Heading when init reports disclosures are required and not yet accepted. */
1332
+ disclosuresRequiredTitle: string;
1333
+ /** Heading while a token-only refresh leaves init stale for the live token. */
1334
+ disclosuresRefreshingTitle: string;
1335
+ /** Supporting copy while the accept action is withheld for a stale init. */
1336
+ disclosuresRefreshingDescription: string;
1337
+ }
1338
+
1339
+ /**
1340
+ * Props for {@link WidgetProvider}.
1341
+ *
1342
+ * All fields are optional. When **all** are omitted the provider is a transparent
1343
+ * pass-through: no fetch is issued and all resolved values cascade unchanged from
1344
+ * the nearest ancestor.
1345
+ */
1346
+ interface WidgetProviderProps extends WidgetProviderBaseProps {
1347
+ /**
1348
+ * Fallback rendered when a render-time exception is caught inside this
1349
+ * provider's subtree. Pass either a `ReactNode` (rendered directly) or a
1350
+ * render-prop receiving `{ error, resetErrorBoundary }` from
1351
+ * `react-error-boundary`. Default is a plain `role="alert"` div whose copy
1352
+ * comes from `providerLabels.errorBoundaryFallback`.
1353
+ */
1354
+ errorFallback?: ReactNode | ((props: FallbackProps) => ReactNode);
1355
+ /**
1356
+ * Called once when the boundary catches an error, before the fallback
1357
+ * renders. Use for telemetry / error tracking / partner logging. Exceptions
1358
+ * thrown from `onError` propagate per `react-error-boundary` semantics.
1359
+ */
1360
+ onError?: (error: unknown, info: ErrorInfo) => void;
1361
+ /**
1362
+ * Accept surface shown when the caller owes disclosures — an INVITED
1363
+ * teammate (including `NOT_REQUIRED` orgs, who still need Accept to
1364
+ * activate) or an ACTIVE user who owes a new version. Pass
1365
+ * `<AcceptDisclosuresWidget />`. Cascades like `linkComponent`.
1366
+ * WidgetProvider cannot import the widget itself (cycle).
1367
+ */
1368
+ disclosuresAcceptance?: ReactNode;
1369
+ /**
1370
+ * Overrides for the copy this provider renders in place of the widget: the
1371
+ * built-in error-boundary fallback and the disclosures gate. Any subset;
1372
+ * unlisted keys keep their defaults. Cascades like `linkComponent`.
1373
+ *
1374
+ * Named `providerLabels` rather than `labels` because a widget's own
1375
+ * `labels` prop sits alongside this one on the same props type.
1376
+ */
1377
+ providerLabels?: Partial<WidgetProviderLabels>;
1378
+ }
1379
+
1380
+ /**
1381
+ * Which issuing product a card belongs to. A card list shows exactly one
1382
+ * program at a time, and the value selects the endpoint the data-access layer
1383
+ * calls: `credit` → `/embedded-banking/v1/credit-cards`, `debit` →
1384
+ * `/embedded-banking/v1/debit-cards`.
1385
+ *
1386
+ * Defined here rather than in either widget because `CardsWidget` and
1387
+ * `CardDetailsWidget` both publish it as a required public prop. Declared
1388
+ * inline in each, the literal would become public API twice with no single
1389
+ * definition — and `cards-widget/ui` ↔ `card-details-widget/ui` imports are
1390
+ * lint-banned while the reverse feature import would be an Nx cycle, so
1391
+ * `shared/feature` is the only home that serves both without duplication.
1392
+ *
1393
+ * Deliberately **not** the generated `CardTypeEnum` (`credit | debit | prepaid
1394
+ * | unknown`), which greps as an exact match for this concept but belongs to
1395
+ * the unrelated snake_case third-party schema family (its sibling fields are
1396
+ * `card_type`, `last4`, `background_color`) and carries two members neither
1397
+ * widget supports. In this codebase "card type" is the DIGITAL/PHYSICAL form
1398
+ * factor instead — see `CardType` in `./cardPresentation`.
1399
+ *
1400
+ * Const-object-plus-type rather than a bare union, mirroring `UIFramework` in
1401
+ * `shared/ui` — the other two-member literal that ships as a public prop type.
1402
+ */
1403
+ declare const CardProgram: {
1404
+ readonly Credit: "credit";
1405
+ readonly Debit: "debit";
1406
+ };
1407
+ type CardProgram = (typeof CardProgram)[keyof typeof CardProgram];
1408
+
1409
+ /**
1410
+ * A card's lifecycle status, program-agnostic. Aliases the credit union because
1411
+ * one of the two has to be the base; the parity assertions below are what keep
1412
+ * that choice arbitrary.
1413
+ */
1414
+ type CardStatus = CreditCardStatus;
1415
+ /**
1416
+ * A card's physical form factor — the codebase's meaning of "card type". The
1417
+ * credit/debit axis is `CardProgram`, not this.
1418
+ */
1419
+ type CardType = CreditCardType;
1420
+
1421
+ /** Accessible copy for the panel header's controls. */
1422
+ interface CardDetailsHeaderLabels {
1423
+ /** Fallback title when the card has no nickname. */
1424
+ untitledCard: string;
1425
+ /** Accessible name for the kebab that opens the card actions menu. */
1426
+ menuTriggerAriaLabel: string;
1427
+ /** Accessible name for the close (X) control. */
1428
+ closeAriaLabel: string;
1429
+ }
1430
+ /** Accessible copy for the simplified card face. */
1431
+ interface CardDetailsCardFaceLabels {
1432
+ /** Alt text for the bank logo when the caller supplies no `bankLogoAlt`. */
1433
+ bankLogoAlt: string;
1434
+ }
1435
+ /** Row headings and per-row copy affordance names for the details table. */
1436
+ interface CardDetailsFieldLabels {
1437
+ detailsHeading: string;
1438
+ cardholder: string;
1439
+ nickname: string;
1440
+ /**
1441
+ * Heading for the billing-address block: one heading, with a copy control
1442
+ * beside each populated address line.
1443
+ */
1444
+ billingAddress: string;
1445
+ /** Sub-header over the merchant categories / velocity control rows. */
1446
+ cardControlsHeading: string;
1447
+ allowedCategories: string;
1448
+ spendLimit: string;
1449
+ perTransactionMax: string;
1450
+ /** Stands in for a row whose value the card does not carry. */
1451
+ emptyValue: string;
1452
+ /** @deprecated The cardholder detail has no copy control. */
1453
+ copyCardholderAriaLabel: string;
1454
+ /** @deprecated The nickname detail has no copy control. */
1455
+ copyNicknameAriaLabel: string;
1456
+ /** @deprecated Address lines have individual copy controls. */
1457
+ copyBillingAddressAriaLabel: string;
1458
+ copyBillingAddressLine1AriaLabel: string;
1459
+ copyBillingAddressLine2AriaLabel: string;
1460
+ copyBillingAddressCityStateAriaLabel: string;
1461
+ copyBillingAddressPostalCodeAriaLabel: string;
1462
+ copiedLabel: string;
1463
+ }
1464
+ /** Copy for the controls the owner can switch on alongside the details. */
1465
+ interface CardDetailsActionLabels {
1466
+ /** Primary control that opens the Activate Card form. */
1467
+ activateCard: string;
1468
+ /** Secondary control that asks the owner to reveal the card's credentials. */
1469
+ viewCard: string;
1470
+ /** The same control, once the credentials are on screen. */
1471
+ hideCard: string;
1472
+ }
1473
+ /** Copy for the nickname row's inline editor. */
1474
+ interface CardDetailsNicknameLabels {
1475
+ edit: string;
1476
+ /** Accessible name for the control that opens the editor. */
1477
+ editAriaLabel: string;
1478
+ /** Accessible name for the editor's text field. */
1479
+ inputAriaLabel: string;
1480
+ save: string;
1481
+ cancel: string;
1482
+ /** Shown under the editor when the save failed. */
1483
+ errorDescription: string;
1484
+ }
1485
+ /** Copy for the card lock control and for the locked card it produces. */
1486
+ interface CardDetailsLockLabels {
1487
+ lockCard: string;
1488
+ /** The same control, once the card is locked. */
1489
+ unlockCard: string;
1490
+ /** Pill stamped across the card face while it is locked. */
1491
+ cardFaceLabel: string;
1492
+ /** Sentence under the controls while the card is locked. */
1493
+ lockedDescription: string;
1494
+ /**
1495
+ * The same sentence for a reader who has no Unlock control, so it stops short
1496
+ * of promising one. Reachable: reveal and lock are entitled separately, so a
1497
+ * session can see a locked card it cannot unlock.
1498
+ */
1499
+ lockedDescriptionWithoutUnlock: string;
1500
+ /** Shown next to the control when a lock change failed. */
1501
+ errorDescription: string;
1502
+ }
1503
+ /**
1504
+ * Copy for the revealed card credentials. The values themselves never have a
1505
+ * default here — the panel is handed them or renders the field blank.
1506
+ */
1507
+ interface CardDetailsCredentialsLabels {
1508
+ cardNumber: string;
1509
+ expirationDate: string;
1510
+ securityCode: string;
1511
+ copyCardNumberAriaLabel: string;
1512
+ copyExpirationDateAriaLabel: string;
1513
+ copySecurityCodeAriaLabel: string;
1514
+ copiedLabel: string;
1515
+ /** Shown next to the control when the reveal failed. */
1516
+ errorDescription: string;
1517
+ }
1518
+ /** Copy for the three non-loaded screens. */
1519
+ interface CardDetailsStatusScreenLabels {
1520
+ /** Accessible name announced while the panel is loading. */
1521
+ loadingAriaLabel: string;
1522
+ errorTitle: string;
1523
+ errorDescription: string;
1524
+ errorRetry: string;
1525
+ notFoundTitle: string;
1526
+ notFoundDescription: string;
1527
+ }
1528
+ interface CardDetailsPanelLabels {
1529
+ header: CardDetailsHeaderLabels;
1530
+ cardFace: CardDetailsCardFaceLabels;
1531
+ fields: CardDetailsFieldLabels;
1532
+ actions: CardDetailsActionLabels;
1533
+ nickname: CardDetailsNicknameLabels;
1534
+ lock: CardDetailsLockLabels;
1535
+ credentials: CardDetailsCredentialsLabels;
1536
+ status: CardDetailsStatusScreenLabels;
1537
+ }
1538
+
1539
+ /** Chrome around the form. */
1540
+ interface ActivateCardHeaderLabels {
1541
+ title: string;
1542
+ /** Accessible name for the close (X) control. */
1543
+ closeAriaLabel: string;
1544
+ }
1545
+ /** Accessible copy for the card face this panel reuses. */
1546
+ interface ActivateCardCardFaceLabels {
1547
+ /** Alt text for the bank logo when the caller supplies no `bankLogoAlt`. */
1548
+ bankLogoAlt: string;
1549
+ }
1550
+ /** Field headings, placeholders and the copy behind each affordance. */
1551
+ interface ActivateCardFieldLabels {
1552
+ expirationDate: string;
1553
+ expirationDatePlaceholder: string;
1554
+ securityCode: string;
1555
+ securityCodePlaceholder: string;
1556
+ /** Accessible name for the (?) control that reveals the explanation. */
1557
+ securityCodeInfoAriaLabel: string;
1558
+ /** The explanation itself, shown in the tooltip. */
1559
+ securityCodeInfo: string;
1560
+ }
1561
+ /** One message per failure the panel can mark. */
1562
+ interface ActivateCardValidationLabels {
1563
+ impossibleMonth: string;
1564
+ pastExpiration: string;
1565
+ /**
1566
+ * Shown when the server rejects the pair. Names both values because the
1567
+ * verify endpoint withholds which one missed — see `ActivateCardFormErrors`.
1568
+ */
1569
+ verificationRejected: string;
1570
+ }
1571
+ /** The CTA and the two screens that replace or accompany the form. */
1572
+ interface ActivateCardStatusLabels {
1573
+ submit: string;
1574
+ /** Accessible name announced while the activation is in flight. */
1575
+ submittingAriaLabel: string;
1576
+ successTitle: string;
1577
+ successDescription: string;
1578
+ successCardholderLabel: string;
1579
+ successLastFourLabel: string;
1580
+ successFormatLabel: string;
1581
+ /** Label for the optional post-success control. */
1582
+ done: string;
1583
+ /** Fallback failure copy when the owner supplies no `errorMessage`. */
1584
+ errorDescription: string;
1585
+ }
1586
+ interface ActivateCardPanelLabels {
1587
+ header: ActivateCardHeaderLabels;
1588
+ cardFace: ActivateCardCardFaceLabels;
1589
+ fields: ActivateCardFieldLabels;
1590
+ validation: ActivateCardValidationLabels;
1591
+ status: ActivateCardStatusLabels;
1592
+ }
1593
+
1594
+ /**
1595
+ * Copy the **feature** layer owns, as opposed to the panel's own
1596
+ * `CardDetailsPanelLabels`.
1597
+ *
1598
+ * The split follows where the string is resolved, not where it is painted. A
1599
+ * status badge word is chosen by mapping a generated `cardStatus` enum member,
1600
+ * which is a data-access-typed decision the presentational layer is not allowed
1601
+ * to make — so it is overridable here even though the panel renders it. The
1602
+ * panel's own labels stay with the panel.
1603
+ */
1604
+ interface CardDetailsFeatureLabels {
1605
+ /** @deprecated Unused: copy buttons confirm themselves. */
1606
+ copySuccessToast: string;
1607
+ /**
1608
+ * Toast shown when activation is refused because the card is no longer
1609
+ * awaiting it. Resolved here rather than in the panel because it is an
1610
+ * API outcome, and because the panel closes as it fires.
1611
+ */
1612
+ activationConflictToast: string;
1613
+ /**
1614
+ * Toast shown when a lock change is refused because the card is no longer in
1615
+ * a state that accepts one. Same reason as `activationConflictToast`: it is an
1616
+ * API outcome, not something the panel can know.
1617
+ */
1618
+ lockConflictToast: string;
1619
+ /** Confirmation toast after the nickname is saved. */
1620
+ nicknameUpdatedToast: string;
1621
+ /**
1622
+ * Toast shown when a nickname save is refused because the card moved on. The
1623
+ * editor closes as it fires, so the reader lands on the refetched name.
1624
+ */
1625
+ nicknameConflictToast: string;
1626
+ /**
1627
+ * Replaces the panel's generic reveal error when the credentials call was
1628
+ * refused (HTTP 403).
1629
+ *
1630
+ * It lives here rather than on the panel because deciding that a failure was a
1631
+ * refusal means reading the error, which is this layer's job — the panel is
1632
+ * handed one already-chosen sentence either way, and its own
1633
+ * `credentials.errorDescription` still covers every other failure.
1634
+ *
1635
+ * The wording deliberately does not tell the reader to ask for a permission.
1636
+ * Reading a debit card and reading its credentials take the same scope, so a
1637
+ * reader looking at this panel already holds it; a 403 here means the call was
1638
+ * refused for this session, which asking an admin for a role will not fix.
1639
+ */
1640
+ revealNotPermittedDescription: string;
1641
+ /** @deprecated Unused: the card face no longer shows program wording. */
1642
+ programLabels: Record<CardProgram, string>;
1643
+ /** Status badge wording, keyed on the generated card status. */
1644
+ statusLabels: Record<CardStatus, string>;
1645
+ /** Form-factor subtitle wording, keyed on the generated card type. */
1646
+ formFactorLabels: Record<CardType, string>;
1647
+ /**
1648
+ * A velocity control's reset-period wording, keyed on the generated
1649
+ * `velocityWindow`. Used to build the spend limit row, e.g. "$500 / month".
1650
+ * `TRANSACTION` is unused there (it drives the separate per-transaction max
1651
+ * row instead) but is still a real enum member, so it stays in the map.
1652
+ */
1653
+ velocityWindowLabels: Record<VelocityWindow, string>;
1654
+ }
1655
+
1656
+ interface CardDetailsWidgetProps extends WidgetProviderProps {
1657
+ /** Id of the card to show. */
1658
+ cardId: string;
1659
+ /**
1660
+ * Which issuing product `cardId` belongs to. **Required, with no default** —
1661
+ * it selects the endpoint the card is fetched from, and a wrong guess would
1662
+ * 404 a card that exists. `CardsWidget` publishes the same required prop, so
1663
+ * one value configures a list and its detail panel together.
1664
+ *
1665
+ * A JavaScript consumer, or a host passing a route param straight through, can
1666
+ * still get a value past the type. **There is no catch-all and no default:**
1667
+ * anything that is not explicitly one of the two programs fetches nothing and
1668
+ * renders the panel's error state with no retry, and the reason is named on the
1669
+ * console. That covers an absent prop (`undefined` / `null`) as well as an
1670
+ * unrecognised one (`'prepaid'`, a case-wrong `'Credit'`), because the widget
1671
+ * cannot know which product to ask about in either case.
1672
+ *
1673
+ * A host that resolves the program asynchronously should gate its own render on
1674
+ * it rather than mounting this widget without it — an absent program is not
1675
+ * read as "still loading".
1676
+ */
1677
+ cardProgram: CardProgram;
1678
+ /**
1679
+ * Called when the header's close control is pressed. Omitting it renders no
1680
+ * close control at all: a standalone card page has nothing to close back to,
1681
+ * while a host rendering the panel in a drawer supplies this and suppresses
1682
+ * its own chrome's close button so the two do not sit side by side.
1683
+ */
1684
+ onClose?: () => void;
1685
+ /** Overrides for the panel's own copy. */
1686
+ labels?: PartialDeep<CardDetailsPanelLabels>;
1687
+ /** Overrides for the Activate Card form's copy. */
1688
+ activateLabels?: PartialDeep<ActivateCardPanelLabels>;
1689
+ /** Overrides for the copy this layer resolves — see `CardDetailsFeatureLabels`. */
1690
+ featureLabels?: PartialDeep<CardDetailsFeatureLabels>;
1691
+ /**
1692
+ * Full per-tenant plastic art (EMBD-5466) — the same asset `CreateCardWidget`
1693
+ * shows for this tenant, e.g. from `CardsWidgetProps.cardArtSrc`. Takes
1694
+ * priority over `bankLogoSrc`, per `CardFace`'s own doc comment. Same
1695
+ * PLAT-1179 / embedded ADR 0005 reason as `bankLogoSrc` below: the package
1696
+ * ships no card artwork of its own, so a host or white-label config supplies
1697
+ * this rather than a bundled lookup table.
1698
+ */
1699
+ cardArtSrc?: string;
1700
+ /**
1701
+ * Bank logo for the card face. The widget ships no bank artwork of its own and
1702
+ * resolves none from the init response: an embeddable library must not depend
1703
+ * on a Tesouro-hosted asset a host page's content-security policy can block,
1704
+ * and a bundled bank-name→URL table would put internal CDN links in the
1705
+ * published package (PLAT-1179, embedded ADR 0005). Omit it and the card face
1706
+ * renders without a logo rather than with a placeholder. Ignored when
1707
+ * `cardArtSrc` is supplied.
1708
+ */
1709
+ bankLogoSrc?: string;
1710
+ bankLogoAlt?: string;
1711
+ }
1712
+
1713
+ /**
1714
+ * Reset-period tab labels and notice copy are deliberately absent: the owner
1715
+ * supplies those through `spendLimitPeriodOptions` / `spendLimitPeriodNotices`,
1716
+ * so declaring them here would give consumers override keys that no component
1717
+ * ever reads.
1718
+ */
1719
+ interface CardControlsLabels {
1720
+ currencySymbol: string;
1721
+ spendLimit: {
1722
+ title: string;
1723
+ description: string;
1724
+ amountPlaceholder: string;
1725
+ amountAriaLabel: string;
1726
+ };
1727
+ merchantCategories: {
1728
+ title: string;
1729
+ description: string;
1730
+ };
1731
+ perTransactionMaximum: {
1732
+ title: string;
1733
+ description: string;
1734
+ amountPlaceholder: string;
1735
+ amountAriaLabel: string;
1736
+ };
1737
+ }
1738
+
1739
+ interface CreateCardWidgetLabels {
1740
+ header: {
1741
+ title: string;
1742
+ closeAriaLabel: string;
1743
+ };
1744
+ cardArtAlt: string;
1745
+ setup: {
1746
+ sectionTitle: string;
1747
+ cardholderLabel: string;
1748
+ cardholderPlaceholder: string;
1749
+ cardFormatLabel: string;
1750
+ cardFormatPlaceholder: string;
1751
+ cardFormatVirtual: string;
1752
+ cardFormatPhysical: string;
1753
+ fundingAccountLabel: string;
1754
+ fundingAccountPlaceholder: string;
1755
+ };
1756
+ mailing: {
1757
+ sectionTitle: string;
1758
+ sectionDescription: string;
1759
+ businessTitle: string;
1760
+ businessDescription: string;
1761
+ customTitle: string;
1762
+ customDescription: string;
1763
+ };
1764
+ manualAddress: {
1765
+ streetLabel: string;
1766
+ cityLabel: string;
1767
+ stateLabel: string;
1768
+ statePlaceholder: string;
1769
+ zipLabel: string;
1770
+ };
1771
+ cardControls: CardControlsLabels;
1772
+ preparing: {
1773
+ title: string;
1774
+ description: string;
1775
+ };
1776
+ success: {
1777
+ title: string;
1778
+ description: string;
1779
+ cardholderLabel: string;
1780
+ lastFourLabel: string;
1781
+ formatLabel: string;
1782
+ done: string;
1783
+ viewCard: string;
1784
+ };
1785
+ footer: {
1786
+ cancel: string;
1787
+ createCard: string;
1788
+ };
1789
+ cardholderError: {
1790
+ title: string;
1791
+ description: string;
1792
+ retry: string;
1793
+ };
1794
+ fundingAccountError: {
1795
+ title: string;
1796
+ description: string;
1797
+ retry: string;
1798
+ };
1799
+ }
1800
+
1801
+ interface CreateCardFeatureLabels {
1802
+ toast: {
1803
+ creating: string;
1804
+ success: string;
1805
+ error: string;
1806
+ /**
1807
+ * Card issued but a follow-up velocity-control POST failed. The card
1808
+ * already exists; this must not read as a create failure.
1809
+ */
1810
+ controlsWarning: string;
1811
+ /**
1812
+ * Card issued but granting company admins access to it failed. The card
1813
+ * already exists; this must not read as a create failure.
1814
+ */
1815
+ companyAdminAccessWarning: string;
1816
+ /**
1817
+ * Card issued, but BOTH the velocity-control POST(s) and the company-admin
1818
+ * access grant failed. Distinct from the two single-failure warnings above
1819
+ * so an issuer who hits both is told about both, not just whichever this
1820
+ * code checks first.
1821
+ */
1822
+ controlsAndAccessWarning: string;
1823
+ /**
1824
+ * The roster of users to grant access to a new card failed to load.
1825
+ * Shown with a retry action; Create stays disabled until it resolves so
1826
+ * a card is never issued without its required admin grants.
1827
+ */
1828
+ debitCardIssuersError: string;
1829
+ retry: string;
1830
+ };
1831
+ untitledFundingAccount: string;
1832
+ /**
1833
+ * API-required `name` on a velocity control. Not shown in this widget;
1834
+ * may surface on a later controls list.
1835
+ */
1836
+ velocityControlNames: {
1837
+ spendLimit: string;
1838
+ perTransactionMaximum: string;
1839
+ };
1840
+ /**
1841
+ * Spend-limit reset-period tab labels and notices. Owned here (not UI
1842
+ * labels) because the feature layer decides what each opaque period value
1843
+ * means.
1844
+ */
1845
+ spendLimit: {
1846
+ periodOneTime: string;
1847
+ periodDaily: string;
1848
+ periodMonthly: string;
1849
+ oneTimeWarningTitle: string;
1850
+ oneTimeWarningDescription: string;
1851
+ dailyResetNotice: string;
1852
+ monthlyResetNotice: string;
1853
+ };
1854
+ /**
1855
+ * Success-screen copy chosen from the create response's `cardStatus`.
1856
+ * Active/ready wording lives on the UI defaults; these cover statuses that
1857
+ * must not claim the card is already usable.
1858
+ */
1859
+ success: {
1860
+ pendingActivationTitle: string;
1861
+ pendingActivationDescription: string;
1862
+ createdTitle: string;
1863
+ createdDescription: string;
1864
+ };
1865
+ }
1866
+
1867
+ type CreateCardWidgetProps = WidgetProviderProps & {
1868
+ /** Static card plastic image URL (no overlays). Host / white-label supplied. */
1869
+ cardArtSrc: string;
1870
+ labels?: PartialDeep<CreateCardWidgetLabels>;
1871
+ featureLabels?: Partial<{
1872
+ toast: Partial<CreateCardFeatureLabels['toast']>;
1873
+ untitledFundingAccount: string;
1874
+ velocityControlNames: Partial<CreateCardFeatureLabels['velocityControlNames']>;
1875
+ spendLimit: Partial<CreateCardFeatureLabels['spendLimit']>;
1876
+ success: Partial<CreateCardFeatureLabels['success']>;
1877
+ }>;
1878
+ className?: string;
1879
+ onClose?: () => void;
1880
+ onCancel?: () => void;
1881
+ /** Fired with the new debit card id after a successful create. */
1882
+ onViewCard?: (cardId: string) => void;
1883
+ };
1884
+
1885
+ /**
1886
+ * Strings this layer produces rather than passes through.
1887
+ *
1888
+ * They are separate from `CardsListLabels` (the `ui` lib's) because the cells
1889
+ * reaching that library are already formatted: the em-dash, the nickname
1890
+ * fallback and the pager's range are all written *here*, so the UI lib has
1891
+ * no key to override them with. `bank-accounts-widget`'s `featureLabels` is the
1892
+ * precedent for the split.
1893
+ *
1894
+ * The status and form-factor maps live here for the same reason. EMBD-4503's
1895
+ * amendment put them in `shared/feature` keyed on the generated unions, and the
1896
+ * row arrives with `statusLabel` / `typeLabel` resolved — so this is the only
1897
+ * layer a consumer could reach them through.
1898
+ */
1899
+ interface CardsFeatureLabels {
1900
+ /**
1901
+ * Stands in for a cell the card program carries no value for — credit has no
1902
+ * funding account, and a debit card's funding account is unresolvable without
1903
+ * the bank-account read scope.
1904
+ */
1905
+ emptyValue: string;
1906
+ /** Name shown for a card with no nickname set. */
1907
+ untitledCard: string;
1908
+ /**
1909
+ * Last-resort name for a funding account with neither a nickname nor an
1910
+ * account number to mask. An account with no nickname shows `••••1234`
1911
+ * instead, so that two unnamed accounts stay distinguishable — this is only
1912
+ * for the case where there is nothing at all to show.
1913
+ */
1914
+ untitledFundingAccount: string;
1915
+ /** `{from}` and `{to}` are substituted. */
1916
+ pageRange: string;
1917
+ /** Display copy per card lifecycle status; keys are the generated code terms. */
1918
+ cardStatus: Record<CardStatus, string>;
1919
+ /** Display copy per card form factor; keys are the generated code terms. */
1920
+ cardType: Record<CardType, string>;
1921
+ }
1922
+
1923
+ /**
1924
+ * What `onPaginationChange` reports. One shared type across both programs — the
1925
+ * shape does not vary by program, so per-program aliases would be published
1926
+ * surface for nothing. Named without the `Widget` segment because no widget
1927
+ * called `CardsWidget` is published any more; `CreditCardsWidget` and
1928
+ * `DebitCardsWidget` both hand back this.
1929
+ */
1930
+ interface CardsPagination {
1931
+ /** Cursor for the page on screen. Omit for the first page. */
1932
+ paginationToken?: string;
1933
+ /** Number of rows requested per page. */
1934
+ pageSize: number;
1935
+ }
1936
+ /**
1937
+ * The wider shape `pagination` / `defaultPagination` accept. Internal: a
1938
+ * `CardsPagination` handed back by `onPaginationChange` satisfies it, which is
1939
+ * the round-trip the docs describe, so the package publishes only that one.
1940
+ * Keeps the `CardsWidget` segment because the internal component keeps the name.
1941
+ */
1942
+ interface CardsWidgetPaginationInput {
1943
+ paginationToken?: string;
1944
+ pageSize?: number;
1945
+ }
1946
+
1947
+ /**
1948
+ * The internal props. Not published: `CreditCardsWidgetProps` and
1949
+ * `DebitCardsWidgetProps` are derived from this by omission, which is what makes
1950
+ * `cardProgram` an implementation detail and the debit-only create props
1951
+ * unreachable on a credit list.
1952
+ */
1953
+ interface CardsWidgetProps extends WidgetProviderProps {
1954
+ /**
1955
+ * Which issuing program the list shows — `'credit'` or `'debit'`. It selects
1956
+ * the endpoint that is read as well as which scopes gate the affordances.
1957
+ *
1958
+ * **Required, with no default**, and supplied by the wrapper rather than by a
1959
+ * consumer: `CreditCardsWidget` and `DebitCardsWidget` pin it. It was a public
1960
+ * prop until those two exports replaced it, and a default here would silently
1961
+ * pick a program, where an integrator on one route only ever wants one.
1962
+ */
1963
+ cardProgram: CardProgram;
1964
+ /**
1965
+ * Controlled cursor/page-size metadata. Supply with `onPaginationChange` when
1966
+ * a host owns the list position, e.g. URL-backed pagination.
1967
+ */
1968
+ pagination?: CardsWidgetPaginationInput;
1969
+ /**
1970
+ * Initial cursor/page-size metadata for uncontrolled usage. Omit for first
1971
+ * page with the default page size. Ignored when `pagination` is supplied.
1972
+ */
1973
+ defaultPagination?: CardsWidgetPaginationInput;
1974
+ /**
1975
+ * Called whenever the widget changes its cursor/page-size pair through pagination
1976
+ * controls or a cursor-invalidating reset such as page-size changes. Hosts that
1977
+ * persist list position should store this whole object, not the token alone.
1978
+ */
1979
+ onPaginationChange?: (pagination: CardsPagination) => void;
1980
+ /**
1981
+ * Overrides for the list's own copy, merged per nested group. Typed with the
1982
+ * `ui` lib's own deep-partial helper (each labels module declares one — the
1983
+ * repo has no shared version) so this prop follows that library's contract.
1984
+ */
1985
+ labels?: PartialDeep<CardsListLabels>;
1986
+ /**
1987
+ * Overrides for the copy this layer produces rather than passes through — the
1988
+ * status and form-factor vocabulary, the empty-cell placeholder, the nickname
1989
+ * fallbacks, and the pagination range prefix. Separate from `labels` because
1990
+ * the list library receives those values already formatted and so has no key
1991
+ * for them; `BankAccountsWidget.featureLabels` is the same split.
1992
+ */
1993
+ featureLabels?: PartialDeep<CardsFeatureLabels>;
1994
+ /**
1995
+ * The card whose details panel is open. Supply with `onSelectedCardIdChange`
1996
+ * when the host owns that state — a deep-linked `/cards/[id]`, say. `null`
1997
+ * closes the panel; omit the prop for uncontrolled behaviour.
1998
+ *
1999
+ * Pinning it to `null` and navigating from `onSelectedCardIdChange` is how a
2000
+ * host suppresses the built-in panel entirely and owns navigation itself: the
2001
+ * click is still reported, and because the value never comes back non-null,
2002
+ * nothing ever opens.
2003
+ */
2004
+ selectedCardId?: string | null;
2005
+ /** Initial selection when uncontrolled. Ignored when `selectedCardId` is supplied. */
2006
+ defaultSelectedCardId?: string | null;
2007
+ /**
2008
+ * Called whenever the open card changes, including on close (`null`).
2009
+ *
2010
+ * Supplying it does **not** change what renders — a host can observe row clicks
2011
+ * for analytics, or mirror the selection into a query param, and still get the
2012
+ * built-in panel. (The removed `onCardSelect` could not: its presence
2013
+ * suppressed the panel, so those two intents were unexpressible together.)
2014
+ */
2015
+ onSelectedCardIdChange?: (cardId: string | null) => void;
2016
+ /**
2017
+ * Label overrides forwarded into the nested card details panel, mirroring
2018
+ * `BankAccountsWidgetProps.accountDetailsLabels`.
2019
+ *
2020
+ * Derived from the receiving prop rather than restated, so the forwarded and
2021
+ * received types cannot drift. Naming the panel's labels type directly is not
2022
+ * an option anyway: a cross-widget `type:ui` import is banned by
2023
+ * `EMBEDDED_DEP_CONSTRAINTS`, and this indexed access reaches it through the
2024
+ * sanctioned feature → feature edge without re-exporting anything. It already
2025
+ * carries `card-details-widget`'s own deep partial, so no wrapper here.
2026
+ */
2027
+ cardDetailsLabels?: CardDetailsWidgetProps['labels'];
2028
+ /**
2029
+ * Overrides for the copy the panel's *feature* layer resolves — its status
2030
+ * vocabulary, form-factor wording and toasts.
2031
+ *
2032
+ * Distinct from `featureLabels`, which covers the list's own vocabulary.
2033
+ * Without this prop the panel is unreachable for that copy, so a host that
2034
+ * renames a status in the list would still read the default inside the panel.
2035
+ */
2036
+ cardDetailsFeatureLabels?: CardDetailsWidgetProps['featureLabels'];
2037
+ /**
2038
+ * Overrides for the Activate Card form the details panel opens.
2039
+ *
2040
+ * Its own prop for the same reason `cardDetailsLabels` is: without it that
2041
+ * screen's copy is unreachable from this composition, so a host that translated
2042
+ * everything else would still meet English on the one form that asks the reader
2043
+ * to type something.
2044
+ */
2045
+ cardDetailsActivateLabels?: CardDetailsWidgetProps['activateLabels'];
2046
+ /**
2047
+ * Bank logo for the details panel's card face. Forwarded verbatim; the panel
2048
+ * renders no logo without it, so omitting these leaves the built-in sheet
2049
+ * showing a logo-less card rather than a placeholder.
2050
+ *
2051
+ * These stay props because the package ships no bank artwork and resolves none
2052
+ * from the init response (PLAT-1179, embedded ADR 0005).
2053
+ */
2054
+ bankLogoSrc?: string;
2055
+ bankLogoAlt?: string;
2056
+ /**
2057
+ * Plastic art for the built-in debit create sheet, and (EMBD-5466) for the
2058
+ * details panel's card face — forwarded verbatim into both nested
2059
+ * `CreateCardWidget` and `CardDetailsWidget`, so a card created in this
2060
+ * widget's own sheet and that same card's later details view show the same
2061
+ * artwork. Omitted, the create sheet draws a built-in neutral plastic and the
2062
+ * details panel falls back to `bankLogoSrc`, same as `CardDetailsWidget` on
2063
+ * its own. Card art never decides whether Create card shows; the token's
2064
+ * scopes do.
2065
+ */
2066
+ cardArtSrc?: string;
2067
+ /**
2068
+ * Label overrides forwarded into the nested create-card panel. Indexed off
2069
+ * `CreateCardWidgetProps` so the forwarded and received types cannot drift,
2070
+ * the same feature → feature edge as `cardDetailsLabels`.
2071
+ */
2072
+ createCardLabels?: CreateCardWidgetProps['labels'];
2073
+ /**
2074
+ * Overrides for the copy the create panel's *feature* layer resolves — mutation
2075
+ * toasts, the untitled funding-account fallback, and pending-activation success
2076
+ * copy.
2077
+ */
2078
+ createCardFeatureLabels?: CreateCardWidgetProps['featureLabels'];
2079
+ /**
2080
+ * Called when Create card is clicked. When supplied, the host owns the
2081
+ * gesture: the built-in debit sheet does **not** open. Omit it on a debit
2082
+ * list to use the built-in `CreateCardWidget` sheet. Credit has no in-package
2083
+ * issuance widget, so credit Create card still requires this callback —
2084
+ * omitting it hides the button rather than offering a control that does
2085
+ * nothing.
2086
+ */
2087
+ onCreateCard?: () => void;
2088
+ /**
2089
+ * Arrival prop (EMBD-6962): `'create'` lands the reader on the built-in
2090
+ * create sheet instead of the bare list, e.g. from a dashboard "Issue card"
2091
+ * shortcut. Same name and shape as `ReceivablesWidget.initialView`
2092
+ * (EMBD-4184), the other "open on the create form" arrival in the package.
2093
+ *
2094
+ * Read once, when the token's scopes first resolve: the sheet opens only if
2095
+ * the built-in flow is available then (debit, `canCreateCard`, and no host
2096
+ * `onCreateCard`); otherwise the list shows as usual. Closing the sheet
2097
+ * returns to the list and nothing reopens it, and a later change to this
2098
+ * prop is ignored. It is not a controlled value: the widget reads no router,
2099
+ * so a host mirroring it into the URL should clear that param itself.
2100
+ */
2101
+ initialView?: 'create';
2102
+ /**
2103
+ * Your own markup for the start of the list's header row, beside Create card,
2104
+ * typically the heading you would otherwise render above the widget. The
2105
+ * widget renders no heading of its own, so you pick the element and level.
2106
+ */
2107
+ headerStart?: ReactNode;
2108
+ /**
2109
+ * Called with the card's id when a row's Activate button is clicked. The button
2110
+ * renders only on cards in `PENDING_ACTIVATION`, and only when the widget token
2111
+ * also holds the program's activate scope.
2112
+ *
2113
+ * Host-owned because EMBD-4398 designs no activation flow for the *list*.
2114
+ *
2115
+ * The original second reason — that no activate endpoint existed — no longer
2116
+ * holds: both programs have one, and the details panel this widget opens now
2117
+ * runs the whole flow itself (EMBD-5085). So a built-in row flow is now
2118
+ * buildable, and this callback stays host-owned by choice rather than by
2119
+ * necessity. Changing it would be a breaking change to a published prop and
2120
+ * belongs in its own ticket; until then a host that wants the built-in flow
2121
+ * can omit this and let the reader open the card.
2122
+ */
2123
+ onActivateCard?: (cardId: string) => void;
2124
+ }
2125
+
2126
+ /**
2127
+ * Derived from the internal props rather than restated, so the two cannot drift.
2128
+ * Only `cardProgram` is omitted — the built-in create sheet is debit's, so this
2129
+ * export keeps `cardArtSrc` and the two create-panel label props.
2130
+ */
2131
+ type DebitCardsWidgetProps = Omit<CardsWidgetProps, 'cardProgram'>;
2132
+ /**
2133
+ * One page of an organization's **debit** cards, with scope-gated Show my cards,
2134
+ * Create card and per-row Activate affordances. Selecting a row opens that
2135
+ * card's read-only details in a sheet.
2136
+ *
2137
+ * Create card opens the same sheet with the built-in `CreateCardWidget`
2138
+ * issuance flow, drawing `cardArtSrc` or a built-in plastic; a host
2139
+ * `onCreateCard` still takes the gesture over. Credit is
2140
+ * {@link CreditCardsWidget}, which accepts neither `cardArtSrc` nor the
2141
+ * create-panel labels.
2142
+ *
2143
+ * The program is pinned *after* the spread, so a JavaScript host still passing
2144
+ * the retired `cardProgram` cannot point this export at the credit endpoint.
2145
+ */
2146
+ declare function DebitCardsWidget(props: DebitCardsWidgetProps): React.JSX.Element;
2147
+
2148
+ export { DebitCardsWidget };
2149
+ export type { DebitCardsWidgetProps };