@box/metadata-editor 1.67.6 → 1.69.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 (43) hide show
  1. package/dist/chunks/ai-suggestion-field.js +77 -60
  2. package/dist/chunks/interactive-text.module.js +5 -0
  3. package/dist/chunks/metadata-instance-content.js +36 -24
  4. package/dist/chunks/metadata-instance-entry.js +61 -52
  5. package/dist/chunks/metadata-instance-form-autofill-button.js +5 -5
  6. package/dist/chunks/metadata-instance-form-card-wrapper.js +6 -6
  7. package/dist/chunks/metadata-instance-form-footer.js +1 -1
  8. package/dist/chunks/metadata-instance-form-header.js +8 -8
  9. package/dist/chunks/metadata-instance-header.js +4 -4
  10. package/dist/chunks/utils.js +67 -37
  11. package/dist/esm/index.js +12 -15
  12. package/dist/esm/lib/components/interactive-text/interactive-text.js +18 -2
  13. package/dist/esm/lib/components/metadata-editor-fields/components/ai-logo-badge/ai-logo-badge.js +19 -16
  14. package/dist/esm/lib/components/metadata-editor-fields/components/low-confidence-badge/low-confidence-badge.js +20 -17
  15. package/dist/esm/lib/components/metadata-editor-fields/components/low-confidence-suggestion-field/low-confidence-suggestion-field.js +4 -4
  16. package/dist/esm/lib/components/metadata-editor-fields/components/metadata-string-field/metadata-string-field.js +1 -1
  17. package/dist/esm/lib/components/metadata-editor-fields/metadata-editor-field-wrapper.js +13 -12
  18. package/dist/esm/lib/components/metadata-instance-editor/index.js +9 -7
  19. package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/metadata-instance-form.js +86 -84
  20. package/dist/esm/lib/components/metadata-instance-list/index.js +6 -4
  21. package/dist/esm/lib/components/metadata-instance-review-notice/metadata-instance-review-notice.js +1 -0
  22. package/dist/esm/lib/components/unsaved-changes-modal/unsaved-changes-modal.js +34 -31
  23. package/dist/esm/lib/utils/analytics/analytics-context.js +11 -0
  24. package/dist/esm/lib/utils/analytics/events.js +9 -0
  25. package/dist/esm/lib/utils/analytics/index.js +4 -0
  26. package/dist/esm/lib/utils/analytics/with-analytics.js +11 -0
  27. package/dist/esm/lib/utils/confidence-score/index.js +5 -5
  28. package/dist/i18n/en-x-pseudo.js +156 -156
  29. package/dist/i18n/en-x-pseudo.properties +156 -156
  30. package/dist/styles/interactive-text.css +1 -1
  31. package/dist/styles/utils.css +1 -1
  32. package/dist/types/lib/components/metadata-instance-editor/index.d.ts +6 -1
  33. package/dist/types/lib/components/metadata-instance-list/index.d.ts +12 -2
  34. package/dist/types/lib/components/unsaved-changes-modal/types.d.ts +7 -0
  35. package/dist/types/lib/components/unsaved-changes-modal/unsaved-changes-modal.d.ts +1 -1
  36. package/dist/types/lib/test-utils/index.d.ts +1 -0
  37. package/dist/types/lib/test-utils/mock-resize-observer.d.ts +5 -0
  38. package/dist/types/lib/utils/analytics/analytics-context.d.ts +12 -0
  39. package/dist/types/lib/utils/analytics/events.d.ts +9 -0
  40. package/dist/types/lib/utils/analytics/index.d.ts +3 -0
  41. package/dist/types/lib/utils/analytics/with-analytics.d.ts +8 -0
  42. package/package.json +4 -4
  43. package/dist/chunks/interactive-text.js +0 -17
@@ -1,53 +1,83 @@
1
1
  import { isConfidenceScoreNeedingReview as e } from "../esm/lib/utils/confidence-score/is-confidence-score-needing-review.js";
2
2
  import { convertISOStringtoRFC3339String as t } from "../esm/lib/utils/convertDate.js";
3
- import { t as n } from "./interactive-text.js";
3
+ import { t as n } from "./interactive-text.module.js";
4
4
  import { AiLogoBadge as r } from "../esm/lib/components/metadata-editor-fields/components/ai-logo-badge/ai-logo-badge.js";
5
5
  import { LowConfidenceBadge as i } from "../esm/lib/components/metadata-editor-fields/components/low-confidence-badge/low-confidence-badge.js";
6
- import { createElement as a, memo as o } from "react";
7
- import { jsx as s, jsxs as c } from "react/jsx-runtime";
8
- import l from "clsx";
9
- import '../styles/utils.css';var u = {
10
- noAttributesText: "_noAttributesText_1lpn0_2",
11
- fieldWrapper: "_fieldWrapper_1lpn0_6",
12
- hasSuggestion: "_hasSuggestion_1lpn0_11",
13
- hasConfidenceReview: "_hasConfidenceReview_1lpn0_16",
14
- error: "_error_1lpn0_25",
15
- dateField: "_dateField_1lpn0_44",
16
- aiApproved: "_aiApproved_1lpn0_49",
17
- comboboxContainer: "_comboboxContainer_1lpn0_49",
18
- labelWrapper: "_labelWrapper_1lpn0_95",
19
- labelText: "_labelText_1lpn0_101",
20
- labelTruncated: "_labelTruncated_1lpn0_104",
21
- labelIcon: "_labelIcon_1lpn0_111"
22
- }, d = /* @__PURE__ */ o(function({ fieldName: t, fieldDescription: o, isAiSuggestionApplied: d, as: f, confidenceScore: p, labelProps: m }) {
23
- let { className: h, ...g } = m, _ = l(h || u.labelText, u.labelTruncated), v = !!p && e(p), y = () => p && v ? /* @__PURE__ */ s(i, {}) : d || p ? /* @__PURE__ */ s(r, {
24
- className: u.labelIcon,
25
- confidenceScore: p
26
- }) : null;
27
- return /* @__PURE__ */ c("div", {
28
- className: u.labelWrapper,
29
- children: [o ? /* @__PURE__ */ s(n, {
30
- as: f,
31
- className: _,
32
- tooltipText: o,
33
- ...g,
34
- children: t
35
- }) : /* @__PURE__ */ a(f, {
36
- className: _,
37
- ...g
38
- }, t), y()]
6
+ import { Tooltip as a, useForkRef as o, useIsEllipsized as s } from "@box/blueprint-web";
7
+ import { createElement as c, memo as l, useRef as u } from "react";
8
+ import { Focusable as d } from "@ariakit/react";
9
+ import { jsx as f, jsxs as p } from "react/jsx-runtime";
10
+ import m from "clsx";
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"
25
+ };
26
+ function g({ as: e, fieldDescription: t, fieldName: r, labelClassName: i, labelRef: l, ...h }) {
27
+ let g = u(null), _ = o(g, l);
28
+ return /* @__PURE__ */ f(a, {
29
+ content: s(g) ? /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("div", { children: r }), /* @__PURE__ */ f("div", { children: t })] }) : t,
30
+ children: /* @__PURE__ */ f(d, { render: /* @__PURE__ */ c(e, {
31
+ className: m(i, n.interactiveTextHint),
32
+ ...h,
33
+ ref: _
34
+ }, r) })
35
+ });
36
+ }
37
+ function _({ as: e, fieldName: t, labelClassName: n, labelRef: r, ...i }) {
38
+ let l = u(null), p = o(l, r), m = s(l) ? t : void 0, h = /* @__PURE__ */ c(e, {
39
+ className: n,
40
+ ...i,
41
+ ref: p
42
+ }, t);
43
+ return m ? /* @__PURE__ */ f(a, {
44
+ content: m,
45
+ children: /* @__PURE__ */ f(d, { render: h })
46
+ }) : h;
47
+ }
48
+ 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, {
53
+ as: o,
54
+ fieldDescription: n,
55
+ fieldName: t,
56
+ labelClassName: v,
57
+ labelRef: u,
58
+ ...d
59
+ }) : /* @__PURE__ */ f(_, {
60
+ as: o,
61
+ fieldName: t,
62
+ labelClassName: v,
63
+ labelRef: u,
64
+ ...d
65
+ });
66
+ return /* @__PURE__ */ p("div", {
67
+ className: h.labelWrapper,
68
+ children: [x, b()]
39
69
  });
