const path = window.location.pathname; const typeCookie = getCookie('krispAccountType'); const userIdCookie = getCookie('userId'); const userAgent = navigator.userAgent.toLowerCase(); const isSafari = userAgent.indexOf('safari') > -1; const isIphone = navigator.userAgent.indexOf('iPhone') > -1; const isIpod = navigator.userAgent.indexOf('iPod') > -1; const isIpad = navigator.userAgent.indexOf('iPad') > -1; const isAndroid = userAgent.indexOf('android') > -1; const isMobile = isIphone || isIpod || isIpad || isAndroid; const platformOS = window.navigator.platform; async function getAppUrl() { return new Promise((resolve, reject) => { if (userIdCookie && userIdCookie !== 0 && userIdCookie !== '') { const credentials = btoa('admin:admin'); $.ajax({ url: theme_url + '/includes/controller/get-app-url.php', type: 'GET', headers: { Authorization: 'Basic ' + credentials, }, data: { userId: userIdCookie, }, success: (resp) => { resolve(resp); }, error: (error) => { reject(error); }, }); } else { reject(); } }); } $(document).ready(async function () { let appUrl = 'https://app.krisp.ai'; try { appUrl = await getAppUrl(); } catch { appUrl = 'https://app.krisp.ai'; } let type = /\/developers/.test(path) ? 'developers' : /\/careers/.test(path) ? 'careers' : /\/affiliate-program/.test(path) ? 'affiliate' : /\/youtube-video-summarizer/.test(path) ? 'yt-summarizer' : /\/youtube-transcript/.test(path) ? 'yt-summarizer' : typeCookie && typeCookie !== '' ? typeCookie : 'default'; const isContactSales = /\/contact-center/.test(path); const typeCases = { teamAdmin: { link: appUrl, text: 'Manage account', class: 'cta_team_admin', }, teamMember: { link: appUrl, text: 'My account', class: 'cta_team_memeber', }, individualFree: { link: `${appUrl}/billing-individual/unlock?src=krispai`, text: 'Upgrade', signInText: 'My account', signInLink: appUrl, class: 'cta_individual', }, individualPaid: { link: appUrl, text: 'My Account', class: 'cta_individual_paid', }, showDownload: { link: `${appUrl}/apps`, text: 'Download', signInText: 'My account', signInLink: appUrl, class: 'cta_download btn_hover', }, developers: { link: 'javascript:void(0)', text: 'Get Access', signInText: 'Documentation', signInLink: 'https://sdk-docs.krisp.ai', newTab: true, }, careers: { link: '#job_listings', text: 'View open jobs', }, default: { signInText: 'Sign in', signInLink: `${appUrl}/login`, link: `${appUrl}/sign-up`, text: 'Get Krisp for free', }, }; function checkAccountType(type, casesObj, ctaElement, linkElem) { if (!type || !(type in casesObj)) { ctaElement.text(casesObj.default.text).attr({ href: casesObj.default.link, class: casesObj.default.class, }); return; } if (type in casesObj) { ctaElement.text(casesObj[type].text).attr({ href: casesObj[type].link, class: casesObj[type].class, }); 'signInText' in casesObj[type] ? linkElem.text(casesObj[type]['signInText']) : linkElem.remove(); 'newTab' in casesObj[type] && linkElem.attr('target', '_blank'); 'signInLink' in casesObj[type] && linkElem.attr('href', casesObj[type]['signInLink']); } } const elem = $( '.cta_primary:not(.contact_sales) > a:not(#main_cta_hero_input)' ); const linkElem = $('.sign_in_link'); checkAccountType(type, typeCases, elem, linkElem); if (type === 'careers' || type === 'developers' || type === 'yt-summarizer') { $('#get_demo, .sign_in_link').remove(); $('#menu_actions .contact_sales').remove(); } if (type === 'developers') { $('#menu_actions .cta_primary') .removeClass('cta_primary') .addClass('modal_opener') .attr('data-modal-opener', 'sdk_form_modal'); $('#menu_actions .contact_sales').remove(); } if (type === 'affiliate') { $('#menu_actions .cta_primary') .removeClass('cta_primary') .children('a') .attr({ href: 'http://app.impact.com/campaign-campaign-info-v2/Krisp.brand', target: '_blank', }) .text('Start Earning Today'); $('#menu_actions .contact_sales').remove(); } if (type === 'individualFree') { $('.intro_info').remove(); } if (isContactSales) { $('header .cta_primary').remove(); $('#get_demo, .sign_in_link').remove(); } });