Skip to content

Instantly share code, notes, and snippets.

@molavec
Last active May 30, 2018 20:09
Show Gist options
  • Save molavec/bfd62cd949c7ebad21cb7c45d095027a to your computer and use it in GitHub Desktop.
Save molavec/bfd62cd949c7ebad21cb7c45d095027a to your computer and use it in GitHub Desktop.
[exit intent popup whatsapp wordpress] versión vitaclinic #whatsapp #popup #facebook #wordpress #chat

README

Exit intent popup

How to

Para poder incluir este popup

  1. subir el script .js al directorio correspondiente del template utilizado.

Enlace al script

Nota: Generalmente el directorio se encuentra en la carpeta del tema:

$WP_FOLDER/themes/$NOMBRE_DEL_TEMA/assets/js/
  1. subir la imagen al directorio correspondiente del template utilizado.

Enlace a la imagen

Nota: Generalmente el directorio se encuentra en la carpeta del tema:

$WP_FOLDER/themes/$NOMBRE_DEL_TEMA/assets/images/
  1. Insertar el código snip.html en el footer del theme (antes del ) ajustando las rutas a los assets. Puede ser includo mediante algún plugin. Es posible utilzar un plugin para realizar este paso. Por ejemplo: Plugin Insert Headers and Footers

CHANGELOG

  • Utiliza sonido campana de whatsapp
  • Limita la "campana" a sólo un par de veces mediante una cookie del usuario
  • Corrige encode del texto del mensaje del whatsapp
