@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.
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,23 +1,23 @@
1
1
  import C from "clsx";
2
- import { useFormikContext as M } from "formik";
3
- import oo from "lodash/isEqual";
4
- import eo from "lodash/isUndefined";
5
- import { memo as io, forwardRef as to, useCallback as a, useEffect as K, useMemo as no } from "react";
2
+ import { useFormikContext as oe } from "formik";
3
+ import ie from "lodash/isEqual";
4
+ import te from "lodash/isUndefined";
5
+ import { memo as ne, forwardRef as se, useCallback as c, useEffect as K, useMemo as re } from "react";
6
6
  import { A as p } from "../../../../chunks/types.js";
7
- import { checkIfHasBoundingBoxes as so } from "../../utils/check-if-has-bounding-boxes.js";
7
+ import { checkIfHasBoundingBoxes as ce } from "../../utils/check-if-has-bounding-boxes.js";
8
8
  import { isInteractiveFormElement as q } from "../../utils/is-interactive-form-element.js";
9
9
  import { s as d } from "../../../../chunks/shared-field-styles.module.js";
10
- import { UpdateModeFieldWrapper as ro } from "./components/update-mode-field-wrapper/update-mode-field-wrapper.js";
11
- import { editorFieldTypes as co } from "./editor-field-types.js";
12
- import { s as f } from "../../../../chunks/utils2.js";
13
- import { jsx as m, jsxs as ao } from "react/jsx-runtime";
10
+ import { UpdateModeFieldWrapper as ae } from "./components/update-mode-field-wrapper/update-mode-field-wrapper.js";
11
+ import { editorFieldTypes as pe } from "./editor-field-types.js";
12
+ import { s as S } from "../../../../chunks/utils2.js";
13
+ import { jsx as m, jsxs as ue } from "react/jsx-runtime";
14
14
  import { isConfidenceScoreNeedingReview as w } from "../../utils/confidence-score/is-confidence-score-needing-review.js";
