@box/box-ai-content-answers 0.119.8 → 0.120.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/types.js +7 -4
- package/dist/esm/index.js +11 -10
- package/dist/esm/lib/components/answer/answer.js +100 -89
- package/dist/esm/lib/components/answer/feedback-tooltip.js +106 -0
- package/dist/esm/lib/components/answer/messages.js +42 -2
- package/dist/esm/lib/components/answer/thumb-buttons.js +89 -50
- package/dist/esm/lib/components/chat/chat.js +114 -105
- package/dist/esm/lib/messages.js +4 -0
- package/dist/i18n/bn-IN.js +11 -0
- package/dist/i18n/da-DK.js +11 -0
- package/dist/i18n/de-DE.js +11 -0
- package/dist/i18n/en-AU.js +11 -0
- package/dist/i18n/en-CA.js +11 -0
- package/dist/i18n/en-GB.js +11 -0
- package/dist/i18n/en-US.js +11 -0
- package/dist/i18n/en-US.properties +22 -0
- package/dist/i18n/en-x-pseudo.js +11 -0
- package/dist/i18n/es-419.js +11 -0
- package/dist/i18n/es-ES.js +11 -0
- package/dist/i18n/fi-FI.js +11 -0
- package/dist/i18n/fr-CA.js +11 -0
- package/dist/i18n/fr-FR.js +11 -0
- package/dist/i18n/hi-IN.js +11 -0
- package/dist/i18n/it-IT.js +11 -0
- package/dist/i18n/ja-JP.js +11 -0
- package/dist/i18n/json/src/lib/components/answer/messages.json +1 -1
- package/dist/i18n/json/src/lib/messages.json +1 -1
- package/dist/i18n/ko-KR.js +11 -0
- package/dist/i18n/nb-NO.js +11 -0
- package/dist/i18n/nl-NL.js +11 -0
- package/dist/i18n/pl-PL.js +11 -0
- package/dist/i18n/pt-BR.js +11 -0
- package/dist/i18n/ru-RU.js +11 -0
- package/dist/i18n/sv-SE.js +11 -0
- package/dist/i18n/tr-TR.js +11 -0
- package/dist/i18n/zh-CN.js +11 -0
- package/dist/i18n/zh-TW.js +11 -0
- package/dist/styles/answer.css +1 -1
- package/dist/styles/feedback-tooltip.css +1 -0
- package/dist/types/lib/components/answer/answer.d.ts +11 -3
- package/dist/types/lib/components/answer/feedback-tooltip.d.ts +11 -0
- package/dist/types/lib/components/answer/messages.d.ts +50 -0
- package/dist/types/lib/components/answer/thumb-buttons.d.ts +9 -5
- package/dist/types/lib/components/chat/chat.d.ts +1 -1
- package/dist/types/lib/messages.d.ts +5 -0
- package/dist/types/lib/stories/shared.d.ts +1 -0
- package/dist/types/lib/types.d.ts +29 -0
- package/package.json +2 -1
package/dist/chunks/types.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
let n = /* @__PURE__ */ function(e) {
|
|
2
2
|
return e.GENERAL = "general", e.RATE_LIMITING = "rate_limiting", e.NO_CONTENT = "no_content", e.PRECONDITION_FAILED = "precondition_failed", e.AGENT_NOT_FOUND = "agent_not_found", e.RESPONSE_FAILED = "response_failed", e.RESPONSE_INTERRUPTED = "response_interrupted", e.RESPONSE_STOPPED = "response_stopped", e;
|
|
3
|
-
}({}), r = /* @__PURE__ */ function(e) {
|
|
4
|
-
return e.LARGE_FILE = "large_file", e.GENERAL = "general", e;
|
|
5
3
|
}({}), t = /* @__PURE__ */ function(e) {
|
|
4
|
+
return e.LARGE_FILE = "large_file", e.GENERAL = "general", e;
|
|
5
|
+
}({}), r = /* @__PURE__ */ function(e) {
|
|
6
6
|
return e.NOT_STARTED = "not_started", e.IN_PROGRESS = "in_progress", e.SUCCESS = "success", e.ERROR = "error", e.CANCELLED = "cancelled", e;
|
|
7
|
+
}({}), o = /* @__PURE__ */ function(e) {
|
|
8
|
+
return e.DID_NOT_FOLLOW_REQUEST = "did_not_follow_request", e.INACCURATE_ANSWER = "inaccurate_answer", e.OTHER = "other", e;
|
|
7
9
|
}({});
|
|
8
10
|
export {
|
|
9
11
|
n as A,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
+
t as C,
|
|
13
|
+
o as F,
|
|
14
|
+
r as R
|
|
12
15
|
};
|
package/dist/esm/index.js
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import { BoxAiContentAnswers as
|
|
1
|
+
import { BoxAiContentAnswers as r } from "./lib/box-ai-content-answers.js";
|
|
2
2
|
import { AnswerContent as p } from "./lib/components/answer/answer-content.js";
|
|
3
|
-
import { withApiWrapper as
|
|
4
|
-
import { C as
|
|
5
|
-
import { IntelligenceModal as
|
|
3
|
+
import { withApiWrapper as n } from "./lib/components/api-wrapper/api-wrapper.js";
|
|
4
|
+
import { C as m } from "../chunks/clear-conversation-button.js";
|
|
5
|
+
import { IntelligenceModal as R } from "./lib/components/modal/modal.js";
|
|
6
6
|
import { APP_MODE as A } from "./lib/constants.js";
|
|
7
7
|
import { usePromptFocus as C } from "./lib/hooks/usePromptFocus.js";
|
|
8
|
-
import { A as
|
|
8
|
+
import { A as i, C as l, F as u, R as O } from "../chunks/types.js";
|
|
9
9
|
export {
|
|
10
|
-
|
|
10
|
+
i as ANSWER_ERROR,
|
|
11
11
|
A as APP_MODE,
|
|
12
12
|
p as AnswerContent,
|
|
13
|
-
|
|
13
|
+
r as BoxAiContentAnswers,
|
|
14
14
|
l as CONTENT_ERROR,
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
m as ClearConversationButton,
|
|
16
|
+
u as FeedbackIssueType,
|
|
17
|
+
R as IntelligenceModal,
|
|
17
18
|
O as REQUEST_STATE,
|
|
18
19
|
C as usePromptFocus,
|
|
19
|
-
|
|
20
|
+
n as withApiWrapper
|
|
20
21
|
};
|
|
@@ -1,131 +1,142 @@
|
|
|
1
|
-
import { Text as
|
|
2
|
-
import { AlertTriangle as
|
|
3
|
-
import { Gray65 as
|
|
1
|
+
import { Text as G } from "@box/blueprint-web";
|
|
2
|
+
import { AlertTriangle as V } from "@box/blueprint-web-assets/icons/Line";
|
|
3
|
+
import { Gray65 as k, Size4 as E } from "@box/blueprint-web-assets/tokens/tokens";
|
|
4
4
|
import p from "clsx";
|
|
5
|
-
import * as
|
|
6
|
-
import { useIntl as
|
|
5
|
+
import * as l from "react";
|
|
6
|
+
import { useIntl as j } from "react-intl";
|
|
7
7
|
import { A as n } from "../../../../chunks/types.js";
|
|
8
|
-
import { MediaContainer as
|
|
9
|
-
import { AnswerContent as
|
|
10
|
-
import { CopyButton as
|
|
11
|
-
import { InlineError as
|
|
12
|
-
import { ThumbButtons as
|
|
13
|
-
import { LoadingIndicator as
|
|
8
|
+
import { MediaContainer as N } from "../common/media-container.js";
|
|
9
|
+
import { AnswerContent as z } from "./answer-content.js";
|
|
10
|
+
import { CopyButton as W } from "./copy-button.js";
|
|
11
|
+
import { InlineError as q } from "./inline-error.js";
|
|
12
|
+
import { ThumbButtons as J } from "./thumb-buttons.js";
|
|
13
|
+
import { LoadingIndicator as K } from "./loading-indicator.js";
|
|
14
14
|
import m from "./messages.js";
|
|
15
|
-
import { References as
|
|
16
|
-
import { jsxs as a, jsx as
|
|
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
|
-
|
|
15
|
+
import { References as Q } from "./references.js";
|
|
16
|
+
import { jsxs as a, jsx as e } from "react/jsx-runtime";
|
|
17
|
+
import '../../../../styles/answer.css';const X = "_answer_140hd_1", Y = "_alertIcon_140hd_5", Z = "_error_140hd_8", $ = "_footer_140hd_12", tt = "_copyButtonContainer_140hd_18", ot = "_feedbackButtonsContainer_140hd_19", et = "_shouldHaveMarginTop_140hd_23", nt = "_shouldUseAnimation_140hd_26", st = "_shouldAnimateHeight_140hd_30", rt = "_footerButtons_140hd_34", at = "_iconAvatar_140hd_40", it = "_buttonsVisible_140hd_56", t = {
|
|
18
|
+
answer: X,
|
|
19
|
+
alertIcon: Y,
|
|
20
|
+
error: Z,
|
|
21
|
+
footer: $,
|
|
22
|
+
copyButtonContainer: tt,
|
|
23
|
+
feedbackButtonsContainer: ot,
|
|
24
|
+
shouldHaveMarginTop: et,
|
|
25
|
+
shouldUseAnimation: nt,
|
|
26
|
+
shouldAnimateHeight: st,
|
|
27
|
+
footerButtons: rt,
|
|
28
|
+
iconAvatar: at,
|
|
29
|
+
buttonsVisible: it
|
|
30
|
+
}, dt = /* @__PURE__ */ new Set([n.RATE_LIMITING, n.NO_CONTENT, n.PRECONDITION_FAILED, n.GENERAL, n.AGENT_NOT_FOUND]), gt = /* @__PURE__ */ l.memo(({
|
|
30
31
|
answer: s,
|
|
31
|
-
citations:
|
|
32
|
-
error:
|
|
33
|
-
contentType:
|
|
34
|
-
hostAppName:
|
|
35
|
-
feedbackValue:
|
|
36
|
-
isCitationsEnabled:
|
|
32
|
+
citations: I,
|
|
33
|
+
error: o,
|
|
34
|
+
contentType: S,
|
|
35
|
+
hostAppName: A,
|
|
36
|
+
feedbackValue: T,
|
|
37
|
+
isCitationsEnabled: R = !1,
|
|
37
38
|
isCompleted: i = !1,
|
|
38
|
-
isFeedbackEnabled:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
39
|
+
isFeedbackEnabled: g = !1,
|
|
40
|
+
isFeedbackFormEnabled: O,
|
|
41
|
+
isFeedbackTooltipOpen: u,
|
|
42
|
+
isLoading: b = !1,
|
|
43
|
+
isMarkdownEnabled: w = !1,
|
|
44
|
+
items: B = [],
|
|
45
|
+
onAnswerCopy: P,
|
|
46
|
+
onCitationClick: C,
|
|
47
|
+
onFeedbackFormSubmit: v,
|
|
48
|
+
onFeedbackTooltipOpenChange: M,
|
|
49
|
+
recordAction: d,
|
|
50
|
+
useAnimation: y = !0,
|
|
46
51
|
variant: r = "modal",
|
|
47
|
-
setAnswerFeedback:
|
|
48
|
-
questionId:
|
|
52
|
+
setAnswerFeedback: D,
|
|
53
|
+
questionId: H
|
|
49
54
|
}) => {
|
|
50
|
-
const
|
|
51
|
-
formatMessage:
|
|
52
|
-
} =
|
|
53
|
-
|
|
54
|
-
setTimeout(() =>
|
|
55
|
+
const _ = dt.has(o), h = b && !s && !o, [L, U] = l.useState(i), {
|
|
56
|
+
formatMessage: c
|
|
57
|
+
} = j();
|
|
58
|
+
l.useEffect(() => {
|
|
59
|
+
setTimeout(() => U(i), 0);
|
|
55
60
|
}, [i]);
|
|
56
|
-
const f = () => /* @__PURE__ */
|
|
57
|
-
className:
|
|
58
|
-
color:
|
|
61
|
+
const f = () => /* @__PURE__ */ e(V, {
|
|
62
|
+
className: t.alertIcon,
|
|
63
|
+
color: k,
|
|
59
64
|
"data-testid": "content-answers-error-alert-icon",
|
|
60
65
|
height: E,
|
|
61
66
|
role: "presentation",
|
|
62
67
|
width: E
|
|
63
|
-
}),
|
|
68
|
+
}), x = () => /* @__PURE__ */ a(G, {
|
|
64
69
|
as: "p",
|
|
65
|
-
className:
|
|
70
|
+
className: t.error,
|
|
66
71
|
color: "textOnLightSecondary",
|
|
67
72
|
"data-testid": "content-answers-error",
|
|
68
73
|
variant: "caption",
|
|
69
|
-
children: [
|
|
70
|
-
}),
|
|
71
|
-
className: p(
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
74
|
+
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
|
+
}), F = () => o !== n.RESPONSE_STOPPED ? /* @__PURE__ */ a("div", {
|
|
76
|
+
className: p(t.footerButtons, "footer-buttons-container", {
|
|
77
|
+
[t.buttonsVisible]: u
|
|
78
|
+
}),
|
|
79
|
+
children: [g ? /* @__PURE__ */ e("div", {
|
|
80
|
+
className: t.feedbackButtonsContainer,
|
|
81
|
+
children: /* @__PURE__ */ e(J, {
|
|
82
|
+
feedbackValue: T,
|
|
83
|
+
hostAppName: A,
|
|
84
|
+
isFeedbackFormEnabled: O,
|
|
85
|
+
isFeedbackTooltipOpen: u,
|
|
86
|
+
items: B,
|
|
87
|
+
onFeedbackFormSubmit: v,
|
|
88
|
+
onFeedbackTooltipOpenChange: M,
|
|
89
|
+
questionId: H,
|
|
90
|
+
recordAction: d,
|
|
91
|
+
setAnswerFeedback: D,
|
|
81
92
|
variant: r
|
|
82
93
|
})
|
|
83
|
-
}) : null, /* @__PURE__ */
|
|
84
|
-
className:
|
|
85
|
-
children: /* @__PURE__ */
|
|
94
|
+
}) : null, /* @__PURE__ */ e("div", {
|
|
95
|
+
className: t.copyButtonContainer,
|
|
96
|
+
children: /* @__PURE__ */ e(W, {
|
|
86
97
|
answer: s,
|
|
87
|
-
onAnswerCopy:
|
|
88
|
-
recordAction:
|
|
98
|
+
onAnswerCopy: P,
|
|
99
|
+
recordAction: d
|
|
89
100
|
})
|
|
90
101
|
})]
|
|
91
102
|
}) : s ? null : f();
|
|
92
103
|
return /* @__PURE__ */ a("div", {
|
|
93
104
|
"aria-live": "polite",
|
|
94
|
-
className:
|
|
105
|
+
className: t.answer,
|
|
95
106
|
"data-testid": "content-answers-answer",
|
|
96
|
-
children: [
|
|
107
|
+
children: [h && /* @__PURE__ */ e(K, {}), !_ && !h && /* @__PURE__ */ e(N, {
|
|
97
108
|
className: "answer",
|
|
98
109
|
variant: r,
|
|
99
|
-
children: /* @__PURE__ */ a(
|
|
110
|
+
children: /* @__PURE__ */ a(N.Content, {
|
|
100
111
|
isUsedInsideSidebar: r === "sidebar",
|
|
101
112
|
variant: "answer",
|
|
102
|
-
children: [/* @__PURE__ */
|
|
113
|
+
children: [/* @__PURE__ */ e(z, {
|
|
103
114
|
answer: s,
|
|
104
|
-
isMarkdownEnabled:
|
|
115
|
+
isMarkdownEnabled: w,
|
|
105
116
|
variant: r
|
|
106
117
|
}), i && /* @__PURE__ */ a("div", {
|
|
107
|
-
className: p(
|
|
108
|
-
[
|
|
109
|
-
[
|
|
110
|
-
[
|
|
118
|
+
className: p(t.footer, {
|
|
119
|
+
[t.shouldHaveMarginTop]: s,
|
|
120
|
+
[t.shouldAnimateHeight]: L,
|
|
121
|
+
[t.shouldUseAnimation]: y
|
|
111
122
|
}),
|
|
112
123
|
"data-testid": "content-answers-answer-footer",
|
|
113
|
-
children: [
|
|
114
|
-
citations:
|
|
115
|
-
onCitationClick:
|
|
116
|
-
recordAction:
|
|
117
|
-
}),
|
|
124
|
+
children: [o && x(), R && !o && /* @__PURE__ */ e(Q, {
|
|
125
|
+
citations: I,
|
|
126
|
+
onCitationClick: C,
|
|
127
|
+
recordAction: d
|
|
128
|
+
}), F()]
|
|
118
129
|
})]
|
|
119
130
|
})
|
|
120
|
-
}),
|
|
121
|
-
contentType:
|
|
122
|
-
error:
|
|
123
|
-
recordAction:
|
|
131
|
+
}), _ && /* @__PURE__ */ e(q, {
|
|
132
|
+
contentType: S,
|
|
133
|
+
error: o,
|
|
134
|
+
recordAction: d,
|
|
124
135
|
variant: r
|
|
125
136
|
})]
|
|
126
137
|
});
|
|
127
138
|
});
|
|
128
139
|
export {
|
|
129
|
-
|
|
130
|
-
|
|
140
|
+
gt as Answer,
|
|
141
|
+
gt as default
|
|
131
142
|
};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { Formik as y, Form as F } from "formik";
|
|
2
|
+
import { GuidedTooltip as t, Radio as l, TextArea as I } from "@box/blueprint-web";
|
|
3
|
+
import { useIntl as x } from "react-intl";
|
|
4
|
+
import { F as d } from "../../../../chunks/types.js";
|
|
5
|
+
import S from "../../messages.js";
|
|
6
|
+
import a from "./messages.js";
|
|
7
|
+
import { jsx as o, jsxs as i, Fragment as g } from "react/jsx-runtime";
|
|
8
|
+
import '../../../../styles/feedback-tooltip.css';const A = "_feedbackTooltip_rsbqj_1", v = "_feedbackTooltipTitle_rsbqj_4", C = "_feedbackTooltipTextarea_rsbqj_7", N = "_feedbackTooltipSubmitBtn_rsbqj_10", c = {
|
|
9
|
+
feedbackTooltip: A,
|
|
10
|
+
feedbackTooltipTitle: v,
|
|
11
|
+
feedbackTooltipTextarea: C,
|
|
12
|
+
feedbackTooltipSubmitBtn: N
|
|
13
|
+
}, O = ({
|
|
14
|
+
children: b,
|
|
15
|
+
isOpen: f,
|
|
16
|
+
onOpenChange: n,
|
|
17
|
+
onSubmit: m,
|
|
18
|
+
shouldShow: k
|
|
19
|
+
}) => {
|
|
20
|
+
const {
|
|
21
|
+
formatMessage: e
|
|
22
|
+
} = x();
|
|
23
|
+
if (!k)
|
|
24
|
+
return b;
|
|
25
|
+
const u = () => {
|
|
26
|
+
n(!1);
|
|
27
|
+
}, _ = (s) => {
|
|
28
|
+
m(s);
|
|
29
|
+
};
|
|
30
|
+
return /* @__PURE__ */ o(t, {
|
|
31
|
+
className: c.feedbackTooltip,
|
|
32
|
+
closeLabel: e(S.closeButtonText),
|
|
33
|
+
content: /* @__PURE__ */ o(y, {
|
|
34
|
+
initialValues: {
|
|
35
|
+
feedback: "",
|
|
36
|
+
issueType: ""
|
|
37
|
+
},
|
|
38
|
+
onSubmit: _,
|
|
39
|
+
children: ({
|
|
40
|
+
submitForm: s,
|
|
41
|
+
setFieldValue: T,
|
|
42
|
+
values: {
|
|
43
|
+
feedback: h,
|
|
44
|
+
issueType: p
|
|
45
|
+
}
|
|
46
|
+
}) => /* @__PURE__ */ i(g, {
|
|
47
|
+
children: [/* @__PURE__ */ i(t.Body, {
|
|
48
|
+
children: [/* @__PURE__ */ o(t.Title, {
|
|
49
|
+
className: c.feedbackTooltipTitle,
|
|
50
|
+
children: e(a.feedbackTooltipTitle)
|
|
51
|
+
}), /* @__PURE__ */ i(F, {
|
|
52
|
+
children: [/* @__PURE__ */ o(l.Legend, {
|
|
53
|
+
header: e(a.feedbackTooltipIssueTypeLabel),
|
|
54
|
+
children: /* @__PURE__ */ i(l.Group, {
|
|
55
|
+
defaultValue: "",
|
|
56
|
+
loop: !0,
|
|
57
|
+
name: "issueType",
|
|
58
|
+
onValueChange: (r) => T("issueType", r),
|
|
59
|
+
orientation: "vertical",
|
|
60
|
+
value: p,
|
|
61
|
+
children: [/* @__PURE__ */ o(l.Item, {
|
|
62
|
+
label: e(a.feedbackTooltipIssueTypeAnswer1),
|
|
63
|
+
value: d.INACCURATE_ANSWER
|
|
64
|
+
}), /* @__PURE__ */ o(l.Item, {
|
|
65
|
+
label: e(a.feedbackTooltipIssueTypeAnswer2),
|
|
66
|
+
value: d.DID_NOT_FOLLOW_REQUEST
|
|
67
|
+
}), /* @__PURE__ */ o(l.Item, {
|
|
68
|
+
label: e(a.feedbackTooltipIssueTypeAnswer3),
|
|
69
|
+
value: d.OTHER
|
|
70
|
+
})]
|
|
71
|
+
})
|
|
72
|
+
}), /* @__PURE__ */ o(I, {
|
|
73
|
+
className: c.feedbackTooltipTextarea,
|
|
74
|
+
label: e(a.feedbackTooltipFeedbackLabel),
|
|
75
|
+
maxRows: 4,
|
|
76
|
+
minRows: 4,
|
|
77
|
+
onChange: (r) => T("feedback", r.target.value),
|
|
78
|
+
placeholder: e(a.feedbackTooltipFeedbackPlaceholder),
|
|
79
|
+
value: h
|
|
80
|
+
})]
|
|
81
|
+
})]
|
|
82
|
+
}), /* @__PURE__ */ i(t.Footer, {
|
|
83
|
+
children: [/* @__PURE__ */ o(t.Footer.SecondaryAction, {
|
|
84
|
+
onClick: u,
|
|
85
|
+
size: "large",
|
|
86
|
+
children: e(a.feedbackTooltipCancel)
|
|
87
|
+
}), /* @__PURE__ */ o(t.Footer.PrimaryAction, {
|
|
88
|
+
className: c.feedbackTooltipSubmitBtn,
|
|
89
|
+
disabled: !p,
|
|
90
|
+
onClick: () => s(),
|
|
91
|
+
size: "large",
|
|
92
|
+
children: e(a.feedbackTooltipSubmit)
|
|
93
|
+
})]
|
|
94
|
+
})]
|
|
95
|
+
})
|
|
96
|
+
}),
|
|
97
|
+
onOpenChange: n,
|
|
98
|
+
open: f,
|
|
99
|
+
side: "left",
|
|
100
|
+
children: b
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
export {
|
|
104
|
+
O as FeedbackTooltip,
|
|
105
|
+
O as default
|
|
106
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineMessages as e } from "react-intl";
|
|
2
|
-
const
|
|
2
|
+
const t = e({
|
|
3
3
|
basedOn: {
|
|
4
4
|
id: "boxAI.contentAnswers.basedOn",
|
|
5
5
|
defaultMessage: "Based on:"
|
|
@@ -28,6 +28,46 @@ const n = e({
|
|
|
28
28
|
id: "boxAI.contentAnswers.copyToClipboardSucceeded",
|
|
29
29
|
defaultMessage: "Copied to your clipboard"
|
|
30
30
|
},
|
|
31
|
+
feedbackTooltipCancel: {
|
|
32
|
+
id: "boxAI.contentAnswers.feedbackTooltipCancel",
|
|
33
|
+
defaultMessage: "Cancel"
|
|
34
|
+
},
|
|
35
|
+
feedbackTooltipConfirmation: {
|
|
36
|
+
id: "boxAI.contentAnswers.feedbackTooltipConfirmation",
|
|
37
|
+
defaultMessage: "Thank you for the feedback."
|
|
38
|
+
},
|
|
39
|
+
feedbackTooltipFeedbackLabel: {
|
|
40
|
+
id: "boxAI.contentAnswers.feedbackTooltipFeedback",
|
|
41
|
+
defaultMessage: "How can we improve the experience?"
|
|
42
|
+
},
|
|
43
|
+
feedbackTooltipFeedbackPlaceholder: {
|
|
44
|
+
id: "boxAI.contentAnswers.feedbackTooltipFeedbackPlaceholder",
|
|
45
|
+
defaultMessage: "Please omit personal info, sensitive content, or links in your feedback as submissions to Box aren't confidential."
|
|
46
|
+
},
|
|
47
|
+
feedbackTooltipIssueTypeLabel: {
|
|
48
|
+
id: "boxAI.contentAnswers.feedbackTooltipIssueTypeLabel",
|
|
49
|
+
defaultMessage: "What type of issue do you wish to report?"
|
|
50
|
+
},
|
|
51
|
+
feedbackTooltipIssueTypeAnswer1: {
|
|
52
|
+
id: "boxAI.contentAnswers.feedbackTooltipIssueTypeAnswer1",
|
|
53
|
+
defaultMessage: "Inaccurate answer"
|
|
54
|
+
},
|
|
55
|
+
feedbackTooltipIssueTypeAnswer2: {
|
|
56
|
+
id: "boxAI.contentAnswers.feedbackTooltipIssueTypeAnswer2",
|
|
57
|
+
defaultMessage: "Did not follow my request"
|
|
58
|
+
},
|
|
59
|
+
feedbackTooltipIssueTypeAnswer3: {
|
|
60
|
+
id: "boxAI.contentAnswers.feedbackTooltipIssueTypeAnswer3",
|
|
61
|
+
defaultMessage: "Other"
|
|
62
|
+
},
|
|
63
|
+
feedbackTooltipTitle: {
|
|
64
|
+
id: "boxAI.contentAnswers.feedbackTooltipTitle",
|
|
65
|
+
defaultMessage: "Share your feedback"
|
|
66
|
+
},
|
|
67
|
+
feedbackTooltipSubmit: {
|
|
68
|
+
id: "boxAI.contentAnswers.feedbackTooltipSubmit",
|
|
69
|
+
defaultMessage: "Submit"
|
|
70
|
+
},
|
|
31
71
|
inlineNoContentErrorText: {
|
|
32
72
|
id: "boxAI.contentAnswers.inlineNoContentErrorText",
|
|
33
73
|
defaultMessage: "Relevant content cannot be found. Please try again later or ask a different question."
|
|
@@ -82,5 +122,5 @@ const n = e({
|
|
|
82
122
|
}
|
|
83
123
|
});
|
|
84
124
|
export {
|
|
85
|
-
|
|
125
|
+
t as default
|
|
86
126
|
};
|
|
@@ -1,68 +1,107 @@
|
|
|
1
|
-
import { Tooltip as
|
|
2
|
-
import { ThumbUp as
|
|
3
|
-
import { ThumbUp as
|
|
4
|
-
import
|
|
5
|
-
import { useIntl as
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { useNotification as P, Tooltip as T, IconButton as M } from "@box/blueprint-web";
|
|
2
|
+
import { ThumbUp as R, ThumbDown as v } from "@box/blueprint-web-assets/icons/Fill";
|
|
3
|
+
import { ThumbUp as E, ThumbDown as I } from "@box/blueprint-web-assets/icons/Line";
|
|
4
|
+
import U from "react";
|
|
5
|
+
import { useIntl as W } from "react-intl";
|
|
6
|
+
import { FeedbackTooltip as $ } from "./feedback-tooltip.js";
|
|
7
|
+
import { LOGGER_BASE_CONFIG as j, LOGGER_ACTION_PROGRAMMATIC as z } from "../common/constants.js";
|
|
8
|
+
import n from "../../messages.js";
|
|
9
|
+
import r from "./messages.js";
|
|
10
|
+
import { focusInput as A } from "../common/focusInputUtils.js";
|
|
11
|
+
import { jsxs as S, Fragment as J, jsx as f } from "react/jsx-runtime";
|
|
12
|
+
import '../../../../styles/thumb-buttons.css';const K = "_thumbDown_1axcd_1", Q = {
|
|
13
|
+
thumbDown: K
|
|
14
|
+
}, u = {
|
|
13
15
|
THUMB_UP: "positive",
|
|
14
16
|
THUMB_DOWN: "negative",
|
|
15
17
|
NONE: "none"
|
|
16
|
-
},
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
}, tt = ({
|
|
19
|
+
feedbackValue: L,
|
|
20
|
+
hostAppName: h,
|
|
21
|
+
isFeedbackFormEnabled: p = !1,
|
|
22
|
+
isFeedbackTooltipOpen: w = !1,
|
|
23
|
+
items: D,
|
|
24
|
+
onFeedbackFormSubmit: b,
|
|
25
|
+
onFeedbackTooltipOpenChange: s,
|
|
26
|
+
questionId: a,
|
|
27
|
+
recordAction: i,
|
|
28
|
+
setAnswerFeedback: o,
|
|
29
|
+
variant: B
|
|
24
30
|
}) => {
|
|
25
31
|
const {
|
|
26
|
-
formatMessage:
|
|
27
|
-
} =
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
32
|
+
formatMessage: m
|
|
33
|
+
} = W(), {
|
|
34
|
+
addNotification: y
|
|
35
|
+
} = P(), l = L, c = U.useMemo(() => D.filter((t) => t.status === "supported").map((t) => t.fileType), [D]), _ = U.useCallback((t) => {
|
|
36
|
+
l !== t && (o == null || o(a, t), i == null || i({
|
|
37
|
+
...j,
|
|
38
|
+
action: z,
|
|
31
39
|
target: "answer_feedback",
|
|
32
|
-
component:
|
|
40
|
+
component: B,
|
|
33
41
|
data: {
|
|
34
42
|
feedback_value: t,
|
|
35
|
-
file_types:
|
|
36
|
-
feature:
|
|
43
|
+
file_types: c,
|
|
44
|
+
feature: h
|
|
37
45
|
}
|
|
38
|
-
}),
|
|
39
|
-
}, [
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
}), A());
|
|
47
|
+
}, [h, i, l, B, c, a, o]), N = ({
|
|
48
|
+
feedback: t,
|
|
49
|
+
issueType: G
|
|
50
|
+
}) => {
|
|
51
|
+
b == null || b({
|
|
52
|
+
feedback: t,
|
|
53
|
+
fileTypes: c,
|
|
54
|
+
hasFeedback: !!t,
|
|
55
|
+
hostApp: h,
|
|
56
|
+
issueType: G,
|
|
57
|
+
timestamp: Date.now(),
|
|
58
|
+
questionId: a
|
|
59
|
+
}, () => {
|
|
60
|
+
y({
|
|
61
|
+
sensitivity: "foreground",
|
|
62
|
+
styledText: m(r.feedbackTooltipConfirmation),
|
|
63
|
+
variant: "success",
|
|
64
|
+
typeIconAriaLabel: m(n.ariaTypeSuccessIconLabel),
|
|
65
|
+
closeButtonAriaLabel: m(n.closeButtonText)
|
|
66
|
+
});
|
|
67
|
+
}), s == null || s(!1, a);
|
|
68
|
+
}, x = (t) => {
|
|
69
|
+
t || s == null || s(!1, a);
|
|
70
|
+
}, H = U.useCallback(() => _(u.THUMB_UP), [_]), e = U.useCallback(() => {
|
|
71
|
+
_(u.THUMB_DOWN), s == null || s(!0, a);
|
|
72
|
+
}, [_, s, a]);
|
|
73
|
+
return /* @__PURE__ */ S(J, {
|
|
74
|
+
children: [/* @__PURE__ */ f(T, {
|
|
75
|
+
content: m(r.thumbsUpAriaLabel),
|
|
76
|
+
children: /* @__PURE__ */ f(M, {
|
|
77
|
+
"aria-label": m(r.thumbsUpAriaLabel),
|
|
78
|
+
disabled: l === u.THUMB_DOWN,
|
|
79
|
+
icon: l === u.THUMB_UP ? R : E,
|
|
80
|
+
onClick: H,
|
|
48
81
|
size: "x-small",
|
|
49
82
|
"data-target-id": "IconButton-thumbsUpAriaLabel"
|
|
50
83
|
})
|
|
51
|
-
}), /* @__PURE__ */
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
84
|
+
}), /* @__PURE__ */ f($, {
|
|
85
|
+
isOpen: w,
|
|
86
|
+
onOpenChange: x,
|
|
87
|
+
onSubmit: N,
|
|
88
|
+
shouldShow: p,
|
|
89
|
+
children: /* @__PURE__ */ f(T, {
|
|
90
|
+
content: m(r.thumbsDownAriaLabel),
|
|
91
|
+
children: /* @__PURE__ */ f(M, {
|
|
92
|
+
"aria-label": m(r.thumbsDownAriaLabel),
|
|
93
|
+
className: Q.thumbDown,
|
|
94
|
+
disabled: l === u.THUMB_UP,
|
|
95
|
+
icon: l === u.THUMB_DOWN ? v : I,
|
|
96
|
+
onClick: e,
|
|
97
|
+
size: "x-small",
|
|
98
|
+
"data-target-id": "IconButton-thumbsDownAriaLabel"
|
|
99
|
+
})
|
|
61
100
|
})
|
|
62
101
|
})]
|
|
63
102
|
});
|
|
64
103
|
};
|
|
65
104
|
export {
|
|
66
|
-
|
|
67
|
-
|
|
105
|
+
tt as ThumbButtons,
|
|
106
|
+
tt as default
|
|
68
107
|
};
|