diff --git a/package.json b/package.json index 418acfc05a..cab529fc43 100644 --- a/package.json +++ b/package.json @@ -92,7 +92,11 @@ "last 2 Edge versions", "last 2 iOS versions" ], - "development": ["last 1 Chrome versions", "last 1 Firefox versions", "last 1 Safari versions"] + "development": [ + "last 1 Chrome versions", + "last 1 Firefox versions", + "last 1 Safari versions" + ] }, "husky": { "hooks": { @@ -124,13 +128,13 @@ "@babel/types": "^7.24.7", "@box/blueprint-web": "^7.36.3", "@box/blueprint-web-assets": "^4.33.0", - "@box/box-ai-agent-selector": "^0.22.0", - "@box/box-ai-content-answers": "^0.86.0", + "@box/box-ai-agent-selector": "^0.26.4", + "@box/box-ai-content-answers": "^0.95.0", "@box/cldr-data": "^34.2.0", "@box/frontend": "^10.0.0", "@box/item-icon": "^0.9.58", "@box/languages": "^1.0.0", - "@box/metadata-editor": "0.91.0", + "@box/metadata-editor": "0.92.0", "@box/react-virtualized": "9.22.3-rc-box.9", "@cfaester/enzyme-adapter-react-18": "^0.8.0", "@chromatic-com/storybook": "^1.6.1", @@ -370,6 +374,8 @@ } }, "msw": { - "workerDirectory": [".storybook/public"] + "workerDirectory": [ + ".storybook/public" + ] } -} +} \ No newline at end of file diff --git a/src/elements/common/content-answers/ContentAnswersModal.tsx b/src/elements/common/content-answers/ContentAnswersModal.tsx index 3de8a65fc7..f11a521a0f 100644 --- a/src/elements/common/content-answers/ContentAnswersModal.tsx +++ b/src/elements/common/content-answers/ContentAnswersModal.tsx @@ -42,7 +42,6 @@ export interface ContentAnswersModalProps extends ExternalProps { const ContentAnswersModal = ({ api, - currentUser, file, isOpen, onAsk, @@ -166,7 +165,6 @@ const ContentAnswersModal = ({ const fileName = getProp(file, 'name'); const fileExtension = getProp(file, 'extension'); - const userInfo = { name: getProp(currentUser, 'name', ''), avatarURL: getProp(currentUser, 'avatarURL', '') }; const isSpreadsheet = SPREADSHEET_FILE_EXTENSIONS.includes(fileExtension); const spreadsheetNotice = isSpreadsheet ? formatMessage(messages.welcomeMessageSpreadsheetNotice) : ''; @@ -180,16 +178,15 @@ const ContentAnswersModal = ({ isMarkdownEnabled={isMarkdownEnabled} isResetChatEnabled={isResetChatEnabled} onClearAction={handleClearConversation} - onModalClose={handleOnRequestClose} onOpenChange={handleOnRequestClose} open={isOpen} questions={questions} retryQuestion={handleRetry} + setAnswerFeedback={undefined} submitQuestion={handleAsk} suggestedQuestions={suggestedQuestions || localizedQuestions} warningNotice={spreadsheetNotice} warningNoticeAriaLabel={formatMessage(messages.welcomeMessageSpreadsheetNoticeAriaLabel)} - userInfo={userInfo} /> ); }; diff --git a/src/elements/common/content-answers/__tests__/ContentAnswers.test.tsx b/src/elements/common/content-answers/__tests__/ContentAnswers.test.tsx index b62948de79..7b304734e7 100644 --- a/src/elements/common/content-answers/__tests__/ContentAnswers.test.tsx +++ b/src/elements/common/content-answers/__tests__/ContentAnswers.test.tsx @@ -38,7 +38,7 @@ describe('elements/common/content-answers/ContentAnswers', () => { const modal = screen.getByTestId('content-answers-modal'); expect(modal).toBeInTheDocument(); - const textArea = screen.getByRole('textbox', { name: 'Ask anything about this doc' }); + const textArea = screen.getByRole('textbox', { name: 'Ask Box AI' }); fireEvent.change(textArea, { target: { value: prompt } }); const submitButton = screen.getByRole('button', { name: 'Ask' }); @@ -59,7 +59,7 @@ describe('elements/common/content-answers/ContentAnswers', () => { const button = screen.getByRole('button', { name: 'Box AI' }); await userEvent.click(button); - const textArea = screen.getByRole('textbox', { name: 'Ask anything about this doc' }); + const textArea = screen.getByRole('textbox', { name: 'Ask Box AI' }); fireEvent.change(textArea, { target: { value: 'Sample question?' } }); const submitButton = screen.getByRole('button', { name: 'Ask' }); diff --git a/src/elements/common/content-answers/__tests__/ContentAnswersModal.test.tsx b/src/elements/common/content-answers/__tests__/ContentAnswersModal.test.tsx index b712f96300..b7a5a0b993 100644 --- a/src/elements/common/content-answers/__tests__/ContentAnswersModal.test.tsx +++ b/src/elements/common/content-answers/__tests__/ContentAnswersModal.test.tsx @@ -48,7 +48,7 @@ describe('elements/common/content-answers/ContentAnswersModal', () => { const { answer = '', prompt } = mockQuestionsWithAnswer[0]; renderComponent(mockApi, { onAsk: onAskMock }); - const textArea = screen.getByRole('textbox', { name: 'Ask anything about this doc' }); + const textArea = screen.getByRole('textbox', { name: 'Ask Box AI' }); await userEvent.type(textArea, prompt); const submitButton = screen.getByRole('button', { name: 'Ask' }); @@ -66,7 +66,7 @@ describe('elements/common/content-answers/ContentAnswersModal', () => { const { prompt } = mockQuestionsWithError[0]; renderComponent(mockApiReturnError); - const textArea = screen.getByRole('textbox', { name: 'Ask anything about this doc' }); + const textArea = screen.getByRole('textbox', { name: 'Ask Box AI' }); await userEvent.type(textArea, prompt); const submitButton = screen.getByRole('button', { name: 'Ask' }); @@ -92,7 +92,7 @@ describe('elements/common/content-answers/ContentAnswersModal', () => { }; renderComponent(apiMock); - const textArea = screen.getByRole('textbox', { name: 'Ask anything about this doc' }); + const textArea = screen.getByRole('textbox', { name: 'Ask Box AI' }); await userEvent.type(textArea, prompt); const submitButton = screen.getByRole('button', { name: 'Ask' }); @@ -112,7 +112,7 @@ describe('elements/common/content-answers/ContentAnswersModal', () => { renderComponent(mockApi, { onAsk: onAskMock }); - let textArea = screen.getByRole('textbox', { name: 'Ask anything about this doc' }); + let textArea = screen.getByRole('textbox', { name: 'Ask Box AI' }); await userEvent.type(textArea, prompt); let submitButton = screen.getByRole('button', { name: 'Ask' }); @@ -122,7 +122,7 @@ describe('elements/common/content-answers/ContentAnswersModal', () => { include_citations: true, }); - textArea = screen.getByRole('textbox', { name: 'Ask anything about this doc' }); + textArea = screen.getByRole('textbox', { name: 'Ask Box AI' }); await userEvent.type(textArea, 'Another question?'); submitButton = screen.getByRole('button', { name: 'Ask' }); diff --git a/src/elements/content-preview/stories/tests/ContentPreview-visual.stories.js b/src/elements/content-preview/stories/tests/ContentPreview-visual.stories.js index fa5a34d8bf..7e67548f23 100644 --- a/src/elements/content-preview/stories/tests/ContentPreview-visual.stories.js +++ b/src/elements/content-preview/stories/tests/ContentPreview-visual.stories.js @@ -23,8 +23,8 @@ export const basic = { expect(dialog).toBeInTheDocument(); const modal = within(dialog); - expect(modal.getByText('Welcome to Box AI')).toBeInTheDocument(); - expect(modal.getByText('Ask questions about')).toBeInTheDocument(); + expect(modal.getByText(/Welcome to Box AI/i)).toBeInTheDocument(); + expect(modal.getByText('Ask Box AI')).toBeInTheDocument(); expect(modal.getByText('This chat will be cleared when you close this pdf')).toBeInTheDocument(); expect(modal.getByText('Summarize this document')).toBeInTheDocument(); @@ -32,7 +32,7 @@ export const basic = { expect(modal.getByText('How can this document be improved?')).toBeInTheDocument(); expect(modal.getByText('Are there any next steps defined?')).toBeInTheDocument(); - expect(modal.getByText('Ask anything about this pdf')).toBeInTheDocument(); + expect(modal.getByText('Ask Box AI')).toBeInTheDocument(); }, }; @@ -63,7 +63,7 @@ export const submitAnswer = { expect(dialog).toBeInTheDocument(); const modal = within(dialog); - const textInput = modal.getByRole('textbox', { name: 'Ask anything about this pdf' }); + const textInput = modal.getByRole('textbox', { name: 'Ask Box AI' }); expect(textInput).toBeInTheDocument(); textInput.focus(); await userEvent.keyboard('Why are public APIs important?'); @@ -116,7 +116,8 @@ export const hoverOverCitation = { expect(modal.getByText('Based on:')).toBeInTheDocument(); - const citation = await modal.getByRole('button', { name: 'Reference 1' }); + const citations = await modal.getAllByTestId('content-answers-citation-status') + const citation = citations[0]; expect(citation).toBeInTheDocument(); await userEvent.hover(citation); @@ -193,7 +194,7 @@ export const markdownEnabled = { expect(dialog).toBeInTheDocument(); const modal = within(dialog); - const textInput = modal.getByRole('textbox', { name: 'Ask anything about this pdf' }); + const textInput = modal.getByRole('textbox', { name: 'Ask Box AI' }); expect(textInput).toBeInTheDocument(); textInput.focus(); await userEvent.keyboard('table summarizing the highlights from the document'); @@ -222,7 +223,7 @@ export const markdownDisabled = { expect(dialog).toBeInTheDocument(); const modal = within(dialog); - const textInput = modal.getByRole('textbox', { name: 'Ask anything about this pdf' }); + const textInput = modal.getByRole('textbox', { name: 'Ask Box AI' }); expect(textInput).toBeInTheDocument(); textInput.focus(); await userEvent.keyboard('table summarizing the highlights from the document'); diff --git a/src/elements/content-sidebar/BoxAISidebarContent.tsx b/src/elements/content-sidebar/BoxAISidebarContent.tsx index aeb96e0e94..845d7ef3ad 100644 --- a/src/elements/content-sidebar/BoxAISidebarContent.tsx +++ b/src/elements/content-sidebar/BoxAISidebarContent.tsx @@ -192,7 +192,6 @@ function BoxAISidebarContent(props: ApiWrapperProps) { items={items} itemSize={itemSize} onClearAction={onClearAction} - onModalClose={handleModalClose} onOpenChange={handleModalClose} onSelectAgent={onSelectAgent} open={isModalOpen} diff --git a/src/elements/content-sidebar/__tests__/BoxAISidebar.test.tsx b/src/elements/content-sidebar/__tests__/BoxAISidebar.test.tsx index 57d7d86474..ff679f11da 100644 --- a/src/elements/content-sidebar/__tests__/BoxAISidebar.test.tsx +++ b/src/elements/content-sidebar/__tests__/BoxAISidebar.test.tsx @@ -181,8 +181,7 @@ describe('elements/content-sidebar/BoxAISidebar', () => { test('should render welcome message', async () => { await renderComponent(); - - expect(screen.getByText('Welcome to Box AI')).toBeInTheDocument(); + expect(screen.getByText('Welcome to Box AI', { exact: false })).toBeInTheDocument(); }); test('should not set questions that are in progress', async () => { diff --git a/src/elements/content-sidebar/stories/tests/BoxAISidebar-visual.stories.tsx b/src/elements/content-sidebar/stories/tests/BoxAISidebar-visual.stories.tsx index f73a3ad827..2e96174be4 100644 --- a/src/elements/content-sidebar/stories/tests/BoxAISidebar-visual.stories.tsx +++ b/src/elements/content-sidebar/stories/tests/BoxAISidebar-visual.stories.tsx @@ -15,10 +15,10 @@ export const basic: StoryObj = { const clearButton = await canvas.findByRole('button', { name: 'Clear conversation' }); expect(clearButton).toBeInTheDocument(); - expect(await canvas.findByText('Welcome to Box AI')).toBeInTheDocument(); - expect(await canvas.findByText('Ask questions about')).toBeInTheDocument(); + expect(await canvas.findByText(/Welcome to Box AI/i)).toBeInTheDocument(); + expect(await canvas.findByText(/Ask questions about/i)).toBeInTheDocument(); expect(await canvas.findByText('This chat will be cleared when you close this content')).toBeInTheDocument(); - expect(await canvas.findByPlaceholderText('Ask anything about this content')).toBeInTheDocument(); + expect(await canvas.findByPlaceholderText('Ask Box AI')).toBeInTheDocument(); expect(await canvas.findByText('Summarize this document')).toBeInTheDocument(); expect(await canvas.findByText('What are the key takeaways?')).toBeInTheDocument(); expect(await canvas.findByText('How can this document be improved?')).toBeInTheDocument(); diff --git a/yarn.lock b/yarn.lock index 6c73f80ac7..f84bba7fd6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1494,15 +1494,15 @@ tabbable "^4.0.0" type-fest "^3.2.0" -"@box/box-ai-agent-selector@^0.22.0": - version "0.22.0" - resolved "https://registry.yarnpkg.com/@box/box-ai-agent-selector/-/box-ai-agent-selector-0.22.0.tgz#d91e4270766a9f7e95166808c4ed735247d196c2" - integrity sha512-eDj088pwuG9OIj+Ut4g7tz1jgdOcZjUDH+vt+hAazCIZJRBnzft6thDVUlrh4XeQ00cdoopIxfNkP1Un937SxA== +"@box/box-ai-agent-selector@^0.26.4": + version "0.26.4" + resolved "https://registry.yarnpkg.com/@box/box-ai-agent-selector/-/box-ai-agent-selector-0.26.4.tgz#76d78550648779fea1376272a2131b101bab822b" + integrity sha512-ct2Sg62UEKQIy8YPGOI5CcI7ov+QW/+IHL5pted/hD5BxbzXAApHOLHk4AlVMTsaidHDalz62E8nA3bus6b3Bw== -"@box/box-ai-content-answers@^0.86.0": - version "0.86.2" - resolved "https://registry.yarnpkg.com/@box/box-ai-content-answers/-/box-ai-content-answers-0.86.2.tgz#757143a6cb97447bfb12e797bccbd86b09921022" - integrity sha512-3Dlf10D36ZeM7uOokdiS/AyKj0rAa0HlrnNKFA+CEeJQS+2lv+ICRjd7fmE4lf5moix5zfPEKq+MDOQTQ7dyxA== +"@box/box-ai-content-answers@^0.95.0": + version "0.95.0" + resolved "https://registry.yarnpkg.com/@box/box-ai-content-answers/-/box-ai-content-answers-0.95.0.tgz#37bcd2545991d76fa9fbe525c22b863f76873979" + integrity sha512-67H93EPLmQBvDqtqScZpHHz7UglBE4LUoKWyAA6J3EaWIUSZAMv4m2iAmbgkjYkXPCvUUafVYoSZ0osPcdcPiw== "@box/cldr-data@^34.2.0": version "34.8.0" @@ -1528,10 +1528,10 @@ resolved "https://registry.yarnpkg.com/@box/languages/-/languages-1.1.2.tgz#cd4266b3da62da18560d881e10b429653186be29" integrity sha512-d64TGosx+KRmrLZj4CIyLp42LUiEbgBJ8n8cviMQwTJmfU0g+UwZqLjmQZR1j+Q9D64yV4xHzY9K1t5nInWWeQ== -"@box/metadata-editor@0.91.0": - version "0.91.0" - resolved "https://registry.yarnpkg.com/@box/metadata-editor/-/metadata-editor-0.91.0.tgz#f7562f4cefd224aad491e955adefce2147c2a803" - integrity sha512-TyJD6n8jS5MW9rericaLlG7h203+xWpjt9deqkrYiQ9K6Vu79FqAmrW3sbBRHJFREy6Os34SruvSqL71qCPclw== +"@box/metadata-editor@0.92.0": + version "0.92.0" + resolved "https://registry.yarnpkg.com/@box/metadata-editor/-/metadata-editor-0.92.0.tgz#df484131655f35e49e355af2b07340eaaddfe905" + integrity sha512-AibiQMlCVV2kTbvhH2ZkgseLjyu89oZkmekuANg6y7tFh0633OVdn0eo5NXaCAASfff6THbH2gxWir7fd/r6tA== "@box/react-virtualized@9.22.3-rc-box.9": version "9.22.3-rc-box.9"