@box/metadata-editor 0.109.6 → 0.110.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 (87) hide show
  1. package/dist/chunks/metadata-instance-form-card-wrapper.js +32 -30
  2. package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/metadata-instance-form-card-wrapper.js +1 -1
  3. package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/metadata-instance-form.js +70 -68
  4. package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-autofill-button/messages.js +14 -14
  5. package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-autofill-button/metadata-instance-form-autofill-button.js +100 -56
  6. package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-header/metadata-instance-form-header.js +24 -22
  7. package/dist/esm/lib/components/metadata-instance-list/metadata-instance-list.js +10 -8
  8. package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance/metadata-instance.js +29 -27
  9. package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-header/messages.js +2 -14
  10. package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-header/metadata-instance-header.js +46 -40
  11. package/dist/esm/lib/constants.js +13 -2
  12. package/dist/esm/lib/messages.js +18 -0
  13. package/dist/esm/lib/utils/utils.js +7 -5
  14. package/dist/i18n/bn-IN.js +17 -10
  15. package/dist/i18n/bn-IN.properties +5 -1
  16. package/dist/i18n/da-DK.js +17 -10
  17. package/dist/i18n/da-DK.properties +5 -1
  18. package/dist/i18n/de-DE.js +17 -10
  19. package/dist/i18n/de-DE.properties +5 -1
  20. package/dist/i18n/en-AU.js +15 -8
  21. package/dist/i18n/en-AU.properties +5 -1
  22. package/dist/i18n/en-CA.js +15 -8
  23. package/dist/i18n/en-CA.properties +5 -1
  24. package/dist/i18n/en-GB.js +15 -8
  25. package/dist/i18n/en-GB.properties +5 -1
  26. package/dist/i18n/en-US.js +7 -6
  27. package/dist/i18n/en-US.properties +14 -12
  28. package/dist/i18n/en-x-pseudo.js +132 -125
  29. package/dist/i18n/en-x-pseudo.properties +127 -123
  30. package/dist/i18n/es-419.js +17 -10
  31. package/dist/i18n/es-419.properties +5 -1
  32. package/dist/i18n/es-ES.js +17 -10
  33. package/dist/i18n/es-ES.properties +5 -1
  34. package/dist/i18n/fi-FI.js +17 -10
  35. package/dist/i18n/fi-FI.properties +5 -1
  36. package/dist/i18n/fr-CA.js +17 -10
  37. package/dist/i18n/fr-CA.properties +5 -1
  38. package/dist/i18n/fr-FR.js +17 -10
  39. package/dist/i18n/fr-FR.properties +5 -1
  40. package/dist/i18n/hi-IN.js +17 -10
  41. package/dist/i18n/hi-IN.properties +5 -1
  42. package/dist/i18n/it-IT.js +17 -10
  43. package/dist/i18n/it-IT.properties +5 -1
  44. package/dist/i18n/ja-JP.js +17 -10
  45. package/dist/i18n/ja-JP.properties +5 -1
  46. package/dist/i18n/json/src/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-autofill-button/messages.json +1 -1
  47. package/dist/i18n/json/src/lib/components/metadata-instance-list/subcomponents/metadata-instance-header/messages.json +1 -1
  48. package/dist/i18n/json/src/lib/messages.json +1 -1
  49. package/dist/i18n/ko-KR.js +17 -10
  50. package/dist/i18n/ko-KR.properties +5 -1
  51. package/dist/i18n/nb-NO.js +17 -10
  52. package/dist/i18n/nb-NO.properties +5 -1
  53. package/dist/i18n/nl-NL.js +17 -10
  54. package/dist/i18n/nl-NL.properties +5 -1
  55. package/dist/i18n/pl-PL.js +17 -10
  56. package/dist/i18n/pl-PL.properties +5 -1
  57. package/dist/i18n/pt-BR.js +17 -10
  58. package/dist/i18n/pt-BR.properties +5 -1
  59. package/dist/i18n/ru-RU.js +17 -10
  60. package/dist/i18n/ru-RU.properties +5 -1
  61. package/dist/i18n/sv-SE.js +17 -10
  62. package/dist/i18n/sv-SE.properties +5 -1
  63. package/dist/i18n/tr-TR.js +17 -10
  64. package/dist/i18n/tr-TR.properties +5 -1
  65. package/dist/i18n/zh-CN.js +17 -10
  66. package/dist/i18n/zh-CN.properties +5 -1
  67. package/dist/i18n/zh-TW.js +17 -10
  68. package/dist/i18n/zh-TW.properties +5 -1
  69. package/dist/styles/metadata-instance-form-autofill-button.css +1 -1
  70. package/dist/types/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/types.d.ts +2 -0
  71. package/dist/types/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-autofill-button/messages.d.ts +4 -4
  72. package/dist/types/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-autofill-button/metadata-instance-form-autofill-button.d.ts +1 -1
  73. package/dist/types/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-autofill-button/types.d.ts +7 -1
  74. package/dist/types/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-header/metadata-instance-form-header.d.ts +1 -1
  75. package/dist/types/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-header/types.d.ts +1 -0
  76. package/dist/types/lib/components/metadata-instance-list/metadata-instance-list.d.ts +1 -1
  77. package/dist/types/lib/components/metadata-instance-list/subcomponents/metadata-instance/metadata-instance.d.ts +1 -1
  78. package/dist/types/lib/components/metadata-instance-list/subcomponents/metadata-instance/types.d.ts +1 -0
  79. package/dist/types/lib/components/metadata-instance-list/subcomponents/metadata-instance-header/messages.d.ts +0 -15
  80. package/dist/types/lib/components/metadata-instance-list/subcomponents/metadata-instance-header/metadata-instance-header.d.ts +1 -1
  81. package/dist/types/lib/components/metadata-instance-list/subcomponents/metadata-instance-header/types.d.ts +1 -0
  82. package/dist/types/lib/components/metadata-instance-list/types.d.ts +1 -0
  83. package/dist/types/lib/constants.d.ts +12 -0
  84. package/dist/types/lib/messages.d.ts +22 -0
  85. package/dist/types/lib/types.d.ts +1 -0
  86. package/dist/types/lib/utils/utils.d.ts +3 -1
  87. package/package.json +4 -2
