/
githubmirror
/
wp-calypso
Обзор
Документация
Войти
/
githubmirror
/
wp-calypso
Код
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
trunk
packages/data-stores/src/utils.ts
33 строки
1 KB
Luis Felipe Zaguini
Allow preloading Woo AI assistant before the page renders (#110062)
27 май 2026, 17:09
Не верифицирован
27 май 2026, 17:09
996cc84
Код
Авторство
О чём код?
/** * Utility functions shared across data stores */ declare const helpCenterData: | { isProxied: boolean; isSU: boolean; isSSP: boolean; currentUser: { ID: number } } | undefined; declare const isSupportSession: boolean; declare const isSSP: boolean; // All end-to-end tests use a custom user agent containing this string. const E2E_USER_AGENT = 'wp-e2e-tests'; export const isE2ETest = (): boolean => typeof window !== 'undefined' && window.navigator.userAgent.includes( E2E_USER_AGENT ); export const isInSupportSession = () => { if ( typeof window !== 'undefined' ) { return ( // A bit hacky but much easier than passing down data from PHP in Jetpack // Simple !! document.querySelector( '#wp-admin-bar-support-session-details' ) || !! document.querySelector( '#a8c-support-session-overlay' ) || // Atomic document.body?.classList.contains( 'support-session' ) || document.querySelector( '#wpcom > .is-support-session' ) || ( typeof isSupportSession !== 'undefined' && !! isSupportSession ) || ( typeof helpCenterData !== 'undefined' && helpCenterData?.isSU ) || ( typeof helpCenterData !== 'undefined' && helpCenterData?.isSSP ) || ( typeof isSSP !== 'undefined' && !! isSSP ) ); } return false; };