@box/metadata-editor 1.68.0 → 1.69.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/ai-suggestion-field.js +77 -60
- package/dist/chunks/metadata-instance-content.js +36 -24
- package/dist/chunks/metadata-instance-entry.js +61 -52
- package/dist/chunks/metadata-instance-form-autofill-button.js +5 -5
- package/dist/chunks/metadata-instance-form-card-wrapper.js +6 -6
- package/dist/chunks/metadata-instance-form-footer.js +1 -1
- package/dist/chunks/metadata-instance-form-header.js +8 -8
- package/dist/chunks/metadata-instance-header.js +4 -4
- package/dist/esm/index.js +12 -15
- package/dist/esm/lib/components/metadata-editor-fields/components/ai-logo-badge/ai-logo-badge.js +19 -16
- package/dist/esm/lib/components/metadata-editor-fields/components/low-confidence-badge/low-confidence-badge.js +20 -17
- package/dist/esm/lib/components/metadata-editor-fields/components/low-confidence-suggestion-field/low-confidence-suggestion-field.js +4 -4
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-string-field/metadata-string-field.js +1 -1
- package/dist/esm/lib/components/metadata-editor-fields/metadata-editor-field-wrapper.js +13 -12
- package/dist/esm/lib/components/metadata-instance-editor/index.js +9 -7
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/metadata-instance-form.js +86 -84
- package/dist/esm/lib/components/metadata-instance-list/index.js +6 -4
- package/dist/esm/lib/components/metadata-instance-review-notice/metadata-instance-review-notice.js +1 -0
- package/dist/esm/lib/components/unsaved-changes-modal/unsaved-changes-modal.js +34 -31
- package/dist/esm/lib/utils/analytics/analytics-context.js +11 -0
- package/dist/esm/lib/utils/analytics/events.js +9 -0
- package/dist/esm/lib/utils/analytics/index.js +4 -0
- package/dist/esm/lib/utils/analytics/with-analytics.js +11 -0
- package/dist/esm/lib/utils/confidence-score/index.js +5 -5
- package/dist/i18n/en-x-pseudo.js +156 -156
- package/dist/i18n/en-x-pseudo.properties +156 -156
- package/dist/types/lib/components/metadata-instance-editor/index.d.ts +6 -1
- package/dist/types/lib/components/metadata-instance-list/index.d.ts +12 -2
- package/dist/types/lib/components/unsaved-changes-modal/types.d.ts +7 -0
- package/dist/types/lib/components/unsaved-changes-modal/unsaved-changes-modal.d.ts +1 -1
- package/dist/types/lib/utils/analytics/analytics-context.d.ts +12 -0
- package/dist/types/lib/utils/analytics/events.d.ts +9 -0
- package/dist/types/lib/utils/analytics/index.d.ts +3 -0
- package/dist/types/lib/utils/analytics/with-analytics.d.ts +8 -0
- package/package.json +4 -4
|
@@ -1,83 +1,100 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t } from "
|
|
3
|
-
import n from "
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
import
|
|
1
|
+
import { EVENT_NAMES as e } from "../esm/lib/utils/analytics/events.js";
|
|
2
|
+
import { useMetadataEditorAnalytics as t } from "../esm/lib/utils/analytics/analytics-context.js";
|
|
3
|
+
import { n } from "./types.js";
|
|
4
|
+
import { t as r } from "./field-action-bar.module.js";
|
|
5
|
+
import i from "../esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/messages.js";
|
|
6
|
+
import { formatSuggestionValue as a } from "../esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/utils.js";
|
|
7
|
+
import { DropdownMenu as o, IconButton as s, Text as c, useBlueprintModernization as l } from "@box/blueprint-web";
|
|
8
|
+
import { Checkmark as u, Ellipsis as d } from "@box/blueprint-web-assets/icons/Fill";
|
|
9
|
+
import { useEffect as f, useRef as p } from "react";
|
|
10
|
+
import { FormattedMessage as m, useIntl as h } from "react-intl";
|
|
11
|
+
import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
12
|
+
import y from "clsx";
|
|
13
|
+
import '../styles/ai-suggestion-field.css';var b = {
|
|
11
14
|
wrapper: "_wrapper_132y2_1",
|
|
12
15
|
selectTrigger: "_selectTrigger_132y2_1"
|
|
13
16
|
};
|
|
14
|
-
function
|
|
15
|
-
let
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
function x({ aiSuggestion: x, onAiSuggestionAppend: S, onAiSuggestionReplace: C, onAiSuggestionIgnore: w, type: T, isSameValue: E, confidenceLevel: D }) {
|
|
18
|
+
let O = h(), { enableModernizedComponents: k } = l(), { trackEvent: A } = t(), j = p(!1);
|
|
19
|
+
f(() => {
|
|
20
|
+
j.current || x == null || !A || (j.current = !0, A(e.AI_SUGGESTION_SHOWN, {
|
|
21
|
+
fieldType: T,
|
|
22
|
+
confidenceLevel: D,
|
|
23
|
+
isSameValue: E
|
|
24
|
+
}));
|
|
25
|
+
}, [
|
|
26
|
+
x,
|
|
27
|
+
D,
|
|
28
|
+
E,
|
|
29
|
+
T,
|
|
30
|
+
A
|
|
31
|
+
]);
|
|
32
|
+
let M = D === n.High ? i.confidenceLevelHigh : i.confidenceLevelLow, N = D ? O.formatMessage(M) : void 0;
|
|
33
|
+
return /* @__PURE__ */ _("div", {
|
|
34
|
+
className: r.wrapperGradient,
|
|
35
|
+
"data-modern": k,
|
|
36
|
+
children: /* @__PURE__ */ _("div", {
|
|
37
|
+
className: y(r.wrapper, b.wrapper),
|
|
38
|
+
children: E ? /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(c, {
|
|
22
39
|
as: "p",
|
|
23
40
|
color: "textOnLightSecondary",
|
|
24
41
|
variant: "caption",
|
|
25
|
-
children:
|
|
26
|
-
}), /* @__PURE__ */
|
|
27
|
-
className:
|
|
28
|
-
children: /* @__PURE__ */
|
|
29
|
-
"aria-label":
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
42
|
+
children: D ? O.formatMessage(i.sameValueAiSuggestionCaptionWithLevel, { level: N }) : O.formatMessage(i.sameValueAiSuggestionCaption)
|
|
43
|
+
}), /* @__PURE__ */ _("div", {
|
|
44
|
+
className: r.buttons,
|
|
45
|
+
children: /* @__PURE__ */ _(s, {
|
|
46
|
+
"aria-label": D ? O.formatMessage(i.aiSuggestionAccept) : O.formatMessage(i.aiSuggestionConfirm),
|
|
47
|
+
"data-target-id": D ? "IconButton-aiSuggestionAccept" : "IconButton-aiSuggestionConfirmSame",
|
|
48
|
+
icon: u,
|
|
49
|
+
onClick: D ? C : w,
|
|
50
|
+
size: "x-small"
|
|
34
51
|
})
|
|
35
|
-
})] }) : /* @__PURE__ */
|
|
52
|
+
})] }) : /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _(c, {
|
|
36
53
|
as: "p",
|
|
37
54
|
color: "textOnLightSecondary",
|
|
38
55
|
variant: "caption",
|
|
39
|
-
children:
|
|
40
|
-
}), /* @__PURE__ */
|
|
56
|
+
children: D ? O.formatMessage(i.aiSuggestionCaptionWithLevel, { level: N }) : O.formatMessage(i.aiSuggestionCaption)
|
|
57
|
+
}), /* @__PURE__ */ _(c, {
|
|
41
58
|
as: "p",
|
|
42
|
-
children:
|
|
43
|
-
type:
|
|
44
|
-
locale:
|
|
59
|
+
children: a(x, {
|
|
60
|
+
type: T,
|
|
61
|
+
locale: O.locale
|
|
45
62
|
})
|
|
46
|
-
})] }), /* @__PURE__ */
|
|
47
|
-
className:
|
|
48
|
-
children: [/* @__PURE__ */
|
|
49
|
-
"aria-label":
|
|
50
|
-
"data-target-id":
|
|
51
|
-
icon:
|
|
52
|
-
onClick:
|
|
63
|
+
})] }), /* @__PURE__ */ v("div", {
|
|
64
|
+
className: r.buttons,
|
|
65
|
+
children: [/* @__PURE__ */ _(s, {
|
|
66
|
+
"aria-label": O.formatMessage(T === "multiSelect" ? i.aiSuggestionAppend : i.aiSuggestionClearAndReplace),
|
|
67
|
+
"data-target-id": T === "multiSelect" ? "IconButton-aiSuggestionAppend" : "IconButton-aiSuggestionClearAndReplace",
|
|
68
|
+
icon: u,
|
|
69
|
+
onClick: T === "multiSelect" ? S : C,
|
|
53
70
|
size: "x-small"
|
|
54
|
-
}), /* @__PURE__ */
|
|
55
|
-
className:
|
|
56
|
-
children: /* @__PURE__ */
|
|
57
|
-
"aria-label":
|
|
58
|
-
|
|
59
|
-
|
|
71
|
+
}), /* @__PURE__ */ v(o.Root, { children: [/* @__PURE__ */ _(o.Trigger, {
|
|
72
|
+
className: b.selectTrigger,
|
|
73
|
+
children: /* @__PURE__ */ _(s, {
|
|
74
|
+
"aria-label": O.formatMessage(i.aiSuggestionOptions),
|
|
75
|
+
"data-target-id": "IconButton-aiSuggestionOptions",
|
|
76
|
+
icon: d
|
|
60
77
|
})
|
|
61
|
-
}), /* @__PURE__ */
|
|
62
|
-
|
|
63
|
-
onSelect: v,
|
|
78
|
+
}), /* @__PURE__ */ v(o.Content, { children: [
|
|
79
|
+
T === "multiSelect" && /* @__PURE__ */ _(o.Item, {
|
|
64
80
|
"data-target-id": "DropdownMenu.Item-aiSuggestionAppend",
|
|
65
|
-
|
|
81
|
+
onSelect: S,
|
|
82
|
+
children: /* @__PURE__ */ _(m, { ...i.aiSuggestionAppend })
|
|
66
83
|
}),
|
|
67
|
-
/* @__PURE__ */
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
children: /* @__PURE__ */
|
|
84
|
+
/* @__PURE__ */ _(o.Item, {
|
|
85
|
+
"data-target-id": "DropdownMenu.Item-metadataAiSuggestionClearAndReplace",
|
|
86
|
+
onSelect: C,
|
|
87
|
+
children: /* @__PURE__ */ _(m, { ...i.aiSuggestionClearAndReplace })
|
|
71
88
|
}),
|
|
72
|
-
/* @__PURE__ */
|
|
73
|
-
/* @__PURE__ */
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
children: /* @__PURE__ */
|
|
89
|
+
/* @__PURE__ */ _(o.Separator, {}),
|
|
90
|
+
/* @__PURE__ */ _(o.Item, {
|
|
91
|
+
"data-target-id": "DropdownMenu.Item-metadataAiSuggestionIgnore",
|
|
92
|
+
onSelect: w,
|
|
93
|
+
children: /* @__PURE__ */ _(m, { ...i.aiSuggestionIgnore })
|
|
77
94
|
})
|
|
78
95
|
] })] })]
|
|
79
96
|
})] })
|
|
80
97
|
})
|
|
81
98
|
});
|
|
82
99
|
}
|
|
83
|
-
export {
|
|
100
|
+
export { x as t };
|
|
@@ -1,29 +1,41 @@
|
|
|
1
1
|
import { t as e } from "./metadata-instance-entry.js";
|
|
2
|
-
import {
|
|
3
|
-
import n from "
|
|
4
|
-
import
|
|
2
|
+
import { useMemo as t } from "react";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
import r from "clsx";
|
|
5
|
+
import '../styles/metadata-instance-content.css';var i = {
|
|
5
6
|
metadataInstanceContent: "_metadataInstanceContent_1cb0f_1",
|
|
6
7
|
metadataInstanceContentReducedGap: "_metadataInstanceContentReducedGap_1cb0f_7"
|
|
7
|
-
},
|
|
8
|
-
let { fields:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
8
|
+
}, a = ({ onSelectMetadataField: a, selectedMetadataFieldId: o, shouldHideEmptyValues: s, templateInstance: c, taxonomyNodeFetcher: l, isConfidenceScoreReviewEnabled: u }) => {
|
|
9
|
+
let { fields: d = [] } = c, f = t(() => d.filter((e) => !e.hidden).map((t) => {
|
|
10
|
+
let r = a ? () => a(t) : void 0;
|
|
11
|
+
return /* @__PURE__ */ n(e, {
|
|
12
|
+
confidenceScore: t.confidenceScore,
|
|
13
|
+
description: t.description,
|
|
14
|
+
isConfidenceScoreReviewEnabled: u,
|
|
15
|
+
isExternallyOwned: c.isExternallyOwned,
|
|
16
|
+
isSelected: o === t.id,
|
|
17
|
+
name: t.displayName || t.key,
|
|
18
|
+
onClick: r,
|
|
19
|
+
scope: t.namespace,
|
|
20
|
+
shouldHideEmptyValues: s,
|
|
21
|
+
taxonomyKey: t.taxonomyKey,
|
|
22
|
+
taxonomyNodeFetcher: l,
|
|
23
|
+
type: t.type,
|
|
24
|
+
value: t.value,
|
|
25
|
+
targetLocation: t.targetLocation
|
|
26
|
+
}, t.id);
|
|
27
|
+
}), [
|
|
28
|
+
d,
|
|
29
|
+
u,
|
|
30
|
+
a,
|
|
31
|
+
o,
|
|
32
|
+
s,
|
|
33
|
+
l,
|
|
34
|
+
c.isExternallyOwned
|
|
35
|
+
]);
|
|
36
|
+
return /* @__PURE__ */ n("div", {
|
|
37
|
+
className: r(i.metadataInstanceContent, u && i.metadataInstanceContentReducedGap),
|
|
38
|
+
children: f
|
|
27
39
|
});
|
|
28
40
|
};
|
|
29
|
-
export {
|
|
41
|
+
export { a as t };
|
|
@@ -1,82 +1,91 @@
|
|
|
1
1
|
import e from "../esm/lib/messages.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import o from "
|
|
8
|
-
import s from "../esm/lib/
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
14
|
-
import {
|
|
15
|
-
import
|
|
2
|
+
import { EVENT_NAMES as t } from "../esm/lib/utils/analytics/events.js";
|
|
3
|
+
import { useMetadataEditorAnalytics as n } from "../esm/lib/utils/analytics/analytics-context.js";
|
|
4
|
+
import { checkIfHasBoundingBoxes as r } from "../esm/lib/utils/check-if-has-bounding-boxes.js";
|
|
5
|
+
import { getConfidenceScoreTooltip as i } from "../esm/lib/utils/confidence-score/get-confidence-score-tooltip.js";
|
|
6
|
+
import { isConfidenceScoreNeedingReview as a } from "../esm/lib/utils/confidence-score/is-confidence-score-needing-review.js";
|
|
7
|
+
import { t as o } from "./shared-field-styles.module.js";
|
|
8
|
+
import { convertISOStringToUTCDate as s } from "../esm/lib/utils/convertDate.js";
|
|
9
|
+
import c from "../esm/lib/components/interactive-text/interactive-text.js";
|
|
10
|
+
import l from "../esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/messages.js";
|
|
11
|
+
import { MetadataEntryDisplay as u } from "../esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/metadata-entry-display.js";
|
|
12
|
+
import { Status as d, Text as f, Tooltip as p } from "@box/blueprint-web";
|
|
13
|
+
import { FormattedDate as m, useIntl as h } from "react-intl";
|
|
14
|
+
import { jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
15
|
+
import v from "clsx";
|
|
16
|
+
import { AlertCircle as y } from "@box/blueprint-web-assets/icons/Medium";
|
|
17
|
+
import '../styles/metadata-instance-entry.css';var b = {
|
|
16
18
|
metadataInstanceEntry: "_metadataInstanceEntry_fr9av_1",
|
|
17
19
|
name: "_name_fr9av_6",
|
|
18
20
|
labelContainer: "_labelContainer_fr9av_14",
|
|
19
21
|
confidenceScoreIcon: "_confidenceScoreIcon_fr9av_20"
|
|
20
|
-
},
|
|
21
|
-
let
|
|
22
|
+
}, x = ({ description: x, isSelected: S, name: C, onClick: w, shouldHideEmptyValues: T, type: E, value: D, taxonomyNodeFetcher: O, taxonomyKey: k, scope: A, isExternallyOwned: j, confidenceScore: M, isConfidenceScoreReviewEnabled: N = !1, targetLocation: P }) => {
|
|
23
|
+
let F = h(), { trackEvent: I } = n(), L = N && !!M && a(M), R = r(P), z = N && !!M && R && !!w, B = L ? i(F.formatMessage, M) : null, V = () => I(t.LOW_CONF_ICON_HOVER_READ_MODE, {
|
|
24
|
+
fieldType: E,
|
|
25
|
+
confidenceLevel: M?.level,
|
|
26
|
+
scope: A
|
|
27
|
+
}), H = typeof D == "number" ? D.toString() : D ? Array.isArray(D) ? D.join(", ") : E === "date" && typeof D == "string" ? /* @__PURE__ */ g(m, {
|
|
22
28
|
day: "numeric",
|
|
23
29
|
month: "long",
|
|
24
|
-
value:
|
|
30
|
+
value: s(D),
|
|
25
31
|
year: "numeric"
|
|
26
|
-
}) :
|
|
32
|
+
}) : D : null, U = {
|
|
27
33
|
"data-metadata-field": !0,
|
|
34
|
+
"data-target-id": "Button-metadataEditorFieldReadClick",
|
|
28
35
|
"data-testid": "metadata-field",
|
|
29
|
-
onClick:
|
|
36
|
+
onClick: w,
|
|
30
37
|
onKeyDown: (e) => {
|
|
31
|
-
e.key === "Enter" && (e.preventDefault(), e.stopPropagation(),
|
|
38
|
+
e.key === "Enter" && (e.preventDefault(), e.stopPropagation(), w?.());
|
|
32
39
|
},
|
|
33
40
|
role: "button",
|
|
34
41
|
tabIndex: 0
|
|
35
42
|
};
|
|
36
|
-
if (
|
|
37
|
-
let
|
|
38
|
-
className:
|
|
39
|
-
...
|
|
40
|
-
children: [/* @__PURE__ */
|
|
41
|
-
className:
|
|
42
|
-
children: [
|
|
43
|
-
content:
|
|
44
|
-
children: /* @__PURE__ */
|
|
45
|
-
className:
|
|
46
|
-
children: /* @__PURE__ */
|
|
43
|
+
if (T && !H) return null;
|
|
44
|
+
let W = /* @__PURE__ */ _("div", {
|
|
45
|
+
className: v(b.metadataInstanceEntry, N && o.spacious, z && o.clickableField, z && S && o.selectedField),
|
|
46
|
+
...z && U,
|
|
47
|
+
children: [/* @__PURE__ */ _("div", {
|
|
48
|
+
className: b.labelContainer,
|
|
49
|
+
children: [B && /* @__PURE__ */ g(p, {
|
|
50
|
+
content: B,
|
|
51
|
+
children: /* @__PURE__ */ g("span", {
|
|
52
|
+
className: b.confidenceScoreIcon,
|
|
53
|
+
children: /* @__PURE__ */ g(d, {
|
|
54
|
+
"data-target-id": "Status-metadataInstanceEntryConfidenceScoreIcon",
|
|
47
55
|
color: "SurfaceStatusSurfaceGray",
|
|
48
56
|
hideText: !0,
|
|
49
|
-
icon:
|
|
57
|
+
icon: y,
|
|
50
58
|
interactive: !0,
|
|
51
|
-
text:
|
|
59
|
+
text: F.formatMessage(l.confidenceScoreIconAriaLabel),
|
|
60
|
+
onMouseEnter: V
|
|
52
61
|
})
|
|
53
62
|
})
|
|
54
|
-
}), /* @__PURE__ */
|
|
63
|
+
}), /* @__PURE__ */ g(f, {
|
|
55
64
|
as: "h5",
|
|
56
65
|
color: "textOnLightSecondary",
|
|
57
66
|
variant: "bodyDefaultBold",
|
|
58
|
-
className:
|
|
59
|
-
children:
|
|
67
|
+
className: b.name,
|
|
68
|
+
children: x ? /* @__PURE__ */ g(c, {
|
|
60
69
|
as: "span",
|
|
61
70
|
color: "textOnLightSecondary",
|
|
62
|
-
tooltipText:
|
|
71
|
+
tooltipText: x,
|
|
63
72
|
variant: "bodyDefaultBold",
|
|
64
|
-
children:
|
|
65
|
-
}) :
|
|
73
|
+
children: C
|
|
74
|
+
}) : C
|
|
66
75
|
})]
|
|
67
|
-
}), /* @__PURE__ */
|
|
68
|
-
formattedValue:
|
|
69
|
-
isExternallyOwned:
|
|
70
|
-
scope:
|
|
71
|
-
taxonomyKey:
|
|
72
|
-
taxonomyNodeFetcher:
|
|
73
|
-
type:
|
|
74
|
-
value:
|
|
76
|
+
}), /* @__PURE__ */ g(u, {
|
|
77
|
+
formattedValue: H,
|
|
78
|
+
isExternallyOwned: j,
|
|
79
|
+
scope: A,
|
|
80
|
+
taxonomyKey: k,
|
|
81
|
+
taxonomyNodeFetcher: O,
|
|
82
|
+
type: E,
|
|
83
|
+
value: D
|
|
75
84
|
})]
|
|
76
85
|
});
|
|
77
|
-
return
|
|
78
|
-
content:
|
|
79
|
-
children:
|
|
80
|
-
}) :
|
|
86
|
+
return z ? /* @__PURE__ */ g(p, {
|
|
87
|
+
content: F.formatMessage(e.viewOnDocument),
|
|
88
|
+
children: W
|
|
89
|
+
}) : W;
|
|
81
90
|
};
|
|
82
|
-
export {
|
|
91
|
+
export { x as t };
|
|
@@ -8,8 +8,8 @@ import { forwardRef as p, useEffect as m, useMemo as h, useState as g } from "re
|
|
|
8
8
|
import { useIntl as _ } from "react-intl";
|
|
9
9
|
import { BoxAiAdvancedLogo24 as v, BoxAiLogo24 as y } from "@box/blueprint-web-assets/icons/Logo";
|
|
10
10
|
import { jsx as b, jsxs as x } from "react/jsx-runtime";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
11
|
+
import { getIn as S, useFormikContext as C } from "formik";
|
|
12
|
+
import { useLocalStorageAIAgents as w } from "@box/box-ai-agent-selector";
|
|
13
13
|
import '../styles/metadata-instance-form-autofill-button.css';var T = {
|
|
14
14
|
loadingIndicator: "_loadingIndicator_i1hyy_1",
|
|
15
15
|
actionMenuItem: "_actionMenuItem_i1hyy_11",
|
|
@@ -51,10 +51,10 @@ import '../styles/metadata-instance-form-autofill-button.css';var T = {
|
|
|
51
51
|
})
|
|
52
52
|
});
|
|
53
53
|
}), D = ({ areAiSuggestionsAvailable: s, isBetaLanguageEnabled: u, isLoading: d, variant: p = "secondary-button", isAdvancedExtractAgentEnabled: g = !1, onAutofill: x }) => {
|
|
54
|
-
let { isSubmitting: D, values: O, setFieldValue: k } =
|
|
54
|
+
let { isSubmitting: D, values: O, setFieldValue: k } = C(), A = _(), [j, M] = w(t), { suggestions: N, confidenceScores: P, targetLocations: F } = i();
|
|
55
55
|
m(() => {
|
|
56
56
|
if (N) {
|
|
57
|
-
let e =
|
|
57
|
+
let e = S(O, "metadata.fields"), t = S(O, "metadata.templateKey");
|
|
58
58
|
k("metadata.fields", e?.map((e) => {
|
|
59
59
|
let n = N?.[t]?.[e.key];
|
|
60
60
|
return n ? {
|
|
@@ -72,7 +72,7 @@ import '../styles/metadata-instance-form-autofill-button.css';var T = {
|
|
|
72
72
|
k
|
|
73
73
|
]);
|
|
74
74
|
let I = (t) => {
|
|
75
|
-
let n =
|
|
75
|
+
let n = S(O, "metadata.templateKey"), r = S(O, "metadata.scope"), i = t ? e[t]?.AGENT_ID : e[j]?.AGENT_ID;
|
|
76
76
|
x(n, r, g ? i : void 0);
|
|
77
77
|
}, L = !s || D || d, R = j === "enhanced" && g ? v : y, z = h(() => r(g, j, A), [
|
|
78
78
|
g,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TEMPLATE_CUSTOM_PROPERTIES as e } from "../esm/lib/constants.js";
|
|
2
|
-
import { t } from "./metadata-instance-form-
|
|
3
|
-
import { t as n } from "./metadata-instance-form-
|
|
4
|
-
import { t as r } from "./metadata-instance-form-
|
|
2
|
+
import { t } from "./metadata-instance-form-ai-disclaimer.js";
|
|
3
|
+
import { t as n } from "./metadata-instance-form-footer.js";
|
|
4
|
+
import { t as r } from "./metadata-instance-form-header.js";
|
|
5
5
|
import { Card as i, useBlueprintModernization as a } from "@box/blueprint-web";
|
|
6
6
|
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
7
7
|
import c from "clsx";
|
|
@@ -21,7 +21,7 @@ import '../styles/metadata-instance-form-card-wrapper.css';var l = {
|
|
|
21
21
|
ref: m,
|
|
22
22
|
className: c(p, { [l.suggestionsFetching]: T }),
|
|
23
23
|
children: [
|
|
24
|
-
/* @__PURE__ */ o(
|
|
24
|
+
/* @__PURE__ */ o(r, {
|
|
25
25
|
areAiSuggestionsAvailable: d,
|
|
26
26
|
hasSuggestions: N,
|
|
27
27
|
isAdvancedExtractAgentEnabled: g,
|
|
@@ -36,12 +36,12 @@ import '../styles/metadata-instance-form-card-wrapper.css';var l = {
|
|
|
36
36
|
templateName: D?.displayName
|
|
37
37
|
}),
|
|
38
38
|
D && f,
|
|
39
|
-
/* @__PURE__ */ o(
|
|
39
|
+
/* @__PURE__ */ o(t, {
|
|
40
40
|
isLoading: T,
|
|
41
41
|
isConfidenceScoreReviewEnabled: y,
|
|
42
42
|
fields: h.metadata?.fields ?? []
|
|
43
43
|
}),
|
|
44
|
-
/* @__PURE__ */ o(
|
|
44
|
+
/* @__PURE__ */ o(n, {
|
|
45
45
|
isDeleteButtonDisabled: x,
|
|
46
46
|
isLoading: T,
|
|
47
47
|
onCancel: () => k(E),
|
|
@@ -28,12 +28,12 @@ import '../styles/metadata-instance-form-footer.css';var s = {
|
|
|
28
28
|
"data-target-id": "Button-cancelButton",
|
|
29
29
|
children: f.formatMessage(e.cancelButton)
|
|
30
30
|
}), /* @__PURE__ */ i(t, {
|
|
31
|
+
"data-target-id": "Button-metadataEditorSave",
|
|
31
32
|
disabled: h,
|
|
32
33
|
loading: p,
|
|
33
34
|
loadingAriaLabel: f.formatMessage(e.loadingAriaLabel),
|
|
34
35
|
onClick: m,
|
|
35
36
|
size: "large",
|
|
36
|
-
"data-target-id": "Button-saveButton",
|
|
37
37
|
children: f.formatMessage(e.saveButton)
|
|
38
38
|
})]
|
|
39
39
|
})]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { getFieldsNeedingReview as e } from "../esm/lib/utils/confidence-score/get-fields-needing-review.js";
|
|
2
|
+
import { t } from "./interactive-header-text.js";
|
|
3
|
+
import { MetadataInstanceReviewNotice as n } from "../esm/lib/components/metadata-instance-review-notice/metadata-instance-review-notice.js";
|
|
4
|
+
import { t as r } from "./metadata-instance-form-autofill-button.js";
|
|
5
5
|
import { MetadataInstanceFormInlineNotice as i } from "../esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-inline-notice/metadata-instance-form-inline-notice.js";
|
|
6
6
|
import a from "../esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-header/messages.js";
|
|
7
7
|
import { useMemo as o } from "react";
|
|
@@ -13,16 +13,16 @@ import '../styles/metadata-instance-form-header.css';var d = {
|
|
|
13
13
|
metadataInstanceFormHeader: "_metadataInstanceFormHeader_3nbmr_1",
|
|
14
14
|
title: "_title_3nbmr_15"
|
|
15
15
|
}, f = ({ areAiSuggestionsAvailable: f, hasSuggestions: p, isAdvancedExtractAgentEnabled: m = !1, isAiSuggestionsFeatureEnabled: h, isBetaLanguageEnabled: g, isConfidenceScoreReviewEnabled: _ = !1, isLargeFile: v, isLoading: y, onToggleReviewFilter: b, shouldShowOnlyReviewFields: x = !1, templateName: S, onAutofill: C }) => {
|
|
16
|
-
let w = s(), { values: T } = u(), E = o(() => _ ?
|
|
16
|
+
let w = s(), { values: T } = u(), E = o(() => _ ? e(T.metadata?.fields ?? []).length : 0, [T.metadata?.fields, _]), D = S ?? w.formatMessage(a.customInstanceTitle), O = p && f, k = _ && !y && (E > 0 || x) && b !== void 0;
|
|
17
17
|
return /* @__PURE__ */ l("div", {
|
|
18
18
|
className: d.metadataInstanceFormHeaderWrapper,
|
|
19
19
|
children: [
|
|
20
20
|
/* @__PURE__ */ l("div", {
|
|
21
21
|
className: d.metadataInstanceFormHeader,
|
|
22
|
-
children: [/* @__PURE__ */ c(
|
|
22
|
+
children: [/* @__PURE__ */ c(t, {
|
|
23
23
|
className: d.title,
|
|
24
24
|
title: D
|
|
25
|
-
}), h ? /* @__PURE__ */ c(
|
|
25
|
+
}), h ? /* @__PURE__ */ c(r, {
|
|
26
26
|
areAiSuggestionsAvailable: f,
|
|
27
27
|
isAdvancedExtractAgentEnabled: m,
|
|
28
28
|
isBetaLanguageEnabled: g,
|
|
@@ -34,7 +34,7 @@ import '../styles/metadata-instance-form-header.css';var d = {
|
|
|
34
34
|
isBetaLanguageEnabled: g,
|
|
35
35
|
isLargeFile: v
|
|
36
36
|
}),
|
|
37
|
-
k && /* @__PURE__ */ c(
|
|
37
|
+
k && /* @__PURE__ */ c(n, {
|
|
38
38
|
fieldsNeedingReviewCount: E,
|
|
39
39
|
isLowScoreFilteringEnabled: x,
|
|
40
40
|
onTextToggleClick: b
|
|
@@ -8,14 +8,14 @@ import { useMemo as c } from "react";
|
|
|
8
8
|
import { useIntl as l } from "react-intl";
|
|
9
9
|
import { BoxAiAdvancedLogo24 as u, BoxAiLogo24 as d } from "@box/blueprint-web-assets/icons/Logo";
|
|
10
10
|
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
11
|
+
import { Pencil as m } from "@box/blueprint-web-assets/icons/Line";
|
|
12
|
+
import { useLocalStorageAIAgents as h } from "@box/box-ai-agent-selector";
|
|
13
13
|
import '../styles/metadata-instance-header.css';var g = {
|
|
14
14
|
metadataInstanceHeader: "_metadataInstanceHeader_17bsu_1",
|
|
15
15
|
iconButtonsContainer: "_iconButtonsContainer_17bsu_6",
|
|
16
16
|
title: "_title_17bsu_14"
|
|
17
17
|
}, _ = ({ areAiSuggestionsAvailable: _, canEdit: v, isAiSuggestionsFeatureEnabled: y, isBetaLanguageEnabled: b, onEdit: x, onAutofill: S, templateName: C, isAdvancedExtractAgentEnabled: w = !1 }) => {
|
|
18
|
-
let T = l(), E = C || T.formatMessage(a.customInstanceTitle), D = y && C, [O] =
|
|
18
|
+
let T = l(), E = C || T.formatMessage(a.customInstanceTitle), D = y && C, [O] = h(t), k = w && e[O]?.AGENT_ID, A = c(() => r(w, O, T), [
|
|
19
19
|
w,
|
|
20
20
|
O,
|
|
21
21
|
T
|
|
@@ -41,7 +41,7 @@ import '../styles/metadata-instance-header.css';var g = {
|
|
|
41
41
|
content: T.formatMessage(a.editButtonTooltip),
|
|
42
42
|
children: /* @__PURE__ */ f(o, {
|
|
43
43
|
"aria-label": T.formatMessage(a.editButtonAriaLabel, { templateName: C }),
|
|
44
|
-
icon:
|
|
44
|
+
icon: m,
|
|
45
45
|
onClick: x,
|
|
46
46
|
"data-target-id": "IconButton-editButtonAriaLabel"
|
|
47
47
|
})
|
package/dist/esm/index.js
CHANGED
|
@@ -7,21 +7,18 @@ import { t as r } from "../chunks/filter-instances-dropdown.js";
|
|
|
7
7
|
import "./lib/components/filter-instances-dropdown/index.js";
|
|
8
8
|
import { MULTI_VALUE_DEFAULT_OPTION as i, MULTI_VALUE_DEFAULT_TAXONOMY_OPTION as a, MULTI_VALUE_DEFAULT_VALUE as o } from "./lib/components/metadata-editor-fields/components/update-mode-field-wrapper/mulitple-values-utils.js";
|
|
9
9
|
import { MetadataEmptyState as s } from "./lib/components/metadata-empty-state/metadata-empty-state.js";
|
|
10
|
-
import {
|
|
11
|
-
import { t as
|
|
12
|
-
import {
|
|
13
|
-
import { t as
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import { MetadataInstanceForm as x } from "./lib/components/metadata-instance-editor/
|
|
19
|
-
import "
|
|
20
|
-
import {
|
|
21
|
-
import { t as C } from "../chunks/metadata-instance-header.js";
|
|
22
|
-
import { t as w } from "../chunks/metadata-instance.js";
|
|
23
|
-
import "./lib/components/metadata-instance-list/index.js";
|
|
10
|
+
import { AutofillContext as c, AutofillContextProvider as l, TIMEOUT_10_SECONDS as u, useAutofill as d } from "./lib/utils/autofill-context.js";
|
|
11
|
+
import { n as f, r as p, t as m } from "../chunks/types.js";
|
|
12
|
+
import { UnsavedChangesModal as h } from "./lib/components/unsaved-changes-modal/unsaved-changes-modal.js";
|
|
13
|
+
import { t as g } from "../chunks/custom-instance-new-field.js";
|
|
14
|
+
import { t as _ } from "../chunks/delete-confirmation-modal.js";
|
|
15
|
+
import { r as v } from "../chunks/utils2.js";
|
|
16
|
+
import { t as y } from "../chunks/metadata-instance-form-autofill-button.js";
|
|
17
|
+
import { t as b } from "../chunks/metadata-instance-form-header.js";
|
|
18
|
+
import { MetadataInstanceForm as x } from "./lib/components/metadata-instance-editor/index.js";
|
|
19
|
+
import { t as S } from "../chunks/metadata-instance-header.js";
|
|
20
|
+
import { MetadataInstance as C, MetadataInstanceList as w } from "./lib/components/metadata-instance-list/index.js";
|
|
24
21
|
import { defaultInitialValues as T, defaultMetadataValueMap as E } from "./lib/defaults.js";
|
|
25
22
|
import { t as D } from "../chunks/metadata-editor.js";
|
|
26
23
|
import { withApiWrapper as O } from "./lib/utils/api-wrapper.js";
|
|
27
|
-
export { t as AddMetadataTemplateDropdown,
|
|
24
|
+
export { t as AddMetadataTemplateDropdown, m as AiSuggestionState, c as AutofillContext, l as AutofillContextProvider, n as ComboboxWithApiPagination, f as ConfidenceLevel, g as CustomInstanceNewField, _ as DeleteConfirmationModal, e as FilterDropdownMenu, r as FilterInstancesDropdown, v as JSONPatchOp, i as MULTI_VALUE_DEFAULT_OPTION, a as MULTI_VALUE_DEFAULT_TAXONOMY_OPTION, o as MULTI_VALUE_DEFAULT_VALUE, D as MetadataEditor, s as MetadataEmptyState, C as MetadataInstance, x as MetadataInstanceForm, y as MetadataInstanceFormAutofillButton, b as MetadataInstanceFormHeader, S as MetadataInstanceHeader, w as MetadataInstanceList, u as TIMEOUT_10_SECONDS, h as UnsavedChangesModal, p as UpdateMode, T as defaultInitialValues, E as defaultMetadataValueMap, d as useAutofill, O as withApiWrapper };
|
package/dist/esm/lib/components/metadata-editor-fields/components/ai-logo-badge/ai-logo-badge.js
CHANGED
|
@@ -1,21 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { EVENT_NAMES as e } from "../../../../utils/analytics/events.js";
|
|
2
|
+
import { useMetadataEditorAnalytics as t } from "../../../../utils/analytics/analytics-context.js";
|
|
3
|
+
import { getConfidenceScoreTooltip as n } from "../../../../utils/confidence-score/get-confidence-score-tooltip.js";
|
|
4
|
+
import { Status as r, Tooltip as i } from "@box/blueprint-web";
|
|
5
|
+
import { useIntl as a } from "react-intl";
|
|
6
|
+
import { BoxAiLogo as o } from "@box/blueprint-web-assets/icons/Logo";
|
|
7
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
8
|
+
import { SurfaceStatusSurfaceGray as c } from "@box/blueprint-web-assets/tokens/tokens";
|
|
9
|
+
function l({ confidenceScore: l, className: u }) {
|
|
10
|
+
let { formatMessage: d } = a(), { trackEvent: f } = t();
|
|
11
|
+
return l ? /* @__PURE__ */ s(i, {
|
|
12
|
+
content: n(d, l),
|
|
13
|
+
children: /* @__PURE__ */ s(r, {
|
|
12
14
|
hideText: !0,
|
|
13
|
-
icon:
|
|
15
|
+
icon: o,
|
|
14
16
|
interactive: !0,
|
|
15
17
|
text: "",
|
|
16
|
-
color:
|
|
17
|
-
"data-testid": "ai-confidence-badge"
|
|
18
|
+
color: c,
|
|
19
|
+
"data-testid": "ai-confidence-badge",
|
|
20
|
+
onMouseEnter: () => f(e.AI_LOGO_BADGE_HOVER, { confidenceLevel: l?.level })
|
|
18
21
|
})
|
|
19
|
-
}) : /* @__PURE__ */
|
|
22
|
+
}) : /* @__PURE__ */ s(o, { className: u });
|
|
20
23
|
}
|
|
21
|
-
export {
|
|
24
|
+
export { l as AiLogoBadge };
|