@box/metadata-editor 1.33.0 → 1.34.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 (61) hide show
  1. package/dist/chunks/types.js +5 -2
  2. package/dist/esm/index.js +38 -37
  3. package/dist/esm/lib/components/metadata-editor-fields/components/metadata-taxonomy-field/metadata-taxonomy-field.js +49 -48
  4. package/dist/esm/lib/components/metadata-editor-fields/metadata-editor-field-wrapper.js +38 -35
  5. package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/metadata-instance-form.js +92 -90
  6. package/dist/esm/lib/components/metadata-instance-list/metadata-instance-list.js +13 -11
  7. package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance/metadata-instance.js +27 -25
  8. package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-content/metadata-instance-content.js +11 -9
  9. package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/metadata-entry-display.js +9 -7
  10. package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/metadata-instance-entry.js +19 -17
  11. package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/taxonomy-entry/taxonomy-value.js +21 -19
  12. package/dist/esm/lib/utils/confidence-score/format-confidence-score-percent.js +6 -0
  13. package/dist/esm/lib/utils/confidence-score/get-confidence-score-tooltip.js +25 -0
  14. package/dist/esm/lib/utils/confidence-score/get-fields-needing-review.js +7 -0
  15. package/dist/esm/lib/utils/confidence-score/messages.js +18 -0
  16. package/dist/i18n/bn-IN.js +3 -0
  17. package/dist/i18n/da-DK.js +3 -0
  18. package/dist/i18n/de-DE.js +3 -0
  19. package/dist/i18n/en-AU.js +3 -0
  20. package/dist/i18n/en-CA.js +3 -0
  21. package/dist/i18n/en-GB.js +3 -0
  22. package/dist/i18n/en-US.js +3 -0
  23. package/dist/i18n/en-US.properties +6 -0
  24. package/dist/i18n/en-x-pseudo.js +3 -0
  25. package/dist/i18n/es-419.js +3 -0
  26. package/dist/i18n/es-ES.js +3 -0
  27. package/dist/i18n/fi-FI.js +3 -0
  28. package/dist/i18n/fr-CA.js +3 -0
  29. package/dist/i18n/fr-FR.js +3 -0
  30. package/dist/i18n/hi-IN.js +3 -0
  31. package/dist/i18n/it-IT.js +3 -0
  32. package/dist/i18n/ja-JP.js +3 -0
  33. package/dist/i18n/json/src/lib/utils/confidence-score/messages.json +1 -0
  34. package/dist/i18n/ko-KR.js +3 -0
  35. package/dist/i18n/nb-NO.js +3 -0
  36. package/dist/i18n/nl-NL.js +3 -0
  37. package/dist/i18n/pl-PL.js +3 -0
  38. package/dist/i18n/pt-BR.js +3 -0
  39. package/dist/i18n/ru-RU.js +3 -0
  40. package/dist/i18n/sv-SE.js +3 -0
  41. package/dist/i18n/tr-TR.js +3 -0
  42. package/dist/i18n/zh-CN.js +3 -0
  43. package/dist/i18n/zh-TW.js +3 -0
  44. package/dist/types/lib/components/metadata-editor-fields/types.d.ts +2 -0
  45. package/dist/types/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/types.d.ts +2 -0
  46. package/dist/types/lib/components/metadata-instance-list/metadata-instance-list.d.ts +1 -1
  47. package/dist/types/lib/components/metadata-instance-list/subcomponents/metadata-instance/metadata-instance.d.ts +1 -1
  48. package/dist/types/lib/components/metadata-instance-list/subcomponents/metadata-instance/types.d.ts +1 -0
  49. package/dist/types/lib/components/metadata-instance-list/subcomponents/metadata-instance-content/metadata-instance-content.d.ts +1 -1
  50. package/dist/types/lib/components/metadata-instance-list/subcomponents/metadata-instance-content/types.d.ts +1 -0
  51. package/dist/types/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/metadata-entry-display.d.ts +1 -1
  52. package/dist/types/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/metadata-instance-entry.d.ts +1 -1
  53. package/dist/types/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/taxonomy-entry/taxonomy-value.d.ts +1 -1
  54. package/dist/types/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/types.d.ts +3 -0
  55. package/dist/types/lib/components/metadata-instance-list/types.d.ts +1 -0
  56. package/dist/types/lib/types.d.ts +16 -0
  57. package/dist/types/lib/utils/confidence-score/format-confidence-score-percent.d.ts +13 -0
  58. package/dist/types/lib/utils/confidence-score/get-confidence-score-tooltip.d.ts +10 -0
  59. package/dist/types/lib/utils/confidence-score/get-fields-needing-review.d.ts +7 -0
  60. package/dist/types/lib/utils/confidence-score/messages.d.ts +18 -0
  61. package/package.json +1 -1
