2020-01-17 08:06:05 +00:00
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0" />
|
|
|
|
|
2021-01-17 17:14:03 +00:00
|
|
|
|
|
|
|
<%
|
|
|
|
user_id = 1
|
|
|
|
user_hash = OpenSSL::HMAC.hexdigest(
|
|
|
|
'sha256',
|
|
|
|
@web_widget.hmac_token,
|
|
|
|
user_id.to_s
|
|
|
|
)
|
|
|
|
|
|
|
|
%>
|
2019-11-01 07:23:01 +00:00
|
|
|
<script>
|
2020-04-03 07:34:58 +00:00
|
|
|
|
|
|
|
window.chatwootSettings = {
|
|
|
|
hideMessageBubble: false,
|
2020-04-25 17:48:00 +00:00
|
|
|
position: 'left',
|
2020-10-18 18:02:22 +00:00
|
|
|
locale: 'en',
|
2020-08-09 10:37:32 +00:00
|
|
|
type: 'expanded_bubble',
|
2020-08-28 12:09:46 +00:00
|
|
|
showPopoutButton: true,
|
2020-04-03 07:34:58 +00:00
|
|
|
};
|
|
|
|
|
2019-11-01 07:23:01 +00:00
|
|
|
(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");
|
2020-07-25 16:24:58 +00:00
|
|
|
|
|
|
|
window.addEventListener('chatwoot:ready', function() {
|
2021-01-17 17:14:03 +00:00
|
|
|
console.log(window.$chatwoot);
|
2021-02-15 19:28:57 +00:00
|
|
|
if (window.location.search.includes('setUser')) {
|
|
|
|
window.$chatwoot.setUser('<%= user_id %>', {
|
|
|
|
identifier_hash: '<%= user_hash %>',
|
|
|
|
email: 'jane@example.com',
|
2021-08-13 11:56:09 +00:00
|
|
|
name: 'Jane Doe',
|
|
|
|
phone_number: ''
|
2021-02-15 19:28:57 +00:00
|
|
|
});
|
|
|
|
}
|
2020-07-25 16:24:58 +00:00
|
|
|
})
|
2019-11-01 07:23:01 +00:00
|
|
|
</script>
|