@box/box-ai-content-answers 2.1.38 → 2.1.40

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 (107) hide show
  1. package/dist/chunks/answer-content.js +1 -32
  2. package/dist/chunks/answer.js +1 -183
  3. package/dist/chunks/box-ai-content-answers.js +1 -78
  4. package/dist/chunks/chat.js +1 -116
  5. package/dist/chunks/citation.js +1 -124
  6. package/dist/chunks/clear-conversation-button.js +1 -37
  7. package/dist/chunks/content.js +1 -89
  8. package/dist/chunks/content2.js +1 -213
  9. package/dist/chunks/contextual-items-message.js +1 -43
  10. package/dist/chunks/embed-the-answer-button.js +1 -52
  11. package/dist/chunks/feedback-tooltip.js +1 -130
  12. package/dist/chunks/footer-actions.js +1 -44
  13. package/dist/chunks/inline-error.js +1 -63
  14. package/dist/chunks/items-dropdown.js +1 -67
  15. package/dist/chunks/markdown.js +6 -6776
  16. package/dist/chunks/markdown.module.js +1 -13
  17. package/dist/chunks/media-container.js +1 -32
  18. package/dist/chunks/question.js +1 -29
  19. package/dist/chunks/references.js +1 -43
  20. package/dist/chunks/stopResponseButton.js +1 -45
  21. package/dist/chunks/suggested-questions.js +1 -70
  22. package/dist/chunks/suggestions.js +1 -35
  23. package/dist/chunks/thinkingBubble.js +1 -111
  24. package/dist/chunks/thumb-buttons.js +1 -103
  25. package/dist/chunks/types.js +1 -14
  26. package/dist/chunks/unsupported-items-notice.js +1 -25
  27. package/dist/chunks/warning-message.js +1 -21
  28. package/dist/esm/index.js +1 -11
  29. package/dist/esm/lib/box-ai-content-answers.js +1 -2
  30. package/dist/esm/lib/components/answer/answer-content.js +1 -2
  31. package/dist/esm/lib/components/answer/answer.js +1 -2
  32. package/dist/esm/lib/components/answer/citation.js +1 -2
  33. package/dist/esm/lib/components/answer/constants.js +1 -2
  34. package/dist/esm/lib/components/answer/copy-button.js +1 -46
  35. package/dist/esm/lib/components/answer/embed-the-answer-button.js +1 -2
  36. package/dist/esm/lib/components/answer/feedback-tooltip.js +1 -2
  37. package/dist/esm/lib/components/answer/inline-error.js +1 -2
  38. package/dist/esm/lib/components/answer/loading-indicator.js +1 -29
  39. package/dist/esm/lib/components/answer/messages.js +1 -148
  40. package/dist/esm/lib/components/answer/no-citations.js +1 -29
  41. package/dist/esm/lib/components/answer/references.js +1 -2
  42. package/dist/esm/lib/components/answer/thumb-buttons.js +1 -2
  43. package/dist/esm/lib/components/api-wrapper/actions.js +1 -2
  44. package/dist/esm/lib/components/api-wrapper/api-wrapper.js +1 -8
  45. package/dist/esm/lib/components/api-wrapper/constants.js +1 -30
  46. package/dist/esm/lib/components/api-wrapper/content-answers-component.js +1 -83
  47. package/dist/esm/lib/components/api-wrapper/hooks/useContentAnswers.js +1 -211
  48. package/dist/esm/lib/components/api-wrapper/records.js +1 -38
  49. package/dist/esm/lib/components/api-wrapper/reducer.js +1 -42
  50. package/dist/esm/lib/components/api-wrapper/utils/format.js +1 -13
  51. package/dist/esm/lib/components/api-wrapper/utils/request.js +1 -12
  52. package/dist/esm/lib/components/api-wrapper/utils/stream.js +2 -116
  53. package/dist/esm/lib/components/api-wrapper/utils/typed-record.js +1 -3
  54. package/dist/esm/lib/components/chat/chat.js +1 -2
  55. package/dist/esm/lib/components/chat/index.js +1 -2
  56. package/dist/esm/lib/components/common/agentUtils.js +1 -5
  57. package/dist/esm/lib/components/common/constants.js +1 -19
  58. package/dist/esm/lib/components/common/focusInputUtils.js +1 -5
  59. package/dist/esm/lib/components/common/inline-citation.js +1 -24
  60. package/dist/esm/lib/components/common/keyInputUtils.js +1 -3
  61. package/dist/esm/lib/components/common/markdown-react.js +1 -97
  62. package/dist/esm/lib/components/common/markdown.js +1 -2
  63. package/dist/esm/lib/components/common/media-container.js +1 -2
  64. package/dist/esm/lib/components/common/mock-data.js +1 -305
  65. package/dist/esm/lib/components/common/performance.js +1 -3
  66. package/dist/esm/lib/components/content/content.js +1 -2
  67. package/dist/esm/lib/components/content/index.js +1 -2
  68. package/dist/esm/lib/components/footer/constants.js +1 -12
  69. package/dist/esm/lib/components/footer/footer-actions.js +1 -2
  70. package/dist/esm/lib/components/footer/footer.js +1 -151
  71. package/dist/esm/lib/components/footer/index.js +1 -2
  72. package/dist/esm/lib/components/footer/messages.js +1 -36
  73. package/dist/esm/lib/components/footer/stopResponseButton.js +1 -2
  74. package/dist/esm/lib/components/modal/clear-conversation-button.js +1 -2
  75. package/dist/esm/lib/components/modal/hooks/useEventListeners.js +1 -10
  76. package/dist/esm/lib/components/modal/hooks/useStopPropagationOnEsc.js +1 -19
  77. package/dist/esm/lib/components/modal/messages.js +1 -20
  78. package/dist/esm/lib/components/modal/modal.js +1 -143
  79. package/dist/esm/lib/components/modal/title.js +1 -14
  80. package/dist/esm/lib/components/modal-error/index.js +1 -2
  81. package/dist/esm/lib/components/modal-error/messages.js +1 -16
  82. package/dist/esm/lib/components/modal-error/modal-error.js +1 -33
  83. package/dist/esm/lib/components/question/question.js +1 -2
  84. package/dist/esm/lib/components/sidebar/content.js +1 -2
  85. package/dist/esm/lib/components/sidebar/context.js +1 -16
  86. package/dist/esm/lib/components/sidebar/messages.js +1 -28
  87. package/dist/esm/lib/components/sidebar/sidebar.js +1 -80
  88. package/dist/esm/lib/components/sidebar/title.js +1 -14
  89. package/dist/esm/lib/components/suggested-questions/messages.js +1 -16
  90. package/dist/esm/lib/components/suggested-questions/mocks.js +1 -36
  91. package/dist/esm/lib/components/suggested-questions/suggested-questions.js +1 -2
  92. package/dist/esm/lib/components/suggested-questions/suggestions.js +1 -2
  93. package/dist/esm/lib/components/thinkingBubble/boxAILoadingIndicator.js +11 -277
  94. package/dist/esm/lib/components/thinkingBubble/messages.js +1 -24
  95. package/dist/esm/lib/components/thinkingBubble/thinkingBubble.js +1 -2
  96. package/dist/esm/lib/components/welcome-message/contextual-items-message.js +1 -2
  97. package/dist/esm/lib/components/welcome-message/items-dropdown.js +1 -2
  98. package/dist/esm/lib/components/welcome-message/messages.js +10 -52
  99. package/dist/esm/lib/components/welcome-message/unsupported-items-notice.js +1 -2
  100. package/dist/esm/lib/components/welcome-message/warning-message.js +1 -2
  101. package/dist/esm/lib/components/welcome-message/welcome-message.js +1 -53
  102. package/dist/esm/lib/constants.js +1 -9
  103. package/dist/esm/lib/hooks/usePromptFocus.js +1 -28
  104. package/dist/esm/lib/messages.js +1 -56
  105. package/dist/esm/lib/utils/constants.js +1 -2
  106. package/dist/esm/lib/utils/inlineCitationsUtils.js +1 -18
  107. package/package.json +11 -11
@@ -1,2 +1 @@
1
- import { t as e } from "../../../../chunks/citation.js";
2
- export { e as Citation, e as default };
1
+ import{t as Citation}from"../../../../chunks/citation.js";export{Citation,Citation as default};
@@ -1,2 +1 @@
1
- var e = "/report-abuse", t = 500;
2
- export { e as ABUSE_FORM_PATH, t as MAX_CITATION_LENGTH };
1
+ var ABUSE_FORM_PATH=`/report-abuse`,MAX_CITATION_LENGTH=500;export{ABUSE_FORM_PATH,MAX_CITATION_LENGTH};
@@ -1,46 +1 @@
1
- import { t as e } from "../../../../chunks/markdown.js";
2
- import t from "../../messages.js";
3
- import n from "./messages.js";
4
- import { LOGGER_ACTION_CLICK as r, LOGGER_BASE_CONFIG as i } from "../common/constants.js";
5
- import { focusInput as a } from "../common/focusInputUtils.js";
6
- import { IconButton as o, Tooltip as s, useBlueprintModernization as c, useNotification as l } from "@box/blueprint-web";
7
- import { useIntl as u } from "react-intl";
8
- import { Clipboard as d } from "@box/blueprint-web-assets/icons/Line";
9
- import { jsx as f } from "react/jsx-runtime";
10
- import { Clipboard as p } from "@box/blueprint-web-assets/icons/Medium";
11
- var m = ({ answer: m, onAnswerCopy: h, recordAction: g }) => {
12
- let { formatMessage: _ } = u(), { addNotification: v } = l(), { enableModernizedComponents: y } = c(), b = async () => {
13
- if (g && g({
14
- ...i,
15
- action: r,
16
- target: "copyToClipboard"
17
- }), m && navigator && navigator.clipboard && navigator.clipboard.write) {
18
- let r = e(m), i = new ClipboardItem({
19
- "text/html": new Blob([r], { type: "text/html" }),
20
- "text/plain": new Blob([m], { type: "text/plain" })
21
- });
22
- await navigator.clipboard.write([i]), v({
23
- sensitivity: "foreground",
24
- styledText: _(n.copyToClipboardSucceeded),
25
- variant: "success",
26
- typeIconAriaLabel: _(n.copyButtonSuccessText),
27
- closeButtonAriaLabel: _(t.closeButtonText)
28
- }), h && h(m);
29
- }
30
- a();
31
- }, x = y ? p : d;
32
- return /* @__PURE__ */ f(s, {
33
- content: _(n.copyToClipboard),
34
- children: /* @__PURE__ */ f(o, {
35
- "aria-label": _(n.copyToClipboard),
36
- icon: x,
37
- onClick: b,
38
- onFocusCapture: (e) => {
39
- e.target.matches(":focus-visible") || e.stopPropagation();
40
- },
41
- size: "x-small",
42
- "data-target-id": "IconButton-copyToClipboard"
43
- })
44
- });
45
- };
46
- export { m as CopyButton, m as default };
1
+ import{t as markdownToHtmlString}from"../../../../chunks/markdown.js";import messages from"../../messages.js";import messages$1 from"./messages.js";import{LOGGER_ACTION_CLICK,LOGGER_BASE_CONFIG}from"../common/constants.js";import{focusInput}from"../common/focusInputUtils.js";import{IconButton,Tooltip,useBlueprintModernization,useNotification}from"@box/blueprint-web";import{useIntl}from"react-intl";import{Clipboard}from"@box/blueprint-web-assets/icons/Line";import{jsx}from"react/jsx-runtime";import{Clipboard as Clipboard$1}from"@box/blueprint-web-assets/icons/Medium";var CopyButton=({answer,onAnswerCopy,recordAction})=>{let{formatMessage}=useIntl(),{addNotification}=useNotification(),{enableModernizedComponents}=useBlueprintModernization(),copyToClipboard=async()=>{if(recordAction&&recordAction({...LOGGER_BASE_CONFIG,action:LOGGER_ACTION_CLICK,target:`copyToClipboard`}),answer&&navigator&&navigator.clipboard&&navigator.clipboard.write){let htmlContent=markdownToHtmlString(answer),clipboardItem=new ClipboardItem({"text/html":new Blob([htmlContent],{type:`text/html`}),"text/plain":new Blob([answer],{type:`text/plain`})});await navigator.clipboard.write([clipboardItem]),addNotification({sensitivity:`foreground`,styledText:formatMessage(messages$1.copyToClipboardSucceeded),variant:`success`,typeIconAriaLabel:formatMessage(messages$1.copyButtonSuccessText),closeButtonAriaLabel:formatMessage(messages.closeButtonText)}),onAnswerCopy&&onAnswerCopy(answer)}focusInput()},ClipboardIcon=enableModernizedComponents?Clipboard$1:Clipboard;return jsx(Tooltip,{content:formatMessage(messages$1.copyToClipboard),children:jsx(IconButton,{"aria-label":formatMessage(messages$1.copyToClipboard),icon:ClipboardIcon,onClick:copyToClipboard,onFocusCapture:e=>{e.target.matches(`:focus-visible`)||e.stopPropagation()},size:`x-small`,"data-target-id":`IconButton-copyToClipboard`})})};export{CopyButton,CopyButton as default};
@@ -1,2 +1 @@
1
- import { t as e } from "../../../../chunks/embed-the-answer-button.js";
2
- export { e as EmbedTheAnswerButton, e as default };
1
+ import{t as EmbedTheAnswerButton}from"../../../../chunks/embed-the-answer-button.js";export{EmbedTheAnswerButton,EmbedTheAnswerButton as default};
@@ -1,2 +1 @@
1
- import { t as e } from "../../../../chunks/feedback-tooltip.js";
2
- export { e as FeedbackTooltip, e as default };
1
+ import{t as FeedbackTooltip}from"../../../../chunks/feedback-tooltip.js";export{FeedbackTooltip,FeedbackTooltip as default};
@@ -1,2 +1 @@
1
- import { t as e } from "../../../../chunks/inline-error.js";
2
- export { e as InlineError, e as default };
1
+ import{t as InlineError}from"../../../../chunks/inline-error.js";export{InlineError,InlineError as default};
@@ -1,29 +1 @@
1
- import e from "./messages.js";
2
- import t from "clsx";
3
- import { useIntl as n } from "react-intl";
4
- import { jsx as r, jsxs as i } from "react/jsx-runtime";
5
- import '../../../../styles/loading-indicator.css';var a = {
6
- loadingDots: "_loadingDots_ozros_1",
7
- dot: "_dot_ozros_10",
8
- dot1: "_dot1_ozros_22",
9
- dot1Animation: "_dot1Animation_ozros_1",
10
- dot2: "_dot2_ozros_25",
11
- dot2Animation: "_dot2Animation_ozros_1",
12
- dot3: "_dot3_ozros_28",
13
- dot3Animation: "_dot3Animation_ozros_1"
14
- };
15
- function o() {
16
- let { formatMessage: o } = n();
17
- return /* @__PURE__ */ i("div", {
18
- "aria-label": o(e.loadingAnswer),
19
- "aria-live": "polite",
20
- className: a.loadingDots,
21
- role: "status",
22
- children: [
23
- /* @__PURE__ */ r("span", { className: t(a.dot, a.dot1) }),
24
- /* @__PURE__ */ r("span", { className: t(a.dot, a.dot2) }),
25
- /* @__PURE__ */ r("span", { className: t(a.dot, a.dot3) })
26
- ]
27
- });
28
- }
29
- export { o as LoadingIndicator };
1
+ import messages from"./messages.js";import clsx from"clsx";import{useIntl}from"react-intl";import{jsx,jsxs}from"react/jsx-runtime";import '../../../../styles/loading-indicator.css';var loading_indicator_module_default={loadingDots:`_loadingDots_ozros_1`,dot:`_dot_ozros_10`,dot1:`_dot1_ozros_22`,dot1Animation:`_dot1Animation_ozros_1`,dot2:`_dot2_ozros_25`,dot2Animation:`_dot2Animation_ozros_1`,dot3:`_dot3_ozros_28`,dot3Animation:`_dot3Animation_ozros_1`};function LoadingIndicator(){let{formatMessage}=useIntl();return jsxs(`div`,{"aria-label":formatMessage(messages.loadingAnswer),"aria-live":`polite`,className:loading_indicator_module_default.loadingDots,role:`status`,children:[jsx(`span`,{className:clsx(loading_indicator_module_default.dot,loading_indicator_module_default.dot1)}),jsx(`span`,{className:clsx(loading_indicator_module_default.dot,loading_indicator_module_default.dot2)}),jsx(`span`,{className:clsx(loading_indicator_module_default.dot,loading_indicator_module_default.dot3)})]})}export{LoadingIndicator};
@@ -1,148 +1 @@
1
- import { defineMessages as e } from "react-intl";
2
- var 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
- },
11
- basedOn: {
12
- id: "boxAI.contentAnswers.basedOn",
13
- defaultMessage: "Based on:"
14
- },
15
- cardTooltipButton: {
16
- id: "boxAI.contentAnswers.cardTooltipButton",
17
- defaultMessage: "Open document"
18
- },
19
- cardTooltipTitle: {
20
- id: "boxAI.contentAnswers.cardTooltipTitle",
21
- defaultMessage: "From document:"
22
- },
23
- cardTooltipTitleWithDocumentName: {
24
- id: "boxAI.contentAnswers.cardTooltipTitleWithDocumentName",
25
- defaultMessage: "From \"{title}\":"
26
- },
27
- copyButtonSuccessText: {
28
- id: "boxAI.textInputWithCopyButton.copyButtonSuccessText",
29
- defaultMessage: "Copied"
30
- },
31
- copyToClipboard: {
32
- id: "boxAI.contentAnswers.copyToClipboard",
33
- defaultMessage: "Copy to Clipboard"
34
- },
35
- copyToClipboardSucceeded: {
36
- id: "boxAI.contentAnswers.copyToClipboardSucceeded",
37
- defaultMessage: "Copied to your clipboard"
38
- },
39
- feedbackTooltipCancel: {
40
- id: "boxAI.contentAnswers.feedbackTooltipCancel",
41
- defaultMessage: "Cancel"
42
- },
43
- feedbackTooltipConfirmation: {
44
- id: "boxAI.contentAnswers.feedbackTooltipConfirmation",
45
- defaultMessage: "Thank you for the feedback."
46
- },
47
- feedbackTooltipAbuseDisclaimer: {
48
- id: "boxAI.contentAnswers.feedbackTooltipAbuseDisclaimer",
49
- defaultMessage: "To report inappropriate content, submit <abuseFormLink>this form</abuseFormLink>."
50
- },
51
- feedbackTooltipFeedbackLabel: {
52
- id: "boxAI.contentAnswers.feedbackTooltipFeedback",
53
- defaultMessage: "How can we improve the experience?"
54
- },
55
- feedbackTooltipFeedbackPlaceholder: {
56
- id: "boxAI.contentAnswers.feedbackTooltipFeedbackPlaceholder",
57
- defaultMessage: "We'd love to hear from you! Please omit personal info, sensitive content, or links in your feedback as submissions to Box aren't confidential."
58
- },
59
- feedbackTooltipIssueTypeLabel: {
60
- id: "boxAI.contentAnswers.feedbackTooltipIssueTypeLabel",
61
- defaultMessage: "What type of issue do you wish to report?"
62
- },
63
- feedbackTooltipIssueTypeAnswer1: {
64
- id: "boxAI.contentAnswers.feedbackTooltipIssueTypeAnswer1",
65
- defaultMessage: "Inaccurate answer"
66
- },
67
- feedbackTooltipIssueTypeAnswer2: {
68
- id: "boxAI.contentAnswers.feedbackTooltipIssueTypeAnswer2",
69
- defaultMessage: "Did not follow my request"
70
- },
71
- feedbackTooltipIssueTypeAnswer3: {
72
- id: "boxAI.contentAnswers.feedbackTooltipIssueTypeAnswer3",
73
- defaultMessage: "Other"
74
- },
75
- feedbackTooltipPromptShareConsent: {
76
- id: "boxAI.contentAnswers.feedbackTooltipPromptShareConsent",
77
- defaultMessage: "Share my prompt and response to help improve product quality."
78
- },
79
- feedbackTooltipTitle: {
80
- id: "boxAI.contentAnswers.feedbackTooltipTitle",
81
- defaultMessage: "Share your feedback"
82
- },
83
- feedbackTooltipSubmit: {
84
- id: "boxAI.contentAnswers.feedbackTooltipSubmit",
85
- defaultMessage: "Submit"
86
- },
87
- inlineNoContentErrorText: {
88
- id: "boxAI.contentAnswers.inlineNoContentErrorText",
89
- defaultMessage: "Relevant content cannot be found. Please try again later or ask a different question."
90
- },
91
- inlineAgentNotFoundErrorText: {
92
- id: "boxAI.contentAnswers.inlineAgentNotFoundErrorText",
93
- defaultMessage: "The selected agent is unavailable. Switching to the default agent."
94
- },
95
- inlineErrorText: {
96
- id: "boxAI.contentAnswers.inlineErrorText",
97
- defaultMessage: "Box AI is having trouble generating a response right now. Please try again."
98
- },
99
- inlineRateLimitingErrorText: {
100
- id: "boxAI.contentAnswers.inlineRateLimitingErrorText",
101
- defaultMessage: "Box AI currently has limited capacity (we're working to expand bandwidth). Please try again in a few minutes."
102
- },
103
- inlinePreconditionFailedErrorText: {
104
- id: "boxAI.contentAnswers.inlinePreconditionFailedErrorText",
105
- defaultMessage: "Additional time is needed to process this {type}, please try again later."
106
- },
107
- loadingAnswer: {
108
- id: "boxAI.contentAnswers.loadingAnswer",
109
- defaultMessage: "Loading Answer..."
110
- },
111
- analyzingRequest: {
112
- id: "boxAI.contentAnswers.analyzingRequest",
113
- defaultMessage: "Analyzing..."
114
- },
115
- noReferences: {
116
- id: "boxAI.contentAnswers.noReferences",
117
- defaultMessage: "Response based on general document analysis"
118
- },
119
- referenceAriaLabel: {
120
- id: "boxAI.contentAnswers.referenceAriaLabel",
121
- defaultMessage: "Reference {number}"
122
- },
123
- responseInterruptedError: {
124
- id: "boxAI.contentAnswers.responseInterruptedError",
125
- defaultMessage: "Response Interrupted"
126
- },
127
- responseFailedError: {
128
- id: "boxAI.contentAnswers.responseFailedError",
129
- defaultMessage: "Response Failed"
130
- },
131
- responseStoppedError: {
132
- id: "boxAI.contentAnswers.responseStoppedError",
133
- defaultMessage: "Response Stopped"
134
- },
135
- thumbsUpAriaLabel: {
136
- id: "boxAI.contentAnswers.thumbsUpAriaLabel",
137
- defaultMessage: "Helpful"
138
- },
139
- thumbsDownAriaLabel: {
140
- id: "boxAI.contentAnswers.thumbsDownAriaLabel",
141
- defaultMessage: "Not helpful"
142
- },
143
- inlineCitationAriaLabel: {
144
- id: "boxAI.contentAnswers.inlineCitationAriaLabel",
145
- defaultMessage: "Open {fileName} in new tab"
146
- }
147
- });
148
- export { t as default };
1
+ import{defineMessages}from"react-intl";var messages=defineMessages({addToNote:{id:`boxAI.contentAnswers.addToNote`,defaultMessage:`Add to Note`},addedToNote:{id:`boxAI.contentAnswers.addedToNote`,defaultMessage:`Added`},basedOn:{id:`boxAI.contentAnswers.basedOn`,defaultMessage:`Based on:`},cardTooltipButton:{id:`boxAI.contentAnswers.cardTooltipButton`,defaultMessage:`Open document`},cardTooltipTitle:{id:`boxAI.contentAnswers.cardTooltipTitle`,defaultMessage:`From document:`},cardTooltipTitleWithDocumentName:{id:`boxAI.contentAnswers.cardTooltipTitleWithDocumentName`,defaultMessage:`From "{title}":`},copyButtonSuccessText:{id:`boxAI.textInputWithCopyButton.copyButtonSuccessText`,defaultMessage:`Copied`},copyToClipboard:{id:`boxAI.contentAnswers.copyToClipboard`,defaultMessage:`Copy to Clipboard`},copyToClipboardSucceeded:{id:`boxAI.contentAnswers.copyToClipboardSucceeded`,defaultMessage:`Copied to your clipboard`},feedbackTooltipCancel:{id:`boxAI.contentAnswers.feedbackTooltipCancel`,defaultMessage:`Cancel`},feedbackTooltipConfirmation:{id:`boxAI.contentAnswers.feedbackTooltipConfirmation`,defaultMessage:`Thank you for the feedback.`},feedbackTooltipAbuseDisclaimer:{id:`boxAI.contentAnswers.feedbackTooltipAbuseDisclaimer`,defaultMessage:`To report inappropriate content, submit <abuseFormLink>this form</abuseFormLink>.`},feedbackTooltipFeedbackLabel:{id:`boxAI.contentAnswers.feedbackTooltipFeedback`,defaultMessage:`How can we improve the experience?`},feedbackTooltipFeedbackPlaceholder:{id:`boxAI.contentAnswers.feedbackTooltipFeedbackPlaceholder`,defaultMessage:`We'd love to hear from you! Please omit personal info, sensitive content, or links in your feedback as submissions to Box aren't confidential.`},feedbackTooltipIssueTypeLabel:{id:`boxAI.contentAnswers.feedbackTooltipIssueTypeLabel`,defaultMessage:`What type of issue do you wish to report?`},feedbackTooltipIssueTypeAnswer1:{id:`boxAI.contentAnswers.feedbackTooltipIssueTypeAnswer1`,defaultMessage:`Inaccurate answer`},feedbackTooltipIssueTypeAnswer2:{id:`boxAI.contentAnswers.feedbackTooltipIssueTypeAnswer2`,defaultMessage:`Did not follow my request`},feedbackTooltipIssueTypeAnswer3:{id:`boxAI.contentAnswers.feedbackTooltipIssueTypeAnswer3`,defaultMessage:`Other`},feedbackTooltipPromptShareConsent:{id:`boxAI.contentAnswers.feedbackTooltipPromptShareConsent`,defaultMessage:`Share my prompt and response to help improve product quality.`},feedbackTooltipTitle:{id:`boxAI.contentAnswers.feedbackTooltipTitle`,defaultMessage:`Share your feedback`},feedbackTooltipSubmit:{id:`boxAI.contentAnswers.feedbackTooltipSubmit`,defaultMessage:`Submit`},inlineNoContentErrorText:{id:`boxAI.contentAnswers.inlineNoContentErrorText`,defaultMessage:`Relevant content cannot be found. Please try again later or ask a different question.`},inlineAgentNotFoundErrorText:{id:`boxAI.contentAnswers.inlineAgentNotFoundErrorText`,defaultMessage:`The selected agent is unavailable. Switching to the default agent.`},inlineErrorText:{id:`boxAI.contentAnswers.inlineErrorText`,defaultMessage:`Box AI is having trouble generating a response right now. Please try again.`},inlineRateLimitingErrorText:{id:`boxAI.contentAnswers.inlineRateLimitingErrorText`,defaultMessage:`Box AI currently has limited capacity (we're working to expand bandwidth). Please try again in a few minutes.`},inlinePreconditionFailedErrorText:{id:`boxAI.contentAnswers.inlinePreconditionFailedErrorText`,defaultMessage:`Additional time is needed to process this {type}, please try again later.`},loadingAnswer:{id:`boxAI.contentAnswers.loadingAnswer`,defaultMessage:`Loading Answer...`},analyzingRequest:{id:`boxAI.contentAnswers.analyzingRequest`,defaultMessage:`Analyzing...`},noReferences:{id:`boxAI.contentAnswers.noReferences`,defaultMessage:`Response based on general document analysis`},referenceAriaLabel:{id:`boxAI.contentAnswers.referenceAriaLabel`,defaultMessage:`Reference {number}`},responseInterruptedError:{id:`boxAI.contentAnswers.responseInterruptedError`,defaultMessage:`Response Interrupted`},responseFailedError:{id:`boxAI.contentAnswers.responseFailedError`,defaultMessage:`Response Failed`},responseStoppedError:{id:`boxAI.contentAnswers.responseStoppedError`,defaultMessage:`Response Stopped`},thumbsUpAriaLabel:{id:`boxAI.contentAnswers.thumbsUpAriaLabel`,defaultMessage:`Helpful`},thumbsDownAriaLabel:{id:`boxAI.contentAnswers.thumbsDownAriaLabel`,defaultMessage:`Not helpful`},inlineCitationAriaLabel:{id:`boxAI.contentAnswers.inlineCitationAriaLabel`,defaultMessage:`Open {fileName} in new tab`}});export{messages as default};
@@ -1,29 +1 @@
1
- import e from "./messages.js";
2
- import { LOGGER_BASE_CONFIG as t } from "../common/constants.js";
3
- import { useEffect as n } from "react";
4
- import { IconButton as r, Tooltip as i, useBlueprintModernization as a } from "@box/blueprint-web";
5
- import { useIntl as o } from "react-intl";
6
- import { InfoBadge as s } from "@box/blueprint-web-assets/icons/Line";
7
- import { jsx as c } from "react/jsx-runtime";
8
- import { InformationCircle as l } from "@box/blueprint-web-assets/icons/Medium";
9
- var u = ({ recordAction: u }) => {
10
- let { formatMessage: d } = o(), { enableModernizedComponents: f } = a(), p = d(e.noReferences);
11
- return n(() => {
12
- u && u({
13
- ...t,
14
- target: "noReferences"
15
- });
16
- }, [u]), /* @__PURE__ */ c(i, {
17
- className: "Answer-NoCitations",
18
- content: p,
19
- "data-testid": "content-answers-references-no-references-tooltip",
20
- children: /* @__PURE__ */ c(r, {
21
- "aria-label": p,
22
- "data-testid": "content-answers-references-no-references",
23
- icon: f ? l : s,
24
- size: "x-small",
25
- "data-target-id": "IconButton-noReferences"
26
- })
27
- });
28
- };
29
- export { u as NoCitationsIcon, u as default };
1
+ import messages from"./messages.js";import{LOGGER_BASE_CONFIG}from"../common/constants.js";import{useEffect}from"react";import{IconButton,Tooltip,useBlueprintModernization}from"@box/blueprint-web";import{useIntl}from"react-intl";import{InfoBadge}from"@box/blueprint-web-assets/icons/Line";import{jsx}from"react/jsx-runtime";import{InformationCircle}from"@box/blueprint-web-assets/icons/Medium";var NoCitationsIcon=({recordAction})=>{let{formatMessage}=useIntl(),{enableModernizedComponents}=useBlueprintModernization(),noReferencesText=formatMessage(messages.noReferences);return useEffect(()=>{recordAction&&recordAction({...LOGGER_BASE_CONFIG,target:`noReferences`})},[recordAction]),jsx(Tooltip,{className:`Answer-NoCitations`,content:noReferencesText,"data-testid":`content-answers-references-no-references-tooltip`,children:jsx(IconButton,{"aria-label":noReferencesText,"data-testid":`content-answers-references-no-references`,icon:enableModernizedComponents?InformationCircle:InfoBadge,size:`x-small`,"data-target-id":`IconButton-noReferences`})})};export{NoCitationsIcon,NoCitationsIcon as default};
@@ -1,2 +1 @@
1
- import { t as e } from "../../../../chunks/references.js";
2
- export { e as References, e as default };
1
+ import{t as References}from"../../../../chunks/references.js";export{References,References as default};
@@ -1,2 +1 @@
1
- import { t as e } from "../../../../chunks/thumb-buttons.js";
2
- export { e as ThumbButtons, e as default };
1
+ import{t as ThumbButtons}from"../../../../chunks/thumb-buttons.js";export{ThumbButtons,ThumbButtons as default};
@@ -1,2 +1 @@
1
- var e = "CLEAR_CONVERSATION_HISTORY", t = "SET_IS_LOADING", n = "SET_MODAL_ERROR", r = "SET_MODAL_SUCCESS", i = "SET_NEW_ITEM", a = "UPDATE_QUESTION", o = "SET_SUGGESTED_QUESTIONS", s = "SET_SUGGESTED_QUESTIONS_REQUEST_STATE", c = "SET_ANSWER_FEEDBACK";
2
- export { e as CLEAR_CONVERSATION_HISTORY, c as SET_ANSWER_FEEDBACK, t as SET_IS_LOADING, n as SET_MODAL_ERROR, r as SET_MODAL_SUCCESS, i as SET_NEW_ITEM, o as SET_SUGGESTED_QUESTIONS, s as SET_SUGGESTED_QUESTIONS_REQUEST_STATE, a as UPDATE_QUESTION };
1
+ var CLEAR_CONVERSATION_HISTORY=`CLEAR_CONVERSATION_HISTORY`,SET_IS_LOADING=`SET_IS_LOADING`,SET_MODAL_ERROR=`SET_MODAL_ERROR`,SET_MODAL_SUCCESS=`SET_MODAL_SUCCESS`,SET_NEW_ITEM=`SET_NEW_ITEM`,UPDATE_QUESTION=`UPDATE_QUESTION`,SET_SUGGESTED_QUESTIONS=`SET_SUGGESTED_QUESTIONS`,SET_SUGGESTED_QUESTIONS_REQUEST_STATE=`SET_SUGGESTED_QUESTIONS_REQUEST_STATE`,SET_ANSWER_FEEDBACK=`SET_ANSWER_FEEDBACK`;export{CLEAR_CONVERSATION_HISTORY,SET_ANSWER_FEEDBACK,SET_IS_LOADING,SET_MODAL_ERROR,SET_MODAL_SUCCESS,SET_NEW_ITEM,SET_SUGGESTED_QUESTIONS,SET_SUGGESTED_QUESTIONS_REQUEST_STATE,UPDATE_QUESTION};
@@ -1,8 +1 @@
1
- import { ContentAnswersComponent as e } from "./content-answers-component.js";
2
- import { jsx as t } from "react/jsx-runtime";
3
- import { AgentsProvider as n } from "@box/box-ai-agent-selector";
4
- var r = (r) => (i) => /* @__PURE__ */ t(n, { children: /* @__PURE__ */ t(e, {
5
- ...i,
6
- WrappedComponent: r
7
- }) });
8
- export { r as default, r as withApiWrapper };
1
+ import{ContentAnswersComponent}from"./content-answers-component.js";import{jsx}from"react/jsx-runtime";import{AgentsProvider}from"@box/box-ai-agent-selector";var withApiWrapper=WrappedComponent=>props=>jsx(AgentsProvider,{children:jsx(ContentAnswersComponent,{...props,WrappedComponent})});export{withApiWrapper as default,withApiWrapper};
@@ -1,30 +1 @@
1
- var e = (e) => ({ ask: {
2
- type: "ai_agent_ask",
3
- longText: { model: e },
4
- longTextMulti: { model: e },
5
- basicText: { model: e },
6
- basicTextMulti: { model: e }
7
- } }), t = (t, n = null, r = !1) => ({
8
- id: n,
9
- name: t,
10
- config: n && n !== "0" ? e(n) : null,
11
- isDefault: r,
12
- isEnterpriseDefault: r,
13
- isSelected: r
14
- }), n = [
15
- t("Box (default)", "0", !0),
16
- t("Box (gpt-3.5-turbo)", "azure__openai__gpt_3_5_turbo_16k"),
17
- t("Box (gpt-4o)", "openai__gpt_4o_2024_05_13"),
18
- t("Box (gemini 1.5 flash", "google__gemini_1_5_flash_001"),
19
- t("Box (gemini 1.5 pro)", "google__gemini_1_5_pro_001"),
20
- t("Box (gemini 2.0 flash)", "google__gemini_2_0_flash_exp"),
21
- t("Box (claude 3 sonnet)", "aws__claude_3_sonnet"),
22
- t("Box (claude 3.5 sonnet)", "aws__claude_3_5_sonnet"),
23
- t("Box (claude 3 haiku)", "aws__claude_3_haiku"),
24
- t("Box (titan text lite)", "aws__titan_text_lite"),
25
- t("Box (titan text express)", "aws__titan_text_express")
26
- ], r = {
27
- agents: n,
28
- selectedAgent: n.find((e) => e.isSelected)
29
- };
30
- export { n as agentList, r as agentState };
1
+ var minimalAgentConfig=model=>({ask:{type:`ai_agent_ask`,longText:{model},longTextMulti:{model},basicText:{model},basicTextMulti:{model}}}),getAgentConfig=(name,model=null,isDefault=!1)=>({id:model,name,config:model&&model!==`0`?minimalAgentConfig(model):null,isDefault,isEnterpriseDefault:isDefault,isSelected:isDefault}),agentList=[getAgentConfig(`Box (default)`,`0`,!0),getAgentConfig(`Box (gpt-3.5-turbo)`,`azure__openai__gpt_3_5_turbo_16k`),getAgentConfig(`Box (gpt-4o)`,`openai__gpt_4o_2024_05_13`),getAgentConfig(`Box (gemini 1.5 flash`,`google__gemini_1_5_flash_001`),getAgentConfig(`Box (gemini 1.5 pro)`,`google__gemini_1_5_pro_001`),getAgentConfig(`Box (gemini 2.0 flash)`,`google__gemini_2_0_flash_exp`),getAgentConfig(`Box (claude 3 sonnet)`,`aws__claude_3_sonnet`),getAgentConfig(`Box (claude 3.5 sonnet)`,`aws__claude_3_5_sonnet`),getAgentConfig(`Box (claude 3 haiku)`,`aws__claude_3_haiku`),getAgentConfig(`Box (titan text lite)`,`aws__titan_text_lite`),getAgentConfig(`Box (titan text express)`,`aws__titan_text_express`)],agentState={agents:agentList,selectedAgent:agentList.find(agent=>agent.isSelected)};export{agentList,agentState};
@@ -1,83 +1 @@
1
- import { a as e } from "../../../../chunks/types.js";
2
- import { ContentAnswersItemRecord as t, ContentAnswersRecord as n } from "./records.js";
3
- import { useContentAnswers as r } from "./hooks/useContentAnswers.js";
4
- import i from "./reducer.js";
5
- import { useEffect as a, useReducer as o } from "react";
6
- import { jsx as s } from "react/jsx-runtime";
7
- var c = (c) => {
8
- let { WrappedComponent: l, cachedSuggestedQuestions: u = [], createSessionRequest: d, enterpriseId: f, fetchTimeout: ee, formatCitations: te, getAIStudioAgents: ne, getAnswer: p, getAnswerStreaming: m, getSuggestedQuestions: h, hostAppName: g, isAIStudioAgentSelectorEnabled: _, isCitationsEnabled: v, isDebugModeEnabled: y, isMarkdownEnabled: b, isReactMarkdownEnabled: x, isOpen: S, isStopResponseEnabled: C, isStreamingEnabled: w, itemID: T, items: E, onCitationClick: D, onCloseModal: O, onItemClick: k, onSuggestedQuestionsFetched: A, parentItem: j, restoredQuestions: M = [], restoredSession: N = null, restoredShouldShowLandingPage: P = !0, sendErrorLog: F, shouldRenderProviders: I = !0, suggestedQuestions: re, userId: L, warningNotice: R, warningNoticeAriaLabel: z, shouldPreinitSession: B } = c, [V, H] = o(i, new n({
9
- item: new t({ id: T }),
10
- questions: M,
11
- encodedSession: N,
12
- shouldShowLandingPage: P
13
- })), { clearConversation: U, createSession: W, fetchAgentConfig: G, fetchSuggestedQuestions: K, retryQuestion: q, sendQuestion: J, setAnswerFeedback: Y, stopQuestion: X } = r({
14
- contentAnswers: V,
15
- createSessionRequest: d,
16
- dispatchStateUpdate: H,
17
- enterpriseId: f,
18
- fetchTimeout: ee,
19
- formatCitations: te,
20
- getAnswerStreaming: m,
21
- getAnswer: p,
22
- getSuggestedQuestions: h,
23
- isStopResponseEnabled: C,
24
- isStreamingEnabled: w,
25
- itemID: T,
26
- items: E,
27
- onSuggestedQuestionsFetched: A,
28
- sendErrorLog: F,
29
- userId: L,
30
- shouldPreinitSession: B
31
- }), { encodedSession: ie, error: ae, isLoading: oe, hasRequestInProgress: se = !1, questions: ce, shouldShowLandingPage: le, suggestedQuestions: Z } = V;
32
- a(() => {
33
- S && Z.requestState === e.NOT_STARTED && K();
34
- }, [
35
- S,
36
- K,
37
- Z.requestState
38
- ]);
39
- let ue = u.length > 0, Q = re, $ = e.SUCCESS;
40
- ue ? Q = u : h && (Q = Z.suggestions, $ = Z.requestState);
41
- let de = Object.fromEntries(Object.entries({
42
- createSession: W,
43
- encodedSession: ie,
44
- error: ae,
45
- getAIStudioAgents: ne,
46
- hostAppName: g,
47
- hasCustomSuggestedQuestions: !!h,
48
- hasRequestInProgress: se,
49
- isAIStudioAgentSelectorEnabled: _,
50
- isCitationsEnabled: v,
51
- isDebugModeEnabled: y,
52
- isMarkdownEnabled: b,
53
- isReactMarkdownEnabled: x,
54
- isLoading: oe,
55
- isOpen: S,
56
- isStreamingEnabled: w,
57
- itemID: T,
58
- items: E,
59
- onClearAction: U,
60
- onCloseModal: O,
61
- onCitationClick: D,
62
- onItemClick: k,
63
- onSelectAgent: G,
64
- onAgentEditorToggle: G,
65
- parentItem: j,
66
- questions: ce,
67
- retryQuestion: q,
68
- sendQuestion: J,
69
- setAnswerFeedback: Y,
70
- shouldRenderProviders: I,
71
- shouldShowLandingPage: le,
72
- stopQuestion: X,
73
- suggestedQuestionsRequestState: $,
74
- suggestedQuestions: Q,
75
- warningNotice: R,
76
- warningNoticeAriaLabel: z
77
- }).filter(([e, t]) => t !== void 0));
78
- return /* @__PURE__ */ s(l, {
79
- ...c,
80
- ...de
81
- });
82
- };
83
- export { c as ContentAnswersComponent, c as default };
1
+ import{a as REQUEST_STATE}from"../../../../chunks/types.js";import{ContentAnswersItemRecord,ContentAnswersRecord}from"./records.js";import{useContentAnswers}from"./hooks/useContentAnswers.js";import contentAnswersReducer from"./reducer.js";import{useEffect,useReducer}from"react";import{jsx}from"react/jsx-runtime";var ContentAnswersComponent=props=>{let{WrappedComponent,cachedSuggestedQuestions=[],createSessionRequest,enterpriseId,fetchTimeout,formatCitations,getAIStudioAgents,getAnswer,getAnswerStreaming,getSuggestedQuestions,hostAppName,isAIStudioAgentSelectorEnabled,isCitationsEnabled,isDebugModeEnabled,isMarkdownEnabled,isReactMarkdownEnabled,isOpen,isStopResponseEnabled,isStreamingEnabled,itemID,items,onCitationClick,onCloseModal,onItemClick,onSuggestedQuestionsFetched,parentItem,restoredQuestions=[],restoredSession=null,restoredShouldShowLandingPage=!0,sendErrorLog,shouldRenderProviders=!0,suggestedQuestions,userId,warningNotice,warningNoticeAriaLabel,shouldPreinitSession}=props,[contentAnswers,dispatch]=useReducer(contentAnswersReducer,new ContentAnswersRecord({item:new ContentAnswersItemRecord({id:itemID}),questions:restoredQuestions,encodedSession:restoredSession,shouldShowLandingPage:restoredShouldShowLandingPage})),{clearConversation,createSession,fetchAgentConfig,fetchSuggestedQuestions,retryQuestion,sendQuestion,setAnswerFeedback,stopQuestion}=useContentAnswers({contentAnswers,createSessionRequest,dispatchStateUpdate:dispatch,enterpriseId,fetchTimeout,formatCitations,getAnswerStreaming,getAnswer,getSuggestedQuestions,isStopResponseEnabled,isStreamingEnabled,itemID,items,onSuggestedQuestionsFetched,sendErrorLog,userId,shouldPreinitSession}),{encodedSession,error,isLoading,hasRequestInProgress=!1,questions,shouldShowLandingPage,suggestedQuestions:customSuggestedQuestions}=contentAnswers;useEffect(()=>{isOpen&&customSuggestedQuestions.requestState===REQUEST_STATE.NOT_STARTED&&fetchSuggestedQuestions()},[isOpen,fetchSuggestedQuestions,customSuggestedQuestions.requestState]);let hasCachedSuggestedQuestions=cachedSuggestedQuestions.length>0,finalSuggestedQuestions=suggestedQuestions,suggestedQuestionsRequestState=REQUEST_STATE.SUCCESS;hasCachedSuggestedQuestions?finalSuggestedQuestions=cachedSuggestedQuestions:getSuggestedQuestions&&(finalSuggestedQuestions=customSuggestedQuestions.suggestions,suggestedQuestionsRequestState=customSuggestedQuestions.requestState);let filteredData=Object.fromEntries(Object.entries({createSession,encodedSession,error,getAIStudioAgents,hostAppName,hasCustomSuggestedQuestions:!!getSuggestedQuestions,hasRequestInProgress,isAIStudioAgentSelectorEnabled,isCitationsEnabled,isDebugModeEnabled,isMarkdownEnabled,isReactMarkdownEnabled,isLoading,isOpen,isStreamingEnabled,itemID,items,onClearAction:clearConversation,onCloseModal,onCitationClick,onItemClick,onSelectAgent:fetchAgentConfig,onAgentEditorToggle:fetchAgentConfig,parentItem,questions,retryQuestion,sendQuestion,setAnswerFeedback,shouldRenderProviders,shouldShowLandingPage,stopQuestion,suggestedQuestionsRequestState,suggestedQuestions:finalSuggestedQuestions,warningNotice,warningNoticeAriaLabel}).filter(([_,value])=>value!==void 0));return jsx(WrappedComponent,{...props,...filteredData})};export{ContentAnswersComponent,ContentAnswersComponent as default};