@box/metadata-editor 1.61.4 → 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.
Files changed (50) hide show
  1. package/dist/chunks/utils.js +39 -30
  2. package/dist/chunks/utils2.js +17 -19
  3. package/dist/esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/ai-suggestion-field.js +62 -61
  4. package/dist/esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/messages.js +16 -0
  5. package/dist/esm/lib/components/metadata-editor-fields/components/low-confidence-badge/low-confidence-badge.js +16 -21
  6. package/dist/esm/lib/components/metadata-editor-fields/hooks/use-review-field-filter.js +41 -0
  7. package/dist/esm/lib/components/metadata-editor-fields/metadata-editor-field-wrapper.js +77 -68
  8. package/dist/esm/lib/components/metadata-editor-fields/metadata-editor-fields.js +31 -24
  9. package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/metadata-instance-form.js +12 -11
  10. package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/utils.js +2 -2
  11. package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-header/metadata-instance-form-header.js +40 -40
  12. package/dist/esm/lib/utils/confidence-score/get-confidence-score-tooltip.js +10 -18
  13. package/dist/esm/lib/utils/confidence-score/get-fields-needing-review.js +3 -2
  14. package/dist/esm/lib/utils/confidence-score/messages.js +5 -5
  15. package/dist/i18n/bn-IN.js +4 -0
  16. package/dist/i18n/da-DK.js +4 -0
  17. package/dist/i18n/de-DE.js +4 -0
  18. package/dist/i18n/en-AU.js +4 -0
  19. package/dist/i18n/en-CA.js +4 -0
  20. package/dist/i18n/en-GB.js +4 -0
  21. package/dist/i18n/en-US.js +7 -3
  22. package/dist/i18n/en-US.properties +13 -5
  23. package/dist/i18n/en-x-pseudo.js +4 -0
  24. package/dist/i18n/es-419.js +4 -0
  25. package/dist/i18n/es-ES.js +4 -0
  26. package/dist/i18n/fi-FI.js +4 -0
  27. package/dist/i18n/fr-CA.js +4 -0
  28. package/dist/i18n/fr-FR.js +4 -0
  29. package/dist/i18n/hi-IN.js +4 -0
  30. package/dist/i18n/it-IT.js +4 -0
  31. package/dist/i18n/ja-JP.js +4 -0
  32. package/dist/i18n/json/src/lib/components/metadata-editor-fields/components/ai-suggestion-field/messages.json +1 -1
  33. package/dist/i18n/json/src/lib/utils/confidence-score/messages.json +1 -1
  34. package/dist/i18n/ko-KR.js +4 -0
  35. package/dist/i18n/nb-NO.js +4 -0
  36. package/dist/i18n/nl-NL.js +4 -0
  37. package/dist/i18n/pl-PL.js +4 -0
  38. package/dist/i18n/pt-BR.js +4 -0
  39. package/dist/i18n/ru-RU.js +4 -0
  40. package/dist/i18n/sv-SE.js +4 -0
  41. package/dist/i18n/tr-TR.js +4 -0
  42. package/dist/i18n/zh-CN.js +4 -0
  43. package/dist/i18n/zh-TW.js +4 -0
  44. package/dist/types/lib/components/metadata-editor-fields/components/ai-suggestion-field/messages.d.ts +20 -0
  45. package/dist/types/lib/components/metadata-editor-fields/components/low-confidence-badge/low-confidence-badge.d.ts +1 -4
  46. package/dist/types/lib/components/metadata-editor-fields/hooks/use-review-field-filter.d.ts +7 -0
  47. package/dist/types/lib/components/metadata-editor-fields/types.d.ts +1 -0
  48. package/dist/types/lib/test-utils/confidence-score-fixtures.d.ts +4 -0
  49. package/dist/types/lib/utils/confidence-score/get-fields-needing-review.d.ts +4 -3
  50. package/package.json +10 -10
