@tesouro/embedded-components-react 0.3.63 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/README.md +1 -70
  2. package/dist/index.d.ts +67 -832
  3. package/dist/index.js +18 -34
  4. package/dist/lib/BillPayWidget.js +1 -1
  5. package/dist/lib/SettingsWidget.d.ts +53 -7
  6. package/dist/lib/SettingsWidget.js +4 -2
  7. package/dist/lib/WidgetSuite.d.ts +38 -0
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +8 -8
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +8 -14
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js +7 -57
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js +56 -16
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +18 -126
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js +126 -14
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index33.js +22 -4
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js +4 -41
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index35.js +40 -4
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index36.js +5 -73
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index37.js +72 -48
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index38.js +47 -91
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index39.js +91 -33
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +33 -167
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index41.js +167 -75
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js +75 -21
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +23 -210
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +199 -203
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js +198 -89
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +105 -13
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +12 -47
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +47 -31
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +27 -198
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +198 -30
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +30 -234
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +240 -18
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +18 -341
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +343 -4
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +4 -33
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +31 -83
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +78 -163
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +170 -3
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +3 -4
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index60.js +2 -44
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index61.js +46 -1
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index62.js +1 -8
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index63.js +6 -9
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index64.js +9 -92
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index65.js +94 -3
  47. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index66.js +3 -128
  48. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index67.js +125 -8
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index68.js +8 -7
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index69.js +8 -46
  51. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index70.js +43 -18
  52. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index71.js +20 -28
  53. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index72.js +27 -82
  54. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index73.js +83 -47
  55. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index74.js +47 -250
  56. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index75.js +239 -101
  57. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index76.js +107 -202
  58. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index77.js +209 -3
  59. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index78.js +4 -8
  60. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index79.js +6 -113
  61. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index80.js +115 -1
  62. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index81.js +0 -24
  63. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index82.js +25 -0
  64. package/dist/libs/tesouro-embedded-components-react/gl-code-table-widget/feature/dist/index.js +3 -3
  65. package/dist/libs/tesouro-embedded-components-react/gl-code-table-widget/ui/dist/index.js +5 -5
  66. package/dist/libs/tesouro-embedded-components-react/help-widget/feature/dist/index.js +4 -2
  67. package/dist/libs/tesouro-embedded-components-react/help-widget/ui/shadcn/dist/index.js +4 -4
  68. package/dist/libs/tesouro-embedded-components-react/help-widget/ui/shadcn/dist/index4.js +2 -3
  69. package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/index6.js +35 -32
  70. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  71. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index8.js +1 -1
  72. package/package.json +1 -1
  73. package/dist/lib/ChartOfAccountsWidget.d.ts +0 -958
  74. package/dist/lib/ChartOfAccountsWidget.js +0 -9
  75. package/dist/lib/HelpWidget.d.ts +0 -739
  76. package/dist/lib/HelpWidget.js +0 -6
  77. package/dist/lib/ProfileWidget.d.ts +0 -672
  78. package/dist/lib/ProfileWidget.js +0 -3
  79. package/dist/lib/TagsWidget.d.ts +0 -719
  80. package/dist/lib/TagsWidget.js +0 -3
  81. package/dist/lib/TeamWidget.d.ts +0 -878
  82. package/dist/lib/TeamWidget.js +0 -3
