PageSourceSearch

https://atas.net/wp-content/themes/bamboo/assets/js/atas-auth.js?02791

js atas.net collected 2026-09-24 20:39:54 UTC 7,367 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkbamboo=self.webpackChunkbamboo||[]).push([["src_js_modules_components_atas-auth_js"],{3513:function(e,t,n){n.r(t);var o=n(6324),a=n(2448);function r(){return window.location.hostname.includes("atas.net")}function i(){function e(){l.forEach((e=>localStorage.removeItem(e)))}function t(){let t=(0,o.ve)(),n=localStorage.getItem("cached_refresh_token");return t&&n&&t!==n?(e(),localStorage.setItem("cached_refresh_token",t),!0):(t&&!n&&localStorage.setItem("cached_refresh_token",t),!t&&n&&(localStorage.removeItem("cached_refresh_token"),e()),!1)}function n(e,t){try{t()}catch(e){}}function i(){(0,o.$H)(),e(),localStorage.removeItem("cached_refresh_token");let t=document.querySelector(".header-log-in"),n=document.querySelector(".header-logged");t&&(t.style.display="flex"),n&&(n.style.display="none"),window.initIntercomGuest&&window.initIntercomGuest()}function c(){return Promise.all([function(){let e=t();try{let t=localStorage.getItem("common_info_cache");if(t&&!e){let e=JSON.parse(t),n=Date.now()-e.timestamp;if((0,o.ve)()&&n<3e5)return Promise.resolve(e.data)}}catch(e){}return fetch(`/wp-json/atas/v1/common-info?_t=${Date.now()}_${Math.random().toString(36).substr(2,9)}`,{credentials:"include",headers:{"Content-Type":"application/json"}}).then((e=>{if(!e.ok)throw Error("CommonInfo error");return e.json()})).then((e=>{if(!e.authenticated)throw Error("Not authenticated");try{localStorage.setItem("common_info_cache",JSON.stringify({timestamp:Date.now(),data:e.data}))}catch(e){}return e.data})).catch((e=>{throw e}))}(),function(){let e=t();try{let t=localStorage.getItem("tariff_cache");if(t&&!e){let e=JSON.parse(t),n=Date.now()-e.timestamp,a="start"===e.subscriptions?.mainSubscription?.title?.toLowerCase()||!e.subscriptions?.mainSubscription;if((0,o.ve)()&&n<(a?6e4:3e5))return Promise.resolve({subscriptions:e.subscriptions,trialTicket:e.trialTicket,plans:e.plans})}}catch(e){}let n=()=>`${Date.now()}_${Math.random().toString(36).substr(2,9)}`;return Promise.all([fetch(`/wp-json/atas/v1/subscriptions?_t=${n()}`,{credentials:"include",headers:{"Content-Type":"application/json"}}),fetch(`/wp-json/atas/v1/trial-ticket?_t=${n()}`,{credentials:"include",headers:{"Content-Type":"application/json"}}),fetch(`/wp-json/atas/v1/plans?_t=${n()}`,{credentials:"include",headers:{"Content-Type":"application/json"}})]).then((async e=>{let[t,n,o]=e;return{subscriptions:t.ok?(await t.json()).subscriptions:null,trialTicket:n.ok?(await n.json()).trial_ticket:null,plans:o.ok?(await o.json()).plans:null}})).catch((()=>({subscriptions:null,trialTicket:null,plans:null})))}(),fetch(`/wp-json/atas/v1/basket?_t=${Date.now()}_${Math.random().toString(36).substr(2,9)}`,{credentials:"include",headers:{"Content-Type":"application/json"}}).then((e=>{if(!e.ok)throw Error("Basket error");return e.json()})).then((e=>{if(!e.authenticated)throw Error("Not authenticated");return e.data})).catch((()=>null))]).then((e=>{let[t,n,o]=e;return{commonInfo:t,tariffData:n,basketData:o}})).catch((e=>{throw i(),e}))}function s(e){let{commonInfo:t,tariffData:a,basketData:r}=e,i=localStorage.getItem("common_info_cache"),c=i?JSON.parse(i).data?.email:null,s=t?.email;if(c&&s&&c!==s)return window.atasResetCustomerIo?.(),localStorage.clear(),void(0,o.$H)().then((()=>{location.reload()})).catch((()=>{location.reload()}));n(0,(()=>function(e){let t=document.querySelector(".header-logged"),n=document.querySelector(".header-log-in");if(n&&(n.style.display="none"),!t)return;t.style.display="flex";let o=window.location.hostname.includes("local")||window.location.hostname.includes("localhost")||"127.0.0.1"===window.location.hostname||window.location.hostname.includes("trade-with.me")?"https://my.trade-with.me/dashboard":"https://my.atas.net/dashboard",a=t.querySelector("[data-user-info]");if(a&&"BUTTON"===a.tagName){let e=document.createElement("a");e.href=o,e.className=a.className,e.setAttribute("data-user-info",""),e.setAttribute("aria-label","User"),e.setAttribute("rel","nofollow"),e.innerHTML=a.innerHTML,a.replaceWith(e)}else a&&"A"===a.tagName&&(a.href=o);let r=t.querySelector(".btn-text"),i=e.name?.trim()||e.email||"User";r&&(r.textContent=i);let c=t.querySelector(".fit-cover img");c&&e.avatarImageUrl&&(c.src=e.avatarImageUrl,c.alt=e.name||"User avatar")}(t))),n(0,(()=>function(){let e=document.querySelectorAll('a[href="#form-signup"]');if(0===e.length)return;let t=window.BAMBOO?.lang||"en",n="en"===t?"/pricing/":`/${t}/pricing/`;e.forEach((e=>{e.href=n,e.addEventListener("click",(e=>{e.stopPropagation(),e.stopImmediatePropagation(),window.location.href=n}),!0)}))}())),n(0,(()=>{window.initIntercom&&window.initIntercom()})),n(0,(()=>function(e){let t={timestamp:Date.now(),subscriptions:e?.subscriptions??null,trialTicket:e?.trialTicket??null,plans:e?.plans??null};
1localStorage.setItem("tariff_cache",JSON.stringify(t)),window.tariffDataReady=!0}(a))),n(0,(()=>{document.body.classList.contains("page-template-page-prices")&&window.initTariffManager&&window.initTariffManager(!0)})),n(0,(()=>function(e){let t=document.querySelector(".header-shop"),n=document.querySelector("[data-shop-count]");if(!t)return;if(!e)return void(t.style.display="none");let o=e.count||0;o>0?(t.style.display="flex",n&&(n.textContent=o,n.style.display="")):t.style.display="none"}(r))),n(0,(()=>function(e){if(!window.ATAS_CUSTOMERIO_IDENTIFY)return;let t=(0,o.F6)(),n=e?.email;if(!t||!n)return;let a={email:n,account_language:e.uiLanguage||window.BAMBOO?.lang||document.documentElement.lang||"en"},r={userId:String(t),traits:a};window.ATAS_CUSTOMERIO_USER=r,window.ATAS_CUSTOMERIO_SENT!==r.userId&&"function"==typeof window.cioanalytics?.identify&&(window.cioanalytics.identify(r.userId,a),window.ATAS_CUSTOMERIO_SENT=r.userId)}(t)))}let l=["tariff_cache","common_info_cache","fchat","fc_data_cache"];!function(){if(!(0,o.ve)())return i();let e=document.querySelector("[data-price-cta]");e&&e.remove();let t=(0,o.F6)();t&&"undefined"!=typeof dataLayer&&dataLayer.push({user_id:t});let n=localStorage.getItem("just_logged_in");if(n){let e=parseInt(n);if(Date.now()-e<5e3)return localStorage.removeItem("just_logged_in"),void c().then((e=>s(e))).catch((()=>{}));localStorage.removeItem("just_logged_in")}(function(){let e=r()?"https://id.atas.net":"https://id.trade-with.me",t=(r(),{client_id:"client",client_secret:"secret",scope:"openid profile email offline_access atas_production",refresh_token:(0,o.ve)(),grant_type:"refresh_token"});return fetch(`${e}/connect/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:Object.keys(t).map((e=>encodeURIComponent(e)+"="+encodeURIComponent(t[e]))).join("&")}).then((e=>{if(!e.ok)throw Error("Token error");return e.json()})).then((async e=>((0,o.fE)(e.refresh_token),await(0,o.ki)(e.access_token),(0,a.createSharedSession)(e.access_token),e.access_token))).catch((e=>{throw i(),e}))})().then((()=>c())).then((e=>s(e))).catch((()=>{}))}()}window.ATAS_CUSTOMERIO_IDENTIFY=!0,window.atasResetCustomerIo=function(){window.ATAS_CUSTOMERIO_IDENTIFY&&(window.ATAS_CUSTOMERIO_USER=null,window.ATAS_CUSTOMERIO_SENT=null,"function"==typeof window.cioanalytics?.reset&&window.cioanalytics.reset())},window.initAtasAuth=i,"loading"===document.readyState?document.addEventListener("DOMContentLoaded",i):i(),window.addEventListener("pageshow",(e=>{e.persisted&&i()}))}}]);

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.