15
- import { AiSuggestionField as po } from "./components/ai-suggestion-field/ai-suggestion-field.js";
16
- import { LowConfidenceSuggestionField as uo } from "./components/low-confidence-suggestion-field/low-confidence-suggestion-field.js";
17
- const Vo = /* @__PURE__ */ io(/* @__PURE__ */ to(({
15
+ import { AiSuggestionField as ge } from "./components/ai-suggestion-field/ai-suggestion-field.js";
16
+ import { LowConfidenceSuggestionField as de } from "./components/low-confidence-suggestion-field/low-confidence-suggestion-field.js";
17
+ const Pe = /* @__PURE__ */ ne(/* @__PURE__ */ se(({
18
18
  disableForm: x,
19
19
  portalElement: N,
20
- field: o,
20
+ field: e,
21
21
  index: H,
22
22
  taxonomyOptionsFetcher: I,
23
23
  isExternallyOwned: L,
@@ -28,45 +28,54 @@ const Vo = /* @__PURE__ */ io(/* @__PURE__ */ to(({
28
28
  }, P) => {
29
29
  const {
30
30
  setFieldValue: i
31
- } = M(), h = o.aiSuggestionState || p.Initial, c = h === p.Pending, B = h === p.Applied, T = h === p.Initial, y = co[o.type], {
31
+ } = oe(), y = e.aiSuggestionState || p.Initial, a = y === p.Pending, B = y === p.Applied, T = y === p.Initial, $ = pe[e.type], {
32
32
  aiSuggestion: r,
33
- aiSuggestionConfidenceScore: $,
33
+ aiSuggestionConfidenceScore: l,
34
34
  aiSuggestionTargetLocation: W,
35
- type: l,
35
+ type: f,
36
36
  value: u
37
- } = o, G = y && !o.hidden, J = !eo(o.updateMode), e = `metadata.fields[${H}]`, Q = o.type === "taxonomy" && o.optionsRules?.multiSelect, k = s && !!o.confidenceScore, F = k && w(o.confidenceScore), X = k && !c && !w(o.confidenceScore), D = z === o.id, Y = so(o.targetLocation), S = k && Y && !!n, Z = C({
38
- [f.aiApproved]: B || X,
39
- [f.hasSuggestion]: c,
40
- [f.hasConfidenceReview]: !c && F,
41
- [f.dateField]: l === "date"
42
- }), g = a((t) => {
43
- i(`${e}.aiSuggestionState`, t);
44
- }, [e, i]), A = a((t) => {
45
- i(`${e}.value`, t), g(p.Applied), s && (i(`${e}.confidenceScore`, $), i(`${e}.aiSuggestionConfidenceScore`, void 0), i(`${e}.targetLocation`, W), i(`${e}.aiSuggestionTargetLocation`, void 0));
46
- }, [e, i, g, $, W, s]), v = a(() => {
47
- g(p.Initial), i(`${e}.aiSuggestion`, void 0), s && (i(`${e}.aiSuggestionConfidenceScore`, void 0), i(`${e}.aiSuggestionTargetLocation`, void 0));
48
- }, [g, i, e, s]), _ = a(() => {
49
- i(`${e}.confidenceScore.isAccepted`, !0), n?.(null);
50
- }, [e, i, n]), b = a(() => {
51
- const t = l === "multiSelect" || l === "taxonomy" ? [] : "";
52
- i(`${e}.value`, t), i(`${e}.confidenceScore`, void 0), n?.(null);
53
- }, [e, i, l, n]), U = a(() => {
54
- v(), s && o.confidenceScore && (i(`${e}.confidenceScore`, void 0), n?.(null));
55
- }, [v, s, o.confidenceScore, i, e, n]), O = a((t) => {
56
- n && (q(t.target) || n(o));
57
- }, [o, n]), E = a((t) => {
37
+ } = e, G = $ && !e.hidden, J = !te(e.updateMode), o = `metadata.fields[${H}]`, Q = e.type === "taxonomy" && e.optionsRules?.multiSelect, k = s && !!e.confidenceScore, F = k && w(e.confidenceScore), X = k && !a && !w(e.confidenceScore), D = z === e.id, Y = ce(e.targetLocation), A = k && Y && !!n, Z = C({
38
+ [S.aiApproved]: B || X,
39
+ [S.hasSuggestion]: a,
40
+ [S.hasConfidenceReview]: !a && F,
41
+ [S.dateField]: f === "date"
42
+ }), g = c((t) => {
43
+ i(`${o}.aiSuggestionState`, t);
44
+ }, [o, i]), h = c((t, M = !1) => {
45
+ if (i(`${o}.value`, t), g(p.Applied), s && l) {
46
+ const ee = M ? {
47
+ ...l,
48
+ isAccepted: !0
49
+ } : l;
50
+ i(`${o}.confidenceScore`, ee), i(`${o}.aiSuggestionConfidenceScore`, void 0), i(`${o}.targetLocation`, W), i(`${o}.aiSuggestionTargetLocation`, void 0);
51
+ }
52
+ }, [o, i, g, l, W, s]), v = c(() => {
53
+ g(p.Initial), i(`${o}.aiSuggestion`, void 0), s && (i(`${o}.aiSuggestionConfidenceScore`, void 0), i(`${o}.aiSuggestionTargetLocation`, void 0));
54
+ }, [g, i, o, s]), _ = c(() => {
55
+ e.confidenceScore && i(`${o}.confidenceScore`, {
56
+ ...e.confidenceScore,
57
+ isAccepted: !0
58
+ }), n?.(null);
59
+ }, [o, i, e.confidenceScore, n]), b = c(() => {
60
+ const t = f === "multiSelect" || f === "taxonomy" ? [] : "";
61
+ i(`${o}.value`, t), i(`${o}.confidenceScore`, void 0), n?.(null);
62
+ }, [o, i, f, n]), U = c(() => {
63
+ v(), s && e.confidenceScore && (i(`${o}.confidenceScore`, void 0), n?.(null));
64
+ }, [v, s, e.confidenceScore, i, o, n]), O = c((t) => {
65
+ n && (q(t.target) || n(e));
66
+ }, [e, n]), E = c((t) => {
58
67
  if (t.key === "Enter") {
59
68
  if (!n || q(t.target))
60
69
  return;
61
- t.preventDefault(), t.stopPropagation(), n(o);
70
+ t.preventDefault(), t.stopPropagation(), n(e);
62
71
  }
63
- }, [o, n]);
72
+ }, [e, n]);
64
73
  K(() => {
65
- c && (!u || Array.isArray(u) && u.length === 0) && A(r);
66
- }, [r, c, A]), K(() => {
74
+ a && (!u || Array.isArray(u) && u.length === 0) && h(r);
75
+ }, [r, a, h]), K(() => {
67
76
  T && r && g(p.Pending);
68
77
  }, [T, r, g]);
69
- const R = no(() => r ? oo(u, r) : !1, [r, u]);
78
+ const R = re(() => r ? ie(u, r) : !1, [r, u]);
70
79
  if (!G)
71
80
  return null;
72
81
  const j = {
@@ -78,65 +87,65 @@ const Vo = /* @__PURE__ */ io(/* @__PURE__ */ to(({
78
87
  tabIndex: 0
79
88
  };
80
89
  if (J) {
81
- const t = /* @__PURE__ */ m(ro, {
82
- fieldNamePrefix: e,
83
- fieldType: o.type,
90
+ const t = /* @__PURE__ */ m(ae, {
91
+ fieldNamePrefix: o,
92
+ fieldType: e.type,
84
93
  isTaxonomyMultiSelect: Q,
85
- children: /* @__PURE__ */ m(y, {
94
+ children: /* @__PURE__ */ m($, {
86
95
  ref: P,
87
- description: o.description,
96
+ description: e.description,
88
97
  disableForm: x,
89
- fieldNamePrefix: e,
98
+ fieldNamePrefix: o,
90
99
  isAiSuggestionApplied: !1,
91
100
  isExternallyOwned: L,
92
101
  isMultilevelTaxonomyFieldEnabled: V,
93
- label: o.displayName,
94
- levels: o.levels,
102
+ label: e.displayName,
103
+ levels: e.levels,
95
104
  onValueEdited: U,
96
105
  portalElement: N,
97
106
  taxonomyOptionsFetcher: I
98
107
  })
99
- }, o.key);
100
- return S ? /* @__PURE__ */ m("div", {
108
+ }, e.key);
109
+ return A ? /* @__PURE__ */ m("div", {
101
110
  className: C(d.spacious, d.clickableField, D && d.selectedField),
102
111
  ...j,
103
112
  children: t
104
113
  }) : t;
105
114
  }
106
- return /* @__PURE__ */ ao("div", {
107
- className: C(f.fieldWrapper, s && d.spacious, S && d.clickableField, S && D && d.selectedField),
108
- ...S && j,
109
- children: [/* @__PURE__ */ m(y, {
115
+ return /* @__PURE__ */ ue("div", {
116
+ className: C(S.fieldWrapper, s && d.spacious, A && d.clickableField, A && D && d.selectedField),
117
+ ...A && j,
118
+ children: [/* @__PURE__ */ m($, {
110
119
  ref: P,
111
120
  className: Z,
112
- description: o.description,
121
+ description: e.description,
113
122
  disableForm: x,
114
- fieldNamePrefix: e,
123
+ fieldNamePrefix: o,
115
124
  isAiSuggestionApplied: B,
116
125
  isExternallyOwned: L,
117
- confidenceScore: s && !c ? o.confidenceScore : void 0,
126
+ confidenceScore: s ? e.confidenceScore : void 0,
118
127
  isMultilevelTaxonomyFieldEnabled: V,
119
- label: o.displayName,
128
+ label: e.displayName,
120
129
  onValueEdited: U,
121
130
  portalElement: N,
122
131
  taxonomyOptionsFetcher: I
123
- }), c && /* @__PURE__ */ m(po, {
132
+ }), a && /* @__PURE__ */ m(ge, {
124
133
  aiSuggestion: r,
125
- confidenceLevel: s ? $?.level : void 0,
134
+ confidenceLevel: s ? l?.level : void 0,
126
135
  isSameValue: R,
127
136
  onAiSuggestionAppend: () => {
128
137
  const t = [...new Set([u, r].flat().filter(Boolean))];
129
- A(t);
138
+ h(t, !0);
130
139
  },
131
140
  onAiSuggestionIgnore: v,
132
- onAiSuggestionReplace: () => A(r),
133
- type: l
134
- }), !c && F && /* @__PURE__ */ m(uo, {
141
+ onAiSuggestionReplace: () => h(r, !0),
142
+ type: f
143
+ }), !a && F && /* @__PURE__ */ m(de, {
135
144
  onAccept: _,
136
145
  onClear: b
137
146
  })]
138
- }, o.key);
147
+ }, e.key);
139
148
  }));
140
149
  export {
141
- Vo as MetadataEditorFieldWrapper
150
+ Pe as MetadataEditorFieldWrapper
142
151
  };
@@ -1,36 +1,43 @@
1
- import { useRef as f, useEffect as l } from "react";
2
- import { Text as c } from "@box/blueprint-web";
3
- import { useFormikContext as d, getIn as p, FieldArray as u } from "formik";
4
- import { FormattedMessage as x } from "react-intl";
1
+ import { Text as d } from "@box/blueprint-web";
2
+ import { useFormikContext as c, getIn as u, FieldArray as p } from "formik";
3
+ import { useRef as F, useEffect as h, createElement as x } from "react";
4
+ import { FormattedMessage as y } from "react-intl";
5
5
  import g from "../../messages.js";
6
- import { MetadataEditorFieldWrapper as h } from "./metadata-editor-field-wrapper.js";
7
- import { s as F } from "../../../../chunks/utils2.js";
8
- import { jsx as t } from "react/jsx-runtime";
9
- const C = (m) => {
6
+ import { MetadataEditorFieldWrapper as v } from "./metadata-editor-field-wrapper.js";
7
+ import { useReviewFieldFilter as E } from "./hooks/use-review-field-filter.js";
8
+ import { s as R } from "../../../../chunks/utils2.js";
9
+ import { jsx as o } from "react/jsx-runtime";
10
+ const N = (r) => {
10
11
  const {
11
- values: i
12
- } = d(), o = "metadata.fields", r = p(i, o), s = f(null), a = r.findIndex((e) => !e.hidden);
13
- return l(() => {
14
- a > -1 && s.current?.focus();
15
- }, []), r.length ? /* @__PURE__ */ t(u, {
16
- name: o,
12
+ shouldShowOnlyReviewFields: m = !1
13
+ } = r, {
14
+ values: l
15
+ } = c(), s = "metadata.fields", t = u(l, s), n = F(null), f = E(t, m), a = t.findIndex((e) => !e.hidden);
16
+ return h(() => {
17
+ a > -1 && n.current?.focus();
18
+ }, []), t.length ? /* @__PURE__ */ o(p, {
19
+ name: s,
17
20
  validateOnChange: !1,
18
- children: () => r.map((e, n) => /* @__PURE__ */ t(h, {
19
- ...m,
20
- ref: n === a ? s : null,
21
+ children: () => f.map(({
21
22
  field: e,
22
- index: n
23
- }, e.key))
24
- }) : /* @__PURE__ */ t(c, {
23
+ originalIndex: i
24
+ }) => /* @__PURE__ */ x(v, {
25
+ ...r,
26
+ key: e.key,
27
+ ref: i === a ? n : null,
28
+ field: e,
29
+ index: i
30
+ }))
31
+ }) : /* @__PURE__ */ o(d, {
25
32
  as: "span",
26
- className: F.noAttributesText,
33
+ className: R.noAttributesText,
27
34
  color: "textOnLightSecondary",
28
- children: /* @__PURE__ */ t(x, {
35
+ children: /* @__PURE__ */ o(y, {
29
36
  ...g.noTemplateAtributesError
30
37
  })
31
38
  });
32
39
  };
33
40
  export {
34
- C as TemplateInstance,
35
- C as default
41
+ N as TemplateInstance,
42
+ N as default
36
43
  };
@@ -34,18 +34,18 @@ const pe = ({
34
34
  isBetaLanguageEnabled: R,
35
35
  isDeleteButtonDisabled: T,
36
36
  isDeleteConfirmationModalCheckboxEnabled: L,
37
- isMultilevelTaxonomyFieldEnabled: f,
37
+ isMultilevelTaxonomyFieldEnabled: u,
38
38
  isUnsavedChangesModalOpen: k = !1,
39
39
  MetadataInstanceFormCustomWrapper: N,
40
40
  selectedTemplateInstance: e,
41
41
  onCancel: P,
42
- onChange: u,
42
+ onChange: g,
43
43
  onDelete: U,
44
44
  onDiscardUnsavedChanges: B,
45
45
  onSubmit: K,
46
46
  onToggleReviewFilter: V,
47
- setIsUnsavedChangesModalOpen: g,
48
- shouldShowOnlyReviewFields: h = !1,
47
+ setIsUnsavedChangesModalOpen: h,
48
+ shouldShowOnlyReviewFields: f = !1,
49
49
  taxonomyOptionsFetcher: C,
50
50
  isConfidenceScoreReviewEnabled: r = !1,
51
51
  onSelectMetadataField: E,
@@ -63,7 +63,7 @@ const pe = ({
63
63
  const S = e?.templateKey === ne, q = async (a) => {
64
64
  await K(a, me(a, e));
65
65
  }, G = (a) => {
66
- a ? g(!0) : P();
66
+ a ? h(!0) : P();
67
67
  }, J = () => {
68
68
  M(!0);
69
69
  }, z = {
@@ -96,14 +96,15 @@ const pe = ({
96
96
  disableForm: o,
97
97
  isConfidenceScoreReviewEnabled: r,
98
98
  isExternallyOwned: e?.isExternallyOwned,
99
- isMultilevelTaxonomyFieldEnabled: f,
99
+ isMultilevelTaxonomyFieldEnabled: u,
100
100
  onSelectMetadataField: E,
101
101
  selectedMetadataFieldId: F,
102
102
  portalElement: t ?? x,
103
+ shouldShowOnlyReviewFields: f,
103
104
  taxonomyOptionsFetcher: C
104
105
  })]
105
106
  });
106
- }, [e?.fields.length, e?.isExternallyOwned, S, o, b, t, x, C, p, r, f, c, h, E, F]);
107
+ }, [e?.fields.length, e?.isExternallyOwned, S, o, b, t, x, C, p, r, u, c, f, E, F]);
107
108
  return /* @__PURE__ */ n(Z, {
108
109
  initialValues: z,
109
110
  onSubmit: q,
@@ -129,15 +130,15 @@ const pe = ({
129
130
  isLargeFile: s,
130
131
  onToggleReviewFilter: V,
131
132
  selectedTemplateInstance: e,
132
- shouldShowOnlyReviewFields: h,
133
+ shouldShowOnlyReviewFields: f,
133
134
  suggestions: $,
134
135
  children: e && Q
135
- }), u && /* @__PURE__ */ n(pe, {
136
+ }), g && /* @__PURE__ */ n(pe, {
136
137
  dirty: i,
137
- onChange: u,
138
+ onChange: g,
138
139
  values: a
139
140
  }), /* @__PURE__ */ n(ce, {
140
- onBackToEdit: () => g(!1),
141
+ onBackToEdit: () => h(!1),
141
142
  onDiscardChanges: B,
142
143
  open: k
143
144
  }), /* @__PURE__ */ n(X, {
@@ -1,7 +1,7 @@
1
- import "lodash/isEmpty";
2
1
  import "lodash/isArray";
3
- import { c as m, g as i } from "../../../../../../chunks/utils.js";
2
+ import "lodash/isEmpty";
4
3
  import "../../../../constants.js";
4
+ import { c as m, g as i } from "../../../../../../chunks/utils.js";
5
5
  export {
6
6
  m as createJSONPatch,
7
7
  i as getFormatedFieldValue
@@ -1,58 +1,58 @@
1
1
  import { useFormikContext as M } from "formik";
2
- import { useMemo as h } from "react";
3
- import { useIntl as v } from "react-intl";
4
- import { getFieldsNeedingReview as w } from "../../../../utils/confidence-score/get-fields-needing-review.js";
5
- import W from "../../../interactive-header-text/interactive-header-text.js";
2
+ import { useMemo as v } from "react";
3
+ import { useIntl as W } from "react-intl";
4
+ import { getFieldsNeedingReview as h } from "../../../../utils/confidence-score/get-fields-needing-review.js";
5
+ import T from "../../../interactive-header-text/interactive-header-text.js";
6
6
  import { MetadataInstanceReviewNotice as g } from "../../../metadata-instance-review-notice/metadata-instance-review-notice.js";
7
- import { MetadataInstanceFormAutofillButton as T } from "../metadata-instance-form-autofill-button/metadata-instance-form-autofill-button.js";
8
- import { MetadataInstanceFormInlineNotice as j } from "../metadata-instance-form-inline-notice/metadata-instance-form-inline-notice.js";
9
- import k from "./messages.js";
10
- import { jsxs as c, jsx as t } from "react/jsx-runtime";
11
- import '../../../../../../styles/metadata-instance-form-header.css';const y = "_metadataInstanceFormHeaderWrapper_3nbmr_1", C = "_metadataInstanceFormHeader_3nbmr_1", R = "_title_3nbmr_15", a = {
12
- metadataInstanceFormHeaderWrapper: y,
13
- metadataInstanceFormHeader: C,
14
- title: R
15
- }, O = ({
7
+ import { MetadataInstanceFormAutofillButton as j } from "../metadata-instance-form-autofill-button/metadata-instance-form-autofill-button.js";
8
+ import { MetadataInstanceFormInlineNotice as k } from "../metadata-instance-form-inline-notice/metadata-instance-form-inline-notice.js";
9
+ import w from "./messages.js";
10
+ import { jsxs as d, jsx as t } from "react/jsx-runtime";
11
+ import '../../../../../../styles/metadata-instance-form-header.css';const C = "_metadataInstanceFormHeaderWrapper_3nbmr_1", b = "_metadataInstanceFormHeader_3nbmr_1", q = "_title_3nbmr_15", a = {
12
+ metadataInstanceFormHeaderWrapper: C,
13
+ metadataInstanceFormHeader: b,
14
+ title: q
15
+ }, R = ({
16
16
  areAiSuggestionsAvailable: r,
17
- hasSuggestions: i,
18
- isAdvancedExtractAgentEnabled: d = !1,
19
- isAiSuggestionsFeatureEnabled: l,
20
- isBetaLanguageEnabled: o,
17
+ hasSuggestions: l,
18
+ isAdvancedExtractAgentEnabled: p = !1,
19
+ isAiSuggestionsFeatureEnabled: f,
20
+ isBetaLanguageEnabled: m,
21
21
  isConfidenceScoreReviewEnabled: e = !1,
22
- isLargeFile: p,
23
- isLoading: f,
24
- onToggleReviewFilter: m,
25
- shouldShowOnlyReviewFields: I = !1,
22
+ isLargeFile: I,
23
+ isLoading: o,
24
+ onToggleReviewFilter: n,
25
+ shouldShowOnlyReviewFields: s = !1,
26
26
  templateName: F,
27
- onAutofill: u
27
+ onAutofill: H
28
28
  }) => {
29
- const H = v(), {
30
- values: n
31
- } = M(), s = h(() => e ? w(n.metadata?.fields ?? []).length : 0, [n.metadata?.fields, e]), N = F ?? H.formatMessage(k.customInstanceTitle), _ = i && r, x = e && s > 0 && m !== void 0;
32
- return /* @__PURE__ */ c("div", {
29
+ const u = W(), {
30
+ values: c
31
+ } = M(), i = v(() => e ? h(c.metadata?.fields ?? []).length : 0, [c.metadata?.fields, e]), N = F ?? u.formatMessage(w.customInstanceTitle), _ = l && r, x = e && !o && (i > 0 || s) && n !== void 0;
32
+ return /* @__PURE__ */ d("div", {
33
33
  className: a.metadataInstanceFormHeaderWrapper,
34
- children: [/* @__PURE__ */ c("div", {
34
+ children: [/* @__PURE__ */ d("div", {
35
35
  className: a.metadataInstanceFormHeader,
36
- children: [/* @__PURE__ */ t(W, {
36
+ children: [/* @__PURE__ */ t(T, {
37
37
  className: a.title,
38
38
  title: N
39
- }), l ? /* @__PURE__ */ t(T, {
39
+ }), f ? /* @__PURE__ */ t(j, {
40
40
  areAiSuggestionsAvailable: r,
41
- isAdvancedExtractAgentEnabled: d,
42
- isBetaLanguageEnabled: o,
43
- isLoading: f,
44
- onAutofill: u
41
+ isAdvancedExtractAgentEnabled: p,
42
+ isBetaLanguageEnabled: m,
43
+ isLoading: o,
44
+ onAutofill: H
45
45
  }) : null]
46
- }), _ && /* @__PURE__ */ t(j, {
47
- isBetaLanguageEnabled: o,
48
- isLargeFile: p
46
+ }), _ && /* @__PURE__ */ t(k, {
47
+ isBetaLanguageEnabled: m,
48
+ isLargeFile: I
49
49
  }), x && /* @__PURE__ */ t(g, {
50
- fieldsNeedingReviewCount: s,
51
- isLowScoreFilteringEnabled: I,
52
- onTextToggleClick: m
50
+ fieldsNeedingReviewCount: i,
51
+ isLowScoreFilteringEnabled: s,
52
+ onTextToggleClick: n
53
53
  })]
54
54
  });
55
55
  };
56
56
  export {
57
- O as MetadataInstanceFormHeader
57
+ R as MetadataInstanceFormHeader
58
58
  };
@@ -1,28 +1,20 @@
1
1
  import { C as t } from "../../../../chunks/types.js";
2
- import { formatConfidenceScorePercent as l } from "./format-confidence-score-percent.js";
3
- import i from "./messages.js";
4
- function u(o, e) {
5
- const r = l(e.value);
6
- if (e.isAccepted && e.level === t.High)
7
- return null;
8
- if (e.isAccepted)
9
- return o(i.tooltipReviewedAndAccepted, {
10
- score: r
11
- });
12
- switch (e.level) {
2
+ import o from "./messages.js";
3
+ function p(e, i) {
4
+ if (i.isAccepted && i.level === t.High)
5
+ return e(o.tooltipHighConfidence);
6
+ if (i.isAccepted)
7
+ return e(o.tooltipReviewedAndAccepted);
8
+ switch (i.level) {
13
9
  case t.Low:
14
10
  case t.Medium:
15
- return o(i.tooltipLowConfidence, {
16
- score: r
17
- });
11
+ return e(o.tooltipLowConfidence);
18
12
  case t.High:
19
- return o(i.tooltipHighConfidence, {
20
- score: r
21
- });
13
+ return e(o.tooltipHighConfidence);
22
14
  default:
23
15
  return null;
24
16
  }
25
17
  }
26
18
  export {
27
- u as getConfidenceScoreTooltip
19
+ p as getConfidenceScoreTooltip
28
20
  };
@@ -1,6 +1,7 @@
1
- import { isConfidenceScoreNeedingReview as i } from "./is-confidence-score-needing-review.js";
1
+ import { A as i } from "../../../../chunks/types.js";
2
+ import { isConfidenceScoreNeedingReview as r } from "./is-confidence-score-needing-review.js";
2
3
  function c(n) {
3
- return n.filter((e) => !e.hidden && !!e.confidenceScore && i(e.confidenceScore));
4
+ return n.filter((e) => e.hidden ? !1 : e.aiSuggestionConfidenceScore && e.aiSuggestionState === i.Pending ? !0 : !!e.confidenceScore && r(e.confidenceScore));
4
5
  }
5
6
  export {
6
7
  c as getFieldsNeedingReview
@@ -1,18 +1,18 @@
1
1
  import { defineMessages as e } from "react-intl";
2
- const t = e({
2
+ const o = e({
3
3
  tooltipLowConfidence: {
4
4
  id: "metadataEditor.confidenceScore.tooltipLowConfidence",
5
- defaultMessage: "Box AI returned low confidence ({score}) level for this extraction. Review the value."
5
+ defaultMessage: "Box AI returned low confidence level for this extraction. Review the value."
6
6
  },
7
7
  tooltipReviewedAndAccepted: {
8
8
  id: "metadataEditor.confidenceScore.tooltipReviewedAndAccepted",
9
- defaultMessage: "Box AI returned low confidence ({score}) level for this extraction but it was accepted by a human."
9
+ defaultMessage: "Box AI returned low confidence level for this extraction but it was accepted by a human."
10
10
  },
11
11
  tooltipHighConfidence: {
12
12
  id: "metadataEditor.confidenceScore.tooltipHighConfidence",
13
- defaultMessage: "Box AI returned high confidence ({score}) level for this extraction."
13
+ defaultMessage: "Box AI returned high confidence level for this extraction."
14
14
  }
15
15
  });
16
16
  export {
17
- t as default
17
+ o as default
18
18
  };
@@ -47,14 +47,18 @@ export default {
47
47
  "metadataEditor.addMetadataTemplate.customMetadataName": "কাস্টম মেটাডেটা",
48
48
  "metadataEditor.addMetadataTemplate.search.placeholder": "টেমপ্লেট খুঁজুন",
49
49
  "metadataEditor.addMetadataTemplate.trigger.label": "টেমপ্লেট যোগ করুন",
50
+ "metadataEditor.aiSuggestionField.acceptLabel": "Accept suggestion",
50
51
  "metadataEditor.aiSuggestionField.aiSuggestionCaption": "Box AI পরামর্শ:",
51
52
  "metadataEditor.aiSuggestionField.aiSuggestionCaptionWithLevel": "Box AI-র পরামর্শ ({level} আত্মবিশ্বাস)",
52
53
  "metadataEditor.aiSuggestionField.aiSuggestionOptions": "বিকল্প",
53
54
  "metadataEditor.aiSuggestionField.appendLabel": "সংযুক্ত করুন",
54
55
  "metadataEditor.aiSuggestionField.clearAndReplaceLabel": "পরিষ্কার করুন এবং প্রতিস্থাপন করুন",
56
+ "metadataEditor.aiSuggestionField.confidenceLevelHigh": "High",
57
+ "metadataEditor.aiSuggestionField.confidenceLevelLow": "Low",
55
58
  "metadataEditor.aiSuggestionField.dismissLabel": "নিশ্চিত করুন",
56
59
  "metadataEditor.aiSuggestionField.ignoreLabel": "উপেক্ষা করুন",
57
60
  "metadataEditor.aiSuggestionField.sameValueAiSuggestionCaption": "Box AI উপরের মতো একই মান প্রস্তাব করে",
61
+ "metadataEditor.aiSuggestionField.sameValueAiSuggestionCaptionWithLevel": "Box AI suggests the same value as above ({level} confidence)",
58
62
  "metadataEditor.autofillButton.ariaLabel": "Box AI-এর মাধ্যমে অটোফিল করুন",
59
63
  "metadataEditor.autofillButton.ariaLabelWithTemplateName": "Box AI দিয়ে {templateName} অটোফিল করুন",
60
64
  "metadataEditor.autofillButton.tooltip.enhanced": "Box AI (বর্ধিত)-এর মাধ্যমে অটোফিল করুন",
@@ -47,14 +47,18 @@ export default {
47
47
  "metadataEditor.addMetadataTemplate.customMetadataName": "Brugerdefineret metadata",
48
48
  "metadataEditor.addMetadataTemplate.search.placeholder": "Søg efter skabeloner",
49
49
  "metadataEditor.addMetadataTemplate.trigger.label": "Tilføj skabelon",
50
+ "metadataEditor.aiSuggestionField.acceptLabel": "Accept suggestion",
50
51
  "metadataEditor.aiSuggestionField.aiSuggestionCaption": "Box AI",
51
52
  "metadataEditor.aiSuggestionField.aiSuggestionCaptionWithLevel": "Box AI-forslag ({level} tillid)",
52
53
  "metadataEditor.aiSuggestionField.aiSuggestionOptions": "Indstillingsmuligheder",
53
54
  "metadataEditor.aiSuggestionField.appendLabel": "Tilføj",
54
55
  "metadataEditor.aiSuggestionField.clearAndReplaceLabel": "Ryd og Erstat",
56
+ "metadataEditor.aiSuggestionField.confidenceLevelHigh": "High",
57
+ "metadataEditor.aiSuggestionField.confidenceLevelLow": "Low",
55
58
  "metadataEditor.aiSuggestionField.dismissLabel": "Bekræft",
56
59
  "metadataEditor.aiSuggestionField.ignoreLabel": "Ignorer",
57
60
  "metadataEditor.aiSuggestionField.sameValueAiSuggestionCaption": "Box AI foreslår den samme værdi som ovenfor",
61
+ "metadataEditor.aiSuggestionField.sameValueAiSuggestionCaptionWithLevel": "Box AI suggests the same value as above ({level} confidence)",
58
62
  "metadataEditor.autofillButton.ariaLabel": "Automatisk udfyldning med Box AI",
59
63
  "metadataEditor.autofillButton.ariaLabelWithTemplateName": "Automatisk udfyldning af {templateName} med Box AI",
60
64
  "metadataEditor.autofillButton.tooltip.enhanced": "Automatisk udfyldning med Box AI (Forbedret)",
@@ -47,14 +47,18 @@ export default {
47
47
  "metadataEditor.addMetadataTemplate.customMetadataName": "Selbst definierte Metadaten",
48
48
  "metadataEditor.addMetadataTemplate.search.placeholder": "Suchvorlagen",
49
49
  "metadataEditor.addMetadataTemplate.trigger.label": "Vorlage hinzufügen",
50
+ "metadataEditor.aiSuggestionField.acceptLabel": "Accept suggestion",
50
51
  "metadataEditor.aiSuggestionField.aiSuggestionCaption": "Box-AI-Vorschlag:",
51
52
  "metadataEditor.aiSuggestionField.aiSuggestionCaptionWithLevel": "Box AI-Vorschlag ({level} Konfidenzniveau)",
52
53
  "metadataEditor.aiSuggestionField.aiSuggestionOptions": "Optionen",
53
54
  "metadataEditor.aiSuggestionField.appendLabel": "Anfügen",
54
55
  "metadataEditor.aiSuggestionField.clearAndReplaceLabel": "Löschen und ersetzen",
56
+ "metadataEditor.aiSuggestionField.confidenceLevelHigh": "High",
57
+ "metadataEditor.aiSuggestionField.confidenceLevelLow": "Low",
55
58
  "metadataEditor.aiSuggestionField.dismissLabel": "Bestätigen",
56
59
  "metadataEditor.aiSuggestionField.ignoreLabel": "Ignorieren",
57
60
  "metadataEditor.aiSuggestionField.sameValueAiSuggestionCaption": "Box AI schlägt denselben Wert wie oben vor",
61
+ "metadataEditor.aiSuggestionField.sameValueAiSuggestionCaptionWithLevel": "Box AI suggests the same value as above ({level} confidence)",
58
62
  "metadataEditor.autofillButton.ariaLabel": "Automatisch ausfüllen mit Box AI",
59
63
  "metadataEditor.autofillButton.ariaLabelWithTemplateName": "Mit Box KI automatisch ausfüllen {templateName}",
60
64
  "metadataEditor.autofillButton.tooltip.enhanced": "Automatisch ausfüllen mit Box AI (erweitert)",
@@ -47,14 +47,18 @@ export default {
47
47
  "metadataEditor.addMetadataTemplate.customMetadataName": "Custom Metadata",
48
48
  "metadataEditor.addMetadataTemplate.search.placeholder": "Search templates",
49
49
  "metadataEditor.addMetadataTemplate.trigger.label": "Add template",
50
+ "metadataEditor.aiSuggestionField.acceptLabel": "Accept suggestion",
50
51
  "metadataEditor.aiSuggestionField.aiSuggestionCaption": "Box AI suggestion:",
51
52
  "metadataEditor.aiSuggestionField.aiSuggestionCaptionWithLevel": "Box AI suggestion ({level} confidence)",
52
53
  "metadataEditor.aiSuggestionField.aiSuggestionOptions": "Options",
53
54
  "metadataEditor.aiSuggestionField.appendLabel": "Append",
54
55
  "metadataEditor.aiSuggestionField.clearAndReplaceLabel": "Clear and Replace",
56
+ "metadataEditor.aiSuggestionField.confidenceLevelHigh": "High",
57
+ "metadataEditor.aiSuggestionField.confidenceLevelLow": "Low",
55
58
  "metadataEditor.aiSuggestionField.dismissLabel": "Confirm",
56
59
  "metadataEditor.aiSuggestionField.ignoreLabel": "Ignore",
57
60
  "metadataEditor.aiSuggestionField.sameValueAiSuggestionCaption": "Box AI suggests the same value as above",
61
+ "metadataEditor.aiSuggestionField.sameValueAiSuggestionCaptionWithLevel": "Box AI suggests the same value as above ({level} confidence)",
58
62
  "metadataEditor.autofillButton.ariaLabel": "Autofill with Box AI",
59
63
  "metadataEditor.autofillButton.ariaLabelWithTemplateName": "Autofill {templateName} with Box AI",
60
64
  "metadataEditor.autofillButton.tooltip.enhanced": "Autofill with Box AI (Enhanced)",