@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.
Files changed (48) hide show
  1. package/dist/chunks/types.js +7 -4
  2. package/dist/esm/index.js +11 -10
  3. package/dist/esm/lib/components/answer/answer.js +100 -89
  4. package/dist/esm/lib/components/answer/feedback-tooltip.js +106 -0
  5. package/dist/esm/lib/components/answer/messages.js +42 -2
  6. package/dist/esm/lib/components/answer/thumb-buttons.js +89 -50
  7. package/dist/esm/lib/components/chat/chat.js +114 -105
  8. package/dist/esm/lib/messages.js +4 -0
  9. package/dist/i18n/bn-IN.js +11 -0
  10. package/dist/i18n/da-DK.js +11 -0
  11. package/dist/i18n/de-DE.js +11 -0
  12. package/dist/i18n/en-AU.js +11 -0
  13. package/dist/i18n/en-CA.js +11 -0
  14. package/dist/i18n/en-GB.js +11 -0
  15. package/dist/i18n/en-US.js +11 -0
  16. package/dist/i18n/en-US.properties +22 -0
  17. package/dist/i18n/en-x-pseudo.js +11 -0
  18. package/dist/i18n/es-419.js +11 -0
  19. package/dist/i18n/es-ES.js +11 -0
  20. package/dist/i18n/fi-FI.js +11 -0
  21. package/dist/i18n/fr-CA.js +11 -0
  22. package/dist/i18n/fr-FR.js +11 -0
  23. package/dist/i18n/hi-IN.js +11 -0
  24. package/dist/i18n/it-IT.js +11 -0
  25. package/dist/i18n/ja-JP.js +11 -0
  26. package/dist/i18n/json/src/lib/components/answer/messages.json +1 -1
  27. package/dist/i18n/json/src/lib/messages.json +1 -1
  28. package/dist/i18n/ko-KR.js +11 -0
  29. package/dist/i18n/nb-NO.js +11 -0
  30. package/dist/i18n/nl-NL.js +11 -0
  31. package/dist/i18n/pl-PL.js +11 -0
  32. package/dist/i18n/pt-BR.js +11 -0
  33. package/dist/i18n/ru-RU.js +11 -0
  34. package/dist/i18n/sv-SE.js +11 -0
  35. package/dist/i18n/tr-TR.js +11 -0
  36. package/dist/i18n/zh-CN.js +11 -0
  37. package/dist/i18n/zh-TW.js +11 -0
  38. package/dist/styles/answer.css +1 -1
  39. package/dist/styles/feedback-tooltip.css +1 -0
  40. package/dist/types/lib/components/answer/answer.d.ts +11 -3
  41. package/dist/types/lib/components/answer/feedback-tooltip.d.ts +11 -0
  42. package/dist/types/lib/components/answer/messages.d.ts +50 -0
  43. package/dist/types/lib/components/answer/thumb-buttons.d.ts +9 -5
  44. package/dist/types/lib/components/chat/chat.d.ts +1 -1
  45. package/dist/types/lib/messages.d.ts +5 -0
  46. package/dist/types/lib/stories/shared.d.ts +1 -0
  47. package/dist/types/lib/types.d.ts +29 -0
  48. package/package.json +2 -1
@@ -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
- r as C,
11
- t as R
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 e } from "./lib/box-ai-content-answers.js";
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 s } from "./lib/components/api-wrapper/api-wrapper.js";
4
- import { C as x } from "../chunks/clear-conversation-button.js";
5
- import { IntelligenceModal as a } from "./lib/components/modal/modal.js";
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 T, C as l, R as O } from "../chunks/types.js";
8
+ import { A as i, C as l, F as u, R as O } from "../chunks/types.js";
9
9
  export {
10
- T as ANSWER_ERROR,
10
+ i as ANSWER_ERROR,
11
11
  A as APP_MODE,
12
12
  p as AnswerContent,
13
- e as BoxAiContentAnswers,
13
+ r as BoxAiContentAnswers,
14
14
  l as CONTENT_ERROR,
15
- x as ClearConversationButton,
16
- a as IntelligenceModal,
15
+ m as ClearConversationButton,
16
+ u as FeedbackIssueType,
17
+ R as IntelligenceModal,
17
18
  O as REQUEST_STATE,
18
19
  C as usePromptFocus,
19
- s as withApiWrapper
20
+ n as withApiWrapper
20
21
  };
@@ -1,131 +1,142 @@
1
- import { Text as H } from "@box/blueprint-web";
2
- import { AlertTriangle as L } from "@box/blueprint-web-assets/icons/Line";
3
- import { Gray65 as F, Size4 as E } from "@box/blueprint-web-assets/tokens/tokens";
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 d from "react";
6
- import { useIntl as U } from "react-intl";
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 h } from "../common/media-container.js";
9
- import { AnswerContent as x } from "./answer-content.js";
10
- import { CopyButton as k } from "./copy-button.js";
11
- import { InlineError as G } from "./inline-error.js";
12
- import { ThumbButtons as j } from "./thumb-buttons.js";
13
- import { LoadingIndicator as W } from "./loading-indicator.js";
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 q } from "./references.js";
16
- import { jsxs as a, jsx as o } from "react/jsx-runtime";
17
- import '../../../../styles/answer.css';const J = "_answer_18szz_1", K = "_alertIcon_18szz_5", Q = "_error_18szz_8", V = "_footer_18szz_12", X = "_copyButtonContainer_18szz_18", Y = "_feedbackButtonsContainer_18szz_19", Z = "_shouldHaveMarginTop_18szz_23", $ = "_shouldUseAnimation_18szz_26", tt = "_shouldAnimateHeight_18szz_30", ot = "_footerButtons_18szz_34", et = "_iconAvatar_18szz_40", e = {
18
- answer: J,
19
- alertIcon: K,
20
- error: Q,
21
- footer: V,
22
- copyButtonContainer: X,
23
- feedbackButtonsContainer: Y,
24
- shouldHaveMarginTop: Z,
25
- shouldUseAnimation: $,
26
- shouldAnimateHeight: tt,
27
- footerButtons: ot,
28
- iconAvatar: et
29
- }, nt = /* @__PURE__ */ new Set([n.RATE_LIMITING, n.NO_CONTENT, n.PRECONDITION_FAILED, n.GENERAL, n.AGENT_NOT_FOUND]), zt = /* @__PURE__ */ d.memo(({
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: N,
32
- error: t,
33
- contentType: z,
34
- hostAppName: I,
35
- feedbackValue: S,
36
- isCitationsEnabled: T = !1,
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: A = !1,
39
- isLoading: R = !1,
40
- isMarkdownEnabled: O = !1,
41
- items: g = [],
42
- onCitationClick: w,
43
- onAnswerCopy: B,
44
- recordAction: c,
45
- useAnimation: P = !0,
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: C,
48
- questionId: v
52
+ setAnswerFeedback: D,
53
+ questionId: H
49
54
  }) => {
50
- const u = nt.has(t), _ = R && !s && !t, [M, b] = d.useState(i), {
51
- formatMessage: l
52
- } = U();
53
- d.useEffect(() => {
54
- setTimeout(() => b(i), 0);
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__ */ o(L, {
57
- className: e.alertIcon,
58
- color: F,
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
- }), y = () => /* @__PURE__ */ a(H, {
68
+ }), x = () => /* @__PURE__ */ a(G, {
64
69
  as: "p",
65
- className: e.error,
70
+ className: t.error,
66
71
  color: "textOnLightSecondary",
67
72
  "data-testid": "content-answers-error",
68
73
  variant: "caption",
69
- children: [t === n.RESPONSE_INTERRUPTED && l(m.responseInterruptedError), t === n.RESPONSE_FAILED && l(m.responseFailedError), t === n.RESPONSE_STOPPED && l(m.responseStoppedError), t !== n.RESPONSE_STOPPED && f()]
70
- }), D = () => t !== n.RESPONSE_STOPPED ? /* @__PURE__ */ a("div", {
71
- className: p(e.footerButtons, "footer-buttons-container"),
72
- children: [A ? /* @__PURE__ */ o("div", {
73
- className: e.feedbackButtonsContainer,
74
- children: /* @__PURE__ */ o(j, {
75
- feedbackValue: S,
76
- hostAppName: I,
77
- items: g,
78
- questionId: v,
79
- recordAction: c,
80
- setAnswerFeedback: C,
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__ */ o("div", {
84
- className: e.copyButtonContainer,
85
- children: /* @__PURE__ */ o(k, {
94
+ }) : null, /* @__PURE__ */ e("div", {
95
+ className: t.copyButtonContainer,
96
+ children: /* @__PURE__ */ e(W, {
86
97
  answer: s,
87
- onAnswerCopy: B,
88
- recordAction: c
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: e.answer,
105
+ className: t.answer,
95
106
  "data-testid": "content-answers-answer",
96
- children: [_ && /* @__PURE__ */ o(W, {}), !u && !_ && /* @__PURE__ */ o(h, {
107
+ children: [h && /* @__PURE__ */ e(K, {}), !_ && !h && /* @__PURE__ */ e(N, {
97
108
  className: "answer",
98
109
  variant: r,
99
- children: /* @__PURE__ */ a(h.Content, {
110
+ children: /* @__PURE__ */ a(N.Content, {
100
111
  isUsedInsideSidebar: r === "sidebar",
101
112
  variant: "answer",
102
- children: [/* @__PURE__ */ o(x, {
113
+ children: [/* @__PURE__ */ e(z, {
103
114
  answer: s,
104
- isMarkdownEnabled: O,
115
+ isMarkdownEnabled: w,
105
116
  variant: r
106
117
  }), i && /* @__PURE__ */ a("div", {
107
- className: p(e.footer, {
108
- [e.shouldHaveMarginTop]: s,
109
- [e.shouldAnimateHeight]: M,
110
- [e.shouldUseAnimation]: P
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: [t && y(), T && !t && /* @__PURE__ */ o(q, {
114
- citations: N,
115
- onCitationClick: w,
116
- recordAction: c
117
- }), D()]
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
- }), u && /* @__PURE__ */ o(G, {
121
- contentType: z,
122
- error: t,
123
- recordAction: c,
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
- zt as Answer,
130
- zt as default
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 n = e({
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
- n as default
125
+ t as default
86
126
  };
@@ -1,68 +1,107 @@
1
- import { Tooltip as f, IconButton as _ } from "@box/blueprint-web";
2
- import { ThumbUp as B, ThumbDown as M } from "@box/blueprint-web-assets/icons/Fill";
3
- import { ThumbUp as d, ThumbDown as O } from "@box/blueprint-web-assets/icons/Line";
4
- import e from "react";
5
- import { useIntl as C } from "react-intl";
6
- import { LOGGER_BASE_CONFIG as H, LOGGER_ACTION_PROGRAMMATIC as L } from "../common/constants.js";
7
- import u from "./messages.js";
8
- import { focusInput as N } from "../common/focusInputUtils.js";
9
- import { jsxs as g, Fragment as w, jsx as b } from "react/jsx-runtime";
10
- import '../../../../styles/thumb-buttons.css';const I = "_thumbDown_1axcd_1", x = {
11
- thumbDown: I
12
- }, o = {
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
- }, z = ({
17
- recordAction: m,
18
- variant: i,
19
- items: p,
20
- hostAppName: r,
21
- questionId: h,
22
- feedbackValue: U,
23
- setAnswerFeedback: l
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: n
27
- } = C(), a = U, T = e.useMemo(() => p.filter((t) => t.status === "supported").map((t) => t.fileType), [p]), s = e.useCallback((t) => {
28
- a !== t && (l == null || l(h, t), m == null || m({
29
- ...H,
30
- action: L,
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: i,
40
+ component: B,
33
41
  data: {
34
42
  feedback_value: t,
35
- file_types: T,
36
- feature: r
43
+ file_types: c,
44
+ feature: h
37
45
  }
38
- }), N());
39
- }, [r, m, a, i, T, h, l]), c = e.useCallback(() => s(o.THUMB_UP), [s]), D = e.useCallback(() => s(o.THUMB_DOWN), [s]);
40
- return /* @__PURE__ */ g(w, {
41
- children: [/* @__PURE__ */ b(f, {
42
- content: n(u.thumbsUpAriaLabel),
43
- children: /* @__PURE__ */ b(_, {
44
- "aria-label": n(u.thumbsUpAriaLabel),
45
- disabled: a === o.THUMB_DOWN,
46
- icon: a === o.THUMB_UP ? B : d,
47
- onClick: c,
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__ */ b(f, {
52
- content: n(u.thumbsDownAriaLabel),
53
- children: /* @__PURE__ */ b(_, {
54
- "aria-label": n(u.thumbsDownAriaLabel),
55
- className: x.thumbDown,
56
- disabled: a === o.THUMB_UP,
57
- icon: a === o.THUMB_DOWN ? M : O,
58
- onClick: D,
59
- size: "x-small",
60
- "data-target-id": "IconButton-thumbsDownAriaLabel"
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
- z as ThumbButtons,
67
- z as default
105
+ tt as ThumbButtons,
106
+ tt as default
68
107
  };