@box/metadata-editor 0.111.4 → 0.112.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.
@@ -1,110 +1,122 @@
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,
1
+ import { Tooltip as S, Button as G, LoadingIndicator as k, IconButton as x, SplitButton as R, DropdownMenu as b, Text as v } from "@box/blueprint-web";
2
+ import { BoxAiLogo as L } from "@box/blueprint-web-assets/icons/Logo";
3
+ import { BoxAiColor as K } from "@box/blueprint-web-assets/icons/Medium";
4
+ import { useLocalStorageAIAgents as D } from "@box/box-ai-agent-selector";
5
+ import { useFormikContext as O, getIn as d } from "formik";
6
+ import { useEffect as P, useMemo as Y, forwardRef as j, useState as w } from "react";
7
+ import { useIntl as E } from "react-intl";
8
+ import { EXTRACT_AI_AGENT_LOCAL_STORAGE_KEY as F, EXTRACT_AGENTS_MAP as N } from "../../../../constants.js";
9
+ import { autofillMessages as V } from "../../../../messages.js";
10
+ import { useAutofill as X } from "../../../../utils/autofill-context.js";
11
+ import { getTooltipContent as q } from "../../../../utils/utils.js";
12
+ import f from "./messages.js";
13
+ import { jsx as t, jsxs as z } from "react/jsx-runtime";
14
+ import '../../../../../../styles/metadata-instance-form-autofill-button.css';const H = "_loadingIndicator_i1hyy_1", J = "_actionMenuItem_i1hyy_11", Q = "_splitButtonIcon_i1hyy_17", T = {
15
+ loadingIndicator: H,
16
+ actionMenuItem: J,
17
+ splitButtonIcon: Q
18
+ }, U = /* @__PURE__ */ j(({
19
+ isButtonDisabled: p,
20
+ onAutofill: h,
21
+ onAgentChange: c,
22
+ storedAgent: g,
23
+ ...n
24
+ }, I) => {
25
+ const u = E(), [a, m] = w(g);
26
+ return /* @__PURE__ */ t(R, {
27
+ ...n,
28
+ ref: I,
29
+ disabled: p,
27
30
  dropdownTriggerAriaLabel: "See agent options.",
28
- icon: c,
29
- label: l.formatMessage(m.autofillButton),
30
- onClick: B,
31
+ icon: L,
32
+ label: u.formatMessage(f.autofillButton),
33
+ onClick: h,
31
34
  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))
35
+ children: /* @__PURE__ */ t(b.RadioGroup, {
36
+ onValueChange: (o) => m(o),
37
+ value: a,
38
+ children: Object.entries(N).map(([o, e]) => {
39
+ const A = e.ICON;
40
+ return /* @__PURE__ */ t(b.RadioSelectItem, {
41
+ onClick: () => c(e.AGENT_TYPE),
42
+ value: e.AGENT_TYPE,
43
+ children: /* @__PURE__ */ z("div", {
44
+ className: T.actionMenuItem,
45
+ children: [/* @__PURE__ */ t(A, {
46
+ "aria-hidden": !0,
47
+ className: T.splitButtonIcon
48
+ }), /* @__PURE__ */ t(v, {
49
+ as: "span",
50
+ children: u.formatMessage(f[e.DISPLAY_MSG])
51
+ })]
52
+ })
53
+ }, o);
54
+ })
45
55
  })
46
56
  });
