Skip to content
This repository was archived by the owner on Feb 22, 2024. It is now read-only.

Nikolai/Minimize elevio call prod #3279

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions gulp/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ const getConfig = prefix => ({
index_css : `<link href="css/${getManifest('index.css')}" rel="stylesheet" />`,
bot_css : `<link href="css/${getManifest('bot.css')}" rel="stylesheet" />`,
binary_style_img: 'image/binary-style',
elevio_script :
'<script>!function(e,l,v,i,o,n){e[i]||(e[i]={}),e[i].account_id=n;var g,h;g=l.createElement(v),g.type="text/javascript",g.async=1,g.src=o+n,h=l.getElementsByTagName(v)[0],h.parentNode.insertBefore(g,h);e[i].q=[];e[i].on=function(z,y){e[i].q.push([z,y])}}(window,document,"script","_elev","https://cdn.elev.io/sdk/bootloader/v4/elevio-bootloader.js?cid=","5bbc2de0b7365");</script>',
gtm_iframe:
gtm_iframe :
'<!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-P97C2DZ" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> <!-- End Google Tag Manager (noscript) -->',
});

Expand Down
41 changes: 40 additions & 1 deletion src/common/elevio.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,41 @@ import { translate } from '../common/i18n';
import { getLanguage } from './lang';

const Elevio = (() => {
const elShellId = 'elevio-shell';
let elShell;
let elBtnLabel;
const accountId = '5bbc2de0b7365';
const elevioScript = `https://cdn.elev.io/sdk/bootloader/v4/elevio-bootloader.js?cid=${accountId}`;

const init = () => {
elShell = document.getElementById(elShellId);
elBtnLabel = elShell.querySelector('span.text');
elBtnLabel.innerText = translate('NEED HELP?');
elShell.classList.remove('invisible');
elShell.addEventListener('click', () => injectElevio(true));
};

const injectElevio = (isOpen = false) => {
window._elev = {}; // eslint-disable-line no-underscore-dangle
window._elev.account_id = accountId; // eslint-disable-line no-underscore-dangle

const script = document.createElement('script');
script.type = 'text/javascript';
script.async = 1;
script.src = elevioScript;
script.id = 'loaded-elevio-script';
document.body.appendChild(script);

window._elev.q = []; // eslint-disable-line no-underscore-dangle
window._elev.on = (z, y) => {
// eslint-disable-line no-underscore-dangle
window._elev.q.push([z, y]); // eslint-disable-line no-underscore-dangle
};

script.onload = () => loadElevio(isOpen);
};

const loadElevio = (isOpen = false) => {
if (!window._elev) return; // eslint-disable-line no-underscore-dangle

// eslint-disable-next-line no-underscore-dangle
Expand All @@ -29,10 +63,15 @@ const Elevio = (() => {
}

elev.setSettings({
page_url: `${document.location.protocol}//${document.location.hostname}${document.location.pathname}`,
disablePushState: true,
page_url : `${document.location.protocol}//${document.location.hostname}${document.location.pathname}`,
});
setUserInfo(elev);
setTranslations(elev);

if (isOpen) {
elev.open();
}
});
};

Expand Down
46 changes: 46 additions & 0 deletions static/css/_elevio.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#elevio-shell {
height: 60px;
min-width: 60px;
display: flex;
justify-content: center;
align-items: center;
background-color: $brand-orange;
position: fixed;
right: 20px !important;
bottom: 20px !important;
border-radius: 100px;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.15);
transition: box-shadow 0.3s ease-in-out;
cursor: pointer;
z-index: 10000 !important;

&:hover {
.text {
max-width: 1000px;
padding: 0 25px;
}
}
.icon {
float: right;
padding: 0 15px;
transform: translateY(2px);

svg {
fill: $white;
height: 30px !important;
width: 30px !important;
}
}
.text {
float: left;
display: inline-block;
padding: 0;
line-height: 60px;
overflow: hidden;
white-space: nowrap;
max-width: 0;
transition: max-width 0.1s ease, padding 0.1s ease;
color: $white;
font-size: 13px;
}
}
1 change: 1 addition & 0 deletions static/css/bot.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
@import 'toolbox';
@import 'reality-check';
@import 'tour';
@import 'elevio';

* {
box-sizing: border-box;
Expand Down
2 changes: 1 addition & 1 deletion templates/bot.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@
<audio id="error" src="sound/out-of-bounds.ogg" autostart="false"></audio>
<audio id="severe-error" src="sound/i-am-being-serious.ogg" autostart="false"></audio>
{{> bundle}} {{> bot}}
{{> elevio_script }}
{{> ../templates/partials/elevio }}
{{> gtm_iframe }}
<div class="notifyjs-corner" style="bottom: 0px; right: 0px;"></div>
<div class="notifyjs-corner" style="bottom: 0px; left: 0px;"></div>
Expand Down
13 changes: 13 additions & 0 deletions templates/partials/elevio.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<div id='elevio-shell' class='invisible'>
<span class='text'></span>
<span class='icon'>
<svg viewBox="0 0 74.2 74.2">
<g>
<path d="M37.1,74.2C16.7,74.2,0,57.6,0,37.1S16.7,0,37.1,0s37.1,16.7,37.1,37.1S57.6,74.2,37.1,74.2z M37.1,4.8C19.3,4.8,4.8,19.3,4.8,37.1c0,17.8,14.5,32.3,32.3,32.3s32.3-14.5,32.3-32.3C69.4,19.3,54.9,4.8,37.1,4.8z"/>
<g>
<path id="XMLID_17_" d="M29.4,22.7c1.9-2.1,4.6-3.1,8-3.1c3.1,0,5.6,0.9,7.5,2.6s2.8,4,2.8,6.7c0,1.7-0.3,3-1,4 c-0.7,1-2.1,2.6-4.2,4.6c-1.5,1.5-2.5,2.7-3,3.7c-0.3,0.7-0.5,1.5-0.6,2.6c-0.1,1.1-1,1.9-2.1,1.9h0c-1.2,0-2.2-1-2.1-2.3 c0.1-1.2,0.4-2.3,0.7-3.1c0.5-1.4,1.7-2.9,3.6-4.7l1.9-1.9c0.6-0.5,1-1.1,1.4-1.7c0.6-1,1-2.1,1-3.2c0-1.5-0.5-2.9-1.4-4 c-0.9-1.1-2.5-1.7-4.6-1.7c-2.7,0-4.5,1-5.5,2.9c-0.4,0.7-0.7,1.7-0.8,2.8c-0.1,1-1,1.8-2.1,1.8h0c-1.3,0-2.3-1.1-2.1-2.4 C27.1,26.2,28,24.3,29.4,22.7z M36.9,49.7L36.9,49.7c1.3,0,2.3,1,2.3,2.3v0.2c0,1.3-1,2.3-2.3,2.3h0c-1.3,0-2.3-1-2.3-2.3V52 C34.5,50.7,35.6,49.7,36.9,49.7z" className="st0"/>
</g>
</g>
</svg>
</span>
</div>
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy