From 7abf5ed3cbf86c4365aaef1702d9ce60e9116ff4 Mon Sep 17 00:00:00 2001 From: Dmitrii Ostasevich Date: Wed, 8 Jan 2025 16:56:06 +0000 Subject: [PATCH 1/2] make QRs in chat options post to the active session --- src/webchat-ui/components/WebchatUI.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/webchat-ui/components/WebchatUI.tsx b/src/webchat-ui/components/WebchatUI.tsx index e750e505..2c5ecc44 100644 --- a/src/webchat-ui/components/WebchatUI.tsx +++ b/src/webchat-ui/components/WebchatUI.tsx @@ -742,7 +742,6 @@ export class WebchatUI extends React.PureComponent< options, }); } else { - this.props.onSwitchSession(); this.props.onSendMessage(text, data, options); } }; From 4f6e88043b506c9a0263307c571f2864e7cbb527 Mon Sep 17 00:00:00 2001 From: Dmitrii Ostasevich Date: Wed, 8 Jan 2025 23:39:05 +0000 Subject: [PATCH 2/2] use only for chat options, otherwise start new session as previously --- src/webchat-ui/components/WebchatUI.tsx | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/webchat-ui/components/WebchatUI.tsx b/src/webchat-ui/components/WebchatUI.tsx index 2c5ecc44..4bf08053 100644 --- a/src/webchat-ui/components/WebchatUI.tsx +++ b/src/webchat-ui/components/WebchatUI.tsx @@ -735,6 +735,26 @@ export class WebchatUI extends React.PureComponent< this.props.onSetShowHomeScreen(false); this.props.onSetShowChatOptionsScreen(false); + if (this.props.config.settings.privacyNotice.enabled && !this.props.hasAcceptedTerms) { + this.props.onSetStoredMessage({ + text, + data, + options, + }); + } else { + this.props.onSwitchSession(); + this.props.onSendMessage(text, data, options); + } + }; + + handleSendActionButtonMessageExistingSession = ( + text?: string, + data?: any, + options?: Partial, + ) => { + this.props.onSetShowHomeScreen(false); + this.props.onSetShowChatOptionsScreen(false); + if (this.props.config.settings.privacyNotice.enabled && !this.props.hasAcceptedTerms) { this.props.onSetStoredMessage({ text, @@ -1204,7 +1224,7 @@ export class WebchatUI extends React.PureComponent< hasGivenRating={this.props.hasGivenRating} onSendRating={this.handleSendRating} onEmitAnalytics={onEmitAnalytics} - onSendActionButtonMessage={this.handleSendActionButtonMessage} + onSendActionButtonMessage={this.handleSendActionButtonMessageExistingSession} /> );