Chatwoot/app/views/widget_tests/index.html.erb
Pranav Raj S 12ee7e5d82
feat: Add chatwoot:ready event listener on window (#1091)
* feat: Add `chatwoot:ready` event listener on window

* Add specs

* Rename customEventHelper.js -> CustomEventHelper.js
2020-07-25 21:54:58 +05:30

27 lines
650 B
Text

<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0" />
<script>
window.chatwootSettings = {
hideMessageBubble: false,
position: 'left',
locale: 'en',
};
(function(d,t) {
var BASE_URL = '';
var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
g.src= BASE_URL + "/packs/js/sdk.js";
s.parentNode.insertBefore(g,s);
g.onload=function(){
window.chatwootSDK.run({
websiteToken: '<%= @web_widget.website_token %>',
baseUrl: BASE_URL
})
}
})(document,"script");
window.addEventListener('chatwoot:ready', function() {
console.log(window.$chatwoot)
})
</script>