@box/box-ai-content-answers 0.148.7 → 0.148.9

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.
@@ -1,24 +1,24 @@
1
- import { Text as K } from "@box/blueprint-web";
2
- import { BoxAiLogo as U } from "@box/blueprint-web-assets/icons/Logo";
1
+ import { Text as U } from "@box/blueprint-web";
2
+ import { BoxAiLogo as V } from "@box/blueprint-web-assets/icons/Logo";
3
3
  import { Size10 as d } from "@box/blueprint-web-assets/tokens/tokens";
4
- import V from "clsx";
5
- import * as X from "react";
6
- import { useIntl as Y } from "react-intl";
7
- import { Answer as Z } from "../answer/answer.js";
8
- import { MediaContainer as $ } from "../common/media-container.js";
9
- import { Question as L } from "../question/question.js";
10
- import { SuggestedQuestions as P } from "../suggested-questions/suggested-questions.js";
11
- import S from "../welcome-message/messages.js";
12
- import { WelcomeMessage as ee } from "../welcome-message/welcome-message.js";
4
+ import X from "clsx";
5
+ import * as Y from "react";
6
+ import { useIntl as Z } from "react-intl";
7
+ import { Answer as $ } from "../answer/answer.js";
8
+ import { MediaContainer as L } from "../common/media-container.js";
9
+ import { Question as P } from "../question/question.js";
10
+ import { SuggestedQuestions as S } from "../suggested-questions/suggested-questions.js";
11
+ import ee from "../welcome-message/messages.js";
12
+ import { WelcomeMessage as te } from "../welcome-message/welcome-message.js";
13
13
  import { jsx as e, jsxs as _ } from "react/jsx-runtime";
