@uipath/ui-widgets-validation-station 1.0.1-beta.6

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/README.md ADDED
@@ -0,0 +1,345 @@
1
+ # @uipath/ui-widgets-validation-station
2
+
3
+ A React wrapper for the UiPath Document Understanding Validation Station. It handles web component loading, bucket artifact fetching, and exposes a declarative props API for all Validation Station features.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @uipath/ui-widgets-validation-station
9
+ ```
10
+
11
+ ### Peer dependencies
12
+
13
+ ```
14
+ react >= 19.2.0
15
+ react-dom >= 19.2.0
16
+ @uipath/uipath-typescript >= 1.3.9
17
+ ```
18
+
19
+ ## Quick start
20
+
21
+ > **Note:** Add either `light` or `dark` class to your HTML `<body>` element to enable proper theming.
22
+
23
+ ```tsx
24
+ import {
25
+ ValidationStation,
26
+ Language,
27
+ } from "@uipath/ui-widgets-validation-station";
28
+ import "@uipath/ui-widgets-validation-station/ValidationStation.css";
29
+ import { UiPath } from "@uipath/uipath-typescript/core";
30
+
31
+ const sdk = new UiPath({
32
+ baseUrl: "https://cloud.uipath.com",
33
+ orgName: "your-org",
34
+ tenantName: "your-tenant",
35
+ secret: "your-secret",
36
+ });
37
+
38
+ await sdk.initialize();
39
+
40
+ function App() {
41
+ return (
42
+ <ValidationStation
43
+ sdk={sdk}
44
+ data={myContentValidationData}
45
+ folderId={12345}
46
+ theme="light"
47
+ language={Language.English}
48
+ />
49
+ );
50
+ }
51
+ ```
52
+
53
+ > See [Static assets](#static-assets) below — you must copy the WC's
54
+ > `du-assets/` folder into your build output, or PDF rendering and
55
+ > translations will silently 404 in production.
56
+
57
+ ## Props
58
+
59
+ | Prop | Type | Required | Default | Description |
60
+ | -------------------------------- | ---------------------------------------------- | -------- | --------- | ----------------------------------------------------------------------------------------- |
61
+ | `sdk` | `UiPath` | Yes | — | UiPath SDK instance for authentication and API calls |
62
+ | `data` | `ContentValidationData` | Yes | — | Document data containing bucket paths, document ID, and folder references |
63
+ | `folderId` | `number` | No | — | Storage bucket folder ID. Falls back to `data.FolderId` if not provided |
64
+ | `theme` | `'light' \| 'dark' \| 'light-hc' \| 'dark-hc'` | No | `'light'` | Visual theme |
65
+ | `language` | `Language` | No | — | UI language (see Language enum below) |
66
+ | `isReadonly` | `boolean` | No | `false` | When `true`, renders in read-only mode |
67
+ | `enableSaveAsDraft` | `boolean` | No | `false` | Enables the "Save as draft" action |
68
+ | `options` | `IValidationStationOptions` | No | — | Fine-grained UI feature flags |
69
+ | `save` | `{ validate: boolean }` | No | — | Trigger a save. Set `{ validate: true }` to validate before saving |
70
+ | `discardChanges` | `{ value: boolean }` | No | — | Trigger a discard-changes operation |
71
+ | `setTableCellValue` | `ISetTableCellValueParameters[]` | No | — | Set one or more table cell values programmatically |
72
+ | `deleteTableCellValue` | `IDeleteTableCellValueParameters[]` | No | — | Delete one or more table cell values programmatically |
73
+ | `setFieldValueByPath` | `SetFieldValueByPath` | No | — | Set a field value addressed by a path of `{ fieldName, valueIndex }` segments |
74
+ | `selectAndFocusFieldValueByPath` | `SelectAndFocusFieldValueByPath` | No | — | Select and focus a field value addressed by a path; focuses the document reference if any |
75
+ | `deleteFieldValueByPath` | `DeleteFieldValueByPath` | No | — | Delete a field value addressed by a path |
76
+
77
+ ### Reacting to save completion
78
+
79
+ `onSaveComplete` fires after the save flow finishes (ProcessExtractedData + bucket upload). The callback receives a `SaveValidatedDataResult` — `success: true` on success, or `success: false` with an `error` message string on failure. Use it to complete task, retry, or surface your own error UI.
80
+
81
+ ```tsx
82
+ import {
83
+ ValidationStation,
84
+ type SaveValidatedDataResult,
85
+ } from "@uipath/ui-widgets-validation-station";
86
+
87
+ function App({ sdk, data, task }) {
88
+ const handleSaveComplete = async (result: SaveValidatedDataResult) => {
89
+ if (!result.success) {
90
+ // ValidationStation already shows a toast for the failure; add
91
+ // your own retry / logging / analytics here if needed.
92
+ console.warn("Save failed:", result.error);
93
+ return;
94
+ }
95
+ await task.complete({ action: "Completed", type: "DocumentValidation" });
96
+ };
97
+
98
+ return (
99
+ <ValidationStation
100
+ sdk={sdk}
101
+ data={data}
102
+ folderId={task.folderId}
103
+ onSaveComplete={handleSaveComplete}
104
+ />
105
+ );
106
+ }
107
+ ```
108
+
109
+ ## Language enum
110
+
111
+ The `Language` enum provides all supported locales:
112
+
113
+ ```ts
114
+ import { Language } from "@uipath/ui-widgets-validation-station";
115
+
116
+ Language.English; // "en"
117
+ Language.German; // "de"
118
+ Language.Spanish; // "es"
119
+ Language.SpanishMexico; // "es-MX"
120
+ Language.French; // "fr"
121
+ Language.Japanese; // "ja"
122
+ Language.Korean; // "ko"
123
+ Language.Portuguese; // "pt"
124
+ Language.PortugueseBrazil; // "pt-BR"
125
+ Language.Romanian; // "ro"
126
+ Language.Russian; // "ru"
127
+ Language.Turkish; // "tr"
128
+ Language.ChineseSimplified; // "zh-CN"
129
+ Language.ChineseTraditional; // "zh-TW"
130
+ ```
131
+
132
+ ## Exported types
133
+
134
+ All parameter types are re-exported from the package for convenience:
135
+
136
+ ```ts
137
+ import { Language } from "@uipath/ui-widgets-validation-station";
138
+ import type {
139
+ ValidationStationProps,
140
+ ISetTableCellValueParameters,
141
+ IDeleteTableCellValueParameters,
142
+ IValidationStationOptions,
143
+ SetFieldValueByPath,
144
+ SelectAndFocusFieldValueByPath,
145
+ DeleteFieldValueByPath,
146
+ } from "@uipath/ui-widgets-validation-station";
147
+ ```
148
+
149
+ ## Examples
150
+
151
+ ### Setting a field value by path
152
+
153
+ Address fields by path when you have nested groups or table rows. Each segment is `{ fieldName, valueIndex }`.
154
+
155
+ ```tsx
156
+ import { useState } from "react";
157
+ import {
158
+ ValidationStation,
159
+ type SetFieldValueByPath,
160
+ } from "@uipath/ui-widgets-validation-station";
161
+
162
+ function App({ sdk, data }) {
163
+ const [fieldValueByPath, setFieldValueByPath] = useState<
164
+ SetFieldValueByPath | undefined
165
+ >(undefined);
166
+
167
+ return (
168
+ <>
169
+ <button
170
+ onClick={() =>
171
+ setFieldValueByPath({
172
+ path: [
173
+ { fieldName: "Invoice", valueIndex: 0 }, // parent field name
174
+ { fieldName: "Amount", valueIndex: 0 }, // child field name
175
+ ],
176
+ update: { Value: "100.00", OperatorConfirmed: true },
177
+ })
178
+ }
179
+ >
180
+ Set Amount by path
181
+ </button>
182
+ <ValidationStation
183
+ sdk={sdk}
184
+ data={data}
185
+ folderId={67}
186
+ setFieldValueByPath={fieldValueByPath}
187
+ />
188
+ </>
189
+ );
190
+ }
191
+ ```
192
+
193
+ ### Focusing a field by path
194
+
195
+ ```tsx
196
+ import { useState } from "react";
197
+ import {
198
+ ValidationStation,
199
+ type SelectAndFocusFieldValueByPath,
200
+ } from "@uipath/ui-widgets-validation-station";
201
+
202
+ function App({ sdk, data }) {
203
+ const [focus, setFocus] = useState<
204
+ SelectAndFocusFieldValueByPath | undefined
205
+ >(undefined);
206
+
207
+ return (
208
+ <>
209
+ <button
210
+ onClick={() =>
211
+ setFocus({
212
+ path: [
213
+ { fieldName: "Invoice", valueIndex: 0 }, // parent field name
214
+ { fieldName: "Amount", valueIndex: 0 }, // child field name
215
+ ],
216
+ })
217
+ }
218
+ >
219
+ Focus Amount by path
220
+ </button>
221
+ <ValidationStation
222
+ sdk={sdk}
223
+ data={data}
224
+ folderId={67}
225
+ selectAndFocusFieldValueByPath={focus}
226
+ />
227
+ </>
228
+ );
229
+ }
230
+ ```
231
+
232
+ ### Triggering save
233
+
234
+ ```tsx
235
+ const [save, setSave] = useState<{ validate: boolean } | undefined>(undefined);
236
+
237
+ <button onClick={() => setSave({ validate: true })}>Save</button>
238
+ <ValidationStation sdk={sdk} data={data} folderId={1} save={save} />
239
+ ```
240
+
241
+ ## Static assets
242
+
243
+ The underlying web component loads runtime assets (PDF.js worker, cmaps,
244
+ wasm, i18n translations) from a sibling `du-assets/` directory, resolved
245
+ relative to where the WC's main bundle is served via `import.meta.url`.
246
+
247
+ **`du-assets/` must be deployed at the same path level as your output
248
+ bundle**, otherwise PDF rendering and translations will silently 404 in
249
+ the browser (no build error). You need to copy
250
+ `node_modules/@uipath/du-validation-station-wc/du-assets/` into your
251
+ build output as a post-build step.
252
+
253
+ ### Vite
254
+
255
+ Add a small plugin to `vite.config.ts` that copies `du-assets/` next to
256
+ your emitted JS chunks after each build:
257
+
258
+ ```ts
259
+ // vite.config.ts
260
+ import react from "@vitejs/plugin-react";
261
+ import { cp } from "node:fs/promises";
262
+ import { createRequire } from "node:module";
263
+ import { dirname, resolve } from "node:path";
264
+ import { defineConfig, type Plugin } from "vite";
265
+
266
+ const require = createRequire(import.meta.url);
267
+
268
+ function copyDuValidationStationAssets(): Plugin {
269
+ let destDir = "";
270
+ return {
271
+ name: "copy-du-validation-station-assets",
272
+ apply: "build",
273
+ configResolved(config) {
274
+ destDir = resolve(
275
+ config.root,
276
+ config.build.outDir,
277
+ config.build.assetsDir,
278
+ "du-assets",
279
+ );
280
+ },
281
+ async closeBundle() {
282
+ const wcRoot = dirname(
283
+ require.resolve("@uipath/du-validation-station-wc/package.json"),
284
+ );
285
+ await cp(resolve(wcRoot, "du-assets"), destDir, { recursive: true });
286
+ },
287
+ };
288
+ }
289
+
290
+ export default defineConfig({
291
+ plugins: [react(), copyDuValidationStationAssets()],
292
+ optimizeDeps: {
293
+ exclude: ["@uipath/du-validation-station-wc"],
294
+ },
295
+ });
296
+ ```
297
+
298
+ `optimizeDeps.exclude` is required — Vite's pre-bundler rewrites
299
+ `import.meta.url`, which breaks the WC's runtime asset resolution.
300
+
301
+ ### webpack
302
+
303
+ Use [`copy-webpack-plugin`](https://github.com/webpack-contrib/copy-webpack-plugin):
304
+
305
+ ```js
306
+ // webpack.config.js
307
+ const CopyPlugin = require("copy-webpack-plugin");
308
+ const path = require("path");
309
+
310
+ module.exports = {
311
+ plugins: [
312
+ new CopyPlugin({
313
+ patterns: [
314
+ {
315
+ from:
316
+ path.dirname(
317
+ require.resolve("@uipath/du-validation-station-wc/package.json"),
318
+ ) + "/du-assets",
319
+ to: "assets/du-assets",
320
+ },
321
+ ],
322
+ }),
323
+ ],
324
+ };
325
+ ```
326
+
327
+ ### Other bundlers
328
+
329
+ Any asset-copy mechanism works — Angular's `assets` array,
330
+ `rollup-plugin-copy`, a `postbuild` npm script with `cp -r`, etc. The
331
+ only requirement is that the final deployed layout has `du-assets/`
332
+ sitting next to the JS chunks that import the WC.
333
+
334
+ ## Development
335
+
336
+ ```bash
337
+ # Build
338
+ npm run build
339
+
340
+ # Run tests
341
+ npm run test
342
+
343
+ # Run tests in watch mode
344
+ npm run test:watch
345
+ ```
@@ -0,0 +1,3 @@
1
+ import type { ValidationStationProps } from "./types";
2
+ export declare const ValidationStation: React.FC<ValidationStationProps>;
3
+ //# sourceMappingURL=ValidationStation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ValidationStation.d.ts","sourceRoot":"","sources":["../src/ValidationStation.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAGtD,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CA4F9D,CAAC"}
@@ -0,0 +1,49 @@
1
+ import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { toast, Toaster } from "@uipath/apollo-wind";
3
+ import { useEffect, useState } from "react";
4
+ import { validationStationWcReady } from "./loadValidationStationWc";
5
+ import { saveValidatedData } from "./saveValidatedDataUtil";
6
+ import { useBucketArtifacts } from "./useBucketArtifacts";
7
+ export const ValidationStation = ({ sdk, data, folderId, theme, language, isReadonly, enableSaveAsDraft, options, save, discardChanges, setFieldValueByPath, selectAndFocusFieldValueByPath, deleteFieldValueByPath, onSaveComplete, }) => {
8
+ const { artifacts, error } = useBucketArtifacts(sdk, data, folderId);
9
+ const [wcReady, setWcReady] = useState(false);
10
+ useEffect(() => {
11
+ let cancelled = false;
12
+ validationStationWcReady.then(() => {
13
+ if (!cancelled)
14
+ setWcReady(true);
15
+ });
16
+ return () => {
17
+ cancelled = true;
18
+ };
19
+ }, []);
20
+ if (error) {
21
+ return _jsxs("div", { children: ["Failed to load document artifacts: ", error] });
22
+ }
23
+ if (!artifacts || !wcReady) {
24
+ return _jsx("div", { children: "Loading..." });
25
+ }
26
+ const resolvedFolderId = folderId ?? data.FolderId;
27
+ const refCallback = (el) => {
28
+ if (!el)
29
+ return;
30
+ const onSaveRequest = (event) => {
31
+ if (!resolvedFolderId) {
32
+ toast.error("[ValidationStation] cannot save: folderId is not available");
33
+ return;
34
+ }
35
+ saveValidatedData(sdk, data, resolvedFolderId, event.detail).then((result) => {
36
+ if (!result.success) {
37
+ toast.error(`[ValidationStation] saveValidatedData failed: ${result.error}`);
38
+ }
39
+ onSaveComplete?.(result);
40
+ });
41
+ };
42
+ el.addEventListener("saveValidatedDataRequest", onSaveRequest);
43
+ return () => {
44
+ el.removeEventListener("saveValidatedDataRequest", onSaveRequest);
45
+ };
46
+ };
47
+ return (_jsxs(_Fragment, { children: [_jsx("ui-du-validation-station-standalone-wc-element", { ...{ ref: refCallback }, theme: theme, language: language, isReadonly: isReadonly, enableSaveAsDraft: enableSaveAsDraft, documentId: data.DocumentId, taxonomy: artifacts.taxonomy, extractionResult: artifacts.extractionResult, dom: artifacts.dom, text: artifacts.text, customizationInfo: artifacts.customizationInfo, original: artifacts.original, options: options, save: save, discardChanges: discardChanges, setFieldValueByPath: setFieldValueByPath, selectAndFocusFieldValueByPath: selectAndFocusFieldValueByPath, deleteFieldValueByPath: deleteFieldValueByPath }), _jsx(Toaster, { position: "top-right" })] }));
48
+ };
49
+ //# sourceMappingURL=ValidationStation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ValidationStation.js","sourceRoot":"","sources":["../src/ValidationStation.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;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AA8B,EAC9D,sBAAsB,EAAE,sBAAsB,GAC9C,EACF,KAAC,OAAO,IAAC,QAAQ,EAAC,WAAW,GAAG,IAC/B,CACJ,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { Meta, StoryObj } from "@storybook/react-vite";
2
+ import type { ValidationStationProps } from "./types";
3
+ interface ValidationStationStoryArgs extends Omit<ValidationStationProps, "sdk"> {
4
+ baseUrl: string;
5
+ orgName: string;
6
+ tenantName: string;
7
+ secret: string;
8
+ }
9
+ declare const ValidationStationWithSdk: ({ baseUrl, orgName, tenantName, secret, ...props }: ValidationStationStoryArgs) => import("react/jsx-runtime").JSX.Element;
10
+ declare const meta: Meta<typeof ValidationStationWithSdk>;
11
+ export default meta;
12
+ type Story = StoryObj<typeof meta>;
13
+ export declare const Default: Story;
14
+ //# sourceMappingURL=ValidationStation.stories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ValidationStation.stories.d.ts","sourceRoot":"","sources":["../src/ValidationStation.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAM5D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEtD,UAAU,0BAA2B,SAAQ,IAAI,CAC/C,sBAAsB,EACtB,KAAK,CACN;IACC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,QAAA,MAAM,wBAAwB,GAAI,oDAM/B,0BAA0B,4CAoE5B,CAAC;AAiBF,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,wBAAwB,CA8J/C,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KASrB,CAAC"}
@@ -0,0 +1,231 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { UiPath } from "@uipath/uipath-typescript/core";
3
+ import { useEffect, useState } from "react";
4
+ import { ValidationStation } from "./ValidationStation";
5
+ import { ValidationStationLanguage } from "./types";
6
+ const ValidationStationWithSdk = ({ baseUrl, orgName, tenantName, secret, ...props }) => {
7
+ const [state, setState] = useState({ sdk: null, error: null });
8
+ useEffect(() => {
9
+ if (!baseUrl || !orgName || !tenantName || !secret) {
10
+ return;
11
+ }
12
+ let cancelled = false;
13
+ const initSdk = async () => {
14
+ try {
15
+ const normalizedBaseUrl = baseUrl.match(/^https?:\/\//)
16
+ ? baseUrl
17
+ : `https://${baseUrl}`;
18
+ const uipath = new UiPath({
19
+ baseUrl: normalizedBaseUrl,
20
+ orgName,
21
+ tenantName,
22
+ secret,
23
+ });
24
+ await uipath.initialize();
25
+ if (!cancelled) {
26
+ setState({ sdk: uipath, error: null });
27
+ }
28
+ }
29
+ catch (err) {
30
+ if (!cancelled) {
31
+ setState({
32
+ sdk: null,
33
+ error: err instanceof Error ? err.message : "Failed to initialize SDK",
34
+ });
35
+ }
36
+ }
37
+ };
38
+ initSdk();
39
+ return () => {
40
+ cancelled = true;
41
+ };
42
+ }, [baseUrl, orgName, tenantName, secret]);
43
+ const { sdk, error } = state;
44
+ if (!baseUrl || !orgName || !tenantName || !secret) {
45
+ return (_jsx("div", { style: { padding: 24, color: "#666" }, children: "Please provide baseUrl, orgName, tenantName, and secret in the controls panel below." }));
46
+ }
47
+ if (error) {
48
+ return (_jsxs("div", { style: { padding: 24, color: "#d32f2f" }, children: ["SDK initialization failed: ", error] }));
49
+ }
50
+ if (!sdk) {
51
+ return _jsx("div", { style: { padding: 24 }, children: "Initializing SDK..." });
52
+ }
53
+ return _jsx(ValidationStation, { sdk: sdk, ...props });
54
+ };
55
+ const mockData = {
56
+ BucketName: "",
57
+ BucketId: 0,
58
+ FolderId: 0,
59
+ FolderKey: "",
60
+ DocumentId: "",
61
+ EncodedDocumentPath: "",
62
+ TextPath: "",
63
+ DocumentObjectModelPath: "",
64
+ TaxonomyPath: "",
65
+ AutomaticExtractionResultsPath: "",
66
+ ValidatedExtractionResultsPath: "",
67
+ CustomizationInfoPath: "",
68
+ };
69
+ const meta = {
70
+ title: "Components/ValidationStation",
71
+ component: ValidationStationWithSdk,
72
+ decorators: [
73
+ (Story) => (_jsx("div", { style: { height: "800px" }, children: _jsx(Story, {}) })),
74
+ ],
75
+ parameters: {
76
+ layout: "fullscreen",
77
+ docs: {
78
+ description: {
79
+ component: `
80
+ A React wrapper for the UiPath Document Understanding Validation Station standalone web component.
81
+
82
+ ## Features
83
+
84
+ - Renders the DU Validation Station for document validation
85
+ - Standalone mode: consumer provides document data directly and handles save operations via event callbacks
86
+ - Supports light, dark, and high-contrast themes
87
+ - Configurable language, read-only mode, and save-as-draft
88
+ - Event-driven props for field/table cell manipulation
89
+
90
+ ## Installation
91
+
92
+ \`\`\`bash
93
+ npm install @uipath/ui-widgets-validation-station
94
+ \`\`\`
95
+
96
+ ## Usage
97
+
98
+ > **Note:** Add either \`light\` or \`dark\` class to your HTML \`<body>\` element to enable proper theming.
99
+
100
+ The component loads the underlying Validation Station web component on mount —
101
+ consumers do not need to call \`loadValidationStationWebComponent\` themselves.
102
+ By default it expects the web component assets to be served at
103
+ \`node_modules/@uipath/du-validation-station-wc\` (which works with Vite's
104
+ dev server). For production, copy the contents of
105
+ \`node_modules/@uipath/du-validation-station-wc\` into your public assets and
106
+ point \`wcAssetsUrl\` at that location.
107
+
108
+ \`\`\`tsx
109
+ import { ValidationStation } from '@uipath/ui-widgets-validation-station';
110
+ import "@uipath/ui-widgets-validation-station/ValidationStation.css";
111
+ import { UiPath } from '@uipath/uipath-typescript/core';
112
+
113
+ const sdk = new UiPath({
114
+ baseUrl: 'https://cloud.uipath.com',
115
+ orgName: 'your-org',
116
+ tenantName: 'your-tenant',
117
+ secret: 'your-secret'
118
+ });
119
+
120
+ await sdk.initialize();
121
+
122
+ function App() {
123
+ return (
124
+ <ValidationStation
125
+ sdk={sdk}
126
+ data={myContentValidationData}
127
+ folderId={12345}
128
+ theme="light"
129
+ language="en"
130
+ save={{ validate: true }}
131
+ // wcAssetsUrl="/assets/du-validation-station-wc"
132
+ />
133
+ );
134
+ }
135
+ \`\`\`
136
+
137
+ ## Requirements
138
+
139
+ - React 19.2.0+
140
+ - React DOM 19.2.0+
141
+ - @uipath/du-validation-station-wc
142
+ - @uipath/uipath-typescript`,
143
+ },
144
+ },
145
+ },
146
+ tags: ["autodocs"],
147
+ argTypes: {
148
+ baseUrl: {
149
+ description: "UiPath API base URL",
150
+ control: "text",
151
+ table: { category: "SDK Configuration" },
152
+ },
153
+ orgName: {
154
+ description: "UiPath organization name",
155
+ control: "text",
156
+ table: { category: "SDK Configuration" },
157
+ },
158
+ tenantName: {
159
+ description: "UiPath tenant name",
160
+ control: "text",
161
+ table: { category: "SDK Configuration" },
162
+ },
163
+ secret: {
164
+ description: "UiPath API secret for authentication",
165
+ control: "text",
166
+ table: { category: "SDK Configuration" },
167
+ },
168
+ data: {
169
+ description: "ContentValidationData object containing bucket paths, document ID, and folder references.",
170
+ control: "object",
171
+ },
172
+ folderId: {
173
+ description: "Storage bucket folder ID. Falls back to data.folderId if not provided.",
174
+ control: "number",
175
+ },
176
+ theme: {
177
+ description: "Visual theme for the validation station",
178
+ control: "select",
179
+ options: ["light", "dark", "light-hc", "dark-hc"],
180
+ },
181
+ language: {
182
+ description: "Language/locale for the validation station UI",
183
+ control: "select",
184
+ options: Object.keys(ValidationStationLanguage),
185
+ mapping: ValidationStationLanguage,
186
+ },
187
+ isReadonly: {
188
+ description: "When true, the validation station is in read-only mode",
189
+ control: "boolean",
190
+ },
191
+ enableSaveAsDraft: {
192
+ description: "When true, enables the save-as-draft functionality",
193
+ control: "boolean",
194
+ },
195
+ options: {
196
+ description: "Additional configuration options for the validation station",
197
+ control: "object",
198
+ },
199
+ save: {
200
+ description: "Trigger save with optional validation",
201
+ control: "object",
202
+ },
203
+ discardChanges: {
204
+ description: "Trigger discard changes",
205
+ control: "object",
206
+ },
207
+ },
208
+ args: {
209
+ baseUrl: "alpha.uipath.com",
210
+ orgName: "",
211
+ tenantName: "",
212
+ secret: "",
213
+ data: mockData,
214
+ folderId: 0,
215
+ theme: "light",
216
+ language: ValidationStationLanguage.English,
217
+ isReadonly: false,
218
+ enableSaveAsDraft: false,
219
+ },
220
+ };
221
+ export default meta;
222
+ export const Default = {
223
+ parameters: {
224
+ docs: {
225
+ description: {
226
+ story: "Default standalone validation station. Fill in the SDK configuration and data fields in the controls panel to load a document.",
227
+ },
228
+ },
229
+ },
230
+ };
231
+ //# sourceMappingURL=ValidationStation.stories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ValidationStation.stories.js","sourceRoot":"","sources":["../src/ValidationStation.stories.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAapD,MAAM,wBAAwB,GAAG,CAAC,EAChC,OAAO,EACP,OAAO,EACP,UAAU,EACV,MAAM,EACN,GAAG,KAAK,EACmB,EAAE,EAAE;IAC/B,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAG/B,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAE/B,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,IAAI,CAAC,UAAU,IAAI,CAAC,MAAM,EAAE,CAAC;YACnD,OAAO;QACT,CAAC;QAED,IAAI,SAAS,GAAG,KAAK,CAAC;QACtB,MAAM,OAAO,GAAG,KAAK,IAA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IAAI,EAAE;QACJ,OAAO,EAAE,kBAAkB;QAC3B,OAAO,EAAE,EAAE;QACX,UAAU,EAAE,EAAE;QACd,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,CAAC;QACX,KAAK,EAAE,OAAO;QACd,QAAQ,EAAE,yBAAyB,CAAC,OAAO;QAC3C,UAAU,EAAE,KAAK;QACjB,iBAAiB,EAAE,KAAK;KACzB;CACF,CAAC;AAEF,eAAe,IAAI,CAAC;AAGpB,MAAM,CAAC,MAAM,OAAO,GAAU;IAC5B,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,WAAW,EAAE;gBACX,KAAK,EACH,gIAAgI;aACnI;SACF;KACF;CACF,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { DuFramework } from "@uipath/uipath-typescript/document-understanding";
2
+ import type { BucketService } from "@uipath/uipath-typescript/buckets";
3
+ import type { BucketArtifacts } from "./types";
4
+ export declare function fetchBucketArtifacts(bucketService: BucketService, data: DuFramework.ContentValidationData, folderId: number): Promise<BucketArtifacts>;
5
+ //# sourceMappingURL=bucketArtifactsUtil.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bucketArtifactsUtil.d.ts","sourceRoot":"","sources":["../src/bucketArtifactsUtil.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kDAAkD,CAAC;AACpF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAEvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAgE/C,wBAAsB,oBAAoB,CACxC,aAAa,EAAE,aAAa,EAC5B,IAAI,EAAE,WAAW,CAAC,qBAAqB,EACvC,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,eAAe,CAAC,CAoD1B"}
@@ -0,0 +1,60 @@
1
+ import { unzipSync } from "fflate";
2
+ /** Fetch a URI, unzip the first file in the archive, and return the raw text. */
3
+ async function fetchAndUnzip(uri) {
4
+ const res = await fetch(uri);
5
+ const buf = await res.arrayBuffer();
6
+ const files = unzipSync(new Uint8Array(buf));
7
+ const firstFile = Object.values(files)[0];
8
+ return new TextDecoder().decode(firstFile);
9
+ }
10
+ async function fetchAndUnzipJson(uri) {
11
+ const text = await fetchAndUnzip(uri);
12
+ return JSON.parse(text);
13
+ }
14
+ /** Get URI then immediately fetch + unzip as JSON. */
15
+ async function fetchArtifactJson(bucketService, bucketId, folderId, path) {
16
+ const r = await bucketService.getReadUri({ bucketId, folderId, path });
17
+ return fetchAndUnzipJson(r.uri);
18
+ }
19
+ /**
20
+ * Fetch the validated extraction result if it exists in the bucket, otherwise
21
+ * fall back to the automatic extraction result.
22
+ */
23
+ async function fetchExtractionResult(bucketService, bucketId, folderId, validatedPath, automaticPath) {
24
+ if (validatedPath) {
25
+ try {
26
+ return await fetchArtifactJson(bucketService, bucketId, folderId, validatedPath);
27
+ }
28
+ catch {
29
+ // Validated result not saved yet — fall through to automatic.
30
+ }
31
+ }
32
+ return fetchArtifactJson(bucketService, bucketId, folderId, automaticPath);
33
+ }
34
+ /** Get URI then immediately fetch + unzip as text. */
35
+ async function fetchArtifactText(bucketService, bucketId, folderId, path) {
36
+ const r = await bucketService.getReadUri({ bucketId, folderId, path });
37
+ return await fetchAndUnzip(r.uri);
38
+ }
39
+ export async function fetchBucketArtifacts(bucketService, data, folderId) {
40
+ const { BucketId, TextPath, TaxonomyPath, EncodedDocumentPath, CustomizationInfoPath, DocumentObjectModelPath, AutomaticExtractionResultsPath, ValidatedExtractionResultsPath, } = data;
41
+ if (!BucketId ||
42
+ !TextPath ||
43
+ !TaxonomyPath ||
44
+ !EncodedDocumentPath ||
45
+ !CustomizationInfoPath ||
46
+ !DocumentObjectModelPath ||
47
+ !AutomaticExtractionResultsPath) {
48
+ throw new Error("ContentValidationData is missing required bucket artifact fields.");
49
+ }
50
+ const [taxonomy, extractionResult, dom, text, customizationInfo, original] = await Promise.all([
51
+ fetchArtifactJson(bucketService, BucketId, folderId, TaxonomyPath),
52
+ fetchExtractionResult(bucketService, BucketId, folderId, ValidatedExtractionResultsPath, AutomaticExtractionResultsPath),
53
+ fetchArtifactJson(bucketService, BucketId, folderId, DocumentObjectModelPath),
54
+ fetchArtifactText(bucketService, BucketId, folderId, TextPath),
55
+ fetchArtifactJson(bucketService, BucketId, folderId, CustomizationInfoPath),
56
+ fetchArtifactText(bucketService, BucketId, folderId, EncodedDocumentPath),
57
+ ]);
58
+ return { taxonomy, extractionResult, dom, text, customizationInfo, original };
59
+ }
60
+ //# sourceMappingURL=bucketArtifactsUtil.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bucketArtifactsUtil.js","sourceRoot":"","sources":["../src/bucketArtifactsUtil.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAGnC,iFAAiF;AACjF,KAAK,UAAU,aAAa,CAAC,GAAW;IACtC,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC;IAC7B,MAAM,GAAG,GAAG,MAAM,GAAG,CAAC,WAAW,EAAE,CAAC;IACpC,MAAM,KAAK,GAAG,SAAS,CAAC,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7C,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1C,OAAO,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;AAC7C,CAAC;AAED,KAAK,UAAU,iBAAiB,CAAC,GAAW;IAC1C,MAAM,IAAI,GAAG,MAAM,aAAa,CAAC,GAAG,CAAC,CAAC;IACtC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,sDAAsD;AACtD,KAAK,UAAU,iBAAiB,CAC9B,aAA4B,EAC5B,QAAgB,EAChB,QAAgB,EAChB,IAAY;IAEZ,MAAM,CAAC,GAAG,MAA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b,mEAAmE,CACpE,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,QAAQ,EAAE,gBAAgB,EAAE,GAAG,EAAE,IAAI,EAAE,iBAAiB,EAAE,QAAQ,CAAC,GACxE,MAAM,OAAO,CAAC,GAAG,CAAC;QAChB,iBAAiB,CAAC,aAAa,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,CAAC;QAClE,qBAAqB,CACnB,aAAa,EACb,QAAQ,EACR,QAAQ,EACR,8BAA8B,EAC9B,8BAA8B,CAC/B;QACD,iBAAiB,CACf,aAAa,EACb,QAAQ,EACR,QAAQ,EACR,uBAAuB,CACxB;QACD,iBAAiB,CAAC,aAAa,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC;QAC9D,iBAAiB,CACf,aAAa,EACb,QAAQ,EACR,QAAQ,EACR,qBAAqB,CACtB;QACD,iBAAiB,CAAC,aAAa,EAAE,QAAQ,EAAE,QAAQ,EAAE,mBAAmB,CAAC;KAC1E,CAAC,CAAC;IAEL,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,GAAG,EAAE,IAAI,EAAE,iBAAiB,EAAE,QAAQ,EAAE,CAAC;AAChF,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { ValidationStationLanguage } from "./types";
2
+ export type { DeleteFieldValueByPath, IValidationStationOptions, SelectAndFocusFieldValueByPath, SetFieldValueByPath, ValidationStationProps, } from "./types";
3
+ export { ValidationStation } from "./ValidationStation";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AACpD,YAAY,EACV,sBAAsB,EACtB,yBAAyB,EACzB,8BAA8B,EAC9B,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export { ValidationStationLanguage } from "./types";
2
+ export { ValidationStation } from "./ValidationStation";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAQpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,6 @@
1
+ import "@uipath/du-validation-station-wc/polyfills";
2
+ import "@uipath/du-validation-station-wc/main";
3
+ import "@uipath/du-validation-station-wc/styles.css";
4
+ export declare const VALIDATION_STATION_TAG = "ui-du-validation-station-standalone-wc-element";
5
+ export declare const validationStationWcReady: Promise<void>;
6
+ //# sourceMappingURL=loadValidationStationWc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loadValidationStationWc.d.ts","sourceRoot":"","sources":["../src/loadValidationStationWc.ts"],"names":[],"mappings":"AAGA,OAAO,4CAA4C,CAAC;AACpD,OAAO,uCAAuC,CAAC;AAC/C,OAAO,6CAA6C,CAAC;AAErD,eAAO,MAAM,sBAAsB,mDACe,CAAC;AAEnD,eAAO,MAAM,wBAAwB,EAAE,OAAO,CAAC,IAAI,CAG2B,CAAC"}
@@ -0,0 +1,11 @@
1
+ // Polyfills (zone.js, etc.) MUST load before main, or the Angular Element
2
+ // inside `main` will not bootstrap. Kept in its own module so import sorters
3
+ // can't reorder the side-effect imports relative to each other.
4
+ import "@uipath/du-validation-station-wc/polyfills";
5
+ import "@uipath/du-validation-station-wc/main";
6
+ import "@uipath/du-validation-station-wc/styles.css";
7
+ export const VALIDATION_STATION_TAG = "ui-du-validation-station-standalone-wc-element";
8
+ export const validationStationWcReady = typeof window === "undefined"
9
+ ? Promise.resolve()
10
+ : window.customElements.whenDefined(VALIDATION_STATION_TAG).then(() => { });
11
+ //# sourceMappingURL=loadValidationStationWc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loadValidationStationWc.js","sourceRoot":"","sources":["../src/loadValidationStationWc.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,6EAA6E;AAC7E,gEAAgE;AAChE,OAAO,4CAA4C,CAAC;AACpD,OAAO,uCAAuC,CAAC;AAC/C,OAAO,6CAA6C,CAAC;AAErD,MAAM,CAAC,MAAM,sBAAsB,GACjC,gDAAgD,CAAC;AAEnD,MAAM,CAAC,MAAM,wBAAwB,GACnC,OAAO,MAAM,KAAK,WAAW;IAC3B,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE;IACnB,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,WAAW,CAAC,sBAAsB,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { IVsSaveValidatedDataRequest } from "@uipath/du-validation-station-wc";
2
+ import type { UiPath } from "@uipath/uipath-typescript/core";
3
+ import type { DuFramework } from "@uipath/uipath-typescript/document-understanding";
4
+ export interface SaveValidatedDataResult {
5
+ success: boolean;
6
+ error?: string;
7
+ }
8
+ export declare function saveValidatedData(sdk: UiPath, data: DuFramework.ContentValidationData, folderId: number, request: IVsSaveValidatedDataRequest): Promise<SaveValidatedDataResult>;
9
+ //# sourceMappingURL=saveValidatedDataUtil.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"saveValidatedDataUtil.d.ts","sourceRoot":"","sources":["../src/saveValidatedDataUtil.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAEpF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kDAAkD,CAAC;AAOpF,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAwED,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,WAAW,CAAC,qBAAqB,EACvC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,2BAA2B,GACnC,OAAO,CAAC,uBAAuB,CAAC,CA8BlC"}
@@ -0,0 +1,78 @@
1
+ import { BucketService } from "@uipath/uipath-typescript/buckets";
2
+ import { strToU8, zipSync } from "fflate";
3
+ const FOLDER_ID = "X-UIPATH-OrganizationUnitId";
4
+ const PROCESS_EXTRACTED_DATA_PATH = "orchestrator_/doc-understanding/DocumentModule/ProcessExtractedData";
5
+ function buildServiceUrl(sdk, path) {
6
+ const { baseUrl, orgName, tenantName } = sdk.config;
7
+ const base = baseUrl.replace(/\/+$/, "");
8
+ return `${base}/${orgName}/${tenantName}/${path}`;
9
+ }
10
+ async function processExtractedData(sdk, folderId, payload) {
11
+ const url = buildServiceUrl(sdk, PROCESS_EXTRACTED_DATA_PATH);
12
+ const token = sdk.getToken();
13
+ const headers = {
14
+ "Content-Type": "application/json",
15
+ [FOLDER_ID]: folderId.toString(),
16
+ Authorization: `Bearer ${token}`,
17
+ };
18
+ const response = await fetch(url, {
19
+ method: "POST",
20
+ headers,
21
+ body: JSON.stringify(payload),
22
+ });
23
+ if (!response.ok) {
24
+ const body = await response.text().catch(() => "");
25
+ throw new Error(`ProcessExtractedData failed (${response.status}): ${body}`);
26
+ }
27
+ return response.json();
28
+ }
29
+ async function uploadResultToBucket(bucketService, bucketId, folderId, path, data, documentId) {
30
+ // The bucket stores a .zip containing a single JSON file. The inner
31
+ // filename is derived from the upload path's basename (e.g.
32
+ // "results/output.zip" → "output.json"). If the path has no basename
33
+ // (e.g. "results/"), fall back to a documentId-scoped name so concurrent
34
+ // saves for different documents don't collide on the same inner key.
35
+ const fallbackFileName = documentId
36
+ ? `${documentId}/output_results.json`
37
+ : "output_results.json";
38
+ const basename = path.split("/").pop() ?? "";
39
+ const innerFileName = basename
40
+ ? basename.replace(/\.zip$/i, ".json")
41
+ : fallbackFileName;
42
+ const zipped = zipSync({ [innerFileName]: strToU8(JSON.stringify(data)) });
43
+ const blob = new Blob([new Uint8Array(zipped)], { type: "application/zip" });
44
+ const result = await bucketService.uploadFile({
45
+ bucketId,
46
+ folderId,
47
+ path,
48
+ content: blob,
49
+ });
50
+ if (!result.success) {
51
+ throw new Error(`Bucket upload failed with status ${result.statusCode}`);
52
+ }
53
+ }
54
+ export async function saveValidatedData(sdk, data, folderId, request) {
55
+ const { BucketId, ValidatedExtractionResultsPath, DocumentId } = data;
56
+ if (!BucketId || !folderId || !ValidatedExtractionResultsPath) {
57
+ return {
58
+ success: false,
59
+ error: "ContentValidationData is missing BucketId, FolderId, or ValidatedExtractionResultsPath.",
60
+ };
61
+ }
62
+ try {
63
+ const processedResult = await processExtractedData(sdk, folderId, {
64
+ AutomaticExtractedResults: request.automaticExtractionResult,
65
+ ValidatedExtractedResults: request.validatedData,
66
+ Taxonomy: request.taxonomy,
67
+ });
68
+ await uploadResultToBucket(new BucketService(sdk), BucketId, folderId, ValidatedExtractionResultsPath, processedResult, DocumentId);
69
+ return { success: true };
70
+ }
71
+ catch (error) {
72
+ return {
73
+ success: false,
74
+ error: error instanceof Error ? error.message : String(error),
75
+ };
76
+ }
77
+ }
78
+ //# sourceMappingURL=saveValidatedDataUtil.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"saveValidatedDataUtil.js","sourceRoot":"","sources":["../src/saveValidatedDataUtil.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAGlE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAE1C,MAAM,SAAS,GAAG,6BAA6B,CAAC;AAChD,MAAM,2BAA2B,GAC/B,qEAAqE,CAAC;AAOxE,SAAS,eAAe,CAAC,GAAW,EAAE,IAAY;IAChD,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,GAAG,CAAC,MAA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YAChE,yBAAyB,EAAE,OAAO,CAAC,yBAAyB;YAC5D,yBAAyB,EAAE,OAAO,CAAC,aAAa;YAChD,QAAQ,EAAE,OAAO,CAAC,QAAQ;SAC3B,CAAC,CAAC;QACH,MAAM,oBAAoB,CACxB,IAAI,aAAa,CAAC,GAAG,CAAC,EACtB,QAAQ,EACR,QAAQ,EACR,8BAA8B,EAC9B,eAAe,EACf,UAAU,CACX,CAAC;QACF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC3B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;SAC9D,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,55 @@
1
+ import type { DeleteFieldValueByPath, IValidationStationOptions, SelectAndFocusFieldValueByPath, SetFieldValueByPath } from "@uipath/du-validation-station-wc";
2
+ import type { UiPath } from "@uipath/uipath-typescript/core";
3
+ import type { DuFramework } from "@uipath/uipath-typescript/document-understanding";
4
+ import type { SaveValidatedDataResult } from "./saveValidatedDataUtil";
5
+ export type { DeleteFieldValueByPath, IValidationStationOptions, SaveValidatedDataResult, SelectAndFocusFieldValueByPath, SetFieldValueByPath, };
6
+ export declare enum ValidationStationLanguage {
7
+ German = "de",
8
+ English = "en",
9
+ Spanish = "es",
10
+ SpanishMexico = "es-MX",
11
+ French = "fr",
12
+ Japanese = "ja",
13
+ Korean = "ko",
14
+ Portuguese = "pt",
15
+ PortugueseBrazil = "pt-BR",
16
+ Romanian = "ro",
17
+ Russian = "ru",
18
+ Turkish = "tr",
19
+ ChineseSimplified = "zh-CN",
20
+ ChineseTraditional = "zh-TW"
21
+ }
22
+ export interface BucketArtifacts {
23
+ taxonomy: unknown;
24
+ extractionResult: unknown;
25
+ dom: unknown;
26
+ text: string | undefined;
27
+ customizationInfo: unknown;
28
+ original: string | undefined;
29
+ }
30
+ export interface ValidationStationProps {
31
+ sdk: UiPath;
32
+ data: DuFramework.ContentValidationData;
33
+ folderId?: number;
34
+ theme?: "light" | "dark" | "light-hc" | "dark-hc";
35
+ language?: ValidationStationLanguage;
36
+ isReadonly?: boolean;
37
+ enableSaveAsDraft?: boolean;
38
+ options?: IValidationStationOptions;
39
+ save?: {
40
+ validate: boolean;
41
+ };
42
+ discardChanges?: {
43
+ value: boolean;
44
+ };
45
+ setFieldValueByPath?: SetFieldValueByPath;
46
+ selectAndFocusFieldValueByPath?: SelectAndFocusFieldValueByPath;
47
+ deleteFieldValueByPath?: DeleteFieldValueByPath;
48
+ /**
49
+ * Fired after the save flow finishes (ProcessExtractedData + bucket upload).
50
+ * `result.success` is `false` on any failure — the host app decides whether
51
+ * to retry, complete the task, surface an error, etc.
52
+ */
53
+ onSaveComplete?: (result: SaveValidatedDataResult) => void;
54
+ }
55
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EACtB,yBAAyB,EACzB,8BAA8B,EAC9B,mBAAmB,EACpB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kDAAkD,CAAC;AACpF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAEvE,YAAY,EACV,sBAAsB,EACtB,yBAAyB,EACzB,uBAAuB,EACvB,8BAA8B,EAC9B,mBAAmB,GACpB,CAAC;AAEF,oBAAY,yBAAyB;IACnC,MAAM,OAAO;IACb,OAAO,OAAO;IACd,OAAO,OAAO;IACd,aAAa,UAAU;IACvB,MAAM,OAAO;IACb,QAAQ,OAAO;IACf,MAAM,OAAO;IACb,UAAU,OAAO;IACjB,gBAAgB,UAAU;IAC1B,QAAQ,OAAO;IACf,OAAO,OAAO;IACd,OAAO,OAAO;IACd,iBAAiB,UAAU;IAC3B,kBAAkB,UAAU;CAC7B;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,OAAO,CAAC;IAClB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,GAAG,EAAE,OAAO,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9B;AAED,MAAM,WAAW,sBAAsB;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,WAAW,CAAC,qBAAqB,CAAC;IACxC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,UAAU,GAAG,SAAS,CAAC;IAClD,QAAQ,CAAC,EAAE,yBAAyB,CAAC;IACrC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,OAAO,CAAC,EAAE,yBAAyB,CAAC;IACpC,IAAI,CAAC,EAAE;QAAE,QAAQ,EAAE,OAAO,CAAA;KAAE,CAAC;IAC7B,cAAc,CAAC,EAAE;QAAE,KAAK,EAAE,OAAO,CAAA;KAAE,CAAC;IACpC,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,8BAA8B,CAAC,EAAE,8BAA8B,CAAC;IAChE,sBAAsB,CAAC,EAAE,sBAAsB,CAAC;IAChD;;;;OAIG;IACH,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,uBAAuB,KAAK,IAAI,CAAC;CAC5D"}
package/dist/types.js ADDED
@@ -0,0 +1,18 @@
1
+ export var ValidationStationLanguage;
2
+ (function (ValidationStationLanguage) {
3
+ ValidationStationLanguage["German"] = "de";
4
+ ValidationStationLanguage["English"] = "en";
5
+ ValidationStationLanguage["Spanish"] = "es";
6
+ ValidationStationLanguage["SpanishMexico"] = "es-MX";
7
+ ValidationStationLanguage["French"] = "fr";
8
+ ValidationStationLanguage["Japanese"] = "ja";
9
+ ValidationStationLanguage["Korean"] = "ko";
10
+ ValidationStationLanguage["Portuguese"] = "pt";
11
+ ValidationStationLanguage["PortugueseBrazil"] = "pt-BR";
12
+ ValidationStationLanguage["Romanian"] = "ro";
13
+ ValidationStationLanguage["Russian"] = "ru";
14
+ ValidationStationLanguage["Turkish"] = "tr";
15
+ ValidationStationLanguage["ChineseSimplified"] = "zh-CN";
16
+ ValidationStationLanguage["ChineseTraditional"] = "zh-TW";
17
+ })(ValidationStationLanguage || (ValidationStationLanguage = {}));
18
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAkBA,MAAM,CAAN,IAAY,yBAeX;AAfD,WAAY,yBAAyB;IACnC,0CAAa,CAAA;IACb,2CAAc,CAAA;IACd,2CAAc,CAAA;IACd,oDAAuB,CAAA;IACvB,0CAAa,CAAA;IACb,4CAAe,CAAA;IACf,0CAAa,CAAA;IACb,8CAAiB,CAAA;IACjB,uDAA0B,CAAA;IAC1B,4CAAe,CAAA;IACf,2CAAc,CAAA;IACd,2CAAc,CAAA;IACd,wDAA2B,CAAA;IAC3B,yDAA4B,CAAA;AAC9B,CAAC,EAfW,yBAAyB,KAAzB,yBAAyB,QAepC"}
@@ -0,0 +1,8 @@
1
+ import type { DuFramework } from "@uipath/uipath-typescript/document-understanding";
2
+ import type { UiPath } from "@uipath/uipath-typescript/core";
3
+ import type { BucketArtifacts } from "./types";
4
+ export declare function useBucketArtifacts(sdk: UiPath, data: DuFramework.ContentValidationData, folderId: number | undefined): {
5
+ artifacts: BucketArtifacts | null;
6
+ error: string | null;
7
+ };
8
+ //# sourceMappingURL=useBucketArtifacts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useBucketArtifacts.d.ts","sourceRoot":"","sources":["../src/useBucketArtifacts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kDAAkD,CAAC;AAEpF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AAG7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,WAAW,CAAC,qBAAqB,EACvC,QAAQ,EAAE,MAAM,GAAG,SAAS;;;EA0C7B"}
@@ -0,0 +1,39 @@
1
+ import { BucketService } from "@uipath/uipath-typescript/buckets";
2
+ import { useEffect, useState, useRef } from "react";
3
+ import { fetchBucketArtifacts } from "./bucketArtifactsUtil";
4
+ export function useBucketArtifacts(sdk, data, folderId) {
5
+ const bucketServiceRef = useRef(new BucketService(sdk));
6
+ const [artifacts, setArtifacts] = useState(null);
7
+ const [error, setError] = useState(null);
8
+ const resolvedFolderId = folderId || data.FolderId;
9
+ useEffect(() => {
10
+ if (resolvedFolderId) {
11
+ let cancelled = false;
12
+ fetchBucketArtifacts(bucketServiceRef.current, data, resolvedFolderId)
13
+ .then((result) => {
14
+ if (!cancelled) {
15
+ setArtifacts(result);
16
+ setError(null);
17
+ }
18
+ })
19
+ .catch((er) => {
20
+ if (!cancelled) {
21
+ setArtifacts(null);
22
+ setError(er instanceof Error ? er.message : String(er));
23
+ }
24
+ });
25
+ return () => {
26
+ cancelled = true;
27
+ };
28
+ }
29
+ }, [data, resolvedFolderId]);
30
+ // Derive error for missing folderId at render time, not inside the effect
31
+ if (!resolvedFolderId) {
32
+ return {
33
+ artifacts: null,
34
+ error: "folderId of Storage bucket is required. Provide it as a prop or ensure data.FolderId is set.",
35
+ };
36
+ }
37
+ return { artifacts, error };
38
+ }
39
+ //# sourceMappingURL=useBucketArtifacts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useBucketArtifacts.js","sour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AC;YAEL,OAAO,GAAG,EAAE;gBACV,SAAS,GAAG,IAAI,CAAC;YACnB,CAAC,CAAC;QACJ,CAAC;IACH,CAAC,EAAE,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC,CAAC;IAE7B,0EAA0E;IAC1E,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACtB,OAAO;YACL,SAAS,EAAE,IAAI;YACf,KAAK,EACH,8FAA8F;SACjG,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;AAC9B,CAAC"}
package/package.json ADDED
@@ -0,0 +1,77 @@
1
+ {
2
+ "name": "@uipath/ui-widgets-validation-station",
3
+ "version": "1.0.1-beta.6",
4
+ "description": "A React component for UiPath Document Understanding Validation Station.",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.esm.js",
7
+ "types": "dist/index.d.ts",
8
+ "type": "module",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./dist/index.js",
12
+ "types": "./dist/index.d.ts"
13
+ },
14
+ "./ValidationStation.css": "./dist/ValidationStation.css"
15
+ },
16
+ "files": [
17
+ "dist"
18
+ ],
19
+ "scripts": {
20
+ "prepack": "rimraf *.tgz",
21
+ "build": "npm run clean && tsc",
22
+ "clean": "rimraf dist",
23
+ "copy-styles": "sass --no-source-map src/ValidationStation.scss | postcss -o dist/ValidationStation.css",
24
+ "test": "vitest --run",
25
+ "test:watch": "vitest",
26
+ "test:ui": "vitest --ui",
27
+ "test:coverage": "vitest --coverage --run"
28
+ },
29
+ "keywords": [
30
+ "react",
31
+ "validation-station",
32
+ "validation",
33
+ "ui-widgets"
34
+ ],
35
+ "author": "",
36
+ "license": "MIT",
37
+ "repository": {
38
+ "type": "git",
39
+ "url": "git+https://github.com/UiPath/uipath-ui-widgets.git",
40
+ "directory": "packages/validation-station"
41
+ },
42
+ "publishConfig": {
43
+ "registry": "https://npm.pkg.github.com"
44
+ },
45
+ "peerDependencies": {
46
+ "@uipath/uipath-typescript": "^1.3.9",
47
+ "react": "^19.2.0",
48
+ "react-dom": "^19.2.0"
49
+ },
50
+ "devDependencies": {
51
+ "@tailwindcss/oxide": "^4.1.18",
52
+ "@testing-library/dom": "^10.4.0",
53
+ "@testing-library/jest-dom": "^6.6.3",
54
+ "@testing-library/react": "^16.1.0",
55
+ "@testing-library/user-event": "^14.5.2",
56
+ "@types/react": "^19.2.5",
57
+ "@types/react-dom": "^19.2.3",
58
+ "@vitejs/plugin-react": "^5.1.1",
59
+ "@vitest/coverage-v8": "^4.0.18",
60
+ "@vitest/ui": "^4.0.18",
61
+ "jsdom": "^25.0.1",
62
+ "lightningcss": "^1.30.2",
63
+ "postcss": "^8.5.6",
64
+ "postcss-cli": "^11.0.1",
65
+ "rimraf": "^6.0.1",
66
+ "rollup": "^4.55.1",
67
+ "sass": "^1.83.4",
68
+ "typescript": "~5.9.3",
69
+ "vite": "^6.0.3",
70
+ "vitest": "^4.0.18"
71
+ },
72
+ "dependencies": {
73
+ "@uipath/apollo-wind": "^0.10.0",
74
+ "@uipath/du-validation-station-wc": "1.0.0-beta.2",
75
+ "fflate": "^0.8.2"
76
+ }
77
+ }