@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.
- package/dist/chunks/metadata-instance-form-card-wrapper.js +32 -30
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/metadata-instance-form-card-wrapper.js +1 -1
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/metadata-instance-form.js +70 -68
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-autofill-button/messages.js +14 -14
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-autofill-button/metadata-instance-form-autofill-button.js +100 -56
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-header/metadata-instance-form-header.js +24 -22
- package/dist/esm/lib/components/metadata-instance-list/metadata-instance-list.js +10 -8
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance/metadata-instance.js +29 -27
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-header/messages.js +2 -14
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-header/metadata-instance-header.js +46 -40
- package/dist/esm/lib/constants.js +13 -2
- package/dist/esm/lib/messages.js +18 -0
- package/dist/esm/lib/utils/utils.js +7 -5
- package/dist/i18n/bn-IN.js +17 -10
- package/dist/i18n/bn-IN.properties +5 -1
- package/dist/i18n/da-DK.js +17 -10
- package/dist/i18n/da-DK.properties +5 -1
- package/dist/i18n/de-DE.js +17 -10
- package/dist/i18n/de-DE.properties +5 -1
- package/dist/i18n/en-AU.js +15 -8
- package/dist/i18n/en-AU.properties +5 -1
- package/dist/i18n/en-CA.js +15 -8
- package/dist/i18n/en-CA.properties +5 -1
- package/dist/i18n/en-GB.js +15 -8
- package/dist/i18n/en-GB.properties +5 -1
- package/dist/i18n/en-US.js +7 -6
- package/dist/i18n/en-US.properties +14 -12
- package/dist/i18n/en-x-pseudo.js +132 -125
- package/dist/i18n/en-x-pseudo.properties +127 -123
- package/dist/i18n/es-419.js +17 -10
- package/dist/i18n/es-419.properties +5 -1
- package/dist/i18n/es-ES.js +17 -10
- package/dist/i18n/es-ES.properties +5 -1
- package/dist/i18n/fi-FI.js +17 -10
- package/dist/i18n/fi-FI.properties +5 -1
- package/dist/i18n/fr-CA.js +17 -10
- package/dist/i18n/fr-CA.properties +5 -1
- package/dist/i18n/fr-FR.js +17 -10
- package/dist/i18n/fr-FR.properties +5 -1
- package/dist/i18n/hi-IN.js +17 -10
- package/dist/i18n/hi-IN.properties +5 -1
- package/dist/i18n/it-IT.js +17 -10
- package/dist/i18n/it-IT.properties +5 -1
- package/dist/i18n/ja-JP.js +17 -10
- package/dist/i18n/ja-JP.properties +5 -1
- package/dist/i18n/json/src/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-autofill-button/messages.json +1 -1
- package/dist/i18n/json/src/lib/components/metadata-instance-list/subcomponents/metadata-instance-header/messages.json +1 -1
- package/dist/i18n/json/src/lib/messages.json +1 -1
- package/dist/i18n/ko-KR.js +17 -10
- package/dist/i18n/ko-KR.properties +5 -1
- package/dist/i18n/nb-NO.js +17 -10
- package/dist/i18n/nb-NO.properties +5 -1
- package/dist/i18n/nl-NL.js +17 -10
- package/dist/i18n/nl-NL.properties +5 -1
- package/dist/i18n/pl-PL.js +17 -10
- package/dist/i18n/pl-PL.properties +5 -1
- package/dist/i18n/pt-BR.js +17 -10
- package/dist/i18n/pt-BR.properties +5 -1
- package/dist/i18n/ru-RU.js +17 -10
- package/dist/i18n/ru-RU.properties +5 -1
- package/dist/i18n/sv-SE.js +17 -10
- package/dist/i18n/sv-SE.properties +5 -1
- package/dist/i18n/tr-TR.js +17 -10
- package/dist/i18n/tr-TR.properties +5 -1
- package/dist/i18n/zh-CN.js +17 -10
- package/dist/i18n/zh-CN.properties +5 -1
- package/dist/i18n/zh-TW.js +17 -10
- package/dist/i18n/zh-TW.properties +5 -1
- 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 +2 -0
- package/dist/types/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-autofill-button/messages.d.ts +4 -4
- package/dist/types/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-autofill-button/metadata-instance-form-autofill-button.d.ts +1 -1
- package/dist/types/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-autofill-button/types.d.ts +7 -1
- package/dist/types/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-header/metadata-instance-form-header.d.ts +1 -1
- package/dist/types/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-header/types.d.ts +1 -0
- package/dist/types/lib/components/metadata-instance-list/metadata-instance-list.d.ts +1 -1
- package/dist/types/lib/components/metadata-instance-list/subcomponents/metadata-instance/metadata-instance.d.ts +1 -1
- package/dist/types/lib/components/metadata-instance-list/subcomponents/metadata-instance/types.d.ts +1 -0
- package/dist/types/lib/components/metadata-instance-list/subcomponents/metadata-instance-header/messages.d.ts +0 -15
- package/dist/types/lib/components/metadata-instance-list/subcomponents/metadata-instance-header/metadata-instance-header.d.ts +1 -1
- package/dist/types/lib/components/metadata-instance-list/subcomponents/metadata-instance-header/types.d.ts +1 -0
- package/dist/types/lib/components/metadata-instance-list/types.d.ts +1 -0
- package/dist/types/lib/constants.d.ts +12 -0
- package/dist/types/lib/messages.d.ts +22 -0
- package/dist/types/lib/types.d.ts +1 -0
- package/dist/types/lib/utils/utils.d.ts +3 -1
- 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 {
|
3
|
-
import {
|
4
|
-
import {
|
5
|
-
import {
|
6
|
-
import
|
7
|
-
|
8
|
-
|
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
|
-
},
|
13
|
+
}, B = (n) => {
|
14
14
|
const {
|
15
15
|
areAiSuggestionsAvailable: o,
|
16
16
|
children: r,
|
17
17
|
className: i,
|
18
18
|
formRef: g,
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
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:
|
26
|
+
isFormDirty: _ = !1,
|
26
27
|
selectedTemplateInstance: a,
|
27
|
-
getAiSuggestions:
|
28
|
-
handleCancel:
|
29
|
-
handleDelete:
|
30
|
-
} = n,
|
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__ */
|
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(
|
39
|
+
children: [/* @__PURE__ */ t(M, {
|
39
40
|
areAiSuggestionsAvailable: o,
|
40
41
|
hasSuggestions: C,
|
41
|
-
|
42
|
-
|
43
|
-
|
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(
|
48
|
-
isDeleteButtonDisabled:
|
49
|
+
}), a && r, /* @__PURE__ */ t(w, {
|
50
|
+
isDeleteButtonDisabled: F,
|
49
51
|
isLoading: e,
|
50
|
-
onCancel: () =>
|
51
|
-
onDelete:
|
52
|
+
onCancel: () => h(_),
|
53
|
+
onDelete: f
|
52
54
|
})]
|
53
55
|
})
|
54
56
|
});
|
55
57
|
};
|
56
58
|
export {
|
57
|
-
|
59
|
+
B as M,
|
58
60
|
s
|
59
61
|
};
|
@@ -1,128 +1,130 @@
|
|
1
1
|
import "../custom-instance-new-field/custom-instance-new-field.js";
|
2
|
-
import { DeleteConfirmationModal as
|
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
|
6
|
-
import { Formik as
|
7
|
-
import { useState as
|
8
|
-
import { TEMPLATE_CUSTOM_PROPERTIES as
|
9
|
-
import { useAutofill as
|
10
|
-
import { TemplateInstance as
|
11
|
-
import { MetadataEmptyState as
|
12
|
-
import { AutofillOverlay as
|
13
|
-
import { CustomInstance as
|
14
|
-
import { c as
|
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
|
17
|
-
import { UnsavedChangesModal as
|
18
|
-
const
|
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
|
-
|
25
|
+
isAdvancedExtractAgentEnabled: D = !1,
|
26
|
+
isBetaLanguageEnabled: v,
|
26
27
|
isDeleteButtonDisabled: O,
|
27
|
-
isDeleteConfirmationModalCheckboxEnabled:
|
28
|
+
isDeleteConfirmationModalCheckboxEnabled: x,
|
28
29
|
isMultilevelTaxonomyFieldEnabled: l,
|
29
|
-
isUnsavedChangesModalOpen:
|
30
|
-
MetadataInstanceFormCustomWrapper:
|
30
|
+
isUnsavedChangesModalOpen: A = !1,
|
31
|
+
MetadataInstanceFormCustomWrapper: L,
|
31
32
|
selectedTemplateInstance: o,
|
32
|
-
onCancel:
|
33
|
-
onDelete:
|
34
|
-
onDiscardUnsavedChanges:
|
35
|
-
onSubmit:
|
33
|
+
onCancel: N,
|
34
|
+
onDelete: P,
|
35
|
+
onDiscardUnsavedChanges: R,
|
36
|
+
onSubmit: U,
|
36
37
|
setIsUnsavedChangesModalOpen: f,
|
37
38
|
taxonomyOptionsFetcher: u
|
38
|
-
} = b,
|
39
|
-
isFetchingSuggestions:
|
39
|
+
} = b, k = L ?? io, [B, d] = c(!1), {
|
40
|
+
isFetchingSuggestions: i,
|
40
41
|
isLongLoading: g,
|
41
|
-
getAiSuggestions:
|
42
|
+
getAiSuggestions: w,
|
42
43
|
clearState: p,
|
43
|
-
suggestions:
|
44
|
-
} =
|
45
|
-
|
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) ===
|
49
|
-
await
|
50
|
-
},
|
51
|
-
r ? f(!0) :
|
52
|
-
},
|
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
|
-
},
|
55
|
+
}, _ = {
|
55
56
|
metadata: {
|
56
57
|
...o
|
57
58
|
}
|
58
|
-
}, C =
|
59
|
-
|
60
|
-
|
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
|
63
|
+
const J = X(() => {
|
63
64
|
const r = (o == null ? void 0 : o.fields.length) === 0;
|
64
65
|
if (h)
|
65
|
-
return /* @__PURE__ */
|
66
|
-
isLoading:
|
66
|
+
return /* @__PURE__ */ t(ro, {
|
67
|
+
isLoading: i
|
67
68
|
});
|
68
69
|
if (r)
|
69
|
-
return /* @__PURE__ */
|
70
|
+
return /* @__PURE__ */ t(T, {
|
70
71
|
isBoxAiSuggestionsFeatureEnabled: s,
|
71
72
|
level: "instance"
|
72
73
|
});
|
73
|
-
const e = !!(
|
74
|
+
const e = !!(i || n);
|
74
75
|
return /* @__PURE__ */ F("div", {
|
75
|
-
className:
|
76
|
-
children: [/* @__PURE__ */
|
76
|
+
className: z(m.metadataInstanceFormContent, e && m.showOverlay),
|
77
|
+
children: [/* @__PURE__ */ t(oo, {
|
77
78
|
errorCode: n,
|
78
|
-
isFetchingSuggestions:
|
79
|
+
isFetchingSuggestions: i,
|
79
80
|
isLongLoading: g
|
80
|
-
}), /* @__PURE__ */
|
81
|
-
disableForm:
|
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,
|
88
|
-
return /* @__PURE__ */
|
89
|
-
initialValues:
|
90
|
-
onSubmit:
|
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(
|
95
|
-
children: [/* @__PURE__ */
|
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:
|
101
|
-
handleCancel:
|
102
|
-
handleDelete:
|
101
|
+
getAiSuggestions: w,
|
102
|
+
handleCancel: j,
|
103
|
+
handleDelete: V,
|
104
|
+
isAdvancedExtractAgentEnabled: D,
|
103
105
|
isAiSuggestionsFeatureEnabled: s,
|
104
|
-
isBetaLanguageEnabled:
|
106
|
+
isBetaLanguageEnabled: v,
|
105
107
|
isDeleteButtonDisabled: O,
|
106
|
-
isFetchingSuggestions:
|
108
|
+
isFetchingSuggestions: i,
|
107
109
|
isFormDirty: e,
|
108
110
|
isLargeFile: S,
|
109
111
|
selectedTemplateInstance: o,
|
110
|
-
suggestions:
|
111
|
-
children: o &&
|
112
|
-
}), /* @__PURE__ */
|
112
|
+
suggestions: K,
|
113
|
+
children: o && J
|
114
|
+
}), /* @__PURE__ */ t(ao, {
|
113
115
|
onBackToEdit: () => f(!1),
|
114
|
-
onDiscardChanges:
|
115
|
-
open:
|
116
|
-
}), /* @__PURE__ */
|
117
|
-
isCheckboxEnabled:
|
118
|
-
onConfirm: () =>
|
116
|
+
onDiscardChanges: R,
|
117
|
+
open: A
|
118
|
+
}), /* @__PURE__ */ t(q, {
|
119
|
+
isCheckboxEnabled: x,
|
120
|
+
onConfirm: () => P(o),
|
119
121
|
onDismiss: () => d(!1),
|
120
|
-
open:
|
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
|
-
|
129
|
+
So as MetadataInstanceForm
|
128
130
|
};
|
@@ -1,24 +1,24 @@
|
|
1
|
-
import { defineMessages as
|
2
|
-
const e =
|
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
|
2
|
-
import { BoxAiLogo as
|
3
|
-
import {
|
4
|
-
import {
|
5
|
-
import {
|
6
|
-
import {
|
7
|
-
import
|
8
|
-
import {
|
9
|
-
import
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
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:
|
20
|
-
values:
|
21
|
-
setFieldValue:
|
22
|
-
} = L(),
|
23
|
-
suggestions:
|
24
|
-
} =
|
25
|
-
|
26
|
-
if (
|
27
|
-
const
|
28
|
-
|
29
|
-
var
|
30
|
-
const
|
31
|
-
return
|
32
|
-
...
|
33
|
-
aiSuggestion:
|
34
|
-
} :
|
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
|
-
}, [
|
38
|
-
const
|
39
|
-
const
|
40
|
-
|
41
|
-
},
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
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:
|
61
|
-
})
|
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
|
-
|
109
|
+
rt as MetadataInstanceFormAutofillButton
|
66
110
|
};
|
@@ -1,41 +1,43 @@
|
|
1
|
-
import { useIntl as
|
2
|
-
import
|
3
|
-
import { MetadataInstanceFormAutofillButton as
|
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
|
7
|
-
import
|
8
|
-
|
9
|
-
|
10
|
-
|
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
|
-
|
13
|
+
isAdvancedExtractAgentEnabled: m = !1,
|
14
|
+
isAiSuggestionsFeatureEnabled: s,
|
14
15
|
isBetaLanguageEnabled: a,
|
15
|
-
isLargeFile:
|
16
|
-
isLoading:
|
17
|
-
templateName:
|
16
|
+
isLargeFile: c,
|
17
|
+
isLoading: i,
|
18
|
+
templateName: l,
|
18
19
|
onAutofill: d
|
19
20
|
}) => {
|
20
|
-
const
|
21
|
-
return /* @__PURE__ */ o(
|
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(
|
25
|
+
children: [/* @__PURE__ */ t(H, {
|
25
26
|
className: n.title,
|
26
|
-
title:
|
27
|
-
}),
|
27
|
+
title: f
|
28
|
+
}), s ? /* @__PURE__ */ t(_, {
|
28
29
|
areAiSuggestionsAvailable: e,
|
30
|
+
isAdvancedExtractAgentEnabled: m,
|
29
31
|
isBetaLanguageEnabled: a,
|
30
|
-
isLoading:
|
32
|
+
isLoading: i,
|
31
33
|
onAutofill: d
|
32
34
|
}) : null]
|
33
|
-
}),
|
35
|
+
}), F && /* @__PURE__ */ t(h, {
|
34
36
|
isBetaLanguageEnabled: a,
|
35
|
-
isLargeFile:
|
37
|
+
isLargeFile: c
|
36
38
|
})]
|
37
39
|
});
|
38
40
|
};
|
39
41
|
export {
|
40
|
-
|
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
|
6
|
-
metadataInstanceList:
|
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:
|
16
|
-
children: c(m).map((t) => /* @__PURE__ */ a(
|
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
|
-
|
28
|
+
b as MetadataInstanceList
|
27
29
|
};
|