@box/box-ai-content-answers 0.121.4 → 0.122.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/answer/answer.js +49 -47
- package/dist/esm/lib/components/answer/feedback-tooltip.js +28 -27
- package/dist/esm/lib/components/answer/thumb-buttons.js +53 -50
- package/dist/esm/lib/components/chat/chat.js +52 -50
- package/dist/types/lib/components/answer/answer.d.ts +2 -0
- package/dist/types/lib/components/answer/feedback-tooltip.d.ts +2 -1
- package/dist/types/lib/components/answer/thumb-buttons.d.ts +2 -1
- package/dist/types/lib/components/chat/chat.d.ts +1 -1
- package/dist/types/lib/types.d.ts +5 -3
- package/package.json +1 -1
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { Text as
|
|
2
|
-
import { AlertTriangle as
|
|
3
|
-
import { Gray65 as
|
|
1
|
+
import { Text as V } from "@box/blueprint-web";
|
|
2
|
+
import { AlertTriangle as k } from "@box/blueprint-web-assets/icons/Line";
|
|
3
|
+
import { Gray65 as j, Size4 as E } from "@box/blueprint-web-assets/tokens/tokens";
|
|
4
4
|
import p from "clsx";
|
|
5
5
|
import * as l from "react";
|
|
6
|
-
import { useIntl as
|
|
6
|
+
import { useIntl as z } from "react-intl";
|
|
7
7
|
import { A as n } from "../../../../chunks/types.js";
|
|
8
8
|
import { MediaContainer as N } from "../common/media-container.js";
|
|
9
|
-
import { AnswerContent as
|
|
10
|
-
import { CopyButton as
|
|
11
|
-
import { InlineError as
|
|
12
|
-
import { ThumbButtons as
|
|
13
|
-
import { LoadingIndicator as
|
|
9
|
+
import { AnswerContent as W } from "./answer-content.js";
|
|
10
|
+
import { CopyButton as q } from "./copy-button.js";
|
|
11
|
+
import { InlineError as J } from "./inline-error.js";
|
|
12
|
+
import { ThumbButtons as K } from "./thumb-buttons.js";
|
|
13
|
+
import { LoadingIndicator as Q } from "./loading-indicator.js";
|
|
14
14
|
import m from "./messages.js";
|
|
15
|
-
import { References as
|
|
15
|
+
import { References as X } from "./references.js";
|
|
16
16
|
import { jsxs as a, jsx as e } from "react/jsx-runtime";
|
|
17
|
-
import '../../../../styles/answer.css';const
|
|
18
|
-
answer:
|
|
19
|
-
alertIcon:
|
|
20
|
-
error:
|
|
21
|
-
footer:
|
|
22
|
-
copyButtonContainer:
|
|
23
|
-
feedbackButtonsContainer:
|
|
24
|
-
shouldHaveMarginTop:
|
|
25
|
-
shouldUseAnimation:
|
|
26
|
-
shouldAnimateHeight:
|
|
27
|
-
footerButtons:
|
|
28
|
-
iconAvatar:
|
|
29
|
-
buttonsVisible:
|
|
30
|
-
},
|
|
17
|
+
import '../../../../styles/answer.css';const Y = "_answer_140hd_1", Z = "_alertIcon_140hd_5", $ = "_error_140hd_8", tt = "_footer_140hd_12", ot = "_copyButtonContainer_140hd_18", et = "_feedbackButtonsContainer_140hd_19", nt = "_shouldHaveMarginTop_140hd_23", st = "_shouldUseAnimation_140hd_26", rt = "_shouldAnimateHeight_140hd_30", at = "_footerButtons_140hd_34", it = "_iconAvatar_140hd_40", dt = "_buttonsVisible_140hd_56", t = {
|
|
18
|
+
answer: Y,
|
|
19
|
+
alertIcon: Z,
|
|
20
|
+
error: $,
|
|
21
|
+
footer: tt,
|
|
22
|
+
copyButtonContainer: ot,
|
|
23
|
+
feedbackButtonsContainer: et,
|
|
24
|
+
shouldHaveMarginTop: nt,
|
|
25
|
+
shouldUseAnimation: st,
|
|
26
|
+
shouldAnimateHeight: rt,
|
|
27
|
+
footerButtons: at,
|
|
28
|
+
iconAvatar: it,
|
|
29
|
+
buttonsVisible: dt
|
|
30
|
+
}, ct = /* @__PURE__ */ new Set([n.RATE_LIMITING, n.NO_CONTENT, n.PRECONDITION_FAILED, n.GENERAL, n.AGENT_NOT_FOUND]), Ot = /* @__PURE__ */ l.memo(({
|
|
31
31
|
answer: s,
|
|
32
32
|
citations: I,
|
|
33
33
|
error: o,
|
|
@@ -47,38 +47,39 @@ import '../../../../styles/answer.css';const X = "_answer_140hd_1", Y = "_alertI
|
|
|
47
47
|
onFeedbackFormSubmit: v,
|
|
48
48
|
onFeedbackTooltipOpenChange: M,
|
|
49
49
|
recordAction: d,
|
|
50
|
-
|
|
50
|
+
shouldFeedbackFormIncludeFeedbackText: y,
|
|
51
|
+
useAnimation: D = !0,
|
|
51
52
|
variant: r = "modal",
|
|
52
|
-
setAnswerFeedback:
|
|
53
|
-
questionId:
|
|
53
|
+
setAnswerFeedback: H,
|
|
54
|
+
questionId: L
|
|
54
55
|
}) => {
|
|
55
|
-
const _ =
|
|
56
|
+
const _ = ct.has(o), h = b && !s && !o, [U, x] = l.useState(i), {
|
|
56
57
|
formatMessage: c
|
|
57
|
-
} =
|
|
58
|
+
} = z();
|
|
58
59
|
l.useEffect(() => {
|
|
59
|
-
setTimeout(() =>
|
|
60
|
+
setTimeout(() => x(i), 0);
|
|
60
61
|
}, [i]);
|
|
61
|
-
const f = () => /* @__PURE__ */ e(
|
|
62
|
+
const f = () => /* @__PURE__ */ e(k, {
|
|
62
63
|
className: t.alertIcon,
|
|
63
|
-
color:
|
|
64
|
+
color: j,
|
|
64
65
|
"data-testid": "content-answers-error-alert-icon",
|
|
65
66
|
height: E,
|
|
66
67
|
role: "presentation",
|
|
67
68
|
width: E
|
|
68
|
-
}),
|
|
69
|
+
}), F = () => /* @__PURE__ */ a(V, {
|
|
69
70
|
as: "p",
|
|
70
71
|
className: t.error,
|
|
71
72
|
color: "textOnLightSecondary",
|
|
72
73
|
"data-testid": "content-answers-error",
|
|
73
74
|
variant: "caption",
|
|
74
75
|
children: [o === n.RESPONSE_INTERRUPTED && c(m.responseInterruptedError), o === n.RESPONSE_FAILED && c(m.responseFailedError), o === n.RESPONSE_STOPPED && c(m.responseStoppedError), o !== n.RESPONSE_STOPPED && f()]
|
|
75
|
-
}),
|
|
76
|
+
}), G = () => o !== n.RESPONSE_STOPPED ? /* @__PURE__ */ a("div", {
|
|
76
77
|
className: p(t.footerButtons, "footer-buttons-container", {
|
|
77
78
|
[t.buttonsVisible]: u
|
|
78
79
|
}),
|
|
79
80
|
children: [g ? /* @__PURE__ */ e("div", {
|
|
80
81
|
className: t.feedbackButtonsContainer,
|
|
81
|
-
children: /* @__PURE__ */ e(
|
|
82
|
+
children: /* @__PURE__ */ e(K, {
|
|
82
83
|
feedbackValue: T,
|
|
83
84
|
hostAppName: A,
|
|
84
85
|
isFeedbackFormEnabled: O,
|
|
@@ -86,14 +87,15 @@ import '../../../../styles/answer.css';const X = "_answer_140hd_1", Y = "_alertI
|
|
|
86
87
|
items: B,
|
|
87
88
|
onFeedbackFormSubmit: v,
|
|
88
89
|
onFeedbackTooltipOpenChange: M,
|
|
89
|
-
questionId:
|
|
90
|
+
questionId: L,
|
|
90
91
|
recordAction: d,
|
|
91
|
-
setAnswerFeedback:
|
|
92
|
+
setAnswerFeedback: H,
|
|
93
|
+
shouldFeedbackFormIncludeFeedbackText: y,
|
|
92
94
|
variant: r
|
|
93
95
|
})
|
|
94
96
|
}) : null, /* @__PURE__ */ e("div", {
|
|
95
97
|
className: t.copyButtonContainer,
|
|
96
|
-
children: /* @__PURE__ */ e(
|
|
98
|
+
children: /* @__PURE__ */ e(q, {
|
|
97
99
|
answer: s,
|
|
98
100
|
onAnswerCopy: P,
|
|
99
101
|
recordAction: d
|
|
@@ -104,31 +106,31 @@ import '../../../../styles/answer.css';const X = "_answer_140hd_1", Y = "_alertI
|
|
|
104
106
|
"aria-live": "polite",
|
|
105
107
|
className: t.answer,
|
|
106
108
|
"data-testid": "content-answers-answer",
|
|
107
|
-
children: [h && /* @__PURE__ */ e(
|
|
109
|
+
children: [h && /* @__PURE__ */ e(Q, {}), !_ && !h && /* @__PURE__ */ e(N, {
|
|
108
110
|
className: "answer",
|
|
109
111
|
variant: r,
|
|
110
112
|
children: /* @__PURE__ */ a(N.Content, {
|
|
111
113
|
isUsedInsideSidebar: r === "sidebar",
|
|
112
114
|
variant: "answer",
|
|
113
|
-
children: [/* @__PURE__ */ e(
|
|
115
|
+
children: [/* @__PURE__ */ e(W, {
|
|
114
116
|
answer: s,
|
|
115
117
|
isMarkdownEnabled: w,
|
|
116
118
|
variant: r
|
|
117
119
|
}), i && /* @__PURE__ */ a("div", {
|
|
118
120
|
className: p(t.footer, {
|
|
119
121
|
[t.shouldHaveMarginTop]: s,
|
|
120
|
-
[t.shouldAnimateHeight]:
|
|
121
|
-
[t.shouldUseAnimation]:
|
|
122
|
+
[t.shouldAnimateHeight]: U,
|
|
123
|
+
[t.shouldUseAnimation]: D
|
|
122
124
|
}),
|
|
123
125
|
"data-testid": "content-answers-answer-footer",
|
|
124
|
-
children: [o &&
|
|
126
|
+
children: [o && F(), R && !o && /* @__PURE__ */ e(X, {
|
|
125
127
|
citations: I,
|
|
126
128
|
onCitationClick: C,
|
|
127
129
|
recordAction: d
|
|
128
|
-
}),
|
|
130
|
+
}), G()]
|
|
129
131
|
})]
|
|
130
132
|
})
|
|
131
|
-
}), _ && /* @__PURE__ */ e(
|
|
133
|
+
}), _ && /* @__PURE__ */ e(J, {
|
|
132
134
|
contentType: S,
|
|
133
135
|
error: o,
|
|
134
136
|
recordAction: d,
|
|
@@ -137,6 +139,6 @@ import '../../../../styles/answer.css';const X = "_answer_140hd_1", Y = "_alertI
|
|
|
137
139
|
});
|
|
138
140
|
});
|
|
139
141
|
export {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
+
Ot as Answer,
|
|
143
|
+
Ot as default
|
|
142
144
|
};
|
|
@@ -1,54 +1,55 @@
|
|
|
1
|
-
import { Formik as
|
|
2
|
-
import { GuidedTooltip as t, Radio as l, TextArea as
|
|
3
|
-
import { useIntl as
|
|
1
|
+
import { Formik as F, Form as I } from "formik";
|
|
2
|
+
import { GuidedTooltip as t, Radio as l, TextArea as x } from "@box/blueprint-web";
|
|
3
|
+
import { useIntl as S } from "react-intl";
|
|
4
4
|
import { F as d } from "../../../../chunks/types.js";
|
|
5
|
-
import
|
|
5
|
+
import g from "../../messages.js";
|
|
6
6
|
import a from "./messages.js";
|
|
7
|
-
import { jsx as o, jsxs as i, Fragment as
|
|
8
|
-
import '../../../../styles/feedback-tooltip.css';const
|
|
9
|
-
feedbackTooltip:
|
|
10
|
-
feedbackTooltipTitle:
|
|
11
|
-
feedbackTooltipTextarea:
|
|
12
|
-
feedbackTooltipSubmitBtn:
|
|
13
|
-
},
|
|
7
|
+
import { jsx as o, jsxs as i, Fragment as A } from "react/jsx-runtime";
|
|
8
|
+
import '../../../../styles/feedback-tooltip.css';const v = "_feedbackTooltip_rsbqj_1", C = "_feedbackTooltipTitle_rsbqj_4", N = "_feedbackTooltipTextarea_rsbqj_7", R = "_feedbackTooltipSubmitBtn_rsbqj_10", c = {
|
|
9
|
+
feedbackTooltip: v,
|
|
10
|
+
feedbackTooltipTitle: C,
|
|
11
|
+
feedbackTooltipTextarea: N,
|
|
12
|
+
feedbackTooltipSubmitBtn: R
|
|
13
|
+
}, z = ({
|
|
14
14
|
children: b,
|
|
15
15
|
isOpen: f,
|
|
16
16
|
onOpenChange: n,
|
|
17
17
|
onSubmit: m,
|
|
18
|
-
|
|
18
|
+
shouldIncludeFeedbackText: k,
|
|
19
|
+
shouldShow: u
|
|
19
20
|
}) => {
|
|
20
21
|
const {
|
|
21
22
|
formatMessage: e
|
|
22
|
-
} =
|
|
23
|
-
if (!
|
|
23
|
+
} = S();
|
|
24
|
+
if (!u)
|
|
24
25
|
return b;
|
|
25
|
-
const
|
|
26
|
+
const _ = () => {
|
|
26
27
|
n(!1);
|
|
27
|
-
},
|
|
28
|
+
}, h = (s) => {
|
|
28
29
|
m(s);
|
|
29
30
|
};
|
|
30
31
|
return /* @__PURE__ */ o(t, {
|
|
31
32
|
className: c.feedbackTooltip,
|
|
32
|
-
closeLabel: e(
|
|
33
|
-
content: /* @__PURE__ */ o(
|
|
33
|
+
closeLabel: e(g.closeButtonText),
|
|
34
|
+
content: /* @__PURE__ */ o(F, {
|
|
34
35
|
initialValues: {
|
|
35
36
|
feedback: "",
|
|
36
37
|
issueType: ""
|
|
37
38
|
},
|
|
38
|
-
onSubmit:
|
|
39
|
+
onSubmit: h,
|
|
39
40
|
children: ({
|
|
40
41
|
submitForm: s,
|
|
41
42
|
setFieldValue: T,
|
|
42
43
|
values: {
|
|
43
|
-
feedback:
|
|
44
|
+
feedback: y,
|
|
44
45
|
issueType: p
|
|
45
46
|
}
|
|
46
|
-
}) => /* @__PURE__ */ i(
|
|
47
|
+
}) => /* @__PURE__ */ i(A, {
|
|
47
48
|
children: [/* @__PURE__ */ i(t.Body, {
|
|
48
49
|
children: [/* @__PURE__ */ o(t.Title, {
|
|
49
50
|
className: c.feedbackTooltipTitle,
|
|
50
51
|
children: e(a.feedbackTooltipTitle)
|
|
51
|
-
}), /* @__PURE__ */ i(
|
|
52
|
+
}), /* @__PURE__ */ i(I, {
|
|
52
53
|
children: [/* @__PURE__ */ o(l.Legend, {
|
|
53
54
|
header: e(a.feedbackTooltipIssueTypeLabel),
|
|
54
55
|
children: /* @__PURE__ */ i(l.Group, {
|
|
@@ -69,19 +70,19 @@ import '../../../../styles/feedback-tooltip.css';const A = "_feedbackTooltip_rsb
|
|
|
69
70
|
value: d.OTHER
|
|
70
71
|
})]
|
|
71
72
|
})
|
|
72
|
-
}), /* @__PURE__ */ o(
|
|
73
|
+
}), k && /* @__PURE__ */ o(x, {
|
|
73
74
|
className: c.feedbackTooltipTextarea,
|
|
74
75
|
label: e(a.feedbackTooltipFeedbackLabel),
|
|
75
76
|
maxRows: 4,
|
|
76
77
|
minRows: 4,
|
|
77
78
|
onChange: (r) => T("feedback", r.target.value),
|
|
78
79
|
placeholder: e(a.feedbackTooltipFeedbackPlaceholder),
|
|
79
|
-
value:
|
|
80
|
+
value: y
|
|
80
81
|
})]
|
|
81
82
|
})]
|
|
82
83
|
}), /* @__PURE__ */ i(t.Footer, {
|
|
83
84
|
children: [/* @__PURE__ */ o(t.Footer.SecondaryAction, {
|
|
84
|
-
onClick:
|
|
85
|
+
onClick: _,
|
|
85
86
|
size: "large",
|
|
86
87
|
children: e(a.feedbackTooltipCancel)
|
|
87
88
|
}), /* @__PURE__ */ o(t.Footer.PrimaryAction, {
|
|
@@ -101,6 +102,6 @@ import '../../../../styles/feedback-tooltip.css';const A = "_feedbackTooltip_rsb
|
|
|
101
102
|
});
|
|
102
103
|
};
|
|
103
104
|
export {
|
|
104
|
-
|
|
105
|
-
|
|
105
|
+
z as FeedbackTooltip,
|
|
106
|
+
z as default
|
|
106
107
|
};
|
|
@@ -1,38 +1,39 @@
|
|
|
1
|
-
import { useNotification as
|
|
2
|
-
import { ThumbUp as
|
|
3
|
-
import { ThumbUp as
|
|
4
|
-
import
|
|
5
|
-
import { useIntl as
|
|
1
|
+
import { useNotification as v, Tooltip as T, IconButton as M } from "@box/blueprint-web";
|
|
2
|
+
import { ThumbUp as E, ThumbDown as I } from "@box/blueprint-web-assets/icons/Fill";
|
|
3
|
+
import { ThumbUp as S, ThumbDown as W } from "@box/blueprint-web-assets/icons/Line";
|
|
4
|
+
import c from "react";
|
|
5
|
+
import { useIntl as d } from "react-intl";
|
|
6
6
|
import { FeedbackTooltip as $ } from "./feedback-tooltip.js";
|
|
7
7
|
import { LOGGER_BASE_CONFIG as j, LOGGER_ACTION_PROGRAMMATIC as z } from "../common/constants.js";
|
|
8
|
-
import
|
|
8
|
+
import L from "../../messages.js";
|
|
9
9
|
import r from "./messages.js";
|
|
10
10
|
import { focusInput as A } from "../common/focusInputUtils.js";
|
|
11
|
-
import { jsxs as
|
|
12
|
-
import '../../../../styles/thumb-buttons.css';const
|
|
13
|
-
thumbDown:
|
|
11
|
+
import { jsxs as J, Fragment as K, jsx as f } from "react/jsx-runtime";
|
|
12
|
+
import '../../../../styles/thumb-buttons.css';const Q = "_thumbDown_1axcd_1", V = {
|
|
13
|
+
thumbDown: Q
|
|
14
14
|
}, u = {
|
|
15
15
|
THUMB_UP: "positive",
|
|
16
16
|
THUMB_DOWN: "negative",
|
|
17
17
|
NONE: "none"
|
|
18
|
-
},
|
|
19
|
-
feedbackValue:
|
|
20
|
-
hostAppName:
|
|
21
|
-
isFeedbackFormEnabled:
|
|
22
|
-
isFeedbackTooltipOpen:
|
|
23
|
-
items:
|
|
24
|
-
onFeedbackFormSubmit:
|
|
18
|
+
}, at = ({
|
|
19
|
+
feedbackValue: p,
|
|
20
|
+
hostAppName: _,
|
|
21
|
+
isFeedbackFormEnabled: w = !1,
|
|
22
|
+
isFeedbackTooltipOpen: y = !1,
|
|
23
|
+
items: e,
|
|
24
|
+
onFeedbackFormSubmit: D,
|
|
25
25
|
onFeedbackTooltipOpenChange: s,
|
|
26
26
|
questionId: a,
|
|
27
27
|
recordAction: i,
|
|
28
28
|
setAnswerFeedback: o,
|
|
29
|
+
shouldFeedbackFormIncludeFeedbackText: n = !1,
|
|
29
30
|
variant: B
|
|
30
31
|
}) => {
|
|
31
32
|
const {
|
|
32
33
|
formatMessage: m
|
|
33
|
-
} =
|
|
34
|
-
addNotification:
|
|
35
|
-
} =
|
|
34
|
+
} = d(), {
|
|
35
|
+
addNotification: N
|
|
36
|
+
} = v(), l = p, U = c.useMemo(() => e.filter((t) => t.status === "supported").map((t) => t.fileType), [e]), b = c.useCallback((t) => {
|
|
36
37
|
l !== t && (o == null || o(a, t), i == null || i({
|
|
37
38
|
...j,
|
|
38
39
|
action: z,
|
|
@@ -40,60 +41,62 @@ import '../../../../styles/thumb-buttons.css';const K = "_thumbDown_1axcd_1", Q
|
|
|
40
41
|
component: B,
|
|
41
42
|
data: {
|
|
42
43
|
feedback_value: t,
|
|
43
|
-
file_types:
|
|
44
|
-
feature:
|
|
44
|
+
file_types: U,
|
|
45
|
+
feature: _
|
|
45
46
|
}
|
|
46
47
|
}), A());
|
|
47
|
-
}, [
|
|
48
|
+
}, [_, i, l, B, U, a, o]), x = ({
|
|
48
49
|
feedback: t,
|
|
49
|
-
issueType:
|
|
50
|
+
issueType: R
|
|
50
51
|
}) => {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
hostApp:
|
|
56
|
-
issueType:
|
|
52
|
+
if (s == null || s(!1, a), !D)
|
|
53
|
+
return;
|
|
54
|
+
const h = {
|
|
55
|
+
fileTypes: U,
|
|
56
|
+
hostApp: _,
|
|
57
|
+
issueType: R,
|
|
57
58
|
timestamp: Date.now(),
|
|
58
59
|
questionId: a
|
|
59
|
-
}
|
|
60
|
-
|
|
60
|
+
};
|
|
61
|
+
n && (h.feedback = t, h.hasFeedback = !!t), D(h, () => {
|
|
62
|
+
N({
|
|
61
63
|
sensitivity: "foreground",
|
|
62
64
|
styledText: m(r.feedbackTooltipConfirmation),
|
|
63
65
|
variant: "success",
|
|
64
|
-
typeIconAriaLabel: m(
|
|
65
|
-
closeButtonAriaLabel: m(
|
|
66
|
+
typeIconAriaLabel: m(L.ariaTypeSuccessIconLabel),
|
|
67
|
+
closeButtonAriaLabel: m(L.closeButtonText)
|
|
66
68
|
});
|
|
67
|
-
})
|
|
68
|
-
},
|
|
69
|
+
});
|
|
70
|
+
}, H = (t) => {
|
|
69
71
|
t || s == null || s(!1, a);
|
|
70
|
-
},
|
|
71
|
-
|
|
72
|
-
}, [
|
|
73
|
-
return /* @__PURE__ */
|
|
72
|
+
}, G = c.useCallback(() => b(u.THUMB_UP), [b]), P = c.useCallback(() => {
|
|
73
|
+
b(u.THUMB_DOWN), s == null || s(!0, a);
|
|
74
|
+
}, [b, s, a]);
|
|
75
|
+
return /* @__PURE__ */ J(K, {
|
|
74
76
|
children: [/* @__PURE__ */ f(T, {
|
|
75
77
|
content: m(r.thumbsUpAriaLabel),
|
|
76
78
|
children: /* @__PURE__ */ f(M, {
|
|
77
79
|
"aria-label": m(r.thumbsUpAriaLabel),
|
|
78
80
|
disabled: l === u.THUMB_DOWN,
|
|
79
|
-
icon: l === u.THUMB_UP ?
|
|
80
|
-
onClick:
|
|
81
|
+
icon: l === u.THUMB_UP ? E : S,
|
|
82
|
+
onClick: G,
|
|
81
83
|
size: "x-small",
|
|
82
84
|
"data-target-id": "IconButton-thumbsUpAriaLabel"
|
|
83
85
|
})
|
|
84
86
|
}), /* @__PURE__ */ f($, {
|
|
85
|
-
isOpen:
|
|
86
|
-
onOpenChange:
|
|
87
|
-
onSubmit:
|
|
88
|
-
|
|
87
|
+
isOpen: y,
|
|
88
|
+
onOpenChange: H,
|
|
89
|
+
onSubmit: x,
|
|
90
|
+
shouldIncludeFeedbackText: n,
|
|
91
|
+
shouldShow: w,
|
|
89
92
|
children: /* @__PURE__ */ f(T, {
|
|
90
93
|
content: m(r.thumbsDownAriaLabel),
|
|
91
94
|
children: /* @__PURE__ */ f(M, {
|
|
92
95
|
"aria-label": m(r.thumbsDownAriaLabel),
|
|
93
|
-
className:
|
|
96
|
+
className: V.thumbDown,
|
|
94
97
|
disabled: l === u.THUMB_UP,
|
|
95
|
-
icon: l === u.THUMB_DOWN ?
|
|
96
|
-
onClick:
|
|
98
|
+
icon: l === u.THUMB_DOWN ? I : W,
|
|
99
|
+
onClick: P,
|
|
97
100
|
size: "x-small",
|
|
98
101
|
"data-target-id": "IconButton-thumbsDownAriaLabel"
|
|
99
102
|
})
|
|
@@ -102,6 +105,6 @@ import '../../../../styles/thumb-buttons.css';const K = "_thumbDown_1axcd_1", Q
|
|
|
102
105
|
});
|
|
103
106
|
};
|
|
104
107
|
export {
|
|
105
|
-
|
|
106
|
-
|
|
108
|
+
at as ThumbButtons,
|
|
109
|
+
at as default
|
|
107
110
|
};
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { BoxAiLogo as
|
|
3
|
-
import { Text as
|
|
1
|
+
import * as H from "react";
|
|
2
|
+
import { BoxAiLogo as J } from "@box/blueprint-web-assets/icons/Logo";
|
|
3
|
+
import { Text as K } from "@box/blueprint-web";
|
|
4
4
|
import { Size10 as d } from "@box/blueprint-web-assets/tokens/tokens";
|
|
5
|
-
import { useIntl as
|
|
6
|
-
import
|
|
7
|
-
import { Answer as
|
|
8
|
-
import { Question as
|
|
9
|
-
import { SuggestedQuestions as
|
|
10
|
-
import { WelcomeMessage as
|
|
11
|
-
import { MediaContainer as
|
|
12
|
-
import
|
|
5
|
+
import { useIntl as U } from "react-intl";
|
|
6
|
+
import V from "clsx";
|
|
7
|
+
import { Answer as X } from "../answer/answer.js";
|
|
8
|
+
import { Question as Y } from "../question/question.js";
|
|
9
|
+
import { SuggestedQuestions as Z } from "../suggested-questions/suggested-questions.js";
|
|
10
|
+
import { WelcomeMessage as $ } from "../welcome-message/welcome-message.js";
|
|
11
|
+
import { MediaContainer as L } from "../common/media-container.js";
|
|
12
|
+
import P from "../welcome-message/messages.js";
|
|
13
13
|
import { jsx as e, jsxs as _ } from "react/jsx-runtime";
|
|
14
|
-
import '../../../../styles/chat.css';const
|
|
15
|
-
chat:
|
|
16
|
-
clearChatText:
|
|
17
|
-
landingPage:
|
|
18
|
-
askQuestionText:
|
|
19
|
-
iconAvatar:
|
|
20
|
-
sidebar:
|
|
21
|
-
},
|
|
14
|
+
import '../../../../styles/chat.css';const S = "_chat_77vqr_1", ee = "_clearChatText_77vqr_1", te = "_landingPage_77vqr_7", oe = "_askQuestionText_77vqr_15", ae = "_iconAvatar_77vqr_23", re = "_sidebar_77vqr_39", a = {
|
|
15
|
+
chat: S,
|
|
16
|
+
clearChatText: ee,
|
|
17
|
+
landingPage: te,
|
|
18
|
+
askQuestionText: oe,
|
|
19
|
+
iconAvatar: ae,
|
|
20
|
+
sidebar: re
|
|
21
|
+
}, Te = ({
|
|
22
22
|
askSuggestedQuestion: f,
|
|
23
23
|
contentType: n,
|
|
24
24
|
hasCustomSuggestedQuestions: h,
|
|
@@ -38,42 +38,43 @@ import '../../../../styles/chat.css';const P = "_chat_77vqr_1", S = "_clearChatT
|
|
|
38
38
|
setAskSuggestedQuestion: m,
|
|
39
39
|
suggestedQuestions: l,
|
|
40
40
|
suggestedQuestionsRequestState: N,
|
|
41
|
+
shouldFeedbackFormIncludeFeedbackText: O,
|
|
41
42
|
shouldShowLandingPage: o,
|
|
42
|
-
useAnimation:
|
|
43
|
+
useAnimation: Q,
|
|
43
44
|
variant: t = "modal",
|
|
44
|
-
hostAppName:
|
|
45
|
-
welcomeMessageClearText:
|
|
45
|
+
hostAppName: j = "",
|
|
46
|
+
welcomeMessageClearText: y,
|
|
46
47
|
...p
|
|
47
48
|
}) => {
|
|
48
49
|
const {
|
|
49
|
-
formatMessage:
|
|
50
|
-
} =
|
|
51
|
-
|
|
50
|
+
formatMessage: M
|
|
51
|
+
} = U(), [w, z] = H.useState(null), B = (r, i) => {
|
|
52
|
+
z(r ? i : null);
|
|
52
53
|
};
|
|
53
54
|
return /* @__PURE__ */ e("div", {
|
|
54
55
|
className: a.chat,
|
|
55
56
|
"data-testid": "content-answers-chat",
|
|
56
57
|
children: /* @__PURE__ */ _("div", {
|
|
57
|
-
className:
|
|
58
|
+
className: V({
|
|
58
59
|
[a.landingPage]: o,
|
|
59
60
|
[a.sidebar]: t === "sidebar"
|
|
60
61
|
}),
|
|
61
|
-
children: [o && /* @__PURE__ */ e(
|
|
62
|
+
children: [o && /* @__PURE__ */ e(L.Figure, {
|
|
62
63
|
variant: t,
|
|
63
64
|
children: /* @__PURE__ */ e("div", {
|
|
64
65
|
className: a.iconAvatar,
|
|
65
|
-
children: /* @__PURE__ */ e(
|
|
66
|
+
children: /* @__PURE__ */ e(J, {
|
|
66
67
|
height: d,
|
|
67
68
|
role: "presentation",
|
|
68
69
|
width: d
|
|
69
70
|
})
|
|
70
71
|
})
|
|
71
|
-
}), /* @__PURE__ */ e(
|
|
72
|
+
}), /* @__PURE__ */ e($, {
|
|
72
73
|
contentType: "",
|
|
73
74
|
shouldShowLandingPage: o,
|
|
74
75
|
...p,
|
|
75
76
|
variant: t
|
|
76
|
-
}), o && l !== void 0 && m !== void 0 && /* @__PURE__ */ e(
|
|
77
|
+
}), o && l !== void 0 && m !== void 0 && /* @__PURE__ */ e(Z, {
|
|
77
78
|
askSuggestedQuestion: f,
|
|
78
79
|
hasCustomSuggestedQuestions: h,
|
|
79
80
|
isLoading: x,
|
|
@@ -83,10 +84,10 @@ import '../../../../styles/chat.css';const P = "_chat_77vqr_1", S = "_clearChatT
|
|
|
83
84
|
suggestedQuestions: l,
|
|
84
85
|
suggestedQuestionsRequestState: N,
|
|
85
86
|
variant: t
|
|
86
|
-
}), /* @__PURE__ */ e(
|
|
87
|
+
}), /* @__PURE__ */ e(K, {
|
|
87
88
|
as: "p",
|
|
88
89
|
className: a.clearChatText,
|
|
89
|
-
children:
|
|
90
|
+
children: y || M(P.welcomeClearChatText, {
|
|
90
91
|
type: n
|
|
91
92
|
})
|
|
92
93
|
}), !o && /* @__PURE__ */ e("ul", {
|
|
@@ -94,38 +95,39 @@ import '../../../../styles/chat.css';const P = "_chat_77vqr_1", S = "_clearChatT
|
|
|
94
95
|
answer: r,
|
|
95
96
|
citations: i,
|
|
96
97
|
id: s,
|
|
97
|
-
isCompleted:
|
|
98
|
-
isLoading:
|
|
99
|
-
error:
|
|
100
|
-
prompt:
|
|
101
|
-
feedbackValue:
|
|
98
|
+
isCompleted: R,
|
|
99
|
+
isLoading: W,
|
|
100
|
+
error: D,
|
|
101
|
+
prompt: E,
|
|
102
|
+
feedbackValue: G
|
|
102
103
|
}) => /* @__PURE__ */ _("li", {
|
|
103
|
-
children: [/* @__PURE__ */ e(
|
|
104
|
-
prompt:
|
|
104
|
+
children: [/* @__PURE__ */ e(Y, {
|
|
105
|
+
prompt: E,
|
|
105
106
|
variant: t
|
|
106
|
-
}), /* @__PURE__ */ e(
|
|
107
|
+
}), /* @__PURE__ */ e(X, {
|
|
107
108
|
answer: r,
|
|
108
109
|
citations: i,
|
|
109
110
|
contentType: n,
|
|
110
|
-
error:
|
|
111
|
-
feedbackValue:
|
|
112
|
-
hostAppName:
|
|
111
|
+
error: D,
|
|
112
|
+
feedbackValue: G,
|
|
113
|
+
hostAppName: j,
|
|
113
114
|
isCitationsEnabled: T,
|
|
114
|
-
isCompleted:
|
|
115
|
+
isCompleted: R,
|
|
115
116
|
isFeedbackEnabled: b,
|
|
116
117
|
isFeedbackFormEnabled: v,
|
|
117
|
-
isFeedbackTooltipOpen:
|
|
118
|
-
isLoading:
|
|
118
|
+
isFeedbackTooltipOpen: w === s,
|
|
119
|
+
isLoading: W || g,
|
|
119
120
|
isMarkdownEnabled: C,
|
|
120
121
|
items: p.items,
|
|
121
122
|
onAnswerCopy: q,
|
|
122
123
|
onCitationClick: k,
|
|
123
124
|
onFeedbackFormSubmit: u,
|
|
124
|
-
onFeedbackTooltipOpenChange:
|
|
125
|
+
onFeedbackTooltipOpenChange: B,
|
|
125
126
|
questionId: s,
|
|
126
127
|
recordAction: c,
|
|
127
128
|
setAnswerFeedback: I,
|
|
128
|
-
|
|
129
|
+
shouldFeedbackFormIncludeFeedbackText: O,
|
|
130
|
+
useAnimation: Q,
|
|
129
131
|
variant: t
|
|
130
132
|
})]
|
|
131
133
|
}, s))
|
|
@@ -134,6 +136,6 @@ import '../../../../styles/chat.css';const P = "_chat_77vqr_1", S = "_clearChatT
|
|
|
134
136
|
});
|
|
135
137
|
};
|
|
136
138
|
export {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
+
Te as Chat,
|
|
140
|
+
Te as default
|
|
139
141
|
};
|
|
@@ -38,6 +38,8 @@ export interface AnswerProps {
|
|
|
38
38
|
onFeedbackTooltipOpenChange?: (isOpen: boolean, questionId: string) => void;
|
|
39
39
|
/** Callback function to handle logging events */
|
|
40
40
|
recordAction?: (params: RecordActionType) => void;
|
|
41
|
+
/** Whether the feedback form includes feedback text field */
|
|
42
|
+
shouldFeedbackFormIncludeFeedbackText?: boolean;
|
|
41
43
|
/** If keyframe animation for appearing answer should be applied */
|
|
42
44
|
useAnimation?: boolean;
|
|
43
45
|
variant?: StyleVariant;
|
|
@@ -5,7 +5,8 @@ export type FeedbackTooltipProps = {
|
|
|
5
5
|
isOpen: boolean;
|
|
6
6
|
onOpenChange: (isOpen: boolean) => void;
|
|
7
7
|
onSubmit: (values: FeedbackFormValues) => void;
|
|
8
|
+
shouldIncludeFeedbackText?: boolean;
|
|
8
9
|
shouldShow: boolean;
|
|
9
10
|
};
|
|
10
|
-
export declare const FeedbackTooltip: ({ children, isOpen, onOpenChange, onSubmit, shouldShow }: FeedbackTooltipProps) => string | number | boolean | Iterable<ReactNode> | import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare const FeedbackTooltip: ({ children, isOpen, onOpenChange, onSubmit, shouldIncludeFeedbackText, shouldShow, }: FeedbackTooltipProps) => string | number | boolean | Iterable<ReactNode> | import("react/jsx-runtime").JSX.Element;
|
|
11
12
|
export default FeedbackTooltip;
|
|
@@ -10,7 +10,8 @@ export type ThumbButtonsProps = {
|
|
|
10
10
|
onFeedbackFormSubmit?: (data: FeedbackFormData, onSuccess: () => void) => void;
|
|
11
11
|
recordAction?: (params: RecordActionType) => void;
|
|
12
12
|
setAnswerFeedback?: (questionId: string, feedbackValue: FeedbackValue) => void;
|
|
13
|
+
shouldFeedbackFormIncludeFeedbackText?: boolean;
|
|
13
14
|
variant: StyleVariant;
|
|
14
15
|
};
|
|
15
|
-
export declare const ThumbButtons: ({ feedbackValue, hostAppName, isFeedbackFormEnabled, isFeedbackTooltipOpen, items, onFeedbackFormSubmit, onFeedbackTooltipOpenChange, questionId, recordAction, setAnswerFeedback, variant, }: ThumbButtonsProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export declare const ThumbButtons: ({ feedbackValue, hostAppName, isFeedbackFormEnabled, isFeedbackTooltipOpen, items, onFeedbackFormSubmit, onFeedbackTooltipOpenChange, questionId, recordAction, setAnswerFeedback, shouldFeedbackFormIncludeFeedbackText, variant, }: ThumbButtonsProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
17
|
export default ThumbButtons;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ChatProps } from '../../types';
|
|
2
|
-
export declare const Chat: ({ askSuggestedQuestion, contentType, hasCustomSuggestedQuestions, hasRequestInProgress, isCitationsEnabled, isFeedbackEnabled, isFeedbackFormEnabled, isMarkdownEnabled, isSessionLoading, onCitationClick, onAnswerCopy, onFeedbackFormSubmit, onSuggestedQuestionInteraction, questions, recordAction, setAnswerFeedback, setAskSuggestedQuestion, suggestedQuestions, suggestedQuestionsRequestState, shouldShowLandingPage, useAnimation, variant, hostAppName, welcomeMessageClearText, ...welcomeMessageProps }: ChatProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const Chat: ({ askSuggestedQuestion, contentType, hasCustomSuggestedQuestions, hasRequestInProgress, isCitationsEnabled, isFeedbackEnabled, isFeedbackFormEnabled, isMarkdownEnabled, isSessionLoading, onCitationClick, onAnswerCopy, onFeedbackFormSubmit, onSuggestedQuestionInteraction, questions, recordAction, setAnswerFeedback, setAskSuggestedQuestion, suggestedQuestions, suggestedQuestionsRequestState, shouldFeedbackFormIncludeFeedbackText, shouldShowLandingPage, useAnimation, variant, hostAppName, welcomeMessageClearText, ...welcomeMessageProps }: ChatProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export default Chat;
|
|
@@ -116,6 +116,8 @@ export type ChatProps = WelcomeMessageProps & {
|
|
|
116
116
|
onFeedbackFormSubmit?: (data: FeedbackFormData, onSuccess: () => void) => void;
|
|
117
117
|
/** Callback when the user interacts with suggested question */
|
|
118
118
|
onSuggestedQuestionInteraction?: () => void;
|
|
119
|
+
/** Whether the feedback form includes feedback text field */
|
|
120
|
+
shouldFeedbackFormIncludeFeedbackText?: boolean;
|
|
119
121
|
variant?: StyleVariant;
|
|
120
122
|
hostAppName?: string;
|
|
121
123
|
/** Custom clear chat message to be shown instead of This chat will be cleared when you close this {contentType} */
|
|
@@ -176,7 +178,7 @@ export declare enum FeedbackIssueType {
|
|
|
176
178
|
OTHER = "other"
|
|
177
179
|
}
|
|
178
180
|
export type FeedbackFormValues = {
|
|
179
|
-
feedback
|
|
181
|
+
feedback?: string;
|
|
180
182
|
issueType: FeedbackIssueType | '';
|
|
181
183
|
};
|
|
182
184
|
export type FeedbackValue = 'positive' | 'negative' | 'none';
|
|
@@ -241,9 +243,9 @@ export type EventLogOptions = {
|
|
|
241
243
|
};
|
|
242
244
|
export type appModeType = typeof APP_MODE.PREVIEW_MODAL | typeof APP_MODE.PREVIEW_SIDEBAR | typeof APP_MODE.ITEM_LIST_MODAL | typeof APP_MODE.HUBS_MODAL | typeof APP_MODE.NOTES_MODAL;
|
|
243
245
|
export type FeedbackFormData = {
|
|
244
|
-
feedback
|
|
246
|
+
feedback?: string;
|
|
245
247
|
fileTypes: string[];
|
|
246
|
-
hasFeedback
|
|
248
|
+
hasFeedback?: boolean;
|
|
247
249
|
hostApp: string;
|
|
248
250
|
issueType: FeedbackIssueType | '';
|
|
249
251
|
questionId: string;
|