@box/metadata-editor 1.67.6 → 1.69.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/chunks/ai-suggestion-field.js +77 -60
- package/dist/chunks/interactive-text.module.js +5 -0
- package/dist/chunks/metadata-instance-content.js +36 -24
- package/dist/chunks/metadata-instance-entry.js +61 -52
- package/dist/chunks/metadata-instance-form-autofill-button.js +5 -5
- package/dist/chunks/metadata-instance-form-card-wrapper.js +6 -6
- package/dist/chunks/metadata-instance-form-footer.js +1 -1
- package/dist/chunks/metadata-instance-form-header.js +8 -8
- package/dist/chunks/metadata-instance-header.js +4 -4
- package/dist/chunks/utils.js +67 -37
- package/dist/esm/index.js +12 -15
- package/dist/esm/lib/components/interactive-text/interactive-text.js +18 -2
- package/dist/esm/lib/components/metadata-editor-fields/components/ai-logo-badge/ai-logo-badge.js +19 -16
- package/dist/esm/lib/components/metadata-editor-fields/components/low-confidence-badge/low-confidence-badge.js +20 -17
- package/dist/esm/lib/components/metadata-editor-fields/components/low-confidence-suggestion-field/low-confidence-suggestion-field.js +4 -4
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-string-field/metadata-string-field.js +1 -1
- package/dist/esm/lib/components/metadata-editor-fields/metadata-editor-field-wrapper.js +13 -12
- package/dist/esm/lib/components/metadata-instance-editor/index.js +9 -7
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/metadata-instance-form.js +86 -84
- package/dist/esm/lib/components/metadata-instance-list/index.js +6 -4
- package/dist/esm/lib/components/metadata-instance-review-notice/metadata-instance-review-notice.js +1 -0
- package/dist/esm/lib/components/unsaved-changes-modal/unsaved-changes-modal.js +34 -31
- package/dist/esm/lib/utils/analytics/analytics-context.js +11 -0
- package/dist/esm/lib/utils/analytics/events.js +9 -0
- package/dist/esm/lib/utils/analytics/index.js +4 -0
- package/dist/esm/lib/utils/analytics/with-analytics.js +11 -0
- package/dist/esm/lib/utils/confidence-score/index.js +5 -5
- package/dist/i18n/en-x-pseudo.js +156 -156
- package/dist/i18n/en-x-pseudo.properties +156 -156
- package/dist/styles/interactive-text.css +1 -1
- package/dist/styles/utils.css +1 -1
- package/dist/types/lib/components/metadata-instance-editor/index.d.ts +6 -1
- package/dist/types/lib/components/metadata-instance-list/index.d.ts +12 -2
- package/dist/types/lib/components/unsaved-changes-modal/types.d.ts +7 -0
- package/dist/types/lib/components/unsaved-changes-modal/unsaved-changes-modal.d.ts +1 -1
- package/dist/types/lib/test-utils/index.d.ts +1 -0
- package/dist/types/lib/test-utils/mock-resize-observer.d.ts +5 -0
- package/dist/types/lib/utils/analytics/analytics-context.d.ts +12 -0
- package/dist/types/lib/utils/analytics/events.d.ts +9 -0
- package/dist/types/lib/utils/analytics/index.d.ts +3 -0
- package/dist/types/lib/utils/analytics/with-analytics.d.ts +8 -0
- package/package.json +4 -4
- package/dist/chunks/interactive-text.js +0 -17
package/dist/chunks/utils.js
CHANGED
|
@@ -1,53 +1,83 @@
|
|
|
1
1
|
import { isConfidenceScoreNeedingReview as e } from "../esm/lib/utils/confidence-score/is-confidence-score-needing-review.js";
|
|
2
2
|
import { convertISOStringtoRFC3339String as t } from "../esm/lib/utils/convertDate.js";
|
|
3
|
-
import { t as n } from "./interactive-text.js";
|
|
3
|
+
import { t as n } from "./interactive-text.module.js";
|
|
4
4
|
import { AiLogoBadge as r } from "../esm/lib/components/metadata-editor-fields/components/ai-logo-badge/ai-logo-badge.js";
|
|
5
5
|
import { LowConfidenceBadge as i } from "../esm/lib/components/metadata-editor-fields/components/low-confidence-badge/low-confidence-badge.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
children: [
|
|
30
|
-
|
|
31
|
-
className:
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
6
|
+
import { Tooltip as a, useForkRef as o, useIsEllipsized as s } from "@box/blueprint-web";
|
|
7
|
+
import { createElement as c, memo as l, useRef as u } from "react";
|
|
8
|
+
import { Focusable as d } from "@ariakit/react";
|
|
9
|
+
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
10
|
+
import m from "clsx";
|
|
11
|
+
import '../styles/utils.css';var h = {
|
|
12
|
+
noAttributesText: "_noAttributesText_19lyy_2",
|
|
13
|
+
fieldWrapper: "_fieldWrapper_19lyy_6",
|
|
14
|
+
hasSuggestion: "_hasSuggestion_19lyy_11",
|
|
15
|
+
hasConfidenceReview: "_hasConfidenceReview_19lyy_16",
|
|
16
|
+
error: "_error_19lyy_25",
|
|
17
|
+
dateField: "_dateField_19lyy_44",
|
|
18
|
+
aiApproved: "_aiApproved_19lyy_49",
|
|
19
|
+
comboboxContainer: "_comboboxContainer_19lyy_49",
|
|
20
|
+
labelWrapper: "_labelWrapper_19lyy_95",
|
|
21
|
+
labelText: "_labelText_19lyy_101",
|
|
22
|
+
labelTruncated: "_labelTruncated_19lyy_104",
|
|
23
|
+
labelIcon: "_labelIcon_19lyy_111",
|
|
24
|
+
labelTooltipStack: "_labelTooltipStack_19lyy_118"
|
|
25
|
+
};
|
|
26
|
+
function g({ as: e, fieldDescription: t, fieldName: r, labelClassName: i, labelRef: l, ...h }) {
|
|
27
|
+
let g = u(null), _ = o(g, l);
|
|
28
|
+
return /* @__PURE__ */ f(a, {
|
|
29
|
+
content: s(g) ? /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("div", { children: r }), /* @__PURE__ */ f("div", { children: t })] }) : t,
|
|
30
|
+
children: /* @__PURE__ */ f(d, { render: /* @__PURE__ */ c(e, {
|
|
31
|
+
className: m(i, n.interactiveTextHint),
|
|
32
|
+
...h,
|
|
33
|
+
ref: _
|
|
34
|
+
}, r) })
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function _({ as: e, fieldName: t, labelClassName: n, labelRef: r, ...i }) {
|
|
38
|
+
let l = u(null), p = o(l, r), m = s(l) ? t : void 0, h = /* @__PURE__ */ c(e, {
|
|
39
|
+
className: n,
|
|
40
|
+
...i,
|
|
41
|
+
ref: p
|
|
42
|
+
}, t);
|
|
43
|
+
return m ? /* @__PURE__ */ f(a, {
|
|
44
|
+
content: m,
|
|
45
|
+
children: /* @__PURE__ */ f(d, { render: h })
|
|
46
|
+
}) : h;
|
|
47
|
+
}
|
|
48
|
+
var v = /* @__PURE__ */ l(function({ fieldName: t, fieldDescription: n, isAiSuggestionApplied: a, as: o, confidenceScore: s, labelProps: c }) {
|
|
49
|
+
let { className: l, ref: u, ...d } = c, v = m(l || h.labelText, h.labelTruncated), y = !!s && e(s), b = () => s && y ? /* @__PURE__ */ f(i, {}) : a || s ? /* @__PURE__ */ f(r, {
|
|
50
|
+
className: h.labelIcon,
|
|
51
|
+
confidenceScore: s
|
|
52
|
+
}) : null, x = n ? /* @__PURE__ */ f(g, {
|
|
53
|
+
as: o,
|
|
54
|
+
fieldDescription: n,
|
|
55
|
+
fieldName: t,
|
|
56
|
+
labelClassName: v,
|
|
57
|
+
labelRef: u,
|
|
58
|
+
...d
|
|
59
|
+
}) : /* @__PURE__ */ f(_, {
|
|
60
|
+
as: o,
|
|
61
|
+
fieldName: t,
|
|
62
|
+
labelClassName: v,
|
|
63
|
+
labelRef: u,
|
|
64
|
+
...d
|
|
65
|
+
});
|
|
66
|
+
return /* @__PURE__ */ p("div", {
|
|
67
|
+
className: h.labelWrapper,
|
|
68
|
+
children: [x, b()]
|
|
39
69
|
});
|
|
40
70
|
}, (e, t) => {
|
|
41
71
|
let n = e.labelProps, r = t.labelProps;
|
|
42
72
|
return e.fieldName === t.fieldName && e.fieldDescription === t.fieldDescription && e.isAiSuggestionApplied === t.isAiSuggestionApplied && e.confidenceScore === t.confidenceScore && e.as === t.as && n.className === r.className && n.htmlFor === r.htmlFor && n.id === r.id;
|
|
43
|
-
}),
|
|
73
|
+
}), y = (e, t, n = !1, r = "label", i) => (a) => /* @__PURE__ */ f(v, {
|
|
44
74
|
as: r,
|
|
45
75
|
confidenceScore: i,
|
|
46
76
|
fieldDescription: t,
|
|
47
77
|
fieldName: e,
|
|
48
78
|
isAiSuggestionApplied: n,
|
|
49
79
|
labelProps: a
|
|
50
|
-
}),
|
|
80
|
+
}), b = (e) => {
|
|
51
81
|
try {
|
|
52
82
|
let n = t(e), r = new Date(n);
|
|
53
83
|
return isNaN(r.getTime()) ? null : n;
|
|
@@ -55,4 +85,4 @@ import '../styles/utils.css';var u = {
|
|
|
55
85
|
return null;
|
|
56
86
|
}
|
|
57
87
|
};
|
|
58
|
-
export {
|
|
88
|
+
export { b as n, h as r, y as t };
|
package/dist/esm/index.js
CHANGED
|
@@ -7,21 +7,18 @@ import { t as r } from "../chunks/filter-instances-dropdown.js";
|
|
|
7
7
|
import "./lib/components/filter-instances-dropdown/index.js";
|
|
8
8
|
import { MULTI_VALUE_DEFAULT_OPTION as i, MULTI_VALUE_DEFAULT_TAXONOMY_OPTION as a, MULTI_VALUE_DEFAULT_VALUE as o } from "./lib/components/metadata-editor-fields/components/update-mode-field-wrapper/mulitple-values-utils.js";
|
|
9
9
|
import { MetadataEmptyState as s } from "./lib/components/metadata-empty-state/metadata-empty-state.js";
|
|
10
|
-
import {
|
|
11
|
-
import { t as
|
|
12
|
-
import {
|
|
13
|
-
import { t as
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import { MetadataInstanceForm as x } from "./lib/components/metadata-instance-editor/
|
|
19
|
-
import "
|
|
20
|
-
import {
|
|
21
|
-
import { t as C } from "../chunks/metadata-instance-header.js";
|
|
22
|
-
import { t as w } from "../chunks/metadata-instance.js";
|
|
23
|
-
import "./lib/components/metadata-instance-list/index.js";
|
|
10
|
+
import { AutofillContext as c, AutofillContextProvider as l, TIMEOUT_10_SECONDS as u, useAutofill as d } from "./lib/utils/autofill-context.js";
|
|
11
|
+
import { n as f, r as p, t as m } from "../chunks/types.js";
|
|
12
|
+
import { UnsavedChangesModal as h } from "./lib/components/unsaved-changes-modal/unsaved-changes-modal.js";
|
|
13
|
+
import { t as g } from "../chunks/custom-instance-new-field.js";
|
|
14
|
+
import { t as _ } from "../chunks/delete-confirmation-modal.js";
|
|
15
|
+
import { r as v } from "../chunks/utils2.js";
|
|
16
|
+
import { t as y } from "../chunks/metadata-instance-form-autofill-button.js";
|
|
17
|
+
import { t as b } from "../chunks/metadata-instance-form-header.js";
|
|
18
|
+
import { MetadataInstanceForm as x } from "./lib/components/metadata-instance-editor/index.js";
|
|
19
|
+
import { t as S } from "../chunks/metadata-instance-header.js";
|
|
20
|
+
import { MetadataInstance as C, MetadataInstanceList as w } from "./lib/components/metadata-instance-list/index.js";
|
|
24
21
|
import { defaultInitialValues as T, defaultMetadataValueMap as E } from "./lib/defaults.js";
|
|
25
22
|
import { t as D } from "../chunks/metadata-editor.js";
|
|
26
23
|
import { withApiWrapper as O } from "./lib/utils/api-wrapper.js";
|
|
27
|
-
export { t as AddMetadataTemplateDropdown,
|
|
24
|
+
export { t as AddMetadataTemplateDropdown, m as AiSuggestionState, c as AutofillContext, l as AutofillContextProvider, n as ComboboxWithApiPagination, f as ConfidenceLevel, g as CustomInstanceNewField, _ as DeleteConfirmationModal, e as FilterDropdownMenu, r as FilterInstancesDropdown, v as JSONPatchOp, i as MULTI_VALUE_DEFAULT_OPTION, a as MULTI_VALUE_DEFAULT_TAXONOMY_OPTION, o as MULTI_VALUE_DEFAULT_VALUE, D as MetadataEditor, s as MetadataEmptyState, C as MetadataInstance, x as MetadataInstanceForm, y as MetadataInstanceFormAutofillButton, b as MetadataInstanceFormHeader, S as MetadataInstanceHeader, w as MetadataInstanceList, u as TIMEOUT_10_SECONDS, h as UnsavedChangesModal, p as UpdateMode, T as defaultInitialValues, E as defaultMetadataValueMap, d as useAutofill, O as withApiWrapper };
|
|
@@ -1,2 +1,18 @@
|
|
|
1
|
-
import { t as e } from "../../../../chunks/interactive-text.js";
|
|
2
|
-
|
|
1
|
+
import { t as e } from "../../../../chunks/interactive-text.module.js";
|
|
2
|
+
import { Text as t, Tooltip as n } from "@box/blueprint-web";
|
|
3
|
+
import { Focusable as r } from "@ariakit/react";
|
|
4
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
5
|
+
import a from "clsx";
|
|
6
|
+
var o = ({ tooltipText: o, className: s, children: c, ...l }) => {
|
|
7
|
+
let { as: u = "span" } = l;
|
|
8
|
+
return /* @__PURE__ */ i(n, {
|
|
9
|
+
content: o,
|
|
10
|
+
children: /* @__PURE__ */ i(r, { render: /* @__PURE__ */ i(t, {
|
|
11
|
+
as: u,
|
|
12
|
+
className: a(e.interactiveText, s),
|
|
13
|
+
...l,
|
|
14
|
+
children: c
|
|
15
|
+
}) })
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
export { o as default };
|
package/dist/esm/lib/components/metadata-editor-fields/components/ai-logo-badge/ai-logo-badge.js
CHANGED
|
@@ -1,21 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { EVENT_NAMES as e } from "../../../../utils/analytics/events.js";
|
|
2
|
+
import { useMetadataEditorAnalytics as t } from "../../../../utils/analytics/analytics-context.js";
|
|
3
|
+
import { getConfidenceScoreTooltip as n } from "../../../../utils/confidence-score/get-confidence-score-tooltip.js";
|
|
4
|
+
import { Status as r, Tooltip as i } from "@box/blueprint-web";
|
|
5
|
+
import { useIntl as a } from "react-intl";
|
|
6
|
+
import { BoxAiLogo as o } from "@box/blueprint-web-assets/icons/Logo";
|
|
7
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
8
|
+
import { SurfaceStatusSurfaceGray as c } from "@box/blueprint-web-assets/tokens/tokens";
|
|
9
|
+
function l({ confidenceScore: l, className: u }) {
|
|
10
|
+
let { formatMessage: d } = a(), { trackEvent: f } = t();
|
|
11
|
+
return l ? /* @__PURE__ */ s(i, {
|
|
12
|
+
content: n(d, l),
|
|
13
|
+
children: /* @__PURE__ */ s(r, {
|
|
12
14
|
hideText: !0,
|
|
13
|
-
icon:
|
|
15
|
+
icon: o,
|
|
14
16
|
interactive: !0,
|
|
15
17
|
text: "",
|
|
16
|
-
color:
|
|
17
|
-
"data-testid": "ai-confidence-badge"
|
|
18
|
+
color: c,
|
|
19
|
+
"data-testid": "ai-confidence-badge",
|
|
20
|
+
onMouseEnter: () => f(e.AI_LOGO_BADGE_HOVER, { confidenceLevel: l?.level })
|
|
18
21
|
})
|
|
19
|
-
}) : /* @__PURE__ */
|
|
22
|
+
}) : /* @__PURE__ */ s(o, { className: u });
|
|
20
23
|
}
|
|
21
|
-
export {
|
|
24
|
+
export { l as AiLogoBadge };
|
|
@@ -1,21 +1,24 @@
|
|
|
1
|
-
import e from "../../../../utils/
|
|
2
|
-
import t from "
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { EVENT_NAMES as e } from "../../../../utils/analytics/events.js";
|
|
2
|
+
import { useMetadataEditorAnalytics as t } from "../../../../utils/analytics/analytics-context.js";
|
|
3
|
+
import n from "../../../../utils/confidence-score/messages.js";
|
|
4
|
+
import r from "../../messages.js";
|
|
5
|
+
import { Status as i, Tooltip as a } from "@box/blueprint-web";
|
|
6
|
+
import { useIntl as o } from "react-intl";
|
|
7
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
8
|
+
import { SurfaceStatusSurfaceGray as c } from "@box/blueprint-web-assets/tokens/tokens";
|
|
9
|
+
import { AlertCircle as l } from "@box/blueprint-web-assets/icons/Medium";
|
|
10
|
+
function u() {
|
|
11
|
+
let { formatMessage: u } = o(), { trackEvent: d } = t(), f = /* @__PURE__ */ s(i, {
|
|
12
|
+
color: c,
|
|
11
13
|
interactive: !0,
|
|
12
|
-
text:
|
|
13
|
-
icon:
|
|
14
|
-
iconPosition: "left"
|
|
14
|
+
text: u(r.lowConfidenceBadge).toUpperCase(),
|
|
15
|
+
icon: l,
|
|
16
|
+
iconPosition: "left",
|
|
17
|
+
onMouseEnter: () => d(e.LOW_CONF_BADGE_HOVER)
|
|
15
18
|
});
|
|
16
|
-
return /* @__PURE__ */ a
|
|
17
|
-
content:
|
|
18
|
-
children:
|
|
19
|
+
return /* @__PURE__ */ s(a, {
|
|
20
|
+
content: u(n.tooltipLowConfidence),
|
|
21
|
+
children: f
|
|
19
22
|
});
|
|
20
23
|
}
|
|
21
|
-
export {
|
|
24
|
+
export { u as LowConfidenceBadge };
|
|
@@ -46,19 +46,19 @@ function g({ onAccept: g, onClear: _ }) {
|
|
|
46
46
|
content: v.formatMessage(t.acceptValueTooltip),
|
|
47
47
|
children: /* @__PURE__ */ d(n, {
|
|
48
48
|
"aria-label": v.formatMessage(t.acceptValueAriaLabel),
|
|
49
|
+
"data-target-id": "IconButton-metadataEditorLowConfAccept",
|
|
49
50
|
icon: p,
|
|
50
51
|
onClick: () => C(g),
|
|
51
|
-
size: "x-small"
|
|
52
|
-
"data-target-id": "IconButton-acceptValueAriaLabel"
|
|
52
|
+
size: "x-small"
|
|
53
53
|
})
|
|
54
54
|
}), /* @__PURE__ */ d(a, {
|
|
55
55
|
content: v.formatMessage(t.clearValueTooltip),
|
|
56
56
|
children: /* @__PURE__ */ d(n, {
|
|
57
57
|
"aria-label": v.formatMessage(t.clearValueAriaLabel),
|
|
58
|
+
"data-target-id": "IconButton-metadataEditorLowConfClear",
|
|
58
59
|
icon: m,
|
|
59
60
|
onClick: () => C(_),
|
|
60
|
-
size: "x-small"
|
|
61
|
-
"data-target-id": "IconButton-clearValueAriaLabel"
|
|
61
|
+
size: "x-small"
|
|
62
62
|
})
|
|
63
63
|
})]
|
|
64
64
|
})]
|
|
@@ -15,7 +15,7 @@ var s = /* @__PURE__ */ r(({ className: r, description: s, isAiSuggestionApplied
|
|
|
15
15
|
...t,
|
|
16
16
|
ref: h,
|
|
17
17
|
className: r,
|
|
18
|
-
"data-target-id": "TextInput-
|
|
18
|
+
"data-target-id": "TextInput-metadataEditorStringField",
|
|
19
19
|
disabled: u,
|
|
20
20
|
error: i.error,
|
|
21
21
|
label: v,
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import e from "../../messages.js";
|
|
2
2
|
import { t } from "../../../../chunks/types.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { checkIfHasBoundingBoxes as n } from "../../utils/check-if-has-bounding-boxes.js";
|
|
4
|
+
import { isConfidenceScoreNeedingReview as r } from "../../utils/confidence-score/is-confidence-score-needing-review.js";
|
|
5
5
|
import { isInteractiveFormElement as i } from "../../utils/is-interactive-form-element.js";
|
|
6
6
|
import { t as a } from "../../../../chunks/shared-field-styles.module.js";
|
|
7
|
-
import { t as
|
|
8
|
-
import { LowConfidenceSuggestionField as
|
|
7
|
+
import { t as o } from "../../../../chunks/ai-suggestion-field.js";
|
|
8
|
+
import { LowConfidenceSuggestionField as ee } from "./components/low-confidence-suggestion-field/low-confidence-suggestion-field.js";
|
|
9
9
|
import { t as s } from "../../../../chunks/update-mode-field-wrapper.js";
|
|
10
10
|
import { r as c } from "../../../../chunks/utils.js";
|
|
11
|
-
import { editorFieldTypes as
|
|
12
|
-
import { useViewReferenceTooltip as
|
|
11
|
+
import { editorFieldTypes as l } from "./editor-field-types.js";
|
|
12
|
+
import { useViewReferenceTooltip as te } from "./hooks/use-view-reference-tooltip.js";
|
|
13
13
|
import { Tooltip as u } from "@box/blueprint-web";
|
|
14
14
|
import { forwardRef as d, memo as f, useCallback as p, useEffect as m, useMemo as ne } from "react";
|
|
15
15
|
import { useIntl as re } from "react-intl";
|
|
16
16
|
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
17
17
|
import _ from "clsx";
|
|
18
|
-
import { useFormikContext as
|
|
19
|
-
import
|
|
18
|
+
import { useFormikContext as ie } from "formik";
|
|
19
|
+
import v from "lodash/isEqual";
|
|
20
20
|
import ae from "lodash/isUndefined";
|
|
21
21
|
var y = /* @__PURE__ */ f(/* @__PURE__ */ d(({ disableForm: d, portalElement: f, field: y, index: oe, taxonomyOptionsFetcher: b, isExternallyOwned: x, isMultilevelTaxonomyFieldEnabled: S, isConfidenceScoreReviewEnabled: C = !1, onSelectMetadataField: w, selectedMetadataFieldId: se }, T) => {
|
|
22
|
-
let { setFieldValue: E } =
|
|
22
|
+
let { setFieldValue: E } = ie(), { formatMessage: D } = re(), O = y.aiSuggestionState || t.Initial, k = O === t.Pending, A = O === t.Applied, j = O === t.Initial, M = l[y.type], { aiSuggestion: N, aiSuggestionConfidenceScore: P, aiSuggestionTargetLocation: F, type: I, value: L } = y, R = M && !y.hidden, z = !ae(y.updateMode), B = `metadata.fields[${oe}]`, V = y.type === "taxonomy" && y.optionsRules?.multiSelect, H = C && !!y.confidenceScore, U = H && r(y.confidenceScore), W = H && !k && !r(y.confidenceScore), G = se === y.id, ce = n(y.targetLocation), K = H && ce && !!w, { isTooltipOpen: q, handleMouseOver: le, handleMouseLeave: ue, handleFocus: de, handleBlur: fe } = te(K), pe = _({
|
|
23
23
|
[c.aiApproved]: A || W,
|
|
24
24
|
[c.hasSuggestion]: k,
|
|
25
25
|
[c.hasConfidenceReview]: !k && U,
|
|
@@ -98,10 +98,11 @@ var y = /* @__PURE__ */ f(/* @__PURE__ */ d(({ disableForm: d, portalElement: f,
|
|
|
98
98
|
N,
|
|
99
99
|
J
|
|
100
100
|
]);
|
|
101
|
-
let ve = ne(() => N ?
|
|
101
|
+
let ve = ne(() => N ? v(L, N) : !1, [N, L]);
|
|
102
102
|
if (!R) return null;
|
|
103
103
|
let Q = {
|
|
104
104
|
"data-metadata-field": !0,
|
|
105
|
+
"data-target-id": "Button-metadataEditorFieldEditClick",
|
|
105
106
|
"data-testid": "metadata-field",
|
|
106
107
|
onClick: ge,
|
|
107
108
|
onKeyDown: _e,
|
|
@@ -161,7 +162,7 @@ var y = /* @__PURE__ */ f(/* @__PURE__ */ d(({ disableForm: d, portalElement: f,
|
|
|
161
162
|
portalElement: f,
|
|
162
163
|
taxonomyOptionsFetcher: b
|
|
163
164
|
}),
|
|
164
|
-
k && /* @__PURE__ */ h(
|
|
165
|
+
k && /* @__PURE__ */ h(o, {
|
|
165
166
|
aiSuggestion: N,
|
|
166
167
|
confidenceLevel: C ? P?.level : void 0,
|
|
167
168
|
isSameValue: ve,
|
|
@@ -172,7 +173,7 @@ var y = /* @__PURE__ */ f(/* @__PURE__ */ d(({ disableForm: d, portalElement: f,
|
|
|
172
173
|
onAiSuggestionReplace: () => Y(N, !0),
|
|
173
174
|
type: I
|
|
174
175
|
}),
|
|
175
|
-
!k && U && /* @__PURE__ */ h(
|
|
176
|
+
!k && U && /* @__PURE__ */ h(ee, {
|
|
176
177
|
onAccept: me,
|
|
177
178
|
onClear: he
|
|
178
179
|
})
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t } from "../../../../chunks/
|
|
3
|
-
import { t as n } from "../../../../chunks/
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
1
|
+
import { withAnalytics as e } from "../../utils/analytics/with-analytics.js";
|
|
2
|
+
import { t } from "../../../../chunks/custom-instance-new-field.js";
|
|
3
|
+
import { t as n } from "../../../../chunks/delete-confirmation-modal.js";
|
|
4
|
+
import { r } from "../../../../chunks/utils2.js";
|
|
5
|
+
import { t as i } from "../../../../chunks/metadata-instance-form-autofill-button.js";
|
|
6
|
+
import { t as a } from "../../../../chunks/metadata-instance-form-header.js";
|
|
7
|
+
import { MetadataInstanceForm as o } from "./subcomponents/metadata-instance-form/metadata-instance-form.js";
|
|
8
|
+
var s = e(o);
|
|
9
|
+
export { t as CustomInstanceNewField, n as DeleteConfirmationModal, r as JSONPatchOp, s as MetadataInstanceForm, i as MetadataInstanceFormAutofillButton, a as MetadataInstanceFormHeader };
|
|
@@ -1,127 +1,129 @@
|
|
|
1
1
|
import { TEMPLATE_CUSTOM_PROPERTIES as e } from "../../../../constants.js";
|
|
2
2
|
import { MetadataEmptyState as t } from "../../../metadata-empty-state/metadata-empty-state.js";
|
|
3
|
-
import {
|
|
3
|
+
import { useMetadataEditorAnalytics as n } from "../../../../utils/analytics/analytics-context.js";
|
|
4
4
|
import { useAutofill as r } from "../../../../utils/autofill-context.js";
|
|
5
5
|
import { TemplateInstance as i } from "../../../metadata-editor-fields/metadata-editor-fields.js";
|
|
6
6
|
import { UnsavedChangesModal as a } from "../../../unsaved-changes-modal/unsaved-changes-modal.js";
|
|
7
7
|
import { t as o } from "../../../../../../chunks/autofill-overlay.js";
|
|
8
8
|
import { t as s } from "../../../../../../chunks/custom-instance.js";
|
|
9
|
-
import { t as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import g from "
|
|
14
|
-
import
|
|
15
|
-
import y from "
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
9
|
+
import { t as c } from "../../../../../../chunks/delete-confirmation-modal.js";
|
|
10
|
+
import { t as l } from "../../../../../../chunks/utils2.js";
|
|
11
|
+
import { n as u, t as d } from "../../../../../../chunks/metadata-instance-form-card-wrapper.js";
|
|
12
|
+
import { useEffect as f, useMemo as p, useRef as m, useState as h } from "react";
|
|
13
|
+
import { jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
14
|
+
import v from "clsx";
|
|
15
|
+
import { Form as y, Formik as b } from "formik";
|
|
16
|
+
import x from "lodash/isEqual";
|
|
17
|
+
var S = ({ dirty: e, onChange: t, values: n }) => {
|
|
18
|
+
let r = m(n);
|
|
19
|
+
return e && !x(r.current.metadata.fields, n.metadata.fields) && (r.current = n, t(n)), null;
|
|
20
|
+
}, C = (x) => {
|
|
21
|
+
let { areAiSuggestionsAvailable: C, customRef: w, isLargeFile: T, errorCode: E, isAiSuggestionsFeatureEnabled: D, isAdvancedExtractAgentEnabled: O = !1, isBetaLanguageEnabled: ee, isDeleteButtonDisabled: te, isDeleteConfirmationModalCheckboxEnabled: ne, isMultilevelTaxonomyFieldEnabled: k, isUnsavedChangesModalOpen: A = !1, MetadataInstanceFormCustomWrapper: j, selectedTemplateInstance: M, onCancel: N, onChange: P, onDelete: F, onDiscardUnsavedChanges: I, onSubmit: L, onToggleReviewFilter: R, setIsUnsavedChangesModalOpen: z, shouldShowOnlyReviewFields: B = !1, taxonomyOptionsFetcher: V, isConfidenceScoreReviewEnabled: H = !1, onSelectMetadataField: U, selectedMetadataFieldId: W } = x, re = j ?? d, [G, K] = h(!1), { isFetchingSuggestions: q, isLongLoading: J, getAiSuggestions: Y, clearState: X, suggestions: ie } = r(), { trackEvent: ae } = n();
|
|
22
|
+
f(() => () => {
|
|
22
23
|
X();
|
|
23
|
-
}, [X,
|
|
24
|
-
let Z =
|
|
25
|
-
await
|
|
26
|
-
},
|
|
27
|
-
e ?
|
|
28
|
-
},
|
|
24
|
+
}, [X, M?.id]);
|
|
25
|
+
let Z = M?.templateKey === e, oe = async (e) => {
|
|
26
|
+
await L(e, l(e, M));
|
|
27
|
+
}, se = (e) => {
|
|
28
|
+
e ? z(!0) : N();
|
|
29
|
+
}, ce = () => {
|
|
29
30
|
K(!0);
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
}, le = { metadata: { ...M } }, Q = m(null), [$, ue] = h(null);
|
|
32
|
+
f(() => {
|
|
33
|
+
ue(w ?? Q.current);
|
|
33
34
|
}, [
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
w,
|
|
36
|
+
M?.templateKey,
|
|
37
|
+
M?.scope
|
|
37
38
|
]);
|
|
38
|
-
let
|
|
39
|
-
let e =
|
|
40
|
-
if (Z) return /* @__PURE__ */
|
|
41
|
-
if (e) return /* @__PURE__ */
|
|
42
|
-
isBoxAiSuggestionsFeatureEnabled:
|
|
39
|
+
let de = p(() => {
|
|
40
|
+
let e = M?.fields.length === 0;
|
|
41
|
+
if (Z) return /* @__PURE__ */ g(s, { isLoading: q });
|
|
42
|
+
if (e) return /* @__PURE__ */ g(t, {
|
|
43
|
+
isBoxAiSuggestionsFeatureEnabled: D,
|
|
43
44
|
level: "instance"
|
|
44
45
|
});
|
|
45
|
-
let n = !!(q ||
|
|
46
|
-
return /* @__PURE__ */
|
|
47
|
-
className:
|
|
48
|
-
children: [/* @__PURE__ */
|
|
49
|
-
errorCode:
|
|
46
|
+
let n = !!(q || E);
|
|
47
|
+
return /* @__PURE__ */ _("div", {
|
|
48
|
+
className: v(u.metadataInstanceFormContent, n && u.showOverlay, H && u.metadataInstanceFormContentReducedGap),
|
|
49
|
+
children: [/* @__PURE__ */ g(o, {
|
|
50
|
+
errorCode: E,
|
|
50
51
|
isFetchingSuggestions: q,
|
|
51
52
|
isLongLoading: J
|
|
52
|
-
}), /* @__PURE__ */
|
|
53
|
+
}), /* @__PURE__ */ g(i, {
|
|
53
54
|
disableForm: q,
|
|
54
|
-
isConfidenceScoreReviewEnabled:
|
|
55
|
-
isExternallyOwned:
|
|
56
|
-
isMultilevelTaxonomyFieldEnabled:
|
|
57
|
-
onSelectMetadataField:
|
|
58
|
-
selectedMetadataFieldId:
|
|
59
|
-
portalElement:
|
|
60
|
-
shouldShowOnlyReviewFields:
|
|
61
|
-
taxonomyOptionsFetcher:
|
|
55
|
+
isConfidenceScoreReviewEnabled: H,
|
|
56
|
+
isExternallyOwned: M?.isExternallyOwned,
|
|
57
|
+
isMultilevelTaxonomyFieldEnabled: k,
|
|
58
|
+
onSelectMetadataField: U,
|
|
59
|
+
selectedMetadataFieldId: W,
|
|
60
|
+
portalElement: w ?? $,
|
|
61
|
+
shouldShowOnlyReviewFields: B,
|
|
62
|
+
taxonomyOptionsFetcher: V
|
|
62
63
|
})]
|
|
63
64
|
});
|
|
64
65
|
}, [
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
M?.fields.length,
|
|
67
|
+
M?.isExternallyOwned,
|
|
67
68
|
Z,
|
|
68
69
|
q,
|
|
69
70
|
J,
|
|
70
|
-
|
|
71
|
+
w,
|
|
71
72
|
$,
|
|
72
|
-
B,
|
|
73
|
-
T,
|
|
74
73
|
V,
|
|
75
|
-
|
|
76
|
-
w,
|
|
77
|
-
z,
|
|
74
|
+
D,
|
|
78
75
|
H,
|
|
79
|
-
|
|
76
|
+
k,
|
|
77
|
+
E,
|
|
78
|
+
B,
|
|
79
|
+
U,
|
|
80
|
+
W
|
|
80
81
|
]);
|
|
81
|
-
return /* @__PURE__ */
|
|
82
|
-
initialValues:
|
|
83
|
-
onSubmit:
|
|
84
|
-
children: ({ values: e, dirty: t }) => /* @__PURE__ */
|
|
85
|
-
/* @__PURE__ */
|
|
86
|
-
areAiSuggestionsAvailable:
|
|
87
|
-
className:
|
|
82
|
+
return /* @__PURE__ */ g(b, {
|
|
83
|
+
initialValues: le,
|
|
84
|
+
onSubmit: oe,
|
|
85
|
+
children: ({ values: e, dirty: t }) => /* @__PURE__ */ _(y, { children: [
|
|
86
|
+
/* @__PURE__ */ g(re, {
|
|
87
|
+
areAiSuggestionsAvailable: C,
|
|
88
|
+
className: u.metadataInstanceForm,
|
|
88
89
|
formRef: Q,
|
|
89
90
|
formValues: e,
|
|
90
91
|
getAiSuggestions: Y,
|
|
91
|
-
handleCancel:
|
|
92
|
-
handleDelete:
|
|
93
|
-
isAdvancedExtractAgentEnabled:
|
|
94
|
-
isAiSuggestionsFeatureEnabled:
|
|
95
|
-
isBetaLanguageEnabled:
|
|
96
|
-
isConfidenceScoreReviewEnabled:
|
|
92
|
+
handleCancel: se,
|
|
93
|
+
handleDelete: ce,
|
|
94
|
+
isAdvancedExtractAgentEnabled: O,
|
|
95
|
+
isAiSuggestionsFeatureEnabled: D,
|
|
96
|
+
isBetaLanguageEnabled: ee,
|
|
97
|
+
isConfidenceScoreReviewEnabled: H,
|
|
97
98
|
isDeleteButtonDisabled: te,
|
|
98
99
|
isFetchingSuggestions: q,
|
|
99
100
|
isFormDirty: t,
|
|
100
|
-
isLargeFile:
|
|
101
|
-
onToggleReviewFilter:
|
|
102
|
-
selectedTemplateInstance:
|
|
103
|
-
shouldShowOnlyReviewFields:
|
|
104
|
-
suggestions:
|
|
105
|
-
children:
|
|
101
|
+
isLargeFile: T,
|
|
102
|
+
onToggleReviewFilter: R,
|
|
103
|
+
selectedTemplateInstance: M,
|
|
104
|
+
shouldShowOnlyReviewFields: B,
|
|
105
|
+
suggestions: ie,
|
|
106
|
+
children: M && de
|
|
106
107
|
}),
|
|
107
|
-
|
|
108
|
+
P && /* @__PURE__ */ g(S, {
|
|
108
109
|
dirty: t,
|
|
109
|
-
onChange:
|
|
110
|
+
onChange: P,
|
|
110
111
|
values: e
|
|
111
112
|
}),
|
|
112
|
-
/* @__PURE__ */
|
|
113
|
-
onBackToEdit: () =>
|
|
114
|
-
onDiscardChanges:
|
|
115
|
-
open:
|
|
113
|
+
/* @__PURE__ */ g(a, {
|
|
114
|
+
onBackToEdit: () => z(!1),
|
|
115
|
+
onDiscardChanges: I,
|
|
116
|
+
open: A,
|
|
117
|
+
trackEvent: ae
|
|
116
118
|
}),
|
|
117
|
-
/* @__PURE__ */
|
|
119
|
+
/* @__PURE__ */ g(c, {
|
|
118
120
|
isCheckboxEnabled: ne,
|
|
119
|
-
onConfirm: () =>
|
|
121
|
+
onConfirm: () => F(M),
|
|
120
122
|
onDismiss: () => K(!1),
|
|
121
123
|
open: G,
|
|
122
|
-
templateName:
|
|
124
|
+
templateName: M?.displayName
|
|
123
125
|
})
|
|
124
126
|
] })
|
|
125
|
-
}, `${
|
|
127
|
+
}, `${M?.scope}.${M?.templateKey}`);
|
|
126
128
|
};
|
|
127
|
-
export {
|
|
129
|
+
export { C as MetadataInstanceForm };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t } from "../../../../chunks/metadata-instance-
|
|
3
|
-
import { t as n } from "../../../../chunks/metadata-instance.js";
|
|
4
|
-
|
|
1
|
+
import { withAnalytics as e } from "../../utils/analytics/with-analytics.js";
|
|
2
|
+
import { t } from "../../../../chunks/metadata-instance-list.js";
|
|
3
|
+
import { t as n } from "../../../../chunks/metadata-instance-header.js";
|
|
4
|
+
import { t as r } from "../../../../chunks/metadata-instance.js";
|
|
5
|
+
var i = e(t), a = e(r);
|
|
6
|
+
export { a as MetadataInstance, n as MetadataInstanceHeader, i as MetadataInstanceList };
|