@tesouro/embedded-components-loader 0.0.0 → 0.11.200
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/NOTICE +7 -0
- package/README.md +314 -5
- package/dist/caretRange.d.ts +13 -0
- package/dist/caretRange.d.ts.map +1 -0
- package/dist/entries.generated.d.ts +34 -0
- package/dist/entries.generated.d.ts.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +208 -0
- package/dist/loader.d.ts +66 -0
- package/dist/loader.d.ts.map +1 -0
- package/dist/react/experimental/BalanceHistoryWidget.d.ts +1382 -0
- package/dist/react/experimental/QuickViewWidget.d.ts +888 -0
- package/dist/react/experimental/RemoteCheckCapture.d.ts +714 -0
- package/dist/react/experimental/index.d.ts +1776 -0
- package/dist/react/index.d.ts +7429 -0
- package/dist/react/lib/AcceptDisclosuresWidget.d.ts +1457 -0
- package/dist/react/lib/BalancesWidget.d.ts +647 -0
- package/dist/react/lib/BankAccountOnboardingWidget.d.ts +2053 -0
- package/dist/react/lib/BankAccountsWidget.d.ts +773 -0
- package/dist/react/lib/BankingComplianceBannerWidget.d.ts +647 -0
- package/dist/react/lib/BillPayWidget.d.ts +651 -0
- package/dist/react/lib/CardDetailsWidget.d.ts +1647 -0
- package/dist/react/lib/CounterpartsWidget.d.ts +1698 -0
- package/dist/react/lib/CounterpartsWidgetPublic.d.ts +1697 -0
- package/dist/react/lib/CreditCardsWidget.d.ts +2153 -0
- package/dist/react/lib/DebitCardsWidget.d.ts +2149 -0
- package/dist/react/lib/ExpenseManagementWidget.d.ts +835 -0
- package/dist/react/lib/InsightsWidget.d.ts +696 -0
- package/dist/react/lib/LinkedAccountsWidget.d.ts +726 -0
- package/dist/react/lib/OfferWidget.d.ts +1421 -0
- package/dist/react/lib/ReceivablesWidget.d.ts +2556 -0
- package/dist/react/lib/RecentActivityWidget.d.ts +655 -0
- package/dist/react/lib/SettingsWidget.d.ts +775 -0
- package/dist/react/lib/TransfersWidget.d.ts +794 -0
- package/dist/react/lib/WidgetProvider.d.ts +1305 -0
- package/dist/react/lib/WidgetProviderPublic.d.ts +619 -0
- package/dist/react/lib/WidgetSuite.d.ts +5664 -0
- package/dist/stylesheet.d.ts +3 -0
- package/dist/stylesheet.d.ts.map +1 -0
- package/package.json +93 -4
|
@@ -0,0 +1,2556 @@
|
|
|
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
|
+
interface LabelLabels {
|
|
698
|
+
/**
|
|
699
|
+
* How the field name and its requirement fragment compose. `{label}` is the
|
|
700
|
+
* name, `{marker}` the asterisk or the note — reorder them freely, and note
|
|
701
|
+
* that the space between them is part of this string.
|
|
702
|
+
*/
|
|
703
|
+
composition: string;
|
|
704
|
+
/** In the label's own colour, deliberately not `destructive`. */
|
|
705
|
+
requiredMarker: string;
|
|
706
|
+
/**
|
|
707
|
+
* Screen-reader-only stand-in for the marker, for a control whose role does
|
|
708
|
+
* not take `aria-required` — a popover trigger is a `button`, which does
|
|
709
|
+
* not. Render it hidden and name it from the control's `aria-labelledby`.
|
|
710
|
+
*/
|
|
711
|
+
requiredAccessibleText: string;
|
|
712
|
+
optionalNote: string;
|
|
713
|
+
/** "This has no meaning here", as against `optionalNote`'s "may be blank". */
|
|
714
|
+
notApplicableNote: string;
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
interface RequiredFieldsLegendLabels {
|
|
718
|
+
/**
|
|
719
|
+
* One string, so a translator can move the marker into whatever clause the
|
|
720
|
+
* language wants. `{marker}` is substituted with `marker`, rendered
|
|
721
|
+
* semi-bold; keep the placeholder when overriding.
|
|
722
|
+
*/
|
|
723
|
+
instruction: string;
|
|
724
|
+
marker: string;
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
interface FilterMenuButtonLabels {
|
|
728
|
+
/** Button text, followed by "(N)" when `activeCount` is set. */
|
|
729
|
+
filters: string;
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
interface FilterTagLabels {
|
|
733
|
+
/**
|
|
734
|
+
* Accessible name for the editable tag body. `{label}` is substituted with
|
|
735
|
+
* the tag's own text; keep the placeholder when overriding.
|
|
736
|
+
*/
|
|
737
|
+
edit: string;
|
|
738
|
+
/** Accessible name for the × dismiss button. `{label}` is substituted. */
|
|
739
|
+
remove: string;
|
|
740
|
+
/** Accessible name for the × when `fullLabel` is set. `{label}` is the full text. */
|
|
741
|
+
removeFull: string;
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
interface DateRangePickerLabels {
|
|
745
|
+
/**
|
|
746
|
+
* Name of the preset field, rendered before the select (a `:` is appended by
|
|
747
|
+
* the component). Owners showing more than one date field pass the one that
|
|
748
|
+
* names theirs, e.g. "Due date range".
|
|
749
|
+
*/
|
|
750
|
+
fieldLabel: string;
|
|
751
|
+
/** Select placeholder shown while the range matches no preset. */
|
|
752
|
+
presetPlaceholder: string;
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
interface AmountFilterLabels {
|
|
756
|
+
/**
|
|
757
|
+
* Rendered next to the min input. Owners pass the wording that matches their
|
|
758
|
+
* bound semantics — "No less than" for inclusive, "Greater than" for not.
|
|
759
|
+
*/
|
|
760
|
+
min: string;
|
|
761
|
+
/** Rendered next to the max input. See {@link min}. */
|
|
762
|
+
max: string;
|
|
763
|
+
/** Amount-mode radio options. */
|
|
764
|
+
modeAny: string;
|
|
765
|
+
modeExact: string;
|
|
766
|
+
modeRange: string;
|
|
767
|
+
/** Flow-direction radio options, shown only when `showFlowDirection`. */
|
|
768
|
+
flowAny: string;
|
|
769
|
+
flowIn: string;
|
|
770
|
+
flowOut: string;
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
type AuthToken = string | undefined;
|
|
774
|
+
interface Auth {
|
|
775
|
+
/**
|
|
776
|
+
* Which part of the request do we use to send the auth?
|
|
777
|
+
*
|
|
778
|
+
* @default 'header'
|
|
779
|
+
*/
|
|
780
|
+
in?: 'header' | 'query' | 'cookie';
|
|
781
|
+
/**
|
|
782
|
+
* A unique identifier for the security scheme.
|
|
783
|
+
*
|
|
784
|
+
* Defined only when there are multiple security schemes whose `Auth`
|
|
785
|
+
* shape would otherwise be identical.
|
|
786
|
+
*/
|
|
787
|
+
key?: string;
|
|
788
|
+
/**
|
|
789
|
+
* Header or query parameter name.
|
|
790
|
+
*
|
|
791
|
+
* @default 'Authorization'
|
|
792
|
+
*/
|
|
793
|
+
name?: string;
|
|
794
|
+
scheme?: 'basic' | 'bearer';
|
|
795
|
+
type: 'apiKey' | 'http';
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
interface SerializerOptions<T> {
|
|
799
|
+
/**
|
|
800
|
+
* @default true
|
|
801
|
+
*/
|
|
802
|
+
explode: boolean;
|
|
803
|
+
style: T;
|
|
804
|
+
}
|
|
805
|
+
type ArrayStyle = 'form' | 'spaceDelimited' | 'pipeDelimited';
|
|
806
|
+
type ObjectStyle = 'form' | 'deepObject';
|
|
807
|
+
|
|
808
|
+
type QuerySerializer = (query: Record<string, unknown>) => string;
|
|
809
|
+
type BodySerializer = (body: unknown) => unknown;
|
|
810
|
+
type QuerySerializerOptionsObject = {
|
|
811
|
+
allowReserved?: boolean;
|
|
812
|
+
array?: Partial<SerializerOptions<ArrayStyle>>;
|
|
813
|
+
object?: Partial<SerializerOptions<ObjectStyle>>;
|
|
814
|
+
};
|
|
815
|
+
type QuerySerializerOptions = QuerySerializerOptionsObject & {
|
|
816
|
+
/**
|
|
817
|
+
* Per-parameter serialization overrides. When provided, these settings
|
|
818
|
+
* override the global array/object settings for specific parameter names.
|
|
819
|
+
*/
|
|
820
|
+
parameters?: Record<string, QuerySerializerOptionsObject>;
|
|
821
|
+
};
|
|
822
|
+
|
|
823
|
+
type HttpMethod = 'connect' | 'delete' | 'get' | 'head' | 'options' | 'patch' | 'post' | 'put' | 'trace';
|
|
824
|
+
type Client$1<RequestFn = never, Config = unknown, MethodFn = never, BuildUrlFn = never, SseFn = never> = {
|
|
825
|
+
/**
|
|
826
|
+
* Returns the final request URL.
|
|
827
|
+
*/
|
|
828
|
+
buildUrl: BuildUrlFn;
|
|
829
|
+
getConfig: () => Config;
|
|
830
|
+
request: RequestFn;
|
|
831
|
+
setConfig: (config: Config) => Config;
|
|
832
|
+
} & {
|
|
833
|
+
[K in HttpMethod]: MethodFn;
|
|
834
|
+
} & ([SseFn] extends [never] ? {
|
|
835
|
+
sse?: never;
|
|
836
|
+
} : {
|
|
837
|
+
sse: {
|
|
838
|
+
[K in HttpMethod]: SseFn;
|
|
839
|
+
};
|
|
840
|
+
});
|
|
841
|
+
interface Config$1 {
|
|
842
|
+
/**
|
|
843
|
+
* Auth token or a function returning auth token. The resolved value will be
|
|
844
|
+
* added to the request payload as defined by its `security` array.
|
|
845
|
+
*/
|
|
846
|
+
auth?: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken;
|
|
847
|
+
/**
|
|
848
|
+
* A function for serializing request body parameter. By default,
|
|
849
|
+
* {@link JSON.stringify()} will be used.
|
|
850
|
+
*/
|
|
851
|
+
bodySerializer?: BodySerializer | null;
|
|
852
|
+
/**
|
|
853
|
+
* An object containing any HTTP headers that you want to pre-populate your
|
|
854
|
+
* `Headers` object with.
|
|
855
|
+
*
|
|
856
|
+
* {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more}
|
|
857
|
+
*/
|
|
858
|
+
headers?: RequestInit['headers'] | Record<string, string | number | boolean | (string | number | boolean)[] | null | undefined | unknown>;
|
|
859
|
+
/**
|
|
860
|
+
* The request method.
|
|
861
|
+
*
|
|
862
|
+
* {@link https://developer.mozilla.org/docs/Web/API/fetch#method See more}
|
|
863
|
+
*/
|
|
864
|
+
method?: Uppercase<HttpMethod>;
|
|
865
|
+
/**
|
|
866
|
+
* A function for serializing request query parameters. By default, arrays
|
|
867
|
+
* will be exploded in form style, objects will be exploded in deepObject
|
|
868
|
+
* style, and reserved characters are percent-encoded.
|
|
869
|
+
*
|
|
870
|
+
* This method will have no effect if the native `paramsSerializer()` Axios
|
|
871
|
+
* API function is used.
|
|
872
|
+
*
|
|
873
|
+
* {@link https://swagger.io/docs/specification/serialization/#query View examples}
|
|
874
|
+
*/
|
|
875
|
+
querySerializer?: QuerySerializer | QuerySerializerOptions;
|
|
876
|
+
/**
|
|
877
|
+
* A function validating request data. This is useful if you want to ensure
|
|
878
|
+
* the request conforms to the desired shape, so it can be safely sent to
|
|
879
|
+
* the server.
|
|
880
|
+
*/
|
|
881
|
+
requestValidator?: (data: unknown) => Promise<unknown>;
|
|
882
|
+
/**
|
|
883
|
+
* A function transforming response data before it's returned. This is useful
|
|
884
|
+
* for post-processing data, e.g., converting ISO strings into Date objects.
|
|
885
|
+
*/
|
|
886
|
+
responseTransformer?: (data: unknown) => Promise<unknown>;
|
|
887
|
+
/**
|
|
888
|
+
* A function validating response data. This is useful if you want to ensure
|
|
889
|
+
* the response conforms to the desired shape, so it can be safely passed to
|
|
890
|
+
* the transformers and returned to the user.
|
|
891
|
+
*/
|
|
892
|
+
responseValidator?: (data: unknown) => Promise<unknown>;
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
type ServerSentEventsOptions<TData = unknown> = Omit<RequestInit, 'method'> & Pick<Config$1, 'method' | 'responseTransformer' | 'responseValidator'> & {
|
|
896
|
+
/**
|
|
897
|
+
* Fetch API implementation. You can use this option to provide a custom
|
|
898
|
+
* fetch instance.
|
|
899
|
+
*
|
|
900
|
+
* @default globalThis.fetch
|
|
901
|
+
*/
|
|
902
|
+
fetch?: typeof fetch;
|
|
903
|
+
/**
|
|
904
|
+
* Implementing clients can call request interceptors inside this hook.
|
|
905
|
+
*/
|
|
906
|
+
onRequest?: (url: string, init: RequestInit) => Promise<Request>;
|
|
907
|
+
/**
|
|
908
|
+
* Callback invoked when a network or parsing error occurs during streaming.
|
|
909
|
+
*
|
|
910
|
+
* This option applies only if the endpoint returns a stream of events.
|
|
911
|
+
*
|
|
912
|
+
* @param error The error that occurred.
|
|
913
|
+
*/
|
|
914
|
+
onSseError?: (error: unknown) => void;
|
|
915
|
+
/**
|
|
916
|
+
* Callback invoked when an event is streamed from the server.
|
|
917
|
+
*
|
|
918
|
+
* This option applies only if the endpoint returns a stream of events.
|
|
919
|
+
*
|
|
920
|
+
* @param event Event streamed from the server.
|
|
921
|
+
* @returns Nothing (void).
|
|
922
|
+
*/
|
|
923
|
+
onSseEvent?: (event: StreamEvent<TData>) => void;
|
|
924
|
+
serializedBody?: RequestInit['body'];
|
|
925
|
+
/**
|
|
926
|
+
* Default retry delay in milliseconds.
|
|
927
|
+
*
|
|
928
|
+
* This option applies only if the endpoint returns a stream of events.
|
|
929
|
+
*
|
|
930
|
+
* @default 3000
|
|
931
|
+
*/
|
|
932
|
+
sseDefaultRetryDelay?: number;
|
|
933
|
+
/**
|
|
934
|
+
* Maximum number of retry attempts before giving up.
|
|
935
|
+
*/
|
|
936
|
+
sseMaxRetryAttempts?: number;
|
|
937
|
+
/**
|
|
938
|
+
* Maximum retry delay in milliseconds.
|
|
939
|
+
*
|
|
940
|
+
* Applies only when exponential backoff is used.
|
|
941
|
+
*
|
|
942
|
+
* This option applies only if the endpoint returns a stream of events.
|
|
943
|
+
*
|
|
944
|
+
* @default 30000
|
|
945
|
+
*/
|
|
946
|
+
sseMaxRetryDelay?: number;
|
|
947
|
+
/**
|
|
948
|
+
* Optional sleep function for retry backoff.
|
|
949
|
+
*
|
|
950
|
+
* Defaults to using `setTimeout`.
|
|
951
|
+
*/
|
|
952
|
+
sseSleepFn?: (ms: number) => Promise<void>;
|
|
953
|
+
url: string;
|
|
954
|
+
};
|
|
955
|
+
interface StreamEvent<TData = unknown> {
|
|
956
|
+
data: TData;
|
|
957
|
+
event?: string;
|
|
958
|
+
id?: string;
|
|
959
|
+
retry?: number;
|
|
960
|
+
}
|
|
961
|
+
type ServerSentEventsResult<TData = unknown, TReturn = void, TNext = unknown> = {
|
|
962
|
+
stream: AsyncGenerator<TData extends Record<string, unknown> ? TData[keyof TData] : TData, TReturn, TNext>;
|
|
963
|
+
};
|
|
964
|
+
|
|
965
|
+
type ErrInterceptor<Err, Res, Req, Options> = (error: Err,
|
|
966
|
+
/** response may be undefined due to a network error where no response object is produced */
|
|
967
|
+
response: Res | undefined,
|
|
968
|
+
/** request may be undefined, because error may be from building the request object itself */
|
|
969
|
+
request: Req | undefined, options: Options) => Err | Promise<Err>;
|
|
970
|
+
type ReqInterceptor<Req, Options> = (request: Req, options: Options) => Req | Promise<Req>;
|
|
971
|
+
type ResInterceptor<Res, Req, Options> = (response: Res, request: Req, options: Options) => Res | Promise<Res>;
|
|
972
|
+
declare class Interceptors<Interceptor> {
|
|
973
|
+
fns: Array<Interceptor | null>;
|
|
974
|
+
clear(): void;
|
|
975
|
+
eject(id: number | Interceptor): void;
|
|
976
|
+
exists(id: number | Interceptor): boolean;
|
|
977
|
+
getInterceptorIndex(id: number | Interceptor): number;
|
|
978
|
+
update(id: number | Interceptor, fn: Interceptor): number | Interceptor | false;
|
|
979
|
+
use(fn: Interceptor): number;
|
|
980
|
+
}
|
|
981
|
+
interface Middleware<Req, Res, Err, Options> {
|
|
982
|
+
error: Interceptors<ErrInterceptor<Err, Res, Req, Options>>;
|
|
983
|
+
request: Interceptors<ReqInterceptor<Req, Options>>;
|
|
984
|
+
response: Interceptors<ResInterceptor<Res, Req, Options>>;
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
type ResponseStyle = 'data' | 'fields';
|
|
988
|
+
interface Config<T extends ClientOptions$1 = ClientOptions$1> extends Omit<RequestInit, 'body' | 'headers' | 'method'>, Config$1 {
|
|
989
|
+
/**
|
|
990
|
+
* Base URL for all requests made by this client.
|
|
991
|
+
*/
|
|
992
|
+
baseUrl?: T['baseUrl'];
|
|
993
|
+
/**
|
|
994
|
+
* Fetch API implementation. You can use this option to provide a custom
|
|
995
|
+
* fetch instance.
|
|
996
|
+
*
|
|
997
|
+
* @default globalThis.fetch
|
|
998
|
+
*/
|
|
999
|
+
fetch?: typeof fetch;
|
|
1000
|
+
/**
|
|
1001
|
+
* Please don't use the Fetch client for Next.js applications. The `next`
|
|
1002
|
+
* options won't have any effect.
|
|
1003
|
+
*
|
|
1004
|
+
* Install {@link https://www.npmjs.com/package/@hey-api/client-next `@hey-api/client-next`} instead.
|
|
1005
|
+
*/
|
|
1006
|
+
next?: never;
|
|
1007
|
+
/**
|
|
1008
|
+
* Return the response data parsed in a specified format. By default, `auto`
|
|
1009
|
+
* will infer the appropriate method from the `Content-Type` response header.
|
|
1010
|
+
* You can override this behavior with any of the {@link Body} methods.
|
|
1011
|
+
* Select `stream` if you don't want to parse response data at all.
|
|
1012
|
+
*
|
|
1013
|
+
* @default 'auto'
|
|
1014
|
+
*/
|
|
1015
|
+
parseAs?: 'arrayBuffer' | 'auto' | 'blob' | 'formData' | 'json' | 'stream' | 'text';
|
|
1016
|
+
/**
|
|
1017
|
+
* Should we return only data or multiple fields (data, error, response, etc.)?
|
|
1018
|
+
*
|
|
1019
|
+
* @default 'fields'
|
|
1020
|
+
*/
|
|
1021
|
+
responseStyle?: ResponseStyle;
|
|
1022
|
+
/**
|
|
1023
|
+
* Throw an error instead of returning it in the response?
|
|
1024
|
+
*
|
|
1025
|
+
* @default false
|
|
1026
|
+
*/
|
|
1027
|
+
throwOnError?: T['throwOnError'];
|
|
1028
|
+
}
|
|
1029
|
+
interface RequestOptions<TData = unknown, TResponseStyle extends ResponseStyle = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string> extends Config<{
|
|
1030
|
+
responseStyle: TResponseStyle;
|
|
1031
|
+
throwOnError: ThrowOnError;
|
|
1032
|
+
}>, Pick<ServerSentEventsOptions<TData>, 'onRequest' | 'onSseError' | 'onSseEvent' | 'sseDefaultRetryDelay' | 'sseMaxRetryAttempts' | 'sseMaxRetryDelay'> {
|
|
1033
|
+
/**
|
|
1034
|
+
* Any body that you want to add to your request.
|
|
1035
|
+
*
|
|
1036
|
+
* {@link https://developer.mozilla.org/docs/Web/API/fetch#body}
|
|
1037
|
+
*/
|
|
1038
|
+
body?: unknown;
|
|
1039
|
+
path?: Record<string, unknown>;
|
|
1040
|
+
query?: Record<string, unknown>;
|
|
1041
|
+
/**
|
|
1042
|
+
* Security mechanism(s) to use for the request.
|
|
1043
|
+
*/
|
|
1044
|
+
security?: ReadonlyArray<Auth>;
|
|
1045
|
+
url: Url;
|
|
1046
|
+
}
|
|
1047
|
+
interface ResolvedRequestOptions<TResponseStyle extends ResponseStyle = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string> extends RequestOptions<unknown, TResponseStyle, ThrowOnError, Url> {
|
|
1048
|
+
headers: Headers;
|
|
1049
|
+
serializedBody?: string;
|
|
1050
|
+
}
|
|
1051
|
+
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 : {
|
|
1052
|
+
data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
|
|
1053
|
+
request: Request;
|
|
1054
|
+
response: Response;
|
|
1055
|
+
}> : Promise<TResponseStyle extends 'data' ? (TData extends Record<string, unknown> ? TData[keyof TData] : TData) | undefined : ({
|
|
1056
|
+
data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
|
|
1057
|
+
error: undefined;
|
|
1058
|
+
} | {
|
|
1059
|
+
data: undefined;
|
|
1060
|
+
error: TError extends Record<string, unknown> ? TError[keyof TError] : TError;
|
|
1061
|
+
}) & {
|
|
1062
|
+
/** request may be undefined, because error may be from building the request object itself */
|
|
1063
|
+
request?: Request;
|
|
1064
|
+
/** response may be undefined, because error may be from building the request object itself or from a network error */
|
|
1065
|
+
response?: Response;
|
|
1066
|
+
}>;
|
|
1067
|
+
interface ClientOptions$1 {
|
|
1068
|
+
baseUrl?: string;
|
|
1069
|
+
responseStyle?: ResponseStyle;
|
|
1070
|
+
throwOnError?: boolean;
|
|
1071
|
+
}
|
|
1072
|
+
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>;
|
|
1073
|
+
type SseFn = <TData = unknown, _TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<never, TResponseStyle, ThrowOnError>, 'method'>) => Promise<ServerSentEventsResult<TData>>;
|
|
1074
|
+
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>;
|
|
1075
|
+
type BuildUrlFn = <TData extends {
|
|
1076
|
+
body?: unknown;
|
|
1077
|
+
path?: Record<string, unknown>;
|
|
1078
|
+
query?: Record<string, unknown>;
|
|
1079
|
+
url: string;
|
|
1080
|
+
}>(options: TData & Options<TData>) => string;
|
|
1081
|
+
type Client = Client$1<RequestFn, Config, MethodFn, BuildUrlFn, SseFn> & {
|
|
1082
|
+
interceptors: Middleware<Request, Response, unknown, ResolvedRequestOptions>;
|
|
1083
|
+
};
|
|
1084
|
+
interface TDataShape {
|
|
1085
|
+
body?: unknown;
|
|
1086
|
+
headers?: unknown;
|
|
1087
|
+
path?: unknown;
|
|
1088
|
+
query?: unknown;
|
|
1089
|
+
url: string;
|
|
1090
|
+
}
|
|
1091
|
+
type OmitKeys<T, K> = Pick<T, Exclude<keyof T, K>>;
|
|
1092
|
+
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'>);
|
|
1093
|
+
|
|
1094
|
+
type ClientOptions = {
|
|
1095
|
+
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 & {});
|
|
1096
|
+
};
|
|
1097
|
+
|
|
1098
|
+
type EmbeddedClient = Client;
|
|
1099
|
+
type ExtractLiterals<T> = T extends string ? string extends T ? never : T : never;
|
|
1100
|
+
type BaseUrl = ExtractLiterals<ClientOptions['baseUrl']>;
|
|
1101
|
+
|
|
1102
|
+
type LinkComponentProps = AnchorHTMLAttributes<HTMLAnchorElement> & {
|
|
1103
|
+
children?: ReactNode;
|
|
1104
|
+
};
|
|
1105
|
+
type LinkComponent = ComponentType<LinkComponentProps>;
|
|
1106
|
+
/**
|
|
1107
|
+
* The UI frameworks a widget's UI layer can render with.
|
|
1108
|
+
*
|
|
1109
|
+
* - `shadcn` — the shadcn/Tailwind implementation. This is the default and the
|
|
1110
|
+
* implicit fallback, so existing consumers that select nothing keep rendering
|
|
1111
|
+
* shadcn.
|
|
1112
|
+
* - `tecton` — the Tecton implementation.
|
|
1113
|
+
*
|
|
1114
|
+
* Declared as an `as const` object (not a TypeScript `enum`) per repo
|
|
1115
|
+
* convention.
|
|
1116
|
+
*/
|
|
1117
|
+
declare const UIFramework: {
|
|
1118
|
+
readonly Shadcn: "shadcn";
|
|
1119
|
+
readonly Tecton: "tecton";
|
|
1120
|
+
};
|
|
1121
|
+
type UIFramework = (typeof UIFramework)[keyof typeof UIFramework];
|
|
1122
|
+
|
|
1123
|
+
/**
|
|
1124
|
+
* The settable fields of the widget config cascade.
|
|
1125
|
+
*
|
|
1126
|
+
* This is the type accepted by {@link setGlobalWidgetConfig} and all provider props.
|
|
1127
|
+
* It intentionally excludes `initResponse`, which is populated automatically by the
|
|
1128
|
+
* provider after a successful fetch and must never be set manually.
|
|
1129
|
+
*
|
|
1130
|
+
* The `null` vs `undefined` distinction on `widgetToken` and `organizationId` is intentional:
|
|
1131
|
+
* - `undefined` — not set at this level; inherit from the nearest ancestor or global store.
|
|
1132
|
+
* - `null` — explicitly cleared; downstream sees "no value" even if an ancestor had one
|
|
1133
|
+
* (e.g. after logout or deliberate de-scoping).
|
|
1134
|
+
*
|
|
1135
|
+
* @see {@link WidgetConfig} for the resolved output type (includes `initResponse`)
|
|
1136
|
+
* @see {@link RootWidgetProvider}
|
|
1137
|
+
* @see {@link WidgetProvider}
|
|
1138
|
+
* @see {@link setGlobalWidgetConfig}
|
|
1139
|
+
*/
|
|
1140
|
+
interface WidgetConfigInput {
|
|
1141
|
+
/**
|
|
1142
|
+
* Base URL of the Tesouro embedded API (e.g. `"https://api.tesouro.com"`).
|
|
1143
|
+
*
|
|
1144
|
+
* When omitted the nearest ancestor's `baseUrl` or the global store value is used.
|
|
1145
|
+
* Changing this recreates the underlying HTTP client so all subsequent requests
|
|
1146
|
+
* go to the new host.
|
|
1147
|
+
*/
|
|
1148
|
+
baseUrl?: BaseUrl;
|
|
1149
|
+
/**
|
|
1150
|
+
* Bearer token used to authenticate widget requests.
|
|
1151
|
+
*
|
|
1152
|
+
* Injected as `Authorization: Bearer <token>` on every outgoing request via an
|
|
1153
|
+
* interceptor on the scoped HTTP client. Token updates are picked up immediately
|
|
1154
|
+
* without recreating the client.
|
|
1155
|
+
*
|
|
1156
|
+
* - `string` — send this token on all requests from this level downward.
|
|
1157
|
+
* - `null` — explicitly cleared; no auth header is sent and fetching is suppressed.
|
|
1158
|
+
* - `undefined` — not set at this level; inherit from the nearest ancestor or global store.
|
|
1159
|
+
*/
|
|
1160
|
+
widgetToken?: string | null;
|
|
1161
|
+
/**
|
|
1162
|
+
* Organization ID forwarded as the `x-organization-id` request header.
|
|
1163
|
+
*
|
|
1164
|
+
* Passed through {@link EmbedApiProvider} context rather than the auth interceptor,
|
|
1165
|
+
* so individual data-access hooks can opt in per-request.
|
|
1166
|
+
*
|
|
1167
|
+
* - `string` — use this organization for downstream data requests.
|
|
1168
|
+
* - `null` — explicitly cleared; queries that require an org ID will be disabled.
|
|
1169
|
+
* - `undefined` — not set at this level; inherit from the nearest ancestor or global store.
|
|
1170
|
+
*
|
|
1171
|
+
* When `undefined` across the **whole** cascade (no prop, no ancestor, no global
|
|
1172
|
+
* value), the resolved org defaults to the loaded `initResponse.organizationId`
|
|
1173
|
+
* (see {@link WidgetConfig.initResponse}) once the widget-init fetch settles. This
|
|
1174
|
+
* is the lowest-priority fallback — any explicit `string` or `null` at any cascade
|
|
1175
|
+
* level wins, and an explicit `null` is preserved and never falls back.
|
|
1176
|
+
*
|
|
1177
|
+
* Only an **explicit** ancestor org is inherited. An ancestor's *init-derived*
|
|
1178
|
+
* default does not propagate into a descendant that owns its own fetch (its own
|
|
1179
|
+
* `baseUrl`/`widgetToken`); such a descendant defaults to its own
|
|
1180
|
+
* `initResponse.organizationId` instead, so it never sends an ancestor's org with
|
|
1181
|
+
* its own token.
|
|
1182
|
+
*/
|
|
1183
|
+
organizationId?: string | null;
|
|
1184
|
+
/**
|
|
1185
|
+
* Optional post-creation hook for the scoped HTTP client.
|
|
1186
|
+
*
|
|
1187
|
+
* Called once after the provider creates its scoped {@link EmbeddedClient} and
|
|
1188
|
+
* applies the built-in `Authorization: Bearer` interceptor. Receives the
|
|
1189
|
+
* fully-configured client and must return the client to be used for the lifetime of
|
|
1190
|
+
* this provider level — either the same instance (with additional interceptors
|
|
1191
|
+
* attached) or a new client entirely.
|
|
1192
|
+
*
|
|
1193
|
+
* **Order:** The built-in auth interceptor is always applied first. `configClient`
|
|
1194
|
+
* is called on top of it, so any interceptors you add here run after auth is set.
|
|
1195
|
+
*
|
|
1196
|
+
* **Any prop triggers a scoped client.** A {@link WidgetProvider} creates its own
|
|
1197
|
+
* scoped client whenever any prop is set — including `configClient` alone, without
|
|
1198
|
+
* `baseUrl` or `widgetToken`. Only a fully props-free pass-through provider skips
|
|
1199
|
+
* client creation and never calls this function.
|
|
1200
|
+
*
|
|
1201
|
+
* **Stability:** The function reference is included in the client creation memo's
|
|
1202
|
+
* dependency array. Passing an unstable (inline) function recreates the client on
|
|
1203
|
+
* every render. Stabilize with `useCallback` or define the function outside the
|
|
1204
|
+
* component.
|
|
1205
|
+
*
|
|
1206
|
+
* **Cascade:** Inherits from the nearest ancestor when `undefined`. A child
|
|
1207
|
+
* {@link WidgetProvider} that creates its own scoped client will use the resolved
|
|
1208
|
+
* `configClient` from the cascade unless it provides its own override.
|
|
1209
|
+
*
|
|
1210
|
+
* @example
|
|
1211
|
+
* ```tsx
|
|
1212
|
+
* const addLogging = useCallback(
|
|
1213
|
+
* (client: EmbeddedClient) => {
|
|
1214
|
+
* client.interceptors.request.use((req) => {
|
|
1215
|
+
* console.log('[widget]', req.method, req.url);
|
|
1216
|
+
* return req;
|
|
1217
|
+
* });
|
|
1218
|
+
* return client;
|
|
1219
|
+
* },
|
|
1220
|
+
* [],
|
|
1221
|
+
* );
|
|
1222
|
+
*
|
|
1223
|
+
* <RootWidgetProvider
|
|
1224
|
+
* baseUrl="https://api.tesouro.com"
|
|
1225
|
+
* widgetToken={token}
|
|
1226
|
+
* configClient={addLogging}
|
|
1227
|
+
* >
|
|
1228
|
+
* <App />
|
|
1229
|
+
* </RootWidgetProvider>
|
|
1230
|
+
* ```
|
|
1231
|
+
*/
|
|
1232
|
+
configClient?: (client: EmbeddedClient) => EmbeddedClient;
|
|
1233
|
+
/**
|
|
1234
|
+
* Overrides the widget-gateway routing decision for the scoped HTTP client.
|
|
1235
|
+
*
|
|
1236
|
+
* Any caller reaching the Tesouro API with a widget token must route data
|
|
1237
|
+
* requests through the widget gateway: prefix the path with
|
|
1238
|
+
* `/api/widget-gateway/proxy` and carry the token as `X-Widget-Token`. The
|
|
1239
|
+
* provider applies both automatically per request when the request origin is
|
|
1240
|
+
* a known Tesouro API host (`WIDGET_GATEWAY_HOSTS`, derived from the
|
|
1241
|
+
* generated `ClientOptions['baseUrl']`); `/api/widget-gateway/*` paths (the
|
|
1242
|
+
* init round-trip) always pass through untouched.
|
|
1243
|
+
*
|
|
1244
|
+
* - `undefined` — decide from the request origin, as above. Inherits from
|
|
1245
|
+
* the nearest ancestor or global store like every other config field.
|
|
1246
|
+
* - `true` — always apply the rewrite, even for an unlisted base URL (e.g. a
|
|
1247
|
+
* custom domain in front of the gateway).
|
|
1248
|
+
* - `false` — never apply it. For hosts that route widget requests their own
|
|
1249
|
+
* way, such as a same-origin BFF whose `configClient` retargets every
|
|
1250
|
+
* request.
|
|
1251
|
+
*
|
|
1252
|
+
* Independent of {@link configClient}: a host that only adds a header keeps
|
|
1253
|
+
* the built-in routing, and the built-in interceptor runs before any
|
|
1254
|
+
* `configClient` interceptor.
|
|
1255
|
+
*/
|
|
1256
|
+
gatewayRouting?: boolean;
|
|
1257
|
+
/**
|
|
1258
|
+
* Component the embedded widgets should render in place of plain `<a>` tags.
|
|
1259
|
+
*
|
|
1260
|
+
* Pass e.g. Next.js's `Link` to make in-app navigation use the host router.
|
|
1261
|
+
* Cascades like other config: provider prop > nearest ancestor > global store.
|
|
1262
|
+
* When no value is set anywhere, widgets fall back to a plain `<a>` element.
|
|
1263
|
+
*/
|
|
1264
|
+
linkComponent?: LinkComponent;
|
|
1265
|
+
/**
|
|
1266
|
+
* Which UI framework the widget UI layer should render with.
|
|
1267
|
+
*
|
|
1268
|
+
* Lets a consuming context bind widgets to either the shadcn/Tailwind or the
|
|
1269
|
+
* Tecton implementation behind the same outward-facing API. The selection is
|
|
1270
|
+
* a presentation concern only — it cascades through the provider tree exactly
|
|
1271
|
+
* like {@link linkComponent} and is read by UI libraries via `useUIFramework`;
|
|
1272
|
+
* it never appears in any widget's feature-library or component props.
|
|
1273
|
+
*
|
|
1274
|
+
* - `'shadcn'` — the shadcn/Tailwind implementation.
|
|
1275
|
+
* - `'tecton'` — the Tecton implementation.
|
|
1276
|
+
* - `null` / `undefined` — not set at this level; inherit from the nearest
|
|
1277
|
+
* ancestor or global store, falling back to `shadcn` when unset everywhere.
|
|
1278
|
+
* `shadcn` is the implicit default, so existing consumers need no changes.
|
|
1279
|
+
*/
|
|
1280
|
+
uiFramework?: UIFramework | null;
|
|
1281
|
+
}
|
|
1282
|
+
/**
|
|
1283
|
+
* Props shared by every analytics-owner-capable widget provider.
|
|
1284
|
+
*
|
|
1285
|
+
* Combines the full settable cascade ({@link WidgetConfigInput}) with the
|
|
1286
|
+
* analytics opt-out honored by analytics owners. Both {@link RootWidgetProvider}
|
|
1287
|
+
* and {@link WidgetProvider} build their public props on top of this; the latter
|
|
1288
|
+
* adds error-boundary props of its own.
|
|
1289
|
+
*
|
|
1290
|
+
* @see {@link WidgetConfigInput} for per-field cascade and `null` vs omitted semantics
|
|
1291
|
+
*/
|
|
1292
|
+
interface WidgetProviderBaseProps extends WidgetConfigInput {
|
|
1293
|
+
/**
|
|
1294
|
+
* Opt out of all analytics capture and prevent PostHog from loading. Default `true`.
|
|
1295
|
+
*
|
|
1296
|
+
* Honored only by an analytics **owner** — a {@link RootWidgetProvider} or a
|
|
1297
|
+
* standalone {@link WidgetProvider} with no parent provider. When `false`,
|
|
1298
|
+
* owner-bound `track` calls in this subtree become no-ops and the PostHog
|
|
1299
|
+
* installer is never dynamically imported for this owner's environment.
|
|
1300
|
+
* Setting it on a nested {@link WidgetProvider} is ignored in v1 (a one-time
|
|
1301
|
+
* `console.warn` is emitted to make the no-op discoverable).
|
|
1302
|
+
*/
|
|
1303
|
+
analytics?: boolean;
|
|
1304
|
+
}
|
|
1305
|
+
|
|
1306
|
+
/**
|
|
1307
|
+
* Copy for the states `WidgetProvider` renders *itself*, in place of the widget:
|
|
1308
|
+
* the error-boundary fallback and the disclosures gate. A host overrides any
|
|
1309
|
+
* subset through the `providerLabels` prop, which cascades like
|
|
1310
|
+
* `disclosuresAcceptance`.
|
|
1311
|
+
*
|
|
1312
|
+
* Not named `Labels` on the public surface: a widget's own `labels` prop is a
|
|
1313
|
+
* different thing, and these two travel together on every widget's props type.
|
|
1314
|
+
*/
|
|
1315
|
+
interface WidgetProviderLabels {
|
|
1316
|
+
/** Default copy for the built-in error boundary fallback. */
|
|
1317
|
+
errorBoundaryFallback: string;
|
|
1318
|
+
/** Heading when init reports disclosures are required and not yet accepted. */
|
|
1319
|
+
disclosuresRequiredTitle: string;
|
|
1320
|
+
/** Heading while a token-only refresh leaves init stale for the live token. */
|
|
1321
|
+
disclosuresRefreshingTitle: string;
|
|
1322
|
+
/** Supporting copy while the accept action is withheld for a stale init. */
|
|
1323
|
+
disclosuresRefreshingDescription: string;
|
|
1324
|
+
}
|
|
1325
|
+
|
|
1326
|
+
/**
|
|
1327
|
+
* Props for {@link WidgetProvider}.
|
|
1328
|
+
*
|
|
1329
|
+
* All fields are optional. When **all** are omitted the provider is a transparent
|
|
1330
|
+
* pass-through: no fetch is issued and all resolved values cascade unchanged from
|
|
1331
|
+
* the nearest ancestor.
|
|
1332
|
+
*/
|
|
1333
|
+
interface WidgetProviderProps extends WidgetProviderBaseProps {
|
|
1334
|
+
/**
|
|
1335
|
+
* Fallback rendered when a render-time exception is caught inside this
|
|
1336
|
+
* provider's subtree. Pass either a `ReactNode` (rendered directly) or a
|
|
1337
|
+
* render-prop receiving `{ error, resetErrorBoundary }` from
|
|
1338
|
+
* `react-error-boundary`. Default is a plain `role="alert"` div whose copy
|
|
1339
|
+
* comes from `providerLabels.errorBoundaryFallback`.
|
|
1340
|
+
*/
|
|
1341
|
+
errorFallback?: ReactNode | ((props: FallbackProps) => ReactNode);
|
|
1342
|
+
/**
|
|
1343
|
+
* Called once when the boundary catches an error, before the fallback
|
|
1344
|
+
* renders. Use for telemetry / error tracking / partner logging. Exceptions
|
|
1345
|
+
* thrown from `onError` propagate per `react-error-boundary` semantics.
|
|
1346
|
+
*/
|
|
1347
|
+
onError?: (error: unknown, info: ErrorInfo) => void;
|
|
1348
|
+
/**
|
|
1349
|
+
* Accept surface shown when the caller owes disclosures — an INVITED
|
|
1350
|
+
* teammate (including `NOT_REQUIRED` orgs, who still need Accept to
|
|
1351
|
+
* activate) or an ACTIVE user who owes a new version. Pass
|
|
1352
|
+
* `<AcceptDisclosuresWidget />`. Cascades like `linkComponent`.
|
|
1353
|
+
* WidgetProvider cannot import the widget itself (cycle).
|
|
1354
|
+
*/
|
|
1355
|
+
disclosuresAcceptance?: ReactNode;
|
|
1356
|
+
/**
|
|
1357
|
+
* Overrides for the copy this provider renders in place of the widget: the
|
|
1358
|
+
* built-in error-boundary fallback and the disclosures gate. Any subset;
|
|
1359
|
+
* unlisted keys keep their defaults. Cascades like `linkComponent`.
|
|
1360
|
+
*
|
|
1361
|
+
* Named `providerLabels` rather than `labels` because a widget's own
|
|
1362
|
+
* `labels` prop sits alongside this one on the same props type.
|
|
1363
|
+
*/
|
|
1364
|
+
providerLabels?: Partial<WidgetProviderLabels>;
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1367
|
+
declare const DOCUMENT_KINDS: readonly ["invoice", "quote", "credit_note"];
|
|
1368
|
+
type ReceivableDocumentKind = (typeof DOCUMENT_KINDS)[number];
|
|
1369
|
+
|
|
1370
|
+
/** Copy every audit-history formatter needs to name who acted on a row. */
|
|
1371
|
+
interface AuditHistoryActorLabels {
|
|
1372
|
+
/** A template so locales own the wording/order, e.g. "Invoice created by Jane Doe". */
|
|
1373
|
+
byActor: (title: string, actorName: string) => string;
|
|
1374
|
+
}
|
|
1375
|
+
/** Copy and formatting the caller owns, backed by the widget's labels.ts. */
|
|
1376
|
+
interface ReceivableAuditHistoryLabels extends AuditHistoryActorLabels {
|
|
1377
|
+
dateLabel: (isoDateTime: string) => string;
|
|
1378
|
+
timeLabel: (isoDateTime: string) => string;
|
|
1379
|
+
/** The noun for a document kind; `unknown` is a kind the payload named that we do not have. */
|
|
1380
|
+
documentTypeLabel: (kind: ReceivableDocumentKind | 'unknown') => string;
|
|
1381
|
+
/** The display name of a status, with a fallback for values we do not know. */
|
|
1382
|
+
statusLabel: (status: string) => string;
|
|
1383
|
+
formatAmount: (minorUnits: number, currency: string) => string;
|
|
1384
|
+
created: (documentTypeLabel: string) => string;
|
|
1385
|
+
recurringSeriesCreated: string;
|
|
1386
|
+
duplicatedFrom: (documentNumber: string) => string;
|
|
1387
|
+
documentUpdated: string;
|
|
1388
|
+
statusUpdated: string;
|
|
1389
|
+
changedTo: (statusLabel: string) => string;
|
|
1390
|
+
/** The sheet words a quote reaching `expired` on its own, not as "Changed to". */
|
|
1391
|
+
quoteExpired: string;
|
|
1392
|
+
paymentReceived: string;
|
|
1393
|
+
received: (amountLabel: string) => string;
|
|
1394
|
+
/** Used when the event names nobody, e.g. a send recorded before addresses were kept. */
|
|
1395
|
+
sentToCustomer: (documentTypeLabel: string) => string;
|
|
1396
|
+
/** `recipients` is already a joined, display-ready list of addresses. */
|
|
1397
|
+
sentToRecipients: (documentTypeLabel: string, recipients: string) => string;
|
|
1398
|
+
/** A send the API recorded as failed: no address is claimed to have received it. */
|
|
1399
|
+
sendFailed: (documentTypeLabel: string) => string;
|
|
1400
|
+
paymentReminderSent: string;
|
|
1401
|
+
overdueReminderSent: string;
|
|
1402
|
+
/** `days` is 0 on the due date itself. */
|
|
1403
|
+
dueInDays: (days: number) => string;
|
|
1404
|
+
daysOverdue: (days: number) => string;
|
|
1405
|
+
draftDeleted: string;
|
|
1406
|
+
}
|
|
1407
|
+
|
|
1408
|
+
interface AddressFieldGroupLabels {
|
|
1409
|
+
line1: string;
|
|
1410
|
+
line2: string;
|
|
1411
|
+
city: string;
|
|
1412
|
+
state: string;
|
|
1413
|
+
statePlaceholder: string;
|
|
1414
|
+
postalCode: string;
|
|
1415
|
+
country: string;
|
|
1416
|
+
/** Fixed country display value (US-only locale in v1). */
|
|
1417
|
+
countryValue: string;
|
|
1418
|
+
/** The asterisk and "(optional)" copy this group's labels carry. */
|
|
1419
|
+
fieldMarkers: LabelLabels;
|
|
1420
|
+
}
|
|
1421
|
+
interface AchFieldGroupLabels {
|
|
1422
|
+
accountHolderName: string;
|
|
1423
|
+
routingNumber: string;
|
|
1424
|
+
accountNumber: string;
|
|
1425
|
+
routingNumberPlaceholder: string;
|
|
1426
|
+
accountNumberPlaceholder: string;
|
|
1427
|
+
/** The asterisk copy this group's labels carry. */
|
|
1428
|
+
fieldMarkers: LabelLabels;
|
|
1429
|
+
}
|
|
1430
|
+
interface CounterpartFormSheetLabels {
|
|
1431
|
+
createTitleOrganization: string;
|
|
1432
|
+
createTitleIndividual: string;
|
|
1433
|
+
editTitleOrganization: string;
|
|
1434
|
+
editTitleIndividual: string;
|
|
1435
|
+
createTitleCustomer: string;
|
|
1436
|
+
createTitleVendor: string;
|
|
1437
|
+
editTitleCustomer: string;
|
|
1438
|
+
editTitleVendor: string;
|
|
1439
|
+
createDescriptionCustomer: string;
|
|
1440
|
+
createDescriptionVendor: string;
|
|
1441
|
+
customerTypeHeading: string;
|
|
1442
|
+
vendorTypeHeading: string;
|
|
1443
|
+
businessTypeOption: string;
|
|
1444
|
+
businessTypeHint: string;
|
|
1445
|
+
personTypeOption: string;
|
|
1446
|
+
personTypeHint: string;
|
|
1447
|
+
profileHeading: string;
|
|
1448
|
+
addressHeading: string;
|
|
1449
|
+
customerAddressDescription: string;
|
|
1450
|
+
legalNameLabel: string;
|
|
1451
|
+
businessNameLabel: string;
|
|
1452
|
+
firstNameLabel: string;
|
|
1453
|
+
lastNameLabel: string;
|
|
1454
|
+
titleLabel: string;
|
|
1455
|
+
emailLabel: string;
|
|
1456
|
+
phoneLabel: string;
|
|
1457
|
+
/** Used by the inline fields; the sheet prefers the SSN/EIN keys and falls back to this. */
|
|
1458
|
+
taxIdLabel: string;
|
|
1459
|
+
taxIdSsnLabel: string;
|
|
1460
|
+
taxIdEinLabel: string;
|
|
1461
|
+
taxIdSsnPlaceholder: string;
|
|
1462
|
+
taxIdEinPlaceholder: string;
|
|
1463
|
+
customerTaxIdHelp: string;
|
|
1464
|
+
vendorTaxIdHelp: string;
|
|
1465
|
+
paymentRemindersLabel: string;
|
|
1466
|
+
paymentRemindersDescription: string;
|
|
1467
|
+
paymentMethodsHeading: string;
|
|
1468
|
+
paymentMethodsDescription: string;
|
|
1469
|
+
/**
|
|
1470
|
+
* @deprecated Superseded by `ach.accountHolderName`. Kept, and still
|
|
1471
|
+
* mapped in, so a consumer already shipping an override for this
|
|
1472
|
+
* already-published flat key doesn't silently lose it — this package is
|
|
1473
|
+
* published standalone, so removing a public field outright is a breaking
|
|
1474
|
+
* change even when nothing internal still reads it directly.
|
|
1475
|
+
*/
|
|
1476
|
+
accountHolderNameLabel?: string;
|
|
1477
|
+
/** @deprecated Superseded by `ach.routingNumber`. See `accountHolderNameLabel`. */
|
|
1478
|
+
routingNumberLabel?: string;
|
|
1479
|
+
/** @deprecated Superseded by `ach.accountNumber`. See `accountHolderNameLabel`. */
|
|
1480
|
+
accountNumberLabel?: string;
|
|
1481
|
+
addAddress: string;
|
|
1482
|
+
cancelButton: string;
|
|
1483
|
+
/** @deprecated Superseded by `createButtonCustomer` / `createButtonVendor`. */
|
|
1484
|
+
createButton?: string;
|
|
1485
|
+
createButtonCustomer: string;
|
|
1486
|
+
createButtonVendor: string;
|
|
1487
|
+
saveButton: string;
|
|
1488
|
+
/** Screen-reader name and tooltip of the sheet's close (X) button. */
|
|
1489
|
+
close: string;
|
|
1490
|
+
address: AddressFieldGroupLabels;
|
|
1491
|
+
ach: AchFieldGroupLabels;
|
|
1492
|
+
/** Seeds `address.fieldMarkers` and `ach.fieldMarkers` unless set per group. */
|
|
1493
|
+
fieldMarkers: LabelLabels;
|
|
1494
|
+
/** Rendered by the sheet only, not by the inline field group. */
|
|
1495
|
+
requiredFieldsLegend: RequiredFieldsLegendLabels;
|
|
1496
|
+
}
|
|
1497
|
+
|
|
1498
|
+
/**
|
|
1499
|
+
* Overridable validation / error messages produced by the counterparts feature
|
|
1500
|
+
* layer and surfaced through each form's `errors` prop. Consumers override via
|
|
1501
|
+
* the widget's `messageLabels` prop, merged over {@link COUNTERPART_MESSAGE_LABELS_EN}.
|
|
1502
|
+
*/
|
|
1503
|
+
interface CounterpartMessageLabels {
|
|
1504
|
+
legalNameRequired: string;
|
|
1505
|
+
firstNameRequired: string;
|
|
1506
|
+
lastNameRequired: string;
|
|
1507
|
+
emailRequired: string;
|
|
1508
|
+
emailInvalid: string;
|
|
1509
|
+
phoneInvalid: string;
|
|
1510
|
+
taxIdInvalid: string;
|
|
1511
|
+
addressLine1Required: string;
|
|
1512
|
+
cityRequired: string;
|
|
1513
|
+
stateRequired: string;
|
|
1514
|
+
postalCodeRequired: string;
|
|
1515
|
+
accountHolderNameRequired: string;
|
|
1516
|
+
routingNumberInvalid: string;
|
|
1517
|
+
accountNumberInvalid: string;
|
|
1518
|
+
/** Shown for a non-field-specific submit failure. */
|
|
1519
|
+
genericError: string;
|
|
1520
|
+
/** @deprecated Unused; the list labels its own warning. */
|
|
1521
|
+
amountsUnavailable: string;
|
|
1522
|
+
/** Delete confirmation title; `{name}` is replaced with the entity name. */
|
|
1523
|
+
deleteTitle: string;
|
|
1524
|
+
deleteBankAccountTitle: string;
|
|
1525
|
+
deleteBankAccountConfirm: string;
|
|
1526
|
+
deleteCounterpartMessage: string;
|
|
1527
|
+
deleteBankAccountMessage: string;
|
|
1528
|
+
/** @deprecated No longer shown. Use `customerAdded` / `vendorAdded`. */
|
|
1529
|
+
createSucceeded: string;
|
|
1530
|
+
/** @deprecated No longer shown. Use `customerUpdated` / `vendorUpdated`. */
|
|
1531
|
+
updateSucceeded: string;
|
|
1532
|
+
customerAdded: string;
|
|
1533
|
+
vendorAdded: string;
|
|
1534
|
+
customerUpdated: string;
|
|
1535
|
+
vendorUpdated: string;
|
|
1536
|
+
addressAdded: string;
|
|
1537
|
+
addressUpdated: string;
|
|
1538
|
+
bankAccountAdded: string;
|
|
1539
|
+
bankAccountUpdated: string;
|
|
1540
|
+
/**
|
|
1541
|
+
* @deprecated Used only when the delete controller gets no `counterpartType`;
|
|
1542
|
+
* users never see the word "counterpart". Use `customerDeleted` / `vendorDeleted`.
|
|
1543
|
+
*/
|
|
1544
|
+
counterpartDeleted: string;
|
|
1545
|
+
customerDeleted: string;
|
|
1546
|
+
vendorDeleted: string;
|
|
1547
|
+
bankAccountDeleted: string;
|
|
1548
|
+
/** Error toast when a counterpart delete fails without an API message. */
|
|
1549
|
+
deleteCounterpartFailed: string;
|
|
1550
|
+
/** Error toast when a bank account delete fails without an API message. */
|
|
1551
|
+
deleteBankAccountFailed: string;
|
|
1552
|
+
}
|
|
1553
|
+
|
|
1554
|
+
/**
|
|
1555
|
+
* Co-located user-facing strings for the product catalog UI. Each component
|
|
1556
|
+
* takes a `labels?: Partial<…Labels>` prop merged over the matching
|
|
1557
|
+
* `*_LABELS_EN` default.
|
|
1558
|
+
*/
|
|
1559
|
+
interface ProductFormSheetLabels {
|
|
1560
|
+
createTitle: string;
|
|
1561
|
+
/** Shown in the sheet description for the create form. */
|
|
1562
|
+
headerDescription: string;
|
|
1563
|
+
/** Heading of the inline edit form. `{type}` is replaced with the product/service word. */
|
|
1564
|
+
editingBanner: string;
|
|
1565
|
+
nameLabel: string;
|
|
1566
|
+
/** @deprecated Unused: placeholders carry format hints only. */
|
|
1567
|
+
namePlaceholder: string;
|
|
1568
|
+
descriptionLabel: string;
|
|
1569
|
+
/** @deprecated Unused: placeholders carry format hints only. */
|
|
1570
|
+
descriptionPlaceholder: string;
|
|
1571
|
+
/** `{count}` is replaced with the current character count. */
|
|
1572
|
+
descriptionCount: string;
|
|
1573
|
+
typeLabel: string;
|
|
1574
|
+
typeProduct: string;
|
|
1575
|
+
typeService: string;
|
|
1576
|
+
unitLabel: string;
|
|
1577
|
+
unitPlaceholder: string;
|
|
1578
|
+
/** First option in the unit picker; choosing it leaves the unit blank. */
|
|
1579
|
+
noUnit: string;
|
|
1580
|
+
unitEmpty: string;
|
|
1581
|
+
unitClearAriaLabel: string;
|
|
1582
|
+
addUnit: string;
|
|
1583
|
+
priceLabel: string;
|
|
1584
|
+
pricePlaceholder: string;
|
|
1585
|
+
cancelButton: string;
|
|
1586
|
+
/** `{type}` is replaced with the product/service word. */
|
|
1587
|
+
createButton: string;
|
|
1588
|
+
saveButton: string;
|
|
1589
|
+
/** Screen-reader name and tooltip of the sheet's close (X) button. */
|
|
1590
|
+
close: string;
|
|
1591
|
+
/** The required asterisk and "(optional)" note on each field label. */
|
|
1592
|
+
fieldMarkers: LabelLabels;
|
|
1593
|
+
requiredFieldsLegend: RequiredFieldsLegendLabels;
|
|
1594
|
+
}
|
|
1595
|
+
interface MeasureUnitsManagerLabels {
|
|
1596
|
+
title: string;
|
|
1597
|
+
hiddenDescription: string;
|
|
1598
|
+
searchPlaceholder: string;
|
|
1599
|
+
searchLabel: string;
|
|
1600
|
+
columnLabel: string;
|
|
1601
|
+
columnDescription: string;
|
|
1602
|
+
noDescription: string;
|
|
1603
|
+
/** @deprecated Unused: placeholders carry format hints only. */
|
|
1604
|
+
namePlaceholder: string;
|
|
1605
|
+
/** @deprecated Unused: placeholders carry format hints only. */
|
|
1606
|
+
descriptionPlaceholder: string;
|
|
1607
|
+
addButton: string;
|
|
1608
|
+
doneButton: string;
|
|
1609
|
+
editAction: string;
|
|
1610
|
+
deleteAction: string;
|
|
1611
|
+
saveAction: string;
|
|
1612
|
+
cancelAction: string;
|
|
1613
|
+
/** @deprecated Use `emptyTitle` and `emptyDescription`. */
|
|
1614
|
+
emptyText: string;
|
|
1615
|
+
emptyTitle: string;
|
|
1616
|
+
emptyDescription: string;
|
|
1617
|
+
searchEmptyTitle: string;
|
|
1618
|
+
searchEmptyDescription: string;
|
|
1619
|
+
loadingLabel: string;
|
|
1620
|
+
errorTitle: string;
|
|
1621
|
+
errorDescription: string;
|
|
1622
|
+
errorRetry: string;
|
|
1623
|
+
moreActionsLabel: string;
|
|
1624
|
+
close: string;
|
|
1625
|
+
createTitle: string;
|
|
1626
|
+
editTitle: string;
|
|
1627
|
+
nameLabel: string;
|
|
1628
|
+
descriptionLabel: string;
|
|
1629
|
+
fieldMarkers: LabelLabels;
|
|
1630
|
+
}
|
|
1631
|
+
interface MeasureUnitDeleteDialogLabels {
|
|
1632
|
+
/** `{name}` is replaced with the unit name. */
|
|
1633
|
+
title: string;
|
|
1634
|
+
/** @deprecated Unused: `messageNoItemsHint` alone covers a unit no product uses. */
|
|
1635
|
+
messageNoItems: string;
|
|
1636
|
+
messageNoItemsHint: string;
|
|
1637
|
+
messageWithItems: string;
|
|
1638
|
+
messageWithItemsHint: string;
|
|
1639
|
+
confirmButton: string;
|
|
1640
|
+
cancelButton: string;
|
|
1641
|
+
/** Screen-reader name and tooltip of the dialog's close (X) button. */
|
|
1642
|
+
close: string;
|
|
1643
|
+
loadingProducts: string;
|
|
1644
|
+
}
|
|
1645
|
+
|
|
1646
|
+
/**
|
|
1647
|
+
* Overridable validation, error and toast messages produced by the products
|
|
1648
|
+
* feature layer and surfaced through the form's `errors` prop, the
|
|
1649
|
+
* measure-units manager and toasts. Consumers override them through
|
|
1650
|
+
* `ProductsWidget`'s `messageLabels` or `ReceivablesWidget`'s
|
|
1651
|
+
* `productMessageLabels`, merged over {@link PRODUCT_MESSAGE_LABELS_EN}.
|
|
1652
|
+
*/
|
|
1653
|
+
interface ProductMessageLabels {
|
|
1654
|
+
nameRequired: string;
|
|
1655
|
+
/** Shown when a name exceeds the 100-character limit. */
|
|
1656
|
+
nameTooLong: string;
|
|
1657
|
+
typeRequired: string;
|
|
1658
|
+
priceInvalid: string;
|
|
1659
|
+
/** Shown when a description exceeds the 255-character limit. */
|
|
1660
|
+
descriptionTooLong: string;
|
|
1661
|
+
unitNameRequired: string;
|
|
1662
|
+
/** Shown for a non-field-specific product submit failure. */
|
|
1663
|
+
genericError: string;
|
|
1664
|
+
/** Fallback when creating a measure unit fails without a server message. */
|
|
1665
|
+
createMeasureUnitError: string;
|
|
1666
|
+
/** Fallback when updating a measure unit fails without a server message. */
|
|
1667
|
+
updateMeasureUnitError: string;
|
|
1668
|
+
/** Success toast after creating a product; `{name}` is replaced with its name. */
|
|
1669
|
+
productCreated: string;
|
|
1670
|
+
/** Success toast after editing a product; `{name}` is replaced with its name. */
|
|
1671
|
+
productUpdated: string;
|
|
1672
|
+
/** Success toast after editing a service; `{name}` is replaced with its name. */
|
|
1673
|
+
serviceUpdated: string;
|
|
1674
|
+
/** Success toast after deleting a product; `{name}` is replaced with its name. */
|
|
1675
|
+
productDeleted: string;
|
|
1676
|
+
/** Error toast when a product delete fails; `{name}` is replaced with its name. */
|
|
1677
|
+
deleteProductError: string;
|
|
1678
|
+
/** Success toast after creating a measure unit; `{name}` is replaced with its name. */
|
|
1679
|
+
measureUnitCreated: string;
|
|
1680
|
+
/** Success toast after editing a measure unit; `{name}` is replaced with its name. */
|
|
1681
|
+
measureUnitUpdated: string;
|
|
1682
|
+
/** Success toast after deleting a measure unit; `{name}` is replaced with its name. */
|
|
1683
|
+
measureUnitDeleted: string;
|
|
1684
|
+
/** Error toast when a measure unit delete fails; `{name}` is replaced with its name. */
|
|
1685
|
+
deleteMeasureUnitError: string;
|
|
1686
|
+
}
|
|
1687
|
+
|
|
1688
|
+
declare const InvoicesFilterField: {
|
|
1689
|
+
readonly DueDate: "dueDate";
|
|
1690
|
+
readonly CreatedAt: "createdAt";
|
|
1691
|
+
readonly IssueDate: "issueDate";
|
|
1692
|
+
readonly Status: "status";
|
|
1693
|
+
readonly Amount: "amount";
|
|
1694
|
+
readonly Customer: "customer";
|
|
1695
|
+
};
|
|
1696
|
+
type InvoicesFilterField = (typeof InvoicesFilterField)[keyof typeof InvoicesFilterField];
|
|
1697
|
+
type InvoicesDateFilterField = typeof InvoicesFilterField.DueDate | typeof InvoicesFilterField.CreatedAt | typeof InvoicesFilterField.IssueDate;
|
|
1698
|
+
|
|
1699
|
+
interface InvoicesFilterBarLabels {
|
|
1700
|
+
fields: Record<InvoicesFilterField, string>;
|
|
1701
|
+
searchPlaceholder: string;
|
|
1702
|
+
searchLabel: string;
|
|
1703
|
+
amountMin: string;
|
|
1704
|
+
amountMax: string;
|
|
1705
|
+
customerNameHeading: string;
|
|
1706
|
+
customerSearchPlaceholder: string;
|
|
1707
|
+
customerSearchHint: string;
|
|
1708
|
+
clearAll: string;
|
|
1709
|
+
filterMenuButton: FilterMenuButtonLabels;
|
|
1710
|
+
filterTag: FilterTagLabels;
|
|
1711
|
+
amountFilter: Omit<AmountFilterLabels, 'min' | 'max'>;
|
|
1712
|
+
dateRangePicker: Omit<DateRangePickerLabels, 'fieldLabel'>;
|
|
1713
|
+
}
|
|
1714
|
+
type InvoicesFilterBarLabelOverrides = PartialDeep<InvoicesFilterBarLabels>;
|
|
1715
|
+
|
|
1716
|
+
interface InvoicingTabsLabels {
|
|
1717
|
+
/** The settings button's accessible name and tooltip. */
|
|
1718
|
+
settingsButton: string;
|
|
1719
|
+
}
|
|
1720
|
+
|
|
1721
|
+
interface ReceivableActionsModalLabels {
|
|
1722
|
+
issueDescription: string;
|
|
1723
|
+
toLabel: string;
|
|
1724
|
+
subjectLabel: string;
|
|
1725
|
+
messageLabel: string;
|
|
1726
|
+
messagePlaceholder: string;
|
|
1727
|
+
attachmentsLabel: string;
|
|
1728
|
+
attachmentsCaption: string;
|
|
1729
|
+
skipButton: string;
|
|
1730
|
+
sendButton: string;
|
|
1731
|
+
productsQuestion: string;
|
|
1732
|
+
productsCaption: string;
|
|
1733
|
+
productsAllLabel: string;
|
|
1734
|
+
saveItemsButton: string;
|
|
1735
|
+
close: string;
|
|
1736
|
+
}
|
|
1737
|
+
|
|
1738
|
+
interface ReceivableBillingSectionLabels {
|
|
1739
|
+
billingHeading: string;
|
|
1740
|
+
billingDescription: string;
|
|
1741
|
+
paymentTermsLabel: string;
|
|
1742
|
+
paymentTermsPlaceholder: string;
|
|
1743
|
+
paymentTermsReceiptDue: string;
|
|
1744
|
+
paymentTermsCustomDate: string;
|
|
1745
|
+
purchaseOrderLabel: string;
|
|
1746
|
+
purchaseOrderOptional: string;
|
|
1747
|
+
}
|
|
1748
|
+
|
|
1749
|
+
interface ReceivableCustomerSectionLabels {
|
|
1750
|
+
customerHeading: string;
|
|
1751
|
+
customerDescription: string;
|
|
1752
|
+
customerNameLabel: string;
|
|
1753
|
+
customerListToggleButton: string;
|
|
1754
|
+
customerEmailLabel: string;
|
|
1755
|
+
addCustomerDetailsButton: string;
|
|
1756
|
+
viewCustomerDetailsButton: string;
|
|
1757
|
+
clearCustomerButton: string;
|
|
1758
|
+
}
|
|
1759
|
+
|
|
1760
|
+
interface ReceivableRecurrenceSectionLabels {
|
|
1761
|
+
recurrenceRepeatLabel: string;
|
|
1762
|
+
recurrenceMonthDayLead: string;
|
|
1763
|
+
recurrenceWeekdayLead: string;
|
|
1764
|
+
recurrenceStartOnLabel: string;
|
|
1765
|
+
recurrenceEndChoiceLead: string;
|
|
1766
|
+
recurrenceEndCountLead: string;
|
|
1767
|
+
recurrenceDatePlaceholder: string;
|
|
1768
|
+
recurrenceCreationModeQuestion: string;
|
|
1769
|
+
recurrenceCreationModeHint: string;
|
|
1770
|
+
recurrenceSetUpEmail: string;
|
|
1771
|
+
}
|
|
1772
|
+
interface ReceivableRecurrenceEmailDialogLabels {
|
|
1773
|
+
recurrenceEmailTitle: string;
|
|
1774
|
+
recurrenceEmailDescription: string;
|
|
1775
|
+
recurrenceEmailTo: string;
|
|
1776
|
+
recurrenceEmailCc: string;
|
|
1777
|
+
recurrenceEmailBcc: string;
|
|
1778
|
+
recurrenceEmailSubject: string;
|
|
1779
|
+
recurrenceEmailMessage: string;
|
|
1780
|
+
recurrenceEmailRecipientPlaceholder: string;
|
|
1781
|
+
recurrenceEmailMessagePlaceholder: string;
|
|
1782
|
+
recurrenceEmailFootnote: string;
|
|
1783
|
+
recurrenceEmailCancel: string;
|
|
1784
|
+
recurrenceEmailSave: string;
|
|
1785
|
+
recurrenceEmailClose: string;
|
|
1786
|
+
}
|
|
1787
|
+
|
|
1788
|
+
interface ReceivableStatusBadgeLabels {
|
|
1789
|
+
draft: string;
|
|
1790
|
+
issuing: string;
|
|
1791
|
+
issued: string;
|
|
1792
|
+
failed: string;
|
|
1793
|
+
accepted: string;
|
|
1794
|
+
expired: string;
|
|
1795
|
+
declined: string;
|
|
1796
|
+
recurring: string;
|
|
1797
|
+
partially_paid: string;
|
|
1798
|
+
paid: string;
|
|
1799
|
+
overdue: string;
|
|
1800
|
+
uncollectible: string;
|
|
1801
|
+
canceled: string;
|
|
1802
|
+
deleted: string;
|
|
1803
|
+
unknown: string;
|
|
1804
|
+
}
|
|
1805
|
+
|
|
1806
|
+
interface ReceivablesScreenLabels {
|
|
1807
|
+
createInvoiceButton: string;
|
|
1808
|
+
statusCardsGroup: string;
|
|
1809
|
+
statusCardsLoading: string;
|
|
1810
|
+
columnDueDate: string;
|
|
1811
|
+
columnStatus: string;
|
|
1812
|
+
columnNumber: string;
|
|
1813
|
+
columnCustomer: string;
|
|
1814
|
+
columnIssueDate: string;
|
|
1815
|
+
columnBalanceDue: string;
|
|
1816
|
+
columnAmount: string;
|
|
1817
|
+
/**
|
|
1818
|
+
* A focused row's accessible name. The row itself is the control that
|
|
1819
|
+
* opens it, so the name says what Enter does. A template so locales own the
|
|
1820
|
+
* wording and order.
|
|
1821
|
+
*/
|
|
1822
|
+
openRow: (documentLabel: string) => string;
|
|
1823
|
+
sortByDueDate: string;
|
|
1824
|
+
sortByStatus: string;
|
|
1825
|
+
sortByNumber: string;
|
|
1826
|
+
sortByIssueDate: string;
|
|
1827
|
+
sortByAmount: string;
|
|
1828
|
+
emptyTitle: string;
|
|
1829
|
+
emptyDescription: string;
|
|
1830
|
+
filterEmptyTitle: string;
|
|
1831
|
+
errorTitle: string;
|
|
1832
|
+
errorDescription: string;
|
|
1833
|
+
errorRetry: string;
|
|
1834
|
+
accessRestrictedTitle: string;
|
|
1835
|
+
accessRestrictedDescription: string;
|
|
1836
|
+
statusBadge: ReceivableStatusBadgeLabels;
|
|
1837
|
+
}
|
|
1838
|
+
type ReceivablesScreenLabelOverrides = Partial<Omit<ReceivablesScreenLabels, 'statusBadge'>> & {
|
|
1839
|
+
statusBadge?: Partial<ReceivableStatusBadgeLabels>;
|
|
1840
|
+
};
|
|
1841
|
+
interface UnsavedInvoiceDialogLabels {
|
|
1842
|
+
unsavedTitle: string;
|
|
1843
|
+
unsavedDescription: string;
|
|
1844
|
+
unsavedDiscardButton: string;
|
|
1845
|
+
unsavedSaveDraftButton: string;
|
|
1846
|
+
unsavedCloseButton: string;
|
|
1847
|
+
}
|
|
1848
|
+
interface ReceivableFormDialogLabels extends ReceivableBillingSectionLabels, ReceivableCustomerSectionLabels, ReceivableRecurrenceSectionLabels, ReceivableRecurrenceEmailDialogLabels, UnsavedInvoiceDialogLabels {
|
|
1849
|
+
createTitle: string;
|
|
1850
|
+
createRecurringTitle: string;
|
|
1851
|
+
createDescription: string;
|
|
1852
|
+
editTitle: string;
|
|
1853
|
+
editDescription: string;
|
|
1854
|
+
closeButton: string;
|
|
1855
|
+
dueDateLabel: string;
|
|
1856
|
+
lineItemsHeading: string;
|
|
1857
|
+
lineItemsDescription: string;
|
|
1858
|
+
productLabel: string;
|
|
1859
|
+
quantityLabel: string;
|
|
1860
|
+
unitLabel: string;
|
|
1861
|
+
unitPlaceholder: string;
|
|
1862
|
+
unitNone: string;
|
|
1863
|
+
manageUnitsOption: string;
|
|
1864
|
+
priceLabel: string;
|
|
1865
|
+
taxableLabel: string;
|
|
1866
|
+
taxRateLabel: string;
|
|
1867
|
+
taxRatePlaceholder: string;
|
|
1868
|
+
taxRateSuffix: string;
|
|
1869
|
+
discountLabel: string;
|
|
1870
|
+
discountPercentageOption: string;
|
|
1871
|
+
discountAmountOptionAriaLabel: string;
|
|
1872
|
+
discountPercentageOptionAriaLabel: string;
|
|
1873
|
+
subtotalLabel: string;
|
|
1874
|
+
discountTotalLabel: string;
|
|
1875
|
+
nonTaxableSubtotalLabel: string;
|
|
1876
|
+
taxableSubtotalLabel: string;
|
|
1877
|
+
taxTotalLabel: string;
|
|
1878
|
+
totalLabel: string;
|
|
1879
|
+
decreaseQuantityButton: string;
|
|
1880
|
+
increaseQuantityButton: string;
|
|
1881
|
+
addLineItemButton: string;
|
|
1882
|
+
removeLineItemButton: string;
|
|
1883
|
+
cancelButton: string;
|
|
1884
|
+
notesHeading: string;
|
|
1885
|
+
notesDescription: string;
|
|
1886
|
+
optionalSuffix: string;
|
|
1887
|
+
openingNoteLabel: string;
|
|
1888
|
+
openingNotePlaceholder: string;
|
|
1889
|
+
openingNoteDescription: string;
|
|
1890
|
+
closingNoteLabel: string;
|
|
1891
|
+
closingNotePlaceholder: string;
|
|
1892
|
+
closingNoteDescription: string;
|
|
1893
|
+
bankAccountHeading: string;
|
|
1894
|
+
bankAccountDescription: string;
|
|
1895
|
+
bankAccountLabel: string;
|
|
1896
|
+
bankAccountHint: string;
|
|
1897
|
+
bankAccountSelectorLabel: string;
|
|
1898
|
+
bankAccountPlaceholder: string;
|
|
1899
|
+
bankAccountAddOption: string;
|
|
1900
|
+
bankAccountFormHeading: string;
|
|
1901
|
+
bankAccountRoutingNumberLabel: string;
|
|
1902
|
+
bankAccountRoutingNumberPlaceholder: string;
|
|
1903
|
+
bankAccountAccountNumberLabel: string;
|
|
1904
|
+
bankAccountAccountNumberPlaceholder: string;
|
|
1905
|
+
bankAccountHolderNameLabel: string;
|
|
1906
|
+
bankAccountHolderNamePlaceholder: string;
|
|
1907
|
+
bankAccountNicknameLabel: string;
|
|
1908
|
+
bankAccountNicknamePlaceholder: string;
|
|
1909
|
+
bankAccountCancelButton: string;
|
|
1910
|
+
bankAccountSaveButton: string;
|
|
1911
|
+
bankAccountRestrictedTitle: string;
|
|
1912
|
+
bankAccountRestrictedDescription: string;
|
|
1913
|
+
attachmentsHeading: string;
|
|
1914
|
+
attachmentsDescription: string;
|
|
1915
|
+
attachmentsDropPrompt: string;
|
|
1916
|
+
attachmentsBrowseLink: string;
|
|
1917
|
+
attachmentsFormatsHint: string;
|
|
1918
|
+
remindersToggleLabel: string;
|
|
1919
|
+
remindersDescription: string;
|
|
1920
|
+
remindersLibraryNote: string;
|
|
1921
|
+
reminderNumberOfDays: string;
|
|
1922
|
+
reminderBefore: string;
|
|
1923
|
+
reminderAfter: string;
|
|
1924
|
+
reminderDueDate: string;
|
|
1925
|
+
reminderNone: string;
|
|
1926
|
+
reminderBeforeDueInputLabel: string;
|
|
1927
|
+
reminderPlaceholder: string;
|
|
1928
|
+
reminderAddTermButton: string;
|
|
1929
|
+
reminderClearButton: string;
|
|
1930
|
+
reminderSaveButton: string;
|
|
1931
|
+
}
|
|
1932
|
+
/** @deprecated Use `ReceivableFormDialogLabels`. */
|
|
1933
|
+
type ReceivableFormSheetLabels = ReceivableFormDialogLabels;
|
|
1934
|
+
interface ReceivableDetailsPanelLabels {
|
|
1935
|
+
hiddenDescription: string;
|
|
1936
|
+
loadingTitle: string;
|
|
1937
|
+
moreActionsLabel: string;
|
|
1938
|
+
viewPdfButton: string;
|
|
1939
|
+
closeButton: string;
|
|
1940
|
+
invoiceDateCaption: string;
|
|
1941
|
+
paymentHistoryHeading: string;
|
|
1942
|
+
paymentHistoryEmpty: string;
|
|
1943
|
+
paymentHistoryTotalLabel: string;
|
|
1944
|
+
paymentHistoryLoading: string;
|
|
1945
|
+
customerDetailsHeading: string;
|
|
1946
|
+
recurringAmountCaption: string;
|
|
1947
|
+
startsOnCaption: string;
|
|
1948
|
+
endsOnCaption: string;
|
|
1949
|
+
recurringSeriesRowLabel: string;
|
|
1950
|
+
scheduleIssueDateColumn: string;
|
|
1951
|
+
scheduleAmountColumn: string;
|
|
1952
|
+
scheduleStatusColumn: string;
|
|
1953
|
+
scheduleNumberColumn: string;
|
|
1954
|
+
scheduleEmpty: string;
|
|
1955
|
+
auditHistoryHeading: string;
|
|
1956
|
+
auditHistoryEmpty: string;
|
|
1957
|
+
auditHistoryLoading: string;
|
|
1958
|
+
auditHistoryError: string;
|
|
1959
|
+
auditHistoryNamesError: string;
|
|
1960
|
+
billingHeading: string;
|
|
1961
|
+
lineItemsHeading: string;
|
|
1962
|
+
notesHeading: string;
|
|
1963
|
+
notesOpeningLabel: string;
|
|
1964
|
+
notesClosingLabel: string;
|
|
1965
|
+
attachmentsHeading: string;
|
|
1966
|
+
attachmentsEmpty: string;
|
|
1967
|
+
attachmentsFileColumn: string;
|
|
1968
|
+
attachmentsEmailedColumn: string;
|
|
1969
|
+
lineItemMultiplier: string;
|
|
1970
|
+
lineItemEaLabel: string;
|
|
1971
|
+
noLineItems: string;
|
|
1972
|
+
editButton: string;
|
|
1973
|
+
issueButton: string;
|
|
1974
|
+
issueAndSendButton: string;
|
|
1975
|
+
recordPaymentButton: string;
|
|
1976
|
+
sendButton: string;
|
|
1977
|
+
acceptButton: string;
|
|
1978
|
+
declineButton: string;
|
|
1979
|
+
markPaidButton: string;
|
|
1980
|
+
markUncollectibleButton: string;
|
|
1981
|
+
cancelButton: string;
|
|
1982
|
+
cloneButton: string;
|
|
1983
|
+
deleteButton: string;
|
|
1984
|
+
pauseRecurrenceButton: string;
|
|
1985
|
+
resumeRecurrenceButton: string;
|
|
1986
|
+
cancelRecurrenceButton: string;
|
|
1987
|
+
recurringBadge: string;
|
|
1988
|
+
}
|
|
1989
|
+
type ReceivableDetailsPanelLabelOverrides = Partial<ReceivableDetailsPanelLabels>;
|
|
1990
|
+
interface ReceivablePaymentDialogLabels {
|
|
1991
|
+
title: string;
|
|
1992
|
+
amountLabel: string;
|
|
1993
|
+
amountPlaceholder: string;
|
|
1994
|
+
fullAmountDuePrefix: string;
|
|
1995
|
+
dateLabel: string;
|
|
1996
|
+
datePlaceholder: string;
|
|
1997
|
+
timeLabel: string;
|
|
1998
|
+
timeZoneSuffix: string;
|
|
1999
|
+
cancelButton: string;
|
|
2000
|
+
saveButton: string;
|
|
2001
|
+
reviewTitle: string;
|
|
2002
|
+
receivedLabel: string;
|
|
2003
|
+
referenceLabel: string;
|
|
2004
|
+
createdByLabel: string;
|
|
2005
|
+
reviewWarning: string;
|
|
2006
|
+
editRecordButton: string;
|
|
2007
|
+
confirmButton: string;
|
|
2008
|
+
close: string;
|
|
2009
|
+
}
|
|
2010
|
+
interface ReceivableActionDialogLabels {
|
|
2011
|
+
cancelButton: string;
|
|
2012
|
+
confirmButton: string;
|
|
2013
|
+
commentLabel: string;
|
|
2014
|
+
commentPlaceholder: string;
|
|
2015
|
+
close: string;
|
|
2016
|
+
}
|
|
2017
|
+
|
|
2018
|
+
type ReceivableDocumentType = ReceivableDocumentKind;
|
|
2019
|
+
|
|
2020
|
+
interface ReceivablePreviewLabels {
|
|
2021
|
+
title: string;
|
|
2022
|
+
noLogo: string;
|
|
2023
|
+
billToHeading: string;
|
|
2024
|
+
detailsHeading: string;
|
|
2025
|
+
invoiceNumberLabel: string;
|
|
2026
|
+
invoiceDateLabel: string;
|
|
2027
|
+
dueDateLabel: string;
|
|
2028
|
+
paymentTermsLabel: string;
|
|
2029
|
+
purchaseOrderLabel: string;
|
|
2030
|
+
pending: string;
|
|
2031
|
+
descriptionColumn: string;
|
|
2032
|
+
quantityColumn: string;
|
|
2033
|
+
priceColumn: string;
|
|
2034
|
+
taxableColumn: string;
|
|
2035
|
+
amountColumn: string;
|
|
2036
|
+
noItems: string;
|
|
2037
|
+
payOnline: string;
|
|
2038
|
+
paymentQrCodeLabel: string;
|
|
2039
|
+
}
|
|
2040
|
+
|
|
2041
|
+
interface RecurringSeriesScreenLabels {
|
|
2042
|
+
createButton: string;
|
|
2043
|
+
columnCustomer: string;
|
|
2044
|
+
columnRepeats: string;
|
|
2045
|
+
columnNextInvoice: string;
|
|
2046
|
+
columnStatus: string;
|
|
2047
|
+
columnAmount: string;
|
|
2048
|
+
openRow: (customerLabel: string) => string;
|
|
2049
|
+
searchPlaceholder: string;
|
|
2050
|
+
searchLabel: string;
|
|
2051
|
+
emptyTitle: string;
|
|
2052
|
+
emptyDescription: string;
|
|
2053
|
+
filterEmptyTitle: string;
|
|
2054
|
+
filterEmptyAction: string;
|
|
2055
|
+
errorTitle: string;
|
|
2056
|
+
errorDescription: string;
|
|
2057
|
+
errorRetry: string;
|
|
2058
|
+
accessRestrictedTitle: string;
|
|
2059
|
+
accessRestrictedDescription: string;
|
|
2060
|
+
}
|
|
2061
|
+
type RecurringSeriesScreenLabelOverrides = Partial<RecurringSeriesScreenLabels>;
|
|
2062
|
+
|
|
2063
|
+
declare const InvoicesDatePreset: {
|
|
2064
|
+
readonly Today: "today";
|
|
2065
|
+
readonly ThisWeek: "this_week";
|
|
2066
|
+
readonly ThisMonth: "this_month";
|
|
2067
|
+
readonly ThisQuarter: "this_quarter";
|
|
2068
|
+
readonly ThisYear: "this_year";
|
|
2069
|
+
readonly Yesterday: "yesterday";
|
|
2070
|
+
readonly LastWeek: "last_week";
|
|
2071
|
+
readonly LastMonth: "last_month";
|
|
2072
|
+
readonly Last30Days: "last_30_days";
|
|
2073
|
+
readonly Last90Days: "last_90_days";
|
|
2074
|
+
readonly LastQuarter: "last_quarter";
|
|
2075
|
+
readonly LastYear: "last_year";
|
|
2076
|
+
};
|
|
2077
|
+
type InvoicesDatePreset = (typeof InvoicesDatePreset)[keyof typeof InvoicesDatePreset];
|
|
2078
|
+
|
|
2079
|
+
interface InvoicesFilterLabels {
|
|
2080
|
+
presets: Record<InvoicesDatePreset, string>;
|
|
2081
|
+
presetGroupCurrent: string;
|
|
2082
|
+
presetGroupPast: string;
|
|
2083
|
+
dateFieldNames: Record<InvoicesDateFilterField, string>;
|
|
2084
|
+
paidDateFieldName: string;
|
|
2085
|
+
dateRange: (from: string, to: string) => string;
|
|
2086
|
+
dateFrom: (from: string) => string;
|
|
2087
|
+
dateTo: (to: string) => string;
|
|
2088
|
+
/** Shown under a status option; a status with no entry shows none. */
|
|
2089
|
+
statusDescriptions: Partial<Record<string, string>>;
|
|
2090
|
+
dateChip: (fieldLabel: string, range: string) => string;
|
|
2091
|
+
statusChip: (value: string) => string;
|
|
2092
|
+
moreSelected: (first: string, count: number) => string;
|
|
2093
|
+
customerChip: (name: string) => string;
|
|
2094
|
+
amountChip: (range: string) => string;
|
|
2095
|
+
amountAtLeast: (amount: string) => string;
|
|
2096
|
+
amountAtMost: (amount: string) => string;
|
|
2097
|
+
amountBetween: (min: string, max: string) => string;
|
|
2098
|
+
searchChip: (value: string) => string;
|
|
2099
|
+
}
|
|
2100
|
+
type InvoicesFilterLabelOverrides = PartialDeep<InvoicesFilterLabels>;
|
|
2101
|
+
|
|
2102
|
+
interface ReceivableMessageLabels {
|
|
2103
|
+
customerRequired: string;
|
|
2104
|
+
customerEmailInvalid: string;
|
|
2105
|
+
customerPickerPlaceholder: string;
|
|
2106
|
+
customerPickerSearchOnlyPlaceholder: string;
|
|
2107
|
+
customerPickerEmpty: string;
|
|
2108
|
+
customerPickerSearchOnlyEmpty: string;
|
|
2109
|
+
customerPickerLoading: string;
|
|
2110
|
+
customerPickerLoadFailed: string;
|
|
2111
|
+
customerPickerMoreMatches: string;
|
|
2112
|
+
customerPickerDescription: string;
|
|
2113
|
+
customerPickerSearchOnlyDescription: string;
|
|
2114
|
+
currencyRequired: string;
|
|
2115
|
+
lineItemNameTooLong: string;
|
|
2116
|
+
/** `{maxAmount}` is replaced with the formatted cap. */
|
|
2117
|
+
lineItemPriceTooHigh: string;
|
|
2118
|
+
discountPercentageTooHigh: string;
|
|
2119
|
+
discountExceedsSubtotal: string;
|
|
2120
|
+
/** `{maxAmount}` is replaced with the formatted cap. */
|
|
2121
|
+
invoiceSubtotalTooHigh: string;
|
|
2122
|
+
/** `{maxAmount}` is replaced with the formatted cap. */
|
|
2123
|
+
invoiceTotalTooHigh: string;
|
|
2124
|
+
invoiceTotalZero: string;
|
|
2125
|
+
paymentRecordAmountRequired: string;
|
|
2126
|
+
paymentRecordAmountNegative: string;
|
|
2127
|
+
paymentRecordAmountZero: string;
|
|
2128
|
+
paymentRecordDateRequired: string;
|
|
2129
|
+
paymentRecordTimeRequired: string;
|
|
2130
|
+
/** `{name}` is replaced with the customer's name. */
|
|
2131
|
+
paymentRecordFrom: string;
|
|
2132
|
+
paymentRecordCreated: string;
|
|
2133
|
+
/** `{errorMessage}` is replaced with the API's reason. */
|
|
2134
|
+
paymentRecordCreateFailed: string;
|
|
2135
|
+
genericError: string;
|
|
2136
|
+
lineItemsLoading: string;
|
|
2137
|
+
paymentTermsCustomDatePlaceholder: string;
|
|
2138
|
+
bankAccountFallbackName: string;
|
|
2139
|
+
/** `{embeddedBankName}` is replaced with the host's bank name. */
|
|
2140
|
+
bankAccountPoweredBy: string;
|
|
2141
|
+
bankAccountLinked: string;
|
|
2142
|
+
bankAccountHolderNameRequired: string;
|
|
2143
|
+
bankAccountHolderNameTooLong: string;
|
|
2144
|
+
bankAccountNumberRequired: string;
|
|
2145
|
+
bankAccountNumberDigitsOnly: string;
|
|
2146
|
+
bankAccountNumberTooShort: string;
|
|
2147
|
+
bankAccountNumberTooLong: string;
|
|
2148
|
+
bankAccountRoutingNumberRequired: string;
|
|
2149
|
+
bankAccountRoutingNumberInvalid: string;
|
|
2150
|
+
bankAccountNicknameTooLong: string;
|
|
2151
|
+
/** `{name}` is replaced with the new account's nickname. */
|
|
2152
|
+
bankAccountCreated: string;
|
|
2153
|
+
bankAccountCreateFailed: string;
|
|
2154
|
+
untitledDocument: string;
|
|
2155
|
+
/** Shown in an invoice row's number and date cells while they have no value. */
|
|
2156
|
+
pendingValue: string;
|
|
2157
|
+
/** Repeats or Next invoice for a series with nothing to show there. */
|
|
2158
|
+
listSeriesNoValue: string;
|
|
2159
|
+
/** Repeats for a series that skips periods; `{interval}` is replaced. */
|
|
2160
|
+
listSeriesEveryDays: string;
|
|
2161
|
+
listSeriesEveryWeeks: string;
|
|
2162
|
+
listSeriesEveryMonths: string;
|
|
2163
|
+
listSeriesEveryQuarters: string;
|
|
2164
|
+
listSeriesEveryYears: string;
|
|
2165
|
+
/** A monthly series' Repeats; `{cadence}` and `{day}` are replaced, e.g. "Monthly, last day". */
|
|
2166
|
+
listSeriesMonthDay: string;
|
|
2167
|
+
listSeriesFirstDay: string;
|
|
2168
|
+
listSeriesLastDay: string;
|
|
2169
|
+
/** Next invoice for a series that will issue no more invoices. */
|
|
2170
|
+
listSeriesNoNextInvoice: string;
|
|
2171
|
+
listDueToday: string;
|
|
2172
|
+
listDueTomorrow: string;
|
|
2173
|
+
/** `{days}` is replaced. */
|
|
2174
|
+
listDayOverdue: string;
|
|
2175
|
+
listDaysOverdue: string;
|
|
2176
|
+
/** An overdue due date's accessible name; `{overdue}` and `{date}` are replaced. */
|
|
2177
|
+
listOverdueAccessibleName: string;
|
|
2178
|
+
listRecurringBadge: string;
|
|
2179
|
+
unknownCustomer: string;
|
|
2180
|
+
notAvailable: string;
|
|
2181
|
+
summaryUnpaid: string;
|
|
2182
|
+
summaryOverdue: string;
|
|
2183
|
+
summaryPaid: string;
|
|
2184
|
+
summaryDrafts: string;
|
|
2185
|
+
summaryDraftsCaption: string;
|
|
2186
|
+
/** `{count}` is replaced. */
|
|
2187
|
+
summaryInvoice: string;
|
|
2188
|
+
summaryInvoices: string;
|
|
2189
|
+
/** The amount on a card whose value is not available. */
|
|
2190
|
+
summaryPlaceholder: string;
|
|
2191
|
+
invoiceType: string;
|
|
2192
|
+
quoteType: string;
|
|
2193
|
+
creditNoteType: string;
|
|
2194
|
+
detailsUnsupportedTitle: string;
|
|
2195
|
+
/** `{type}` is replaced with the receivable's API type. */
|
|
2196
|
+
detailsUnsupportedDescription: string;
|
|
2197
|
+
detailsNotFoundTitle: string;
|
|
2198
|
+
/** `{invoiceId}` is replaced with the requested invoice ID. */
|
|
2199
|
+
detailsNotFoundDescription: string;
|
|
2200
|
+
/** `{number}` is replaced with the invoice number. */
|
|
2201
|
+
detailsInvoiceSubtitle: string;
|
|
2202
|
+
/** `{days}` is replaced with the number of days. */
|
|
2203
|
+
detailsDaysOverdue: string;
|
|
2204
|
+
detailsInvoiceAmount: string;
|
|
2205
|
+
detailsBalanceDue: string;
|
|
2206
|
+
detailsAmountReceived: string;
|
|
2207
|
+
detailsCancelledAmount: string;
|
|
2208
|
+
detailsSendButton: string;
|
|
2209
|
+
detailsResendButton: string;
|
|
2210
|
+
detailsAmountWrittenOff: string;
|
|
2211
|
+
detailsCancelledOnCaption: string;
|
|
2212
|
+
detailsPending: string;
|
|
2213
|
+
detailsNotProvided: string;
|
|
2214
|
+
detailsCustomerName: string;
|
|
2215
|
+
detailsCustomerEmail: string;
|
|
2216
|
+
detailsCustomerPhone: string;
|
|
2217
|
+
detailsCustomerAddress: string;
|
|
2218
|
+
detailsInvoiceNumber: string;
|
|
2219
|
+
detailsInvoiceDate: string;
|
|
2220
|
+
detailsDueDate: string;
|
|
2221
|
+
detailsPaymentTerms: string;
|
|
2222
|
+
detailsPaymentReminders: string;
|
|
2223
|
+
detailsPoNumber: string;
|
|
2224
|
+
detailsDepositAccount: string;
|
|
2225
|
+
detailsRemindersBefore: string;
|
|
2226
|
+
detailsRemindersAfter: string;
|
|
2227
|
+
detailsRemindersNone: string;
|
|
2228
|
+
detailsFrequency: string;
|
|
2229
|
+
detailsFrequencyDay: string;
|
|
2230
|
+
detailsFrequencyWeek: string;
|
|
2231
|
+
detailsFrequencyMonth: string;
|
|
2232
|
+
detailsFrequencyQuarter: string;
|
|
2233
|
+
detailsFrequencyYear: string;
|
|
2234
|
+
detailsPeriodDay: string;
|
|
2235
|
+
detailsPeriodWeek: string;
|
|
2236
|
+
detailsPeriodMonth: string;
|
|
2237
|
+
detailsPeriodQuarter: string;
|
|
2238
|
+
detailsPeriodYear: string;
|
|
2239
|
+
detailsPeriodEveryDays: string;
|
|
2240
|
+
detailsPeriodEveryWeeks: string;
|
|
2241
|
+
detailsPeriodEveryMonths: string;
|
|
2242
|
+
detailsPeriodEveryQuarters: string;
|
|
2243
|
+
detailsPeriodEveryYears: string;
|
|
2244
|
+
/** `{name}` and `{frequency}` are replaced, e.g. "Acme - Monthly". */
|
|
2245
|
+
detailsSeriesTitle: string;
|
|
2246
|
+
detailsSeriesSubtitle: string;
|
|
2247
|
+
/** `{frequency}` is replaced, e.g. "Monthly schedule". */
|
|
2248
|
+
detailsScheduleTitle: string;
|
|
2249
|
+
detailsScheduleTitleEvery: string;
|
|
2250
|
+
/** `{title}` is replaced with the series title. */
|
|
2251
|
+
detailsSeriesBack: string;
|
|
2252
|
+
/** `{number}` is replaced with the invoice number. */
|
|
2253
|
+
detailsScheduleOpenInvoice: string;
|
|
2254
|
+
detailsSeriesStatusActive: string;
|
|
2255
|
+
detailsSeriesStatusPaused: string;
|
|
2256
|
+
detailsSeriesStatusCanceled: string;
|
|
2257
|
+
detailsSeriesStatusCompleted: string;
|
|
2258
|
+
detailsIterationStatusPending: string;
|
|
2259
|
+
detailsIterationStatusSkipped: string;
|
|
2260
|
+
detailsIterationStatusCanceled: string;
|
|
2261
|
+
detailsIterationStatusIssueFailed: string;
|
|
2262
|
+
detailsIterationStatusSendFailed: string;
|
|
2263
|
+
detailsIterationStatusCompleted: string;
|
|
2264
|
+
issueSucceeded: string;
|
|
2265
|
+
acceptTitle: string;
|
|
2266
|
+
acceptDescription: string;
|
|
2267
|
+
acceptConfirm: string;
|
|
2268
|
+
declineTitle: string;
|
|
2269
|
+
declineDescription: string;
|
|
2270
|
+
declineConfirm: string;
|
|
2271
|
+
issueFailed: string;
|
|
2272
|
+
unrecognizedError: string;
|
|
2273
|
+
sendNoEmail: string;
|
|
2274
|
+
cancelTitle: string;
|
|
2275
|
+
/** `{number}` is replaced with the invoice number. */
|
|
2276
|
+
cancelNumberedTitle: string;
|
|
2277
|
+
cancelClose: string;
|
|
2278
|
+
cancelDescription: string;
|
|
2279
|
+
cancelConfirm: string;
|
|
2280
|
+
cancelSucceeded: string;
|
|
2281
|
+
cloneSuccess: string;
|
|
2282
|
+
cloneError: string;
|
|
2283
|
+
deleteTitle: string;
|
|
2284
|
+
/** `{number}` is replaced with the invoice number. */
|
|
2285
|
+
deleteNumberedTitle: string;
|
|
2286
|
+
deleteDescription: string;
|
|
2287
|
+
deleteConfirm: string;
|
|
2288
|
+
deleteSucceeded: string;
|
|
2289
|
+
markPaidTitle: string;
|
|
2290
|
+
markPaidDescription: string;
|
|
2291
|
+
markPaidConfirm: string;
|
|
2292
|
+
markUncollectibleTitle: string;
|
|
2293
|
+
markUncollectibleDescription: string;
|
|
2294
|
+
markUncollectibleConfirm: string;
|
|
2295
|
+
markUncollectibleSucceeded: string;
|
|
2296
|
+
/** `{customer}` is replaced with the customer's name. */
|
|
2297
|
+
createSucceeded: string;
|
|
2298
|
+
updateSucceeded: string;
|
|
2299
|
+
recurrenceActivated: string;
|
|
2300
|
+
recurrenceUpdated: string;
|
|
2301
|
+
cancelRecurrenceTitle: string;
|
|
2302
|
+
cancelRecurrenceQuestion: string;
|
|
2303
|
+
cancelRecurrenceFutureIterations: string;
|
|
2304
|
+
/** `{count}`, `{invoices}` and `{amount}` are replaced. */
|
|
2305
|
+
cancelRecurrenceTotal: string;
|
|
2306
|
+
cancelRecurrenceInvoice: string;
|
|
2307
|
+
cancelRecurrenceInvoices: string;
|
|
2308
|
+
cancelRecurrenceIrreversible: string;
|
|
2309
|
+
cancelRecurrenceConfirm: string;
|
|
2310
|
+
cancelRecurrenceClose: string;
|
|
2311
|
+
recurrencePaused: string;
|
|
2312
|
+
recurrenceResumed: string;
|
|
2313
|
+
recurrenceCanceled: string;
|
|
2314
|
+
attachmentsEmailCaption: string;
|
|
2315
|
+
attachmentsRecurringEmailCaption: string;
|
|
2316
|
+
attachmentIncludeInEmail: string;
|
|
2317
|
+
attachmentRemove: string;
|
|
2318
|
+
attachmentUploading: string;
|
|
2319
|
+
attachmentUploadFailed: string;
|
|
2320
|
+
attachmentTooLarge: string;
|
|
2321
|
+
attachmentUnsupportedType: string;
|
|
2322
|
+
attachmentsCountLimit: string;
|
|
2323
|
+
attachmentIncludedInEmail: string;
|
|
2324
|
+
attachmentNotIncludedInEmail: string;
|
|
2325
|
+
recurrenceSeriesPaymentTerms: string;
|
|
2326
|
+
recurrenceFrequencyOnce: string;
|
|
2327
|
+
recurrenceFrequencyDaily: string;
|
|
2328
|
+
recurrenceFrequencyWeekly: string;
|
|
2329
|
+
recurrenceFrequencyMonthly: string;
|
|
2330
|
+
recurrenceFrequencyQuarterly: string;
|
|
2331
|
+
recurrenceFrequencyAnnually: string;
|
|
2332
|
+
recurrenceFirstDay: string;
|
|
2333
|
+
recurrenceLastDay: string;
|
|
2334
|
+
recurrenceMonthDayTrail: string;
|
|
2335
|
+
recurrenceMonthEdgeTrail: string;
|
|
2336
|
+
recurrenceWeekdayMo: string;
|
|
2337
|
+
recurrenceWeekdayTu: string;
|
|
2338
|
+
recurrenceWeekdayWe: string;
|
|
2339
|
+
recurrenceWeekdayTh: string;
|
|
2340
|
+
recurrenceWeekdayFr: string;
|
|
2341
|
+
recurrenceWeekdaySa: string;
|
|
2342
|
+
recurrenceWeekdaySu: string;
|
|
2343
|
+
recurrenceEndAfter: string;
|
|
2344
|
+
recurrenceEndOn: string;
|
|
2345
|
+
recurrenceUnitDay: string;
|
|
2346
|
+
recurrenceUnitDays: string;
|
|
2347
|
+
recurrenceUnitWeek: string;
|
|
2348
|
+
recurrenceUnitWeeks: string;
|
|
2349
|
+
recurrenceUnitMonth: string;
|
|
2350
|
+
recurrenceUnitMonths: string;
|
|
2351
|
+
recurrenceUnitQuarter: string;
|
|
2352
|
+
recurrenceUnitQuarters: string;
|
|
2353
|
+
recurrenceUnitYear: string;
|
|
2354
|
+
recurrenceUnitYears: string;
|
|
2355
|
+
recurrenceLastDayCaption: string;
|
|
2356
|
+
recurrenceModeIssueAndSendTitle: string;
|
|
2357
|
+
recurrenceModeIssueAndSendDescription: string;
|
|
2358
|
+
recurrenceModeIssueTitle: string;
|
|
2359
|
+
recurrenceModeIssueDescription: string;
|
|
2360
|
+
recurrenceModeDraftTitle: string;
|
|
2361
|
+
recurrenceModeDraftDescription: string;
|
|
2362
|
+
recurrenceNoRecipients: string;
|
|
2363
|
+
/** `{recipient}` is replaced with the address. */
|
|
2364
|
+
recurrenceRemoveRecipient: string;
|
|
2365
|
+
recurrenceActivateButton: string;
|
|
2366
|
+
recurrenceUpdateButton: string;
|
|
2367
|
+
saveDraftButton: string;
|
|
2368
|
+
updateDraftButton: string;
|
|
2369
|
+
issueButton: string;
|
|
2370
|
+
recurrenceStartDateRequired: string;
|
|
2371
|
+
recurrenceDayOfMonthRequired: string;
|
|
2372
|
+
recurrenceDayOfWeekRequired: string;
|
|
2373
|
+
recurrenceEndConditionRequired: string;
|
|
2374
|
+
recurrenceEndDateRequired: string;
|
|
2375
|
+
/** `{units}` is replaced with the plural unit, e.g. "months". */
|
|
2376
|
+
recurrenceOccurrencesRequired: string;
|
|
2377
|
+
/** `{unit}` is replaced with the singular unit, e.g. "month". */
|
|
2378
|
+
recurrenceOccurrencesTooFew: string;
|
|
2379
|
+
/** `{units}` is replaced with the plural unit. */
|
|
2380
|
+
recurrenceOccurrencesTooMany: string;
|
|
2381
|
+
recurrenceOccurrencesWhole: string;
|
|
2382
|
+
/** `{count}` is replaced with how many invoices the series has issued. */
|
|
2383
|
+
recurrenceOccurrencesBelowIssued: string;
|
|
2384
|
+
recurrenceSubjectRequired: string;
|
|
2385
|
+
recurrenceMessageRequired: string;
|
|
2386
|
+
recurrenceRecipientRequired: string;
|
|
2387
|
+
/** `{address}` is replaced with the rejected address. */
|
|
2388
|
+
recurrenceInvalidEmail: string;
|
|
2389
|
+
reminderUnitDay: string;
|
|
2390
|
+
reminderUnitDays: string;
|
|
2391
|
+
/** `{days}` is replaced with the number of days. */
|
|
2392
|
+
reminderNameDay: string;
|
|
2393
|
+
/** `{days}` is replaced with the number of days. */
|
|
2394
|
+
reminderNameDays: string;
|
|
2395
|
+
reminderNameAnd: string;
|
|
2396
|
+
reminderBeforeDueCaption: string;
|
|
2397
|
+
reminderOverdueCaption: string;
|
|
2398
|
+
reminderOverdueEmptyCaption: string;
|
|
2399
|
+
/** `{index}` is replaced with the term's position, starting at 1. */
|
|
2400
|
+
reminderOverdueTermLabel: string;
|
|
2401
|
+
/** `{min}` and `{max}` are replaced with the accepted range. */
|
|
2402
|
+
reminderDaysRange: string;
|
|
2403
|
+
reminderPastDueWarning: string;
|
|
2404
|
+
reminderAdded: string;
|
|
2405
|
+
reminderBeforeDueSubject: string;
|
|
2406
|
+
/** `{dueDate}` is replaced with the invoice's due date. */
|
|
2407
|
+
reminderBeforeDueBody: string;
|
|
2408
|
+
reminderBeforeDueBodyNoDate: string;
|
|
2409
|
+
reminderOverdueSubject: string;
|
|
2410
|
+
/** `{dueDate}` is replaced with the invoice's due date. */
|
|
2411
|
+
reminderOverdueBody: string;
|
|
2412
|
+
reminderOverdueBodyNoDate: string;
|
|
2413
|
+
issueRemindersDisabled: string;
|
|
2414
|
+
issueRemindersNoEmail: string;
|
|
2415
|
+
issueRemindersDisabledNoEmail: string;
|
|
2416
|
+
lineItemNameRequired: string;
|
|
2417
|
+
lineItemQuantityRequired: string;
|
|
2418
|
+
lineItemsRequired: string;
|
|
2419
|
+
paymentTermsRequired: string;
|
|
2420
|
+
bankAccountRequired: string;
|
|
2421
|
+
issueTaxIdRequired: string;
|
|
2422
|
+
issueBankAccountUnavailable: string;
|
|
2423
|
+
issueChecksLoading: string;
|
|
2424
|
+
attachmentsUploading: string;
|
|
2425
|
+
issueFailedAfterSave: string;
|
|
2426
|
+
/** `{errorMessage}` is replaced with the API's reason. */
|
|
2427
|
+
createFailed: string;
|
|
2428
|
+
/** `{errorMessage}` is replaced with the API's reason. */
|
|
2429
|
+
updateFailed: string;
|
|
2430
|
+
unknownError: string;
|
|
2431
|
+
/** `{message}` is the first reasons, `{count}` how many more there are. */
|
|
2432
|
+
apiErrorsSummary: string;
|
|
2433
|
+
/** `{name}` is replaced with the customer's name. */
|
|
2434
|
+
actionsIssueTitle: string;
|
|
2435
|
+
/** `{name}` is replaced with the customer's name. */
|
|
2436
|
+
actionsResendTitle: string;
|
|
2437
|
+
actionsIssueDismiss: string;
|
|
2438
|
+
actionsResendDismiss: string;
|
|
2439
|
+
/** `{documentId}` and `{name}` are replaced with the invoice number and customer name. */
|
|
2440
|
+
actionsSubjectWithNumber: string;
|
|
2441
|
+
/** `{name}` is replaced with the customer's name. */
|
|
2442
|
+
actionsSubject: string;
|
|
2443
|
+
actionsSendSucceeded: string;
|
|
2444
|
+
actionsSendFailed: string;
|
|
2445
|
+
/** @deprecated Unused: the backend creates the payment link on issue, so the browser no longer decides. Kept so existing overrides still compile. */
|
|
2446
|
+
actionsSendWithoutPaymentLink: string;
|
|
2447
|
+
/** @deprecated Unused: sending no longer checks a payment-link scope. Kept so existing overrides still compile. */
|
|
2448
|
+
actionsSendWithoutPaymentLinkScope: string;
|
|
2449
|
+
actionsTitleSent: string;
|
|
2450
|
+
actionsTitleIssued: string;
|
|
2451
|
+
actionsTitleRecurrence: string;
|
|
2452
|
+
actionsTitleDraft: string;
|
|
2453
|
+
actionsTitleUpdated: string;
|
|
2454
|
+
actionsSelectAll: string;
|
|
2455
|
+
actionsDeselectAll: string;
|
|
2456
|
+
actionsProductsSaved: string;
|
|
2457
|
+
actionsProductsSaveFailed: string;
|
|
2458
|
+
/** `{taxId}` is replaced with the party's tax ID. */
|
|
2459
|
+
previewTaxId: string;
|
|
2460
|
+
previewTaxableYes: string;
|
|
2461
|
+
previewTaxableNo: string;
|
|
2462
|
+
previewSubtotal: string;
|
|
2463
|
+
previewDiscount: string;
|
|
2464
|
+
previewNonTaxableSubtotal: string;
|
|
2465
|
+
previewTaxableSubtotal: string;
|
|
2466
|
+
previewTax: string;
|
|
2467
|
+
/** `{rate}` is replaced with the tax rate, e.g. "6.25". */
|
|
2468
|
+
previewTaxWithRate: string;
|
|
2469
|
+
previewTotal: string;
|
|
2470
|
+
previewDueOnReceipt: string;
|
|
2471
|
+
/** `{days}` is replaced with the term's number of days. */
|
|
2472
|
+
previewNetDays: string;
|
|
2473
|
+
/** `{days}` is replaced with the early-payment window. */
|
|
2474
|
+
previewEarlyPaymentDays: string;
|
|
2475
|
+
/** `{rate}` is replaced with the early-payment discount percentage. */
|
|
2476
|
+
previewEarlyPaymentDiscount: string;
|
|
2477
|
+
/** `{value}` is replaced with the account holder's name. */
|
|
2478
|
+
previewAccountHolderName: string;
|
|
2479
|
+
/** `{value}` is replaced with the routing number. */
|
|
2480
|
+
previewRoutingNumber: string;
|
|
2481
|
+
/** `{value}` is replaced with the account number. */
|
|
2482
|
+
previewAccountNumber: string;
|
|
2483
|
+
/** `{name}` is replaced with the issuer's name. */
|
|
2484
|
+
previewLogoAlt: string;
|
|
2485
|
+
previewLogoAltNoName: string;
|
|
2486
|
+
}
|
|
2487
|
+
|
|
2488
|
+
declare const ReceivableStatusCard: {
|
|
2489
|
+
readonly Unpaid: "unpaid";
|
|
2490
|
+
readonly Overdue: "overdue";
|
|
2491
|
+
readonly Paid: "paid";
|
|
2492
|
+
readonly Drafts: "drafts";
|
|
2493
|
+
};
|
|
2494
|
+
type ReceivableStatusCard = (typeof ReceivableStatusCard)[keyof typeof ReceivableStatusCard];
|
|
2495
|
+
|
|
2496
|
+
declare const InvoicingTab: {
|
|
2497
|
+
readonly Invoices: "invoices";
|
|
2498
|
+
readonly Recurring: "recurring";
|
|
2499
|
+
readonly Customers: "customers";
|
|
2500
|
+
readonly Products: "products";
|
|
2501
|
+
};
|
|
2502
|
+
type InvoicingTabId = (typeof InvoicingTab)[keyof typeof InvoicingTab];
|
|
2503
|
+
interface InvoicingTabLabels extends InvoicingTabsLabels {
|
|
2504
|
+
invoicesTab: string;
|
|
2505
|
+
recurringTab: string;
|
|
2506
|
+
customersTab: string;
|
|
2507
|
+
productsTab: string;
|
|
2508
|
+
}
|
|
2509
|
+
|
|
2510
|
+
interface ReceivablesWidgetOwnProps {
|
|
2511
|
+
/** Sponsor bank shown as "Powered by {bank}" beside embedded accounts. */
|
|
2512
|
+
embeddedBankName?: string;
|
|
2513
|
+
/** Rendered above the tab row. The widget renders no heading of its own (embedded ADR 0010), so pass the page title here. */
|
|
2514
|
+
headerStart?: ReactNode;
|
|
2515
|
+
/** The active tab. Omit to let the widget track it, starting on Invoices. */
|
|
2516
|
+
selectedTab?: InvoicingTabId;
|
|
2517
|
+
/** Called when the user picks a tab, so the host can keep it in the URL. */
|
|
2518
|
+
onTabChange?: (tab: InvoicingTabId) => void;
|
|
2519
|
+
/** The active summary card on the Invoices tab, or `null` for none. Applied on mount and whenever it changes; omit to let the widget track it. */
|
|
2520
|
+
selectedStatusCard?: ReceivableStatusCard | null;
|
|
2521
|
+
/** Called when the active summary card changes: a card click, or a Status filter change that matches or leaves a card. */
|
|
2522
|
+
onStatusCardChange?: (card: ReceivableStatusCard | null) => void;
|
|
2523
|
+
initialView?: 'create';
|
|
2524
|
+
/** Preselects this customer in the create form with `initialView: 'create'`; otherwise filters the invoice list to them. */
|
|
2525
|
+
initialCounterpartId?: string;
|
|
2526
|
+
pageSizeOptions?: number[];
|
|
2527
|
+
onReceivableCreated?: (id: string, type: ReceivableDocumentType) => void;
|
|
2528
|
+
onReceivableOpened?: (id: string, type: ReceivableDocumentType) => void;
|
|
2529
|
+
/** Shows an invoice settings button at the top right, on the `headerStart` line, for users holding `organization_settings:write:org`. */
|
|
2530
|
+
onTemplateSettingsClick?: () => void;
|
|
2531
|
+
tabLabels?: Partial<InvoicingTabLabels>;
|
|
2532
|
+
screenLabels?: ReceivablesScreenLabelOverrides;
|
|
2533
|
+
seriesScreenLabels?: RecurringSeriesScreenLabelOverrides;
|
|
2534
|
+
filterBarLabels?: InvoicesFilterBarLabelOverrides;
|
|
2535
|
+
filterLabels?: InvoicesFilterLabelOverrides;
|
|
2536
|
+
formLabels?: Partial<ReceivableFormDialogLabels>;
|
|
2537
|
+
previewLabels?: Partial<ReceivablePreviewLabels>;
|
|
2538
|
+
detailsLabels?: ReceivableDetailsPanelLabelOverrides;
|
|
2539
|
+
auditHistoryLabels?: Partial<ReceivableAuditHistoryLabels>;
|
|
2540
|
+
paymentLabels?: Partial<ReceivablePaymentDialogLabels>;
|
|
2541
|
+
actionLabels?: Partial<ReceivableActionDialogLabels>;
|
|
2542
|
+
actionsModalLabels?: Partial<ReceivableActionsModalLabels>;
|
|
2543
|
+
counterpartFormLabels?: PartialDeep<CounterpartFormSheetLabels>;
|
|
2544
|
+
measureUnitsLabels?: PartialDeep<MeasureUnitsManagerLabels>;
|
|
2545
|
+
measureUnitDeleteLabels?: Partial<MeasureUnitDeleteDialogLabels>;
|
|
2546
|
+
messageLabels?: Partial<ReceivableMessageLabels>;
|
|
2547
|
+
productMessageLabels?: Partial<ProductMessageLabels>;
|
|
2548
|
+
counterpartMessageLabels?: Partial<CounterpartMessageLabels>;
|
|
2549
|
+
}
|
|
2550
|
+
|
|
2551
|
+
type ReceivablesWidgetProps = WidgetProviderProps & ReceivablesWidgetOwnProps;
|
|
2552
|
+
|
|
2553
|
+
declare function ReceivablesWidget({ baseUrl, widgetToken, organizationId, configClient, gatewayRouting, linkComponent, uiFramework, errorFallback, onError, analytics, disclosuresAcceptance, providerLabels, ...innerProps }: ReceivablesWidgetProps): React.JSX.Element;
|
|
2554
|
+
|
|
2555
|
+
export { InvoicingTab, ReceivableStatusCard, ReceivablesWidget };
|
|
2556
|
+
export type { CounterpartFormSheetLabels, CounterpartMessageLabels, InvoicesFilterBarLabelOverrides, InvoicesFilterBarLabels, InvoicesFilterLabelOverrides, InvoicesFilterLabels, InvoicingTabId, InvoicingTabLabels, MeasureUnitDeleteDialogLabels, MeasureUnitsManagerLabels, ProductFormSheetLabels, ProductMessageLabels, ReceivableActionDialogLabels, ReceivableActionsModalLabels, ReceivableAuditHistoryLabels, ReceivableDetailsPanelLabelOverrides, ReceivableDetailsPanelLabels, ReceivableDocumentType, ReceivableFormDialogLabels, ReceivableFormSheetLabels, ReceivableMessageLabels, ReceivablePaymentDialogLabels, ReceivablePreviewLabels, ReceivableStatusBadgeLabels, ReceivablesScreenLabelOverrides, ReceivablesScreenLabels, ReceivablesWidgetProps, RecurringSeriesScreenLabelOverrides, RecurringSeriesScreenLabels };
|