@abtasty/spotlight 1.1.13 → 1.1.15-0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/form.js +1 -1
- package/dist/main.js +1 -1
- package/package.json +3 -2
package/dist/main.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
!function(){"use strict";const e=()=>Object.prototype.hasOwnProperty.call(window,"ABTastyEditor"),t=()=>{const e=!!document.getElementById("ABTastyPreviewBar"),t=location.href.includes("ab_project=preview");return e||t},s=e=>new Function(`try {\n\t\t${e}\n\t} catch (error) {\n\t\treturn null;\n\t}`)(),n=()=>encodeURIComponent(DATA.spNoTrim?window.location.href.replace(window.location.origin,""):`${window.location.pathname}`),i=()=>!e()&&(t()||!!window.ABTasty.getTestsOnPage()[TEST_ID]),r=()=>window.ABTasty&&!0===window.ABTasty.consentReady,o="remove",a="rebuild",c="update",l=()=>{const{type:e}=DATA;return`${PACKAGE.replace("@abtasty/","")}${e?`_${e}`:""}`},h=()=>{const e=l();return`${e.charAt(0).toUpperCase()}${e.slice(1)}`.split("-").join(" ")},d=()=>`${PLUGIN_ID.split("-")[0]}_${TEST_ID}`,u=s=>{const n=(()=>{if(e()||t())return!1;const s=ABTasty.getTestsOnPage()[TEST_ID];return!!s&&Object.keys(s.targetings.qaParameters).length>0})(),i=document.cookie.includes("abTastyDebug=")||!0===window.abTastyDebug;if(n||i){const e=h();window.console.log(`%c${e} - ${n?"QA":"Debug"} Mode for campaign ${TEST_ID} %c ${s}`,"background-color: #D6FF01; color: #3100be; padding: 3px 0 3px 10px; border-radius: 5px 0 0 5px; font-weight: bold;","background-color: #3100be; color: white; padding: 3px 10px 3px 0; border-radius: 0 5px 5px 0;")}},g=e=>{const t={promise:null,resolve:null,reject:null,name:e};return t.promise=new Promise((e,s)=>{t.resolve=e,t.reject=s}),t},m=(e,t)=>{const s=()=>{try{return document.querySelector(e)}catch(e){return null}};let n=s();const i=[document.querySelector("body")||document.documentElement,{childList:!0,subtree:!0,attributes:!0}],r=()=>a.disconnect(),o=()=>a.observe(...i),a=new MutationObserver(()=>(n=s(),n&&!r()&&t(n)));return n?setTimeout(()=>t(n),0):o(),{selector:e,clear:r,observe:o}};function p(e,t){return t(e)||!e.parentElement?e:p(e.parentElement,t)}const v=(e,t)=>[...document.querySelectorAll(t)].some(s=>s===e||!!e.closest(t)),b=(e,t)=>{let s=Date.now();return()=>{s+t-Date.now()<=0&&(e(),s=Date.now())}};class f{constructor(){this.targets=[],this.existingTargets=[],this.inViewportTargets=[],this.visibilityObserver=this.startVisibilityObserver(),this.mutationObserver=null,this.mouseOverEvent=this.mouseOverHandler(),this.scrollEvent=this.scrollEventHandler(),this.onTransitionEnd=this.transitionOverHandler()}transitionOverHandler(){const e=["transitionend",this.checkElements.bind(this),!0];return this.getEvents(e)}intersectionHandler(e){e.forEach(e=>{e.isIntersecting?(this.existingTargets.forEach(t=>{t.element.isSameNode(e.target)&&(this.inViewportTargets.push(t),this.mouseOverEvent.start(),this.scrollEvent.start(),this.onTransitionEnd.start())}),this.checkElements()):this.inViewportTargets=this.inViewportTargets.filter(t=>!t.element.isSameNode(e.target)||(this.mouseOverEvent.clear(),this.scrollEvent.clear(),this.onTransitionEnd.clear(),!1))})}startVisibilityObserver(){return new IntersectionObserver(this.intersectionHandler.bind(this),{root:null,rootMargin:"0px",threshold:0})}startMutationObserver(){this.mutationObserver??=new MutationObserver(this.checkElements.bind(this));const{clear:e}=m("body",t=>{e(),this.mutationObserver.observe(t,{attributes:!0,childList:!0,subtree:!0})});return this.mutationObserver}onMouseOver({target:e,path:t}){const s=this.inViewportTargets.find(({element:s,selector:n})=>{if(s.isSameNode(e))return!0;const i=[...e.querySelectorAll(n)];if(i.length&&i.includes(s))return!0;if(t.includes(s))return!0;const r=[...e.parentElement.children],o=r.findIndex(t=>t.isSameNode(e)),a=r.filter((e,t)=>t>o);if(a.length){if(a.includes(s))return!0;if(a.some(e=>[...e.querySelectorAll(n)].includes(s)))return!0}return!1});if(s&&this.isElementVisible(s.element)){const{selector:e,element:t,uniqueId:n}=s,i=this.targets.find(t=>t.selector===e&&t.uniqueId===n);i&&i.resolve(t),this.clear(e,n)}}getEvents(e){return{start:()=>document.addEventListener(...e),clear:()=>document.removeEventListener(...e)}}mouseOverHandler(){const e=["ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0?"touchmove":"mouseover",e=>{const t=e.composedPath(),{target:s}=e;setTimeout(()=>this.onMouseOver({target:s,path:t}),50)},!0];return this.getEvents(e)}scrollEventHandler(){const e=["scroll",b(this.checkElements.bind(this),50),{passive:!0}];return this.getEvents(e)}isElementVisible(e){return this.isElementTopmost(e)&&this.isElementOpaque(e)}isElementOpaque(e){return"HTML"===p(e,e=>"0"===window.getComputedStyle(e).opacity).nodeName}isElementTopmost(e){const t=e.getBoundingClientRect(),s=[[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 n=!1,i=0;for(;!n&&i<s.length;){const t=document.elementFromPoint(...s[i]);n=e===t||e.contains(t),i+=1}return n}checkElements(){this.targets.forEach(({selector:e,uniqueId:t})=>{const s=document.querySelector(e);s&&!this.existingTargets.find(s=>s.element.matches(e)&&s.uniqueId===t)&&(this.existingTargets.push({element:s,selector:e,uniqueId:t}),this.visibilityObserver.observe(s))}),this.existingTargets=this.existingTargets.filter(({selector:e,element:t})=>!!document.querySelector(e)||(t&&this.visibilityObserver.unobserve(t),!1)),this.inViewportTargets=this.inViewportTargets.filter(({selector:e,element:t,uniqueId:s})=>{if(t.matches(e)&&this.isElementVisible(t)){const n=this.targets.find(t=>t.selector===e&&t.uniqueId===s);return n&&n.resolve(t),this.clear(e,s),!1}return!0})}watch(e,t,s){this.targets.push({selector:e,resolve:t,uniqueId:s}),this.startMutationObserver(),this.checkElements()}clear(e,t){[this.targets,this.existingTargets,this.inViewportTargets]=[this.targets,this.existingTargets,this.inViewportTargets].map(s=>s.filter(({selector:s,uniqueId:n})=>s!==e&&n!==t));const s=document.querySelector(e);s&&this.visibilityObserver.unobserve(s),0===this.targets.length&&this.mutationObserver?.disconnect(),0===this.inViewportTargets.length&&(this.mouseOverEvent.clear(),this.scrollEvent.clear(),this.onTransitionEnd.clear())}}class y{constructor({triggerEvent:e,triggerSelector:t,triggerDelay:s,triggerTarget:n}){this.event=e,this.selector=t&&t.length?t:"body",this.target=n,this.delay=1e3*s,this.elementsSelectors=[],this.eventsListeners=[],this.timeouts=[],this.intervals=[],this.promises=[],this.visibilityObservers=[],this.socialProofStore={}}async onElementVisible({promise:e,resolve:t}){const s=g(`${this.event}DomReady`);this.promises.push(s);const n=await this.onPageLoad(s),i=new f;if(this.visibilityObservers.push(i),n){const e=d();i.watch(this.selector,t,e)}return e}onPageLoad({promise:e,resolve:t}){const s=()=>"complete"===document.readyState;if(!s()){const n=["readystatechange",()=>s()&&t(!0),{passive:!0}];return this.eventsListeners.push([document,...n]),document.addEventListener(...n),e}return t(!0),e}onClick({promise:e,resolve:t}){const s=document.createElement("style");s.type="text/css",s.id=`Click_${d()}`,s.innerHTML=`${this.selector} {\n\t\t\tcursor: pointer !important;\n\t\t\tpointer-events: all !important;\n\t\t}`,document.head.appendChild(s),this.elementsSelectors.push(`#${s.id}`);const n=["click",({isTrusted:e,target:s})=>{const n=s.isEqualNode(this.target)||v(s,this.selector);return e&&n&&t(!0)},{passive:!0,capture:!0}];return this.eventsListeners.push([document,...n]),document.addEventListener(...n),e}onHover({promise:e,resolve:t}){const s=["mouseenter",({isTrusted:e,target:s})=>{const n=this.target?s.isEqualNode(this.target):v(s,this.selector);return e&&n&&t(!0)},{passive:!0,capture:!0}];return this.eventsListeners.push([document.documentElement,...s]),document.documentElement.addEventListener(...s),e}onExitIntent({promise:e,resolve:t}){const s=["mouseleave",({isTrusted:e,clientY:s})=>{e&&s<=0&&t(!0)},{passive:!0}],{clear:n}=m("html",e=>{n(),this.eventsListeners.push([e,...s]),e.addEventListener(...s)});return e}onReengage({promise:e,resolve:t}){const s=this.delay;let n=s;const i=[({isTrusted:e})=>{e&&(n=s)},{passive:!0}];["click","mousemove","scroll","keypress"].forEach(e=>{this.eventsListeners.push([document,e,...i]),document.addEventListener(e,...i)});const r=setInterval(()=>{n<=0?t(!0):n-=100},100);return this.intervals.push(r),e}onCustomTrigger({promise:e,resolve:t}){const{triggerEventCustomScript:s}=DATA;return new Function(`return new Promise(async resolve => {${s}})`)().then(e=>e&&t(!0)),e}onScrollUp({promise:e,resolve:t}){let s=0;const n=["scroll",({isTrusted:e})=>{e&&(window.pageYOffset<s?t(!0):s=window.pageYOffset)},{passive:!0,capture:!0}];return this.eventsListeners.push([document,...n]),document.addEventListener(...n),e}onScrollPercentReached({promise:e,resolve:t}){const{triggerEventScrollPercent:s}=DATA,n=["scroll",({isTrusted:e})=>{if(!e)return;const n=(()=>{const{documentElement:e,body:t}=document,s=e.scrollTop||t.scrollTop,n=e.scrollHeight||t.scrollHeight;return Math.trunc(s/(n-e.clientHeight)*100,10)})();s<n&&t(!0)},{passive:!0,capture:!0}];return this.eventsListeners.push([document,...n]),document.addEventListener(...n),e}checkSocialProofConditions(e,t,s,n){const i=(()=>{let e;return window.ABTasty||window.ABTASTY_S?(window.ABTASTY_S&&window.ABTASTY_S.USER&&window.ABTASTY_S.USER.accountIdentifier&&window.ABTASTY_S.USER.accountIdentifier.length?e=window.ABTASTY_S.USER.accountIdentifier:window.ABTasty&&window.ABTasty.getAccountSettings&&"function"==typeof window.ABTasty.getAccountSettings?e=window.ABTasty.getAccountSettings().identifier:window.ABTasty&&window.ABTasty.accountSettings&&(e=window.ABTasty.accountSettings.identifier),e):e})(),{viewInterval:r,spNoTrim:o}=DATA;if(this.socialProofStore.hasOwnProperty(e))s(this.socialProofStore[e])?n(`${this.socialProofStore[e][r]}`):n(!1);else if(e&&i){const a=t=>(this.socialProofStore[e]=t,n(!!s(t)&&`${t[r]}`));fetch(`https://api-social-proof.abtasty.com/clients/${i}/metrics/${t}?key=${e}${o?"&noTrim=true":""}`).then(e=>e.ok&&e.json()).then(a).catch(()=>u("Failed to fetch datas from server."))}else n(!1)}getSocialProofDatas({promise:e,resolve:t},i,r=!1){const{productKey:o,keyType:a}=(()=>{const{socialProofContentType:e,productKeyProvider:t,pathToProductKey:i,customJSProductKey:r,productSKU:o}=DATA;if(2===e)return{productKey:n(),keyType:"url"};{let a=null,c="sku";switch(t){case"ABTastyProductKey":a=window.ABTastyProductKey;break;case"pathToProductKey":a=s(`return ${i};`);break;case"customJSProductKey":a=s(r);break;case"productSKU":a=o}return a||3!==e||(a=n(),c="url"),{productKey:a,keyType:c}}})(),{viewInterval:c,triggerSocialProofMinVisitors:l,triggerSocialProofMinPurchases:h,triggerSocialProofMinPageViews:d}=DATA,g={pv:d,i:h,"v-pv":l}[i];return[typeof c,typeof g].includes("undefined")&&t(!1),r&&!o&&(u("Not able to find ABTastyProductKey, impossible to call the API, read documentation for more informations:\n\t\t\t\thttps://support.abtasty.com/hc/en-us/articles/4710919241628-Widgets-List#h_84c04344-c655-4e5e-b9ab-d26a798ad9b0"),t(!1)),this.checkSocialProofConditions(o,"v-pv"===i&&"sku"===a?"v-i":i,e=>{const t=void 0!==e[c]&&e[c]>=g;return t||u(`Widget will not be shown, Social Proof API returned ${e[c]} while ${g} are required`),t},t),e}onConsent({promise:e,resolve:t}){if(!r()){const s=["abtasty_consentValid",()=>t(!0)];return this.eventsListeners.push(s),window.addEventListener(...s),e}return t(!0),e}onTrackingSent({promise:e,resolve:t}){const{triggerEventTrackingSent:s}=DATA;let n=localStorage.getItem("ABTastyData");const i=()=>JSON.parse(n).ActionTracking.find(({name:e})=>e===s),r=["storage",()=>{n=localStorage.getItem("ABTastyData"),i()&&t(!0)},{passive:!0,capture:!0}];return n&&i()?t(!0):(()=>{this.eventsListeners.push([window,...r]),window.addEventListener(...r)})(),e}onMinPagesViewed({promise:e,resolve:t}){const{triggerEventMinPagesViewed:s}=DATA;let n=localStorage.getItem("ABTastyData");const i=()=>s<=(n?JSON.parse(n).VisitedPages.length:0),r=["storage",()=>{n=localStorage.getItem("ABTastyData"),i()&&t(!0)},{passive:!0,capture:!0}];return n&&i()?t(!0):(()=>{this.eventsListeners.push([window,...r]),window.addEventListener(...r)})(),e}onRageClick({promise:e,resolve:t}){const{triggerEventRageClickQuantity:s,triggerEventRageClickDelay:n}=DATA;let i=0,r=!1;const o=["click",({isTrusted:e})=>{if(e&&(i+=1,i>=s&&t(!0),!r)){r=!0;const e=setTimeout(()=>{i=0,r=!1},n);this.timeouts.push(e)}},{passive:!0,capture:!0}];return this.eventsListeners.push([document,...o]),document.addEventListener(...o),e}clear(){if(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,...s]=e;t&&s.length>1&&t.removeEventListener(...s)}),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.visibilityObservers.length){const e=d();this.visibilityObservers.forEach(t=>t.clear(this.selector,e)),this.visibilityObservers=[]}return this.promises.length&&(this.promises.forEach(e=>e.resolve(!1)),this.promises=[]),this}async isTriggered(){this.clear();const e=g(this.event);this.promises.push(e);const t={consent:()=>this.onConsent(e),direct:()=>!0,pageLoad:()=>this.onPageLoad(e),click:()=>this.onClick(e),exitIntent:()=>this.onExitIntent(e),reengage:()=>this.onReengage(e),elementVisible:()=>this.onElementVisible(e),script:()=>this.onCustomTrigger(e),hover:()=>this.onHover(e),scrollUp:()=>this.onScrollUp(e),scrollPercent:()=>this.onScrollPercentReached(e),rageClick:()=>this.onRageClick(e),minPagesViewed:()=>this.onMinPagesViewed(e),trackingSent:()=>this.onTrackingSent(e),socialProofPurchases:()=>this.getSocialProofDatas(e,"i",!0),socialProofPageViews:()=>this.getSocialProofDatas(e,"pv"),socialProofVisitors:()=>this.getSocialProofDatas(e,"v-pv")},s=!Object.prototype.hasOwnProperty.call(t,this.event)||await t[this.event]();return s&&this.clear(),"reengage"!==this.event&&this.delay?s&&await(async()=>{const e=g(`${this.event}Delay`);this.promises.push(e);const t=setTimeout(()=>{e.resolve(!0),this.clear()},this.delay);return this.timeouts.push(t),e.promise})():s}}const w="display",S="closing",$="validation",T="ABTastyWidgets",C=`${T}Temporary`;class E{constructor({displayRecurrence:e,closingRecurrence:t,validationRecurrence:s},n){this.displayRecurrence=parseFloat(e),this.closingRecurrence=parseFloat(t),this.validationRecurrence=parseFloat(s),this.onSetCallback=n,this.widgetName=l(),this.uniqueId=d(),this.recurrenceKey=`${this.widgetName}_${this.uniqueId}`,this.isListeningStorageEvent=this.listenStorageEvent(),this.pendingRecurrence=!1,this.pendingRecurrenceValue={}}onStorage({key:e}){const t=localStorage.getItem(C),s=sessionStorage.getItem(T);"ABTastyData"===e&&!t&&s&&localStorage.setItem(C,s)}listenStorageEvent(){return this.isListeningStorageEvent||window.addEventListener("storage",this.onStorage.bind(this)),!0}getGivenRecurrenceStorageParsed(e){try{const t=e.getItem(T);return JSON.parse(t)}catch(t){return e.removeItem(T),!1}}getSessionRecurrenceStorageParsed(){return this.getGivenRecurrenceStorageParsed(window.sessionStorage)}getLocalRecurrenceStorageParsed(){return this.getGivenRecurrenceStorageParsed(window.localStorage)}removeGivenStorage(e,t){const{[this.recurrenceKey]:s,...n}=t;return Object.entries(n).length?(e.setItem(T,JSON.stringify(n)),n):(e.removeItem(T),!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(){if(this.pendingRecurrence)return this.pendingRecurrenceValue;const e=this.getSessionRecurrence(),t=this.getLocalRecurrence();return e||t||{type:!1}}isOver(){const e=localStorage.getItem(C),t=!(!e||!e.includes(this.recurrenceKey))||this.getSessionRecurrence();e&&(sessionStorage.setItem(T,e),localStorage.removeItem(C));const s=this.getLocalRecurrence(),n=(s?parseFloat(s.stamp):0)<(new Date).getTime();return n&&this.removeLocalRecurrenceStorage(),!this.pendingRecurrence&&n&&!this.getLocalRecurrence()&&!t}setRecurrence(e,s){0!==e&&(window.removeEventListener("storage",this.onStorage.bind(this)),this.isListeningStorageEvent=!1);const n=this.getTypeOfStorage(e);if(t()||!n&&"object"!=typeof n)return!1;const{storageString:i,storageMethod:o}=n,a=this.getStamp(e),c={type:s,stamp:a},{type:l}=this.getCurrentRecurrence(),h=async()=>{if(!r()){this.pendingRecurrence=!0,this.pendingRecurrenceValue=c;const e=new y({triggerEvent:"consent"});await e.isTriggered(),this.pendingRecurrence=!1,this.pendingRecurrenceValue={}}const e=this.getSessionRecurrence(),t=this.getLocalRecurrence();let s;"session"===i?e?s=this.removeSessionRecurrenceStorage():(this.removeLocalRecurrenceStorage(),s=this.getSessionRecurrenceStorageParsed()):"local"===i&&(t?s=this.removeLocalRecurrenceStorage():(this.removeSessionRecurrenceStorage(),s=this.getLocalRecurrenceStorageParsed()));const n=s?{[this.recurrenceKey]:c,...s}:{[this.recurrenceKey]:c};o.setItem(T,JSON.stringify(n)),this.onSetCallback&&"function"==typeof this.onSetCallback&&this.onSetCallback()};if(!o)return!1;if(l&&s!==$)if(s===S&&l!==$)h();else{if(s!==w||l===$||l===S)return!1;h()}else h();return a}setDisplayRecurrence(){const e=w;this.setRecurrence(this.displayRecurrence,e)}setClosingRecurrence(){const e=S;this.setRecurrence(this.closingRecurrence,e)}setValidationRecurrence(){const e=$;this.setRecurrence(this.validationRecurrence,e)}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 A{constructor(e,t,s){this.isWidgetApplied=e,this.callback=t,this.shouldUpdate=s,this.observer=new MutationObserver(this.observerHandler.bind(this)),this.tagRollbackEventParams=["abtasty_resetActionTracking",this.onTagRollback.bind(this)],this.onCampaignLaunchedEventParams=["abtasty_executedCampaign",this.onCampaignLaunched.bind(this)]}decisionHandler(){const e=this.isWidgetApplied()?this.shouldUpdate&&c:a;return e?(this.clearWatcher(),this.callback(e,!0),this.watch(),this):this}onCampaignLaunched({detail:{campaignId:e}}){e===TEST_ID&&(this.callback(a,!1),this.watch())}onTagRollback(){return this.clearWatcher(),this.callback(o,!1),window.addEventListener(...this.onCampaignLaunchedEventParams),this}observerHandler(e){return i()?e.some(e=>["removedNodes","addedNodes"].some(t=>e[t]&&e[t].length))?this.decisionHandler():this:this.callback(o,!1)}watch(){if(e())return this;this.clearWatcher(),window.removeEventListener(...this.onCampaignLaunchedEventParams),document.addEventListener(...this.tagRollbackEventParams);const{clear:t}=m("body",e=>{t(),this.observer.observe(e,{childList:!0,subtree:!0})});return this}clearWatcher(){return document.removeEventListener(...this.tagRollbackEventParams),this.observer.disconnect(),this}}const x=/.+\/([^.]+)\.(otf|ttf)$/,P=["socialProofPurchases","socialProofPageViews","socialProofVisitors"];class k{constructor(t,s){this.children=void 0,this.uniqueId=`${d()}${s?`_${s}`:""}`,this.widgetName=l(),this.prettyName=h(),this.recurrenceParams=(()=>{const{displayRecurrence:t,closingRecurrence:s,validationRecurrence:n}=DATA,i=!t&&!s&&!n;if(e()||i)return!1;const r={everytime:()=>-1,session:()=>0,once:()=>395,day:e=>DATA[`${e}_day`],week:e=>7*DATA[`${e}_week`],month:e=>30.5*DATA[`${e}_month`]},o={};return t&&(o.displayRecurrence=r[t]("displayRecurrence")),s&&(o.closingRecurrence=r[s]("closingRecurrence")),n&&(o.validationRecurrence=r[n]("validationRecurrence")),o})(),this.triggerParams=(t=>{let{triggerEvent:s}=DATA;const{triggerEventClick:n,triggerEventHover:i,triggerEventReengageDelay:r,socialProofContentType:o,triggerEventElementVisible:a,triggerEventDelay:c}=DATA;if(e()||!s&&!o)return!1;const l={click:()=>n,hover:()=>i,elementVisible:()=>a},h=Object.prototype.hasOwnProperty.call(l,s)?l[s]():"body",d="reengage"===s?r:c;return o&&(s=[,"socialProofPurchases","socialProofPageViews","socialProofVisitors"][o]),{triggerEvent:s,triggerSelector:h,triggerDelay:d,triggerTarget:t}})(t),this.recurrence=!!this.recurrenceParams&&new E(this.recurrenceParams,this.clearGivenClearables.bind(this)),this.trigger=!!this.triggerParams&&new y(this.triggerParams),this.shouldUpdate=!!this.triggerParams&&P.includes(this.triggerParams.triggerEvent),this.pageWatcher=new A(this.isWidgetApplied.bind(this),this.onPageChange.bind(this),this.shouldUpdate),this.hasOncePerPageTrigger=(()=>{const{isOncePerPageTrigger:e,triggerEvent:t}=DATA;return!t||!["click","hover","scrollUp","script"].includes(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.forEach(e=>document.removeEventListener(...e)),this.eventsListeners=[],this.timeouts.forEach(e=>clearTimeout(e)),this.timeouts=[],this.intervals.forEach(e=>clearInterval(e)),this.intervals=[],this.elementsWaiters.forEach(e=>e.clear()),this.elementsWaiters=[]}isWidgetApplied(){return this.domElement&&this.domElement.isConnected}removeOldDomElement(){const e=document.getElementById(this.widgetContainerId);return e&&e.remove(),this}async insert(){if(this.isWidgetApplied())return!1;document.head.appendChild(this.styleElement);const e=["free"];return"drawer"===DATA.layout&&DATA.customTarget&&e.push("drawer"),new Promise(t=>{const{elementReferrer:s="body",referrerInsertType:n="beforeend"}=e.includes(DATA.layout)?DATA:{},i=m(s,e=>{this.elementsWaiters=this.elementsWaiters.filter(e=>e.selector!==s),this.removeOldDomElement(),t(e.insertAdjacentElement(n,this.domElement))});this.elementsWaiters.push(i)}).then(()=>this)}remove(){return this.trigger&&this.trigger.clear(),this.pageWatcher.clearWatcher(),[this.domElement,this.styleElement].forEach(e=>e&&e.isConnected&&e.remove()),this.hasOncePerPageTrigger?this.pageWatcher.watch():e()||this.init().then(({response:e})=>e?this.show():this),this}show(){return e()||this.hasBeenShown&&this.hasOncePerPageTrigger||window.ABTastyEvent(`${this.prettyName} displayed`,null,TEST_ID),this.closedByUser=!1,setTimeout(()=>this.domElement.classList.remove(this.hideClassName),50),this.recurrence&&this.recurrence.setDisplayRecurrence(),this.hasBeenShown=!0,this.pageWatcher.watch(),this}hide(t=!0){return!e()&&this.hasBeenShown&&t&&window.ABTastyEvent(`${this.prettyName} closed`,null,TEST_ID),t&&(this.pageWatcher.clearWatcher(),this.closedByUser=!0),this.domElement.classList.add(this.hideClassName),this}async init(t){const s=e(),n=i(),r=this.trigger&&this.trigger.promises.length,o=!this.recurrence||this.recurrence.isOver();if(!s&&!n||r||!o)return{container:this,response:!1};this.pageWatcher.watch();const a=s||!this.trigger||this.trigger&&await this.trigger.isTriggered(),c={container:this,response:a};return a?(await this.insert(),this.addCloseEvent(),s||t||this.hasBeenShown||void 0===this.children||"function"!=typeof this.children.refreshContent||this.children.refreshContent(a),c):c}onPageChange(e,t){const s=()=>this.init().then(({response:e})=>{e?this.show():this.hide(!1)});t||(this.hasBeenShown=!1,this.trigger&&this.trigger.clear());const n=this.isWidgetApplied(),i={[o]:()=>n?this.remove():this.pageWatcher.watch(),[a]:()=>{this.hasBeenShown?this.closedByUser?this.pageWatcher.watch():n||this.insert().then(e=>e.show()).catch(this.pageWatcher.watch):s()},[c]:s};"function"==typeof i[e]&&i[e]()}addCloseEvent(...t){const{closeButton:s,overlay:n,overlayClickable:i,layout:r,animationDuration:o=1e3}=DATA,a=[];if(void 0!==n&&!0!==n||!0!==i||"popin"!==r||a.push(`.${this.overlayClassName}`),void 0!==s&&s&&a.push(`.${this.closeButtonClassName}`),!a.length)return this;const c=this.domElement.querySelectorAll(a.join(", "));if(!c.length)return this;const l=["click",t=>{(t=>{e()||(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation())})(t),this.recurrence&&this.recurrence.setClosingRecurrence(),this.hide(!0),setTimeout(()=>this.remove(),1.05*o)},{once:!0,capture:!0}];return t.push(...c),t.forEach(t=>{e()&&(t.dataset.abtastyActionnable="true"),t.removeEventListener(...l),t.addEventListener(...l)}),this}getDom(){const{closeButton:e,layout:t,overlay:s=!0}=DATA,n=document.createElement("div");return n.className=`${this.basicClassName} ${this.hideClassName}`,n.id=this.widgetContainerId,["popin","banner"].includes(t)&&(n.role="dialog"),n.innerHTML=`\n\t\t\t${"popin"===t&&!0===s?`<div class="${this.overlayClassName}"></div>`:""}\n\t\t\t<div class="${this.contentClassName}">\n\t\t\t${e?`<button class="${this.closeButtonClassName}" aria-label="Close dialog"><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(e,t){if(!e||"inherit"===e||!/otf|ttf/g.test(t))return;const s=document.createElement("style"),n=t.match(x)?t.match(x)[1]:"";s.innerHTML=`@font-face { font-family: '${e}_${n}'; src: url('${t}'); font-display: swap; }`,document.head.appendChild(s)}getStyleTag(t="",s=DATA){const{noStyles:n,layout:i}=s,{backgroundColor:r,isBackgroundImage:o,backgroundImage:a,backgroundSize:c,backgroundPosition:l,backgroundRepeat:h,borderColor:d,borderRadius:u,borderWidth:g,textColor:m,textAlign:p,fontName:v,fontStyle:b,fontSize:f,isTitle:y,titleTextAlign:w,titleTextColor:S,titleFontName:$,titleFontStyle:T,titleFontSize:C,overlay:E,overlayColor:A,dropShadow:P,dropShadowColor:k,dropShadowBlur:N,containerMargin:L,containerPadding:I,closeButton:R,closeButtonPosition:B,closeButtonSize:D,closeButtonBorderRadius:O,closeButtonBorderWidth:_,closeButtonBorderColor:j,closeButtonColor:V,closeButtonBackgroundColor:W,buttonsAlign:q,buttonsBorderWidth:F,buttonsBorderColor:M,buttonsBorderRadius:z,buttonsBackgroundColor:H,buttonsTextColor:U,buttonsFontName:K,buttonsFontStyle:G,buttonsFontSize:Y,secondLink:J,secondLinkBorderWidth:Q,secondLinkBorderColor:X,secondLinkBorderRadius:Z,secondLinkBackgroundColor:ee,secondLinkTextColor:te,secondLinkFontName:se,secondLinkFontStyle:ne,secondLinkFontSize:ie,animation:re,animationDuration:oe,animationBehaviour:ae,animationSlideDirection:ce}=n?{}:s,le=document.createElement("style");le.type="text/css",e()&&le.setAttribute("abtasty-script-added","true"),this.loadFont(v,b),this.loadFont($,T),this.loadFont(K,G),this.loadFont(se,ne);const he=`background: ${["string"==typeof r?r:"rgba(255, 255, 255, 1)",o&&"string"==typeof a&&a.length?`url(${a})`:"",o&&"string"==typeof l&&"100% 100%"!==c?l:"0 0",o&&"string"==typeof c?`/ ${c}`:"/ auto",o&&h&&!["cover","100% 100%"].includes(c)?"repeat":"no-repeat"].join(" ").trim()};`,de="number"==typeof g&&g>0,ue=`border: ${[de?`${g}px`:"unset",de?"solid":"",de&&"string"==typeof d&&d.length?d:""].join(" ").trim()};`,ge=void 0!==u?`border-radius: ${u}px;`:"",me=void 0!==m?`color: ${m}; fill: ${m}; -webkit-text-fill-color: ${m};`:"",pe=void 0!==p?`text-align: ${p};`:"",ve=v&&"inherit"!==v?`font-family:${v}_${b.match(x)?b.match(x)[1]:""};`:b||"",be=f?`font-size: ${f}px;`:"",fe=void 0!==P&&P?`box-shadow: 0 5px ${N}px 0 ${k};`:"",ye=L instanceof Array&&1===L.length&&L[0],we=ye?`margin: ${ye.top}px ${ye.right}px ${ye.bottom}px ${ye.left}px;`:"",Se=ye?`margin: calc(${ye.top}px * 0.5) calc(${ye.right}px * 0.5) calc(${ye.bottom}px * 0.5) calc(${ye.left}px * 0.5);`:"",$e=I instanceof Array&&1===I.length&&I[0],Te=$e?`padding: ${$e.top}px ${$e.right}px ${$e.bottom}px ${$e.left}px;`:"",Ce=$e?`padding: calc(${$e.top}px * 0.5) calc(${$e.right}px * 0.5) calc(${$e.bottom}px * 0.5) calc(${$e.left}px * 0.5);`:"",Ee=void 0!==F&&F?`border-width: ${F}px; border-style: solid;`:"",Ae=[M,F].every(e=>void 0!==e)&&F?`border-color: ${M};`:"",xe=void 0!==z?`border-radius: ${z}px;`:"",Pe=void 0!==H?`background-color: ${H};`:"",ke=void 0!==U?`color: ${U}; fill: ${U}; -webkit-text-fill-color: ${U};`:"",Ne=K&&"inherit"!==K?`font-family:${K}_${G.match(x)?G.match(x)[1]:""};`:G||"",Le=Y?`font-size: ${Y}px;`:"",Ie="number"==typeof Q?`border-width: ${Q}px; border-style: solid;`:"",Re=[X,Q].every(e=>void 0!==e)&&Q?`border-color: ${X};`:"",Be=void 0!==Z?`border-radius: ${Z}px;`:"",De=void 0!==ee?`background-color: ${ee};`:"",Oe=void 0!==te?`color: ${te}; fill: ${te}; -webkit-text-fill-color: ${te};`:"",_e=se&&"inherit"!==se?`font-family:${se}_${ne.match(x)?ne.match(x)[1]:""};`:ne||"",je=ie?`font-size: ${ie}px;`:"",Ve="popin"!==i||void 0!==E&&!0!==E?"":[`#${this.widgetContainerId} .${this.overlayClassName} {`,`background-color: ${void 0!==A?A:"rgba(0, 0, 0, 0.6)"};`,"}"].join(""),We="number"==typeof D?D:16,qe=We/2,Fe=n||void 0!==R&&R?[`#${this.widgetContainerId} .${this.contentClassName} .${this.closeButtonClassName} {`,"position: absolute;",("out"===B?`bottom: calc(100% + ${qe}px)`:`top: ${qe}px`)+";",`right: ${qe}px;`,"width: auto;","height: auto;","background: none;","border: none;","cursor: pointer;","padding: 0;","margin: 0;","line-height: 0;","z-index: 9;","number"==typeof O?`border-radius: ${O}px;`:"","number"==typeof _&&_>0?`border: ${_}px solid ${void 0!==j?j:"rgba(57, 57, 57, 1)"};`:"","string"==typeof W?`background-color: ${W};`:"","}",`#${this.widgetContainerId} .${this.contentClassName} .${this.closeButtonClassName} svg {`,"pointer-events: none;",`width: ${We}px;`,`height: ${We}px;`,"string"==typeof V?`fill: ${V};`:"","}"].join(""):"",Me=y&&"string"==typeof S?[`#${this.widgetContainerId} .${this.contentClassName} > * h1, `,`#${this.widgetContainerId} .${this.contentClassName} > * h2, `,`#${this.widgetContainerId} .${this.contentClassName} > * h3, `,`#${this.widgetContainerId} .${this.contentClassName} > * h4, `,`#${this.widgetContainerId} .${this.contentClassName} > * h5, `,`#${this.widgetContainerId} .${this.contentClassName} > * h6 {`,`color: ${S}; fill: ${S}; -webkit-text-fill-color: ${S};`,void 0!==w?`text-align: ${w};`:"",$&&"inherit"!==$?`font-family:${$}_${T.match(x)?T.match(x)[1]:""};`:T||"",C?`font-size: ${C}px;`:"","}"].join(""):"";let ze="";if("string"==typeof re){const t=(oe/1e3).toFixed(2),s=["top","bottom"].includes(ce),n=Number(s),i=[(["top","left"].includes(ce)?"-":"")+"100vmax",this.translateValues?this.translateValues[n]:"0"];s&&i.reverse(),ze={none:[`.${this.hideClassName} {`,"opacity: 0 !important;","}"],fade:[`.${this.hideClassName} {`,"opacity: 0 !important;","}",`#${this.widgetContainerId} {`,`transition: opacity ${t}s ${ae};`,"}"],slide:[`.${this.hideClassName} .${this.overlayClassName} {`,"opacity: 0 !important;","}",`#${this.widgetContainerId} .${this.overlayClassName} {`,`transition: opacity ${t}s ${ae};`,"}",`.${this.hideClassName} .${this.contentClassName} {`,`transform: translate(${i.join(", ")}) !important;`,"}",`#${this.widgetContainerId} .${this.contentClassName} {`,`transition: transform ${t}s ${ae};`,"}"]}[e()&&!ABTASTY_S.WIDGETS.animationChanged?"none":re].join("")}const He=[`#${this.widgetContainerId} .${this.contentClassName} .buttons_container .second_link {`,`margin-${"fill"===q?"top":"left"}: 8px;`,Ie,Re,Be,De,Oe,_e,je,"}",`#${this.widgetContainerId} .${this.contentClassName} .buttons_container .second_link {`,Oe,_e,je,"}"];return le.textContent=[`.${this.hideClassName} {`,"pointer-events: none;","}",`#${this.widgetContainerId} {`,"opacity: 1;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,he,ge,ue,me,pe,fe,we,ve,be,"}",`#${this.widgetContainerId} .${this.contentClassName} p {`,me,pe,ve,be,"}",`#${this.widgetContainerId} .${this.contentClassName} > * {`,"display: block;","line-height: 1;","text-indent: unset;",Te,ve,be,"}",`#${this.widgetContainerId} .${this.contentClassName} a {`,"text-decoration: underline;","}",`#${this.widgetContainerId} .${this.contentClassName} div.buttons_container a, `,`#${this.widgetContainerId} .${this.contentClassName} button {`,"text-decoration: none;","box-sizing: border-box;","display: inline-block;",Ee,Ae,xe,Pe,ke,Ne,Le,"}",`#${this.widgetContainerId} .${this.contentClassName} div.buttons_container a *, `,`#${this.widgetContainerId} .${this.contentClassName} button:not(class*="close_button") * {`,ke,Ne,Le,"}",...J?He:[],"@media screen and (max-width: 579px) {",`#${this.widgetContainerId} .${this.contentClassName} {`,Se,"}",`#${this.widgetContainerId} .${this.contentClassName} > * {`,Ce,"}","}",Ve,Fe,Me,ze,`${t}`].join(""),le}}class N extends k{constructor(){super(),this.position="string"==typeof DATA.layout&&"bannerTop"===DATA.layout?"top":"bottom",this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){const{zindex:e,zindexCustom:t}=DATA;return[`#${this.widgetContainerId} {`,"position: fixed;",`${this.position}: 0;`,"left: 0;","width: 100%;","height: auto;",`z-index: ${"custom"===e?t:e};`,"background: none;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: relative;","}"].join("")}}class L extends k{constructor(e,t){super(e,t),this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){return[`#${this.widgetContainerId} {`,"width: auto;","height: auto;","margin: 0;","padding: 0;","background: none;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: relative;","}"].join("")}}function I(e){return I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},I(e)}function R(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),s.push.apply(s,n)}return s}function B(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{};t%2?R(Object(s),!0).forEach(function(t){D(e,t,s[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):R(Object(s)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))})}return e}function D(e,t,s){return(t=O(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}function O(e){var t=function(e){if("object"!=I(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var s=t.call(e,"string");if("object"!=I(s))return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==I(t)?t:t+""}var _=function(){return t=function e(t){var s=t.parentContainer;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.parentContainer=s,this.baseClassName="spotlight_container",this.className="".concat(this.baseClassName,"_").concat(s.uniqueId),this.contentElement=this.getContentElement()},s=[{key:"insertIn",value:function(t,s){return this.setStyles(),t.insertAdjacentElement(s,this.contentElement),e()||(setTimeout(this.setHorizontalScroll.bind(this),500),window.addEventListener("resize",this.setHorizontalScroll.bind(this))),this}},{key:"remove",value:function(){var e=this,t=DATA.animationDuration;setTimeout(function(){return e.parentContainer.remove()},1.05*(void 0===t?1e3:t))}},{key:"onRedirect",value:function(e){window.ABTastyEvent(e,null,TEST_ID),u('Tracking "'.concat(e,'" sent to campaign ').concat(TEST_ID)),this.parentContainer.recurrence.setValidationRecurrence()}},{key:"setHorizontalScroll",value:function(){var e=this,t=ABTasty.getParsedUserAgent().type,s=this.contentElement,n=s.scrollWidth,i=s.clientWidth,r=!1,o=!1,a=0,c=0,l=function(){return s.classList.remove("".concat(e.baseClassName,"_draggable_active"))},h=function(){o?setTimeout(l,50):l(),r=!1,o=!1},d=function(e){r=!0,a=e.pageX-s.offsetLeft,c=s.scrollLeft,s.addEventListener("mouseup",h,{capture:!0,once:!0,passive:!0})},u=function(t){if(r){t.preventDefault(),s.classList.add("".concat(e.baseClassName,"_draggable_active")),o=!0;var n=t.pageX-s.offsetLeft-a;s.scrollLeft=c-n}};"Desktop"===t&&n>i?(s.classList.add("".concat(this.baseClassName,"_draggable")),s.addEventListener("mousedown",d,{capture:!0,passive:!0}),s.addEventListener("mousemove",u,{capture:!0,passive:!1})):(s.classList.remove("".concat(this.baseClassName,"_draggable")),s.removeEventListener("mousedown",d,{capture:!0,passive:!0}),s.removeEventListener("mousemove",u,{capture:!0,passive:!1}))}},{key:"getContentElement",value:function(){var t=this,s=DATA.spotlightContent,n=document.createElement("div");return n.className="".concat(this.className," buttons_container"),1===s.length&&e()&&(s.length=4,s.fill(B(B({},s[0]),{},{text:"Example",fake:!0}),1)),s.forEach(function(s,i){var r=s.text,o=s.link,a=s.fake,c=s.tracking,l=document.createElement("figure");a&&(l.className="spotlightExample"),l.innerHTML="<a href='".concat(o,"' aria-label=\"").concat(r,'"></a><legend>').concat(r,"</legend>");var h=c.replace(/!name!/gm,r).replace(/!number!/gm,i+1);e()||l.querySelector("a").addEventListener("click",function(){return t.onRedirect(h)},{capture:!0}),n.appendChild(l)}),n}},{key:"setStyles",value:function(){var e=this,t=this.parentContainer,s=t.styleElement,n=t.widgetContainerId,i=DATA,r=i.buttonsBorderRadius,o=i.buttonsTextColor,a=i.buttonsFontName,c=i.buttonsFontStyle,l=i.buttonsFontSize,h=i.insideBorderWidth,d=i.insideBorderColor,u=i.buttonsAlign,g=i.spotlightContent,m=i.buttonsSize,p=i.buttonsSpace,v=i.scrollSnapBehaviour,b=i.scrollBarDisplay,f=i.textAlign,y=i.textWrap,w=/.+\/([^.]+)\.(otf|ttf)$/,S=void 0!==o?"color: ".concat(o,"; fill: ").concat(o,"; -webkit-text-fill-color: ").concat(o,";"):"",$=a&&"inherit"!==a?"font-family:".concat(a,"_").concat(c.match(w)?c.match(w)[1]:"",";"):c||"",T=["#".concat(n," .").concat(this.className," {"),"display: flex;","flex-direction: row;","flex-wrap: nowrap;","justify-content: ".concat(u,";"),"align-items: flex-start;","overflow-x: auto;","overscroll-behavior-x: contain;",v?"scroll-snap-type: x mandatory;":"",b?"scrollbar-width: none;":"","overflow-y: hidden;","}",b?["#".concat(n," .").concat(this.className,"::-webkit-scrollbar {"),"display: none;","}"].join(""):"",".".concat(this.baseClassName,"_draggable {"),"cursor: grab;","}","#".concat(n," .").concat(this.baseClassName,"_draggable_active {"),"cursor: grabbing;","}","#".concat(n," .").concat(this.baseClassName,"_draggable_active * {"),"pointer-events: none;","}",".".concat(this.className," .spotlightExample {"),"opacity: 0.5;","}",".".concat(this.className," figure {"),"font-size: 0;","text-align: center;","margin: 0 ".concat(p,"vw;"),"width: ".concat(m,"vh;"),"min-width: ".concat(m,"vh;"),"scroll-snap-align: start;","scroll-margin-left: ".concat(p,"vw;"),"}",".".concat(this.className," figure a {"),"line-height: 0;","width: 100%;","background-size: cover;","background-position: center;","background-repeat: no-repeat;","border-radius: ".concat(r,"% !important;"),"position: relative;","}",".".concat(this.className," figure legend {"),"display: inline-block;","margin-top: ".concat(10,"px;"),"white-space: ".concat(y?"pre-wrap":"nowrap",";"),"overflow: hidden;","text-overflow: ellipsis;","line-height: 1.5;","font-size: ".concat(l,"px;"),"text-align: ".concat(f,";"),S,$,"}",g.map(function(t,s){var n=t.image;return[".".concat(e.className," figure:nth-of-type(").concat(s+1,") a {"),'background-image: url("'.concat("widget_common_defaultImgUrl"===n?"https://widgets-images.abtasty.com/widgets-default-image.png":n,'");'),"}"].join("")}).join(""),".".concat(this.className," figure a::before {"),'content: "";',"display: block;","border-radius: ".concat(r,"% !important;"),"padding-bottom: calc(100% - ".concat(2*h,"px);"),h>0?"border: ".concat(h,"px solid ").concat(d,";"):"","}",".".concat(this.className," figure a::after {"),'content: "";',"display: block;","position: absolute;","top: calc(100% + ".concat(r,"px);"),"left: -".concat(r,"px;"),"z-index: 1;","width: calc(100% + ".concat(2*r,"px);"),"height: ".concat(1.1*(10+l),"px;"),"}"].join("");return s.insertAdjacentText("beforeend",T),s}}],s&&function(e,t){for(var s=0;s<t.length;s++){var n=t[s];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,O(n.key),n)}}(t.prototype,s),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,s}();!function(){u("Widget launch");var e=DATA.layout.includes("banner")?new N:new L,t=e.domElement.querySelector(".".concat(e.contentClassName)),s=new _({parentContainer:e});e.children=s,s.insertIn(t,"beforeend"),e.init(!0).then(function(t){t.response&&e.show()})}()}();
|
1
|
+
!function(){"use strict";const e=()=>Object.prototype.hasOwnProperty.call(top,"ABTastyEditor"),t=()=>{const e=!!document.getElementById("ABTastyPreviewBar"),t=location.href.includes("ab_project=preview");return e||t},s=e=>new Function(`try {\n\t\t${e}\n\t} catch (error) {\n\t\treturn null;\n\t}`)(),n=()=>encodeURIComponent(DATA.spNoTrim?window.location.href.replace(window.location.origin,""):`${window.location.pathname}`),i=()=>!e()&&(t()||!!window.ABTasty.getTestsOnPage()[TEST_ID]),r=()=>window.ABTasty&&!0===window.ABTasty.consentReady,o=()=>{const{type:e}=DATA;return`${PACKAGE.replace("@abtasty/","")}${e?`_${e}`:""}`},a=()=>{const e=o();return`${e.charAt(0).toUpperCase()}${e.slice(1)}`.split("-").join(" ")},c=()=>`${PLUGIN_ID.split("-")[0]}_${TEST_ID}`,l=s=>{const n=(()=>{if(e()||t())return!1;const s=ABTasty.getTestsOnPage()[TEST_ID];return!!s&&Object.keys(s.targetings.qaParameters).length>0})(),i=window.document.cookie.includes("abTastyDebug=")||!0===window.abTastyDebug;if(n||i){const e=a();window.console.log(`%c${e} - ${n?"QA":"Debug"} Mode for campaign ${TEST_ID} %c ${s}`,"background-color: #D6FF01; color: #3100be; padding: 3px 0 3px 10px; border-radius: 5px 0 0 5px; font-weight: bold;","background-color: #3100be; color: white; padding: 3px 10px 3px 0; border-radius: 0 5px 5px 0;")}},h=e=>{const t={promise:null,resolve:null,reject:null,name:e};return t.promise=new Promise((e,s)=>{t.resolve=e,t.reject=s}),t},d=(e,t)=>{const s=t?[]:null;if("string"!=typeof e||!e.trim().length)return s;const[n,i,r]=e.split("[]").map(e=>e.trim()),o=Boolean(r)?r:e,a=i?document.querySelector(n)?.[i]:document;return a?t?[...a.querySelectorAll(o)]:a.querySelector(o):s},u=e=>d(e,!1),g=e=>d(e,!0),m=(e,t)=>{const s=document.querySelector("body")||document.documentElement,n={childList:!0,subtree:!0,attributes:!0},i=()=>r.disconnect(),r=new MutationObserver(()=>{const s=u(t);return s&&!i()&&e(s)});return{clear:i,observe:(e=s)=>r.observe(e,n)}},p=()=>{},v=(t,s)=>{const n=u(t),i={selector:t,clear:p,observe:p};if(n)return setTimeout(()=>s(n),0),i;if(e())return setTimeout(()=>v(t,s),1e3),i;if(t.includes("[]"))return((e,t)=>{const[s,n]=t.split("[]").map(e=>e.trim()),i=u(s),r=i?.[n],{clear:o,observe:a}=m(e,t),c=()=>{const s=u(t);return s&&!l()&&e(s)},l=()=>{o(),i?.removeEventListener("load",c)},h=()=>{a(r),"iframe"===i?.localName&&i.addEventListener("load",c)};return h(),{selector:t,clear:l,observe:h}})(s,t);const{clear:r,observe:o}=m(s,t);return o(),{selector:t,clear:r,observe:o}};function f(e,t){const s=e.parentElement||e.getRootNode().host;return t(e)||!s?e:f(s,t)}const b=(e,t)=>[...g(t)].some(s=>{const[n,,i]=t.split("[]"),r=i??n;return s===e||!!e.closest(r)});let y=!1;class w{constructor(){this.targets=[],this.existingTargets=[],this.inViewportTargets=[],this.visibilityObserver=null,this.mutationObserver=null,this.mouseOverEvent=null,this.scrollEvent=null,this.onTransitionEnd=null,this.onIframeLoad=null}transitionOverHandler(e){const t=[e,"transitionend",this.checkElements.bind(this),!0];return this.getEvents(...t)}intersectionHandler(e){e.forEach(e=>{e.isIntersecting?(this.existingTargets.forEach(t=>{t.element.isSameNode(e.target)&&(this.inViewportTargets.push(t),this.mouseOverEvent.start(),this.scrollEvent.start(),this.onTransitionEnd.start())}),this.checkElements()):this.inViewportTargets=this.inViewportTargets.filter(t=>!t.element.isSameNode(e.target)||(this.mouseOverEvent.clear(),this.scrollEvent.clear(),this.onTransitionEnd.clear(),!1))})}startVisibilityObserver(e){const t={root:e,rootMargin:"0px",threshold:0};return this.visibilityObserver??=new IntersectionObserver(this.intersectionHandler.bind(this),t),this.visibilityObserver}startMutationObserver(e){return this.mutationObserver??=new MutationObserver(this.checkElements.bind(this)),this.mutationObserver.observe(e,{attributes:!0,childList:!0,subtree:!0}),this.mutationObserver}onMouseOver({target:e,path:t}){const s=this.inViewportTargets.find(({element:s,selector:n})=>{if(s.isSameNode(e))return!0;const[i,,r]=n.split("[]"),o=r??i,a=[...e.querySelectorAll(o)];if(a.length&&a.includes(s))return!0;if(t.includes(s))return!0;if(!e.parentElement?.children?.length)return;const c=[...e.parentElement.children],l=c.findIndex(t=>t.isSameNode(e)),h=c.filter((e,t)=>t>l);if(h.length){if(h.includes(s))return!0;if(h.some(e=>[...e.querySelectorAll(o)].includes(s)))return!0}return!1});if(s&&this.isElementVisible(s.element)){const{selector:e,element:t,uniqueId:n}=s,i=this.targets.find(t=>t.selector===e&&t.uniqueId===n);i&&i.resolve(t),this.clear(e,n)}}getEvents(e,...t){return{start:()=>e?.addEventListener(...t),clear:()=>e?.removeEventListener(...t)}}mouseOverHandler(e){const t=[e,"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0?"touchmove":"mouseover",e=>{const t=e.composedPath(),{target:s}=e;setTimeout(()=>this.onMouseOver({target:s,path:t}),50)},!0];return this.getEvents(...t)}scrollEventHandler(e){const t=[e,"scroll",(s=this.checkElements.bind(this),()=>{y||(y=!0,setTimeout(()=>{s(),y=!1},100))}),{passive:!0}];var s;return this.getEvents(...t)}isElementVisible(e){return this.isElementOpaque(e)&&this.isElementTopmost(e)}isElementOpaque(e){return"HTML"===f(e,e=>"0"===window.getComputedStyle(e).opacity).nodeName}isElementTopmost(e){const t=e.getBoundingClientRect(),s=[[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 n=!1,i=0;for(;!n&&i<s.length;){const t=e.getRootNode()?.elementFromPoint(...s[i]);n=e===t||t?.contains(e)||e.contains(t),i+=1}return n}checkElements(){this.targets.forEach(({selector:e,uniqueId:t})=>{const s=u(e),[n,,i]=e.split("[]"),r=i??n;s&&!this.existingTargets.find(e=>e.element.matches(r)&&e.uniqueId===t)&&(this.existingTargets.push({element:s,selector:e,uniqueId:t}),this.visibilityObserver.observe(s))}),this.existingTargets=this.existingTargets.filter(({selector:e,element:t})=>!!u(e)||(t&&this.visibilityObserver.unobserve(t),!1)),this.inViewportTargets=this.inViewportTargets.filter(({selector:e,element:t,uniqueId:s})=>{const[n,,i]=e.split("[]"),r=i??n;if(t.matches(r)&&this.isElementVisible(t)){const n=this.targets.find(t=>t.selector===e&&t.uniqueId===s);return n&&n.resolve(t),this.clear(e,s),!1}return!0})}onLoadIframe(e){const t=[e.defaultView.frameElement,"load",()=>this.watch(selector,resolve,uniqueId).bind(this),{passive:!0}];return this.getEvents(...t)}watch(e,t,s){this.targets.push({selector:e,resolve:t,uniqueId:s});const{clear:n}=v(e,e=>{n();const t=e.getRootNode(),s="body"in t?t.body:document;this.mouseOverEvent=this.mouseOverHandler(t),this.scrollEvent=this.scrollEventHandler(t),this.onTransitionEnd=this.transitionOverHandler(t),t.defaultView?.frameElement&&(this.onIframeLoad=this.onLoadIframe(t),this.onIframeLoad.start()),this.startVisibilityObserver(s),this.startMutationObserver(s),this.checkElements()})}clear(e,t){[this.targets,this.existingTargets,this.inViewportTargets]=[this.targets,this.existingTargets,this.inViewportTargets].map(s=>s.filter(({selector:s,uniqueId:n})=>s!==e&&n!==t));const s=u(e);s&&this.visibilityObserver?.unobserve(s),0===this.targets.length&&(this.mutationObserver?.disconnect(),this.onIframeLoad?.clear()),0===this.inViewportTargets.length&&(this.mouseOverEvent?.clear(),this.scrollEvent?.clear(),this.onTransitionEnd?.clear())}}const $="remove",E="rebuild",S="update",T="ABTastyData";class C{constructor({triggerEvent:e,triggerSelector:t,triggerDelay:s,triggerTarget:n}){this.event=e,this.selector=Boolean(t)?t:"body",this.target="string"==typeof n?u(t):n,this.delay=1e3*s,this.triggerElements=[],this.eventsListeners=[],this.timeouts=[],this.intervals=[],this.promises=[],this.visibilityObservers=[],this.socialProofStore={},this.elementWaiters=[]}async onElementVisible({promise:e,resolve:t}){const s=h(`${this.event}DomReady`);this.promises.push(s);const{clear:n}=v(this.selector,()=>{const e=new w;this.visibilityObservers.push(e),e.watch(this.selector,t,c())});return this.elementWaiters.push(n),e}onPageLoad({promise:e,resolve:t}){const s=()=>"complete"===document.readyState;if(!s()){const n=["readystatechange",()=>s()&&t(!0),{passive:!0}];return this.eventsListeners.push([document,...n]),document.addEventListener(...n),e}return t(!0),e}onClick({promise:e,resolve:t}){const s=({isTrusted:e,target:s})=>{if(e)return(s.isEqualNode(this.target)||b(s,this.selector))&&t(!0)},{clear:n}=v(this.selector,e=>{n();const t=document.createElement("style");t.id=`Click_${c()}`;const[i,,r]=this.selector.split("[]"),o=r??i;t.innerHTML=`${o} {\n\t\t\t\tcursor: pointer !important;\n\t\t\t\tpointer-events: all !important;\n\t\t\t}`;const a=e.getRootNode();("head"in a?a.head:a).appendChild(t),this.triggerElements.push(t);const l=["click",s,{passive:!0,capture:!0}];this.eventsListeners.push([a,...l]),a.addEventListener(...l)});return this.elementWaiters.push(n),e}onHover({promise:e,resolve:t}){const s=({isTrusted:e,target:s})=>{if(e)return(this.target?s.isEqualNode(this.target):b(s,this.selector))&&t(!0)},{clear:n}=v(this.selector,e=>{const t=e.getRootNode(),n="body"in t?t.body:[...t.childNodes].find(t=>t.contains(e)),i=["mouseenter",s,{passive:!0,capture:!0}];this.eventsListeners.push([n,...i]),n.addEventListener(...i)});return this.elementWaiters.push(n),e}onExitIntent({promise:e,resolve:t}){const s=["mouseleave",({isTrusted:e,clientY:s})=>{e&&s<=0&&t(!0)},{passive:!0}],{clear:n}=v("html",e=>{n(),this.eventsListeners.push([e,...s]),e.addEventListener(...s)});return e}onReengage({promise:e,resolve:t}){const s=this.delay;let n=s;const i=[...document.querySelectorAll("*:empty")].map(e=>e.contentDocument||e.shadowRoot).filter(e=>e),r=[({isTrusted:e})=>{e&&(n=s)},{passive:!0}];["click","mousemove","scroll","keypress"].forEach(e=>{[document,...i].forEach(t=>{this.eventsListeners.push([t,e,...r]),t.addEventListener(e,...r)})});const o=setInterval(()=>{n<=0?t(!0):n-=100},100);return this.intervals.push(o),e}onCustomTrigger({promise:e,resolve:t}){const{triggerEventCustomScript:s}=DATA;return new Function(`return new Promise(async resolve => {${s}})`)().then(e=>e&&t(!0)),e}onScrollUp({promise:e,resolve:t}){let s=0;const n=["scroll",({isTrusted:e})=>{e&&(window.scrollY<s?t(!0):s=window.scrollY)},{passive:!0,capture:!0}];return this.eventsListeners.push([document,...n]),document.addEventListener(...n),e}onScrollPercentReached({promise:e,resolve:t}){const{triggerEventScrollPercent:s}=DATA,n=["scroll",({isTrusted:e})=>{if(!e)return;const n=(()=>{const{documentElement:e,body:t}=document,s=e.scrollTop||t.scrollTop,n=e.scrollHeight||t.scrollHeight;return Math.trunc(s/(n-e.clientHeight)*100,10)})();s<n&&t(!0)},{passive:!0,capture:!0}];return this.eventsListeners.push([document,...n]),document.addEventListener(...n),e}checkSocialProofConditions(e,t,s,n){const i=(()=>{let e;return top.ABTasty||top.ABTASTY_S?(top.ABTASTY_S?.USER?.accountIdentifier?.length?e=top.ABTASTY_S.USER.accountIdentifier:"function"==typeof top.ABTasty?.getAccountSettings?e=top.ABTasty.getAccountSettings().identifier:top.ABTasty?.accountSettings&&(e=top.ABTasty.accountSettings.identifier),e):e})(),{viewInterval:r,spNoTrim:o}=DATA;if(this.socialProofStore.hasOwnProperty(e))s(this.socialProofStore[e])?n(`${this.socialProofStore[e][r]}`):n(!1);else if(e&&i){const a=t=>(this.socialProofStore[e]=t,n(!!s(t)&&`${t[r]}`));fetch(`https://api-social-proof.abtasty.com/clients/${i}/metrics/${t}?key=${e}${o?"&noTrim=true":""}`).then(e=>e.ok&&e.json()).then(a).catch(()=>l("Failed to fetch datas from server."))}else n(!1)}getSocialProofDatas({promise:e,resolve:t},i,r=!1){const{productKey:o,keyType:a}=(()=>{const{socialProofContentType:e,productKeyProvider:t,pathToProductKey:i,customJSProductKey:r,productSKU:o}=DATA;if(2===e)return{productKey:n(),keyType:"url"};{let a=null,c="sku";switch(t){case"ABTastyProductKey":a=window.ABTastyProductKey;break;case"pathToProductKey":a=s(`return ${i};`);break;case"customJSProductKey":a=s(r);break;case"productSKU":a=o}return a||3!==e||(a=n(),c="url"),{productKey:a,keyType:c}}})(),{viewInterval:c,triggerSocialProofMinVisitors:h,triggerSocialProofMinPurchases:d,triggerSocialProofMinPageViews:u}=DATA,g={pv:u,i:d,"v-pv":h}[i];return[typeof c,typeof g].includes("undefined")&&t(!1),r&&!o&&(l("Not able to find ABTastyProductKey, impossible to call the API, read documentation for more informations:\n\t\t\t\thttps://support.abtasty.com/hc/en-us/articles/4710919241628-Widgets-List#h_84c04344-c655-4e5e-b9ab-d26a798ad9b0"),t(!1)),this.checkSocialProofConditions(o,"v-pv"===i&&"sku"===a?"v-i":i,e=>{const t=void 0!==e[c]&&e[c]>=g;return t||l(`Widget will not be shown, Social Proof API returned ${e[c]} while ${g} are required`),t},t),e}onConsent({promise:e,resolve:t}){if(!r()){const s=["abtasty_consentValid",()=>t(!0)];return this.eventsListeners.push(s),window.addEventListener(...s),e}return t(!0),e}onTrackingSent({promise:e,resolve:t}){const{triggerEventTrackingSent:s}=DATA;let n=localStorage.getItem(T);const i=()=>JSON.parse(n)?.ActionTracking?.some(({name:e})=>e===s),r=["storage",({key:e,newValue:s})=>{e===T&&(n=s,i()&&t(!0))},{passive:!0,capture:!0}];return n&&i()?t(!0):(()=>{this.eventsListeners.push([window,...r]),window.addEventListener(...r)})(),e}onMinPagesViewed({promise:e,resolve:t}){const{triggerEventMinPagesViewed:s}=DATA;let n=localStorage.getItem(T);const i=()=>s<=(n?JSON.parse(n)?.VisitedPages?.length:0),r=["storage",({key:e,newValue:s})=>{e===T&&(n=s,i()&&t(!0))},{passive:!0,capture:!0}];return n&&i()?t(!0):(()=>{this.eventsListeners.push([window,...r]),window.addEventListener(...r)})(),e}onRageClick({promise:e,resolve:t}){const{triggerEventRageClickQuantity:s,triggerEventRageClickDelay:n}=DATA;let i=0,r=!1;const o=["click",({isTrusted:e})=>{if(e&&(i+=1,i>=s&&t(!0),!r)){r=!0;const e=setTimeout(()=>{i=0,r=!1},n);this.timeouts.push(e)}},{passive:!0,capture:!0}],a=e=>{this.eventsListeners.push([e,...o]),e.addEventListener(...o)},{clear:c}=v("iframe []contentDocument[] body > *",()=>{const e=document.getElementsByTagName("iframe");for(const t of e){"contentDocument"in t&&"body"in t.contentDocument&&a(t.contentDocument);const e=()=>a(t.contentDocument);t.addEventListener("load",e),this.eventsListeners.push([t,"onIframeLoad",e])}});return this.elementWaiters.push(c),a(document),e}clear(){this.triggerElements=this.triggerElements.filter(e=>(e.remove(),!1)),this.eventsListeners=this.eventsListeners.filter(e=>{const[t,...s]=e;return t&&s.length>1&&t.removeEventListener(...s),!1}),this.timeouts=this.timeouts.filter(e=>(clearTimeout(e),!1)),this.intervals=this.intervals.filter(e=>(clearInterval(e),!1));const e=c();return this.visibilityObservers=this.visibilityObservers.filter(t=>(t.clear(this.selector,e),!1)),this.promises=this.promises.filter(e=>(e.resolve(!1),!1)),this.elementWaiters=this.elementWaiters.filter(e=>(e(),!1)),this}async isTriggered(){this.clear();const e=h(this.event);this.promises.push(e);const t={consent:()=>this.onConsent(e),direct:()=>!0,pageLoad:()=>this.onPageLoad(e),click:()=>this.onClick(e),exitIntent:()=>this.onExitIntent(e),reengage:()=>this.onReengage(e),elementVisible:()=>this.onElementVisible(e),script:()=>this.onCustomTrigger(e),hover:()=>this.onHover(e),scrollUp:()=>this.onScrollUp(e),scrollPercent:()=>this.onScrollPercentReached(e),rageClick:()=>this.onRageClick(e),minPagesViewed:()=>this.onMinPagesViewed(e),trackingSent:()=>this.onTrackingSent(e),socialProofPurchases:()=>this.getSocialProofDatas(e,"i",!0),socialProofPageViews:()=>this.getSocialProofDatas(e,"pv"),socialProofVisitors:()=>this.getSocialProofDatas(e,"v-pv")},s=!Object.prototype.hasOwnProperty.call(t,this.event)||await t[this.event]();return s&&this.clear(),"reengage"!==this.event&&this.delay?s&&await(async()=>{const e=h(`${this.event}Delay`);this.promises.push(e);const t=setTimeout(()=>{e.resolve(!0),this.clear()},this.delay);return this.timeouts.push(t),e.promise})():s}}const P="display",k="closing",x="validation",A="ABTastyWidgets",N=`${A}Temporary`;class L{constructor({displayRecurrence:e,closingRecurrence:t,validationRecurrence:s},n){this.displayRecurrence=parseFloat(e),this.closingRecurrence=parseFloat(t),this.validationRecurrence=parseFloat(s),this.onSetCallback=n,this.widgetName=o(),this.uniqueId=c(),this.recurrenceKey=`${this.widgetName}_${this.uniqueId}`,this.isListeningStorageEvent=this.listenStorageEvent(),this.pendingRecurrence=!1,this.pendingRecurrenceValue={}}onStorage({key:e}){const t=localStorage.getItem(N),s=sessionStorage.getItem(A);"ABTastyData"===e&&!t&&s&&localStorage.setItem(N,s)}listenStorageEvent(){return this.isListeningStorageEvent||window.addEventListener("storage",this.onStorage.bind(this)),!0}getGivenRecurrenceStorageParsed(e){try{const t=e.getItem(A);return JSON.parse(t)}catch(t){return e.removeItem(A),!1}}getSessionRecurrenceStorageParsed(){return this.getGivenRecurrenceStorageParsed(window.sessionStorage)}getLocalRecurrenceStorageParsed(){return this.getGivenRecurrenceStorageParsed(window.localStorage)}removeGivenStorage(e,t){const{[this.recurrenceKey]:s,...n}=t;return Object.entries(n).length?(e.setItem(A,JSON.stringify(n)),n):(e.removeItem(A),!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(){if(this.pendingRecurrence)return this.pendingRecurrenceValue;const e=this.getSessionRecurrence(),t=this.getLocalRecurrence();return e||t||{type:!1}}isOver(){const e=localStorage.getItem(N),t=!(!e||!e.includes(this.recurrenceKey))||this.getSessionRecurrence();e&&(sessionStorage.setItem(A,e),localStorage.removeItem(N));const s=this.getLocalRecurrence(),n=(s?parseFloat(s.stamp):0)<(new Date).getTime();return n&&this.removeLocalRecurrenceStorage(),!this.pendingRecurrence&&n&&!this.getLocalRecurrence()&&!t}setRecurrence(e,s){0!==e&&(window.removeEventListener("storage",this.onStorage.bind(this)),this.isListeningStorageEvent=!1);const n=this.getTypeOfStorage(e);if(t()||!n&&"object"!=typeof n)return!1;const{storageString:i,storageMethod:o}=n,a=this.getStamp(e),c={type:s,stamp:a},{type:l}=this.getCurrentRecurrence(),h=async()=>{if(!r()){this.pendingRecurrence=!0,this.pendingRecurrenceValue=c;const e=new C({triggerEvent:"consent"});await e.isTriggered(),this.pendingRecurrence=!1,this.pendingRecurrenceValue={}}const e=this.getSessionRecurrence(),t=this.getLocalRecurrence();let s;"session"===i?e?s=this.removeSessionRecurrenceStorage():(this.removeLocalRecurrenceStorage(),s=this.getSessionRecurrenceStorageParsed()):"local"===i&&(t?s=this.removeLocalRecurrenceStorage():(this.removeSessionRecurrenceStorage(),s=this.getLocalRecurrenceStorageParsed()));const n=s?{[this.recurrenceKey]:c,...s}:{[this.recurrenceKey]:c};o.setItem(A,JSON.stringify(n)),this.onSetCallback&&"function"==typeof this.onSetCallback&&this.onSetCallback()};if(!o)return!1;if(l&&s!==x)if(s===k&&l!==x)h();else{if(s!==P||l===x||l===k)return!1;h()}else h();return a}setDisplayRecurrence(){const e=P;this.setRecurrence(this.displayRecurrence,e)}setClosingRecurrence(){const e=k;this.setRecurrence(this.closingRecurrence,e)}setValidationRecurrence(){const e=x;this.setRecurrence(this.validationRecurrence,e)}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 I{constructor(e,t,s){this.isWidgetApplied=e,this.callback=t,this.shouldUpdate=s,this.triggerIframeTarget=null,this.observer=new MutationObserver(this.observerHandler.bind(this)),this.tagRollbackEventParams=["abtasty_resetActionTracking",this.onTagRollback.bind(this)],this.onCampaignLaunchedEventParams=["abtasty_executedCampaign",this.onCampaignLaunched.bind(this)]}decisionHandler(e){const t=!e&&this.isWidgetApplied(),s=t?this.shouldUpdate&&S:E;return s?(this.clearWatcher(),this.callback(s,!e,t),this.watch(),this):this}onCampaignLaunched({detail:{campaignId:e}}){e===TEST_ID&&(this.callback(E,!1),this.watch())}onTagRollback({target:e}){return this.clearWatcher(e),this.callback($,!1),window.addEventListener(...this.onCampaignLaunchedEventParams),this}observerHandler(e){return i()?e.some(e=>["removedNodes","addedNodes"].some(t=>e[t]&&e[t].length))?this.decisionHandler():this:this.callback($,!1)}watch(t,s){if(e())return this;if(this.clearWatcher(t),window.removeEventListener(...this.onCampaignLaunchedEventParams),document.addEventListener(...this.tagRollbackEventParams),s?.includes("[]contentDocument[]")){const e=s.split("[]")[0].trim(),{clear:t}=v(e,e=>{t(),this.triggerIframeTarget=e,e.addEventListener("load",this.decisionHandler.bind(this))})}const n=t?.defaultView?.frameElement;n&&this.triggerIframeTarget!==n&&n.addEventListener("load",this.decisionHandler.bind(this));const{clear:i}=v("body",e=>{i();const s=t?.body||t||e;this.observer.observe(s,{childList:!0,subtree:!0})});return this}clearTriggerElementWatcher(){this.triggerIframeTarget?.removeEventListener("load",this.decisionHandler.bind(this))}clearWatcher(e){return document.removeEventListener(...this.tagRollbackEventParams),this.observer.disconnect(),this.clearTriggerElementWatcher(),e?.defaultView?.frameElement?.removeEventListener("load",this.decisionHandler.bind(this)),this}}const R=/.+\/([^.]+)\.(otf|ttf)$/,D=["socialProofPurchases","socialProofPageViews","socialProofVisitors"];class B{constructor(t,s){this.children=void 0,this.uniqueId=`${c()}${s?`_${s}`:""}`,this.widgetName=o(),this.prettyName=a(),this.recurrenceParams=(()=>{const{displayRecurrence:t,closingRecurrence:s,validationRecurrence:n}=DATA,i=!t&&!s&&!n;if(e()||i)return!1;const r={everytime:()=>-1,session:()=>0,once:()=>395,day:e=>DATA[`${e}_day`],week:e=>7*DATA[`${e}_week`],month:e=>30.5*DATA[`${e}_month`]},o={};return t&&(o.displayRecurrence=r[t]("displayRecurrence")),s&&(o.closingRecurrence=r[s]("closingRecurrence")),n&&(o.validationRecurrence=r[n]("validationRecurrence")),o})(),this.triggerParams=(t=>{let{triggerEvent:s}=DATA;const{triggerEventClick:n,triggerEventHover:i,triggerEventReengageDelay:r,socialProofContentType:o,triggerEventElementVisible:a,triggerEventDelay:c}=DATA;if(e()||!s&&!o)return!1;const l={click:()=>n,hover:()=>i,elementVisible:()=>a},h=Object.prototype.hasOwnProperty.call(l,s)?l[s]():"body",d="reengage"===s?r:c;return o&&(s=[,"socialProofPurchases","socialProofPageViews","socialProofVisitors"][o]),{triggerEvent:s,triggerSelector:h,triggerDelay:d,triggerTarget:t}})(t),this.recurrence=!!this.recurrenceParams&&new L(this.recurrenceParams,this.clearGivenClearables.bind(this)),this.trigger=!!this.triggerParams&&new C(this.triggerParams),this.shouldUpdate=!!this.triggerParams&&D.includes(this.triggerParams.triggerEvent),this.pageWatcher=new I(this.isWidgetApplied.bind(this),this.onPageChange.bind(this)),this.hasOncePerPageTrigger=(()=>{const{isOncePerPageTrigger:e,triggerEvent:t}=DATA;return!t||!["click","hover","scrollUp","script"].includes(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.rootElement=null,this.domElement=this.getDom(),this.hasBeenShown=!1,this.closedByUser=!1,this.elementsWaiters=[]}clearGivenClearables(){this.elementsWaiters.forEach(e=>e.clear()),this.elementsWaiters=[]}isWidgetApplied(){return this.domElement?.isConnected&&this.domElement.ownerDocument?.defaultView}removeOldDomElement(){const e=this.rootElement?.getElementById(this.widgetContainerId);return e?.remove(),this}async insert(){if(this.isWidgetApplied())return!1;const e=["free"];"drawer"===DATA.layout&&DATA.customTarget&&e.push("drawer");const t=e.includes(DATA.layout);return new Promise(e=>{const{elementReferrer:s="body",referrerInsertType:n="beforeend"}=t?DATA:{},i=v(s,t=>{this.elementsWaiters=this.elementsWaiters.filter(e=>e.selector!==s),this.rootElement=t.getRootNode(),this.removeOldDomElement(),this.domElement.appendChild(this.styleElement),e(t.insertAdjacentElement(n,this.domElement))});this.elementsWaiters.push(i)}).then(()=>this)}remove(){return this.trigger&&this.trigger.clear(),this.pageWatcher.clearWatcher(this.rootElement),this.domElement?.isConnected&&this.domElement.remove(),this.hasOncePerPageTrigger?this.pageWatcher.watch(this.rootElement):e()||this.init().then(({response:e})=>e?this.show():this),this}show(){return e()||this.hasBeenShown&&this.hasOncePerPageTrigger||window.ABTastyEvent(`${this.prettyName} displayed`,null,TEST_ID),this.closedByUser=!1,setTimeout(()=>this.domElement.classList.remove(this.hideClassName),50),this.recurrence&&this.recurrence.setDisplayRecurrence(),this.hasBeenShown=!0,this.pageWatcher.watch(this.rootElement),this}hide(t=!0){return!e()&&this.hasBeenShown&&t&&window.ABTastyEvent(`${this.prettyName} closed`,null,TEST_ID),t&&(this.pageWatcher.clearWatcher(this.rootElement),this.closedByUser=!0),this.domElement.classList.add(this.hideClassName),this}async init(t){const s=e(),n=i(),r=this.trigger?.promises?.length,o=!this.recurrence||this.recurrence.isOver();if(!s&&!n||r||!o)return{container:this,response:!1};this.pageWatcher.watch(this.rootElement||document,this.triggerParams.triggerSelector);const a=s||!this.trigger||this.trigger&&await this.trigger.isTriggered();this.pageWatcher.clearTriggerElementWatcher();const c={container:this,response:a};return a?(await this.insert(),this.addCloseEvent(),s||t||this.hasBeenShown||void 0===this.children||"function"!=typeof this.children.refreshContent||this.children.refreshContent(a),c):c}onPageChange(e,t,s){const n=()=>this.init().then(({response:e})=>{e?this.show():this.hide(!1)});t||(this.hasBeenShown=!1,this.trigger&&this.trigger.clear());const i={[$]:()=>s?this.remove():this.pageWatcher.watch(this.rootElement),[E]:()=>{this.hasBeenShown?this.closedByUser?this.pageWatcher.watch(this.rootElement):s||this.insert().then(e=>e.show()).catch(this.pageWatcher.watch):n()},[S]:()=>{this.hasBeenShown?this.pageWatcher.watch():n()}};"function"==typeof i[e]&&i[e]()}addCloseEvent(...t){const{closeButton:s,overlay:n,overlayClickable:i,layout:r,animationDuration:o=1e3}=DATA,a=[];if(void 0!==n&&!0!==n||!0!==i||"popin"!==r||a.push(`.${this.overlayClassName}`),void 0!==s&&s&&a.push(`.${this.closeButtonClassName}`),!a.length)return this;const c=this.domElement.querySelectorAll(a.join(", "));if(!c.length)return this;const l=["click",t=>{(t=>{e()||(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation())})(t),this.recurrence&&this.recurrence.setClosingRecurrence(),this.hide(!0),setTimeout(()=>this.remove(),1.05*o)},{once:!0,capture:!0}];return t.push(...c),t.forEach(t=>{e()&&(t.dataset.abtastyActionnable="true"),t.removeEventListener(...l),t.addEventListener(...l)}),this}getDom(){const{closeButton:e,layout:t,overlayClickable:s,overlay:n=!0}=DATA,i=document.createElement("div");return i.className=`${this.basicClassName} ${this.hideClassName}`,i.id=this.widgetContainerId,["popin","bannerTop","bannerBottom"].includes(t)&&(i.role="dialog"),i.innerHTML=`\n\t\t\t${"popin"===t&&!0===n?`<div ${s?'aria-label="Close dialog"':""} class="${this.overlayClassName}"></div>`:""}\n\t\t\t<div class="${this.contentClassName}">\n\t\t\t${e?`<button class="${this.closeButtonClassName}" aria-label="Close dialog"><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>`,i}loadFont(e,t){if(!e||"inherit"===e||!/otf|ttf/g.test(t))return;const s=document.createElement("style"),n=t.match(R)?t.match(R)[1]:"";s.innerHTML=`@font-face { font-family: '${e}_${n}'; src: url('${t}'); font-display: swap; }`;const i=this.rootElement?.head||document.head;i?.appendChild(s)}getStyleTag(t="",s=DATA){const{noStyles:n,layout:i}=s,{backgroundColor:r,isBackgroundImage:o,backgroundImage:a,backgroundSize:c,backgroundPosition:l,backgroundRepeat:h,borderColor:d,borderRadius:u,borderWidth:g,textColor:m,textAlign:p,fontName:v,fontStyle:f,fontSize:b,isTitle:y,titleTextAlign:w,titleTextColor:$,titleFontName:E,titleFontStyle:S,titleFontSize:T,overlay:C,overlayColor:P,dropShadow:k,dropShadowColor:x,dropShadowBlur:A,containerMargin:N,containerPadding:L,closeButton:I,closeButtonPosition:D,closeButtonSize:B,closeButtonBorderRadius:O,closeButtonBorderWidth:_,closeButtonBorderColor:W,closeButtonColor:V,closeButtonBackgroundColor:j,buttonsAlign:q,buttonsBorderWidth:H,buttonsBorderColor:F,buttonsBorderRadius:M,buttonsBackgroundColor:z,buttonsTextColor:K,buttonsFontName:U,buttonsFontStyle:G,buttonsFontSize:J,secondLink:Y,secondLinkBorderWidth:Q,secondLinkBorderColor:X,secondLinkBorderRadius:Z,secondLinkBackgroundColor:ee,secondLinkTextColor:te,secondLinkFontName:se,secondLinkFontStyle:ne,secondLinkFontSize:ie,animation:re,animationDuration:oe,animationBehaviour:ae,animationSlideDirection:ce}=n?{}:s,le=document.createElement("style");e()&&le.setAttribute("abtasty-script-added","true"),this.loadFont(v,f),this.loadFont(E,S),this.loadFont(U,G),this.loadFont(se,ne);const he=`background: ${["string"==typeof r?r:"rgba(255, 255, 255, 1)",o&&"string"==typeof a&&a.length?`url(${a})`:"",o&&"string"==typeof l&&"100% 100%"!==c?l:"0 0",o&&"string"==typeof c?`/ ${c}`:"/ auto",o&&h&&!["cover","100% 100%"].includes(c)?"repeat":"no-repeat"].join(" ").trim()};`,de="number"==typeof g&&g>0,ue=`border: ${[de?`${g}px`:"unset",de?"solid":"",de&&"string"==typeof d&&d.length?d:""].join(" ").trim()};`,ge=void 0!==u?`border-radius: ${u}px;`:"",me=void 0!==m?`color: ${m}; fill: ${m}; -webkit-text-fill-color: ${m};`:"",pe=void 0!==p?`text-align: ${p};`:"",ve=v&&"inherit"!==v?`font-family:${v}_${f.match(R)?f.match(R)[1]:""};`:f||"",fe=b?`font-size: ${b}px;`:"",be=void 0!==k&&k?`box-shadow: 0 5px ${A}px 0 ${x};`:"",ye=N instanceof Array&&1===N.length&&N[0],we=ye?`margin: ${ye.top}px ${ye.right}px ${ye.bottom}px ${ye.left}px;`:"",$e=ye?`margin: calc(${ye.top}px * 0.5) calc(${ye.right}px * 0.5) calc(${ye.bottom}px * 0.5) calc(${ye.left}px * 0.5);`:"",Ee=L instanceof Array&&1===L.length&&L[0],Se=Ee?`padding: ${Ee.top}px ${Ee.right}px ${Ee.bottom}px ${Ee.left}px;`:"",Te=Ee?`padding: calc(${Ee.top}px * 0.5) calc(${Ee.right}px * 0.5) calc(${Ee.bottom}px * 0.5) calc(${Ee.left}px * 0.5);`:"",Ce=void 0!==H&&H?`border-width: ${H}px; border-style: solid;`:"",Pe=[F,H].every(e=>void 0!==e)&&H?`border-color: ${F};`:"",ke=void 0!==M?`border-radius: ${M}px;`:"",xe=void 0!==z?`background-color: ${z};`:"",Ae=void 0!==K?`color: ${K}; fill: ${K}; -webkit-text-fill-color: ${K};`:"",Ne=U&&"inherit"!==U?`font-family:${U}_${G.match(R)?G.match(R)[1]:""};`:G||"",Le=J?`font-size: ${J}px;`:"",Ie="number"==typeof Q?`border-width: ${Q}px; border-style: solid;`:"",Re=[X,Q].every(e=>void 0!==e)&&Q?`border-color: ${X};`:"",De=void 0!==Z?`border-radius: ${Z}px;`:"",Be=void 0!==ee?`background-color: ${ee};`:"",Oe=void 0!==te?`color: ${te}; fill: ${te}; -webkit-text-fill-color: ${te};`:"",_e=se&&"inherit"!==se?`font-family:${se}_${ne.match(R)?ne.match(R)[1]:""};`:ne||"",We=ie?`font-size: ${ie}px;`:"",Ve="popin"!==i||void 0!==C&&!0!==C?"":[`#${this.widgetContainerId} .${this.overlayClassName} {`,`background-color: ${void 0!==P?P:"rgba(0, 0, 0, 0.6)"};`,"}"].join(""),je="number"==typeof B?B:16,qe=je/2,He=n||void 0!==I&&I?[`#${this.widgetContainerId} .${this.contentClassName} .${this.closeButtonClassName} {`,"position: absolute;",("out"===D?`bottom: calc(100% + ${qe}px)`:`top: ${qe}px`)+";",`right: ${qe}px;`,"width: auto;","height: auto;","background: none;","border: none;","cursor: pointer;","padding: 0;","margin: 0;","line-height: 0;","z-index: 9;","number"==typeof O?`border-radius: ${O}px;`:"","number"==typeof _&&_>0?`border: ${_}px solid ${void 0!==W?W:"rgba(57, 57, 57, 1)"};`:"","string"==typeof j?`background-color: ${j};`:"","}",`#${this.widgetContainerId} .${this.contentClassName} .${this.closeButtonClassName} svg {`,"pointer-events: none;",`width: ${je}px;`,`height: ${je}px;`,"string"==typeof V?`fill: ${V};`:"","}"].join(""):"",Fe=y&&"string"==typeof $?[`#${this.widgetContainerId} .${this.contentClassName} > * h1, `,`#${this.widgetContainerId} .${this.contentClassName} > * h2, `,`#${this.widgetContainerId} .${this.contentClassName} > * h3, `,`#${this.widgetContainerId} .${this.contentClassName} > * h4, `,`#${this.widgetContainerId} .${this.contentClassName} > * h5, `,`#${this.widgetContainerId} .${this.contentClassName} > * h6 {`,`color: ${$}; fill: ${$}; -webkit-text-fill-color: ${$};`,void 0!==w?`text-align: ${w};`:"",E&&"inherit"!==E?`font-family:${E}_${S.match(R)?S.match(R)[1]:""};`:S||"",T?`font-size: ${T}px;`:"","}"].join(""):"";let Me="";if("string"==typeof re){const t=(oe/1e3).toFixed(2),s=["top","bottom"].includes(ce),n=Number(s),i=[(["top","left"].includes(ce)?"-":"")+"100vmax",this.translateValues?this.translateValues[n]:"0"];s&&i.reverse(),Me={none:[`.${this.hideClassName} {`,"opacity: 0 !important;","}"],fade:[`.${this.hideClassName} {`,"opacity: 0 !important;","}",`#${this.widgetContainerId} {`,`transition: opacity ${t}s ${ae};`,"}"],slide:[`.${this.hideClassName} .${this.overlayClassName} {`,"opacity: 0 !important;","}",`#${this.widgetContainerId} .${this.overlayClassName} {`,`transition: opacity ${t}s ${ae};`,"}",`.${this.hideClassName} .${this.contentClassName} {`,`transform: translate(${i.join(", ")}) !important;`,"}",`#${this.widgetContainerId} .${this.contentClassName} {`,`transition: transform ${t}s ${ae};`,"}"]}[e()&&!ABTASTY_S.WIDGETS.animationChanged?"none":re].join("")}const ze=[`#${this.widgetContainerId} .${this.contentClassName} .buttons_container .second_link {`,`margin-${"fill"===q?"top":"left"}: 8px;`,Ie,Re,De,Be,Oe,_e,We,"}",`#${this.widgetContainerId} .${this.contentClassName} .buttons_container .second_link {`,Oe,_e,We,"}"];return le.textContent=[`#${this.widgetContainerId} style { display: none; }`,`.${this.hideClassName} {`,"pointer-events: none;","}",`#${this.widgetContainerId} {`,"opacity: 1;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,he,ge,ue,me,pe,be,we,ve,fe,"}",`#${this.widgetContainerId} .${this.contentClassName} p {`,me,pe,ve,fe,"}",`#${this.widgetContainerId} .${this.contentClassName} > * {`,"display: block;","line-height: 1;","text-indent: unset;",Se,ve,fe,"}",`#${this.widgetContainerId} .${this.contentClassName} a {`,"text-decoration: underline;","}",`#${this.widgetContainerId} .${this.contentClassName} div.buttons_container a, `,`#${this.widgetContainerId} .${this.contentClassName} button {`,"text-decoration: none;","box-sizing: border-box;","display: inline-block;",Ce,Pe,ke,xe,Ae,Ne,Le,"}",`#${this.widgetContainerId} .${this.contentClassName} div.buttons_container a *, `,`#${this.widgetContainerId} .${this.contentClassName} button:not(class*="close_button") * {`,Ae,Ne,Le,"}",...Y?ze:[],"@media screen and (max-width: 579px) {",`#${this.widgetContainerId} .${this.contentClassName} {`,$e,"}",`#${this.widgetContainerId} .${this.contentClassName} > * {`,Te,"}","}",Ve,He,Fe,Me,`${t}`].join(""),le}}class O extends B{constructor(){super(),this.position="string"==typeof DATA.layout&&"bannerTop"===DATA.layout?"top":"bottom",this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){const{zindex:e,zindexCustom:t}=DATA;return[`#${this.widgetContainerId} {`,"position: fixed;",`${this.position}: 0;`,"left: 0;","width: 100%;","height: auto;",`z-index: ${"custom"===e?t:e};`,"background: none;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: relative;","}"].join("")}}class _ extends B{constructor(e,t){super(e,t),this.stringStyles=this.getStyles(),this.styleElement=this.getStyleTag(this.stringStyles)}getStyles(){return[`#${this.widgetContainerId} {`,"width: auto;","height: auto;","margin: 0;","padding: 0;","background: none;","}",`#${this.widgetContainerId} .${this.contentClassName} {`,"position: relative;","}"].join("")}}function W(e){return W="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},W(e)}function V(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),s.push.apply(s,n)}return s}function j(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{};t%2?V(Object(s),!0).forEach(function(t){q(e,t,s[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):V(Object(s)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))})}return e}function q(e,t,s){return(t=H(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}function H(e){var t=function(e){if("object"!=W(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var s=t.call(e,"string");if("object"!=W(s))return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==W(t)?t:t+""}var F=function(){return t=function e(t){var s=t.parentContainer;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.parentContainer=s,this.baseClassName="spotlight_container",this.className="".concat(this.baseClassName,"_").concat(s.uniqueId),this.contentElement=this.getContentElement()},s=[{key:"insertIn",value:function(t,s){return this.setStyles(),t.insertAdjacentElement(s,this.contentElement),e()||(setTimeout(this.setHorizontalScroll.bind(this),500),window.addEventListener("resize",this.setHorizontalScroll.bind(this))),this}},{key:"remove",value:function(){var e=this,t=DATA.animationDuration;setTimeout(function(){return e.parentContainer.remove()},1.05*(void 0===t?1e3:t))}},{key:"onRedirect",value:function(e){window.ABTastyEvent(e,null,TEST_ID),l('Tracking "'.concat(e,'" sent to campaign ').concat(TEST_ID)),this.parentContainer.recurrence.setValidationRecurrence()}},{key:"setHorizontalScroll",value:function(){var e=this,t=ABTasty.getParsedUserAgent().type,s=this.contentElement,n=s.scrollWidth,i=s.clientWidth,r=!1,o=!1,a=0,c=0,l=function(){return s.classList.remove("".concat(e.baseClassName,"_draggable_active"))},h=function(){o?setTimeout(l,50):l(),r=!1,o=!1},d=function(e){r=!0,a=e.pageX-s.offsetLeft,c=s.scrollLeft,s.addEventListener("mouseup",h,{capture:!0,once:!0,passive:!0})},u=function(t){if(r){t.preventDefault(),s.classList.add("".concat(e.baseClassName,"_draggable_active")),o=!0;var n=t.pageX-s.offsetLeft-a;s.scrollLeft=c-n}};"Desktop"===t&&n>i?(s.classList.add("".concat(this.baseClassName,"_draggable")),s.addEventListener("mousedown",d,{capture:!0,passive:!0}),s.addEventListener("mousemove",u,{capture:!0,passive:!1})):(s.classList.remove("".concat(this.baseClassName,"_draggable")),s.removeEventListener("mousedown",d,{capture:!0,passive:!0}),s.removeEventListener("mousemove",u,{capture:!0,passive:!1}))}},{key:"getContentElement",value:function(){var t=this,s=DATA,n=s.spotlightContent,i=s.layout,r=document.createElement("div");return r.className="".concat(this.className," buttons_container"),["bannerTop","bannerBottom"].includes(i)&&this.parentContainer.domElement.removeAttribute("role"),1===n.length&&e()&&(n.length=4,n.fill(j(j({},n[0]),{},{text:"Example",fake:!0}),1)),n.forEach(function(s,n){var i=s.text,o=s.link,a=s.fake,c=s.tracking,l=document.createElement("figure");a&&(l.className="spotlightExample"),l.innerHTML="<a href='".concat(o,"' aria-label=\"").concat(i,'"></a><legend>').concat(i,"</legend>");var h=c.replace(/!name!/gm,i).replace(/!number!/gm,n+1);e()||l.querySelector("a").addEventListener("click",function(){return t.onRedirect(h)},{capture:!0}),r.appendChild(l)}),r}},{key:"setStyles",value:function(){var e=this,t=this.parentContainer,s=t.styleElement,n=t.widgetContainerId,i=DATA,r=i.buttonsBorderRadius,o=i.buttonsTextColor,a=i.buttonsFontName,c=i.buttonsFontStyle,l=i.buttonsFontSize,h=i.insideBorderWidth,d=i.insideBorderColor,u=i.buttonsAlign,g=i.spotlightContent,m=i.buttonsSize,p=i.buttonsSpace,v=i.scrollSnapBehaviour,f=i.scrollBarDisplay,b=i.textAlign,y=i.textWrap,w=/.+\/([^.]+)\.(otf|ttf)$/,$=void 0!==o?"color: ".concat(o,"; fill: ").concat(o,"; -webkit-text-fill-color: ").concat(o,";"):"",E=a&&"inherit"!==a?"font-family:".concat(a,"_").concat(c.match(w)?c.match(w)[1]:"",";"):c||"",S=["#".concat(n," .").concat(this.className," {"),"display: flex;","flex-direction: row;","flex-wrap: nowrap;","justify-content: ".concat(u,";"),"align-items: flex-start;","overflow-x: auto;","overscroll-behavior-x: contain;",v?"scroll-snap-type: x mandatory;":"",f?"scrollbar-width: none;":"","overflow-y: hidden;","}",f?["#".concat(n," .").concat(this.className,"::-webkit-scrollbar {"),"display: none;","}"].join(""):"",".".concat(this.baseClassName,"_draggable {"),"cursor: grab;","}","#".concat(n," .").concat(this.baseClassName,"_draggable_active {"),"cursor: grabbing;","}","#".concat(n," .").concat(this.baseClassName,"_draggable_active * {"),"pointer-events: none;","}",".".concat(this.className," .spotlightExample {"),"opacity: 0.5;","}",".".concat(this.className," figure {"),"font-size: 0;","text-align: center;","margin: 0 ".concat(p,"vw;"),"width: ".concat(m,"vh;"),"min-width: ".concat(m,"vh;"),"scroll-snap-align: start;","scroll-margin-left: ".concat(p,"vw;"),"}",".".concat(this.className," figure a {"),"line-height: 0;","width: 100%;","background-size: cover;","background-position: center;","background-repeat: no-repeat;","border-radius: ".concat(r,"% !important;"),"position: relative;","}",".".concat(this.className," figure legend {"),"display: inline-block;","margin-top: ".concat(10,"px;"),"white-space: ".concat(y?"pre-wrap":"nowrap",";"),"overflow: hidden;","text-overflow: ellipsis;","line-height: 1.5;","font-size: ".concat(l,"px;"),"text-align: ".concat(b,";"),$,E,"}",g.map(function(t,s){var n=t.image;return[".".concat(e.className," figure:nth-of-type(").concat(s+1,") a {"),'background-image: url("'.concat("widget_common_defaultImgUrl"===n?"https://widgets-images.abtasty.com/widgets-default-image.png":n,'");'),"}"].join("")}).join(""),".".concat(this.className," figure a::before {"),'content: "";',"display: block;","border-radius: ".concat(r,"% !important;"),"padding-bottom: calc(100% - ".concat(2*h,"px);"),h>0?"border: ".concat(h,"px solid ").concat(d,";"):"","}",".".concat(this.className," figure a::after {"),'content: "";',"display: block;","position: absolute;","top: calc(100% + ".concat(r,"px);"),"left: -".concat(r,"px;"),"z-index: 1;","width: calc(100% + ".concat(2*r,"px);"),"height: ".concat(1.1*(10+l),"px;"),"}"].join("");return s.insertAdjacentText("beforeend",S),s}}],s&&function(e,t){for(var s=0;s<t.length;s++){var n=t[s];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,H(n.key),n)}}(t.prototype,s),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,s}();!function(){l("Widget launch");var e=DATA.layout.includes("banner")?new O:new _,t=e.domElement.querySelector(".".concat(e.contentClassName)),s=new F({parentContainer:e});e.children=s,s.insertIn(t,"beforeend"),e.init(!0).then(function(t){t.response&&e.show()})}()}();
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@abtasty/spotlight",
|
3
3
|
"description": "Allow you to add a spotlight section on your website",
|
4
|
-
"version": "1.1.
|
4
|
+
"version": "1.1.15-0",
|
5
5
|
"form": "dist/form.js",
|
6
6
|
"main": "dist/main.js",
|
7
7
|
"type": "module",
|
@@ -43,5 +43,6 @@
|
|
43
43
|
"postcss-cssnext": "^3.1.1",
|
44
44
|
"rollup": "^4.12.0",
|
45
45
|
"rollup-plugin-postcss": "^4.0.2"
|
46
|
-
}
|
46
|
+
},
|
47
|
+
"stableVersion": "1.1.14"
|
47
48
|
}
|