tm.jsuol.com.br
Open in
urlscan Pro
2600:9000:214f:7a00:6:9eb2:5cc0:93a1
Public Scan
URL:
https://tm.jsuol.com.br/modules/dmp-uol-sync-p.js
Submission: On December 30 via api from LU — Scanned from DE
Submission: On December 30 via api from LU — Scanned from DE
Form analysis
0 forms found in the DOMText Content
!function(e){var t={};function a(r){if(t[r])return t[r].exports;var n=t[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,a),n.l=!0,n.exports}a.m=e,a.c=t,a.d=function(e,t,r){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(a.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)a.d(r,n,function(t){return e[t]}.bind(null,n));return r},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="",a(a.s=0)}([function(e,t,a){"use strict";function r(e,t,a,r,n,o,i){try{var s=e[o](i),c=s.value}catch(e){return void a(e)}s.done?t(c):Promise.resolve(c).then(r,n)}function n(e){return function(){var t=this,a=arguments;return new Promise((function(n,o){var i=e.apply(t,a);function s(e){r(i,n,o,s,c,"next",e)}function c(e){r(i,n,o,s,c,"throw",e)}s(void 0)}))}}function o(e){return i.apply(this,arguments)}function i(){return(i=n((function*(e){var t=new TextEncoder("utf-8").encode(e),a=yield crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(a)).map((function(e){return("00"+e.toString(16)).slice(-2)})).join("")}))).apply(this,arguments)}function s(e,t,a,r,n,o,i){try{var s=e[o](i),c=s.value}catch(e){return void a(e)}s.done?t(c):Promise.resolve(c).then(r,n)}function c(e){return function(){var t=this,a=arguments;return new Promise((function(r,n){var o=e.apply(t,a);function i(e){s(o,r,n,i,c,"next",e)}function c(e){s(o,r,n,i,c,"throw",e)}i(void 0)}))}}a.r(t);var l="https://udr.uol.com.br",u={sync:()=>c((function*(){yield u.syncUOLID(),yield Promise.all([u.syncTailTarget(),u.sendUOLIDToTailTarget(),u.syncXandrDMP(),u.syncPiano()])}))(),get:e=>c((function*(){return yield fetch(e,{credentials:"include"})}))(),hasTM(){try{return!!window.UOLPD.TagManager}catch(e){return!1}},hasCX(){try{return!!window.cX}catch(e){return!1}},syncUOLID(){var e=this;return c((function*(){var t=(yield e.getLocalData())||{};e.persist(t),e.refreshSyncData(t)}))()},refreshSyncData(e){var t=this;return c((function*(){var a=t.isFolhaEnvironment()?"?xsrc=folha":"",r=yield t.get("".concat(l+a)),n=yield r.json();Object.assign(e,n),t.persist(e)}))()},isFolhaEnvironment:()=>/folha(\.uol)?\.com\.br/.test(location.origin),setPPIDtoTicker(e){try{window.tickerAdManager=window.tickerAdManager||{},window.tickerAdManager.model=window.tickerAdManager.model||{},window.tickerAdManager.model.data=window.tickerAdManager.model.data||{},window.tickerAdManager.model.data.datalake=window.tickerAdManager.model.data.datalake||{},window.tickerAdManager.model.data.datalake.ppid=e.ppid,console.log("PPID configurado")}catch(e){console.log("Não foi possível configurar PPID.")}},syncPiano(){var e=this;return c((function*(){if(yield new Promise(e=>setTimeout(e,3e3)),e.hasCX()){var t=yield e.get("".concat(l,"/?scopes=base-assinantes,user-preferences,corporate,inscriptions,base-assinantes-pd-host-bol-user,clusters-conteudo")),a=yield t.json(),r=e.formatPianoProfile(a);if(r.length){console.log("piano profile",r);var n="https://api.cxense.com/profile/user/external/update?callback={{callback}}&persisted="+encodeURIComponent("d221a64af0b728fa6a6c3d8a81c50c89340769c7")+"&json="+encodeURIComponent(JSON.stringify({id:a.uolid,type:"tfh",profile:r}));cX.getCookie("T_PIANO")||(cX.jsonpRequest(n,(function(e){e.hasOwnProperty("httpStatus")&&200==e.httpStatus?(console.log("piano result: "),console.log(e)):console.log("No or bad http status")})),cX.setCookie("T_PIANO","t",30/1440))}}}))()},formatPianoProfile(e){var{data:t}=e,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Date,r=[],n=t["user-preferences"],o=t["base-assinantes"],i=t.corporate,s=t.inscriptions,c=t["base-assinantes-pd-host-bol-user"],l=t["clusters-conteudo"];if(o){r.push({group:"tfh-assinante-ponto-venda",item:o.ponto_venda}),r.push({group:"tfh-assinante-status",item:o.status_assinante}),r.push({group:"tfh-assinante-estacao",item:o.estacao}),r.push({group:"tfh-assinante-produto",item:o.produto});var u=new Date(o.dt_venda);if(r.push({group:"tfh-assinante-num-dias-venda",item:parseInt((a-u)/864e5)}),o.dt_cancelamento){var d=new Date(o.dt_cancelamento);r.push({group:"tfh-assinante-num-dias-cancel",item:parseInt((a-d)/864e5)})}}if(n){if(n.newsletter_assinaturas&&n.newsletter_assinaturas.length)for(var p of n.newsletter_assinaturas)r.push({group:"tfh-newsletter-assinaturas",item:p});if(n.preferencias&&Object.keys(n.preferencias).length&&(n.preferencias["bloco-customizado-esporte"]&&r.push({group:"tfh-preferencias-time",item:n.preferencias["bloco-customizado-esporte"]}),n.preferencias["bloco-customizado-mulher"]&&r.push({group:"tfh-preferencias-signo",item:n.preferencias["bloco-customizado-mulher"]})),n.app_navegacao&&Object.keys(n.app_navegacao).length)for(var[g,f]of Object.entries(n.app_navegacao))r.push({group:"tfh-app-navegacao",item:g});if(n.canais_whatsapp&&Object.keys(n.canais_whatsapp).length)for(var h of Object.keys(n.canais_whatsapp))r.push({group:"tfh-canais-whatsapp",item:h})}return o||!i||s&&s.activeProducts&&s.activeProducts.includes(32)||r.push({group:"tfh-assinante-status",item:"Cadastrado"}),c&&c.flg_user_emad_elegivel&&r.push({group:"tfh-flg-user-emad-elegivel",item:c.flg_user_emad_elegivel}),l&&l.flg_upsell_able_heavy_user&&r.push({group:"tfh-flg-upsell-able-heavy-user",item:l.flg_upsell_able_heavy_user}),r},persist(e){var t=JSON.stringify(e);this.setTargeting(e),this.persistDataLayer({UOLID:e.uolid,ppid:e.ppid}),this.persistLocal(t),this.hasTM()&&this.persistRemote(t),this.setPPIDtoTicker(e)},setTargeting(e){var{uolid:t}=e;try{googletag.pubads().setTargeting("UOLID",t)}catch(e){}},persistLocal(e){localStorage.setItem("UDR.DATA",e)},getLocalData(){var e=this;return c((function*(){var t=localStorage.getItem("UDR.DATA");return t||e.hasTM()&&(t=yield e.getRemoteStorageData())?JSON.parse(t):null}))()},persistRemote(e){return this.persistOnRemoteStorage("UDR.DATA",e)},persistOnRemoteStorage:(e,t)=>new Promise(a=>{try{UOLPD.TagManager.Commons.RemoteStorage().set(e,t,(e,t)=>{a()})}catch(e){console.error(e),a()}}),getFromRemoteStorage:e=>new Promise(t=>{try{UOLPD.TagManager.Commons.RemoteStorage().get(e,(e,a)=>{t(a)})}catch(e){console.error(e),t(null)}}),getRemoteStorageData(){return this.getFromRemoteStorage("UDR.DATA")},getDataLayer(){var e=this;return c((function*(){var t=localStorage.getItem("uolDataLayer");return t&&"null"!==t&&"undefined"!==t||!e.hasTM()||(t=yield e.getFromRemoteStorage("uolDataLayer")),t&&"null"!==t&&"undefined"!==t?JSON.parse(t):{}}))()},getWindowDataLayer:()=>(window.UOLPD=window.UOLPD||{},window.UOLPD.dataLayer=window.UOLPD.dataLayer||{},window.UOLPD.dataLayer),persistDataLayer(e){var t=this;return c((function*(){var a=t.getWindowDataLayer();Object.assign(a,e);var r=yield t.getDataLayer();Object.assign(r,e),localStorage.setItem("uolDataLayer",JSON.stringify(r)),t.hasTM()&&t.persistOnRemoteStorage("uolDataLayer",JSON.stringify(r))}))()},syncTailTarget(){var e=this;return c((function*(){var t=yield e.getDataLayer(),a=t&&t.TailtargetTrack;if(a){var r="";for(var n in a)r+="".concat(n,":").concat(a[n],";");var o="".concat(l,"/store?scope=").concat("tt","&data=").concat(r);(yield e.isNewSync(o,"tt"))&&(yield e.get(o),yield e.saveSyncHash(o,"tt"))}}))()},getXandrUid:()=>c((function*(){try{var e=yield fetch("https://ib.adnxs.com/getuidj",{credentials:"include"});return(yield e.json()).uid}catch(e){return console.log("Ops! ocorreu um erro ao obter o XandrUID"),"0"}}))(),syncXandrDMP(){var e=this;return c((function*(){var t=yield e.getXandrUid();"0"!=t&&/^(0x)?[0-9A-Fa-f]+$/.test(t)&&(yield fetch("".concat(l,"/store?scope=xandr&sid=").concat(t),{credentials:"include"}))}))()},saveSyncHash(e,t){var a=this;return c((function*(){var r=yield a.getLocalData(),{syncHashMap:n={}}=r,i=yield o(e);n[t]=i,r.syncHashMap=n,yield a.persist(r)}))()},isNewSync(e,t){var a=this;return c((function*(){var r=yield a.getLocalData(),{syncHashMap:n={}}=r,i=yield o(e);return n[t]!=i}))()},sendUOLIDToTailTarget(){var e=this;return c((function*(){var t=yield e.getLocalData(),a="https://m.t.tailtarget.com/sync/TT-10162-1/"+(yield o(t.uolid));document.createElement("img").setAttribute("src",a)}))()},syncWeather(){var e=this;return c((function*(){try{var t=yield e.getLocalData(),a=yield fetch("https://dynad-list.dynad.net/v3/weather?uolid=".concat(t.uolid)),r=yield a.json();e.persistDataLayer({weather:r.main});var n=JSON.parse(localStorage.getItem("UDR.DATA"));Object.assign(n,{weather:r.main}),e.persistLocal(JSON.stringify(n))}catch(e){console.log("Falha ao obter os dados de clima")}}))()}};u.sync()}]);