47
- }), rt = ({
48
- areAiSuggestionsAvailable: u,
49
- isBetaLanguageEnabled: B,
50
- isLoading: r,
51
- variant: d = "secondary-button",
52
- isAdvancedExtractAgentEnabled: e = !1,
53
- onAutofill: l
57
+ }), ut = ({
58
+ areAiSuggestionsAvailable: p,
59
+ isBetaLanguageEnabled: h,
60
+ isLoading: c,
61
+ variant: g = "secondary-button",
62
+ isAdvancedExtractAgentEnabled: n = !1,
63
+ onAutofill: I
54
64
  }) => {
55
65
  const {
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;
66
+ isSubmitting: u,
67
+ values: a,
68
+ setFieldValue: m
69
+ } = O(), o = E(), [e, A] = D(F), {
70
+ suggestions: i
71
+ } = X();
72
+ P(() => {
73
+ if (i) {
74
+ const r = d(a, "metadata.fields"), y = d(a, "metadata.templateKey");
75
+ m("metadata.fields", r == null ? void 0 : r.map((l) => {
76
+ var M;
77
+ const s = (M = i == null ? void 0 : i[y]) == null ? void 0 : M[l.key];
78
+ return s ? {
79
+ ...l,
80
+ aiSuggestion: s
81
+ } : l;
72
82
  }));
73
83
  }
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,
84
+ }, [i, m]);
85
+ const B = () => {
86
+ var s;
87
+ const r = d(a, "metadata.templateKey"), y = d(a, "metadata.scope"), l = n && ((s = N[e]) == null ? void 0 : s.AGENT_ID);
88
+ I(r, y, l || void 0);
89
+ }, _ = !p || u || c, C = Y(() => q(n, e, o), [n, e, o]);
90
+ return g === "secondary-button" ? /* @__PURE__ */ t(S, {
91
+ content: C,
92
+ children: n ? /* @__PURE__ */ t(U, {
93
+ isButtonDisabled: _,
94
+ onAgentChange: A,
95
+ onAutofill: B,
96
+ storedAgent: e
97
+ }) : /* @__PURE__ */ t(G, {
98
+ disabled: _,
99
+ icon: L,
100
+ onClick: B,
89
101
  variant: "secondary",
90
102
  "data-target-id": "Button-autofillButton",
91
- children: n.formatMessage(m.autofillButton)
103
+ children: o.formatMessage(f.autofillButton)
92
104
  })
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,
105
+ }) : /* @__PURE__ */ t(S, {
106
+ content: C,
107
+ children: c ? /* @__PURE__ */ t(k, {
108
+ "aria-label": o.formatMessage(f.loadingButtonAriaLabel),
109
+ className: T.loadingIndicator
110
+ }) : /* @__PURE__ */ t(x, {
111
+ "aria-label": o.formatMessage(V.autofillButtonAriaLabel),
112
+ disabled: _,
113
+ icon: K,
114
+ onClick: B,
103
115
  variant: "icon-logo",
104
116
  "data-target-id": "IconButton-autofillButtonAriaLabel"
105
117
  })
106
118
  });
107
119
  };
108
120
  export {
109
- rt as MetadataInstanceFormAutofillButton
121
+ ut as MetadataInstanceFormAutofillButton
110
122
  };
@@ -18,10 +18,10 @@ import '../../../../../../styles/metadata-instance.css';const x = "_topDivider_t
18
18
  taxonomyNodeFetcher: h,
19
19
  isAdvancedExtractAgentEnabled: v = !1