@@ -1,9 +1,12 @@
1
1
  let n = /* @__PURE__ */ (function(e) {
2
2
  return e.ClearAndReplace = "clearAndReplace", e.RemoveEntered = "removeEntered", e.ReplaceEntered = "replaceEntered", e.Append = "append", e;
3
- })({}), r = /* @__PURE__ */ (function(e) {
3
+ })({}), d = /* @__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
7
  })({});
6
8
  export {
7
- r as A,
9
+ d as A,
10
+ r as C,
8
11
  n as U
9
12
  };
package/dist/esm/index.js CHANGED
@@ -1,51 +1,52 @@
1
1
  import { FilterDropdownMenu as e } from "./lib/components/filter-dropdown-menu/index.js";
2
- import { MULTI_VALUE_DEFAULT_OPTION as r, MULTI_VALUE_DEFAULT_TAXONOMY_OPTION as p, MULTI_VALUE_DEFAULT_VALUE as n } from "./lib/components/metadata-editor-fields/components/update-mode-field-wrapper/mulitple-values-utils.js";
3
- import { MetadataEmptyState as f } from "./lib/components/metadata-empty-state/metadata-empty-state.js";
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
+ 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 M } from "./lib/metadata-editor.js";
6
- import { A, U as I } from "../chunks/types.js";
7
- import { withApiWrapper as u } from "./lib/utils/api-wrapper.js";
8
- import { AutofillContext as _, AutofillContextProvider as E, TIMEOUT_10_SECONDS as L, useAutofill as O } from "./lib/utils/autofill-context.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";
9
9
  import { AddMetadataTemplateDropdown as F } from "./lib/components/add-metadata-template-dropdown/add-metadata-template-dropdown.js";
10
- import { ComboboxWithApiPagination as C } from "./lib/components/combobox-with-api-pagination/combobox-with-api-pagination.js";
11
- import { FilterInstancesDropdown as S } from "./lib/components/filter-instances-dropdown/filter-instances-dropdown.js";
12
- import { CustomInstanceNewField as w } from "./lib/components/metadata-instance-editor/subcomponents/custom-instance-new-field/custom-instance-new-field.js";
13
- import { DeleteConfirmationModal as g } from "./lib/components/metadata-instance-editor/subcomponents/delete-confirmation-modal/delete-confirmation-modal.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
- import { MetadataInstanceFormHeader as H } from "./lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-header/metadata-instance-form-header.js";
16
- import { MetadataInstanceForm as W } from "./lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/metadata-instance-form.js";
17
- import { J as B } from "../chunks/utils.js";
18
- import { MetadataInstanceList as Y } from "./lib/components/metadata-instance-list/metadata-instance-list.js";
19
- import { MetadataInstanceHeader as k } from "./lib/components/metadata-instance-list/subcomponents/metadata-instance-header/metadata-instance-header.js";
20
- import { MetadataInstance as z } from "./lib/components/metadata-instance-list/subcomponents/metadata-instance/metadata-instance.js";
21
- import { UnsavedChangesModal as K } from "./lib/components/unsaved-changes-modal/unsaved-changes-modal.js";
10
+ import { ComboboxWithApiPagination as S } from "./lib/components/combobox-with-api-pagination/combobox-with-api-pagination.js";
11
+ import { FilterInstancesDropdown as V } from "./lib/components/filter-instances-dropdown/filter-instances-dropdown.js";
12
+ import { CustomInstanceNewField as P } from "./lib/components/metadata-instance-editor/subcomponents/custom-instance-new-field/custom-instance-new-field.js";
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";
15
+ import { MetadataInstanceFormHeader as J } from "./lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-header/metadata-instance-form-header.js";
16
+ import { MetadataInstanceForm as y } from "./lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/metadata-instance-form.js";
17
+ import { J as X } from "../chunks/utils.js";
18
+ import { MetadataInstanceList as j } from "./lib/components/metadata-instance-list/metadata-instance-list.js";
19
+ import { MetadataInstanceHeader as q } from "./lib/components/metadata-instance-list/subcomponents/metadata-instance-header/metadata-instance-header.js";
20
+ import { MetadataInstance as G } from "./lib/components/metadata-instance-list/subcomponents/metadata-instance/metadata-instance.js";
21
+ import { UnsavedChangesModal as Q } from "./lib/components/unsaved-changes-modal/unsaved-changes-modal.js";
22
22
  export {
23
23
  F as AddMetadataTemplateDropdown,
24
24
  A as AiSuggestionState,
25
- _ as AutofillContext,
25
+ c as AutofillContext,
26
26
  E as AutofillContextProvider,
27
- C as ComboboxWithApiPagination,
28
- w as CustomInstanceNewField,
29
- g as DeleteConfirmationModal,
27
+ S as ComboboxWithApiPagination,
28
+ I as ConfidenceScoreStatus,
29
+ P as CustomInstanceNewField,
30
+ h as DeleteConfirmationModal,
30
31
  e as FilterDropdownMenu,
31
- S as FilterInstancesDropdown,
32
- B as JSONPatchOp,
32
+ V as FilterInstancesDropdown,
33
+ X as JSONPatchOp,
33
34
  r as MULTI_VALUE_DEFAULT_OPTION,
34
- p as MULTI_VALUE_DEFAULT_TAXONOMY_OPTION,
35
- n as MULTI_VALUE_DEFAULT_VALUE,
36
- M as MetadataEditor,
37
- f as MetadataEmptyState,
38
- z as MetadataInstance,
39
- W as MetadataInstanceForm,
40
- b as MetadataInstanceFormAutofillButton,
41
- H as MetadataInstanceFormHeader,
42
- k as MetadataInstanceHeader,
43
- Y as MetadataInstanceList,
35
+ n as MULTI_VALUE_DEFAULT_TAXONOMY_OPTION,
36
+ p as MULTI_VALUE_DEFAULT_VALUE,
37
+ l as MetadataEditor,
38
+ m as MetadataEmptyState,
39
+ G as MetadataInstance,
40
+ y as MetadataInstanceForm,
41
+ v as MetadataInstanceFormAutofillButton,
42
+ J as MetadataInstanceFormHeader,
43
+ q as MetadataInstanceHeader,
44
+ j as MetadataInstanceList,
44
45
  L as TIMEOUT_10_SECONDS,
45
- K as UnsavedChangesModal,
46
- I as UpdateMode,
46
+ Q as UnsavedChangesModal,
47
+ u as UpdateMode,
47
48
  x as defaultInitialValues,
48
49
  i as defaultMetadataValueMap,
49
50
  O as useAutofill,
50
- u as withApiWrapper
51
+ T as withApiWrapper
51
52
  };
@@ -1,83 +1,84 @@
1
- import { ComboboxWithApiTreeView as W, ComboboxWithApiPagination as w } from "@box/combobox-with-api";
2
- import { useFormikContext as _, getIn as $, Field as D } from "formik";
3
- import { forwardRef as K, useCallback as j } from "react";
4
- import { useIntl as R } from "react-intl";
5
- import S from "../../../../messages.js";
6
- import { g as A } from "../../../../../../chunks/utils2.js";
7
- import { messages as q } from "../update-mode-field-wrapper/messages.js";
8
- import { MULTI_VALUE_DEFAULT_VALUE as z } from "../update-mode-field-wrapper/mulitple-values-utils.js";
9
- import { jsx as l } from "react/jsx-runtime";
10
- const B = (a, o) => a === z ? o : a, ee = /* @__PURE__ */ K(({
1
+ import { ComboboxWithApiTreeView as D, ComboboxWithApiPagination as _ } from "@box/combobox-with-api";
2
+ import { useFormikContext as $, getIn as K, Field as j } from "formik";
3
+ import { forwardRef as R, useCallback as S } from "react";
4
+ import { useIntl as q } from "react-intl";
5
+ import z from "../../../../messages.js";
6
+ import { g as L } from "../../../../../../chunks/utils2.js";
7
+ import { messages as B } from "../update-mode-field-wrapper/messages.js";
8
+ import { MULTI_VALUE_DEFAULT_VALUE as G } from "../update-mode-field-wrapper/mulitple-values-utils.js";
9
+ import { jsx as t } from "react/jsx-runtime";
10
+ const H = (a, l) => a === G ? l : a, oe = /* @__PURE__ */ R(({
11
11
  description: a,
12
- disableForm: o,
13
- isAiSuggestionApplied: s,
12
+ disableForm: l,
13
+ isAiSuggestionApplied: i,
14
14
  fieldNamePrefix: n,
15
15
  label: r,
16
- onValueEdited: L,
16
+ onValueEdited: M,
17
17
  portalElement: m,
18
18
  taxonomyOptionsFetcher: u,
19
- updateModePrefix: M,
19
+ updateModePrefix: I,
20
20
  className: d,
21
- isMultilevelTaxonomyFieldEnabled: I
21
+ isExternallyOwned: k,
22
+ isMultilevelTaxonomyFieldEnabled: E
22
23
  }, c) => {
23
24
  const {
24
25
  formatMessage: p
25
- } = R(), g = `${M ?? n}.value`, {
26
- setFieldValue: k,
27
- values: h
28
- } = _(), {
26
+ } = q(), b = `${I ?? n}.value`, {
27
+ setFieldValue: P,
28
+ values: g
29
+ } = $(), {
29
30
  metadata: {
30
- templateKey: V,
31
- scope: b
31
+ templateKey: h,
32
+ scope: V
32
33
  }
33
- } = h, E = $(h, n), {
34
+ } = g, U = K(g, n), {
34
35
  key: v,
35
36
  optionsRules: {
36
- multiSelect: i,
37
- selectableLevels: t
37
+ multiSelect: s,
38
+ selectableLevels: o
38
39
  },
39
- levels: P
40
- } = E, U = p(q.multipleValues), y = I && t?.some((e) => e > 1), f = j((e) => u(b, V, v, t?.[0], e), [v, b, t, u, V]), x = (e) => i || !e?.length ? p(S.taxonomyPlaceholder) : void 0, T = (e) => {
41
- k(g, e), L();
40
+ levels: W
41
+ } = U, w = p(B.multipleValues), y = E && o?.some((e) => e > 1), f = l || k, x = S((e) => u(V, h, v, o?.[0], e), [v, V, o, u, h]), F = (e) => s || !e?.length ? p(z.taxonomyPlaceholder) : void 0, T = (e) => {
42
+ P(b, e), M();
42
43
  };
43
- return /* @__PURE__ */ l("div", {
44
+ return /* @__PURE__ */ t("div", {
44
45
  "data-testid": `${r}-field`,
45
46
  onKeyDown: (e) => e.stopPropagation(),
46
47
  role: "presentation",
47
- children: /* @__PURE__ */ l(D, {
48
- name: g,
48
+ children: /* @__PURE__ */ t(j, {
49
+ name: b,
49
50
  children: ({
50
51
  field: e
51
52
  }) => {
52
- const C = Array.isArray(e.value) ? e.value.map((F) => ({
53
- ...F,
54
- displayValue: B(F.displayValue, U)
53
+ const C = Array.isArray(e.value) ? e.value.map((A) => ({
54
+ ...A,
55
+ displayValue: H(A.displayValue, w)
55
56
  })) : e.value;
56
- return y ? /* @__PURE__ */ l(W, {
57
+ return y ? /* @__PURE__ */ t(D, {
57
58
  ref: c,
58
59
  className: d,
59
60
  closeOnSelection: y,
60
61
  dataTargetId: "ComboboxWithApiTreeView-MetadataEditorTaxonomyField",
61
- defaultFetcher: f,
62
- disabled: o,
63
- label: A(r, a, s),
64
- levels: P,
65
- multiselect: i,
62
+ defaultFetcher: x,
63
+ disabled: f,
64
+ label: L(r, a, i),
65
+ levels: W,
66
+ multiselect: s,
66
67
  onValueChange: T,
67
- placeholder: x(e.value),
68
+ placeholder: F(e.value),
68
69
  portalElement: m,
69
- selectableLevels: t,
70
+ selectableLevels: o,
70
71
  value: C
71
- }) : /* @__PURE__ */ l(w, {
72
+ }) : /* @__PURE__ */ t(_, {
72
73
  ref: c,
73
74
  className: d,
74
75
  dataTargetId: "ComboboxWithApiPagination-MetadataEditorTaxonomyField",
75
- defaultFetcher: f,
76
- disabled: o,
77
- label: A(r, a, s),
78
- multiselect: i,
76
+ defaultFetcher: x,
77
+ disabled: f,
78
+ label: L(r, a, i),
79
+ multiselect: s,
79
80
  onValueChange: T,
80
- placeholder: x(e.value),
81
+ placeholder: F(e.value),
81
82
  portalElement: m,
82
83
  value: C
83
84
  });
@@ -86,5 +87,5 @@ const B = (a, o) => a === z ? o : a, ee = /* @__PURE__ */ K(({
86
87
  });
87
88
  });
88
89
  export {
89
- ee as MetadataTaxonomyField
90
+ oe as MetadataTaxonomyField
90
91
  };
@@ -1,31 +1,32 @@
1
- import $ from "clsx";
2
- import { useFormikContext as C } from "formik";
3
- import E from "lodash/isUndefined";
4
- import { forwardRef as U, useCallback as S, useEffect as v, useMemo as j } from "react";
1
+ import C from "clsx";
2
+ import { useFormikContext as U } from "formik";
3
+ import j from "lodash/isUndefined";
4
+ import { forwardRef as E, useCallback as S, useEffect as I, useMemo as R } from "react";
5
5
  import { A as o } from "../../../../chunks/types.js";
6
- import { UpdateModeFieldWrapper as R } from "./components/update-mode-field-wrapper/update-mode-field-wrapper.js";
7
- import { editorFieldTypes as T } from "./editor-field-types.js";
6
+ import { UpdateModeFieldWrapper as T } from "./components/update-mode-field-wrapper/update-mode-field-wrapper.js";
7
+ import { editorFieldTypes as b } from "./editor-field-types.js";
8
8
  import { s as l } from "../../../../chunks/utils2.js";
9
- import { jsx as d, jsxs as b } from "react/jsx-runtime";
10
- import { AiSuggestionField as B } from "./components/ai-suggestion-field/ai-suggestion-field.js";
11
- const Y = /* @__PURE__ */ U(({
9
+ import { jsx as d, jsxs as B } from "react/jsx-runtime";
10
+ import { AiSuggestionField as q } from "./components/ai-suggestion-field/ai-suggestion-field.js";
11
+ const Z = /* @__PURE__ */ E(({
12
12
  disableForm: A,
13
13
  portalElement: f,
14
14
  field: e,
15
- index: I,
15
+ index: V,
16
16
  taxonomyOptionsFetcher: y,
17
- isMultilevelTaxonomyFieldEnabled: h
18
- }, x) => {
17
+ isExternallyOwned: h,
18
+ isMultilevelTaxonomyFieldEnabled: F
19
+ }, M) => {
19
20
  const {
20
21
  setFieldValue: s
21
- } = C(), u = e.aiSuggestionState || o.Initial, a = u === o.Pending, F = u === o.Applied, M = u === o.Initial, c = T[e.type], {
22
+ } = U(), u = e.aiSuggestionState || o.Initial, a = u === o.Pending, N = u === o.Applied, v = u === o.Initial, c = b[e.type], {
22
23
  aiSuggestion: t,
23
- type: N,
24
+ type: x,
24
25
  value: r
25
- } = e, V = c && !e.hidden, W = !E(e.updateMode), i = `metadata.fields[${I}]`, k = e.type === "taxonomy" && e.optionsRules?.multiSelect, w = $({
26
- [l.suggestionApplied]: F,
26
+ } = e, W = c && !e.hidden, k = !j(e.updateMode), i = `metadata.fields[${V}]`, P = e.type === "taxonomy" && e.optionsRules?.multiSelect, $ = C({
27
+ [l.suggestionApplied]: N,
27
28
  [l.hasSuggestion]: a,
28
- [l.dateField]: N === "date"
29
+ [l.dateField]: x === "date"
29
30
  }), n = S((p) => {
30
31
  s(`${i}.aiSuggestionState`, p);
31
32
  }, [i, s]), g = S((p) => {
@@ -33,56 +34,58 @@ const Y = /* @__PURE__ */ U(({
33
34
  }, [i, s, n]), m = S(() => {
34
35
  n(o.Initial), s(`${i}.aiSuggestion`, void 0);
35
36
  }, [n, s, i]);
36
- v(() => {
37
+ I(() => {
37
38
  a && (!r || Array.isArray(r) && r.length === 0) && g(t);
38
- }, [t, a, g]), v(() => {
39
- M && t && n(o.Pending);
40
- }, [M, t, n]);
41
- const P = j(() => t && r === t, [a]);
42
- return V ? W ? /* @__PURE__ */ d(R, {
39
+ }, [t, a, g]), I(() => {
40
+ v && t && n(o.Pending);
41
+ }, [v, t, n]);
42
+ const w = R(() => t && r === t, [a]);
43
+ return W ? k ? /* @__PURE__ */ d(T, {
43
44
  fieldNamePrefix: i,
44
45
  fieldType: e.type,
45
- isTaxonomyMultiSelect: k,
46
+ isTaxonomyMultiSelect: P,
46
47
  children: /* @__PURE__ */ d(c, {
47
- ref: x,
48
+ ref: M,
48
49
  description: e.description,
49
50
  disableForm: A,
50
51
  fieldNamePrefix: i,
51
52
  isAiSuggestionApplied: !1,
52
- isMultilevelTaxonomyFieldEnabled: h,
53
+ isExternallyOwned: h,
54
+ isMultilevelTaxonomyFieldEnabled: F,
53
55
  label: e.displayName,
54
56
  levels: e.levels,
55
57
  onValueEdited: m,
56
58
  portalElement: f,
57
59
  taxonomyOptionsFetcher: y
58
60
  })
59
- }, e.key) : /* @__PURE__ */ b("div", {
61
+ }, e.key) : /* @__PURE__ */ B("div", {
60
62
  className: l.fieldWrapper,
61
63
  children: [/* @__PURE__ */ d(c, {
62
- ref: x,
63
- className: w,
64
+ ref: M,
65
+ className: $,
64
66
  description: e.description,
65
67
  disableForm: A,
66
68
  fieldNamePrefix: i,
67
- isAiSuggestionApplied: F,
68
- isMultilevelTaxonomyFieldEnabled: h,
69
+ isAiSuggestionApplied: N,
70
+ isExternallyOwned: h,
71
+ isMultilevelTaxonomyFieldEnabled: F,
69
72
  label: e.displayName,
70
73
  onValueEdited: m,
71
74
  portalElement: f,
72
75
  taxonomyOptionsFetcher: y
73
- }), a && /* @__PURE__ */ d(B, {
76
+ }), a && /* @__PURE__ */ d(q, {
74
77
  aiSuggestion: t,
75
- isSameValue: P,
78
+ isSameValue: w,
76
79
  onAiSuggestionAppend: () => {
77
80
  const p = [...new Set([r, t].flat().filter(Boolean))];
78
81
  g(p);
79
82
  },
80
83
  onAiSuggestionIgnore: m,
81
84
  onAiSuggestionReplace: () => g(t),
82
- type: N
85
+ type: x
83
86
  })]
84
87
  }, e.key) : null;
85
88
  });
86
89
  export {
87
- Y as MetadataEditorFieldWrapper
90
+ Z as MetadataEditorFieldWrapper
88
91
  };
@@ -1,30 +1,30 @@
1
1
  import "../custom-instance-new-field/custom-instance-new-field.js";
2
- import { DeleteConfirmationModal as z } from "../delete-confirmation-modal/delete-confirmation-modal.js";
2
+ import { DeleteConfirmationModal as G } from "../delete-confirmation-modal/delete-confirmation-modal.js";
3
3
  import "../metadata-instance-form-autofill-button/metadata-instance-form-autofill-button.js";
4
4
  import "../metadata-instance-form-header/metadata-instance-form-header.js";
5
- import G from "clsx";
6
- import { Formik as H, Form as Q } from "formik";
7
- import X from "lodash/isEqual";
8
- import { useState as S, useEffect as y, useRef as O, useMemo as Y } from "react";
9
- import { TEMPLATE_CUSTOM_PROPERTIES as Z } from "../../../../constants.js";
10
- import { useAutofill as ee } from "../../../../utils/autofill-context.js";
11
- import { ConfidenceScoreContextProvider as te } from "../../../../utils/confidence-score-context.js";
12
- import { TemplateInstance as oe } from "../../../metadata-editor-fields/metadata-editor-fields.js";
13
- import { MetadataEmptyState as ae } from "../../../metadata-empty-state/metadata-empty-state.js";
14
- import { AutofillOverlay as ne } from "../autofill-overlay/autofill-overlay.js";
15
- import { CustomInstance as se } from "../custom-instance/custom-instance.js";
16
- import { c as re } from "../../../../../../chunks/utils.js";
17
- import { s as d, M as ie } from "../../../../../../chunks/metadata-instance-form-card-wrapper.js";
18
- import { jsx as t, jsxs as D } from "react/jsx-runtime";
19
- import { UnsavedChangesModal as le } from "../../../unsaved-changes-modal/unsaved-changes-modal.js";
20
- const me = ({
5
+ import H from "clsx";
6
+ import { Formik as Q, Form as X } from "formik";
7
+ import Y from "lodash/isEqual";
8
+ import { useState as y, useEffect as O, useRef as D, useMemo as Z } from "react";
9
+ import { TEMPLATE_CUSTOM_PROPERTIES as ee } from "../../../../constants.js";
10
+ import { useAutofill as te } from "../../../../utils/autofill-context.js";
11
+ import { ConfidenceScoreContextProvider as oe } from "../../../../utils/confidence-score-context.js";
12
+ import { TemplateInstance as ae } from "../../../metadata-editor-fields/metadata-editor-fields.js";
13
+ import { MetadataEmptyState as ne } from "../../../metadata-empty-state/metadata-empty-state.js";
14
+ import { AutofillOverlay as se } from "../autofill-overlay/autofill-overlay.js";
15
+ import { CustomInstance as re } from "../custom-instance/custom-instance.js";
16
+ import { c as ie } from "../../../../../../chunks/utils.js";
17
+ import { s as d, M as le } from "../../../../../../chunks/metadata-instance-form-card-wrapper.js";
18
+ import { jsx as t, jsxs as x } from "react/jsx-runtime";
19
+ import { UnsavedChangesModal as me } from "../../../unsaved-changes-modal/unsaved-changes-modal.js";
20
+ const ce = ({
21
21
  dirty: i,
22
22
  onChange: l,
23
23
  values: o
24
24
  }) => {
25
- const s = O(o);
26
- return i && !X(s.current.metadata.fields, o.metadata.fields) && (s.current = o, l(o)), null;
27
- }, Ae = (i) => {
25
+ const s = D(o);
26
+ return i && !Y(s.current.metadata.fields, o.metadata.fields) && (s.current = o, l(o)), null;
27
+ }, Te = (i) => {
28
28
  const {
29
29
  areAiSuggestionsAvailable: l,
30
30
  customRef: o,
@@ -32,111 +32,113 @@ const me = ({
32
32
  errorCode: m,
33
33
  isAiSuggestionsFeatureEnabled: c,
34
34
  isAdvancedExtractAgentEnabled: v = !1,
35
- isBetaLanguageEnabled: x,
36
- isDeleteButtonDisabled: I,
37
- isDeleteConfirmationModalCheckboxEnabled: A,
38
- isMultilevelTaxonomyFieldEnabled: f,
39
- isUnsavedChangesModalOpen: T = !1,
40
- MetadataInstanceFormCustomWrapper: R,
35
+ isBetaLanguageEnabled: I,
36
+ isExternallyOwned: f = !1,
37
+ isDeleteButtonDisabled: A,
38
+ isDeleteConfirmationModalCheckboxEnabled: T,
39
+ isMultilevelTaxonomyFieldEnabled: p,
40
+ isUnsavedChangesModalOpen: R = !1,
41
+ MetadataInstanceFormCustomWrapper: L,
41
42
  selectedTemplateInstance: e,
42
- onCancel: L,
43
- onChange: p,
44
- onDelete: P,
45
- onDiscardUnsavedChanges: k,
43
+ onCancel: P,
44
+ onChange: u,
45
+ onDelete: k,
46
+ onDiscardUnsavedChanges: w,
46
47
  onSubmit: N,
47
- setIsUnsavedChangesModalOpen: u,
48
- taxonomyOptionsFetcher: g,
48
+ setIsUnsavedChangesModalOpen: g,
49
+ taxonomyOptionsFetcher: C,
49
50
  isConfidenceScoreReviewEnabled: U = !1
50
- } = i, w = R ?? ie, [B, C] = S(!1), {
51
+ } = i, B = L ?? le, [K, h] = y(!1), {
51
52
  isFetchingSuggestions: n,
52
- isLongLoading: h,
53
- getAiSuggestions: K,
54
- clearState: E,
55
- suggestions: V
56
- } = ee();
57
- y(() => () => {
58
- E();
59
- }, [E, e?.id]);
60
- const b = e?.templateKey === Z, W = async (a) => {
61
- await N(a, re(a, e));
62
- }, j = (a) => {
63
- a ? u(!0) : L();
64
- }, _ = () => {
65
- C(!0);
66
- }, $ = {
53
+ isLongLoading: E,
54
+ getAiSuggestions: V,
55
+ clearState: b,
56
+ suggestions: W
57
+ } = te();
58
+ O(() => () => {
59
+ b();
60
+ }, [b, e?.id]);
61
+ const F = e?.templateKey === ee, j = async (a) => {
62
+ await N(a, ie(a, e));
63
+ }, _ = (a) => {
64
+ a ? g(!0) : P();
65
+ }, $ = () => {
66
+ h(!0);
67
+ }, q = {
67
68
  metadata: {
68
69
  ...e
69
70
  }
70
- }, F = O(null), [M, q] = S(null);
71
- y(() => {
72
- q(o ?? F.current);
71
+ }, M = D(null), [S, J] = y(null);
72
+ O(() => {
73
+ J(o ?? M.current);
73
74
  }, [o, e?.templateKey, e?.scope]);
74
- const J = Y(() => {
75
+ const z = Z(() => {
75
76
  const a = e?.fields.length === 0;
76
- if (b)
77
- return /* @__PURE__ */ t(se, {
77
+ if (F)
78
+ return /* @__PURE__ */ t(re, {
78
79
  isLoading: n
79
80
  });
80
81
  if (a)
81
- return /* @__PURE__ */ t(ae, {
82
+ return /* @__PURE__ */ t(ne, {
82
83
  isBoxAiSuggestionsFeatureEnabled: c,
83
84
  level: "instance"
84
85
  });
85
86
  const r = !!(n || m);
86
- return /* @__PURE__ */ D("div", {
87
- className: G(d.metadataInstanceFormContent, r && d.showOverlay),
88
- children: [/* @__PURE__ */ t(ne, {
87
+ return /* @__PURE__ */ x("div", {
88
+ className: H(d.metadataInstanceFormContent, r && d.showOverlay),
89
+ children: [/* @__PURE__ */ t(se, {
89
90
  errorCode: m,
90
91
  isFetchingSuggestions: n,
91
- isLongLoading: h
92
- }), /* @__PURE__ */ t(oe, {
92
+ isLongLoading: E
93
+ }), /* @__PURE__ */ t(ae, {
93
94
  disableForm: n,
94
- isMultilevelTaxonomyFieldEnabled: f,
95
- portalElement: o ?? M,
96
- taxonomyOptionsFetcher: g
95
+ isExternallyOwned: f,
96
+ isMultilevelTaxonomyFieldEnabled: p,
97
+ portalElement: o ?? S,
98
+ taxonomyOptionsFetcher: C
97
99
  })]
98
100
  });
99
- }, [e?.fields.length, b, n, h, o, M, g, c, f, m]);
100
- return /* @__PURE__ */ t(te, {
101
+ }, [e?.fields.length, F, n, E, o, S, C, c, f, p, m]);
102
+ return /* @__PURE__ */ t(oe, {
101
103
  isConfidenceScoreReviewEnabled: U,
102
- children: /* @__PURE__ */ t(H, {
103
- initialValues: $,
104
- onSubmit: W,
104
+ children: /* @__PURE__ */ t(Q, {
105
+ initialValues: q,
106
+ onSubmit: j,
105
107
  children: ({
106
108
  values: a,
107
109
  dirty: r
108
- }) => /* @__PURE__ */ D(Q, {
109
- children: [/* @__PURE__ */ t(w, {
110
+ }) => /* @__PURE__ */ x(X, {
111
+ children: [/* @__PURE__ */ t(B, {
110
112
  areAiSuggestionsAvailable: l,
111
113
  className: d.metadataInstanceForm,
112
- formRef: F,
114
+ formRef: M,
113
115
  formValues: a,
114
- getAiSuggestions: K,
115
- handleCancel: j,
116
- handleDelete: _,
116
+ getAiSuggestions: V,
117
+ handleCancel: _,
118
+ handleDelete: $,
117
119
  isAdvancedExtractAgentEnabled: v,
118
120
  isAiSuggestionsFeatureEnabled: c,
119
- isBetaLanguageEnabled: x,
120
- isDeleteButtonDisabled: I,
121
+ isBetaLanguageEnabled: I,
122
+ isDeleteButtonDisabled: A,
121
123
  isFetchingSuggestions: n,
122
124
  isFormDirty: r,
123
125
  isLargeFile: s,
124
126
  selectedTemplateInstance: e,
125
- suggestions: V,
126
- children: e && J
127
- }), p && /* @__PURE__ */ t(me, {
127
+ suggestions: W,
128
+ children: e && z
129
+ }), u && /* @__PURE__ */ t(ce, {
128
130
  dirty: r,
129
- onChange: p,
131
+ onChange: u,
130
132
  values: a
131
- }), /* @__PURE__ */ t(le, {
132
- onBackToEdit: () => u(!1),
133
- onDiscardChanges: k,
134
- open: T
135
- }), /* @__PURE__ */ t(z, {
136
- isCheckboxEnabled: A,
137
- onConfirm: () => P(e),
138
- onDismiss: () => C(!1),
139
- open: B,
133
+ }), /* @__PURE__ */ t(me, {
134
+ onBackToEdit: () => g(!1),
135
+ onDiscardChanges: w,
136
+ open: R
137
+ }), /* @__PURE__ */ t(G, {
138
+ isCheckboxEnabled: T,
139
+ onConfirm: () => k(e),
140
+ onDismiss: () => h(!1),
141
+ open: K,
140
142
  templateName: e?.displayName
141
143
  })]
142
144
  })
@@ -144,5 +146,5 @@ const me = ({
144
146
  });
145
147
  };
146
148
  export {
147
- Ae as MetadataInstanceForm
149
+ Te as MetadataInstanceForm
148
150
  };