@box/metadata-editor 1.52.1 → 1.52.3

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.
@@ -1,12 +1,12 @@
1
- let n = /* @__PURE__ */ (function(e) {
1
+ let r = /* @__PURE__ */ (function(e) {
2
2
  return e.ClearAndReplace = "clearAndReplace", e.RemoveEntered = "removeEntered", e.ReplaceEntered = "replaceEntered", e.Append = "append", e;
3
- })({}), d = /* @__PURE__ */ (function(e) {
3
+ })({}), n = /* @__PURE__ */ (function(e) {
4
4
  return e.Initial = "INITIAL", e.Pending = "PENDING", e.Applied = "APPLIED", e;
5
- })({}), r = /* @__PURE__ */ (function(e) {
6
- return e.ReviewIsNeeded = "review_is_needed", e.ReviewedAndAccepted = "reviewed_and_accepted", e.ReviewIsNotNeeded = "review_is_not_needed", e;
5
+ })({}), l = /* @__PURE__ */ (function(e) {
6
+ return e.Low = "LOW", e.Medium = "MEDIUM", e.High = "HIGH", e;
7
7
  })({});
8
8
  export {
9
- d as A,
10
- r as C,
11
- n as U
9
+ n as A,
10
+ l as C,
11
+ r as U
12
12
  };
package/dist/esm/index.js CHANGED
@@ -1,17 +1,17 @@
1
- import { FilterDropdownMenu as e } from "./lib/components/filter-dropdown-menu/index.js";
1
+ import { FilterDropdownMenu as o } from "./lib/components/filter-dropdown-menu/index.js";
2
2
  import { MULTI_VALUE_DEFAULT_OPTION as r, MULTI_VALUE_DEFAULT_TAXONOMY_OPTION as n, MULTI_VALUE_DEFAULT_VALUE as p } from "./lib/components/metadata-editor-fields/components/update-mode-field-wrapper/mulitple-values-utils.js";
3
3
  import { MetadataEmptyState as m } from "./lib/components/metadata-empty-state/metadata-empty-state.js";
4
4
  import { defaultInitialValues as x, defaultMetadataValueMap as i } from "./lib/defaults.js";
5
- import { MetadataEditor as l } from "./lib/metadata-editor.js";
6
- import { A, C as I, U as u } from "../chunks/types.js";
7
- import { withApiWrapper as T } from "./lib/utils/api-wrapper.js";
8
- import { AutofillContext as c, AutofillContextProvider as E, TIMEOUT_10_SECONDS as L, useAutofill as O } from "./lib/utils/autofill-context.js";
5
+ import { MetadataEditor as s } from "./lib/metadata-editor.js";
6
+ import { A, C as I, U } from "../chunks/types.js";
7
+ import { withApiWrapper as L } from "./lib/utils/api-wrapper.js";
8
+ import { AutofillContext as _, AutofillContextProvider as E, TIMEOUT_10_SECONDS as c, useAutofill as O } from "./lib/utils/autofill-context.js";
9
9
  import { AddMetadataTemplateDropdown as F } from "./lib/components/add-metadata-template-dropdown/add-metadata-template-dropdown.js";
10
- import { ComboboxWithApiPagination as S } from "./lib/components/combobox-with-api-pagination/combobox-with-api-pagination.js";
10
+ import { ComboboxWithApiPagination as N } from "./lib/components/combobox-with-api-pagination/combobox-with-api-pagination.js";
11
11
  import { FilterInstancesDropdown as V } from "./lib/components/filter-instances-dropdown/filter-instances-dropdown.js";
12
12
  import { CustomInstanceNewField as P } from "./lib/components/metadata-instance-editor/subcomponents/custom-instance-new-field/custom-instance-new-field.js";
13
13
  import { DeleteConfirmationModal as h } from "./lib/components/metadata-instance-editor/subcomponents/delete-confirmation-modal/delete-confirmation-modal.js";
14
- import { MetadataInstanceFormAutofillButton as v } from "./lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-autofill-button/metadata-instance-form-autofill-button.js";
14
+ import { MetadataInstanceFormAutofillButton as b } from "./lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-autofill-button/metadata-instance-form-autofill-button.js";
15
15
  import { MetadataInstanceFormHeader as J } from "./lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-header/metadata-instance-form-header.js";
16
16
  import { MetadataInstanceForm as y } from "./lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/metadata-instance-form.js";
17
17
  import { J as X } from "../chunks/utils.js";
@@ -22,31 +22,31 @@ import { UnsavedChangesModal as Q } from "./lib/components/unsaved-changes-modal
22
22
  export {
23
23
  F as AddMetadataTemplateDropdown,
24
24
  A as AiSuggestionState,
25
- c as AutofillContext,
25
+ _ as AutofillContext,
26
26
  E as AutofillContextProvider,
27
- S as ComboboxWithApiPagination,
28
- I as ConfidenceScoreStatus,
27
+ N as ComboboxWithApiPagination,
28
+ I as ConfidenceLevel,
29
29
  P as CustomInstanceNewField,
30
30
  h as DeleteConfirmationModal,
31
- e as FilterDropdownMenu,
31
+ o as FilterDropdownMenu,
32
32
  V as FilterInstancesDropdown,
33
33
  X as JSONPatchOp,
34
34
  r as MULTI_VALUE_DEFAULT_OPTION,
35
35
  n as MULTI_VALUE_DEFAULT_TAXONOMY_OPTION,
36
36
  p as MULTI_VALUE_DEFAULT_VALUE,
37
- l as MetadataEditor,
37
+ s as MetadataEditor,
38
38
  m as MetadataEmptyState,
39
39
  G as MetadataInstance,
40
40
  y as MetadataInstanceForm,
41
- v as MetadataInstanceFormAutofillButton,
41
+ b as MetadataInstanceFormAutofillButton,
42
42
  J as MetadataInstanceFormHeader,
43
43
  q as MetadataInstanceHeader,
44
44
  j as MetadataInstanceList,
45
- L as TIMEOUT_10_SECONDS,
45
+ c as TIMEOUT_10_SECONDS,
46
46
  Q as UnsavedChangesModal,
47
- u as UpdateMode,
47
+ U as UpdateMode,
48
48
  x as defaultInitialValues,
49
49
  i as defaultMetadataValueMap,
50
50
  O as useAutofill,
51
- T as withApiWrapper
51
+ L as withApiWrapper
52
52
  };
@@ -1,32 +1,32 @@
1
- import { Tooltip as _, Status as h, Text as x } from "@box/blueprint-web";
2
- import { AlertCircle as C } from "@box/blueprint-web-assets/icons/Medium";
3
- import { useIntl as g, FormattedDate as T } from "react-intl";
1
+ import { Tooltip as h, Status as _, Text as g } from "@box/blueprint-web";
2
+ import { AlertCircle as x } from "@box/blueprint-web-assets/icons/Medium";
3
+ import { useIntl as C, FormattedDate as T } from "react-intl";
4
4
  import { convertISOStringToUTCDate as b } from "../../../../utils/convertDate.js";
5
5
  import { C as v } from "../../../../../../chunks/types.js";
6
6
  import { getConfidenceScoreTooltip as D } from "../../../../utils/confidence-score/get-confidence-score-tooltip.js";
7
7
  import E from "../../../interactive-text/interactive-text.js";
8
8
  import { MetadataEntryDisplay as L } from "./metadata-entry-display.js";
9
- import N from "./messages.js";
9
+ import A from "./messages.js";
10
10
  import { jsxs as m, jsx as e } from "react/jsx-runtime";
11
- import '../../../../../../styles/metadata-instance-entry.css';const A = "_metadataInstanceEntry_fr9av_1", M = "_name_fr9av_6", j = "_labelContainer_fr9av_14", w = "_confidenceScoreIcon_fr9av_20", n = {
12
- metadataInstanceEntry: A,
13
- name: M,
11
+ import '../../../../../../styles/metadata-instance-entry.css';const M = "_metadataInstanceEntry_fr9av_1", N = "_name_fr9av_6", j = "_labelContainer_fr9av_14", O = "_confidenceScoreIcon_fr9av_20", r = {
12
+ metadataInstanceEntry: M,
13
+ name: N,
14
14
  labelContainer: j,
15
- confidenceScoreIcon: w
16
- }, K = ({
15
+ confidenceScoreIcon: O
16
+ }, P = ({
17
17
  description: o,
18
18
  name: a,
19
19
  shouldHideEmptyValues: f,
20
20
  type: c,
21
21
  value: t,
22
22
  taxonomyNodeFetcher: d,
23
- taxonomyKey: u,
24
- scope: p,
23
+ taxonomyKey: p,
24
+ scope: u,
25
25
  isExternallyOwned: y,
26
- confidenceScore: r,
26
+ confidenceScore: n,
27
27
  isConfidenceScoreReviewEnabled: S = !1
28
28
  }) => {
29
- const i = g(), s = S && r?.status === v.ReviewIsNeeded ? D(i.formatMessage, r.status, r.value) : null, l = (() => {
29
+ const i = C(), s = S && !!n && n.level !== v.High && !n.isAccepted ? D(i.formatMessage, n) : null, l = (() => {
30
30
  if (typeof t == "number")
31
31
  return t.toString();
32
32
  if (!t)
@@ -45,26 +45,26 @@ import '../../../../../../styles/metadata-instance-entry.css';const A = "_metada
45
45
  return t;
46
46
  })();
47
47
  return f && !l ? null : /* @__PURE__ */ m("div", {
48
- className: n.metadataInstanceEntry,
48
+ className: r.metadataInstanceEntry,
49
49
  children: [/* @__PURE__ */ m("div", {
50
- className: n.labelContainer,
51
- children: [s && /* @__PURE__ */ e(_, {
50
+ className: r.labelContainer,
51
+ children: [s && /* @__PURE__ */ e(h, {
52
52
  content: s,
53
53
  children: /* @__PURE__ */ e("span", {
54
- className: n.confidenceScoreIcon,
55
- children: /* @__PURE__ */ e(h, {
54
+ className: r.confidenceScoreIcon,
55
+ children: /* @__PURE__ */ e(_, {
56
56
  color: "SurfaceStatusSurfaceGray",
57
57
  hideText: !0,
58
- icon: C,
58
+ icon: x,
59
59
  interactive: !0,
60
- text: i.formatMessage(N.confidenceScoreIconAriaLabel)
60
+ text: i.formatMessage(A.confidenceScoreIconAriaLabel)
61
61
  })
62
62
  })
63
- }), /* @__PURE__ */ e(x, {
63
+ }), /* @__PURE__ */ e(g, {
64
64
  as: "h5",
65
65
  color: "textOnLightSecondary",
66
66
  variant: "bodyDefaultBold",
67
- className: n.name,
67
+ className: r.name,
68
68
  children: o ? /* @__PURE__ */ e(E, {
69
69
  as: "span",
70
70
  color: "textOnLightSecondary",
@@ -76,8 +76,8 @@ import '../../../../../../styles/metadata-instance-entry.css';const A = "_metada
76
76
  }), /* @__PURE__ */ e(L, {
77
77
  formattedValue: l,
78
78
  isExternallyOwned: y,
79
- scope: p,
80
- taxonomyKey: u,
79
+ scope: u,
80
+ taxonomyKey: p,
81
81
  taxonomyNodeFetcher: d,
82
82
  type: c,
83
83
  value: t
@@ -85,5 +85,5 @@ import '../../../../../../styles/metadata-instance-entry.css';const A = "_metada
85
85
  });
86
86
  };
87
87
  export {
88
- K as MetadataInstanceEntry
88
+ P as MetadataInstanceEntry
89
89
  };
@@ -1,20 +1,21 @@
1
- import { C as t } from "../../../../chunks/types.js";
2
- import { formatConfidenceScorePercent as i } from "./format-confidence-score-percent.js";
3
- import c from "./messages.js";
4
- function p(e, r, n) {
5
- const o = i(n);
6
- switch (r) {
7
- case t.ReviewIsNeeded:
8
- return e(c.tooltipLowConfidence, {
9
- score: o
1
+ import { C as r } from "../../../../chunks/types.js";
2
+ import { formatConfidenceScorePercent as c } from "./format-confidence-score-percent.js";
3
+ import i from "./messages.js";
4
+ function p(e, o) {
5
+ const t = c(o.value);
6
+ if (o.isAccepted)
7
+ return e(i.tooltipReviewedAndAccepted, {
8
+ score: t
9
+ });
10
+ switch (o.level) {
11
+ case r.Low:
12
+ case r.Medium:
13
+ return e(i.tooltipLowConfidence, {
14
+ score: t
10
15
  });
11
- case t.ReviewedAndAccepted:
12
- return e(c.tooltipReviewedAndAccepted, {
13
- score: o
14
- });
15
- case t.ReviewIsNotNeeded:
16
- return e(c.tooltipHighConfidence, {
17
- score: o
16
+ case r.High:
17
+ return e(i.tooltipHighConfidence, {
18
+ score: t
18
19
  });
19
20
  default:
20
21
  return null;
@@ -1,7 +1,7 @@
1
- import { C as i } from "../../../../chunks/types.js";
2
- function o(t) {
3
- return t.filter((e) => !e.hidden && e.confidenceScore?.status === i.ReviewIsNeeded);
1
+ import { C as n } from "../../../../chunks/types.js";
2
+ function i(c) {
3
+ return c.filter((e) => !e.hidden && !!e.confidenceScore && e.confidenceScore.level !== n.High && !e.confidenceScore.isAccepted);
4
4
  }
5
5
  export {
6
- o as getFieldsNeedingReview
6
+ i as getFieldsNeedingReview
7
7
  };
@@ -44,16 +44,18 @@ export declare enum AiSuggestionState {
44
44
  Pending = "PENDING",
45
45
  Applied = "APPLIED"
46
46
  }
47
- export declare enum ConfidenceScoreStatus {
48
- ReviewIsNeeded = "review_is_needed",
49
- ReviewedAndAccepted = "reviewed_and_accepted",
50
- ReviewIsNotNeeded = "review_is_not_needed"
47
+ export declare enum ConfidenceLevel {
48
+ Low = "LOW",
49
+ Medium = "MEDIUM",
50
+ High = "HIGH"
51
51
  }
52
52
  export type ConfidenceScoreData = {
53
53
  /** Confidence value from 0-1 (e.g., 0.95 = 95%) */
54
54
  value: number;
55
- /** Pre-computed status based on value vs threshold */
56
- status: ConfidenceScoreStatus;
55
+ /** AI confidence level provided by the backend */
56
+ level: ConfidenceLevel;
57
+ /** Whether the user has explicitly accepted this field value */
58
+ isAccepted: boolean;
57
59
  };
58
60
  export type MetadataTemplateField = {
59
61
  description?: string;
@@ -84,7 +86,6 @@ export type MetadataTemplate = {
84
86
  displayName?: string;
85
87
  hidden: boolean;
86
88
  copyInstanceOnItemCopy?: boolean;
87
- confidenceScoreThreshold?: number;
88
89
  fields: MetadataTemplateField[];
89
90
  };
90
91
  export type MetadataTemplateOption = {
@@ -96,7 +97,6 @@ export type MetadataTemplateOption = {
96
97
  export type MetadataFieldValue = string | number | Array<string> | null | BaseOptionType[];
97
98
  export type MetadataTemplateInstance = {
98
99
  canEdit: boolean;
99
- confidenceScoreThreshold?: number;
100
100
  displayName?: string;
101
101
  hidden?: boolean;
102
102
  id: string;
@@ -1,10 +1,9 @@
1
1
  import { IntlShape } from 'react-intl';
2
- import { ConfidenceScoreStatus } from '../../types';
2
+ import { ConfidenceScoreData } from '../../types';
3
3
  /**
4
- * Returns appropriate tooltip text based on confidence score status
4
+ * Returns appropriate tooltip text based on confidence score data
5
5
  * @param formatMessage - IntlShape formatMessage function
6
- * @param status - Confidence score status
7
- * @param scoreValue - Confidence score value (0-1)
8
- * @returns Tooltip text for the field, or null if status is unknown
6
+ * @param confidenceScore - Confidence score data object
7
+ * @returns Tooltip text for the field, or null for MEDIUM level (no tooltip shown)
9
8
  */
10
- export declare function getConfidenceScoreTooltip(formatMessage: IntlShape['formatMessage'], status: ConfidenceScoreStatus, scoreValue: number): string | null;
9
+ export declare function getConfidenceScoreTooltip(formatMessage: IntlShape['formatMessage'], confidenceScore: ConfidenceScoreData): string | null;
@@ -1,7 +1,7 @@
1
1
  import { MetadataTemplateField } from '../../types';
2
2
  /**
3
- * Returns fields that need review (confidence score below threshold)
3
+ * Returns fields that need review (non-high confidence score not yet accepted by user)
4
4
  * @param fields - Array of metadata template fields
5
- * @returns Array of visible fields with status 'review_is_needed'
5
+ * @returns Array of visible fields with non-high confidence that haven't been accepted
6
6
  */
7
7
  export declare function getFieldsNeedingReview(fields: MetadataTemplateField[]): MetadataTemplateField[];
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@box/metadata-editor",
3
- "version": "1.52.1",
3
+ "version": "1.52.3",
4
4
  "peerDependencies": {
5
5
  "@ariakit/react": "0.4.15",
6
- "@box/box-ai-agent-selector": "^1.38.9",
7
- "@box/blueprint-web": "^13.5.4",
8
- "@box/blueprint-web-assets": "^4.103.0",
9
- "@box/combobox-with-api": "^1.41.10",
6
+ "@box/box-ai-agent-selector": "^1.38.11",
7
+ "@box/blueprint-web": "^13.5.6",
8
+ "@box/blueprint-web-assets": "^4.104.1",
9
+ "@box/combobox-with-api": "^1.41.12",
10
10
  "formik": "^2.0.3",
11
11
  "lodash": "^4.17.15",
12
12
  "react": "^17.0.0 || ^18.0.0",
@@ -15,11 +15,11 @@
15
15
  },
16
16
  "devDependencies": {
17
17
  "@ariakit/react": "0.4.15",
18
- "@box/box-ai-agent-selector": "^1.38.9",
19
- "@box/babel-plugin-target-attributes": "1.5.2",
20
- "@box/blueprint-web": "^13.5.4",
21
- "@box/blueprint-web-assets": "^4.103.0",
22
- "@box/storybook-utils": "^0.16.60",
18
+ "@box/box-ai-agent-selector": "^1.38.11",
19
+ "@box/babel-plugin-target-attributes": "1.5.3",
20
+ "@box/blueprint-web": "^13.5.6",
21
+ "@box/blueprint-web-assets": "^4.104.1",
22
+ "@box/storybook-utils": "^0.16.62",
23
23
  "@testing-library/react": "^15.0.6",
24
24
  "react": "^18.3.0",
25
25
  "react-dom": "^18.3.0",