-
Notifications
You must be signed in to change notification settings - Fork 47
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
base: master
Are you sure you want to change the base?
Conversation
Added chatSessionParameters to ChatInterface and check for parameters in initiateChat
src/components/Chat/ChatInitiator.js
Outdated
@@ -32,6 +32,9 @@ function safeParse(jsonString, defaultValue) { | |||
* @returns {Promise} Promise object that resolves to chatDetails objects | |||
*/ | |||
export function initiateChat(input) { | |||
if (input.chatSessionParameters) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 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? - Can you add a unit test case for the new path?
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I have moved the check from ChatInitiator.js to ChatContainer.js
- I have added a unit test to ChatContainer.test.js that checks that initiateChat has not been called when chatSessionParameters is present.
There was a problem hiding this 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.
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.