export const hasCookieConsent = () => typeof window !== 'undefined' && window.document.cookie.indexOf('nuk-consent-personalisation=1') >= 0; export const getPreferredEdition = () => { if (!window || !window.nuk) { return 'uk'; } const edition = window.nuk.getCookieValue('nuk_preferred_edition') || 'uk'; return edition.toLowerCase(); }; export const getCookieValue = (name: string): string | undefined => { if (typeof window === 'undefined') { return undefined; } const match = document.cookie.match( new RegExp(`(?:^|; )${encodeURIComponent(name)}=([^;]*)`) ); return match ? decodeURIComponent(match[1]) : undefined; };