@20minutes/tyr 0.1.13 → 0.1.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- (function(){"use strict";const F={HEADER_AD:'[[1,1], "fluid"]',BAN_ATF:"[[1,1], [728,90], [970,250], [980,250], [1000,90], [1000,250], [1600,1200]]",PAVE_ATF:"[[1,1], [300,250], [300,600]]",BAN_BTF:"[[1,1], [728,90], [970,90], [970,250], [980,250], [1000,90], [1000,250]]",ARTICLE_BTF:"[[1,1], [300,168], [300,250], [320,50], [320,100], [320,480]]"};var u=(t=>(t.UNKNOWN="Non connu",t.SLIDESHOW_COVER="Slideshow cover",t.SLIDESHOW_COVER_LISTING_PAGE="Slideshow listing page",t.SLIDESHOW_PAGE="Slideshow page",t.ARTICLE="article",t.MISC="divers",t.HOME="home",t.LIVE="live",t.SECTION="section",t.TAG="tag",t))(u||{}),g=(t=>(t.MISC="divers",t.HOME="home",t.LOCAL="local",t.PLANET="plan\xE8te",t))(g||{}),w=(t=>(t.PAGETYPE="pageType",t.TAGS="tags",t))(w||{});const V=t=>{var e,n,o,a;switch(t){case"pageType":return Object.values(u).includes((e=window.datalayer)==null?void 0:e.page_type)?(n=window.datalayer.page_type)==null?void 0:n.toLowerCase():u.MISC;case"tags":return Object.values(g).includes((o=window.datalayer)==null?void 0:o.tags)?(a=window.datalayer.tags)==null?void 0:a.toLowerCase():g.MISC}return window.datalayer[t]},R=()=>{window.dfp=window.dfp||{},window.dfp.targeting=window.dfp.targeting||{},Object.values(w).forEach(t=>{window.dfp.targeting[t]=V(t)})},B=t=>{var e;const n=t instanceof Array?t:[t];window.dfp.slots=((e=window.dfp)==null?void 0:e.slots)||[],window.dfp.slots=[...window.dfp.slots,...n]},U=t=>{window.dfp.slotsReady=!1;const e=[];googletag.cmd.push(()=>{document.querySelectorAll("div[data-dfp-path]").forEach(n=>{const o=n.getAttribute("data-dfp-name"),a=n.getAttribute("data-dfp-path"),l=n.getAttribute("id"),s=o&&JSON.parse(F[o.toUpperCase()])||null;if(l&&o&&a&&s&&googletag){const c=googletag.defineSlot([a,o].join("/"),s,l);if(!c)return;c.addService(googletag.pubads()),e.push({slotElementId:c.getSlotElementId(),path:a,sizes:JSON.stringify(s)}),Object.entries(t).map(([Ne,je])=>c.setTargeting(Ne,je))}})}),window.dfp.slotsReady=!0,B(e)};let v=!1,y=0;const q=1500,p="renderAd",H=()=>v||googletag&&googletag.pubadsReady&&window.dfp.slotsReady&&window.dfp.hubvisorEnd,f=t=>{googletag&&googletag.cmd.push(()=>{const e={};googletag.pubads().getSlots().forEach(o=>{e[o.getSlotElementId()]=o});const n=[];t.forEach(o=>{e[o]&&n.push(e[o])}),n.length&&googletag.pubads().refresh(n)})},z=()=>{document.addEventListener(p,t=>{if(!t.target)return;const e=t;e&&e.target.closest("[data-dfp-name]")&&e.detail.length&&f([e.detail[0].id])},!0)},G=()=>{const t=document.querySelectorAll('div[data-dfp-name][data-delayed="true"]');Array.prototype.forEach.call(t,e=>{e.addEventListener(e.getAttribute("id"),function n(){e.dispatchEvent(new CustomEvent(p,{detail:[{id:e.getAttribute("id")}]})),e.removeEventListener(p,n)})})},J=()=>{const t=[],e=document.querySelectorAll('div[data-dfp-name][data-delayed="false"]');e.length>0&&Array.prototype.forEach.call(e,n=>{t.push(n.getAttribute("id"))}),f(t)},K=()=>{const t=setInterval(()=>{if(!H&&y<q){y+=100;return}clearInterval(t),v=!0,z(),window.addEventListener("DOMContentLoaded",()=>{J(),G()})},100)},W=()=>{googletag.cmd.push(()=>{googletag.pubads().setTargeting("lang","fr"),googletag.pubads().setTargeting("dn",window.location.hostname);try{const e=window.location.href.split("?")[1];e&&e.split("&").forEach(n=>{const o=n.split("=");o[0]==="20minutest"&&googletag.pubads().setTargeting(o[0],o[1])})}catch{}googletag.pubads().enableSingleRequest(),googletag.pubads().disableInitialLoad(),googletag.enableServices();const t=Math.max(document.documentElement.clientWidth,window.innerWidth||0);t>=1400?googletag.pubads().setTargeting("screen",["1400","1000"]):t>=1e3&&googletag.pubads().setTargeting("screen","1000")})},_=t=>{const e=document.cookie.split(";").filter(n=>n.indexOf(t)!==-1)[0];return e?e.split("=")[1]:"{}"},d=t=>{const e=[`${t.name}=`,"expires=Thu, 1 Jan 1970 00:00:01 UTC","path=/"];t.domain&&e.push(`domain=${t.domain}`),document.cookie=e.join("; ")},h=t=>{document.cookie.split(";").map(e=>e.split("=")[0].trim()).filter(e=>t.indexOf(e)===-1).forEach(e=>{const{hostname:n}=window.location;d({name:e}),d({name:e,domain:n.substring(n.indexOf(".")+1)}),d({name:e,domain:n.substring(n.indexOf("."))}),d({name:e,domain:`.${n}`})})},b=t=>{for(let e=0;e<sessionStorage.length;e+=1){const n=sessionStorage.key(e);n&&t.indexOf(n)===-1&&sessionStorage.removeItem(n)}},E=t=>{for(let e=0;e<localStorage.length;e+=1){const n=localStorage.key(e);n&&t.indexOf(n)===-1&&localStorage.removeItem(n)}};function Y(t){let e=t;const n="\xE3\xE0\xE1\xE4\xE2\u1EBD\xE8\xE9\xEB\xEA\xEC\xED\xEF\xEE\xF5\xF2\xF3\xF6\xF4\xF9\xFA\xFC\xFB\xF1\xE7\xB7/_,:;",o="aaaaaeeeeeiiiiooooouuuunc------";for(let a=0;a<n.length;a+=1)e=t.replace(new RegExp(n.charAt(a),"g"),o.charAt(a));return e}const r=t=>{let e=t.toLowerCase().replace(/[\s-]+/g,"_");return e=Y(e),e.replace(/[^\w-]+/g,"")},Q=(t,e=100)=>{const n=t.getBoundingClientRect(),o=window.pageYOffset||document.documentElement.scrollTop,a=Math.max(document.documentElement.clientHeight,window.innerHeight||0),l=o+a,s=n.top+o;return l>s-e},X=()=>document.body.dataset.device,S=()=>{const t=new URLSearchParams(window.location.search);return Object.fromEntries(t.entries())},T=["20mnToken","20mnUserDataLayer","20mnTutorial","20mnUserInfo","20mnUserSession","_vfa","_vfb","_vfz","atauthority","atid","atidvisitor","atidx","atuserid","didomi_token","euconsent-v2","_pbjs_userid_consent_data","osano_consentmanager","osano_consentmanager_expdate","osano_consentmanager_uuid","SESSIDSF","SESSIDSFRM","TCPID","TSTD","ei_client_id","_biz_pendingA","_biz_flagsA","_biz_uid","_biz_nA","ajs_group_id","ajs_user_id","ajs_anonymous_id","TSNGUID","_mkto_trk","JSESSIONID","staging-login_idle_session_timeout","login_service_login_newrelic_com_tokens","login_idle_session_timeout","lang","auth_expiration_timestamp","sticky-scorecast-business-chat","__utna","__utnv","auth_token","PHPSESSID","sticky-scorecast-business-app","sticky-scorecast-prod-app","realm"],I=["_vf_sid","consent_validity_date","20mn-articlesSaved","20mn-font","closedInfo","20mn-known-user","20mn-block-links","20mnBreakingNewsBanner","20mnAppBanner","20mn-visits-content","20minutes-font"],O=["vfThirdpartyCookiesEnabled","com.batch.sessionId","loadIntrasticial"],Z=()=>{window.didomiOnReady.push(()=>{let t=new Date;const e=t.getTimezoneOffset();t=new Date(t.getTime()-e*60*1e3);const n=t.toISOString().split("T")[0],o=localStorage.getItem("consent_validity_date");o&&n>o&&(window.Didomi.reset(),localStorage.removeItem("consent_validity_date"),window.disapproveDidomiGTMEvents=!0,h(T),E(I),b(O),window.Didomi.notice.show())})},ee=()=>{window.didomiEventListeners.push({event:"notice.clickagree",listener:()=>{console.log("notice.clickagree")}}),window.didomiEventListeners.push({event:"notice.clickmoreinfo",listener:()=>{console.log("notice.clickmoreinfo")}}),window.didomiEventListeners.push({event:"notice.clickdisagree",listener:()=>{console.log("notice.clickdisagree")}})},te=()=>{window.cmpVariables={consentEventsCount:0},window.didomiEventListeners.push({event:"consent.changed",listener:()=>{const t=_("euconsent-v2"),e=window.cmpVariables.consentEventsCount>0?!0:!!t,n=!window.Didomi.getUserConsentStatusForPurpose("Cookies"),o=window.sessionStorage.getItem("cmpModal");e&&!o&&(n&&(h(T),E(I),b(O)),setTimeout(()=>{window.location.reload()})),o&&window.sessionStorage.removeItem("cmpModal"),window.cmpVariables.consentEventsCount+=1}})},ne=()=>{window.didomiEventListeners=window.didomiEventListeners||[],window.didomiEventListeners.push({event:"consent.changed",listener:()=>{var t,e;(e=(t=window.ATInternet)==null?void 0:t.Tracker)!=null&&e.instances&&window.ATInternet.Tracker.instances.forEach(n=>{n.privacy.getVisitorMode().name!=="optout"&&(n.privacy.setVisitorMode("cnil","exempt"),window.Didomi.getUserConsentStatusForPurpose("mesureda-6qyqaZXC")&&n.privacy.setVisitorOptin())})}})},oe=()=>{ne()};var ae=Object.defineProperty,A=Object.getOwnPropertySymbols,re=Object.prototype.hasOwnProperty,ie=Object.prototype.propertyIsEnumerable,k=(t,e,n)=>e in t?ae(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,m=(t,e)=>{for(var n in e||(e={}))re.call(e,n)&&k(t,n,e[n]);if(A)for(var n of A(e))ie.call(e,n)&&k(t,n,e[n]);return t};const se=()=>{var t;return{page_uri:"/",page_type:((t=window.datalayer)==null?void 0:t.pageType)||"divers"}},de=()=>({darkmode:"0"}),le=()=>{var t,e;return{signature:((t=window.datalayer)==null?void 0:t.signature)||void 0,nbParagraphs:((e=window.datalayer)==null?void 0:e.nbParagraphs)||void 0}},ce=({signature:t,nbParagraphs:e}={})=>{window.datalayer=window.datalayer||{},window.datalayer.signature=t||"",e&&(window.datalayer.nbParagraphs=e)},ue=()=>{const t=se(),e=de(),n=le();window.datalayer=m(m(m({},t),e),n)};let i=[],C;const ge=(t,e)=>{let n=!1;return()=>{n||(t(),n=!0,C=setTimeout(()=>{n=!1},e))}},pe=t=>t.event&&Q(t.elem,Number(t.distance))?(t.elem.dispatchEvent(new Event(t.event)),t.elem.dataset.lazyLoaded="true",!1):!0,x=()=>{ge(()=>{i=i.filter(pe),i.length<=0&&(clearTimeout(C),window.removeEventListener("scroll",x))},50)()},me=()=>{i.length<=0||window.addEventListener("scroll",x)},we=t=>{i.push(t),me()},ve=t=>{t.forEach(e=>{const n={elem:e,event:e.getAttribute("id"),distance:e.dataset.distanceVisible};we(n)})},L=(t,e,n=()=>{})=>{performance.mark(`20mn:${t}:Start`);const o=document.getElementsByTagName("script")[0],a=document.createElement("script");a.async=!0,a.src=e,a.onload=()=>{n(),performance.mark(`20mn:${t}:End`)},o&&o.parentNode&&o.parentNode.insertBefore(a,o)};var ye=Object.defineProperty,D=Object.getOwnPropertySymbols,fe=Object.prototype.hasOwnProperty,_e=Object.prototype.propertyIsEnumerable,P=(t,e,n)=>e in t?ye(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,$=(t,e)=>{for(var n in e||(e={}))fe.call(e,n)&&P(t,n,e[n]);if(D)for(var n of D(e))_e.call(e,n)&&P(t,n,e[n]);return t};const he=()=>{const t=window.datalayer,e={};if(e["b:user_darkmode"]=t.darkmode==="1",e["b:user_status"]=t.user_status==="Connecte",e["b:user_status"]){const n=_("20mnUserDataLayer"),o=n?JSON.parse(decodeURIComponent(n)):null;o&&(e["s:user_id"]=String(o.i),Number.isNaN(o.d)||(e["n:user_a"]=parseInt(o.d,10)),Number.isNaN(o.l)||(e["n:user_zip"]=parseInt(o.l,10)),Number.isNaN(o.g)||(e["n:user_g"]=parseInt(o.g,10)))}return e},be=()=>{var t,e,n;const o={},a=S();return("utm_source"in a||"utm_campaign"in a||"utm_medium"in a)&&("utm_source"in a||(o.utm_source=(t=a.utm_medium)!=null?t:a.utm_campaign),"utm_campaign"in a||(o.utm_campaign=(e=a.utm_source)!=null?e:a.utm_medium),"utm_medium"in a||(o.utm_medium=(n=a.utm_source)!=null?n:a.utm_campaign)),o},Ee=()=>{var t;const e=window.datalayer,n={};n["b:user_adblock"]=e.adblock==="1",n["s:page_url_raw"]=window.location.href,e.source_type&&(n["s:content_source"]=e.source_type),e.referrer&&(n["s:misc_referrer"]=e.referrer),n["s:page_type"]=e.page_type||"other";const o=document.querySelector("link[rel='canonical']");if(o&&(n["s:page_canonical"]=(t=o.getAttribute("href"))!=null?t:""),e.chapter4&&(n["s:chapter4"]=e.chapter4),e.page_uri==="/search"){const a=S();n["s:misc_search"]=a.q||""}return $($({},n),he())};var Se=Object.defineProperty,Te=Object.defineProperties,Ie=Object.getOwnPropertyDescriptors,N=Object.getOwnPropertySymbols,Oe=Object.prototype.hasOwnProperty,Ae=Object.prototype.propertyIsEnumerable,j=(t,e,n)=>e in t?Se(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,M=(t,e)=>{for(var n in e||(e={}))Oe.call(e,n)&&j(t,n,e[n]);if(N)for(var n of N(e))Ae.call(e,n)&&j(t,n,e[n]);return t},ke=(t,e)=>Te(t,Ie(e));const Ce=()=>{L("ATInternet","https://www.20minutes.fr/js/script-at.js")},xe=()=>{window.ATInternet={onTrackerLoad:()=>{var t,e,n;if(window.ATInternet.Tracker){const o=new window.ATInternet.Tracker.Tag;o.privacy.getVisitorMode()===null&&o.privacy.setVisitorMode("cnil","exempt");const a=window.datalayer.article_section?r(window.datalayer.article_section):"";o.page.set({name:window.datalayer.libelle?r(window.datalayer.libelle):"",chapter1:window.datalayer.chapter1?r(window.datalayer.chapter1):a,chapter2:window.datalayer.chapter2?r(window.datalayer.chapter2):"",chapter3:window.datalayer.chapter3?r(window.datalayer.chapter3):"",customObject:{device:X()==="desktop"?"desktop":"smartphone"}}),o.customVars.set({site:{2:(t=window.datalayer.content_id)!=null?t:""}}),o.setProps(ke(M(M({},Ee()),be()),{"b:pageview_with_consent":o.privacy.getVisitorMode().name==="optin","s:site_level2":window.location.hostname}),!0),o.identifiedVisitor.set({id:(e=window.datalayer.ac)!=null?e:"",category:(n=window.datalayer.an)!=null?n:""}),o.dispatch()}}}},Le=()=>{window.addEventListener("DOMContentLoaded",()=>{xe(),Ce()})},De=()=>{!document.querySelector(".gcse-search")||L("googlesearch","https://cse.google.com/cse.js?cx=954c975a1d4164f88")},Pe=()=>{var t;return(t=Array.from(document.querySelectorAll(".c-tags--breadcrumb")))==null?void 0:t.reduce((e,n)=>e+n.innerHTML,"")},$e=()=>{window.gtmDatalayer=window.gtmDatalayer||[];const t=document.cookie.match("(^|;)\\s*20mnUserDataLayer\\s*=\\s*([^;]+)"),e=t?JSON.parse(decodeURIComponent(t.pop())):null;window.gtmDatalayer=[{page_uri:window.location.pathname,user_status:window.datalayer.user_status,referrer:document.referrer,breadcrumb:Pe(),user:{d:e?.d||null,g:e?.g||null,i:e?.i||null,l:e?.l||null,o:e?.o||null}}]};(()=>{ce(),ue(),$e(),Z(),oe(),te(),ee(),W(),R(),U(window.dfp.targeting),K(),Le(),ve(document.querySelectorAll('[data-delayed="true"]')),De()})()})();
1
+ (function(){"use strict";const F={HEADER_AD:'[[1,1], "fluid"]',BAN_ATF:"[[1,1], [728,90], [970,250], [980,250], [1000,90], [1000,250], [1600,1200]]",PAVE_ATF:"[[1,1], [300,250], [300,600]]",BAN_BTF:"[[1,1], [728,90], [970,90], [970,250], [980,250], [1000,90], [1000,250]]",ARTICLE_BTF:"[[1,1], [300,168], [300,250], [320,50], [320,100], [320,480]]"};var u=(t=>(t.UNKNOWN="Non connu",t.SLIDESHOW_COVER="Slideshow cover",t.SLIDESHOW_COVER_LISTING_PAGE="Slideshow listing page",t.SLIDESHOW_PAGE="Slideshow page",t.ARTICLE="article",t.MISC="divers",t.HOME="home",t.LIVE="live",t.SECTION="section",t.TAG="tag",t))(u||{}),g=(t=>(t.MISC="divers",t.HOME="home",t.LOCAL="local",t.PLANET="plan\xE8te",t))(g||{}),w=(t=>(t.PAGETYPE="pageType",t.TAGS="tags",t))(w||{});const V=t=>{var e,n,o,a;switch(t){case"pageType":return Object.values(u).includes((e=window.datalayer)==null?void 0:e.page_type)?(n=window.datalayer.page_type)==null?void 0:n.toLowerCase():u.MISC;case"tags":return Object.values(g).includes((o=window.datalayer)==null?void 0:o.tags)?(a=window.datalayer.tags)==null?void 0:a.toLowerCase():g.MISC}return window.datalayer[t]},R=()=>{window.dfp=window.dfp||{},window.dfp.targeting=window.dfp.targeting||{},Object.values(w).forEach(t=>{window.dfp.targeting[t]=V(t)})},B=t=>{var e;const n=t instanceof Array?t:[t];window.dfp.slots=((e=window.dfp)==null?void 0:e.slots)||[],window.dfp.slots=[...window.dfp.slots,...n]},U=t=>{window.dfp.slotsReady=!1;const e=[];googletag.cmd.push(()=>{document.querySelectorAll("div[data-dfp-path]").forEach(n=>{const o=n.getAttribute("data-dfp-name"),a=n.getAttribute("data-dfp-path"),l=n.getAttribute("id"),s=o&&JSON.parse(F[o.toUpperCase()])||null;if(l&&o&&a&&s&&googletag){const c=googletag.defineSlot([a,o].join("/"),s,l);if(!c)return;c.addService(googletag.pubads()),e.push({slotElementId:c.getSlotElementId(),path:a,sizes:JSON.stringify(s)}),Object.entries(t).map(([Ne,je])=>c.setTargeting(Ne,je))}})}),window.dfp.slotsReady=!0,B(e)};let v=!1,y=0;const q=1500,p="renderAd",z=()=>v||googletag&&googletag.pubadsReady&&window.dfp.slotsReady&&window.dfp.hubvisorEnd,f=t=>{googletag&&googletag.cmd.push(()=>{const e={};googletag.pubads().getSlots().forEach(o=>{e[o.getSlotElementId()]=o});const n=[];t.forEach(o=>{e[o]&&n.push(e[o])}),n.length&&googletag.pubads().refresh(n)})},H=()=>{document.addEventListener(p,t=>{if(!t.target)return;const e=t;e&&e.target.closest("[data-dfp-name]")&&e.detail.length&&f([e.detail[0].id])},!0)},G=()=>{const t=document.querySelectorAll('div[data-dfp-name][data-delayed="true"]');Array.prototype.forEach.call(t,e=>{e.addEventListener(e.getAttribute("id"),function n(){e.dispatchEvent(new CustomEvent(p,{detail:[{id:e.getAttribute("id")}]})),e.removeEventListener(p,n)})})},J=()=>{const t=[],e=document.querySelectorAll('div[data-dfp-name][data-delayed="false"]');e.length>0&&Array.prototype.forEach.call(e,n=>{t.push(n.getAttribute("id"))}),f(t)},K=()=>{const t=setInterval(()=>{if(!z&&y<q){y+=100;return}clearInterval(t),v=!0,H(),window.addEventListener("DOMContentLoaded",()=>{J(),G()})},100)},W=()=>{googletag.cmd.push(()=>{googletag.pubads().setTargeting("lang","fr"),googletag.pubads().setTargeting("dn",window.location.hostname);try{const e=window.location.href.split("?")[1];e&&e.split("&").forEach(n=>{const o=n.split("=");o[0]==="20minutest"&&googletag.pubads().setTargeting(o[0],o[1])})}catch{}googletag.pubads().enableSingleRequest(),googletag.pubads().disableInitialLoad(),googletag.enableServices();const t=Math.max(document.documentElement.clientWidth,window.innerWidth||0);t>=1400?googletag.pubads().setTargeting("screen",["1400","1000"]):t>=1e3&&googletag.pubads().setTargeting("screen","1000")})},_=t=>{const e=document.cookie.split(";").filter(n=>n.indexOf(t)!==-1)[0];return e?e.split("=")[1]:"{}"},d=t=>{const e=[`${t.name}=`,"expires=Thu, 1 Jan 1970 00:00:01 UTC","path=/"];t.domain&&e.push(`domain=${t.domain}`),document.cookie=e.join("; ")},h=t=>{document.cookie.split(";").map(e=>e.split("=")[0].trim()).filter(e=>t.indexOf(e)===-1).forEach(e=>{const{hostname:n}=window.location;d({name:e}),d({name:e,domain:n.substring(n.indexOf(".")+1)}),d({name:e,domain:n.substring(n.indexOf("."))}),d({name:e,domain:`.${n}`})})},b=t=>{for(let e=0;e<sessionStorage.length;e+=1){const n=sessionStorage.key(e);n&&t.indexOf(n)===-1&&sessionStorage.removeItem(n)}},E=t=>{for(let e=0;e<localStorage.length;e+=1){const n=localStorage.key(e);n&&t.indexOf(n)===-1&&localStorage.removeItem(n)}};function Y(t){let e=t;const n="\xE3\xE0\xE1\xE4\xE2\u1EBD\xE8\xE9\xEB\xEA\xEC\xED\xEF\xEE\xF5\xF2\xF3\xF6\xF4\xF9\xFA\xFC\xFB\xF1\xE7\xB7/_,:;",o="aaaaaeeeeeiiiiooooouuuunc------";for(let a=0;a<n.length;a+=1)e=t.replace(new RegExp(n.charAt(a),"g"),o.charAt(a));return e}const r=t=>{let e=t.toLowerCase().replace(/[\s-]+/g,"_");return e=Y(e),e.replace(/[^\w-]+/g,"")},Q=(t,e=100)=>{const n=t.getBoundingClientRect(),o=window.pageYOffset||document.documentElement.scrollTop,a=Math.max(document.documentElement.clientHeight,window.innerHeight||0),l=o+a,s=n.top+o;return l>s-e},X=()=>document.body.dataset.device,S=()=>{const t=new URLSearchParams(window.location.search);return Object.fromEntries(t.entries())},T=["20mnToken","20mnUserDataLayer","20mnTutorial","20mnUserInfo","20mnUserSession","_vfa","_vfb","_vfz","atauthority","atid","atidvisitor","atidx","atuserid","didomi_token","euconsent-v2","_pbjs_userid_consent_data","osano_consentmanager","osano_consentmanager_expdate","osano_consentmanager_uuid","SESSIDSF","SESSIDSFRM","TCPID","TSTD","ei_client_id","_biz_pendingA","_biz_flagsA","_biz_uid","_biz_nA","ajs_group_id","ajs_user_id","ajs_anonymous_id","TSNGUID","_mkto_trk","JSESSIONID","staging-login_idle_session_timeout","login_service_login_newrelic_com_tokens","login_idle_session_timeout","lang","auth_expiration_timestamp","sticky-scorecast-business-chat","__utna","__utnv","auth_token","PHPSESSID","sticky-scorecast-business-app","sticky-scorecast-prod-app","realm"],O=["_vf_sid","consent_validity_date","20mn-articlesSaved","20mn-font","closedInfo","20mn-known-user","20mn-block-links","20mnBreakingNewsBanner","20mnAppBanner","20mn-visits-content","20minutes-font"],I=["vfThirdpartyCookiesEnabled","com.batch.sessionId","loadIntrasticial"],Z=()=>{window.didomiOnReady.push(()=>{let t=new Date;const e=t.getTimezoneOffset();t=new Date(t.getTime()-e*60*1e3);const n=t.toISOString().split("T")[0],o=localStorage.getItem("consent_validity_date");o&&n>o&&(window.Didomi.reset(),localStorage.removeItem("consent_validity_date"),window.disapproveDidomiGTMEvents=!0,h(T),E(O),b(I),window.Didomi.notice.show())})},ee=()=>{window.didomiEventListeners.push({event:"notice.clickagree",listener:()=>{console.log("notice.clickagree")}}),window.didomiEventListeners.push({event:"notice.clickmoreinfo",listener:()=>{console.log("notice.clickmoreinfo")}}),window.didomiEventListeners.push({event:"notice.clickdisagree",listener:()=>{console.log("notice.clickdisagree")}})},te=()=>{window.cmpVariables={consentEventsCount:0},window.didomiEventListeners.push({event:"consent.changed",listener:()=>{const t=_("euconsent-v2"),e=window.cmpVariables.consentEventsCount>0?!0:!!t,n=!window.Didomi.getUserConsentStatusForPurpose("Cookies"),o=window.sessionStorage.getItem("cmpModal");e&&!o&&(n&&(h(T),E(O),b(I)),setTimeout(()=>{window.location.reload()})),o&&window.sessionStorage.removeItem("cmpModal"),window.cmpVariables.consentEventsCount+=1}})},ne=()=>{window.didomiEventListeners=window.didomiEventListeners||[],window.didomiEventListeners.push({event:"consent.changed",listener:()=>{var t,e;(e=(t=window.ATInternet)==null?void 0:t.Tracker)!=null&&e.instances&&window.ATInternet.Tracker.instances.forEach(n=>{n.privacy.getVisitorMode().name!=="optout"&&(n.privacy.setVisitorMode("cnil","exempt"),window.Didomi.getUserConsentStatusForPurpose("mesureda-6qyqaZXC")&&n.privacy.setVisitorOptin())})}})},oe=()=>{ne()};var ae=Object.defineProperty,A=Object.getOwnPropertySymbols,re=Object.prototype.hasOwnProperty,ie=Object.prototype.propertyIsEnumerable,k=(t,e,n)=>e in t?ae(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,m=(t,e)=>{for(var n in e||(e={}))re.call(e,n)&&k(t,n,e[n]);if(A)for(var n of A(e))ie.call(e,n)&&k(t,n,e[n]);return t};const se=()=>{var t;return{page_uri:"/",page_type:((t=window.datalayer)==null?void 0:t.pageType)||"divers"}},de=()=>({darkmode:"0"}),le=()=>{var t,e;return{signature:((t=window.datalayer)==null?void 0:t.signature)||void 0,nbParagraphs:((e=window.datalayer)==null?void 0:e.nbParagraphs)||void 0}},ce=({signature:t,nbParagraphs:e}={})=>{window.datalayer=window.datalayer||{},window.datalayer.signature=t||"",e&&(window.datalayer.nbParagraphs=e)},ue=()=>{const t=se(),e=de(),n=le();window.datalayer=m(m(m({},t),e),n)};let i=[],L;const ge=(t,e)=>{let n=!1;return()=>{n||(t(),n=!0,L=setTimeout(()=>{n=!1},e))}},pe=t=>t.event&&Q(t.elem,Number(t.distance))?(t.elem.dispatchEvent(new Event(t.event)),t.elem.dataset.lazyLoaded="true",!1):!0,C=()=>{ge(()=>{i=i.filter(pe),i.length<=0&&(clearTimeout(L),window.removeEventListener("scroll",C))},50)()},me=()=>{i.length<=0||window.addEventListener("scroll",C)},we=t=>{i.push(t),me()},ve=()=>{window.addEventListener("DOMContentLoaded",()=>{document.querySelectorAll('[data-delayed="true"]').forEach(t=>{const e={elem:t,event:t.getAttribute("id"),distance:t.dataset.distanceVisible};we(e)})})},x=(t,e,n=()=>{})=>{performance.mark(`20mn:${t}:Start`);const o=document.getElementsByTagName("script")[0],a=document.createElement("script");a.async=!0,a.src=e,a.onload=()=>{n(),performance.mark(`20mn:${t}:End`)},o&&o.parentNode&&o.parentNode.insertBefore(a,o)};var ye=Object.defineProperty,D=Object.getOwnPropertySymbols,fe=Object.prototype.hasOwnProperty,_e=Object.prototype.propertyIsEnumerable,P=(t,e,n)=>e in t?ye(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,$=(t,e)=>{for(var n in e||(e={}))fe.call(e,n)&&P(t,n,e[n]);if(D)for(var n of D(e))_e.call(e,n)&&P(t,n,e[n]);return t};const he=()=>{const t=window.datalayer,e={};if(e["b:user_darkmode"]=t.darkmode==="1",e["b:user_status"]=t.user_status==="Connecte",e["b:user_status"]){const n=_("20mnUserDataLayer"),o=n?JSON.parse(decodeURIComponent(n)):null;o&&(e["s:user_id"]=String(o.i),Number.isNaN(o.d)||(e["n:user_a"]=parseInt(o.d,10)),Number.isNaN(o.l)||(e["n:user_zip"]=parseInt(o.l,10)),Number.isNaN(o.g)||(e["n:user_g"]=parseInt(o.g,10)))}return e},be=()=>{var t,e,n;const o={},a=S();return("utm_source"in a||"utm_campaign"in a||"utm_medium"in a)&&("utm_source"in a||(o.utm_source=(t=a.utm_medium)!=null?t:a.utm_campaign),"utm_campaign"in a||(o.utm_campaign=(e=a.utm_source)!=null?e:a.utm_medium),"utm_medium"in a||(o.utm_medium=(n=a.utm_source)!=null?n:a.utm_campaign)),o},Ee=()=>{var t;const e=window.datalayer,n={};n["b:user_adblock"]=e.adblock==="1",n["s:page_url_raw"]=window.location.href,e.source_type&&(n["s:content_source"]=e.source_type),e.referrer&&(n["s:misc_referrer"]=e.referrer),n["s:page_type"]=e.page_type||"other";const o=document.querySelector("link[rel='canonical']");if(o&&(n["s:page_canonical"]=(t=o.getAttribute("href"))!=null?t:""),e.chapter4&&(n["s:chapter4"]=e.chapter4),e.page_uri==="/search"){const a=S();n["s:misc_search"]=a.q||""}return $($({},n),he())};var Se=Object.defineProperty,Te=Object.defineProperties,Oe=Object.getOwnPropertyDescriptors,N=Object.getOwnPropertySymbols,Ie=Object.prototype.hasOwnProperty,Ae=Object.prototype.propertyIsEnumerable,j=(t,e,n)=>e in t?Se(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,M=(t,e)=>{for(var n in e||(e={}))Ie.call(e,n)&&j(t,n,e[n]);if(N)for(var n of N(e))Ae.call(e,n)&&j(t,n,e[n]);return t},ke=(t,e)=>Te(t,Oe(e));const Le=()=>{x("ATInternet","https://www.20minutes.fr/js/script-at.js")},Ce=()=>{window.ATInternet={onTrackerLoad:()=>{var t,e,n;if(window.ATInternet.Tracker){const o=new window.ATInternet.Tracker.Tag;o.privacy.getVisitorMode()===null&&o.privacy.setVisitorMode("cnil","exempt");const a=window.datalayer.article_section?r(window.datalayer.article_section):"";o.page.set({name:window.datalayer.libelle?r(window.datalayer.libelle):"",chapter1:window.datalayer.chapter1?r(window.datalayer.chapter1):a,chapter2:window.datalayer.chapter2?r(window.datalayer.chapter2):"",chapter3:window.datalayer.chapter3?r(window.datalayer.chapter3):"",customObject:{device:X()==="desktop"?"desktop":"smartphone"}}),o.customVars.set({site:{2:(t=window.datalayer.content_id)!=null?t:""}}),o.setProps(ke(M(M({},Ee()),be()),{"b:pageview_with_consent":o.privacy.getVisitorMode().name==="optin","s:site_level2":window.location.hostname}),!0),o.identifiedVisitor.set({id:(e=window.datalayer.ac)!=null?e:"",category:(n=window.datalayer.an)!=null?n:""}),o.dispatch()}}}},xe=()=>{window.addEventListener("DOMContentLoaded",()=>{Ce(),Le()})},De=()=>{window.addEventListener("DOMContentLoaded",()=>{!document.querySelector(".gcse-search")||x("googlesearch","https://cse.google.com/cse.js?cx=954c975a1d4164f88")})},Pe=()=>{var t;return(t=Array.from(document.querySelectorAll(".c-tags--breadcrumb")))==null?void 0:t.reduce((e,n)=>e+n.innerHTML,"")},$e=()=>{window.gtmDatalayer=window.gtmDatalayer||[];const t=document.cookie.match("(^|;)\\s*20mnUserDataLayer\\s*=\\s*([^;]+)"),e=t?JSON.parse(decodeURIComponent(t.pop())):null;window.gtmDatalayer=[{page_uri:window.location.pathname,user_status:window.datalayer.user_status,referrer:document.referrer,breadcrumb:Pe(),user:{d:e?.d||null,g:e?.g||null,i:e?.i||null,l:e?.l||null,o:e?.o||null}}]};(()=>{ce(),ue(),$e(),Z(),oe(),te(),ee(),W(),R(),U(window.dfp.targeting),K(),xe(),ve(),De()})()})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@20minutes/tyr",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
4
4
  "repository": "git@github.com:20minutes/tyr.git",
5
5
  "license": "MIT",
6
6
  "author": "20 Minutes",
@@ -58,11 +58,11 @@
58
58
  "@storybook/testing-library": "0.0.13",
59
59
  "@types/googletag": "^2.2.5",
60
60
  "@types/jest": "^29.2.0",
61
- "@types/react": "^18.0.22",
61
+ "@types/react": "^18.0.23",
62
62
  "@types/react-dom": "^18.0.7",
63
63
  "@typescript-eslint/eslint-plugin": "^5.41.0",
64
64
  "@typescript-eslint/parser": "^5.41.0",
65
- "@vitejs/plugin-react": "^2.1.0",
65
+ "@vitejs/plugin-react": "^2.2.0",
66
66
  "babel-loader": "^8.2.5",
67
67
  "eslint": "^8.26.0",
68
68
  "eslint-config-airbnb": "^19.0.4",
@@ -75,7 +75,7 @@
75
75
  "eslint-plugin-react": "^7.31.10",
76
76
  "eslint-plugin-simple-import-sort": "^8.0.0",
77
77
  "husky": "^8.0.1",
78
- "jest": "^29.2.1",
78
+ "jest": "^29.2.2",
79
79
  "lint-staged": "^13.0.3",
80
80
  "prettier": "^2.7.1",
81
81
  "purgecss": "^5.0.0",
@@ -85,6 +85,6 @@
85
85
  "ts-jest": "^29.0.3",
86
86
  "ts-node": "^10.9.1",
87
87
  "typescript": "^4.6.4",
88
- "vite": "^3.1.8"
88
+ "vite": "^3.2.0"
89
89
  }
90
90
  }