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

@abtasty/nps

Package Overview
Dependencies
Maintainers
18
Versions
175
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@abtasty/nps - npm Package Compare versions

Comparing version 0.2.3-7 to 0.2.3-8

2

dist/main.js

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

!function(){"use strict";function t(t,e){return t(e={exports:{}},e.exports),e.exports}var e=t(function(t){var e=function(t){var e,n=Object.prototype,r=n.hasOwnProperty,a="function"==typeof Symbol?Symbol:{},o=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function c(t,e,n,r){var a=e&&e.prototype instanceof m?e:m,o=Object.create(a.prototype),i=new x(r||[]);return o._invoke=function(t,e,n){var r=l;return function(a,o){if(r===d)throw new Error("Generator is already running");if(r===f){if("throw"===a)throw o;return I()}for(n.method=a,n.arg=o;;){var i=n.delegate;if(i){var s=N(i,n);if(s){if(s===p)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===l)throw r=f,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=d;var c=u(t,e,n);if("normal"===c.type){if(r=n.done?f:h,c.arg===p)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r=f,n.method="throw",n.arg=c.arg)}}}(t,n,i),o}function u(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var l="suspendedStart",h="suspendedYield",d="executing",f="completed",p={};function m(){}function g(){}function y(){}var v={};v[o]=function(){return this};var b=Object.getPrototypeOf,C=b&&b(b(O([])));C&&C!==n&&r.call(C,o)&&(v=C);var w=y.prototype=m.prototype=Object.create(v);function k(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function E(t){var e;this._invoke=function(n,a){function o(){return new Promise(function(e,o){!function e(n,a,o,i){var s=u(t[n],t,a);if("throw"!==s.type){var c=s.arg,l=c.value;return l&&"object"==typeof l&&r.call(l,"__await")?Promise.resolve(l.__await).then(function(t){e("next",t,o,i)},function(t){e("throw",t,o,i)}):Promise.resolve(l).then(function(t){c.value=t,o(c)},function(t){return e("throw",t,o,i)})}i(s.arg)}(n,a,e,o)})}return e=e?e.then(o,o):o()}}function N(t,n){var r=t.iterator[n.method];if(r===e){if(n.delegate=null,"throw"===n.method){if(t.iterator.return&&(n.method="return",n.arg=e,N(t,n),"throw"===n.method))return p;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return p}var a=u(r,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,p;var o=a.arg;return o?o.done?(n[t.resultName]=o.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,p):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,p)}function S(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function x(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function O(t){if(t){var n=t[o];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,i=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return i.next=i}}return{next:I}}function I(){return{value:e,done:!0}}return g.prototype=w.constructor=y,y.constructor=g,y[s]=g.displayName="GeneratorFunction",t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,s in t||(t[s]="GeneratorFunction")),t.prototype=Object.create(w),t},t.awrap=function(t){return{__await:t}},k(E.prototype),E.prototype[i]=function(){return this},t.AsyncIterator=E,t.async=function(e,n,r,a){var o=new E(c(e,n,r,a));return t.isGeneratorFunction(n)?o:o.next().then(function(t){return t.done?t.value:o.next()})},k(w),w[s]="Generator",w[o]=function(){return this},w.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},t.values=O,x.prototype={constructor:x,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(T),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function a(r,a){return s.type="throw",s.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],s=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=t,i.arg=e,o?(this.method="next",this.next=o.finallyLoc,p):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),p},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),T(n),p}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var a=r.arg;T(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:O(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),p}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}});var n=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t};var r=function(t){if(Array.isArray(t))return t};var a=function(t,e){var n=[],r=!0,a=!1,o=void 0;try{for(var i,s=t[Symbol.iterator]();!(r=(i=s.next()).done)&&(n.push(i.value),!e||n.length!==e);r=!0);}catch(t){a=!0,o=t}finally{try{r||null==s.return||s.return()}finally{if(a)throw o}}return n};var o=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")};var i=function(t,e){return r(t)||a(t,e)||o()};function s(t,e,n,r,a,o,i){try{var s=t[o](i),c=s.value}catch(t){return void n(t)}s.done?e(c):Promise.resolve(c).then(r,a)}var c=function(t){return function(){var e=this,n=arguments;return new Promise(function(r,a){var o=t.apply(e,n);function i(t){s(o,r,a,i,c,"next",t)}function c(t){s(o,r,a,i,c,"throw",t)}i(void 0)})}};var u=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t};var l=function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}};var h=function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)};var d=function(){throw new TypeError("Invalid attempt to spread non-iterable instance")};var f=function(t){return l(t)||h(t)||d()};var p=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")};function m(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var g=function(t,e,n){return e&&m(t.prototype,e),n&&m(t,n),t},y=t(function(t){function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function n(r){return"function"==typeof Symbol&&"symbol"===e(Symbol.iterator)?t.exports=n=function(t){return e(t)}:t.exports=n=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":e(t)},n(r)}t.exports=n});var v=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t};var b=function(t,e){return!e||"object"!==y(e)&&"function"!=typeof e?v(t):e},C=t(function(t){function e(n){return t.exports=e=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},e(n)}t.exports=e}),w=t(function(t){function e(n,r){return t.exports=e=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},e(n,r)}t.exports=e});var k=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&w(t,e)},E="Recurrence",N="Récurrence",S="Recurrencia",T="Wiederholung",x={en:"".concat(E," of the display"),fr:"".concat(N," de l'affichage"),es:"".concat(S," de la pantalla"),de:"".concat(T," der Anzeige")},O={en:"".concat(E," after closure"),fr:"".concat(N," après fermeture"),es:"".concat(S," después del cierre"),de:"".concat(T," nach Schließung")},I={en:"".concat(E," after validation"),fr:"".concat(N," après validation"),es:"".concat(S," después de la validación"),de:"".concat(T," nach der Validierung")},L={en:"Trigger",fr:"Déclencheur",es:"Desencadenar",de:"Auslösen"};function P(t,e){var n=Object.keys(t);return Object.getOwnPropertySymbols&&n.push.apply(n,Object.getOwnPropertySymbols(t)),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n}function A(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?P(n,!0).forEach(function(e){u(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):P(n).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}var _={category:"conditions",type:"select",options:[{label:{en:"Every time",fr:"Tout le temps",es:"Cada vez",de:"Jedes Mal"},value:"-1"},{label:{en:"Every session",fr:"Chaque session",es:"En cada sesión",de:"Jede Session"},value:"0"},{label:{en:"Everyday",fr:"Chaque jour",es:"Cada día",de:"Jeden Tag"},value:"1"},{label:{en:"Every week",fr:"Chaque semaine",es:"Cada semana",de:"Jede Woche"},value:"7"},{label:{en:"Every month",fr:"Chaque mois",es:"Cada mes",de:"Jeden Monat"},value:"30"},{label:{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)"},value:"365"}],value:"-1"},D=(A({},_,{label:O,propName:"closingRecurrence"}),A({},_,{label:x,propName:"displayRecurrence"}),A({},_,{label:I,propName:"validationRecurrence"}),[{label:{en:"Page load",fr:"Chargement de la page",es:"Carga de página",de:"Seite laden"},value:"pageLoad"},{label:{en:"Click",fr:"Clic",es:"Clic",de:"Klicken"},value:"click"},{label:{en:"Exit intent",fr:"Avant fermeture de l'onglet",es:"Intención de salida",de:"Absicht beenden"},value:"exitIntent"},{label:{en:"Delay",fr:"Délai",es:"Retrasar",de:"Verzögern"},value:"delay"},{label:{en:"Reengage (after inactivity)",fr:"Réengagement (après inactivité)",es:"Despues de inactividad",de:"Nach Untätigkeit"},value:"reengage"}]),j={category:"conditions",type:"selectelement",propName:"".concat("triggerEvent","Click"),label:L,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:"triggerEvent",value:"click"}]},R={category:"conditions",type:"number",propName:"".concat("triggerEvent","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:"triggerEvent",value:"exitIntent"}]},B={category:"conditions",type:"number",propName:"".concat("triggerEvent","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:"triggerEvent",value:"reengage"}]},Y={category:"conditions",type:"number",propName:"".concat("triggerEvent","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:"triggerEvent",value:"delay"}]},F=([{category:"conditions",type:"select",label:{en:"Triggers on",fr:"Se déclenche au",es:"Disparadores en",de:"Löst aus"},options:D,propName:"triggerEvent",value:"pageLoad"}].concat(f([j,R,B,Y])),function(){return Object.prototype.hasOwnProperty.call(window,"ABTastyEditor")});function q(t,e){return new Promise(function(n,r){var a=new XMLHttpRequest;a.open(t,e,!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 M=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"000000",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";p(this,t),this.testID=e,this.widgetContainer=n,this.basicClassName="ab_widget_container_".concat(n),this.widgetContainerId="".concat(this.basicClassName,"_").concat(e),this.contentClassName="".concat(this.basicClassName,"_content"),this.overlayClassName="".concat(this.basicClassName,"_overlay"),this.closeButtonClassName="".concat(this.basicClassName,"_close_button"),this.hideClassName="ab_hide_".concat(e),this.domElement=this.getDom()}return g(t,[{key:"insert",value:function(){var t=this;return W("head",function(e){return e.appendChild(t.styleElement)},function(t){return console.error(t)}),W("body",function(e){return e.appendChild(t.domElement)},function(t){return console.error(t)}),this}},{key:"remove",value:function(){return this.domElement.remove(),this.styleElement.remove(),this}},{key:"show",value:function(){return this.domElement.classList.remove("ab_hide"),this}},{key:"hide",value:function(){return this.domElement.classList.add("ab_hide"),this}},{key:"init",value:function(){return this.insert(),this.addCloseEvent(),this}},{key:"addCloseEvent",value:function(){for(var t=this,e=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,f(e)),r.forEach(function(e){e.addEventListener("click",function(){t.hide()},!0)}),this}},{key:"getDom",value:function(){var t=document.createElement("div");return t.className="".concat(this.basicClassName," ab_hide"),t.id=this.widgetContainerId,t.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(F()?"data-abtasty-actionnable":"",">+</button>\n\t\t\t</div>"),t}},{key:"getStyleTag",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=document.createElement("style");return e.type="text/css",F()&&e.setAttribute("abtasty-script-added","true"),e.textContent="\n\t\t\t.".concat(this.hideClassName," {opacity: 0 !important; pointer-events: none;}\n\t\t\t").concat(t),e}}]),t}(),z=function(t){function e(t,n){var r;return p(this,e),(r=b(this,C(e).call(this,t,n))).stringStyles=r.getStyles(),r.styleElement=r.getStyleTag(r.stringStyles),r}return k(e,M),g(e,[{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}")}}]),e}(),G=function(t){function e(t,n,r){var a;return p(this,e),(a=b(this,C(e).call(this,t,n))).position=r,a.stringStyles=a.getStyles(),a.styleElement=a.getStyleTag(a.stringStyles),a}return k(e,M),g(e,[{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}")}}]),e}(),Q=function(t){function e(t,n,r,a){var o;return p(this,e),(o=b(this,C(e).call(this,t,n))).position=r,o.referrerElement=a,o.stringStyles=o.getStyles(),o.styleElement=o.getStyleTag(o.stringStyles),o}return k(e,M),g(e,[{key:"insert",value:function(){var t=this;return W("head",function(e){return e.appendChild(t.styleElement)},function(t){return console.error(t)}),W(this.referrerElement,function(e){return e.insertAdjacentElement(t.position,t.domElement)},function(t){return console.error(t)}),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}")}}]),e}(),U=function(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];n.unshift("[AB Tasty Widget] ".concat(PACKAGE,":")),(t=console).log.apply(t,n)},W=function(t,e,n){var r,a=0;try{document.querySelector(t)}catch(e){var o="Selector «".concat(t,"» not valid.");return U(o),"function"==typeof n&&n(o)}r=setTimeout(function(){clearInterval(a);var e="Can't find element «".concat(t,"».");return U(e),"function"==typeof n&&n(e)},1e4),a=setInterval(function(){var n=document.querySelector(t);if(null!==n)return clearTimeout(r),clearInterval(a),"function"==typeof e&&e(n)},200)};var H=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")};function V(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var J=function(t,e,n){return e&&V(t.prototype,e),n&&V(t,n),t},K="https://nps.abtasty.com/api/",X=DATA.isFeedBackQuestion,Z=function(t){var e=t.question,n=t.npsCampaignId,r=t.userFeedback;return{abtastyIdentifier:"abtastyidentifier=".concat(top.ABTasty.accountSettings.identifier),accessToken:"access_token=".concat(ABTASTY_S.SERVER.token),testId:"testId=".concat(TEST_ID),variationId:"variationId=".concat(ABTASTY_S.STORE.currentVariation.id),name:"name=".concat(ABTASTY_S.STORE.test.name," - ").concat(ABTASTY_S.STORE.currentVariation.name),nps:"nps=".concat(e),feedback:"feedback=".concat(X?r:""),id:"id=".concat(n)}},$=function(t){if(t.npsCampaignId)return!1;var e,n,r,a,o,i,s,c,u=Z(t);return q("GET",(n=(e=u).abtastyIdentifier,r=e.accessToken,a=e.testId,o=e.variationId,i=e.name,s=e.nps,c=e.feedback,"".concat(K,"setNPS.php?").concat(n,"&").concat(r,"&").concat(a,"&").concat(o,"&").concat(i,"&").concat(s,"&").concat(c)))},tt=function(t){var e=t.detail;if(!e.npsCampaignId)return!1;var n,r,a,o,i,s,c,u,l,h=Z(e);return q("GET",(r=(n=h).id,a=n.abtastyIdentifier,o=n.accessToken,i=n.testId,s=n.variationId,c=n.name,u=n.nps,l=n.feedback,"".concat(K,"setNPS.php?").concat(r,"&").concat(a,"&").concat(o,"&").concat(i,"&").concat(s,"&").concat(c,"&").concat(u,"&").concat(l)))},et=function(t,e){var n,r,a,o=DATA,i=o.question,s=o.npsCampaignId,c=function(t,e){var n=e.feedback,r=e.id,a=e.abtastyIdentifier,o="score=".concat(t);return"".concat(K,"collect.php?").concat(o,"&").concat(n,"&nps").concat(r,"&").concat(a)}(t,Z({question:i,npsCampaignId:s,userFeedback:e}));return n="GET",r=c,(a=new XMLHttpRequest).open(n,r,!1),a.send(null),a};function nt(t,e){var n=Object.keys(t);return Object.getOwnPropertySymbols&&n.push.apply(n,Object.getOwnPropertySymbols(t)),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n}var rt=DATA,at=rt.themeType,ot=rt.layout,it=rt.isFeedBackQuestion,st=rt.isThankYouMessage,ct=rt.isLegend,ut=rt.timeHide,lt=function(){function t(e){var n=e.TEST_ID,r=e.question,a=e.feedbackQuestion,o=e.userStyles,i=e.parentContainer,s=e.buttonText,c=e.thankYouMessage,u=e.zeroLegend,l=e.tenLegend,h=e.recurrence;H(this,t),this.testID=n,this.question=r,this.feedbackQuestion=a,this.userStyles=o,this.parentContainer=i,this.buttonText=s,this.thankYouMessage=c,this.legend={zeroLegend:u,tenLegend:l},this.recurrence=h,this.baseClassName="nps_container",this.npsClassName="".concat(this.baseClassName,"_").concat(this.testID),this.questionClassName="".concat(this.baseClassName,"_question"),this.notesClassName="".concat(this.baseClassName,"_notes"),this.feedbackQuestionClassName="".concat(this.questionClassName,"_feedback"),this.feedbackFormClassName="".concat(this.questionClassName,"_feedback_form"),this.notesButtonsClassName="".concat(this.notesClassName,"_button"),this.thankYouClassName="".concat(this.baseClassName,"_thanks"),this.hideClassName="nps_".concat(this.testID,"_display_none"),this.currentNote=NaN,this.userFeedback="",this.npsContainer=this.getContainer(),this.questionElement=this.getQuestionElement(),this.notesContainer=this.getNotesElement(),this.feedbackElements=this.getFeedBackElements(),this.thankYouElement=this.getThankYouElement(),this.npsElement=this.getNPSElement(),this.styleElement=this.getStyleElement()}return J(t,[{key:"sendNote",value:function(){return top.console.log("".concat(this.currentNote)),F()||isNaN(this.currentNote)||(et(this.currentNote,this.userFeedback),window.abtasty.send("nps",{ns:this.currentNote,nf:this.userFeedback}),this.recurrence.setValidationRecurrence()),this}},{key:"setExternalEvents",value:function(){var t=this;[this.parentContainer.overlayClassName,this.parentContainer.closeButtonClassName].forEach(function(e){t.parentContainer.domElement.querySelector(".".concat(e)).addEventListener("mouseup",t.recurrence.setClosingRecurrence,{passive:!0,once:!0})})}},{key:"insert",value:function(t,e){return document.head.insertAdjacentElement("beforeend",this.styleElement),t.insertAdjacentElement(e,this.npsElement),this.setExternalEvents(),this}},{key:"remove",value:function(){return this.npsElement&&this.npsElement.remove(),this.styleElement&&this.styleElement.remove(),this}},{key:"complete",value:function(){var t=this;this.sendNote(),setTimeout(function(){t.parentContainer.hide(),setTimeout(function(){return t.remove()},1e3)},1e3*ut)}},{key:"onClickNote",value:function(t){this.currentNote=t.target.dataset.note,it&&this.feedbackQuestion&&this.feedbackQuestion.length?this.showFeedBack():st&&this.thankYouMessage&&this.thankYouMessage.length&&this.showThankYouMessage()}},{key:"onFeedbackSend",value:function(){st&&this.thankYouMessage&&this.thankYouMessage.length?this.showThankYouMessage():this.complete()}},{key:"showFeedBack",value:function(){var t=this;return this.npsContainer.childNodes.forEach(function(e){return e.classList.add(t.hideClassName)}),Object.values(this.feedbackElements).forEach(function(e){return e.classList.remove(t.hideClassName)}),this}},{key:"showThankYouMessage",value:function(){var t=this;return this.npsContainer.childNodes.forEach(function(e){return e.classList.add(t.hideClassName)}),this.thankYouElement.classList.remove(this.hideClassName),this.complete(),this}},{key:"getThankYouElement",value:function(){var t=document.createElement("p");return t.className="".concat(this.thankYouClassName," ").concat(this.hideClassName),t.innerHTML=this.thankYouMessage,t}},{key:"getFeedBackElements",value:function(){var t=this,e=document.createElement("p");e.className="".concat(this.feedbackQuestionClassName," ").concat(this.hideClassName),e.innerHTML=this.feedbackQuestion;var n=document.createElement("form");n.className="".concat(this.feedbackFormClassName," ").concat(this.hideClassName);var r=document.createElement("input");r.className="".concat(this.feedbackQuestionClassName,"_input"),r.type="text";var a=document.createElement("button");return a.className="".concat(this.feedbackQuestionClassName,"_button"),a.innerHTML=this.buttonText,a.addEventListener("click",function(){return t.onFeedbackSend()},{passive:!0}),n.appendChild(r),n.appendChild(a),{feedbackQuestionElement:e,feedbackFormElement:n}}},{key:"getNotesElement",value:function(){var t=this,e=document.createElement("div");e.className=this.notesClassName;for(var n=10;n>=0;){var r=document.createElement("button");r.className=this.notesButtonsClassName,r.dataset.note=n,F()&&r.setAttribute("data-abtasty-actionnable",""),r.innerHTML+="<span>".concat(n,"</span>"),r.addEventListener("click",function(e){return t.onClickNote(e)},{passive:!0}),e.insertAdjacentElement("afterbegin",r),n-=1}return ct&&(e.insertAdjacentHTML("afterbegin","<legend>".concat(this.legend.zeroLegend,"</legend>")),e.insertAdjacentHTML("beforeend","<legend>".concat(this.legend.tenLegend,"</legend>"))),e}},{key:"getQuestionElement",value:function(){var t=document.createElement("p");return t.className=this.questionClassName,t.innerHTML=this.question,t}},{key:"getContainer",value:function(){var t=document.createElement("div");return t.className="".concat(this.baseClassName," ").concat(this.npsClassName),t}},{key:"getNPSElement",value:function(){var t=this;return this.npsContainer.appendChild(this.questionElement),this.npsContainer.appendChild(this.notesContainer),it&&Object.values(this.feedbackElements).forEach(function(e){t.npsContainer.appendChild(e)}),st&&this.npsContainer.appendChild("getNPSElement 3",this.thankYouElement),this.npsContainer}},{key:"getDefaultStyles",value:function(){return"\n\t\t#".concat(this.parentContainer.widgetContainerId," .").concat(this.hideClassName," {\n\t\t\tdisplay: none !important;\n\t\t}\n\t\t#").concat(this.parentContainer.widgetContainerId," .").concat(this.baseClassName,",\n\t\t#").concat(this.parentContainer.widgetContainerId," .").concat(this.baseClassName," * {\n\t\t\twidth: auto;\n\t\t\theight: auto;\n\t\t\tmin-width: inherit;\n\t\t\tmin-height: inherit;\n\t\t\tmax-width: inherit;\n\t\t\tmax-height: inherit;\n\t\t\tfont-size: 1vmin;\n\t\t\tline-height: 1;\n\t\t\tmargin: 0;\n\t\t\tpadding: 0;\n\t\t\tborder: none;\n\t\t}")}},{key:"getThemeDefaultStyles",value:function(){var t="popin"===ot?"75em":"auto",e="#".concat(this.parentContainer.widgetContainerId," .").concat(this.npsClassName);return"\n\t\t".concat(e,",\n\t\t").concat(e," * {\n\t\t\tdisplay: flex;\n\t\t\tflex-wrap: nowrap;\n\t\t\tjustify-content: center;\n\t\t}\n\t\t").concat(e," {\n\t\t\twidth: ").concat(t,";\n\t\t\talign-items: center;\n\t\t}\n\t\t").concat(e," .").concat(this.questionClassName,",\n\t\t").concat(e," .").concat(this.feedbackQuestionClassName,",\n\t\t").concat(e," .").concat(this.thankYouClassName," {\n\t\t\tfont-size: 2em;\n\t\t}\n\t\t").concat(e," .").concat(this.notesClassName," {\n\t\t\tflex-direction: row;\n\t\t}\n\t\t").concat(e," .").concat(this.notesClassName," legend {\n\t\t\talign-self: center;\n\t\t\tfont-size: 1.5em;\n\t\t}\n\t\t").concat(e," .").concat(this.notesClassName," legend:first-of-type {\n\t\t\tmargin-right: 1em;\n\t\t}\n\t\t").concat(e," .").concat(this.notesClassName," legend:last-of-type {\n\t\t\tmargin-left: 1em;\n\t\t}\n\t\t").concat(e," .").concat(this.notesButtonsClassName," {\n\t\t\twidth: 3.5em;\n\t\t\theight: 3.5em;\n\t\t}\n\t\t").concat(e," .").concat(this.notesButtonsClassName," span {\n\t\t\tfont-size: 2em;\n\t\t}\n\t\t").concat(e," .").concat(this.feedbackFormClassName," {\n\t\t\tflex-direction: row;\n\t\t}\n\t\t").concat(e," .").concat(this.feedbackFormClassName," input {\n\t\t\twidth: 45em;\n\t\t\theight: 4em;\n\t\t\tborder-radius: 8px;\n\t\t\tborder: 2px solid blue;\n\t\t}\n\t\t").concat(e," .").concat(this.feedbackFormClassName," button {\n\t\t\twidth: 10em;\n\t\t\tborder-radius: 8px;\n\t\t\tbackground: blue;\n\t\t\tcolor: white;\n\t\t\tfont-size: 1.4em;\n\t\t}")}},{key:"getUserStyles",value:function(){var t,e=this.userStyles,r=e.backgroundColor,a=e.borderColor,o=e.borderRadius,s=e.borderWidth,c=e.dropShadow,u=e.textColor,l=e.horizontalPaddingContainer,h=e.verticalPaddingContainer,d=e.horizontalMarginContainer,f=e.verticalMarginContainer,p=e.overlayColor,m=e.overlayOpacity,g=e.shadowOpacity,y=e.buttonsContrast,v=e.buttonsShape,b=e.contentDirection,C=e.questionMargin,w=e.buttonsHorizontalMargin,k=Object.entries(this.userStyles).filter(function(t){return i(t,1)[0].includes(y)}).reduce(function(t,e){var r=i(e,2),a=r[0],o=r[1],s=a.split("_".concat(y))[0],c=function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?nt(r,!0).forEach(function(e){n(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):nt(r).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}({},t);return c[s]=o,c},{}),E=k.buttonsBackgroundColor,N=k.buttonsTextColor,S=k.buttonsBorderColor,T=k.buttonsBorderWidth;switch(v){case"roundsquare":t="border-radius: 8px;";break;case"round":t="border-radius: 50%;";break;default:t=""}var x=c?"box-shadow: 0px 5px 10px 2px rgba(0, 0, 0, ".concat(g/100,");"):"",O="#".concat(this.parentContainer.widgetContainerId," .").concat(this.npsClassName),I="\n\t\t".concat(O," .").concat(this.notesButtonsClassName," {\n\t\t\tmargin-left: ").concat(w,"px;\n\t\t\tmargin-right: ").concat(w,"px;\n\t\t\tbackground-color: ").concat(E,";\n\t\t\tborder: ").concat(T,"px solid ").concat(S,";\n\t\t\t").concat(t,"\n\t\t}\n\t\t").concat(O," .").concat(this.notesButtonsClassName," span {\n\t\t\tcolor: ").concat(N,";\n\t\t}");return"\n\t\tbody ".concat(O," {\n\t\t\tflex-direction: ").concat(b,";\n\t\t\tbackground-color: ").concat(r,";\n\t\t\tborder: ").concat(s,"px solid ").concat(a,";\n\t\t\tborder-radius: ").concat(o,"px;\n\t\t\tmargin: ").concat(f,"px ").concat(d,"px;\n\t\t\tpadding: ").concat(h,"px ").concat(l,"px;\n\t\t\t").concat(x,"\n\t\t}\n\t\t").concat(O," .").concat(this.questionClassName,",\n\t\t").concat(O," .").concat(this.feedbackQuestionClassName," ,\n\t\t").concat(O," .").concat(this.thankYouClassName," {\n\t\t\tcolor: ").concat(u,";\n\t\t\tmargin-").concat("row"===b?"right":"bottom"," : ").concat(C,"px;\n\t\t}\n\t\t").concat(O," .").concat(this.notesClassName," legend {\n\t\t\tcolor: ").concat(u,";\n\t\t}\n\t\t").concat(I,"\n\t\t#").concat(this.parentContainer.widgetContainerId," .").concat(this.parentContainer.overlayClassName," {\n\t\t\tbackground-color: ").concat(p,";\n\t\t\topacity: ").concat(m/100,";\n\t\t}")}},{key:"getStyleElement",value:function(){var t="theme"===at,e=this.getDefaultStyles(),n=t?this.getThemeDefaultStyles():"",r=t?this.getUserStyles():"",a=document.createElement("style");return F()&&a.setAttribute("abtasty-script-added","true"),a.textContent="".concat(e," ").concat(n," ").concat(r),a}}]),t}(),ht=function(){function t(e){var n=e.displayRecurrence,r=e.closingRecurrence,a=e.validationRecurrence,o=e.widgetName;H(this,t),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 J(t,[{key:"getCurrentRecurrence",value:function(){var t={type:!1},e=sessionStorage.getItem(this.storageName)||localStorage.getItem(this.storageName);try{return JSON.parse(e)||t}catch(e){return t}}},{key:"isOver",value:function(){var t=sessionStorage.getItem(this.storageName),e=localStorage.getItem(this.storageName),n=e?parseFloat(e):0,r=(new Date).getTime(),a=!!e&&n<r;return a&&localStorage.removeItem(this.storageName),!t||!e||a}},{key:"setRecurrence",value:function(t,e){var n=this.getTypeOfStorage(t),r=this.getStamp(t),a={type:e,stamp:r},o=this.currentRecurrence.type;function i(){sessionStorage.getItem(this.storageName)&&sessionStorage.removeItem(this.storageName),localStorage.getItem(this.storageName)&&localStorage.removeItem(this.storageName),n.setItem(this.storageName,JSON.stringify(a))}if(o&&"validation"!==e)if("closing"===e&&"validation"!==o)i();else{if("display"!==e||"validation"===o||"closing"===o)return!1;i()}else i();return r}},{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(t){return(new Date).getTime()+864e5*t}},{key:"getTypeOfStorage",value:function(t){return!(isNaN(t)||t<0||0!==t&&!t)&&(t>0?window.localStorage:0===t&&window.sessionStorage)}}]),t}();var dt=function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}};var ft=function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)};var pt=function(){throw new TypeError("Invalid attempt to spread non-iterable instance")};var mt=function(t){return dt(t)||ft(t)||pt()},gt=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"body",r=arguments.length>2?arguments[2]:void 0;H(this,t),this.event=e,this.selector=n,this.delay=r,this.targets=mt(document.querySelectorAll(n))}return J(t,[{key:"onPageLoad",value:function(){return new Promise(function(t,e){if("complete"!==document.readyState){var n,r=["DOMContentLoaded",function(){return t(!0)},{passive:!0,once:!0}];(n=window).addEventListener.apply(n,r),setTimeout(function(){var t;return(t=window).removeEventListener.apply(t,r),e(!1)},15e3)}return t(!0)})}},{key:"onClick",value:function(){var t=this;return new Promise(function(e){var n,r=function(e){return e.isSameNode(t)||!!t.closest(e)},a=["click",function(n){var a;a=n.target,t.targets.some(r,a)&&e(!0)},{passive:!0,once:!0,capture:!0}];(n=document).addEventListener.apply(n,a)})}},{key:"onExitIntent",value:function(){var t=this;return new Promise(function(){var n=c(e.mark(function n(r,a){var o,i;return e.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return o=["mouseleave",function(){if(t.delay){var e=1e3*t.delay;setTimeout(function(){return r(!0)},e)}return r(!0)},{passive:!0,once:!0}],e.next=4,t.onPageLoad();case 4:return e.sent&&(i=document.body).addEventListener.apply(i,o),e.abrupt("return",a(!1));case 7:case"end":return e.stop()}},n)}));return function(t,e){return n.apply(this,arguments)}}())}},{key:"onDelay",value:function(){var t=this;return new Promise(function(){var n=c(e.mark(function n(r){var a;return e.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a=1e3*t.delay,e.next=3,t.onPageLoad();case 3:e.sent&&setTimeout(function(){return r(!0)},a);case 5:case"end":return e.stop()}},n)}));return function(t){return n.apply(this,arguments)}}())}},{key:"onReengage",value:function(){var t=this;return new Promise(function(e){var n,r=1e3*t.delay,a=r,o=["click mousemove scroll keypress",function(){return a=r},{passive:!0}];setInterval(function(){a<=0?e(!0):a-=100},100),(n=document).addEventListener.apply(n,o)})}},{key:"isTriggered",value:function(){var t=c(e.mark(function t(){var n;return e.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:t.t0=this.event,t.next="pageLoad"===t.t0?3:"click"===t.t0?7:"exitIntent"===t.t0?11:"delay"===t.t0?15:"reengage"===t.t0?19:23;break;case 3:return t.next=5,this.onPageLoad();case 5:return n=t.sent,t.abrupt("break",24);case 7:return t.next=9,this.onClick();case 9:return n=t.sent,t.abrupt("break",24);case 11:return t.next=13,this.onExitIntent();case 13:return n=t.sent,t.abrupt("break",24);case 15:return t.next=17,this.onDelay();case 17:return n=t.sent,t.abrupt("break",24);case 19:return t.next=21,this.onReengage();case 21:return n=t.sent,t.abrupt("break",24);case 23:n=!1;case 24:return t.abrupt("return",n);case 25:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()}]),t}();function yt(t,e){var n=Object.keys(t);return Object.getOwnPropertySymbols&&n.push.apply(n,Object.getOwnPropertySymbols(t)),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n}function vt(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?yt(r,!0).forEach(function(e){n(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):yt(r).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}var bt="NPS";top.console.log(DATA,TEST_ID,PLUGIN_ID);var Ct,wt=DATA,kt=wt.layout,Et=wt.bannerPosition,Nt=wt.npsElementReferrer,St=wt.npsReferrerInsertType,Tt=wt.contentDirection,xt=wt.npsCampaignId,Ot=wt.question,It=wt.feedbackQuestion,Lt=wt.buttonText,Pt=wt.thankYouMessage,At=wt.zeroLegend,_t=wt.tenLegend,Dt=wt.themeType,jt=wt.theme,Rt=wt.triggerEvent,Bt=wt.triggerEventClick,Yt=wt.triggerEventDelay,Ft=wt.triggerEventExitDelay,qt=wt.triggerEventReengageDelay,Mt=wt.displayRecurrence,zt=wt.closingRecurrence,Gt=wt.validationRecurrence,Qt=Bt;switch(Rt){case"exitIntent":Ct=Yt;break;case"delay":Ct=Ft;break;case"reengage":Ct=qt;break;default:Ct=0}var Ut={triggerEvent:Rt,triggerSelector:Qt,triggerDelay:Ct},Wt=new ht({displayRecurrence:Mt,closingRecurrence:zt,validationRecurrence:Gt,widgetName:bt}),Ht=new gt(Ut);function Vt(t){return Jt.apply(this,arguments)}function Jt(){return(Jt=c(e.mark(function t(n){var r,a,o,i;return e.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r=n.detail,t.next=3,$(r);case 3:if(a=t.sent){t.next=6;break}return t.abrupt("return",!1);case 6:return o=vt({},r,{npsCampaignId:JSON.parse(a).id}),i=new CustomEvent("asyncWidgetDataObtained",{detail:o}),top.dispatchEvent(i),t.abrupt("return",!0);case 10:case"end":return t.stop()}},t)}))).apply(this,arguments)}function Kt(t){var e;switch(kt){case"popin":e=new z(TEST_ID,bt);break;case"banner":e=new G(TEST_ID,bt,Et);break;default:e=new Q(TEST_ID,bt,St,Nt)}e.init();var n=e.domElement.querySelector(".".concat(e.contentClassName)),r={TEST_ID:TEST_ID,question:Ot,feedbackQuestion:It,userStyles:t,parentContainer:e,buttonText:Lt,thankYouMessage:Pt,zeroLegend:At,tenLegend:_t,recurrence:Wt},a=new lt(r);return a.insert(n,"beforeend"),e.show(),Wt.setDisplayRecurrence(),{parentContainer:e,NPS:a}}function Xt(){return"customCss"!==Dt&&vt({},Object.entries(DATA).filter(function(t){return i(t,1)[0].includes(jt)}).reduce(function(t,e){var n=i(e,2),r=n[0],a=n[1],o=r.split("".concat(jt,"_"))[1],s=vt({},t);return s[o]=a,s},{}),{contentDirection:Tt})}function Zt(){return(Zt=c(e.mark(function t(){var n;return e.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(xt){t.next=3;break}return top.console.error("\n\t\tThe NPS is not linked to any NPS campaign following a test duplicate.\n\t\tPlease go to ABTasty editor (https://app2.abtasty.com/edit/test/".concat(TEST_ID,"/editor) to generate a new NPS campaign.\n\t\t")),t.abrupt("return",!1);case 3:return t.next=5,Ht.isTriggered();case 5:return(n=t.sent)&&Kt(Xt()),t.abrupt("return",n);case 8:case"end":return t.stop()}},t)}))).apply(this,arguments)}F()&&(!function(){if("onFirstWidgetSave"in ABTASTY_S.PLUGINS==0&&(ABTASTY_S.PLUGINS.onFirstWidgetSave=Vt),"editNPSCampaign"in ABTASTY_S.PLUGINS==0&&(ABTASTY_S.PLUGINS.editNPSCampaign=tt),xt||!0===ABTASTY_S.PLUGINS.currentWidgetNeedAsyncSave){if(xt&&!0!==ABTASTY_S.PLUGINS.currentWidgetNeedAsyncSave){var t,e,n=["widgetsave",ABTASTY_S.PLUGINS.editNPSCampaign,{once:!0}];(t=top).removeEventListener.apply(t,n),(e=top).addEventListener.apply(e,n)}}else{var r,a,o=["widgetsave",ABTASTY_S.PLUGINS.onFirstWidgetSave,{once:!0}];(r=top).removeEventListener.apply(r,o),ABTASTY_S.PLUGINS.currentWidgetNeedAsyncSave=!0,(a=top).addEventListener.apply(a,o)}}(),Kt(Xt())),!F()&&Wt.isOver()&&function(){Zt.apply(this,arguments)}()}();
!function(){"use strict";function t(t,e){return t(e={exports:{}},e.exports),e.exports}var e=t(function(t){var e=function(t){var e,n=Object.prototype,r=n.hasOwnProperty,a="function"==typeof Symbol?Symbol:{},o=a.iterator||"@@iterator",i=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function c(t,e,n,r){var a=e&&e.prototype instanceof m?e:m,o=Object.create(a.prototype),i=new x(r||[]);return o._invoke=function(t,e,n){var r=l;return function(a,o){if(r===h)throw new Error("Generator is already running");if(r===p){if("throw"===a)throw o;return O()}for(n.method=a,n.arg=o;;){var i=n.delegate;if(i){var s=S(i,n);if(s){if(s===f)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===l)throw r=p,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=h;var c=u(t,e,n);if("normal"===c.type){if(r=n.done?p:d,c.arg===f)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r=p,n.method="throw",n.arg=c.arg)}}}(t,n,i),o}function u(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var l="suspendedStart",d="suspendedYield",h="executing",p="completed",f={};function m(){}function g(){}function y(){}var v={};v[o]=function(){return this};var b=Object.getPrototypeOf,C=b&&b(b(I([])));C&&C!==n&&r.call(C,o)&&(v=C);var w=y.prototype=m.prototype=Object.create(v);function k(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function N(t){var e;this._invoke=function(n,a){function o(){return new Promise(function(e,o){!function e(n,a,o,i){var s=u(t[n],t,a);if("throw"!==s.type){var c=s.arg,l=c.value;return l&&"object"==typeof l&&r.call(l,"__await")?Promise.resolve(l.__await).then(function(t){e("next",t,o,i)},function(t){e("throw",t,o,i)}):Promise.resolve(l).then(function(t){c.value=t,o(c)},function(t){return e("throw",t,o,i)})}i(s.arg)}(n,a,e,o)})}return e=e?e.then(o,o):o()}}function S(t,n){var r=t.iterator[n.method];if(r===e){if(n.delegate=null,"throw"===n.method){if(t.iterator.return&&(n.method="return",n.arg=e,S(t,n),"throw"===n.method))return f;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var a=u(r,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,f;var o=a.arg;return o?o.done?(n[t.resultName]=o.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,f):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,f)}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function T(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function x(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function I(t){if(t){var n=t[o];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,i=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return i.next=i}}return{next:O}}function O(){return{value:e,done:!0}}return g.prototype=w.constructor=y,y.constructor=g,y[s]=g.displayName="GeneratorFunction",t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,s in t||(t[s]="GeneratorFunction")),t.prototype=Object.create(w),t},t.awrap=function(t){return{__await:t}},k(N.prototype),N.prototype[i]=function(){return this},t.AsyncIterator=N,t.async=function(e,n,r,a){var o=new N(c(e,n,r,a));return t.isGeneratorFunction(n)?o:o.next().then(function(t){return t.done?t.value:o.next()})},k(w),w[s]="Generator",w[o]=function(){return this},w.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},t.values=I,x.prototype={constructor:x,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(T),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function a(r,a){return s.type="throw",s.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],s=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=t,i.arg=e,o?(this.method="next",this.next=o.finallyLoc,f):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),T(n),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var a=r.arg;T(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:I(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),f}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}});var n=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t};var r=function(t){if(Array.isArray(t))return t};var a=function(t,e){var n=[],r=!0,a=!1,o=void 0;try{for(var i,s=t[Symbol.iterator]();!(r=(i=s.next()).done)&&(n.push(i.value),!e||n.length!==e);r=!0);}catch(t){a=!0,o=t}finally{try{r||null==s.return||s.return()}finally{if(a)throw o}}return n};var o=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")};var i=function(t,e){return r(t)||a(t,e)||o()};function s(t,e,n,r,a,o,i){try{var s=t[o](i),c=s.value}catch(t){return void n(t)}s.done?e(c):Promise.resolve(c).then(r,a)}var c=function(t){return function(){var e=this,n=arguments;return new Promise(function(r,a){var o=t.apply(e,n);function i(t){s(o,r,a,i,c,"next",t)}function c(t){s(o,r,a,i,c,"throw",t)}i(void 0)})}};var u=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t};var l=function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}};var d=function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)};var h=function(){throw new TypeError("Invalid attempt to spread non-iterable instance")};var p=function(t){return l(t)||d(t)||h()};var f=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")};function m(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var g=function(t,e,n){return e&&m(t.prototype,e),n&&m(t,n),t},y=t(function(t){function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function n(r){return"function"==typeof Symbol&&"symbol"===e(Symbol.iterator)?t.exports=n=function(t){return e(t)}:t.exports=n=function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":e(t)},n(r)}t.exports=n});var v=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t};var b=function(t,e){return!e||"object"!==y(e)&&"function"!=typeof e?v(t):e},C=t(function(t){function e(n){return t.exports=e=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},e(n)}t.exports=e}),w=t(function(t){function e(n,r){return t.exports=e=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},e(n,r)}t.exports=e});var k=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&w(t,e)},N="Recurrence",S="Récurrence",E="Recurrencia",T="Wiederholung",x={en:"".concat(N," of the display"),fr:"".concat(S," de l'affichage"),es:"".concat(E," de la pantalla"),de:"".concat(T," der Anzeige")},I={en:"".concat(N," after closure"),fr:"".concat(S," après fermeture"),es:"".concat(E," después del cierre"),de:"".concat(T," nach Schließung")},O={en:"".concat(N," after validation"),fr:"".concat(S," après validation"),es:"".concat(E," después de la validación"),de:"".concat(T," nach der Validierung")},L={en:"Trigger",fr:"Déclencheur",es:"Desencadenar",de:"Auslösen"};function P(t,e){var n=Object.keys(t);return Object.getOwnPropertySymbols&&n.push.apply(n,Object.getOwnPropertySymbols(t)),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n}function _(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?P(n,!0).forEach(function(e){u(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):P(n).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}var A={category:"conditions",type:"select",options:[{label:{en:"Every time",fr:"Tout le temps",es:"Cada vez",de:"Jedes Mal"},value:"-1"},{label:{en:"Every session",fr:"Chaque session",es:"En cada sesión",de:"Jede Session"},value:"0"},{label:{en:"Everyday",fr:"Chaque jour",es:"Cada día",de:"Jeden Tag"},value:"1"},{label:{en:"Every week",fr:"Chaque semaine",es:"Cada semana",de:"Jede Woche"},value:"7"},{label:{en:"Every month",fr:"Chaque mois",es:"Cada mes",de:"Jeden Monat"},value:"30"},{label:{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)"},value:"365"}],value:"-1"},D=(_({},A,{label:I,propName:"closingRecurrence"}),_({},A,{label:x,propName:"displayRecurrence"}),_({},A,{label:O,propName:"validationRecurrence"}),[{label:{en:"Page load",fr:"Chargement de la page",es:"Carga de página",de:"Seite laden"},value:"pageLoad"},{label:{en:"Click",fr:"Clic",es:"Clic",de:"Klicken"},value:"click"},{label:{en:"Exit intent",fr:"Avant fermeture de l'onglet",es:"Intención de salida",de:"Absicht beenden"},value:"exitIntent"},{label:{en:"Delay",fr:"Délai",es:"Retrasar",de:"Verzögern"},value:"delay"},{label:{en:"Reengage (after inactivity)",fr:"Réengagement (après inactivité)",es:"Despues de inactividad",de:"Nach Untätigkeit"},value:"reengage"}]),j={category:"conditions",type:"selectelement",propName:"".concat("triggerEvent","Click"),label:L,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:"triggerEvent",value:"click"}]},R={category:"conditions",type:"number",propName:"".concat("triggerEvent","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:"triggerEvent",value:"exitIntent"}]},B={category:"conditions",type:"number",propName:"".concat("triggerEvent","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:"triggerEvent",value:"reengage"}]},Y={category:"conditions",type:"number",propName:"".concat("triggerEvent","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:"triggerEvent",value:"delay"}]},F=([{category:"conditions",type:"select",label:{en:"Triggers on",fr:"Se déclenche au",es:"Disparadores en",de:"Löst aus"},options:D,propName:"triggerEvent",value:"pageLoad"}].concat(p([j,R,B,Y])),function(){return Object.prototype.hasOwnProperty.call(window,"ABTastyEditor")});function q(t,e){return new Promise(function(n,r){var a=new XMLHttpRequest;a.open(t,e,!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 M=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"000000",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";f(this,t),this.testID=e,this.widgetContainer=n,this.basicClassName="ab_widget_container_".concat(n),this.widgetContainerId="".concat(this.basicClassName,"_").concat(e),this.contentClassName="".concat(this.basicClassName,"_content"),this.overlayClassName="".concat(this.basicClassName,"_overlay"),this.closeButtonClassName="".concat(this.basicClassName,"_close_button"),this.hideClassName="ab_hide_".concat(e),this.domElement=this.getDom()}return g(t,[{key:"insert",value:function(){var t=this;return W("head",function(e){return e.appendChild(t.styleElement)},function(t){return console.error(t)}),W("body",function(e){return e.appendChild(t.domElement)},function(t){return console.error(t)}),this}},{key:"remove",value:function(){return this.domElement.remove(),this.styleElement.remove(),this}},{key:"show",value:function(){return this.domElement.classList.remove("ab_hide"),this}},{key:"hide",value:function(){return this.domElement.classList.add("ab_hide"),this}},{key:"init",value:function(){return this.insert(),this.addCloseEvent(),this}},{key:"addCloseEvent",value:function(){for(var t=this,e=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,p(e)),r.forEach(function(e){e.addEventListener("click",function(){t.hide()},!0)}),this}},{key:"getDom",value:function(){var t=document.createElement("div");return t.className="".concat(this.basicClassName," ab_hide"),t.id=this.widgetContainerId,t.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(F()?"data-abtasty-actionnable":"",">+</button>\n\t\t\t</div>"),t}},{key:"getStyleTag",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=document.createElement("style");return e.type="text/css",F()&&e.setAttribute("abtasty-script-added","true"),e.textContent="\n\t\t\t.".concat(this.hideClassName," {opacity: 0 !important; pointer-events: none;}\n\t\t\t").concat(t),e}}]),t}(),G=function(t){function e(t,n){var r;return f(this,e),(r=b(this,C(e).call(this,t,n))).stringStyles=r.getStyles(),r.styleElement=r.getStyleTag(r.stringStyles),r}return k(e,M),g(e,[{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}")}}]),e}(),z=function(t){function e(t,n,r){var a;return f(this,e),(a=b(this,C(e).call(this,t,n))).position=r,a.stringStyles=a.getStyles(),a.styleElement=a.getStyleTag(a.stringStyles),a}return k(e,M),g(e,[{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}")}}]),e}(),U=function(t){function e(t,n,r,a){var o;return f(this,e),(o=b(this,C(e).call(this,t,n))).position=r,o.referrerElement=a,o.stringStyles=o.getStyles(),o.styleElement=o.getStyleTag(o.stringStyles),o}return k(e,M),g(e,[{key:"insert",value:function(){var t=this;return W("head",function(e){return e.appendChild(t.styleElement)},function(t){return console.error(t)}),W(this.referrerElement,function(e){return e.insertAdjacentElement(t.position,t.domElement)},function(t){return console.error(t)}),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}")}}]),e}(),Q=function(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];n.unshift("[AB Tasty Widget] ".concat(PACKAGE,":")),(t=console).log.apply(t,n)},W=function(t,e,n){var r,a=0;try{document.querySelector(t)}catch(e){var o="Selector «".concat(t,"» not valid.");return Q(o),"function"==typeof n&&n(o)}r=setTimeout(function(){clearInterval(a);var e="Can't find element «".concat(t,"».");return Q(e),"function"==typeof n&&n(e)},1e4),a=setInterval(function(){var n=document.querySelector(t);if(null!==n)return clearTimeout(r),clearInterval(a),"function"==typeof e&&e(n)},200)};var H=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")};function V(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var J=function(t,e,n){return e&&V(t.prototype,e),n&&V(t,n),t},K="https://nps.abtasty.com/api/",X=DATA.isFeedBackQuestion,Z=function(t){var e=t.question,n=t.npsCampaignId,r=t.userFeedback;return{abtastyIdentifier:"abtastyidentifier=".concat(top.ABTasty.accountSettings.identifier),accessToken:"access_token=".concat(ABTASTY_S.SERVER.token),testId:"testId=".concat(TEST_ID),variationId:"variationId=".concat(ABTASTY_S.STORE.currentVariation.id),name:"name=".concat(ABTASTY_S.STORE.test.name," - ").concat(ABTASTY_S.STORE.currentVariation.name),nps:"nps=".concat(e),feedback:"feedback=".concat(X?r:""),id:"id=".concat(n)}},$=function(t){if(t.npsCampaignId)return!1;var e,n,r,a,o,i,s,c,u=Z(t);return q("GET",(n=(e=u).abtastyIdentifier,r=e.accessToken,a=e.testId,o=e.variationId,i=e.name,s=e.nps,c=e.feedback,"".concat(K,"setNPS.php?").concat(n,"&").concat(r,"&").concat(a,"&").concat(o,"&").concat(i,"&").concat(s,"&").concat(c)))},tt=function(t){var e=t.detail;if(!e.npsCampaignId)return!1;var n,r,a,o,i,s,c,u,l,d=Z(e);return q("GET",(r=(n=d).id,a=n.abtastyIdentifier,o=n.accessToken,i=n.testId,s=n.variationId,c=n.name,u=n.nps,l=n.feedback,"".concat(K,"setNPS.php?").concat(r,"&").concat(a,"&").concat(o,"&").concat(i,"&").concat(s,"&").concat(c,"&").concat(u,"&").concat(l)))},et=function(t,e){var n,r,a,o=DATA,i=o.question,s=o.npsCampaignId,c=function(t,e){var n=e.feedback,r=e.id,a=e.abtastyIdentifier,o="score=".concat(t);return"".concat(K,"collect.php?").concat(o,"&").concat(n,"&nps").concat(r,"&").concat(a)}(t,Z({question:i,npsCampaignId:s,userFeedback:e}));return n="GET",r=c,(a=new XMLHttpRequest).open(n,r,!1),a.send(null),a};function nt(t,e){var n=Object.keys(t);return Object.getOwnPropertySymbols&&n.push.apply(n,Object.getOwnPropertySymbols(t)),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n}var rt=DATA,at=rt.themeType,ot=rt.layout,it=rt.isFeedBackQuestion,st=rt.isThankYouMessage,ct=rt.isLegend,ut=rt.timeHide,lt=function(){function t(e){var n=e.TEST_ID,r=e.question,a=e.feedbackQuestion,o=e.userStyles,i=e.parentContainer,s=e.buttonText,c=e.thankYouMessage,u=e.zeroLegend,l=e.tenLegend,d=e.recurrence;H(this,t),this.testID=n,this.question=r,this.feedbackQuestion=a,this.userStyles=o,this.parentContainer=i,this.buttonText=s,this.thankYouMessage=c,this.legend={zeroLegend:u,tenLegend:l},this.recurrence=d,this.baseClassName="nps_container",this.npsClassName="".concat(this.baseClassName,"_").concat(this.testID),this.questionClassName="".concat(this.baseClassName,"_question"),this.notesClassName="".concat(this.baseClassName,"_notes"),this.feedbackQuestionClassName="".concat(this.questionClassName,"_feedback"),this.feedbackFormClassName="".concat(this.questionClassName,"_feedback_form"),this.notesButtonsClassName="".concat(this.notesClassName,"_button"),this.thankYouClassName="".concat(this.baseClassName,"_thanks"),this.hideClassName="nps_".concat(this.testID,"_display_none"),this.currentNote=NaN,this.userFeedback="",this.npsContainer=this.getContainer(),this.questionElement=this.getQuestionElement(),this.notesContainer=this.getNotesElement(),this.feedbackElements=this.getFeedBackElements(),this.thankYouElement=this.getThankYouElement(),this.npsElement=this.getNPSElement(),this.styleElement=this.getStyleElement()}return J(t,[{key:"sendNote",value:function(){return top.console.log("".concat(this.currentNote)),F()||isNaN(this.currentNote)||(et(this.currentNote,this.userFeedback),window.abtasty.send("nps",{ns:this.currentNote,nf:this.userFeedback}),this.recurrence.setValidationRecurrence()),this}},{key:"setExternalEvents",value:function(){var t=this;[this.parentContainer.overlayClassName,this.parentContainer.closeButtonClassName].forEach(function(e){t.parentContainer.domElement.querySelector(".".concat(e)).addEventListener("mouseup",t.recurrence.setClosingRecurrence,{passive:!0,once:!0})})}},{key:"insert",value:function(t,e){return document.head.insertAdjacentElement("beforeend",this.styleElement),t.insertAdjacentElement(e,this.npsElement),this.setExternalEvents(),this}},{key:"remove",value:function(){return this.npsElement&&this.npsElement.remove(),this.styleElement&&this.styleElement.remove(),this}},{key:"complete",value:function(){var t=this;this.sendNote(),setTimeout(function(){t.parentContainer.hide(),setTimeout(function(){return t.remove()},1e3)},1e3*ut)}},{key:"onClickNote",value:function(t){this.currentNote=t.target.dataset.note,it&&this.feedbackQuestion&&this.feedbackQuestion.length?this.showFeedBack():st&&this.thankYouMessage&&this.thankYouMessage.length&&this.showThankYouMessage()}},{key:"onFeedbackSend",value:function(){st&&this.thankYouMessage&&this.thankYouMessage.length?this.showThankYouMessage():this.complete()}},{key:"showFeedBack",value:function(){var t=this;return this.npsContainer.childNodes.forEach(function(e){return e.classList.add(t.hideClassName)}),Object.values(this.feedbackElements).forEach(function(e){return e.classList.remove(t.hideClassName)}),this}},{key:"showThankYouMessage",value:function(){var t=this;return this.npsContainer.childNodes.forEach(function(e){return e.classList.add(t.hideClassName)}),this.thankYouElement.classList.remove(this.hideClassName),this.complete(),this}},{key:"getThankYouElement",value:function(){var t=document.createElement("p");return t.className="".concat(this.thankYouClassName," ").concat(this.hideClassName),t.innerHTML=this.thankYouMessage,t}},{key:"getFeedBackElements",value:function(){var t=this,e=document.createElement("p");e.className="".concat(this.feedbackQuestionClassName," ").concat(this.hideClassName),e.innerHTML=this.feedbackQuestion;var n=document.createElement("form");n.className="".concat(this.feedbackFormClassName," ").concat(this.hideClassName);var r=document.createElement("input");r.className="".concat(this.feedbackQuestionClassName,"_input"),r.type="text";var a=document.createElement("button");return a.className="".concat(this.feedbackQuestionClassName,"_button"),a.innerHTML=this.buttonText,a.addEventListener("click",function(){return t.onFeedbackSend()},{passive:!0}),n.appendChild(r),n.appendChild(a),{feedbackQuestionElement:e,feedbackFormElement:n}}},{key:"getNotesElement",value:function(){var t=this,e=document.createElement("div");e.className=this.notesClassName;for(var n=10;n>=0;){var r=document.createElement("button");r.className=this.notesButtonsClassName,r.dataset.note=n,F()&&r.setAttribute("data-abtasty-actionnable",""),r.innerHTML+="<span>".concat(n,"</span>"),r.addEventListener("click",function(e){return t.onClickNote(e)},{passive:!0}),e.insertAdjacentElement("afterbegin",r),n-=1}return ct&&(e.insertAdjacentHTML("afterbegin","<legend>".concat(this.legend.zeroLegend,"</legend>")),e.insertAdjacentHTML("beforeend","<legend>".concat(this.legend.tenLegend,"</legend>"))),e}},{key:"getQuestionElement",value:function(){var t=document.createElement("p");return t.className=this.questionClassName,t.innerHTML=this.question,t}},{key:"getContainer",value:function(){var t=document.createElement("div");return t.className="".concat(this.baseClassName," ").concat(this.npsClassName),t}},{key:"getNPSElement",value:function(){var t=this;return this.npsContainer.appendChild(this.questionElement),this.npsContainer.appendChild(this.notesContainer),it&&Object.values(this.feedbackElements).forEach(function(e){t.npsContainer.appendChild(e)}),st&&this.npsContainer.appendChild("getNPSElement 3",this.thankYouElement),this.npsContainer}},{key:"getDefaultStyles",value:function(){return"\n\t\t#".concat(this.parentContainer.widgetContainerId," .").concat(this.hideClassName," {\n\t\t\tdisplay: none !important;\n\t\t}\n\t\t#").concat(this.parentContainer.widgetContainerId," .").concat(this.baseClassName,",\n\t\t#").concat(this.parentContainer.widgetContainerId," .").concat(this.baseClassName," * {\n\t\t\twidth: auto;\n\t\t\theight: auto;\n\t\t\tmin-width: inherit;\n\t\t\tmin-height: inherit;\n\t\t\tmax-width: inherit;\n\t\t\tmax-height: inherit;\n\t\t\tfont-size: 1vmin;\n\t\t\tline-height: 1;\n\t\t\tmargin: 0;\n\t\t\tpadding: 0;\n\t\t\tborder: none;\n\t\t}")}},{key:"getThemeDefaultStyles",value:function(){var t="popin"===ot?"75em":"auto",e="#".concat(this.parentContainer.widgetContainerId," .").concat(this.npsClassName);return"\n\t\t".concat(e,",\n\t\t").concat(e," * {\n\t\t\tdisplay: flex;\n\t\t\tflex-wrap: nowrap;\n\t\t\tjustify-content: center;\n\t\t}\n\t\t").concat(e," {\n\t\t\twidth: ").concat(t,";\n\t\t\talign-items: center;\n\t\t}\n\t\t").concat(e," .").concat(this.questionClassName,",\n\t\t").concat(e," .").concat(this.feedbackQuestionClassName,",\n\t\t").concat(e," .").concat(this.thankYouClassName," {\n\t\t\tfont-size: 2em;\n\t\t}\n\t\t").concat(e," .").concat(this.notesClassName," {\n\t\t\tflex-direction: row;\n\t\t}\n\t\t").concat(e," .").concat(this.notesClassName," legend {\n\t\t\talign-self: center;\n\t\t\tfont-size: 1.5em;\n\t\t}\n\t\t").concat(e," .").concat(this.notesClassName," legend:first-of-type {\n\t\t\tmargin-right: 1em;\n\t\t}\n\t\t").concat(e," .").concat(this.notesClassName," legend:last-of-type {\n\t\t\tmargin-left: 1em;\n\t\t}\n\t\t").concat(e," .").concat(this.notesButtonsClassName," {\n\t\t\twidth: 3.5em;\n\t\t\theight: 3.5em;\n\t\t}\n\t\t").concat(e," .").concat(this.notesButtonsClassName," span {\n\t\t\tfont-size: 2em;\n\t\t}\n\t\t").concat(e," .").concat(this.feedbackFormClassName," {\n\t\t\tflex-direction: row;\n\t\t}\n\t\t").concat(e," .").concat(this.feedbackFormClassName," input {\n\t\t\twidth: 45em;\n\t\t\theight: 4em;\n\t\t\tborder-radius: 8px;\n\t\t\tborder: 2px solid blue;\n\t\t}\n\t\t").concat(e," .").concat(this.feedbackFormClassName," button {\n\t\t\twidth: 10em;\n\t\t\tborder-radius: 8px;\n\t\t\tbackground: blue;\n\t\t\tcolor: white;\n\t\t\tfont-size: 1.4em;\n\t\t}")}},{key:"getUserStyles",value:function(){var t,e=this.userStyles,r=e.backgroundColor,a=e.borderColor,o=e.borderRadius,s=e.borderWidth,c=e.dropShadow,u=e.textColor,l=e.horizontalPaddingContainer,d=e.verticalPaddingContainer,h=e.horizontalMarginContainer,p=e.verticalMarginContainer,f=e.overlayColor,m=e.overlayOpacity,g=e.shadowOpacity,y=e.buttonsContrast,v=e.buttonsShape,b=e.contentDirection,C=e.questionMargin,w=e.buttonsHorizontalMargin,k=Object.entries(this.userStyles).filter(function(t){return i(t,1)[0].includes(y)}).reduce(function(t,e){var r=i(e,2),a=r[0],o=r[1],s=a.split("_".concat(y))[0],c=function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?nt(r,!0).forEach(function(e){n(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):nt(r).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}({},t);return c[s]=o,c},{}),N=k.buttonsBackgroundColor,S=k.buttonsTextColor,E=k.buttonsBorderColor,T=k.buttonsBorderWidth;switch(v){case"roundsquare":t="border-radius: 8px;";break;case"round":t="border-radius: 50%;";break;default:t=""}var x=c?"box-shadow: 0px 5px 10px 2px rgba(0, 0, 0, ".concat(g/100,");"):"",I="#".concat(this.parentContainer.widgetContainerId," .").concat(this.npsClassName),O="\n\t\t\t".concat(I," .").concat(this.notesButtonsClassName," {\n\t\t\t\tmargin-left: ").concat(w,"px;\n\t\t\t\tmargin-right: ").concat(w,"px;\n\t\t\t\tbackground-color: ").concat(N,";\n\t\t\t\tborder: ").concat(T,"px solid ").concat(E,";\n\t\t\t\t").concat(t,"\n\t\t\t}\n\t\t\t").concat(I," .").concat(this.notesButtonsClassName," span {\n\t\t\t\tcolor: ").concat(S,";\n\t\t\t}");return"\n\t\t\tbody ".concat(I," {\n\t\t\t\tflex-direction: ").concat(b,";\n\t\t\t\tbackground-color: ").concat(r,";\n\t\t\t\tborder: ").concat(s,"px solid ").concat(a,";\n\t\t\t\tborder-radius: ").concat(o,"px;\n\t\t\t\tpadding: ").concat(d,"px ").concat(l,"px;\n\t\t\t\t").concat(x,"\n\t\t\t}\n\t\t\t").concat(I," .").concat(this.questionClassName,",\n\t\t\t").concat(I," .").concat(this.feedbackQuestionClassName," ,\n\t\t\t").concat(I," .").concat(this.thankYouClassName," {\n\t\t\t\tcolor: ").concat(u,";\n\t\t\t\tmargin-").concat("row"===b?"right":"bottom"," : ").concat(C,"px;\n\t\t\t}\n\t\t\t").concat(I," .").concat(this.notesClassName," legend {\n\t\t\t\tcolor: ").concat(u,";\n\t\t\t}\n\t\t\t").concat(O,"\n\t\t\tbody #").concat(this.parentContainer.widgetContainerId," {\n\t\t\t\tmargin: ").concat(p,"px ").concat(h,"px;\n\t\t\t}\n\t\t\tbody #").concat(this.parentContainer.widgetContainerId," .").concat(this.parentContainer.overlayClassName," {\n\t\t\t\tbackground-color: ").concat(f,";\n\t\t\t\topacity: ").concat(m/100,";\n\t\t\t}")}},{key:"getStyleElement",value:function(){var t="theme"===at,e=this.getDefaultStyles(),n=t?this.getThemeDefaultStyles():"",r=t?this.getUserStyles():"",a=document.createElement("style");return F()&&a.setAttribute("abtasty-script-added","true"),a.textContent="".concat(e," ").concat(n," ").concat(r),a}}]),t}(),dt=function(){function t(e){var n=e.displayRecurrence,r=e.closingRecurrence,a=e.validationRecurrence,o=e.widgetName;H(this,t),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 J(t,[{key:"getCurrentRecurrence",value:function(){var t={type:!1},e=sessionStorage.getItem(this.storageName)||localStorage.getItem(this.storageName);try{return JSON.parse(e)||t}catch(e){return t}}},{key:"isOver",value:function(){var t=sessionStorage.getItem(this.storageName),e=localStorage.getItem(this.storageName),n=e?parseFloat(e):0,r=(new Date).getTime(),a=!!e&&n<r;return a&&localStorage.removeItem(this.storageName),!t||!e||a}},{key:"setRecurrence",value:function(t,e){var n=this,r=this.getTypeOfStorage(t),a=this.getStamp(t),o={type:e,stamp:a},i=this.currentRecurrence.type,s=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(i&&"validation"!==e)if("closing"===e&&"validation"!==i)s();else{if("display"!==e||"validation"===i||"closing"===i)return!1;s()}else s();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(t){return(new Date).getTime()+864e5*t}},{key:"getTypeOfStorage",value:function(t){return!(isNaN(t)||t<0||0!==t&&!t)&&(t>0?window.localStorage:0===t&&window.sessionStorage)}}]),t}();var ht=function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}};var pt=function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)};var ft=function(){throw new TypeError("Invalid attempt to spread non-iterable instance")};var mt=function(t){return ht(t)||pt(t)||ft()},gt=function(){function t(e){var n=e.triggerEvent,r=e.triggerSelector,a=e.triggerDelay;H(this,t),this.event=n,this.selector=r&&r.length?r:"body",this.delay=a}return J(t,[{key:"onPageLoad",value:function(){return new Promise(function(t,e){if("complete"!==document.readyState){var n,r=["DOMContentLoaded",function(){return t(!0)},{passive:!0,once:!0}];(n=window).addEventListener.apply(n,r),setTimeout(function(){var t;return(t=window).removeEventListener.apply(t,r),e(!1)},15e3)}return t(!0)})}},{key:"onClick",value:function(){var t=this,e=document.createElement("style");return e.innerHTML="".concat(this.selector," {\n\t\t\tcursor: pointer !important;\n\t\t\tpointer-events: all !important;\n\t\t}"),document.head.appendChild(e),new Promise(function(n){var r,a=function(e){return mt(document.querySelectorAll(t.selector)).some(function(n){return n.isSameNode(e)||!!e.closest(t.selector)})},o=["click",function(t){return!!a(t.target)&&(document.head.removeChild(e),n(!0))},{passive:!0,once:!0,capture:!0}];(r=document).addEventListener.apply(r,o)})}},{key:"onExitIntent",value:function(){var t=this;return new Promise(function(){var n=c(e.mark(function n(r){var a;return e.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a=["mouseleave",function(){if(top.console.log("mouseleave"),t.delay){var e=1e3*t.delay;setTimeout(function(){return r(!0)},e)}return r(!0)},{passive:!0,once:!0}],e.next=4,t.onPageLoad();case 4:e.sent&&W("body",function(t){return t.addEventListener.apply(t,a)});case 6:case"end":return e.stop()}},n)}));return function(t){return n.apply(this,arguments)}}())}},{key:"onDelay",value:function(){var t=this;return new Promise(function(){var n=c(e.mark(function n(r){var a;return e.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a=1e3*t.delay,e.next=3,t.onPageLoad();case 3:e.sent&&setTimeout(function(){return r(!0)},a);case 5:case"end":return e.stop()}},n)}));return function(t){return n.apply(this,arguments)}}())}},{key:"onReengage",value:function(){var t=this;return new Promise(function(e){var n=1e3*t.delay,r=n,a=[function(){return r=n},{passive:!0}];["click","mousemove","scroll","keypress"].forEach(function(t){var e;return(e=document).addEventListener.apply(e,[t].concat(a))});var o=setInterval(function(){r<=0?(e(!0),clearInterval(o)):r-=100},100)})}},{key:"isTriggered",value:function(){var t=c(e.mark(function t(){var n;return e.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:top.console.log("isTriggered",this),t.t0=this.event,t.next="pageLoad"===t.t0?4:"click"===t.t0?8:"exitIntent"===t.t0?12:"delay"===t.t0?16:"reengage"===t.t0?22:26;break;case 4:return t.next=6,this.onPageLoad();case 6:return n=t.sent,t.abrupt("break",27);case 8:return t.next=10,this.onClick();case 10:return n=t.sent,t.abrupt("break",27);case 12:return t.next=14,this.onExitIntent();case 14:return n=t.sent,t.abrupt("break",27);case 16:return top.console.log("delay"),t.next=19,this.onDelay();case 19:return n=t.sent,top.console.log("delay, eventTrigered:",n),t.abrupt("break",27);case 22:return t.next=24,this.onReengage();case 24:return n=t.sent,t.abrupt("break",27);case 26:n=!1;case 27:return t.abrupt("return",n);case 28:case"end":return t.stop()}},t,this)}));return function(){return t.apply(this,arguments)}}()}]),t}();function yt(t,e){var n=Object.keys(t);return Object.getOwnPropertySymbols&&n.push.apply(n,Object.getOwnPropertySymbols(t)),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n}function vt(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?yt(r,!0).forEach(function(e){n(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):yt(r).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}var bt="NPS";top.console.log(DATA,TEST_ID,PLUGIN_ID);var Ct,wt=DATA,kt=wt.layout,Nt=wt.bannerPosition,St=wt.npsElementReferrer,Et=wt.npsReferrerInsertType,Tt=wt.contentDirection,xt=wt.npsCampaignId,It=wt.question,Ot=wt.feedbackQuestion,Lt=wt.buttonText,Pt=wt.thankYouMessage,_t=wt.zeroLegend,At=wt.tenLegend,Dt=wt.themeType,jt=wt.theme,Rt=wt.triggerEvent,Bt=wt.triggerEventClick,Yt=wt.triggerEventDelay,Ft=wt.triggerEventExitDelay,qt=wt.triggerEventReengageDelay,Mt=wt.displayRecurrence,Gt=wt.closingRecurrence,zt=wt.validationRecurrence,Ut=Bt;switch(Rt){case"exitIntent":Ct=Ft;break;case"delay":Ct=Yt;break;case"reengage":Ct=qt;break;default:Ct=0}var Qt={displayRecurrence:Mt,closingRecurrence:Gt,validationRecurrence:zt,widgetName:bt},Wt={triggerEvent:Rt,triggerSelector:Ut,triggerDelay:Ct};top.console.log("triggerParams:",Wt);var Ht=new dt(Qt),Vt=new gt(Wt);function Jt(t){return Kt.apply(this,arguments)}function Kt(){return(Kt=c(e.mark(function t(n){var r,a,o,i;return e.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return r=n.detail,t.next=3,$(r);case 3:if(a=t.sent){t.next=6;break}return t.abrupt("return",!1);case 6:return o=vt({},r,{npsCampaignId:JSON.parse(a).id}),i=new CustomEvent("asyncWidgetDataObtained",{detail:o}),top.dispatchEvent(i),t.abrupt("return",!0);case 10:case"end":return t.stop()}},t)}))).apply(this,arguments)}function Xt(t){var e;switch(kt){case"popin":e=new G(TEST_ID,bt);break;case"banner":e=new z(TEST_ID,bt,Nt);break;default:e=new U(TEST_ID,bt,Et,St)}e.init();var n=e.domElement.querySelector(".".concat(e.contentClassName)),r={TEST_ID:TEST_ID,question:It,feedbackQuestion:Ot,userStyles:t,parentContainer:e,buttonText:Lt,thankYouMessage:Pt,zeroLegend:_t,tenLegend:At,recurrence:Ht},a=new lt(r);return a.insert(n,"beforeend"),e.show(),F()?ABTASTY_S.PLUGINS.NPS_Container_Class=e:Ht.setDisplayRecurrence(),{parentContainer:e,NPS:a}}function Zt(){return"customCss"!==Dt&&vt({},Object.entries(DATA).filter(function(t){return i(t,1)[0].includes(jt)}).reduce(function(t,e){var n=i(e,2),r=n[0],a=n[1],o=r.split("".concat(jt,"_"))[1],s=vt({},t);return s[o]=a,s},{}),{contentDirection:Tt})}function $t(){return($t=c(e.mark(function t(){var n;return e.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(xt){t.next=3;break}return top.console.error("\n\t\tThe NPS is not linked to any NPS campaign following a test duplicate.\n\t\tPlease go to ABTasty editor (https://app2.abtasty.com/edit/test/".concat(TEST_ID,"/editor) to generate a new NPS campaign.\n\t\t")),t.abrupt("return",!1);case 3:return t.next=5,Vt.isTriggered();case 5:return(n=t.sent)&&Xt(Zt()),t.abrupt("return",n);case 8:case"end":return t.stop()}},t)}))).apply(this,arguments)}F()&&(!function(){if("onFirstWidgetSave"in ABTASTY_S.PLUGINS==0&&(ABTASTY_S.PLUGINS.onFirstWidgetSave=Jt),"editNPSCampaign"in ABTASTY_S.PLUGINS==0&&(ABTASTY_S.PLUGINS.editNPSCampaign=tt),xt||!0===ABTASTY_S.PLUGINS.currentWidgetNeedAsyncSave){if(xt&&!0!==ABTASTY_S.PLUGINS.currentWidgetNeedAsyncSave){var t,e,n=["widgetsave",ABTASTY_S.PLUGINS.editNPSCampaign,{once:!0}];(t=top).removeEventListener.apply(t,n),(e=top).addEventListener.apply(e,n)}}else{var r,a,o=["widgetsave",ABTASTY_S.PLUGINS.onFirstWidgetSave,{once:!0}];(r=top).removeEventListener.apply(r,o),ABTASTY_S.PLUGINS.currentWidgetNeedAsyncSave=!0,(a=top).addEventListener.apply(a,o)}}(),ABTASTY_S.PLUGINS.NPS_Container_Class&&ABTASTY_S.PLUGINS.NPS_Container_Class.remove(),Xt(Zt())),!F()&&Ht.isOver()&&function(){$t.apply(this,arguments)}(),top.console.log("test local tag")}();
{
"name": "@abtasty/nps",
"description": "Allow you to add a custom NPS on your website",
"version": "0.2.3-7",
"version": "0.2.3-8",
"main": "dist/main.js",

@@ -6,0 +6,0 @@ "form": "dist/form.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