40
70
  }, (e, t) => {
41
71
  let n = e.labelProps, r = t.labelProps;
42
72
  return e.fieldName === t.fieldName && e.fieldDescription === t.fieldDescription && e.isAiSuggestionApplied === t.isAiSuggestionApplied && e.confidenceScore === t.confidenceScore && e.as === t.as && n.className === r.className && n.htmlFor === r.htmlFor && n.id === r.id;
43
- }), f = (e, t, n = !1, r = "label", i) => (a) => /* @__PURE__ */ s(d, {
73
+ }), y = (e, t, n = !1, r = "label", i) => (a) => /* @__PURE__ */ f(v, {
44
74
  as: r,
45
75
  confidenceScore: i,
46
76
  fieldDescription: t,
47
77
  fieldName: e,
48
78
  isAiSuggestionApplied: n,
49
79
  labelProps: a
50
- }), p = (e) => {
80
+ }), b = (e) => {
51
81
  try {
52
82
  let n = t(e), r = new Date(n);
53
83
  return isNaN(r.getTime()) ? null : n;
@@ -55,4 +85,4 @@ import '../styles/utils.css';var u = {
55
85
  return null;
56
86
  }
57
87
  };
58
- export { p as n, u as r, f as t };
88
+ export { b as n, h as r, y as t };
package/dist/esm/index.js CHANGED
@@ -7,21 +7,18 @@ import { t as r } from "../chunks/filter-instances-dropdown.js";
7
7
  import "./lib/components/filter-instances-dropdown/index.js";
8
8
  import { MULTI_VALUE_DEFAULT_OPTION as i, MULTI_VALUE_DEFAULT_TAXONOMY_OPTION as a, MULTI_VALUE_DEFAULT_VALUE as o } from "./lib/components/metadata-editor-fields/components/update-mode-field-wrapper/mulitple-values-utils.js";
9
9
  import { MetadataEmptyState as s } from "./lib/components/metadata-empty-state/metadata-empty-state.js";
10
- import { t as c } from "../chunks/custom-instance-new-field.js";
11
- import { t as l } from "../chunks/delete-confirmation-modal.js";
12
- import { AutofillContext as u, AutofillContextProvider as d, TIMEOUT_10_SECONDS as f, useAutofill as p } from "./lib/utils/autofill-context.js";
13
- import { t as m } from "../chunks/metadata-instance-form-autofill-button.js";
14
- import { n as h, r as g, t as _ } from "../chunks/types.js";
15
- import { t as v } from "../chunks/metadata-instance-form-header.js";
16
- import { UnsavedChangesModal as y } from "./lib/components/unsaved-changes-modal/unsaved-changes-modal.js";
17
- import { r as b } from "../chunks/utils2.js";
18
- import { MetadataInstanceForm as x } from "./lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/metadata-instance-form.js";
19
- import "./lib/components/metadata-instance-editor/index.js";
20
- import { t as S } from "../chunks/metadata-instance-list.js";
21
- import { t as C } from "../chunks/metadata-instance-header.js";
22
- import { t as w } from "../chunks/metadata-instance.js";
23
- import "./lib/components/metadata-instance-list/index.js";
10
+ import { AutofillContext as c, AutofillContextProvider as l, TIMEOUT_10_SECONDS as u, useAutofill as d } from "./lib/utils/autofill-context.js";
11
+ import { n as f, r as p, t as m } from "../chunks/types.js";
12
+ import { UnsavedChangesModal as h } from "./lib/components/unsaved-changes-modal/unsaved-changes-modal.js";
13
+ import { t as g } from "../chunks/custom-instance-new-field.js";
14
+ import { t as _ } from "../chunks/delete-confirmation-modal.js";
15
+ import { r as v } from "../chunks/utils2.js";
16
+ import { t as y } from "../chunks/metadata-instance-form-autofill-button.js";
17
+ import { t as b } from "../chunks/metadata-instance-form-header.js";
18
+ import { MetadataInstanceForm as x } from "./lib/components/metadata-instance-editor/index.js";
19
+ import { t as S } from "../chunks/metadata-instance-header.js";
20
+ import { MetadataInstance as C, MetadataInstanceList as w } from "./lib/components/metadata-instance-list/index.js";
24
21
  import { defaultInitialValues as T, defaultMetadataValueMap as E } from "./lib/defaults.js";
25
22
  import { t as D } from "../chunks/metadata-editor.js";
26
23
  import { withApiWrapper as O } from "./lib/utils/api-wrapper.js";
27
- export { t as AddMetadataTemplateDropdown, _ as AiSuggestionState, u as AutofillContext, d as AutofillContextProvider, n as ComboboxWithApiPagination, h as ConfidenceLevel, c as CustomInstanceNewField, l as DeleteConfirmationModal, e as FilterDropdownMenu, r as FilterInstancesDropdown, b as JSONPatchOp, i as MULTI_VALUE_DEFAULT_OPTION, a as MULTI_VALUE_DEFAULT_TAXONOMY_OPTION, o as MULTI_VALUE_DEFAULT_VALUE, D as MetadataEditor, s as MetadataEmptyState, w as MetadataInstance, x as MetadataInstanceForm, m as MetadataInstanceFormAutofillButton, v as MetadataInstanceFormHeader, C as MetadataInstanceHeader, S as MetadataInstanceList, f as TIMEOUT_10_SECONDS, y as UnsavedChangesModal, g as UpdateMode, T as defaultInitialValues, E as defaultMetadataValueMap, p as useAutofill, O as withApiWrapper };
24
+ export { t as AddMetadataTemplateDropdown, m as AiSuggestionState, c as AutofillContext, l as AutofillContextProvider, n as ComboboxWithApiPagination, f as ConfidenceLevel, g as CustomInstanceNewField, _ as DeleteConfirmationModal, e as FilterDropdownMenu, r as FilterInstancesDropdown, v as JSONPatchOp, i as MULTI_VALUE_DEFAULT_OPTION, a as MULTI_VALUE_DEFAULT_TAXONOMY_OPTION, o as MULTI_VALUE_DEFAULT_VALUE, D as MetadataEditor, s as MetadataEmptyState, C as MetadataInstance, x as MetadataInstanceForm, y as MetadataInstanceFormAutofillButton, b as MetadataInstanceFormHeader, S as MetadataInstanceHeader, w as MetadataInstanceList, u as TIMEOUT_10_SECONDS, h as UnsavedChangesModal, p as UpdateMode, T as defaultInitialValues, E as defaultMetadataValueMap, d as useAutofill, O as withApiWrapper };
@@ -1,2 +1,18 @@
1
- import { t as e } from "../../../../chunks/interactive-text.js";
2
- export { e as default };
1
+ import { t as e } from "../../../../chunks/interactive-text.module.js";
2
+ import { Text as t, Tooltip as n } from "@box/blueprint-web";
3
+ import { Focusable as r } from "@ariakit/react";
4
+ import { jsx as i } from "react/jsx-runtime";
5
+ import a from "clsx";
6
+ var o = ({ tooltipText: o, className: s, children: c, ...l }) => {
7
+ let { as: u = "span" } = l;
8
+ return /* @__PURE__ */ i(n, {
9
+ content: o,
10
+ children: /* @__PURE__ */ i(r, { render: /* @__PURE__ */ i(t, {
11
+ as: u,
12
+ className: a(e.interactiveText, s),
13
+ ...l,
14
+ children: c
15
+ }) })
16
+ });
17
+ };
18
+ export { o as default };
@@ -1,21 +1,24 @@
1
- import { getConfidenceScoreTooltip as e } from "../../../../utils/confidence-score/get-confidence-score-tooltip.js";
2
- import { Status as t, Tooltip as n } from "@box/blueprint-web";
3
- import { useIntl as r } from "react-intl";
4
- import { BoxAiLogo as i } from "@box/blueprint-web-assets/icons/Logo";
5
- import { jsx as a } from "react/jsx-runtime";
6
- import { SurfaceStatusSurfaceGray as o } from "@box/blueprint-web-assets/tokens/tokens";
7
- function s({ confidenceScore: s, className: c }) {
8
- let { formatMessage: l } = r();
9
- return s ? /* @__PURE__ */ a(n, {
10
- content: e(l, s),
11
- children: /* @__PURE__ */ a(t, {
1
+ import { EVENT_NAMES as e } from "../../../../utils/analytics/events.js";
2
+ import { useMetadataEditorAnalytics as t } from "../../../../utils/analytics/analytics-context.js";
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, {
12
14
  hideText: !0,
13
- icon: i,
15
+ icon: o,
14
16
  interactive: !0,
15
17
  text: "",
16
- color: o,
17
- "data-testid": "ai-confidence-badge"
18
+ color: c,
19
+ "data-testid": "ai-confidence-badge",
20
+ onMouseEnter: () => f(e.AI_LOGO_BADGE_HOVER, { confidenceLevel: l?.level })
18
21
  })
19
- }) : /* @__PURE__ */ a(i, { className: c });
22
+ }) : /* @__PURE__ */ s(o, { className: u });
20
23
  }
