react-cookie-consent/build/index.d.ts

77 lines
2.3 KiB
TypeScript
Raw Normal View History

2018-11-28 09:05:35 +01:00
import * as React from "react";
import Cookies from "js-cookie";
export interface CookieConsentProps {
location?: "top" | "bottom" | "none";
sameSite?: "strict" | "lax" | "none";
2021-09-23 19:16:15 +02:00
visible?: "hidden" | "show" | "byCookieValue";
cookieSecurity?: boolean;
2018-11-28 09:05:35 +01:00
style?: object;
buttonStyle?: object;
declineButtonStyle?: object;
2018-11-28 09:05:35 +01:00
contentStyle?: object;
children?: React.ReactNode;
disableStyles?: boolean;
hideOnAccept?: boolean;
2021-12-28 12:10:14 +01:00
hideOnDecline?: boolean;
2021-08-11 11:16:03 +02:00
onAccept?: (acceptedByScrolling?: boolean) => void;
onDecline?: Function;
2018-11-28 09:05:35 +01:00
buttonText?: Function | React.ReactNode;
declineButtonText?: Function | React.ReactNode;
2018-11-28 09:05:35 +01:00
cookieName?: string;
cookieValue?: string | boolean | number;
declineCookieValue?: string | boolean | number;
2019-08-19 19:10:23 +02:00
setDeclineCookie?: boolean;
2018-11-28 09:05:35 +01:00
debug?: boolean;
expires?: number;
containerClasses?: string;
contentClasses?: string;
2020-07-23 12:50:54 +02:00
buttonWrapperClasses?: string;
2018-11-28 09:05:35 +01:00
buttonClasses?: string;
declineButtonClasses?: string;
2018-11-28 09:05:35 +01:00
buttonId?: string;
declineButtonId?: string;
2018-11-28 09:05:35 +01:00
extraCookieOptions?: object;
disableButtonStyles?: boolean;
enableDeclineButton?: boolean;
2019-05-03 12:07:12 +02:00
flipButtons?: boolean;
ButtonComponent?: React.ElementType;
2020-06-17 10:29:15 +02:00
overlay?: boolean;
overlayClasses?: string;
overlayStyle?: object;
onOverlayClick?: () => void;
acceptOnOverlayClick?: boolean;
ariaAcceptLabel?: string;
ariaDeclineLabel?: string;
2021-08-11 11:16:03 +02:00
acceptOnScroll?: boolean;
acceptOnScrollPercentage?: number;
customContentAttributes?: object;
customContainerAttributes?: object;
2022-02-08 17:13:48 +01:00
customButtonProps?: object;
2018-11-28 09:05:35 +01:00
}
export default class CookieConsent extends React.Component<CookieConsentProps, {}> {}
2020-12-08 18:02:10 +01:00
/**
* Returns the value of the consent cookie
* Retrieves the regular value first and if not found the legacy one according
* to: https://web.dev/samesite-cookie-recipes/#handling-incompatible-clients
* @param {*} name optional name of the cookie
*/
2021-01-27 16:35:17 +01:00
export function getCookieConsentValue(name?: string): string;
2020-12-08 18:02:10 +01:00
2021-09-23 19:16:15 +02:00
/**
* Reset the consent cookie
* Remove the cookie on browser in order to allow user to change their consent
* @param {*} name optional name of the cookie
*/
2022-02-10 14:25:18 +01:00
export function resetCookieConsentValue(name?: string): void;
2021-09-23 19:16:15 +02:00
/**
* Get the legacy cookie name by the regular cookie name
* @param {string} name of cookie to get
*/
2022-02-10 14:25:18 +01:00
export function getLegacyCookieName(name: string): string;
2021-09-23 19:16:15 +02:00
2018-11-28 09:05:35 +01:00
export { Cookies };