{"version":3,"sources":["webpack:///./widgets/chatbotButton.js"],"names":["ChatbotButton","$el","_classCallCheck","this","$","key","value","setChatbotButton","handleBtnClick","$wg","window","on","scrollTop","addClass","removeClass","$happytalkBtn","find","e","preventDefault","url","prop","open"],"mappings":"i2BACA,IAQaA,EAAa,WAKxB,O,EAHD,SAAAA,EAAYC,I,4FAAKC,CAAA,KAAAF,GAEhBG,KAAKF,IAAMG,EAAEH,K,EACb,EAAAI,IAAA,OAAAC,MAED,WAECH,KAAKI,mBACLJ,KAAKK,mBAGN,CAAAH,IAAA,mBAAAC,MACA,WACC,IAAIG,EAAMN,KAAKF,IAGfG,EAAEM,QAAQC,GAAG,UAAU,WACnBP,EAAEM,QAAQE,YAAc,IAC1BH,EAAII,SAJiB,gBAMrBJ,EAAIK,YANiB,qBASvB,CAAAT,IAAA,iBAAAC,MAED,WACC,IAAIS,EAAgBZ,KAAKF,IAAIe,KAAK,iCAClCD,EAAcJ,GAAG,SAAS,SAACM,GAC1BA,EAAEC,iBACF,IAAIC,EAAMJ,EAAcK,KAAK,QAC7BV,OAAOW,KAAKF,EAAK,cAAe,gC,0FAhCT,I","file":"21.js","sourcesContent":["// CONSTANTS are all caps.\nconst NS = \"ChatbotButton\";\nconst CLS = \"chatbotButton\";\nconst WG = \".\" + CLS + \"-\";\n\n// Import stuff here if you need to or even better to import them dynamically\n// for ex. of dynamic import check out src/scripts/loadWg/chatbotButton.js using Webpack dynamic imports as chunks.\n// import $ from 'jquery'\n\nexport class ChatbotButton {\n\n\tconstructor($el) {\n\t\t// $el is the widget node return by the loadChatbotButton function\n\t\tthis.$el = $($el);\n\t}\n\n\tinit() {\n\t\tconsole.log(NS, \"init\");\n\t\tthis.setChatbotButton();\n\t\tthis.handleBtnClick();\n\t}\n\n\t//check if page is scrolled so it can move together with the \"back to top\" button\n\tsetChatbotButton() {\n\t\tlet $wg = this.$el;\n\t\tconst clsHasScrolled = 'has-scrolled';\n\n\t\t$(window).on('scroll', () => {\n\t\t\tif($(window).scrollTop() > 100) {\n\t\t\t\t$wg.addClass(clsHasScrolled);\n\t\t\t} else {\n\t\t\t\t$wg.removeClass(clsHasScrolled);\n\t\t\t}\n\t\t});\n\t}\n\n\thandleBtnClick() {\n\t\tlet $happytalkBtn = this.$el.find('.chatbotButton-btn--happytalk');\n\t\t$happytalkBtn.on('click', (e) => {\n\t\t\te.preventDefault();\n\t\t\tlet url = $happytalkBtn.prop('href');\n\t\t\twindow.open(url, 'Window Name', 'height=503,width=350');\n\t\t});\n\t}\n\n}\n"],"sourceRoot":""}