Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@abtasty/widget-utils

Package Overview
Dependencies
Maintainers
16
Versions
215
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@abtasty/widget-utils - npm Package Compare versions

Comparing version 1.12.3-20 to 1.12.3-21

2

dist/widget-utils.cjs.js

@@ -1,1 +0,1 @@

"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var _defineProperty=_interopDefault(require("@babel/runtime/helpers/defineProperty")),_toConsumableArray=_interopDefault(require("@babel/runtime/helpers/toConsumableArray")),_classCallCheck=_interopDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass=_interopDefault(require("@babel/runtime/helpers/createClass")),_possibleConstructorReturn=_interopDefault(require("@babel/runtime/helpers/possibleConstructorReturn")),_getPrototypeOf=_interopDefault(require("@babel/runtime/helpers/getPrototypeOf")),_inherits=_interopDefault(require("@babel/runtime/helpers/inherits")),_regeneratorRuntime=_interopDefault(require("@babel/runtime/regenerator")),_asyncToGenerator=_interopDefault(require("@babel/runtime/helpers/asyncToGenerator")),backgroundTranslations={en:"Background",fr:"Fond",es:"Fondo",de:"Hintergrund"},backgroundColorTranslations={en:"Background color",fr:"Couleur de fond",es:"Color de fondo",de:"Hintergrundfarbe"},backgroundImageTranslations={en:"Background image",fr:"Image de fond",es:"Imagen de fondo",de:"Hintergrundbild"},backgroundOpacityTranslations={en:"Background opacity",fr:"Opacité du fond",es:"Opacidad de fondo",de:"Hintergrundopazität"},borderTranslations={en:"Border",fr:"Contour",es:"Borde",de:"Grenze"},borderColorTranslations={en:"Border color",fr:"Couleur du contour",es:"Color del contorno",de:"Farbe der Kontur"},borderRadiusTranslations={en:"Border radius",fr:"Arrondi du contour",es:"Contorno redondeado",de:"Abgerundeter Umriss"},borderWidthTranslations={en:"Border width",fr:"Épaisseur du contour",es:"Espesor del contorno",de:"Dicke der Kontur"},everydayTranslations={en:"Everyday",fr:"Chaque jour",es:"Cada día",de:"Jeden Tag"},everyWeekTranslations={en:"Every week",fr:"Chaque semaine",es:"Cada semana",de:"Jede Woche"},everyMonthTranslations={en:"Every month",fr:"Chaque mois",es:"Cada mes",de:"Jeden Monat"},everySessionTranslations={en:"Every session",fr:"Chaque session",es:"En cada sesión",de:"Jede Session"},everytimeTranslations={en:"Every time",fr:"Tout le temps",es:"Cada vez",de:"Jedes Mal"},oncePerUserTranslations={en:"Once per user (no recurrence)",fr:"Une fois par visiteur (pas de récurrence)",es:"Una vez por usuario (sin recurrencia)",de:"Einmal pro User (keine Wiederholung)"},recurrenceTranslations={en:"Recurrence",fr:"Récurrence",es:"Recurrencia",de:"Wiederholung"},displayRecurrenceTranslations={en:"".concat(recurrenceTranslations.en," of the display"),fr:"".concat(recurrenceTranslations.fr," de l'affichage"),es:"".concat(recurrenceTranslations.es," de la pantalla"),de:"".concat(recurrenceTranslations.de," der Anzeige")},closingRecurrenceTranslations={en:"".concat(recurrenceTranslations.en," after closure"),fr:"".concat(recurrenceTranslations.fr," après fermeture"),es:"".concat(recurrenceTranslations.es," después del cierre"),de:"".concat(recurrenceTranslations.de," nach Schließung")},validationRecurrenceTranslations={en:"".concat(recurrenceTranslations.en," after validation"),fr:"".concat(recurrenceTranslations.fr," après validation"),es:"".concat(recurrenceTranslations.es," después de la validación"),de:"".concat(recurrenceTranslations.de," nach der Validierung")},textColorTranslations={en:"Text color",fr:"Couleur du texte",es:"Color de texto",de:"Textfarbe"},closeButtonColorTranslations={en:"Close button color",fr:"Couleur du bouton de fermeture",es:"Color del botón de cierre",de:"Farbe der Schließen-Schaltfläche"},positionTranslations={en:"Position",fr:"Position",es:"Posición",de:"Position"},topTranslations={en:"Top",fr:"Haut",es:"Arriba",de:"Oben"},bottomTranslations={en:"Bottom",fr:"Bas",es:"Abajo",de:"Unten"},leftTranslations={en:"Left",fr:"Gauche",es:"Izquierda",de:"Links"},rightTranslations={en:"Right",fr:"Droite",es:"Derecha",de:"Recht"},beforeBeginTranslations={en:"Before begin",fr:"Avant",es:"Antes",de:"Vor"},afterBeginTranslations={en:"After begin",fr:"Au début",es:"Al principio",de:"Früh"},beforeEndTranslations={en:"Before end",fr:"À la fin",es:"Al final",de:"Am ende"},afterEndTranslations={en:"After end",fr:"Après",es:"Después",de:"Nach"},pageLoadTranslations={en:"Page load",fr:"Chargement de la page",es:"Carga de página",de:"Seite laden"},clickTranslations={en:"Click",fr:"Clic",es:"Clic",de:"Klicken"},exitIntentTranslations={en:"Exit intent",fr:"Avant fermeture de l'onglet",es:"Intención de salida",de:"Absicht beenden"},delayTranslations={en:"Delay",fr:"Délai",es:"Retrasar",de:"Verzögern"},reengageInactivityTranslations={en:"Reengage (after inactivity)",fr:"Réengagement (après inactivité)",es:"Despues de inactividad",de:"Nach Untätigkeit"},triggerOnTranslations={en:"Triggers on",fr:"Se déclenche au",es:"Disparadores en",de:"Löst aus"},triggerTranslations={en:"Trigger",fr:"Déclencheur",es:"Desencadenar",de:"Auslösen"},selectLayoutTranslations={en:"Select a layout",fr:"Sélectionnez une mise en page",es:"Seleccione un diseño",de:"Wählen Sie ein Layout"},popinTranslations={en:"Popin",fr:"Popin",es:"Popin",de:"Popin"},bannerTranslations={en:"Banner",fr:"Bannière",es:"Bandera",de:"Banner"},inThePageTranslations={en:"In the page",fr:"Dans la page",es:"En la pagina",de:"In der Seite"},adjustLayoutTranslations={en:"Adjust the layout",fr:"Ajuster le placement",es:"Ajustar la posición",de:"Position einstellen"},selectElementReferrerTranslations={en:"Select an element as referrer",fr:"Sélectionnez un élément de référence",es:"Seleccione un elemento de referencia",de:"Wählen Sie ein Referenzelement"},relativePositionToElementTranslations={en:"Position relative to the element",fr:"Position par rapport à l'élément",es:"Posición relativa al elemento",de:"Position relativ zum Element"},containerTranslations={en:"Container",fr:"Conteneur",es:"Container",de:"Container"},paddingTranslations={en:"Padding",fr:"Padding",es:"Padding",de:"Padding"},horizontalPaddingTranslations={en:"Horizontal padding",fr:"Padding horizontal",es:"Relleno horizontal",de:"Horizontale Polsterung"},verticalPaddingTranslations={en:"Vertical padding",fr:"Padding vertical",es:"Acolchado vertical",de:"Vertikale Polsterung"},marginTranslations={en:"Margin",fr:"Marges",es:"Márgenes",de:"Spanne"},horiziontalMarginTranslations={en:"Horizontal margin",fr:"Marges horizontales",es:"Margen horizontal",de:"Horizontaler Rand"},verticalMarginTranslations={en:"Vertical margin",fr:"Marges verticales",es:"Margen vertical",de:"Vertikaler Rand"},buttonsStylesTranslations={en:"Buttons style",fr:"Style des boutons",es:"Estilo de botón",de:"Schaltflächenstil"},buttonsContrastTranslations={en:"Buttons contrast",fr:"Contraste des boutons",es:"Contraste de los botones",de:"Kontrast der Tasten"},buttonsShapeTranslations={en:"Buttons shape",fr:"Forme des boutons",es:"Forma de boton",de:"Knopfform"},buttonsBackgroundColorTranslations={en:"Buttons background color",fr:"Couleur de fond des boutons",es:"Color de fondo de los botones",de:"Hintergrundfarbe der Tasten"},buttonsTextColorTranslations={en:"Buttons text color",fr:"Couleur de texte des boutons",es:"Color del texto de los botones",de:"Textfarbe der Schaltflächen"},buttonsBorderColorTranslations={en:"Buttons border color",fr:"Couleur du contour des boutons",es:"Color del contorno de los botones",de:"Farbe der Schaltflächenkontur"},buttonsBorderWidthTranslations={en:"Buttons border thickness",fr:"Épaisseur du contour des boutons",es:"Grosor del contorno de los botones",de:"Stärke des Umrisses der Schaltflächen"},overlayOpacityTranslations={en:"Overlay opacity",fr:"Opacité de l'overlay",es:"Opacidad superpuesta",de:"Deckkraft überlagern"},dropShadowTranslations={en:"Drop shadow",fr:"Ombre portée",es:"Sombra",de:"Schatten"},shadowOpacityTranslations={en:"Shadow opacity",fr:"Opacité de l'ombre",es:"Opacidad de las sombras",de:"Schattenopazität"},STYLE="style",LAYOUT="layout",CONTENT="content",CONDITIONS="conditions",GROUP="group",CHECKBOX="checkbox",COLOR_PICKER="colorpicker",SEPARATOR="separator",DATE_PICKER="datepicker",DATE_RANGE_PICKER="dateRangePicker",SELECT="select",MEDIA_UPLOAD="mediaupload",NUMBER="number",RADIO_BUTTON="radio",RADIO_IMAGE="radioImage",SLIDER="slider",SWITCH="switch",TEXT_FIELD="text",TEXT_AREA="textarea",TIME_PICKER="timepicker",SELECT_ELEMENT="selectelement",WYSIWYG="wysiwyg",HIDDEN="hidden",recurrencesOptions=[{label:everytimeTranslations,value:"-1"},{label:everySessionTranslations,value:"0"},{label:everydayTranslations,value:"1"},{label:everyWeekTranslations,value:"7"},{label:everyMonthTranslations,value:"30"},{label:oncePerUserTranslations,value:"365"}];function ownKeys(e,t){var n=Object.keys(e);return Object.getOwnPropertySymbols&&n.push.apply(n,Object.getOwnPropertySymbols(e)),t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(n,!0).forEach(function(t){_defineProperty(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ownKeys(n).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var commons={category:CONDITIONS,type:SELECT,options:recurrencesOptions,value:"-1"},closingRecurrenceForm=_objectSpread({},commons,{label:closingRecurrenceTranslations,propName:"closingRecurrence"}),displayRecurrenceForm=_objectSpread({},commons,{label:displayRecurrenceTranslations,propName:"displayRecurrence"}),validationRecurrenceForm=_objectSpread({},commons,{label:validationRecurrenceTranslations,propName:"validationRecurrence"}),recurrencesGroup={category:CONDITIONS,type:GROUP,label:recurrenceTranslations,collapsible:!0,children:[displayRecurrenceForm,closingRecurrenceForm,validationRecurrenceForm]},triggersOptions=[{label:pageLoadTranslations,value:"pageLoad"},{label:clickTranslations,value:"click"},{label:exitIntentTranslations,value:"exitIntent"},{label:delayTranslations,value:"delay"},{label:reengageInactivityTranslations,value:"reengage"}],TRIGGER_EVENT="triggerEvent",triggerEventClick={category:CONDITIONS,type:SELECT_ELEMENT,propName:"".concat(TRIGGER_EVENT,"Click"),label:triggerTranslations,placeholder:{en:"Select an element in the webpage",fr:"Sélectionner un élément dans la page",es:"Selecciona un elemento en la página web",de:"Wählen Sie ein Element auf der Webseite aus"},conditions:[{field:TRIGGER_EVENT,value:"click"}]},triggerEventExitDelay={category:CONDITIONS,type:NUMBER,propName:"".concat(TRIGGER_EVENT,"ExitDelay"),label:{en:"Delay after exit intent",fr:"Délai après intention de sortie",es:"Retraso después de la intención de salida",de:"Verzögerung nach Ausstiegsabsicht"},min:0,max:120,value:0,conditions:[{field:TRIGGER_EVENT,value:"exitIntent"}]},triggerEventReengageDelay={category:CONDITIONS,type:NUMBER,propName:"".concat(TRIGGER_EVENT,"ReengageDelay"),label:{en:"Idle timeout before posting",fr:"Délai d'inactivité avant l'affichage",es:"Tiempo de espera inactivo antes de publicar",de:"Zeitüberschreitung vor dem Posten"},min:1,max:120,value:10,conditions:[{field:TRIGGER_EVENT,value:"reengage"}]},triggerEventDelay={category:CONDITIONS,type:NUMBER,propName:"".concat(TRIGGER_EVENT,"Delay"),label:{en:"Trigger event delay (in seconds)",fr:"Délai avant l'affichage (en secondes)",es:"",de:"Verzögerung vor dem Posten"},value:10,conditions:[{field:TRIGGER_EVENT,value:"delay"}]},conditionalFields=[triggerEventClick,triggerEventExitDelay,triggerEventReengageDelay,triggerEventDelay],triggersForm={category:CONDITIONS,type:SELECT,label:triggerOnTranslations,options:triggersOptions,propName:TRIGGER_EVENT,value:"pageLoad"},triggersGroup={category:CONDITIONS,type:GROUP,label:triggerTranslations,collapsible:!0,children:[triggersForm].concat(_toConsumableArray(conditionalFields))},isOnEditor=function(){return Object.prototype.hasOwnProperty.call(window,"ABTastyEditor")};function syncRequest(e,t){var n=new XMLHttpRequest;return n.open(e,t,!1),n.send(null),n}function asyncRequest(e,t){return new Promise(function(n,r){var o=new XMLHttpRequest;o.open(e,t,!0),o.onload=function(){this.status>=200&&this.status<300?n(o.response):r({status:this.status,statusText:o.statusText})},o.onerror=function(){r({status:this.status,statusText:o.statusText})},o.send()})}var originalBodyScroll,backgroundColorForm={category:STYLE,type:COLOR_PICKER,label:backgroundColorTranslations,propName:"backgroundColor",value:"rgba(255, 255, 255, 1)"},backgroundImageForm={category:STYLE,type:MEDIA_UPLOAD,label:backgroundImageTranslations,propName:"backgroundImage",value:""},backgroundOpacityForm={category:STYLE,type:SLIDER,label:backgroundOpacityTranslations,propName:"backgroundOpacity",value:75,unit:"%"},backgroundsGroup={category:STYLE,type:GROUP,label:backgroundTranslations,collapsible:!0,children:[backgroundColorForm,backgroundImageForm,backgroundOpacityForm]},borderColorForm={category:STYLE,type:COLOR_PICKER,label:borderColorTranslations,propName:"borderColor",value:"rgba(255, 255, 255, 1)"},borderRadiusForm={category:STYLE,type:SLIDER,label:borderRadiusTranslations,propName:"borderRadius",value:0,unit:"px"},borderWidthForm={category:STYLE,type:SLIDER,label:borderWidthTranslations,propName:"borderWidth",value:0,unit:"px"},bordersGroup={category:STYLE,type:GROUP,label:borderTranslations,collapsible:!0,children:[borderWidthForm,borderColorForm,borderRadiusForm]},textColorForm={category:STYLE,type:COLOR_PICKER,label:textColorTranslations,propName:"textColor",value:"rgba(255, 255, 255, 1)"},WidgetContainer=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"000000",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";_classCallCheck(this,e),this.uniqueId=t,this.widgetContainer=n,this.basicClassName="ab_widget_container_".concat(n),this.widgetContainerId="".concat(this.basicClassName,"_").concat(t),this.contentClassName="".concat(this.basicClassName,"_content"),this.overlayClassName="".concat(this.basicClassName,"_overlay"),this.closeButtonClassName="".concat(this.basicClassName,"_close_button"),this.hideClassName="ab_hide_".concat(t),this.domElement=this.getDom()}return _createClass(e,[{key:"insert",value:function(){var e=this;return waitForElement("head",function(t){return t.appendChild(e.styleElement)},function(e){return console.error(e)}),waitForElement("body",function(t){return t.appendChild(e.domElement)},function(e){return console.error(e)}),this}},{key:"remove",value:function(){return this.domElement.remove(),this.styleElement.remove(),this}},{key:"show",value:function(){return this.domElement.classList.remove(this.hideClassName),this}},{key:"hide",value:function(){return this.domElement.classList.add(this.hideClassName),this}},{key:"init",value:function(){return this.insert(),this.addCloseEvent(),this}},{key:"addCloseEvent",value:function(){for(var e=this,t=this.domElement.querySelectorAll("\n\t\t\t.".concat(this.overlayClassName,",\n\t\t\t.").concat(this.closeButtonClassName,"\n\t\t")),n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return r.push.apply(r,_toConsumableArray(t)),r.forEach(function(t){t.addEventListener("click",function(){e.hide()},!0)}),this}},{key:"getDom",value:function(){var e=document.createElement("div");return e.className="".concat(this.basicClassName," ").concat(this.hideClassName),e.id=this.widgetContainerId,e.innerHTML='\n\t\t\t<div class="'.concat(this.overlayClassName,'"></div>\n\t\t\t<div class="').concat(this.contentClassName,'">\n\t\t\t\t<button class="').concat(this.closeButtonClassName,'" ').concat(isOnEditor()?"data-abtasty-actionnable":"",">+</button>\n\t\t\t</div>"),e}},{key:"getStyleTag",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=document.createElement("style");return t.type="text/css",isOnEditor()&&t.setAttribute("abtasty-script-added","true"),t.textContent="\n\t\t\t.".concat(this.hideClassName," {opacity: 0 !important; pointer-events: none;}\n\t\t\t").concat(e),t}}]),e}(),Popin=function(e){function t(e,n){var r;return _classCallCheck(this,t),(r=_possibleConstructorReturn(this,_getPrototypeOf(t).call(this,e,n))).stringStyles=r.getStyles(),r.styleElement=r.getStyleTag(r.stringStyles),r}return _inherits(t,WidgetContainer),_createClass(t,[{key:"getStyles",value:function(){return"\n\t\t#".concat(this.widgetContainerId," {\n\t\t\tposition: fixed;\n\t\t\ttop: 0;\n\t\t\tleft: 0;\n\t\t\twidth: 100%;\n\t\t\theight: 100%;\n\t\t\tz-index: 9999;\n\t\t\topacity: 1;\n\t\t\ttransition: opacity 0.25s ease;\n\t\t}\n\t\t#").concat(this.widgetContainerId," .").concat(this.overlayClassName," {\n\t\t\tposition: absolute;\n\t\t\tz-index: -1;\n\t\t\ttop: 0;\n\t\t\tleft: 0;\n\t\t\twidth: 100%;\n\t\t\theight: 100%;\n\t\t\tbackground-color: black;\n\t\t\topacity: 0.6;\n\t\t}\n\t\t#").concat(this.widgetContainerId," .").concat(this.contentClassName," {\n\t\t\tposition: absolute;\n\t\t\tleft: 50%;\n\t\t\ttop: 50%;\n\t\t\ttransform: translate(-50%, -50%);\n\t\t\twidth: auto;\n\t\t\theight: auto;\n\t\t}\n\t\t#").concat(this.widgetContainerId," .").concat(this.closeButtonClassName," {\n\t\t\tposition: absolute;\n\t\t\ttop: 0;\n\t\t\tright: 0;\n\t\t\tcolor: black;\n\t\t\tbackground: none;\n\t\t\tborder: none;\n\t\t\ttransform: rotate(45deg);\n\t\t\tcursor: pointer;\n\t\t\toutline: none;\n\t\t\tfont-size: 1.8em;\n\t\t}")}}]),t}(),Banner=function(e){function t(e,n,r){var o;return _classCallCheck(this,t),(o=_possibleConstructorReturn(this,_getPrototypeOf(t).call(this,e,n))).position=r,o.stringStyles=o.getStyles(),o.styleElement=o.getStyleTag(o.stringStyles),o}return _inherits(t,WidgetContainer),_createClass(t,[{key:"getStyles",value:function(){return"\n\t\t#".concat(this.widgetContainerId," {\n\t\t\tposition: fixed;\n\t\t\t").concat(this.position,": 0;\n\t\t\tleft: 0;\n\t\t\twidth: 100%;\n\t\t\theight: auto;\n\t\t\tz-index: 9999;\n\t\t\topacity: 1;\n\t\t\ttransition: opacity 0.25s ease;\n\t\t}\n\t\t#").concat(this.widgetContainerId," .").concat(this.overlayClassName," {\n\t\t\tdisplay: none;\n\t\t}\n\t\t#").concat(this.widgetContainerId," .").concat(this.closeButtonClassName," {\n\t\t\tposition: absolute;\n\t\t\ttop: 0;\n\t\t\tright: 0;\n\t\t\tcolor: black;\n\t\t\tbackground: none;\n\t\t\tborder: none;\n\t\t\ttransform: rotate(45deg);\n\t\t\tcursor: pointer;\n\t\t\toutline: none;\n\t\t\tfont-size: 1.8em;\n\t\t}")}}]),t}(),Free=function(e){function t(e,n,r,o){var a;return _classCallCheck(this,t),(a=_possibleConstructorReturn(this,_getPrototypeOf(t).call(this,e,n))).position=r,a.referrerElement=o,a.stringStyles=a.getStyles(),a.styleElement=a.getStyleTag(a.stringStyles),a}return _inherits(t,WidgetContainer),_createClass(t,[{key:"insert",value:function(){var e=this;return waitForElement("head",function(t){return t.appendChild(e.styleElement)},function(e){return console.error(e)}),waitForElement(this.referrerElement,function(t){return t.insertAdjacentElement(e.position,e.domElement)},function(e){return console.error(e)}),this}},{key:"getStyles",value:function(){return"\n\t\t#".concat(this.widgetContainerId," {\n\t\t\twidth: auto;\n\t\t\theight: auto;\n\t\t\tposition: relative;\n\t\t\tmargin: 0;\n\t\t\tpadding: 0;\n\t\t}\n\t\t#").concat(this.widgetContainerId," .").concat(this.overlayClassName," {\n\t\t\tdisplay: none;\n\t\t}\n\t\t#").concat(this.widgetContainerId," .").concat(this.closeButtonClassName," {\n\t\t\tposition: absolute;\n\t\t\ttop: 0;\n\t\t\tright: 0;\n\t\t\tcolor: black;\n\t\t\tbackground: none;\n\t\t\tborder: none;\n\t\t\ttransform: rotate(45deg);\n\t\t\tcursor: pointer;\n\t\t\toutline: none;\n\t\t\tfont-size: 1.8em;\n\t\t}")}}]),t}(),Recurrence=function(){function e(t){var n=t.displayRecurrence,r=t.closingRecurrence,o=t.validationRecurrence,a=t.widgetName;_classCallCheck(this,e),this.displayRecurrence=parseFloat(n),this.closingRecurrence=parseFloat(r),this.validationRecurrence=parseFloat(o),this.storageName="Rec_".concat(a,"_").concat(PLUGIN_ID),this.currentRecurrence=this.getCurrentRecurrence()}return _createClass(e,[{key:"getCurrentRecurrence",value:function(){var e={type:!1},t=sessionStorage.getItem(this.storageName)||localStorage.getItem(this.storageName);try{return JSON.parse(t)||e}catch(t){return e}}},{key:"isOver",value:function(){var e=sessionStorage.getItem(this.storageName),t=localStorage.getItem(this.storageName),n=(t?parseFloat(t):0)<(new Date).getTime();return n&&localStorage.removeItem(this.storageName),n&&!t&&!e}},{key:"setRecurrence",value:function(e,t){var n=this,r=this.getTypeOfStorage(e),o=this.getStamp(e),a={type:t,stamp:o},s=this.currentRecurrence.type,i=function(){sessionStorage.getItem(n.storageName)&&sessionStorage.removeItem(n.storageName),localStorage.getItem(n.storageName)&&localStorage.removeItem(n.storageName),r.setItem(n.storageName,JSON.stringify(a))};if(!r)return!1;if(s&&"validation"!==t)if("closing"===t&&"validation"!==s)i();else{if("display"!==t||"validation"===s||"closing"===s)return!1;i()}else i();return o}},{key:"setDisplayRecurrence",value:function(){this.setRecurrence(this.displayRecurrence,"display")}},{key:"setClosingRecurrence",value:function(){this.setRecurrence(this.closingRecurrence,"closing")}},{key:"setValidationRecurrence",value:function(){this.setRecurrence(this.validationRecurrence,"validation")}},{key:"getStamp",value:function(e){return(new Date).getTime()+864e5*e}},{key:"getTypeOfStorage",value:function(e){return!(isNaN(e)||e<0||0!==e&&!e)&&(e>0?window.localStorage:0===e&&window.sessionStorage)}}]),e}(),Trigger=function(){function e(t){var n=t.triggerEvent,r=t.triggerSelector,o=t.triggerDelay;_classCallCheck(this,e),this.event=n,this.selector=r&&r.length?r:"body",this.delay=o}return _createClass(e,[{key:"onPageLoad",value:function(){return new Promise(function(e,t){if("complete"!==document.readyState){var n,r=["DOMContentLoaded",function(){return e(!0)},{passive:!0,once:!0}];(n=window).addEventListener.apply(n,r),setTimeout(function(){var e;return(e=window).removeEventListener.apply(e,r),t(!1)},15e3)}return e(!0)})}},{key:"onClick",value:function(){var e=this,t=document.createElement("style");return t.innerHTML="".concat(this.selector," {\n\t\t\tcursor: pointer !important;\n\t\t\tpointer-events: all !important;\n\t\t}"),document.head.appendChild(t),new Promise(function(n){var r,o=function(t){return _toConsumableArray(document.querySelectorAll(e.selector)).some(function(n){return n.isSameNode(t)||!!t.closest(e.selector)})},a=["click",function(e){return!!o(e.target)&&(document.head.removeChild(t),n(!0))},{passive:!0,once:!0,capture:!0}];(r=document).addEventListener.apply(r,a)})}},{key:"onExitIntent",value:function(){var e=this;return new Promise(function(){var t=_asyncToGenerator(_regeneratorRuntime.mark(function t(n){var r;return _regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r=["mouseleave",function(){if(e.delay){var t=1e3*e.delay;setTimeout(function(){return n(!0)},t)}return n(!0)},{passive:!0,once:!0}],t.next=4,e.onPageLoad();case 4:t.sent&&waitForElement("body",function(e){return e.addEventListener.apply(e,r)});case 6:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}())}},{key:"onDelay",value:function(){var e=this;return new Promise(function(){var t=_asyncToGenerator(_regeneratorRuntime.mark(function t(n){var r;return _regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r=1e3*e.delay,t.next=3,e.onPageLoad();case 3:t.sent&&setTimeout(function(){return n(!0)},r);case 5:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}())}},{key:"onReengage",value:function(){var e=this;return new Promise(function(t){var n=1e3*e.delay,r=n,o=["click","mousemove","scroll","keypress"],a=[function(){return r=n},{passive:!0}];o.forEach(function(e){var t;return(t=document).addEventListener.apply(t,[e].concat(a))});var s=setInterval(function(){r<=0?(t(!0),clearInterval(s),o.forEach(function(e){var t;return(t=document).removeEventListener.apply(t,[e].concat(a))})):r-=100},100)})}},{key:"isTriggered",value:function(){var e=_asyncToGenerator(_regeneratorRuntime.mark(function e(){var t;return _regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=this.event,e.next="pageLoad"===e.t0?3:"click"===e.t0?7:"exitIntent"===e.t0?11:"delay"===e.t0?15:"reengage"===e.t0?19:23;break;case 3:return e.next=5,this.onPageLoad();case 5:return t=e.sent,e.abrupt("break",24);case 7:return e.next=9,this.onClick();case 9:return t=e.sent,e.abrupt("break",24);case 11:return e.next=13,this.onExitIntent();case 13:return t=e.sent,e.abrupt("break",24);case 15:return e.next=17,this.onDelay();case 17:return t=e.sent,e.abrupt("break",24);case 19:return e.next=21,this.onReengage();case 21:return t=e.sent,e.abrupt("break",24);case 23:t=!1;case 24:return e.abrupt("return",t);case 25:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()}]),e}();function preventGlobalScroll(){var e=document.querySelector("body");originalBodyScroll=window.getComputedStyle(e).overflowY,e.style.overflowY="hidden"}function allowGlobalScroll(){originalBodyScroll&&(document.querySelector("body").style.overflowY=originalBodyScroll)}var loadImage=function(e){return new Promise(function(t,n){var r=new Image;r.onload=function(){t(r)},r.src=e,r.onerror=function(t){var r=new Error("Image ".concat(e," is not loaded."));n(r)}})},isTouch=function(){return void 0!==window.ontouchstart},exitIntent=function(e){var t,n=0;document.addEventListener("mousemove",function(e){n=e.clientY}),document.body.addEventListener("mouseleave",function r(o){o.clientY<=50&&(n=0,clearInterval(t),t=setTimeout(function(){0===n&&(e(),document.removeEventListener("mouseleave",r))},0))},!1)},log=function(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];n.unshift("[AB Tasty Widget] ".concat(PACKAGE,":")),(e=console).log.apply(e,n)},domReady=function(e){"loading"!==document.readyState?e():document.addEventListener("DOMContentLoaded",e)},waitForElement=function(e,t,n){var r,o=0;try{document.querySelector(e)}catch(t){var a="Selector «".concat(e,"» not valid.");return log(a),"function"==typeof n&&n(a)}r=setTimeout(function(){clearInterval(o);var t="Can't find element «".concat(e,"».");return log(t),"function"==typeof n&&n(t)},1e4),o=setInterval(function(){var n=document.querySelector(e);if(null!==n)return clearTimeout(r),clearInterval(o),"function"==typeof t&&t(n)},200)},getCookie=function(e){for(var t=e+"=",n=document.cookie.split(";"),r=0;r<n.length;r++){for(var o=n[r];" "==o.charAt(0);)o=o.substring(1);if(0===o.indexOf(t))return o.substring(t.length,o.length)}return""},getHostname=function(){var e=document.location.hostname.split("").reverse().join("");null===(e=e.match(/(?:[a-z]{2,4}\.[a-z]{2,3}|[a-z]{2,5})\.[a-z0-9\-]+(?:\.|$)/i))?e=document.location.hostname:("."!=e[0].substr(e[0].length-1)&&(e[0]+="."),e=e[0].split("").reverse().join(""));return e},setCookie=function(e,t,n){var r="";if(n){var o=new Date;o.setTime(o.getTime()+24*n*60*60*1e3),r="expires="+o.toUTCString()}var a="domain="+getHostname();document.cookie=e+"="+t+"; "+r+";"+a+";path=/"};exports.preventGlobalScroll=preventGlobalScroll,exports.allowGlobalScroll=allowGlobalScroll,exports.loadImage=loadImage,exports.isTouch=isTouch,exports.exitIntent=exitIntent,exports.log=log,exports.domReady=domReady,exports.waitForElement=waitForElement,exports.getCookie=getCookie,exports.getHostname=getHostname,exports.setCookie=setCookie,exports.closingRecurrenceForm=closingRecurrenceForm,exports.displayRecurrenceForm=displayRecurrenceForm,exports.validationRecurrenceForm=validationRecurrenceForm,exports.recurrencesGroup=recurrencesGroup,exports.triggersForm=triggersForm,exports.triggersGroup=triggersGroup,exports.isOnEditor=isOnEditor,exports.syncRequest=syncRequest,exports.asyncRequest=asyncRequest,exports.backgroundColorForm=backgroundColorForm,exports.backgroundImageForm=backgroundImageForm,exports.backgroundOpacityForm=backgroundOpacityForm,exports.backgroundsGroup=backgroundsGroup,exports.borderColorForm=borderColorForm,exports.borderRadiusForm=borderRadiusForm,exports.borderWidthForm=borderWidthForm,exports.bordersGroup=bordersGroup,exports.textColorForm=textColorForm,exports.Popin=Popin,exports.Banner=Banner,exports.Free=Free,exports.WidgetContainer=WidgetContainer,exports.Recurrence=Recurrence,exports.Trigger=Trigger,exports.backgroundImageTranslations=backgroundImageTranslations,exports.backgroundColorTranslations=backgroundColorTranslations,exports.backgroundTranslations=backgroundTranslations,exports.backgroundOpacityTranslations=backgroundOpacityTranslations,exports.borderTranslations=borderTranslations,exports.borderColorTranslations=borderColorTranslations,exports.borderRadiusTranslations=borderRadiusTranslations,exports.borderWidthTranslations=borderWidthTranslations,exports.everydayTranslations=everydayTranslations,exports.everyWeekTranslations=everyWeekTranslations,exports.everyMonthTranslations=everyMonthTranslations,exports.everySessionTranslations=everySessionTranslations,exports.everytimeTranslations=everytimeTranslations,exports.oncePerUserTranslations=oncePerUserTranslations,exports.recurrenceTranslations=recurrenceTranslations,exports.displayRecurrenceTranslations=displayRecurrenceTranslations,exports.closingRecurrenceTranslations=closingRecurrenceTranslations,exports.validationRecurrenceTranslations=validationRecurrenceTranslations,exports.textColorTranslations=textColorTranslations,exports.closeButtonColorTranslations=closeButtonColorTranslations,exports.positionTranslations=positionTranslations,exports.topTranslations=topTranslations,exports.bottomTranslations=bottomTranslations,exports.leftTranslations=leftTranslations,exports.rightTranslations=rightTranslations,exports.beforeBeginTranslations=beforeBeginTranslations,exports.afterBeginTranslations=afterBeginTranslations,exports.beforeEndTranslations=beforeEndTranslations,exports.afterEndTranslations=afterEndTranslations,exports.pageLoadTranslations=pageLoadTranslations,exports.clickTranslations=clickTranslations,exports.exitIntentTranslations=exitIntentTranslations,exports.delayTranslations=delayTranslations,exports.reengageInactivityTranslations=reengageInactivityTranslations,exports.triggerOnTranslations=triggerOnTranslations,exports.triggerTranslations=triggerTranslations,exports.selectLayoutTranslations=selectLayoutTranslations,exports.popinTranslations=popinTranslations,exports.bannerTranslations=bannerTranslations,exports.inThePageTranslations=inThePageTranslations,exports.adjustLayoutTranslations=adjustLayoutTranslations,exports.selectElementReferrerTranslations=selectElementReferrerTranslations,exports.relativePositionToElementTranslations=relativePositionToElementTranslations,exports.containerTranslations=containerTranslations,exports.paddingTranslations=paddingTranslations,exports.horizontalPaddingTranslations=horizontalPaddingTranslations,exports.verticalPaddingTranslations=verticalPaddingTranslations,exports.marginTranslations=marginTranslations,exports.horiziontalMarginTranslations=horiziontalMarginTranslations,exports.verticalMarginTranslations=verticalMarginTranslations,exports.buttonsStylesTranslations=buttonsStylesTranslations,exports.buttonsContrastTranslations=buttonsContrastTranslations,exports.buttonsShapeTranslations=buttonsShapeTranslations,exports.buttonsBackgroundColorTranslations=buttonsBackgroundColorTranslations,exports.buttonsTextColorTranslations=buttonsTextColorTranslations,exports.buttonsBorderColorTranslations=buttonsBorderColorTranslations,exports.buttonsBorderWidthTranslations=buttonsBorderWidthTranslations,exports.overlayOpacityTranslations=overlayOpacityTranslations,exports.dropShadowTranslations=dropShadowTranslations,exports.shadowOpacityTranslations=shadowOpacityTranslations,exports.STYLE=STYLE,exports.LAYOUT=LAYOUT,exports.CONTENT=CONTENT,exports.CONDITIONS=CONDITIONS,exports.GROUP=GROUP,exports.CHECKBOX=CHECKBOX,exports.COLOR_PICKER=COLOR_PICKER,exports.SEPARATOR=SEPARATOR,exports.DATE_PICKER=DATE_PICKER,exports.DATE_RANGE_PICKER=DATE_RANGE_PICKER,exports.SELECT=SELECT,exports.MEDIA_UPLOAD=MEDIA_UPLOAD,exports.NUMBER=NUMBER,exports.RADIO_BUTTON=RADIO_BUTTON,exports.RADIO_IMAGE=RADIO_IMAGE,exports.SLIDER=SLIDER,exports.SWITCH=SWITCH,exports.TEXT_FIELD=TEXT_FIELD,exports.TEXT_AREA=TEXT_AREA,exports.TIME_PICKER=TIME_PICKER,exports.SELECT_ELEMENT=SELECT_ELEMENT,exports.WYSIWYG=WYSIWYG,exports.HIDDEN=HIDDEN;
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var _defineProperty=_interopDefault(require("@babel/runtime/helpers/defineProperty")),_toConsumableArray=_interopDefault(require("@babel/runtime/helpers/toConsumableArray")),_classCallCheck=_interopDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass=_interopDefault(require("@babel/runtime/helpers/createClass")),_possibleConstructorReturn=_interopDefault(require("@babel/runtime/helpers/possibleConstructorReturn")),_getPrototypeOf=_interopDefault(require("@babel/runtime/helpers/getPrototypeOf")),_inherits=_interopDefault(require("@babel/runtime/helpers/inherits")),_regeneratorRuntime=_interopDefault(require("@babel/runtime/regenerator")),_asyncToGenerator=_interopDefault(require("@babel/runtime/helpers/asyncToGenerator")),backgroundTranslations={en:"Background",fr:"Fond",es:"Fondo",de:"Hintergrund"},backgroundColorTranslations={en:"Background color",fr:"Couleur de fond",es:"Color de fondo",de:"Hintergrundfarbe"},backgroundImageTranslations={en:"Background image",fr:"Image de fond",es:"Imagen de fondo",de:"Hintergrundbild"},backgroundOpacityTranslations={en:"Background opacity",fr:"Opacité du fond",es:"Opacidad de fondo",de:"Hintergrundopazität"},borderTranslations={en:"Border",fr:"Contour",es:"Borde",de:"Grenze"},borderColorTranslations={en:"Border color",fr:"Couleur du contour",es:"Color del contorno",de:"Farbe der Kontur"},borderRadiusTranslations={en:"Border radius",fr:"Arrondi du contour",es:"Contorno redondeado",de:"Abgerundeter Umriss"},borderWidthTranslations={en:"Border width",fr:"Épaisseur du contour",es:"Espesor del contorno",de:"Dicke der Kontur"},everydayTranslations={en:"Everyday",fr:"Chaque jour",es:"Cada día",de:"Jeden Tag"},everyWeekTranslations={en:"Every week",fr:"Chaque semaine",es:"Cada semana",de:"Jede Woche"},everyMonthTranslations={en:"Every month",fr:"Chaque mois",es:"Cada mes",de:"Jeden Monat"},everySessionTranslations={en:"Every session",fr:"Chaque session",es:"En cada sesión",de:"Jede Session"},everytimeTranslations={en:"Every time",fr:"Tout le temps",es:"Cada vez",de:"Jedes Mal"},oncePerUserTranslations={en:"Once per user (no recurrence)",fr:"Une fois par visiteur (pas de récurrence)",es:"Una vez por usuario (sin recurrencia)",de:"Einmal pro User (keine Wiederholung)"},recurrenceTranslations={en:"Recurrence",fr:"Récurrence",es:"Recurrencia",de:"Wiederholung"},displayRecurrenceTranslations={en:"".concat(recurrenceTranslations.en," of the display"),fr:"".concat(recurrenceTranslations.fr," de l'affichage"),es:"".concat(recurrenceTranslations.es," de la pantalla"),de:"".concat(recurrenceTranslations.de," der Anzeige")},closingRecurrenceTranslations={en:"".concat(recurrenceTranslations.en," after closure"),fr:"".concat(recurrenceTranslations.fr," après fermeture"),es:"".concat(recurrenceTranslations.es," después del cierre"),de:"".concat(recurrenceTranslations.de," nach Schließung")},validationRecurrenceTranslations={en:"".concat(recurrenceTranslations.en," after validation"),fr:"".concat(recurrenceTranslations.fr," après validation"),es:"".concat(recurrenceTranslations.es," después de la validación"),de:"".concat(recurrenceTranslations.de," nach der Validierung")},textColorTranslations={en:"Text color",fr:"Couleur du texte",es:"Color de texto",de:"Textfarbe"},closeButtonColorTranslations={en:"Close button color",fr:"Couleur du bouton de fermeture",es:"Color del botón de cierre",de:"Farbe der Schließen-Schaltfläche"},positionTranslations={en:"Position",fr:"Position",es:"Posición",de:"Position"},topTranslations={en:"Top",fr:"Haut",es:"Arriba",de:"Oben"},bottomTranslations={en:"Bottom",fr:"Bas",es:"Abajo",de:"Unten"},leftTranslations={en:"Left",fr:"Gauche",es:"Izquierda",de:"Links"},rightTranslations={en:"Right",fr:"Droite",es:"Derecha",de:"Recht"},beforeBeginTranslations={en:"Before begin",fr:"Avant",es:"Antes",de:"Vor"},afterBeginTranslations={en:"After begin",fr:"Au début",es:"Al principio",de:"Früh"},beforeEndTranslations={en:"Before end",fr:"À la fin",es:"Al final",de:"Am ende"},afterEndTranslations={en:"After end",fr:"Après",es:"Después",de:"Nach"},pageLoadTranslations={en:"Page load",fr:"Chargement de la page",es:"Carga de página",de:"Seite laden"},clickTranslations={en:"Click",fr:"Clic",es:"Clic",de:"Klicken"},exitIntentTranslations={en:"Exit intent",fr:"Avant fermeture de l'onglet",es:"Intención de salida",de:"Absicht beenden"},delayTranslations={en:"Delay",fr:"Délai",es:"Retrasar",de:"Verzögern"},reengageInactivityTranslations={en:"Reengage (after inactivity)",fr:"Réengagement (après inactivité)",es:"Despues de inactividad",de:"Nach Untätigkeit"},triggerOnTranslations={en:"Triggers on",fr:"Se déclenche au",es:"Disparadores en",de:"Löst aus"},triggerTranslations={en:"Trigger",fr:"Déclencheur",es:"Desencadenar",de:"Auslösen"},selectLayoutTranslations={en:"Select a layout",fr:"Sélectionnez une mise en page",es:"Seleccione un diseño",de:"Wählen Sie ein Layout"},popinTranslations={en:"Popin",fr:"Popin",es:"Popin",de:"Popin"},bannerTranslations={en:"Banner",fr:"Bannière",es:"Bandera",de:"Banner"},inThePageTranslations={en:"In the page",fr:"Dans la page",es:"En la pagina",de:"In der Seite"},adjustLayoutTranslations={en:"Adjust the layout",fr:"Ajuster le placement",es:"Ajustar la posición",de:"Position einstellen"},selectElementReferrerTranslations={en:"Select an element as referrer",fr:"Sélectionnez un élément de référence",es:"Seleccione un elemento de referencia",de:"Wählen Sie ein Referenzelement"},relativePositionToElementTranslations={en:"Position relative to the element",fr:"Position par rapport à l'élément",es:"Posición relativa al elemento",de:"Position relativ zum Element"},containerTranslations={en:"Container",fr:"Conteneur",es:"Container",de:"Container"},paddingTranslations={en:"Padding",fr:"Padding",es:"Padding",de:"Padding"},horizontalPaddingTranslations={en:"Horizontal padding",fr:"Padding horizontal",es:"Relleno horizontal",de:"Horizontale Polsterung"},verticalPaddingTranslations={en:"Vertical padding",fr:"Padding vertical",es:"Acolchado vertical",de:"Vertikale Polsterung"},marginTranslations={en:"Margin",fr:"Marges",es:"Márgenes",de:"Spanne"},horiziontalMarginTranslations={en:"Horizontal margin",fr:"Marges horizontales",es:"Margen horizontal",de:"Horizontaler Rand"},verticalMarginTranslations={en:"Vertical margin",fr:"Marges verticales",es:"Margen vertical",de:"Vertikaler Rand"},buttonsStylesTranslations={en:"Buttons style",fr:"Style des boutons",es:"Estilo de botón",de:"Schaltflächenstil"},buttonsContrastTranslations={en:"Buttons contrast",fr:"Contraste des boutons",es:"Contraste de los botones",de:"Kontrast der Tasten"},buttonsShapeTranslations={en:"Buttons shape",fr:"Forme des boutons",es:"Forma de boton",de:"Knopfform"},buttonsBackgroundColorTranslations={en:"Buttons background color",fr:"Couleur de fond des boutons",es:"Color de fondo de los botones",de:"Hintergrundfarbe der Tasten"},buttonsTextColorTranslations={en:"Buttons text color",fr:"Couleur de texte des boutons",es:"Color del texto de los botones",de:"Textfarbe der Schaltflächen"},buttonsBorderColorTranslations={en:"Buttons border color",fr:"Couleur du contour des boutons",es:"Color del contorno de los botones",de:"Farbe der Schaltflächenkontur"},buttonsBorderWidthTranslations={en:"Buttons border thickness",fr:"Épaisseur du contour des boutons",es:"Grosor del contorno de los botones",de:"Stärke des Umrisses der Schaltflächen"},overlayOpacityTranslations={en:"Overlay opacity",fr:"Opacité de l'overlay",es:"Opacidad superpuesta",de:"Deckkraft überlagern"},dropShadowTranslations={en:"Drop shadow",fr:"Ombre portée",es:"Sombra",de:"Schatten"},shadowOpacityTranslations={en:"Shadow opacity",fr:"Opacité de l'ombre",es:"Opacidad de las sombras",de:"Schattenopazität"},STYLE="style",LAYOUT="layout",CONTENT="content",CONDITIONS="conditions",GROUP="group",CHECKBOX="checkbox",COLOR_PICKER="colorpicker",SEPARATOR="separator",DATE_PICKER="datepicker",DATE_RANGE_PICKER="dateRangePicker",SELECT="select",MEDIA_UPLOAD="mediaupload",NUMBER="number",RADIO_BUTTON="radio",RADIO_IMAGE="radioImage",SLIDER="slider",SWITCH="switch",TEXT_FIELD="text",TEXT_AREA="textarea",TIME_PICKER="timepicker",SELECT_ELEMENT="selectelement",WYSIWYG="wysiwyg",HIDDEN="hidden",recurrencesOptions=[{label:everytimeTranslations,value:"-1"},{label:everySessionTranslations,value:"0"},{label:everydayTranslations,value:"1"},{label:everyWeekTranslations,value:"7"},{label:everyMonthTranslations,value:"30"},{label:oncePerUserTranslations,value:"365"}];function ownKeys(e,t){var n=Object.keys(e);return Object.getOwnPropertySymbols&&n.push.apply(n,Object.getOwnPropertySymbols(e)),t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(n,!0).forEach(function(t){_defineProperty(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ownKeys(n).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var commons={category:CONDITIONS,type:SELECT,options:recurrencesOptions,value:"-1"},closingRecurrenceForm=_objectSpread({},commons,{label:closingRecurrenceTranslations,propName:"closingRecurrence"}),displayRecurrenceForm=_objectSpread({},commons,{label:displayRecurrenceTranslations,propName:"displayRecurrence"}),validationRecurrenceForm=_objectSpread({},commons,{label:validationRecurrenceTranslations,propName:"validationRecurrence"}),recurrencesGroup={category:CONDITIONS,type:GROUP,label:recurrenceTranslations,collapsible:!0,children:[displayRecurrenceForm,closingRecurrenceForm,validationRecurrenceForm]},triggersOptions=[{label:pageLoadTranslations,value:"pageLoad"},{label:clickTranslations,value:"click"},{label:exitIntentTranslations,value:"exitIntent"},{label:delayTranslations,value:"delay"},{label:reengageInactivityTranslations,value:"reengage"}],TRIGGER_EVENT="triggerEvent",triggerEventClick={category:CONDITIONS,type:SELECT_ELEMENT,propName:"".concat(TRIGGER_EVENT,"Click"),label:triggerTranslations,placeholder:{en:"Select an element in the webpage",fr:"Sélectionner un élément dans la page",es:"Selecciona un elemento en la página web",de:"Wählen Sie ein Element auf der Webseite aus"},conditions:[{field:TRIGGER_EVENT,value:"click"}]},triggerEventExitDelay={category:CONDITIONS,type:NUMBER,propName:"".concat(TRIGGER_EVENT,"ExitDelay"),label:{en:"Delay after exit intent",fr:"Délai après intention de sortie",es:"Retraso después de la intención de salida",de:"Verzögerung nach Ausstiegsabsicht"},min:0,max:120,value:0,conditions:[{field:TRIGGER_EVENT,value:"exitIntent"}]},triggerEventReengageDelay={category:CONDITIONS,type:NUMBER,propName:"".concat(TRIGGER_EVENT,"ReengageDelay"),label:{en:"Idle timeout before posting",fr:"Délai d'inactivité avant l'affichage",es:"Tiempo de espera inactivo antes de publicar",de:"Zeitüberschreitung vor dem Posten"},min:1,max:120,value:10,conditions:[{field:TRIGGER_EVENT,value:"reengage"}]},triggerEventDelay={category:CONDITIONS,type:NUMBER,propName:"".concat(TRIGGER_EVENT,"Delay"),label:{en:"Trigger event delay (in seconds)",fr:"Délai avant l'affichage (en secondes)",es:"",de:"Verzögerung vor dem Posten"},value:10,conditions:[{field:TRIGGER_EVENT,value:"delay"}]},conditionalFields=[triggerEventClick,triggerEventExitDelay,triggerEventReengageDelay,triggerEventDelay],triggersForm={category:CONDITIONS,type:SELECT,label:triggerOnTranslations,options:triggersOptions,propName:TRIGGER_EVENT,value:"pageLoad"},triggersGroup={category:CONDITIONS,type:GROUP,label:triggerTranslations,collapsible:!0,children:[triggersForm].concat(_toConsumableArray(conditionalFields))},isOnEditor=function(){return Object.prototype.hasOwnProperty.call(window,"ABTastyEditor")};function syncRequest(e,t){var n=new XMLHttpRequest;return n.open(e,t,!1),n.send(null),n}function asyncRequest(e,t){return new Promise(function(n,r){var o=new XMLHttpRequest;o.open(e,t,!0),o.onload=function(){this.status>=200&&this.status<300?n(o.response):r({status:this.status,statusText:o.statusText})},o.onerror=function(){r({status:this.status,statusText:o.statusText})},o.send()})}var originalBodyScroll,backgroundColorForm={category:STYLE,type:COLOR_PICKER,label:backgroundColorTranslations,propName:"backgroundColor",value:"rgba(255, 255, 255, 1)"},backgroundImageForm={category:STYLE,type:MEDIA_UPLOAD,label:backgroundImageTranslations,propName:"backgroundImage",value:""},backgroundOpacityForm={category:STYLE,type:SLIDER,label:backgroundOpacityTranslations,propName:"backgroundOpacity",value:75,unit:"%"},backgroundsGroup={category:STYLE,type:GROUP,label:backgroundTranslations,collapsible:!0,children:[backgroundColorForm,backgroundImageForm,backgroundOpacityForm]},borderColorForm={category:STYLE,type:COLOR_PICKER,label:borderColorTranslations,propName:"borderColor",value:"rgba(255, 255, 255, 1)"},borderRadiusForm={category:STYLE,type:SLIDER,label:borderRadiusTranslations,propName:"borderRadius",value:0,unit:"px"},borderWidthForm={category:STYLE,type:SLIDER,label:borderWidthTranslations,propName:"borderWidth",value:0,unit:"px"},bordersGroup={category:STYLE,type:GROUP,label:borderTranslations,collapsible:!0,children:[borderWidthForm,borderColorForm,borderRadiusForm]},textColorForm={category:STYLE,type:COLOR_PICKER,label:textColorTranslations,propName:"textColor",value:"rgba(255, 255, 255, 1)"},WidgetContainer=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"000000",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";_classCallCheck(this,e),this.uniqueId=t,this.widgetContainer=n,this.basicClassName="ab_widget_container_".concat(n),this.widgetContainerId="".concat(this.basicClassName,"_").concat(t),this.contentClassName="".concat(this.basicClassName,"_content"),this.overlayClassName="".concat(this.basicClassName,"_overlay"),this.closeButtonClassName="".concat(this.basicClassName,"_close_button"),this.hideClassName="ab_hide_".concat(t),this.domElement=this.getDom()}return _createClass(e,[{key:"insert",value:function(){var e=this;return waitForElement("head",function(t){return t.appendChild(e.styleElement)},function(e){return console.error(e)}),waitForElement("body",function(t){return t.appendChild(e.domElement)},function(e){return console.error(e)}),this}},{key:"remove",value:function(){return this.domElement.remove(),this.styleElement.remove(),this}},{key:"show",value:function(){return this.domElement.classList.remove(this.hideClassName),this}},{key:"hide",value:function(){return this.domElement.classList.add(this.hideClassName),this}},{key:"init",value:function(){return this.insert(),this.addCloseEvent(),this}},{key:"addCloseEvent",value:function(){for(var e=this,t=this.domElement.querySelectorAll("\n\t\t\t.".concat(this.overlayClassName,",\n\t\t\t.").concat(this.closeButtonClassName,"\n\t\t")),n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return r.push.apply(r,_toConsumableArray(t)),r.forEach(function(t){t.addEventListener("click",function(){e.hide()},!0)}),this}},{key:"getDom",value:function(){var e=document.createElement("div");return e.className="".concat(this.basicClassName," ").concat(this.hideClassName),e.id=this.widgetContainerId,e.innerHTML='\n\t\t\t<div class="'.concat(this.overlayClassName,'"></div>\n\t\t\t<div class="').concat(this.contentClassName,'">\n\t\t\t\t<button class="').concat(this.closeButtonClassName,'" ').concat(isOnEditor()?"data-abtasty-actionnable":"",">+</button>\n\t\t\t</div>"),e}},{key:"getStyleTag",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=document.createElement("style");return t.type="text/css",isOnEditor()&&t.setAttribute("abtasty-script-added","true"),t.textContent="\n\t\t\t.".concat(this.hideClassName," {opacity: 0 !important; pointer-events: none;}\n\t\t\t").concat(e),t}}]),e}(),Popin=function(e){function t(e,n){var r;return _classCallCheck(this,t),(r=_possibleConstructorReturn(this,_getPrototypeOf(t).call(this,e,n))).stringStyles=r.getStyles(),r.styleElement=r.getStyleTag(r.stringStyles),r}return _inherits(t,WidgetContainer),_createClass(t,[{key:"getStyles",value:function(){return"\n\t\t#".concat(this.widgetContainerId," {\n\t\t\tposition: fixed;\n\t\t\ttop: 0;\n\t\t\tleft: 0;\n\t\t\twidth: 100%;\n\t\t\theight: 100%;\n\t\t\tz-index: 9999;\n\t\t\topacity: 1;\n\t\t\ttransition: opacity 0.25s ease;\n\t\t}\n\t\t#").concat(this.widgetContainerId," .").concat(this.overlayClassName," {\n\t\t\tposition: absolute;\n\t\t\tz-index: -1;\n\t\t\ttop: 0;\n\t\t\tleft: 0;\n\t\t\twidth: 100%;\n\t\t\theight: 100%;\n\t\t\tbackground-color: black;\n\t\t\topacity: 0.6;\n\t\t}\n\t\t#").concat(this.widgetContainerId," .").concat(this.contentClassName," {\n\t\t\tposition: absolute;\n\t\t\tleft: 50%;\n\t\t\ttop: 50%;\n\t\t\ttransform: translate(-50%, -50%);\n\t\t\twidth: auto;\n\t\t\theight: auto;\n\t\t}\n\t\t#").concat(this.widgetContainerId," .").concat(this.closeButtonClassName," {\n\t\t\tposition: absolute;\n\t\t\ttop: 0;\n\t\t\tright: 0;\n\t\t\tcolor: black;\n\t\t\tbackground: none;\n\t\t\tborder: none;\n\t\t\ttransform: rotate(45deg);\n\t\t\tcursor: pointer;\n\t\t\toutline: none;\n\t\t\tfont-size: 1.8em;\n\t\t}")}}]),t}(),Banner=function(e){function t(e,n,r){var o;return _classCallCheck(this,t),(o=_possibleConstructorReturn(this,_getPrototypeOf(t).call(this,e,n))).position=r,o.stringStyles=o.getStyles(),o.styleElement=o.getStyleTag(o.stringStyles),o}return _inherits(t,WidgetContainer),_createClass(t,[{key:"getStyles",value:function(){return"\n\t\t#".concat(this.widgetContainerId," {\n\t\t\tposition: fixed;\n\t\t\t").concat(this.position,": 0;\n\t\t\tleft: 0;\n\t\t\twidth: 100%;\n\t\t\theight: auto;\n\t\t\tz-index: 9999;\n\t\t\topacity: 1;\n\t\t\ttransition: opacity 0.25s ease;\n\t\t}\n\t\t#").concat(this.widgetContainerId," .").concat(this.overlayClassName," {\n\t\t\tdisplay: none;\n\t\t}\n\t\t#").concat(this.widgetContainerId," .").concat(this.closeButtonClassName," {\n\t\t\tposition: absolute;\n\t\t\ttop: 0;\n\t\t\tright: 0;\n\t\t\tcolor: black;\n\t\t\tbackground: none;\n\t\t\tborder: none;\n\t\t\ttransform: rotate(45deg);\n\t\t\tcursor: pointer;\n\t\t\toutline: none;\n\t\t\tfont-size: 1.8em;\n\t\t}")}}]),t}(),Free=function(e){function t(e,n,r,o){var a;return _classCallCheck(this,t),(a=_possibleConstructorReturn(this,_getPrototypeOf(t).call(this,e,n))).position=r,a.referrerElement=o,a.stringStyles=a.getStyles(),a.styleElement=a.getStyleTag(a.stringStyles),a}return _inherits(t,WidgetContainer),_createClass(t,[{key:"insert",value:function(){var e=this;return waitForElement("head",function(t){return t.appendChild(e.styleElement)},function(e){return console.error(e)}),waitForElement(this.referrerElement,function(t){return t.insertAdjacentElement(e.position,e.domElement)},function(e){return console.error(e)}),this}},{key:"getStyles",value:function(){return"\n\t\t#".concat(this.widgetContainerId," {\n\t\t\twidth: auto;\n\t\t\theight: auto;\n\t\t\tposition: relative;\n\t\t\tmargin: 0;\n\t\t\tpadding: 0;\n\t\t}\n\t\t#").concat(this.widgetContainerId," .").concat(this.overlayClassName," {\n\t\t\tdisplay: none;\n\t\t}\n\t\t#").concat(this.widgetContainerId," .").concat(this.closeButtonClassName," {\n\t\t\tposition: absolute;\n\t\t\ttop: 0;\n\t\t\tright: 0;\n\t\t\tcolor: black;\n\t\t\tbackground: none;\n\t\t\tborder: none;\n\t\t\ttransform: rotate(45deg);\n\t\t\tcursor: pointer;\n\t\t\toutline: none;\n\t\t\tfont-size: 1.8em;\n\t\t}")}}]),t}(),Recurrence=function(){function e(t){var n=t.displayRecurrence,r=t.closingRecurrence,o=t.validationRecurrence,a=t.widgetName,s=t.uniqueId;_classCallCheck(this,e),this.displayRecurrence=parseFloat(n),this.closingRecurrence=parseFloat(r),this.validationRecurrence=parseFloat(o),this.storageName="Rec_".concat(a,"_").concat(s),this.currentRecurrence=this.getCurrentRecurrence()}return _createClass(e,[{key:"getCurrentRecurrence",value:function(){var e={type:!1},t=sessionStorage.getItem(this.storageName)||localStorage.getItem(this.storageName);try{return JSON.parse(t)||e}catch(t){return e}}},{key:"isOver",value:function(){var e=sessionStorage.getItem(this.storageName),t=localStorage.getItem(this.storageName),n=(t?parseFloat(t):0)<(new Date).getTime();return n&&localStorage.removeItem(this.storageName),n&&!t&&!e}},{key:"setRecurrence",value:function(e,t){var n=this,r=this.getTypeOfStorage(e),o=this.getStamp(e),a={type:t,stamp:o},s=this.currentRecurrence.type,i=function(){sessionStorage.getItem(n.storageName)&&sessionStorage.removeItem(n.storageName),localStorage.getItem(n.storageName)&&localStorage.removeItem(n.storageName),r.setItem(n.storageName,JSON.stringify(a))};if(!r)return!1;if(s&&"validation"!==t)if("closing"===t&&"validation"!==s)i();else{if("display"!==t||"validation"===s||"closing"===s)return!1;i()}else i();return o}},{key:"setDisplayRecurrence",value:function(){this.setRecurrence(this.displayRecurrence,"display")}},{key:"setClosingRecurrence",value:function(){this.setRecurrence(this.closingRecurrence,"closing")}},{key:"setValidationRecurrence",value:function(){this.setRecurrence(this.validationRecurrence,"validation")}},{key:"getStamp",value:function(e){return(new Date).getTime()+864e5*e}},{key:"getTypeOfStorage",value:function(e){return!(isNaN(e)||e<0||0!==e&&!e)&&(e>0?window.localStorage:0===e&&window.sessionStorage)}}]),e}(),Trigger=function(){function e(t){var n=t.triggerEvent,r=t.triggerSelector,o=t.triggerDelay;_classCallCheck(this,e),this.event=n,this.selector=r&&r.length?r:"body",this.delay=o}return _createClass(e,[{key:"onPageLoad",value:function(){return new Promise(function(e,t){if("complete"!==document.readyState){var n,r=["DOMContentLoaded",function(){return e(!0)},{passive:!0,once:!0}];(n=window).addEventListener.apply(n,r),setTimeout(function(){var e;return(e=window).removeEventListener.apply(e,r),t(!1)},15e3)}return e(!0)})}},{key:"onClick",value:function(){var e=this,t=document.createElement("style");return t.innerHTML="".concat(this.selector," {\n\t\t\tcursor: pointer !important;\n\t\t\tpointer-events: all !important;\n\t\t}"),document.head.appendChild(t),new Promise(function(n){var r,o=function(t){return _toConsumableArray(document.querySelectorAll(e.selector)).some(function(n){return n.isSameNode(t)||!!t.closest(e.selector)})},a=["click",function(e){return!!o(e.target)&&(document.head.removeChild(t),n(!0))},{passive:!0,once:!0,capture:!0}];(r=document).addEventListener.apply(r,a)})}},{key:"onExitIntent",value:function(){var e=this;return new Promise(function(){var t=_asyncToGenerator(_regeneratorRuntime.mark(function t(n){var r;return _regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r=["mouseleave",function(){if(e.delay){var t=1e3*e.delay;setTimeout(function(){return n(!0)},t)}return n(!0)},{passive:!0,once:!0}],t.next=4,e.onPageLoad();case 4:t.sent&&waitForElement("body",function(e){return e.addEventListener.apply(e,r)});case 6:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}())}},{key:"onDelay",value:function(){var e=this;return new Promise(function(){var t=_asyncToGenerator(_regeneratorRuntime.mark(function t(n){var r;return _regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r=1e3*e.delay,t.next=3,e.onPageLoad();case 3:t.sent&&setTimeout(function(){return n(!0)},r);case 5:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}())}},{key:"onReengage",value:function(){var e=this;return new Promise(function(t){var n=1e3*e.delay,r=n,o=["click","mousemove","scroll","keypress"],a=[function(){return r=n},{passive:!0}];o.forEach(function(e){var t;return(t=document).addEventListener.apply(t,[e].concat(a))});var s=setInterval(function(){r<=0?(t(!0),clearInterval(s),o.forEach(function(e){var t;return(t=document).removeEventListener.apply(t,[e].concat(a))})):r-=100},100)})}},{key:"isTriggered",value:function(){var e=_asyncToGenerator(_regeneratorRuntime.mark(function e(){var t;return _regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=this.event,e.next="pageLoad"===e.t0?3:"click"===e.t0?7:"exitIntent"===e.t0?11:"delay"===e.t0?15:"reengage"===e.t0?19:23;break;case 3:return e.next=5,this.onPageLoad();case 5:return t=e.sent,e.abrupt("break",24);case 7:return e.next=9,this.onClick();case 9:return t=e.sent,e.abrupt("break",24);case 11:return e.next=13,this.onExitIntent();case 13:return t=e.sent,e.abrupt("break",24);case 15:return e.next=17,this.onDelay();case 17:return t=e.sent,e.abrupt("break",24);case 19:return e.next=21,this.onReengage();case 21:return t=e.sent,e.abrupt("break",24);case 23:t=!1;case 24:return e.abrupt("return",t);case 25:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()}]),e}();function preventGlobalScroll(){var e=document.querySelector("body");originalBodyScroll=window.getComputedStyle(e).overflowY,e.style.overflowY="hidden"}function allowGlobalScroll(){originalBodyScroll&&(document.querySelector("body").style.overflowY=originalBodyScroll)}var loadImage=function(e){return new Promise(function(t,n){var r=new Image;r.onload=function(){t(r)},r.src=e,r.onerror=function(t){var r=new Error("Image ".concat(e," is not loaded."));n(r)}})},isTouch=function(){return void 0!==window.ontouchstart},exitIntent=function(e){var t,n=0;document.addEventListener("mousemove",function(e){n=e.clientY}),document.body.addEventListener("mouseleave",function r(o){o.clientY<=50&&(n=0,clearInterval(t),t=setTimeout(function(){0===n&&(e(),document.removeEventListener("mouseleave",r))},0))},!1)},log=function(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];n.unshift("[AB Tasty Widget] ".concat(PACKAGE,":")),(e=console).log.apply(e,n)},domReady=function(e){"loading"!==document.readyState?e():document.addEventListener("DOMContentLoaded",e)},waitForElement=function(e,t,n){var r,o=0;try{document.querySelector(e)}catch(t){var a="Selector «".concat(e,"» not valid.");return log(a),"function"==typeof n&&n(a)}r=setTimeout(function(){clearInterval(o);var t="Can't find element «".concat(e,"».");return log(t),"function"==typeof n&&n(t)},1e4),o=setInterval(function(){var n=document.querySelector(e);if(null!==n)return clearTimeout(r),clearInterval(o),"function"==typeof t&&t(n)},200)},getCookie=function(e){for(var t=e+"=",n=document.cookie.split(";"),r=0;r<n.length;r++){for(var o=n[r];" "==o.charAt(0);)o=o.substring(1);if(0===o.indexOf(t))return o.substring(t.length,o.length)}return""},getHostname=function(){var e=document.location.hostname.split("").reverse().join("");null===(e=e.match(/(?:[a-z]{2,4}\.[a-z]{2,3}|[a-z]{2,5})\.[a-z0-9\-]+(?:\.|$)/i))?e=document.location.hostname:("."!=e[0].substr(e[0].length-1)&&(e[0]+="."),e=e[0].split("").reverse().join(""));return e},setCookie=function(e,t,n){var r="";if(n){var o=new Date;o.setTime(o.getTime()+24*n*60*60*1e3),r="expires="+o.toUTCString()}var a="domain="+getHostname();document.cookie=e+"="+t+"; "+r+";"+a+";path=/"};exports.preventGlobalScroll=preventGlobalScroll,exports.allowGlobalScroll=allowGlobalScroll,exports.loadImage=loadImage,exports.isTouch=isTouch,exports.exitIntent=exitIntent,exports.log=log,exports.domReady=domReady,exports.waitForElement=waitForElement,exports.getCookie=getCookie,exports.getHostname=getHostname,exports.setCookie=setCookie,exports.closingRecurrenceForm=closingRecurrenceForm,exports.displayRecurrenceForm=displayRecurrenceForm,exports.validationRecurrenceForm=validationRecurrenceForm,exports.recurrencesGroup=recurrencesGroup,exports.triggersForm=triggersForm,exports.triggersGroup=triggersGroup,exports.isOnEditor=isOnEditor,exports.syncRequest=syncRequest,exports.asyncRequest=asyncRequest,exports.backgroundColorForm=backgroundColorForm,exports.backgroundImageForm=backgroundImageForm,exports.backgroundOpacityForm=backgroundOpacityForm,exports.backgroundsGroup=backgroundsGroup,exports.borderColorForm=borderColorForm,exports.borderRadiusForm=borderRadiusForm,exports.borderWidthForm=borderWidthForm,exports.bordersGroup=bordersGroup,exports.textColorForm=textColorForm,exports.Popin=Popin,exports.Banner=Banner,exports.Free=Free,exports.WidgetContainer=WidgetContainer,exports.Recurrence=Recurrence,exports.Trigger=Trigger,exports.backgroundImageTranslations=backgroundImageTranslations,exports.backgroundColorTranslations=backgroundColorTranslations,exports.backgroundTranslations=backgroundTranslations,exports.backgroundOpacityTranslations=backgroundOpacityTranslations,exports.borderTranslations=borderTranslations,exports.borderColorTranslations=borderColorTranslations,exports.borderRadiusTranslations=borderRadiusTranslations,exports.borderWidthTranslations=borderWidthTranslations,exports.everydayTranslations=everydayTranslations,exports.everyWeekTranslations=everyWeekTranslations,exports.everyMonthTranslations=everyMonthTranslations,exports.everySessionTranslations=everySessionTranslations,exports.everytimeTranslations=everytimeTranslations,exports.oncePerUserTranslations=oncePerUserTranslations,exports.recurrenceTranslations=recurrenceTranslations,exports.displayRecurrenceTranslations=displayRecurrenceTranslations,exports.closingRecurrenceTranslations=closingRecurrenceTranslations,exports.validationRecurrenceTranslations=validationRecurrenceTranslations,exports.textColorTranslations=textColorTranslations,exports.closeButtonColorTranslations=closeButtonColorTranslations,exports.positionTranslations=positionTranslations,exports.topTranslations=topTranslations,exports.bottomTranslations=bottomTranslations,exports.leftTranslations=leftTranslations,exports.rightTranslations=rightTranslations,exports.beforeBeginTranslations=beforeBeginTranslations,exports.afterBeginTranslations=afterBeginTranslations,exports.beforeEndTranslations=beforeEndTranslations,exports.afterEndTranslations=afterEndTranslations,exports.pageLoadTranslations=pageLoadTranslations,exports.clickTranslations=clickTranslations,exports.exitIntentTranslations=exitIntentTranslations,exports.delayTranslations=delayTranslations,exports.reengageInactivityTranslations=reengageInactivityTranslations,exports.triggerOnTranslations=triggerOnTranslations,exports.triggerTranslations=triggerTranslations,exports.selectLayoutTranslations=selectLayoutTranslations,exports.popinTranslations=popinTranslations,exports.bannerTranslations=bannerTranslations,exports.inThePageTranslations=inThePageTranslations,exports.adjustLayoutTranslations=adjustLayoutTranslations,exports.selectElementReferrerTranslations=selectElementReferrerTranslations,exports.relativePositionToElementTranslations=relativePositionToElementTranslations,exports.containerTranslations=containerTranslations,exports.paddingTranslations=paddingTranslations,exports.horizontalPaddingTranslations=horizontalPaddingTranslations,exports.verticalPaddingTranslations=verticalPaddingTranslations,exports.marginTranslations=marginTranslations,exports.horiziontalMarginTranslations=horiziontalMarginTranslations,exports.verticalMarginTranslations=verticalMarginTranslations,exports.buttonsStylesTranslations=buttonsStylesTranslations,exports.buttonsContrastTranslations=buttonsContrastTranslations,exports.buttonsShapeTranslations=buttonsShapeTranslations,exports.buttonsBackgroundColorTranslations=buttonsBackgroundColorTranslations,exports.buttonsTextColorTranslations=buttonsTextColorTranslations,exports.buttonsBorderColorTranslations=buttonsBorderColorTranslations,exports.buttonsBorderWidthTranslations=buttonsBorderWidthTranslations,exports.overlayOpacityTranslations=overlayOpacityTranslations,exports.dropShadowTranslations=dropShadowTranslations,exports.shadowOpacityTranslations=shadowOpacityTranslations,exports.STYLE=STYLE,exports.LAYOUT=LAYOUT,exports.CONTENT=CONTENT,exports.CONDITIONS=CONDITIONS,exports.GROUP=GROUP,exports.CHECKBOX=CHECKBOX,exports.COLOR_PICKER=COLOR_PICKER,exports.SEPARATOR=SEPARATOR,exports.DATE_PICKER=DATE_PICKER,exports.DATE_RANGE_PICKER=DATE_RANGE_PICKER,exports.SELECT=SELECT,exports.MEDIA_UPLOAD=MEDIA_UPLOAD,exports.NUMBER=NUMBER,exports.RADIO_BUTTON=RADIO_BUTTON,exports.RADIO_IMAGE=RADIO_IMAGE,exports.SLIDER=SLIDER,exports.SWITCH=SWITCH,exports.TEXT_FIELD=TEXT_FIELD,exports.TEXT_AREA=TEXT_AREA,exports.TIME_PICKER=TIME_PICKER,exports.SELECT_ELEMENT=SELECT_ELEMENT,exports.WYSIWYG=WYSIWYG,exports.HIDDEN=HIDDEN;

@@ -1,1 +0,1 @@

import _defineProperty from"@babel/runtime/helpers/defineProperty";import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";import _classCallCheck from"@babel/runtime/helpers/classCallCheck";import _createClass from"@babel/runtime/helpers/createClass";import _possibleConstructorReturn from"@babel/runtime/helpers/possibleConstructorReturn";import _getPrototypeOf from"@babel/runtime/helpers/getPrototypeOf";import _inherits from"@babel/runtime/helpers/inherits";import _regeneratorRuntime from"@babel/runtime/regenerator";import _asyncToGenerator from"@babel/runtime/helpers/asyncToGenerator";var backgroundTranslations={en:"Background",fr:"Fond",es:"Fondo",de:"Hintergrund"},backgroundColorTranslations={en:"Background color",fr:"Couleur de fond",es:"Color de fondo",de:"Hintergrundfarbe"},backgroundImageTranslations={en:"Background image",fr:"Image de fond",es:"Imagen de fondo",de:"Hintergrundbild"},backgroundOpacityTranslations={en:"Background opacity",fr:"Opacité du fond",es:"Opacidad de fondo",de:"Hintergrundopazität"},borderTranslations={en:"Border",fr:"Contour",es:"Borde",de:"Grenze"},borderColorTranslations={en:"Border color",fr:"Couleur du contour",es:"Color del contorno",de:"Farbe der Kontur"},borderRadiusTranslations={en:"Border radius",fr:"Arrondi du contour",es:"Contorno redondeado",de:"Abgerundeter Umriss"},borderWidthTranslations={en:"Border width",fr:"Épaisseur du contour",es:"Espesor del contorno",de:"Dicke der Kontur"},everydayTranslations={en:"Everyday",fr:"Chaque jour",es:"Cada día",de:"Jeden Tag"},everyWeekTranslations={en:"Every week",fr:"Chaque semaine",es:"Cada semana",de:"Jede Woche"},everyMonthTranslations={en:"Every month",fr:"Chaque mois",es:"Cada mes",de:"Jeden Monat"},everySessionTranslations={en:"Every session",fr:"Chaque session",es:"En cada sesión",de:"Jede Session"},everytimeTranslations={en:"Every time",fr:"Tout le temps",es:"Cada vez",de:"Jedes Mal"},oncePerUserTranslations={en:"Once per user (no recurrence)",fr:"Une fois par visiteur (pas de récurrence)",es:"Una vez por usuario (sin recurrencia)",de:"Einmal pro User (keine Wiederholung)"},recurrenceTranslations={en:"Recurrence",fr:"Récurrence",es:"Recurrencia",de:"Wiederholung"},displayRecurrenceTranslations={en:"".concat(recurrenceTranslations.en," of the display"),fr:"".concat(recurrenceTranslations.fr," de l'affichage"),es:"".concat(recurrenceTranslations.es," de la pantalla"),de:"".concat(recurrenceTranslations.de," der Anzeige")},closingRecurrenceTranslations={en:"".concat(recurrenceTranslations.en," after closure"),fr:"".concat(recurrenceTranslations.fr," après fermeture"),es:"".concat(recurrenceTranslations.es," después del cierre"),de:"".concat(recurrenceTranslations.de," nach Schließung")},validationRecurrenceTranslations={en:"".concat(recurrenceTranslations.en," after validation"),fr:"".concat(recurrenceTranslations.fr," après validation"),es:"".concat(recurrenceTranslations.es," después de la validación"),de:"".concat(recurrenceTranslations.de," nach der Validierung")},textColorTranslations={en:"Text color",fr:"Couleur du texte",es:"Color de texto",de:"Textfarbe"},closeButtonColorTranslations={en:"Close button color",fr:"Couleur du bouton de fermeture",es:"Color del botón de cierre",de:"Farbe der Schließen-Schaltfläche"},positionTranslations={en:"Position",fr:"Position",es:"Posición",de:"Position"},topTranslations={en:"Top",fr:"Haut",es:"Arriba",de:"Oben"},bottomTranslations={en:"Bottom",fr:"Bas",es:"Abajo",de:"Unten"},leftTranslations={en:"Left",fr:"Gauche",es:"Izquierda",de:"Links"},rightTranslations={en:"Right",fr:"Droite",es:"Derecha",de:"Recht"},beforeBeginTranslations={en:"Before begin",fr:"Avant",es:"Antes",de:"Vor"},afterBeginTranslations={en:"After begin",fr:"Au début",es:"Al principio",de:"Früh"},beforeEndTranslations={en:"Before end",fr:"À la fin",es:"Al final",de:"Am ende"},afterEndTranslations={en:"After end",fr:"Après",es:"Después",de:"Nach"},pageLoadTranslations={en:"Page load",fr:"Chargement de la page",es:"Carga de página",de:"Seite laden"},clickTranslations={en:"Click",fr:"Clic",es:"Clic",de:"Klicken"},exitIntentTranslations={en:"Exit intent",fr:"Avant fermeture de l'onglet",es:"Intención de salida",de:"Absicht beenden"},delayTranslations={en:"Delay",fr:"Délai",es:"Retrasar",de:"Verzögern"},reengageInactivityTranslations={en:"Reengage (after inactivity)",fr:"Réengagement (après inactivité)",es:"Despues de inactividad",de:"Nach Untätigkeit"},triggerOnTranslations={en:"Triggers on",fr:"Se déclenche au",es:"Disparadores en",de:"Löst aus"},triggerTranslations={en:"Trigger",fr:"Déclencheur",es:"Desencadenar",de:"Auslösen"},selectLayoutTranslations={en:"Select a layout",fr:"Sélectionnez une mise en page",es:"Seleccione un diseño",de:"Wählen Sie ein Layout"},popinTranslations={en:"Popin",fr:"Popin",es:"Popin",de:"Popin"},bannerTranslations={en:"Banner",fr:"Bannière",es:"Bandera",de:"Banner"},inThePageTranslations={en:"In the page",fr:"Dans la page",es:"En la pagina",de:"In der Seite"},adjustLayoutTranslations={en:"Adjust the layout",fr:"Ajuster le placement",es:"Ajustar la posición",de:"Position einstellen"},selectElementReferrerTranslations={en:"Select an element as referrer",fr:"Sélectionnez un élément de référence",es:"Seleccione un elemento de referencia",de:"Wählen Sie ein Referenzelement"},relativePositionToElementTranslations={en:"Position relative to the element",fr:"Position par rapport à l'élément",es:"Posición relativa al elemento",de:"Position relativ zum Element"},containerTranslations={en:"Container",fr:"Conteneur",es:"Container",de:"Container"},paddingTranslations={en:"Padding",fr:"Padding",es:"Padding",de:"Padding"},horizontalPaddingTranslations={en:"Horizontal padding",fr:"Padding horizontal",es:"Relleno horizontal",de:"Horizontale Polsterung"},verticalPaddingTranslations={en:"Vertical padding",fr:"Padding vertical",es:"Acolchado vertical",de:"Vertikale Polsterung"},marginTranslations={en:"Margin",fr:"Marges",es:"Márgenes",de:"Spanne"},horiziontalMarginTranslations={en:"Horizontal margin",fr:"Marges horizontales",es:"Margen horizontal",de:"Horizontaler Rand"},verticalMarginTranslations={en:"Vertical margin",fr:"Marges verticales",es:"Margen vertical",de:"Vertikaler Rand"},buttonsStylesTranslations={en:"Buttons style",fr:"Style des boutons",es:"Estilo de botón",de:"Schaltflächenstil"},buttonsContrastTranslations={en:"Buttons contrast",fr:"Contraste des boutons",es:"Contraste de los botones",de:"Kontrast der Tasten"},buttonsShapeTranslations={en:"Buttons shape",fr:"Forme des boutons",es:"Forma de boton",de:"Knopfform"},buttonsBackgroundColorTranslations={en:"Buttons background color",fr:"Couleur de fond des boutons",es:"Color de fondo de los botones",de:"Hintergrundfarbe der Tasten"},buttonsTextColorTranslations={en:"Buttons text color",fr:"Couleur de texte des boutons",es:"Color del texto de los botones",de:"Textfarbe der Schaltflächen"},buttonsBorderColorTranslations={en:"Buttons border color",fr:"Couleur du contour des boutons",es:"Color del contorno de los botones",de:"Farbe der Schaltflächenkontur"},buttonsBorderWidthTranslations={en:"Buttons border thickness",fr:"Épaisseur du contour des boutons",es:"Grosor del contorno de los botones",de:"Stärke des Umrisses der Schaltflächen"},overlayOpacityTranslations={en:"Overlay opacity",fr:"Opacité de l'overlay",es:"Opacidad superpuesta",de:"Deckkraft überlagern"},dropShadowTranslations={en:"Drop shadow",fr:"Ombre portée",es:"Sombra",de:"Schatten"},shadowOpacityTranslations={en:"Shadow opacity",fr:"Opacité de l'ombre",es:"Opacidad de las sombras",de:"Schattenopazität"},STYLE="style",LAYOUT="layout",CONTENT="content",CONDITIONS="conditions",GROUP="group",CHECKBOX="checkbox",COLOR_PICKER="colorpicker",SEPARATOR="separator",DATE_PICKER="datepicker",DATE_RANGE_PICKER="dateRangePicker",SELECT="select",MEDIA_UPLOAD="mediaupload",NUMBER="number",RADIO_BUTTON="radio",RADIO_IMAGE="radioImage",SLIDER="slider",SWITCH="switch",TEXT_FIELD="text",TEXT_AREA="textarea",TIME_PICKER="timepicker",SELECT_ELEMENT="selectelement",WYSIWYG="wysiwyg",HIDDEN="hidden",recurrencesOptions=[{label:everytimeTranslations,value:"-1"},{label:everySessionTranslations,value:"0"},{label:everydayTranslations,value:"1"},{label:everyWeekTranslations,value:"7"},{label:everyMonthTranslations,value:"30"},{label:oncePerUserTranslations,value:"365"}];function ownKeys(e,t){var n=Object.keys(e);return Object.getOwnPropertySymbols&&n.push.apply(n,Object.getOwnPropertySymbols(e)),t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(n,!0).forEach(function(t){_defineProperty(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ownKeys(n).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var commons={category:CONDITIONS,type:SELECT,options:recurrencesOptions,value:"-1"},closingRecurrenceForm=_objectSpread({},commons,{label:closingRecurrenceTranslations,propName:"closingRecurrence"}),displayRecurrenceForm=_objectSpread({},commons,{label:displayRecurrenceTranslations,propName:"displayRecurrence"}),validationRecurrenceForm=_objectSpread({},commons,{label:validationRecurrenceTranslations,propName:"validationRecurrence"}),recurrencesGroup={category:CONDITIONS,type:GROUP,label:recurrenceTranslations,collapsible:!0,children:[displayRecurrenceForm,closingRecurrenceForm,validationRecurrenceForm]},triggersOptions=[{label:pageLoadTranslations,value:"pageLoad"},{label:clickTranslations,value:"click"},{label:exitIntentTranslations,value:"exitIntent"},{label:delayTranslations,value:"delay"},{label:reengageInactivityTranslations,value:"reengage"}],TRIGGER_EVENT="triggerEvent",triggerEventClick={category:CONDITIONS,type:SELECT_ELEMENT,propName:"".concat(TRIGGER_EVENT,"Click"),label:triggerTranslations,placeholder:{en:"Select an element in the webpage",fr:"Sélectionner un élément dans la page",es:"Selecciona un elemento en la página web",de:"Wählen Sie ein Element auf der Webseite aus"},conditions:[{field:TRIGGER_EVENT,value:"click"}]},triggerEventExitDelay={category:CONDITIONS,type:NUMBER,propName:"".concat(TRIGGER_EVENT,"ExitDelay"),label:{en:"Delay after exit intent",fr:"Délai après intention de sortie",es:"Retraso después de la intención de salida",de:"Verzögerung nach Ausstiegsabsicht"},min:0,max:120,value:0,conditions:[{field:TRIGGER_EVENT,value:"exitIntent"}]},triggerEventReengageDelay={category:CONDITIONS,type:NUMBER,propName:"".concat(TRIGGER_EVENT,"ReengageDelay"),label:{en:"Idle timeout before posting",fr:"Délai d'inactivité avant l'affichage",es:"Tiempo de espera inactivo antes de publicar",de:"Zeitüberschreitung vor dem Posten"},min:1,max:120,value:10,conditions:[{field:TRIGGER_EVENT,value:"reengage"}]},triggerEventDelay={category:CONDITIONS,type:NUMBER,propName:"".concat(TRIGGER_EVENT,"Delay"),label:{en:"Trigger event delay (in seconds)",fr:"Délai avant l'affichage (en secondes)",es:"",de:"Verzögerung vor dem Posten"},value:10,conditions:[{field:TRIGGER_EVENT,value:"delay"}]},conditionalFields=[triggerEventClick,triggerEventExitDelay,triggerEventReengageDelay,triggerEventDelay],triggersForm={category:CONDITIONS,type:SELECT,label:triggerOnTranslations,options:triggersOptions,propName:TRIGGER_EVENT,value:"pageLoad"},triggersGroup={category:CONDITIONS,type:GROUP,label:triggerTranslations,collapsible:!0,children:[triggersForm].concat(_toConsumableArray(conditionalFields))},isOnEditor=function(){return Object.prototype.hasOwnProperty.call(window,"ABTastyEditor")};function syncRequest(e,t){var n=new XMLHttpRequest;return n.open(e,t,!1),n.send(null),n}function asyncRequest(e,t){return new Promise(function(n,r){var a=new XMLHttpRequest;a.open(e,t,!0),a.onload=function(){this.status>=200&&this.status<300?n(a.response):r({status:this.status,statusText:a.statusText})},a.onerror=function(){r({status:this.status,statusText:a.statusText})},a.send()})}var originalBodyScroll,backgroundColorForm={category:STYLE,type:COLOR_PICKER,label:backgroundColorTranslations,propName:"backgroundColor",value:"rgba(255, 255, 255, 1)"},backgroundImageForm={category:STYLE,type:MEDIA_UPLOAD,label:backgroundImageTranslations,propName:"backgroundImage",value:""},backgroundOpacityForm={category:STYLE,type:SLIDER,label:backgroundOpacityTranslations,propName:"backgroundOpacity",value:75,unit:"%"},backgroundsGroup={category:STYLE,type:GROUP,label:backgroundTranslations,collapsible:!0,children:[backgroundColorForm,backgroundImageForm,backgroundOpacityForm]},borderColorForm={category:STYLE,type:COLOR_PICKER,label:borderColorTranslations,propName:"borderColor",value:"rgba(255, 255, 255, 1)"},borderRadiusForm={category:STYLE,type:SLIDER,label:borderRadiusTranslations,propName:"borderRadius",value:0,unit:"px"},borderWidthForm={category:STYLE,type:SLIDER,label:borderWidthTranslations,propName:"borderWidth",value:0,unit:"px"},bordersGroup={category:STYLE,type:GROUP,label:borderTranslations,collapsible:!0,children:[borderWidthForm,borderColorForm,borderRadiusForm]},textColorForm={category:STYLE,type:COLOR_PICKER,label:textColorTranslations,propName:"textColor",value:"rgba(255, 255, 255, 1)"},WidgetContainer=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"000000",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";_classCallCheck(this,e),this.uniqueId=t,this.widgetContainer=n,this.basicClassName="ab_widget_container_".concat(n),this.widgetContainerId="".concat(this.basicClassName,"_").concat(t),this.contentClassName="".concat(this.basicClassName,"_content"),this.overlayClassName="".concat(this.basicClassName,"_overlay"),this.closeButtonClassName="".concat(this.basicClassName,"_close_button"),this.hideClassName="ab_hide_".concat(t),this.domElement=this.getDom()}return _createClass(e,[{key:"insert",value:function(){var e=this;return waitForElement("head",function(t){return t.appendChild(e.styleElement)},function(e){return console.error(e)}),waitForElement("body",function(t){return t.appendChild(e.domElement)},function(e){return console.error(e)}),this}},{key:"remove",value:function(){return this.domElement.remove(),this.styleElement.remove(),this}},{key:"show",value:function(){return this.domElement.classList.remove(this.hideClassName),this}},{key:"hide",value:function(){return this.domElement.classList.add(this.hideClassName),this}},{key:"init",value:function(){return this.insert(),this.addCloseEvent(),this}},{key:"addCloseEvent",value:function(){for(var e=this,t=this.domElement.querySelectorAll("\n\t\t\t.".concat(this.overlayClassName,",\n\t\t\t.").concat(this.closeButtonClassName,"\n\t\t")),n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return r.push.apply(r,_toConsumableArray(t)),r.forEach(function(t){t.addEventListener("click",function(){e.hide()},!0)}),this}},{key:"getDom",value:function(){var e=document.createElement("div");return e.className="".concat(this.basicClassName," ").concat(this.hideClassName),e.id=this.widgetContainerId,e.innerHTML='\n\t\t\t<div class="'.concat(this.overlayClassName,'"></div>\n\t\t\t<div class="').concat(this.contentClassName,'">\n\t\t\t\t<button class="').concat(this.closeButtonClassName,'" ').concat(isOnEditor()?"data-abtasty-actionnable":"",">+</button>\n\t\t\t</div>"),e}},{key:"getStyleTag",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=document.createElement("style");return t.type="text/css",isOnEditor()&&t.setAttribute("abtasty-script-added","true"),t.textContent="\n\t\t\t.".concat(this.hideClassName," {opacity: 0 !important; pointer-events: none;}\n\t\t\t").concat(e),t}}]),e}(),Popin=function(e){function t(e,n){var r;return _classCallCheck(this,t),(r=_possibleConstructorReturn(this,_getPrototypeOf(t).call(this,e,n))).stringStyles=r.getStyles(),r.styleElement=r.getStyleTag(r.stringStyles),r}return _inherits(t,WidgetContainer),_createClass(t,[{key:"getStyles",value:function(){return"\n\t\t#".concat(this.widgetContainerId," {\n\t\t\tposition: fixed;\n\t\t\ttop: 0;\n\t\t\tleft: 0;\n\t\t\twidth: 100%;\n\t\t\theight: 100%;\n\t\t\tz-index: 9999;\n\t\t\topacity: 1;\n\t\t\ttransition: opacity 0.25s ease;\n\t\t}\n\t\t#").concat(this.widgetContainerId," .").concat(this.overlayClassName," {\n\t\t\tposition: absolute;\n\t\t\tz-index: -1;\n\t\t\ttop: 0;\n\t\t\tleft: 0;\n\t\t\twidth: 100%;\n\t\t\theight: 100%;\n\t\t\tbackground-color: black;\n\t\t\topacity: 0.6;\n\t\t}\n\t\t#").concat(this.widgetContainerId," .").concat(this.contentClassName," {\n\t\t\tposition: absolute;\n\t\t\tleft: 50%;\n\t\t\ttop: 50%;\n\t\t\ttransform: translate(-50%, -50%);\n\t\t\twidth: auto;\n\t\t\theight: auto;\n\t\t}\n\t\t#").concat(this.widgetContainerId," .").concat(this.closeButtonClassName," {\n\t\t\tposition: absolute;\n\t\t\ttop: 0;\n\t\t\tright: 0;\n\t\t\tcolor: black;\n\t\t\tbackground: none;\n\t\t\tborder: none;\n\t\t\ttransform: rotate(45deg);\n\t\t\tcursor: pointer;\n\t\t\toutline: none;\n\t\t\tfont-size: 1.8em;\n\t\t}")}}]),t}(),Banner=function(e){function t(e,n,r){var a;return _classCallCheck(this,t),(a=_possibleConstructorReturn(this,_getPrototypeOf(t).call(this,e,n))).position=r,a.stringStyles=a.getStyles(),a.styleElement=a.getStyleTag(a.stringStyles),a}return _inherits(t,WidgetContainer),_createClass(t,[{key:"getStyles",value:function(){return"\n\t\t#".concat(this.widgetContainerId," {\n\t\t\tposition: fixed;\n\t\t\t").concat(this.position,": 0;\n\t\t\tleft: 0;\n\t\t\twidth: 100%;\n\t\t\theight: auto;\n\t\t\tz-index: 9999;\n\t\t\topacity: 1;\n\t\t\ttransition: opacity 0.25s ease;\n\t\t}\n\t\t#").concat(this.widgetContainerId," .").concat(this.overlayClassName," {\n\t\t\tdisplay: none;\n\t\t}\n\t\t#").concat(this.widgetContainerId," .").concat(this.closeButtonClassName," {\n\t\t\tposition: absolute;\n\t\t\ttop: 0;\n\t\t\tright: 0;\n\t\t\tcolor: black;\n\t\t\tbackground: none;\n\t\t\tborder: none;\n\t\t\ttransform: rotate(45deg);\n\t\t\tcursor: pointer;\n\t\t\toutline: none;\n\t\t\tfont-size: 1.8em;\n\t\t}")}}]),t}(),Free=function(e){function t(e,n,r,a){var o;return _classCallCheck(this,t),(o=_possibleConstructorReturn(this,_getPrototypeOf(t).call(this,e,n))).position=r,o.referrerElement=a,o.stringStyles=o.getStyles(),o.styleElement=o.getStyleTag(o.stringStyles),o}return _inherits(t,WidgetContainer),_createClass(t,[{key:"insert",value:function(){var e=this;return waitForElement("head",function(t){return t.appendChild(e.styleElement)},function(e){return console.error(e)}),waitForElement(this.referrerElement,function(t){return t.insertAdjacentElement(e.position,e.domElement)},function(e){return console.error(e)}),this}},{key:"getStyles",value:function(){return"\n\t\t#".concat(this.widgetContainerId," {\n\t\t\twidth: auto;\n\t\t\theight: auto;\n\t\t\tposition: relative;\n\t\t\tmargin: 0;\n\t\t\tpadding: 0;\n\t\t}\n\t\t#").concat(this.widgetContainerId," .").concat(this.overlayClassName," {\n\t\t\tdisplay: none;\n\t\t}\n\t\t#").concat(this.widgetContainerId," .").concat(this.closeButtonClassName," {\n\t\t\tposition: absolute;\n\t\t\ttop: 0;\n\t\t\tright: 0;\n\t\t\tcolor: black;\n\t\t\tbackground: none;\n\t\t\tborder: none;\n\t\t\ttransform: rotate(45deg);\n\t\t\tcursor: pointer;\n\t\t\toutline: none;\n\t\t\tfont-size: 1.8em;\n\t\t}")}}]),t}(),Recurrence=function(){function e(t){var n=t.displayRecurrence,r=t.closingRecurrence,a=t.validationRecurrence,o=t.widgetName;_classCallCheck(this,e),this.displayRecurrence=parseFloat(n),this.closingRecurrence=parseFloat(r),this.validationRecurrence=parseFloat(a),this.storageName="Rec_".concat(o,"_").concat(PLUGIN_ID),this.currentRecurrence=this.getCurrentRecurrence()}return _createClass(e,[{key:"getCurrentRecurrence",value:function(){var e={type:!1},t=sessionStorage.getItem(this.storageName)||localStorage.getItem(this.storageName);try{return JSON.parse(t)||e}catch(t){return e}}},{key:"isOver",value:function(){var e=sessionStorage.getItem(this.storageName),t=localStorage.getItem(this.storageName),n=(t?parseFloat(t):0)<(new Date).getTime();return n&&localStorage.removeItem(this.storageName),n&&!t&&!e}},{key:"setRecurrence",value:function(e,t){var n=this,r=this.getTypeOfStorage(e),a=this.getStamp(e),o={type:t,stamp:a},s=this.currentRecurrence.type,i=function(){sessionStorage.getItem(n.storageName)&&sessionStorage.removeItem(n.storageName),localStorage.getItem(n.storageName)&&localStorage.removeItem(n.storageName),r.setItem(n.storageName,JSON.stringify(o))};if(!r)return!1;if(s&&"validation"!==t)if("closing"===t&&"validation"!==s)i();else{if("display"!==t||"validation"===s||"closing"===s)return!1;i()}else i();return a}},{key:"setDisplayRecurrence",value:function(){this.setRecurrence(this.displayRecurrence,"display")}},{key:"setClosingRecurrence",value:function(){this.setRecurrence(this.closingRecurrence,"closing")}},{key:"setValidationRecurrence",value:function(){this.setRecurrence(this.validationRecurrence,"validation")}},{key:"getStamp",value:function(e){return(new Date).getTime()+864e5*e}},{key:"getTypeOfStorage",value:function(e){return!(isNaN(e)||e<0||0!==e&&!e)&&(e>0?window.localStorage:0===e&&window.sessionStorage)}}]),e}(),Trigger=function(){function e(t){var n=t.triggerEvent,r=t.triggerSelector,a=t.triggerDelay;_classCallCheck(this,e),this.event=n,this.selector=r&&r.length?r:"body",this.delay=a}return _createClass(e,[{key:"onPageLoad",value:function(){return new Promise(function(e,t){if("complete"!==document.readyState){var n,r=["DOMContentLoaded",function(){return e(!0)},{passive:!0,once:!0}];(n=window).addEventListener.apply(n,r),setTimeout(function(){var e;return(e=window).removeEventListener.apply(e,r),t(!1)},15e3)}return e(!0)})}},{key:"onClick",value:function(){var e=this,t=document.createElement("style");return t.innerHTML="".concat(this.selector," {\n\t\t\tcursor: pointer !important;\n\t\t\tpointer-events: all !important;\n\t\t}"),document.head.appendChild(t),new Promise(function(n){var r,a=function(t){return _toConsumableArray(document.querySelectorAll(e.selector)).some(function(n){return n.isSameNode(t)||!!t.closest(e.selector)})},o=["click",function(e){return!!a(e.target)&&(document.head.removeChild(t),n(!0))},{passive:!0,once:!0,capture:!0}];(r=document).addEventListener.apply(r,o)})}},{key:"onExitIntent",value:function(){var e=this;return new Promise(function(){var t=_asyncToGenerator(_regeneratorRuntime.mark(function t(n){var r;return _regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r=["mouseleave",function(){if(e.delay){var t=1e3*e.delay;setTimeout(function(){return n(!0)},t)}return n(!0)},{passive:!0,once:!0}],t.next=4,e.onPageLoad();case 4:t.sent&&waitForElement("body",function(e){return e.addEventListener.apply(e,r)});case 6:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}())}},{key:"onDelay",value:function(){var e=this;return new Promise(function(){var t=_asyncToGenerator(_regeneratorRuntime.mark(function t(n){var r;return _regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r=1e3*e.delay,t.next=3,e.onPageLoad();case 3:t.sent&&setTimeout(function(){return n(!0)},r);case 5:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}())}},{key:"onReengage",value:function(){var e=this;return new Promise(function(t){var n=1e3*e.delay,r=n,a=["click","mousemove","scroll","keypress"],o=[function(){return r=n},{passive:!0}];a.forEach(function(e){var t;return(t=document).addEventListener.apply(t,[e].concat(o))});var s=setInterval(function(){r<=0?(t(!0),clearInterval(s),a.forEach(function(e){var t;return(t=document).removeEventListener.apply(t,[e].concat(o))})):r-=100},100)})}},{key:"isTriggered",value:function(){var e=_asyncToGenerator(_regeneratorRuntime.mark(function e(){var t;return _regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=this.event,e.next="pageLoad"===e.t0?3:"click"===e.t0?7:"exitIntent"===e.t0?11:"delay"===e.t0?15:"reengage"===e.t0?19:23;break;case 3:return e.next=5,this.onPageLoad();case 5:return t=e.sent,e.abrupt("break",24);case 7:return e.next=9,this.onClick();case 9:return t=e.sent,e.abrupt("break",24);case 11:return e.next=13,this.onExitIntent();case 13:return t=e.sent,e.abrupt("break",24);case 15:return e.next=17,this.onDelay();case 17:return t=e.sent,e.abrupt("break",24);case 19:return e.next=21,this.onReengage();case 21:return t=e.sent,e.abrupt("break",24);case 23:t=!1;case 24:return e.abrupt("return",t);case 25:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()}]),e}();function preventGlobalScroll(){var e=document.querySelector("body");originalBodyScroll=window.getComputedStyle(e).overflowY,e.style.overflowY="hidden"}function allowGlobalScroll(){originalBodyScroll&&(document.querySelector("body").style.overflowY=originalBodyScroll)}var loadImage=function(e){return new Promise(function(t,n){var r=new Image;r.onload=function(){t(r)},r.src=e,r.onerror=function(t){var r=new Error("Image ".concat(e," is not loaded."));n(r)}})},isTouch=function(){return void 0!==window.ontouchstart},exitIntent=function(e){var t,n=0;document.addEventListener("mousemove",function(e){n=e.clientY}),document.body.addEventListener("mouseleave",function r(a){a.clientY<=50&&(n=0,clearInterval(t),t=setTimeout(function(){0===n&&(e(),document.removeEventListener("mouseleave",r))},0))},!1)},log=function(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];n.unshift("[AB Tasty Widget] ".concat(PACKAGE,":")),(e=console).log.apply(e,n)},domReady=function(e){"loading"!==document.readyState?e():document.addEventListener("DOMContentLoaded",e)},waitForElement=function(e,t,n){var r,a=0;try{document.querySelector(e)}catch(t){var o="Selector «".concat(e,"» not valid.");return log(o),"function"==typeof n&&n(o)}r=setTimeout(function(){clearInterval(a);var t="Can't find element «".concat(e,"».");return log(t),"function"==typeof n&&n(t)},1e4),a=setInterval(function(){var n=document.querySelector(e);if(null!==n)return clearTimeout(r),clearInterval(a),"function"==typeof t&&t(n)},200)},getCookie=function(e){for(var t=e+"=",n=document.cookie.split(";"),r=0;r<n.length;r++){for(var a=n[r];" "==a.charAt(0);)a=a.substring(1);if(0===a.indexOf(t))return a.substring(t.length,a.length)}return""},getHostname=function(){var e=document.location.hostname.split("").reverse().join("");null===(e=e.match(/(?:[a-z]{2,4}\.[a-z]{2,3}|[a-z]{2,5})\.[a-z0-9\-]+(?:\.|$)/i))?e=document.location.hostname:("."!=e[0].substr(e[0].length-1)&&(e[0]+="."),e=e[0].split("").reverse().join(""));return e},setCookie=function(e,t,n){var r="";if(n){var a=new Date;a.setTime(a.getTime()+24*n*60*60*1e3),r="expires="+a.toUTCString()}var o="domain="+getHostname();document.cookie=e+"="+t+"; "+r+";"+o+";path=/"};export{preventGlobalScroll,allowGlobalScroll,loadImage,isTouch,exitIntent,log,domReady,waitForElement,getCookie,getHostname,setCookie,closingRecurrenceForm,displayRecurrenceForm,validationRecurrenceForm,recurrencesGroup,triggersForm,triggersGroup,isOnEditor,syncRequest,asyncRequest,backgroundColorForm,backgroundImageForm,backgroundOpacityForm,backgroundsGroup,borderColorForm,borderRadiusForm,borderWidthForm,bordersGroup,textColorForm,Popin,Banner,Free,WidgetContainer,Recurrence,Trigger,backgroundImageTranslations,backgroundColorTranslations,backgroundTranslations,backgroundOpacityTranslations,borderTranslations,borderColorTranslations,borderRadiusTranslations,borderWidthTranslations,everydayTranslations,everyWeekTranslations,everyMonthTranslations,everySessionTranslations,everytimeTranslations,oncePerUserTranslations,recurrenceTranslations,displayRecurrenceTranslations,closingRecurrenceTranslations,validationRecurrenceTranslations,textColorTranslations,closeButtonColorTranslations,positionTranslations,topTranslations,bottomTranslations,leftTranslations,rightTranslations,beforeBeginTranslations,afterBeginTranslations,beforeEndTranslations,afterEndTranslations,pageLoadTranslations,clickTranslations,exitIntentTranslations,delayTranslations,reengageInactivityTranslations,triggerOnTranslations,triggerTranslations,selectLayoutTranslations,popinTranslations,bannerTranslations,inThePageTranslations,adjustLayoutTranslations,selectElementReferrerTranslations,relativePositionToElementTranslations,containerTranslations,paddingTranslations,horizontalPaddingTranslations,verticalPaddingTranslations,marginTranslations,horiziontalMarginTranslations,verticalMarginTranslations,buttonsStylesTranslations,buttonsContrastTranslations,buttonsShapeTranslations,buttonsBackgroundColorTranslations,buttonsTextColorTranslations,buttonsBorderColorTranslations,buttonsBorderWidthTranslations,overlayOpacityTranslations,dropShadowTranslations,shadowOpacityTranslations,STYLE,LAYOUT,CONTENT,CONDITIONS,GROUP,CHECKBOX,COLOR_PICKER,SEPARATOR,DATE_PICKER,DATE_RANGE_PICKER,SELECT,MEDIA_UPLOAD,NUMBER,RADIO_BUTTON,RADIO_IMAGE,SLIDER,SWITCH,TEXT_FIELD,TEXT_AREA,TIME_PICKER,SELECT_ELEMENT,WYSIWYG,HIDDEN};
import _defineProperty from"@babel/runtime/helpers/defineProperty";import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";import _classCallCheck from"@babel/runtime/helpers/classCallCheck";import _createClass from"@babel/runtime/helpers/createClass";import _possibleConstructorReturn from"@babel/runtime/helpers/possibleConstructorReturn";import _getPrototypeOf from"@babel/runtime/helpers/getPrototypeOf";import _inherits from"@babel/runtime/helpers/inherits";import _regeneratorRuntime from"@babel/runtime/regenerator";import _asyncToGenerator from"@babel/runtime/helpers/asyncToGenerator";var backgroundTranslations={en:"Background",fr:"Fond",es:"Fondo",de:"Hintergrund"},backgroundColorTranslations={en:"Background color",fr:"Couleur de fond",es:"Color de fondo",de:"Hintergrundfarbe"},backgroundImageTranslations={en:"Background image",fr:"Image de fond",es:"Imagen de fondo",de:"Hintergrundbild"},backgroundOpacityTranslations={en:"Background opacity",fr:"Opacité du fond",es:"Opacidad de fondo",de:"Hintergrundopazität"},borderTranslations={en:"Border",fr:"Contour",es:"Borde",de:"Grenze"},borderColorTranslations={en:"Border color",fr:"Couleur du contour",es:"Color del contorno",de:"Farbe der Kontur"},borderRadiusTranslations={en:"Border radius",fr:"Arrondi du contour",es:"Contorno redondeado",de:"Abgerundeter Umriss"},borderWidthTranslations={en:"Border width",fr:"Épaisseur du contour",es:"Espesor del contorno",de:"Dicke der Kontur"},everydayTranslations={en:"Everyday",fr:"Chaque jour",es:"Cada día",de:"Jeden Tag"},everyWeekTranslations={en:"Every week",fr:"Chaque semaine",es:"Cada semana",de:"Jede Woche"},everyMonthTranslations={en:"Every month",fr:"Chaque mois",es:"Cada mes",de:"Jeden Monat"},everySessionTranslations={en:"Every session",fr:"Chaque session",es:"En cada sesión",de:"Jede Session"},everytimeTranslations={en:"Every time",fr:"Tout le temps",es:"Cada vez",de:"Jedes Mal"},oncePerUserTranslations={en:"Once per user (no recurrence)",fr:"Une fois par visiteur (pas de récurrence)",es:"Una vez por usuario (sin recurrencia)",de:"Einmal pro User (keine Wiederholung)"},recurrenceTranslations={en:"Recurrence",fr:"Récurrence",es:"Recurrencia",de:"Wiederholung"},displayRecurrenceTranslations={en:"".concat(recurrenceTranslations.en," of the display"),fr:"".concat(recurrenceTranslations.fr," de l'affichage"),es:"".concat(recurrenceTranslations.es," de la pantalla"),de:"".concat(recurrenceTranslations.de," der Anzeige")},closingRecurrenceTranslations={en:"".concat(recurrenceTranslations.en," after closure"),fr:"".concat(recurrenceTranslations.fr," après fermeture"),es:"".concat(recurrenceTranslations.es," después del cierre"),de:"".concat(recurrenceTranslations.de," nach Schließung")},validationRecurrenceTranslations={en:"".concat(recurrenceTranslations.en," after validation"),fr:"".concat(recurrenceTranslations.fr," après validation"),es:"".concat(recurrenceTranslations.es," después de la validación"),de:"".concat(recurrenceTranslations.de," nach der Validierung")},textColorTranslations={en:"Text color",fr:"Couleur du texte",es:"Color de texto",de:"Textfarbe"},closeButtonColorTranslations={en:"Close button color",fr:"Couleur du bouton de fermeture",es:"Color del botón de cierre",de:"Farbe der Schließen-Schaltfläche"},positionTranslations={en:"Position",fr:"Position",es:"Posición",de:"Position"},topTranslations={en:"Top",fr:"Haut",es:"Arriba",de:"Oben"},bottomTranslations={en:"Bottom",fr:"Bas",es:"Abajo",de:"Unten"},leftTranslations={en:"Left",fr:"Gauche",es:"Izquierda",de:"Links"},rightTranslations={en:"Right",fr:"Droite",es:"Derecha",de:"Recht"},beforeBeginTranslations={en:"Before begin",fr:"Avant",es:"Antes",de:"Vor"},afterBeginTranslations={en:"After begin",fr:"Au début",es:"Al principio",de:"Früh"},beforeEndTranslations={en:"Before end",fr:"À la fin",es:"Al final",de:"Am ende"},afterEndTranslations={en:"After end",fr:"Après",es:"Después",de:"Nach"},pageLoadTranslations={en:"Page load",fr:"Chargement de la page",es:"Carga de página",de:"Seite laden"},clickTranslations={en:"Click",fr:"Clic",es:"Clic",de:"Klicken"},exitIntentTranslations={en:"Exit intent",fr:"Avant fermeture de l'onglet",es:"Intención de salida",de:"Absicht beenden"},delayTranslations={en:"Delay",fr:"Délai",es:"Retrasar",de:"Verzögern"},reengageInactivityTranslations={en:"Reengage (after inactivity)",fr:"Réengagement (après inactivité)",es:"Despues de inactividad",de:"Nach Untätigkeit"},triggerOnTranslations={en:"Triggers on",fr:"Se déclenche au",es:"Disparadores en",de:"Löst aus"},triggerTranslations={en:"Trigger",fr:"Déclencheur",es:"Desencadenar",de:"Auslösen"},selectLayoutTranslations={en:"Select a layout",fr:"Sélectionnez une mise en page",es:"Seleccione un diseño",de:"Wählen Sie ein Layout"},popinTranslations={en:"Popin",fr:"Popin",es:"Popin",de:"Popin"},bannerTranslations={en:"Banner",fr:"Bannière",es:"Bandera",de:"Banner"},inThePageTranslations={en:"In the page",fr:"Dans la page",es:"En la pagina",de:"In der Seite"},adjustLayoutTranslations={en:"Adjust the layout",fr:"Ajuster le placement",es:"Ajustar la posición",de:"Position einstellen"},selectElementReferrerTranslations={en:"Select an element as referrer",fr:"Sélectionnez un élément de référence",es:"Seleccione un elemento de referencia",de:"Wählen Sie ein Referenzelement"},relativePositionToElementTranslations={en:"Position relative to the element",fr:"Position par rapport à l'élément",es:"Posición relativa al elemento",de:"Position relativ zum Element"},containerTranslations={en:"Container",fr:"Conteneur",es:"Container",de:"Container"},paddingTranslations={en:"Padding",fr:"Padding",es:"Padding",de:"Padding"},horizontalPaddingTranslations={en:"Horizontal padding",fr:"Padding horizontal",es:"Relleno horizontal",de:"Horizontale Polsterung"},verticalPaddingTranslations={en:"Vertical padding",fr:"Padding vertical",es:"Acolchado vertical",de:"Vertikale Polsterung"},marginTranslations={en:"Margin",fr:"Marges",es:"Márgenes",de:"Spanne"},horiziontalMarginTranslations={en:"Horizontal margin",fr:"Marges horizontales",es:"Margen horizontal",de:"Horizontaler Rand"},verticalMarginTranslations={en:"Vertical margin",fr:"Marges verticales",es:"Margen vertical",de:"Vertikaler Rand"},buttonsStylesTranslations={en:"Buttons style",fr:"Style des boutons",es:"Estilo de botón",de:"Schaltflächenstil"},buttonsContrastTranslations={en:"Buttons contrast",fr:"Contraste des boutons",es:"Contraste de los botones",de:"Kontrast der Tasten"},buttonsShapeTranslations={en:"Buttons shape",fr:"Forme des boutons",es:"Forma de boton",de:"Knopfform"},buttonsBackgroundColorTranslations={en:"Buttons background color",fr:"Couleur de fond des boutons",es:"Color de fondo de los botones",de:"Hintergrundfarbe der Tasten"},buttonsTextColorTranslations={en:"Buttons text color",fr:"Couleur de texte des boutons",es:"Color del texto de los botones",de:"Textfarbe der Schaltflächen"},buttonsBorderColorTranslations={en:"Buttons border color",fr:"Couleur du contour des boutons",es:"Color del contorno de los botones",de:"Farbe der Schaltflächenkontur"},buttonsBorderWidthTranslations={en:"Buttons border thickness",fr:"Épaisseur du contour des boutons",es:"Grosor del contorno de los botones",de:"Stärke des Umrisses der Schaltflächen"},overlayOpacityTranslations={en:"Overlay opacity",fr:"Opacité de l'overlay",es:"Opacidad superpuesta",de:"Deckkraft überlagern"},dropShadowTranslations={en:"Drop shadow",fr:"Ombre portée",es:"Sombra",de:"Schatten"},shadowOpacityTranslations={en:"Shadow opacity",fr:"Opacité de l'ombre",es:"Opacidad de las sombras",de:"Schattenopazität"},STYLE="style",LAYOUT="layout",CONTENT="content",CONDITIONS="conditions",GROUP="group",CHECKBOX="checkbox",COLOR_PICKER="colorpicker",SEPARATOR="separator",DATE_PICKER="datepicker",DATE_RANGE_PICKER="dateRangePicker",SELECT="select",MEDIA_UPLOAD="mediaupload",NUMBER="number",RADIO_BUTTON="radio",RADIO_IMAGE="radioImage",SLIDER="slider",SWITCH="switch",TEXT_FIELD="text",TEXT_AREA="textarea",TIME_PICKER="timepicker",SELECT_ELEMENT="selectelement",WYSIWYG="wysiwyg",HIDDEN="hidden",recurrencesOptions=[{label:everytimeTranslations,value:"-1"},{label:everySessionTranslations,value:"0"},{label:everydayTranslations,value:"1"},{label:everyWeekTranslations,value:"7"},{label:everyMonthTranslations,value:"30"},{label:oncePerUserTranslations,value:"365"}];function ownKeys(e,t){var n=Object.keys(e);return Object.getOwnPropertySymbols&&n.push.apply(n,Object.getOwnPropertySymbols(e)),t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(n,!0).forEach(function(t){_defineProperty(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ownKeys(n).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var commons={category:CONDITIONS,type:SELECT,options:recurrencesOptions,value:"-1"},closingRecurrenceForm=_objectSpread({},commons,{label:closingRecurrenceTranslations,propName:"closingRecurrence"}),displayRecurrenceForm=_objectSpread({},commons,{label:displayRecurrenceTranslations,propName:"displayRecurrence"}),validationRecurrenceForm=_objectSpread({},commons,{label:validationRecurrenceTranslations,propName:"validationRecurrence"}),recurrencesGroup={category:CONDITIONS,type:GROUP,label:recurrenceTranslations,collapsible:!0,children:[displayRecurrenceForm,closingRecurrenceForm,validationRecurrenceForm]},triggersOptions=[{label:pageLoadTranslations,value:"pageLoad"},{label:clickTranslations,value:"click"},{label:exitIntentTranslations,value:"exitIntent"},{label:delayTranslations,value:"delay"},{label:reengageInactivityTranslations,value:"reengage"}],TRIGGER_EVENT="triggerEvent",triggerEventClick={category:CONDITIONS,type:SELECT_ELEMENT,propName:"".concat(TRIGGER_EVENT,"Click"),label:triggerTranslations,placeholder:{en:"Select an element in the webpage",fr:"Sélectionner un élément dans la page",es:"Selecciona un elemento en la página web",de:"Wählen Sie ein Element auf der Webseite aus"},conditions:[{field:TRIGGER_EVENT,value:"click"}]},triggerEventExitDelay={category:CONDITIONS,type:NUMBER,propName:"".concat(TRIGGER_EVENT,"ExitDelay"),label:{en:"Delay after exit intent",fr:"Délai après intention de sortie",es:"Retraso después de la intención de salida",de:"Verzögerung nach Ausstiegsabsicht"},min:0,max:120,value:0,conditions:[{field:TRIGGER_EVENT,value:"exitIntent"}]},triggerEventReengageDelay={category:CONDITIONS,type:NUMBER,propName:"".concat(TRIGGER_EVENT,"ReengageDelay"),label:{en:"Idle timeout before posting",fr:"Délai d'inactivité avant l'affichage",es:"Tiempo de espera inactivo antes de publicar",de:"Zeitüberschreitung vor dem Posten"},min:1,max:120,value:10,conditions:[{field:TRIGGER_EVENT,value:"reengage"}]},triggerEventDelay={category:CONDITIONS,type:NUMBER,propName:"".concat(TRIGGER_EVENT,"Delay"),label:{en:"Trigger event delay (in seconds)",fr:"Délai avant l'affichage (en secondes)",es:"",de:"Verzögerung vor dem Posten"},value:10,conditions:[{field:TRIGGER_EVENT,value:"delay"}]},conditionalFields=[triggerEventClick,triggerEventExitDelay,triggerEventReengageDelay,triggerEventDelay],triggersForm={category:CONDITIONS,type:SELECT,label:triggerOnTranslations,options:triggersOptions,propName:TRIGGER_EVENT,value:"pageLoad"},triggersGroup={category:CONDITIONS,type:GROUP,label:triggerTranslations,collapsible:!0,children:[triggersForm].concat(_toConsumableArray(conditionalFields))},isOnEditor=function(){return Object.prototype.hasOwnProperty.call(window,"ABTastyEditor")};function syncRequest(e,t){var n=new XMLHttpRequest;return n.open(e,t,!1),n.send(null),n}function asyncRequest(e,t){return new Promise(function(n,r){var a=new XMLHttpRequest;a.open(e,t,!0),a.onload=function(){this.status>=200&&this.status<300?n(a.response):r({status:this.status,statusText:a.statusText})},a.onerror=function(){r({status:this.status,statusText:a.statusText})},a.send()})}var originalBodyScroll,backgroundColorForm={category:STYLE,type:COLOR_PICKER,label:backgroundColorTranslations,propName:"backgroundColor",value:"rgba(255, 255, 255, 1)"},backgroundImageForm={category:STYLE,type:MEDIA_UPLOAD,label:backgroundImageTranslations,propName:"backgroundImage",value:""},backgroundOpacityForm={category:STYLE,type:SLIDER,label:backgroundOpacityTranslations,propName:"backgroundOpacity",value:75,unit:"%"},backgroundsGroup={category:STYLE,type:GROUP,label:backgroundTranslations,collapsible:!0,children:[backgroundColorForm,backgroundImageForm,backgroundOpacityForm]},borderColorForm={category:STYLE,type:COLOR_PICKER,label:borderColorTranslations,propName:"borderColor",value:"rgba(255, 255, 255, 1)"},borderRadiusForm={category:STYLE,type:SLIDER,label:borderRadiusTranslations,propName:"borderRadius",value:0,unit:"px"},borderWidthForm={category:STYLE,type:SLIDER,label:borderWidthTranslations,propName:"borderWidth",value:0,unit:"px"},bordersGroup={category:STYLE,type:GROUP,label:borderTranslations,collapsible:!0,children:[borderWidthForm,borderColorForm,borderRadiusForm]},textColorForm={category:STYLE,type:COLOR_PICKER,label:textColorTranslations,propName:"textColor",value:"rgba(255, 255, 255, 1)"},WidgetContainer=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"000000",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";_classCallCheck(this,e),this.uniqueId=t,this.widgetContainer=n,this.basicClassName="ab_widget_container_".concat(n),this.widgetContainerId="".concat(this.basicClassName,"_").concat(t),this.contentClassName="".concat(this.basicClassName,"_content"),this.overlayClassName="".concat(this.basicClassName,"_overlay"),this.closeButtonClassName="".concat(this.basicClassName,"_close_button"),this.hideClassName="ab_hide_".concat(t),this.domElement=this.getDom()}return _createClass(e,[{key:"insert",value:function(){var e=this;return waitForElement("head",function(t){return t.appendChild(e.styleElement)},function(e){return console.error(e)}),waitForElement("body",function(t){return t.appendChild(e.domElement)},function(e){return console.error(e)}),this}},{key:"remove",value:function(){return this.domElement.remove(),this.styleElement.remove(),this}},{key:"show",value:function(){return this.domElement.classList.remove(this.hideClassName),this}},{key:"hide",value:function(){return this.domElement.classList.add(this.hideClassName),this}},{key:"init",value:function(){return this.insert(),this.addCloseEvent(),this}},{key:"addCloseEvent",value:function(){for(var e=this,t=this.domElement.querySelectorAll("\n\t\t\t.".concat(this.overlayClassName,",\n\t\t\t.").concat(this.closeButtonClassName,"\n\t\t")),n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return r.push.apply(r,_toConsumableArray(t)),r.forEach(function(t){t.addEventListener("click",function(){e.hide()},!0)}),this}},{key:"getDom",value:function(){var e=document.createElement("div");return e.className="".concat(this.basicClassName," ").concat(this.hideClassName),e.id=this.widgetContainerId,e.innerHTML='\n\t\t\t<div class="'.concat(this.overlayClassName,'"></div>\n\t\t\t<div class="').concat(this.contentClassName,'">\n\t\t\t\t<button class="').concat(this.closeButtonClassName,'" ').concat(isOnEditor()?"data-abtasty-actionnable":"",">+</button>\n\t\t\t</div>"),e}},{key:"getStyleTag",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=document.createElement("style");return t.type="text/css",isOnEditor()&&t.setAttribute("abtasty-script-added","true"),t.textContent="\n\t\t\t.".concat(this.hideClassName," {opacity: 0 !important; pointer-events: none;}\n\t\t\t").concat(e),t}}]),e}(),Popin=function(e){function t(e,n){var r;return _classCallCheck(this,t),(r=_possibleConstructorReturn(this,_getPrototypeOf(t).call(this,e,n))).stringStyles=r.getStyles(),r.styleElement=r.getStyleTag(r.stringStyles),r}return _inherits(t,WidgetContainer),_createClass(t,[{key:"getStyles",value:function(){return"\n\t\t#".concat(this.widgetContainerId," {\n\t\t\tposition: fixed;\n\t\t\ttop: 0;\n\t\t\tleft: 0;\n\t\t\twidth: 100%;\n\t\t\theight: 100%;\n\t\t\tz-index: 9999;\n\t\t\topacity: 1;\n\t\t\ttransition: opacity 0.25s ease;\n\t\t}\n\t\t#").concat(this.widgetContainerId," .").concat(this.overlayClassName," {\n\t\t\tposition: absolute;\n\t\t\tz-index: -1;\n\t\t\ttop: 0;\n\t\t\tleft: 0;\n\t\t\twidth: 100%;\n\t\t\theight: 100%;\n\t\t\tbackground-color: black;\n\t\t\topacity: 0.6;\n\t\t}\n\t\t#").concat(this.widgetContainerId," .").concat(this.contentClassName," {\n\t\t\tposition: absolute;\n\t\t\tleft: 50%;\n\t\t\ttop: 50%;\n\t\t\ttransform: translate(-50%, -50%);\n\t\t\twidth: auto;\n\t\t\theight: auto;\n\t\t}\n\t\t#").concat(this.widgetContainerId," .").concat(this.closeButtonClassName," {\n\t\t\tposition: absolute;\n\t\t\ttop: 0;\n\t\t\tright: 0;\n\t\t\tcolor: black;\n\t\t\tbackground: none;\n\t\t\tborder: none;\n\t\t\ttransform: rotate(45deg);\n\t\t\tcursor: pointer;\n\t\t\toutline: none;\n\t\t\tfont-size: 1.8em;\n\t\t}")}}]),t}(),Banner=function(e){function t(e,n,r){var a;return _classCallCheck(this,t),(a=_possibleConstructorReturn(this,_getPrototypeOf(t).call(this,e,n))).position=r,a.stringStyles=a.getStyles(),a.styleElement=a.getStyleTag(a.stringStyles),a}return _inherits(t,WidgetContainer),_createClass(t,[{key:"getStyles",value:function(){return"\n\t\t#".concat(this.widgetContainerId," {\n\t\t\tposition: fixed;\n\t\t\t").concat(this.position,": 0;\n\t\t\tleft: 0;\n\t\t\twidth: 100%;\n\t\t\theight: auto;\n\t\t\tz-index: 9999;\n\t\t\topacity: 1;\n\t\t\ttransition: opacity 0.25s ease;\n\t\t}\n\t\t#").concat(this.widgetContainerId," .").concat(this.overlayClassName," {\n\t\t\tdisplay: none;\n\t\t}\n\t\t#").concat(this.widgetContainerId," .").concat(this.closeButtonClassName," {\n\t\t\tposition: absolute;\n\t\t\ttop: 0;\n\t\t\tright: 0;\n\t\t\tcolor: black;\n\t\t\tbackground: none;\n\t\t\tborder: none;\n\t\t\ttransform: rotate(45deg);\n\t\t\tcursor: pointer;\n\t\t\toutline: none;\n\t\t\tfont-size: 1.8em;\n\t\t}")}}]),t}(),Free=function(e){function t(e,n,r,a){var o;return _classCallCheck(this,t),(o=_possibleConstructorReturn(this,_getPrototypeOf(t).call(this,e,n))).position=r,o.referrerElement=a,o.stringStyles=o.getStyles(),o.styleElement=o.getStyleTag(o.stringStyles),o}return _inherits(t,WidgetContainer),_createClass(t,[{key:"insert",value:function(){var e=this;return waitForElement("head",function(t){return t.appendChild(e.styleElement)},function(e){return console.error(e)}),waitForElement(this.referrerElement,function(t){return t.insertAdjacentElement(e.position,e.domElement)},function(e){return console.error(e)}),this}},{key:"getStyles",value:function(){return"\n\t\t#".concat(this.widgetContainerId," {\n\t\t\twidth: auto;\n\t\t\theight: auto;\n\t\t\tposition: relative;\n\t\t\tmargin: 0;\n\t\t\tpadding: 0;\n\t\t}\n\t\t#").concat(this.widgetContainerId," .").concat(this.overlayClassName," {\n\t\t\tdisplay: none;\n\t\t}\n\t\t#").concat(this.widgetContainerId," .").concat(this.closeButtonClassName," {\n\t\t\tposition: absolute;\n\t\t\ttop: 0;\n\t\t\tright: 0;\n\t\t\tcolor: black;\n\t\t\tbackground: none;\n\t\t\tborder: none;\n\t\t\ttransform: rotate(45deg);\n\t\t\tcursor: pointer;\n\t\t\toutline: none;\n\t\t\tfont-size: 1.8em;\n\t\t}")}}]),t}(),Recurrence=function(){function e(t){var n=t.displayRecurrence,r=t.closingRecurrence,a=t.validationRecurrence,o=t.widgetName,s=t.uniqueId;_classCallCheck(this,e),this.displayRecurrence=parseFloat(n),this.closingRecurrence=parseFloat(r),this.validationRecurrence=parseFloat(a),this.storageName="Rec_".concat(o,"_").concat(s),this.currentRecurrence=this.getCurrentRecurrence()}return _createClass(e,[{key:"getCurrentRecurrence",value:function(){var e={type:!1},t=sessionStorage.getItem(this.storageName)||localStorage.getItem(this.storageName);try{return JSON.parse(t)||e}catch(t){return e}}},{key:"isOver",value:function(){var e=sessionStorage.getItem(this.storageName),t=localStorage.getItem(this.storageName),n=(t?parseFloat(t):0)<(new Date).getTime();return n&&localStorage.removeItem(this.storageName),n&&!t&&!e}},{key:"setRecurrence",value:function(e,t){var n=this,r=this.getTypeOfStorage(e),a=this.getStamp(e),o={type:t,stamp:a},s=this.currentRecurrence.type,i=function(){sessionStorage.getItem(n.storageName)&&sessionStorage.removeItem(n.storageName),localStorage.getItem(n.storageName)&&localStorage.removeItem(n.storageName),r.setItem(n.storageName,JSON.stringify(o))};if(!r)return!1;if(s&&"validation"!==t)if("closing"===t&&"validation"!==s)i();else{if("display"!==t||"validation"===s||"closing"===s)return!1;i()}else i();return a}},{key:"setDisplayRecurrence",value:function(){this.setRecurrence(this.displayRecurrence,"display")}},{key:"setClosingRecurrence",value:function(){this.setRecurrence(this.closingRecurrence,"closing")}},{key:"setValidationRecurrence",value:function(){this.setRecurrence(this.validationRecurrence,"validation")}},{key:"getStamp",value:function(e){return(new Date).getTime()+864e5*e}},{key:"getTypeOfStorage",value:function(e){return!(isNaN(e)||e<0||0!==e&&!e)&&(e>0?window.localStorage:0===e&&window.sessionStorage)}}]),e}(),Trigger=function(){function e(t){var n=t.triggerEvent,r=t.triggerSelector,a=t.triggerDelay;_classCallCheck(this,e),this.event=n,this.selector=r&&r.length?r:"body",this.delay=a}return _createClass(e,[{key:"onPageLoad",value:function(){return new Promise(function(e,t){if("complete"!==document.readyState){var n,r=["DOMContentLoaded",function(){return e(!0)},{passive:!0,once:!0}];(n=window).addEventListener.apply(n,r),setTimeout(function(){var e;return(e=window).removeEventListener.apply(e,r),t(!1)},15e3)}return e(!0)})}},{key:"onClick",value:function(){var e=this,t=document.createElement("style");return t.innerHTML="".concat(this.selector," {\n\t\t\tcursor: pointer !important;\n\t\t\tpointer-events: all !important;\n\t\t}"),document.head.appendChild(t),new Promise(function(n){var r,a=function(t){return _toConsumableArray(document.querySelectorAll(e.selector)).some(function(n){return n.isSameNode(t)||!!t.closest(e.selector)})},o=["click",function(e){return!!a(e.target)&&(document.head.removeChild(t),n(!0))},{passive:!0,once:!0,capture:!0}];(r=document).addEventListener.apply(r,o)})}},{key:"onExitIntent",value:function(){var e=this;return new Promise(function(){var t=_asyncToGenerator(_regeneratorRuntime.mark(function t(n){var r;return _regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r=["mouseleave",function(){if(e.delay){var t=1e3*e.delay;setTimeout(function(){return n(!0)},t)}return n(!0)},{passive:!0,once:!0}],t.next=4,e.onPageLoad();case 4:t.sent&&waitForElement("body",function(e){return e.addEventListener.apply(e,r)});case 6:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}())}},{key:"onDelay",value:function(){var e=this;return new Promise(function(){var t=_asyncToGenerator(_regeneratorRuntime.mark(function t(n){var r;return _regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r=1e3*e.delay,t.next=3,e.onPageLoad();case 3:t.sent&&setTimeout(function(){return n(!0)},r);case 5:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}())}},{key:"onReengage",value:function(){var e=this;return new Promise(function(t){var n=1e3*e.delay,r=n,a=["click","mousemove","scroll","keypress"],o=[function(){return r=n},{passive:!0}];a.forEach(function(e){var t;return(t=document).addEventListener.apply(t,[e].concat(o))});var s=setInterval(function(){r<=0?(t(!0),clearInterval(s),a.forEach(function(e){var t;return(t=document).removeEventListener.apply(t,[e].concat(o))})):r-=100},100)})}},{key:"isTriggered",value:function(){var e=_asyncToGenerator(_regeneratorRuntime.mark(function e(){var t;return _regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=this.event,e.next="pageLoad"===e.t0?3:"click"===e.t0?7:"exitIntent"===e.t0?11:"delay"===e.t0?15:"reengage"===e.t0?19:23;break;case 3:return e.next=5,this.onPageLoad();case 5:return t=e.sent,e.abrupt("break",24);case 7:return e.next=9,this.onClick();case 9:return t=e.sent,e.abrupt("break",24);case 11:return e.next=13,this.onExitIntent();case 13:return t=e.sent,e.abrupt("break",24);case 15:return e.next=17,this.onDelay();case 17:return t=e.sent,e.abrupt("break",24);case 19:return e.next=21,this.onReengage();case 21:return t=e.sent,e.abrupt("break",24);case 23:t=!1;case 24:return e.abrupt("return",t);case 25:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()}]),e}();function preventGlobalScroll(){var e=document.querySelector("body");originalBodyScroll=window.getComputedStyle(e).overflowY,e.style.overflowY="hidden"}function allowGlobalScroll(){originalBodyScroll&&(document.querySelector("body").style.overflowY=originalBodyScroll)}var loadImage=function(e){return new Promise(function(t,n){var r=new Image;r.onload=function(){t(r)},r.src=e,r.onerror=function(t){var r=new Error("Image ".concat(e," is not loaded."));n(r)}})},isTouch=function(){return void 0!==window.ontouchstart},exitIntent=function(e){var t,n=0;document.addEventListener("mousemove",function(e){n=e.clientY}),document.body.addEventListener("mouseleave",function r(a){a.clientY<=50&&(n=0,clearInterval(t),t=setTimeout(function(){0===n&&(e(),document.removeEventListener("mouseleave",r))},0))},!1)},log=function(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];n.unshift("[AB Tasty Widget] ".concat(PACKAGE,":")),(e=console).log.apply(e,n)},domReady=function(e){"loading"!==document.readyState?e():document.addEventListener("DOMContentLoaded",e)},waitForElement=function(e,t,n){var r,a=0;try{document.querySelector(e)}catch(t){var o="Selector «".concat(e,"» not valid.");return log(o),"function"==typeof n&&n(o)}r=setTimeout(function(){clearInterval(a);var t="Can't find element «".concat(e,"».");return log(t),"function"==typeof n&&n(t)},1e4),a=setInterval(function(){var n=document.querySelector(e);if(null!==n)return clearTimeout(r),clearInterval(a),"function"==typeof t&&t(n)},200)},getCookie=function(e){for(var t=e+"=",n=document.cookie.split(";"),r=0;r<n.length;r++){for(var a=n[r];" "==a.charAt(0);)a=a.substring(1);if(0===a.indexOf(t))return a.substring(t.length,a.length)}return""},getHostname=function(){var e=document.location.hostname.split("").reverse().join("");null===(e=e.match(/(?:[a-z]{2,4}\.[a-z]{2,3}|[a-z]{2,5})\.[a-z0-9\-]+(?:\.|$)/i))?e=document.location.hostname:("."!=e[0].substr(e[0].length-1)&&(e[0]+="."),e=e[0].split("").reverse().join(""));return e},setCookie=function(e,t,n){var r="";if(n){var a=new Date;a.setTime(a.getTime()+24*n*60*60*1e3),r="expires="+a.toUTCString()}var o="domain="+getHostname();document.cookie=e+"="+t+"; "+r+";"+o+";path=/"};export{preventGlobalScroll,allowGlobalScroll,loadImage,isTouch,exitIntent,log,domReady,waitForElement,getCookie,getHostname,setCookie,closingRecurrenceForm,displayRecurrenceForm,validationRecurrenceForm,recurrencesGroup,triggersForm,triggersGroup,isOnEditor,syncRequest,asyncRequest,backgroundColorForm,backgroundImageForm,backgroundOpacityForm,backgroundsGroup,borderColorForm,borderRadiusForm,borderWidthForm,bordersGroup,textColorForm,Popin,Banner,Free,WidgetContainer,Recurrence,Trigger,backgroundImageTranslations,backgroundColorTranslations,backgroundTranslations,backgroundOpacityTranslations,borderTranslations,borderColorTranslations,borderRadiusTranslations,borderWidthTranslations,everydayTranslations,everyWeekTranslations,everyMonthTranslations,everySessionTranslations,everytimeTranslations,oncePerUserTranslations,recurrenceTranslations,displayRecurrenceTranslations,closingRecurrenceTranslations,validationRecurrenceTranslations,textColorTranslations,closeButtonColorTranslations,positionTranslations,topTranslations,bottomTranslations,leftTranslations,rightTranslations,beforeBeginTranslations,afterBeginTranslations,beforeEndTranslations,afterEndTranslations,pageLoadTranslations,clickTranslations,exitIntentTranslations,delayTranslations,reengageInactivityTranslations,triggerOnTranslations,triggerTranslations,selectLayoutTranslations,popinTranslations,bannerTranslations,inThePageTranslations,adjustLayoutTranslations,selectElementReferrerTranslations,relativePositionToElementTranslations,containerTranslations,paddingTranslations,horizontalPaddingTranslations,verticalPaddingTranslations,marginTranslations,horiziontalMarginTranslations,verticalMarginTranslations,buttonsStylesTranslations,buttonsContrastTranslations,buttonsShapeTranslations,buttonsBackgroundColorTranslations,buttonsTextColorTranslations,buttonsBorderColorTranslations,buttonsBorderWidthTranslations,overlayOpacityTranslations,dropShadowTranslations,shadowOpacityTranslations,STYLE,LAYOUT,CONTENT,CONDITIONS,GROUP,CHECKBOX,COLOR_PICKER,SEPARATOR,DATE_PICKER,DATE_RANGE_PICKER,SELECT,MEDIA_UPLOAD,NUMBER,RADIO_BUTTON,RADIO_IMAGE,SLIDER,SWITCH,TEXT_FIELD,TEXT_AREA,TIME_PICKER,SELECT_ELEMENT,WYSIWYG,HIDDEN};
{
"name": "@abtasty/widget-utils",
"version": "1.12.3-20",
"version": "1.12.3-21",
"main": "dist/widget-utils.cjs.js",

@@ -5,0 +5,0 @@ "module": "dist/widget-utils.esm.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc