@abtasty/countdown 1.4.1 → 2.0.1-0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +1 -0
- package/dist/form.js +1 -1
- package/dist/main.js +1 -1
- package/package.json +55 -55
package/dist/main.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
!function(){"use strict";var e=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e){var t=function(e){var t=Object.prototype,r=t.hasOwnProperty,s="function"==typeof Symbol?Symbol:{},n=s.iterator||"@@iterator",i=s.asyncIterator||"@@asyncIterator",o=s.toStringTag||"@@toStringTag";function a(e,t,r,s){var n=t&&t.prototype instanceof l?t:l,i=Object.create(n.prototype),o=new S(s||[]);return i._invoke=function(e,t,r){var s="suspendedStart";return function(n,i){if("executing"===s)throw new Error("Generator is already running");if("completed"===s){if("throw"===n)throw i;return L()}for(r.method=n,r.arg=i;;){var o=r.delegate;if(o){var a=b(o,r);if(a){if(a===h)continue;return a}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===s)throw s="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);s="executing";var l=c(e,t,r);if("normal"===l.type){if(s=r.done?"completed":"suspendedYield",l.arg===h)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(s="completed",r.method="throw",r.arg=l.arg)}}}(e,r,o),i}function c(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=a;var h={};function l(){}function u(){}function d(){}var g={};g[n]=function(){return this};var m=Object.getPrototypeOf,v=m&&m(m(T([])));v&&v!==t&&r.call(v,n)&&(g=v);var f=d.prototype=l.prototype=Object.create(g);function p(e){["next","throw","return"].forEach((function(t){e[t]=function(e){return this._invoke(t,e)}}))}function y(e){var t;this._invoke=function(s,n){function i(){return new Promise((function(t,i){!function t(s,n,i,o){var a=c(e[s],e,n);if("throw"!==a.type){var h=a.arg,l=h.value;return l&&"object"==typeof l&&r.call(l,"__await")?Promise.resolve(l.__await).then((function(e){t("next",e,i,o)}),(function(e){t("throw",e,i,o)})):Promise.resolve(l).then((function(e){h.value=e,i(h)}),(function(e){return t("throw",e,i,o)}))}o(a.arg)}(s,n,t,i)}))}return t=t?t.then(i,i):i()}}function b(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,b(e,t),"throw"===t.method))return h;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var s=c(r,e.iterator,t.arg);if("throw"===s.type)return t.method="throw",t.arg=s.arg,t.delegate=null,h;var n=s.arg;return n?n.done?(t[e.resultName]=n.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,h):n:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,h)}function w(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function E(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function S(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(w,this),this.reset(!0)}function T(e){if(e){var t=e[n];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var s=-1,i=function t(){for(;++s<e.length;)if(r.call(e,s))return t.value=e[s],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:L}}function L(){return{value:void 0,done:!0}}return u.prototype=f.constructor=d,d.constructor=u,d[o]=u.displayName="GeneratorFunction",e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===u||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,o in e||(e[o]="GeneratorFunction")),e.prototype=Object.create(f),e},e.awrap=function(e){return{__await:e}},p(y.prototype),y.prototype[i]=function(){return this},e.AsyncIterator=y,e.async=function(t,r,s,n){var i=new y(a(t,r,s,n));return e.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},p(f),f[o]="Generator",f[n]=function(){return this},f.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var s=t.pop();if(s in e)return r.value=s,r.done=!1,r}return r.done=!0,r}},e.values=T,S.prototype={constructor:S,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function s(r,s){return o.type="throw",o.arg=e,t.next=r,s&&(t.method="next",t.arg=void 0),!!s}for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n],o=i.completion;if("root"===i.tryLoc)return s("end");if(i.tryLoc<=this.prev){var a=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(a&&c){if(this.prev<i.catchLoc)return s(i.catchLoc,!0);if(this.prev<i.finallyLoc)return s(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return s(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return s(i.finallyLoc)}}}},abrupt:function(e,t){for(var s=this.tryEntries.length-1;s>=0;--s){var n=this.tryEntries[s];if(n.tryLoc<=this.prev&&r.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var o=i?i.completion:{};return o.type=e,o.arg=t,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),h},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),E(r),h}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var s=r.completion;if("throw"===s.type){var n=s.arg;E(r)}return n}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:T(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}}));function t(e,t,r,s,n,i,o){try{var a=e[i](o),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(s,n)}var r=function(e){return function(){var r=this,s=arguments;return new Promise((function(n,i){var o=e.apply(r,s);function a(e){t(o,n,i,a,c,"next",e)}function c(e){t(o,n,i,a,c,"throw",e)}a(void 0)}))}};const s=()=>Object.prototype.hasOwnProperty.call(window,"ABTastyEditor");const n=()=>!!window.ABTasty.getTestsOnPage()[TEST_ID],i=()=>{const{type:e}=DATA;return`${PACKAGE.replace("@abtasty/","")}${e?`_${e}`:""}`},o=()=>`${PLUGIN_ID.split("-")[0]}_${TEST_ID}`,a=(...e)=>{e.unshift(`[AB Tasty Widget] ${PACKAGE}:`),console.log(...e)},c=(e,t,r)=>{let s=0,n=0;try{document.querySelector(e)}catch(t){const s=`Selector «${e}» not valid.`;return a(s),"function"==typeof r&&r(s)}function i(){clearInterval(n),clearTimeout(s)}return s=setTimeout(()=>{i();const t=`Can't find element «${e}».`;return a(t),"function"==typeof r&&r(t)},1e4),n=setInterval(()=>{const r=document.querySelector(e);return null!==r?(i(),"function"==typeof t&&t(r)):r},200),{clear:i}};async function h(e){let t;switch(e){case"IntersectionObserver":t=await("IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype||function(e){return new Promise((t,r)=>{const s=window.document.getElementsByTagName("script")[0],n=window.document.createElement("script");n.src=e,s.parentNode.insertBefore(n,s),n.onload=t,n.onerror=r})}(""));break;default:t=!0}return t}class l{constructor({displayRecurrence:e,closingRecurrence:t,validationRecurrence:r},s){this.displayRecurrence=parseFloat(e),this.closingRecurrence=parseFloat(t),this.validationRecurrence=parseFloat(r),this.onSetCallback=s,this.widgetName=i(),this.uniqueId=o(),this.recurrenceKey=`${this.widgetName}_${this.uniqueId}`}getGivenRecurrenceStorageParsed(e){try{const t=e.getItem("ABTastyWidgets");return JSON.parse(t)}catch(t){return e.removeItem("ABTastyWidgets"),!1}}getSessionRecurrenceStorageParsed(){return this.getGivenRecurrenceStorageParsed(window.sessionStorage)}getLocalRecurrenceStorageParsed(){return this.getGivenRecurrenceStorageParsed(window.localStorage)}removeGivenStorage(e,t){const{[this.recurrenceKey]:r,...s}=t;return Object.entries(s).length?(e.setItem("ABTastyWidgets",JSON.stringify(s)),s):(e.removeItem("ABTastyWidgets"),!1)}removeSessionRecurrenceStorage(){const e=this.getSessionRecurrenceStorageParsed();return!!e&&this.removeGivenStorage(window.sessionStorage,e)}removeLocalRecurrenceStorage(){const e=this.getLocalRecurrenceStorageParsed();return!!e&&this.removeGivenStorage(window.localStorage,e)}getSessionRecurrence(){const e=this.getSessionRecurrenceStorageParsed();return!!e&&e[this.recurrenceKey]}getLocalRecurrence(){const e=this.getLocalRecurrenceStorageParsed();return!!e&&e[this.recurrenceKey]}getCurrentRecurrence(){const e=this.getSessionRecurrence(),t=this.getLocalRecurrence();return e||t||{type:!1}}isOver(){const e=this.getLocalRecurrence(),t=(e?parseFloat(e.stamp):0)<(new Date).getTime();return t&&this.removeLocalRecurrenceStorage(),t&&!this.getLocalRecurrence()&&!this.getSessionRecurrence()}setRecurrence(e,t){const r=this.getTypeOfStorage(e);if(!r&&"object"!=typeof r)return!1;const{storageString:s,storageMethod:n}=this.getTypeOfStorage(e),i=this.getStamp(e),o={type:t,stamp:i},{type:a}=this.getCurrentRecurrence(),c=()=>{const e=this.getSessionRecurrence(),t=this.getLocalRecurrence();let r;"session"===s?e?r=this.removeSessionRecurrenceStorage():(this.removeLocalRecurrenceStorage(),r=this.getSessionRecurrenceStorageParsed()):"local"===s&&(t?r=this.removeLocalRecurrenceStorage():(this.removeSessionRecurrenceStorage(),r=this.getLocalRecurrenceStorageParsed()));const i=r?{[this.recurrenceKey]:o,...r}:{[this.recurrenceKey]:o};n.setItem("ABTastyWidgets",JSON.stringify(i)),this.onSetCallback&&"function"==typeof this.onSetCallback&&this.onSetCallback()};if(!n)return!1;if(a&&"validation"!==t)if("closing"===t&&"validation"!==a)c();else{if("display"!==t||"validation"===a||"closing"===a)return!1;c()}else c();return i}setDisplayRecurrence(){this.setRecurrence(this.displayRecurrence,"display")}setClosingRecurrence(){this.setRecurrence(this.closingRecurrence,"closing")}setValidationRecurrence(){this.setRecurrence(this.validationRecurrence,"validation")}getStamp(e){return(new Date).getTime()+864e5*e}getTypeOfStorage(e){return!(isNaN(e)||e<0||0!==e&&!e)&&(e>0?{storageString:"local",storageMethod:window.localStorage}:0===e&&{storageString:"session",storageMethod:window.sessionStorage})}}class u{constructor(){this.targets=[],this.existingTargets=[],this.inViewPortTargets=[],this.visibilityobserver=this.startVisibilityObserver(),this.mutationobserver=this.startMutationObserver()}intersectionHandler(e){e.forEach(e=>{e.isIntersecting?(this.existingTargets=this.existingTargets.filter(t=>t.element!==e.target||(this.inViewPortTargets.push(t),!1)),this.checkElements()):this.inViewPortTargets=this.inViewPortTargets.filter(t=>t.element!==e.target||(this.existingTargets.push(t),!1))})}startVisibilityObserver(){return new IntersectionObserver(this.intersectionHandler.bind(this),{root:null,rootMargin:"0px",threshold:0})}startMutationObserver(){const e=new MutationObserver(this.checkElements.bind(this));return e.observe(document,{attributes:!0,childList:!0,subtree:!0}),e}isElementVisible(e){return this.isElementTopmost(e)&&this.isElementOpaque(e)}isElementOpaque(e){return"HTML"===function e(t,r){return r(t)||!t.parentElement?t:e(t.parentElement,r)}(e,e=>"0"===window.getComputedStyle(e).opacity).nodeName}isElementTopmost(e){const t=e.getBoundingClientRect(),r=[[t.left,t.top],[t.right,t.top],[t.left,t.bottom],[t.right,t.bottom],[t.left+t.width/2,t.top],[t.left+t.width/2,t.bottom],[t.left,t.height/2],[t.right,t.height/2],[t.left+t.left/2,t.height/2]];let s=!1,n=0;for(;!s&&n<r.length;){const t=document.elementFromPoint(...r[n]);s=e===t||e.contains(t),n+=1}return s}checkElements(){this.targets=this.targets.filter(e=>{const t=document.querySelector(e.selector);return!t||(this.existingTargets.push(Object.assign(e,{element:t})),this.visibilityobserver.observe(t),!1)}),this.existingTargets=this.existingTargets.filter(e=>!!document.querySelector(e.selector)||(this.visibilityobserver.unobserve(e.element),this.targets.push(e),!1)),this.inViewPortTargets=this.inViewPortTargets.filter(({element:e,resolve:t})=>!this.isElementVisible(e)||(this.visibilityobserver.unobserve(e),t(e),!1))}watch(e,t){this.targets.push({selector:e,resolve:t})}clear(e){const t=this.targets.filter(t=>t.selector!==e);0===t.length&&(this.existingTargets=[],this.inViewPortTargets=[],this.mutationobserver.disconnect(),this.visibilityobserver.unobserve(document.querySelector(e))),this.targets.length>t&&(this.targets=t,this.visibilityobserver.unobserve(document.querySelector(e)))}}class d{constructor({triggerEvent:e,triggerSelector:t,triggerDelay:r}){this.event=e,this.selector=t&&t.length?t:"body",this.delay=r,this.elementsSelectors=[],this.eventsListeners=[],this.timeouts=[],this.intervals=[],this.observers=[],this.promises=[],this.visibilityObservers=[],this.elementsWaiters=[]}static promiseDeferrer(e){const t={promise:null,resolve:null,reject:null,name:e};return t.promise=new Promise((e,r)=>{t.resolve=e,t.reject=r}),t}async onElementVisible(){const e=d.promiseDeferrer("onElementVisible");this.promises.push(e);const t=await this.onPageLoad(),r=await h("IntersectionObserver"),s=function(e,t){return ABTasty.widgetUtils||(ABTasty.widgetUtils={}),ABTasty.widgetUtils[e]||Object.assign(ABTasty.widgetUtils,{[e]:new t}),ABTasty.widgetUtils[e]}("VisibilityObserver",u);return this.visibilityObservers.push(s),r&&t&&s.watch(this.selector,e.resolve),e.promise}onPageLoad(){const e=d.promiseDeferrer("onPageLoad");this.promises.push(e);const t=()=>"complete"===document.readyState;if(t())e.resolve(!0);else{const r=()=>t()&&!clearTimeout(s)&&!e.resolve(!0),s=setTimeout(()=>e.resolve(!1),2e4),n=["readystatechange",r,{passive:!0}];this.timeouts.push(s),this.eventsListeners.push(n),document.addEventListener(...n)}return e.promise}onClick(){const e=document.createElement("style");e.type="text/css",e.id=`Click_${o()}`,e.innerHTML=`${this.selector} {\n\t\t\tcursor: pointer !important;\n\t\t\tpointer-events: all !important;\n\t\t}`,document.head.appendChild(e),this.elementsSelectors.push(`#${e.id}`);const t=d.promiseDeferrer("onClick");this.promises.push(t);const r=()=>[...document.querySelectorAll(this.selector)],s=e=>r().some(t=>t.isSameNode(e)||!!e.closest(this.selector)),n=["click",({target:e})=>!!s(e)&&(t.resolve(!0),this.clear()),{passive:!0,capture:!0}];return this.eventsListeners.push(n),document.addEventListener(...n),t.promise}onExitIntent(){const e=d.promiseDeferrer("onExitIntent");this.promises.push(e);const t=["mouseleave",async({clientY:t})=>{if(!(t>0))if(this.delay){const t=1e3*this.delay,r=setTimeout(()=>{e.resolve(!0)},t);this.timeouts.push(r)}else e.resolve(!0)},{passive:!0}],r=c("body",e=>{e.addEventListener(...t),this.eventsListeners.push([e,...t]),this.elementsWaiters=this.elementsWaiters.filter(e=>e!==r)});return this.elementsWaiters.push(r),e.promise}onDelay(){const e=d.promiseDeferrer("onDelay");this.promises.push(e);const t=1e3*this.delay,r=setTimeout(()=>{e.resolve(!0)},t);return this.timeouts.push(r),e.promise}onReengage(){const e=d.promiseDeferrer("onReengage");this.promises.push(e);const t=1e3*this.delay;let r=t;const s=[()=>(r=t,r),{passive:!0}];["click","mousemove","scroll","keypress"].forEach(e=>{document.addEventListener(e,...s),this.eventsListeners.push([e,...s])});const n=setInterval(()=>{r<=0?e.resolve(!0):r-=100},100);return this.intervals.push(n),e.promise}clear(){return this.elementsSelectors.length&&(this.elementsSelectors.forEach(e=>{document.querySelector(e)&&document.querySelector(e).remove()}),this.elementsSelectors=[]),this.eventsListeners.length&&(this.eventsListeners.forEach(e=>{const[t,...r]="string"==typeof e[0]?[document,...e]:e;t&&r.length>1&&t.removeEventListener(...r)}),this.eventsListeners=[]),this.timeouts.length&&(this.timeouts.forEach(e=>clearTimeout(e)),this.timeouts=[]),this.intervals.length&&(this.intervals.forEach(e=>clearInterval(e)),this.intervals=[]),this.observers.length&&(this.observers.forEach(e=>e.disconnect()),this.observers=[]),this.visibilityObservers.length&&(this.visibilityObservers.forEach(e=>e.clear(this.selector)),this.visibilityObservers=[]),this.promises.length&&(this.promises.forEach(e=>e.resolve(!1)),this.promises=[]),this.elementsWaiters.length&&(this.elementsWaiters.forEach(e=>e.clear()),this.elementsWaiters=[]),this}async isTriggered(){let e;switch(this.clear(),this.event){case"pageLoad":e=await this.onPageLoad(),this.clear();break;case"click":e=await this.onClick(),this.clear();break;case"exitIntent":e=await this.onExitIntent(),this.clear();break;case"delay":e=await this.onDelay(),this.clear();break;case"reengage":e=await this.onReengage(),this.clear();break;case"elementVisible":e=await this.onElementVisible(),this.clear();break;default:e=!1}return e}}class g{constructor(e,t,r){this.recurrence=e,this.isWidgetApplied=t,this.callback=r,this.observer=new MutationObserver(this.observerHandler.bind(this)),this.eventListenerParams=["abtasty_resetActionTracking",this.eventHandler.bind(this),{passive:!0}],this.elementsWaiters=[]}recurrenceIsDone(){return!this.recurrence||this.recurrence.isOver()}decisionHandler(e){const t=n(),{type:r}=this.recurrence?this.recurrence.getCurrentRecurrence():{type:!1},s=()=>e&&"display"===r||this.recurrenceIsDone();return!this.isWidgetApplied()&&t&&s()?(this.clearWatcher(),this.callback("rebuild",e)):(!this.isWidgetApplied()||t&&s())&&(this.isWidgetApplied()||t)||(this.clearWatcher(),this.callback("remove",e),this.watch()),this}eventHandler(){let e=n();return[250,500].forEach(t=>setTimeout(()=>500===t&&n()===e?this:(e=n(),this.decisionHandler(!1)),t)),this}observerHandler(e){const t=e.some(({removedNodes:e})=>e&&e.length),r=e.some(({addedNodes:e})=>e&&e.length);return t||r?(this.decisionHandler(!0),this):this}watch(){if(s())return this;this.clearWatcher(),document.addEventListener(...this.eventListenerParams);const e=c("body",t=>{const r=[t,{childList:!0,subtree:!0}];this.observer.observe(...r),this.elementsWaiters=this.elementsWaiters.filter(t=>t!==e)});return this.elementsWaiters.push(e),this}clearWatcher(){return document.removeEventListener(...this.eventListenerParams),this.elementsWaiters.length&&(this.elementsWaiters.forEach(e=>e.clear()),this.elementsWaiters=[]),this.observer.disconnect(),this}}const m=["pageLoad","delay","reengage"];class v extends class{constructor(){this.uniqueId=o(),this.widgetName=i(),this.recurrenceParams=(()=>{const{displayRecurrence:e,closingRecurrence:t,validationRecurrence:r}=DATA;return!(s()||!(e||t||r))&&{displayRecurrence:e,closingRecurrence:t,validationRecurrence:r}})(),this.triggerParams=(()=>{const{triggerEvent:e,triggerEventClick:t,triggerEventExitDelay:r,triggerEventDelay:n,triggerEventReengageDelay:i}=DATA;if(s()||!e)return!1;const o=t;let a;switch(e){case"exitIntent":a=r;break;case"delay":a=n;break;case"reengage":a=i;break;default:a=0}return{triggerEvent:e,triggerSelector:o,triggerDelay:a}})(),this.recurrence=!!this.recurrenceParams&&new l(this.recurrenceParams,this.clearGivenClearables.bind(this)),this.trigger=!!this.triggerParams&&new d(this.triggerParams),this.pageWatcher=new g(this.recurrence,this.isWidgetApplied.bind(this),this.onPageChange.bind(this)),this.hasOncePerPageTrigger=!!this.trigger&&m.some(e=>e===this.trigger.event),this.basicClassName=`ab_widget_container_${this.widgetName}`,this.widgetContainerId=`${this.basicClassName}_${this.uniqueId}`,this.contentClassName=`${this.basicClassName}_content`,this.overlayClassName=`${this.basicClassName}_overlay`,this.closeButtonClassName=`${this.basicClassName}_close_button`,this.hideClassName=`ab_hide_${this.uniqueId}`,this.domElement=this.getDom(),this.hasBeenShown=!1,this.closedByUser=!1,this.eventsListeners=[],this.timeouts=[],this.intervals=[],this.observers=[],this.promises=[],this.elementsWaiters=[]}clearGivenClearables(){this.eventsListeners.length&&(this.eventsListeners.forEach(e=>document.removeEventListener(...e)),this.eventsListeners=[]),this.timeouts.length&&(this.timeouts.forEach(e=>clearTimeout(e)),this.timeouts=[]),this.intervals.length&&(this.intervals.forEach(e=>clearInterval(e)),this.intervals=[]),this.observers.length&&(this.observers.forEach(e=>e.disconnect()),this.observers=[]),this.promises.length&&(this.promises.forEach(e=>e.resolve(!1)),this.promises=[]),this.elementsWaiters.length&&(this.elementsWaiters.forEach(e=>e.clear()),this.elementsWaiters=[])}isWidgetApplied(){return this.domElement&&!!this.domElement.closest("html")}removeOldDomElement(){const e=document.getElementById(this.widgetContainerId);return e&&e.remove(),this}insert(){const e=new Promise((t,r)=>{c("body",r=>{this.elementsWaiters=this.elementsWaiters.filter(t=>t!==e),this.removeOldDomElement(),t(r.appendChild(this.domElement))},t=>{this.elementsWaiters=this.elementsWaiters.filter(t=>t!==e),a(t),r(t)})}),t=new Promise((e,r)=>{c("head",r=>{this.elementsWaiters=this.elementsWaiters.filter(e=>e!==t),e(r.appendChild(this.styleElement))},e=>{this.elementsWaiters=this.elementsWaiters.filter(e=>e!==t),a(e),r(e)})});return Promise.all([e,t]).then(()=>this)}remove(){return this.pageWatcher.clearWatcher(),this.domElement&&this.domElement.closest("html")&&this.domElement.remove(),this.styleElement&&this.styleElement.closest("html")&&this.styleElement.remove(),this.hasOncePerPageTrigger?this.pageWatcher.watch():s()||this.init().then(e=>e?this.show():this),this}show(){return this.hasBeenShown||s()||window.ABTastyEvent(`${this.widgetName} displayed`,null,TEST_ID),this.closedByUser=!1,this.domElement.classList.remove(this.hideClassName),this.recurrence&&this.recurrence.setDisplayRecurrence(),this.hasBeenShown=!0,this.pageWatcher.watch(),this}hide(){return this.hasBeenShown&&!s()&&window.ABTastyEvent(`${this.widgetName} closed`,null,TEST_ID),this.closedByUser=!0,this.domElement.classList.add(this.hideClassName),this}async init(){if(!s()&&!n())return!1;if(this.trigger&&this.trigger.promises.length)return!1;const e=this.recurrence&&this.recurrence.isOver();return this.recurrence&&!e?(this.pageWatcher.watch(),!1):(this.pageWatcher.watch(),!!(s()||!this.trigger||this.trigger&&await this.trigger.isTriggered())&&(await this.insert(),this.addCloseEvent(),this))}onPageChange(e,t){const r=()=>this.init().then(e=>e&&this.show());switch(t||(this.hasBeenShown=!1),e){case"remove":this.isWidgetApplied()?this.remove():(this.trigger&&this.trigger.clear(),this.pageWatcher.watch());break;case"rebuild":this.hasBeenShown?this.closedByUser?this.pageWatcher.watch():this.insert().then(e=>e.show()):r()}}addCloseEvent(...e){const t=this.domElement.querySelectorAll(`\n\t\t\t.${this.overlayClassName},\n\t\t\t.${this.closeButtonClassName}\n\t\t`);return e.push(...t),e.forEach(e=>{e.addEventListener("click",()=>{this.recurrence&&this.recurrence.setClosingRecurrence(),this.hide(),setTimeout(()=>this.remove(),1e3)},{passive:!0,once:!0})}),this}getDom(){const e=document.createElement("div");return e.className=`${this.basicClassName} ${this.hideClassName}`,e.id=this.widgetContainerId,e.innerHTML=`\n\t\t\t<div class="${this.overlayClassName}"></div>\n\t\t\t<div class="${this.contentClassName}">\n\t\t\t\t<button class="${this.closeButtonClassName}" ${s()?"data-abtasty-actionnable":""}>+</button>\n\t\t\t</div>`,e}getStyleTag(e=""){const t=document.createElement("style");return t.type="text/css",s()&&t.setAttribute("abtasty-script-added","true"),t.textContent=`\n\t\t\t.${this.hideClassName} {opacity: 0 !important; pointer-events: none;}\n\t\t\t${e}`,t}}{constructor(e,t){super(),this.position=e,this.referrerElement=t,this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}async insert(){const e=c("head",t=>(this.elementsWaiters=this.elementsWaiters.filter(t=>t!==e),t.appendChild(this.styleElement)),t=>(this.elementsWaiters=this.elementsWaiters.filter(t=>t!==e),a(t))),t=c(this.referrerElement,e=>(this.elementsWaiters=this.elementsWaiters.filter(e=>e!==t),this.removeOldDomElement(this.domElement.id),e.insertAdjacentElement(this.position,this.domElement)),e=>(this.elementsWaiters=this.elementsWaiters.filter(e=>e!==t),a(e)));return this.elementsWaiters.push(e,t),this}getStyles(){return`\n\t\t#${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#${this.widgetContainerId} .${this.overlayClassName} {\n\t\t\tdisplay: none;\n\t\t}\n\t\t#${this.widgetContainerId} .${this.closeButtonClassName} {\n\t\t\tposition: absolute;\n\t\t\ttop: 0;\n\t\t\tright: 0;\n\t\t\twidth: auto;\n\t\t\theight: auto;\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}`}}var f=function(e){if(Array.isArray(e))return e};var p=function(e,t){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)){var r=[],s=!0,n=!1,i=void 0;try{for(var o,a=e[Symbol.iterator]();!(s=(o=a.next()).done)&&(r.push(o.value),!t||r.length!==t);s=!0);}catch(e){n=!0,i=e}finally{try{s||null==a.return||a.return()}finally{if(n)throw i}}return r}};var y=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")};var b=function(e,t){return f(e)||p(e,t)||y()};var w=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")};function E(e,t){for(var r=0;r<t.length;r++){var s=t[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}var S=function(e,t,r){return t&&E(e.prototype,t),r&&E(e,r),e},T=function(e){var t=Object.prototype.hasOwnProperty;function r(e,s){return Array.isArray(e)?function(e,t){for(var s,n="",i="",a=Array.isArray(t),c=0;c<e.length;c++)(s=r(e[c]))&&(a&&t[c]&&(s=o(s)),n=n+i+s,i=" ");return n}(e,s):e&&"object"==typeof e?function(e){var r="",s="";for(var n in e)n&&e[n]&&t.call(e,n)&&(r=r+s+n,s=" ");return r}(e):e||""}function s(e){if(!e)return"";if("object"==typeof e){var r="";for(var s in e)t.call(e,s)&&(r=r+s+":"+e[s]+";");return r}return e+""}function n(e,t,r,s){if(!1===t||null==t||!t&&("class"===e||"style"===e))return"";if(!0===t)return" "+(s?e:e+'="'+e+'"');var n=typeof t;return"object"!==n&&"function"!==n||"function"!=typeof t.toJSON||(t=t.toJSON()),"string"==typeof t||(t=JSON.stringify(t),r||-1===t.indexOf('"'))?(r&&(t=o(t))," "+e+'="'+t+'"'):" "+e+"='"+t.replace(/'/g,"'")+"'"}e.merge=function e(t,r){if(1===arguments.length){for(var n=t[0],i=1;i<t.length;i++)n=e(n,t[i]);return n}for(var o in r)if("class"===o){var a=t[o]||[];t[o]=(Array.isArray(a)?a:[a]).concat(r[o]||[])}else if("style"===o){a=(a=s(t[o]))&&";"!==a[a.length-1]?a+";":a;var c=s(r[o]);c=c&&";"!==c[c.length-1]?c+";":c,t[o]=a+c}else t[o]=r[o];return t},e.classes=r,e.style=s,e.attr=n,e.attrs=function(e,i){var o="";for(var a in e)if(t.call(e,a)){var c=e[a];if("class"===a){c=r(c),o=n(a,c,!1,i)+o;continue}"style"===a&&(c=s(c)),o+=n(a,c,!1,i)}return o};var i=/["&<>]/;function o(e){var t=""+e,r=i.exec(t);if(!r)return e;var s,n,o,a="";for(s=r.index,n=0;s<t.length;s++){switch(t.charCodeAt(s)){case 34:o=""";break;case 38:o="&";break;case 60:o="<";break;case 62:o=">";break;default:continue}n!==s&&(a+=t.substring(n,s)),n=s+1,a+=o}return n!==s?a+t.substring(n,s):a}return e.escape=o,e.rethrow=function e(t,r,s,n){if(!(t instanceof Error))throw t;if(!("undefined"==typeof window&&r||n))throw t.message+=" on line "+s,t;try{n=n||require("fs").readFileSync(r,"utf8")}catch(r){e(t,null,s)}var i=3,o=n.split("\n"),a=Math.max(s-i,0),c=Math.min(o.length,s+i);i=o.slice(a,c).map((function(e,t){var r=t+a+1;return(r==s?" > ":" ")+r+"| "+e})).join("\n");throw t.path=r,t.message=(r||"Pug")+":"+s+"\n"+i+"\n\n"+t.message,t},e}({});var L=["fr","en","de","es"],x=["day","hour","minute","second"],A={day:{en:"Day",fr:"Jour",es:"Dia",de:"Tag"},days:{en:"Days",fr:"Jours",es:"Dias",de:"Tage"},hour:{en:"Hour",fr:"Heure",es:"Hora",de:"Zeit"},hours:{en:"Hours",fr:"Heures",es:"Horas",de:"Stunden"},minute:"Min",second:{en:"Sec",fr:"Sec",es:"Seg",de:"Sek"}},C={"01":"Jan","02":"Feb","03":"Mar","04":"Apr","05":"May","06":"Jun","07":"Jul","08":"Aug","09":"Sep",10:"Oct",11:"Nov",12:"Dec"},R=window.ABTASTY_S&&ABTASTY_S.USER&&ABTASTY_S.USER.lang?ABTASTY_S.USER.lang.split("_")[0]:navigator.language.substr(0,2)||"en",O=function(e){return L.indexOf(e)>-1}(R)?R:"en",W={day:A.day[O],days:A.days[O],hour:A.hour[O],hours:A.hours[O],minute:A.minute,minutes:A.minute,second:A.second[O],seconds:A.second[O]},P=function(e,t){return new Date(e).toLocaleString("fr-FR",{timezone:t}).replace(/[^ -~]/g,"")},_=function(e){var t=function(e,t){return P(e,t)}(e).split(" ")[0].split("/"),r=b(t,3),s=r[0],n=r[1],i=r[2];return"".concat(s," ").concat(C[n]," ").concat(i)},k=function(e,t){return function(e,t){return P(e,t)}(e,t).split(" ")},N=function(e,t){return function(e,t){return k(e,t)[k(e,t).length-1]}(e,t)},I=function(e){return function(e){var t=function(e,t){var r="".concat(e);return r.length<t?"0".concat(r):"".concat(e)};return"".concat(e<0?"+":"-").concat(t(parseInt(Math.abs(e/60),10),2)).concat(t(Math.abs(e%60),2))}(e)},D=function(e){var t=e.dateStart,r=e.timeStart,s=e.timezoneOffset;return new Date("".concat(function(e,t){return _(e)}(t)," ").concat(N(r)," GMT").concat(I(s))).getTime()};var B=function(){function e(t,r){w(this,e),this.testId=t,this.data=r,this.targetselector=r.selector,this.container=document.createElement("abtasty-countdown"),this.digitElements={},this.textElements={},this.timeLoop=null}return S(e,[{key:"insert",value:function(e,t){return e.insertAdjacentElement(t,this.container),this}},{key:"setText",value:function(e){var t=this;x.forEach((function(r){var s=e[r];t.digitElements[r].textContent=s,t.textElements[r].textContent=1===s?W[r]:W["".concat(r,"s")]}))}},{key:"setCountdown",value:function(){var e=(new Date).getTime(),t=(D(this.data)-e)/1e3;if(t<=0)return this.setText({day:0,hour:0,minute:0,second:0}),void clearInterval(this.timeLoop);var r=Math.floor(t/86400);t-=86400*r;var s=Math.floor(t/3600);t-=3600*s;var n=Math.floor(t/60);t-=60*n;var i=Math.floor(t);this.setText({day:r,hour:s,minute:n,second:i})}},{key:"init",value:function(){var e=this,t=function(e){var t="";try{var r={};t+='<div class="abtasty-countdown-days">',t+='<div class="abtasty-countdown-days__digit"></div>',t+='<div class="abtasty-countdown-days__text"></div></div>',t+='<div class="abtasty-countdown-hours">',t+='<div class="abtasty-countdown-hours__digit"></div>',t+='<div class="abtasty-countdown-hours__text"></div></div>',t+='<div class="abtasty-countdown-minutes">',t+='<div class="abtasty-countdown-minutes__digit"></div>',t+='<div class="abtasty-countdown-minutes__text"></div></div>',t+='<div class="abtasty-countdown-seconds">',t+='<div class="abtasty-countdown-seconds__digit"></div>',t+='<div class="abtasty-countdown-seconds__text"></div></div>'}catch(e){T.rethrow(e,void 0,void 0,r[void 0])}return t}();this.container.innerHTML=t,this.container.insertAdjacentElement("afterbegin",function(e){var t=document.createElement("style");return t.type="text/css",t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e)),t}("abtasty-countdown{display:inline-block}abtasty-countdown>div{display:inline-block;text-align:center;margin:10px}")),x.forEach((function(t){var r=b(e.container.querySelector(".abtasty-countdown-".concat(t,"s")).children,2),s=r[0],n=r[1];e.digitElements[t]=s,e.textElements[t]=n})),this.timeLoop=setInterval(this.setCountdown.bind(this),1e3)}}]),e}();function $(){return j.apply(this,arguments)}function j(){return(j=r(e.mark((function t(){var r,s,n;return e.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=new v("beforeend",DATA.selector),e.next=3,r.init();case 3:if(e.sent){e.next=6;break}return e.abrupt("return",!1);case 6:s=r.domElement.querySelector(".".concat(r.contentClassName)),r.domElement.querySelectorAll(".".concat(r.closeButtonClassName)).forEach((function(e){e.remove()})),(n=new B(TEST_ID,DATA)).init(),n.insert(s,"beforeend"),r.show();case 12:case"end":return e.stop()}}),t)})))).apply(this,arguments)}$()}();
|
1
|
+
!function(){"use strict";var t=function(t,e){return t(e={exports:{}},e.exports),e.exports}((function(t){var e=function(t){var e=Object.prototype,n=e.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",o=i.asyncIterator||"@@asyncIterator",r=i.toStringTag||"@@toStringTag";function a(t,e,n,i){var s=e&&e.prototype instanceof d?e:d,o=Object.create(s.prototype),r=new T(i||[]);return o._invoke=function(t,e,n){var i="suspendedStart";return function(s,o){if("executing"===i)throw new Error("Generator is already running");if("completed"===i){if("throw"===s)throw o;return E()}for(n.method=s,n.arg=o;;){var r=n.delegate;if(r){var a=f(r,n);if(a){if(a===l)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===i)throw i="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i="executing";var d=c(t,e,n);if("normal"===d.type){if(i=n.done?"completed":"suspendedYield",d.arg===l)continue;return{value:d.arg,done:n.done}}"throw"===d.type&&(i="completed",n.method="throw",n.arg=d.arg)}}}(t,n,r),o}function c(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=a;var l={};function d(){}function h(){}function u(){}var m={};m[s]=function(){return this};var g=Object.getPrototypeOf,p=g&&g(g(x([])));p&&p!==e&&n.call(p,s)&&(m=p);var y=u.prototype=d.prototype=Object.create(m);function v(t){["next","throw","return"].forEach((function(e){t[e]=function(t){return this._invoke(e,t)}}))}function b(t,e){var i;this._invoke=function(s,o){function r(){return new e((function(i,r){!function i(s,o,r,a){var l=c(t[s],t,o);if("throw"!==l.type){var d=l.arg,h=d.value;return h&&"object"==typeof h&&n.call(h,"__await")?e.resolve(h.__await).then((function(t){i("next",t,r,a)}),(function(t){i("throw",t,r,a)})):e.resolve(h).then((function(t){d.value=t,r(d)}),(function(t){return i("throw",t,r,a)}))}a(l.arg)}(s,o,i,r)}))}return i=i?i.then(r,r):r()}}function f(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,f(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var i=c(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,l;var s=i.arg;return s?s.done?(e[t.resultName]=s.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):s:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function w(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 S(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(w,this),this.reset(!0)}function x(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function e(){for(;++i<t.length;)if(n.call(t,i))return e.value=t[i],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:E}}function E(){return{value:void 0,done:!0}}return h.prototype=y.constructor=u,u.constructor=h,u[r]=h.displayName="GeneratorFunction",t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,u):(t.__proto__=u,r in t||(t[r]="GeneratorFunction")),t.prototype=Object.create(y),t},t.awrap=function(t){return{__await:t}},v(b.prototype),b.prototype[o]=function(){return this},t.AsyncIterator=b,t.async=function(e,n,i,s,o){void 0===o&&(o=Promise);var r=new b(a(e,n,i,s),o);return t.isGeneratorFunction(n)?r:r.next().then((function(t){return t.done?t.value:r.next()}))},v(y),y[r]="Generator",y[s]=function(){return this},y.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 i=e.pop();if(i in t)return n.value=i,n.done=!1,n}return n.done=!0,n}},t.values=x,T.prototype={constructor:T,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(S),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},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 e=this;function i(n,i){return r.type="throw",r.arg=t,e.next=n,i&&(e.method="next",e.arg=void 0),!!i}for(var s=this.tryEntries.length-1;s>=0;--s){var o=this.tryEntries[s],r=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=n.call(o,"catchLoc"),c=n.call(o,"finallyLoc");if(a&&c){if(this.prev<o.catchLoc)return i(o.catchLoc,!0);if(this.prev<o.finallyLoc)return i(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return i(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return i(o.finallyLoc)}}}},abrupt:function(t,e){for(var i=this.tryEntries.length-1;i>=0;--i){var s=this.tryEntries[i];if(s.tryLoc<=this.prev&&n.call(s,"finallyLoc")&&this.prev<s.finallyLoc){var o=s;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var r=o?o.completion:{};return r.type=t,r.arg=e,o?(this.method="next",this.next=o.finallyLoc,l):this.complete(r)},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),l},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),S(n),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var s=i.arg;S(n)}return s}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:x(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),l}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}}));function e(t,e,n,i,s,o,r){try{var a=t[o](r),c=a.value}catch(t){return void n(t)}a.done?e(c):Promise.resolve(c).then(i,s)}var n=function(t){return function(){var n=this,i=arguments;return new Promise((function(s,o){var r=t.apply(n,i);function a(t){e(r,s,o,a,c,"next",t)}function c(t){e(r,s,o,a,c,"throw",t)}a(void 0)}))}};const i=()=>Object.prototype.hasOwnProperty.call(window,"ABTastyEditor");const s=()=>{let t;return window.ABTasty||window.ABTASTY_S?(window.ABTASTY_S&&window.ABTASTY_S.USER&&window.ABTASTY_S.USER.accountIdentifier&&window.ABTASTY_S.USER.accountIdentifier.length?t=window.ABTASTY_S.USER.accountIdentifier:window.ABTasty&&window.ABTasty.getAccountSettings&&"function"==typeof window.ABTasty.getAccountSettings?t=window.ABTasty.getAccountSettings().identifier:window.ABTasty&&window.ABTasty.accountSettings&&(t=window.ABTasty.accountSettings.identifier),t):t},o=()=>{const t=!!document.getElementById("ABTastyPreviewBar"),e=location.href.includes("ab_project=preview");return t||e},r=()=>o()||!!window.ABTasty.getTestsOnPage()[TEST_ID],a=()=>{if(i()||o())return!1;const t=ABTasty.getTestsOnPage()[TEST_ID];return!!t&&Object.keys(t.targetings.qaParameters).length>0},c="conditions",l="https://social-proof-api.abtasty.com/clients/",d=()=>{const{type:t}=DATA;return`${PACKAGE.replace("@abtasty/","")}${t?"_"+t:""}`},h=()=>{const t=d();return`${t.charAt(0).toUpperCase()}${t.slice(1)}`.split("-").join(" ")},u=()=>`${PLUGIN_ID.split("-")[0]}_${TEST_ID}`,m=(...t)=>{t.unshift(`[AB Tasty Widget] ${PACKAGE}:`),console.log(...t)},g=t=>{if(a()){const e=h();window.console.log(`%c${e} - QA Mode for campaign ${TEST_ID}\n${t}`,"background-color: rgba(0, 127, 145, 1); color: rgba(247, 247, 247, 1)")}},p=t=>{const e={promise:null,resolve:null,reject:null,name:t};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e},y=(t,e,n)=>{let i=0,s=0;try{document.querySelector(t)}catch(e){const i=`Selector «${t}» not valid.`;return m(i),"function"==typeof n&&n(i)}function o(){clearInterval(s),clearTimeout(i)}return i=setTimeout(()=>{o();const e=`Can't find element «${t}».`;return m(e),"function"==typeof n&&n(e)},1e4),s=setInterval(()=>{const n=document.querySelector(t);return null!==n?(o(),"function"==typeof e&&e(n)):n},200),{clear:o}};async function v(t){let e;switch(t){case"IntersectionObserver":e=await("IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype||function(t){return new Promise((e,n)=>{const i=window.document.getElementsByTagName("script")[0],s=window.document.createElement("script");s.src=t,i.parentNode.insertBefore(s,i),s.onload=e,s.onerror=n})}("https://polyfill.io/v3/polyfill.min.js?flags=gated&features=IntersectionObserver"));break;default:e=!0}return e}class b{constructor({displayRecurrence:t,closingRecurrence:e,validationRecurrence:n},i){this.displayRecurrence=parseFloat(t),this.closingRecurrence=parseFloat(e),this.validationRecurrence=parseFloat(n),this.onSetCallback=i,this.widgetName=d(),this.uniqueId=u(),this.recurrenceKey=`${this.widgetName}_${this.uniqueId}`,this.isListeningStorageEvent=this.listenStorageEvent()}onStorage({key:t}){const e=localStorage.getItem("ABTastyWidgetsTemporary"),n=sessionStorage.getItem("ABTastyWidgets");"ABTastyData"===t&&!e&&n&&localStorage.setItem("ABTastyWidgetsTemporary",n)}listenStorageEvent(){return this.isListeningStorageEvent||window.addEventListener("storage",this.onStorage.bind(this)),!0}getGivenRecurrenceStorageParsed(t){try{const e=t.getItem("ABTastyWidgets");return JSON.parse(e)}catch(e){return t.removeItem("ABTastyWidgets"),!1}}getSessionRecurrenceStorageParsed(){return this.getGivenRecurrenceStorageParsed(window.sessionStorage)}getLocalRecurrenceStorageParsed(){return this.getGivenRecurrenceStorageParsed(window.localStorage)}removeGivenStorage(t,e){const{[this.recurrenceKey]:n,...i}=e;return Object.entries(i).length?(t.setItem("ABTastyWidgets",JSON.stringify(i)),i):(t.removeItem("ABTastyWidgets"),!1)}removeSessionRecurrenceStorage(){const t=this.getSessionRecurrenceStorageParsed();return!!t&&this.removeGivenStorage(window.sessionStorage,t)}removeLocalRecurrenceStorage(){const t=this.getLocalRecurrenceStorageParsed();return!!t&&this.removeGivenStorage(window.localStorage,t)}getSessionRecurrence(){const t=this.getSessionRecurrenceStorageParsed();return!!t&&t[this.recurrenceKey]}getLocalRecurrence(){const t=this.getLocalRecurrenceStorageParsed();return!!t&&t[this.recurrenceKey]}getCurrentRecurrence(){const t=this.getSessionRecurrence(),e=this.getLocalRecurrence();return t||e||{type:!1}}isOver(){const t=localStorage.getItem("ABTastyWidgetsTemporary"),e=!(!t||!t.includes(this.recurrenceKey))||this.getSessionRecurrence();t&&(sessionStorage.setItem("ABTastyWidgets",t),localStorage.removeItem("ABTastyWidgetsTemporary"));const n=this.getLocalRecurrence(),i=(n?parseFloat(n.stamp):0)<(new Date).getTime();return i&&this.removeLocalRecurrenceStorage(),i&&!this.getLocalRecurrence()&&!e}setRecurrence(t,e){0!==t&&(window.removeEventListener("storage",this.onStorage.bind(this)),this.isListeningStorageEvent=!1);const n=this.getTypeOfStorage(t);if(o()||!n&&"object"!=typeof n)return!1;const{storageString:i,storageMethod:s}=n,r=this.getStamp(t),a={type:e,stamp:r},{type:c}=this.getCurrentRecurrence(),l=()=>{const t=this.getSessionRecurrence(),e=this.getLocalRecurrence();let n;"session"===i?t?n=this.removeSessionRecurrenceStorage():(this.removeLocalRecurrenceStorage(),n=this.getSessionRecurrenceStorageParsed()):"local"===i&&(e?n=this.removeLocalRecurrenceStorage():(this.removeSessionRecurrenceStorage(),n=this.getLocalRecurrenceStorageParsed()));const o=n?{[this.recurrenceKey]:a,...n}:{[this.recurrenceKey]:a};s.setItem("ABTastyWidgets",JSON.stringify(o)),this.onSetCallback&&"function"==typeof this.onSetCallback&&this.onSetCallback()};if(!s)return!1;if(c&&"validation"!==e)if("closing"===e&&"validation"!==c)l();else{if("display"!==e||"validation"===c||"closing"===c)return!1;l()}else l();return r}setDisplayRecurrence(){this.setRecurrence(this.displayRecurrence,"display")}setClosingRecurrence(){this.setRecurrence(this.closingRecurrence,"closing")}setValidationRecurrence(){this.setRecurrence(this.validationRecurrence,"validation")}getStamp(t){return(new Date).getTime()+864e5*t}getTypeOfStorage(t){return!(isNaN(t)||t<0||0!==t&&!t)&&(t>0?{storageString:"local",storageMethod:window.localStorage}:0===t&&{storageString:"session",storageMethod:window.sessionStorage})}}class f{constructor(){this.targets=[],this.existingTargets=[],this.inViewportTargets=[],this.visibilityObserver=this.startVisibilityObserver(),this.mutationObserver=this.startMutationObserver(),this.mouseOverEvent=this.mouseOverHandler()}intersectionHandler(t){t.forEach(t=>{t.isIntersecting?(this.existingTargets.forEach(e=>{e.element.isSameNode(t.target)&&(this.inViewportTargets.push(e),this.mouseOverEvent.start())}),this.checkElements()):this.inViewportTargets=this.inViewportTargets.filter(e=>!e.element.isSameNode(t.target)||(this.mouseOverEvent.clear(),!1))})}startVisibilityObserver(){return new IntersectionObserver(this.intersectionHandler.bind(this),{root:null,rootMargin:"0px",threshold:0})}startMutationObserver(){const t=this.mutationObserver||new MutationObserver(this.checkElements.bind(this));return document.body&&t.observe(document.body,{attributes:!0,childList:!0,subtree:!0}),t}onMouseOver({target:t,path:e}){const n=this.inViewportTargets.find(({element:n,selector:i})=>{if(n.isSameNode(t))return!0;const s=[...t.querySelectorAll(i)];if(s.length&&s.includes(n))return!0;if(e.includes(n))return!0;const o=[...t.parentElement.children],r=o.findIndex(e=>e.isSameNode(t)),a=o.filter((t,e)=>e>r);if(a.length){if(a.includes(n))return!0;if(a.some(t=>[...t.querySelectorAll(i)].includes(n)))return!0}return!1});if(n&&this.isElementVisible(n.element)){const{selector:t,element:e,uniqueId:i}=n,s=this.targets.find(e=>e.selector===t&&e.uniqueId===i);s&&s.resolve(e),this.clear(t,i)}}mouseOverHandler(){const t=["mouseover",t=>setTimeout(()=>this.onMouseOver(t),50),!0];return{start:()=>document.addEventListener(...t),clear:()=>document.removeEventListener(...t)}}isElementVisible(t){return this.isElementTopmost(t)&&this.isElementOpaque(t)}isElementOpaque(t){return"HTML"===function t(e,n){return n(e)||!e.parentElement?e:t(e.parentElement,n)}(t,t=>"0"===window.getComputedStyle(t).opacity).nodeName}isElementTopmost(t){const e=t.getBoundingClientRect(),n=[[e.left,e.top],[e.right,e.top],[e.left,e.bottom],[e.right,e.bottom],[e.left+e.width/2,e.top],[e.left+e.width/2,e.bottom],[e.left,e.height/2],[e.right,e.height/2],[e.left+e.left/2,e.height/2]];let i=!1,s=0;for(;!i&&s<n.length;){const e=document.elementFromPoint(...n[s]);i=t===e||t.contains(e),s+=1}return i}checkElements(){this.targets.forEach(({selector:t,uniqueId:e})=>{const n=document.querySelector(t);n&&!this.existingTargets.find(n=>n.element.matches(t)&&n.uniqueId===e)&&(this.existingTargets.push({element:n,selector:t,uniqueId:e}),this.visibilityObserver.observe(n))}),this.existingTargets=this.existingTargets.filter(({selector:t,element:e})=>!!document.querySelector(t)||(this.visibilityObserver.unobserve(e),!1)),this.inViewportTargets=this.inViewportTargets.filter(({selector:t,element:e,uniqueId:n})=>{if(e.matches(t)&&this.isElementVisible(e)){const i=this.targets.find(e=>e.selector===t&&e.uniqueId===n);return i&&i.resolve(e),this.clear(t,n),!1}return!0})}watch(t,e,n){this.targets.push({selector:t,resolve:e,uniqueId:n});const i=()=>{this.startMutationObserver(),this.checkElements()};document.body?i():y("body",i)}clear(t,e){[this.targets,this.existingTargets,this.inViewportTargets]=[this.targets,this.existingTargets,this.inViewportTargets].map(n=>n.filter(({selector:n,uniqueId:i})=>n!==t&&i!==e)),this.visibilityObserver.unobserve(document.querySelector(t)),0===this.targets.length&&this.mutationObserver.disconnect(),0===this.inViewportTargets.length&&this.mouseOverEvent.clear()}}class w{constructor({triggerEvent:t,triggerSelector:e,triggerDelay:n}){this.event=t,this.selector=e&&e.length?e:"body",this.delay=1e3*n,this.elementsSelectors=[],this.eventsListeners=[],this.timeouts=[],this.intervals=[],this.observers=[],this.promises=[],this.visibilityObservers=[],this.elementsWaiters=[]}async onElementVisible({promise:t,resolve:e}){const n=p(this.event+"DomReady");this.promises.push(n);const i=await this.onPageLoad(n),s=await v("IntersectionObserver"),o=function(t,e){return ABTasty.widgetUtils||(ABTasty.widgetUtils={}),ABTasty.widgetUtils[t]||Object.assign(ABTasty.widgetUtils,{[t]:new e}),ABTasty.widgetUtils[t]}("VisibilityObserver",f);if(this.visibilityObservers.push(o),s&&i){const t=u();o.watch(this.selector,e,t)}return t}onPageLoad({promise:t,resolve:e}){const n=()=>"complete"===document.readyState;if(!n()){const i=["readystatechange",()=>n()&&e(!0),{passive:!0}];return this.eventsListeners.push(i),document.addEventListener(...i),t}return e(!0),t}onClick({promise:t,resolve:e}){const n=document.createElement("style");n.type="text/css",n.id="Click_"+u(),n.innerHTML=this.selector+" {\n\t\t\tcursor: pointer !important;\n\t\t\tpointer-events: all !important;\n\t\t}",document.head.appendChild(n),this.elementsSelectors.push("#"+n.id);const i=t=>[...document.querySelectorAll(this.selector)].some(e=>e.isSameNode(t)||!!t.closest(this.selector)),s=["click",({target:t})=>i(t)&&e(!0),{passive:!0,capture:!0}];return this.eventsListeners.push(s),document.addEventListener(...s),t}onExitIntent({promise:t,resolve:e}){const n=["mouseleave",async({clientY:t})=>{t<=0&&e(!0)},{passive:!0}],i=y("body",t=>{t.addEventListener(...n),this.eventsListeners.push([t,...n]),this.elementsWaiters=this.elementsWaiters.filter(t=>t!==i)});return this.elementsWaiters.push(i),t}onReengage({promise:t,resolve:e}){const n=this.delay;let i=n;const s=[()=>(i=n,i),{passive:!0}];["click","mousemove","scroll","keypress"].forEach(t=>{document.addEventListener(t,...s),this.eventsListeners.push([t,...s])});const o=setInterval(()=>{i<=0?e(!0):i-=100},100);return this.intervals.push(o),t}onCustomTrigger({promise:t,resolve:e}){const{triggerEventCustomScript:n}=DATA;return new Function(`return new Promise(async resolve => {${n}})`)().then(t=>t&&e(!0)),t}getSocialProofPurchases({promise:t,resolve:e}){const n=window.ABTastyProductKey,i=s(),{viewInterval:o,triggerSocialProofMinPurchases:r,spNoTrim:a}=DATA;return n||(g("Not able to find ABTastyProductKey, impossible to call the API."),e(!1)),n&&i?fetch(`${l}${i}/metrics/i?key=${n}${a?"&noTrim=true":""}`).then(t=>t.ok&&t.json()).then(t=>(t=>{if(void 0===o||void 0===r)return!1;const e=t[o]&&t[o]>=r;return e||g(`Widget will not be shown, product has been purchased ${t[o]} times while ${r} are required`),e})(t)&&e(t[o])).catch(()=>g("Failed to fetch datas from server.")):e(!1),t}getSocialProofPageViews({promise:t,resolve:e}){const n=encodeURIComponent(""+window.location.pathname),i=s(),{viewInterval:o,triggerSocialProofMinPageViews:r}=DATA;return n&&i?fetch(`${l}${i}/metrics/pv?key=${n}`).then(t=>t.ok&&t.json()).then(t=>(t=>{if(void 0===o||void 0===r)return!1;const e=t[o]&&t[o]>=r;return e||g(`Widget will not be shown, page has been seen ${t[o]} times while ${r} are required`),e})(t)&&e(t[o])).catch(()=>g("Failed to fetch datas from server.")):e(!1),t}clear(){if(this.elementsSelectors.length&&(this.elementsSelectors.forEach(t=>{document.querySelector(t)&&document.querySelector(t).remove()}),this.elementsSelectors=[]),this.eventsListeners.length&&(this.eventsListeners.forEach(t=>{const[e,...n]="string"==typeof t[0]?[document,...t]:t;e&&n.length>1&&e.removeEventListener(...n)}),this.eventsListeners=[]),this.timeouts.length&&(this.timeouts.forEach(t=>clearTimeout(t)),this.timeouts=[]),this.intervals.length&&(this.intervals.forEach(t=>clearInterval(t)),this.intervals=[]),this.observers.length&&(this.observers.forEach(t=>t.disconnect()),this.observers=[]),this.visibilityObservers.length){const t=u();this.visibilityObservers.forEach(e=>e.clear(this.selector,t)),this.visibilityObservers=[]}return this.promises.length&&(this.promises.forEach(t=>t.resolve(!1)),this.promises=[]),this.elementsWaiters.length&&(this.elementsWaiters.forEach(t=>t.clear()),this.elementsWaiters=[]),this}async isTriggered(){this.clear();const t=p(this.event);this.promises.push(t);const e={direct:()=>!0,pageLoad:()=>this.onPageLoad(t),click:()=>this.onClick(t),exitIntent:()=>this.onExitIntent(t),reengage:()=>this.onReengage(t),elementVisible:()=>this.onElementVisible(t),script:()=>this.onCustomTrigger(t),socialProofPurchases:()=>this.getSocialProofPurchases(t),socialProofPageViews:()=>this.getSocialProofPageViews(t)},n=!Object.prototype.hasOwnProperty.call(e,this.event)||await e[this.event]();return this.clear(),"reengage"!==this.event&&this.delay?n&&await(async()=>{const t=p(this.event+"Delay");return this.promises.push(t),setTimeout(()=>{t.resolve(!0),this.clear()},this.delay),t.promise})():n}}class S{constructor(t,e,n){this.recurrence=t,this.isWidgetApplied=e,this.callback=n,this.observer=new MutationObserver(this.observerHandler.bind(this)),this.eventListenerParams=["abtasty_resetActionTracking",this.eventHandler.bind(this),{passive:!0}],this.elementsWaiters=[]}recurrenceIsDone(){return!this.recurrence||this.recurrence.isOver()}decisionHandler(t){const e=r(),{type:n}=this.recurrence?this.recurrence.getCurrentRecurrence():{type:!1},i=()=>t&&"display"===n||this.recurrenceIsDone();return!this.isWidgetApplied()&&e&&i()?(this.clearWatcher(),this.callback("rebuild",t)):(!this.isWidgetApplied()||e&&i())&&(this.isWidgetApplied()||e)||(this.clearWatcher(),this.callback("remove",t),this.watch()),this}eventHandler(){let t=r();return[250,500].forEach(e=>setTimeout(()=>500===e&&r()===t?this:(t=r(),this.decisionHandler(!1)),e)),this}observerHandler(t){const e=t.some(({removedNodes:t})=>t&&t.length),n=t.some(({addedNodes:t})=>t&&t.length);return e||n?(this.decisionHandler(!0),this):this}watch(){if(i())return this;this.clearWatcher(),document.addEventListener(...this.eventListenerParams);const t=y("body",e=>{const n=[e,{childList:!0,subtree:!0}];this.observer.observe(...n),this.elementsWaiters=this.elementsWaiters.filter(e=>e!==t)});return this.elementsWaiters.push(t),this}clearWatcher(){return document.removeEventListener(...this.eventListenerParams),this.elementsWaiters.length&&(this.elementsWaiters.forEach(t=>t.clear()),this.elementsWaiters=[]),this.observer.disconnect(),this}}class T{constructor(){this.children=void 0,this.uniqueId=u(),this.widgetName=d(),this.prettyName=h(),this.recurrenceParams=(()=>{const{displayRecurrence:t,closingRecurrence:e,validationRecurrence:n}=DATA;if(i()||!t&&!e&&!n)return!1;const s={everytime:()=>-1,session:()=>0,once:()=>395,day:t=>DATA[t+"_day"],week:t=>7*DATA[t+"_week"],month:t=>30.5*DATA[t+"_month"]},o={};return t&&(o.displayRecurrence=s[t]("displayRecurrence")),e&&(o.closingRecurrence=s[e]("closingRecurrence")),n&&(o.validationRecurrence=s[n]("validationRecurrence")),o})(),this.triggerParams=(()=>{let{triggerEvent:t}=DATA;const{triggerEventClick:e,triggerEventReengageDelay:n,socialProofContentType:s,triggerEventElementVisible:o,triggerEventDelay:r}=DATA;if(i()||!t&&!s)return!1;const a={click:()=>e,elementVisible:()=>o},c=Object.prototype.hasOwnProperty.call(a,t)?a[t]():"body",l="reengage"===t?n:r;return s&&(t=1===s?"socialProofPurchases":"socialProofPageViews"),{triggerEvent:t,triggerSelector:c,triggerDelay:l}})(),this.recurrence=!!this.recurrenceParams&&new b(this.recurrenceParams,this.clearGivenClearables.bind(this)),this.trigger=!!this.triggerParams&&new w(this.triggerParams),this.pageWatcher=new S(this.recurrence,this.isWidgetApplied.bind(this),this.onPageChange.bind(this)),this.hasOncePerPageTrigger=(()=>{const{isOncePerPageTrigger:t,triggerEvent:e}=DATA;return!(!t||!["click","script"].includes(e))||["pageLoad","direct","reengage","socialProofPurchases","socialProofPageViews","elementVisible"].some(t=>t===e)})(),this.basicClassName="ab_widget_container_"+this.widgetName,this.widgetContainerId=`${this.basicClassName}_${this.uniqueId}`,this.contentClassName=this.basicClassName+"_content",this.overlayClassName=this.basicClassName+"_overlay",this.closeButtonClassName=this.basicClassName+"_close_button",this.hideClassName="ab_hide_"+this.uniqueId,this.domElement=this.getDom(),this.hasBeenShown=!1,this.closedByUser=!1,this.eventsListeners=[],this.timeouts=[],this.intervals=[],this.observers=[],this.promises=[],this.elementsWaiters=[]}clearGivenClearables(){this.eventsListeners.length&&(this.eventsListeners.forEach(t=>document.removeEventListener(...t)),this.eventsListeners=[]),this.timeouts.length&&(this.timeouts.forEach(t=>clearTimeout(t)),this.timeouts=[]),this.intervals.length&&(this.intervals.forEach(t=>clearInterval(t)),this.intervals=[]),this.observers.length&&(this.observers.forEach(t=>t.disconnect()),this.observers=[]),this.promises.length&&(this.promises.forEach(t=>t.resolve(!1)),this.promises=[]),this.elementsWaiters.length&&(this.elementsWaiters.forEach(t=>t.clear()),this.elementsWaiters=[])}isWidgetApplied(){return this.domElement&&!!this.domElement.closest("html")}removeOldDomElement(){const t=document.getElementById(this.widgetContainerId);return t&&t.remove(),this}async insert(){const t=(t,e,n)=>{this.elementsWaiters=this.elementsWaiters.filter(t=>t!==e),g(t),n(t)},e=new Promise((e,n)=>{const i=y("head",t=>{this.elementsWaiters=this.elementsWaiters.filter(t=>t!==i),e(t.appendChild(this.styleElement))},e=>t(e,i,n));this.elementsWaiters.push(i)}),n=new Promise((e,n)=>{const{layout:i,elementReferrer:s,referrerInsertType:o}=DATA,{selector:r,position:a}="string"==typeof i&&"free"===i&&"string"==typeof s&&"string"==typeof o?{selector:s,position:o}:{selector:"body",position:"beforeend"},c=y(r,t=>{this.elementsWaiters=this.elementsWaiters.filter(t=>t!==c),this.removeOldDomElement(),e(t.insertAdjacentElement(a,this.domElement))},e=>t(e,c,n));this.elementsWaiters.push(c)});return Promise.all([n,e]).then(()=>this)}remove(){return this.pageWatcher.clearWatcher(),this.domElement&&this.domElement.closest("html")&&this.domElement.remove(),this.styleElement&&this.styleElement.closest("html")&&this.styleElement.remove(),this.hasOncePerPageTrigger?this.pageWatcher.watch():i()||this.init().then(({response:t})=>t?this.show():this),this}show(){return this.hasBeenShown||i()||window.ABTastyEvent(this.prettyName+" displayed",null,TEST_ID),this.closedByUser=!1,this.domElement.classList.remove(this.hideClassName),this.recurrence&&this.recurrence.setDisplayRecurrence(),this.hasBeenShown=!0,this.pageWatcher.watch(),this}hide(){return this.hasBeenShown&&!i()&&window.ABTastyEvent(this.prettyName+" closed",null,TEST_ID),this.closedByUser=!0,this.domElement.classList.add(this.hideClassName),this}async init(t){if(!i()&&!r())return!1;if(this.trigger&&this.trigger.promises.length)return!1;const e=this.recurrence&&this.recurrence.isOver();if(this.recurrence&&!e)return this.pageWatcher.watch(),!1;this.pageWatcher.watch();const n=i()||!this.trigger||this.trigger&&await this.trigger.isTriggered();return!!n&&(await this.insert(),this.addCloseEvent(),i()||t||this.hasBeenShown||void 0===this.children||"function"!=typeof this.children.refreshContent||this.children.refreshContent(n),{container:this,response:n})}onPageChange(t,e){const n=()=>this.init().then(({response:t})=>t&&this.show());switch(e||(this.hasBeenShown=!1),t){case"remove":this.isWidgetApplied()?this.remove():(this.trigger&&this.trigger.clear(),this.pageWatcher.watch());break;case"rebuild":this.hasBeenShown?this.closedByUser?this.pageWatcher.watch():this.insert().then(t=>t.show()):n()}}addCloseEvent(...t){const{closeButton:e,overlayClickable:n,layout:s}=DATA,o=[];if(void 0!==n&&n&&void 0!==s&&"popin"===s&&o.push("."+this.overlayClassName),void 0!==e&&e&&o.push("."+this.closeButtonClassName),!o.length)return this;const r=this.domElement.querySelectorAll(o.join(", "));return r.length?(t.push(...r),t.forEach(t=>{i()&&(t.dataset.abtastyActionnable="true"),t.addEventListener("click",()=>{this.recurrence&&this.recurrence.setClosingRecurrence(),this.hide(),setTimeout(()=>this.remove(),1e3)},{passive:!0,once:!0})}),this):this}getDom(){const{closeButton:t,layout:e}=DATA,n=document.createElement("div");return n.className=`${this.basicClassName} ${this.hideClassName}`,n.id=this.widgetContainerId,n.innerHTML=`\n\t\t\t${void 0!==e&&"popin"===e?`<div class="${this.overlayClassName}"></div>`:""}\n\t\t\t<div class="${this.contentClassName}">\n\t\t\t${t?`<button class="${this.closeButtonClassName}"><svg viewBox="0 0 16 16">\n\t<defs><path id="prefix__a" d="M12 4.991L11.009 4 8 7.009 4.991 4 4 4.991 7.009 8 4 11.009 4.991 12 8 8.991 11.009 12 12 11.009 8.991 8z"></path></defs>\n\t<g><use xlink:href="#prefix__a"></use></g>\n</svg></button>`:""}\n\t\t\t</div>`,n}loadFont(t,e){if(!t||"inherit"===t)return;const n=document.createElement("style");n.appendChild(document.createTextNode(`\t\t\t@font-face { \t\t\tfont-family: '${t}'; \t\t\tsrc: url('${e}');\t\t\t}\t\t`)),document.head.appendChild(n)}getStyleTag(t=""){const{noStyles:e,layout:n}=DATA,{backgroundColor:s,isBackgroundImage:o,backgroundImage:r,backgroundSize:a,backgroundPosition:c,backgroundRepeat:l,borderColor:d,borderRadius:h,borderWidth:u,textColor:m,textAlign:g,fontName:p,fontStyle:y,fontSize:v,overlayColor:b,dropShadow:f,dropShadowColor:w,dropShadowBlur:S,containerMargin:T,containerPadding:x,closeButton:E,buttonsBorderWidth:_,buttonsBorderColor:A,buttonsBorderRadius:C,buttonsBackgroundColor:$,buttonsTextColor:L}=e?{}:DATA,k=document.createElement("style");k.type="text/css",i()&&k.setAttribute("abtasty-script-added","true"),this.loadFont(p,y);const B=`background: ${["string"==typeof s?s:"rgba(255, 255, 255, 1)",o&&"string"==typeof r&&r.length?`url(${r})`:"",o&&"string"==typeof c&&"100% 100%"!==a?c:"0 0",o&&"string"==typeof a?"/ "+a:"/ auto",o&&l&&!["cover","100% 100%"].includes(a)?"repeat":"no-repeat"].join(" ").trim()};`,N="number"==typeof u&&u>0,I=`border: ${[N?u+"px":"unset",N?"solid":"",N&&"string"==typeof d&&d.length?d:""].join(" ").trim()};`,P=void 0!==h?`border-radius: ${h}px;`:"",O=void 0!==m?`color: ${m}; fill: ${m};`:"",R=void 0!==g?`text-align: ${g};`:"",W=p&&"inherit"!==p?`font-family:${p};`:y||"",D=v?`font-size: ${v}px;`:"",j=void 0!==f&&f?`box-shadow: 0 5px ${S}px 0 ${w};`:"",q=T instanceof Array&&1===T.length&&T[0],M=q?`margin: ${q.top}px ${q.right}px ${q.bottom}px ${q.left}px;`:"",V=q?`margin: calc(${q.top}px * 0.5) calc(${q.right}px * 0.5) calc(${q.bottom}px * 0.5) calc(${q.left}px * 0.5);`:"",H=x instanceof Array&&1===x.length&&x[0],U=H?`padding: ${H.top}px ${H.right}px ${H.bottom}px ${H.left}px;`:"",G=H?`padding: calc(${H.top}px * 0.5) calc(${H.right}px * 0.5) calc(${H.bottom}px * 0.5) calc(${H.left}px * 0.5);`:"",F=void 0!==_&&_?`border-width: ${_}px; border-style: solid;`:"",Y=[A,_].every(t=>void 0!==t)&&_?`border-color: ${A};`:"",z=void 0!==C?`border-radius: ${C}px;`:"",K=void 0!==$?`background-color: ${$};`:"",J=void 0!==L?`color: ${L};`:"",X=void 0!==n&&"popin"===n?[`#${this.widgetContainerId} .${this.overlayClassName} {`,`background-color: ${void 0!==b?b:"rgba(0, 0, 0, 0.6)"};`,"}"].join(""):"",Q=e||void 0!==E&&E?[`#${this.widgetContainerId} .${this.contentClassName} .${this.closeButtonClassName} {`,"position: absolute;","top: 8px;","right: 8px;","width: auto;","height: auto;","background: none;","border: none;","cursor: pointer;","outline: none;","padding: 0;","margin: 0;","}",`#${this.widgetContainerId} .${this.contentClassName} .${this.closeButtonClassName} svg {`,"pointer-events: none;","width: 16px;","height: 16px;",O,W,D,"}"].join(""):"";return k.textContent=[`.${this.hideClassName} {`,"opacity: 0 !important;","pointer-events: none;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,B,P,I,O,R,j,M,W,D,"}",`#${this.widgetContainerId} .${this.contentClassName} > * {`,"display: block;","line-height: 1;","text-indent: unset;",U,W,D,"}",`#${this.widgetContainerId} .${this.contentClassName} > * a, `,`#${this.widgetContainerId} .${this.contentClassName} > * button {`,F,Y,z,K,J,W,D,"}","@media screen and (max-width: 579px) {",`#${this.widgetContainerId} .${this.contentClassName} {`,V,"}",`#${this.widgetContainerId} .${this.contentClassName} > * {`,G,"}","}",X,Q,""+t].join(""),k}}class x extends T{constructor(){super(),this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){return[`#${this.widgetContainerId} {`,"position: fixed;","top: 0;","left: 0;","width: 100%;","height: 100%;","z-index: 9999;","opacity: 1;","transition: opacity 0.25s ease;","}",`#${this.widgetContainerId} .${this.overlayClassName} {`,"position: absolute;","z-index: -1;","top: 0;","left: 0;","width: 100%;","height: 100%;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: absolute;","left: 50%;","top: 50%;","transform: translate(-50%, -50%);","width: auto;","height: auto;","}","@media screen and (max-width: 579px) {",`#${this.widgetContainerId} .${this.contentClassName} {`,"max-width: 94vw;","}","}"].join("")}}class E extends T{constructor(){super(),this.position="string"==typeof DATA.layout&&"bannerTop"===DATA.layout?"top":"bottom",this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){return[`#${this.widgetContainerId} {`,"position: fixed;",this.position+": 0;","left: 0;","width: 100%;","height: auto;","z-index: 9999;","opacity: 1;","transition: opacity 0.25s ease;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: relative;","}"].join("")}}class _ extends T{constructor(){super(),this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){return[`#${this.widgetContainerId} {`,"width: auto;","height: auto;","margin: 0;","padding: 0;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: relative;","}"].join("")}}const A=()=>{const{layout:t}=DATA;let e;switch(t){case"popin":e=new x;break;case"bannerTop":case"bannerBottom":e=new E;break;case"free":e=new _;break;default:e=new T}return e},C={category:c,type:"slider",min:1},$=[{...C,propName:"day",label:"widget_common_conditions_recurrence_ifOptionVariable_labelDays",value:5,max:395},{...C,propName:"week",label:"widget_common_conditions_recurrence_ifOptionVariable_labelWeeks",value:2,max:56},{...C,propName:"month",label:"widget_common_conditions_recurrence_ifOptionVariable_labelMonths",value:1,max:13}],L={category:c,type:"select",options:[{label:"widget_common_conditions_recurrence_option_everyTime",value:"everytime"},{label:"widget_common_conditions_recurrence_option_everySession",value:"session"},{label:"widget_common_conditions_recurrence_option_everyXDays",value:"day"},{label:"widget_common_conditions_recurrence_option_everyXWeeks",value:"week"},{label:"widget_common_conditions_recurrence_option_everyXMonths",value:"month"},{label:"widget_common_conditions_recurrence_option_once",value:"once"}],value:"everytime"},k={...L,label:"widget_common_conditions_recurrence_label_widgetDisplayed",propName:"displayRecurrence"},B=($.map(t=>({...t,propName:`${k.propName}_${t.propName}`,conditions:[{field:k.propName,value:t.propName}]})),{...L,label:"widget_common_conditions_recurrence_label_widgetDisplayedAfterClosure",propName:"closingRecurrence"}),N=($.map(t=>({...t,propName:`${B.propName}_${t.propName}`,conditions:[{field:B.propName,value:t.propName}]})),{...L,label:"widget_common_conditions_recurrence_label_widgetDisplayedAfterSubmission",propName:"validationRecurrence"});$.map(t=>({...t,propName:`${N.propName}_${t.propName}`,conditions:[{field:N.propName,value:t.propName}]}));B.condition=({closeButton:t,layout:e,overlayClickable:n})=>!("popin"===e&&!1===t&&!1===n||void 0!==e&&"popin"!==e&&!1===t);const I={pageLoad:{label:"widget_common_conditions_triggering_option_pageload",value:"pageLoad"},direct:{label:"widget_common_conditions_triggering_option_asap",value:"direct"},exitIntent:{label:"widget_common_conditions_triggering_option_exitIntent",value:"exitIntent"},reengage:{label:"widget_common_conditions_triggering_option_afterXSecondsOfInactivity",value:"reengage"},click:{label:"widget_common_conditions_triggering_option_click",value:"click"},elementVisible:{label:"widget_common_conditions_triggering_option_elementVisible",value:"elementVisible"},customScript:{label:"widget_common_conditions_triggering_option_customTrigger",value:"script"}};Object.keys(I).map(t=>I[t]);var P=function(t){if(Array.isArray(t))return t};var O=function(t,e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var n=[],i=!0,s=!1,o=void 0;try{for(var r,a=t[Symbol.iterator]();!(i=(r=a.next()).done)&&(n.push(r.value),!e||n.length!==e);i=!0);}catch(t){s=!0,o=t}finally{try{i||null==a.return||a.return()}finally{if(s)throw o}}return n}};var R=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i};var W=function(t,e){if(t){if("string"==typeof t)return R(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?R(t,e):void 0}};var D=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")};var j=function(t,e){return P(t)||O(t,e)||W(t,e)||D()};var q=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 i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}var V=function(t,e,n){return e&&M(t.prototype,e),n&&M(t,n),t},H=["fr","en","de","es"],U=["day","hour","minute","second"],G={day:{en:"Day",fr:"Jour",es:"Dia",de:"Tag"},days:{en:"Days",fr:"Jours",es:"Dias",de:"Tage"},hour:{en:"Hour",fr:"Heure",es:"Hora",de:"Zeit"},hours:{en:"Hours",fr:"Heures",es:"Horas",de:"Stunden"},minute:"Min",second:{en:"Sec",fr:"Sec",es:"Seg",de:"Sek"}},F=window.ABTASTY_S&&ABTASTY_S.USER&&ABTASTY_S.USER.lang?ABTASTY_S.USER.lang.split("_")[0]:navigator.language.substr(0,2)||"en",Y=function(t){return H.indexOf(t)>-1}(F)?F:"en",z={day:G.day[Y],days:G.days[Y],hour:G.hour[Y],hours:G.hours[Y],minute:G.minute,minutes:G.minute,second:G.second[Y],seconds:G.second[Y]};var K=function(){function t(e,n){q(this,t),this.testId=e,this.data=n,this.targetselector=n.selector,this.container=document.createElement("abtasty-countdown"),this.digitElements={},this.textElements={},this.timeLoop=null,this.maxWidth=0,this.previewTime=172799,this.unitsText=z,this.data.customTexts&&(this.unitsText={day:this.data.customDaysLabel,days:this.data.customDaysLabel,hour:this.data.customHoursLabel,hours:this.data.customHoursLabel,minute:this.data.customMinutesLabel,minutes:this.data.customMinutesLabel,second:this.data.customSecondsLabel,seconds:this.data.customSecondsLabel})}return V(t,[{key:"insert",value:function(t,e){return t.insertAdjacentElement(e,this.container),this}},{key:"setText",value:function(t){var e=this;U.forEach((function(n){var i=t[n];String(i).length<2&&(i="0"+i),e.digitElements[n].textContent=i,e.textElements[n].textContent=1===i?e.unitsText[n]:e.unitsText["".concat(n,"s")],e.maxWidth<e.textElements[n].offsetWidth&&(e.maxWidth=e.textElements[n].offsetWidth),e.textElements[n].style.minWidth="".concat(e.maxWidth,"px")}))}},{key:"onTimeEnd",value:function(){if("hideWidget"==this.data.endSettings)return this.parentContainer.hide(),void(this.parentContainer.domElement.style.display="none");var t={};"showText"==this.data.endSettings&&(t.endText=!0,t.endCountdown=!0,t.endButton=!1),"showTextAndButton"==this.data.endSettings&&(t.endText=!0,t.endButton=!0,t.endCountdown=!0),"hideCountdownAndShowText"==this.data.endSettings&&(t.endText=!0,t.endCountdown=!1,t.endButton=!1),"hideCountdownAndShowTextAndButton"==this.data.endSettings&&(t.endText=!0,t.endCountdown=!1,t.endButton=!0);var e=[" abtasty-countdown-".concat(this.data.endSettings),"abtasty-countdown-finish"];for(var n in t)t[n]?e.push("abtasty-countdown-".concat(n,"-show")):e.push("abtasty-countdown-".concat(n,"-hide"));this.container.className+=" "+e.join(" ")}},{key:"setCountdown",value:function(){var t,e=(new Date).getTime(),n=((t=this.data).dateTimeStart+(t.timezoneOffset||0)-e)/1e3;if(window.ABTastyEditor&&("ifEnded"==this.data.previewBlock?n=-1:"ifWorking"==this.data.previewBlock&&n<=0&&(n=this.previewTime),this.previewTime-=1),n<=0)return this.setText({day:0,hour:0,minute:0,second:0}),clearInterval(this.timeLoop),void this.onTimeEnd();var i=Math.floor(n/86400);n-=86400*i;var s=Math.floor(n/3600);n-=3600*s;var o=Math.floor(n/60);n-=60*o;var r=Math.floor(n);this.setText({day:i,hour:s,minute:o,second:r})}},{key:"getStyle",value:function(){return"\n abtasty-countdown .abtasty-countdown-finish-text,\n abtasty-countdown .abtasty-countdown-top-message {\n text-align: ".concat(this.data.textAlign,"!important;\n }\n \n abtasty-countdown .abtasty-countdown-elm-number{\n font-size: ").concat(this.data.numbersfontSize,"px; \n color: ").concat(this.data.numberstextColor,";\n ").concat(this.data.numbersfontStyle,";\n font-family: ").concat(this.data.numbersfontName,";\n text-align: ").concat(this.data.numberstextAlign,"; \n }\n\n abtasty-countdown .abtasty-countdown-elm-text{\n text-transform: uppercase;\n font-weight: 700;\n font-size: ").concat(this.data.legendfontSize,"px; \n color: ").concat(this.data.legendtextColor,";\n ").concat(this.data.legendfontStyle,";\n font-family: ").concat(this.data.legendfontName,";\n text-align: ").concat(this.data.legendtextAlign,"; \n }\n \n abtasty-countdown .abtasty-countdown-elm-time {\n border-radius: ").concat(this.data.countdownBorderRadius,"px;\n border: ").concat(this.data.countdownBorderWidth,"px solid ").concat(this.data.countdownBorderColor,";\n background-color: ").concat(this.data.numbersBackgroundColor,"; \n }\n \n ")}},{key:"setButton",value:function(){var t,e;if(this.data.button){var n=this.container.querySelector(".abtasty-countdown-bottom-button"),i=document.createElement("a");i.href=this.data.btnLink,i.innerHTML=this.data.btnLabel,this.data.btnTargetBlank&&(i.target="_blank"),n.appendChild(i)}t=this.container.querySelector(".abtasty-countdown-finish-button"),(e=document.createElement("a")).href=this.data.endBtnLink,this.data.endBtnTargetBlank&&(e.target="_blank"),e.innerHTML=this.data.endBtnLabel,t.appendChild(e)}},{key:"setContent",value:function(){window.testt=this;var t=this.container.querySelector(".abtasty-countdown-top-message"),e=document.createElement("div");e.innerHTML=this.data.message,t.appendChild(e),t=this.container.querySelector(".abtasty-countdown-finish-text"),(e=document.createElement("div")).innerHTML=this.data.endMessage,t.appendChild(e)}},{key:"init",value:function(t){var e,n,i=this;try{this.parentContainer=t,this.container.className="abtasty-countdown-layout-block","bannerTop"!=this.data.layout&&"bannerBottom"!=this.data.layout||(this.container.className="abtasty-countdown-layout-line",t.domElement.querySelectorAll(".".concat(t.closeButtonClassName)).forEach((function(t){t.className+=" abtasty-countdown-close-inline"}))),this.container.innerHTML='\n <div class="abtasty-countdown-layout-'.concat(this.data.layout,'">\n <div class="abtasty-countdown-top-message"></div>\n <div class="abtasty-countdown-clock">\n <div class="abtasty-countdown-days abtasty-countdown-elm-time">\n <div class="abtasty-countdown-days__digit abtasty-countdown-elm-number"></div>\n <div class="abtasty-countdown-days__text abtasty-countdown-elm-text"></div>\n </div>\n <div class="abtasty-countdown-hours abtasty-countdown-elm-time">\n <div class="abtasty-countdown-hours__digit abtasty-countdown-elm-number"></div>\n <div class="abtasty-countdown-hours__text abtasty-countdown-elm-text"></div>\n </div>\n <div class="abtasty-countdown-minutes abtasty-countdown-elm-time">\n <div class="abtasty-countdown-minutes__digit abtasty-countdown-elm-number"></div>\n <div class="abtasty-countdown-minutes__text abtasty-countdown-elm-text"></div>\n </div>\n <div class="abtasty-countdown-seconds abtasty-countdown-elm-time">\n <div class="abtasty-countdown-seconds__digit abtasty-countdown-elm-number"></div>\n <div class="abtasty-countdown-seconds__text abtasty-countdown-elm-text"></div>\n </div>\n </div>\n <div class="abtasty-countdown-finish-text"></div>\n <div class="abtasty-countdown-finish-button"></div>\n <div class="abtasty-countdown-bottom-button"></div>\n </div>'),this.container.insertAdjacentElement("afterbegin",(e="abtasty-countdown{display:inline-block}abtasty-countdown>div{display:inline-block;text-align:center;margin:10px}abtasty-countdown .abtasty-countdown-finish-text,abtasty-countdown .abtasty-countdown-top-message{margin-bottom:15px}abtasty-countdown .abtasty-countdown-elm-time{display:inline-block;padding:6px;margin:6px 6px 15px}abtasty-countdown .abtasty-countdown-elm-text{text-align:center}abtasty-countdown .abtasty-countdown-elm-number,abtasty-countdown .abtasty-countdown-elm-text{font-weight:700;font-stretch:normal;font-style:normal;line-height:normal;letter-spacing:normal}abtasty-countdown .abtasty-countdown-bottom-button a,abtasty-countdown .abtasty-countdown-finish-button a{cursor:pointer;text-decoration:none;display:block;padding:6px;border:1px solid #57b8c7;text-align:center}.abtasty-countdown-layout-line.abtasty-countdown-finish .abtasty-countdown-finish-text{display:table-cell;padding:0 25px;vertical-align:middle}.abtasty-countdown-layout-line.abtasty-countdown-finish .abtasty-countdown-finish-button{display:table-cell;vertical-align:middle}.abtasty-countdown-layout-line>div{display:inline-block;margin:0}.abtasty-countdown-layout-line .abtasty-countdown-top-message{display:table-cell;vertical-align:middle;padding-right:30px}.abtasty-countdown-layout-line .abtasty-countdown-bottom-button{display:table-cell;vertical-align:middle}.abtasty-countdown-layout-line .abtasty-countdown-bottom-button a{margin-left:30px}.abtasty-countdown-layout-line .abtasty-countdown-elm-time{margin:0}.abtasty-countdown-layout-line .abtasty-countdown-clock{display:table-cell}.abtasty-countdown-close-inline{top:calc(50% - 13px)!important}.abtasty-countdown-layout-line{display:table;width:100%}.abtasty-countdown-finish-button,.abtasty-countdown-finish-text{display:none}.abtasty-countdown-endButton-show .abtasty-countdown-finish-button,.abtasty-countdown-endCountdown-show.abtasty-countdown-clock,.abtasty-countdown-endText-show .abtasty-countdown-finish-text{display:block}.abtasty-countdown-layout-line.abtasty-countdown-endButton-show .abtasty-countdown-finish-button,.abtasty-countdown-layout-line.abtasty-countdown-endCountdown-show .abtasty-countdown-clock,.abtasty-countdown-layout-line.abtasty-countdown-endText-show .abtasty-countdown-finish-text{display:table-cell}.abtasty-countdown-endButton-hide .abtasty-countdown-finish-button,.abtasty-countdown-endCountdown-hide .abtasty-countdown-clock,.abtasty-countdown-endText-hide .abtasty-countdown-finish-text,.abtasty-countdown-finish .abtasty-countdown-bottom-button,.abtasty-countdown-finish .abtasty-countdown-top-message{display:none!important} "+this.getStyle(),(n=document.createElement("style")).type="text/css",n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e)),n)),U.forEach((function(t){var e=j(i.container.querySelector(".abtasty-countdown-".concat(t,"s")).children,2),n=e[0],s=e[1];i.digitElements[t]=n,i.textElements[t]=s})),this.timeLoop=setInterval(this.setCountdown.bind(this),1e3),this.setContent(),this.setButton(),this.setText({day:99,hour:88,minute:77,second:66}),this.setText({day:55,hour:44,minute:33,second:22}),this.setText({day:11,hour:0,minute:0,second:0}),this.setCountdown()}catch(t){}}}]),t}();function J(){return(J=n(t.mark((function e(){var n,i,s;return t.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=A(),t.next=3,n.init();case 3:if(t.sent){t.next=6;break}return t.abrupt("return",!1);case 6:i=n.domElement.querySelector(".".concat(n.contentClassName)),(s=new K(TEST_ID,DATA)).init(n),s.insert(i,"beforeend"),n.show();case 11:case"end":return t.stop()}}),e)})))).apply(this,arguments)}!function(){J.apply(this,arguments)}()}();
|
package/package.json
CHANGED
@@ -1,55 +1,55 @@
|
|
1
|
-
{
|
2
|
-
"name": "@abtasty/countdown",
|
3
|
-
"description": "Widget for AB Tasty",
|
4
|
-
"version": "
|
5
|
-
"form": "dist/form.js",
|
6
|
-
"main": "dist/main.js",
|
7
|
-
"files": [
|
8
|
-
"dist"
|
9
|
-
],
|
10
|
-
"homepage": "https://abtasty.com",
|
11
|
-
"author": "Enguerran Dector <enguerran@abtasty.com>",
|
12
|
-
"scripts": {
|
13
|
-
"
|
14
|
-
"
|
15
|
-
"
|
16
|
-
"
|
17
|
-
"
|
18
|
-
"
|
19
|
-
},
|
20
|
-
"devDependencies": {
|
21
|
-
"@babel/core": "^7.8.4",
|
22
|
-
"@babel/plugin-transform-classes": "^7.8.3",
|
23
|
-
"@babel/plugin-transform-runtime": "^7.8.3",
|
24
|
-
"@babel/preset-env": "^7.8.4",
|
25
|
-
"@babel/runtime": "^7.4.2",
|
26
|
-
"concurrently": "^5.1.0",
|
27
|
-
"cssnano": "^4.1.10",
|
28
|
-
"eslint": "^4.16.0",
|
29
|
-
"eslint-config-airbnb-base": "^12.1.0",
|
30
|
-
"eslint-config-prettier": "^2.9.0",
|
31
|
-
"eslint-import-resolver-node": "^0.3.2",
|
32
|
-
"eslint-plugin-import": "^2.20.1",
|
33
|
-
"postcss-cssnext": "^3.0.2",
|
34
|
-
"rollup": "^1.30.1",
|
35
|
-
"rollup-plugin-babel": "^4.3.3",
|
36
|
-
"rollup-plugin-eslint": "^7.0.0",
|
37
|
-
"rollup-plugin-postcss": "^2.0.6",
|
38
|
-
"rollup-plugin-pug": "^1.1.1",
|
39
|
-
"rollup-watch": "^4.3.1",
|
40
|
-
"snowpack": "^1.1.4"
|
41
|
-
},
|
42
|
-
"dependencies": {
|
43
|
-
"@abtasty/widget-utils": "^1.
|
44
|
-
"@babel/plugin-proposal-object-rest-spread": "^7.8.3",
|
45
|
-
"@rollup/plugin-commonjs": "^11.0.1",
|
46
|
-
"@rollup/plugin-node-resolve": "^7.0.0",
|
47
|
-
"babel-eslint": "^10.0.3",
|
48
|
-
"rollup-plugin-terser": "^5.2.0"
|
49
|
-
},
|
50
|
-
"snowpack": {
|
51
|
-
"webDependencies": [
|
52
|
-
"@abtasty/widget-utils"
|
53
|
-
]
|
54
|
-
}
|
55
|
-
}
|
1
|
+
{
|
2
|
+
"name": "@abtasty/countdown",
|
3
|
+
"description": "Widget for AB Tasty",
|
4
|
+
"version": "2.0.1-0",
|
5
|
+
"form": "dist/form.js",
|
6
|
+
"main": "dist/main.js",
|
7
|
+
"files": [
|
8
|
+
"dist"
|
9
|
+
],
|
10
|
+
"homepage": "https://abtasty.com",
|
11
|
+
"author": "Enguerran Dector <enguerran@abtasty.com>",
|
12
|
+
"scripts": {
|
13
|
+
"start": "concurrently --kill-others \"npm run watch\" \"npm run serve\"",
|
14
|
+
"watch": "rollup -c --watch --dev",
|
15
|
+
"build": "rollup -c",
|
16
|
+
"serve": "widget serve",
|
17
|
+
"prepare": "npm run build",
|
18
|
+
"postpublish": "echo 'Your widget is on NPM. You can now add your widget to AB Tasty at https://app2.abtasty.com/'"
|
19
|
+
},
|
20
|
+
"devDependencies": {
|
21
|
+
"@babel/core": "^7.8.4",
|
22
|
+
"@babel/plugin-transform-classes": "^7.8.3",
|
23
|
+
"@babel/plugin-transform-runtime": "^7.8.3",
|
24
|
+
"@babel/preset-env": "^7.8.4",
|
25
|
+
"@babel/runtime": "^7.4.2",
|
26
|
+
"concurrently": "^5.1.0",
|
27
|
+
"cssnano": "^4.1.10",
|
28
|
+
"eslint": "^4.16.0",
|
29
|
+
"eslint-config-airbnb-base": "^12.1.0",
|
30
|
+
"eslint-config-prettier": "^2.9.0",
|
31
|
+
"eslint-import-resolver-node": "^0.3.2",
|
32
|
+
"eslint-plugin-import": "^2.20.1",
|
33
|
+
"postcss-cssnext": "^3.0.2",
|
34
|
+
"rollup": "^1.30.1",
|
35
|
+
"rollup-plugin-babel": "^4.3.3",
|
36
|
+
"rollup-plugin-eslint": "^7.0.0",
|
37
|
+
"rollup-plugin-postcss": "^2.0.6",
|
38
|
+
"rollup-plugin-pug": "^1.1.1",
|
39
|
+
"rollup-watch": "^4.3.1",
|
40
|
+
"snowpack": "^1.1.4"
|
41
|
+
},
|
42
|
+
"dependencies": {
|
43
|
+
"@abtasty/widget-utils": "^1.16.12",
|
44
|
+
"@babel/plugin-proposal-object-rest-spread": "^7.8.3",
|
45
|
+
"@rollup/plugin-commonjs": "^11.0.1",
|
46
|
+
"@rollup/plugin-node-resolve": "^7.0.0",
|
47
|
+
"babel-eslint": "^10.0.3",
|
48
|
+
"rollup-plugin-terser": "^5.2.0"
|
49
|
+
},
|
50
|
+
"snowpack": {
|
51
|
+
"webDependencies": [
|
52
|
+
"@abtasty/widget-utils"
|
53
|
+
]
|
54
|
+
}
|
55
|
+
}
|