constructor(props) { super(props); this.state = { messages: [], showBot: false, welcomeSent: false, botName: 'Chatbot' }; this.sound = new Audio(messageSound); //Setting the cookie using uuid if (!cookies.get("userID")) { cookies.set("userID", uuid(), { path: "/" }); } //Binding event listeners this.toggleBot = this.toggleBot.bind(this); this._handleInputKeyPress = this._handleInputKeyPress.bind(this); }
constructor(props) { super(props); // This binding is necessary to make `this` work in the callback this._handleInputKeyPress = this._handleInputKeyPress.bind(this); this._handleQuickReplyPayload = this._handleQuickReplyPayload.bind(this); this.hide = this.hide.bind(this); this.show = this.show.bind(this); this.state = { messages: [], showBot: true, shopWelcomeSent: false, clientToken: false, regenerateToken: 0 }; if (cookies.get('userID') === undefined) { cookies.set('userID', uuid(), { path: '/' }); } }
componentDidMount() { this.setState({ type: this.props.location.state !== undefined ? this.props.location.state.item : "newbadge" }); let load = cookie.get("load"); // cookie.remove('load') if (load !== "done") { cookie.set("load", "done", { maxAge: 86400 }); this.setState( { showLoading: true }, () => { setTimeout(() => { this.setState({ showLoading: false }); }, 2500); } ); } else { this.setState({ showLoading: false }); } }
constructor(props) { super(props); this.state = { messages: [], showBot: false, welcomeSent: false, botName: 'Chatbot' }; this.sound = new Audio(messageSound); //Setting the cookie using uuid if (!cookies.get("userID")) { cookies.set("userID", uuid(), { path: "/" }); } //Binding event listeners this.toggleBot = this.toggleBot.bind(this); this._handleInputKeyPress = this._handleInputKeyPress.bind(this); }