@box/metadata-editor 1.30.0 → 1.32.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 (34) hide show
  1. package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/metadata-instance-form.js +106 -101
  2. package/dist/esm/lib/components/metadata-instance-list/metadata-instance-list.js +27 -22
  3. package/dist/esm/lib/utils/confidence-score-context.js +24 -0
  4. package/dist/i18n/bn-IN.properties +2 -0
  5. package/dist/i18n/da-DK.properties +2 -0
  6. package/dist/i18n/de-DE.properties +2 -0
  7. package/dist/i18n/en-AU.properties +2 -0
  8. package/dist/i18n/en-CA.properties +2 -0
  9. package/dist/i18n/en-GB.properties +2 -0
  10. package/dist/i18n/en-x-pseudo.js +130 -130
  11. package/dist/i18n/en-x-pseudo.properties +131 -129
  12. package/dist/i18n/es-419.properties +2 -0
  13. package/dist/i18n/es-ES.properties +2 -0
  14. package/dist/i18n/fi-FI.properties +2 -0
  15. package/dist/i18n/fr-CA.properties +2 -0
  16. package/dist/i18n/fr-FR.properties +2 -0
  17. package/dist/i18n/hi-IN.properties +2 -0
  18. package/dist/i18n/it-IT.properties +2 -0
  19. package/dist/i18n/ja-JP.properties +2 -0
  20. package/dist/i18n/ko-KR.properties +2 -0
  21. package/dist/i18n/nb-NO.properties +2 -0
  22. package/dist/i18n/nl-NL.properties +2 -0
  23. package/dist/i18n/pl-PL.properties +2 -0
  24. package/dist/i18n/pt-BR.properties +2 -0
  25. package/dist/i18n/ru-RU.properties +2 -0
  26. package/dist/i18n/sv-SE.properties +2 -0
  27. package/dist/i18n/tr-TR.properties +2 -0
  28. package/dist/i18n/zh-CN.properties +2 -0
  29. package/dist/i18n/zh-TW.properties +2 -0
  30. package/dist/types/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/types.d.ts +1 -0
  31. package/dist/types/lib/components/metadata-instance-list/metadata-instance-list.d.ts +1 -1
  32. package/dist/types/lib/components/metadata-instance-list/types.d.ts +1 -0
  33. package/dist/types/lib/utils/confidence-score-context.d.ts +11 -0
  34. package/package.json +9 -9
@@ -1,143 +1,148 @@
1
1
  import "../custom-instance-new-field/custom-instance-new-field.js";
2
- import { DeleteConfirmationModal as J } from "../delete-confirmation-modal/delete-confirmation-modal.js";
2
+ import { DeleteConfirmationModal as z } 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 z from "clsx";
6
- import { Formik as G, Form as H } from "formik";
7
- import Q from "lodash/isEqual";
8
- import { useState as S, useEffect as y, useRef as O, useMemo as X } from "react";
9
- import { TEMPLATE_CUSTOM_PROPERTIES as Y } from "../../../../constants.js";
10
- import { useAutofill as Z } from "../../../../utils/autofill-context.js";
11
- import { TemplateInstance as ee } from "../../../metadata-editor-fields/metadata-editor-fields.js";
12
- import { MetadataEmptyState as te } from "../../../metadata-empty-state/metadata-empty-state.js";
13
- import { AutofillOverlay as ae } from "../autofill-overlay/autofill-overlay.js";
14
- import { CustomInstance as oe } from "../custom-instance/custom-instance.js";
15
- import { c as ne } from "../../../../../../chunks/utils.js";
16
- import { s as d, M as se } from "../../../../../../chunks/metadata-instance-form-card-wrapper.js";
17
- import { jsx as o, jsxs as D } from "react/jsx-runtime";
18
- import { UnsavedChangesModal as re } from "../../../unsaved-changes-modal/unsaved-changes-modal.js";
19
- const ie = ({
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 = ({
20
21
  dirty: i,
21
22
  onChange: l,
22
- values: t
23
+ values: o
23
24
  }) => {
24
- const s = O(t);
25
- return i && !Q(s.current.metadata.fields, t.metadata.fields) && (s.current = t, l(t)), null;
26
- }, Ie = (i) => {
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) => {
27
28
  const {
28
29
  areAiSuggestionsAvailable: l,
29
- customRef: t,
30
+ customRef: o,
30
31
  isLargeFile: s,
31
32
  errorCode: m,
32
33
  isAiSuggestionsFeatureEnabled: c,
33
- isAdvancedExtractAgentEnabled: I = !1,
34
+ isAdvancedExtractAgentEnabled: v = !1,
34
35
  isBetaLanguageEnabled: x,
35
- isDeleteButtonDisabled: A,
36
- isDeleteConfirmationModalCheckboxEnabled: v,
37
- isMultilevelTaxonomyFieldEnabled: p,
36
+ isDeleteButtonDisabled: I,
37
+ isDeleteConfirmationModalCheckboxEnabled: A,
38
+ isMultilevelTaxonomyFieldEnabled: f,
38
39
  isUnsavedChangesModalOpen: T = !1,
39
- MetadataInstanceFormCustomWrapper: L,
40
+ MetadataInstanceFormCustomWrapper: R,
40
41
  selectedTemplateInstance: e,
41
- onCancel: R,
42
- onChange: f,
43
- onDelete: k,
44
- onDiscardUnsavedChanges: N,
45
- onSubmit: P,
42
+ onCancel: L,
43
+ onChange: p,
44
+ onDelete: P,
45
+ onDiscardUnsavedChanges: k,
46
+ onSubmit: N,
46
47
  setIsUnsavedChangesModalOpen: u,
47
- taxonomyOptionsFetcher: g
48
- } = i, U = L ?? se, [B, h] = S(!1), {
48
+ taxonomyOptionsFetcher: g,
49
+ isConfidenceScoreReviewEnabled: U = !1
50
+ } = i, w = R ?? ie, [B, C] = S(!1), {
49
51
  isFetchingSuggestions: n,
50
- isLongLoading: C,
51
- getAiSuggestions: w,
52
+ isLongLoading: h,
53
+ getAiSuggestions: K,
52
54
  clearState: E,
53
- suggestions: K
54
- } = Z();
55
+ suggestions: V
56
+ } = ee();
55
57
  y(() => () => {
56
58
  E();
57
59
  }, [E, e?.id]);
58
- const F = e?.templateKey === Y, V = async (a) => {
59
- await P(a, ne(a, e));
60
- }, W = (a) => {
61
- a ? u(!0) : R();
62
- }, j = () => {
63
- h(!0);
64
- }, _ = {
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
+ }, $ = {
65
67
  metadata: {
66
68
  ...e
67
69
  }
68
- }, M = O(null), [b, $] = S(null);
70
+ }, F = O(null), [M, q] = S(null);
69
71
  y(() => {
70
- $(t ?? M.current);
71
- }, [t, e?.templateKey, e?.scope]);
72
- const q = X(() => {
72
+ q(o ?? F.current);
73
+ }, [o, e?.templateKey, e?.scope]);
74
+ const J = Y(() => {
73
75
  const a = e?.fields.length === 0;
74
- if (F)
75
- return /* @__PURE__ */ o(oe, {
76
+ if (b)
77
+ return /* @__PURE__ */ t(se, {
76
78
  isLoading: n
77
79
  });
78
80
  if (a)
79
- return /* @__PURE__ */ o(te, {
81
+ return /* @__PURE__ */ t(ae, {
80
82
  isBoxAiSuggestionsFeatureEnabled: c,
81
83
  level: "instance"
82
84
  });
83
85
  const r = !!(n || m);
84
86
  return /* @__PURE__ */ D("div", {
85
- className: z(d.metadataInstanceFormContent, r && d.showOverlay),
86
- children: [/* @__PURE__ */ o(ae, {
87
+ className: G(d.metadataInstanceFormContent, r && d.showOverlay),
88
+ children: [/* @__PURE__ */ t(ne, {
87
89
  errorCode: m,
88
90
  isFetchingSuggestions: n,
89
- isLongLoading: C
90
- }), /* @__PURE__ */ o(ee, {
91
+ isLongLoading: h
92
+ }), /* @__PURE__ */ t(oe, {
91
93
  disableForm: n,
92
- isMultilevelTaxonomyFieldEnabled: p,
93
- portalElement: t ?? b,
94
+ isMultilevelTaxonomyFieldEnabled: f,
95
+ portalElement: o ?? M,
94
96
  taxonomyOptionsFetcher: g
95
97
  })]
96
98
  });
97
- }, [e?.fields.length, F, n, C, t, b, g, c, p, m]);
98
- return /* @__PURE__ */ o(G, {
99
- initialValues: _,
100
- onSubmit: V,
101
- children: ({
102
- values: a,
103
- dirty: r
104
- }) => /* @__PURE__ */ D(H, {
105
- children: [/* @__PURE__ */ o(U, {
106
- areAiSuggestionsAvailable: l,
107
- className: d.metadataInstanceForm,
108
- formRef: M,
109
- formValues: a,
110
- getAiSuggestions: w,
111
- handleCancel: W,
112
- handleDelete: j,
113
- isAdvancedExtractAgentEnabled: I,
114
- isAiSuggestionsFeatureEnabled: c,
115
- isBetaLanguageEnabled: x,
116
- isDeleteButtonDisabled: A,
117
- isFetchingSuggestions: n,
118
- isFormDirty: r,
119
- isLargeFile: s,
120
- selectedTemplateInstance: e,
121
- suggestions: K,
122
- children: e && q
123
- }), f && /* @__PURE__ */ o(ie, {
124
- dirty: r,
125
- onChange: f,
126
- values: a
127
- }), /* @__PURE__ */ o(re, {
128
- onBackToEdit: () => u(!1),
129
- onDiscardChanges: N,
130
- open: T
131
- }), /* @__PURE__ */ o(J, {
132
- isCheckboxEnabled: v,
133
- onConfirm: () => k(e),
134
- onDismiss: () => h(!1),
135
- open: B,
136
- templateName: e?.displayName
137
- })]
138
- })
139
- }, `${e?.scope}.${e?.templateKey}`);
99
+ }, [e?.fields.length, b, n, h, o, M, g, c, f, m]);
100
+ return /* @__PURE__ */ t(te, {
101
+ isConfidenceScoreReviewEnabled: U,
102
+ children: /* @__PURE__ */ t(H, {
103
+ initialValues: $,
104
+ onSubmit: W,
105
+ children: ({
106
+ values: a,
107
+ dirty: r
108
+ }) => /* @__PURE__ */ D(Q, {
109
+ children: [/* @__PURE__ */ t(w, {
110
+ areAiSuggestionsAvailable: l,
111
+ className: d.metadataInstanceForm,
112
+ formRef: F,
113
+ formValues: a,
114
+ getAiSuggestions: K,
115
+ handleCancel: j,
116
+ handleDelete: _,
117
+ isAdvancedExtractAgentEnabled: v,
118
+ isAiSuggestionsFeatureEnabled: c,
119
+ isBetaLanguageEnabled: x,
120
+ isDeleteButtonDisabled: I,
121
+ isFetchingSuggestions: n,
122
+ isFormDirty: r,
123
+ isLargeFile: s,
124
+ selectedTemplateInstance: e,
125
+ suggestions: V,
126
+ children: e && J
127
+ }), p && /* @__PURE__ */ t(me, {
128
+ dirty: r,
129
+ onChange: p,
130
+ 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,
140
+ templateName: e?.displayName
141
+ })]
142
+ })
143
+ }, `${e?.scope}.${e?.templateKey}`)
144
+ });
140
145
  };
141
146
  export {
142
- Ie as MetadataInstanceForm
147
+ Ae as MetadataInstanceForm
143
148
  };
@@ -1,29 +1,34 @@
1
- import { getVisibleTemplates as c } from "../../utils/utils.js";
2
- import { MetadataInstance as d } from "./subcomponents/metadata-instance/metadata-instance.js";
3
- import { jsx as a } from "react/jsx-runtime";
1
+ import { ConfidenceScoreContextProvider as d } from "../../utils/confidence-score-context.js";
2
+ import { getVisibleTemplates as f } from "../../utils/utils.js";
3
+ import { MetadataInstance as l } from "./subcomponents/metadata-instance/metadata-instance.js";
4
+ import { jsx as t } from "react/jsx-runtime";
4
5
  import "./subcomponents/metadata-instance-header/metadata-instance-header.js";
5
- import '../../../../styles/metadata-instance-list.css';const p = "_metadataInstanceList_bd83w_1", l = {
6
+ import '../../../../styles/metadata-instance-list.css';const p = "_metadataInstanceList_bd83w_1", I = {
6
7
  metadataInstanceList: p
7
- }, b = ({
8
- areAiSuggestionsAvailable: s,
9
- isAiSuggestionsFeatureEnabled: e,
8
+ }, v = ({
9
+ areAiSuggestionsAvailable: e,
10
+ isAiSuggestionsFeatureEnabled: s,
10
11
  isBetaLanguageEnabled: n,
11
12
  onEdit: i,
12
- templateInstances: m,
13
- taxonomyNodeFetcher: o,
14
- isAdvancedExtractAgentEnabled: r = !1
15
- }) => /* @__PURE__ */ a("div", {
16
- className: l.metadataInstanceList,
17
- children: c(m).map((t) => /* @__PURE__ */ a(d, {
18
- areAiSuggestionsAvailable: s,
19
- isAdvancedExtractAgentEnabled: r,
20
- isAiSuggestionsFeatureEnabled: e,
21
- isBetaLanguageEnabled: n,
22
- onEdit: i,
23
- taxonomyNodeFetcher: o,
24
- templateInstance: t
25
- }, t.id))
13
+ templateInstances: o,
14
+ taxonomyNodeFetcher: r,
15
+ isAdvancedExtractAgentEnabled: m = !1,
16
+ isConfidenceScoreReviewEnabled: c = !1
17
+ }) => /* @__PURE__ */ t(d, {
18
+ isConfidenceScoreReviewEnabled: c,
19
+ children: /* @__PURE__ */ t("div", {
20
+ className: I.metadataInstanceList,
21
+ children: f(o).map((a) => /* @__PURE__ */ t(l, {
22
+ areAiSuggestionsAvailable: e,
23
+ isAdvancedExtractAgentEnabled: m,
24
+ isAiSuggestionsFeatureEnabled: s,
25
+ isBetaLanguageEnabled: n,
26
+ onEdit: i,
27
+ taxonomyNodeFetcher: r,
28
+ templateInstance: a
29
+ }, a.id))
30
+ })
26
31
  });
27
32
  export {
28
- b as MetadataInstanceList
33
+ v as MetadataInstanceList
29
34
  };
@@ -0,0 +1,24 @@
1
+ import { createContext as t, useMemo as c, useContext as s } from "react";
2
+ import { jsx as i } from "react/jsx-runtime";
3
+ const r = /* @__PURE__ */ t(null), C = ({
4
+ children: e,
5
+ isConfidenceScoreReviewEnabled: o
6
+ }) => {
7
+ const n = c(() => ({
8
+ isConfidenceScoreReviewEnabled: o
9
+ }), [o]);
10
+ return /* @__PURE__ */ i(r.Provider, {
11
+ value: n,
12
+ children: e
13
+ });
14
+ }, f = () => {
15
+ const e = s(r);
16
+ if (!e)
17
+ throw new Error("useConfidenceScore should be wrapped inside ConfidenceScoreContextProvider");
18
+ return e;
19
+ };
20
+ export {
21
+ r as ConfidenceScoreContext,
22
+ C as ConfidenceScoreContextProvider,
23
+ f as useIsConfidenceScoreReviewEnabled
24
+ };
@@ -26,6 +26,8 @@ groupSharedFeatures.metadataEditor.metadataEditorFields.clearAndReplace = সব
26
26
  groupSharedFeatures.metadataEditor.metadataEditorFields.clearSelectedDate = নির্বাচিত তারিখ মুছে ফেলুন
27
27
  # Error message shown for an invalid field value
28
28
  groupSharedFeatures.metadataEditor.metadataEditorFields.floatFieldInvalidValue = অবৈধ ফিল্ড মান
29
+ # Placeholder text displayed when editing metadata for multiple items and the selected items have different values for the field
30
+ groupSharedFeatures.metadataEditor.metadataEditorFields.multipleValues = Multiple values
29
31
  # Placeholder text for the multiselect field
30
32
  groupSharedFeatures.metadataEditor.metadataEditorFields.multiselectPlaceholder = মান নির্বাচন করুন
31
33
  # Error message shown if no attributes are available in the template
@@ -26,6 +26,8 @@ groupSharedFeatures.metadataEditor.metadataEditorFields.clearAndReplace = Ryd al
26
26
  groupSharedFeatures.metadataEditor.metadataEditorFields.clearSelectedDate = Ryd den valgte dato
27
27
  # Error message shown for an invalid field value
28
28
  groupSharedFeatures.metadataEditor.metadataEditorFields.floatFieldInvalidValue = Ugyldig feltværdi
29
+ # Placeholder text displayed when editing metadata for multiple items and the selected items have different values for the field
30
+ groupSharedFeatures.metadataEditor.metadataEditorFields.multipleValues = Multiple values
29
31
  # Placeholder text for the multiselect field
30
32
  groupSharedFeatures.metadataEditor.metadataEditorFields.multiselectPlaceholder = Vælg værdi(er)
31
33
  # Error message shown if no attributes are available in the template
@@ -26,6 +26,8 @@ groupSharedFeatures.metadataEditor.metadataEditorFields.clearAndReplace = Alles
26
26
  groupSharedFeatures.metadataEditor.metadataEditorFields.clearSelectedDate = Ausgewähltes Datum löschen
27
27
  # Error message shown for an invalid field value
28
28
  groupSharedFeatures.metadataEditor.metadataEditorFields.floatFieldInvalidValue = Ungültiger Feldwert
29
+ # Placeholder text displayed when editing metadata for multiple items and the selected items have different values for the field
30
+ groupSharedFeatures.metadataEditor.metadataEditorFields.multipleValues = Multiple values
29
31
  # Placeholder text for the multiselect field
30
32
  groupSharedFeatures.metadataEditor.metadataEditorFields.multiselectPlaceholder = Wert(e) auswählen
31
33
  # Error message shown if no attributes are available in the template
@@ -26,6 +26,8 @@ groupSharedFeatures.metadataEditor.metadataEditorFields.clearAndReplace = Clear
26
26
  groupSharedFeatures.metadataEditor.metadataEditorFields.clearSelectedDate = Clear selected date
27
27
  # Error message shown for an invalid field value
28
28
  groupSharedFeatures.metadataEditor.metadataEditorFields.floatFieldInvalidValue = Invalid field value
29
+ # Placeholder text displayed when editing metadata for multiple items and the selected items have different values for the field
30
+ groupSharedFeatures.metadataEditor.metadataEditorFields.multipleValues = Multiple values
29
31
  # Placeholder text for the multiselect field
30
32
  groupSharedFeatures.metadataEditor.metadataEditorFields.multiselectPlaceholder = Select value(s)
31
33
  # Error message shown if no attributes are available in the template
@@ -26,6 +26,8 @@ groupSharedFeatures.metadataEditor.metadataEditorFields.clearAndReplace = Clear
26
26
  groupSharedFeatures.metadataEditor.metadataEditorFields.clearSelectedDate = Clear selected date
27
27
  # Error message shown for an invalid field value
28
28
  groupSharedFeatures.metadataEditor.metadataEditorFields.floatFieldInvalidValue = Invalid field value
29
+ # Placeholder text displayed when editing metadata for multiple items and the selected items have different values for the field
30
+ groupSharedFeatures.metadataEditor.metadataEditorFields.multipleValues = Multiple values
29
31
  # Placeholder text for the multiselect field
30
32
  groupSharedFeatures.metadataEditor.metadataEditorFields.multiselectPlaceholder = Select value(s)
31
33
  # Error message shown if no attributes are available in the template
@@ -26,6 +26,8 @@ groupSharedFeatures.metadataEditor.metadataEditorFields.clearAndReplace = Clear
26
26
  groupSharedFeatures.metadataEditor.metadataEditorFields.clearSelectedDate = Clear selected date
27
27
  # Error message shown for an invalid field value
28
28
  groupSharedFeatures.metadataEditor.metadataEditorFields.floatFieldInvalidValue = Invalid field value
29
+ # Placeholder text displayed when editing metadata for multiple items and the selected items have different values for the field
30
+ groupSharedFeatures.metadataEditor.metadataEditorFields.multipleValues = Multiple values
29
31
  # Placeholder text for the multiselect field
30
32
  groupSharedFeatures.metadataEditor.metadataEditorFields.multiselectPlaceholder = Select value(s)
31
33
  # Error message shown if no attributes are available in the template