@box/metadata-editor 1.73.3 → 1.73.4

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 (53) hide show
  1. package/dist/chunks/metadata-instance-content.js +6 -4
  2. package/dist/chunks/metadata-instance-entry.js +59 -59
  3. package/dist/chunks/metadata-instance-list.js +2 -1
  4. package/dist/chunks/metadata-instance.js +14 -13
  5. package/dist/chunks/utils.js +13 -17
  6. package/dist/chunks/utils2.js +20 -17
  7. package/dist/esm/lib/components/metadata-editor-fields/components/ai-logo-badge/ai-logo-badge.js +27 -15
  8. package/dist/esm/lib/components/metadata-editor-fields/messages.js +10 -4
  9. package/dist/esm/lib/components/metadata-editor-fields/metadata-editor-field-wrapper.js +133 -136
  10. package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/metadata-instance-form.js +86 -84
  11. package/dist/i18n/bn-IN.js +1 -0
  12. package/dist/i18n/da-DK.js +1 -0
  13. package/dist/i18n/de-DE.js +1 -0
  14. package/dist/i18n/en-AU.js +1 -0
  15. package/dist/i18n/en-CA.js +1 -0
  16. package/dist/i18n/en-GB.js +1 -0
  17. package/dist/i18n/en-US.js +1 -0
  18. package/dist/i18n/en-US.properties +2 -0
  19. package/dist/i18n/en-x-pseudo.js +1 -0
  20. package/dist/i18n/es-419.js +1 -0
  21. package/dist/i18n/es-ES.js +1 -0
  22. package/dist/i18n/fi-FI.js +1 -0
  23. package/dist/i18n/fr-CA.js +1 -0
  24. package/dist/i18n/fr-FR.js +1 -0
  25. package/dist/i18n/hi-IN.js +1 -0
  26. package/dist/i18n/it-IT.js +1 -0
  27. package/dist/i18n/ja-JP.js +1 -0
  28. package/dist/i18n/json/src/lib/components/metadata-editor-fields/messages.json +1 -1
  29. package/dist/i18n/ko-KR.js +1 -0
  30. package/dist/i18n/nb-NO.js +1 -0
  31. package/dist/i18n/nl-NL.js +1 -0
  32. package/dist/i18n/pl-PL.js +1 -0
  33. package/dist/i18n/pt-BR.js +1 -0
  34. package/dist/i18n/ru-RU.js +1 -0
  35. package/dist/i18n/sv-SE.js +1 -0
  36. package/dist/i18n/tr-TR.js +1 -0
  37. package/dist/i18n/zh-CN.js +1 -0
  38. package/dist/i18n/zh-TW.js +1 -0
  39. package/dist/styles/utils.css +1 -1
  40. package/dist/types/lib/components/metadata-editor-fields/components/ai-logo-badge/ai-logo-badge.d.ts +1 -2
  41. package/dist/types/lib/components/metadata-editor-fields/messages.d.ts +5 -0
  42. package/dist/types/lib/components/metadata-editor-fields/types.d.ts +1 -0
  43. package/dist/types/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/types.d.ts +1 -0
  44. package/dist/types/lib/components/metadata-instance-list/metadata-instance-list.d.ts +1 -1
  45. package/dist/types/lib/components/metadata-instance-list/subcomponents/metadata-instance/metadata-instance.d.ts +1 -1
  46. package/dist/types/lib/components/metadata-instance-list/subcomponents/metadata-instance/types.d.ts +1 -0
  47. package/dist/types/lib/components/metadata-instance-list/subcomponents/metadata-instance-content/metadata-instance-content.d.ts +1 -1
  48. package/dist/types/lib/components/metadata-instance-list/subcomponents/metadata-instance-content/types.d.ts +1 -0
  49. package/dist/types/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/metadata-instance-entry.d.ts +1 -1
  50. package/dist/types/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/types.d.ts +1 -0
  51. package/dist/types/lib/components/metadata-instance-list/types.d.ts +1 -0
  52. package/dist/types/lib/types.d.ts +1 -0
  53. package/package.json +10 -10
@@ -5,13 +5,14 @@ import r from "clsx";
5
5
  import '../styles/metadata-instance-content.css';var i = {
6
6
  metadataInstanceContent: "_metadataInstanceContent_1cb0f_1",
7
7
  metadataInstanceContentReducedGap: "_metadataInstanceContentReducedGap_1cb0f_7"
8
- }, a = ({ onSelectMetadataField: a, selectedMetadataFieldId: o, shouldHideEmptyValues: s, templateInstance: c, taxonomyNodeFetcher: l, isConfidenceScoreReviewEnabled: u }) => {
9
- let { fields: d = [] } = c, f = t(() => d.filter((e) => !e.hidden).map((t) => {
8
+ }, a = ({ onSelectMetadataField: a, selectedMetadataFieldId: o, shouldHideEmptyValues: s, templateInstance: c, taxonomyNodeFetcher: l, isConfidenceScoreReviewEnabled: u, isBoundingBoxEnabled: d }) => {
9
+ let { fields: f = [] } = c, p = t(() => f.filter((e) => !e.hidden).map((t) => {
10
10
  let r = a ? () => a(t) : void 0;
11
11
  return /* @__PURE__ */ n(e, {
12
12
  confidenceScore: t.confidenceScore,
13
13
  description: t.description,
14
14
  isConfidenceScoreReviewEnabled: u,
15
+ isBoundingBoxEnabled: d,
15
16
  isExternallyOwned: c.isExternallyOwned,
16
17
  isSelected: o === t.id,
17
18
  name: t.displayName || t.key,
@@ -25,8 +26,9 @@ import '../styles/metadata-instance-content.css';var i = {
25
26
  targetLocation: t.targetLocation
26
27
  }, t.id);
27
28
  }), [
28
- d,
29
+ f,
29
30
  u,
31
+ d,
30
32
  a,
31
33
  o,
32
34
  s,
@@ -35,7 +37,7 @@ import '../styles/metadata-instance-content.css';var i = {
35
37
  ]);
36
38
  return /* @__PURE__ */ n("div", {
37
39
  className: r(i.metadataInstanceContent, u && i.metadataInstanceContentReducedGap),
38
- children: f
40
+ children: p
39
41
  });
40
42
  };
41
43
  export { a as t };
@@ -8,97 +8,97 @@ import { t as o } from "./shared-field-styles.module.js";
8
8
  import { convertISOStringToUTCDate as s } from "../esm/lib/utils/convertDate.js";
9
9
  import { t as c } from "./interactive-text.module.js";
10
10
  import l from "../esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/messages.js";
11
- import { MetadataEntryDisplay as u } from "../esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/metadata-entry-display.js";
12
- import { Status as d, Text as f, Tooltip as p, useIsEllipsized as m } from "@box/blueprint-web";
13
- import { useRef as h } from "react";
14
- import { FormattedDate as g, useIntl as _ } from "react-intl";
15
- import { Focusable as v } from "@ariakit/react";
16
- import { jsx as y, jsxs as b } from "react/jsx-runtime";
17
- import x from "clsx";
18
- import { AlertCircle as S } from "@box/blueprint-web-assets/icons/Medium";
19
- import '../styles/metadata-instance-entry.css';var C = {
11
+ import { MetadataEntryDisplay as ee } from "../esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/metadata-entry-display.js";
12
+ import { Status as u, Text as d, Tooltip as f, useIsEllipsized as p } from "@box/blueprint-web";
13
+ import { useRef as m } from "react";
14
+ import { FormattedDate as h, useIntl as g } from "react-intl";
15
+ import { Focusable as _ } from "@ariakit/react";
16
+ import { jsx as v, jsxs as y } from "react/jsx-runtime";
17
+ import b from "clsx";
18
+ import { AlertCircle as x } from "@box/blueprint-web-assets/icons/Medium";
19
+ import '../styles/metadata-instance-entry.css';var S = {
20
20
  metadataInstanceEntry: "_metadataInstanceEntry_1ygbk_1",
21
21
  name: "_name_1ygbk_6",
22
22
  nameText: "_nameText_1ygbk_13",
23
23
  labelContainer: "_labelContainer_1ygbk_21",
24
24
  nameLabel: "_nameLabel_1ygbk_28",
25
25
  confidenceScoreIcon: "_confidenceScoreIcon_1ygbk_43"
26
- }, w = ({ description: w, isSelected: T, name: E, onClick: D, shouldHideEmptyValues: O, type: k, value: A, taxonomyNodeFetcher: j, taxonomyKey: M, scope: N, isExternallyOwned: P, confidenceScore: F, isConfidenceScoreReviewEnabled: I = !1, targetLocation: L }) => {
27
- let R = _(), { trackEvent: z } = n(), B = h(null), V = m(B), H = (e) => {
26
+ }, C = ({ description: C, isSelected: w, name: T, onClick: E, shouldHideEmptyValues: D, type: O, value: k, taxonomyNodeFetcher: A, taxonomyKey: j, scope: M, isExternallyOwned: N, confidenceScore: P, isConfidenceScoreReviewEnabled: F = !1, isBoundingBoxEnabled: I = !1, targetLocation: L }) => {
27
+ let R = g(), { trackEvent: z } = n(), B = m(null), V = p(B), H = (e) => {
28
28
  B.current = e instanceof HTMLElement ? e : null;
29
- }, U = I && !!F && a(F), W = r(L), G = I && !!F && W && !!D, K = U ? i(R.formatMessage, F) : null, q = () => z(t.LOW_CONF_ICON_HOVER_READ_MODE, {
30
- fieldType: k,
31
- confidenceLevel: F?.level,
32
- scope: N
33
- }), J = typeof A == "number" ? A.toString() : A ? Array.isArray(A) ? A.join(", ") : k === "date" && typeof A == "string" ? /* @__PURE__ */ y(g, {
29
+ }, U = I || F, W = F && !!P && a(P), G = r(L), K = U && G && !!E, q = W ? i(R.formatMessage, P) : null, J = () => z(t.LOW_CONF_ICON_HOVER_READ_MODE, {
30
+ fieldType: O,
31
+ confidenceLevel: P?.level,
32
+ scope: M
33
+ }), Y = typeof k == "number" ? k.toString() : k ? Array.isArray(k) ? k.join(", ") : O === "date" && typeof k == "string" ? /* @__PURE__ */ v(h, {
34
34
  day: "numeric",
35
35
  month: "long",
36
- value: s(A),
36
+ value: s(k),
37
37
  year: "numeric"
38
- }) : A : null, Y = {
38
+ }) : k : null, X = {
39
39
  "data-metadata-field": !0,
40
40
  "data-target-id": "Button-metadataEditorFieldReadClick",
41
41
  "data-testid": "metadata-field",
42
- onClick: D,
42
+ onClick: E,
43
43
  onKeyDown: (e) => {
44
- e.key === "Enter" && (e.preventDefault(), e.stopPropagation(), D?.());
44
+ e.key === "Enter" && (e.preventDefault(), e.stopPropagation(), E?.());
45
45
  },
46
46
  role: "button",
47
47
  tabIndex: 0
48
48
  };
49
- if (O && !J) return null;
50
- let X = (() => {
51
- if (w) return V ? /* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("div", { children: E }), /* @__PURE__ */ y("div", { children: w })] }) : w;
52
- if (V) return E;
53
- })(), Z = /* @__PURE__ */ y("h5", {
54
- className: C.name,
55
- children: /* @__PURE__ */ y(f, {
49
+ if (D && !Y) return null;
50
+ let Z = (() => {
51
+ if (C) return V ? /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("div", { children: T }), /* @__PURE__ */ v("div", { children: C })] }) : C;
52
+ if (V) return T;
53
+ })(), Q = /* @__PURE__ */ v("h5", {
54
+ className: S.name,
55
+ children: /* @__PURE__ */ v(d, {
56
56
  ref: H,
57
57
  as: "span",
58
- className: x(C.nameText, w && c.interactiveTextHint),
58
+ className: b(S.nameText, C && c.interactiveTextHint),
59
59
  color: "textOnLightSecondary",
60
60
  variant: "bodyDefaultBold",
61
- children: E
61
+ children: T
62
62
  })
63
- }), Q = /* @__PURE__ */ b("div", {
64
- className: x(C.metadataInstanceEntry, I && o.spacious, G && o.clickableField, G && T && o.selectedField),
65
- ...G && Y,
66
- children: [/* @__PURE__ */ b("div", {
67
- className: C.labelContainer,
68
- children: [K && /* @__PURE__ */ y(p, {
69
- content: K,
70
- children: /* @__PURE__ */ y("span", {
71
- className: C.confidenceScoreIcon,
72
- children: /* @__PURE__ */ y(d, {
63
+ }), $ = /* @__PURE__ */ y("div", {
64
+ className: b(S.metadataInstanceEntry, U && o.spacious, K && o.clickableField, K && w && o.selectedField),
65
+ ...K && X,
66
+ children: [/* @__PURE__ */ y("div", {
67
+ className: S.labelContainer,
68
+ children: [q && /* @__PURE__ */ v(f, {
69
+ content: q,
70
+ children: /* @__PURE__ */ v("span", {
71
+ className: S.confidenceScoreIcon,
72
+ children: /* @__PURE__ */ v(u, {
73
73
  "data-target-id": "Status-metadataInstanceEntryConfidenceScoreIcon",
74
74
  color: "SurfaceStatusSurfaceGray",
75
75
  hideText: !0,
76
- icon: S,
76
+ icon: x,
77
77
  interactive: !0,
78
78
  text: R.formatMessage(l.confidenceScoreIconAriaLabel),
79
- onMouseEnter: q
79
+ onMouseEnter: J
80
80
  })
81
81
  })
82
- }), /* @__PURE__ */ y("div", {
83
- className: C.nameLabel,
84
- children: X ? /* @__PURE__ */ y(p, {
85
- content: X,
86
- children: /* @__PURE__ */ y(v, { render: Z })
87
- }) : Z
82
+ }), /* @__PURE__ */ v("div", {
83
+ className: S.nameLabel,
84
+ children: Z ? /* @__PURE__ */ v(f, {
85
+ content: Z,
86
+ children: /* @__PURE__ */ v(_, { render: Q })
87
+ }) : Q
88
88
  })]
89
- }), /* @__PURE__ */ y(u, {
90
- formattedValue: J,
91
- isExternallyOwned: P,
92
- scope: N,
93
- taxonomyKey: M,
94
- taxonomyNodeFetcher: j,
95
- type: k,
96
- value: A
89
+ }), /* @__PURE__ */ v(ee, {
90
+ formattedValue: Y,
91
+ isExternallyOwned: N,
92
+ scope: M,
93
+ taxonomyKey: j,
94
+ taxonomyNodeFetcher: A,
95
+ type: O,
96
+ value: k
97
97
  })]
98
98
  });
99
- return G ? /* @__PURE__ */ y(p, {
99
+ return K ? /* @__PURE__ */ v(f, {
100
100
  content: R.formatMessage(e.viewOnDocument),
101
- children: Q
102
- }) : Q;
101
+ children: $
102
+ }) : $;
103
103
  };
104
- export { w as t };
104
+ export { C as t };
@@ -1,7 +1,7 @@
1
1
  import { getVisibleTemplates as e } from "../esm/lib/utils/utils.js";
2
2
  import { t } from "./metadata-instance.js";
3
3
  import { jsx as n } from "react/jsx-runtime";
4
- import '../styles/metadata-instance-list.css';var r = { metadataInstanceList: "_metadataInstanceList_bd83w_1" }, i = ({ areAiSuggestionsAvailable: i, isAiSuggestionsFeatureEnabled: a, isBetaLanguageEnabled: o, onEdit: s, onSelectMetadataField: c, selectedMetadataFieldId: l, templateInstances: u, taxonomyNodeFetcher: d, isAdvancedExtractAgentEnabled: f = !1, isConfidenceScoreReviewEnabled: p = !1 }) => /* @__PURE__ */ n("div", {
4
+ import '../styles/metadata-instance-list.css';var r = { metadataInstanceList: "_metadataInstanceList_bd83w_1" }, i = ({ areAiSuggestionsAvailable: i, isAiSuggestionsFeatureEnabled: a, isBetaLanguageEnabled: o, onEdit: s, onSelectMetadataField: c, selectedMetadataFieldId: l, templateInstances: u, taxonomyNodeFetcher: d, isAdvancedExtractAgentEnabled: f = !1, isConfidenceScoreReviewEnabled: p = !1, isBoundingBoxEnabled: m = !1 }) => /* @__PURE__ */ n("div", {
5
5
  className: r.metadataInstanceList,
6
6
  children: e(u).map((e) => /* @__PURE__ */ n(t, {
7
7
  areAiSuggestionsAvailable: i,
@@ -9,6 +9,7 @@ import '../styles/metadata-instance-list.css';var r = { metadataInstanceList: "_
9
9
  isAiSuggestionsFeatureEnabled: a,
10
10
  isBetaLanguageEnabled: o,
11
11
  isConfidenceScoreReviewEnabled: p,
12
+ isBoundingBoxEnabled: m,
12
13
  onEdit: s,
13
14
  onSelectMetadataField: c,
14
15
  selectedMetadataFieldId: l,
@@ -12,8 +12,8 @@ import '../styles/metadata-instance.css';var p = {
12
12
  topDivider: "_topDivider_1xnom_1",
13
13
  reviewNotice: "_reviewNotice_1xnom_5",
14
14
  bottomDivider: "_bottomDivider_1xnom_9"
15
- }, m = ({ areAiSuggestionsAvailable: m, isAiSuggestionsFeatureEnabled: h, isBetaLanguageEnabled: g, onEdit: _, onSelectMetadataField: v, selectedMetadataFieldId: y, templateInstance: b, taxonomyNodeFetcher: x, isAdvancedExtractAgentEnabled: S = !1, isConfidenceScoreReviewEnabled: C = !1 }) => {
16
- let w = b.fields, T = (e) => !e.value || Array.isArray(e.value) && e.value.length === 0, E = w.every(T), D = w.some(T), O = w.length > 0, k = n(w).length, A = C && k > 0 && b.canEdit, [j, M] = l(!0), { getAiSuggestions: N } = t();
15
+ }, m = ({ areAiSuggestionsAvailable: m, isAiSuggestionsFeatureEnabled: h, isBetaLanguageEnabled: g, onEdit: _, onSelectMetadataField: v, selectedMetadataFieldId: y, templateInstance: b, taxonomyNodeFetcher: x, isAdvancedExtractAgentEnabled: S = !1, isConfidenceScoreReviewEnabled: C = !1, isBoundingBoxEnabled: w = !1 }) => {
16
+ let T = b.fields, E = (e) => !e.value || Array.isArray(e.value) && e.value.length === 0, D = T.every(E), O = T.some(E), k = T.length > 0, A = n(T).length, j = C && A > 0 && b.canEdit, [M, N] = l(!0), { getAiSuggestions: P } = t();
17
17
  return /* @__PURE__ */ f(s, { children: [
18
18
  /* @__PURE__ */ d(o, {
19
19
  areAiSuggestionsAvailable: m,
@@ -22,37 +22,38 @@ import '../styles/metadata-instance.css';var p = {
22
22
  isAiSuggestionsFeatureEnabled: h,
23
23
  isBetaLanguageEnabled: g,
24
24
  onAutofill: (e) => {
25
- _(b), N(b.templateKey, b.scope, e);
25
+ _(b), P(b.templateKey, b.scope, e);
26
26
  },
27
27
  onEdit: () => _(b),
28
28
  templateName: b?.displayName
29
29
  }),
30
30
  /* @__PURE__ */ d(c, { className: p.topDivider }),
31
- A && /* @__PURE__ */ d("div", {
31
+ j && /* @__PURE__ */ d("div", {
32
32
  className: p.reviewNotice,
33
33
  children: /* @__PURE__ */ d(r, {
34
- fieldsNeedingReviewCount: k,
34
+ fieldsNeedingReviewCount: A,
35
35
  onTextToggleClick: () => {
36
36
  _(b, !0);
37
37
  }
38
38
  })
39
39
  }),
40
- j && E ? /* @__PURE__ */ d(e, {
41
- isAnyEmptyValueHidden: O,
40
+ M && D ? /* @__PURE__ */ d(e, {
41
+ isAnyEmptyValueHidden: k,
42
42
  isBoxAiSuggestionsFeatureEnabled: h,
43
43
  level: "instance",
44
- onShowEmptyValues: () => M(!1)
44
+ onShowEmptyValues: () => N(!1)
45
45
  }) : /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d(i, {
46
46
  isConfidenceScoreReviewEnabled: C,
47
+ isBoundingBoxEnabled: w,
47
48
  onSelectMetadataField: v,
48
49
  selectedMetadataFieldId: y,
49
- shouldHideEmptyValues: j,
50
+ shouldHideEmptyValues: M,
50
51
  taxonomyNodeFetcher: x,
51
52
  templateInstance: b
52
- }), D && /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d(c, { className: p.bottomDivider }), /* @__PURE__ */ d(a, {
53
- isAnyEmptyValueHidden: j,
54
- onHideEmptyValues: () => M(!0),
55
- onShowEmptyValues: () => M(!1)
53
+ }), O && /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d(c, { className: p.bottomDivider }), /* @__PURE__ */ d(a, {
54
+ isAnyEmptyValueHidden: M,
55
+ onHideEmptyValues: () => N(!0),
56
+ onShowEmptyValues: () => N(!1)
56
57
  })] })] })
57
58
  ] });
58
59
  };
@@ -9,19 +9,18 @@ import { Focusable as d } from "@ariakit/react";
9
9
  import { jsx as f, jsxs as p } from "react/jsx-runtime";
10
10
  import m from "clsx";
11
11
  import '../styles/utils.css';var h = {
12
- noAttributesText: "_noAttributesText_19lyy_2",
13
- fieldWrapper: "_fieldWrapper_19lyy_6",
14
- hasSuggestion: "_hasSuggestion_19lyy_11",
15
- hasConfidenceReview: "_hasConfidenceReview_19lyy_16",
16
- error: "_error_19lyy_25",
17
- dateField: "_dateField_19lyy_44",
18
- aiApproved: "_aiApproved_19lyy_49",
19
- comboboxContainer: "_comboboxContainer_19lyy_49",
20
- labelWrapper: "_labelWrapper_19lyy_95",
21
- labelText: "_labelText_19lyy_101",
22
- labelTruncated: "_labelTruncated_19lyy_104",
23
- labelIcon: "_labelIcon_19lyy_111",
24
- labelTooltipStack: "_labelTooltipStack_19lyy_118"
12
+ noAttributesText: "_noAttributesText_1o3kr_2",
13
+ fieldWrapper: "_fieldWrapper_1o3kr_6",
14
+ hasSuggestion: "_hasSuggestion_1o3kr_11",
15
+ hasConfidenceReview: "_hasConfidenceReview_1o3kr_16",
16
+ error: "_error_1o3kr_25",
17
+ dateField: "_dateField_1o3kr_44",
18
+ aiApproved: "_aiApproved_1o3kr_49",
19
+ comboboxContainer: "_comboboxContainer_1o3kr_49",
20
+ labelWrapper: "_labelWrapper_1o3kr_95",
21
+ labelText: "_labelText_1o3kr_102",
22
+ labelTruncated: "_labelTruncated_1o3kr_105",
23
+ labelTooltipStack: "_labelTooltipStack_1o3kr_113"
25
24
  };
26
25
  function g({ as: e, fieldDescription: t, fieldName: r, labelClassName: i, labelRef: l, ...h }) {
27
26
  let g = u(null), _ = o(g, l);
@@ -46,10 +45,7 @@ function _({ as: e, fieldName: t, labelClassName: n, labelRef: r, ...i }) {
46
45
  }) : h;
47
46
  }
48
47
  var v = /* @__PURE__ */ l(function({ fieldName: t, fieldDescription: n, isAiSuggestionApplied: a, as: o, confidenceScore: s, labelProps: c }) {
49
- let { className: l, ref: u, ...d } = c, v = m(l || h.labelText, h.labelTruncated), y = !!s && e(s), b = () => s && y ? /* @__PURE__ */ f(i, {}) : a || s ? /* @__PURE__ */ f(r, {
50
- className: h.labelIcon,
51
- confidenceScore: s
52
- }) : null, x = n ? /* @__PURE__ */ f(g, {
48
+ let { className: l, ref: u, ...d } = c, v = m(l || h.labelText, h.labelTruncated), y = !!s && e(s), b = () => s && y ? /* @__PURE__ */ f(i, {}) : a || s ? /* @__PURE__ */ f(r, { confidenceScore: s }) : null, x = n ? /* @__PURE__ */ f(g, {
53
49
  as: o,
54
50
  fieldDescription: n,
55
51
  fieldName: t,
@@ -7,44 +7,47 @@ var i = {
7
7
  REMOVE: "remove",
8
8
  REPLACE: "replace",
9
9
  TEST: "test"
10
- }, a = "AI_ACCEPTED", o = (e, t) => e.value === t.value && e.level === t.level && e.isAccepted === t.isAccepted, s = (e) => e.value === void 0 || e.value === null || e.value === "" || n(e.value) && r(e.value), c = (e, t, n) => {
10
+ }, a = "AI_ACCEPTED", o = "AI_EXTRACTED", s = (e, n, r) => {
11
+ let i = !n.isExtracted && r.isExtracted, a = r.targetLocation && !t(n.targetLocation, r.targetLocation);
12
+ return i || a ? [g(`${e}/process`, o)] : [];
13
+ }, c = (e, t) => e.value === t.value && e.level === t.level && e.isAccepted === t.isAccepted, l = (e) => e.value === void 0 || e.value === null || e.value === "" || n(e.value) && r(e.value), u = (e, t, n) => {
11
14
  let r = t.confidenceScore, i = n.confidenceScore;
12
- return !i || r && o(r, i) ? [] : l(e, i);
13
- }, l = (e, t) => {
15
+ return !i || r && c(r, i) ? [] : d(e, i);
16
+ }, d = (e, t) => {
14
17
  let n = [];
15
- return t.isAccepted && n.push(m(`${e}/process`, a)), n.push(m(`${e}/confidenceScore`, t.value), m(`${e}/confidenceLevel`, t.level)), n;
16
- }, u = (e, n, r) => {
18
+ return t.isAccepted && n.push(g(`${e}/process`, a)), n.push(g(`${e}/confidenceScore`, t.value), g(`${e}/confidenceLevel`, t.level)), n;
19
+ }, f = (e, n, r) => {
17
20
  let i = n.targetLocation, a = r.targetLocation, o = n.confidenceScore?.isAccepted ?? !1, s = r.confidenceScore?.isAccepted ?? !1, c = !o && s;
18
- return a && (!t(i, a) || c) ? [m(`${e}/targetLocation`, JSON.stringify(a))] : [];
19
- }, d = (n, r) => {
20
- let i = [], a = n.metadata.fields, o = r.templateKey === e, l = new Map(r.fields.map((e) => [e.key, e])), d = new Map(a.map((e) => [e.key, e]));
21
+ return a && (!t(i, a) || c) ? [g(`${e}/targetLocation`, JSON.stringify(a))] : [];
22
+ }, p = (n, r) => {
23
+ let i = [], a = n.metadata.fields, o = r.templateKey === e, c = new Map(r.fields.map((e) => [e.key, e])), d = new Map(a.map((e) => [e.key, e]));
21
24
  return a.forEach((e) => {
22
- let n = l.get(e.key);
25
+ let n = c.get(e.key);
23
26
  if (!n) {
24
- i.push(m(e.key, f(e)));
27
+ i.push(g(e.key, m(e)));
25
28
  return;
26
29
  }
27
30
  if (t(e, n)) return;
28
31
  let r = !t(e.value, n.value);
29
- !o && s(n) && !s(e) ? i.push(m(e.key, f(e))) : (!o && r && n.value !== null && !s(e) || o && r) && (i.push(p(n.key, f(n))), i.push(g(e.key, f(e)))), i.push(...c(e.key, n, e)), i.push(...u(e.key, n, e));
32
+ !o && l(n) && !l(e) ? i.push(g(e.key, m(e))) : (!o && r && n.value !== null && !l(e) || o && r) && (i.push(h(n.key, m(n))), i.push(v(e.key, m(e)))), i.push(...s(e.key, n, e)), i.push(...u(e.key, n, e)), i.push(...f(e.key, n, e));
30
33
  }), r.fields.forEach((e) => {
31
34
  let t = d.get(e.key);
32
- (!t || !o && s(t) && !s(e)) && (i.push(p(e.key, f(e))), i.push(h(e.key)));
35
+ (!t || !o && l(t) && !l(e)) && (i.push(h(e.key, m(e))), i.push(_(e.key)));
33
36
  }), i;
34
- }, f = (e) => e.type === "float" ? Number(e.value) : e.type === "taxonomy" ? e.value.map((e) => e.value) : e.type === "date" && typeof e.value == "string" ? new Date(e.value).toISOString() : e.value, p = (e, t) => ({
37
+ }, m = (e) => e.type === "float" ? Number(e.value) : e.type === "taxonomy" ? e.value.map((e) => e.value) : e.type === "date" && typeof e.value == "string" ? new Date(e.value).toISOString() : e.value, h = (e, t) => ({
35
38
  op: i.TEST,
36
39
  path: `/${e}`,
37
40
  value: t
38
- }), m = (e, t) => ({
41
+ }), g = (e, t) => ({
39
42
  op: i.ADD,
40
43
  path: `/${e}`,
41
44
  value: t
42
- }), h = (e) => ({
45
+ }), _ = (e) => ({
43
46
  op: i.REMOVE,
44
47
  path: `/${e}`
45
- }), g = (e, t) => ({
48
+ }), v = (e, t) => ({
46
49
  op: i.REPLACE,
47
50
  path: `/${e}`,
48
51
  value: t
49
52
  });
50
- export { f as n, i as r, d as t };
53
+ export { m as n, i as r, p as t };
@@ -1,24 +1,36 @@
1
1
  import { EVENT_NAMES as e } from "../../../../utils/analytics/events.js";
2
2
  import { useMetadataEditorAnalytics as t } from "../../../../utils/analytics/analytics-context.js";
3
3
  import { getConfidenceScoreTooltip as n } from "../../../../utils/confidence-score/get-confidence-score-tooltip.js";
4
- import { Status as r, Tooltip as i } from "@box/blueprint-web";
5
- import { useIntl as a } from "react-intl";
6
- import { BoxAiLogo as o } from "@box/blueprint-web-assets/icons/Logo";
7
- import { jsx as s } from "react/jsx-runtime";
8
- import { SurfaceStatusSurfaceGray as c } from "@box/blueprint-web-assets/tokens/tokens";
9
- function l({ confidenceScore: l, className: u }) {
10
- let { formatMessage: d } = a(), { trackEvent: f } = t();
11
- return l ? /* @__PURE__ */ s(i, {
12
- content: n(d, l),
13
- children: /* @__PURE__ */ s(r, {
4
+ import r from "../../messages.js";
5
+ import { Status as i, Tooltip as a } from "@box/blueprint-web";
6
+ import { useIntl as o } from "react-intl";
7
+ import { BoxAiLogo as s } from "@box/blueprint-web-assets/icons/Logo";
8
+ import { jsx as c } from "react/jsx-runtime";
9
+ import { SurfaceStatusSurfaceGray as l } from "@box/blueprint-web-assets/tokens/tokens";
10
+ function u({ confidenceScore: u }) {
11
+ let { formatMessage: d } = o(), { trackEvent: f } = t(), p = () => f(e.AI_LOGO_BADGE_HOVER, { confidenceLevel: u?.level });
12
+ return u ? /* @__PURE__ */ c(a, {
13
+ content: n(d, u),
14
+ children: /* @__PURE__ */ c(i, {
14
15
  hideText: !0,
15
- icon: o,
16
+ icon: s,
16
17
  interactive: !0,
17
18
  text: "",
18
- color: c,
19
+ color: l,
19
20
  "data-testid": "ai-confidence-badge",
20
- onMouseEnter: () => f(e.AI_LOGO_BADGE_HOVER, { confidenceLevel: l?.level })
21
+ onMouseEnter: p
21
22
  })
22
- }) : /* @__PURE__ */ s(o, { className: u });
23
+ }) : /* @__PURE__ */ c(a, {
24
+ content: d(r.aiExtractedBadgeTooltip),
25
+ children: /* @__PURE__ */ c(i, {
26
+ hideText: !0,
27
+ icon: s,
28
+ interactive: !0,
29
+ text: "",
30
+ color: l,
31
+ "data-testid": "ai-extracted-badge",
32
+ onMouseEnter: p
33
+ })
34
+ });
23
35
  }
24
- export { l as AiLogoBadge };
36
+ export { u as AiLogoBadge };
@@ -1,6 +1,12 @@
1
1
  import { defineMessages as e } from "react-intl";
2
- var t = e({ lowConfidenceBadge: {
3
- id: "metadataEditor.fieldLabel.lowConfidenceBadge",
4
- defaultMessage: "Low"
5
- } });
2
+ var t = e({
3
+ lowConfidenceBadge: {
4
+ id: "metadataEditor.fieldLabel.lowConfidenceBadge",
5
+ defaultMessage: "Low"
6
+ },
7
+ aiExtractedBadgeTooltip: {
8
+ id: "metadataEditor.fieldLabel.aiExtractedBadgeTooltip",
9
+ defaultMessage: "Extraction value returned by Box AI"
10
+ }
11
+ });
6
12
  export { t as default };