@m10s/cmp
Version:
Package containing scripts used by Schibsteds' sites to integrate with Sourcepoint CMP
13 lines (10 loc) • 529 B
JavaScript
export function isNativeConsentPassed(_window) {
return new URLSearchParams(_window.location?.search).has('_sp_pass_consent');
};
const mobileWebViewUa = ['Hermes', '_app_', 'tv.nu', 'FinnApp', 'Omni'];
export function isWebView(_navigator) {
return mobileWebViewUa.some((webviewAgent) => _navigator.userAgent.includes(webviewAgent));
};
export function checkIfShouldDisableOnWebview(window, navigator, config) {
return !isNativeConsentPassed(window) && isWebView(navigator) && !config.disableNativeConsentCheck
};