@@ -21,6 +21,7 @@ import { setupDevApplication } from '@/core/dev';
2121import { ApplicationProvider } from '@/context' ;
2222import Container from '@/container' ;
2323import { ApiError } from './types/error.type' ;
24+ import { deleteMatchingCookies } from './helpers' ;
2425
2526function reloadPage ( ) {
2627 window . location . reload ( ) ;
@@ -55,26 +56,6 @@ function setupI18n(locale: string) {
5556 } ) ;
5657}
5758
58- const deleteMatchingCookies = ( ) => {
59- const cookies = document . cookie . split ( ';' ) ;
60- cookies . forEach ( ( cookie ) => {
61- const cookieName = cookie . split ( '=' ) [ 0 ] . trim ( ) ;
62- if ( cookieName . startsWith ( '_biz_' ) || cookieName . startsWith ( '_mkto_trk' ) || cookieName . startsWith ( '_gcl_au' ) ) {
63- // Delete the cookie by setting its expiration date to the past
64- document . cookie = `${ cookieName } =; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT` ;
65- // Also try to delete with domain variations
66- const domain = window . location . hostname ;
67- document . cookie = `${ cookieName } =; path=/; domain=${ domain } ; expires=Thu, 01 Jan 1970 00:00:00 GMT` ;
68- // Try with parent domain
69- const domainParts = domain . split ( '.' ) ;
70- if ( domainParts . length > 2 ) {
71- const parentDomain = domainParts . slice ( - 2 ) . join ( '.' ) ;
72- document . cookie = `${ cookieName } =; path=/; domain=.${ parentDomain } ; expires=Thu, 01 Jan 1970 00:00:00 GMT` ;
73- }
74- }
75- } ) ;
76- }
77-
7859const App = ( ) => {
7960 const [ error , setError ] = useState ( null ) ;
8061 const [ environment , setEnvironment ] = useState < Environment > ( null ) ;
0 commit comments