Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(content-sidebar): added onUserInteraction prop to BoxAISidebar #4027

Conversation

kkuliczkowski-box
Copy link
Contributor

Description

Added onUserInteraction prop to BoxAISidebar to notify parent when user interacts with Box AI.

@kkuliczkowski-box kkuliczkowski-box requested review from a team as code owners March 14, 2025 16:30
@@ -14,7 +14,6 @@ import {
ClearConversationButton,
IntelligenceModal,
withApiWrapper,
// @ts-expect-error - TS2305 - Module '"@box/box-ai-content-answers"' has no exported member 'ApiWrapperWithInjectedProps'.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙌

@@ -83,11 +83,14 @@ function BoxAISidebarContent(props: ApiWrapperWithInjectedProps) {
setCacheValue('agents', { agents, requestState, selectedAgent });
}

const handleUserIntentToUseAI = () => {
const handleUserIntentToUseAI = (userHasInteracted: boolean = false) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit] I think hasUserInteracted would be more proper form

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That might be true, however I've named it the same way in content-answers, so for consistency I'd leave it like that.

@kkuliczkowski-box kkuliczkowski-box force-pushed the content-sidebar/box-ai-handle-user-interaction-prop branch from ad4aaf4 to 3566980 Compare March 14, 2025 16:58
@@ -423,4 +424,14 @@ describe('elements/content-sidebar/BoxAISidebar', () => {
expect(mockSendQuestion).not.toHaveBeenCalled();
},
);

test('should call onUserInteraction when user takes action', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we cover when userHasInteracted? Or is this covered in box-ai-content-answers?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test already covers that. onUserIntentToUseAI is called with userHasInteracted = true when user types in prompt. The logic of setting this param is inside content-answers.

@kkuliczkowski-box kkuliczkowski-box force-pushed the content-sidebar/box-ai-handle-user-interaction-prop branch from 3566980 to 5255c71 Compare March 14, 2025 17:38
@mergify mergify bot merged commit 995c092 into box:master Mar 14, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants