Callback Type
Define callback functions that will be invoked based on specific events related to the cookies message.
Interface
ts
import type { CookiesStatus } from './index'
export interface Callback {
/**
* This function will be invoked when the user visits the page and has not neither accepted nor rejected the cookies message.
* @param params - Custom cookie preferences.
*/
first_load?: (params: CookiesStatus) => void
/**
* This function will be invoked when the user clicks on the accept all or accept settings buttons.
* @param params - Custom cookie preferences.
*/
accept?: (params: CookiesStatus) => void
/**
* This function will be invoked when the user clicks on the reject button.
* @param params - Custom cookie preferences.
*/
reject?: (params: CookiesStatus) => void
/**
* This function will be invoked every time a user that interacted previously with the cookies message (accepting or rejecting) visits the page.
* @param params - Custom cookie preferences.
*/
load?: (params: CookiesStatus) => void
}
CookiesStatus Interface
Define a type to represent the status of custom cookies.
ts
/**
* Define a type to represent the status of custom cookies.
*/
export interface CookiesStatus {
/**
* Status of each custom cookie, identified by their respective names.
* The values are boolean flags indicating whether the cookie is accepted or rejected.
*/
[key: string]: {
status: boolean
parent?: Cookie
} & Cookie
}