!function(e){function t(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,o){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:o})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s="lVK7")}({"21wt":function(e,t,n){"use strict";(function(o){var r,i,a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(o,s){"object"==a(t)&&void 0!==e?e.exports=s():(r=s,void 0!==(i="function"==typeof r?r.call(t,n,t,e):r)&&(e.exports=i))}(0,function(){function e(e){return e&&"[object Function]"==={}.toString.call(e)}function t(e,t){if(1!==e.nodeType)return[];var n=window.getComputedStyle(e,null);return t?n[t]:n}function n(e){return"HTML"===e.nodeName?e:e.parentNode||e.host}function r(e){if(!e||-1!==["HTML","BODY","#document"].indexOf(e.nodeName))return window.document.body;var o=t(e),i=o.overflow,a=o.overflowX,s=o.overflowY;return/(auto|scroll)/.test(i+s+a)?e:r(n(e))}function i(e){var n=e&&e.offsetParent,o=n&&n.nodeName;return o&&"BODY"!==o&&"HTML"!==o?-1!==["TD","TABLE"].indexOf(n.nodeName)&&"static"===t(n,"position")?i(n):n:window.document.documentElement}function a(e){return null===e.parentNode?e:a(e.parentNode)}function s(e,t){if(!(e&&e.nodeType&&t&&t.nodeType))return window.document.documentElement;var n=e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING,o=n?e:t,r=n?t:e,p=document.createRange();p.setStart(o,0),p.setEnd(r,0);var f=p.commonAncestorContainer;if(e!==f&&t!==f||o.contains(r))return function(e){var t=e.nodeName;return"BODY"!==t&&("HTML"===t||i(e.firstElementChild)===e)}(f)?f:i(f);var c=a(e);return c.host?s(c.host,t):s(e,a(t).host)}function p(e){var t="top"===(1<arguments.length&&void 0!==arguments[1]?arguments[1]:"top")?"scrollTop":"scrollLeft",n=e.nodeName;if("BODY"===n||"HTML"===n){var o=window.document.documentElement;return(window.document.scrollingElement||o)[t]}return e[t]}function f(e,t){var n=2<arguments.length&&void 0!==arguments[2]&&arguments[2],o=p(t,"top"),r=p(t,"left"),i=n?-1:1;return e.top+=o*i,e.bottom+=o*i,e.left+=r*i,e.right+=r*i,e}function c(e,t){var n="x"===t?"Left":"Top",o="Left"==n?"Right":"Bottom";return+e["border"+n+"Width"].split("px")[0]+ +e["border"+o+"Width"].split("px")[0]}function u(e,t,n,o){return R(t["offset"+e],t["scroll"+e],n["client"+e],n["offset"+e],n["scroll"+e],Y()?n["offset"+e]+o["margin"+("Height"===e?"Top":"Left")]+o["margin"+("Height"===e?"Bottom":"Right")]:0)}function l(){var e=window.document.body,t=window.document.documentElement,n=Y()&&window.getComputedStyle(t);return{height:u("Height",e,t,n),width:u("Width",e,t,n)}}function d(e){return X({},e,{right:e.left+e.width,bottom:e.top+e.height})}function h(e){var n={};if(Y())try{n=e.getBoundingClientRect();var o=p(e,"top"),r=p(e,"left");n.top+=o,n.left+=r,n.bottom+=o,n.right+=r}catch(e){}else n=e.getBoundingClientRect();var i={left:n.left,top:n.top,width:n.right-n.left,height:n.bottom-n.top},a="HTML"===e.nodeName?l():{},s=a.width||e.clientWidth||i.right-i.left,f=a.height||e.clientHeight||i.bottom-i.top,u=e.offsetWidth-s,h=e.offsetHeight-f;if(u||h){var m=t(e);u-=c(m,"x"),h-=c(m,"y"),i.width-=u,i.height-=h}return d(i)}function m(e,n){var o=Y(),i="HTML"===n.nodeName,a=h(e),s=h(n),p=r(e),c=t(n),u=+c.borderTopWidth.split("px")[0],l=+c.borderLeftWidth.split("px")[0],m=d({top:a.top-s.top-u,left:a.left-s.left-l,width:a.width,height:a.height});if(m.marginTop=0,m.marginLeft=0,!o&&i){var b=+c.marginTop.split("px")[0],v=+c.marginLeft.split("px")[0];m.top-=u-b,m.bottom-=u-b,m.left-=l-v,m.right-=l-v,m.marginTop=b,m.marginLeft=v}return(o?n.contains(p):n===p&&"BODY"!==p.nodeName)&&(m=f(m,n)),m}function b(e){var t=window.document.documentElement,n=m(e,t),o=R(t.clientWidth,window.innerWidth||0),r=R(t.clientHeight,window.innerHeight||0),i=p(t),a=p(t,"left");return d({top:i-n.top+n.marginTop,left:a-n.left+n.marginLeft,width:o,height:r})}function v(e){var o=e.nodeName;return"BODY"!==o&&"HTML"!==o&&("fixed"===t(e,"position")||v(n(e)))}function g(e,t,o,i){var a={top:0,left:0},p=s(e,t);if("viewport"===i)a=b(p);else{var f;"scrollParent"===i?"BODY"===(f=r(n(e))).nodeName&&(f=window.document.documentElement):f="window"===i?window.document.documentElement:i;var c=m(f,p);if("HTML"!==f.nodeName||v(p))a=c;else{var u=l(),d=u.height,h=u.width;a.top+=c.top-c.marginTop,a.bottom=d+c.top,a.left+=c.left-c.marginLeft,a.right=h+c.left}}return a.left+=o,a.top+=o,a.right-=o,a.bottom-=o,a}function w(e,t,n,o,r){var i=5<arguments.length&&void 0!==arguments[5]?arguments[5]:0;if(-1===e.indexOf("auto"))return e;var a=g(n,o,i,r),s={top:{width:a.width,height:t.top-a.top},right:{width:a.right-t.right,height:a.height},bottom:{width:a.width,height:a.bottom-t.bottom},left:{width:t.left-a.left,height:a.height}},p=Object.keys(s).map(function(e){return X({key:e},s[e],{area:function(e){return e.width*e.height}(s[e])})}).sort(function(e,t){return t.area-e.area}),f=p.filter(function(e){var t=e.width,o=e.height;return t>=n.clientWidth&&o>=n.clientHeight}),c=0<f.length?f[0].key:p[0].key,u=e.split("-")[1];return c+(u?"-"+u:"")}function y(e,t,n){return m(n,s(t,n))}function x(e){var t=window.getComputedStyle(e),n=parseFloat(t.marginTop)+parseFloat(t.marginBottom),o=parseFloat(t.marginLeft)+parseFloat(t.marginRight);return{width:e.offsetWidth+o,height:e.offsetHeight+n}}function E(e){var t={left:"right",right:"left",bottom:"top",top:"bottom"};return e.replace(/left|right|bottom|top/g,function(e){return t[e]})}function O(e,t,n){n=n.split("-")[0];var o=x(e),r={width:o.width,height:o.height},i=-1!==["right","left"].indexOf(n),a=i?"top":"left",s=i?"left":"top",p=i?"height":"width",f=i?"width":"height";return r[a]=t[a]+t[p]/2-o[p]/2,r[s]=n===s?t[s]-o[f]:t[E(s)],r}function L(e,t){return Array.prototype.find?e.find(t):e.filter(t)[0]}function _(t,n,o){return(void 0===o?t:t.slice(0,function(e,t,n){if(Array.prototype.findIndex)return e.findIndex(function(e){return e[t]===n});var o=L(e,function(e){return e[t]===n});return e.indexOf(o)}(t,"name",o))).forEach(function(t){t.function&&console.warn("`modifier.function` is deprecated, use `modifier.fn`!");var o=t.function||t.fn;t.enabled&&e(o)&&(n.offsets.popper=d(n.offsets.popper),n.offsets.reference=d(n.offsets.reference),n=o(n,t))}),n}function C(e,t){return e.some(function(e){var n=e.name;return e.enabled&&n===t})}function T(e){for(var t=[!1,"ms","Webkit","Moz","O"],n=e.charAt(0).toUpperCase()+e.slice(1),o=0;o<t.length-1;o++){var r=t[o],i=r?""+r+n:e;if(void 0!==window.document.body.style[i])return i}return null}function S(e,t,n,o){var i="BODY"===e.nodeName,a=i?window:e;a.addEventListener(t,n,{passive:!0}),i||S(r(a.parentNode),t,n,o),o.push(a)}function k(e){return""!==e&&!isNaN(parseFloat(e))&&isFinite(e)}function D(e,t){Object.keys(t).forEach(function(n){var o="";-1!==["width","height","top","right","bottom","left"].indexOf(n)&&k(t[n])&&(o="px"),e.style[n]=t[n]+o})}function N(e,t,n){var o=L(e,function(e){return e.name===t}),r=!!o&&e.some(function(e){return e.name===n&&e.enabled&&e.order<o.order});if(!r){var i="`"+t+"`";console.warn("`"+n+"` modifier is required by "+i+" modifier in order to work, be sure to include it before "+i+"!")}return r}function M(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1],n=V.indexOf(e),o=V.slice(n+1).concat(V.slice(0,n));return t?o.reverse():o}for(var A=Math.min,P=Math.floor,R=Math.max,F=["native code","[object MutationObserverConstructor]"],I="undefined"!=typeof window,j=["Edge","Trident","Firefox"],B=0,U=0;U<j.length;U+=1)if(I&&0<=navigator.userAgent.indexOf(j[U])){B=1;break}var W,H=I&&function(e){return F.some(function(t){return-1<(e||"").toString().indexOf(t)})}(window.MutationObserver)?function(e){var t=!1,n=0,o=document.createElement("span");return new MutationObserver(function(){e(),t=!1}).observe(o,{attributes:!0}),function(){t||(t=!0,o.setAttribute("x-index",n),++n)}}:function(e){var t=!1;return function(){t||(t=!0,setTimeout(function(){t=!1,e()},B))}},Y=function(){return void 0==W&&(W=-1!==navigator.appVersion.indexOf("MSIE 10")),W},z=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},q=function(){function e(e,t){for(var n,o=0;o<t.length;o++)(n=t[o]).enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),K=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},X=Object.assign||function(e){for(var t,n=1;n<arguments.length;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},G=["auto-start","auto","auto-end","top-start","top","top-end","right-start","right","right-end","bottom-end","bottom","bottom-start","left-end","left","left-start"],V=G.slice(3),Q={FLIP:"flip",CLOCKWISE:"clockwise",COUNTERCLOCKWISE:"counterclockwise"},Z=function(){function t(n,o){var r=this,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};z(this,t),this.scheduleUpdate=function(){return requestAnimationFrame(r.update)},this.update=H(this.update.bind(this)),this.options=X({},t.Defaults,i),this.state={isDestroyed:!1,isCreated:!1,scrollParents:[]},this.reference=n.jquery?n[0]:n,this.popper=o.jquery?o[0]:o,this.options.modifiers={},Object.keys(X({},t.Defaults.modifiers,i.modifiers)).forEach(function(e){r.options.modifiers[e]=X({},t.Defaults.modifiers[e]||{},i.modifiers?i.modifiers[e]:{})}),this.modifiers=Object.keys(this.options.modifiers).map(function(e){return X({name:e},r.options.modifiers[e])}).sort(function(e,t){return e.order-t.order}),this.modifiers.forEach(function(t){t.enabled&&e(t.onLoad)&&t.onLoad(r.reference,r.popper,r.options,t,r.state)}),this.update();var a=this.options.eventsEnabled;a&&this.enableEventListeners(),this.state.eventsEnabled=a}return q(t,[{key:"update",value:function(){return function(){if(!this.state.isDestroyed){var e={instance:this,styles:{},arrowStyles:{},attributes:{},flipped:!1,offsets:{}};e.offsets.reference=y(this.state,this.popper,this.reference),e.placement=w(this.options.placement,e.offsets.reference,this.popper,this.reference,this.options.modifiers.flip.boundariesElement,this.options.modifiers.flip.padding),e.originalPlacement=e.placement,e.offsets.popper=O(this.popper,e.offsets.reference,e.placement),e.offsets.popper.position="absolute",e=_(this.modifiers,e),this.state.isCreated?this.options.onUpdate(e):(this.state.isCreated=!0,this.options.onCreate(e))}}.call(this)}},{key:"destroy",value:function(){return function(){return this.state.isDestroyed=!0,C(this.modifiers,"applyStyle")&&(this.popper.removeAttribute("x-placement"),this.popper.style.left="",this.popper.style.position="",this.popper.style.top="",this.popper.style[T("transform")]=""),this.disableEventListeners(),this.options.removeOnDestroy&&this.popper.parentNode.removeChild(this.popper),this}.call(this)}},{key:"enableEventListeners",value:function(){return function(){this.state.eventsEnabled||(this.state=function(e,t,n,o){n.updateBound=o,window.addEventListener("resize",n.updateBound,{passive:!0});var i=r(e);return S(i,"scroll",n.updateBound,n.scrollParents),n.scrollElement=i,n.eventsEnabled=!0,n}(this.reference,this.options,this.state,this.scheduleUpdate))}.call(this)}},{key:"disableEventListeners",value:function(){return function(){this.state.eventsEnabled&&(window.cancelAnimationFrame(this.scheduleUpdate),this.state=function(e,t){return window.removeEventListener("resize",t.updateBound),t.scrollParents.forEach(function(e){e.removeEventListener("scroll",t.updateBound)}),t.updateBound=null,t.scrollParents=[],t.scrollElement=null,t.eventsEnabled=!1,t}(this.reference,this.state))}.call(this)}}]),t}();return Z.Utils=("undefined"==typeof window?o:window).PopperUtils,Z.placements=G,Z.Defaults={placement:"bottom",eventsEnabled:!0,removeOnDestroy:!1,onCreate:function(){},onUpdate:function(){},modifiers:{shift:{order:100,enabled:!0,fn:function(e){var t=e.placement,n=t.split("-")[0],o=t.split("-")[1];if(o){var r=e.offsets,i=r.reference,a=r.popper,s=-1!==["bottom","top"].indexOf(n),p=s?"left":"top",f=s?"width":"height",c={start:K({},p,i[p]),end:K({},p,i[p]+i[f]-a[f])};e.offsets.popper=X({},a,c[o])}return e}},offset:{order:200,enabled:!0,fn:function(e,t){var n,o=t.offset,r=e.placement,i=e.offsets,a=i.popper,s=i.reference,p=r.split("-")[0];return n=k(+o)?[+o,0]:function(e,t,n,o){var r=[0,0],i=-1!==["right","left"].indexOf(o),a=e.split(/(\+|\-)/).map(function(e){return e.trim()}),s=a.indexOf(L(a,function(e){return-1!==e.search(/,|\s/)}));a[s]&&-1===a[s].indexOf(",")&&console.warn("Offsets separated by white space(s) are deprecated, use a comma (,) instead.");var p=/\s*,\s*|\s+/,f=-1===s?[a]:[a.slice(0,s).concat([a[s].split(p)[0]]),[a[s].split(p)[1]].concat(a.slice(s+1))];return(f=f.map(function(e,o){var r=(1===o?!i:i)?"height":"width",a=!1;return e.reduce(function(e,t){return""===e[e.length-1]&&-1!==["+","-"].indexOf(t)?(e[e.length-1]=t,a=!0,e):a?(e[e.length-1]+=t,a=!1,e):e.concat(t)},[]).map(function(e){return function(e,t,n,o){var r=e.match(/((?:\-|\+)?\d*\.?\d*)(.*)/),i=+r[1],a=r[2];if(!i)return e;if(0===a.indexOf("%")){var s;switch(a){case"%p":s=n;break;case"%":case"%r":default:s=o}return d(s)[t]/100*i}return"vh"===a||"vw"===a?("vh"===a?R(document.documentElement.clientHeight,window.innerHeight||0):R(document.documentElement.clientWidth,window.innerWidth||0))/100*i:i}(e,r,t,n)})})).forEach(function(e,t){e.forEach(function(n,o){k(n)&&(r[t]+=n*("-"===e[o-1]?-1:1))})}),r}(o,a,s,p),"left"===p?(a.top+=n[0],a.left-=n[1]):"right"===p?(a.top+=n[0],a.left+=n[1]):"top"===p?(a.left+=n[0],a.top-=n[1]):"bottom"===p&&(a.left+=n[0],a.top+=n[1]),e.popper=a,e},offset:0},preventOverflow:{order:300,enabled:!0,fn:function(e,t){var n=t.boundariesElement||i(e.instance.popper);e.instance.reference===n&&(n=i(n));var o=g(e.instance.popper,e.instance.reference,t.padding,n);t.boundaries=o;var r=t.priority,a=e.offsets.popper,s={primary:function(e){var n=a[e];return a[e]<o[e]&&!t.escapeWithReference&&(n=R(a[e],o[e])),K({},e,n)},secondary:function(e){var n="right"===e?"left":"top",r=a[n];return a[e]>o[e]&&!t.escapeWithReference&&(r=A(a[n],o[e]-("right"===e?a.width:a.height))),K({},n,r)}};return r.forEach(function(e){var t=-1===["left","top"].indexOf(e)?"secondary":"primary";a=X({},a,s[t](e))}),e.offsets.popper=a,e},priority:["left","right","top","bottom"],padding:5,boundariesElement:"scrollParent"},keepTogether:{order:400,enabled:!0,fn:function(e){var t=e.offsets,n=t.popper,o=t.reference,r=e.placement.split("-")[0],i=P,a=-1!==["top","bottom"].indexOf(r),s=a?"right":"bottom",p=a?"left":"top",f=a?"width":"height";return n[s]<i(o[p])&&(e.offsets.popper[p]=i(o[p])-n[f]),n[p]>i(o[s])&&(e.offsets.popper[p]=i(o[s])),e}},arrow:{order:500,enabled:!0,fn:function(e,n){if(!N(e.instance.modifiers,"arrow","keepTogether"))return e;var o=n.element;if("string"==typeof o){if(!(o=e.instance.popper.querySelector(o)))return e}else if(!e.instance.popper.contains(o))return console.warn("WARNING: `arrow.element` must be child of its popper element!"),e;var r=e.placement.split("-")[0],i=e.offsets,a=i.popper,s=i.reference,p=-1!==["left","right"].indexOf(r),f=p?"height":"width",c=p?"Top":"Left",u=c.toLowerCase(),l=p?"left":"top",h=p?"bottom":"right",m=x(o)[f];s[h]-m<a[u]&&(e.offsets.popper[u]-=a[u]-(s[h]-m)),s[u]+m>a[h]&&(e.offsets.popper[u]+=s[u]+m-a[h]);var b=s[u]+s[f]/2-m/2,v=t(e.instance.popper,"margin"+c).replace("px",""),g=b-d(e.offsets.popper)[u]-v;return g=R(A(a[f]-m,g),0),e.arrowElement=o,e.offsets.arrow={},e.offsets.arrow[u]=Math.round(g),e.offsets.arrow[l]="",e},element:"[x-arrow]"},flip:{order:600,enabled:!0,fn:function(e,t){if(C(e.instance.modifiers,"inner"))return e;if(e.flipped&&e.placement===e.originalPlacement)return e;var n=g(e.instance.popper,e.instance.reference,t.padding,t.boundariesElement),o=e.placement.split("-")[0],r=E(o),i=e.placement.split("-")[1]||"",a=[];switch(t.behavior){case Q.FLIP:a=[o,r];break;case Q.CLOCKWISE:a=M(o);break;case Q.COUNTERCLOCKWISE:a=M(o,!0);break;default:a=t.behavior}return a.forEach(function(s,p){if(o!==s||a.length===p+1)return e;o=e.placement.split("-")[0],r=E(o);var f=e.offsets.popper,c=e.offsets.reference,u=P,l="left"===o&&u(f.right)>u(c.left)||"right"===o&&u(f.left)<u(c.right)||"top"===o&&u(f.bottom)>u(c.top)||"bottom"===o&&u(f.top)<u(c.bottom),d=u(f.left)<u(n.left),h=u(f.right)>u(n.right),m=u(f.top)<u(n.top),b=u(f.bottom)>u(n.bottom),v="left"===o&&d||"right"===o&&h||"top"===o&&m||"bottom"===o&&b,g=-1!==["top","bottom"].indexOf(o),w=!!t.flipVariations&&(g&&"start"===i&&d||g&&"end"===i&&h||!g&&"start"===i&&m||!g&&"end"===i&&b);(l||v||w)&&(e.flipped=!0,(l||v)&&(o=a[p+1]),w&&(i=function(e){return"end"===e?"start":"start"===e?"end":e}(i)),e.placement=o+(i?"-"+i:""),e.offsets.popper=X({},e.offsets.popper,O(e.instance.popper,e.offsets.reference,e.placement)),e=_(e.instance.modifiers,e,"flip"))}),e},behavior:"flip",padding:5,boundariesElement:"viewport"},inner:{order:700,enabled:!1,fn:function(e){var t=e.placement,n=t.split("-")[0],o=e.offsets,r=o.popper,i=o.reference,a=-1!==["left","right"].indexOf(n),s=-1===["top","left"].indexOf(n);return r[a?"left":"top"]=i[n]-(s?r[a?"width":"height"]:0),e.placement=E(t),e.offsets.popper=d(r),e}},hide:{order:800,enabled:!0,fn:function(e){if(!N(e.instance.modifiers,"hide","preventOverflow"))return e;var t=e.offsets.reference,n=L(e.instance.modifiers,function(e){return"preventOverflow"===e.name}).boundaries;if(t.bottom<n.top||t.left>n.right||t.top>n.bottom||t.right<n.left){if(!0===e.hide)return e;e.hide=!0,e.attributes["x-out-of-boundaries"]=""}else{if(!1===e.hide)return e;e.hide=!1,e.attributes["x-out-of-boundaries"]=!1}return e}},computeStyle:{order:850,enabled:!0,fn:function(e,t){var n=t.x,o=t.y,r=e.offsets.popper,a=L(e.instance.modifiers,function(e){return"applyStyle"===e.name}).gpuAcceleration;void 0!==a&&console.warn("WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!");var s,p,f=void 0===a?t.gpuAcceleration:a,c=h(i(e.instance.popper)),u={position:r.position},l={left:P(r.left),top:P(r.top),bottom:P(r.bottom),right:P(r.right)},d="bottom"===n?"top":"bottom",m="right"===o?"left":"right",b=T("transform");if(p="bottom"==d?-c.height+l.bottom:l.top,s="right"==m?-c.width+l.right:l.left,f&&b)u[b]="translate3d("+s+"px, "+p+"px, 0)",u[d]=0,u[m]=0,u.willChange="transform";else{var v="bottom"==d?-1:1,g="right"==m?-1:1;u[d]=p*v,u[m]=s*g,u.willChange=d+", "+m}var w={"x-placement":e.placement};return e.attributes=X({},w,e.attributes),e.styles=X({},u,e.styles),e.arrowStyles=X({},e.offsets.arrow,e.arrowStyles),e},gpuAcceleration:!0,x:"bottom",y:"right"},applyStyle:{order:900,enabled:!0,fn:function(e){return D(e.instance.popper,e.styles),function(e,t){Object.keys(t).forEach(function(n){!1===t[n]?e.removeAttribute(n):e.setAttribute(n,t[n])})}(e.instance.popper,e.attributes),e.arrowElement&&Object.keys(e.arrowStyles).length&&D(e.arrowElement,e.arrowStyles),e},onLoad:function(e,t,n,o,r){var i=y(0,t,e),a=w(n.placement,i,t,e,n.modifiers.flip.boundariesElement,n.modifiers.flip.padding);return t.setAttribute("x-placement",a),D(t,{position:"absolute"}),n},gpuAcceleration:void 0}}},Z})}).call(t,n("DuR2"))},"9jFS":function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.debounce=function(e,t,n){var o=void 0;return function(){var r=this,i=arguments,a=n&&!o;clearTimeout(o),o=setTimeout(function(){o=null,n||e.apply(r,i)},t),a&&e.apply(r,i)}},t.addEvent=function(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent&&e.attachEvent("on"+t,n)}},DuR2:function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(n=window)}e.exports=n},"FZ+f":function(e,t){e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var n=function(e,t){var n=e[1]||"",o=e[3];if(!o)return n;if(t&&"function"==typeof btoa){var r=function(e){return"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(e))))+" */"}(o),i=o.sources.map(function(e){return"/*# sourceURL="+o.sourceRoot+e+" */"});return[n].concat(i).concat([r]).join("\n")}return[n].join("\n")}(t,e);return t[2]?"@media "+t[2]+"{"+n+"}":n}).join("")},t.i=function(e,n){"string"==typeof e&&(e=[[null,e,""]]);for(var o={},r=0;r<this.length;r++){var i=this[r][0];"number"==typeof i&&(o[i]=!0)}for(r=0;r<e.length;r++){var a=e[r];"number"==typeof a[0]&&o[a[0]]||(n&&!a[2]?a[2]=n:n&&(a[2]="("+a[2]+") and ("+n+")"),t.push(a))}},t}},QbSh:function(e,t,n){(e.exports=n("FZ+f")(void 0)).push([e.i,".eib-block {\n position: fixed;\n bottom: 2px;\n right: 10px;\n height: auto;\n width: 100px;\n text-align: center;\n z-index: 9998;\n}\n\n.eib-block__image {\n border-radius: 10px 30px;\n -moz-border-radius: 10px 20px 30px 0;\n }\n\n.eib-block__notification {\n position: absolute;\n background: red;\n top: 0px;\n right: 1px;\n color: white;\n border: 1px solid white;\n border-radius: 8px;\n text-align: center;\n font-size: 10px;\n width: 20px;\n padding: 5px 0;\n line-height: 10px;\n display: none;\n z-index: 9999;\n}\n\n.popover-shown .eib-block__notification {\n display: block;\n}\n\n.eib-popover {\n position: absolute;\n left: -9999px;\n opacity: 0;\n transition: opacity 2s ease-in;\n background: #0C3C84;\n font-size: 13px;\n width: 120px;\n border: 1px solid #FFFFFF;\n border-radius: 3px;\n box-shadow: 0 0 2px rgba(0,0,0,0.5);\n padding: 10px;\n text-align: center;\n margin-bottom: 5px;\n z-index: 9999;\n color: #FFFFFF;\n font-family: 'Open Sans', sans-serif;\n}\n\n.eib-popover_is-show {\n opacity: 1;\n}\n\n.eib-popover__arrow {\n width: 0;\n height: 0;\n border-style: solid;\n position: absolute;\n margin: 5px;\n border-color: #0C3C84;\n border-width: 5px 5px 0 5px;\n border-left-color: transparent;\n border-right-color: transparent;\n border-bottom-color: transparent;\n bottom: -5px;\n left: calc(50% - 5px);\n margin-top: 0;\n margin-bottom: 0;\n}\n\n.animated {\n animation-duration: 1s;\n animation-fill-mode: both;\n}\n\n@keyframes bounce {\n from, 20%, 53%, 80%, to {\n animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);\n transform: translate3d(0,0,0);\n }\n 40%, 43% {\n animation-timing-function: cubic-bezier(0.755, 0.050, 0.855, 0.060);\n transform: translate3d(0, -30px, 0);\n }\n 70% {\n animation-timing-function: cubic-bezier(0.755, 0.050, 0.855, 0.060);\n transform: translate3d(0, -15px, 0);\n }\n 90% {\n transform: translate3d(0,-4px,0);\n }\n}\n\n.bounce {\n animation-name: bounce;\n transform-origin: center bottom;\n}\n",""])},RghB:function(e,t){e.exports='<div class="eib-block"><div class="eib-block__link"><a href="" target="_blank"><img class="eib-block__image" src="xxxHTMLLINKxxx0.28656812642705430.14669011372164542xxx" alt="Asistente de mensajes" width="80px" height="96px"/></a><div class="eib-block__notification">1</div></div><div class="eib-popover"><div class="eib-popover__arrow" x-arrow=""></div></div></div>'},To8L:function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=o(n("gBnC")),i=n("9jFS"),a=o(n("21wt")),s={SOUND_URL:"https://s3-us-west-2.amazonaws.com/exit-intent-bubble-sounds/whatsapp_web.mp3",MAX_SOUND_PLAY_COUNT:2,CLOSE_DELAY:8e3,popover:null,popoverReferenceElement:null,popoverElement:null,closePopoverDb:null,mouseOutsideDocumentDb:null,canShow:!0,sound:null,soundPlayCount:0,hidePopover:function(){this.popover.destroy(),this.popover=null,this.popoverReferenceElement.classList.remove("animated"),this.popoverReferenceElement.classList.remove("bounce")},showPopover:function(){this.canShow&&(this.popover=new a.default(this.popoverReferenceElement,this.popoverElement,{placement:"top"}),this.popoverElement.classList.add("eib-popover_is-show"),r.default.create("popOverWhatsapp","true",30,!1),this.closePopoverDb(),this.popoverReferenceElement.classList.add("popover-shown"),++this.soundPlayCount<=this.MAX_SOUND_PLAY_COUNT&&(this.sound||(this.sound=new Audio(this.SOUND_URL)),this.sound.play()),this.popoverReferenceElement.classList.add("animated"),this.popoverReferenceElement.classList.add("bounce"),this.canShow=!1)},exitIntentInit:function(e,t){var n=this;this.popoverReferenceElement=document.querySelector(e),this.popoverElement=document.querySelector(t),r.default.check("popOverWhatsapp")?this.canShow=!0:setTimeout(function(){n.canShow=!0,n.showPopover()},5e3),(0,i.addEvent)(document,"mouseout",function(e){n.mouseOutsideDocumentDb(e)})},init:function(e,t){var n=this;this.closePopoverDb=(0,i.debounce)(function(){n.hidePopover(),n.canShow=!0},this.CLOSE_DELAY),this.mouseOutsideDocumentDb=(0,i.debounce)(function(e){e=e||window.event;var t=Math.max(document.documentElement.clientWidth,window.innerWidth||0);if(!(e.clientX>=50&&e.clientX<=t-50&&e.clientY>=50)){e.relatedTarget||e.toElement||n.showPopover()}},100),this.exitIntentInit(e,t)}};t.default=s},gBnC:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={create:function(e,t,n,o){var r="";if(o)r="; expires=0";else if(n){var i=new Date;i.setTime(i.getTime()+24*n*60*60*1e3),r="; expires="+i.toGMTString()}document.cookie=e+"="+t+r+"; path=/"},get:function(e){for(var t=e+"=",n=document.cookie.split(";"),o=0;o<n.length;o++){for(var r=n[o];" "==r.charAt(0);)r=r.substring(1,r.length);if(0===r.indexOf(t))return r.substring(t.length,r.length)}return null},erase:function(e){this.create(e,"",-1)},check:function(e){return"true"==this.get(e)}}},jHxP:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t="";t=e.isWhatsapplink?function(e){var t="https://api.whatsapp.com/send?phone={{TELEFONO}}&text={{TEXTO_URL_ENCODED}}";return e.phone&&(t=t.replace("{{TELEFONO}}",e.phone)),e.message&&(t=t.replace("{{TEXTO_URL_ENCODED}}",e.message.replace(" ","%20"))),t}(e):function(e){var t="https://m.me/{{FB_ID}}?ref=messenger_commerce_{{ECOMMERCE_ID}}_{{DOMAIN_URL}}?utm_source=fomo&utm_medium=notification#newsletter";return e.fbId&&(t=t.replace("{{FB_ID}}",e.fbId)),t=e.eCommerceId?t.replace("{{ECOMMERCE_ID}}",e.eCommerceId):t.replace("{{ECOMMERCE_ID}}",""),e.domainUrl&&(t=t.replace("{{DOMAIN_URL}}",e.domainUrl)),t}(e);var n=document.querySelectorAll(".eib-block__link a");n[0]&&n[0].setAttribute("href",t);var r=document.querySelectorAll(".eib-block__link .eib-block__image");r[0]&&r[0].setAttribute("src",e.imageSrc);var i=document.querySelectorAll(".eib-block .eib-popover");if(i[0]){var a=document.createTextNode(e.popoverMessage);i[0].appendChild(a)}o.default.init(".eib-block__link",".eib-popover")};var o=function(e){return e&&e.__esModule?e:{default:e}}(n("To8L"))},lVK7:function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}var r=o(n("RghB")),i=o(n("QbSh")),a=o(n("jHxP"));!function(){var e=document.getElementsByTagName("script")[0],t=document.createElement("style");t.type="text/css",t.innerHTML=i.default,e.parentNode.appendChild(t);var n=document.getElementById("exit-intent-bubble-widget"),o={};if(n){var s=n.getAttribute("data-wpp-phone"),p=n.getAttribute("data-wpp-message"),f=n.getAttribute("data-ei-popover-message"),c=n.getAttribute("data-ei-image-src"),u=n.getAttribute("data-fb-id"),l=n.getAttribute("data-ecomerce-id"),d=n.getAttribute("data-domain-url");o={phone:s,isWhatsapplink:s,message:p,popoverMessage:f,imageSrc:c,fbId:u,eCommerceId:l,domainUrl:d},n.innerHTML=r.default}document.addEventListener("DOMContentLoaded",function(){(0,a.default)(o)})}()}});
<div id="exit-intent-bubble-widget"
data-wpp-phone="56974894301"
data-wpp-message="Hola! Me pueden ayudar?"
data-ei-popover-message="Hola! Puedo ayudarte si haces Click aquí"
data-ei-image-src="/ruta/theme/assets/images/vitaclinic-dialog-bubble.png" >
</div>
<script src="/ruta/theme/assets/js/exit-intent-bubble.a166e81.min.js"></script>
@molavec
Copy link
Author

molavec commented Nov 10, 2017

Descargar la imagen y en caso de ser necesario cambiar el nombre a vitaclinic-dialog-bubble.png

vitaclinic-dialog-bubble

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment