diff --git a/LiveChat/Chat/Chat.js b/LiveChat/Chat/Chat.js index 3614d48..f276540 100644 --- a/LiveChat/Chat/Chat.js +++ b/LiveChat/Chat/Chat.js @@ -113,9 +113,13 @@ export default class Chat extends React.Component { }; closeChat = () => { - this.chat.lightSpeedOut(500).then(() => { - this.props.closeChat(); - }); + if (this.props.animateOnClose) { + this.chat.lightSpeedOut(500).then(() => { + this.props.closeChat(); + }); + } else { + this.props.closeChat(); + } }; renderFooter = () => { @@ -135,7 +139,7 @@ export default class Chat extends React.Component { if (this.props.isChatOn) { return ( { this.chat = ref; }} > diff --git a/LiveChat/LiveChat.js b/LiveChat/LiveChat.js index cf6a5ff..0c01339 100644 --- a/LiveChat/LiveChat.js +++ b/LiveChat/LiveChat.js @@ -67,7 +67,7 @@ export default class LiveChat extends Component { bubble={this.state.bubble} disabled={this.props.movable} /> - + ); } @@ -85,6 +85,7 @@ LiveChat.propTypes = { greeting: PropTypes.string, noAgents: PropTypes.string, onLoaded: PropTypes.func, + closeChat: PropTypes.func, }; LiveChat.defaultProps = { diff --git a/README.md b/README.md index 25b15b5..04e7d18 100644 --- a/README.md +++ b/README.md @@ -121,12 +121,33 @@ Let's say you want to close the current chat. You can do it in two ways: // is the same as: GLOBAL.visitorSDK.closeChat(); ``` +#### Props + +|Name|Type|Required|Note| +|---|---|---|---| +| animateOnOpen | Bool | No | Chat will open with an animation. | +| animateOnClose | Bool | No | Chat will close with an animation. | +| license | Int | Yes | License number for livechat. | +| group | Int | No | Description goes here. | +| movable | Bool | No | Description goes here. | +| bubble | Element | No | Description goes here. | +| bubbleColor | String | No | Description goes here. | +| bubbleLeft | Number | No | Description goes here. | +| bubbleTop | Number | No | Description goes here. | +| chatTitle | String | No | Description goes here. | +| greeting | String | No | Description goes here. | +| noAgents | String | No | Description goes here. | +| onLoaded | Func | No | Description goes here. | +| closeChat | Func | No | Overrides the default function to run when user clicks the "Back" button, closing the chat. | + + #### Available methods |Name|Note| |---|---| | closeChat | Closes the chat. | +| openChat | Opens the chat. | | sendMessage | Sends a message. More information about message format you can find [here](https://docs.livechatinc.com/visitor-sdk/#sendmessage). | | rateChat | Enables chat ratings. More info [here](https://docs.livechatinc.com/visitor-sdk/#ratechat). | |setSneakPeek | Enables sneak peeks to see what the visitor is typing in before they actually send the message. More info [here](https://docs.livechatinc.com/visitor-sdk/#setsneakpeek). |