@box/metadata-editor 1.61.5 → 1.62.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/utils.js +39 -30
- package/dist/chunks/utils2.js +17 -19
- package/dist/esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/ai-suggestion-field.js +62 -61
- package/dist/esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/messages.js +16 -0
- package/dist/esm/lib/components/metadata-editor-fields/components/low-confidence-badge/low-confidence-badge.js +16 -21
- package/dist/esm/lib/components/metadata-editor-fields/hooks/use-review-field-filter.js +41 -0
- package/dist/esm/lib/components/metadata-editor-fields/metadata-editor-field-wrapper.js +77 -68
- package/dist/esm/lib/components/metadata-editor-fields/metadata-editor-fields.js +31 -24
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/metadata-instance-form.js +12 -11
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/utils.js +2 -2
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-header/metadata-instance-form-header.js +40 -40
- package/dist/esm/lib/utils/confidence-score/get-confidence-score-tooltip.js +10 -18
- package/dist/esm/lib/utils/confidence-score/get-fields-needing-review.js +3 -2
- package/dist/esm/lib/utils/confidence-score/messages.js +5 -5
- package/dist/i18n/bn-IN.js +4 -0
- package/dist/i18n/da-DK.js +4 -0
- package/dist/i18n/de-DE.js +4 -0
- package/dist/i18n/en-AU.js +4 -0
- package/dist/i18n/en-CA.js +4 -0
- package/dist/i18n/en-GB.js +4 -0
- package/dist/i18n/en-US.js +7 -3
- package/dist/i18n/en-US.properties +13 -5
- package/dist/i18n/en-x-pseudo.js +4 -0
- package/dist/i18n/es-419.js +4 -0
- package/dist/i18n/es-ES.js +4 -0
- package/dist/i18n/fi-FI.js +4 -0
- package/dist/i18n/fr-CA.js +4 -0
- package/dist/i18n/fr-FR.js +4 -0
- package/dist/i18n/hi-IN.js +4 -0
- package/dist/i18n/it-IT.js +4 -0
- package/dist/i18n/ja-JP.js +4 -0
- package/dist/i18n/json/src/lib/components/metadata-editor-fields/components/ai-suggestion-field/messages.json +1 -1
- package/dist/i18n/json/src/lib/utils/confidence-score/messages.json +1 -1
- package/dist/i18n/ko-KR.js +4 -0
- package/dist/i18n/nb-NO.js +4 -0
- package/dist/i18n/nl-NL.js +4 -0
- package/dist/i18n/pl-PL.js +4 -0
- package/dist/i18n/pt-BR.js +4 -0
- package/dist/i18n/ru-RU.js +4 -0
- package/dist/i18n/sv-SE.js +4 -0
- package/dist/i18n/tr-TR.js +4 -0
- package/dist/i18n/zh-CN.js +4 -0
- package/dist/i18n/zh-TW.js +4 -0
- package/dist/types/lib/components/metadata-editor-fields/components/ai-suggestion-field/messages.d.ts +20 -0
- package/dist/types/lib/components/metadata-editor-fields/components/low-confidence-badge/low-confidence-badge.d.ts +1 -4
- package/dist/types/lib/components/metadata-editor-fields/hooks/use-review-field-filter.d.ts +7 -0
- package/dist/types/lib/components/metadata-editor-fields/types.d.ts +1 -0
- package/dist/types/lib/test-utils/confidence-score-fixtures.d.ts +4 -0
- package/dist/types/lib/utils/confidence-score/get-fields-needing-review.d.ts +4 -3
- package/package.json +10 -10
package/dist/chunks/utils.js
CHANGED
|
@@ -1,42 +1,51 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { TEMPLATE_CUSTOM_PROPERTIES as
|
|
4
|
-
const
|
|
1
|
+
import i from "lodash/isArray";
|
|
2
|
+
import m from "lodash/isEmpty";
|
|
3
|
+
import { TEMPLATE_CUSTOM_PROPERTIES as O } from "../esm/lib/constants.js";
|
|
4
|
+
const E = {
|
|
5
5
|
ADD: "add",
|
|
6
6
|
REMOVE: "remove",
|
|
7
7
|
REPLACE: "replace",
|
|
8
8
|
TEST: "test"
|
|
9
|
-
},
|
|
10
|
-
const
|
|
11
|
-
return
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
9
|
+
}, l = "AI_ACCEPTED", y = (e, s) => e.value === s.value && e.level === s.level && e.isAccepted === s.isAccepted, a = (e) => e.value === void 0 || e.value === null || e.value === "" || i(e.value) && m(e.value), A = (e, s, o) => {
|
|
10
|
+
const r = s.confidenceScore, n = o.confidenceScore;
|
|
11
|
+
return n ? r && y(r, n) ? [] : T(e, n, r) : r ? g(e, r) : [];
|
|
12
|
+
}, g = (e, s) => {
|
|
13
|
+
const o = [];
|
|
14
|
+
return s.isAccepted && o.push(u(`${e}/process`)), o.push(u(`${e}/confidenceScore`), u(`${e}/confidenceLevel`)), o;
|
|
15
|
+
}, T = (e, s, o) => {
|
|
16
|
+
const r = [];
|
|
17
|
+
return s.isAccepted ? r.push(p(`${e}/process`, l)) : o?.isAccepted && r.push(u(`${e}/process`)), r.push(p(`${e}/confidenceScore`, s.value), p(`${e}/confidenceLevel`, s.level)), r;
|
|
18
|
+
}, M = (e, s) => {
|
|
19
|
+
const o = [], r = e.metadata.fields, n = s.templateKey === O, h = new Map(s.fields.map((t) => [t.key, t])), S = new Map(r.map((t) => [t.key, t]));
|
|
20
|
+
return r.forEach((t) => {
|
|
21
|
+
const c = h.get(t.key);
|
|
22
|
+
if (!c) {
|
|
23
|
+
o.push(p(t.key, t.value));
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
JSON.stringify(t) !== JSON.stringify(c) && (!n && a(c) && !a(t) ? o.push(p(t.key, v(t))) : (!n && t.value !== c.value && c.value !== null && !a(t) || n && t.value !== c.value) && (o.push(f(c.key, v(c))), o.push($(t.key, v(t)))), o.push(...A(t.key, c, t)));
|
|
27
|
+
}), s.fields.forEach((t) => {
|
|
28
|
+
const c = S.get(t.key);
|
|
29
|
+
(!c || !n && a(c) && !a(t)) && (o.push(f(t.key, v(t))), o.push(u(t.key)));
|
|
21
30
|
}), o;
|
|
22
|
-
},
|
|
23
|
-
op:
|
|
31
|
+
}, v = (e) => e.type === "float" ? Number(e.value) : e.type === "taxonomy" ? e.value.map((s) => s.value) : e.type === "date" && typeof e.value == "string" ? new Date(e.value).toISOString() : e.value, f = (e, s) => ({
|
|
32
|
+
op: E.TEST,
|
|
24
33
|
path: `/${e}`,
|
|
25
|
-
value:
|
|
26
|
-
}),
|
|
27
|
-
op:
|
|
34
|
+
value: s
|
|
35
|
+
}), p = (e, s) => ({
|
|
36
|
+
op: E.ADD,
|
|
28
37
|
path: `/${e}`,
|
|
29
|
-
value:
|
|
30
|
-
}),
|
|
31
|
-
op:
|
|
38
|
+
value: s
|
|
39
|
+
}), u = (e) => ({
|
|
40
|
+
op: E.REMOVE,
|
|
32
41
|
path: `/${e}`
|
|
33
|
-
}),
|
|
34
|
-
op:
|
|
42
|
+
}), $ = (e, s) => ({
|
|
43
|
+
op: E.REPLACE,
|
|
35
44
|
path: `/${e}`,
|
|
36
|
-
value:
|
|
45
|
+
value: s
|
|
37
46
|
});
|
|
38
47
|
export {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
48
|
+
E as J,
|
|
49
|
+
M as c,
|
|
50
|
+
v as g
|
|
42
51
|
};
|
package/dist/chunks/utils2.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import _ from "clsx";
|
|
2
|
-
import { memo as b, createElement as
|
|
3
|
-
import { convertISOStringtoRFC3339String as
|
|
2
|
+
import { memo as b, createElement as f } from "react";
|
|
3
|
+
import { convertISOStringtoRFC3339String as g } from "../esm/lib/utils/convertDate.js";
|
|
4
4
|
import v from "../esm/lib/components/interactive-text/interactive-text.js";
|
|
5
5
|
import { jsx as n, jsxs as T } from "react/jsx-runtime";
|
|
6
6
|
import { isConfidenceScoreNeedingReview as N } from "../esm/lib/utils/confidence-score/is-confidence-score-needing-review.js";
|
|
7
7
|
import { LowConfidenceBadge as h } from "../esm/lib/components/metadata-editor-fields/components/low-confidence-badge/low-confidence-badge.js";
|
|
8
8
|
import { AiLogoBadge as A } from "../esm/lib/components/metadata-editor-fields/components/ai-logo-badge/ai-logo-badge.js";
|
|
9
|
-
import '../styles/utils.css';const C = "_noAttributesText_1oruv_2",
|
|
9
|
+
import '../styles/utils.css';const C = "_noAttributesText_1oruv_2", S = "_fieldWrapper_1oruv_6", x = "_hasSuggestion_1oruv_11", L = "_hasConfidenceReview_1oruv_16", w = "_dateField_1oruv_44", F = "_aiApproved_1oruv_49", W = "_labelWrapper_1oruv_96", I = "_labelText_1oruv_102", P = "_labelTruncated_1oruv_105", R = "_labelIcon_1oruv_112", s = {
|
|
10
10
|
noAttributesText: C,
|
|
11
|
-
fieldWrapper:
|
|
12
|
-
hasSuggestion:
|
|
13
|
-
hasConfidenceReview:
|
|
11
|
+
fieldWrapper: S,
|
|
12
|
+
hasSuggestion: x,
|
|
13
|
+
hasConfidenceReview: L,
|
|
14
14
|
dateField: w,
|
|
15
15
|
aiApproved: F,
|
|
16
16
|
labelWrapper: W,
|
|
@@ -20,19 +20,17 @@ import '../styles/utils.css';const C = "_noAttributesText_1oruv_2", x = "_fieldW
|
|
|
20
20
|
}, D = /* @__PURE__ */ b(function({
|
|
21
21
|
fieldName: e,
|
|
22
22
|
fieldDescription: o,
|
|
23
|
-
isAiSuggestionApplied:
|
|
23
|
+
isAiSuggestionApplied: r,
|
|
24
24
|
as: l,
|
|
25
|
-
confidenceScore:
|
|
25
|
+
confidenceScore: a,
|
|
26
26
|
labelProps: d
|
|
27
27
|
}) {
|
|
28
28
|
const {
|
|
29
29
|
className: u,
|
|
30
30
|
...i
|
|
31
|
-
} = d, c = _(u || s.labelText, s.labelTruncated), p = !!
|
|
32
|
-
confidenceScore: r
|
|
33
|
-
}) : a || r ? /* @__PURE__ */ n(A, {
|
|
31
|
+
} = d, c = _(u || s.labelText, s.labelTruncated), p = !!a && N(a), m = () => a && p ? /* @__PURE__ */ n(h, {}) : r || a ? /* @__PURE__ */ n(A, {
|
|
34
32
|
className: s.labelIcon,
|
|
35
|
-
confidenceScore:
|
|
33
|
+
confidenceScore: a
|
|
36
34
|
}) : null;
|
|
37
35
|
return /* @__PURE__ */ T("div", {
|
|
38
36
|
className: s.labelWrapper,
|
|
@@ -42,24 +40,24 @@ import '../styles/utils.css';const C = "_noAttributesText_1oruv_2", x = "_fieldW
|
|
|
42
40
|
tooltipText: o,
|
|
43
41
|
...i,
|
|
44
42
|
children: e
|
|
45
|
-
}) : /* @__PURE__ */
|
|
43
|
+
}) : /* @__PURE__ */ f(l, {
|
|
46
44
|
className: c,
|
|
47
45
|
...i
|
|
48
46
|
}, e), m()]
|
|
49
47
|
});
|
|
50
48
|
}, (t, e) => {
|
|
51
|
-
const o = t.labelProps,
|
|
52
|
-
return t.fieldName === e.fieldName && t.fieldDescription === e.fieldDescription && t.isAiSuggestionApplied === e.isAiSuggestionApplied && t.confidenceScore === e.confidenceScore && t.as === e.as && o.className ===
|
|
53
|
-
}), G = (t, e, o = !1,
|
|
54
|
-
as:
|
|
49
|
+
const o = t.labelProps, r = e.labelProps;
|
|
50
|
+
return t.fieldName === e.fieldName && t.fieldDescription === e.fieldDescription && t.isAiSuggestionApplied === e.isAiSuggestionApplied && t.confidenceScore === e.confidenceScore && t.as === e.as && o.className === r.className && o.htmlFor === r.htmlFor && o.id === r.id;
|
|
51
|
+
}), G = (t, e, o = !1, r = "label", l) => (a) => /* @__PURE__ */ n(D, {
|
|
52
|
+
as: r,
|
|
55
53
|
confidenceScore: l,
|
|
56
54
|
fieldDescription: e,
|
|
57
55
|
fieldName: t,
|
|
58
56
|
isAiSuggestionApplied: o,
|
|
59
|
-
labelProps:
|
|
57
|
+
labelProps: a
|
|
60
58
|
}), H = (t) => {
|
|
61
59
|
try {
|
|
62
|
-
const e =
|
|
60
|
+
const e = g(t), o = new Date(e);
|
|
63
61
|
return isNaN(o.getTime()) ? null : e;
|
|
64
62
|
} catch {
|
|
65
63
|
return null;
|
|
@@ -1,99 +1,100 @@
|
|
|
1
|
-
import { useBlueprintModernization as w, Text as
|
|
2
|
-
import { Checkmark as
|
|
3
|
-
import
|
|
4
|
-
import { useIntl as
|
|
5
|
-
import {
|
|
1
|
+
import { useBlueprintModernization as w, Text as g, IconButton as c, DropdownMenu as i } from "@box/blueprint-web";
|
|
2
|
+
import { Checkmark as S, Ellipsis as x } from "@box/blueprint-web-assets/icons/Fill";
|
|
3
|
+
import A from "clsx";
|
|
4
|
+
import { useIntl as b, FormattedMessage as d } from "react-intl";
|
|
5
|
+
import { C as B } from "../../../../../../chunks/types.js";
|
|
6
|
+
import { s } from "../../../../../../chunks/field-action-bar.module.js";
|
|
6
7
|
import t from "./messages.js";
|
|
7
|
-
import { formatSuggestionValue as
|
|
8
|
-
import { jsx as e, jsxs as r, Fragment as
|
|
9
|
-
import '../../../../../../styles/ai-suggestion-field.css';const
|
|
10
|
-
wrapper:
|
|
11
|
-
selectTrigger:
|
|
8
|
+
import { formatSuggestionValue as T } from "./utils.js";
|
|
9
|
+
import { jsx as e, jsxs as r, Fragment as h } from "react/jsx-runtime";
|
|
10
|
+
import '../../../../../../styles/ai-suggestion-field.css';const _ = "_wrapper_132y2_1", L = "_selectTrigger_132y2_1", f = {
|
|
11
|
+
wrapper: _,
|
|
12
|
+
selectTrigger: L
|
|
12
13
|
};
|
|
13
|
-
function
|
|
14
|
+
function y({
|
|
14
15
|
aiSuggestion: C,
|
|
15
|
-
onAiSuggestionAppend:
|
|
16
|
-
onAiSuggestionReplace:
|
|
16
|
+
onAiSuggestionAppend: m,
|
|
17
|
+
onAiSuggestionReplace: l,
|
|
17
18
|
onAiSuggestionIgnore: p,
|
|
18
|
-
type:
|
|
19
|
-
isSameValue:
|
|
20
|
-
confidenceLevel:
|
|
19
|
+
type: n,
|
|
20
|
+
isSameValue: M,
|
|
21
|
+
confidenceLevel: o
|
|
21
22
|
}) {
|
|
22
|
-
const
|
|
23
|
+
const a = b(), {
|
|
23
24
|
enableModernizedComponents: I
|
|
24
|
-
} = w(),
|
|
25
|
+
} = w(), v = o === B.High ? t.confidenceLevelHigh : t.confidenceLevelLow, u = o ? a.formatMessage(v) : void 0;
|
|
25
26
|
return /* @__PURE__ */ e("div", {
|
|
26
|
-
className:
|
|
27
|
+
className: s.wrapperGradient,
|
|
27
28
|
"data-modern": I,
|
|
28
29
|
children: /* @__PURE__ */ e("div", {
|
|
29
|
-
className:
|
|
30
|
-
children:
|
|
31
|
-
children: [/* @__PURE__ */ e(
|
|
30
|
+
className: A(s.wrapper, f.wrapper),
|
|
31
|
+
children: M ? /* @__PURE__ */ r(h, {
|
|
32
|
+
children: [/* @__PURE__ */ e(g, {
|
|
32
33
|
as: "p",
|
|
33
34
|
color: "textOnLightSecondary",
|
|
34
35
|
variant: "caption",
|
|
35
|
-
children:
|
|
36
|
-
|
|
37
|
-
})
|
|
36
|
+
children: o ? a.formatMessage(t.sameValueAiSuggestionCaptionWithLevel, {
|
|
37
|
+
level: u
|
|
38
|
+
}) : a.formatMessage(t.sameValueAiSuggestionCaption)
|
|
38
39
|
}), /* @__PURE__ */ e("div", {
|
|
39
|
-
className:
|
|
40
|
-
children: /* @__PURE__ */ e(
|
|
41
|
-
"aria-label":
|
|
42
|
-
icon:
|
|
43
|
-
onClick: p,
|
|
40
|
+
className: s.buttons,
|
|
41
|
+
children: /* @__PURE__ */ e(c, {
|
|
42
|
+
"aria-label": o ? a.formatMessage(t.aiSuggestionAccept) : a.formatMessage(t.aiSuggestionConfirm),
|
|
43
|
+
icon: S,
|
|
44
|
+
onClick: o ? l : p,
|
|
44
45
|
size: "x-small",
|
|
45
|
-
"data-target-id": "IconButton-aiSuggestionConfirm"
|
|
46
|
+
"data-target-id": "IconButton-aiSuggestionAccept|aiSuggestionConfirm"
|
|
46
47
|
})
|
|
47
48
|
})]
|
|
48
|
-
}) : /* @__PURE__ */ r(
|
|
49
|
+
}) : /* @__PURE__ */ r(h, {
|
|
49
50
|
children: [/* @__PURE__ */ r("div", {
|
|
50
|
-
children: [/* @__PURE__ */ e(
|
|
51
|
+
children: [/* @__PURE__ */ e(g, {
|
|
51
52
|
as: "p",
|
|
52
53
|
color: "textOnLightSecondary",
|
|
53
54
|
variant: "caption",
|
|
54
|
-
children:
|
|
55
|
-
level:
|
|
56
|
-
}) :
|
|
57
|
-
}), /* @__PURE__ */ e(
|
|
55
|
+
children: o ? a.formatMessage(t.aiSuggestionCaptionWithLevel, {
|
|
56
|
+
level: u
|
|
57
|
+
}) : a.formatMessage(t.aiSuggestionCaption)
|
|
58
|
+
}), /* @__PURE__ */ e(g, {
|
|
58
59
|
as: "p",
|
|
59
|
-
children:
|
|
60
|
-
type:
|
|
61
|
-
locale:
|
|
60
|
+
children: T(C, {
|
|
61
|
+
type: n,
|
|
62
|
+
locale: a.locale
|
|
62
63
|
})
|
|
63
64
|
})]
|
|
64
65
|
}), /* @__PURE__ */ r("div", {
|
|
65
|
-
className:
|
|
66
|
-
children: [/* @__PURE__ */ e(
|
|
67
|
-
"aria-label":
|
|
68
|
-
"data-target-id":
|
|
69
|
-
icon:
|
|
70
|
-
onClick:
|
|
66
|
+
className: s.buttons,
|
|
67
|
+
children: [/* @__PURE__ */ e(c, {
|
|
68
|
+
"aria-label": a.formatMessage(n === "multiSelect" ? t.aiSuggestionAppend : t.aiSuggestionClearAndReplace),
|
|
69
|
+
"data-target-id": n === "multiSelect" ? "IconButton-aiSuggestionAppend" : "IconButton-aiSuggestionClearAndReplace",
|
|
70
|
+
icon: S,
|
|
71
|
+
onClick: n === "multiSelect" ? m : l,
|
|
71
72
|
size: "x-small"
|
|
72
|
-
}), /* @__PURE__ */ r(
|
|
73
|
-
children: [/* @__PURE__ */ e(
|
|
74
|
-
className:
|
|
75
|
-
children: /* @__PURE__ */ e(
|
|
76
|
-
"aria-label":
|
|
73
|
+
}), /* @__PURE__ */ r(i.Root, {
|
|
74
|
+
children: [/* @__PURE__ */ e(i.Trigger, {
|
|
75
|
+
className: f.selectTrigger,
|
|
76
|
+
children: /* @__PURE__ */ e(c, {
|
|
77
|
+
"aria-label": a.formatMessage(t.aiSuggestionOptions),
|
|
77
78
|
icon: x,
|
|
78
79
|
"data-target-id": "IconButton-aiSuggestionOptions"
|
|
79
80
|
})
|
|
80
|
-
}), /* @__PURE__ */ r(
|
|
81
|
-
children: [
|
|
82
|
-
onSelect:
|
|
81
|
+
}), /* @__PURE__ */ r(i.Content, {
|
|
82
|
+
children: [n === "multiSelect" && /* @__PURE__ */ e(i.Item, {
|
|
83
|
+
onSelect: m,
|
|
83
84
|
"data-target-id": "DropdownMenu.Item-aiSuggestionAppend",
|
|
84
|
-
children: /* @__PURE__ */ e(
|
|
85
|
+
children: /* @__PURE__ */ e(d, {
|
|
85
86
|
...t.aiSuggestionAppend
|
|
86
87
|
})
|
|
87
|
-
}), /* @__PURE__ */ e(
|
|
88
|
-
onSelect:
|
|
88
|
+
}), /* @__PURE__ */ e(i.Item, {
|
|
89
|
+
onSelect: l,
|
|
89
90
|
"data-target-id": "DropdownMenu.Item-aiSuggestionClearAndReplace",
|
|
90
|
-
children: /* @__PURE__ */ e(
|
|
91
|
+
children: /* @__PURE__ */ e(d, {
|
|
91
92
|
...t.aiSuggestionClearAndReplace
|
|
92
93
|
})
|
|
93
|
-
}), /* @__PURE__ */ e(
|
|
94
|
+
}), /* @__PURE__ */ e(i.Separator, {}), /* @__PURE__ */ e(i.Item, {
|
|
94
95
|
onSelect: p,
|
|
95
96
|
"data-target-id": "DropdownMenu.Item-aiSuggestionIgnore",
|
|
96
|
-
children: /* @__PURE__ */ e(
|
|
97
|
+
children: /* @__PURE__ */ e(d, {
|
|
97
98
|
...t.aiSuggestionIgnore
|
|
98
99
|
})
|
|
99
100
|
})]
|
|
@@ -105,5 +106,5 @@ function j({
|
|
|
105
106
|
});
|
|
106
107
|
}
|
|
107
108
|
export {
|
|
108
|
-
|
|
109
|
+
y as AiSuggestionField
|
|
109
110
|
};
|
package/dist/esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/messages.js
CHANGED
|
@@ -8,6 +8,10 @@ const i = e({
|
|
|
8
8
|
id: "metadataEditor.aiSuggestionField.sameValueAiSuggestionCaption",
|
|
9
9
|
defaultMessage: "Box AI suggests the same value as above"
|
|
10
10
|
},
|
|
11
|
+
sameValueAiSuggestionCaptionWithLevel: {
|
|
12
|
+
id: "metadataEditor.aiSuggestionField.sameValueAiSuggestionCaptionWithLevel",
|
|
13
|
+
defaultMessage: "Box AI suggests the same value as above ({level} confidence)"
|
|
14
|
+
},
|
|
11
15
|
aiSuggestionOptions: {
|
|
12
16
|
id: "metadataEditor.aiSuggestionField.aiSuggestionOptions",
|
|
13
17
|
defaultMessage: "Options"
|
|
@@ -28,9 +32,21 @@ const i = e({
|
|
|
28
32
|
id: "metadataEditor.aiSuggestionField.aiSuggestionCaptionWithLevel",
|
|
29
33
|
defaultMessage: "Box AI suggestion ({level} confidence)"
|
|
30
34
|
},
|
|
35
|
+
confidenceLevelHigh: {
|
|
36
|
+
id: "metadataEditor.aiSuggestionField.confidenceLevelHigh",
|
|
37
|
+
defaultMessage: "High"
|
|
38
|
+
},
|
|
39
|
+
confidenceLevelLow: {
|
|
40
|
+
id: "metadataEditor.aiSuggestionField.confidenceLevelLow",
|
|
41
|
+
defaultMessage: "Low"
|
|
42
|
+
},
|
|
31
43
|
aiSuggestionConfirm: {
|
|
32
44
|
id: "metadataEditor.aiSuggestionField.dismissLabel",
|
|
33
45
|
defaultMessage: "Confirm"
|
|
46
|
+
},
|
|
47
|
+
aiSuggestionAccept: {
|
|
48
|
+
id: "metadataEditor.aiSuggestionField.acceptLabel",
|
|
49
|
+
defaultMessage: "Accept suggestion"
|
|
34
50
|
}
|
|
35
51
|
});
|
|
36
52
|
export {
|
|
@@ -1,30 +1,25 @@
|
|
|
1
|
-
import { Status as
|
|
2
|
-
import { AlertCircle as
|
|
3
|
-
import { SurfaceStatusSurfaceGray as
|
|
4
|
-
import { useIntl as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
1
|
+
import { Status as i, Tooltip as n } from "@box/blueprint-web";
|
|
2
|
+
import { AlertCircle as m } from "@box/blueprint-web-assets/icons/Medium";
|
|
3
|
+
import { SurfaceStatusSurfaceGray as s } from "@box/blueprint-web-assets/tokens/tokens";
|
|
4
|
+
import { useIntl as c } from "react-intl";
|
|
5
|
+
import f from "../../../../utils/confidence-score/messages.js";
|
|
6
|
+
import a from "../../messages.js";
|
|
7
7
|
import { jsx as t } from "react/jsx-runtime";
|
|
8
|
-
|
|
9
|
-
function L({
|
|
10
|
-
confidenceScore: e
|
|
11
|
-
}) {
|
|
8
|
+
function w() {
|
|
12
9
|
const {
|
|
13
10
|
formatMessage: o
|
|
14
|
-
} =
|
|
15
|
-
color:
|
|
11
|
+
} = c(), e = /* @__PURE__ */ t(i, {
|
|
12
|
+
color: s,
|
|
16
13
|
interactive: !0,
|
|
17
|
-
text: o(
|
|
18
|
-
icon:
|
|
14
|
+
text: o(a.lowConfidenceBadge).toUpperCase(),
|
|
15
|
+
icon: m,
|
|
19
16
|
iconPosition: "left"
|
|
20
|
-
}),
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
content: n,
|
|
25
|
-
children: r
|
|
17
|
+
}), r = o(f.tooltipLowConfidence);
|
|
18
|
+
return /* @__PURE__ */ t(n, {
|
|
19
|
+
content: r,
|
|
20
|
+
children: e
|
|
26
21
|
});
|
|
27
22
|
}
|
|
28
23
|
export {
|
|
29
|
-
|
|
24
|
+
w as LowConfidenceBadge
|
|
30
25
|
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { useState as p, useRef as R, useMemo as y, useCallback as m, useEffect as d } from "react";
|
|
2
|
+
import { getFieldsNeedingReview as v } from "../../../utils/confidence-score/get-fields-needing-review.js";
|
|
3
|
+
function w(s, i) {
|
|
4
|
+
const [o, a] = p(/* @__PURE__ */ new Set()), c = R(null), n = y(() => {
|
|
5
|
+
const e = v(s);
|
|
6
|
+
return new Set(e.map((t) => t.key));
|
|
7
|
+
}, [s]), u = m(() => {
|
|
8
|
+
if (!i || !c.current)
|
|
9
|
+
return;
|
|
10
|
+
const e = [];
|
|
11
|
+
for (const t of c.current)
|
|
12
|
+
n.has(t) || e.push(t);
|
|
13
|
+
e.length > 0 && a((t) => {
|
|
14
|
+
const f = new Set(t);
|
|
15
|
+
for (const r of e)
|
|
16
|
+
f.add(r);
|
|
17
|
+
return f;
|
|
18
|
+
});
|
|
19
|
+
}, [i, n]);
|
|
20
|
+
return d(() => {
|
|
21
|
+
u(), c.current = n;
|
|
22
|
+
}, [n, u]), d(() => {
|
|
23
|
+
i || a(/* @__PURE__ */ new Set());
|
|
24
|
+
}, [i]), y(() => {
|
|
25
|
+
const e = s.map((r, k) => ({
|
|
26
|
+
field: r,
|
|
27
|
+
originalIndex: k
|
|
28
|
+
}));
|
|
29
|
+
if (!i)
|
|
30
|
+
return e;
|
|
31
|
+
const t = e.filter(({
|
|
32
|
+
field: r
|
|
33
|
+
}) => n.has(r.key)), f = e.filter(({
|
|
34
|
+
field: r
|
|
35
|
+
}) => o.has(r.key) && !n.has(r.key));
|
|
36
|
+
return [...t, ...f];
|
|
37
|
+
}, [s, i, n, o]);
|
|
38
|
+
}
|
|
39
|
+
export {
|
|
40
|
+
w as useReviewFieldFilter
|
|
41
|
+
};
|