14
- import '../../../../styles/chat.css';const te = "_chat_77vqr_1", oe = "_clearChatText_77vqr_1", ae = "_landingPage_77vqr_7", re = "_askQuestionText_77vqr_15", se = "_iconAvatar_77vqr_23", ie = "_sidebar_77vqr_39", a = {
15
- chat: te,
16
- clearChatText: oe,
17
- landingPage: ae,
18
- askQuestionText: re,
19
- iconAvatar: se,
20
- sidebar: ie
21
- }, ve = ({
14
+ import '../../../../styles/chat.css';const oe = "_chat_77vqr_1", ae = "_clearChatText_77vqr_1", re = "_landingPage_77vqr_7", se = "_askQuestionText_77vqr_15", ie = "_iconAvatar_77vqr_23", ne = "_sidebar_77vqr_39", a = {
15
+ chat: oe,
16
+ clearChatText: ae,
17
+ landingPage: re,
18
+ askQuestionText: se,
19
+ iconAvatar: ie,
20
+ sidebar: ne
21
+ }, Ce = ({
22
22
  askSuggestedQuestion: f,
23
23
  contentType: n,
24
24
  hasCustomSuggestedQuestions: h,
@@ -44,38 +44,39 @@ import '../../../../styles/chat.css';const te = "_chat_77vqr_1", oe = "_clearCha
44
44
  useAnimation: j,
45
45
  variant: t = "modal",
46
46
  hostAppName: y = "",
47
- welcomeMessageClearText: M,
47
+ isReactMarkdownEnabled: M,
48
+ welcomeMessageClearText: w,
48
49
  ...p
49
50
  }) => {
50
51
  const {
51
- formatMessage: w
52
- } = Y(), [z, B] = X.useState(null), R = (r, s) => {
53
- B(r ? s : null);
52
+ formatMessage: z
53
+ } = Z(), [B, R] = Y.useState(null), W = (r, s) => {
54
+ R(r ? s : null);
54
55
  };
55
56
  return /* @__PURE__ */ e("div", {
56
57
  className: a.chat,
57
58
  "data-testid": "content-answers-chat",
58
59
  children: /* @__PURE__ */ _("div", {
59
- className: V({
60
+ className: X({
60
61
  [a.landingPage]: o,
61
62
  [a.sidebar]: t === "sidebar"
62
63
  }),
63
- children: [o && /* @__PURE__ */ e($.Figure, {
64
+ children: [o && /* @__PURE__ */ e(L.Figure, {
64
65
  variant: t,
65
66
  children: /* @__PURE__ */ e("div", {
66
67
  className: a.iconAvatar,
67
- children: /* @__PURE__ */ e(U, {
68
+ children: /* @__PURE__ */ e(V, {
68
69
  height: d,
69
70
  role: "presentation",
70
71
  width: d
71
72
  })
72
73
  })
73
- }), /* @__PURE__ */ e(ee, {
74
+ }), /* @__PURE__ */ e(te, {
74
75
  contentType: "",
75
76
  shouldShowLandingPage: o,
76
77
  ...p,
77
78
  variant: t
78
- }), o && m !== void 0 && l !== void 0 && /* @__PURE__ */ e(P, {
79
+ }), o && m !== void 0 && l !== void 0 && /* @__PURE__ */ e(S, {
79
80
  askSuggestedQuestion: f,
80
81
  hasCustomSuggestedQuestions: h,
81
82
  isLoading: x,
@@ -85,10 +86,10 @@ import '../../../../styles/chat.css';const te = "_chat_77vqr_1", oe = "_clearCha
85
86
  suggestedQuestions: m,
86
87
  suggestedQuestionsRequestState: O,
87
88
  variant: t
88
- }), /* @__PURE__ */ e(K, {
89
+ }), /* @__PURE__ */ e(U, {
89
90
  as: "p",
90
91
  className: a.clearChatText,
91
- children: M || w(S.welcomeClearChatText, {
92
+ children: w || z(ee.welcomeClearChatText, {
92
93
  type: n
93
94
  })
94
95
  }), !o && /* @__PURE__ */ e("ul", {
@@ -96,37 +97,38 @@ import '../../../../styles/chat.css';const te = "_chat_77vqr_1", oe = "_clearCha
96
97
  answer: r,
97
98
  citations: s,
98
99
  id: i,
99
- isCompleted: W,
100
- isLoading: D,
101
- error: E,
102
- prompt: G,
103
- promptType: H,
104
- feedbackValue: J
100
+ isCompleted: D,
101
+ isLoading: E,
102
+ error: G,
103
+ prompt: H,
104
+ promptType: J,
105
+ feedbackValue: K
105
106
  }) => /* @__PURE__ */ _("li", {
106
- children: [/* @__PURE__ */ e(L, {
107
- prompt: G,
107
+ children: [/* @__PURE__ */ e(P, {
108
+ prompt: H,
108
109
  variant: t
109
- }), /* @__PURE__ */ e(Z, {
110
+ }), /* @__PURE__ */ e($, {
110
111
  answer: r,
111
112
  citations: s,
112
113
  contentType: n,
113
- error: E,
114
- feedbackValue: J,
114
+ error: G,
115
+ feedbackValue: K,
115
116
  hostAppName: y,
116
117
  isCitationsEnabled: T,
117
- isCompleted: W,
118
+ isCompleted: D,
118
119
  isFeedbackEnabled: b,
119
120
  isFeedbackFormEnabled: v,
120
- isFeedbackTooltipOpen: z === i,
121
+ isFeedbackTooltipOpen: B === i,
121
122
  isInlineCitationsEnabled: C,
122
- isLoading: D || k,
123
+ isLoading: E || k,
123
124
  isMarkdownEnabled: g,
125
+ isReactMarkdownEnabled: M,
124
126
  items: p.items,
125
127
  onAnswerCopy: u,
126
128
  onCitationClick: q,
127
129
  onFeedbackFormSubmit: A,
128
- onFeedbackTooltipOpenChange: R,
129
- promptType: H,
130
+ onFeedbackTooltipOpenChange: W,
131
+ promptType: J,
130
132
  questionId: i,
131
133
  recordAction: c,
132
134
  setAnswerFeedback: N,
@@ -140,6 +142,6 @@ import '../../../../styles/chat.css';const te = "_chat_77vqr_1", oe = "_clearCha
140
142
  });
141
143
  };
142
144
  export {
143
- ve as Chat,
144
- ve as default
145
+ Ce as Chat,
146
+ Ce as default
145
147
  };
@@ -0,0 +1,99 @@
1
+ import i from "react-markdown";
2
+ import d from "remark-gfm";
3
+ import { jsxs as a, jsx as n } from "react/jsx-runtime";
4
+ const m = ({
5
+ children: e,
6
+ className: t
7
+ }) => {
8
+ const o = t ? t.replace("language-", "") : "";
9
+ return /* @__PURE__ */ a("div", {
10
+ className: "hljs",
11
+ children: [/* @__PURE__ */ n("span", {
12
+ className: "hljs-language",
13
+ children: o || "auto"
14
+ }), /* @__PURE__ */ n("code", {
15
+ children: ((s) => s.trim().split(/\r?\n/).map((c, l) => /* @__PURE__ */ a("div", {
16
+ className: "hljs-line",
17
+ children: [/* @__PURE__ */ n("span", {
18
+ className: "hljs-line-number",
19
+ children: l + 1
20
+ }), /* @__PURE__ */ n("span", {
21
+ className: "hljs-line-content",
22
+ children: c
23
+ })]
24
+ }, `line-${c.substring(0, 20)}-${Date.now()}`)))(e)
25
+ })]
26
+ });
27
+ }, u = ({
28
+ children: e
29
+ }) => /* @__PURE__ */ n("div", {
30
+ className: "table-wrapper",
31
+ children: /* @__PURE__ */ n("table", {
32
+ children: e
33
+ })
34
+ }), h = ({
35
+ href: e,
36
+ children: t
37
+ }) => /* @__PURE__ */ a("span", {
38
+ children: [t, " (", e, ")"]
39
+ }), f = ({
40
+ children: e
41
+ }) => /* @__PURE__ */ n("blockquote", {
42
+ className: "blockquote",
43
+ children: e
44
+ }), N = ({
45
+ children: e
46
+ }) => /* @__PURE__ */ n("ol", {
47
+ className: "orderedList",
48
+ children: e
49
+ }), b = ({
50
+ children: e
51
+ }) => {
52
+ var o;
53
+ const t = ((o = e == null ? void 0 : e.toString().match(/^(\d+)/)) == null ? void 0 : o[1]) || e;
54
+ return /* @__PURE__ */ n("span", {
55
+ className: "footnote",
56
+ children: t
57
+ });
58
+ }, k = {
59
+ code: m,
60
+ table: u,
61
+ blockquote: f,
62
+ ol: N,
63
+ sup: b,
64
+ // Handle footnote references
65
+ // Handle footnote references that might be rendered as links
66
+ a: (e) => {
67
+ var t, o, r;
68
+ if ((t = e.href) != null && t.startsWith("#user-content-fn")) {
69
+ const s = ((r = (o = e.children) == null ? void 0 : o.toString().match(/^(\d+)/)) == null ? void 0 : r[1]) || e.children;
70
+ return /* @__PURE__ */ n("a", {
71
+ className: "footnote-reference",
72
+ href: e.href,
73
+ children: s
74
+ });
75
+ }
76
+ return /* @__PURE__ */ n(h, {
77
+ href: e.href,
78
+ children: e.children
79
+ });
80
+ }
81
+ }, q = ({
82
+ children: e
83
+ }) => /* @__PURE__ */ n("div", {
84
+ className: "markdown-content",
85
+ children: /* @__PURE__ */ n(i, {
86
+ components: k,
87
+ remarkPlugins: [d],
88
+ children: e
89
+ })
90
+ });
91
+ export {
92
+ f as Blockquote,
93
+ m as CodeBlock,
94
+ b as Footnote,
95
+ h as Link,
96
+ N as Ol,
97
+ u as Table,
98
+ q as default
99
+ };