20
20
  }) => {
21
- const e = o.fields, m = (s) => !s.value || Array.isArray(s.value) && s.value.length === 0, E = e.every(m), f = e.some(m), V = e.length > 0, [i, r] = b(!0), {
21
+ const i = o.fields, m = (e) => !e.value || Array.isArray(e.value) && e.value.length === 0, E = i.every(m), f = i.some(m), V = i.length > 0, [r, s] = b(!0), {
22
22
  getAiSuggestions: A
23
- } = g(), D = () => {
24
- l(o), A(o.templateKey, o.scope);
23
+ } = g(), D = (e) => {
24
+ l(o), A(o.templateKey, o.scope, e);
25
25
  };
26
26
  return /* @__PURE__ */ a(S, {
27
27
  children: [/* @__PURE__ */ t(N, {
@@ -35,23 +35,23 @@ import '../../../../../../styles/metadata-instance.css';const x = "_topDivider_t
35
35
  templateName: o == null ? void 0 : o.displayName
36
36
  }), /* @__PURE__ */ t(u, {
37
37
  className: y.topDivider
38
- }), i && E ? /* @__PURE__ */ t(H, {
38
+ }), r && E ? /* @__PURE__ */ t(H, {
39
39
  isAnyEmptyValueHidden: V,
40
40
  isBoxAiSuggestionsFeatureEnabled: d,
41
41
  level: "instance",
42
- onShowEmptyValues: () => r(!1)
42
+ onShowEmptyValues: () => s(!1)
43
43
  }) : /* @__PURE__ */ a(n, {
44
44
  children: [/* @__PURE__ */ t(_, {
45
- shouldHideEmptyValues: i,
45
+ shouldHideEmptyValues: r,
46
46
  taxonomyNodeFetcher: h,
47
47
  templateInstance: o
48
48
  }), f && /* @__PURE__ */ a(n, {
49
49
  children: [/* @__PURE__ */ t(u, {
50
50
  className: y.bottomDivider
51
51
  }), /* @__PURE__ */ t(M, {
52
- isAnyEmptyValueHidden: i,
53
- onHideEmptyValues: () => r(!0),
54
- onShowEmptyValues: () => r(!1)
52
+ isAnyEmptyValueHidden: r,
53
+ onHideEmptyValues: () => s(!0),
54
+ onShowEmptyValues: () => s(!1)
55
55
  })]
56
56
  })]
57
57
  })]
@@ -1,57 +1,58 @@
1
- import { Tooltip as r, IconButton as l } from "@box/blueprint-web";
2
- import { Pencil as I } from "@box/blueprint-web-assets/icons/Line";
3
- import { BoxAiLogo as A } from "@box/blueprint-web-assets/icons/Logo";
4
- import { useLocalStorageAIAgents as T } from "@box/box-ai-agent-selector";
5
- import { useMemo as b } from "react";
6
- import { useIntl as C } from "react-intl";
7
- import { EXTRACT_AI_AGENT_LOCAL_STORAGE_KEY as L } from "../../../../constants.js";
8
- import { autofillMessages as h } from "../../../../messages.js";
9
- import { getTooltipContent as M } from "../../../../utils/utils.js";
10
- import H from "../../../interactive-header-text/interactive-header-text.js";
11
- import a from "./messages.js";
12
- import { jsxs as c, jsx as o } from "react/jsx-runtime";
13
- import '../../../../../../styles/metadata-instance-header.css';const x = "_metadataInstanceHeader_17bsu_1", v = "_iconButtonsContainer_17bsu_6", E = "_title_17bsu_14", n = {
14
- metadataInstanceHeader: x,
15
- iconButtonsContainer: v,
16
- title: E
17
- }, Y = ({
18
- areAiSuggestionsAvailable: m,
1
+ import { Tooltip as l, IconButton as c } from "@box/blueprint-web";
2
+ import { Pencil as A } from "@box/blueprint-web-assets/icons/Line";
3
+ import { BoxAiColor as C } from "@box/blueprint-web-assets/icons/Medium";
4
+ import { useLocalStorageAIAgents as b } from "@box/box-ai-agent-selector";
5
+ import { useMemo as L } from "react";
6
+ import { useIntl as M } from "react-intl";
7
+ import { EXTRACT_AI_AGENT_LOCAL_STORAGE_KEY as h, EXTRACT_AGENTS_MAP as H } from "../../../../constants.js";
8
+ import { autofillMessages as N } from "../../../../messages.js";
9
+ import { getTooltipContent as E } from "../../../../utils/utils.js";
10
+ import G from "../../../interactive-header-text/interactive-header-text.js";
11
+ import i from "./messages.js";
12
+ import { jsxs as m, jsx as o } from "react/jsx-runtime";
13
+ import '../../../../../../styles/metadata-instance-header.css';const v = "_metadataInstanceHeader_17bsu_1", x = "_iconButtonsContainer_17bsu_6", R = "_title_17bsu_14", s = {
14
+ metadataInstanceHeader: v,
15
+ iconButtonsContainer: x,
16
+ title: R
17
+ }, z = ({
18
+ areAiSuggestionsAvailable: u,
19
19
  canEdit: d,
20
- isAiSuggestionsFeatureEnabled: u,
21
- isBetaLanguageEnabled: N,
22
- onEdit: f,
20
+ isAiSuggestionsFeatureEnabled: f,
21
+ isBetaLanguageEnabled: S,
22
+ onEdit: _,
23
23
  onAutofill: p,
24
24
  templateName: e,
25
- isAdvancedExtractAgentEnabled: i = !1
25
+ isAdvancedExtractAgentEnabled: a = !1
26
26
  }) => {
27
- const t = C(), g = e || t.formatMessage(a.customInstanceTitle), B = u && e, [s] = T(L), _ = b(() => M(i, s, t), [i, s, t]);
28
- return /* @__PURE__ */ c("div", {
29
- className: n.metadataInstanceHeader,
30
- children: [/* @__PURE__ */ o(H, {
31
- className: n.title,
32
- title: g
33
- }), d && /* @__PURE__ */ c("div", {
34
- className: n.iconButtonsContainer,
35
- children: [B && /* @__PURE__ */ o(r, {
36
- content: _,
37
- children: /* @__PURE__ */ o(l, {
38
- "aria-label": t.formatMessage(h.autofillButtonAriaLabelWithTemplateName, {
27
+ var r;
28
+ const t = M(), B = e || t.formatMessage(i.customInstanceTitle), I = f && e, [n] = b(h), T = a && ((r = H[n]) == null ? void 0 : r.AGENT_ID), g = L(() => E(a, n, t), [a, n, t]);
29
+ return /* @__PURE__ */ m("div", {
30
+ className: s.metadataInstanceHeader,
31
+ children: [/* @__PURE__ */ o(G, {
32
+ className: s.title,
33
+ title: B
34
+ }), d && /* @__PURE__ */ m("div", {
35
+ className: s.iconButtonsContainer,
36
+ children: [I && /* @__PURE__ */ o(l, {
37
+ content: g,
38
+ children: /* @__PURE__ */ o(c, {
39
+ "aria-label": t.formatMessage(N.autofillButtonAriaLabelWithTemplateName, {
39
40
  templateName: e
40
41
  }),
41
- disabled: !m,
42
- icon: A,
43
- onClick: p,
42
+ disabled: !u,
43
+ icon: C,
44
+ onClick: () => p(T || void 0),
44
45
  variant: "icon-logo",
45
46
  "data-target-id": "IconButton-autofillButtonAriaLabelWithTemplateName"
46
47
  })
47
- }), /* @__PURE__ */ o(r, {
48
- content: t.formatMessage(a.editButtonTooltip),
49
- children: /* @__PURE__ */ o(l, {
50
- "aria-label": t.formatMessage(a.editButtonAriaLabel, {
48
+ }), /* @__PURE__ */ o(l, {
49
+ content: t.formatMessage(i.editButtonTooltip),
50
+ children: /* @__PURE__ */ o(c, {
51
+ "aria-label": t.formatMessage(i.editButtonAriaLabel, {
51
52
  templateName: e
52
53
  }),
53
- icon: I,
54
- onClick: f,
54
+ icon: A,
55
+ onClick: _,
55
56
  "data-target-id": "IconButton-editButtonAriaLabel"
56
57
  })
57
58
  })]
@@ -59,5 +60,5 @@ import '../../../../../../styles/metadata-instance-header.css';const x = "_metad
59
60
  });
60
61
  };
61
62
  export {
62
- Y as MetadataInstanceHeader
63
+ z as MetadataInstanceHeader
63
64
  };
@@ -1,15 +1,19 @@
1
- const t = "properties", e = "extractAgent", n = {
1
+ import { BoxAiColor as t, BoxAiAdvancedColor as A } from "@box/blueprint-web-assets/icons/Medium";
2
+ const e = "properties", E = "extractAgent", a = {
2
3
  standard: {
3
- agentType: "standard",
4
- displayMsg: "standardExtractAgent"
4
+ AGENT_TYPE: "standard",
5
+ DISPLAY_MSG: "standardExtractAgent",
6
+ ICON: t
5
7
  },
6
8
  enhanced: {
7
- agentType: "enhanced",
8
- displayMsg: "enhancedExtractAgent"
9
+ AGENT_TYPE: "enhanced",
10
+ DISPLAY_MSG: "enhancedExtractAgent",
11
+ ICON: A,
12
+ AGENT_ID: "enhanced_extract_agent"
9
13
  }
10
14
  };
11
15
  export {
12
- n as EXTRACT_AGENTS_MAP,
13
- e as EXTRACT_AI_AGENT_LOCAL_STORAGE_KEY,
14
- t as TEMPLATE_CUSTOM_PROPERTIES
16
+ a as EXTRACT_AGENTS_MAP,
17
+ E as EXTRACT_AI_AGENT_LOCAL_STORAGE_KEY,
18
+ e as TEMPLATE_CUSTOM_PROPERTIES
15
19
  };
@@ -1,7 +1,7 @@
1
- import E, { createContext as d, useState as l, useCallback as S, useMemo as v, useContext as x } from "react";
2
- import { TEMPLATE_CUSTOM_PROPERTIES as A } from "../constants.js";
3
- import { jsx as P } from "react/jsx-runtime";
4
- const _ = 1e4, T = /* @__PURE__ */ d(null), M = ({
1
+ import E, { createContext as v, useState as l, useCallback as S, useMemo as x, useContext as A } from "react";
2
+ import { TEMPLATE_CUSTOM_PROPERTIES as P } from "../constants.js";
3
+ import { jsx as _ } from "react/jsx-runtime";
4
+ const p = 1e4, T = /* @__PURE__ */ v(null), O = ({
5
5
  children: e,
6
6
  isAiSuggestionsFeatureEnabled: o,
7
7
  fetchSuggestions: c
@@ -11,17 +11,17 @@ const _ = 1e4, T = /* @__PURE__ */ d(null), M = ({
11
11
  let t;
12
12
  return r ? t = setTimeout(() => {
13
13
  i(!0);
14
- }, _) : (i(!1), clearTimeout(t)), () => clearTimeout(t);
14
+ }, p) : (i(!1), clearTimeout(t)), () => clearTimeout(t);
15
15
  }, [r]);
16
- const m = S(async (t, w) => {
16
+ const m = S(async (t, h, w) => {
17
17
  let u = [];
18
18
  if (!o)
19
19
  throw new Error("AI Suggestions feature not available.");
20
- if (t === A)
20
+ if (t === P)
21
21
  throw new Error("Can't fetch suggestions for Custom Metadata instance");
22
22
  n(!0);
23
23
  try {
24
- u = await c(t, w), f({
24
+ u = await c(t, h, w || void 0), f({
25
25
  ...s,
26
26
  [t]: {
27
27
  ...Object.fromEntries(u.map((a) => [a.key, a.aiSuggestion]))
@@ -34,7 +34,7 @@ const _ = 1e4, T = /* @__PURE__ */ d(null), M = ({
34
34
  return u;
35
35
  }, [o, s, c]), C = S(() => {
36
36
  f({}), n(!1), i(!1);
37
- }, []), h = v(() => ({
37
+ }, []), d = x(() => ({
38
38
  clearState: C,
39
39
  getAiSuggestions: m,
40
40
  isAiSuggestionsFeatureEnabled: o,
@@ -42,19 +42,19 @@ const _ = 1e4, T = /* @__PURE__ */ d(null), M = ({
42
42
  isLongLoading: g,
43
43
  suggestions: s
44
44
  }), [C, m, o, r, g, s]);
45
- return /* @__PURE__ */ P(T.Provider, {
46
- value: h,
45
+ return /* @__PURE__ */ _(T.Provider, {
46
+ value: d,
47
47
  children: e
48
48
  });
49
- }, O = () => {
50
- const e = x(T);
49
+ }, R = () => {
50
+ const e = A(T);
51
51
  if (!e)
52
52
  throw new Error("useAutofill should be wrapped inside AutofillProvider");
53
53
  return e;
54
54
  };
55
55
  export {
56
56
  T as AutofillContext,
57
- M as AutofillContextProvider,
58
- _ as TIMEOUT_10_SECONDS,
59
- O as useAutofill
57
+ O as AutofillContextProvider,
58
+ p as TIMEOUT_10_SECONDS,
59
+ R as useAutofill
60
60
  };
@@ -1 +1 @@
1
- ._loadingIndicator_mk0hd_1{position:relative;display:flex;align-items:center;justify-content:center;width:var(--size-8);height:var(--size-8);margin:unset}._actionMenuItem_mk0hd_11{display:flex;gap:.75rem;align-items:center}
1
+ ._loadingIndicator_i1hyy_1{position:relative;display:flex;align-items:center;justify-content:center;width:var(--size-8);height:var(--size-8);margin:unset}._actionMenuItem_i1hyy_11{display:flex;gap:.75rem;align-items:center}._splitButtonIcon_i1hyy_17{width:var(--size-4);height:var(--size-4)}
@@ -41,7 +41,7 @@ export type MetadataInstanceFormWrapperProps<T> = {
41
41
  suggestions: AutofillSuggestions;
42
42
  handleDelete: () => void;
43
43
  handleCancel: (isDirty: boolean) => void;
44
- getAiSuggestions: (templateKey: MetadataTemplateInstance['templateKey'], scope: MetadataTemplateInstance['scope']) => Promise<MetadataTemplateField[]>;
44
+ getAiSuggestions: (templateKey: MetadataTemplateInstance['templateKey'], scope: MetadataTemplateInstance['scope'], agentId?: string) => Promise<MetadataTemplateField[]>;
45
45
  extraProps?: T;
46
46
  formRef?: React.LegacyRef<HTMLDivElement | null>;
47
47
  } & React.HTMLAttributes<HTMLDivElement>;
@@ -4,11 +4,12 @@ export type MetadataInstanceFormAutofillButtonProps = {
4
4
  isBetaLanguageEnabled: boolean;
5
5
  isLoading: boolean;
6
6
  isAdvancedExtractAgentEnabled?: boolean;
7
- onAutofill?: (templateKey: MetadataTemplateInstance['templateKey'], scope: MetadataTemplateInstance['scope']) => Promise<MetadataTemplateField[]>;
7
+ onAutofill?: (templateKey: MetadataTemplateInstance['templateKey'], scope: MetadataTemplateInstance['scope'], agentId?: string) => Promise<MetadataTemplateField[]>;
8
8
  variant?: 'secondary-button' | 'icon-button';
9
9
  };
10
10
  export type AutofillSplitButtonProps = {
11
11
  onAgentChange: (agentType: StoredAgentType) => void;
12
12
  isButtonDisabled: boolean;
13
13
  onAutofill: () => void;
14
+ storedAgent: StoredAgentType;
14
15
  };
@@ -4,7 +4,7 @@ export type MetadataInstanceHeaderProps = {
4
4
  isAiSuggestionsFeatureEnabled: boolean;
5
5
  isBetaLanguageEnabled: boolean;
6
6
  onEdit: () => void;
7
- onAutofill: () => void;
7
+ onAutofill: (agentId?: string) => void;
8
8
  templateName?: string;
9
9
  isAdvancedExtractAgentEnabled?: boolean;
10
10
  };
@@ -1,13 +1,4 @@
1
- import { StoredAgentType } from './types';
1
+ import { ExtractAgent } from './types';
2
2
  export declare const TEMPLATE_CUSTOM_PROPERTIES: "properties";
3
3
  export declare const EXTRACT_AI_AGENT_LOCAL_STORAGE_KEY = "extractAgent";
4
- export declare const EXTRACT_AGENTS_MAP: {
5
- standard: {
6
- agentType: StoredAgentType;
7
- displayMsg: string;
8
- };
9
- enhanced: {
10
- agentType: StoredAgentType;
11
- displayMsg: string;
12
- };
13
- };
4
+ export declare const EXTRACT_AGENTS_MAP: Record<string, ExtractAgent>;
@@ -1,7 +1,14 @@
1
1
  import { Level } from '@box/combobox-with-api';
2
+ import { default as React } from 'react';
2
3
  import { BaseOptionType } from './components/combobox-with-api-pagination/types';
3
4
  export type { FormValues } from './components/metadata-instance-editor/types';
4
5
  export type StoredAgentType = 'standard' | 'enhanced' | null;
6
+ export type ExtractAgent = {
7
+ AGENT_TYPE: StoredAgentType;
8
+ DISPLAY_MSG: string;
9
+ ICON: React.ComponentType<React.SVGProps<SVGSVGElement>>;
10
+ AGENT_ID?: string;
11
+ };
5
12
  export type MetadataEmptyStateProps = {
6
13
  isBoxAiSuggestionsFeatureEnabled?: boolean;
7
14
  isAnyEmptyValueHidden?: boolean;
@@ -2,7 +2,7 @@ import { default as React } from 'react';
2
2
  import { AutofillSuggestions, MetadataTemplateField, MetadataTemplateInstance } from '../types';
3
3
  export interface AutofillContextType {
4
4
  clearState: () => void;
5
- getAiSuggestions: (templateKey: MetadataTemplateInstance['templateKey'], scope: MetadataTemplateInstance['scope']) => Promise<MetadataTemplateField[]>;
5
+ getAiSuggestions: (templateKey: MetadataTemplateInstance['templateKey'], scope: MetadataTemplateInstance['scope'], agentId?: string) => Promise<MetadataTemplateField[]>;
6
6
  isAiSuggestionsFeatureEnabled: boolean;
7
7
  isFetchingSuggestions: boolean;
8
8
  isLongLoading: boolean;
@@ -11,7 +11,7 @@ export interface AutofillContextType {
11
11
  export interface AutofillContextProviderProps {
12
12
  children: React.ReactNode;
13
13
  isAiSuggestionsFeatureEnabled: boolean;
14
- fetchSuggestions: (templateKey: MetadataTemplateInstance['templateKey'], scope: MetadataTemplateInstance['scope']) => Promise<MetadataTemplateField[]>;
14
+ fetchSuggestions: (templateKey: MetadataTemplateInstance['templateKey'], scope: MetadataTemplateInstance['scope'], agentId?: string) => Promise<MetadataTemplateField[]>;
15
15
  }
16
16
  export declare const TIMEOUT_10_SECONDS = 10000;
17
17
  export declare const AutofillContext: React.Context<AutofillContextType>;
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@box/metadata-editor",
3
- "version": "0.111.4",
3
+ "version": "0.112.0",
4
4
  "peerDependencies": {
5
5
  "@ariakit/react": "0.4.15",
6
6
  "@box/box-ai-agent-selector": "^0.41.7",
7
7
  "@box/blueprint-web": "^7.30.3",
8
- "@box/blueprint-web-assets": "^4.21.0",
8
+ "@box/blueprint-web-assets": "^4.53.0",
9
9
  "@box/combobox-with-api": "^0.26.0",
10
10
  "formik": "^2.0.3",
11
11
  "lodash": "^4.17.15",
@@ -15,9 +15,9 @@
15
15
  },
16
16
  "devDependencies": {
17
17
  "@ariakit/react": "0.4.15",
18
- "@box/box-ai-agent-selector": "^0.43.4",
18
+ "@box/box-ai-agent-selector": "^0.43.6",
19
19
  "@box/babel-plugin-target-attributes": "1.3.0",
20
- "@box/blueprint-web": "^12.10.0",
20
+ "@box/blueprint-web": "^12.12.0",
21
21
  "@box/blueprint-web-assets": "^4.53.0",
22
22
  "@box/storybook-utils": "^0.13.6",
23
23
  "@testing-library/react": "^15.0.6",