PageSourceSearch

https://www.awin.com/assets/product-quiz.BFcGPLSI.js

js awin.com collected 2026-09-24 08:24:19 UTC 4,004 bytes, 1 lines download raw bytes

1const l="globe",u="#productquiz",o="Product Quiz";const c="https://website-assets.awin.com/awin/image/upload/c_limit,w_196/dpr_1.0/f_auto/q_auto/v1/icons/3d",h={"de-DE":"de","fr-FR":"fr","en-US":"us","pt-BR":"br","es-ES":"es","es-MX":"mx","it-IT":"it","nl-NL":"nl","pl-PL":"pl"},r=["access","accelerate","advanced"],d={access:"access-service",accelerate:"accelerate-service",advanced:"advanced-service"},a=(t=l,e=!1)=>`${c}/${e?"animation":"static"}/icon_${t}${e?"_animation":""}`,m=()=>{history.replaceState(null,document.title,window.location.pathname+window.location.search)};function p(t){const e=Object.fromEntries(r.map(s=>[s,0]));for(const s of t)s.plan&&e[s.plan]++;const i=r.reduce((s,n)=>e[n]>e[s]?n:s);return t.some(s=>s.service===!0)?d[i]:i}function w(){return{loader:!1,error:!1,loaderTimeout:null,scrollY:0,hashChangeHandler:null,questions:[],currentQuestion:0,answers:[],plans:[],plan:null,questionStartTime:0,destroy(){this.hashChangeHandler&&window.removeEventListener("hashchange",this.hashChangeHandler),this.loaderTimeout!==null&&(clearTimeout(this.loaderTimeout),this.loaderTimeout=null)},get totalQuestions(){return this.questions.length},get dialog(){return this.$refs.dialog},getIcon3dStatic(t){return a(t)},getIcon3dAnimated(t){return a(t,!0)},startQuestionTimer(){this.questionStartTime=performance.now()},getQuestionDuration(){return Math.floor(performance.now()-this.questionStartTime)},open(){!this.dialog||this.dialog.open||(this.scrollY=window.scrollY,document.body.style.position="fixed",document.body.style.top=`-${this.scrollY}px`,document.body.style.left="0",document.body.style.right="0",this.dialog.showModal(),this.startQuestionTimer(),this.$track.event(`${o} - Product Quiz Started`,{},!1))},close(){if(!this.dialog||!this.dialog.open)return;document.body.style.position="",document.body.style.top="",document.body.style.left="",document.body.style.right="";const t=document.documentElement,e=t.style.scrollBehavior;t.style.scrollBehavior="auto",window.scrollTo(0,this.scrollY),t.style.scrollBehavior=e,this.dialog.close(),this.reset(),this.$track.event(`${o} - Product Quiz Abandoned`,{},!1)},handleHash(){window.location.hash===u?this.open():this.dialog?.open&&this.close()},handleOptionClick(t){const e=this.questions[this.currentQuestion];this.answers[this.currentQuestion]=t;const i=this.getQuestionDuration();if(this.$track.event(`${o} - Step Viewed`,{"product-quiz_step_nr":this.currentQuestion+1,"product-quiz_question_name":e?.titleAlt||e?.title,"product-quiz_question_answer":t.labelAlt||t.label,time_spent_ms:i},!1),this.currentQuestion++,this.currentQuestion===this.questions.length){this.showLoader();return}this.startQuestionTimer()},back(){if(this.currentQuestion>0){this.$track.event(`${o} - Step Back`,{"product-quiz_step_nr":this.currentQuestion+1},!1),this.currentQuestion--,this.startQuestionTimer();return}this.reset()},reset(t=!1){this.loaderTimeout!==null&&(clearTimeout(this.loaderTimeout),this.loaderTimeout=null),this.loader=!1,this.currentQuestion=0,this.answers=[],this.plan=null,this.startQuestionTimer(),!t&&(m(),this.$el.dispatchEvent(new CustomEvent("reset",{bubbles:!0})))},showLoader(){this.loaderTimeout===null&&(this.loader=!0,this.loaderTimeout=window.setTimeout(()=>{this.loaderTimeout=null,this.loader=!1,this.showResults()},2e3))},showResults(){const t=p(this.answers);this.plan=this.plans.find(({id:e})=>e===t)??null,this.$track.event(`${o} - Completed`,{cta_link:this.plan?.primaryCta.url},!1)},async loadData(){this.error=!1;try{const t=h[document.documentElement.lang]??"gb",e=await fetch(`/api/product-quiz/${t}.json`);if(!e.ok)throw new Error(`HTTP ${e.status}`);const i=await e.json();this.questions=i.result.data.questions,this.plans=i.result.data.plans}catch(t){console.error("productQuiz",t),this.error=!0}},init(){this.loadData().catch(()=>{}),this.hashChangeHandler=()=>this.handleHash(),window.addEventListener("hashchange",this.hashChangeHandler),this.$nextTick(()=>{this.handleHash()})}}}export{w as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.