@uipath/du-validation-station-wc 1.0.0-beta.2 → 1.0.0-beta.3

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/types.d.ts CHANGED
@@ -1,401 +1,401 @@
1
- /**
2
- * Public TypeScript types for `@uipath/du-validation-station-wc`.
3
- *
4
- * Covers the **standalone** variants of the validation-station web
5
- * component:
6
- * <ui-du-validation-station-standalone-wc-element>
7
- * <ui-du-validation-station-standalone-wc-persistent-element>
8
- *
9
- * The standalone variant does not make any HTTP calls. The consumer
10
- * provides all document data as JS properties and handles the
11
- * `saveValidatedDataRequest` / `saveValidatedDataAsDraftRequest` /
12
- * `saveExceptionReportRequest` events to wire up persistence against
13
- * their own backend.
14
- */
15
-
16
- // ─── Field-value details ──────────────────────────────────────────────────────
17
-
18
- /**
19
- * Details of the selected field and value, emitted in `fieldValueSelected`
20
- * and `fieldValueChanged` events.
21
- *
22
- * `Field` and `FieldValue` carry the underlying DTO shapes from the
23
- * UiPath Document Understanding domain. Cast as needed.
24
- */
25
- export interface IFieldValueDetailsDto {
26
- /** Type: IExtractedDataPointDTO */
27
- Field: unknown;
28
- FieldValueIndex: number;
29
- /** Type: IExtractedValueDTO */
30
- FieldValue?: unknown;
31
- }
32
-
33
- // ─── Business-rule evaluation ─────────────────────────────────────────────────
34
-
35
- export type CriticalityDTO = 'Must' | 'Should';
36
- export type LogicalOperatorDTO = 'OR' | 'AND';
37
-
38
- /**
39
- * The evaluated result of a rule set for a value with given Index in Field.
40
- * Index is -1 if Field has no extracted value.
41
- */
42
- export interface EvaluatedBusinessRulesForFieldValueDto {
43
- FieldId: string;
44
- ParentFieldId?: string;
45
- FieldName: string;
46
- /**
47
- * The index of the value when a field is multi-value; the row index
48
- * when the field is a table; -1 for rules defined on fields without a
49
- * value.
50
- */
51
- Index: number;
52
- IsValid: boolean;
53
- Criticality: CriticalityDTO;
54
- LogicalOperator: LogicalOperatorDTO;
55
- Rules: EvaluatedBusinessRuleDetailsDto[];
56
- }
57
-
58
- export interface EvaluatedBusinessRuleDetailsDto {
59
- RuleName: string;
60
- RuleMessage: string;
61
- IsValid: boolean;
62
- }
63
-
64
- // ─── Configuration inputs ─────────────────────────────────────────────────────
65
-
66
- export interface IValidationStationOptions {
67
- hideSubmitButton?: boolean;
68
- hideReportAsExceptionButton?: boolean;
69
- hideDocumentTypeField?: boolean;
70
- hideFields?: boolean;
71
- /** @default 'left' */
72
- fieldsSectionPosition?: 'left' | 'right';
73
- /** @default true */
74
- enableUserPreferences?: boolean;
75
- userPreferencesKeySuffix?: string;
76
- /**
77
- * If true, `extractionResultChanged` will emit on every internal state
78
- * change (mapped to IExtractionResultDTO).
79
- */
80
- emitDtoStateChanges?: boolean;
81
- }
82
-
83
- // ─── Path-based inputs ────────────────────────────────────────────────────────
84
-
85
- export interface ExtractedPathSegment {
86
- fieldName: string;
87
- valueIndex: number;
88
- }
89
-
90
- export interface FieldValueUpdate {
91
- Value: string;
92
- DeleteReference: boolean;
93
- Confidence: number;
94
- OperatorConfirmed: boolean;
95
- }
96
-
97
- export interface SetFieldValueByPath {
98
- path: ExtractedPathSegment[];
99
- update: Partial<FieldValueUpdate>;
100
- }
101
-
102
- export interface SelectAndFocusFieldValueByPath {
103
- path: ExtractedPathSegment[];
104
- }
105
-
106
- export interface DeleteFieldValueByPath {
107
- path: ExtractedPathSegment[];
108
- }
109
-
110
- // ─── Action-result outputs ────────────────────────────────────────────────────
111
-
112
- export interface IVsWcActionResultOutput {
113
- success: boolean;
114
- error?: string;
115
- }
116
-
117
- export type ISaveResult = IVsWcActionResultOutput;
118
- export type SetFieldValueByPathResult = IVsWcActionResultOutput;
119
- export type SelectAndFocusFieldValueByPathResult = IVsWcActionResultOutput;
120
- export type DeleteFieldValueByPathResult = IVsWcActionResultOutput;
121
-
122
- // ─── Standalone save-request payloads ─────────────────────────────────────────
123
-
124
- /**
125
- * Payload of the `saveValidatedDataRequest` event.
126
- *
127
- * `validatedData`, `automaticExtractionResult`, and `taxonomy` carry
128
- * UiPath Document Understanding DTOs (IExtractionResultDTO /
129
- * ITemplateManagerDataDTO / ITaxonomyDTO). Cast as needed when
130
- * forwarding to your backend.
131
- */
132
- export interface IVsSaveValidatedDataRequest {
133
- documentId: string;
134
- /** The extraction result after user edits. Type: IExtractionResultDTO | ITemplateManagerDataDTO */
135
- validatedData: unknown;
136
- /** The automatic (pre-edit) extraction result. Type: IExtractionResultDTO | ITemplateManagerDataDTO | null */
137
- automaticExtractionResult: unknown | null;
138
- /** The taxonomy for this document. Type: ITaxonomyDTO | null */
139
- taxonomy: unknown | null;
140
- }
141
-
142
- /** Payload of the `saveValidatedDataAsDraftRequest` event. */
143
- export interface IVsSaveValidatedDataAsDraftRequest {
144
- documentId: string;
145
- /** Type: IExtractionResultDTO | ITemplateManagerDataDTO */
146
- validatedData: unknown;
147
- }
148
-
149
- /**
150
- * Payload of the `saveExceptionReportRequest` event.
151
- *
152
- * `exceptionReport` carries the IReportAsExceptionDTO shape; cast when
153
- * forwarding to your backend.
154
- */
155
- export interface IVsSaveExceptionReportRequest {
156
- documentId: string;
157
- /** Type: IReportAsExceptionDTO */
158
- exceptionReport: unknown;
159
- }
160
-
161
- // ─── Event maps ───────────────────────────────────────────────────────────────
162
-
163
- /**
164
- * Events emitted by the standalone validation-station web component
165
- * that are also shared with the (internal) standard variant.
166
- */
167
- export interface IVsWcSharedEventMap {
168
- /** Fires once when the component has finished loading. */
169
- loaded: boolean;
170
- /** Fires when the user has unsaved changes (true) or the state is clean (false). */
171
- dirty: boolean;
172
- /** Fires when the user changes the document type. Detail is the new document type ID. */
173
- documentTypeChanged: string;
174
- /** Fires on every extraction result change when `IValidationStationOptions.emitDtoStateChanges` is true. detail: IExtractionResultDTO */
175
- extractionResultChanged: unknown;
176
- /** Fires when the user selects a field value. */
177
- fieldValueSelected: IFieldValueDetailsDto;
178
- /** Fires when the user edits a field value. */
179
- fieldValueChanged: IFieldValueDetailsDto;
180
- /** Fires after business rules are evaluated. */
181
- businessRulesEvaluated: EvaluatedBusinessRulesForFieldValueDto[];
182
- /** Fires when the fields panel width changes. Detail is the width in pixels. */
183
- fieldsPanelWidthChanged: number;
184
- /** Fires when the fields panel moves to the other side of the document viewer. */
185
- fieldsPanelSideChanged: 'left' | 'right';
186
- /** Result of the `setFieldValueByPath` command. */
187
- setFieldValueByPathResult: SetFieldValueByPathResult;
188
- /** Result of the `selectAndFocusFieldValueByPath` command. */
189
- selectAndFocusFieldValueByPathResult: SelectAndFocusFieldValueByPathResult;
190
- /** Result of the `deleteFieldValueByPath` command. */
191
- deleteFieldValueByPathResult: DeleteFieldValueByPathResult;
192
- }
193
-
194
- /**
195
- * Maps every custom-event name emitted by the standalone validation-station
196
- * web component to the type carried in CustomEvent.detail.
197
- *
198
- * The standalone variant emits API command events instead of making HTTP calls.
199
- */
200
- export interface IValidationStationStandaloneWcEventMap extends IVsWcSharedEventMap {
201
- /** Emitted when the user saves. Handle this to call the ProcessExtractedData API. */
202
- saveValidatedDataRequest: IVsSaveValidatedDataRequest;
203
- /** Emitted when the user saves as draft. */
204
- saveValidatedDataAsDraftRequest: IVsSaveValidatedDataAsDraftRequest;
205
- /** Emitted when the user reports an exception. */
206
- saveExceptionReportRequest: IVsSaveExceptionReportRequest;
207
- }
208
-
209
- // ─── Element interfaces ───────────────────────────────────────────────────────
210
-
211
- /**
212
- * Internal base for the standalone VS element interface.
213
- * @internal Consumers should use IValidationStationStandaloneWcElement directly.
214
- */
215
- export interface IVsWcBaseElement<TEventMap> extends HTMLElement {
216
- // ── Configuration inputs ──────────────────────────────────────────────────
217
-
218
- /** Visual theme applied to the component. @default 'light' */
219
- theme: 'light' | 'dark' | 'light-hc' | 'dark-hc';
220
- /** BCP-47 language code for the UI. @default 'en' */
221
- language: string;
222
- /** When true, the component renders in read-only mode. @default false */
223
- isReadonly: boolean;
224
- /** When true, a "Save as draft" action is available. @default false */
225
- enableSaveAsDraft: boolean;
226
- /** Fine-grained UI feature flags. */
227
- options: IValidationStationOptions;
228
-
229
- // ── Command inputs ────────────────────────────────────────────────────────
230
- //
231
- // Assigning a new object reference triggers the action.
232
-
233
- /** Trigger a save operation. Set { validate: true } to validate before saving. */
234
- save: { validate: boolean } | undefined;
235
- /** Trigger a discard-changes operation. Assign { value: true } to confirm. */
236
- discardChanges: { value: boolean } | undefined;
237
- /** Set field values by path. Listen to `setFieldValueByPathResult` for outcomes. */
238
- setFieldValueByPath: SetFieldValueByPath | undefined;
239
- /**
240
- * Select the field in the extraction panel by path; if the value has a
241
- * document reference, focus it in the PDF viewer. Listen to
242
- * `selectAndFocusFieldValueByPathResult` for the outcome.
243
- */
244
- selectAndFocusFieldValueByPath: SelectAndFocusFieldValueByPath | undefined;
245
- /** Delete a field value by path. Listen to `deleteFieldValueByPathResult` for outcomes. */
246
- deleteFieldValueByPath: DeleteFieldValueByPath | undefined;
247
-
248
- // ── Typed event listeners ─────────────────────────────────────────────────
249
-
250
- addEventListener<K extends keyof TEventMap>(
251
- type: K,
252
- listener: (event: CustomEvent<TEventMap[K]>) => void,
253
- options?: boolean | AddEventListenerOptions,
254
- ): void;
255
- addEventListener(
256
- type: string,
257
- listener: EventListenerOrEventListenerObject,
258
- options?: boolean | AddEventListenerOptions,
259
- ): void;
260
-
261
- removeEventListener<K extends keyof TEventMap>(
262
- type: K,
263
- listener: (event: CustomEvent<TEventMap[K]>) => void,
264
- options?: boolean | EventListenerOptions,
265
- ): void;
266
- removeEventListener(
267
- type: string,
268
- listener: EventListenerOrEventListenerObject,
269
- options?: boolean | EventListenerOptions,
270
- ): void;
271
- }
272
-
273
- /**
274
- * Strongly-typed interface for `<ui-du-validation-station-standalone-wc-element>`.
275
- *
276
- * The standalone variant does not make HTTP calls. The consumer provides
277
- * document data as JS properties and handles API commands by listening
278
- * to `saveValidatedDataRequest` / `saveValidatedDataAsDraftRequest` /
279
- * `saveExceptionReportRequest`.
280
- */
281
- export interface IValidationStationStandaloneWcElement extends IVsWcBaseElement<IValidationStationStandaloneWcEventMap> {
282
- // ── Setup inputs ──────────────────────────────────────────────────────────
283
-
284
- /** Document identifier. Required before any data inputs are set. */
285
- documentId: string | undefined;
286
-
287
- // ── Data inputs (replace the HTTP fetches of the non-standalone variant) ──
288
-
289
- /** Taxonomy for this document. Type: ITaxonomyDTO */
290
- taxonomy: unknown;
291
- /** Initial extraction results. Type: IExtractionResultDTO */
292
- extractionResult: unknown;
293
- /** Document object model. Type: DocumentDTO */
294
- dom: unknown;
295
- /** Plain text content of the document. */
296
- text: string | undefined;
297
- /** Customization configuration. Type: ICustomizationInfoDTO */
298
- customizationInfo: unknown;
299
- /** Original document as a base64 data URL. */
300
- original: string | undefined;
301
- }
302
-
303
- /**
304
- * Extends `IValidationStationStandaloneWcElement` with an explicit teardown method.
305
- *
306
- * The persistent element suppresses `disconnectedCallback()` to survive
307
- * portal detachments (e.g. tab switches). Call `forceDestroy()` when the
308
- * element is being permanently removed (`ngOnDestroy` / `useEffect`
309
- * cleanup / `componentWillUnmount`).
310
- */
311
- export interface IPersistentValidationStationStandaloneWcElement extends IValidationStationStandaloneWcElement {
312
- /**
313
- * Explicitly tears down the inner Angular component.
314
- * Must be called when the element is being permanently removed.
315
- */
316
- forceDestroy(): void;
317
- }
318
-
319
- // ─── Shared JSX props ─────────────────────────────────────────────────────────
320
-
321
- /**
322
- * JSX props shared by the standalone VS element variants. Covers
323
- * configuration inputs, command inputs, and common HTML attributes.
324
- */
325
- export interface IVsWcSharedJsxProps {
326
- // ── Scalar configuration inputs ───────────────────────────────────────────
327
- theme?: 'light' | 'dark' | 'light-hc' | 'dark-hc';
328
- language?: string;
329
- /** JS property form. */
330
- isReadonly?: boolean;
331
- /** Attribute form (kebab-case). Coerced via Angular's `booleanAttribute` transform. */
332
- 'is-readonly'?: boolean;
333
- /** JS property form. */
334
- enableSaveAsDraft?: boolean;
335
- /** Attribute form (kebab-case). Coerced via Angular's `booleanAttribute` transform. */
336
- 'enable-save-as-draft'?: boolean;
337
- // ── Complex configuration + command inputs ────────────────────────────────
338
- options?: IValidationStationOptions;
339
- save?: { validate: boolean };
340
- discardChanges?: { value: boolean };
341
- setFieldValueByPath?: SetFieldValueByPath;
342
- selectAndFocusFieldValueByPath?: SelectAndFocusFieldValueByPath;
343
- deleteFieldValueByPath?: DeleteFieldValueByPath;
344
- // ── Common HTML attributes ────────────────────────────────────────────────
345
- id?: string;
346
- className?: string;
347
- class?: string;
348
- style?: string | Record<string, string | number>;
349
- title?: string;
350
- role?: string;
351
- tabIndex?: number;
352
- part?: string;
353
- slot?: string;
354
- draggable?: boolean;
355
- hidden?: boolean;
356
- // Allow arbitrary data-* / aria-* attributes while preserving strong typing
357
- [dataAttr: `data-${string}`]: string | number | boolean | null | undefined;
358
- [ariaAttr: `aria-${string}`]: string | number | boolean | null | undefined;
359
- }
360
-
361
- /**
362
- * Props for `<ui-du-validation-station-standalone-wc-element>` in React JSX.
363
- *
364
- * React 18 — complex object inputs (`taxonomy`, `extractionResult`, `dom`,
365
- * `customizationInfo`, and all command payloads) must be set via a `ref`
366
- * as JS properties; React 18 serialises JSX props to HTML attributes and
367
- * Angular Elements cannot deserialise object JSON.
368
- *
369
- * React 19 — supports passing complex object props directly as JSX
370
- * attributes. Refs become unnecessary for static data.
371
- */
372
- export interface IValidationStationStandaloneWcJsxProps extends IVsWcSharedJsxProps {
373
- documentId?: string;
374
- text?: string;
375
- original?: string;
376
- taxonomy?: unknown;
377
- extractionResult?: unknown;
378
- dom?: unknown;
379
- customizationInfo?: unknown;
380
- }
381
-
382
- /** Props for `<ui-du-validation-station-standalone-wc-persistent-element>` in React JSX. */
383
- export type IPersistentValidationStationStandaloneWcJsxProps = IValidationStationStandaloneWcJsxProps;
384
-
385
- // ─── Global type augmentations ────────────────────────────────────────────────
386
-
387
- declare global {
388
- interface HTMLElementTagNameMap {
389
- 'ui-du-validation-station-standalone-wc-element': IValidationStationStandaloneWcElement;
390
- 'ui-du-validation-station-standalone-wc-persistent-element': IPersistentValidationStationStandaloneWcElement;
391
- }
392
-
393
- namespace React {
394
- namespace JSX {
395
- interface IntrinsicElements {
396
- 'ui-du-validation-station-standalone-wc-element': IValidationStationStandaloneWcJsxProps;
397
- 'ui-du-validation-station-standalone-wc-persistent-element': IPersistentValidationStationStandaloneWcJsxProps;
398
- }
399
- }
400
- }
401
- }
1
+ /**
2
+ * Public TypeScript types for `@uipath/du-validation-station-wc`.
3
+ *
4
+ * Covers the **standalone** variants of the validation-station web
5
+ * component:
6
+ * <ui-du-validation-station-standalone-wc-element>
7
+ * <ui-du-validation-station-standalone-wc-persistent-element>
8
+ *
9
+ * The standalone variant does not make any HTTP calls. The consumer
10
+ * provides all document data as JS properties and handles the
11
+ * `saveValidatedDataRequest` / `saveValidatedDataAsDraftRequest` /
12
+ * `saveExceptionReportRequest` events to wire up persistence against
13
+ * their own backend.
14
+ */
15
+
16
+ // ─── Field-value details ──────────────────────────────────────────────────────
17
+
18
+ /**
19
+ * Details of the selected field and value, emitted in `fieldValueSelected`
20
+ * and `fieldValueChanged` events.
21
+ *
22
+ * `Field` and `FieldValue` carry the underlying DTO shapes from the
23
+ * UiPath Document Understanding domain. Cast as needed.
24
+ */
25
+ export interface IFieldValueDetailsDto {
26
+ /** Type: IExtractedDataPointDTO */
27
+ Field: unknown;
28
+ FieldValueIndex: number;
29
+ /** Type: IExtractedValueDTO */
30
+ FieldValue?: unknown;
31
+ }
32
+
33
+ // ─── Business-rule evaluation ─────────────────────────────────────────────────
34
+
35
+ export type CriticalityDTO = 'Must' | 'Should';
36
+ export type LogicalOperatorDTO = 'OR' | 'AND';
37
+
38
+ /**
39
+ * The evaluated result of a rule set for a value with given Index in Field.
40
+ * Index is -1 if Field has no extracted value.
41
+ */
42
+ export interface EvaluatedBusinessRulesForFieldValueDto {
43
+ FieldId: string;
44
+ ParentFieldId?: string;
45
+ FieldName: string;
46
+ /**
47
+ * The index of the value when a field is multi-value; the row index
48
+ * when the field is a table; -1 for rules defined on fields without a
49
+ * value.
50
+ */
51
+ Index: number;
52
+ IsValid: boolean;
53
+ Criticality: CriticalityDTO;
54
+ LogicalOperator: LogicalOperatorDTO;
55
+ Rules: EvaluatedBusinessRuleDetailsDto[];
56
+ }
57
+
58
+ export interface EvaluatedBusinessRuleDetailsDto {
59
+ RuleName: string;
60
+ RuleMessage: string;
61
+ IsValid: boolean;
62
+ }
63
+
64
+ // ─── Configuration inputs ─────────────────────────────────────────────────────
65
+
66
+ export interface IValidationStationOptions {
67
+ hideSubmitButton?: boolean;
68
+ hideReportAsExceptionButton?: boolean;
69
+ hideDocumentTypeField?: boolean;
70
+ hideFields?: boolean;
71
+ /** @default 'left' */
72
+ fieldsSectionPosition?: 'left' | 'right';
73
+ /** @default true */
74
+ enableUserPreferences?: boolean;
75
+ userPreferencesKeySuffix?: string;
76
+ /**
77
+ * If true, `extractionResultChanged` will emit on every internal state
78
+ * change (mapped to IExtractionResultDTO).
79
+ */
80
+ emitDtoStateChanges?: boolean;
81
+ }
82
+
83
+ // ─── Path-based inputs ────────────────────────────────────────────────────────
84
+
85
+ export interface ExtractedPathSegment {
86
+ fieldName: string;
87
+ valueIndex: number;
88
+ }
89
+
90
+ export interface FieldValueUpdate {
91
+ Value: string;
92
+ DeleteReference: boolean;
93
+ Confidence: number;
94
+ OperatorConfirmed: boolean;
95
+ }
96
+
97
+ export interface SetFieldValueByPath {
98
+ path: ExtractedPathSegment[];
99
+ update: Partial<FieldValueUpdate>;
100
+ }
101
+
102
+ export interface SelectAndFocusFieldValueByPath {
103
+ path: ExtractedPathSegment[];
104
+ }
105
+
106
+ export interface DeleteFieldValueByPath {
107
+ path: ExtractedPathSegment[];
108
+ }
109
+
110
+ // ─── Action-result outputs ────────────────────────────────────────────────────
111
+
112
+ export interface IVsWcActionResultOutput {
113
+ success: boolean;
114
+ error?: string;
115
+ }
116
+
117
+ export type ISaveResult = IVsWcActionResultOutput;
118
+ export type SetFieldValueByPathResult = IVsWcActionResultOutput;
119
+ export type SelectAndFocusFieldValueByPathResult = IVsWcActionResultOutput;
120
+ export type DeleteFieldValueByPathResult = IVsWcActionResultOutput;
121
+
122
+ // ─── Standalone save-request payloads ─────────────────────────────────────────
123
+
124
+ /**
125
+ * Payload of the `saveValidatedDataRequest` event.
126
+ *
127
+ * `validatedData`, `automaticExtractionResult`, and `taxonomy` carry
128
+ * UiPath Document Understanding DTOs (IExtractionResultDTO /
129
+ * ITemplateManagerDataDTO / ITaxonomyDTO). Cast as needed when
130
+ * forwarding to your backend.
131
+ */
132
+ export interface IVsSaveValidatedDataRequest {
133
+ documentId: string;
134
+ /** The extraction result after user edits. Type: IExtractionResultDTO | ITemplateManagerDataDTO */
135
+ validatedData: unknown;
136
+ /** The automatic (pre-edit) extraction result. Type: IExtractionResultDTO | ITemplateManagerDataDTO | null */
137
+ automaticExtractionResult: unknown | null;
138
+ /** The taxonomy for this document. Type: ITaxonomyDTO | null */
139
+ taxonomy: unknown | null;
140
+ }
141
+
142
+ /** Payload of the `saveValidatedDataAsDraftRequest` event. */
143
+ export interface IVsSaveValidatedDataAsDraftRequest {
144
+ documentId: string;
145
+ /** Type: IExtractionResultDTO | ITemplateManagerDataDTO */
146
+ validatedData: unknown;
147
+ }
148
+
149
+ /**
150
+ * Payload of the `saveExceptionReportRequest` event.
151
+ *
152
+ * `exceptionReport` carries the IReportAsExceptionDTO shape; cast when
153
+ * forwarding to your backend.
154
+ */
155
+ export interface IVsSaveExceptionReportRequest {
156
+ documentId: string;
157
+ /** Type: IReportAsExceptionDTO */
158
+ exceptionReport: unknown;
159
+ }
160
+
161
+ // ─── Event maps ───────────────────────────────────────────────────────────────
162
+
163
+ /**
164
+ * Events emitted by the standalone validation-station web component
165
+ * that are also shared with the (internal) standard variant.
166
+ */
167
+ export interface IVsWcSharedEventMap {
168
+ /** Fires once when the component has finished loading. */
169
+ loaded: boolean;
170
+ /** Fires when the user has unsaved changes (true) or the state is clean (false). */
171
+ dirty: boolean;
172
+ /** Fires when the user changes the document type. Detail is the new document type ID. */
173
+ documentTypeChanged: string;
174
+ /** Fires on every extraction result change when `IValidationStationOptions.emitDtoStateChanges` is true. detail: IExtractionResultDTO */
175
+ extractionResultChanged: unknown;
176
+ /** Fires when the user selects a field value. */
177
+ fieldValueSelected: IFieldValueDetailsDto;
178
+ /** Fires when the user edits a field value. */
179
+ fieldValueChanged: IFieldValueDetailsDto;
180
+ /** Fires after business rules are evaluated. */
181
+ businessRulesEvaluated: EvaluatedBusinessRulesForFieldValueDto[];
182
+ /** Fires when the fields panel width changes. Detail is the width in pixels. */
183
+ fieldsPanelWidthChanged: number;
184
+ /** Fires when the fields panel moves to the other side of the document viewer. */
185
+ fieldsPanelSideChanged: 'left' | 'right';
186
+ /** Result of the `setFieldValueByPath` command. */
187
+ setFieldValueByPathResult: SetFieldValueByPathResult;
188
+ /** Result of the `selectAndFocusFieldValueByPath` command. */
189
+ selectAndFocusFieldValueByPathResult: SelectAndFocusFieldValueByPathResult;
190
+ /** Result of the `deleteFieldValueByPath` command. */
191
+ deleteFieldValueByPathResult: DeleteFieldValueByPathResult;
192
+ }
193
+
194
+ /**
195
+ * Maps every custom-event name emitted by the standalone validation-station
196
+ * web component to the type carried in CustomEvent.detail.
197
+ *
198
+ * The standalone variant emits API command events instead of making HTTP calls.
199
+ */
200
+ export interface IValidationStationStandaloneWcEventMap extends IVsWcSharedEventMap {
201
+ /** Emitted when the user saves. Handle this to call the ProcessExtractedData API. */
202
+ saveValidatedDataRequest: IVsSaveValidatedDataRequest;
203
+ /** Emitted when the user saves as draft. */
204
+ saveValidatedDataAsDraftRequest: IVsSaveValidatedDataAsDraftRequest;
205
+ /** Emitted when the user reports an exception. */
206
+ saveExceptionReportRequest: IVsSaveExceptionReportRequest;
207
+ }
208
+
209
+ // ─── Element interfaces ───────────────────────────────────────────────────────
210
+
211
+ /**
212
+ * Internal base for the standalone VS element interface.
213
+ * @internal Consumers should use IValidationStationStandaloneWcElement directly.
214
+ */
215
+ export interface IVsWcBaseElement<TEventMap> extends HTMLElement {
216
+ // ── Configuration inputs ──────────────────────────────────────────────────
217
+
218
+ /** Visual theme applied to the component. @default 'light' */
219
+ theme: 'light' | 'dark' | 'light-hc' | 'dark-hc';
220
+ /** BCP-47 language code for the UI. @default 'en' */
221
+ language: string;
222
+ /** When true, the component renders in read-only mode. @default false */
223
+ isReadonly: boolean;
224
+ /** When true, a "Save as draft" action is available. @default false */
225
+ enableSaveAsDraft: boolean;
226
+ /** Fine-grained UI feature flags. */
227
+ options: IValidationStationOptions;
228
+
229
+ // ── Command inputs ────────────────────────────────────────────────────────
230
+ //
231
+ // Assigning a new object reference triggers the action.
232
+
233
+ /** Trigger a save operation. Set { validate: true } to validate before saving. */
234
+ save: { validate: boolean } | undefined;
235
+ /** Trigger a discard-changes operation. Assign { value: true } to confirm. */
236
+ discardChanges: { value: boolean } | undefined;
237
+ /** Set field values by path. Listen to `setFieldValueByPathResult` for outcomes. */
238
+ setFieldValueByPath: SetFieldValueByPath | undefined;
239
+ /**
240
+ * Select the field in the extraction panel by path; if the value has a
241
+ * document reference, focus it in the PDF viewer. Listen to
242
+ * `selectAndFocusFieldValueByPathResult` for the outcome.
243
+ */
244
+ selectAndFocusFieldValueByPath: SelectAndFocusFieldValueByPath | undefined;
245
+ /** Delete a field value by path. Listen to `deleteFieldValueByPathResult` for outcomes. */
246
+ deleteFieldValueByPath: DeleteFieldValueByPath | undefined;
247
+
248
+ // ── Typed event listeners ─────────────────────────────────────────────────
249
+
250
+ addEventListener<K extends keyof TEventMap>(
251
+ type: K,
252
+ listener: (event: CustomEvent<TEventMap[K]>) => void,
253
+ options?: boolean | AddEventListenerOptions,
254
+ ): void;
255
+ addEventListener(
256
+ type: string,
257
+ listener: EventListenerOrEventListenerObject,
258
+ options?: boolean | AddEventListenerOptions,
259
+ ): void;
260
+
261
+ removeEventListener<K extends keyof TEventMap>(
262
+ type: K,
263
+ listener: (event: CustomEvent<TEventMap[K]>) => void,
264
+ options?: boolean | EventListenerOptions,
265
+ ): void;
266
+ removeEventListener(
267
+ type: string,
268
+ listener: EventListenerOrEventListenerObject,
269
+ options?: boolean | EventListenerOptions,
270
+ ): void;
271
+ }
272
+
273
+ /**
274
+ * Strongly-typed interface for `<ui-du-validation-station-standalone-wc-element>`.
275
+ *
276
+ * The standalone variant does not make HTTP calls. The consumer provides
277
+ * document data as JS properties and handles API commands by listening
278
+ * to `saveValidatedDataRequest` / `saveValidatedDataAsDraftRequest` /
279
+ * `saveExceptionReportRequest`.
280
+ */
281
+ export interface IValidationStationStandaloneWcElement extends IVsWcBaseElement<IValidationStationStandaloneWcEventMap> {
282
+ // ── Setup inputs ──────────────────────────────────────────────────────────
283
+
284
+ /** Document identifier. Required before any data inputs are set. */
285
+ documentId: string | undefined;
286
+
287
+ // ── Data inputs (replace the HTTP fetches of the non-standalone variant) ──
288
+
289
+ /** Taxonomy for this document. Type: ITaxonomyDTO */
290
+ taxonomy: unknown;
291
+ /** Initial extraction results. Type: IExtractionResultDTO */
292
+ extractionResult: unknown;
293
+ /** Document object model. Type: DocumentDTO */
294
+ dom: unknown;
295
+ /** Plain text content of the document. */
296
+ text: string | undefined;
297
+ /** Customization configuration. Type: ICustomizationInfoDTO */
298
+ customizationInfo: unknown;
299
+ /** Original document as a base64 data URL. */
300
+ original: string | undefined;
301
+ }
302
+
303
+ /**
304
+ * Extends `IValidationStationStandaloneWcElement` with an explicit teardown method.
305
+ *
306
+ * The persistent element suppresses `disconnectedCallback()` to survive
307
+ * portal detachments (e.g. tab switches). Call `forceDestroy()` when the
308
+ * element is being permanently removed (`ngOnDestroy` / `useEffect`
309
+ * cleanup / `componentWillUnmount`).
310
+ */
311
+ export interface IPersistentValidationStationStandaloneWcElement extends IValidationStationStandaloneWcElement {
312
+ /**
313
+ * Explicitly tears down the inner Angular component.
314
+ * Must be called when the element is being permanently removed.
315
+ */
316
+ forceDestroy(): void;
317
+ }
318
+
319
+ // ─── Shared JSX props ─────────────────────────────────────────────────────────
320
+
321
+ /**
322
+ * JSX props shared by the standalone VS element variants. Covers
323
+ * configuration inputs, command inputs, and common HTML attributes.
324
+ */
325
+ export interface IVsWcSharedJsxProps {
326
+ // ── Scalar configuration inputs ───────────────────────────────────────────
327
+ theme?: 'light' | 'dark' | 'light-hc' | 'dark-hc';
328
+ language?: string;
329
+ /** JS property form. */
330
+ isReadonly?: boolean;
331
+ /** Attribute form (kebab-case). Coerced via Angular's `booleanAttribute` transform. */
332
+ 'is-readonly'?: boolean;
333
+ /** JS property form. */
334
+ enableSaveAsDraft?: boolean;
335
+ /** Attribute form (kebab-case). Coerced via Angular's `booleanAttribute` transform. */
336
+ 'enable-save-as-draft'?: boolean;
337
+ // ── Complex configuration + command inputs ────────────────────────────────
338
+ options?: IValidationStationOptions;
339
+ save?: { validate: boolean };
340
+ discardChanges?: { value: boolean };
341
+ setFieldValueByPath?: SetFieldValueByPath;
342
+ selectAndFocusFieldValueByPath?: SelectAndFocusFieldValueByPath;
343
+ deleteFieldValueByPath?: DeleteFieldValueByPath;
344
+ // ── Common HTML attributes ────────────────────────────────────────────────
345
+ id?: string;
346
+ className?: string;
347
+ class?: string;
348
+ style?: string | Record<string, string | number>;
349
+ title?: string;
350
+ role?: string;
351
+ tabIndex?: number;
352
+ part?: string;
353
+ slot?: string;
354
+ draggable?: boolean;
355
+ hidden?: boolean;
356
+ // Allow arbitrary data-* / aria-* attributes while preserving strong typing
357
+ [dataAttr: `data-${string}`]: string | number | boolean | null | undefined;
358
+ [ariaAttr: `aria-${string}`]: string | number | boolean | null | undefined;
359
+ }
360
+
361
+ /**
362
+ * Props for `<ui-du-validation-station-standalone-wc-element>` in React JSX.
363
+ *
364
+ * React 18 — complex object inputs (`taxonomy`, `extractionResult`, `dom`,
365
+ * `customizationInfo`, and all command payloads) must be set via a `ref`
366
+ * as JS properties; React 18 serialises JSX props to HTML attributes and
367
+ * Angular Elements cannot deserialise object JSON.
368
+ *
369
+ * React 19 — supports passing complex object props directly as JSX
370
+ * attributes. Refs become unnecessary for static data.
371
+ */
372
+ export interface IValidationStationStandaloneWcJsxProps extends IVsWcSharedJsxProps {
373
+ documentId?: string;
374
+ text?: string;
375
+ original?: string;
376
+ taxonomy?: unknown;
377
+ extractionResult?: unknown;
378
+ dom?: unknown;
379
+ customizationInfo?: unknown;
380
+ }
381
+
382
+ /** Props for `<ui-du-validation-station-standalone-wc-persistent-element>` in React JSX. */
383
+ export type IPersistentValidationStationStandaloneWcJsxProps = IValidationStationStandaloneWcJsxProps;
384
+
385
+ // ─── Global type augmentations ────────────────────────────────────────────────
386
+
387
+ declare global {
388
+ interface HTMLElementTagNameMap {
389
+ 'ui-du-validation-station-standalone-wc-element': IValidationStationStandaloneWcElement;
390
+ 'ui-du-validation-station-standalone-wc-persistent-element': IPersistentValidationStationStandaloneWcElement;
391
+ }
392
+
393
+ namespace React {
394
+ namespace JSX {
395
+ interface IntrinsicElements {
396
+ 'ui-du-validation-station-standalone-wc-element': IValidationStationStandaloneWcJsxProps;
397
+ 'ui-du-validation-station-standalone-wc-persistent-element': IPersistentValidationStationStandaloneWcJsxProps;
398
+ }
399
+ }
400
+ }
401
+ }