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
Support: send initial info on chat start #471
Conversation
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.
With master
branch the chat works, but on this branch I get some sort of infinite loop from the happychat-client library crashing the chat (Uncaught RangeError: Maximum call stack size exceeded
).
As best I can tell from going through the stack trace, the Happychat.sendUserInfo
call here is triggering the 'availability'
event, resulting in an infinite loop. Moving didSendInitialInfo = true;
to line 56 (above Happychat.sendUserInfo
) solves the issue.
let didSendInitialInfo; | ||
Happychat.on( 'availability', availability => { | ||
if ( ! didSendInitialInfo && availability ) { | ||
Happychat.sendUserInfo( { |
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.
Happychat.sendUserInfo( { | |
didSendInitialInfo = true; | |
Happychat.sendUserInfo( { |
This change will prevent an infinite loop without otherwise affecting the behavior.
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.
Fixed: f37bc85
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.
Latest version works great!
# [1.1.0](v1.0.0...v1.1.0) (2020-03-10) ### Bug Fixes * fix Site Kit module deactivation ([96787e9](96787e9)) * standardize REST API namespace usage ([44d15b2](44d15b2)) ### Features * **support:** add a link to support docs ([#470](#470)) ([af4754d](af4754d)) * **support:** send initial info on chat start ([#471](#471)) ([1392452](1392452)) * **support:** update subject string for support tickets ([aca9963](aca9963))
🎉 This PR is included in version 1.1.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
All Submissions:
Changes proposed in this Pull Request:
In order for HEs to know that they're dealing with a Newspack customer, an "event" will be sent at the beginning of the chat. Events are used for messages like "user is navigating to billing page", but here we'll use this feature to "mark" a Newspack customer.
Also, the "user info" is added here for convenience. It has a link to the site, as well as some browser information.
How to test the changes in this Pull Request:
[ Newspack customer ]
message are prepended.Other information: