diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ff32ec1..c12a745a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 0.5.4 +- When reconnecting to an existing chat session, the bot will send a message contained in the localStorage key specified by the `NEXT_MESSAGE` constant. The message should be stringified JSON with a `message` property describing the message and an `expiry` property set to a UNIX timestamp in milliseconds after which this message should not be sent. + ## 0.5.3 - Added the parameter hideWhenNotConnected to not display the widget when the server is not connected (defaults to true) - Fixed issue where the 'connected' property was being loaded from previous session instead of being triggered on actual connection diff --git a/README.md b/README.md index 3cf00368..6ff8fe18 100644 --- a/README.md +++ b/README.md @@ -208,6 +208,10 @@ emit('bot_uttered', message, room=socket_id) `storage: "local"` defines the state to be stored in the local stoage. The local storage persists after the the browser is closed, and is cleared when the cookies of the browser are cleared, or when `localStorage.clear()`is called. +### Sending a message on page load + +When reconnecting to an existing chat session, the bot will send a message contained in the localStorage key specified by the `NEXT_MESSAGE` constant. The message should be stringified JSON with a `message` property describing the message and an `expiry` property set to a UNIX timestamp in milliseconds after which this message should not be sent. This is useful if you would like your bot to be able to offer your user to navigate around the site. + ## API diff --git a/src/components/Widget/components/Conversation/components/Messages/components/Message/index.js b/src/components/Widget/components/Conversation/components/Messages/components/Message/index.js index e549673f..734c43ae 100644 --- a/src/components/Widget/components/Conversation/components/Messages/components/Message/index.js +++ b/src/components/Widget/components/Conversation/components/Messages/components/Message/index.js @@ -12,7 +12,7 @@ class Message extends PureComponent {