PageSourceSearch

https://www.levels.fyi/js/feCommonUtils.js

js levels.fyi collected 2026-10-02 02:26:35 UTC 11,194 bytes, 1 lines download raw bytes

1"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_slicedToArray=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],o=!0,r=!1,a=void 0;try{for(var i,s=e[Symbol.iterator]();!(o=(i=s.next()).done)&&(n.push(i.value),!t||n.length!==t);o=!0);}catch(e){r=!0,a=e}finally{try{!o&&s.return&&s.return()}finally{if(r)throw a}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),UNITED_STATES_COUNTRY_ID=254,NEXTJS_ROOT_KEY="persist:root",NEXTJS_MODAL_COOLDOWN_DAYS=14,DEFAULT_FILTERS={limitPerCompany:3,limit:5,offset:0,sortBy:"relevance"},SINGLE_COMPANY_VIEW_DEFAULT_FILTERS={limitPerCompany:15,limit:1,offset:0,sortBy:"relevance"};function captureOutboundLink(e,t){if("undefined"!=typeof ga&&"function"==typeof ga.getAll){var n=ga.getAll()[0];n&&n.send("event","sponsored","click",e,{transport:"beacon"})}"undefined"!=typeof UST&&"function"==typeof UST.addEvent&&UST.addEvent({category:"sponsored",action:"click",label:e}),storeBrowserData("ClickedOn_"+t,t,{day:300}),window.open(e,"_blank")}var LEVELS_ANON_DATA_KEY="levelsAnonId";function getAnonUUID(){var e=getBrowserData(LEVELS_ANON_DATA_KEY);return void 0!==e?e:(e=uuidv4(),storeBrowserData(LEVELS_ANON_DATA_KEY,e,{day:730}),e)}function uuidv4(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,function(e){return(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)})}var LEVELS_LOCATION_DATA_KEY="levelsUserLocationPreference";function getUserLocationDetails(e){var t=getBrowserData(LEVELS_LOCATION_DATA_KEY);if(void 0!==t)return e(t);$.ajax({url:"https://api.levels.fyi/geo/me",dataType:"json",cache:!0,success:function(t){storeBrowserData(LEVELS_LOCATION_DATA_KEY,t,{day:7}),e(t)},error:function(t,n,o){if("undefined"!=typeof ga&&"function"==typeof ga.getAll){var r=ga.getAll()[0];r&&r.send("event","Error","region",o)}e()}})}function isLocalStorageNameSupported(){var e=window.localStorage;try{return e.setItem("test","1"),e.removeItem("test"),!0}catch(e){return!1}}function storeBrowserData(e,t,n,o,r){if(isLocalStorageNameSupported())if(o)window.localStorage.setItem(e,JSON.stringify(t));else{r=r||new Date;var a=n.day,i=n.month;a&&(r=r.addDays(a)),i&&(r=r.addMonths(i));var s={value:t,timestamp:r.getTime()};window.localStorage.setItem(e,JSON.stringify(s))}}function getBrowserData(e,t){if(isLocalStorageNameSupported()){var n=window.localStorage.getItem(e);if(null!==n){if(n=JSON.parse(n),t)return n;var o=n.timestamp;if(!(new Date>new Date(o)))return n.value;window.localStorage.removeItem(e)}}}function isNextjsModalExpired(e){try{var t=JSON.parse(localStorage.getItem(NEXTJS_ROOT_KEY)).globalNotificationModal,n=JSON.parse(t).modalViewHistory.filter(function(t){return t.id===e}).at(0).timestamp;return new Date(n).addDays(NEXTJS_MODAL_COOLDOWN_DAYS)<Date.now()}catch(e){return!1}}function reduxPersistLocalStorageAccess(e){if(isLocalStorageNameSupported()){var t=window.localStorage.getItem("persist:root")?JSON.parse(window.localStorage.getItem("persist:root")):void 0;return t&&t[e]?JSON.parse(t[e]):void 0}}function setInReduxPersistLocalStorage(e,t){if(isLocalStorageNameSupported()){var n=window.localStorage.getItem("persist:root")?JSON.parse(window.localStorage.getItem("persist:root")):void 0;return!!n&&(n[e]=JSON.stringify(t),window.localStorage.setItem("persist:root",JSON.stringify(n)),!0)}}Date.prototype.addDays=function(e){var t=new Date(this.valueOf());return t.setDate(t.getDate()+e),t},Date.prototype.addMonths=function(e){var t=new Date(this.valueOf());return t.setMonth(t.getMonth()+e),t},$(".emailRecaptchaInput").on("change paste keyup",function(){$(".emailRecaptcha").show("fast")}),$(".emailRecaptchaSub").click(function(){$(".emailRecaptcha").hide()}),getAnonUUID();var MobileDevice={isIOS:function(){return navigator&&/iPhone|iPad|iPod/i.test(navigator.userAgent)},isAndroid:function(){return navigator&&/Android/i.test(navigator.userAgent)}},DesktopDevice={isMac:function(){return navigator&&/Mac/.test(navigator.userAgent)},isWindows:function(){return navigator&&/Windows/.test(navigator.userAgent)}},getJobFamilySpecificTopCompaniesWithLeveling=function(e){var t=reduxPersistLocalStorageAccess("geoLocation"),n=t?t.countryId:UNITED_STATES_COUNTRY_ID,o=t?t.dmaId:void 0,r={userCountryId:n};return o&&(r.dmaId=o),$.ajax({url:"https://api.levels.fyi/v1/levels/job-family/"+e+"/relevantCompanies",dataType:"json",data:r,success:function(e){return e},error:function(){return[]}})},getDirectoryUrlWithPersistedFilters=function(e,t,n){var o=e?Object.assign(e,t):t,r=convertFiltersToPath(o),a=r.pathname,i=r.query;return n&&(i.jobId=n),{pathname:a,query:i}},convertFiltersToPath=function(e){var t=[],n={},o=e.companySlugs&&1===e.companySlugs.length?SINGLE_COMPANY_VIEW_DEFAULT_FILTERS:DEFAULT_FILTERS;return Object.keys(e).forEach(function(r){var a=getFilterName(r),i=e[r];o[a]===i||void 0===i||null===i||""===i||i&&0===i.length||(filterNamesInPath.includes(a)?i.length>1?n[a]=i.join(","):(t.push(getPathName(a)),t.push(i[0])):isArrayFilter(a)?n[a]=i.join(","):n[a]=i)}),{pathname:t.length>0?"/jobs/"+t.join("/"):"/jobs",query:n}},customFilterNames={jobFamilySlugs:"title",companySlugs:"company",standardLevels:"level",locationSlugs:"location"},filterNamesInPath=["jobFamilySlugs","locationSlugs","companySlugs","standardLevels"],getFilterName=function(e){return Object.keys(customFilterNames).find(function(t){return customFilterNames[t]===e})?Object.keys(customFilterNames).find(function(t){return customFilterNames[t]===e}):e},getPathName=function(e){return customFilterNames[e]?customFilterNames[e]:e},isArrayFilter=function(e){return["cityIds","companySizes","companySlugs","companyTypes","companyValuations","countryIds","dmaIds","employmentTypes","jobFamilySlugs","locationSlugs","perk
1Ids","standardLevels","stateIds","workArrangements"].includes(e)},getOmnisearchJobsResult=function(e,t,n){var o=Object.assign({},e);o.categoryIcon='<i class="fas fa-briefcase"></i>',o.subline="In Jobs";var r={};"company"===n?r.companySlugs=[e.slug]:["dma","country","city","state"].includes(n)?r.locationSlugs=[e.slug]:"track"===n?r.jobFamilySlugs=[e.slug]:r.searchText=e.name;var a=getDirectoryUrlWithPersistedFilters(t,r),i=a.pathname,s=a.query,u=s&&Object.values(s).length>0?"?"+Object.entries(s).map(function(e){var t=_slicedToArray(e,2);return t[0]+"="+t[1]}).join("&"):"";return o.url=i+u,o};function patchAuthUser(e,t){var n=getAuthToken();n?e?$.ajax({url:"https://api-community.levels.fyi/auth/user",method:"PATCH",contentType:"application/json; charset=utf-8",headers:{Authorization:"Bearer "+n},dataType:"json",data:JSON.stringify(e),success:function(e){t&&t(e),e&&(storeBrowserData("user",e,{},!1,new Date(Date.now()+12e4)),setInReduxPersistLocalStorage("user",e),window.document.dispatchEvent(new CustomEvent("userUpdated",{detail:e})))},error:function(e,n,o){t&&t(void 0,o)}}):t&&t(e):t&&t(void 0,{error:"no auth token found"})}function getUser(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=getAuthToken();if(n){var o=getBrowserData("user");t||!o?$.ajax({url:"https://api-community.levels.fyi/auth/user",method:"GET",contentType:"application/json; charset=utf-8",headers:{Authorization:"Bearer "+n},dataType:"json",success:function(t){e&&"function"==typeof e&&e(t),t&&(storeBrowserData("user",t,{},!1,new Date(Date.now()+12e4)),setInReduxPersistLocalStorage("user",t),window.document.dispatchEvent(new CustomEvent("detectCurrencyLocale",{detail:t})),window.document.dispatchEvent(new CustomEvent("userUpdated",{detail:t})))},error:function(t,n,o){e&&e(void 0,o)}}):"function"==typeof e&&e(o)}else"function"==typeof e&&e(void 0,{error:"no auth token found"})}function getCommunityFeed(e,t){$.ajax({url:"https://api-community.levels.fyi/threads/feed?filter="+JSON.stringify(e),success:function(e){t(e.data)},error:function(e,n,o){t([])}})}function ConfigureAuthAmplify(){"undefined"!=typeof aws_amplify_auth&&aws_amplify_auth.Auth&&aws_amplify_auth.Auth.configure({Auth:{region:"us-west-2",userPoolId:"us-west-2_fUcfzSGdv",userPoolWebClientId:"76of0ich18hd8uehju7fniv2u1",mandatorySignIn:!1,cookieStorage:{domain:"levels.fyi",path:"/",expires:365,sameSite:"none",secure:!0}}})}function getAuthToken(e){var t=localStorage.getItem("auth");return aws_amplify_auth.Auth.currentSession().then(function(n){if(n){var o=Math.floor(Date.now()/1e3);n.getIdToken().getExpiration()-o<1800?refreshAuthToken(e):"function"==typeof e&&e(t)}}).catch(function(t){"function"==typeof e&&e(void 0,t),"No current user"!==t&&console.log(t)}),t}function refreshAuthToken(e){Promise.all([aws_amplify_auth.Auth.currentAuthenticatedUser(),aws_amplify_auth.Auth.currentSession()]).then(function(t){var n=_slicedToArray(t,2),o=n[0],r=n[1];o&&r&&o.refreshSession(r.getRefreshToken(),function(t,n){if(t)console.error(err);else{var o=n.idToken.getJwtToken();o&&(localStorage.setItem("auth",o),window.document.dispatchEvent(new CustomEvent("authTokenRefreshed",{detail:o})),"function"==typeof e&&e(o))}})}).catch(function(t){"function"==typeof e&&e(void 0,t),"No current user"!==t&&console.log(t)})}!function(e,t){var n,o;"object"==("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self,n=e.Cookies,(o=e.Cookies=t()).noConflict=function(){return e.Cookies=n,o})}(void 0,function(){function e(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)e[o]=n[o]}return e}return function t(n,o){function r(t,r,a){if("undefined"!=typeof document){"number"==typeof(a=e({},o,a)).expires&&(a.expires=new Date(Date.now()+864e5*a.expires)),a.expires&&(a.expires=a.expires.toUTCString()),t=encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var i="";for(var s in a)a[s]&&(i+="; "+s,!0!==a[s]&&(i+="="+a[s].split(";")[0]));return document.cookie=t+"="+n.write(r,t)+i}}return Object.create({set:r,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var t=document.cookie?document.cookie.split("; "):[],o={},r=0;r<t.length;r++){var a=t[r].split("="),i=a.slice(1).join("=");try{var s=decodeURIComponent(a[0]);if(o[s]=n.read(i,s),e===s)break}catch(e){}}return e?o[e]:o}},remove:function(t,n){r(t,"",e({},n,{expires:-1}))},withAttributes:function(n){return t(this.converter,e({},this.attributes,n))},withConverter:function(n){return t(e({},this.converter,n),this.attributes)}},{attributes:{value:Object.freeze(o)},converter:{value:Object.freeze(n)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decode
1URIComponent)}},{path:"/"})}),ConfigureAuthAmplify(),document.addEventListener("refreshAuthToken",refreshAuthToken),document.addEventListener("authTokenRefreshed",function(){getUser(void 0,!0)}),refreshAuthToken(),getAuthToken();

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.