@@ -1,958 +0,0 @@
1
- import * as React from 'react';
2
- import { ComponentType, AnchorHTMLAttributes, ReactNode, ErrorInfo } from 'react';
3
- import { SortingState, OnChangeFn } from '@tanstack/react-table';
4
- import { FallbackProps } from 'react-error-boundary';
5
-
6
- /**
7
- * Co-located user-facing strings for every chart-of-accounts surface: the table,
8
- * the create/edit sheet, and the delete confirmation. Each component takes a
9
- * `labels?: Partial<…Labels>` prop merged over the matching `*_LABELS_EN`
10
- * default.
11
- *
12
- * This is the single home for the widget's translation surface. Keeping any of
13
- * it next to a component instead splits what a translator has to find.
14
- *
15
- * The copy follows the Chart of accounts design, which calls each row an
16
- * "account" rather than a "GL code" or a "category": the GL code is one field on
17
- * an account, not the thing itself.
18
- */
19
- interface ChartOfAccountsLabels {
20
- /** Section heading, and the sentence beneath it explaining what the list is. */
21
- subtitle: string;
22
- columnGlCode: string;
23
- columnName: string;
24
- columnDescription: string;
25
- columnActions: string;
26
- actionEdit: string;
27
- actionDelete: string;
28
- /** Accessible name for the icon-only sort control in the name column. */
29
- sortByName: string;
30
- openActionsMenu: string;
31
- /** Toolbar and empty-state call to action. */
32
- addAccount: string;
33
- emptyTitle: string;
34
- emptyDescription: string;
35
- /**
36
- * Shown instead of {@link ChartOfAccountsLabels.emptyTitle} when a later page
37
- * comes back empty, which happens when the rows it held were deleted. The
38
- * organization still has accounts, so the copy must not claim otherwise.
39
- */
40
- emptyPageTitle: string;
41
- emptyPageDescription: string;
42
- errorTitle: string;
43
- errorDescription: string;
44
- paginationPrev: string;
45
- paginationNext: string;
46
- }
47
- declare const CHART_OF_ACCOUNTS_LABELS_EN: ChartOfAccountsLabels;
48
- /**
49
- * Copy for the create/edit sheet.
50
- *
51
- * Four of these are resolved by the **owner** rather than by `AccountFormSheet`:
52
- * `createTitle`, `createDescription`, `editDescription`, and `descriptionCounter`.
53
- * The sheet takes an already-assembled `title`, `description`, and
54
- * `descriptionCounterText`, because choosing between create and edit copy is form
55
- * policy and filling `{count}`/`{max}` is formatting, neither of which belongs in
56
- * a presentational component. They stay in this file anyway: it is the single
57
- * home for the widget's translation surface, and splitting it by which layer
58
- * happens to read a key would make a translator hunt in two places.
59
- *
60
- * There is no `editTitle`. The design titles the edit sheet with the account's
61
- * own name, verbatim, so there is no template to translate.
62
- */
63
- interface AccountFormSheetLabels {
64
- /** Create-mode heading. Owner-resolved. */
65
- createTitle: string;
66
- /** Screen-reader description of the edit sheet's purpose. Owner-resolved. */
67
- editDescription: string;
68
- /** Screen-reader description of the create sheet's purpose. Owner-resolved. */
69
- createDescription: string;
70
- glCodeLabel: string;
71
- glCodePlaceholder: string;
72
- nameLabel: string;
73
- namePlaceholder: string;
74
- descriptionLabel: string;
75
- descriptionPlaceholder: string;
76
- /**
77
- * `{count}` and `{max}` are replaced with the current and maximum length.
78
- * Owner-resolved; the sheet renders the finished `descriptionCounterText`.
79
- */
80
- descriptionCounter: string;
81
- cancelButton: string;
82
- saveButton: string;
83
- /** Tooltip on a disabled save, explaining why it cannot be pressed yet. */
84
- saveDisabledHint: string;
85
- openAccountMenu: string;
86
- deleteAction: string;
87
- /**
88
- * Accessible name for the sheet's close control. The built-in `SheetContent`
89
- * close is switched off in favour of one this widget owns, so the copy stays
90
- * inside the label contract instead of the primitive's hardcoded "Close".
91
- */
92
- closeSheet: string;
93
- }
94
- declare const ACCOUNT_FORM_SHEET_LABELS_EN: AccountFormSheetLabels;
95
- interface AccountDeleteDialogLabels {
96
- /**
97
- * `{name}` is replaced with the account name. Owner-resolved, for the same
98
- * reason as the sheet's titles above: the dialog takes a finished `title`
99
- * rather than a domain value plus a template.
100
- */
101
- title: string;
102
- /** Used when the owner passes no `message`, which is the normal case. */
103
- message: string;
104
- confirmButton: string;
105
- cancelButton: string;
106
- }
107
- declare const ACCOUNT_DELETE_DIALOG_LABELS_EN: AccountDeleteDialogLabels;
108
-
109
- type LedgerAccountRow = {
110
- id: string;
111
- name: string;
112
- nominal_code: string;
113
- description: string;
114
- /**
115
- * True when the account came from an external accounting system. The API
116
- * refuses to update or delete these (403), so row actions are withheld.
117
- */
118
- is_external?: boolean;
119
- };
120
- interface ChartOfAccountsTableProps {
121
- data: LedgerAccountRow[];
122
- isLoading?: boolean;
123
- isError?: boolean;
124
- sorting: SortingState;
125
- onSortingChange: OnChangeFn<SortingState>;
126
- pageSize: number;
127
- onPageSizeChange: (pageSize: number) => void;
128
- pageSizeOptions: number[];
129
- hasNextPage?: boolean;
130
- hasPrevPage?: boolean;
131
- onNextPage: () => void;
132
- onPrevPage: () => void;
133
- /** Merged with CHART_OF_ACCOUNTS_LABELS_EN; only override what you need. */
134
- labels?: Partial<ChartOfAccountsLabels>;
135
- onEdit?: (row: LedgerAccountRow) => void;
136
- onDelete?: (row: LedgerAccountRow) => void;
137
- /**
138
- * Enables the add action. Rendered as a toolbar button above the table, or as
139
- * the centred call to action when the first page comes back with no rows.
140
- * Omit it (for example when the user lacks write permission) to withhold the
141
- * affordance entirely.
142
- */
143
- onAdd?: () => void;
144
- /** Applied to the empty state's root element. Supplied by the caller, not decided here. */
145
- emptyStateTestId?: string;
146
- }
147
- declare function ChartOfAccountsTable({ data, isLoading, isError, sorting, onSortingChange, pageSize, onPageSizeChange, pageSizeOptions, hasNextPage, hasPrevPage, onNextPage, onPrevPage, labels, emptyStateTestId, onEdit, onDelete, onAdd, }: ChartOfAccountsTableProps): React.JSX.Element;
148
-
149
- /**
150
- * Which form the owner has open. Deliberately *not* a prop on
151
- * {@link AccountFormSheet}: the sheet renders whatever `title` and `description`
152
- * it is handed, so create-versus-edit is the owner's state rather than something
153
- * the sheet interprets. Lives here because it belongs to this widget's shared
154
- * vocabulary and is part of the published package surface;
155
- * `useChartOfAccountsCrud` is the consumer.
156
- */
157
- type AccountFormMode = 'create' | 'edit';
158
- interface AccountFormValues {
159
- name: string;
160
- nominal_code: string;
161
- description: string;
162
- }
163
- interface AccountFormErrors {
164
- name?: string;
165
- nominal_code?: string;
166
- description?: string;
167
- /** Form-level error (e.g. an API failure not tied to a single field). */
168
- form?: string;
169
- }
170
- interface AccountFormSheetProps {
171
- open: boolean;
172
- onOpenChange: (open: boolean) => void;
173
- /**
174
- * Heading, already assembled. The owner decides whether that is the create
175
- * copy or the edited account's own name; the sheet does not interpolate a
176
- * domain value into a template or branch on a form mode to pick one.
177
- */
178
- title: string;
179
- /** Screen-reader description of the sheet's purpose, already assembled. */
180
- description: string;
181
- values: AccountFormValues;
182
- errors?: AccountFormErrors;
183
- /** Disables every action while a mutation is in flight. */
184
- inProgress?: boolean;
185
- /**
186
- * Whether the form is not yet complete enough to submit. The owner decides,
187
- * so the rule stays with the validation that enforces it; the sheet only
188
- * reflects the answer and shows {@link AccountFormSheetLabels.saveDisabledHint}.
189
- */
190
- submitDisabled?: boolean;
191
- /** Already-formatted character counter for the description, e.g. "53/280 characters". */
192
- descriptionCounterText: string;
193
- onNameChange: (name: string) => void;
194
- onGlCodeChange: (nominalCode: string) => void;
195
- onDescriptionChange: (description: string) => void;
196
- onSubmit: () => void;
197
- onCancel: () => void;
198
- /**
199
- * Shows the header menu when supplied. The owner withholds it for a form that
200
- * has nothing to delete yet, so its presence is the whole condition here.
201
- */
202
- onDelete?: () => void;
203
- /** Merged with {@link ACCOUNT_FORM_SHEET_LABELS_EN}. */
204
- labels?: Partial<AccountFormSheetLabels>;
205
- }
206
- /**
207
- * Presentational create/edit form for a ledger account, rendered in a side
208
- * sheet. Fully controlled: the owner holds `values` and validation `errors` and
209
- * reacts to the field-change and submit/cancel/delete gestures.
210
- *
211
- * Three fields (GL code, account name, description), in the order the design
212
- * lists them. An **Account type** select is also in the design and deliberately
213
- * absent here: the API exposes `type` on the response only, so the control would
214
- * silently discard whatever was chosen. It arrives with EMBD-4603.
215
- */
216
- declare function AccountFormSheet({ open, onOpenChange, title, description, values, errors, inProgress, submitDisabled, descriptionCounterText, onNameChange, onGlCodeChange, onDescriptionChange, onSubmit, onCancel, onDelete, labels, }: AccountFormSheetProps): React.JSX.Element;
217
-
218
- interface AccountDeleteDialogProps {
219
- open: boolean;
220
- onOpenChange: (open: boolean) => void;
221
- /**
222
- * Confirmation heading, already assembled. The owner names the account, so the
223
- * dialog never interpolates a domain value into a template.
224
- */
225
- title: string;
226
- /**
227
- * Body copy. Falls back to
228
- * {@link AccountDeleteDialogLabels.message} when omitted, since nothing about
229
- * this sentence depends on which account is being deleted.
230
- */
231
- message?: string;
232
- /** Disables the buttons while the delete mutation is in flight. */
233
- isDeleting?: boolean;
234
- /** Failure message from the delete attempt; keeps the dialog open. */
235
- error?: string;
236
- onConfirm: () => void;
237
- onCancel: () => void;
238
- /** Merged with {@link ACCOUNT_DELETE_DIALOG_LABELS_EN}. */
239
- labels?: Partial<AccountDeleteDialogLabels>;
240
- }
241
- /**
242
- * Destructive confirmation dialog for deleting a GL code. Controlled by the
243
- * owner; composes the shared `AlertDialog` primitive with a destructive confirm
244
- * button.
245
- */
246
- declare function AccountDeleteDialog({ open, onOpenChange, title, message, isDeleting, error, onConfirm, onCancel, labels, }: AccountDeleteDialogProps): React.JSX.Element;
247
-
248
- type AuthToken = string | undefined;
249
- interface Auth {
250
- /**
251
- * Which part of the request do we use to send the auth?
252
- *
253
- * @default 'header'
254
- */
255
- in?: 'header' | 'query' | 'cookie';
256
- /**
257
- * A unique identifier for the security scheme.
258
- *
259
- * Defined only when there are multiple security schemes whose `Auth`
260
- * shape would otherwise be identical.
261
- */
262
- key?: string;
263
- /**
264
- * Header or query parameter name.
265
- *
266
- * @default 'Authorization'
267
- */
268
- name?: string;
269
- scheme?: 'basic' | 'bearer';
270
- type: 'apiKey' | 'http';
271
- }
272
-
273
- interface SerializerOptions<T> {
274
- /**
275
- * @default true
276
- */
277
- explode: boolean;
278
- style: T;
279
- }
280
- type ArrayStyle = 'form' | 'spaceDelimited' | 'pipeDelimited';
281
- type ObjectStyle = 'form' | 'deepObject';
282
-
283
- type QuerySerializer = (query: Record<string, unknown>) => string;
284
- type BodySerializer = (body: unknown) => unknown;
285
- type QuerySerializerOptionsObject = {
286
- allowReserved?: boolean;
287
- array?: Partial<SerializerOptions<ArrayStyle>>;
288
- object?: Partial<SerializerOptions<ObjectStyle>>;
289
- };
290
- type QuerySerializerOptions = QuerySerializerOptionsObject & {
291
- /**
292
- * Per-parameter serialization overrides. When provided, these settings
293
- * override the global array/object settings for specific parameter names.
294
- */
295
- parameters?: Record<string, QuerySerializerOptionsObject>;
296
- };
297
-
298
- type HttpMethod = 'connect' | 'delete' | 'get' | 'head' | 'options' | 'patch' | 'post' | 'put' | 'trace';
299
- type Client$1<RequestFn = never, Config = unknown, MethodFn = never, BuildUrlFn = never, SseFn = never> = {
300
- /**
301
- * Returns the final request URL.
302
- */
303
- buildUrl: BuildUrlFn;
304
- getConfig: () => Config;
305
- request: RequestFn;
306
- setConfig: (config: Config) => Config;
307
- } & {
308
- [K in HttpMethod]: MethodFn;
309
- } & ([SseFn] extends [never] ? {
310
- sse?: never;
311
- } : {
312
- sse: {
313
- [K in HttpMethod]: SseFn;
314
- };
315
- });
316
- interface Config$1 {
317
- /**
318
- * Auth token or a function returning auth token. The resolved value will be
319
- * added to the request payload as defined by its `security` array.
320
- */
321
- auth?: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken;
322
- /**
323
- * A function for serializing request body parameter. By default,
324
- * {@link JSON.stringify()} will be used.
325
- */
326
- bodySerializer?: BodySerializer | null;
327
- /**
328
- * An object containing any HTTP headers that you want to pre-populate your
329
- * `Headers` object with.
330
- *
331
- * {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more}
332
- */
333
- headers?: RequestInit['headers'] | Record<string, string | number | boolean | (string | number | boolean)[] | null | undefined | unknown>;
334
- /**
335
- * The request method.
336
- *
337
- * {@link https://developer.mozilla.org/docs/Web/API/fetch#method See more}
338
- */
339
- method?: Uppercase<HttpMethod>;
340
- /**
341
- * A function for serializing request query parameters. By default, arrays
342
- * will be exploded in form style, objects will be exploded in deepObject
343
- * style, and reserved characters are percent-encoded.
344
- *
345
- * This method will have no effect if the native `paramsSerializer()` Axios
346
- * API function is used.
347
- *
348
- * {@link https://swagger.io/docs/specification/serialization/#query View examples}
349
- */
350
- querySerializer?: QuerySerializer | QuerySerializerOptions;
351
- /**
352
- * A function validating request data. This is useful if you want to ensure
353
- * the request conforms to the desired shape, so it can be safely sent to
354
- * the server.
355
- */
356
- requestValidator?: (data: unknown) => Promise<unknown>;
357
- /**
358
- * A function transforming response data before it's returned. This is useful
359
- * for post-processing data, e.g., converting ISO strings into Date objects.
360
- */
361
- responseTransformer?: (data: unknown) => Promise<unknown>;
362
- /**
363
- * A function validating response data. This is useful if you want to ensure
364
- * the response conforms to the desired shape, so it can be safely passed to
365
- * the transformers and returned to the user.
366
- */
367
- responseValidator?: (data: unknown) => Promise<unknown>;
368
- }
369
-
370
- type ServerSentEventsOptions<TData = unknown> = Omit<RequestInit, 'method'> & Pick<Config$1, 'method' | 'responseTransformer' | 'responseValidator'> & {
371
- /**
372
- * Fetch API implementation. You can use this option to provide a custom
373
- * fetch instance.
374
- *
375
- * @default globalThis.fetch
376
- */
377
- fetch?: typeof fetch;
378
- /**
379
- * Implementing clients can call request interceptors inside this hook.
380
- */
381
- onRequest?: (url: string, init: RequestInit) => Promise<Request>;
382
- /**
383
- * Callback invoked when a network or parsing error occurs during streaming.
384
- *
385
- * This option applies only if the endpoint returns a stream of events.
386
- *
387
- * @param error The error that occurred.
388
- */
389
- onSseError?: (error: unknown) => void;
390
- /**
391
- * Callback invoked when an event is streamed from the server.
392
- *
393
- * This option applies only if the endpoint returns a stream of events.
394
- *
395
- * @param event Event streamed from the server.
396
- * @returns Nothing (void).
397
- */
398
- onSseEvent?: (event: StreamEvent<TData>) => void;
399
- serializedBody?: RequestInit['body'];
400
- /**
401
- * Default retry delay in milliseconds.
402
- *
403
- * This option applies only if the endpoint returns a stream of events.
404
- *
405
- * @default 3000
406
- */
407
- sseDefaultRetryDelay?: number;
408
- /**
409
- * Maximum number of retry attempts before giving up.
410
- */
411
- sseMaxRetryAttempts?: number;
412
- /**
413
- * Maximum retry delay in milliseconds.
414
- *
415
- * Applies only when exponential backoff is used.
416
- *
417
- * This option applies only if the endpoint returns a stream of events.
418
- *
419
- * @default 30000
420
- */
421
- sseMaxRetryDelay?: number;
422
- /**
423
- * Optional sleep function for retry backoff.
424
- *
425
- * Defaults to using `setTimeout`.
426
- */
427
- sseSleepFn?: (ms: number) => Promise<void>;
428
- url: string;
429
- };
430
- interface StreamEvent<TData = unknown> {
431
- data: TData;
432
- event?: string;
433
- id?: string;
434
- retry?: number;
435
- }
436
- type ServerSentEventsResult<TData = unknown, TReturn = void, TNext = unknown> = {
437
- stream: AsyncGenerator<TData extends Record<string, unknown> ? TData[keyof TData] : TData, TReturn, TNext>;
438
- };
439
-
440
- type ErrInterceptor<Err, Res, Req, Options> = (error: Err,
441
- /** response may be undefined due to a network error where no response object is produced */
442
- response: Res | undefined,
443
- /** request may be undefined, because error may be from building the request object itself */
444
- request: Req | undefined, options: Options) => Err | Promise<Err>;
445
- type ReqInterceptor<Req, Options> = (request: Req, options: Options) => Req | Promise<Req>;
446
- type ResInterceptor<Res, Req, Options> = (response: Res, request: Req, options: Options) => Res | Promise<Res>;
447
- declare class Interceptors<Interceptor> {
448
- fns: Array<Interceptor | null>;
449
- clear(): void;
450
- eject(id: number | Interceptor): void;
451
- exists(id: number | Interceptor): boolean;
452
- getInterceptorIndex(id: number | Interceptor): number;
453
- update(id: number | Interceptor, fn: Interceptor): number | Interceptor | false;
454
- use(fn: Interceptor): number;
455
- }
456
- interface Middleware<Req, Res, Err, Options> {
457
- error: Interceptors<ErrInterceptor<Err, Res, Req, Options>>;
458
- request: Interceptors<ReqInterceptor<Req, Options>>;
459
- response: Interceptors<ResInterceptor<Res, Req, Options>>;
460
- }
461
-
462
- type ResponseStyle = 'data' | 'fields';
463
- interface Config<T extends ClientOptions$1 = ClientOptions$1> extends Omit<RequestInit, 'body' | 'headers' | 'method'>, Config$1 {
464
- /**
465
- * Base URL for all requests made by this client.
466
- */
467
- baseUrl?: T['baseUrl'];
468
- /**
469
- * Fetch API implementation. You can use this option to provide a custom
470
- * fetch instance.
471
- *
472
- * @default globalThis.fetch
473
- */
474
- fetch?: typeof fetch;
475
- /**
476
- * Please don't use the Fetch client for Next.js applications. The `next`
477
- * options won't have any effect.
478
- *
479
- * Install {@link https://www.npmjs.com/package/@hey-api/client-next `@hey-api/client-next`} instead.
480
- */
481
- next?: never;
482
- /**
483
- * Return the response data parsed in a specified format. By default, `auto`
484
- * will infer the appropriate method from the `Content-Type` response header.
485
- * You can override this behavior with any of the {@link Body} methods.
486
- * Select `stream` if you don't want to parse response data at all.
487
- *
488
- * @default 'auto'
489
- */
490
- parseAs?: 'arrayBuffer' | 'auto' | 'blob' | 'formData' | 'json' | 'stream' | 'text';
491
- /**
492
- * Should we return only data or multiple fields (data, error, response, etc.)?
493
- *
494
- * @default 'fields'
495
- */
496
- responseStyle?: ResponseStyle;
497
- /**
498
- * Throw an error instead of returning it in the response?
499
- *
500
- * @default false
501
- */
502
- throwOnError?: T['throwOnError'];
503
- }
504
- interface RequestOptions<TData = unknown, TResponseStyle extends ResponseStyle = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string> extends Config<{
505
- responseStyle: TResponseStyle;
506
- throwOnError: ThrowOnError;
507
- }>, Pick<ServerSentEventsOptions<TData>, 'onRequest' | 'onSseError' | 'onSseEvent' | 'sseDefaultRetryDelay' | 'sseMaxRetryAttempts' | 'sseMaxRetryDelay'> {
508
- /**
509
- * Any body that you want to add to your request.
510
- *
511
- * {@link https://developer.mozilla.org/docs/Web/API/fetch#body}
512
- */
513
- body?: unknown;
514
- path?: Record<string, unknown>;
515
- query?: Record<string, unknown>;
516
- /**
517
- * Security mechanism(s) to use for the request.
518
- */
519
- security?: ReadonlyArray<Auth>;
520
- url: Url;
521
- }
522
- interface ResolvedRequestOptions<TResponseStyle extends ResponseStyle = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string> extends RequestOptions<unknown, TResponseStyle, ThrowOnError, Url> {
523
- headers: Headers;
524
- serializedBody?: string;
525
- }
526
- 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 : {
527
- data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
528
- request: Request;
529
- response: Response;
530
- }> : Promise<TResponseStyle extends 'data' ? (TData extends Record<string, unknown> ? TData[keyof TData] : TData) | undefined : ({
531
- data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
532
- error: undefined;
533
- } | {
534
- data: undefined;
535
- error: TError extends Record<string, unknown> ? TError[keyof TError] : TError;
536
- }) & {
537
- /** request may be undefined, because error may be from building the request object itself */
538
- request?: Request;
539
- /** response may be undefined, because error may be from building the request object itself or from a network error */
540
- response?: Response;
541
- }>;
542
- interface ClientOptions$1 {
543
- baseUrl?: string;
544
- responseStyle?: ResponseStyle;
545
- throwOnError?: boolean;
546
- }
547
- 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>;
548
- type SseFn = <TData = unknown, _TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<never, TResponseStyle, ThrowOnError>, 'method'>) => Promise<ServerSentEventsResult<TData>>;
549
- 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>;
550
- type BuildUrlFn = <TData extends {
551
- body?: unknown;
552
- path?: Record<string, unknown>;
553
- query?: Record<string, unknown>;
554
- url: string;
555
- }>(options: TData & Options<TData>) => string;
556
- type Client = Client$1<RequestFn, Config, MethodFn, BuildUrlFn, SseFn> & {
557
- interceptors: Middleware<Request, Response, unknown, ResolvedRequestOptions>;
558
- };
559
- interface TDataShape {
560
- body?: unknown;
561
- headers?: unknown;
562
- path?: unknown;
563
- query?: unknown;
564
- url: string;
565
- }
566
- type OmitKeys<T, K> = Pick<T, Exclude<keyof T, K>>;
567
- 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'>);
568
-
569
- type ClientOptions = {
570
- 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 & {});
571
- };
572
-
573
- type EmbeddedClient = Client;
574
- type ExtractLiterals<T> = T extends string ? string extends T ? never : T : never;
575
- type BaseUrl = ExtractLiterals<ClientOptions['baseUrl']>;
576
-
577
- type LinkComponentProps = AnchorHTMLAttributes<HTMLAnchorElement> & {
578
- children?: ReactNode;
579
- };
580
- type LinkComponent = ComponentType<LinkComponentProps>;
581
- /**
582
- * The UI frameworks a widget's UI layer can render with.
583
- *
584
- * - `shadcn` — the shadcn/Tailwind implementation. This is the default and the
585
- * implicit fallback, so existing consumers that select nothing keep rendering
586
- * shadcn.
587
- * - `tecton` — the Tecton implementation.
588
- *
589
- * Declared as an `as const` object (not a TypeScript `enum`) per repo
590
- * convention.
591
- */
592
- declare const UIFramework: {
593
- readonly Shadcn: "shadcn";
594
- readonly Tecton: "tecton";
595
- };
596
- type UIFramework = (typeof UIFramework)[keyof typeof UIFramework];
597
-
598
- /**
599
- * The implementation a widget renders with.
600
- *
601
- * - `native` — the Tesouro-native implementation. This is the default and the
602
- * implicit fallback, so consumers that select nothing keep rendering native.
603
- * - `monite` — the Monite SDK implementation.
604
- *
605
- * Declared as an `as const` object (not a TypeScript `enum`) per repo
606
- * convention.
607
- */
608
- declare const Implementation: {
609
- readonly Native: "native";
610
- readonly Monite: "monite";
611
- };
612
- type Implementation = (typeof Implementation)[keyof typeof Implementation];
613
- /**
614
- * The settable fields of the widget config cascade.
615
- *
616
- * This is the type accepted by {@link setGlobalWidgetConfig} and all provider props.
617
- * It intentionally excludes `initResponse`, which is populated automatically by the
618
- * provider after a successful fetch and must never be set manually.
619
- *
620
- * The `null` vs `undefined` distinction on `widgetToken` and `organizationId` is intentional:
621
- * - `undefined` — not set at this level; inherit from the nearest ancestor or global store.
622
- * - `null` — explicitly cleared; downstream sees "no value" even if an ancestor had one
623
- * (e.g. after logout or deliberate de-scoping).
624
- *
625
- * @see {@link WidgetConfig} for the resolved output type (includes `initResponse`)
626
- * @see {@link RootWidgetProvider}
627
- * @see {@link WidgetProvider}
628
- * @see {@link setGlobalWidgetConfig}
629
- */
630
- interface WidgetConfigInput {
631
- /**
632
- * Base URL of the Tesouro embedded API (e.g. `"https://api.tesouro.com"`).
633
- *
634
- * When omitted the nearest ancestor's `baseUrl` or the global store value is used.
635
- * Changing this recreates the underlying HTTP client so all subsequent requests
636
- * go to the new host.
637
- */
638
- baseUrl?: BaseUrl;
639
- /**
640
- * Bearer token used to authenticate widget requests.
641
- *
642
- * Injected as `Authorization: Bearer <token>` on every outgoing request via an
643
- * interceptor on the scoped HTTP client. Token updates are picked up immediately
644
- * without recreating the client.
645
- *
646
- * - `string` — send this token on all requests from this level downward.
647
- * - `null` — explicitly cleared; no auth header is sent and fetching is suppressed.
648
- * - `undefined` — not set at this level; inherit from the nearest ancestor or global store.
649
- */
650
- widgetToken?: string | null;
651
- /**
652
- * Organization ID forwarded as the `x-organization-id` request header.
653
- *
654
- * Passed through {@link EmbedApiProvider} context rather than the auth interceptor,
655
- * so individual data-access hooks can opt in per-request.
656
- *
657
- * - `string` — use this organization for downstream data requests.
658
- * - `null` — explicitly cleared; queries that require an org ID will be disabled.
659
- * - `undefined` — not set at this level; inherit from the nearest ancestor or global store.
660
- *
661
- * When `undefined` across the **whole** cascade (no prop, no ancestor, no global
662
- * value), the resolved org defaults to the loaded `initResponse.organizationId`
663
- * (see {@link WidgetConfig.initResponse}) once the widget-init fetch settles. This
664
- * is the lowest-priority fallback — any explicit `string` or `null` at any cascade
665
- * level wins, and an explicit `null` is preserved and never falls back.
666
- *
667
- * Only an **explicit** ancestor org is inherited. An ancestor's *init-derived*
668
- * default does not propagate into a descendant that owns its own fetch (its own
669
- * `baseUrl`/`widgetToken`); such a descendant defaults to its own
670
- * `initResponse.organizationId` instead, so it never sends an ancestor's org with
671
- * its own token.
672
- */
673
- organizationId?: string | null;
674
- /**
675
- * Optional post-creation hook for the scoped HTTP client.
676
- *
677
- * Called once after the provider creates its scoped {@link EmbeddedClient} and
678
- * applies the built-in `Authorization: Bearer` interceptor. Receives the
679
- * fully-configured client and must return the client to be used for the lifetime of
680
- * this provider level — either the same instance (with additional interceptors
681
- * attached) or a new client entirely.
682
- *
683
- * **Order:** The built-in auth interceptor is always applied first. `configClient`
684
- * is called on top of it, so any interceptors you add here run after auth is set.
685
- *
686
- * **Any prop triggers a scoped client.** A {@link WidgetProvider} creates its own
687
- * scoped client whenever any prop is set — including `configClient` alone, without
688
- * `baseUrl` or `widgetToken`. Only a fully props-free pass-through provider skips
689
- * client creation and never calls this function.
690
- *
691
- * **Stability:** The function reference is included in the client creation memo's
692
- * dependency array. Passing an unstable (inline) function recreates the client on
693
- * every render. Stabilize with `useCallback` or define the function outside the
694
- * component.
695
- *
696
- * **Cascade:** Inherits from the nearest ancestor when `undefined`. A child
697
- * {@link WidgetProvider} that creates its own scoped client will use the resolved
698
- * `configClient` from the cascade unless it provides its own override.
699
- *
700
- * @example
701
- * ```tsx
702
- * const addLogging = useCallback(
703
- * (client: EmbeddedClient) => {
704
- * client.interceptors.request.use((req) => {
705
- * console.log('[widget]', req.method, req.url);
706
- * return req;
707
- * });
708
- * return client;
709
- * },
710
- * [],
711
- * );
712
- *
713
- * <RootWidgetProvider
714
- * baseUrl="https://api.tesouro.com"
715
- * widgetToken={token}
716
- * configClient={addLogging}
717
- * >
718
- * <App />
719
- * </RootWidgetProvider>
720
- * ```
721
- */
722
- configClient?: (client: EmbeddedClient) => EmbeddedClient;
723
- /**
724
- * Overrides the widget-gateway routing decision for the scoped HTTP client.
725
- *
726
- * Any caller reaching the Tesouro API with a widget token must route data
727
- * requests through the widget gateway: prefix the path with
728
- * `/api/widget-gateway/proxy` and carry the token as `X-Widget-Token`. The
729
- * provider applies both automatically per request when the request origin is
730
- * a known Tesouro API host (`WIDGET_GATEWAY_HOSTS`, derived from the
731
- * generated `ClientOptions['baseUrl']`); `/api/widget-gateway/*` paths (the
732
- * init round-trip) always pass through untouched.
733
- *
734
- * - `undefined` — decide from the request origin, as above. Inherits from
735
- * the nearest ancestor or global store like every other config field.
736
- * - `true` — always apply the rewrite, even for an unlisted base URL (e.g. a
737
- * custom domain in front of the gateway).
738
- * - `false` — never apply it. For hosts that route widget requests their own
739
- * way, such as a same-origin BFF whose `configClient` retargets every
740
- * request.
741
- *
742
- * Independent of {@link configClient}: a host that only adds a header keeps
743
- * the built-in routing, and the built-in interceptor runs before any
744
- * `configClient` interceptor.
745
- */
746
- gatewayRouting?: boolean;
747
- /**
748
- * Component the embedded widgets should render in place of plain `<a>` tags.
749
- *
750
- * Pass e.g. Next.js's `Link` to make in-app navigation use the host router.
751
- * Cascades like other config: provider prop > nearest ancestor > global store.
752
- * When no value is set anywhere, widgets fall back to a plain `<a>` element.
753
- */
754
- linkComponent?: LinkComponent;
755
- /**
756
- * Which UI framework the widget UI layer should render with.
757
- *
758
- * Lets a consuming context bind widgets to either the shadcn/Tailwind or the
759
- * Tecton implementation behind the same outward-facing API. The selection is
760
- * a presentation concern only — it cascades through the provider tree exactly
761
- * like {@link linkComponent} and is read by UI libraries via `useUIFramework`;
762
- * it never appears in any widget's feature-library or component props.
763
- *
764
- * - `'shadcn'` — the shadcn/Tailwind implementation.
765
- * - `'tecton'` — the Tecton implementation.
766
- * - `null` / `undefined` — not set at this level; inherit from the nearest
767
- * ancestor or global store, falling back to `shadcn` when unset everywhere.
768
- * `shadcn` is the implicit default, so existing consumers need no changes.
769
- */
770
- uiFramework?: UIFramework | null;
771
- /**
772
- * Which implementation a widget renders with.
773
- *
774
- * Lets a consuming context bind widgets to either the Tesouro-native or the
775
- * Monite SDK implementation behind the same outward-facing API. It cascades
776
- * through the provider tree exactly like {@link linkComponent} and
777
- * {@link uiFramework} — provider prop > nearest ancestor > global store — and
778
- * is read via `useImplementation`.
779
- *
780
- * - `'native'` — the Tesouro-native implementation.
781
- * - `'monite'` — the Monite SDK implementation.
782
- * - `null` / `undefined` — not set at this level; inherit from the nearest
783
- * ancestor or global store, falling back to `native` when unset everywhere.
784
- * `native` is the implicit default, so existing consumers need no changes.
785
- */
786
- implementation?: Implementation | null;
787
- }
788
- /**
789
- * Props shared by every analytics-owner-capable widget provider.
790
- *
791
- * Combines the full settable cascade ({@link WidgetConfigInput}) with the
792
- * analytics opt-out honored by analytics owners. Both {@link RootWidgetProvider}
793
- * and {@link WidgetProvider} build their public props on top of this; the latter
794
- * adds error-boundary props of its own.
795
- *
796
- * @see {@link WidgetConfigInput} for per-field cascade and `null` vs omitted semantics
797
- */
798
- interface WidgetProviderBaseProps extends WidgetConfigInput {
799
- /**
800
- * Opt out of all analytics capture and prevent PostHog from loading. Default `true`.
801
- *
802
- * Honored only by an analytics **owner** — a {@link RootWidgetProvider} or a
803
- * standalone {@link WidgetProvider} with no parent provider. When `false`,
804
- * owner-bound `track` calls in this subtree become no-ops and the PostHog
805
- * installer is never dynamically imported for this owner's environment.
806
- * Setting it on a nested {@link WidgetProvider} is ignored in v1 (a one-time
807
- * `console.warn` is emitted to make the no-op discoverable).
808
- */
809
- analytics?: boolean;
810
- }
811
-
812
- /**
813
- * Copy for the states `WidgetProvider` renders *itself*, in place of the widget:
814
- * the error-boundary fallback and the disclosures gate. A host overrides any
815
- * subset through the `providerLabels` prop, which cascades like
816
- * `disclosuresAcceptance`.
817
- *
818
- * Not named `Labels` on the public surface: a widget's own `labels` prop is a
819
- * different thing, and these two travel together on every widget's props type.
820
- */
821
- interface WidgetProviderLabels {
822
- /** Default copy for the built-in error boundary fallback. */
823
- errorBoundaryFallback: string;
824
- /** Heading when init reports disclosures are required and not yet accepted. */
825
- disclosuresRequiredTitle: string;
826
- /** Heading while a token-only refresh leaves init stale for the live token. */
827
- disclosuresRefreshingTitle: string;
828
- /** Supporting copy while the accept action is withheld for a stale init. */
829
- disclosuresRefreshingDescription: string;
830
- }
831
-
832
- /**
833
- * Props for {@link WidgetProvider}.
834
- *
835
- * All fields are optional. When **all** are omitted the provider is a transparent
836
- * pass-through: no fetch is issued and all resolved values cascade unchanged from
837
- * the nearest ancestor.
838
- */
839
- interface WidgetProviderProps extends WidgetProviderBaseProps {
840
- /**
841
- * Fallback rendered when a render-time exception is caught inside this
842
- * provider's subtree. Pass either a `ReactNode` (rendered directly) or a
843
- * render-prop receiving `{ error, resetErrorBoundary }` from
844
- * `react-error-boundary`. Default is a plain `role="alert"` div whose copy
845
- * comes from `providerLabels.errorBoundaryFallback`.
846
- */
847
- errorFallback?: ReactNode | ((props: FallbackProps) => ReactNode);
848
- /**
849
- * Called once when the boundary catches an error, before the fallback
850
- * renders. Use for telemetry / Sentry / partner logging. Exceptions
851
- * thrown from `onError` propagate per `react-error-boundary` semantics.
852
- */
853
- onError?: (error: unknown, info: ErrorInfo) => void;
854
- /**
855
- * Accept surface shown when the caller owes disclosures — an INVITED
856
- * teammate (including `NOT_REQUIRED` orgs, who still need Accept to
857
- * activate) or an ACTIVE user who owes a new version. Pass
858
- * `<AcceptDisclosuresWidget />`. Cascades like `linkComponent`.
859
- * WidgetProvider cannot import the widget itself (cycle).
860
- */
861
- disclosuresAcceptance?: ReactNode;
862
- /**
863
- * Overrides for the copy this provider renders in place of the widget: the
864
- * built-in error-boundary fallback and the disclosures gate. Any subset;
865
- * unlisted keys keep their defaults. Cascades like `linkComponent`.
866
- *
867
- * Named `providerLabels` rather than `labels` because a widget's own
868
- * `labels` prop sits alongside this one on the same props type.
869
- */
870
- providerLabels?: Partial<WidgetProviderLabels>;
871
- }
872
-
873
- /**
874
- * Feature-layer copy for the widget's built-in create/edit/delete flow.
875
- *
876
- * The table, form sheet, and delete dialog each carry their own label sets in
877
- * the `ui` library; these are only the strings the orchestration produces
878
- * itself, which is validation messages, API failure fallbacks, and the
879
- * confirmation toasts. Consumers override them through the widget's
880
- * `messageLabels` prop, merged over {@link CHART_OF_ACCOUNTS_MESSAGE_LABELS_EN}.
881
- */
882
- interface ChartOfAccountsMessageLabels {
883
- nameRequired: string;
884
- glCodeRequired: string;
885
- /** `{max}` is replaced with the field's character limit. */
886
- nameTooLong: string;
887
- /** `{max}` is replaced with the field's character limit. */
888
- glCodeTooLong: string;
889
- /** `{max}` is replaced with the field's character limit. */
890
- descriptionTooLong: string;
891
- saveError: string;
892
- deleteError: string;
893
- /** `{name}` is replaced with the account's name. */
894
- accountCreated: string;
895
- /** `{name}` is replaced with the account's name. */
896
- accountUpdated: string;
897
- /** `{name}` is replaced with the account's name. */
898
- accountDeleted: string;
899
- }
900
- declare const CHART_OF_ACCOUNTS_MESSAGE_LABELS_EN: ChartOfAccountsMessageLabels;
901
-
902
- /**
903
- * Props that the feature layer owns and wires internally. Consumers cannot
904
- * override these because they are driven by the query and pagination state.
905
- * Everything else on `ChartOfAccountsTableProps` (including `title`) passes through
906
- * this `Omit` untouched via the `...tableProps` spread below, so no explicit
907
- * feature-layer wiring needed when a new pass-through UI prop is added there.
908
- */
909
- type TableProps = Omit<ChartOfAccountsTableProps, 'data' | 'isLoading' | 'isError' | 'sorting' | 'onSortingChange' | 'pageSize' | 'onPageSizeChange' | 'pageSizeOptions' | 'hasNextPage' | 'hasPrevPage' | 'onNextPage' | 'onPrevPage' | 'emptyStateTestId' | 'labels'>;
910
- /**
911
- * Label override channels, one per surface the widget mounts.
912
- *
913
- * The widget renders more than the table, so a single `labels` prop would leave
914
- * the built-in create/edit/delete flow stuck on English while the table around
915
- * it localized. Split per surface rather than nested under one object, which is
916
- * the shape `tags-widget`, `products-widget`, and `counterparts-widget` all use.
917
- */
918
- interface ChartOfAccountsWidgetLabelProps {
919
- /** Table copy: headings, column headers, row actions, empty and error states. */
920
- screenLabels?: Partial<ChartOfAccountsLabels>;
921
- /** Create/edit sheet copy: titles, field labels, placeholders, buttons. */
922
- formLabels?: Partial<AccountFormSheetLabels>;
923
- /** Delete confirmation copy. */
924
- deleteLabels?: Partial<AccountDeleteDialogLabels>;
925
- /** Validation messages, save/delete failure fallbacks, and success toasts. */
926
- messageLabels?: Partial<ChartOfAccountsMessageLabels>;
927
- }
928
- /**
929
- * Public props for {@link ChartOfAccountsWidget}.
930
- *
931
- * Merges {@link WidgetProviderProps} (auth/base-URL scope) with the subset of
932
- * {@link ChartOfAccountsTableProps} that consumers are allowed to control (row
933
- * action callbacks, empty-state CTAs, etc.) plus a label channel per surface.
934
- */
935
- type ChartOfAccountsWidgetProps = WidgetProviderProps & TableProps & ChartOfAccountsWidgetLabelProps;
936
- /**
937
- * Self-contained GL code table widget.
938
- *
939
- * Composes a {@link WidgetProvider} scope with the table's query and pagination
940
- * logic. The two-component split (`ChartOfAccountsWidget` → `ChartOfAccountsWidgetInner`)
941
- * ensures that `useGetLedgerAccountsQuery` runs *inside* the provider tree and
942
- * can therefore resolve the correct API base URL and auth token from context.
943
- *
944
- * @example
945
- * ```tsx
946
- * <ChartOfAccountsWidget
947
- * baseUrl="https://api.example.com"
948
- * widgetToken="wt_..."
949
- * organizationId="org_..."
950
- * onEdit={(row) => openEditDialog(row)}
951
- * onDelete={(row) => confirmDelete(row)}
952
- * />
953
- * ```
954
- */
955
- declare function ChartOfAccountsWidget({ baseUrl, widgetToken, organizationId, configClient, gatewayRouting, linkComponent, implementation, uiFramework, analytics, disclosuresAcceptance, providerLabels, errorFallback, onError, ...tableProps }: ChartOfAccountsWidgetProps): React.JSX.Element;
956
-
957
- export { ACCOUNT_DELETE_DIALOG_LABELS_EN, ACCOUNT_FORM_SHEET_LABELS_EN, AccountDeleteDialog, AccountFormSheet, CHART_OF_ACCOUNTS_LABELS_EN, CHART_OF_ACCOUNTS_MESSAGE_LABELS_EN, ChartOfAccountsTable, ChartOfAccountsWidget };
958
- export type { AccountDeleteDialogLabels, AccountDeleteDialogProps, AccountFormErrors, AccountFormMode, AccountFormSheetLabels, AccountFormSheetProps, AccountFormValues, ChartOfAccountsLabels, ChartOfAccountsMessageLabels, ChartOfAccountsTableProps, ChartOfAccountsWidgetLabelProps, ChartOfAccountsWidgetProps, LedgerAccountRow };