@box/metadata-editor 1.68.0 → 1.69.1

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 (35) hide show
  1. package/dist/chunks/ai-suggestion-field.js +77 -60
  2. package/dist/chunks/metadata-instance-content.js +36 -24
  3. package/dist/chunks/metadata-instance-entry.js +61 -52
  4. package/dist/chunks/metadata-instance-form-autofill-button.js +5 -5
  5. package/dist/chunks/metadata-instance-form-card-wrapper.js +6 -6
  6. package/dist/chunks/metadata-instance-form-footer.js +1 -1
  7. package/dist/chunks/metadata-instance-form-header.js +8 -8
  8. package/dist/chunks/metadata-instance-header.js +4 -4
  9. package/dist/esm/index.js +12 -15
  10. package/dist/esm/lib/components/metadata-editor-fields/components/ai-logo-badge/ai-logo-badge.js +19 -16
  11. package/dist/esm/lib/components/metadata-editor-fields/components/low-confidence-badge/low-confidence-badge.js +20 -17
  12. package/dist/esm/lib/components/metadata-editor-fields/components/low-confidence-suggestion-field/low-confidence-suggestion-field.js +4 -4
  13. package/dist/esm/lib/components/metadata-editor-fields/components/metadata-string-field/metadata-string-field.js +1 -1
  14. package/dist/esm/lib/components/metadata-editor-fields/metadata-editor-field-wrapper.js +13 -12
  15. package/dist/esm/lib/components/metadata-instance-editor/index.js +9 -7
  16. package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/metadata-instance-form.js +86 -84
  17. package/dist/esm/lib/components/metadata-instance-list/index.js +6 -4
  18. package/dist/esm/lib/components/metadata-instance-review-notice/metadata-instance-review-notice.js +1 -0
  19. package/dist/esm/lib/components/unsaved-changes-modal/unsaved-changes-modal.js +34 -31
  20. package/dist/esm/lib/utils/analytics/analytics-context.js +11 -0
  21. package/dist/esm/lib/utils/analytics/events.js +9 -0
  22. package/dist/esm/lib/utils/analytics/index.js +4 -0
  23. package/dist/esm/lib/utils/analytics/with-analytics.js +11 -0
  24. package/dist/esm/lib/utils/confidence-score/index.js +5 -5
  25. package/dist/i18n/en-x-pseudo.js +156 -156
  26. package/dist/i18n/en-x-pseudo.properties +156 -156
  27. package/dist/types/lib/components/metadata-instance-editor/index.d.ts +6 -1
  28. package/dist/types/lib/components/metadata-instance-list/index.d.ts +12 -2
  29. package/dist/types/lib/components/unsaved-changes-modal/types.d.ts +7 -0
  30. package/dist/types/lib/components/unsaved-changes-modal/unsaved-changes-modal.d.ts +1 -1
  31. package/dist/types/lib/utils/analytics/analytics-context.d.ts +12 -0
  32. package/dist/types/lib/utils/analytics/events.d.ts +9 -0
  33. package/dist/types/lib/utils/analytics/index.d.ts +3 -0
  34. package/dist/types/lib/utils/analytics/with-analytics.d.ts +8 -0
  35. package/package.json +9 -9
