1class MobileHeader{constructor(){this.header=document.getElementById("mobileHeader"),this.header&&(this.pageType=this.header.dataset.pageType,this.isLoggedIn="true"===this.header.dataset.loggedIn,this.detectPlatform(),this.cacheElements(),this.init())}detectPlatform(){this.isCapacitorApp=!1;try{window.Capacitor?.getPlatform&&(this.isCapacitorApp="web"!==window.Capacitor.getPlatform())}catch(t){console.warn("Capacitor detection error:",t)}this.isMobileWeb="Android"===window.settings?.os||"iOS"===window.settings?.os}cacheElements(){this.wrapper=this.header.querySelector(".actionButtonsWrapper");Object.entries({scanBtn:"scanBarcodeButton",openAppBtn:"openAppBtn",unifiedBack:"unifiedBack",headContent:"headContent",logInBtn:"logIn",signOutBtn:"signOutButton",sprinkleLogo:"sprinkleLogo",titleEl:"mobileHeaderTitle",subtitleEl:"mobileHeaderSubtitle",profileBtn:"openProfileMobileBtn"}).forEach((([t,e])=>{this[t]=document.getElementById(e)}))}init(){this.initBackButton(),this.initSettingsButton(),this.initSignOutButton(),this.handleButtonsVisibility(),this.insertLocalStorageUser(),this.initProfileButton()}initBackButton(){this.unifiedBack&&this.unifiedBack.addEventListener("click",(t=>{if(t.preventDefault(),"settings"!==this.pageType)window.history.length>1?("productDetails"===this.pageType&&window.sessionStorage.setItem("mobileProductCatalogRefreshAfterBack","1"),window.history.back()):window.location.href=window.routes.home;else{if("true"===new URLSearchParams(window.location.search).get("useStoredBack")){const t=sessionStorage.getItem("settingsBackUrl");if(t)return sessionStorage.removeItem("settingsBackUrl"),void(window.location.href=t)}window.location.href=this.isCapacitorApp?"/":`/${window.settings.locale}/profile`}}))}initSettingsButton(){this.settingsBtn&&this.settingsBtn.addEventListener("click",(()=>{window.location.href=`${window.routes.base}/settings`}))}initProfileButton(){this.profileBtn&&this.profileBtn.addEventListener("click",(()=>{this.isLoggedIn?window.location.href=window.routes.home:window.location.href=`${window.routes.base}/sign-in`}))}initSignOutButton(){this.signOutBtn&&this.signOutBtn.addEventListener("click",window.logoutConfirmationModal)}handleButtonsVisibility(){this.toggleElement(this.scanBtn,this.isMobileWeb),this.toggleElement(this.openAppBtn,this.isMobileWeb&&!this.isCapacitorApp),this.updateLogoPosition()}toggleElement(t,e){t&&(t.style.display=e?"flex":"none")}updateLogoPosition(){if(!this.sprinkleLogo)return;const t=!this.unifiedBack||"none"===this.unifiedBack.style.display,e=!this.openAppBtn||"none"===this.openAppBtn.style.display;t&&e?(this.sprinkleLogo.classList.add("center-logo"),"thankYou"!==this.pageType&&this.headContent?.classList.add("logo-only")):(this.sprinkleLogo.classList.remove("center-logo"),this.headContent?.classList.remove("logo-only"))}async insertLocalStorageUser(){if(!this.titleEl&&!this.subtitleEl)return;if("thankYou"===this.pageType)return;const t=this.titleEl?.textContent.trim().length>0,e=this.subtitleEl?.textContent.trim().length>0;if(t||e)return;let i=localStorage.getItem("co_name"),n=localStorage.getItem("co_lastname"),o=user().mobile;if(!i||!n)try{const{data:t}=await window.auth.getGeneralPersonalContactInformation();i=t.first_name,n=t.last_name,o||(o=t.contact_phone)}catch(t){console.warn("Auth fetch failed",t)}this.titleEl.textContent=i+" "+n,this.titleEl.classList.add("notranslate"),this.titleEl.setAttribute("translate","no"),this.subtitleEl.textContent=o}}document.addEventListener("DOMContentLoaded",(()=>{new MobileHeader}));
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.