@box/metadata-editor 1.31.0 → 1.32.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.
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/metadata-instance-form.js +106 -101
- package/dist/esm/lib/components/metadata-instance-list/metadata-instance-list.js +27 -22
- package/dist/esm/lib/utils/confidence-score-context.js +24 -0
- package/dist/types/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/types.d.ts +1 -0
- package/dist/types/lib/components/metadata-instance-list/metadata-instance-list.d.ts +1 -1
- package/dist/types/lib/components/metadata-instance-list/types.d.ts +1 -0
- package/dist/types/lib/utils/confidence-score-context.d.ts +11 -0
- package/package.json +9 -9
|
@@ -1,143 +1,148 @@
|
|
|
1
1
|
import "../custom-instance-new-field/custom-instance-new-field.js";
|
|
2
|
-
import { DeleteConfirmationModal as
|
|
2
|
+
import { DeleteConfirmationModal as z } from "../delete-confirmation-modal/delete-confirmation-modal.js";
|
|
3
3
|
import "../metadata-instance-form-autofill-button/metadata-instance-form-autofill-button.js";
|
|
4
4
|
import "../metadata-instance-form-header/metadata-instance-form-header.js";
|
|
5
|
-
import
|
|
6
|
-
import { Formik as
|
|
7
|
-
import
|
|
8
|
-
import { useState as S, useEffect as y, useRef as O, useMemo as
|
|
9
|
-
import { TEMPLATE_CUSTOM_PROPERTIES as
|
|
10
|
-
import { useAutofill as
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
|
|
5
|
+
import G from "clsx";
|
|
6
|
+
import { Formik as H, Form as Q } from "formik";
|
|
7
|
+
import X from "lodash/isEqual";
|
|
8
|
+
import { useState as S, useEffect as y, useRef as O, useMemo as Y } from "react";
|
|
9
|
+
import { TEMPLATE_CUSTOM_PROPERTIES as Z } from "../../../../constants.js";
|
|
10
|
+
import { useAutofill as ee } from "../../../../utils/autofill-context.js";
|
|
11
|
+
import { ConfidenceScoreContextProvider as te } from "../../../../utils/confidence-score-context.js";
|
|
12
|
+
import { TemplateInstance as oe } from "../../../metadata-editor-fields/metadata-editor-fields.js";
|
|
13
|
+
import { MetadataEmptyState as ae } from "../../../metadata-empty-state/metadata-empty-state.js";
|
|
14
|
+
import { AutofillOverlay as ne } from "../autofill-overlay/autofill-overlay.js";
|
|
15
|
+
import { CustomInstance as se } from "../custom-instance/custom-instance.js";
|
|
16
|
+
import { c as re } from "../../../../../../chunks/utils.js";
|
|
17
|
+
import { s as d, M as ie } from "../../../../../../chunks/metadata-instance-form-card-wrapper.js";
|
|
18
|
+
import { jsx as t, jsxs as D } from "react/jsx-runtime";
|
|
19
|
+
import { UnsavedChangesModal as le } from "../../../unsaved-changes-modal/unsaved-changes-modal.js";
|
|
20
|
+
const me = ({
|
|
20
21
|
dirty: i,
|
|
21
22
|
onChange: l,
|
|
22
|
-
values:
|
|
23
|
+
values: o
|
|
23
24
|
}) => {
|
|
24
|
-
const s = O(
|
|
25
|
-
return i && !
|
|
26
|
-
},
|
|
25
|
+
const s = O(o);
|
|
26
|
+
return i && !X(s.current.metadata.fields, o.metadata.fields) && (s.current = o, l(o)), null;
|
|
27
|
+
}, Ae = (i) => {
|
|
27
28
|
const {
|
|
28
29
|
areAiSuggestionsAvailable: l,
|
|
29
|
-
customRef:
|
|
30
|
+
customRef: o,
|
|
30
31
|
isLargeFile: s,
|
|
31
32
|
errorCode: m,
|
|
32
33
|
isAiSuggestionsFeatureEnabled: c,
|
|
33
|
-
isAdvancedExtractAgentEnabled:
|
|
34
|
+
isAdvancedExtractAgentEnabled: v = !1,
|
|
34
35
|
isBetaLanguageEnabled: x,
|
|
35
|
-
isDeleteButtonDisabled:
|
|
36
|
-
isDeleteConfirmationModalCheckboxEnabled:
|
|
37
|
-
isMultilevelTaxonomyFieldEnabled:
|
|
36
|
+
isDeleteButtonDisabled: I,
|
|
37
|
+
isDeleteConfirmationModalCheckboxEnabled: A,
|
|
38
|
+
isMultilevelTaxonomyFieldEnabled: f,
|
|
38
39
|
isUnsavedChangesModalOpen: T = !1,
|
|
39
|
-
MetadataInstanceFormCustomWrapper:
|
|
40
|
+
MetadataInstanceFormCustomWrapper: R,
|
|
40
41
|
selectedTemplateInstance: e,
|
|
41
|
-
onCancel:
|
|
42
|
-
onChange:
|
|
43
|
-
onDelete:
|
|
44
|
-
onDiscardUnsavedChanges:
|
|
45
|
-
onSubmit:
|
|
42
|
+
onCancel: L,
|
|
43
|
+
onChange: p,
|
|
44
|
+
onDelete: P,
|
|
45
|
+
onDiscardUnsavedChanges: k,
|
|
46
|
+
onSubmit: N,
|
|
46
47
|
setIsUnsavedChangesModalOpen: u,
|
|
47
|
-
taxonomyOptionsFetcher: g
|
|
48
|
-
|
|
48
|
+
taxonomyOptionsFetcher: g,
|
|
49
|
+
isConfidenceScoreReviewEnabled: U = !1
|
|
50
|
+
} = i, w = R ?? ie, [B, C] = S(!1), {
|
|
49
51
|
isFetchingSuggestions: n,
|
|
50
|
-
isLongLoading:
|
|
51
|
-
getAiSuggestions:
|
|
52
|
+
isLongLoading: h,
|
|
53
|
+
getAiSuggestions: K,
|
|
52
54
|
clearState: E,
|
|
53
|
-
suggestions:
|
|
54
|
-
} =
|
|
55
|
+
suggestions: V
|
|
56
|
+
} = ee();
|
|
55
57
|
y(() => () => {
|
|
56
58
|
E();
|
|
57
59
|
}, [E, e?.id]);
|
|
58
|
-
const
|
|
59
|
-
await
|
|
60
|
-
},
|
|
61
|
-
a ? u(!0) :
|
|
62
|
-
},
|
|
63
|
-
|
|
64
|
-
},
|
|
60
|
+
const b = e?.templateKey === Z, W = async (a) => {
|
|
61
|
+
await N(a, re(a, e));
|
|
62
|
+
}, j = (a) => {
|
|
63
|
+
a ? u(!0) : L();
|
|
64
|
+
}, _ = () => {
|
|
65
|
+
C(!0);
|
|
66
|
+
}, $ = {
|
|
65
67
|
metadata: {
|
|
66
68
|
...e
|
|
67
69
|
}
|
|
68
|
-
},
|
|
70
|
+
}, F = O(null), [M, q] = S(null);
|
|
69
71
|
y(() => {
|
|
70
|
-
|
|
71
|
-
}, [
|
|
72
|
-
const
|
|
72
|
+
q(o ?? F.current);
|
|
73
|
+
}, [o, e?.templateKey, e?.scope]);
|
|
74
|
+
const J = Y(() => {
|
|
73
75
|
const a = e?.fields.length === 0;
|
|
74
|
-
if (
|
|
75
|
-
return /* @__PURE__ */
|
|
76
|
+
if (b)
|
|
77
|
+
return /* @__PURE__ */ t(se, {
|
|
76
78
|
isLoading: n
|
|
77
79
|
});
|
|
78
80
|
if (a)
|
|
79
|
-
return /* @__PURE__ */
|
|
81
|
+
return /* @__PURE__ */ t(ae, {
|
|
80
82
|
isBoxAiSuggestionsFeatureEnabled: c,
|
|
81
83
|
level: "instance"
|
|
82
84
|
});
|
|
83
85
|
const r = !!(n || m);
|
|
84
86
|
return /* @__PURE__ */ D("div", {
|
|
85
|
-
className:
|
|
86
|
-
children: [/* @__PURE__ */
|
|
87
|
+
className: G(d.metadataInstanceFormContent, r && d.showOverlay),
|
|
88
|
+
children: [/* @__PURE__ */ t(ne, {
|
|
87
89
|
errorCode: m,
|
|
88
90
|
isFetchingSuggestions: n,
|
|
89
|
-
isLongLoading:
|
|
90
|
-
}), /* @__PURE__ */
|
|
91
|
+
isLongLoading: h
|
|
92
|
+
}), /* @__PURE__ */ t(oe, {
|
|
91
93
|
disableForm: n,
|
|
92
|
-
isMultilevelTaxonomyFieldEnabled:
|
|
93
|
-
portalElement:
|
|
94
|
+
isMultilevelTaxonomyFieldEnabled: f,
|
|
95
|
+
portalElement: o ?? M,
|
|
94
96
|
taxonomyOptionsFetcher: g
|
|
95
97
|
})]
|
|
96
98
|
});
|
|
97
|
-
}, [e?.fields.length,
|
|
98
|
-
return /* @__PURE__ */
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
99
|
+
}, [e?.fields.length, b, n, h, o, M, g, c, f, m]);
|
|
100
|
+
return /* @__PURE__ */ t(te, {
|
|
101
|
+
isConfidenceScoreReviewEnabled: U,
|
|
102
|
+
children: /* @__PURE__ */ t(H, {
|
|
103
|
+
initialValues: $,
|
|
104
|
+
onSubmit: W,
|
|
105
|
+
children: ({
|
|
106
|
+
values: a,
|
|
107
|
+
dirty: r
|
|
108
|
+
}) => /* @__PURE__ */ D(Q, {
|
|
109
|
+
children: [/* @__PURE__ */ t(w, {
|
|
110
|
+
areAiSuggestionsAvailable: l,
|
|
111
|
+
className: d.metadataInstanceForm,
|
|
112
|
+
formRef: F,
|
|
113
|
+
formValues: a,
|
|
114
|
+
getAiSuggestions: K,
|
|
115
|
+
handleCancel: j,
|
|
116
|
+
handleDelete: _,
|
|
117
|
+
isAdvancedExtractAgentEnabled: v,
|
|
118
|
+
isAiSuggestionsFeatureEnabled: c,
|
|
119
|
+
isBetaLanguageEnabled: x,
|
|
120
|
+
isDeleteButtonDisabled: I,
|
|
121
|
+
isFetchingSuggestions: n,
|
|
122
|
+
isFormDirty: r,
|
|
123
|
+
isLargeFile: s,
|
|
124
|
+
selectedTemplateInstance: e,
|
|
125
|
+
suggestions: V,
|
|
126
|
+
children: e && J
|
|
127
|
+
}), p && /* @__PURE__ */ t(me, {
|
|
128
|
+
dirty: r,
|
|
129
|
+
onChange: p,
|
|
130
|
+
values: a
|
|
131
|
+
}), /* @__PURE__ */ t(le, {
|
|
132
|
+
onBackToEdit: () => u(!1),
|
|
133
|
+
onDiscardChanges: k,
|
|
134
|
+
open: T
|
|
135
|
+
}), /* @__PURE__ */ t(z, {
|
|
136
|
+
isCheckboxEnabled: A,
|
|
137
|
+
onConfirm: () => P(e),
|
|
138
|
+
onDismiss: () => C(!1),
|
|
139
|
+
open: B,
|
|
140
|
+
templateName: e?.displayName
|
|
141
|
+
})]
|
|
142
|
+
})
|
|
143
|
+
}, `${e?.scope}.${e?.templateKey}`)
|
|
144
|
+
});
|
|
140
145
|
};
|
|
141
146
|
export {
|
|
142
|
-
|
|
147
|
+
Ae as MetadataInstanceForm
|
|
143
148
|
};
|
|
@@ -1,29 +1,34 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { ConfidenceScoreContextProvider as d } from "../../utils/confidence-score-context.js";
|
|
2
|
+
import { getVisibleTemplates as f } from "../../utils/utils.js";
|
|
3
|
+
import { MetadataInstance as l } from "./subcomponents/metadata-instance/metadata-instance.js";
|
|
4
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
4
5
|
import "./subcomponents/metadata-instance-header/metadata-instance-header.js";
|
|
5
|
-
import '../../../../styles/metadata-instance-list.css';const p = "_metadataInstanceList_bd83w_1",
|
|
6
|
+
import '../../../../styles/metadata-instance-list.css';const p = "_metadataInstanceList_bd83w_1", I = {
|
|
6
7
|
metadataInstanceList: p
|
|
7
|
-
},
|
|
8
|
-
areAiSuggestionsAvailable:
|
|
9
|
-
isAiSuggestionsFeatureEnabled:
|
|
8
|
+
}, v = ({
|
|
9
|
+
areAiSuggestionsAvailable: e,
|
|
10
|
+
isAiSuggestionsFeatureEnabled: s,
|
|
10
11
|
isBetaLanguageEnabled: n,
|
|
11
12
|
onEdit: i,
|
|
12
|
-
templateInstances:
|
|
13
|
-
taxonomyNodeFetcher:
|
|
14
|
-
isAdvancedExtractAgentEnabled:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
13
|
+
templateInstances: o,
|
|
14
|
+
taxonomyNodeFetcher: r,
|
|
15
|
+
isAdvancedExtractAgentEnabled: m = !1,
|
|
16
|
+
isConfidenceScoreReviewEnabled: c = !1
|
|
17
|
+
}) => /* @__PURE__ */ t(d, {
|
|
18
|
+
isConfidenceScoreReviewEnabled: c,
|
|
19
|
+
children: /* @__PURE__ */ t("div", {
|
|
20
|
+
className: I.metadataInstanceList,
|
|
21
|
+
children: f(o).map((a) => /* @__PURE__ */ t(l, {
|
|
22
|
+
areAiSuggestionsAvailable: e,
|
|
23
|
+
isAdvancedExtractAgentEnabled: m,
|
|
24
|
+
isAiSuggestionsFeatureEnabled: s,
|
|
25
|
+
isBetaLanguageEnabled: n,
|
|
26
|
+
onEdit: i,
|
|
27
|
+
taxonomyNodeFetcher: r,
|
|
28
|
+
templateInstance: a
|
|
29
|
+
}, a.id))
|
|
30
|
+
})
|
|
26
31
|
});
|
|
27
32
|
export {
|
|
28
|
-
|
|
33
|
+
v as MetadataInstanceList
|
|
29
34
|
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { createContext as t, useMemo as c, useContext as s } from "react";
|
|
2
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
3
|
+
const r = /* @__PURE__ */ t(null), C = ({
|
|
4
|
+
children: e,
|
|
5
|
+
isConfidenceScoreReviewEnabled: o
|
|
6
|
+
}) => {
|
|
7
|
+
const n = c(() => ({
|
|
8
|
+
isConfidenceScoreReviewEnabled: o
|
|
9
|
+
}), [o]);
|
|
10
|
+
return /* @__PURE__ */ i(r.Provider, {
|
|
11
|
+
value: n,
|
|
12
|
+
children: e
|
|
13
|
+
});
|
|
14
|
+
}, f = () => {
|
|
15
|
+
const e = s(r);
|
|
16
|
+
if (!e)
|
|
17
|
+
throw new Error("useConfidenceScore should be wrapped inside ConfidenceScoreContextProvider");
|
|
18
|
+
return e;
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
r as ConfidenceScoreContext,
|
|
22
|
+
C as ConfidenceScoreContextProvider,
|
|
23
|
+
f as useIsConfidenceScoreReviewEnabled
|
|
24
|
+
};
|
|
@@ -26,6 +26,7 @@ export type MetadataInstanceFormProps = {
|
|
|
26
26
|
customRef?: HTMLDivElement | null;
|
|
27
27
|
MetadataInstanceFormCustomWrapper?: React.ComponentType<MetadataInstanceFormWrapperProps<null>>;
|
|
28
28
|
isAdvancedExtractAgentEnabled?: boolean;
|
|
29
|
+
isConfidenceScoreReviewEnabled?: boolean;
|
|
29
30
|
};
|
|
30
31
|
export type MetadataInstanceFormWrapperProps<T> = {
|
|
31
32
|
areAiSuggestionsAvailable: boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { MetadataInstanceListProps } from './types';
|
|
2
|
-
export declare const MetadataInstanceList: ({ areAiSuggestionsAvailable, isAiSuggestionsFeatureEnabled, isBetaLanguageEnabled, onEdit, templateInstances, taxonomyNodeFetcher, isAdvancedExtractAgentEnabled, }: MetadataInstanceListProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const MetadataInstanceList: ({ areAiSuggestionsAvailable, isAiSuggestionsFeatureEnabled, isBetaLanguageEnabled, onEdit, templateInstances, taxonomyNodeFetcher, isAdvancedExtractAgentEnabled, isConfidenceScoreReviewEnabled, }: MetadataInstanceListProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -5,6 +5,7 @@ export type MetadataInstanceListProps = {
|
|
|
5
5
|
isAiSuggestionsFeatureEnabled: boolean;
|
|
6
6
|
isBetaLanguageEnabled: boolean;
|
|
7
7
|
isAdvancedExtractAgentEnabled?: boolean;
|
|
8
|
+
isConfidenceScoreReviewEnabled?: boolean;
|
|
8
9
|
onEdit: (templateInstacne: MetadataTemplateInstance) => void;
|
|
9
10
|
templateInstances: MetadataTemplateInstance[];
|
|
10
11
|
taxonomyNodeFetcher: TaxonomyNodeFetcher;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface ConfidenceScoreContextType {
|
|
3
|
+
isConfidenceScoreReviewEnabled: boolean;
|
|
4
|
+
}
|
|
5
|
+
export interface ConfidenceScoreContextProviderProps {
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
isConfidenceScoreReviewEnabled: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const ConfidenceScoreContext: React.Context<ConfidenceScoreContextType>;
|
|
10
|
+
export declare const ConfidenceScoreContextProvider: ({ children, isConfidenceScoreReviewEnabled, }: ConfidenceScoreContextProviderProps) => React.ReactElement;
|
|
11
|
+
export declare const useIsConfidenceScoreReviewEnabled: () => ConfidenceScoreContextType;
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/metadata-editor",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.32.0",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@ariakit/react": "0.4.15",
|
|
6
|
-
"@box/box-ai-agent-selector": "^1.28.
|
|
7
|
-
"@box/blueprint-web": "^12.133.
|
|
8
|
-
"@box/blueprint-web-assets": "^4.99.
|
|
9
|
-
"@box/combobox-with-api": "^1.29.
|
|
6
|
+
"@box/box-ai-agent-selector": "^1.28.1",
|
|
7
|
+
"@box/blueprint-web": "^12.133.1",
|
|
8
|
+
"@box/blueprint-web-assets": "^4.99.8",
|
|
9
|
+
"@box/combobox-with-api": "^1.29.1",
|
|
10
10
|
"formik": "^2.0.3",
|
|
11
11
|
"lodash": "^4.17.15",
|
|
12
12
|
"react": "^17.0.0 || ^18.0.0",
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"@ariakit/react": "0.4.15",
|
|
18
|
-
"@box/box-ai-agent-selector": "^1.28.
|
|
18
|
+
"@box/box-ai-agent-selector": "^1.28.1",
|
|
19
19
|
"@box/babel-plugin-target-attributes": "1.4.0",
|
|
20
|
-
"@box/blueprint-web": "^12.133.
|
|
21
|
-
"@box/blueprint-web-assets": "^4.99.
|
|
22
|
-
"@box/storybook-utils": "^0.16.
|
|
20
|
+
"@box/blueprint-web": "^12.133.1",
|
|
21
|
+
"@box/blueprint-web-assets": "^4.99.8",
|
|
22
|
+
"@box/storybook-utils": "^0.16.34",
|
|
23
23
|
"@testing-library/react": "^15.0.6",
|
|
24
24
|
"react": "^18.3.0",
|
|
25
25
|
"react-dom": "^18.3.0",
|