@uipath/ui-widgets-validation-station 1.0.1 → 1.1.0

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 (73) hide show
  1. package/README.md +384 -191
  2. package/dist/ValidationStation.d.ts +12 -0
  3. package/dist/ValidationStation.d.ts.map +1 -1
  4. package/dist/ValidationStation.js +72 -49
  5. package/dist/ValidationStation.js.map +1 -1
  6. package/dist/ValidationStation.stories.d.ts.map +1 -1
  7. package/dist/ValidationStation.stories.js +30 -19
  8. package/dist/ValidationStation.stories.js.map +1 -1
  9. package/dist/bucketArtifactsUtil.d.ts +13 -3
  10. package/dist/bucketArtifactsUtil.d.ts.map +1 -1
  11. package/dist/bucketArtifactsUtil.js +42 -32
  12. package/dist/bucketArtifactsUtil.js.map +1 -1
  13. package/dist/index.d.ts +9 -4
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +7 -1
  16. package/dist/index.js.map +1 -1
  17. package/dist/loadValidationStationWc.d.ts +59 -7
  18. package/dist/loadValidationStationWc.d.ts.map +1 -1
  19. package/dist/loadValidationStationWc.js +81 -20
  20. package/dist/loadValidationStationWc.js.map +1 -1
  21. package/dist/saveHandlers.d.ts +19 -0
  22. package/dist/saveHandlers.d.ts.map +1 -0
  23. package/dist/saveHandlers.js +41 -0
  24. package/dist/saveHandlers.js.map +1 -0
  25. package/dist/saveValidatedDataUtil.d.ts +2 -2
  26. package/dist/saveValidatedDataUtil.d.ts.map +1 -1
  27. package/dist/saveValidatedDataUtil.js +32 -22
  28. package/dist/saveValidatedDataUtil.js.map +1 -1
  29. package/dist/subcomponents/CompactFieldsForm.d.ts +4 -4
  30. package/dist/subcomponents/CompactFieldsForm.d.ts.map +1 -1
  31. package/dist/subcomponents/CompactFieldsForm.js +8 -27
  32. package/dist/subcomponents/CompactFieldsForm.js.map +1 -1
  33. package/dist/subcomponents/shared.d.ts +3 -3
  34. package/dist/subcomponents/shared.d.ts.map +1 -1
  35. package/dist/subcomponents/shared.js.map +1 -1
  36. package/dist/subcomponents/types.d.ts +8 -54
  37. package/dist/subcomponents/types.d.ts.map +1 -1
  38. package/dist/subcomponents/useWcElement.d.ts +5 -6
  39. package/dist/subcomponents/useWcElement.d.ts.map +1 -1
  40. package/dist/subcomponents/useWcElement.js +2 -4
  41. package/dist/subcomponents/useWcElement.js.map +1 -1
  42. package/dist/types.d.ts +150 -31
  43. package/dist/types.d.ts.map +1 -1
  44. package/dist/types.js +15 -0
  45. package/dist/types.js.map +1 -1
  46. package/dist/urlUtil.d.ts +9 -0
  47. package/dist/urlUtil.d.ts.map +1 -0
  48. package/dist/urlUtil.js +11 -0
  49. package/dist/urlUtil.js.map +1 -0
  50. package/dist/useDuDocumentArtifacts.d.ts +12 -0
  51. package/dist/useDuDocumentArtifacts.d.ts.map +1 -0
  52. package/dist/useDuDocumentArtifacts.js +11 -0
  53. package/dist/useDuDocumentArtifacts.js.map +1 -0
  54. package/dist/useResolvedArtifacts.d.ts +41 -0
  55. package/dist/useResolvedArtifacts.d.ts.map +1 -0
  56. package/dist/{useSubcomponentArtifacts.js → useResolvedArtifacts.js} +24 -26
  57. package/dist/useResolvedArtifacts.js.map +1 -0
  58. package/dist/useWcReady.d.ts +7 -3
  59. package/dist/useWcReady.d.ts.map +1 -1
  60. package/dist/useWcReady.js +11 -3
  61. package/dist/useWcReady.js.map +1 -1
  62. package/dist/utils/telemetryUtils.d.ts +3 -0
  63. package/dist/utils/telemetryUtils.d.ts.map +1 -0
  64. package/dist/utils/telemetryUtils.js +10 -0
  65. package/dist/utils/telemetryUtils.js.map +1 -0
  66. package/package.json +2 -2
  67. package/dist/useBucketArtifacts.d.ts +0 -16
  68. package/dist/useBucketArtifacts.d.ts.map +0 -1
  69. package/dist/useBucketArtifacts.js +0 -19
  70. package/dist/useBucketArtifacts.js.map +0 -1
  71. package/dist/useSubcomponentArtifacts.d.ts +0 -44
  72. package/dist/useSubcomponentArtifacts.d.ts.map +0 -1
  73. package/dist/useSubcomponentArtifacts.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"useWcElement.d.ts","sourceRoot":"","sources":["../../src/subcomponents/useWcElement.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC5B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAGxD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,yEAAyE;AACzE,MAAM,WAAW,eAAe;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,yBAAyB,CAAC;IACrC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB;AAED,qEAAqE;AACrE,UAAU,aAAa;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;IACxC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,yBAAyB,CAAC;IACpC,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,cAAe,SAAQ,iBAAiB;IACvD,OAAO,EAAE,OAAO,CAAC;IACjB,uEAAuE;IACvE,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,aAAa,CAAC;CAC5B;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,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BAAiB,CAAC;IAC9B,MAAM,EAAE,eAAe,CAAC;CACzB,GAAG,cAAc,CA2BjB"}
@@ -1,5 +1,5 @@
1
1
  import { convertToPersistentTag } from "../loadValidationStationWc.js";
2
- import { useSubcomponentArtifacts, } from "../useSubcomponentArtifacts.js";
2
+ import { useResolvedArtifacts, } from "../useResolvedArtifacts.js";
3
3
  import { ValidationStationLanguage } from "../types.js";
4
4
  import { useWcReady } from "../useWcReady.js";
5
5
  import { wcStyle } from "./shared.js";
@@ -14,7 +14,7 @@ export function useWcElement(params) {
14
14
  const { baseTag, dataSource, common } = params;
15
15
  const persistent = common.persistent ?? false;
16
16
  const tag = persistent ? convertToPersistentTag(baseTag) : baseTag;
17
- const { artifacts, error, documentId, canPersist, resolvedFolderId } = useSubcomponentArtifacts(dataSource);
17
+ const { artifacts, error, documentId } = useResolvedArtifacts(dataSource);
18
18
  // Gate on the tag actually rendered, not always the base tag.
19
19
  const wcReady = useWcReady(tag);
20
20
  const commonProps = {
@@ -30,8 +30,6 @@ export function useWcElement(params) {
30
30
  artifacts,
31
31
  error,
32
32
  documentId,
33
- canPersist,
34
- resolvedFolderId,
35
33
  wcReady,
36
34
  tag,
37
35
  commonProps,
@@ -1 +1 @@
1
- {"version":3,"file":"useWcElement.js","sourceRoot":"","sources":["../../src/subcomponents/useWcElement.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EACL,wBAAwB,GAGzB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAgCtC;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,MAI5B;IACC,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IAC/C,MAA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EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IAC/C,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,IAAI,KAAK,CAAC;IAC9C,MAAM,GAAG,GAAG,UAAU,CAAC,CAAC,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;IAEnE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,oBAAoB,CAAC,UAAU,CAAC,CAAC;IAC1E,8DAA8D;IAC9D,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;IAEhC,MAAM,WAAW,GAAkB;QACjC,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC;QAC5B,aAAa,EAAE,MAAM,CAAC,UAAU;QAChC,UAAU;QACV,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,OAAO;QAC9B,QAAQ,EAAE,MAAM,CAAC,QAAQ,IAAI,yBAAyB,CAAC,OAAO;QAC9D,UAAU,EAAE,MAAM,CAAC,UAAU,IAAI,KAAK;KACvC,CAAC;IAEF,OAAO;QACL,SAAS;QACT,KAAK;QACL,UAAU;QACV,OAAO;QACP,GAAG;QACH,WAAW;KACZ,CAAC;AACJ,CAAC"}
package/dist/types.d.ts CHANGED
@@ -1,8 +1,21 @@
1
- import type { DeleteFieldValueByPath, IValidationStationOptions, SelectAndFocusFieldValueByPath, SetFieldValueByPath } from "@uipath/du-validation-station-wc";
2
- import type { UiPath } from "@uipath/uipath-typescript/core";
1
+ import type { DeleteFieldValueByPath, DeleteFieldValueByPathResult, EvaluatedBusinessRulesForFieldValueDto, IFieldValueDetailsDto, ISaveResult, IValidationStationOptions, IVsSaveExceptionReportRequest, IVsSaveValidatedDataAsDraftRequest, IVsSaveValidatedDataRequest, SelectAndFocusFieldValueByPath, SelectAndFocusFieldValueByPathResult, SetFieldValueByPath, SetFieldValueByPathResult } from "@uipath/du-validation-station-wc";
3
2
  import type { DuFramework } from "@uipath/uipath-typescript/document-understanding";
4
3
  import type { SaveValidatedDataResult } from "./saveValidatedDataUtil.js";
5
- export type { DeleteFieldValueByPath, IValidationStationOptions, SaveValidatedDataResult, SelectAndFocusFieldValueByPath, SetFieldValueByPath, };
4
+ import type { DuArtifactsSource } from "./useResolvedArtifacts.js";
5
+ export type { DeleteFieldValueByPath, DeleteFieldValueByPathResult, EvaluatedBusinessRulesForFieldValueDto, IFieldValueDetailsDto, ISaveResult, IValidationStationOptions, IVsSaveExceptionReportRequest, IVsSaveValidatedDataAsDraftRequest, IVsSaveValidatedDataRequest, SaveValidatedDataResult, SelectAndFocusFieldValueByPath, SelectAndFocusFieldValueByPathResult, SetFieldValueByPath, SetFieldValueByPathResult, };
6
+ export declare enum TelemetryEvent {
7
+ Load = "ValidationStation.Load",
8
+ /**
9
+ * One event per submit. Its status is the persistence outcome where the
10
+ * widget did the write-back, and the attempt where the host owns it.
11
+ */
12
+ Submit = "ValidationStation.Submit",
13
+ ExceptionRequest = "ValidationStation.ExceptionRequest"
14
+ }
15
+ export declare enum TelemetryStatus {
16
+ Success = "ValidationStation.Success",
17
+ Error = "ValidationStation.Error"
18
+ }
6
19
  export declare enum ValidationStationLanguage {
7
20
  German = "de",
8
21
  English = "en",
@@ -19,7 +32,33 @@ export declare enum ValidationStationLanguage {
19
32
  ChineseSimplified = "zh-CN",
20
33
  ChineseTraditional = "zh-TW"
21
34
  }
22
- export interface BucketArtifacts {
35
+ export type DuTheme = "light" | "dark" | "light-hc" | "dark-hc";
36
+ /**
37
+ * The inputs every DU element takes, whichever one you render — as opposed to
38
+ * the data, commands and outputs that differ between them.
39
+ */
40
+ export interface DuCommonProps {
41
+ theme?: DuTheme;
42
+ language?: ValidationStationLanguage;
43
+ /** Render the document without editing affordances. */
44
+ isReadonly?: boolean;
45
+ /**
46
+ * Render the persistent element variant, which survives portal/DOM
47
+ * detachment (e.g. tab switches) and is torn down via `forceDestroy()` when
48
+ * the React component unmounts. Defaults to `false`.
49
+ */
50
+ persistent?: boolean;
51
+ }
52
+ /**
53
+ * Everything the Validation Station elements need to render one document:
54
+ * the taxonomy, the extraction result to edit, the digitised document model,
55
+ * and the document itself.
56
+ *
57
+ * Storage-agnostic — `fetchDuDocumentArtifacts` produces one of these from an
58
+ * Orchestrator storage bucket, but a host holding the same pieces anywhere
59
+ * else can build one by hand and pass it as the `artifacts` prop.
60
+ */
61
+ export interface DuDocumentArtifacts {
23
62
  taxonomy: DuFramework.DocumentTaxonomy;
24
63
  extractionResult: DuFramework.ExtractionResult;
25
64
  dom: DuFramework.DocumentEntity;
@@ -27,13 +66,113 @@ export interface BucketArtifacts {
27
66
  customizationInfo: unknown;
28
67
  original: string | undefined;
29
68
  }
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;
69
+ /**
70
+ * The save flows every save-capable widget reports — `ValidationStation` and
71
+ * `CompactFieldsForm`. Both implement them identically, so a host swapping one
72
+ * for the other keeps its handlers.
73
+ */
74
+ export interface DuSaveCallbacks {
75
+ /**
76
+ * The user submitted (`save={{ validate: true }}`). Always fires, and always
77
+ * carries the request the web component produced.
78
+ *
79
+ * `result` is present only when the widget persisted the data itself, i.e.
80
+ * when it has `sdk` + `data` naming a folder. Otherwise the write-back
81
+ * is yours — the exported `submitValidatedData` does what the widget would
82
+ * have done for a bucket-backed document.
83
+ */
84
+ onSubmit?: (request: IVsSaveValidatedDataRequest, result?: SaveValidatedDataResult) => void;
85
+ /**
86
+ * The user saved a draft (`save={{ validate: false }}`). Same contract as
87
+ * {@link DuSaveCallbacks.onSubmit}; the host-side equivalent is
88
+ * `saveValidatedDataAsDraft`.
89
+ */
90
+ onSaveAsDraft?: (request: IVsSaveValidatedDataAsDraftRequest, result?: SaveValidatedDataResult) => void;
91
+ /**
92
+ * The user reported the document as an exception. The widget never persists
93
+ * this in either mode, so there is no `result` — the host owns it, typically
94
+ * via `OrchestratorDuModule.submitExceptionReport(...)`. The reason lives at
95
+ * `request.exceptionReport.Reason`.
96
+ */
97
+ onReportException?: (request: IVsSaveExceptionReportRequest) => void;
98
+ }
99
+ /**
100
+ * Callbacks for the edit/state events reported by the four widgets that share
101
+ * the Validation Station's extraction store: the full `ValidationStation`, the
102
+ * compact fields form, the table editor and the business-rules panel. One store
103
+ * means one set of events — an edit or selection driven through any of them
104
+ * reaches the others — so a host swapping one for another keeps its handlers.
105
+ *
106
+ * `DocumentViewer` (`loaded`, `selectAndFocusFieldValueByPathResult`) and
107
+ * `CompactDocTypeField` (`loaded`, `documentTypeChanged`) overlap on a few of
108
+ * these and declare them on their own props instead.
109
+ *
110
+ * Mirrors the web component's `IVsWcCommonStateEventMap`.
111
+ */
112
+ export interface VsStateEventProps {
113
+ /**
114
+ * The element finished loading. The path-addressed command props need the
115
+ * taxonomy and extraction result this signals, so gate them on it.
116
+ */
117
+ onLoaded?: (loaded: boolean) => void;
118
+ onDirtyChange?: (dirty: boolean) => void;
119
+ onDocumentTypeChanged?: (documentTypeId: string) => void;
120
+ /**
121
+ * Every change to the extraction result, i.e. the host's window onto the
122
+ * user's edits.
123
+ *
124
+ * Requires `options={{ emitDtoStateChanges: true }}`; the element defaults
125
+ * the flag to `false`.
126
+ */
127
+ onExtractionResultChanged?: (result: DuFramework.ExtractionResult) => void;
128
+ onFieldValueSelected?: (details: IFieldValueDetailsDto) => void;
129
+ onFieldValueChanged?: (details: IFieldValueDetailsDto) => void;
130
+ /** Field validation errors and business rules, re-evaluated. */
131
+ onBusinessRulesEvaluated?: (rules: EvaluatedBusinessRulesForFieldValueDto[]) => void;
132
+ /** Outcome of the `setFieldValueByPath` command. */
133
+ onSetFieldValueByPathResult?: (result: SetFieldValueByPathResult) => void;
134
+ /** Outcome of the `selectAndFocusFieldValueByPath` command. */
135
+ onSelectAndFocusFieldValueByPathResult?: (result: SelectAndFocusFieldValueByPathResult) => void;
136
+ /** Outcome of the `deleteFieldValueByPath` command. */
137
+ onDeleteFieldValueByPathResult?: (result: DeleteFieldValueByPathResult) => void;
138
+ }
139
+ /**
140
+ * Reported by the two widgets that have a `save` command: `ValidationStation`
141
+ * and `CompactFieldsForm`. Composed alongside {@link VsStateEventProps} rather
142
+ * than extending it, so the table editor and business-rules panel can take the
143
+ * state events on their own.
144
+ *
145
+ * Together the two make up the web component's `IVsWcCommonEventMap`.
146
+ */
147
+ export interface VsSaveResultEventProps {
148
+ /** Outcome of a `save` command. */
149
+ onSaveResult?: (result: ISaveResult) => void;
150
+ }
151
+ /**
152
+ * The output surface unique to the full `ValidationStation` element: overall
153
+ * validity plus the document-viewer panel layout. Mirrors the web component's
154
+ * `IVsWcSharedEventMap`.
155
+ */
156
+ export interface ValidationStationEventProps extends VsStateEventProps, VsSaveResultEventProps {
157
+ /**
158
+ * Validity changed. `true` when no critical (Must) business rule is broken and
159
+ * no field value fails validation — the element weighs both, and counts every
160
+ * validation error as Must.
161
+ */
162
+ onIsValidChange?: (isValid: boolean) => void;
163
+ /** The fields panel was resized. Detail is the width in pixels. */
164
+ onFieldsPanelWidthChanged?: (width: number) => void;
165
+ /** The fields panel moved to the other side of the document viewer. */
166
+ onFieldsPanelSideChanged?: (side: "left" | "right") => void;
167
+ }
168
+ /**
169
+ * Props for the monolithic `ValidationStation`.
170
+ *
171
+ * The document data comes from a {@link DuArtifactsSource}: either
172
+ * pre-fetched `artifacts` handed in directly, or `sdk` + `data` for the widget
173
+ * to fetch from the bucket paths on `ContentValidationData`.
174
+ */
175
+ export interface ValidationStationProps extends DuArtifactsSource, DuCommonProps, DuSaveCallbacks, ValidationStationEventProps {
37
176
  options?: IValidationStationOptions;
38
177
  save?: {
39
178
  validate: boolean;
@@ -44,25 +183,5 @@ export interface ValidationStationProps {
44
183
  setFieldValueByPath?: SetFieldValueByPath;
45
184
  selectAndFocusFieldValueByPath?: SelectAndFocusFieldValueByPath;
46
185
  deleteFieldValueByPath?: DeleteFieldValueByPath;
47
- /**
48
- * Fired after the submit flow (`save={{ validate: true }}`) finishes
49
- * (ProcessExtractedData + bucket upload). `result.success` is `false` on
50
- * any failure — the host app decides whether to retry, complete the task,
51
- * surface an error, etc.
52
- */
53
- onSubmitComplete?: (result: SaveValidatedDataResult) => void;
54
- /**
55
- * Fired after the save-as-draft flow (`save={{ validate: false }}`)
56
- * finishes (uploads `validatedData` straight to the bucket, no
57
- * `ProcessExtractedData` call).
58
- */
59
- onSaveAsDraftComplete?: (result: SaveValidatedDataResult) => void;
60
- /**
61
- * Fired when the user reports the document as an exception. The widget does
62
- * NOT call any API for this flow — the host owns persistence (typically a
63
- * `OrchestratorDuModule.submitExceptionReport(taskId, documentId, reason, ...)`
64
- * call).
65
- */
66
- onReportExceptionComplete?: (documentId: string, reason: string) => void;
67
186
  }
68
187
  //# sourceMappingURL=types.d.ts.map
@@ -1 +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,4BAA4B,CAAC;AAE1E,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;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KAAK,EAAE,OAAO,CAAA;KAAE,CAAC;IACpC,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,8BAA8B,CAAC,EAAE,8BAA8B,CAAC;IAChE,sBAAsB,CAAC,EAAE,sBAAsB,CAAC;CACjD"}
package/dist/types.js CHANGED
@@ -1,3 +1,18 @@
1
+ export var TelemetryEvent;
2
+ (function (TelemetryEvent) {
3
+ TelemetryEvent["Load"] = "ValidationStation.Load";
4
+ /**
5
+ * One event per submit. Its status is the persistence outcome where the
6
+ * widget did the write-back, and the attempt where the host owns it.
7
+ */
8
+ TelemetryEvent["Submit"] = "ValidationStation.Submit";
9
+ TelemetryEvent["ExceptionRequest"] = "ValidationStation.ExceptionRequest";
10
+ })(TelemetryEvent || (TelemetryEvent = {}));
11
+ export var TelemetryStatus;
12
+ (function (TelemetryStatus) {
13
+ TelemetryStatus["Success"] = "ValidationStation.Success";
14
+ TelemetryStatus["Error"] = "ValidationStation.Error";
15
+ })(TelemetryStatus || (TelemetryStatus = {}));
1
16
  export var ValidationStationLanguage;
2
17
  (function (ValidationStationLanguage) {
3
18
  ValidationStationLanguage["German"] = "de";
package/dist/types.js.map CHANGED
@@ -1 +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"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAuCA,MAAM,CAAN,IAAY,cAQX;AARD,WAAY,cAAc;IACxB,iDAA+B,CAAA;IAC/B;;;OAGG;IACH,qDAAmC,CAAA;IACnC,yEAAuD,CAAA;AACzD,CAAC,EARW,cAAc,KAAd,cAAc,QAQzB;AAED,MAAM,CAAN,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,wDAAqC,CAAA;IACrC,oDAAiC,CAAA;AACnC,CAAC,EAHW,eAAe,KAAf,eAAe,QAG1B;AAED,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,9 @@
1
+ /**
2
+ * Joins a base URL and a path segment with exactly one slash between them,
3
+ * regardless of whether `base` already ends in one or `path` already starts
4
+ * with one. Safe for joining a dynamic base — e.g. `getAppBase()`, which
5
+ * returns `/` locally but no trailing slash in production — with a fixed
6
+ * path segment without producing a doubled or missing slash.
7
+ */
8
+ export declare function joinDeploymentUrl(base: string, path: string): string;
9
+ //# sourceMappingURL=urlUtil.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"urlUtil.d.ts","sourceRoot":"","sources":["../src/urlUtil.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAEpE"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Joins a base URL and a path segment with exactly one slash between them,
3
+ * regardless of whether `base` already ends in one or `path` already starts
4
+ * with one. Safe for joining a dynamic base — e.g. `getAppBase()`, which
5
+ * returns `/` locally but no trailing slash in production — with a fixed
6
+ * path segment without producing a doubled or missing slash.
7
+ */
8
+ export function joinDeploymentUrl(base, path) {
9
+ return `${base.replace(/\/+$/, "")}/${path.replace(/^\/+/, "")}`;
10
+ }
11
+ //# sourceMappingURL=urlUtil.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"urlUtil.js","sourceRoot":"","sources":["../src/urlUtil.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAY,EAAE,IAAY;IAC1D,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC;AACnE,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { UiPath } from "@uipath/uipath-typescript/core";
2
+ import type { DuFramework } from "@uipath/uipath-typescript/document-understanding";
3
+ /**
4
+ * Fetches a document's artifacts from its storage bucket, tied to a component's
5
+ * lifecycle. The hook counterpart of `fetchDuDocumentArtifacts` — reach for that
6
+ * one when the fetch is not driven by render.
7
+ */
8
+ export declare function useDuDocumentArtifacts(sdk: UiPath, data: DuFramework.ContentValidationData): {
9
+ artifacts: import("./types.js").DuDocumentArtifacts | null;
10
+ error: string | null;
11
+ };
12
+ //# sourceMappingURL=useDuDocumentArtifacts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDuDocumentArtifacts.d.ts","sourceRoot":"","sources":["../src/useDuDocumentArtifacts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kDAAkD,CAAC;AAGpF;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,WAAW,CAAC,qBAAqB;;;EAIxC"}
@@ -0,0 +1,11 @@
1
+ import { useResolvedArtifacts } from "./useResolvedArtifacts.js";
2
+ /**
3
+ * Fetches a document's artifacts from its storage bucket, tied to a component's
4
+ * lifecycle. The hook counterpart of `fetchDuDocumentArtifacts` — reach for that
5
+ * one when the fetch is not driven by render.
6
+ */
7
+ export function useDuDocumentArtifacts(sdk, data) {
8
+ const { artifacts, error } = useResolvedArtifacts({ sdk, data });
9
+ return { artifacts, error };
10
+ }
11
+ //# sourceMappingURL=useDuDocumentArtifacts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDuDocumentArtifacts.js","sourceRoot":"","sources":["../src/useDuDocumentArtifacts.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CACpC,GAAW,EACX,IAAuC;IAEvC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,oBAAoB,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC;IACjE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;AAC9B,CAAC"}
@@ -0,0 +1,41 @@
1
+ import type { UiPath } from "@uipath/uipath-typescript/core";
2
+ import type { DuFramework } from "@uipath/uipath-typescript/document-understanding";
3
+ import { type DuDocumentArtifacts } from "./types.js";
4
+ /**
5
+ * Data source shared by `ValidationStation` and every subcomponent wrapper. Two
6
+ * mutually-exclusive modes:
7
+ *
8
+ * 1. **Pre-fetched** — pass `artifacts` (and usually `documentId`). No HTTP
9
+ * call is made. This is the composition mode: a parent fetches once and
10
+ * hands the same artifacts to a linked viewer + fields-form + table-editor,
11
+ * and the mode to use when the host already holds the taxonomy / extraction
12
+ * result / DOM in memory rather than in a storage bucket.
13
+ * 2. **Self-fetching** — pass `sdk` + `data`. The hook fetches the bucket
14
+ * artifacts itself from the paths on `data`, scoped to the folder `data`
15
+ * names.
16
+ */
17
+ export interface DuArtifactsSource {
18
+ /** SDK instance — required for self-fetching mode. */
19
+ sdk?: UiPath;
20
+ /**
21
+ * Content-validation descriptor — required for self-fetching mode. Carries
22
+ * the bucket paths and the folder they live in (`FolderId` or `FolderKey`).
23
+ */
24
+ data?: DuFramework.ContentValidationData;
25
+ /** Pre-fetched artifacts. When supplied, no fetch is performed. */
26
+ artifacts?: DuDocumentArtifacts;
27
+ /** Document id. Falls back to `data.DocumentId`. */
28
+ documentId?: string;
29
+ }
30
+ export interface ResolvedArtifacts {
31
+ artifacts: DuDocumentArtifacts | null;
32
+ error: string | null;
33
+ documentId: string | undefined;
34
+ }
35
+ /**
36
+ * Resolves the artifacts a widget needs — `ValidationStation` and every
37
+ * subcomponent alike — transparently handling both the pre-fetched and
38
+ * self-fetching modes described on {@link DuArtifactsSource}.
39
+ */
40
+ export declare function useResolvedArtifacts({ sdk, data, artifacts: provided, documentId, }: DuArtifactsSource): ResolvedArtifacts;
41
+ //# sourceMappingURL=useResolvedArtifacts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useResolvedArtifacts.d.ts","sourceRoot":"","sources":["../src/useResolvedArtifacts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kDAAkD,CAAC;AAGpF,OAAO,EACL,KAAK,mBAAmB,EAGzB,MAAM,YAAY,CAAC;AAGpB;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,iBAAiB;IAChC,sDAAsD;IACtD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC,qBAAqB,CAAC;IACzC,mEAAmE;IACnE,SAAS,CAAC,EAAE,mBAAmB,CAAC;IAChC,oDAAoD;IACpD,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACtC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,GAAG,EACH,IAAI,EACJ,SAAS,EAAE,QAAQ,EACnB,UAAU,GACX,EAAE,iBAAiB,GAAG,iBAAiB,CAoFvC"}
@@ -1,19 +1,21 @@
1
1
  import { BucketService } from "@uipath/uipath-typescript/buckets";
2
2
  import { useEffect, useRef, useState } from "react";
3
3
  import { fetchBucketArtifacts } from "./bucketArtifactsUtil.js";
4
+ import { TelemetryEvent, TelemetryStatus, } from "./types.js";
5
+ import { trackTelemetry } from "./utils/telemetryUtils.js";
4
6
  /**
5
- * Resolves the artifacts a subcomponent needs, transparently handling both the
6
- * pre-fetched and self-fetching modes described on {@link SubcomponentDataSource}.
7
+ * Resolves the artifacts a widget needs — `ValidationStation` and every
8
+ * subcomponent alike — transparently handling both the pre-fetched and
9
+ * self-fetching modes described on {@link DuArtifactsSource}.
7
10
  */
8
- export function useSubcomponentArtifacts({ sdk, data, folderId, artifacts: provided, documentId, }) {
11
+ export function useResolvedArtifacts({ sdk, data, artifacts: provided, documentId, }) {
9
12
  const [fetched, setFetched] = useState(null);
10
13
  const [error, setError] = useState(null);
11
- const resolvedFolderId = folderId ?? data?.FolderId;
12
14
  const resolvedDocumentId = documentId ?? data?.DocumentId;
13
- const canPersist = !!sdk && !!data && !!resolvedFolderId;
15
+ const hasFolder = !!(data?.FolderKey || data?.FolderId);
14
16
  // Fetch only when the caller did not supply artifacts and a full context is
15
- // present (the missing-folderId case is surfaced at render).
16
- const shouldFetch = !provided && canPersist;
17
+ // present (the missing-folder case is surfaced at render).
18
+ const shouldFetch = !provided && !!sdk && !!data && hasFolder;
17
19
  // Keep the latest sdk reachable so each fetch uses the current instance (token
18
20
  // refresh / tenant switch) without making sdk identity a fetch trigger.
19
21
  const sdkRef = useRef(sdk);
@@ -27,35 +29,37 @@ export function useSubcomponentArtifacts({ sdk, data, folderId, artifacts: provi
27
29
  // Build the service from the CURRENT sdk on each fetch — caching it in a ref
28
30
  // would pin the original sdk's auth/base URL.
29
31
  const bucketService = new BucketService(sdkRef.current);
30
- fetchBucketArtifacts(bucketService, data, resolvedFolderId)
32
+ fetchBucketArtifacts(bucketService, data)
31
33
  .then((result) => {
32
34
  if (!cancelled) {
33
35
  setFetched(result);
34
36
  setError(null);
37
+ trackTelemetry(TelemetryEvent.Load, TelemetryStatus.Success);
35
38
  }
36
39
  })
37
40
  .catch((er) => {
38
41
  if (!cancelled) {
42
+ const message = er instanceof Error ? er.message : String(er);
39
43
  setFetched(null);
40
- setError(er instanceof Error ? er.message : String(er));
44
+ setError(message);
45
+ trackTelemetry(TelemetryEvent.Load, TelemetryStatus.Error, {
46
+ error: message,
47
+ });
41
48
  }
42
49
  });
43
50
  return () => {
44
51
  cancelled = true;
45
52
  };
46
- // Keyed on `data` identity (as useBucketArtifacts always has) + folder: the
47
- // fetch reads the bucket PATH fields off `data`, not just DocumentId, so a
48
- // new payload with the same DocumentId but different paths must refetch.
49
- // Callers pass a stable `data` reference (React state) so this does not
50
- // refetch on unrelated re-renders.
51
- }, [shouldFetch, data, resolvedFolderId]);
53
+ // Keyed on `data` identity: the fetch reads the bucket PATH fields off it,
54
+ // not just DocumentId, so a new payload with the same DocumentId but
55
+ // different paths must refetch. Callers pass a stable `data` reference
56
+ // (React state) so this does not refetch on unrelated re-renders.
57
+ }, [shouldFetch, data]);
52
58
  if (provided) {
53
59
  return {
54
60
  artifacts: provided,
55
61
  error: null,
56
62
  documentId: resolvedDocumentId,
57
- canPersist,
58
- resolvedFolderId,
59
63
  };
60
64
  }
61
65
  if (!sdk || !data) {
@@ -63,25 +67,19 @@ export function useSubcomponentArtifacts({ sdk, data, folderId, artifacts: provi
63
67
  artifacts: null,
64
68
  error: "No data source provided. Pass `artifacts` (pre-fetched) or `sdk` + `data` (to fetch).",
65
69
  documentId: resolvedDocumentId,
66
- canPersist,
67
- resolvedFolderId,
68
70
  };
69
71
  }
70
- if (!resolvedFolderId) {
72
+ if (!hasFolder) {
71
73
  return {
72
74
  artifacts: null,
73
- error: "folderId of Storage bucket is required. Provide it as a prop or ensure data.FolderId is set.",
75
+ error: "ContentValidationData must carry FolderId or FolderKey (the storage bucket's folder).",
74
76
  documentId: resolvedDocumentId,
75
- canPersist,
76
- resolvedFolderId,
77
77
  };
78
78
  }
79
79
  return {
80
80
  artifacts: fetched,
81
81
  error,
82
82
  documentId: resolvedDocumentId,
83
- canPersist,
84
- resolvedFolderId,
85
83
  };
86
84
  }
87
- //# sourceMappingURL=useSubcomponentArtifacts.js.map
85
+ //# sourceMappingURL=useResolvedArtifacts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useResolvedArtifacts.js","sourceRoot":"","sources":["../src/useResolvedArtifacts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAGlE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAEL,cAAc,EACd,eAAe,GAChB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAmC3D;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,EACnC,GAAG,EACH,IAAI,EACJ,SAAS,EAAE,QAAQ,EACnB,UAAU,GACQ;IAClB,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAA6B,IAAI,CAAC,CAAC;IACzE,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IAExD,MAAM,kBAAkB,GAAG,UAAU,IAAI,IAAI,EAAE,UAAU,CAAC;IAC1D,MAAM,SAAS,GAAG,CAAC,CAAC,CAAC,IAAI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,KAAK,EAAE;oBACzD,KAAK,EAAE,OAAO;iBACf,CAAC,CAAC;YACL,CAAC;QACH,CAAC,CAAC,CAAC;QAEL,OAAO,GAAG,EAAE;YACV,SAAS,GAAG,IAAI,CAAC;QACnB,CAAC,CAAC;QACF,2EAA2E;QAC3E,qEAAqE;QACrE,uEAAuE;QACvE,kEAAkE;IACpE,CAAC,EAAE,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC;IAExB,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO;YACL,SAAS,EAAE,QAAQ;YACnB,KAAK,EAAE,IAAI;YACX,UAAU,EAAE,kBAAkB;SAC/B,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QAClB,OAAO;YACL,SAAS,EAAE,IAAI;YACf,KAAK,EACH,uFAAuF;YACzF,UAAU,EAAE,kBAAkB;SAC/B,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO;YACL,SAAS,EAAE,IAAI;YACf,KAAK,EACH,uFAAuF;YACzF,UAAU,EAAE,kBAAkB;SAC/B,CAAC;IACJ,CAAC;IAED,OAAO;QACL,SAAS,EAAE,OAAO;QAClB,KAAK;QACL,UAAU,EAAE,kBAAkB;KAC/B,CAAC;AACJ,CAAC"}
@@ -1,8 +1,12 @@
1
1
  /**
2
2
  * Returns `true` once the custom element for `tag` has been defined by the
3
- * browser's element registry. All standalone DU elements are registered by the
4
- * same `main` import (side-effect of importing `loadValidationStationWc`), so
5
- * this only waits for the requested tag to upgrade.
3
+ * browser's element registry. All standalone DU elements come from the same
4
+ * bundle loaded by `configureValidationStationWc`, so this waits for that load
5
+ * and then for the requested tag to upgrade.
6
+ *
7
+ * Stays `false` if the bundle fails to load — the load error itself surfaces on
8
+ * the promise returned by `configureValidationStationWc`, which is where the
9
+ * host app should handle it.
6
10
  */
7
11
  export declare function useWcReady(tag: string): boolean;
8
12
  //# sourceMappingURL=useWcReady.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useWcReady.d.ts","sourceRoot":"","sources":["../src/useWcReady.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAc/C"}
1
+ {"version":3,"file":"useWcReady.d.ts","sourceRoot":"","sources":["../src/useWcReady.ts"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAwB/C"}
@@ -2,9 +2,13 @@ import { useEffect, useState } from "react";
2
2
  import { waitForWcElementReady } from "./loadValidationStationWc.js";
3
3
  /**
4
4
  * Returns `true` once the custom element for `tag` has been defined by the
5
- * browser's element registry. All standalone DU elements are registered by the
6
- * same `main` import (side-effect of importing `loadValidationStationWc`), so
7
- * this only waits for the requested tag to upgrade.
5
+ * browser's element registry. All standalone DU elements come from the same
6
+ * bundle loaded by `configureValidationStationWc`, so this waits for that load
7
+ * and then for the requested tag to upgrade.
8
+ *
9
+ * Stays `false` if the bundle fails to load — the load error itself surfaces on
10
+ * the promise returned by `configureValidationStationWc`, which is where the
11
+ * host app should handle it.
8
12
  */
9
13
  export function useWcReady(tag) {
10
14
  const [ready, setReady] = useState(false);
@@ -13,6 +17,10 @@ export function useWcReady(tag) {
13
17
  waitForWcElementReady(tag).then(() => {
14
18
  if (!cancelled)
15
19
  setReady(true);
20
+ }, (error) => {
21
+ // Logged, not thrown: a rejection here would surface as an unhandled
22
+ // promise rejection from inside an effect.
23
+ console.error(`[validation-station] web component failed to load; <${tag}> will not render.`, error);
16
24
  });
17
25
  return () => {
18
26
  cancelled = true;
@@ -1 +1 @@
1
- {"version":3,"file":"useWcReady.js","sourceRoot":"","sources":["../src/useWcReady.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,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S,GAAG,IAAI,CAAC;QACnB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAEV,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { TelemetryEvent, TelemetryStatus } from "../types.js";
2
+ export declare const trackTelemetry: (event: TelemetryEvent, status: TelemetryStatus, properties?: Record<string, string | number | boolean>) => void;
3
+ //# sourceMappingURL=telemetryUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"telemetryUtils.d.ts","sourceRoot":"","sources":["../../src/utils/telemetryUtils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9D,eAAO,MAAM,cAAc,GACzB,OAAO,cAAc,EACrB,QAAQ,eAAe,EACvB,aAAa,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,SAOvD,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { trackEvent } from "@uipath/uipath-typescript/core";
2
+ import { version } from "../../package.json";
3
+ export const trackTelemetry = (event, status, properties) => {
4
+ trackEvent(event, status, {
5
+ ApplicationName: "Widget.ValidationStation",
6
+ WidgetVersion: version,
7
+ ...properties,
8
+ });
9
+ };
10
+ //# sourceMappingURL=telemetryUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"telemetryUtils.js","sourceRoot":"","sources":["../../src/utils/telemetryUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAG7C,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,KAAqB,EACrB,MAAuB,EACvB,UAAsD,EACtD,EAAE;IACF,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE;QACxB,eAAe,EAAE,0BAA0B;QAC3C,aAAa,EAAE,OAAO;QACtB,GAAG,UAAU;KACd,CAAC,CAAC;AACL,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipath/ui-widgets-validation-station",
3
- "version": "1.0.1",
3
+ "version": "1.1.0",
4
4
  "description": "A React component for UiPath Document Understanding Validation Station.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",
@@ -66,7 +66,7 @@
66
66
  "vitest": "^4.0.18"
67
67
  },
68
68
  "dependencies": {
69
- "@uipath/apollo-wind": "^0.10.0",
69
+ "@uipath/du-utils": "^1.0.0-rc.1",
70
70
  "@uipath/du-validation-station-wc": "1.0.0-rc.1",
71
71
  "fflate": "^0.8.2"
72
72
  }