21
- export { s as AiLogoBadge };
24
+ export { l as AiLogoBadge };
@@ -1,21 +1,24 @@
1
- import e from "../../../../utils/confidence-score/messages.js";
2
- import t from "../../messages.js";
3
- import { Status as n, Tooltip as r } from "@box/blueprint-web";
4
- import { useIntl as i } from "react-intl";
5
- import { jsx as a } from "react/jsx-runtime";
6
- import { SurfaceStatusSurfaceGray as o } from "@box/blueprint-web-assets/tokens/tokens";
7
- import { AlertCircle as s } from "@box/blueprint-web-assets/icons/Medium";
8
- function c() {
9
- let { formatMessage: c } = i(), l = /* @__PURE__ */ a(n, {
10
- color: o,
1
+ import { EVENT_NAMES as e } from "../../../../utils/analytics/events.js";
2
+ import { useMetadataEditorAnalytics as t } from "../../../../utils/analytics/analytics-context.js";
3
+ import n from "../../../../utils/confidence-score/messages.js";
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 { jsx as s } from "react/jsx-runtime";
8
+ import { SurfaceStatusSurfaceGray as c } from "@box/blueprint-web-assets/tokens/tokens";
9
+ import { AlertCircle as l } from "@box/blueprint-web-assets/icons/Medium";
10
+ function u() {
11
+ let { formatMessage: u } = o(), { trackEvent: d } = t(), f = /* @__PURE__ */ s(i, {
12
+ color: c,
11
13
  interactive: !0,
12
- text: c(t.lowConfidenceBadge).toUpperCase(),
13
- icon: s,
14
- iconPosition: "left"
14
+ text: u(r.lowConfidenceBadge).toUpperCase(),
15
+ icon: l,
16
+ iconPosition: "left",
17
+ onMouseEnter: () => d(e.LOW_CONF_BADGE_HOVER)
15
18
  });
16
- return /* @__PURE__ */ a(r, {
17
- content: c(e.tooltipLowConfidence),
18
- children: l
19
+ return /* @__PURE__ */ s(a, {
20
+ content: u(n.tooltipLowConfidence),
21
+ children: f
19
22
  });
20
23
  }
21
- export { c as LowConfidenceBadge };
24
+ export { u as LowConfidenceBadge };
@@ -46,19 +46,19 @@ function g({ onAccept: g, onClear: _ }) {
46
46
  content: v.formatMessage(t.acceptValueTooltip),
47
47
  children: /* @__PURE__ */ d(n, {
48
48
  "aria-label": v.formatMessage(t.acceptValueAriaLabel),
49
+ "data-target-id": "IconButton-metadataEditorLowConfAccept",
49
50
  icon: p,
50
51
  onClick: () => C(g),
51
- size: "x-small",
52
- "data-target-id": "IconButton-acceptValueAriaLabel"
52
+ size: "x-small"
53
53
  })
54
54
  }), /* @__PURE__ */ d(a, {
55
55
  content: v.formatMessage(t.clearValueTooltip),
56
56
  children: /* @__PURE__ */ d(n, {
57
57
  "aria-label": v.formatMessage(t.clearValueAriaLabel),
58
+ "data-target-id": "IconButton-metadataEditorLowConfClear",
58
59
  icon: m,
59
60
  onClick: () => C(_),
60
- size: "x-small",
61
- "data-target-id": "IconButton-clearValueAriaLabel"
61
+ size: "x-small"
62
62
  })
63
63
  })]
64
64
  })]
