Compare commits

...

1 Commits

Author SHA1 Message Date
lislis
3ae1358dd2 welcome helpscout beacon
make basic beacon work
2016-04-14 17:12:08 +02:00
7 changed files with 24 additions and 66 deletions

View File

@ -66,8 +66,8 @@ var App = Ember.Application.extend(Ember.Evented, {
if (config.pro) {
this.identifyCustomer(user);
}
if (config.userlike) {
this.setupUserlike(user);
if (config.beacon) {
this.setupHsBeacon();
}
return this.subscribePusher(user);
},
@ -90,28 +90,20 @@ var App = Ember.Application.extend(Ember.Evented, {
return Travis.pusher.subscribeAll(channels);
},
setupUserlike(user) {
var btn, s, userlikeData;
btn = document.getElementById('userlikeCustomTab');
btn.classList.add("logged-in");
userlikeData = window.userlikeData = {};
userlikeData.user = {};
userlikeData.user.name = user.login;
userlikeData.user.email = user.email;
if (!document.getElementById('userlike-script')) {
s = document.createElement('script');
s.id = 'userlike-script';
s.src = '//userlike-cdn-widgets.s3-eu-west-1.amazonaws.com/0327dbb23382ccbbb91b445b76e8a91d4b37d90ef9f2faf84e11177847ff7bb9.js';
setupHsBeacon() {
if (!document.getElementById('beacon-script')) {
let s = document.createElement('script');
s.id = 'beacon-script';
let code = '!function(e,o,n){window.HSCW=o,window.HS=n,n.beacon=n.beacon||{};var t=n.beacon;t.userConfig={},t.readyQueue=[],t.config=function(e){this.userConfig=e},t.ready=function(e){this.readyQueue.push(e)},o.config={docs:{enabled:!1,baseUrl:""},contact:{enabled:!0,formId:"f48f821c-fb20-11e5-a329-0ee2467769ff"}};var r=e.getElementsByTagName("script")[0],c=e.createElement("script");c.type="text/javascript",c.async=!0,c.src="https://djtflbt20bdde.cloudfront.net/",r.parentNode.insertBefore(c,r)}(document,window.HSCW||{},window.HS||{});';
try {
s.appendChild(document.createTextNode(code));
} catch (e) {
s.text = code;
}
return document.body.appendChild(s);
}
},
removeUserlike() {
var btn;
btn = document.getElementById('userlikeCustomTab');
return btn.classList.remove("logged-in");
},
identifyCustomer(user) {
if (_cio && _cio.identify) {
return _cio.identify({

View File

@ -36,7 +36,5 @@
<script src="assets/travis.js"></script>
{{content-for "body-footer"}}
<a href="javascript:void(0)" class="feedback-button" id="userlikeCustomTab" data-right="20" data-bottom="50" data-orientation="top">Do you have a question?</a>
</body>
</html>

View File

@ -0,0 +1,11 @@
export function initialize(/* application */) {
var data = {};
return data;
}
export default {
name: 'hs-beacon',
initialize: initialize
};

View File

@ -1,17 +0,0 @@
// Generated by CoffeeScript 1.10.0
import config from 'travis/config/environment';
var UserlikeInitializer, initialize;
initialize = function(application) {
var userlikeData;
return userlikeData = {};
};
UserlikeInitializer = {
name: 'userlike',
initialize: initialize
};
export {initialize};
export default UserlikeInitializer;

View File

@ -6,7 +6,6 @@
@import "app/data";
@import "app/mixins";
@import "app/base";
@import "app/userlike";
@import "app/modules/logo";
@import "app/modules/tofuburger";

View File

@ -1,26 +0,0 @@
.feedback-button
display: none
position: fixed
right: 9%
left: auto
bottom: 0
margin: 0
padding: .5em 1em 1em 1em
border-radius: 4px
border: solid 1px #399399
transform: translateY(20%)
will-change: transform
transition: transform ease 200ms
background: white
font-size: 16px
color: #399399
z-index: 89
@media #{$medium-up}
right: 5%
.feedback-button:hover
transform: translateY(5%)
.logged-in.feedback-button
display: inline-block

View File

@ -54,6 +54,7 @@ module.exports = function(environment) {
caches: true
};
ENV.userlike = true;
ENV.beacon = true;
ENV.urls = {
legal: ENV.billingEndpoint + "/pages/legal",
imprint: ENV.billingEndpoint + "/pages/imprint",