UNPKG

genesys-chat-rr

Version:

Class iteration chat genesys royalresorts.com

36 lines (27 loc) 900 B
import {GenesysChat} from "./components/chat-init"; class ChatRR{ chatG; constructor(buttons,options) { options || (options = null); this.chatG = new GenesysChat(options); this.initChat(buttons); } initChat(els){ els.forEach(el => { el.addEventListener("click",evt => { this.chatG.startChat(el.dataset.channel,el.innerHTML); this.chatG.getInstance().subscribe('WebChat.opened',event => { window.dataLayer = window.dataLayer || []; dataLayer.push({ 'event':'webchat form', 'department':el.dataset.channel }) }); }); }); } getInstanceChat(){ return this.chatG.getInstance(); } } export default ChatRR