@@ -15,7 +15,7 @@ var s = /* @__PURE__ */ r(({ className: r, description: s, isAiSuggestionApplied
15
15
  ...t,
16
16
  ref: h,
17
17
  className: r,
18
- "data-target-id": "TextInput-MetadataEditorStringField",
18
+ "data-target-id": "TextInput-metadataEditorStringField",
19
19
  disabled: u,
20
20
  error: i.error,
21
21
  label: v,
@@ -1,25 +1,25 @@
1
1
  import e from "../../messages.js";
2
2
  import { t } from "../../../../chunks/types.js";
3
- import { isConfidenceScoreNeedingReview as n } from "../../utils/confidence-score/is-confidence-score-needing-review.js";
4
- import { checkIfHasBoundingBoxes as r } from "../../utils/check-if-has-bounding-boxes.js";
3
+ import { checkIfHasBoundingBoxes as n } from "../../utils/check-if-has-bounding-boxes.js";
4
+ import { isConfidenceScoreNeedingReview as r } from "../../utils/confidence-score/is-confidence-score-needing-review.js";
5
5
  import { isInteractiveFormElement as i } from "../../utils/is-interactive-form-element.js";
6
6
  import { t as a } from "../../../../chunks/shared-field-styles.module.js";
7
- import { t as ee } from "../../../../chunks/ai-suggestion-field.js";
8
- import { LowConfidenceSuggestionField as o } from "./components/low-confidence-suggestion-field/low-confidence-suggestion-field.js";
7
+ import { t as o } from "../../../../chunks/ai-suggestion-field.js";
8
+ import { LowConfidenceSuggestionField as ee } from "./components/low-confidence-suggestion-field/low-confidence-suggestion-field.js";
9
9
  import { t as s } from "../../../../chunks/update-mode-field-wrapper.js";
10
10
  import { r as c } from "../../../../chunks/utils.js";
11
- import { editorFieldTypes as te } from "./editor-field-types.js";
12
- import { useViewReferenceTooltip as l } from "./hooks/use-view-reference-tooltip.js";
11
+ import { editorFieldTypes as l } from "./editor-field-types.js";
12
+ import { useViewReferenceTooltip as te } from "./hooks/use-view-reference-tooltip.js";
13
13
  import { Tooltip as u } from "@box/blueprint-web";
14
14
  import { forwardRef as d, memo as f, useCallback as p, useEffect as m, useMemo as ne } from "react";
15
15
  import { useIntl as re } from "react-intl";
16
16
  import { jsx as h, jsxs as g } from "react/jsx-runtime";
17
17
  import _ from "clsx";
18
- import { useFormikContext as v } from "formik";
19
- import ie from "lodash/isEqual";
18
+ import { useFormikContext as ie } from "formik";
19
+ import v from "lodash/isEqual";
20
20
  import ae from "lodash/isUndefined";
21
21
  var y = /* @__PURE__ */ f(/* @__PURE__ */ d(({ disableForm: d, portalElement: f, field: y, index: oe, taxonomyOptionsFetcher: b, isExternallyOwned: x, isMultilevelTaxonomyFieldEnabled: S, isConfidenceScoreReviewEnabled: C = !1, onSelectMetadataField: w, selectedMetadataFieldId: se }, T) => {
22
- let { setFieldValue: E } = v(), { formatMessage: D } = re(), O = y.aiSuggestionState || t.Initial, k = O === t.Pending, A = O === t.Applied, j = O === t.Initial, M = te[y.type], { aiSuggestion: N, aiSuggestionConfidenceScore: P, aiSuggestionTargetLocation: F, type: I, value: L } = y, R = M && !y.hidden, z = !ae(y.updateMode), B = `metadata.fields[${oe}]`, V = y.type === "taxonomy" && y.optionsRules?.multiSelect, H = C && !!y.confidenceScore, U = H && n(y.confidenceScore), W = H && !k && !n(y.confidenceScore), G = se === y.id, ce = r(y.targetLocation), K = H && ce && !!w, { isTooltipOpen: q, handleMouseOver: le, handleMouseLeave: ue, handleFocus: de, handleBlur: fe } = l(K), pe = _({
22
+ let { setFieldValue: E } = ie(), { formatMessage: D } = re(), O = y.aiSuggestionState || t.Initial, k = O === t.Pending, A = O === t.Applied, j = O === t.Initial, M = l[y.type], { aiSuggestion: N, aiSuggestionConfidenceScore: P, aiSuggestionTargetLocation: F, type: I, value: L } = y, R = M && !y.hidden, z = !ae(y.updateMode), B = `metadata.fields[${oe}]`, V = y.type === "taxonomy" && y.optionsRules?.multiSelect, H = C && !!y.confidenceScore, U = H && r(y.confidenceScore), W = H && !k && !r(y.confidenceScore), G = se === y.id, ce = n(y.targetLocation), K = H && ce && !!w, { isTooltipOpen: q, handleMouseOver: le, handleMouseLeave: ue, handleFocus: de, handleBlur: fe } = te(K), pe = _({
23
23
  [c.aiApproved]: A || W,
24
24
  [c.hasSuggestion]: k,
25
25
  [c.hasConfidenceReview]: !k && U,
@@ -98,10 +98,11 @@ var y = /* @__PURE__ */ f(/* @__PURE__ */ d(({ disableForm: d, portalElement: f,
98
98
  N,
99
99
  J
100
100
  ]);
101
- let ve = ne(() => N ? ie(L, N) : !1, [N, L]);
101
+ let ve = ne(() => N ? v(L, N) : !1, [N, L]);
102
102
  if (!R) return null;
103
103
  let Q = {
104
104
  "data-metadata-field": !0,
105
+ "data-target-id": "Button-metadataEditorFieldEditClick",
105
106
  "data-testid": "metadata-field",
106
107
  onClick: ge,
107
108
  onKeyDown: _e,
@@ -161,7 +162,7 @@ var y = /* @__PURE__ */ f(/* @__PURE__ */ d(({ disableForm: d, portalElement: f,
161
162
  portalElement: f,
162
163
  taxonomyOptionsFetcher: b
163
164
  }),
164
- k && /* @__PURE__ */ h(ee, {
165
+ k && /* @__PURE__ */ h(o, {
165
166
  aiSuggestion: N,
166
167
  confidenceLevel: C ? P?.level : void 0,
167
168
  isSameValue: ve,
@@ -172,7 +173,7 @@ var y = /* @__PURE__ */ f(/* @__PURE__ */ d(({ disableForm: d, portalElement: f,
172
173
  onAiSuggestionReplace: () => Y(N, !0),
173
174
  type: I
174
175
  }),
175
- !k && U && /* @__PURE__ */ h(o, {
176
+ !k && U && /* @__PURE__ */ h(ee, {
176
177
  onAccept: me,
177
178
  onClear: he
178
179
  })
@@ -1,7 +1,9 @@
1
- import { t as e } from "../../../../chunks/custom-instance-new-field.js";
2
- import { t } from "../../../../chunks/delete-confirmation-modal.js";
3
- import { t as n } from "../../../../chunks/metadata-instance-form-autofill-button.js";
4
- import { t as r } from "../../../../chunks/metadata-instance-form-header.js";
5
- import { r as i } from "../../../../chunks/utils2.js";
6
- import { MetadataInstanceForm as a } from "./subcomponents/metadata-instance-form/metadata-instance-form.js";
7
- export { e as CustomInstanceNewField, t as DeleteConfirmationModal, i as JSONPatchOp, a as MetadataInstanceForm, n as MetadataInstanceFormAutofillButton, r as MetadataInstanceFormHeader };
1
+ import { withAnalytics as e } from "../../utils/analytics/with-analytics.js";
2
+ import { t } from "../../../../chunks/custom-instance-new-field.js";
3
+ import { t as n } from "../../../../chunks/delete-confirmation-modal.js";
4
+ import { r } from "../../../../chunks/utils2.js";
5
+ import { t as i } from "../../../../chunks/metadata-instance-form-autofill-button.js";
6
+ import { t as a } from "../../../../chunks/metadata-instance-form-header.js";
7
+ import { MetadataInstanceForm as o } from "./subcomponents/metadata-instance-form/metadata-instance-form.js";
8
+ var s = e(o);
9
+ export { t as CustomInstanceNewField, n as DeleteConfirmationModal, r as JSONPatchOp, s as MetadataInstanceForm, i as MetadataInstanceFormAutofillButton, a as MetadataInstanceFormHeader };
@@ -1,127 +1,129 @@
1
1
  import { TEMPLATE_CUSTOM_PROPERTIES as e } from "../../../../constants.js";
2
2
  import { MetadataEmptyState as t } from "../../../metadata-empty-state/metadata-empty-state.js";
3
- import { t as n } from "../../../../../../chunks/delete-confirmation-modal.js";
3
+ import { useMetadataEditorAnalytics as n } from "../../../../utils/analytics/analytics-context.js";
4
4
  import { useAutofill as r } from "../../../../utils/autofill-context.js";
5
5
  import { TemplateInstance as i } from "../../../metadata-editor-fields/metadata-editor-fields.js";
6
6
  import { UnsavedChangesModal as a } from "../../../unsaved-changes-modal/unsaved-changes-modal.js";
7
7
  import { t as o } from "../../../../../../chunks/autofill-overlay.js";
8
8
  import { t as s } from "../../../../../../chunks/custom-instance.js";
9
- import { t as ee } from "../../../../../../chunks/utils2.js";
10
- import { n as c, t as l } from "../../../../../../chunks/metadata-instance-form-card-wrapper.js";
11
- import { useEffect as u, useMemo as d, useRef as f, useState as p } from "react";
12
- import { jsx as m, jsxs as h } from "react/jsx-runtime";
13
- import g from "clsx";
14
- import { Form as _, Formik as v } from "formik";
15
- import y from "lodash/isEqual";
16
- var b = ({ dirty: e, onChange: t, values: n }) => {
17
- let r = f(n);
18
- return e && !y(r.current.metadata.fields, n.metadata.fields) && (r.current = n, t(n)), null;
19
- }, x = (y) => {
20
- let { areAiSuggestionsAvailable: x, customRef: S, isLargeFile: C, errorCode: w, isAiSuggestionsFeatureEnabled: T, isAdvancedExtractAgentEnabled: E = !1, isBetaLanguageEnabled: D, isDeleteButtonDisabled: te, isDeleteConfirmationModalCheckboxEnabled: ne, isMultilevelTaxonomyFieldEnabled: O, isUnsavedChangesModalOpen: k = !1, MetadataInstanceFormCustomWrapper: A, selectedTemplateInstance: j, onCancel: M, onChange: N, onDelete: P, onDiscardUnsavedChanges: F, onSubmit: I, onToggleReviewFilter: L, setIsUnsavedChangesModalOpen: R, shouldShowOnlyReviewFields: z = !1, taxonomyOptionsFetcher: B, isConfidenceScoreReviewEnabled: V = !1, onSelectMetadataField: H, selectedMetadataFieldId: U } = y, W = A ?? l, [G, K] = p(!1), { isFetchingSuggestions: q, isLongLoading: J, getAiSuggestions: Y, clearState: X, suggestions: re } = r();
21
- u(() => () => {
9
+ import { t as c } from "../../../../../../chunks/delete-confirmation-modal.js";
10
+ import { t as l } from "../../../../../../chunks/utils2.js";
11
+ import { n as u, t as d } from "../../../../../../chunks/metadata-instance-form-card-wrapper.js";
12
+ import { useEffect as f, useMemo as p, useRef as m, useState as h } from "react";
13
+ import { jsx as g, jsxs as _ } from "react/jsx-runtime";
14
+ import v from "clsx";
15
+ import { Form as y, Formik as b } from "formik";
16
+ import x from "lodash/isEqual";
17
+ var S = ({ dirty: e, onChange: t, values: n }) => {
18
+ let r = m(n);
19
+ return e && !x(r.current.metadata.fields, n.metadata.fields) && (r.current = n, t(n)), null;
20
+ }, C = (x) => {
21
+ let { areAiSuggestionsAvailable: C, customRef: w, isLargeFile: T, errorCode: E, isAiSuggestionsFeatureEnabled: D, isAdvancedExtractAgentEnabled: O = !1, isBetaLanguageEnabled: ee, isDeleteButtonDisabled: te, isDeleteConfirmationModalCheckboxEnabled: ne, isMultilevelTaxonomyFieldEnabled: k, isUnsavedChangesModalOpen: A = !1, MetadataInstanceFormCustomWrapper: j, selectedTemplateInstance: M, onCancel: N, onChange: P, onDelete: F, onDiscardUnsavedChanges: I, onSubmit: L, onToggleReviewFilter: R, setIsUnsavedChangesModalOpen: z, shouldShowOnlyReviewFields: B = !1, taxonomyOptionsFetcher: V, isConfidenceScoreReviewEnabled: H = !1, onSelectMetadataField: U, selectedMetadataFieldId: W } = x, re = j ?? d, [G, K] = h(!1), { isFetchingSuggestions: q, isLongLoading: J, getAiSuggestions: Y, clearState: X, suggestions: ie } = r(), { trackEvent: ae } = n();
22
+ f(() => () => {
22
23
  X();
23
- }, [X, j?.id]);
24
- let Z = j?.templateKey === e, ie = async (e) => {
25
- await I(e, ee(e, j));
26
- }, ae = (e) => {
27
- e ? R(!0) : M();
28
- }, oe = () => {
24
+ }, [X, M?.id]);
25
+ let Z = M?.templateKey === e, oe = async (e) => {
26
+ await L(e, l(e, M));
27
+ }, se = (e) => {
28
+ e ? z(!0) : N();
29
+ }, ce = () => {
29
30
  K(!0);
30
- }, se = { metadata: { ...j } }, Q = f(null), [$, ce] = p(null);
31
- u(() => {
32
- ce(S ?? Q.current);
31
+ }, le = { metadata: { ...M } }, Q = m(null), [$, ue] = h(null);
32
+ f(() => {
33
+ ue(w ?? Q.current);
33
34
  }, [
34
- S,
35
- j?.templateKey,
36
- j?.scope
35
+ w,
36
+ M?.templateKey,
37
+ M?.scope
37
38
  ]);
38
- let le = d(() => {
39
- let e = j?.fields.length === 0;
40
- if (Z) return /* @__PURE__ */ m(s, { isLoading: q });
41
- if (e) return /* @__PURE__ */ m(t, {
42
- isBoxAiSuggestionsFeatureEnabled: T,
39
+ let de = p(() => {
40
+ let e = M?.fields.length === 0;
41
+ if (Z) return /* @__PURE__ */ g(s, { isLoading: q });
42
+ if (e) return /* @__PURE__ */ g(t, {
43
+ isBoxAiSuggestionsFeatureEnabled: D,
43
44
  level: "instance"
44
45
  });
45
- let n = !!(q || w);
46
- return /* @__PURE__ */ h("div", {
47
- className: g(c.metadataInstanceFormContent, n && c.showOverlay, V && c.metadataInstanceFormContentReducedGap),
48
- children: [/* @__PURE__ */ m(o, {
49
- errorCode: w,
46
+ let n = !!(q || E);
47
+ return /* @__PURE__ */ _("div", {
48
+ className: v(u.metadataInstanceFormContent, n && u.showOverlay, H && u.metadataInstanceFormContentReducedGap),
49
+ children: [/* @__PURE__ */ g(o, {
50
+ errorCode: E,
50
51
  isFetchingSuggestions: q,
51
52
  isLongLoading: J
52
- }), /* @__PURE__ */ m(i, {
53
+ }), /* @__PURE__ */ g(i, {
53
54
  disableForm: q,
54
- isConfidenceScoreReviewEnabled: V,
55
- isExternallyOwned: j?.isExternallyOwned,
56
- isMultilevelTaxonomyFieldEnabled: O,
57
- onSelectMetadataField: H,
58
- selectedMetadataFieldId: U,
59
- portalElement: S ?? $,
60
- shouldShowOnlyReviewFields: z,
61
- taxonomyOptionsFetcher: B
55
+ isConfidenceScoreReviewEnabled: H,
56
+ isExternallyOwned: M?.isExternallyOwned,
57
+ isMultilevelTaxonomyFieldEnabled: k,
58
+ onSelectMetadataField: U,
59
+ selectedMetadataFieldId: W,
60
+ portalElement: w ?? $,
61
+ shouldShowOnlyReviewFields: B,
62
+ taxonomyOptionsFetcher: V
62
63
  })]
63
64
  });
64
65
  }, [
65
- j?.fields.length,
66
- j?.isExternallyOwned,
66
+ M?.fields.length,
67
+ M?.isExternallyOwned,
67
68
  Z,
68
69
  q,
69
70
  J,
70
- S,
71
+ w,
71
72
  $,
72
- B,
73
- T,
74
73
  V,
75
- O,
76
- w,
77
- z,
74
+ D,
78
75
  H,
79
- U
76
+ k,
77
+ E,
78
+ B,
79
+ U,
80
+ W
80
81
  ]);
81
- return /* @__PURE__ */ m(v, {
82
- initialValues: se,
83
- onSubmit: ie,
84
- children: ({ values: e, dirty: t }) => /* @__PURE__ */ h(_, { children: [
85
- /* @__PURE__ */ m(W, {
86
- areAiSuggestionsAvailable: x,
87
- className: c.metadataInstanceForm,
82
+ return /* @__PURE__ */ g(b, {
83
+ initialValues: le,
84
+ onSubmit: oe,
85
+ children: ({ values: e, dirty: t }) => /* @__PURE__ */ _(y, { children: [
86
+ /* @__PURE__ */ g(re, {
87
+ areAiSuggestionsAvailable: C,
88
+ className: u.metadataInstanceForm,
88
89
  formRef: Q,
89
90
  formValues: e,
90
91
  getAiSuggestions: Y,
91
- handleCancel: ae,
92
- handleDelete: oe,
93
- isAdvancedExtractAgentEnabled: E,
94
- isAiSuggestionsFeatureEnabled: T,
95
- isBetaLanguageEnabled: D,
96
- isConfidenceScoreReviewEnabled: V,
92
+ handleCancel: se,
93
+ handleDelete: ce,
94
+ isAdvancedExtractAgentEnabled: O,
95
+ isAiSuggestionsFeatureEnabled: D,
96
+ isBetaLanguageEnabled: ee,
97
+ isConfidenceScoreReviewEnabled: H,
97
98
  isDeleteButtonDisabled: te,
98
99
  isFetchingSuggestions: q,
99
100
  isFormDirty: t,
100
- isLargeFile: C,
101
- onToggleReviewFilter: L,
102
- selectedTemplateInstance: j,
103
- shouldShowOnlyReviewFields: z,
104
- suggestions: re,
105
- children: j && le
101
+ isLargeFile: T,
102
+ onToggleReviewFilter: R,
103
+ selectedTemplateInstance: M,
104
+ shouldShowOnlyReviewFields: B,
105
+ suggestions: ie,
106
+ children: M && de
106
107
  }),
107
- N && /* @__PURE__ */ m(b, {
108
+ P && /* @__PURE__ */ g(S, {
108
109
  dirty: t,
109
- onChange: N,
110
+ onChange: P,
110
111
  values: e
111
112
  }),
112
- /* @__PURE__ */ m(a, {
113
- onBackToEdit: () => R(!1),
114
- onDiscardChanges: F,
115
- open: k
113
+ /* @__PURE__ */ g(a, {
114
+ onBackToEdit: () => z(!1),
115
+ onDiscardChanges: I,
116
+ open: A,
117
+ trackEvent: ae
116
118
  }),
117
- /* @__PURE__ */ m(n, {
119
+ /* @__PURE__ */ g(c, {
118
120
  isCheckboxEnabled: ne,
119
- onConfirm: () => P(j),
121
+ onConfirm: () => F(M),
120
122
  onDismiss: () => K(!1),
121
123
  open: G,
122
- templateName: j?.displayName
124
+ templateName: M?.displayName
123
125
  })
124
126
  ] })
125
- }, `${j?.scope}.${j?.templateKey}`);
127
+ }, `${M?.scope}.${M?.templateKey}`);
126
128
  };
127
- export { x as MetadataInstanceForm };
129
+ export { C as MetadataInstanceForm };
@@ -1,4 +1,6 @@
1
- import { t as e } from "../../../../chunks/metadata-instance-list.js";
2
- import { t } from "../../../../chunks/metadata-instance-header.js";
3
- import { t as n } from "../../../../chunks/metadata-instance.js";
4
- export { n as MetadataInstance, t as MetadataInstanceHeader, e as MetadataInstanceList };
1
+ import { withAnalytics as e } from "../../utils/analytics/with-analytics.js";
2
+ import { t } from "../../../../chunks/metadata-instance-list.js";
3
+ import { t as n } from "../../../../chunks/metadata-instance-header.js";
4
+ import { t as r } from "../../../../chunks/metadata-instance.js";
5
+ var i = e(t), a = e(r);
6
+ export { a as MetadataInstance, n as MetadataInstanceHeader, i as MetadataInstanceList };