Skip to content

Commit

Permalink
feat(box-ai): Update Shared packages versions (#3926)
Browse files Browse the repository at this point in the history
* feat(box-ai): Update Shared packages versions

* fix(box-ai): Update props that are not longer needed
  • Loading branch information
marcoartaviaq authored Feb 13, 2025
1 parent c4cc811 commit dc5d352
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 42 deletions.
18 changes: 12 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -370,6 +374,8 @@
}
},
"msw": {
"workerDirectory": [".storybook/public"]
"workerDirectory": [
".storybook/public"
]
}
}
}
5 changes: 1 addition & 4 deletions src/elements/common/content-answers/ContentAnswersModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ export interface ContentAnswersModalProps extends ExternalProps {

const ContentAnswersModal = ({
api,
currentUser,
file,
isOpen,
onAsk,
Expand Down Expand Up @@ -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) : '';
Expand All @@ -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}
/>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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' });
Expand All @@ -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' });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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' });
Expand All @@ -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' });
Expand All @@ -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' });
Expand All @@ -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' });
Expand All @@ -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' });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ 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();
expect(modal.getByText('What are the key takeaways?')).toBeInTheDocument();
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();
},
};

Expand Down Expand Up @@ -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?');
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -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');
Expand Down
1 change: 0 additions & 1 deletion src/elements/content-sidebar/BoxAISidebarContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ function BoxAISidebarContent(props: ApiWrapperProps) {
items={items}
itemSize={itemSize}
onClearAction={onClearAction}
onModalClose={handleModalClose}
onOpenChange={handleModalClose}
onSelectAgent={onSelectAgent}
open={isModalOpen}
Expand Down
3 changes: 1 addition & 2 deletions src/elements/content-sidebar/__tests__/BoxAISidebar.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ export const basic: StoryObj<typeof BoxAISidebar> = {
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();
Expand Down
24 changes: 12 additions & 12 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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/[email protected]":
version "9.22.3-rc-box.9"
Expand Down

0 comments on commit dc5d352

Please sign in to comment.