@box/box-ai-content-answers 0.86.2 → 0.87.2

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 (127) hide show
  1. package/chunks/clear-conversation-button.js +12 -13
  2. package/chunks/markdown.js +12168 -0
  3. package/esm/lib/box-ai-content-answers.js +11 -12
  4. package/esm/lib/components/agents/agent-editor.js +7 -8
  5. package/esm/lib/components/agents/agent-selector.js +3 -4
  6. package/esm/lib/components/answer/answer-content.js +5 -6
  7. package/esm/lib/components/answer/answer.js +604 -107
  8. package/esm/lib/components/answer/citation.js +4 -5
  9. package/esm/lib/components/answer/inline-error.js +4 -5
  10. package/esm/lib/components/answer/loading-element.js +4 -5
  11. package/esm/lib/components/answer/references.js +19 -20
  12. package/esm/lib/components/answer/thumb-buttons.js +11 -12
  13. package/esm/lib/components/chat/chat.js +13 -14
  14. package/esm/lib/components/common/markdown.js +3 -12212
  15. package/esm/lib/components/common/media-container.js +10 -11
  16. package/esm/lib/components/content/content.js +4 -5
  17. package/esm/lib/components/footer/footer-actions.js +3 -4
  18. package/esm/lib/components/footer/footer.js +3 -4
  19. package/esm/lib/components/modal-error/modal-error.js +3 -4
  20. package/esm/lib/components/question/question.js +12 -13
  21. package/esm/lib/components/suggested-questions/suggested-questions.js +10 -11
  22. package/esm/lib/components/suggested-questions/suggestions.js +8 -9
  23. package/esm/lib/components/welcome-message/contextual-items-message.js +4 -5
  24. package/esm/lib/components/welcome-message/items-dropdown.js +15 -16
  25. package/esm/lib/components/welcome-message/unsupported-items-notice.js +9 -10
  26. package/esm/lib/components/welcome-message/welcome-message.js +11 -12
  27. package/i18n/bn-IN.js +3 -3
  28. package/i18n/bn-IN.properties +7 -3
  29. package/i18n/da-DK.js +3 -3
  30. package/i18n/da-DK.properties +7 -3
  31. package/i18n/de-DE.js +3 -3
  32. package/i18n/de-DE.properties +7 -3
  33. package/i18n/en-AU.js +3 -3
  34. package/i18n/en-AU.properties +7 -3
  35. package/i18n/en-CA.js +1 -1
  36. package/i18n/en-CA.properties +5 -1
  37. package/i18n/en-GB.js +3 -3
  38. package/i18n/en-GB.properties +7 -3
  39. package/i18n/en-x-pseudo.js +59 -59
  40. package/i18n/en-x-pseudo.properties +61 -57
  41. package/i18n/es-419.js +3 -3
  42. package/i18n/es-419.properties +7 -3
  43. package/i18n/es-ES.js +3 -3
  44. package/i18n/es-ES.properties +7 -3
  45. package/i18n/fi-FI.js +3 -3
  46. package/i18n/fi-FI.properties +7 -3
  47. package/i18n/fr-CA.js +3 -3
  48. package/i18n/fr-CA.properties +7 -3
  49. package/i18n/fr-FR.js +3 -3
  50. package/i18n/fr-FR.properties +7 -3
  51. package/i18n/hi-IN.js +3 -3
  52. package/i18n/hi-IN.properties +7 -3
  53. package/i18n/it-IT.js +3 -3
  54. package/i18n/it-IT.properties +7 -3
  55. package/i18n/ja-JP.js +4 -4
  56. package/i18n/ja-JP.properties +8 -4
  57. package/i18n/ko-KR.js +3 -3
  58. package/i18n/ko-KR.properties +7 -3
  59. package/i18n/nb-NO.js +3 -3
  60. package/i18n/nb-NO.properties +7 -3
  61. package/i18n/nl-NL.js +3 -3
  62. package/i18n/nl-NL.properties +7 -3
  63. package/i18n/pl-PL.js +3 -3
  64. package/i18n/pl-PL.properties +7 -3
  65. package/i18n/pt-BR.js +3 -3
  66. package/i18n/pt-BR.properties +7 -3
  67. package/i18n/ru-RU.js +3 -3
  68. package/i18n/ru-RU.properties +7 -3
  69. package/i18n/sv-SE.js +3 -3
  70. package/i18n/sv-SE.properties +7 -3
  71. package/i18n/tr-TR.js +3 -3
  72. package/i18n/tr-TR.properties +7 -3
  73. package/i18n/zh-CN.js +3 -3
  74. package/i18n/zh-CN.properties +7 -3
  75. package/i18n/zh-TW.js +3 -3
  76. package/i18n/zh-TW.properties +7 -3
  77. package/package.json +7 -7
  78. package/types/lib/box-ai-content-answers.d.ts +1 -1
  79. package/types/lib/components/agents/agent-editor.d.ts +1 -1
  80. package/types/lib/components/agents/agent-selector.d.ts +1 -1
  81. package/types/lib/components/agents/stories/shared.d.ts +3 -3
  82. package/types/lib/components/answer/answer-content.d.ts +2 -2
  83. package/types/lib/components/answer/answer.d.ts +1 -1
  84. package/types/lib/components/answer/citation.d.ts +1 -1
  85. package/types/lib/components/answer/copy-button.d.ts +1 -1
  86. package/types/lib/components/answer/inline-error.d.ts +1 -1
  87. package/types/lib/components/answer/loading-element.d.ts +1 -1
  88. package/types/lib/components/answer/no-citations.d.ts +1 -1
  89. package/types/lib/components/answer/references.d.ts +1 -1
  90. package/types/lib/components/answer/stories/shared.d.ts +1 -1
  91. package/types/lib/components/answer/thumb-buttons.d.ts +1 -1
  92. package/types/lib/components/api-wrapper/api-wrapper.d.ts +1 -1
  93. package/types/lib/components/api-wrapper/constants.d.ts +1 -1
  94. package/types/lib/components/api-wrapper/content-answers-component.d.ts +1 -1
  95. package/types/lib/components/api-wrapper/hooks/useContentAnswers.d.ts +4 -4
  96. package/types/lib/components/api-wrapper/records.d.ts +1 -1
  97. package/types/lib/components/api-wrapper/stories/shared.d.ts +1 -1
  98. package/types/lib/components/api-wrapper/test-utils/ReadableStreamSimulator.d.ts +1 -1
  99. package/types/lib/components/api-wrapper/types.d.ts +3 -3
  100. package/types/lib/components/api-wrapper/utils/format.d.ts +1 -1
  101. package/types/lib/components/api-wrapper/utils/request.d.ts +3 -3
  102. package/types/lib/components/api-wrapper/utils/stream.d.ts +1 -1
  103. package/types/lib/components/chat/chat.d.ts +1 -1
  104. package/types/lib/components/common/constants.d.ts +1 -1
  105. package/types/lib/components/common/media-container.d.ts +2 -2
  106. package/types/lib/components/common/mock-data.d.ts +4 -4
  107. package/types/lib/components/content/content.d.ts +1 -1
  108. package/types/lib/components/footer/footer-actions.d.ts +1 -1
  109. package/types/lib/components/footer/footer.d.ts +1 -1
  110. package/types/lib/components/footer/stories/shared.d.ts +7 -7
  111. package/types/lib/components/modal/modal.d.ts +5 -5
  112. package/types/lib/components/modal/stories/shared.d.ts +2 -2
  113. package/types/lib/components/modal-error/stories/shared.d.ts +1 -1
  114. package/types/lib/components/question/question.d.ts +1 -1
  115. package/types/lib/components/question/stories/shared.d.ts +1 -1
  116. package/types/lib/components/suggested-questions/mocks.d.ts +1 -1
  117. package/types/lib/components/suggested-questions/stories/shared.d.ts +1 -1
  118. package/types/lib/components/suggested-questions/suggested-questions.d.ts +1 -1
  119. package/types/lib/components/suggested-questions/suggestions.d.ts +1 -1
  120. package/types/lib/components/welcome-message/contextual-items-message.d.ts +1 -1
  121. package/types/lib/components/welcome-message/items-dropdown.d.ts +1 -1
  122. package/types/lib/components/welcome-message/stories/shared.d.ts +4 -4
  123. package/types/lib/components/welcome-message/unsupported-items-notice.d.ts +1 -1
  124. package/types/lib/components/welcome-message/welcome-message.d.ts +1 -1
  125. package/types/lib/contexts/AgentsContext.d.ts +1 -1
  126. package/types/lib/stories/shared.d.ts +3 -3
  127. package/types/lib/types.d.ts +2 -2
@@ -1,4 +1,3 @@
1
- import "../../../../styles/citation.css";
2
1
  import { Popover as d, Status as O, Text as x, TextButton as k } from "@box/blueprint-web";
3
2
  import { ArrowUpRightSquare as E } from "@box/blueprint-web-assets/icons/Fill";
4
3
  import L from "clsx";
@@ -10,7 +9,7 @@ import { LOGGER_BASE_CONFIG as v, LOGGER_ACTION_CLICK as j } from "../common/con
10
9
  import { MAX_CITATION_LENGTH as K } from "./constants.js";
11
10
  import s from "./messages.js";
12
11
  import { jsxs as y, jsx as e } from "react/jsx-runtime";
13
- const P = "_citationTrigger_wo5ky_1", U = "_citationStatus_wo5ky_5", q = "_animate_wo5ky_12", H = "_fadeIn_wo5ky_16", W = "_cardTooltip_wo5ky_20", X = "_cardTooltipTitle_wo5ky_24", $ = "_cardTooltipCitation_wo5ky_28", z = "_cardTooltipButton_wo5ky_33", o = {
12
+ import '../../../../styles/citation.css';const P = "_citationTrigger_wo5ky_1", U = "_citationStatus_wo5ky_5", q = "_animate_wo5ky_12", H = "_fadeIn_wo5ky_16", W = "_cardTooltip_wo5ky_20", X = "_cardTooltipTitle_wo5ky_24", $ = "_cardTooltipCitation_wo5ky_28", z = "_cardTooltipButton_wo5ky_33", o = {
14
13
  citationTrigger: P,
15
14
  citationStatus: U,
16
15
  animate: q,
@@ -19,7 +18,7 @@ const P = "_citationTrigger_wo5ky_1", U = "_citationStatus_wo5ky_5", q = "_anima
19
18
  cardTooltipTitle: X,
20
19
  cardTooltipCitation: $,
21
20
  cardTooltipButton: z
22
- }, st = ({
21
+ }, rt = ({
23
22
  animate: p,
24
23
  content: m,
25
24
  id: a,
@@ -134,6 +133,6 @@ const P = "_citationTrigger_wo5ky_1", U = "_citationStatus_wo5ky_5", q = "_anima
134
133
  });
135
134
  };
136
135
  export {
137
- st as Citation,
138
- st as default
136
+ rt as Citation,
137
+ rt as default
139
138
  };
@@ -1,4 +1,3 @@
1
- import "../../../../styles/inline-error.css";
2
1
  import { useBreakpoint as f, Breakpoint as N, Text as h } from "@box/blueprint-web";
3
2
  import { AlertTriangle as x } from "@box/blueprint-web-assets/icons/Line";
4
3
  import { BoxAiLogo as g } from "@box/blueprint-web-assets/icons/Logo";
@@ -10,12 +9,12 @@ import { LOGGER_BASE_CONFIG as A } from "../common/constants.js";
10
9
  import { MediaContainer as l } from "../common/media-container.js";
11
10
  import i from "./messages.js";
12
11
  import { jsx as r, jsxs as _ } from "react/jsx-runtime";
13
- const v = "_inlineError_1uyp9_1", I = "_text_1uyp9_4", O = "_icon_1uyp9_14", R = "_iconAvatar_1uyp9_18", n = {
12
+ import '../../../../styles/inline-error.css';const v = "_inlineError_1uyp9_1", I = "_text_1uyp9_4", O = "_icon_1uyp9_14", R = "_iconAvatar_1uyp9_18", n = {
14
13
  inlineError: v,
15
14
  text: I,
16
15
  icon: O,
17
16
  iconAvatar: R
18
- }, U = ({
17
+ }, D = ({
19
18
  error: o,
20
19
  contentType: c,
21
20
  variant: d = "modal",
@@ -83,6 +82,6 @@ const v = "_inlineError_1uyp9_1", I = "_text_1uyp9_4", O = "_icon_1uyp9_14", R =
83
82
  });
84
83
  };
85
84
  export {
86
- U as InlineError,
87
- U as default
85
+ D as InlineError,
86
+ D as default
88
87
  };
@@ -1,4 +1,3 @@
1
- import "../../../../styles/loading-element.css";
2
1
  import { useBreakpoint as t, Breakpoint as s, LoadingIndicator as d } from "@box/blueprint-web";
3
2
  import { BoxAiLogo as l } from "@box/blueprint-web-assets/icons/Logo";
4
3
  import { Size5 as c, Size6 as m } from "@box/blueprint-web-assets/tokens/tokens";
@@ -6,11 +5,11 @@ import { useIntl as g } from "react-intl";
6
5
  import { MediaContainer as e } from "../common/media-container.js";
7
6
  import p from "./messages.js";
8
7
  import { jsx as i, jsxs as S } from "react/jsx-runtime";
9
- const f = "_loadingElement_5i7ol_1", _ = "_loadingIndicator_5i7ol_1", h = "_iconAvatar_5i7ol_5", n = {
8
+ import '../../../../styles/loading-element.css';const f = "_loadingElement_5i7ol_1", _ = "_loadingIndicator_5i7ol_1", h = "_iconAvatar_5i7ol_5", n = {
10
9
  loadingElement: f,
11
10
  loadingIndicator: _,
12
11
  iconAvatar: h
13
- }, B = ({
12
+ }, z = ({
14
13
  variant: o = "modal"
15
14
  }) => {
16
15
  const {
@@ -43,6 +42,6 @@ const f = "_loadingElement_5i7ol_1", _ = "_loadingIndicator_5i7ol_1", h = "_icon
43
42
  });
44
43
  };
45
44
  export {
46
- B as LoadingElement,
47
- B as default
45
+ z as LoadingElement,
46
+ z as default
48
47
  };
@@ -1,4 +1,3 @@
1
- import "../../../../styles/references.css";
2
1
  import { Text as u } from "@box/blueprint-web";
3
2
  import { useEffect as g } from "react";
4
3
  import { useIntl as i } from "react-intl";
@@ -6,20 +5,20 @@ import { LOGGER_BASE_CONFIG as w } from "../common/constants.js";
6
5
  import { Citation as b } from "./citation.js";
7
6
  import N from "./messages.js";
8
7
  import { NoCitationsIcon as _ } from "./no-citations.js";
9
- import { jsx as s, jsxs as l, Fragment as x } from "react/jsx-runtime";
10
- const C = "_label_1wqmn_1", t = {
8
+ import { jsx as r, jsxs as l, Fragment as x } from "react/jsx-runtime";
9
+ import '../../../../styles/references.css';const C = "_label_1wqmn_1", t = {
11
10
  label: C
12
- }, R = ({
11
+ }, L = ({
13
12
  animate: m = !0,
14
13
  citations: e,
15
- recordAction: r,
14
+ recordAction: s,
16
15
  onCitationClick: o
17
16
  }) => {
18
17
  const a = e && e.length > 0, {
19
18
  formatMessage: f
20
19
  } = i();
21
20
  return g(() => {
22
- a && r && r({
21
+ a && s && s({
23
22
  ...w,
24
23
  feature: "answers-citations",
25
24
  target: "shown",
@@ -27,14 +26,14 @@ const C = "_label_1wqmn_1", t = {
27
26
  count: e.length
28
27
  }
29
28
  });
30
- }, []), e === null ? /* @__PURE__ */ s("div", {
29
+ }, []), e === null ? /* @__PURE__ */ r("div", {
31
30
  className: t.references,
32
31
  "data-testid": "content-answers-references-null"
33
32
  }) : /* @__PURE__ */ l("div", {
34
33
  className: t.references,
35
34
  "data-testid": "content-answers-references",
36
35
  children: [a && /* @__PURE__ */ l(x, {
37
- children: [/* @__PURE__ */ s(u, {
36
+ children: [/* @__PURE__ */ r(u, {
38
37
  as: "span",
39
38
  className: t.label,
40
39
  color: "textOnLightSecondary",
@@ -42,28 +41,28 @@ const C = "_label_1wqmn_1", t = {
42
41
  variant: "caption",
43
42
  children: f(N.basedOn)
44
43
  }), e.map(({
45
- content: p,
46
- location: c,
47
- title: d,
44
+ content: c,
45
+ location: d,
46
+ title: p,
48
47
  fileId: h
49
48
  }, n) => (
50
49
  // eslint-disable-next-line react/no-array-index-key
51
- /* @__PURE__ */ s(b, {
50
+ /* @__PURE__ */ r(b, {
52
51
  animate: m,
53
- content: p,
52
+ content: c,
54
53
  fileId: h,
55
54
  id: n + 1,
56
55
  onCitationClick: o,
57
- recordAction: r,
58
- title: d
59
- }, `${c}-${n + 1}`)
56
+ recordAction: s,
57
+ title: p
58
+ }, `${d}-${n + 1}`)
60
59
  ))]
61
- }), (e == null ? void 0 : e.length) === 0 && /* @__PURE__ */ s(_, {
62
- recordAction: r
60
+ }), (e == null ? void 0 : e.length) === 0 && /* @__PURE__ */ r(_, {
61
+ recordAction: s
63
62
  })]
64
63
  });
65
64
  };
66
65
  export {
67
- R as References,
68
- R as default
66
+ L as References,
67
+ L as default
69
68
  };
@@ -1,4 +1,3 @@
1
- import "../../../../styles/thumb-buttons.css";
2
1
  import { Tooltip as h, IconButton as T } from "@box/blueprint-web";
3
2
  import { ThumbUp as U, ThumbDown as d } from "@box/blueprint-web-assets/icons/Fill";
4
3
  import { ThumbUp as D, ThumbDown as w } from "@box/blueprint-web-assets/icons/Line";
@@ -7,21 +6,21 @@ import { useIntl as M } from "react-intl";
7
6
  import { LOGGER_BASE_CONFIG as B, LOGGER_ACTION_PROGRAMMATIC as O } from "../common/constants.js";
8
7
  import n from "./messages.js";
9
8
  import { jsxs as N, Fragment as k, jsx as u } from "react/jsx-runtime";
10
- const C = "_thumbDown_1axcd_1", H = {
9
+ import '../../../../styles/thumb-buttons.css';const C = "_thumbDown_1axcd_1", H = {
11
10
  thumbDown: C
12
11
  }, t = {
13
12
  THUMB_UP: "up",
14
13
  THUMB_DOWN: "down",
15
14
  NONE: "none"
16
- }, F = ({
15
+ }, y = ({
17
16
  recordAction: o,
18
17
  variant: b,
19
18
  items: p,
20
19
  hostAppName: r
21
20
  }) => {
22
21
  const {
23
- formatMessage: m
24
- } = M(), [a, c] = s.useState(t.NONE), i = s.useMemo(() => p.filter((e) => e.status === "supported").map((e) => e.fileType), [p]), l = s.useCallback((e) => {
22
+ formatMessage: l
23
+ } = M(), [a, c] = s.useState(t.NONE), i = s.useMemo(() => p.filter((e) => e.status === "supported").map((e) => e.fileType), [p]), m = s.useCallback((e) => {
25
24
  a !== e && (c(e), o == null || o({
26
25
  ...B,
27
26
  action: O,
@@ -33,21 +32,21 @@ const C = "_thumbDown_1axcd_1", H = {
33
32
  feature: r
34
33
  }
35
34
  }));
36
- }, [r, o, a, b, i]), _ = s.useCallback(() => l(t.THUMB_UP), [l]), f = s.useCallback(() => l(t.THUMB_DOWN), [l]);
35
+ }, [r, o, a, b, i]), _ = s.useCallback(() => m(t.THUMB_UP), [m]), f = s.useCallback(() => m(t.THUMB_DOWN), [m]);
37
36
  return /* @__PURE__ */ N(k, {
38
37
  children: [/* @__PURE__ */ u(h, {
39
- content: m(n.thumbsUpAriaLabel),
38
+ content: l(n.thumbsUpAriaLabel),
40
39
  children: /* @__PURE__ */ u(T, {
41
- "aria-label": m(n.thumbsUpAriaLabel),
40
+ "aria-label": l(n.thumbsUpAriaLabel),
42
41
  disabled: a === t.THUMB_DOWN,
43
42
  icon: a === t.THUMB_UP ? U : D,
44
43
  onClick: _,
45
44
  size: "x-small"
46
45
  })
47
46
  }), /* @__PURE__ */ u(h, {
48
- content: m(n.thumbsDownAriaLabel),
47
+ content: l(n.thumbsDownAriaLabel),
49
48
  children: /* @__PURE__ */ u(T, {
50
- "aria-label": m(n.thumbsDownAriaLabel),
49
+ "aria-label": l(n.thumbsDownAriaLabel),
51
50
  className: H.thumbDown,
52
51
  disabled: a === t.THUMB_UP,
53
52
  icon: a === t.THUMB_DOWN ? d : w,
@@ -58,6 +57,6 @@ const C = "_thumbDown_1axcd_1", H = {
58
57
  });
59
58
  };
60
59
  export {
61
- F as ThumbButtons,
62
- F as default
60
+ y as ThumbButtons,
61
+ y as default
63
62
  };
@@ -1,20 +1,19 @@
1
- import "../../../../styles/chat.css";
2
1
  import { Answer as v } from "../answer/answer.js";
3
2
  import { Question as w } from "../question/question.js";
4
3
  import { SuggestedQuestions as z } from "../suggested-questions/suggested-questions.js";
5
4
  import { WelcomeMessage as B } from "../welcome-message/welcome-message.js";
6
- import { jsxs as r, jsx as t } from "react/jsx-runtime";
7
- const D = "_chat_fj1ue_1", E = {
5
+ import { jsxs as e, jsx as t } from "react/jsx-runtime";
6
+ import '../../../../styles/chat.css';const D = "_chat_fj1ue_1", E = {
8
7
  chat: D
9
- }, O = ({
10
- askSuggestedQuestion: e,
8
+ }, K = ({
9
+ askSuggestedQuestion: r,
11
10
  hasCustomSuggestedQuestions: s,
12
11
  hasRequestInProgress: a,
13
12
  isCitationsEnabled: d,
14
13
  isFeedbackEnabled: h,
15
14
  isMarkdownEnabled: l,
16
- onCitationClick: p,
17
- onAnswerCopy: f,
15
+ onCitationClick: f,
16
+ onAnswerCopy: p,
18
17
  questions: j,
19
18
  recordAction: i,
20
19
  setAskSuggestedQuestion: c,
@@ -25,14 +24,14 @@ const D = "_chat_fj1ue_1", E = {
25
24
  variant: o = "modal",
26
25
  hostAppName: _ = "",
27
26
  ...m
28
- }) => /* @__PURE__ */ r("div", {
27
+ }) => /* @__PURE__ */ e("div", {
29
28
  className: E.chat,
30
29
  "data-testid": "content-answers-chat",
31
30
  children: [/* @__PURE__ */ t(B, {
32
31
  ...m,
33
32
  variant: o
34
33
  }), n !== void 0 && c !== void 0 && /* @__PURE__ */ t(z, {
35
- askSuggestedQuestion: e,
34
+ askSuggestedQuestion: r,
36
35
  hasCustomSuggestedQuestions: s,
37
36
  isLoading: a,
38
37
  recordAction: i,
@@ -49,7 +48,7 @@ const D = "_chat_fj1ue_1", E = {
49
48
  isLoading: W,
50
49
  error: b,
51
50
  prompt: q
52
- }) => /* @__PURE__ */ r("li", {
51
+ }) => /* @__PURE__ */ e("li", {
53
52
  children: [/* @__PURE__ */ t(w, {
54
53
  prompt: q,
55
54
  userInfo: y,
@@ -66,8 +65,8 @@ const D = "_chat_fj1ue_1", E = {
66
65
  isLoading: W,
67
66
  isMarkdownEnabled: l,
68
67
  items: m.items,
69
- onAnswerCopy: f,
70
- onCitationClick: p,
68
+ onAnswerCopy: p,
69
+ onCitationClick: f,
71
70
  recordAction: i,
72
71
  useAnimation: x,
73
72
  variant: o
@@ -76,6 +75,6 @@ const D = "_chat_fj1ue_1", E = {
76
75
  })]
77
76
  });
78
77
  export {
79
- O as Chat,
80
- O as default
78
+ K as Chat,
79
+ K as default
81
80
  };