@box/metadata-editor 1.53.16 → 1.54.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 (67) hide show
  1. package/dist/chunks/utils2.js +43 -38
  2. package/dist/esm/lib/components/metadata-editor-fields/components/ai-logo-badge/ai-logo-badge.js +37 -0
  3. package/dist/esm/lib/components/metadata-editor-fields/components/ai-logo-badge/index.js +4 -0
  4. package/dist/esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/ai-suggestion-field.js +57 -56
  5. package/dist/esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/messages.js +4 -0
  6. package/dist/esm/lib/components/metadata-editor-fields/components/low-confidence-badge/index.js +4 -0
  7. package/dist/esm/lib/components/metadata-editor-fields/components/low-confidence-badge/low-confidence-badge.js +30 -0
  8. package/dist/esm/lib/components/metadata-editor-fields/components/metadata-date-field/metadata-date-field.js +37 -36
  9. package/dist/esm/lib/components/metadata-editor-fields/components/metadata-enum-field/metadata-enum-field.js +32 -31
  10. package/dist/esm/lib/components/metadata-editor-fields/components/metadata-float-field/metadata-float-field.js +32 -31
  11. package/dist/esm/lib/components/metadata-editor-fields/components/metadata-multi-select-field/metadata-multi-select-field.js +35 -34
  12. package/dist/esm/lib/components/metadata-editor-fields/components/metadata-string-field/metadata-string-field.js +26 -25
  13. package/dist/esm/lib/components/metadata-editor-fields/components/metadata-taxonomy-field/metadata-taxonomy-field.js +64 -63
  14. package/dist/esm/lib/components/metadata-editor-fields/messages.js +10 -0
  15. package/dist/esm/lib/components/metadata-editor-fields/metadata-editor-field-wrapper.js +89 -85
  16. package/dist/esm/lib/components/metadata-editor-fields/utils.js +7 -5
  17. package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-autofill-button/metadata-instance-form-autofill-button.js +90 -88
  18. package/dist/esm/lib/components/metadata-instance-review-notice/metadata-instance-review-notice.js +5 -5
  19. package/dist/esm/lib/utils/autofill-context.js +51 -47
  20. package/dist/esm/lib/utils/confidence-score/get-confidence-score-tooltip.js +18 -16
  21. package/dist/esm/lib/utils/confidence-score/messages.js +1 -1
  22. package/dist/i18n/bn-IN.js +2 -0
  23. package/dist/i18n/da-DK.js +2 -0
  24. package/dist/i18n/de-DE.js +2 -0
  25. package/dist/i18n/en-AU.js +2 -0
  26. package/dist/i18n/en-CA.js +2 -0
  27. package/dist/i18n/en-GB.js +2 -0
  28. package/dist/i18n/en-US.js +3 -1
  29. package/dist/i18n/en-US.properties +5 -1
  30. package/dist/i18n/en-x-pseudo.js +2 -0
  31. package/dist/i18n/es-419.js +2 -0
  32. package/dist/i18n/es-ES.js +2 -0
  33. package/dist/i18n/fi-FI.js +2 -0
  34. package/dist/i18n/fr-CA.js +2 -0
  35. package/dist/i18n/fr-FR.js +2 -0
  36. package/dist/i18n/hi-IN.js +2 -0
  37. package/dist/i18n/it-IT.js +2 -0
  38. package/dist/i18n/ja-JP.js +2 -0
  39. package/dist/i18n/json/src/lib/components/metadata-editor-fields/components/ai-suggestion-field/messages.json +1 -1
  40. package/dist/i18n/json/src/lib/components/metadata-editor-fields/messages.json +1 -0
  41. package/dist/i18n/json/src/lib/utils/confidence-score/messages.json +1 -1
  42. package/dist/i18n/ko-KR.js +2 -0
  43. package/dist/i18n/nb-NO.js +2 -0
  44. package/dist/i18n/nl-NL.js +2 -0
  45. package/dist/i18n/pl-PL.js +2 -0
  46. package/dist/i18n/pt-BR.js +2 -0
  47. package/dist/i18n/ru-RU.js +2 -0
  48. package/dist/i18n/sv-SE.js +2 -0
  49. package/dist/i18n/tr-TR.js +2 -0
  50. package/dist/i18n/zh-CN.js +2 -0
  51. package/dist/i18n/zh-TW.js +2 -0
  52. package/dist/types/lib/components/metadata-editor-fields/components/ai-logo-badge/ai-logo-badge.d.ts +5 -0
  53. package/dist/types/lib/components/metadata-editor-fields/components/ai-logo-badge/index.d.ts +1 -0
  54. package/dist/types/lib/components/metadata-editor-fields/components/ai-suggestion-field/ai-suggestion-field.d.ts +1 -1
  55. package/dist/types/lib/components/metadata-editor-fields/components/ai-suggestion-field/messages.d.ts +5 -0
  56. package/dist/types/lib/components/metadata-editor-fields/components/ai-suggestion-field/types.d.ts +9 -1
  57. package/dist/types/lib/components/metadata-editor-fields/components/low-confidence-badge/index.d.ts +1 -0
  58. package/dist/types/lib/components/metadata-editor-fields/components/low-confidence-badge/low-confidence-badge.d.ts +4 -0
  59. package/dist/types/lib/components/metadata-editor-fields/messages.d.ts +8 -0
  60. package/dist/types/lib/components/metadata-editor-fields/types.d.ts +2 -1
  61. package/dist/types/lib/components/metadata-editor-fields/utils.d.ts +2 -1
  62. package/dist/types/lib/test-utils/confidence-score-fixtures.d.ts +37 -0
  63. package/dist/types/lib/test-utils/index.d.ts +1 -0
  64. package/dist/types/lib/test-utils/sample-data.d.ts +1 -3
  65. package/dist/types/lib/types.d.ts +1 -0
  66. package/dist/types/lib/utils/autofill-context.d.ts +2 -1
  67. package/package.json +9 -9