@@ -1,42 +1,51 @@
1
- import h from "lodash/isEmpty";
2
- import O from "lodash/isArray";
3
- import { TEMPLATE_CUSTOM_PROPERTIES as f } from "../esm/lib/constants.js";
4
- const n = {
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
- }, p = (e) => e.value === void 0 || e.value === null || e.value === "" || O(e.value) && h(e.value), S = (e, a) => {
10
- const o = [], c = e.metadata.fields, r = a.templateKey === f, E = new Map(a.fields.map((t) => [t.key, t])), m = new Map(c.map((t) => [t.key, t]));
11
- return c.forEach((t) => {
12
- const s = E.get(t.key);
13
- s ? JSON.stringify(t) === JSON.stringify(s) || (!r && p(s) && !p(t) ? o.push(v(t.key, u(t))) : (
14
- // template instance
15
- (!r && t.value !== s.value && s.value !== null && !p(t) || // custom instance
16
- r && t.value !== s.value) && (o.push(y(s.key, u(s))), o.push(M(t.key, u(t))))
17
- )) : o.push(v(t.key, t.value));
18
- }), a.fields.forEach((t) => {
19
- const s = m.get(t.key);
20
- (!s || !r && p(s) && !p(t)) && (o.push(y(t.key, u(t))), o.push(k(t.key)));
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
- }, u = (e) => e.type === "float" ? Number(e.value) : e.type === "taxonomy" ? e.value.map((a) => a.value) : e.value, y = (e, a) => ({
23
- op: n.TEST,
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: a
26
- }), v = (e, a) => ({
27
- op: n.ADD,
34
+ value: s
35
+ }), p = (e, s) => ({
36
+ op: E.ADD,
28
37
  path: `/${e}`,
29
- value: a
30
- }), k = (e) => ({
31
- op: n.REMOVE,
38
+ value: s
39
+ }), u = (e) => ({
40
+ op: E.REMOVE,
32
41
  path: `/${e}`
33
- }), M = (e, a) => ({
34
- op: n.REPLACE,
42
+ }), $ = (e, s) => ({
43
+ op: E.REPLACE,
35
44
  path: `/${e}`,
36
- value: a
45
+ value: s
37
46
  });
38
47
  export {
39
- n as J,
40
- S as c,
41
- u as g
48
+ E as J,
49
+ M as c,
50
+ v as g
42
51
  };
@@ -1,16 +1,16 @@
1
1
  import _ from "clsx";
2
- import { memo as b, createElement as g } from "react";
3
- import { convertISOStringtoRFC3339String as f } from "../esm/lib/utils/convertDate.js";
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", x = "_fieldWrapper_1oruv_6", L = "_hasSuggestion_1oruv_11", S = "_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 = {
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: x,
12
- hasSuggestion: L,
13
- hasConfidenceReview: S,
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: a,
23
+ isAiSuggestionApplied: r,
24
24
  as: l,
25
- confidenceScore: r,
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 = !!r && N(r), m = () => r && p ? /* @__PURE__ */ n(h, {
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: r
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__ */ g(l, {
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, a = e.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 === a.className && o.htmlFor === a.htmlFor && o.id === a.id;
53
- }), G = (t, e, o = !1, a = "label", l) => (r) => /* @__PURE__ */ n(D, {
54
- as: a,
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: r
57
+ labelProps: a
60
58
  }), H = (t) => {
61
59
  try {
62
- const e = f(t), o = new Date(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 c, IconButton as g, DropdownMenu as a } from "@box/blueprint-web";
2
- import { Checkmark as u, Ellipsis as x } from "@box/blueprint-web-assets/icons/Fill";
3
- import v from "clsx";
4
- import { useIntl as A, FormattedMessage as s } from "react-intl";
5
- import { s as l } from "../../../../../../chunks/field-action-bar.module.js";
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 b } from "./utils.js";
8
- import { jsx as e, jsxs as r, Fragment as S } from "react/jsx-runtime";
9
- import '../../../../../../styles/ai-suggestion-field.css';const B = "_wrapper_132y2_1", T = "_selectTrigger_132y2_1", h = {
10
- wrapper: B,
11
- selectTrigger: T
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 j({
14
+ function y({
14
15
  aiSuggestion: C,
15
- onAiSuggestionAppend: d,
16
- onAiSuggestionReplace: m,
16
+ onAiSuggestionAppend: m,
17
+ onAiSuggestionReplace: l,
17
18
  onAiSuggestionIgnore: p,
18
- type: o,
19
- isSameValue: f,
20
- confidenceLevel: n
19
+ type: n,
20
+ isSameValue: M,
21
+ confidenceLevel: o
21
22
  }) {
22
- const i = A(), {
23
+ const a = b(), {
23
24
  enableModernizedComponents: I
24
- } = w(), M = n ? n.charAt(0).toUpperCase() + n.slice(1).toLowerCase() : void 0;
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: l.wrapperGradient,
27
+ className: s.wrapperGradient,
27
28
  "data-modern": I,
28
29
  children: /* @__PURE__ */ e("div", {
29
- className: v(l.wrapper, h.wrapper),
30
- children: f ? /* @__PURE__ */ r(S, {
31
- children: [/* @__PURE__ */ e(c, {
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: /* @__PURE__ */ e(s, {
36
- ...t.sameValueAiSuggestionCaption
37
- })
36
+ children: o ? a.formatMessage(t.sameValueAiSuggestionCaptionWithLevel, {
37
+ level: u
38
+ }) : a.formatMessage(t.sameValueAiSuggestionCaption)
38
39
  }), /* @__PURE__ */ e("div", {
39
- className: l.buttons,
40
- children: /* @__PURE__ */ e(g, {
41
- "aria-label": i.formatMessage(t.aiSuggestionConfirm),
42
- icon: u,
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(S, {
49
+ }) : /* @__PURE__ */ r(h, {
49
50
  children: [/* @__PURE__ */ r("div", {
50
- children: [/* @__PURE__ */ e(c, {
51
+ children: [/* @__PURE__ */ e(g, {
51
52
  as: "p",
52
53
  color: "textOnLightSecondary",
53
54
  variant: "caption",
54
- children: n ? i.formatMessage(t.aiSuggestionCaptionWithLevel, {
55
- level: M
56
- }) : i.formatMessage(t.aiSuggestionCaption)
57
- }), /* @__PURE__ */ e(c, {
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: b(C, {
60
- type: o,
61
- locale: i.locale
60
+ children: T(C, {
61
+ type: n,
62
+ locale: a.locale
62
63
  })
63
64
  })]
64
65
  }), /* @__PURE__ */ r("div", {
65
- className: l.buttons,
66
- children: [/* @__PURE__ */ e(g, {
67
- "aria-label": i.formatMessage(o === "multiSelect" ? t.aiSuggestionAppend : t.aiSuggestionClearAndReplace),
68
- "data-target-id": o === "multiSelect" ? "IconButton-aiSuggestionAppend" : "IconButton-aiSuggestionClearAndReplace",
69
- icon: u,
70
- onClick: o === "multiSelect" ? d : m,
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(a.Root, {
73
- children: [/* @__PURE__ */ e(a.Trigger, {
74
- className: h.selectTrigger,
75
- children: /* @__PURE__ */ e(g, {
76
- "aria-label": i.formatMessage(t.aiSuggestionOptions),
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(a.Content, {
81
- children: [o === "multiSelect" && /* @__PURE__ */ e(a.Item, {
82
- onSelect: d,
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(s, {
85
+ children: /* @__PURE__ */ e(d, {
85
86
  ...t.aiSuggestionAppend
86
87
  })
87
- }), /* @__PURE__ */ e(a.Item, {
88
- onSelect: m,
88
+ }), /* @__PURE__ */ e(i.Item, {
89
+ onSelect: l,
89
90
  "data-target-id": "DropdownMenu.Item-aiSuggestionClearAndReplace",
90
- children: /* @__PURE__ */ e(s, {
91
+ children: /* @__PURE__ */ e(d, {
91
92
  ...t.aiSuggestionClearAndReplace
92
93
  })
93
- }), /* @__PURE__ */ e(a.Separator, {}), /* @__PURE__ */ e(a.Item, {
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(s, {
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
- j as AiSuggestionField
109
+ y as AiSuggestionField
109
110
  };
@@ -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 c, Tooltip as m } from "@box/blueprint-web";
2
- import { AlertCircle as s } from "@box/blueprint-web-assets/icons/Medium";
3
- import { SurfaceStatusSurfaceGray as f } from "@box/blueprint-web-assets/tokens/tokens";
4
- import { useIntl as a } from "react-intl";
5
- import p from "../../../../utils/confidence-score/messages.js";
6
- import l from "../../messages.js";
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
- import { formatConfidenceScorePercent as u } from "../../../../utils/confidence-score/format-confidence-score-percent.js";
9
- function L({
10
- confidenceScore: e
11
- }) {
8
+ function w() {
12
9
  const {
13
10
  formatMessage: o
14
- } = a(), r = /* @__PURE__ */ t(c, {
15
- color: f,
11
+ } = c(), e = /* @__PURE__ */ t(i, {
12
+ color: s,
16
13
  interactive: !0,
17
- text: o(l.lowConfidenceBadge).toUpperCase(),
18
- icon: s,
14
+ text: o(a.lowConfidenceBadge).toUpperCase(),
15
+ icon: m,
19
16
  iconPosition: "left"
20
- }), i = u(e.value), n = o(p.tooltipLowConfidence, {
21
- score: i
22
- });
23
- return /* @__PURE__ */ t(m, {
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
- L as LowConfidenceBadge
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
+ };