@@ -1,59 +1,61 @@
1
+ import { Card as E } from "@box/blueprint-web";
1
2
  import y from "clsx";
2
- import { Card as S } from "@box/blueprint-web";
3
- import { TEMPLATE_CUSTOM_PROPERTIES as w } from "../esm/lib/constants.js";
4
- import { MetadataInstanceFormFooter as A } from "../esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-footer/metadata-instance-form-footer.js";
5
- import { MetadataInstanceFormHeader as E } from "../esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-header/metadata-instance-form-header.js";
6
- import { jsx as t, jsxs as M } from "react/jsx-runtime";
7
- import '../styles/metadata-instance-form-card-wrapper.css';const b = "_metadataInstanceForm_1e6l2_1", v = "_wrapperGradient_1e6l2_7", D = "_suggestionsFetching_1e6l2_12", I = "_metadataInstanceFormContent_1e6l2_18", L = "_showOverlay_1e6l2_25", s = {
8
- metadataInstanceForm: b,
9
- wrapperGradient: v,
3
+ import { TEMPLATE_CUSTOM_PROPERTIES as S } from "../esm/lib/constants.js";
4
+ import { MetadataInstanceFormFooter as w } from "../esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-footer/metadata-instance-form-footer.js";
5
+ import { MetadataInstanceFormHeader as M } from "../esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-header/metadata-instance-form-header.js";
6
+ import { jsx as t, jsxs as b } from "react/jsx-runtime";
7
+ import '../styles/metadata-instance-form-card-wrapper.css';const v = "_metadataInstanceForm_1e6l2_1", x = "_wrapperGradient_1e6l2_7", D = "_suggestionsFetching_1e6l2_12", I = "_metadataInstanceFormContent_1e6l2_18", L = "_showOverlay_1e6l2_25", s = {
8
+ metadataInstanceForm: v,
9
+ wrapperGradient: x,
10
10
  suggestionsFetching: D,
11
11
  metadataInstanceFormContent: I,
12
12
  showOverlay: L
13
- }, j = (n) => {
13
+ }, B = (n) => {
14
14
  const {
15
15
  areAiSuggestionsAvailable: o,
16
16
  children: r,
17
17
  className: i,
18
18
  formRef: g,
19
- isAiSuggestionsFeatureEnabled: m,
20
- isBetaLanguageEnabled: l,
21
- isLargeFile: d = !1,
22
- isDeleteButtonDisabled: c,
23
- suggestions: F,
19
+ isAdvancedExtractAgentEnabled: m = !1,
20
+ isAiSuggestionsFeatureEnabled: l,
21
+ isBetaLanguageEnabled: d,
22
+ isLargeFile: c = !1,
23
+ isDeleteButtonDisabled: F,
24
+ suggestions: u,
24
25
  isFetchingSuggestions: e,
25
- isFormDirty: u = !1,
26
+ isFormDirty: _ = !1,
26
27
  selectedTemplateInstance: a,
27
- getAiSuggestions: _,
28
- handleCancel: p,
29
- handleDelete: h
30
- } = n, f = (a == null ? void 0 : a.templateKey) === w, C = !!F[a == null ? void 0 : a.templateKey];
28
+ getAiSuggestions: p,
29
+ handleCancel: h,
30
+ handleDelete: f
31
+ } = n, A = (a == null ? void 0 : a.templateKey) === S, C = !!u[a == null ? void 0 : a.templateKey];
31
32
  return /* @__PURE__ */ t("div", {
32
33
  className: e && s.wrapperGradient,
33
- children: /* @__PURE__ */ M(S, {
34
+ children: /* @__PURE__ */ b(E, {
34
35
  ref: g,
35
36
  className: y(i, {
36
37
  [s.suggestionsFetching]: e
37
38
  }),
38
- children: [/* @__PURE__ */ t(E, {
39
+ children: [/* @__PURE__ */ t(M, {
39
40
  areAiSuggestionsAvailable: o,
40
41
  hasSuggestions: C,
41
- isAiSuggestionsFeatureEnabled: m && !f,
42
- isBetaLanguageEnabled: l,
43
- isLargeFile: d,
42
+ isAdvancedExtractAgentEnabled: m,
43
+ isAiSuggestionsFeatureEnabled: l && !A,
44
+ isBetaLanguageEnabled: d,
45
+ isLargeFile: c,
44
46
  isLoading: e,
45
- onAutofill: _,
47
+ onAutofill: p,
46
48
  templateName: a == null ? void 0 : a.displayName
47
- }), a && r, /* @__PURE__ */ t(A, {
48
- isDeleteButtonDisabled: c,
49
+ }), a && r, /* @__PURE__ */ t(w, {
50
+ isDeleteButtonDisabled: F,
49
51
  isLoading: e,
50
- onCancel: () => p(u),
51
- onDelete: h
52
+ onCancel: () => h(_),
53
+ onDelete: f
52
54
  })]
53
55
  })
54
56
  });
55
57
  };
56
58
  export {
57
- j as M,
59
+ B as M,
58
60
  s
59
61
  };
@@ -1,5 +1,5 @@
1
- import "clsx";
2
1
  import "@box/blueprint-web";
2
+ import "clsx";
3
3
  import "../../../../constants.js";
4
4
  import "../metadata-instance-form-footer/metadata-instance-form-footer.js";
5
5
  import "../metadata-instance-form-header/metadata-instance-form-header.js";
@@ -1,128 +1,130 @@
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 q } 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 q from "clsx";
6
- import { Formik as z, Form as G } from "formik";
7
- import { useState as M, useEffect as c, useRef as H, useMemo as Q } from "react";
8
- import { TEMPLATE_CUSTOM_PROPERTIES as X } from "../../../../constants.js";
9
- import { useAutofill as Y } from "../../../../utils/autofill-context.js";
10
- import { TemplateInstance as Z } from "../../../metadata-editor-fields/metadata-editor-fields.js";
11
- import { MetadataEmptyState as I } from "../../../metadata-empty-state/metadata-empty-state.js";
12
- import { AutofillOverlay as T } from "../autofill-overlay/autofill-overlay.js";
13
- import { CustomInstance as oo } from "../custom-instance/custom-instance.js";
14
- import { c as ro } from "../../../../../../chunks/utils.js";
5
+ import z from "clsx";
6
+ import { Formik as G, Form as H } from "formik";
7
+ import { useState as c, useEffect as M, useRef as Q, useMemo as X } from "react";
8
+ import { TEMPLATE_CUSTOM_PROPERTIES as Y } from "../../../../constants.js";
9
+ import { useAutofill as Z } from "../../../../utils/autofill-context.js";
10
+ import { TemplateInstance as I } from "../../../metadata-editor-fields/metadata-editor-fields.js";
11
+ import { MetadataEmptyState as T } from "../../../metadata-empty-state/metadata-empty-state.js";
12
+ import { AutofillOverlay as oo } from "../autofill-overlay/autofill-overlay.js";
13
+ import { CustomInstance as ro } from "../custom-instance/custom-instance.js";
14
+ import { c as to } from "../../../../../../chunks/utils.js";
15
15
  import { s as m, M as io } from "../../../../../../chunks/metadata-instance-form-card-wrapper.js";
16
- import { jsx as i, jsxs as F } from "react/jsx-runtime";
17
- import { UnsavedChangesModal as to } from "../../../unsaved-changes-modal/unsaved-changes-modal.js";
18
- const yo = (b) => {
16
+ import { jsx as t, jsxs as F } from "react/jsx-runtime";
17
+ import { UnsavedChangesModal as ao } from "../../../unsaved-changes-modal/unsaved-changes-modal.js";
18
+ const So = (b) => {
19
19
  const {
20
20
  areAiSuggestionsAvailable: y,
21
21
  customRef: a,
22
22
  isLargeFile: S,
23
23
  errorCode: n,
24
24
  isAiSuggestionsFeatureEnabled: s,
25
- isBetaLanguageEnabled: D,
25
+ isAdvancedExtractAgentEnabled: D = !1,
26
+ isBetaLanguageEnabled: v,
26
27
  isDeleteButtonDisabled: O,
27
- isDeleteConfirmationModalCheckboxEnabled: v,
28
+ isDeleteConfirmationModalCheckboxEnabled: x,
28
29
  isMultilevelTaxonomyFieldEnabled: l,
29
- isUnsavedChangesModalOpen: x = !1,
30
- MetadataInstanceFormCustomWrapper: A,
30
+ isUnsavedChangesModalOpen: A = !1,
31
+ MetadataInstanceFormCustomWrapper: L,
31
32
  selectedTemplateInstance: o,
32
- onCancel: L,
33
- onDelete: N,
34
- onDiscardUnsavedChanges: P,
35
- onSubmit: R,
33
+ onCancel: N,
34
+ onDelete: P,
35
+ onDiscardUnsavedChanges: R,
36
+ onSubmit: U,
36
37
  setIsUnsavedChangesModalOpen: f,
37
38
  taxonomyOptionsFetcher: u
38
- } = b, U = A ?? io, [k, d] = M(!1), {
39
- isFetchingSuggestions: t,
39
+ } = b, k = L ?? io, [B, d] = c(!1), {
40
+ isFetchingSuggestions: i,
40
41
  isLongLoading: g,
41
- getAiSuggestions: B,
42
+ getAiSuggestions: w,
42
43
  clearState: p,
43
- suggestions: w
44
- } = Y();
45
- c(() => () => {
44
+ suggestions: K
45
+ } = Z();
46
+ M(() => () => {
46
47
  p();
47
48
  }, [p, o == null ? void 0 : o.id]);
48
- const h = (o == null ? void 0 : o.templateKey) === X, K = async (r) => {
49
- await R(r, ro(r, o));
50
- }, W = (r) => {
51
- r ? f(!0) : L();
52
- }, j = () => {
49
+ const h = (o == null ? void 0 : o.templateKey) === Y, W = async (r) => {
50
+ await U(r, to(r, o));
51
+ }, j = (r) => {
52
+ r ? f(!0) : N();
53
+ }, V = () => {
53
54
  d(!0);
54
- }, V = {
55
+ }, _ = {
55
56
  metadata: {
56
57
  ...o
57
58
  }
58
- }, C = H(null), [E, _] = M(null);
59
- c(() => {
60
- _(a ?? C.current);
59
+ }, C = Q(null), [E, $] = c(null);
60
+ M(() => {
61
+ $(a ?? C.current);
61
62
  }, [a, o == null ? void 0 : o.templateKey, o == null ? void 0 : o.scope]);
62
- const $ = Q(() => {
63
+ const J = X(() => {
63
64
  const r = (o == null ? void 0 : o.fields.length) === 0;
64
65
  if (h)
65
- return /* @__PURE__ */ i(oo, {
66
- isLoading: t
66
+ return /* @__PURE__ */ t(ro, {
67
+ isLoading: i
67
68
  });
68
69
  if (r)
69
- return /* @__PURE__ */ i(I, {
70
+ return /* @__PURE__ */ t(T, {
70
71
  isBoxAiSuggestionsFeatureEnabled: s,
71
72
  level: "instance"
72
73
  });
73
- const e = !!(t || n);
74
+ const e = !!(i || n);
74
75
  return /* @__PURE__ */ F("div", {
75
- className: q(m.metadataInstanceFormContent, e && m.showOverlay),
76
- children: [/* @__PURE__ */ i(T, {
76
+ className: z(m.metadataInstanceFormContent, e && m.showOverlay),
77
+ children: [/* @__PURE__ */ t(oo, {
77
78
  errorCode: n,
78
- isFetchingSuggestions: t,
79
+ isFetchingSuggestions: i,
79
80
  isLongLoading: g
80
- }), /* @__PURE__ */ i(Z, {
81
- disableForm: t,
81
+ }), /* @__PURE__ */ t(I, {
82
+ disableForm: i,
82
83
  isMultilevelTaxonomyFieldEnabled: l,
83
84
  portalElement: a ?? E,
84
85
  taxonomyOptionsFetcher: u
85
86
  })]
86
87
  });
87
- }, [o == null ? void 0 : o.fields.length, h, t, g, a, E, u, s, l, n]);
88
- return /* @__PURE__ */ i(z, {
89
- initialValues: V,
90
- onSubmit: K,
88
+ }, [o == null ? void 0 : o.fields.length, h, i, g, a, E, u, s, l, n]);
89
+ return /* @__PURE__ */ t(G, {
90
+ initialValues: _,
91
+ onSubmit: W,
91
92
  children: ({
92
93
  values: r,
93
94
  dirty: e
94
- }) => /* @__PURE__ */ F(G, {
95
- children: [/* @__PURE__ */ i(U, {
95
+ }) => /* @__PURE__ */ F(H, {
96
+ children: [/* @__PURE__ */ t(k, {
96
97
  areAiSuggestionsAvailable: y,
97
98
  className: m.metadataInstanceForm,
98
99
  formRef: C,
99
100
  formValues: r,
100
- getAiSuggestions: B,
101
- handleCancel: W,
102
- handleDelete: j,
101
+ getAiSuggestions: w,
102
+ handleCancel: j,
103
+ handleDelete: V,
104
+ isAdvancedExtractAgentEnabled: D,
103
105
  isAiSuggestionsFeatureEnabled: s,
104
- isBetaLanguageEnabled: D,
106
+ isBetaLanguageEnabled: v,
105
107
  isDeleteButtonDisabled: O,
106
- isFetchingSuggestions: t,
108
+ isFetchingSuggestions: i,
107
109
  isFormDirty: e,
108
110
  isLargeFile: S,
109
111
  selectedTemplateInstance: o,
110
- suggestions: w,
111
- children: o && $
112
- }), /* @__PURE__ */ i(to, {
112
+ suggestions: K,
113
+ children: o && J
114
+ }), /* @__PURE__ */ t(ao, {
113
115
  onBackToEdit: () => f(!1),
114
- onDiscardChanges: P,
115
- open: x
116
- }), /* @__PURE__ */ i(J, {
117
- isCheckboxEnabled: v,
118
- onConfirm: () => N(o),
116
+ onDiscardChanges: R,
117
+ open: A
118
+ }), /* @__PURE__ */ t(q, {
119
+ isCheckboxEnabled: x,
120
+ onConfirm: () => P(o),
119
121
  onDismiss: () => d(!1),
120
- open: k,
122
+ open: B,
121
123
  templateName: o == null ? void 0 : o.displayName
122
124
  })]
123
125
  })
124
126
  }, `${o == null ? void 0 : o.scope}.${o == null ? void 0 : o.templateKey}`);
125
127
  };
126
128
  export {
127
- yo as MetadataInstanceForm
129
+ So as MetadataInstanceForm
128
130
  };
@@ -1,24 +1,24 @@
1
- import { defineMessages as t } from "react-intl";
2
- const e = t({
1
+ import { defineMessages as a } from "react-intl";
2
+ const e = a({
3
3
  autofillButton: {
4
4
  id: "metadataEditor.metadataInstanceEditor.metadataInstanceFormHeader.autofillButton",
5
5
  defaultMessage: "Autofill"
6
6
  },
7
- autofillButtonAriaLabel: {
8
- id: "metadataEditor.metadataInstanceEditor.metadataInstanceFormHeader.autofillButtonAriaLabel",
9
- defaultMessage: "Autofill with Box AI"
10
- },
11
- autofillButtonTooltip: {
12
- id: "metadataEditor.metadataInstanceEditor.metadataInstanceFormHeader.autofillButtonTooltip",
13
- defaultMessage: "Autofill with Box AI (Beta)"
14
- },
15
- autofillButtonTooltipGA: {
16
- id: "metadataEditor.metadataInstanceEditor.metadataInstanceFormHeader.autofillButtonTooltipGA",
17
- defaultMessage: "Autofill with Box AI"
18
- },
19
7
  loadingButtonAriaLabel: {
20
8
  id: "metadataEditor.metadataInstanceEditor.metadataInstanceFormHeader.loadingButtonAriaLabel",
21
9
  defaultMessage: "Loading..."
10
+ },
11
+ standardExtractAgent: {
12
+ id: "metadataEditor.metadataInstanceEditor.metadataInstanceFormHeader.standardExtractAgent",
13
+ defaultMessage: "Standard"
14
+ },
15
+ enhancedExtractAgent: {
16
+ id: "metadataEditor.metadataInstanceEditor.metadataInstanceFormHeader.enhancedExtractAgent",
17
+ defaultMessage: "Enhanced"
18
+ },
19
+ autofillDropdownTriggerAriaLabel: {
20
+ id: "metadataEditor.metadataInstanceEditor.metadataInstanceFormHeader.autofillDropdownTriggerAriaLabel",
21
+ defaultMessage: "See agent options."
22
22
  }
23
23
  });
24
24
  export {
@@ -1,66 +1,110 @@
1
- import { LoadingIndicator as k, IconButton as v, Tooltip as x, Button as K } from "@box/blueprint-web";
2
- import { BoxAiLogo as p } from "@box/blueprint-web-assets/icons/Logo";
3
- import { useFormikContext as L, getIn as i } from "formik";
4
- import { useEffect as h } from "react";
5
- import { useIntl as C } from "react-intl";
6
- import { useAutofill as F } from "../../../../utils/autofill-context.js";
7
- import n from "./messages.js";
8
- import { jsx as l } from "react/jsx-runtime";
9
- import '../../../../../../styles/metadata-instance-form-autofill-button.css';const T = "_loadingIndicator_baqvi_1", _ = {
10
- loadingIndicator: T
11
- }, w = ({
12
- areAiSuggestionsAvailable: B,
13
- isBetaLanguageEnabled: b,
14
- isLoading: c,
15
- variant: I = "secondary-button",
16
- onAutofill: y
1
+ import { Tooltip as T, Button as K, LoadingIndicator as x, IconButton as E, SplitButton as G, DropdownMenu as C, Text as N } from "@box/blueprint-web";
2
+ import { BoxAiLogo as c } from "@box/blueprint-web-assets/icons/Logo";
3
+ import { useLocalStorageAIAgents as R } from "@box/box-ai-agent-selector";
4
+ import { useFormikContext as j, getIn as s } from "formik";
5
+ import { useEffect as v, useMemo as w, forwardRef as F } from "react";
6
+ import { useIntl as L } from "react-intl";
7
+ import { EXTRACT_AI_AGENT_LOCAL_STORAGE_KEY as O, EXTRACT_AGENTS_MAP as D } from "../../../../constants.js";
8
+ import { autofillMessages as X } from "../../../../messages.js";
9
+ import { useAutofill as P } from "../../../../utils/autofill-context.js";
10
+ import { getTooltipContent as V } from "../../../../utils/utils.js";
11
+ import m from "./messages.js";
12
+ import { jsx as t, jsxs as Y } from "react/jsx-runtime";
13
+ import '../../../../../../styles/metadata-instance-form-autofill-button.css';const q = "_loadingIndicator_mk0hd_1", z = "_actionMenuItem_mk0hd_11", S = {
14
+ loadingIndicator: q,
15
+ actionMenuItem: z
16
+ }, H = /* @__PURE__ */ F(({
17
+ isButtonDisabled: u,
18
+ onAutofill: B,
19
+ onAgentChange: r,
20
+ ...d
21
+ }, e) => {
22
+ const l = L();
23
+ return /* @__PURE__ */ t(G, {
24
+ ...d,
25
+ ref: e,
26
+ disabled: u,
27
+ dropdownTriggerAriaLabel: "See agent options.",
28
+ icon: c,
29
+ label: l.formatMessage(m.autofillButton),
30
+ onClick: B,
31
+ variant: "secondary",
32
+ children: /* @__PURE__ */ t(C.Group, {
33
+ children: Object.entries(D).map(([f, o]) => /* @__PURE__ */ t(C.Item, {
34
+ onClick: () => r(o.agentType),
35
+ children: /* @__PURE__ */ Y("div", {
36
+ className: S.actionMenuItem,
37
+ children: [/* @__PURE__ */ t(c, {
38
+ "aria-hidden": !0
39
+ }), /* @__PURE__ */ t(N, {
40
+ as: "span",
41
+ children: l.formatMessage(m[o.displayMsg])
42
+ })]
43
+ })
44
+ }, f))
45
+ })
46
+ });
47
+ }), rt = ({
48
+ areAiSuggestionsAvailable: u,
49
+ isBetaLanguageEnabled: B,
50
+ isLoading: r,
51
+ variant: d = "secondary-button",
52
+ isAdvancedExtractAgentEnabled: e = !1,
53
+ onAutofill: l
17
54
  }) => {
18
55
  const {
19
- isSubmitting: A,
20
- values: e,
21
- setFieldValue: m
22
- } = L(), t = C(), {
23
- suggestions: o
24
- } = F();
25
- h(() => {
26
- if (o) {
27
- const a = i(e, "metadata.fields"), r = i(e, "metadata.templateKey");
28
- m("metadata.fields", a == null ? void 0 : a.map((s) => {
29
- var g;
30
- const f = (g = o == null ? void 0 : o[r]) == null ? void 0 : g[s.key];
31
- return f ? {
32
- ...s,
33
- aiSuggestion: f
34
- } : s;
56
+ isSubmitting: f,
57
+ values: o,
58
+ setFieldValue: M
59
+ } = j(), n = L(), [b, k] = R(O), {
60
+ suggestions: a
61
+ } = P();
62
+ v(() => {
63
+ if (a) {
64
+ const i = s(o, "metadata.fields"), A = s(o, "metadata.templateKey");
65
+ M("metadata.fields", i == null ? void 0 : i.map((I) => {
66
+ var y;
67
+ const _ = (y = a == null ? void 0 : a[A]) == null ? void 0 : y[I.key];
68
+ return _ ? {
69
+ ...I,
70
+ aiSuggestion: _
71
+ } : I;
35
72
  }));
36
73
  }
37
- }, [o, m]);
38
- const u = () => {
39
- const a = i(e, "metadata.templateKey"), r = i(e, "metadata.scope");
40
- y(a, r);
41
- }, d = !B || A || c, M = c ? /* @__PURE__ */ l(k, {
42
- "aria-label": t.formatMessage(n.loadingButtonAriaLabel),
43
- className: _.loadingIndicator
44
- }) : /* @__PURE__ */ l(v, {
45
- "aria-label": t.formatMessage(n.autofillButtonAriaLabel),
46
- disabled: d,
47
- icon: p,
48
- onClick: u,
49
- variant: "icon-logo",
50
- "data-target-id": "IconButton-autofillButtonAriaLabel"
51
- });
52
- return /* @__PURE__ */ l(x, {
53
- content: b ? t.formatMessage(n.autofillButtonTooltip) : t.formatMessage(n.autofillButtonTooltipGA),
54
- children: I === "secondary-button" ? /* @__PURE__ */ l(K, {
55
- disabled: d,
56
- icon: p,
57
- onClick: u,
74
+ }, [a, M]);
75
+ const p = () => {
76
+ const i = s(o, "metadata.templateKey"), A = s(o, "metadata.scope");
77
+ l(i, A);
78
+ }, g = !u || f || r, h = w(() => V(e, b, n), [e, b, n]);
79
+ return d === "secondary-button" ? /* @__PURE__ */ t(T, {
80
+ content: h,
81
+ children: e ? /* @__PURE__ */ t(H, {
82
+ isButtonDisabled: g,
83
+ onAgentChange: k,
84
+ onAutofill: p
85
+ }) : /* @__PURE__ */ t(K, {
86
+ disabled: g,
87
+ icon: c,
88
+ onClick: p,
58
89
  variant: "secondary",
59
90
  "data-target-id": "Button-autofillButton",
60
- children: t.formatMessage(n.autofillButton)
61
- }) : M
91
+ children: n.formatMessage(m.autofillButton)
92
+ })
93
+ }) : /* @__PURE__ */ t(T, {
94
+ content: h,
95
+ children: r ? /* @__PURE__ */ t(x, {
96
+ "aria-label": n.formatMessage(m.loadingButtonAriaLabel),
97
+ className: S.loadingIndicator
98
+ }) : /* @__PURE__ */ t(E, {
99
+ "aria-label": n.formatMessage(X.autofillButtonAriaLabel),
100
+ disabled: g,
101
+ icon: c,
102
+ onClick: p,
103
+ variant: "icon-logo",
104
+ "data-target-id": "IconButton-autofillButtonAriaLabel"
105
+ })
62
106
  });
63
107
  };
64
108
  export {
65
- w as MetadataInstanceFormAutofillButton
109
+ rt as MetadataInstanceFormAutofillButton
66
110
  };
@@ -1,41 +1,43 @@
1
- import { useIntl as F } from "react-intl";
2
- import p from "../../../interactive-header-text/interactive-header-text.js";
3
- import { MetadataInstanceFormAutofillButton as H } from "../metadata-instance-form-autofill-button/metadata-instance-form-autofill-button.js";
4
- import _ from "./messages.js";
1
+ import { useIntl as p } from "react-intl";
2
+ import H from "../../../interactive-header-text/interactive-header-text.js";
3
+ import { MetadataInstanceFormAutofillButton as _ } from "../metadata-instance-form-autofill-button/metadata-instance-form-autofill-button.js";
5
4
  import { MetadataInstanceFormInlineNotice as h } from "../metadata-instance-form-inline-notice/metadata-instance-form-inline-notice.js";
6
- import { jsxs as o, Fragment as u, jsx as t } from "react/jsx-runtime";
7
- import '../../../../../../styles/metadata-instance-form-header.css';const x = "_metadataInstanceFormHeader_1hzt2_1", M = "_title_1hzt2_9", n = {
8
- metadataInstanceFormHeader: x,
9
- title: M
10
- }, y = ({
5
+ import u from "./messages.js";
6
+ import { jsxs as o, Fragment as x, jsx as t } from "react/jsx-runtime";
7
+ import '../../../../../../styles/metadata-instance-form-header.css';const M = "_metadataInstanceFormHeader_1hzt2_1", N = "_title_1hzt2_9", n = {
8
+ metadataInstanceFormHeader: M,
9
+ title: N
10
+ }, k = ({
11
11
  areAiSuggestionsAvailable: e,
12
12
  hasSuggestions: r,
13
- isAiSuggestionsFeatureEnabled: m,
13
+ isAdvancedExtractAgentEnabled: m = !1,
14
+ isAiSuggestionsFeatureEnabled: s,
14
15
  isBetaLanguageEnabled: a,
15
- isLargeFile: s,
16
- isLoading: c,
17
- templateName: i,
16
+ isLargeFile: c,
17
+ isLoading: i,
18
+ templateName: l,
18
19
  onAutofill: d
19
20
  }) => {
20
- const l = F(), I = i ?? l.formatMessage(_.customInstanceTitle), f = r && e;
21
- return /* @__PURE__ */ o(u, {
21
+ const I = p(), f = l ?? I.formatMessage(u.customInstanceTitle), F = r && e;
22
+ return /* @__PURE__ */ o(x, {
22
23
  children: [/* @__PURE__ */ o("div", {
23
24
  className: n.metadataInstanceFormHeader,
24
- children: [/* @__PURE__ */ t(p, {
25
+ children: [/* @__PURE__ */ t(H, {
25
26
  className: n.title,
26
- title: I
27
- }), m ? /* @__PURE__ */ t(H, {
27
+ title: f
28
+ }), s ? /* @__PURE__ */ t(_, {
28
29
  areAiSuggestionsAvailable: e,
30
+ isAdvancedExtractAgentEnabled: m,
29
31
  isBetaLanguageEnabled: a,
30
- isLoading: c,
32
+ isLoading: i,
31
33
  onAutofill: d
32
34
  }) : null]
33
- }), f && /* @__PURE__ */ t(h, {
35
+ }), F && /* @__PURE__ */ t(h, {
34
36
  isBetaLanguageEnabled: a,
35
- isLargeFile: s
37
+ isLargeFile: c
36
38
  })]
37
39
  });
38
40
  };
39
41
  export {
40
- y as MetadataInstanceFormHeader
42
+ k as MetadataInstanceFormHeader
41
43
  };
@@ -1,20 +1,22 @@
1
- import { MetadataInstance as r } from "./subcomponents/metadata-instance/metadata-instance.js";
2
1
  import { getVisibleTemplates as c } from "../../utils/utils.js";
2
+ import { MetadataInstance as d } from "./subcomponents/metadata-instance/metadata-instance.js";
3
3
  import { jsx as a } from "react/jsx-runtime";
4
4
  import "./subcomponents/metadata-instance-header/metadata-instance-header.js";
5
- import '../../../../styles/metadata-instance-list.css';const d = "_metadataInstanceList_bd83w_1", p = {
6
- metadataInstanceList: d
7
- }, _ = ({
5
+ import '../../../../styles/metadata-instance-list.css';const p = "_metadataInstanceList_bd83w_1", l = {
6
+ metadataInstanceList: p
7
+ }, b = ({
8
8
  areAiSuggestionsAvailable: s,
9
9
  isAiSuggestionsFeatureEnabled: e,
10
10
  isBetaLanguageEnabled: n,
11
11
  onEdit: i,
12
12
  templateInstances: m,
13
- taxonomyNodeFetcher: o
13
+ taxonomyNodeFetcher: o,
14
+ isAdvancedExtractAgentEnabled: r = !1
14
15
  }) => /* @__PURE__ */ a("div", {
15
- className: p.metadataInstanceList,
16
- children: c(m).map((t) => /* @__PURE__ */ a(r, {
16
+ className: l.metadataInstanceList,
17
+ children: c(m).map((t) => /* @__PURE__ */ a(d, {
17
18
  areAiSuggestionsAvailable: s,
19
+ isAdvancedExtractAgentEnabled: r,
18
20
  isAiSuggestionsFeatureEnabled: e,
19
21
  isBetaLanguageEnabled: n,
20
22
  onEdit: i,
@@ -23,5 +25,5 @@ import '../../../../styles/metadata-instance-list.css';const d = "_metadataInsta
23
25
  }, t.id))
24
26
  });
25
27
  export {
26
- _ as MetadataInstanceList
28
+ b as MetadataInstanceList
27
29
  };