@@ -1,55 +1,56 @@
1
- import { Combobox as v } from "@box/blueprint-web";
2
- import { useFormikContext as y, getIn as x, Field as E } from "formik";
3
- import { forwardRef as U } from "react";
4
- import { useIntl as $ } from "react-intl";
5
- import w from "../../../../messages.js";
6
- import { g as A } from "../../../../../../chunks/utils2.js";
7
- import { messages as D } from "../update-mode-field-wrapper/messages.js";
8
- import { MULTI_VALUE_DEFAULT_VALUE as I } from "../update-mode-field-wrapper/mulitple-values-utils.js";
1
+ import { Combobox as y } from "@box/blueprint-web";
2
+ import { useFormikContext as x, getIn as E, Field as U } from "formik";
3
+ import { forwardRef as $ } from "react";
4
+ import { useIntl as w } from "react-intl";
5
+ import A from "../../../../messages.js";
6
+ import { g as D } from "../../../../../../chunks/utils2.js";
7
+ import { messages as I } from "../update-mode-field-wrapper/messages.js";
8
+ import { MULTI_VALUE_DEFAULT_VALUE as _ } from "../update-mode-field-wrapper/mulitple-values-utils.js";
9
9
  import { jsx as l } from "react/jsx-runtime";
10
- const G = /* @__PURE__ */ U(({
10
+ const H = /* @__PURE__ */ $(({
11
11
  className: m,
12
12
  isAiSuggestionApplied: n,
13
- description: u,
14
- disableForm: d,
13
+ confidenceScore: u,
14
+ description: d,
15
+ disableForm: p,
15
16
  fieldNamePrefix: o,
16
17
  label: a,
17
- onValueEdited: p,
18
- options: c,
19
- portalElement: f,
20
- updateModePrefix: g
21
- }, V) => {
18
+ onValueEdited: c,
19
+ options: f,
20
+ portalElement: g,
21
+ updateModePrefix: V
22
+ }, L) => {
22
23
  const {
23
- setFieldValue: L,
24
- values: F
25
- } = y(), {
24
+ setFieldValue: F,
25
+ values: b
26
+ } = x(), {
26
27
  formatMessage: s
27
- } = $(), r = `${g ?? o}.value`, h = s(D.multipleValues), b = (c || x(F, `${o}.options`, [])).map((e) => typeof e == "string" ? e : e.key), C = (e, i) => i.toLowerCase().includes(e.toLowerCase());
28
+ } = w(), r = `${V ?? o}.value`, h = s(I.multipleValues), C = (f || E(b, `${o}.options`, [])).map((e) => typeof e == "string" ? e : e.key), M = (e, i) => i.toLowerCase().includes(e.toLowerCase());
28
29
  return /* @__PURE__ */ l("div", {
29
30
  "data-testid": `${a}-field`,
30
- children: /* @__PURE__ */ l(E, {
31
+ children: /* @__PURE__ */ l(U, {
31
32
  name: r,
32
33
  children: ({
33
34
  field: e
34
35
  }) => {
35
- const M = (e.value?.length || 0) === 0 ? s(w.multiselectPlaceholder) : "";
36
- return /* @__PURE__ */ l(v, {
37
- ref: V,
36
+ const v = (e.value?.length || 0) === 0 ? s(A.multiselectPlaceholder) : "";
37
+ return /* @__PURE__ */ l(y, {
38
+ ref: L,
38
39
  as: "input",
39
40
  className: m,
40
41
  "data-target-id": "Combobox-MetadataEditorMultiSelectField",
41
- disabled: d,
42
- displayValue: (t) => t === I ? h : t,
43
- filterFn: C,
44
- label: A(a, u, n),
42
+ disabled: p,
43
+ displayValue: (t) => t === _ ? h : t,
44
+ filterFn: M,
45
+ label: D(a, d, n, "label", u),
45
46
  multiselect: !0,
46
47
  name: e.name,
47
48
  onValueChange: (t) => {
48
- L(r, t), p();
49
+ F(r, t), c();
49
50
  },
50
- options: b,
51
- placeholder: M,
52
- portalElement: f,
51
+ options: C,
52
+ placeholder: v,
53
+ portalElement: g,
53
54
  value: e.value
54
55
  });
55
56
  }
@@ -57,6 +58,6 @@ const G = /* @__PURE__ */ U(({
57
58
  });
58
59
  });
59
60
  export {
60
- G as MetadataMultiSelectField,
61
- G as default
61
+ H as MetadataMultiSelectField,
62
+ H as default
62
63
  };
@@ -1,38 +1,39 @@
1
- import { TextInput as u } from "@box/blueprint-web";
2
- import { Field as c } from "formik";
3
- import { forwardRef as h } from "react";
4
- import { useIntl as F } from "react-intl";
5
- import x from "../../../../messages.js";
6
- import { g as M } from "../../../../../../chunks/utils2.js";
1
+ import { TextInput as c } from "@box/blueprint-web";
2
+ import { Field as h } from "formik";
3
+ import { forwardRef as F } from "react";
4
+ import { useIntl as x } from "react-intl";
5
+ import M from "../../../../messages.js";
6
+ import { g as b } from "../../../../../../chunks/utils2.js";
7
7
  import { jsx as e } from "react/jsx-runtime";
8
- const I = /* @__PURE__ */ h(({
8
+ const I = /* @__PURE__ */ F(({
9
9
  className: r,
10
10
  description: a,
11
11
  isAiSuggestionApplied: i,
12
- disableForm: o,
13
- fieldNamePrefix: d,
12
+ confidenceScore: o,
13
+ disableForm: d,
14
+ fieldNamePrefix: l,
14
15
  label: t,
15
- onValueEdited: l,
16
- updateModePrefix: m
17
- }, n) => {
18
- const s = F(), f = `${m ?? d}.value`;
16
+ onValueEdited: m,
17
+ updateModePrefix: n
18
+ }, s) => {
19
+ const f = x(), p = `${n ?? l}.value`;
19
20
  return /* @__PURE__ */ e("div", {
20
21
  "data-testid": `${t}-field`,
21
- children: /* @__PURE__ */ e(c, {
22
- name: f,
22
+ children: /* @__PURE__ */ e(h, {
23
+ name: p,
23
24
  children: ({
24
- field: p,
25
- meta: g
26
- }) => /* @__PURE__ */ e(u, {
27
- ...p,
28
- ref: n,
25
+ field: g,
26
+ meta: u
27
+ }) => /* @__PURE__ */ e(c, {
28
+ ...g,
29
+ ref: s,
29
30
  className: r,
30
31
  "data-target-id": "TextInput-MetadataEditorStringField",
31
- disabled: o,
32
- error: g.error,
33
- label: M(t, a, i),
34
- onChangeCapture: l,
35
- placeholder: s.formatMessage(x.setValuePlaceholder)
32
+ disabled: d,
33
+ error: u.error,
34
+ label: b(t, a, i, "label", o),
35
+ onChangeCapture: m,
36
+ placeholder: f.formatMessage(M.setValuePlaceholder)
36
37
  })
37
38
  })
38
39
  });
@@ -1,95 +1,96 @@
1
- import { Tooltip as $ } from "@box/blueprint-web";
2
- import { ComboboxWithApiTreeView as K, ComboboxWithApiPagination as j } from "@box/combobox-with-api";
3
- import { useFormikContext as R, getIn as S, Field as q } from "formik";
4
- import { forwardRef as z, useCallback as B } from "react";
5
- import { useIntl as G } from "react-intl";
6
- import I from "../../../../messages.js";
7
- import { g as k } from "../../../../../../chunks/utils2.js";
8
- import { messages as H } from "../update-mode-field-wrapper/messages.js";
9
- import { MULTI_VALUE_DEFAULT_VALUE as J } from "../update-mode-field-wrapper/mulitple-values-utils.js";
1
+ import { Tooltip as K } from "@box/blueprint-web";
2
+ import { ComboboxWithApiTreeView as j, ComboboxWithApiPagination as R } from "@box/combobox-with-api";
3
+ import { useFormikContext as q, getIn as z, Field as B } from "formik";
4
+ import { forwardRef as G, useCallback as H } from "react";
5
+ import { useIntl as J } from "react-intl";
6
+ import k from "../../../../messages.js";
7
+ import { g as E } from "../../../../../../chunks/utils2.js";
8
+ import { messages as O } from "../update-mode-field-wrapper/messages.js";
9
+ import { MULTI_VALUE_DEFAULT_VALUE as Q } from "../update-mode-field-wrapper/mulitple-values-utils.js";
10
10
  import { jsx as t } from "react/jsx-runtime";
11
- const O = (o, l) => o === J ? l : o, re = /* @__PURE__ */ z(({
11
+ const S = (o, l) => o === Q ? l : o, ie = /* @__PURE__ */ G(({
12
12
  description: o,
13
13
  disableForm: l,
14
14
  isAiSuggestionApplied: s,
15
- fieldNamePrefix: m,
15
+ confidenceScore: m,
16
+ fieldNamePrefix: d,
16
17
  label: r,
17
- onValueEdited: E,
18
- portalElement: d,
19
- taxonomyOptionsFetcher: u,
20
- updateModePrefix: P,
21
- className: c,
22
- isExternallyOwned: p,
23
- isMultilevelTaxonomyFieldEnabled: U
18
+ onValueEdited: P,
19
+ portalElement: u,
20
+ taxonomyOptionsFetcher: c,
21
+ updateModePrefix: U,
22
+ className: p,
23
+ isExternallyOwned: b,
24
+ isMultilevelTaxonomyFieldEnabled: W
24
25
  }, h) => {
25
26
  const {
26
- formatMessage: n
27
- } = G(), b = `${P ?? m}.value`, {
28
- setFieldValue: W,
29
- values: g
30
- } = R(), {
27
+ formatMessage: i
28
+ } = J(), g = `${U ?? d}.value`, {
29
+ setFieldValue: w,
30
+ values: V
31
+ } = q(), {
31
32
  metadata: {
32
- templateKey: V,
33
- scope: v
33
+ templateKey: v,
34
+ scope: y
34
35
  }
35
- } = g, w = S(g, m), {
36
+ } = V, D = z(V, d), {
36
37
  key: f,
37
38
  optionsRules: {
38
- multiSelect: i,
39
+ multiSelect: n,
39
40
  selectableLevels: a
40
41
  },
41
- levels: D
42
- } = w, _ = n(H.multipleValues), y = U && a?.some((e) => e > 1), x = l || p, T = B((e) => u(v, V, f, a?.[0], e), [f, v, a, u, V]), C = (e) => i || !e?.length ? n(I.taxonomyPlaceholder) : void 0, F = (e) => {
43
- W(b, e), E();
44
- }, A = /* @__PURE__ */ t("div", {
42
+ levels: _
43
+ } = D, $ = i(O.multipleValues), x = W && a?.some((e) => e > 1), T = l || b, C = H((e) => c(y, v, f, a?.[0], e), [f, y, a, c, v]), F = (e) => n || !e?.length ? i(k.taxonomyPlaceholder) : void 0, A = (e) => {
44
+ w(g, e), P();
45
+ }, L = /* @__PURE__ */ t("div", {
45
46
  "data-testid": `${r}-field`,
46
47
  onKeyDown: (e) => e.stopPropagation(),
47
48
  role: "presentation",
48
- children: /* @__PURE__ */ t(q, {
49
- name: b,
49
+ children: /* @__PURE__ */ t(B, {
50
+ name: g,
50
51
  children: ({
51
52
  field: e
52
53
  }) => {
53
- const L = Array.isArray(e.value) ? e.value.map((M) => ({
54
- ...M,
55
- displayValue: O(M.displayValue, _)
54
+ const M = Array.isArray(e.value) ? e.value.map((I) => ({
55
+ ...I,
56
+ displayValue: S(I.displayValue, $)
56
57
  })) : e.value;
57
- return y ? /* @__PURE__ */ t(K, {
58
+ return x ? /* @__PURE__ */ t(j, {
58
59
  ref: h,
59
- className: c,
60
- closeOnSelection: y,
60
+ className: p,
61
+ closeOnSelection: x,
61
62
  dataTargetId: "ComboboxWithApiTreeView-MetadataEditorTaxonomyField",
62
- defaultFetcher: T,
63
- disabled: x,
64
- label: k(r, o, s),
65
- levels: D,
66
- multiselect: i,
67
- onValueChange: F,
68
- placeholder: C(e.value),
69
- portalElement: d,
63
+ defaultFetcher: C,
64
+ disabled: T,
65
+ label: E(r, o, s, "label", m),
66
+ levels: _,
67
+ multiselect: n,
68
+ onValueChange: A,
69
+ placeholder: F(e.value),
70
+ portalElement: u,
70
71
  selectableLevels: a,
71
- value: L
72
- }) : /* @__PURE__ */ t(j, {
72
+ value: M
73
+ }) : /* @__PURE__ */ t(R, {
73
74
  ref: h,
74
- className: c,
75
+ className: p,
75
76
  dataTargetId: "ComboboxWithApiPagination-MetadataEditorTaxonomyField",
76
- defaultFetcher: T,
77
- disabled: x,
78
- label: k(r, o, s),
79
- multiselect: i,
80
- onValueChange: F,
81
- placeholder: C(e.value),
82
- portalElement: d,
83
- value: L
77
+ defaultFetcher: C,
78
+ disabled: T,
79
+ label: E(r, o, s, "label", m),
80
+ multiselect: n,
81
+ onValueChange: A,
82
+ placeholder: F(e.value),
83
+ portalElement: u,
84
+ value: M
84
85
  });
85
86
  }
86
87
  })
87
88
  });
88
- return p ? /* @__PURE__ */ t($, {
89
- content: n(I.taxonomyExternallyOwned),
90
- children: A
91
- }) : A;
89
+ return b ? /* @__PURE__ */ t(K, {
90
+ content: i(k.taxonomyExternallyOwned),
91
+ children: L
92
+ }) : L;
92
93
  });
93
94
  export {
94
- re as MetadataTaxonomyField
95
+ ie as MetadataTaxonomyField
95
96
  };
@@ -0,0 +1,10 @@
1
+ import { defineMessages as e } from "react-intl";
2
+ const d = e({
3
+ lowConfidenceBadge: {
4
+ id: "metadataEditor.fieldLabel.lowConfidenceBadge",
5
+ defaultMessage: "Low"
6
+ }
7
+ });
8
+ export {
9
+ d as default
10
+ };
@@ -1,105 +1,109 @@
1
- import L from "clsx";
2
- import { useFormikContext as T } from "formik";
3
- import b from "lodash/isUndefined";
4
- import { forwardRef as B, useCallback as r, useEffect as x, useMemo as q } from "react";
5
- import { A as a } from "../../../../chunks/types.js";
6
- import { UpdateModeFieldWrapper as z } from "./components/update-mode-field-wrapper/update-mode-field-wrapper.js";
7
- import { editorFieldTypes as D } from "./editor-field-types.js";
8
- import { s as l } from "../../../../chunks/utils2.js";
9
- import { jsx as g, jsxs as G } from "react/jsx-runtime";
10
- import { isConfidenceScoreNeedingReview as H } from "../../utils/confidence-score/is-confidence-score-needing-review.js";
11
- import { AiSuggestionField as J } from "./components/ai-suggestion-field/ai-suggestion-field.js";
12
- import { LowConfidenceSuggestionField as K } from "./components/low-confidence-suggestion-field/low-confidence-suggestion-field.js";
13
- const ae = /* @__PURE__ */ B(({
14
- disableForm: y,
15
- portalElement: h,
1
+ import w from "clsx";
2
+ import { useFormikContext as z } from "formik";
3
+ import D from "lodash/isEqual";
4
+ import G from "lodash/isUndefined";
5
+ import { forwardRef as H, useCallback as d, useEffect as W, useMemo as J } from "react";
6
+ import { A as r } from "../../../../chunks/types.js";
7
+ import { UpdateModeFieldWrapper as K } from "./components/update-mode-field-wrapper/update-mode-field-wrapper.js";
8
+ import { editorFieldTypes as Q } from "./editor-field-types.js";
9
+ import { s as u } from "../../../../chunks/utils2.js";
10
+ import { jsx as l, jsxs as X } from "react/jsx-runtime";
11
+ import { isConfidenceScoreNeedingReview as Y } from "../../utils/confidence-score/is-confidence-score-needing-review.js";
12
+ import { AiSuggestionField as Z } from "./components/ai-suggestion-field/ai-suggestion-field.js";
13
+ import { LowConfidenceSuggestionField as _ } from "./components/low-confidence-suggestion-field/low-confidence-suggestion-field.js";
14
+ const pe = /* @__PURE__ */ H(({
15
+ disableForm: h,
16
+ portalElement: $,
16
17
  field: e,
17
- index: M,
18
+ index: k,
18
19
  taxonomyOptionsFetcher: v,
19
- isExternallyOwned: C,
20
- isMultilevelTaxonomyFieldEnabled: w,
21
- isConfidenceScoreReviewEnabled: I = !1
22
- }, N) => {
20
+ isExternallyOwned: N,
21
+ isMultilevelTaxonomyFieldEnabled: V,
22
+ isConfidenceScoreReviewEnabled: n = !1
23
+ }, F) => {
23
24
  const {
24
- setFieldValue: o
25
- } = T(), m = e.aiSuggestionState || a.Initial, n = m === a.Pending, V = m === a.Applied, $ = m === a.Initial, f = D[e.type], {
26
- aiSuggestion: t,
27
- type: d,
28
- value: p
29
- } = e, R = f && !e.hidden, W = !b(e.updateMode), i = `metadata.fields[${M}]`, k = e.type === "taxonomy" && e.optionsRules?.multiSelect, u = I && !!e.confidenceScore && H(e.confidenceScore), P = L({
30
- [l.suggestionApplied]: V,
31
- [l.hasSuggestion]: n,
32
- [l.hasConfidenceReview]: !n && u,
33
- [l.dateField]: d === "date"
34
- }), c = r((s) => {
35
- o(`${i}.aiSuggestionState`, s);
36
- }, [i, o]), S = r((s) => {
37
- o(`${i}.value`, s), c(a.Applied);
38
- }, [i, o, c]), A = r(() => {
39
- c(a.Initial), o(`${i}.aiSuggestion`, void 0);
40
- }, [c, o, i]), E = r(() => {
41
- o(`${i}.confidenceScore.isAccepted`, !0);
42
- }, [i, o]), U = r(() => {
43
- const s = d === "multiSelect" || d === "taxonomy" ? [] : "";
44
- o(`${i}.value`, s), o(`${i}.confidenceScore`, void 0);
45
- }, [i, o, d]), F = r(() => {
46
- A(), u && o(`${i}.confidenceScore`, void 0);
47
- }, [A, u, o, i]);
48
- x(() => {
49
- n && (!p || Array.isArray(p) && p.length === 0) && S(t);
50
- }, [t, n, S]), x(() => {
51
- $ && t && c(a.Pending);
52
- }, [$, t, c]);
53
- const j = q(() => t && p === t, [n]);
54
- return R ? W ? /* @__PURE__ */ g(z, {
55
- fieldNamePrefix: i,
25
+ setFieldValue: t
26
+ } = z(), m = e.aiSuggestionState || r.Initial, s = m === r.Pending, x = m === r.Applied, C = m === r.Initial, f = Q[e.type], {
27
+ aiSuggestion: i,
28
+ aiSuggestionConfidenceScore: A,
29
+ type: g,
30
+ value: a
31
+ } = e, P = f && !e.hidden, L = !G(e.updateMode), o = `metadata.fields[${k}]`, U = e.type === "taxonomy" && e.optionsRules?.multiSelect, M = n && !!e.confidenceScore && Y(e.confidenceScore), j = w({
32
+ [u.suggestionApplied]: x,
33
+ [u.hasSuggestion]: s,
34
+ [u.hasConfidenceReview]: !s && M,
35
+ [u.dateField]: g === "date"
36
+ }), p = d((c) => {
37
+ t(`${o}.aiSuggestionState`, c);
38
+ }, [o, t]), S = d((c) => {
39
+ t(`${o}.value`, c), p(r.Applied), n && (t(`${o}.confidenceScore`, A), t(`${o}.aiSuggestionConfidenceScore`, void 0));
40
+ }, [o, t, p, A, n]), y = d(() => {
41
+ p(r.Initial), t(`${o}.aiSuggestion`, void 0), n && t(`${o}.aiSuggestionConfidenceScore`, void 0);
42
+ }, [p, t, o, n]), T = d(() => {
43
+ t(`${o}.confidenceScore.isAccepted`, !0);
44
+ }, [o, t]), q = d(() => {
45
+ const c = g === "multiSelect" || g === "taxonomy" ? [] : "";
46
+ t(`${o}.value`, c), t(`${o}.confidenceScore`, void 0);
47
+ }, [o, t, g]), I = d(() => {
48
+ y(), n && e.confidenceScore && t(`${o}.confidenceScore`, void 0);
49
+ }, [y, n, e.confidenceScore, t, o]);
50
+ W(() => {
51
+ s && (!a || Array.isArray(a) && a.length === 0) && S(i);
52
+ }, [i, s, S]), W(() => {
53
+ C && i && p(r.Pending);
54
+ }, [C, i, p]);
55
+ const B = J(() => i ? D(a, i) : !1, [i, a]);
56
+ return P ? L ? /* @__PURE__ */ l(K, {
57
+ fieldNamePrefix: o,
56
58
  fieldType: e.type,
57
- isTaxonomyMultiSelect: k,
58
- children: /* @__PURE__ */ g(f, {
59
- ref: N,
59
+ isTaxonomyMultiSelect: U,
60
+ children: /* @__PURE__ */ l(f, {
61
+ ref: F,
60
62
  description: e.description,
61
- disableForm: y,
62
- fieldNamePrefix: i,
63
+ disableForm: h,
64
+ fieldNamePrefix: o,
63
65
  isAiSuggestionApplied: !1,
64
- isExternallyOwned: C,
65
- isMultilevelTaxonomyFieldEnabled: w,
66
+ isExternallyOwned: N,
67
+ isMultilevelTaxonomyFieldEnabled: V,
66
68
  label: e.displayName,
67
69
  levels: e.levels,
68
- onValueEdited: F,
69
- portalElement: h,
70
+ onValueEdited: I,
71
+ portalElement: $,
70
72
  taxonomyOptionsFetcher: v
71
73
  })
72
- }, e.key) : /* @__PURE__ */ G("div", {
73
- className: l.fieldWrapper,
74
- children: [/* @__PURE__ */ g(f, {
75
- ref: N,
76
- className: P,
74
+ }, e.key) : /* @__PURE__ */ X("div", {
75
+ className: u.fieldWrapper,
76
+ children: [/* @__PURE__ */ l(f, {
77
+ ref: F,
78
+ className: j,
77
79
  description: e.description,
78
- disableForm: y,
79
- fieldNamePrefix: i,
80
- isAiSuggestionApplied: V,
81
- isExternallyOwned: C,
82
- isMultilevelTaxonomyFieldEnabled: w,
80
+ disableForm: h,
81
+ fieldNamePrefix: o,
82
+ isAiSuggestionApplied: x,
83
+ isExternallyOwned: N,
84
+ confidenceScore: n && !s ? e.confidenceScore : void 0,
85
+ isMultilevelTaxonomyFieldEnabled: V,
83
86
  label: e.displayName,
84
- onValueEdited: F,
85
- portalElement: h,
87
+ onValueEdited: I,
88
+ portalElement: $,
86
89
  taxonomyOptionsFetcher: v
87
- }), n && /* @__PURE__ */ g(J, {
88
- aiSuggestion: t,
89
- isSameValue: j,
90
+ }), s && /* @__PURE__ */ l(Z, {
91
+ aiSuggestion: i,
92
+ confidenceLevel: n ? A?.level : void 0,
93
+ isSameValue: B,
90
94
  onAiSuggestionAppend: () => {
91
- const s = [...new Set([p, t].flat().filter(Boolean))];
92
- S(s);
95
+ const c = [...new Set([a, i].flat().filter(Boolean))];
96
+ S(c);
93
97
  },
94
- onAiSuggestionIgnore: A,
95
- onAiSuggestionReplace: () => S(t),
96
- type: d
97
- }), !n && u && /* @__PURE__ */ g(K, {
98
- onAccept: E,
99
- onClear: U
98
+ onAiSuggestionIgnore: y,
99
+ onAiSuggestionReplace: () => S(i),
100
+ type: g
101
+ }), !s && M && /* @__PURE__ */ l(_, {
102
+ onAccept: T,
103
+ onClear: q
100
104
  })]
101
105
  }, e.key) : null;
102
106
  });
103
107
  export {
104
- ae as MetadataEditorFieldWrapper
108
+ pe as MetadataEditorFieldWrapper
105
109
  };
@@ -1,10 +1,12 @@
1
- import "@box/blueprint-web-assets/icons/Logo";
2
1
  import "clsx";
3
- import "../interactive-text/interactive-text.js";
4
- import { g as a, t as g } from "../../../../chunks/utils2.js";
5
2
  import "../../utils/convertDate.js";
3
+ import "../interactive-text/interactive-text.js";
4
+ import { g as s, t as l } from "../../../../chunks/utils2.js";
6
5
  import "react/jsx-runtime";
6
+ import "../../utils/confidence-score/is-confidence-score-needing-review.js";
7
+ import "./components/low-confidence-badge/low-confidence-badge.js";
8
+ import "./components/ai-logo-badge/ai-logo-badge.js";
7
9
  export {
8
- a as getFieldLabel,
9
- g as tryParseDateSuggestion
10
+ s as getFieldLabel,
11
+ l as tryParseDateSuggestion
10
12
  };