import { useEffect , useState } from "react" ; export * from "./stencilproxy/components" ; function isCustomEvent ( event ) { return "detail" in event ; } export function useCookieConsent ( ) { const [ acceptedCategories , setAcceptedCategories ] = useState < string [ ] > ( [ ] ) ; const acceptedCategoriesListener = ( event ) => { if ( isCustomEvent ( event ) ) { setAcceptedCategories ( event . detail . acceptedCategories ?? [ ] ) ; } } ; useEffect ( ( ) => { window . addEventListener ( "cookie_consent_preferences_restored" , acceptedCategoriesListener ) ; window . addEventListener ( "cookie_consent_preferences_updated" , acceptedCategoriesListener ) ; return ( ) : void => { window . removeEventListener ( "cookie_consent_preferences_restored" , acceptedCategoriesListener ) ; window . removeEventListener ( "cookie_consent_preferences_updated" , acceptedCategoriesListener ) ; } ; } , [ ] ) ; return acceptedCategories ; }