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

Allow creation of chatSession from startChatResponse parameters #286

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

wue148070
Copy link

@wue148070 wue148070 commented Feb 25, 2025

Description of changes:
Added chatSessionParameters to ChatInterface.js that would be obtained by a call to startChatApi. If chatSessionParameters are present, initiateChat skips making a call to the provided backend startChat API and creates a chat session directly with the provided parameters.

Changes were built and the amazon-connect-chat-interface.js was tested locally on our website.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Added chatSessionParameters to ChatInterface and check for parameters in initiateChat
@wue148070 wue148070 requested a review from a team as a code owner February 25, 2025 20:55
@wue148070 wue148070 requested review from haomingli2020 and agarwhi and removed request for a team February 25, 2025 20:55
@@ -32,6 +32,9 @@ function safeParse(jsonString, defaultValue) {
* @returns {Promise} Promise object that resolves to chatDetails objects
*/
export function initiateChat(input) {
if (input.chatSessionParameters) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

  1. Instead of returning the input.chatSessionParameters here, can we add a check where this function is called in ChatContainer.js and avoid the initiateChat call?
  2. Can you add a unit test case for the new path?

Thanks!

Copy link
Author

Choose a reason for hiding this comment

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

  1. I have moved the check from ChatInitiator.js to ChatContainer.js
  2. I have added a unit test to ChatContainer.test.js that checks that initiateChat has not been called when chatSessionParameters is present.

Copy link

@agarwhi agarwhi left a comment

Choose a reason for hiding this comment

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

Pls add details of testing this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants