@box/box-ai-content-answers 0.158.0 → 0.159.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 (70) hide show
  1. package/dist/esm/lib/components/answer/answer.js +153 -140
  2. package/dist/esm/lib/components/answer/embed-the-answer-button.js +65 -0
  3. package/dist/esm/lib/components/answer/messages.js +8 -0
  4. package/dist/esm/lib/components/chat/chat.js +74 -72
  5. package/dist/esm/lib/components/sidebar/content.js +78 -76
  6. package/dist/esm/lib/components/sidebar/sidebar.js +37 -35
  7. package/dist/i18n/bn-IN.js +7 -5
  8. package/dist/i18n/bn-IN.properties +11 -5
  9. package/dist/i18n/da-DK.js +7 -5
  10. package/dist/i18n/da-DK.properties +11 -5
  11. package/dist/i18n/de-DE.js +7 -5
  12. package/dist/i18n/de-DE.properties +11 -5
  13. package/dist/i18n/en-AU.js +3 -1
  14. package/dist/i18n/en-AU.properties +7 -1
  15. package/dist/i18n/en-CA.js +4 -2
  16. package/dist/i18n/en-CA.properties +8 -2
  17. package/dist/i18n/en-GB.js +3 -1
  18. package/dist/i18n/en-GB.properties +7 -1
  19. package/dist/i18n/en-US.js +2 -0
  20. package/dist/i18n/en-US.properties +4 -0
  21. package/dist/i18n/en-x-pseudo.js +88 -86
  22. package/dist/i18n/en-x-pseudo.properties +91 -85
  23. package/dist/i18n/es-419.js +7 -5
  24. package/dist/i18n/es-419.properties +11 -5
  25. package/dist/i18n/es-ES.js +7 -5
  26. package/dist/i18n/es-ES.properties +11 -5
  27. package/dist/i18n/fi-FI.js +7 -5
  28. package/dist/i18n/fi-FI.properties +11 -5
  29. package/dist/i18n/fr-CA.js +7 -5
  30. package/dist/i18n/fr-CA.properties +11 -5
  31. package/dist/i18n/fr-FR.js +7 -5
  32. package/dist/i18n/fr-FR.properties +11 -5
  33. package/dist/i18n/hi-IN.js +7 -5
  34. package/dist/i18n/hi-IN.properties +11 -5
  35. package/dist/i18n/it-IT.js +7 -5
  36. package/dist/i18n/it-IT.properties +11 -5
  37. package/dist/i18n/ja-JP.js +7 -5
  38. package/dist/i18n/ja-JP.properties +11 -5
  39. package/dist/i18n/json/src/lib/components/answer/messages.json +1 -1
  40. package/dist/i18n/ko-KR.js +7 -5
  41. package/dist/i18n/ko-KR.properties +11 -5
  42. package/dist/i18n/nb-NO.js +7 -5
  43. package/dist/i18n/nb-NO.properties +11 -5
  44. package/dist/i18n/nl-NL.js +7 -5
  45. package/dist/i18n/nl-NL.properties +11 -5
  46. package/dist/i18n/pl-PL.js +7 -5
  47. package/dist/i18n/pl-PL.properties +11 -5
  48. package/dist/i18n/pt-BR.js +7 -5
  49. package/dist/i18n/pt-BR.properties +11 -5
  50. package/dist/i18n/ru-RU.js +7 -5
  51. package/dist/i18n/ru-RU.properties +11 -5
  52. package/dist/i18n/sv-SE.js +7 -5
  53. package/dist/i18n/sv-SE.properties +11 -5
  54. package/dist/i18n/tr-TR.js +7 -5
  55. package/dist/i18n/tr-TR.properties +11 -5
  56. package/dist/i18n/zh-CN.js +7 -5
  57. package/dist/i18n/zh-CN.properties +11 -5
  58. package/dist/i18n/zh-TW.js +7 -5
  59. package/dist/i18n/zh-TW.properties +11 -5
  60. package/dist/styles/answer.css +1 -1
  61. package/dist/styles/embed-the-answer-button.css +1 -0
  62. package/dist/types/lib/components/answer/answer.d.ts +3 -1
  63. package/dist/types/lib/components/answer/embed-the-answer-button.d.ts +11 -0
  64. package/dist/types/lib/components/answer/messages.d.ts +10 -0
  65. package/dist/types/lib/components/chat/chat.d.ts +1 -1
  66. package/dist/types/lib/components/sidebar/content.d.ts +2 -0
  67. package/dist/types/lib/components/sidebar/sidebar.d.ts +2 -1
  68. package/dist/types/lib/stories/shared.d.ts +9 -0
  69. package/dist/types/lib/types.d.ts +10 -0
  70. package/package.json +4 -4
@@ -1,183 +1,196 @@
1
- import { Text as N } from "@box/blueprint-web";
2
- import { AlertTriangle as Q } from "@box/blueprint-web-assets/icons/Line";
3
- import { Gray65 as X, Size4 as I } from "@box/blueprint-web-assets/tokens/tokens";
4
- import w from "clsx";
5
- import { memo as Y, useState as Z, useEffect as T, useMemo as $ } from "react";
6
- import { useIntl as tt } from "react-intl";
1
+ import { Text as T } from "@box/blueprint-web";
2
+ import { AlertTriangle as X } from "@box/blueprint-web-assets/icons/Line";
3
+ import { Gray65 as Y, Size4 as S } from "@box/blueprint-web-assets/tokens/tokens";
4
+ import R from "clsx";
5
+ import { memo as Z, useState as $, useEffect as j, useMemo as nn } from "react";
6
+ import { useIntl as en } from "react-intl";
7
7
  import { A as r } from "../../../../chunks/types.js";
8
- import { injectInlineCitation as ot } from "../../utils/inlineCitationsUtils.js";
9
- import { MediaContainer as S } from "../common/media-container.js";
10
- import { BoxAILoadingIndicator as nt } from "../thinkingBubble/boxAILoadingIndicator.js";
11
- import { AnswerContent as et } from "./answer-content.js";
12
- import { CopyButton as rt } from "./copy-button.js";
13
- import { InlineError as st } from "./inline-error.js";
8
+ import { injectInlineCitation as tn } from "../../utils/inlineCitationsUtils.js";
9
+ import { MediaContainer as O } from "../common/media-container.js";
10
+ import { BoxAILoadingIndicator as on } from "../thinkingBubble/boxAILoadingIndicator.js";
11
+ import { AnswerContent as rn } from "./answer-content.js";
12
+ import { CopyButton as sn } from "./copy-button.js";
13
+ import { EmbedTheAnswerButton as an } from "./embed-the-answer-button.js";
14
+ import { InlineError as ln } from "./inline-error.js";
14
15
  import u from "./messages.js";
15
- import { References as at } from "./references.js";
16
- import { ThumbButtons as it } from "./thumb-buttons.js";
17
- import { jsxs as c, jsx as n } from "react/jsx-runtime";
18
- import '../../../../styles/answer.css';const lt = "_answer_rp7w7_1", ct = "_loadingContainer_rp7w7_5", dt = "_loadingText_rp7w7_12", ut = "_fadeIn_rp7w7_1", _t = "_alertIcon_rp7w7_21", ft = "_error_rp7w7_24", mt = "_footer_rp7w7_28", pt = "_copyButtonContainer_rp7w7_34", ht = "_feedbackButtonsContainer_rp7w7_35", Et = "_shouldHaveMarginTop_rp7w7_39", gt = "_shouldUseAnimation_rp7w7_42", Nt = "_shouldAnimateHeight_rp7w7_46", It = "_footerButtons_rp7w7_50", wt = "_iconAvatar_rp7w7_56", Tt = "_buttonsVisible_rp7w7_72", t = {
19
- answer: lt,
20
- loadingContainer: ct,
21
- loadingText: dt,
22
- fadeIn: ut,
23
- alertIcon: _t,
24
- error: ft,
25
- footer: mt,
26
- copyButtonContainer: pt,
27
- feedbackButtonsContainer: ht,
28
- shouldHaveMarginTop: Et,
29
- shouldUseAnimation: gt,
30
- shouldAnimateHeight: Nt,
31
- footerButtons: It,
32
- iconAvatar: wt,
33
- buttonsVisible: Tt
34
- }, St = /* @__PURE__ */ new Set([r.RATE_LIMITING, r.NO_CONTENT, r.PRECONDITION_FAILED, r.GENERAL, r.AGENT_NOT_FOUND]), Vt = /* @__PURE__ */ Y(({
35
- answer: o,
36
- citations: R,
37
- error: e,
38
- contentType: A,
39
- hostAppName: _,
40
- feedbackValue: O,
41
- isCitationsEnabled: B = !1,
16
+ import { References as cn } from "./references.js";
17
+ import { ThumbButtons as fn } from "./thumb-buttons.js";
18
+ import { jsxs as c, jsx as e } from "react/jsx-runtime";
19
+ import '../../../../styles/answer.css';const dn = "_answer_1efjn_1", _n = "_loadingContainer_1efjn_5", un = "_loadingText_1efjn_12", mn = "_fadeIn_1efjn_1", hn = "_alertIcon_1efjn_21", En = "_error_1efjn_24", Nn = "_footer_1efjn_28", pn = "_copyButtonContainer_1efjn_34", In = "_feedbackButtonsContainer_1efjn_35", gn = "_shouldHaveMarginTop_1efjn_39", Tn = "_shouldUseAnimation_1efjn_42", Sn = "_shouldAnimateHeight_1efjn_46", Rn = "_footerButtons_1efjn_50", jn = "_iconAvatar_1efjn_56", On = "_embedTheAnswerButtonContainer_1efjn_71", An = "_buttonsVisible_1efjn_79", n = {
20
+ answer: dn,
21
+ loadingContainer: _n,
22
+ loadingText: un,
23
+ fadeIn: mn,
24
+ alertIcon: hn,
25
+ error: En,
26
+ footer: Nn,
27
+ copyButtonContainer: pn,
28
+ feedbackButtonsContainer: In,
29
+ shouldHaveMarginTop: gn,
30
+ shouldUseAnimation: Tn,
31
+ shouldAnimateHeight: Sn,
32
+ footerButtons: Rn,
33
+ iconAvatar: jn,
34
+ embedTheAnswerButtonContainer: On,
35
+ buttonsVisible: An
36
+ }, Bn = /* @__PURE__ */ new Set([r.RATE_LIMITING, r.NO_CONTENT, r.PRECONDITION_FAILED, r.GENERAL, r.AGENT_NOT_FOUND]), Jn = /* @__PURE__ */ Z(({
37
+ answer: t,
38
+ citations: A,
39
+ error: o,
40
+ contentType: B,
41
+ hostAppName: f,
42
+ feedbackValue: b,
43
+ isCitationsEnabled: P = !1,
42
44
  isCompleted: s = !1,
43
- isFeedbackEnabled: b = !1,
44
- isFeedbackFormEnabled: C,
45
- isFeedbackTooltipOpen: f,
46
- isInlineCitationsEnabled: m = !1,
47
- isLoading: P = !1,
48
- isMarkdownEnabled: x = !1,
49
- items: a = [],
50
- onAnswerCopy: v,
51
- onCitationClick: M,
52
- onFeedbackFormSubmit: y,
53
- onFeedbackTooltipOpenChange: D,
54
- prompt: L,
55
- promptType: F,
56
- recordAction: i,
57
- shouldFeedbackFormIncludeFeedbackText: H,
58
- shouldFeedbackIncludePromptData: U,
59
- useAnimation: k = !0,
60
- variant: l = "modal",
61
- isReactMarkdownEnabled: G,
62
- setAnswerFeedback: V,
63
- questionId: j
45
+ isFeedbackEnabled: w = !1,
46
+ isFeedbackFormEnabled: x,
47
+ isFeedbackTooltipOpen: N,
48
+ isInlineCitationsEnabled: p = !1,
49
+ isLoading: C = !1,
50
+ isMarkdownEnabled: v = !1,
51
+ items: l = [],
52
+ onAnswerCopy: M,
53
+ embedTheAnswerButtonConfig: d,
54
+ onCitationClick: y,
55
+ onFeedbackFormSubmit: D,
56
+ onFeedbackTooltipOpenChange: L,
57
+ prompt: F,
58
+ promptType: H,
59
+ recordAction: a,
60
+ shouldFeedbackFormIncludeFeedbackText: U,
61
+ shouldFeedbackIncludePromptData: k,
62
+ useAnimation: G = !0,
63
+ variant: i = "modal",
64
+ isReactMarkdownEnabled: V,
65
+ setAnswerFeedback: z,
66
+ questionId: I
64
67
  }) => {
65
- const p = St.has(e), h = P && !o && !e, [z, q] = Z(s), {
66
- formatMessage: d
67
- } = tt();
68
- T(() => {
69
- o && i && s && a.some((K) => o.includes(K.name)) && i({
68
+ const m = Bn.has(o), h = C && !t && !o, [W, q] = $(s), {
69
+ formatMessage: _
70
+ } = en();
71
+ j(() => {
72
+ t && a && s && l.some((Q) => t.includes(Q.name)) && a({
70
73
  action: "programmatic",
71
- component: l,
74
+ component: i,
72
75
  feature: "answers",
73
76
  target: "links_detected",
74
77
  data: {
75
- hostAppName: _,
76
- linkCount: a.length,
77
- fileNameCount: a.length
78
+ hostAppName: f,
79
+ linkCount: l.length,
80
+ fileNameCount: l.length
78
81
  }
79
82
  });
80
- }, [o, l, _, s, i, a]), T(() => {
83
+ }, [t, i, f, s, a, l]), j(() => {
81
84
  setTimeout(() => q(s), 0);
82
85
  }, [s]);
83
- const E = () => /* @__PURE__ */ n(Q, {
84
- className: t.alertIcon,
85
- color: X,
86
+ const g = () => /* @__PURE__ */ e(X, {
87
+ className: n.alertIcon,
88
+ color: Y,
86
89
  "data-testid": "content-answers-error-alert-icon",
87
- height: I,
90
+ height: S,
88
91
  role: "presentation",
89
- width: I
90
- }), W = () => /* @__PURE__ */ c(N, {
92
+ width: S
93
+ }), J = () => /* @__PURE__ */ c(T, {
91
94
  as: "p",
92
- className: t.error,
95
+ className: n.error,
93
96
  color: "textOnLightSecondary",
94
97
  "data-testid": "content-answers-error",
95
98
  variant: "caption",
96
- children: [e === r.RESPONSE_INTERRUPTED && d(u.responseInterruptedError), e === r.RESPONSE_FAILED && d(u.responseFailedError), e === r.RESPONSE_STOPPED && d(u.responseStoppedError), e !== r.RESPONSE_STOPPED && E()]
97
- }), J = () => e !== r.RESPONSE_STOPPED ? /* @__PURE__ */ c("div", {
98
- className: w(t.footerButtons, "footer-buttons-container", {
99
- [t.buttonsVisible]: f
99
+ children: [o === r.RESPONSE_INTERRUPTED && _(u.responseInterruptedError), o === r.RESPONSE_FAILED && _(u.responseFailedError), o === r.RESPONSE_STOPPED && _(u.responseStoppedError), o !== r.RESPONSE_STOPPED && g()]
100
+ }), K = () => o !== r.RESPONSE_STOPPED ? /* @__PURE__ */ c("div", {
101
+ className: R(n.footerButtons, "footer-buttons-container", {
102
+ [n.buttonsVisible]: N
100
103
  }),
101
- children: [b ? /* @__PURE__ */ n("div", {
102
- className: t.feedbackButtonsContainer,
103
- children: /* @__PURE__ */ n(it, {
104
- feedbackValue: O,
105
- hostAppName: _,
106
- isFeedbackFormEnabled: C,
107
- isFeedbackTooltipOpen: f,
108
- items: a,
109
- onFeedbackFormSubmit: y,
110
- onFeedbackTooltipOpenChange: D,
111
- prompt: L,
112
- promptType: F,
113
- questionId: j,
114
- recordAction: i,
115
- response: g,
116
- setAnswerFeedback: V,
117
- shouldFeedbackFormIncludeFeedbackText: H,
118
- shouldFeedbackIncludePromptData: U,
119
- variant: l
104
+ children: [w ? /* @__PURE__ */ e("div", {
105
+ className: n.feedbackButtonsContainer,
106
+ children: /* @__PURE__ */ e(fn, {
107
+ feedbackValue: b,
108
+ hostAppName: f,
109
+ isFeedbackFormEnabled: x,
110
+ isFeedbackTooltipOpen: N,
111
+ items: l,
112
+ onFeedbackFormSubmit: D,
113
+ onFeedbackTooltipOpenChange: L,
114
+ prompt: F,
115
+ promptType: H,
116
+ questionId: I,
117
+ recordAction: a,
118
+ response: E,
119
+ setAnswerFeedback: z,
120
+ shouldFeedbackFormIncludeFeedbackText: U,
121
+ shouldFeedbackIncludePromptData: k,
122
+ variant: i
120
123
  })
121
- }) : null, /* @__PURE__ */ n("div", {
122
- className: t.copyButtonContainer,
123
- children: /* @__PURE__ */ n(rt, {
124
- answer: o,
125
- onAnswerCopy: v,
126
- recordAction: i
124
+ }) : null, /* @__PURE__ */ e("div", {
125
+ className: n.copyButtonContainer,
126
+ children: /* @__PURE__ */ e(sn, {
127
+ answer: t,
128
+ onAnswerCopy: M,
129
+ recordAction: a
127
130
  })
128
131
  })]
129
- }) : o ? null : E(), g = $(() => o && ot(o, {
130
- items: a,
132
+ }) : t ? null : g(), E = nn(() => t && tn(t, {
133
+ items: l,
131
134
  isCompleted: s,
132
- isInlineCitationsEnabled: m
133
- }), [o, a, s, m]);
135
+ isInlineCitationsEnabled: p
136
+ }), [t, l, s, p]);
134
137
  return /* @__PURE__ */ c("div", {
135
138
  "aria-live": "polite",
136
- className: t.answer,
139
+ className: n.answer,
137
140
  "data-testid": "content-answers-answer",
138
141
  children: [h && /* @__PURE__ */ c("div", {
139
- className: t.loadingContainer,
140
- children: [/* @__PURE__ */ n(nt, {}), /* @__PURE__ */ n(N, {
142
+ className: n.loadingContainer,
143
+ children: [/* @__PURE__ */ e(on, {}), /* @__PURE__ */ e(T, {
141
144
  as: "span",
142
- className: t.loadingText,
145
+ className: n.loadingText,
143
146
  color: "textOnLightDefault",
144
147
  variant: "titleMedium",
145
- children: d(u.analyzingRequest)
148
+ children: _(u.analyzingRequest)
146
149
  })]
147
- }), !p && !h && /* @__PURE__ */ n(S, {
150
+ }), !m && !h && /* @__PURE__ */ e(O, {
148
151
  className: "answer",
149
- variant: l,
150
- children: /* @__PURE__ */ c(S.Content, {
151
- isUsedInsideSidebar: l === "sidebar",
152
+ variant: i,
153
+ children: /* @__PURE__ */ c(O.Content, {
154
+ isUsedInsideSidebar: i === "sidebar",
152
155
  variant: "answer",
153
- children: [/* @__PURE__ */ n(et, {
154
- answer: g,
155
- isMarkdownEnabled: x,
156
- isReactMarkdownEnabled: G,
157
- variant: l
156
+ children: [/* @__PURE__ */ e(rn, {
157
+ answer: E,
158
+ isMarkdownEnabled: v,
159
+ isReactMarkdownEnabled: V,
160
+ variant: i
158
161
  }), s && /* @__PURE__ */ c("div", {
159
- className: w(t.footer, {
160
- [t.shouldHaveMarginTop]: o,
161
- [t.shouldAnimateHeight]: z,
162
- [t.shouldUseAnimation]: k
162
+ className: R(n.footer, {
163
+ [n.shouldHaveMarginTop]: t,
164
+ [n.shouldAnimateHeight]: W,
165
+ [n.shouldUseAnimation]: G
163
166
  }),
164
167
  "data-testid": "content-answers-answer-footer",
165
- children: [e && W(), B && !e && /* @__PURE__ */ n(at, {
166
- citations: R,
167
- onCitationClick: M,
168
- recordAction: i
169
- }), J()]
168
+ children: [o && J(), P && !o && /* @__PURE__ */ e(cn, {
169
+ citations: A,
170
+ onCitationClick: y,
171
+ recordAction: a
172
+ }), K()]
170
173
  })]
171
174
  })
172
- }), p && /* @__PURE__ */ n(st, {
173
- contentType: A,
174
- error: e,
175
- recordAction: i,
176
- variant: l
175
+ }), !m && !h && s && (d == null ? void 0 : d.onAction) && /* @__PURE__ */ e("div", {
176
+ className: n.embedTheAnswerButtonContainer,
177
+ children: /* @__PURE__ */ e(an, {
178
+ answer: E,
179
+ embedTheAnswerButtonConfig: d,
180
+ hostAppName: f,
181
+ questionId: I,
182
+ recordAction: a,
183
+ variant: i
184
+ })
185
+ }), m && /* @__PURE__ */ e(ln, {
186
+ contentType: B,
187
+ error: o,
188
+ recordAction: a,
189
+ variant: i
177
190
  })]
178
191
  });
179
192
  });
180
193
  export {
181
- Vt as Answer,
182
- Vt as default
194
+ Jn as Answer,
195
+ Jn as default
183
196
  };
@@ -0,0 +1,65 @@
1
+ import { Tooltip as N, Button as I } from "@box/blueprint-web";
2
+ import { BoxNotes as f } from "@box/blueprint-web-assets/icons/Line";
3
+ import { useState as F, useCallback as G } from "react";
4
+ import { useIntl as h } from "react-intl";
5
+ import { LOGGER_BASE_CONFIG as z, LOGGER_ACTION_CLICK as E } from "../common/constants.js";
6
+ import { focusInput as O } from "../common/focusInputUtils.js";
7
+ import p from "./messages.js";
8
+ import { jsx as e } from "react/jsx-runtime";
9
+ import '../../../../styles/embed-the-answer-button.css';const v = "_embedTheAnswerButtonContainer_1dz6d_1", L = "_embedTheAnswerButton_1dz6d_1", b = "_completedText_1dz6d_37", l = {
10
+ embedTheAnswerButtonContainer: v,
11
+ embedTheAnswerButton: L,
12
+ completedText: b
13
+ }, M = ({
14
+ answer: o,
15
+ hostAppName: d,
16
+ embedTheAnswerButtonConfig: t,
17
+ questionId: u,
18
+ recordAction: s,
19
+ variant: _
20
+ }) => {
21
+ const {
22
+ formatMessage: n
23
+ } = h(), [a, m] = F(!1), x = () => {
24
+ !o || !(t != null && t.onAction) || a || (s == null || s({
25
+ ...z,
26
+ action: E,
27
+ target: "add_to_note",
28
+ component: _,
29
+ data: {
30
+ hostAppName: d,
31
+ questionId: u || ""
32
+ }
33
+ }), t.onAction(o), m(!0), setTimeout(() => {
34
+ m(!1);
35
+ }, 5e3), O());
36
+ }, T = G((i) => {
37
+ i.target.matches(":focus-visible") || i.stopPropagation();
38
+ }, []);
39
+ if (!o || !(t != null && t.onAction))
40
+ return null;
41
+ const c = t.actionText || n(p.addToNote), r = t.completedText || n(p.addedToNote);
42
+ return /* @__PURE__ */ e(N, {
43
+ content: a ? r : c,
44
+ children: /* @__PURE__ */ e("div", {
45
+ className: l.embedTheAnswerButtonContainer,
46
+ children: a ? /* @__PURE__ */ e("span", {
47
+ className: l.completedText,
48
+ children: r
49
+ }) : /* @__PURE__ */ e(I, {
50
+ "aria-label": c,
51
+ className: l.embedTheAnswerButton,
52
+ icon: f,
53
+ onClick: x,
54
+ onFocusCapture: T,
55
+ size: "small",
56
+ variant: "tertiary",
57
+ children: c
58
+ })
59
+ })
60
+ });
61
+ };
62
+ export {
63
+ M as EmbedTheAnswerButton,
64
+ M as default
65
+ };
@@ -1,5 +1,13 @@
1
1
  import { defineMessages as e } from "react-intl";
2
2
  const t = e({
3
+ addToNote: {
4
+ id: "boxAI.contentAnswers.addToNote",
5
+ defaultMessage: "Add to Note"
6
+ },
7
+ addedToNote: {
8
+ id: "boxAI.contentAnswers.addedToNote",
9
+ defaultMessage: "Added"
10
+ },
3
11
  basedOn: {
4
12
  id: "boxAI.contentAnswers.basedOn",
5
13
  defaultMessage: "Based on:"
@@ -1,25 +1,25 @@
1
- import { Text as Z } from "@box/blueprint-web";
2
- import { BoxAiLogo as $ } from "@box/blueprint-web-assets/icons/Logo";
1
+ import { Text as $ } from "@box/blueprint-web";
2
+ import { BoxAiLogo as w } from "@box/blueprint-web-assets/icons/Logo";
3
3
  import { Size10 as f } from "@box/blueprint-web-assets/tokens/tokens";
4
- import w from "clsx";
5
- import * as L from "react";
6
- import { useIntl as P } from "react-intl";
7
- import { Answer as S } from "../answer/answer.js";
8
- import { MediaContainer as ee } from "../common/media-container.js";
9
- import { Question as te } from "../question/question.js";
10
- import { SuggestedQuestions as oe } from "../suggested-questions/suggested-questions.js";
11
- import { ThinkingBubble as ae } from "../thinkingBubble/thinkingBubble.js";
12
- import ie from "../welcome-message/messages.js";
13
- import { WelcomeMessage as re } from "../welcome-message/welcome-message.js";
4
+ import L from "clsx";
5
+ import * as P from "react";
6
+ import { useIntl as S } from "react-intl";
7
+ import { Answer as ee } from "../answer/answer.js";
8
+ import { MediaContainer as te } from "../common/media-container.js";
9
+ import { Question as oe } from "../question/question.js";
10
+ import { SuggestedQuestions as ae } from "../suggested-questions/suggested-questions.js";
11
+ import { ThinkingBubble as ie } from "../thinkingBubble/thinkingBubble.js";
12
+ import re from "../welcome-message/messages.js";
13
+ import { WelcomeMessage as se } from "../welcome-message/welcome-message.js";
14
14
  import { jsx as e, jsxs as _ } from "react/jsx-runtime";
15
- import '../../../../styles/chat.css';const se = "_chat_77vqr_1", ne = "_clearChatText_77vqr_1", ce = "_landingPage_77vqr_7", le = "_askQuestionText_77vqr_15", me = "_iconAvatar_77vqr_23", pe = "_sidebar_77vqr_39", a = {
16
- chat: se,
17
- clearChatText: ne,
18
- landingPage: ce,
19
- askQuestionText: le,
20
- iconAvatar: me,
21
- sidebar: pe
22
- }, Fe = ({
15
+ import '../../../../styles/chat.css';const ne = "_chat_77vqr_1", ce = "_clearChatText_77vqr_1", le = "_landingPage_77vqr_7", me = "_askQuestionText_77vqr_15", pe = "_iconAvatar_77vqr_23", de = "_sidebar_77vqr_39", a = {
16
+ chat: ne,
17
+ clearChatText: ce,
18
+ landingPage: le,
19
+ askQuestionText: me,
20
+ iconAvatar: pe,
21
+ sidebar: de
22
+ }, Ae = ({
23
23
  askSuggestedQuestion: h,
24
24
  contentType: n,
25
25
  hasCustomSuggestedQuestions: T,
@@ -32,119 +32,121 @@ import '../../../../styles/chat.css';const se = "_chat_77vqr_1", ne = "_clearCha
32
32
  isSessionLoading: u = !1,
33
33
  onCitationClick: q,
34
34
  onAnswerCopy: F,
35
- onFeedbackFormSubmit: A,
36
- onDropdownOpenChange: I,
37
- onSuggestedQuestionInteraction: N,
38
- questions: O,
35
+ embedTheAnswerButtonConfig: A,
36
+ onFeedbackFormSubmit: I,
37
+ onDropdownOpenChange: N,
38
+ onSuggestedQuestionInteraction: O,
39
+ questions: Q,
39
40
  recordAction: c,
40
- setAnswerFeedback: Q,
41
+ setAnswerFeedback: j,
41
42
  setAskSuggestedQuestion: l,
42
43
  suggestedQuestions: m,
43
- suggestedQuestionsRequestState: j,
44
- shouldFeedbackFormIncludeFeedbackText: y,
45
- shouldFeedbackIncludePromptData: B,
44
+ suggestedQuestionsRequestState: y,
45
+ shouldFeedbackFormIncludeFeedbackText: B,
46
+ shouldFeedbackIncludePromptData: M,
46
47
  shouldShowLandingPage: o,
47
- useAnimation: M,
48
+ useAnimation: z,
48
49
  variant: t = "modal",
49
- hostAppName: z = "",
50
- isReactMarkdownEnabled: R,
51
- welcomeMessageClearText: W,
50
+ hostAppName: R = "",
51
+ isReactMarkdownEnabled: W,
52
+ welcomeMessageClearText: D,
52
53
  ...p
53
54
  }) => {
54
55
  const {
55
- formatMessage: D
56
- } = P(), [E, G] = L.useState(null), H = (i, r) => {
57
- G(i ? r : null);
56
+ formatMessage: E
57
+ } = S(), [G, H] = P.useState(null), J = (i, r) => {
58
+ H(i ? r : null);
58
59
  };
59
60
  return /* @__PURE__ */ e("div", {
60
61
  className: a.chat,
61
62
  "data-testid": "content-answers-chat",
62
63
  children: /* @__PURE__ */ _("div", {
63
- className: w({
64
+ className: L({
64
65
  [a.landingPage]: o,
65
66
  [a.sidebar]: t === "sidebar"
66
67
  }),
67
- children: [o && /* @__PURE__ */ e(ee.Figure, {
68
+ children: [o && /* @__PURE__ */ e(te.Figure, {
68
69
  variant: t,
69
70
  children: /* @__PURE__ */ e("div", {
70
71
  className: a.iconAvatar,
71
- children: /* @__PURE__ */ e($, {
72
+ children: /* @__PURE__ */ e(w, {
72
73
  height: f,
73
74
  role: "presentation",
74
75
  width: f
75
76
  })
76
77
  })
77
- }), /* @__PURE__ */ e(re, {
78
+ }), /* @__PURE__ */ e(se, {
78
79
  contentType: "",
79
80
  shouldShowLandingPage: o,
80
81
  ...p,
81
82
  variant: t
82
- }), o && m !== void 0 && l !== void 0 && /* @__PURE__ */ e(oe, {
83
+ }), o && m !== void 0 && l !== void 0 && /* @__PURE__ */ e(ae, {
83
84
  askSuggestedQuestion: h,
84
85
  hasCustomSuggestedQuestions: T,
85
86
  isLoading: x,
86
- onSuggestedQuestionInteraction: N,
87
+ onSuggestedQuestionInteraction: O,
87
88
  recordAction: c,
88
89
  setAskSuggestedQuestion: l,
89
90
  suggestedQuestions: m,
90
- suggestedQuestionsRequestState: j,
91
+ suggestedQuestionsRequestState: y,
91
92
  variant: t
92
- }), /* @__PURE__ */ e(Z, {
93
+ }), /* @__PURE__ */ e($, {
93
94
  as: "p",
94
95
  className: a.clearChatText,
95
- children: W || D(ie.welcomeClearChatText, {
96
+ children: D || E(re.welcomeClearChatText, {
96
97
  type: n
97
98
  })
98
99
  }), !o && /* @__PURE__ */ e("ul", {
99
- children: O.map(({
100
+ children: Q.map(({
100
101
  answer: i,
101
102
  thinkingAnswer: r,
102
- citations: J,
103
+ citations: K,
103
104
  id: s,
104
- isCompleted: K,
105
- isLoading: U,
106
- error: V,
105
+ isCompleted: U,
106
+ isLoading: V,
107
+ error: X,
107
108
  prompt: d,
108
- promptType: X,
109
- feedbackValue: Y
109
+ promptType: Y,
110
+ feedbackValue: Z
110
111
  }) => /* @__PURE__ */ _("li", {
111
- children: [/* @__PURE__ */ e(te, {
112
+ children: [/* @__PURE__ */ e(oe, {
112
113
  prompt: d,
113
114
  variant: t
114
- }), r && /* @__PURE__ */ e(ae, {
115
+ }), r && /* @__PURE__ */ e(ie, {
115
116
  content: r,
116
117
  isThinkingComplete: !!i,
117
- onDropdownOpenChange: I,
118
+ onDropdownOpenChange: N,
118
119
  variant: t
119
- }), /* @__PURE__ */ e(S, {
120
+ }), /* @__PURE__ */ e(ee, {
120
121
  answer: i,
121
- citations: J,
122
+ citations: K,
122
123
  contentType: n,
123
- error: V,
124
- feedbackValue: Y,
125
- hostAppName: z,
124
+ embedTheAnswerButtonConfig: A,
125
+ error: X,
126
+ feedbackValue: Z,
127
+ hostAppName: R,
126
128
  isCitationsEnabled: b,
127
- isCompleted: K,
129
+ isCompleted: U,
128
130
  isFeedbackEnabled: C,
129
131
  isFeedbackFormEnabled: v,
130
- isFeedbackTooltipOpen: E === s,
132
+ isFeedbackTooltipOpen: G === s,
131
133
  isInlineCitationsEnabled: g,
132
- isLoading: U || u,
134
+ isLoading: V || u,
133
135
  isMarkdownEnabled: k,
134
- isReactMarkdownEnabled: R,
136
+ isReactMarkdownEnabled: W,
135
137
  items: p.items,
136
138
  onAnswerCopy: F,
137
139
  onCitationClick: q,
138
- onFeedbackFormSubmit: A,
139
- onFeedbackTooltipOpenChange: H,
140
+ onFeedbackFormSubmit: I,
141
+ onFeedbackTooltipOpenChange: J,
140
142
  prompt: d,
141
- promptType: X,
143
+ promptType: Y,
142
144
  questionId: s,
143
145
  recordAction: c,
144
- setAnswerFeedback: Q,
145
- shouldFeedbackFormIncludeFeedbackText: y,
146
- shouldFeedbackIncludePromptData: B,
147
- useAnimation: M,
146
+ setAnswerFeedback: j,
147
+ shouldFeedbackFormIncludeFeedbackText: B,
148
+ shouldFeedbackIncludePromptData: M,
149
+ useAnimation: z,
148
150
  variant: t
149
151
  })]
150
152
  }, s))
@@ -153,6 +155,6 @@ import '../../../../styles/chat.css';const se = "_chat_77vqr_1", ne = "_clearCha
153
155
  });
154
156
  };
155
157
  export {
156
- Fe as Chat,
157
- Fe as default
158
+ Ae as Chat,
159
+ Ae as default
158
160
  };