@box/metadata-editor 0.111.5 → 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.
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-autofill-button/metadata-instance-form-autofill-button.js +104 -92
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance/metadata-instance.js +9 -9
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-header/metadata-instance-header.js +45 -44
- package/dist/esm/lib/constants.js +12 -8
- package/dist/esm/lib/utils/autofill-context.js +16 -16
- package/dist/styles/metadata-instance-form-autofill-button.css +1 -1
- package/dist/types/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/types.d.ts +1 -1
- package/dist/types/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-autofill-button/types.d.ts +2 -1
- package/dist/types/lib/components/metadata-instance-list/subcomponents/metadata-instance-header/types.d.ts +1 -1
- package/dist/types/lib/constants.d.ts +2 -11
- package/dist/types/lib/types.d.ts +7 -0
- package/dist/types/lib/utils/autofill-context.d.ts +2 -2
- package/package.json +4 -4
@@ -1,110 +1,122 @@
|
|
1
|
-
import { Tooltip as
|
2
|
-
import { BoxAiLogo as
|
3
|
-
import {
|
4
|
-
import {
|
5
|
-
import {
|
6
|
-
import {
|
7
|
-
import {
|
8
|
-
import {
|
9
|
-
import {
|
10
|
-
import {
|
11
|
-
import
|
12
|
-
import
|
13
|
-
import
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
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:
|
29
|
-
label:
|
30
|
-
onClick:
|
31
|
+
icon: L,
|
32
|
+
label: u.formatMessage(f.autofillButton),
|
33
|
+
onClick: h,
|
31
34
|
variant: "secondary",
|
32
|
-
children: /* @__PURE__ */ t(
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
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
|
-
}),
|
48
|
-
areAiSuggestionsAvailable:
|
49
|
-
isBetaLanguageEnabled:
|
50
|
-
isLoading:
|
51
|
-
variant:
|
52
|
-
isAdvancedExtractAgentEnabled:
|
53
|
-
onAutofill:
|
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:
|
57
|
-
values:
|
58
|
-
setFieldValue:
|
59
|
-
} =
|
60
|
-
suggestions:
|
61
|
-
} =
|
62
|
-
|
63
|
-
if (
|
64
|
-
const
|
65
|
-
|
66
|
-
var
|
67
|
-
const
|
68
|
-
return
|
69
|
-
...
|
70
|
-
aiSuggestion:
|
71
|
-
} :
|
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
|
-
}, [
|
75
|
-
const
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
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:
|
103
|
+
children: o.formatMessage(f.autofillButton)
|
92
104
|
})
|
93
|
-
}) : /* @__PURE__ */ t(
|
94
|
-
content:
|
95
|
-
children:
|
96
|
-
"aria-label":
|
97
|
-
className:
|
98
|
-
}) : /* @__PURE__ */ t(
|
99
|
-
"aria-label":
|
100
|
-
disabled:
|
101
|
-
icon:
|
102
|
-
onClick:
|
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
|
-
|
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
|
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
|
-
}),
|
38
|
+
}), r && E ? /* @__PURE__ */ t(H, {
|
39
39
|
isAnyEmptyValueHidden: V,
|
40
40
|
isBoxAiSuggestionsFeatureEnabled: d,
|
41
41
|
level: "instance",
|
42
|
-
onShowEmptyValues: () =>
|
42
|
+
onShowEmptyValues: () => s(!1)
|
43
43
|
}) : /* @__PURE__ */ a(n, {
|
44
44
|
children: [/* @__PURE__ */ t(_, {
|
45
|
-
shouldHideEmptyValues:
|
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:
|
53
|
-
onHideEmptyValues: () =>
|
54
|
-
onShowEmptyValues: () =>
|
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
|
2
|
-
import { Pencil as
|
3
|
-
import {
|
4
|
-
import { useLocalStorageAIAgents as
|
5
|
-
import { useMemo as
|
6
|
-
import { useIntl as
|
7
|
-
import { EXTRACT_AI_AGENT_LOCAL_STORAGE_KEY as
|
8
|
-
import { autofillMessages as
|
9
|
-
import { getTooltipContent as
|
10
|
-
import
|
11
|
-
import
|
12
|
-
import { jsxs as
|
13
|
-
import '../../../../../../styles/metadata-instance-header.css';const
|
14
|
-
metadataInstanceHeader:
|
15
|
-
iconButtonsContainer:
|
16
|
-
title:
|
17
|
-
},
|
18
|
-
areAiSuggestionsAvailable:
|
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:
|
21
|
-
isBetaLanguageEnabled:
|
22
|
-
onEdit:
|
20
|
+
isAiSuggestionsFeatureEnabled: f,
|
21
|
+
isBetaLanguageEnabled: S,
|
22
|
+
onEdit: _,
|
23
23
|
onAutofill: p,
|
24
24
|
templateName: e,
|
25
|
-
isAdvancedExtractAgentEnabled:
|
25
|
+
isAdvancedExtractAgentEnabled: a = !1
|
26
26
|
}) => {
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
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: !
|
42
|
-
icon:
|
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(
|
48
|
-
content: t.formatMessage(
|
49
|
-
children: /* @__PURE__ */ o(
|
50
|
-
"aria-label": t.formatMessage(
|
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:
|
54
|
-
onClick:
|
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
|
-
|
63
|
+
z as MetadataInstanceHeader
|
63
64
|
};
|
@@ -1,15 +1,19 @@
|
|
1
|
-
|
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
|
-
|
4
|
-
|
4
|
+
AGENT_TYPE: "standard",
|
5
|
+
DISPLAY_MSG: "standardExtractAgent",
|
6
|
+
ICON: t
|
5
7
|
},
|
6
8
|
enhanced: {
|
7
|
-
|
8
|
-
|
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
|
-
|
13
|
-
|
14
|
-
|
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
|
2
|
-
import { TEMPLATE_CUSTOM_PROPERTIES as
|
3
|
-
import { jsx as
|
4
|
-
const
|
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
|
-
},
|
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 ===
|
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
|
-
}, []),
|
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__ */
|
46
|
-
value:
|
45
|
+
return /* @__PURE__ */ _(T.Provider, {
|
46
|
+
value: d,
|
47
47
|
children: e
|
48
48
|
});
|
49
|
-
},
|
50
|
-
const e =
|
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
|
-
|
58
|
-
|
59
|
-
|
57
|
+
O as AutofillContextProvider,
|
58
|
+
p as TIMEOUT_10_SECONDS,
|
59
|
+
R as useAutofill
|
60
60
|
};
|
@@ -1 +1 @@
|
|
1
|
-
.
|
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 {
|
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.
|
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.
|
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.
|
18
|
+
"@box/box-ai-agent-selector": "^0.43.6",
|
19
19
|
"@box/babel-plugin-target-attributes": "1.3.0",
|
20
|
-
"@box/blueprint-web": "^12.
|
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",
|