@@ -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 };
@@ -13,6 +13,7 @@ var s = ({ fieldsNeedingReviewCount: s, isLowScoreFilteringEnabled: c = !1, onTe
13
13
  children: /* @__PURE__ */ a(r, {
14
14
  content: f,
15
15
  children: /* @__PURE__ */ a(n, {
16
+ "data-target-id": c ? "TextToggleButton-metadataEditorReviewFilterHide" : "TextToggleButton-metadataEditorReviewFilterView",
16
17
  onPressedChange: l,
17
18
  pressed: c,
18
19
  children: c ? u.formatMessage(e.hideReviewFieldsCTA) : u.formatMessage(e.viewReviewFieldsCTA)
@@ -1,42 +1,45 @@
1
- import e from "./messages.js";
2
- import { Modal as t } from "@box/blueprint-web";
3
- import { useCallback as n, useEffect as r, useState as i } from "react";
4
- import { FormattedMessage as a, useIntl as o } from "react-intl";
5
- import { jsx as s, jsxs as c } from "react/jsx-runtime";
6
- function l({ onBackToEdit: l, onDiscardChanges: u, defaultOpen: d = !0, open: f = d }) {
7
- let p = o(), [m, h] = i(f);
8
- r(() => h(f), [f]);
9
- let g = n(() => {
10
- l(), h(!1);
11
- }, [l]), _ = n(() => {
12
- u(), h(!1);
13
- }, [u]);
14
- return /* @__PURE__ */ s(t, {
1
+ import { EVENT_NAMES as e } from "../../utils/analytics/events.js";
2
+ import t from "./messages.js";
3
+ import { Modal as n } from "@box/blueprint-web";
4
+ import { useCallback as r, useEffect as i, useState as a } from "react";
5
+ import { FormattedMessage as o, useIntl as s } from "react-intl";
6
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
7
+ function u({ onBackToEdit: u, onDiscardChanges: d, defaultOpen: f = !0, open: p = f, trackEvent: m }) {
8
+ let h = s(), [g, _] = a(p);
9
+ i(() => _(p), [p]), i(() => {
10
+ g && m?.(e.UNSAVED_MODAL_SHOWN);
11
+ }, [g, m]);
12
+ let v = r(() => {
13
+ u(), _(!1);
14
+ }, [u]), y = r(() => {
15
+ m?.(e.UNSAVED_MODAL_DISCARD), d(), _(!1);
16
+ }, [d, m]);
17
+ return /* @__PURE__ */ c(n, {
15
18
  modal: !0,
16
- onOpenChange: n((e) => {
17
- h(e), e || g();
18
- }, [g]),
19
- open: m,
20
- children: /* @__PURE__ */ c(t.Content, {
19
+ onOpenChange: r((e) => {
20
+ _(e), e || v();
21
+ }, [v]),
22
+ open: g,
23
+ children: /* @__PURE__ */ l(n.Content, {
21
24
  onEscapeKeyDown: (e) => e.stopPropagation(),
22
25
  size: "small",
23
26
  children: [
24
- /* @__PURE__ */ s(t.Header, { children: /* @__PURE__ */ s(a, { ...e.unsavedChangesModalHeader }) }),
25
- /* @__PURE__ */ s(t.ScrollableContainer, { children: /* @__PURE__ */ s(t.Body, { children: /* @__PURE__ */ s(a, { ...e.unsavedChangesModalBody }) }) }),
26
- /* @__PURE__ */ c(t.Footer, { children: [/* @__PURE__ */ s(t.Footer.SecondaryButton, {
27
- onClick: _,
27
+ /* @__PURE__ */ c(n.Header, { children: /* @__PURE__ */ c(o, { ...t.unsavedChangesModalHeader }) }),
28
+ /* @__PURE__ */ c(n.ScrollableContainer, { children: /* @__PURE__ */ c(n.Body, { children: /* @__PURE__ */ c(o, { ...t.unsavedChangesModalBody }) }) }),
29
+ /* @__PURE__ */ l(n.Footer, { children: [/* @__PURE__ */ c(n.Footer.SecondaryButton, {
30
+ "data-target-id": "Modal.Footer.SecondaryButton-metadataEditorUnsavedDiscard",
31
+ onClick: y,
28
32
  size: "large",
29
- "data-target-id": "Modal.Footer.SecondaryButton-unsavedChangesModalDiscardChangesCTA",
30
- children: p.formatMessage(e.unsavedChangesModalDiscardChangesCTA)
31
- }), /* @__PURE__ */ s(t.Footer.PrimaryButton, {
32
- onClick: g,
33
+ children: h.formatMessage(t.unsavedChangesModalDiscardChangesCTA)
34
+ }), /* @__PURE__ */ c(n.Footer.PrimaryButton, {
35
+ "data-target-id": "Modal.Footer.PrimaryButton-metadataEditorUnsavedBackToEdit",
36
+ onClick: v,
33
37
  size: "large",
34
- "data-target-id": "Modal.Footer.PrimaryButton-unsavedChangesModalContinueEditingCTA",
35
- children: p.formatMessage(e.unsavedChangesModalContinueEditingCTA)
38
+ children: h.formatMessage(t.unsavedChangesModalContinueEditingCTA)
36
39
  })] }),
37
- /* @__PURE__ */ s(t.Close, { "aria-label": p.formatMessage(e.unsavedChangesModalCloseLabel) })
40
+ /* @__PURE__ */ c(n.Close, { "aria-label": h.formatMessage(t.unsavedChangesModalCloseLabel) })
38
41
  ]
39
42
  })
40
43
  });
41
44
  }
42
- export { l as UnsavedChangesModal };
45
+ export { u as UnsavedChangesModal };
@@ -0,0 +1,11 @@
1
+ import { createContext as e, useContext as t, useMemo as n } from "react";
2
+ import { jsx as r } from "react/jsx-runtime";
3
+ import i from "lodash/noop";
4
+ var a = /* @__PURE__ */ e({ trackEvent: i }), o = ({ children: e, trackEvent: t }) => {
5
+ let o = n(() => ({ trackEvent: t ?? i }), [t]);
6
+ return /* @__PURE__ */ r(a.Provider, {
7
+ value: o,
8
+ children: e
9
+ });
10
+ }, s = () => t(a);
11
+ export { a as AnalyticsContext, o as AnalyticsContextProvider, s as useMetadataEditorAnalytics };
@@ -0,0 +1,9 @@
1
+ var e = {
2
+ LOW_CONF_BADGE_HOVER: "metadata_editor_low_conf_badge_hover",
3
+ LOW_CONF_ICON_HOVER_READ_MODE: "metadata_editor_low_conf_icon_hover_read_mode",
4
+ AI_SUGGESTION_SHOWN: "metadata_editor_ai_suggestion_shown",
5
+ UNSAVED_MODAL_SHOWN: "metadata_editor_unsaved_modal_shown",
6
+ UNSAVED_MODAL_DISCARD: "metadata_editor_unsaved_modal_discard",
7
+ AI_LOGO_BADGE_HOVER: "metadata_editor_conf_score_icon_hover"
8
+ };
9
+ export { e as EVENT_NAMES };
@@ -0,0 +1,4 @@
1
+ import { EVENT_NAMES as e } from "./events.js";
2
+ import { AnalyticsContext as t, AnalyticsContextProvider as n, useMetadataEditorAnalytics as r } from "./analytics-context.js";
3
+ import { withAnalytics as i } from "./with-analytics.js";
4
+ export { t as AnalyticsContext, n as AnalyticsContextProvider, e as EVENT_NAMES, r as useMetadataEditorAnalytics, i as withAnalytics };
@@ -0,0 +1,11 @@
1
+ import { AnalyticsContextProvider as e } from "./analytics-context.js";
2
+ import "react";
3
+ import { jsx as t } from "react/jsx-runtime";
4
+ function n(n) {
5
+ let r = ({ trackEvent: r, ...i }) => /* @__PURE__ */ t(e, {
6
+ trackEvent: r,
7
+ children: /* @__PURE__ */ t(n, { ...i })
8
+ });
9
+ return r.displayName = `withAnalytics(${n.displayName || n.name || "Component"})`, r;
10
+ }
11
+ export { n as withAnalytics };
@@ -1,5 +1,5 @@
1
- import { isConfidenceScoreNeedingReview as e } from "./is-confidence-score-needing-review.js";
2
- import { getFieldsNeedingReview as t } from "./get-fields-needing-review.js";
3
- import { formatConfidenceScorePercent as n } from "./format-confidence-score-percent.js";
4
- import { getConfidenceScoreTooltip as r } from "./get-confidence-score-tooltip.js";
5
- export { n as formatConfidenceScorePercent, r as getConfidenceScoreTooltip, t as getFieldsNeedingReview, e as isConfidenceScoreNeedingReview };
1
+ import { formatConfidenceScorePercent as e } from "./format-confidence-score-percent.js";
2
+ import { getConfidenceScoreTooltip as t } from "./get-confidence-score-tooltip.js";
3
+ import { isConfidenceScoreNeedingReview as n } from "./is-confidence-score-needing-review.js";
4
+ import { getFieldsNeedingReview as r } from "./get-fields-needing-review.js";
5
+ export { e as formatConfidenceScorePercent, t as getConfidenceScoreTooltip, r as getFieldsNeedingReview, n as isConfidenceScoreNeedingReview };