Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-cookie-consent

Package Overview
Dependencies
Maintainers
1
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-cookie-consent - npm Package Compare versions

Comparing version 8.0.1 to 9.0.0

2

dist/components/ConditionalWrapper.d.ts
import { FunctionComponent, ReactNode } from "react";
declare type Props = {
condition: boolean;
condition?: boolean;
wrapper: (_: ReactNode) => any;

@@ -5,0 +5,0 @@ children: ReactNode;

@@ -1,6 +0,61 @@

import { Component } from "react";
import React, { Component } from "react";
import { CookieConsentProps } from "./CookieConsent.props";
import { CookieConsentState } from "./CookieConsent.state";
import { SAME_SITE_OPTIONS } from "./models/constants";
export declare class CookieConsent extends Component<CookieConsentProps, CookieConsentState> {
static defaultProps: CookieConsentProps;
static defaultProps: {
disableStyles: boolean;
hideOnAccept: boolean;
hideOnDecline: boolean;
location: string;
visible: string;
onAccept: (_acceptedByScrolling: boolean) => void;
onDecline: () => void;
cookieName: string;
cookieValue: string;
declineCookieValue: string;
setDeclineCookie: boolean;
buttonText: string;
declineButtonText: string;
debug: boolean;
expires: number;
containerClasses: string;
contentClasses: string;
buttonClasses: string;
buttonWrapperClasses: string;
declineButtonClasses: string;
buttonId: string;
declineButtonId: string;
extraCookieOptions: {};
disableButtonStyles: boolean;
enableDeclineButton: boolean;
flipButtons: boolean;
sameSite: SAME_SITE_OPTIONS;
ButtonComponent: React.FunctionComponent<{
[x: string]: any;
children: React.ReactNode;
}>;
overlay: boolean;
overlayClasses: string;
onOverlayClick: () => void;
acceptOnOverlayClick: boolean;
ariaAcceptLabel: string;
ariaDeclineLabel: string;
acceptOnScroll: boolean;
acceptOnScrollPercentage: number;
customContentAttributes: {};
customContainerAttributes: {};
customButtonProps: {};
customDeclineButtonProps: {};
customButtonWrapperAttributes: {};
style: {};
buttonStyle: {};
declineButtonStyle: {};
contentStyle: {};
overlayStyle: {}; /**
* 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
*/
};
state: CookieConsentState;

@@ -7,0 +62,0 @@ componentDidMount(): void;

import React, { ReactNode } from "react";
import { SAME_SITE_OPTIONS } from "./models/constants";
export interface CookieConsentProps {
children?: ReactNode;
style: React.CSSProperties;
buttonStyle: React.CSSProperties;
declineButtonStyle: React.CSSProperties;
contentStyle: React.CSSProperties;
style?: React.CSSProperties;
buttonStyle?: React.CSSProperties;
declineButtonStyle?: React.CSSProperties;
contentStyle?: React.CSSProperties;
disableStyles?: boolean;
hideOnAccept?: boolean;
hideOnDecline?: boolean;
onAccept?: (acceptedByScrolling: boolean) => void;
onDecline?: () => void;
buttonText?: string | ReactNode | Function;
declineButtonText?: string | ReactNode | Function;
cookieName?: string;
cookieValue?: string | object;
declineCookieValue?: string | object;
setDeclineCookie?: boolean;
debug?: boolean;
expires?: number;
containerClasses?: string;
contentClasses?: string;
buttonClasses?: string;
buttonWrapperClasses?: string;
declineButtonClasses?: string;
buttonId?: string;
declineButtonId?: string;
overlayClasses?: string;
ariaAcceptLabel?: string;
ariaDeclineLabel?: string;
disableButtonStyles?: boolean;
enableDeclineButton?: boolean;
flipButtons?: boolean;
cookieSecurity?: boolean;
overlay?: boolean;
acceptOnOverlayClick?: boolean;
acceptOnScroll?: boolean;
acceptOnScrollPercentage?: number;
ButtonComponent?: any;
extraCookieOptions?: Object;
overlayStyle?: Object;
customContentAttributes?: Object;
customContainerAttributes?: Object;
customButtonProps?: Object;
customDeclineButtonProps?: Object;
customButtonWrapperAttributes?: Object;
onOverlayClick?: () => void;
location?: string;
visible?: string;
sameSite?: "strict" | "Strict" | "lax" | "Lax" | "none" | "None";
}
export declare const defaultCookieConsentProps: {
disableStyles: boolean;
hideOnAccept: boolean;
hideOnDecline: boolean;
onAccept: (acceptedByScrolling: boolean) => void;
location: string;
visible: string;
onAccept: (_acceptedByScrolling: boolean) => void;
onDecline: () => void;
buttonText: string | ReactNode | Function;
declineButtonText: string | ReactNode | Function;
cookieName: string;
cookieValue: string | object;
declineCookieValue: string | object;
cookieValue: string;
declineCookieValue: string;
setDeclineCookie: boolean;
buttonText: string;
declineButtonText: string;
debug: boolean;

@@ -28,26 +76,29 @@ expires: number;

declineButtonId: string;
overlayClasses: string;
ariaAcceptLabel: string;
ariaDeclineLabel: string;
extraCookieOptions: {};
disableButtonStyles: boolean;
enableDeclineButton: boolean;
flipButtons: boolean;
cookieSecurity?: boolean;
sameSite: SAME_SITE_OPTIONS;
ButtonComponent: React.FunctionComponent<{
[x: string]: any;
children: ReactNode;
}>;
overlay: boolean;
overlayClasses: string;
onOverlayClick: () => void;
acceptOnOverlayClick: boolean;
ariaAcceptLabel: string;
ariaDeclineLabel: string;
acceptOnScroll: boolean;
acceptOnScrollPercentage: number;
ButtonComponent: any;
extraCookieOptions: Object;
overlayStyle: Object;
customContentAttributes: Object;
customContainerAttributes: Object;
customButtonProps: Object;
customDeclineButtonProps: Object;
customButtonWrapperAttributes: Object;
onOverlayClick: () => void;
location: string;
visible: string;
sameSite: "strict" | "Strict" | "lax" | "Lax" | "none" | "None" | undefined;
}
export declare const defaultCookieConsentProps: CookieConsentProps;
customContentAttributes: {};
customContainerAttributes: {};
customButtonProps: {};
customDeclineButtonProps: {};
customButtonWrapperAttributes: {};
style: {};
buttonStyle: {};
declineButtonStyle: {};
contentStyle: {};
overlayStyle: {};
};

@@ -20,4 +20,4 @@ 'use strict';

var condition = _ref.condition,
wrapper = _ref.wrapper,
children = _ref.children;
wrapper = _ref.wrapper,
children = _ref.children;
return condition ? wrapper(children) : children;

@@ -30,3 +30,2 @@ };

var source = arguments[i];
for (var key in source) {

@@ -38,3 +37,2 @@ if (Object.prototype.hasOwnProperty.call(source, key)) {

}
return target;

@@ -44,10 +42,7 @@ };

}
function _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
_setPrototypeOf(subClass, superClass);
}
function _setPrototypeOf(o, p) {

@@ -60,3 +55,2 @@ _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {

}
function _objectWithoutPropertiesLoose(source, excluded) {

@@ -67,3 +61,2 @@ if (source == null) return {};

var key, i;
for (i = 0; i < sourceKeys.length; i++) {

@@ -74,3 +67,2 @@ key = sourceKeys[i];

}
return target;

@@ -100,10 +92,7 @@ }

var _excluded = ["children"];
var DefaultButtonComponent = function DefaultButtonComponent(_ref) {
var children = _ref.children,
props = _objectWithoutPropertiesLoose(_ref, _excluded);
props = _objectWithoutPropertiesLoose(_ref, _excluded);
return React__default.createElement("button", Object.assign({}, props), children);
};
var defaultCookieConsentProps = {

@@ -215,3 +204,2 @@ disableStyles: false,

*/
var getCookieConsentValue = function getCookieConsentValue(name) {

@@ -221,9 +209,7 @@ if (name === void 0) {

}
var cookieValue = Cookies.get(name); // if the cookieValue is undefined check for the legacy cookie
var cookieValue = Cookies.get(name);
// if the cookieValue is undefined check for the legacy cookie
if (cookieValue === undefined) {
return Cookies.get(getLegacyCookieName(name));
}
return cookieValue;

@@ -236,3 +222,2 @@ };

*/
var resetCookieConsentValue = function resetCookieConsentValue(name) {

@@ -242,3 +227,2 @@ if (name === void 0) {

}
Cookies.remove(name);

@@ -250,3 +234,2 @@ };

*/
var getLegacyCookieName = function getLegacyCookieName(name) {

@@ -258,6 +241,4 @@ return name + "-legacy";

_inheritsLoose(CookieConsent, _Component);
function CookieConsent() {
var _this;
_this = _Component.apply(this, arguments) || this;

@@ -268,6 +249,6 @@ _this.state = defaultState;

*/
_this.handleScroll = function () {
var acceptOnScrollPercentage = _this.props.acceptOnScrollPercentage; // (top / height) - height * 100
var _defaultCookieConsent = _extends({}, defaultCookieConsentProps, _this.props),
acceptOnScrollPercentage = _defaultCookieConsent.acceptOnScrollPercentage;
// (top / height) - height * 100
var rootNode = document.documentElement;

@@ -278,3 +259,2 @@ var body = document.body;

var percentage = (rootNode[top] || body[top]) / ((rootNode[height] || body[height]) - rootNode.clientHeight) * 100;
if (percentage > acceptOnScrollPercentage) {

@@ -284,6 +264,4 @@ _this.accept(true);

};
_this.removeScrollListener = function () {
var acceptOnScroll = _this.props.acceptOnScroll;
if (acceptOnScroll) {

@@ -293,16 +271,13 @@ window.removeEventListener("scroll", _this.handleScroll);

};
return _this;
}
var _proto = CookieConsent.prototype;
_proto.componentDidMount = function componentDidMount() {
var debug = this.props.debug; // if cookie undefined or debug
var debug = this.props.debug;
// if cookie undefined or debug
if (this.getCookieValue() === undefined || debug) {
this.setState({
visible: true
}); // if acceptOnScroll is set to true and (cookie is undefined or debug is set to true), add a listener.
});
// if acceptOnScroll is set to true and (cookie is undefined or debug is set to true), add a listener.
if (this.props.acceptOnScroll) {

@@ -315,3 +290,2 @@ window.addEventListener("scroll", this.handleScroll, {

};
_proto.componentWillUnmount = function componentWillUnmount() {

@@ -323,20 +297,15 @@ // remove listener if still set

* Set a persistent accept cookie
*/
;
*/;
_proto.accept = function accept(acceptedByScrolling) {
var _acceptedByScrolling;
if (acceptedByScrolling === void 0) {
acceptedByScrolling = false;
}
var _this$props = this.props,
cookieName = _this$props.cookieName,
cookieValue = _this$props.cookieValue,
hideOnAccept = _this$props.hideOnAccept,
onAccept = _this$props.onAccept;
var _defaultCookieConsent2 = _extends({}, defaultCookieConsentProps, this.props),
cookieName = _defaultCookieConsent2.cookieName,
cookieValue = _defaultCookieConsent2.cookieValue,
hideOnAccept = _defaultCookieConsent2.hideOnAccept,
onAccept = _defaultCookieConsent2.onAccept;
this.setCookie(cookieName, cookieValue);
onAccept((_acceptedByScrolling = acceptedByScrolling) != null ? _acceptedByScrolling : false);
if (hideOnAccept) {

@@ -351,14 +320,10 @@ this.setState({

* Handle a click on the overlay
*/
;
*/;
_proto.overlayClick = function overlayClick() {
var _this$props2 = this.props,
acceptOnOverlayClick = _this$props2.acceptOnOverlayClick,
onOverlayClick = _this$props2.onOverlayClick;
var _defaultCookieConsent3 = _extends({}, defaultCookieConsentProps, this.props),
acceptOnOverlayClick = _defaultCookieConsent3.acceptOnOverlayClick,
onOverlayClick = _defaultCookieConsent3.onOverlayClick;
if (acceptOnOverlayClick) {
this.accept();
}
onOverlayClick();

@@ -368,19 +333,14 @@ }

* Set a persistent decline cookie
*/
;
*/;
_proto.decline = function decline() {
var _this$props3 = this.props,
cookieName = _this$props3.cookieName,
declineCookieValue = _this$props3.declineCookieValue,
hideOnDecline = _this$props3.hideOnDecline,
onDecline = _this$props3.onDecline,
setDeclineCookie = _this$props3.setDeclineCookie;
var _defaultCookieConsent4 = _extends({}, defaultCookieConsentProps, this.props),
cookieName = _defaultCookieConsent4.cookieName,
declineCookieValue = _defaultCookieConsent4.declineCookieValue,
hideOnDecline = _defaultCookieConsent4.hideOnDecline,
onDecline = _defaultCookieConsent4.onDecline,
setDeclineCookie = _defaultCookieConsent4.setDeclineCookie;
if (setDeclineCookie) {
this.setCookie(cookieName, declineCookieValue);
}
onDecline();
if (hideOnDecline) {

@@ -396,16 +356,12 @@ this.setState({

* https://web.dev/samesite-cookie-recipes/#handling-incompatible-clients
*/
;
*/;
_proto.setCookie = function setCookie(cookieName, cookieValue) {
var _this$props4 = this.props,
extraCookieOptions = _this$props4.extraCookieOptions,
expires = _this$props4.expires,
sameSite = _this$props4.sameSite;
var _this$props = this.props,
extraCookieOptions = _this$props.extraCookieOptions,
expires = _this$props.expires,
sameSite = _this$props.sameSite;
var cookieSecurity = this.props.cookieSecurity;
if (cookieSecurity === undefined) {
cookieSecurity = window.location ? window.location.protocol === "https:" : true;
}
var cookieOptions = _extends({

@@ -416,11 +372,9 @@ expires: expires

secure: cookieSecurity
}); // Fallback for older browsers where can not set SameSite=None,
});
// Fallback for older browsers where can not set SameSite=None,
// SEE: https://web.dev/samesite-cookie-recipes/#handling-incompatible-clients
if (sameSite === exports.SAME_SITE_OPTIONS.NONE) {
Cookies.set(getLegacyCookieName(cookieName), cookieValue, cookieOptions);
} // set the regular cookie
}
// set the regular cookie
Cookies.set(cookieName, cookieValue, cookieOptions);

@@ -432,5 +386,3 @@ }

* to: https://web.dev/samesite-cookie-recipes/#handling-incompatible-clients
*/
;
*/;
_proto.getCookieValue = function getCookieValue() {

@@ -440,6 +392,4 @@ var cookieName = this.props.cookieName;

};
_proto.render = function render() {
var _this2 = this;
// If the bar shouldn't be visible don't render anything.

@@ -449,3 +399,2 @@ switch (this.props.visible) {

return null;
case VISIBILITY_OPTIONS.BY_COOKIE_VALUE:

@@ -455,36 +404,34 @@ if (!this.state.visible) {

}
break;
}
var _this$props5 = this.props,
location = _this$props5.location,
style = _this$props5.style,
buttonStyle = _this$props5.buttonStyle,
declineButtonStyle = _this$props5.declineButtonStyle,
contentStyle = _this$props5.contentStyle,
disableStyles = _this$props5.disableStyles,
buttonText = _this$props5.buttonText,
declineButtonText = _this$props5.declineButtonText,
containerClasses = _this$props5.containerClasses,
contentClasses = _this$props5.contentClasses,
buttonClasses = _this$props5.buttonClasses,
buttonWrapperClasses = _this$props5.buttonWrapperClasses,
declineButtonClasses = _this$props5.declineButtonClasses,
buttonId = _this$props5.buttonId,
declineButtonId = _this$props5.declineButtonId,
disableButtonStyles = _this$props5.disableButtonStyles,
enableDeclineButton = _this$props5.enableDeclineButton,
flipButtons = _this$props5.flipButtons,
ButtonComponent = _this$props5.ButtonComponent,
overlay = _this$props5.overlay,
overlayClasses = _this$props5.overlayClasses,
overlayStyle = _this$props5.overlayStyle,
ariaAcceptLabel = _this$props5.ariaAcceptLabel,
ariaDeclineLabel = _this$props5.ariaDeclineLabel,
customContainerAttributes = _this$props5.customContainerAttributes,
customContentAttributes = _this$props5.customContentAttributes,
customButtonProps = _this$props5.customButtonProps,
customDeclineButtonProps = _this$props5.customDeclineButtonProps,
customButtonWrapperAttributes = _this$props5.customButtonWrapperAttributes;
var _this$props2 = this.props,
location = _this$props2.location,
style = _this$props2.style,
buttonStyle = _this$props2.buttonStyle,
declineButtonStyle = _this$props2.declineButtonStyle,
contentStyle = _this$props2.contentStyle,
disableStyles = _this$props2.disableStyles,
buttonText = _this$props2.buttonText,
declineButtonText = _this$props2.declineButtonText,
containerClasses = _this$props2.containerClasses,
contentClasses = _this$props2.contentClasses,
buttonClasses = _this$props2.buttonClasses,
buttonWrapperClasses = _this$props2.buttonWrapperClasses,
declineButtonClasses = _this$props2.declineButtonClasses,
buttonId = _this$props2.buttonId,
declineButtonId = _this$props2.declineButtonId,
disableButtonStyles = _this$props2.disableButtonStyles,
enableDeclineButton = _this$props2.enableDeclineButton,
flipButtons = _this$props2.flipButtons,
ButtonComponent = _this$props2.ButtonComponent,
overlay = _this$props2.overlay,
overlayClasses = _this$props2.overlayClasses,
overlayStyle = _this$props2.overlayStyle,
ariaAcceptLabel = _this$props2.ariaAcceptLabel,
ariaDeclineLabel = _this$props2.ariaDeclineLabel,
customContainerAttributes = _this$props2.customContainerAttributes,
customContentAttributes = _this$props2.customContentAttributes,
customButtonProps = _this$props2.customButtonProps,
customDeclineButtonProps = _this$props2.customDeclineButtonProps,
customButtonWrapperAttributes = _this$props2.customButtonWrapperAttributes;
var myStyle = {};

@@ -495,3 +442,2 @@ var myButtonStyle = {};

var myOverlayStyle = {};
if (disableStyles) {

@@ -508,4 +454,4 @@ // if styles are disabled use the provided styles (or none)

myContentStyle = Object.assign({}, _extends({}, this.state.contentStyle, contentStyle));
myOverlayStyle = Object.assign({}, _extends({}, this.state.overlayStyle, overlayStyle)); // switch to disable JUST the button styles
myOverlayStyle = Object.assign({}, _extends({}, this.state.overlayStyle, overlayStyle));
// switch to disable JUST the button styles
if (disableButtonStyles) {

@@ -518,5 +464,4 @@ myButtonStyle = Object.assign({}, buttonStyle);

}
} // syntactic sugar to enable user to easily select top / bottom
}
// syntactic sugar to enable user to easily select top / bottom
switch (location) {

@@ -526,3 +471,2 @@ case POSITION_OPTIONS.TOP:

break;
case POSITION_OPTIONS.BOTTOM:

@@ -532,5 +476,4 @@ myStyle.bottom = "0";

}
var buttonsToRender = []; // add decline button
var buttonsToRender = [];
// add decline button
enableDeclineButton && buttonsToRender.push(React__default.createElement(ButtonComponent, Object.assign({

@@ -545,4 +488,4 @@ key: "declineButton",

}
}, customDeclineButtonProps), declineButtonText)); // add accept button
}, customDeclineButtonProps), declineButtonText));
// add accept button
buttonsToRender.push(React__default.createElement(ButtonComponent, Object.assign({

@@ -558,7 +501,5 @@ key: "acceptButton",

}, customButtonProps), buttonText));
if (flipButtons) {
buttonsToRender.reverse();
}
return React__default.createElement(ConditionalWrapper, {

@@ -587,3 +528,2 @@ condition: overlay,

};
return CookieConsent;

@@ -590,0 +530,0 @@ }(React.Component);

@@ -1,2 +0,2 @@

"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("js-cookie")),o=require("react"),n=e(o),i=function(e){var t=e.children;return e.condition?(0,e.wrapper)(t):t};function s(){return(s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e}).apply(this,arguments)}function r(e,t){return(r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}var c,l={TOP:"top",BOTTOM:"bottom",NONE:"none"};(c=exports.SAME_SITE_OPTIONS||(exports.SAME_SITE_OPTIONS={})).STRICT="strict",c.LAX="lax",c.NONE="none";var a={HIDDEN:"hidden",SHOW:"show",BY_COOKIE_VALUE:"byCookieValue"},u=["children"],p={disableStyles:!1,hideOnAccept:!0,hideOnDecline:!0,location:l.BOTTOM,visible:a.BY_COOKIE_VALUE,onAccept:function(e){},onDecline:function(){},cookieName:"CookieConsent",cookieValue:"true",declineCookieValue:"false",setDeclineCookie:!0,buttonText:"I understand",declineButtonText:"I decline",debug:!1,expires:365,containerClasses:"CookieConsent",contentClasses:"",buttonClasses:"",buttonWrapperClasses:"",declineButtonClasses:"",buttonId:"rcc-confirm-button",declineButtonId:"rcc-decline-button",extraCookieOptions:{},disableButtonStyles:!1,enableDeclineButton:!1,flipButtons:!1,sameSite:exports.SAME_SITE_OPTIONS.LAX,ButtonComponent:function(e){var t=e.children,o=function(e,t){if(null==e)return{};var o,n,i={},s=Object.keys(e);for(n=0;n<s.length;n++)t.indexOf(o=s[n])>=0||(i[o]=e[o]);return i}(e,u);return n.createElement("button",Object.assign({},o),t)},overlay:!1,overlayClasses:"",onOverlayClick:function(){},acceptOnOverlayClick:!1,ariaAcceptLabel:"Accept cookies",ariaDeclineLabel:"Decline cookies",acceptOnScroll:!1,acceptOnScrollPercentage:25,customContentAttributes:{},customContainerAttributes:{},customButtonProps:{},customDeclineButtonProps:{},customButtonWrapperAttributes:{},style:{},buttonStyle:{},declineButtonStyle:{},contentStyle:{},overlayStyle:{}},d={visible:!1,style:{alignItems:"baseline",background:"#353535",color:"white",display:"flex",flexWrap:"wrap",justifyContent:"space-between",left:"0",position:"fixed",width:"100%",zIndex:"999"},buttonStyle:{background:"#ffd42d",border:"0",borderRadius:"0px",boxShadow:"none",color:"black",cursor:"pointer",flex:"0 0 auto",padding:"5px 10px",margin:"15px"},declineButtonStyle:{background:"#c12a2a",border:"0",borderRadius:"0px",boxShadow:"none",color:"#e5e5e5",cursor:"pointer",flex:"0 0 auto",padding:"5px 10px",margin:"15px"},contentStyle:{flex:"1 0 300px",margin:"15px"},overlayStyle:{position:"fixed",left:0,top:0,width:"100%",height:"100%",zIndex:"999",backgroundColor:"rgba(0,0,0,0.3)"}},b=function(e){void 0===e&&(e="CookieConsent");var o=t.get(e);return void 0===o?t.get(O(e)):o},O=function(e){return e+"-legacy"},C=function(e){var o,c;function u(){var t;return(t=e.apply(this,arguments)||this).state=d,t.handleScroll=function(){var e=document.documentElement,o=document.body;(e.scrollTop||o.scrollTop)/((e.scrollHeight||o.scrollHeight)-e.clientHeight)*100>t.props.acceptOnScrollPercentage&&t.accept(!0)},t.removeScrollListener=function(){t.props.acceptOnScroll&&window.removeEventListener("scroll",t.handleScroll)},t}c=e,(o=u).prototype=Object.create(c.prototype),o.prototype.constructor=o,r(o,c);var p=u.prototype;return p.componentDidMount=function(){var e=this.props.debug;(void 0===this.getCookieValue()||e)&&(this.setState({visible:!0}),this.props.acceptOnScroll&&window.addEventListener("scroll",this.handleScroll,{passive:!0}))},p.componentWillUnmount=function(){this.removeScrollListener()},p.accept=function(e){var t;void 0===e&&(e=!1);var o=this.props,n=o.hideOnAccept,i=o.onAccept;this.setCookie(o.cookieName,o.cookieValue),i(null!=(t=e)&&t),n&&(this.setState({visible:!1}),this.removeScrollListener())},p.overlayClick=function(){var e=this.props,t=e.onOverlayClick;e.acceptOnOverlayClick&&this.accept(),t()},p.decline=function(){var e=this.props,t=e.hideOnDecline,o=e.onDecline;e.setDeclineCookie&&this.setCookie(e.cookieName,e.declineCookieValue),o(),t&&this.setState({visible:!1})},p.setCookie=function(e,o){var n=this.props,i=n.sameSite,r=this.props.cookieSecurity;void 0===r&&(r=!window.location||"https:"===window.location.protocol);var c=s({expires:n.expires},n.extraCookieOptions,{sameSite:i,secure:r});i===exports.SAME_SITE_OPTIONS.NONE&&t.set(O(e),o,c),t.set(e,o,c)},p.getCookieValue=function(){return b(this.props.cookieName)},p.render=function(){var e=this;switch(this.props.visible){case a.HIDDEN:return null;case a.BY_COOKIE_VALUE:if(!this.state.visible)return null}var t=this.props,o=t.location,r=t.style,c=t.buttonStyle,u=t.declineButtonStyle,p=t.contentStyle,d=t.buttonText,b=t.declineButtonText,O=t.containerClasses,C=t.contentClasses,v=t.buttonClasses,y=t.buttonWrapperClasses,f=t.declineButtonClasses,h=t.buttonId,S=t.declineButtonId,m=t.disableButtonStyles,k=t.enableDeclineButton,g=t.flipButtons,x=t.ButtonComponent,I=t.overlay,B=t.overlayClasses,E=t.overlayStyle,T=t.ariaAcceptLabel,j=t.ariaDeclineLabel,N=t.customContainerAttributes,_=t.customContentAttributes,A=t.customButtonProps,P=t.customDeclineButtonProps,w=t.customButtonWrapperAttributes,D={},L={},V={},M={},W={};switch(t.disableStyles?(D=Object.assign({},r),L=Object.assign({},c),V=Object.assign({},u),M=Object.assign({},p),W=Object.assign({},E)):(D=Object.assign({},s({},this.state.style,r)),M=Object.assign({},s({},this.state.contentStyle,p)),W=Object.assign({},s({},this.state.overlayStyle,E)),m?(L=Object.assign({},c),V=Object.assign({},u)):(L=Object.assign({},s({},this.state.buttonStyle,c)),V=Object.assign({},s({},this.state.declineButtonStyle,u)))),o){case l.TOP:D.top="0";break;case l.BOTTOM:D.bottom="0"}var H=[];return k&&H.push(n.createElement(x,Object.assign({key:"declineButton",style:V,className:f,id:S,"aria-label":j,onClick:function(){e.decline()}},P),b)),H.push(n.createElement(x,Object.assign({key:"acceptButton",style:L,className:v,id:h,"aria-label":T,onClick:function(){e.accept()}},A),d)),g&&H.reverse(),n.createElement(i,{condition:I,wrapper:function(t){return n.createElement("div",{style:W,className:B,onClick:function(){e.overlayClick()}},t)}},n.createElement("div",Object.assign({className:""+O,style:D},N),n.createElement("div",Object.assign({style:M,className:C},_),this.props.children),n.createElement("div",Object.assign({className:""+y},w),H.map((function(e){return e})))))},u}(o.Component);C.defaultProps=p,exports.Cookies=t,exports.ConditionalWrapper=i,exports.CookieConsent=C,exports.OPTIONS=l,exports.POSITION_OPTIONS=l,exports.VISIBILITY_OPTIONS=a,exports.VISIBLE_OPTIONS=a,exports.default=C,exports.defaultCookieConsentName="CookieConsent",exports.getCookieConsentValue=b,exports.getLegacyCookieName=O,exports.resetCookieConsentValue=function(e){void 0===e&&(e="CookieConsent"),t.remove(e)};
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("js-cookie")),o=require("react"),n=e(o),i=function(e){var t=e.children;return e.condition?(0,e.wrapper)(t):t};function s(){return(s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e}).apply(this,arguments)}function r(e,t){return(r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}var c,l={TOP:"top",BOTTOM:"bottom",NONE:"none"};(c=exports.SAME_SITE_OPTIONS||(exports.SAME_SITE_OPTIONS={})).STRICT="strict",c.LAX="lax",c.NONE="none";var a={HIDDEN:"hidden",SHOW:"show",BY_COOKIE_VALUE:"byCookieValue"},u=["children"],p={disableStyles:!1,hideOnAccept:!0,hideOnDecline:!0,location:l.BOTTOM,visible:a.BY_COOKIE_VALUE,onAccept:function(e){},onDecline:function(){},cookieName:"CookieConsent",cookieValue:"true",declineCookieValue:"false",setDeclineCookie:!0,buttonText:"I understand",declineButtonText:"I decline",debug:!1,expires:365,containerClasses:"CookieConsent",contentClasses:"",buttonClasses:"",buttonWrapperClasses:"",declineButtonClasses:"",buttonId:"rcc-confirm-button",declineButtonId:"rcc-decline-button",extraCookieOptions:{},disableButtonStyles:!1,enableDeclineButton:!1,flipButtons:!1,sameSite:exports.SAME_SITE_OPTIONS.LAX,ButtonComponent:function(e){var t=e.children,o=function(e,t){if(null==e)return{};var o,n,i={},s=Object.keys(e);for(n=0;n<s.length;n++)t.indexOf(o=s[n])>=0||(i[o]=e[o]);return i}(e,u);return n.createElement("button",Object.assign({},o),t)},overlay:!1,overlayClasses:"",onOverlayClick:function(){},acceptOnOverlayClick:!1,ariaAcceptLabel:"Accept cookies",ariaDeclineLabel:"Decline cookies",acceptOnScroll:!1,acceptOnScrollPercentage:25,customContentAttributes:{},customContainerAttributes:{},customButtonProps:{},customDeclineButtonProps:{},customButtonWrapperAttributes:{},style:{},buttonStyle:{},declineButtonStyle:{},contentStyle:{},overlayStyle:{}},d={visible:!1,style:{alignItems:"baseline",background:"#353535",color:"white",display:"flex",flexWrap:"wrap",justifyContent:"space-between",left:"0",position:"fixed",width:"100%",zIndex:"999"},buttonStyle:{background:"#ffd42d",border:"0",borderRadius:"0px",boxShadow:"none",color:"black",cursor:"pointer",flex:"0 0 auto",padding:"5px 10px",margin:"15px"},declineButtonStyle:{background:"#c12a2a",border:"0",borderRadius:"0px",boxShadow:"none",color:"#e5e5e5",cursor:"pointer",flex:"0 0 auto",padding:"5px 10px",margin:"15px"},contentStyle:{flex:"1 0 300px",margin:"15px"},overlayStyle:{position:"fixed",left:0,top:0,width:"100%",height:"100%",zIndex:"999",backgroundColor:"rgba(0,0,0,0.3)"}},b=function(e){void 0===e&&(e="CookieConsent");var o=t.get(e);return void 0===o?t.get(O(e)):o},O=function(e){return e+"-legacy"},C=function(e){var o,c;function u(){var t;return(t=e.apply(this,arguments)||this).state=d,t.handleScroll=function(){var e=s({},p,t.props),o=document.documentElement,n=document.body;(o.scrollTop||n.scrollTop)/((o.scrollHeight||n.scrollHeight)-o.clientHeight)*100>e.acceptOnScrollPercentage&&t.accept(!0)},t.removeScrollListener=function(){t.props.acceptOnScroll&&window.removeEventListener("scroll",t.handleScroll)},t}c=e,(o=u).prototype=Object.create(c.prototype),o.prototype.constructor=o,r(o,c);var C=u.prototype;return C.componentDidMount=function(){var e=this.props.debug;(void 0===this.getCookieValue()||e)&&(this.setState({visible:!0}),this.props.acceptOnScroll&&window.addEventListener("scroll",this.handleScroll,{passive:!0}))},C.componentWillUnmount=function(){this.removeScrollListener()},C.accept=function(e){var t;void 0===e&&(e=!1);var o=s({},p,this.props),n=o.hideOnAccept,i=o.onAccept;this.setCookie(o.cookieName,o.cookieValue),i(null!=(t=e)&&t),n&&(this.setState({visible:!1}),this.removeScrollListener())},C.overlayClick=function(){var e=s({},p,this.props),t=e.onOverlayClick;e.acceptOnOverlayClick&&this.accept(),t()},C.decline=function(){var e=s({},p,this.props),t=e.hideOnDecline,o=e.onDecline;e.setDeclineCookie&&this.setCookie(e.cookieName,e.declineCookieValue),o(),t&&this.setState({visible:!1})},C.setCookie=function(e,o){var n=this.props,i=n.sameSite,r=this.props.cookieSecurity;void 0===r&&(r=!window.location||"https:"===window.location.protocol);var c=s({expires:n.expires},n.extraCookieOptions,{sameSite:i,secure:r});i===exports.SAME_SITE_OPTIONS.NONE&&t.set(O(e),o,c),t.set(e,o,c)},C.getCookieValue=function(){return b(this.props.cookieName)},C.render=function(){var e=this;switch(this.props.visible){case a.HIDDEN:return null;case a.BY_COOKIE_VALUE:if(!this.state.visible)return null}var t=this.props,o=t.location,r=t.style,c=t.buttonStyle,u=t.declineButtonStyle,p=t.contentStyle,d=t.buttonText,b=t.declineButtonText,O=t.containerClasses,C=t.contentClasses,v=t.buttonClasses,y=t.buttonWrapperClasses,f=t.declineButtonClasses,h=t.buttonId,S=t.declineButtonId,m=t.disableButtonStyles,k=t.enableDeclineButton,g=t.flipButtons,x=t.ButtonComponent,I=t.overlay,B=t.overlayClasses,E=t.overlayStyle,T=t.ariaAcceptLabel,j=t.ariaDeclineLabel,N=t.customContainerAttributes,_=t.customContentAttributes,A=t.customButtonProps,P=t.customDeclineButtonProps,w=t.customButtonWrapperAttributes,D={},L={},V={},M={},W={};switch(t.disableStyles?(D=Object.assign({},r),L=Object.assign({},c),V=Object.assign({},u),M=Object.assign({},p),W=Object.assign({},E)):(D=Object.assign({},s({},this.state.style,r)),M=Object.assign({},s({},this.state.contentStyle,p)),W=Object.assign({},s({},this.state.overlayStyle,E)),m?(L=Object.assign({},c),V=Object.assign({},u)):(L=Object.assign({},s({},this.state.buttonStyle,c)),V=Object.assign({},s({},this.state.declineButtonStyle,u)))),o){case l.TOP:D.top="0";break;case l.BOTTOM:D.bottom="0"}var H=[];return k&&H.push(n.createElement(x,Object.assign({key:"declineButton",style:V,className:f,id:S,"aria-label":j,onClick:function(){e.decline()}},P),b)),H.push(n.createElement(x,Object.assign({key:"acceptButton",style:L,className:v,id:h,"aria-label":T,onClick:function(){e.accept()}},A),d)),g&&H.reverse(),n.createElement(i,{condition:I,wrapper:function(t){return n.createElement("div",{style:W,className:B,onClick:function(){e.overlayClick()}},t)}},n.createElement("div",Object.assign({className:""+O,style:D},N),n.createElement("div",Object.assign({style:M,className:C},_),this.props.children),n.createElement("div",Object.assign({className:""+y},w),H.map((function(e){return e})))))},u}(o.Component);C.defaultProps=p,exports.Cookies=t,exports.ConditionalWrapper=i,exports.CookieConsent=C,exports.OPTIONS=l,exports.POSITION_OPTIONS=l,exports.VISIBILITY_OPTIONS=a,exports.VISIBLE_OPTIONS=a,exports.default=C,exports.defaultCookieConsentName="CookieConsent",exports.getCookieConsentValue=b,exports.getLegacyCookieName=O,exports.resetCookieConsentValue=function(e){void 0===e&&(e="CookieConsent"),t.remove(e)};
//# sourceMappingURL=react-cookie-consent.cjs.production.min.js.map

@@ -14,4 +14,4 @@ import Cookies from 'js-cookie';

var condition = _ref.condition,
wrapper = _ref.wrapper,
children = _ref.children;
wrapper = _ref.wrapper,
children = _ref.children;
return condition ? wrapper(children) : children;

@@ -24,3 +24,2 @@ };

var source = arguments[i];
for (var key in source) {

@@ -32,3 +31,2 @@ if (Object.prototype.hasOwnProperty.call(source, key)) {

}
return target;

@@ -38,10 +36,7 @@ };

}
function _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
_setPrototypeOf(subClass, superClass);
}
function _setPrototypeOf(o, p) {

@@ -54,3 +49,2 @@ _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {

}
function _objectWithoutPropertiesLoose(source, excluded) {

@@ -61,3 +55,2 @@ if (source == null) return {};

var key, i;
for (i = 0; i < sourceKeys.length; i++) {

@@ -68,3 +61,2 @@ key = sourceKeys[i];

}
return target;

@@ -80,3 +72,2 @@ }

var SAME_SITE_OPTIONS;
(function (SAME_SITE_OPTIONS) {

@@ -97,10 +88,7 @@ SAME_SITE_OPTIONS["STRICT"] = "strict";

var _excluded = ["children"];
var DefaultButtonComponent = function DefaultButtonComponent(_ref) {
var children = _ref.children,
props = _objectWithoutPropertiesLoose(_ref, _excluded);
props = _objectWithoutPropertiesLoose(_ref, _excluded);
return React.createElement("button", Object.assign({}, props), children);
};
var defaultCookieConsentProps = {

@@ -212,3 +200,2 @@ disableStyles: false,

*/
var getCookieConsentValue = function getCookieConsentValue(name) {

@@ -218,9 +205,7 @@ if (name === void 0) {

}
var cookieValue = Cookies.get(name); // if the cookieValue is undefined check for the legacy cookie
var cookieValue = Cookies.get(name);
// if the cookieValue is undefined check for the legacy cookie
if (cookieValue === undefined) {
return Cookies.get(getLegacyCookieName(name));
}
return cookieValue;

@@ -233,3 +218,2 @@ };

*/
var resetCookieConsentValue = function resetCookieConsentValue(name) {

@@ -239,3 +223,2 @@ if (name === void 0) {

}
Cookies.remove(name);

@@ -247,3 +230,2 @@ };

*/
var getLegacyCookieName = function getLegacyCookieName(name) {

@@ -255,6 +237,4 @@ return name + "-legacy";

_inheritsLoose(CookieConsent, _Component);
function CookieConsent() {
var _this;
_this = _Component.apply(this, arguments) || this;

@@ -265,6 +245,6 @@ _this.state = defaultState;

*/
_this.handleScroll = function () {
var acceptOnScrollPercentage = _this.props.acceptOnScrollPercentage; // (top / height) - height * 100
var _defaultCookieConsent = _extends({}, defaultCookieConsentProps, _this.props),
acceptOnScrollPercentage = _defaultCookieConsent.acceptOnScrollPercentage;
// (top / height) - height * 100
var rootNode = document.documentElement;

@@ -275,3 +255,2 @@ var body = document.body;

var percentage = (rootNode[top] || body[top]) / ((rootNode[height] || body[height]) - rootNode.clientHeight) * 100;
if (percentage > acceptOnScrollPercentage) {

@@ -281,6 +260,4 @@ _this.accept(true);

};
_this.removeScrollListener = function () {
var acceptOnScroll = _this.props.acceptOnScroll;
if (acceptOnScroll) {

@@ -290,16 +267,13 @@ window.removeEventListener("scroll", _this.handleScroll);

};
return _this;
}
var _proto = CookieConsent.prototype;
_proto.componentDidMount = function componentDidMount() {
var debug = this.props.debug; // if cookie undefined or debug
var debug = this.props.debug;
// if cookie undefined or debug
if (this.getCookieValue() === undefined || debug) {
this.setState({
visible: true
}); // if acceptOnScroll is set to true and (cookie is undefined or debug is set to true), add a listener.
});
// if acceptOnScroll is set to true and (cookie is undefined or debug is set to true), add a listener.
if (this.props.acceptOnScroll) {

@@ -312,3 +286,2 @@ window.addEventListener("scroll", this.handleScroll, {

};
_proto.componentWillUnmount = function componentWillUnmount() {

@@ -320,20 +293,15 @@ // remove listener if still set

* Set a persistent accept cookie
*/
;
*/;
_proto.accept = function accept(acceptedByScrolling) {
var _acceptedByScrolling;
if (acceptedByScrolling === void 0) {
acceptedByScrolling = false;
}
var _this$props = this.props,
cookieName = _this$props.cookieName,
cookieValue = _this$props.cookieValue,
hideOnAccept = _this$props.hideOnAccept,
onAccept = _this$props.onAccept;
var _defaultCookieConsent2 = _extends({}, defaultCookieConsentProps, this.props),
cookieName = _defaultCookieConsent2.cookieName,
cookieValue = _defaultCookieConsent2.cookieValue,
hideOnAccept = _defaultCookieConsent2.hideOnAccept,
onAccept = _defaultCookieConsent2.onAccept;
this.setCookie(cookieName, cookieValue);
onAccept((_acceptedByScrolling = acceptedByScrolling) != null ? _acceptedByScrolling : false);
if (hideOnAccept) {

@@ -348,14 +316,10 @@ this.setState({

* Handle a click on the overlay
*/
;
*/;
_proto.overlayClick = function overlayClick() {
var _this$props2 = this.props,
acceptOnOverlayClick = _this$props2.acceptOnOverlayClick,
onOverlayClick = _this$props2.onOverlayClick;
var _defaultCookieConsent3 = _extends({}, defaultCookieConsentProps, this.props),
acceptOnOverlayClick = _defaultCookieConsent3.acceptOnOverlayClick,
onOverlayClick = _defaultCookieConsent3.onOverlayClick;
if (acceptOnOverlayClick) {
this.accept();
}
onOverlayClick();

@@ -365,19 +329,14 @@ }

* Set a persistent decline cookie
*/
;
*/;
_proto.decline = function decline() {
var _this$props3 = this.props,
cookieName = _this$props3.cookieName,
declineCookieValue = _this$props3.declineCookieValue,
hideOnDecline = _this$props3.hideOnDecline,
onDecline = _this$props3.onDecline,
setDeclineCookie = _this$props3.setDeclineCookie;
var _defaultCookieConsent4 = _extends({}, defaultCookieConsentProps, this.props),
cookieName = _defaultCookieConsent4.cookieName,
declineCookieValue = _defaultCookieConsent4.declineCookieValue,
hideOnDecline = _defaultCookieConsent4.hideOnDecline,
onDecline = _defaultCookieConsent4.onDecline,
setDeclineCookie = _defaultCookieConsent4.setDeclineCookie;
if (setDeclineCookie) {
this.setCookie(cookieName, declineCookieValue);
}
onDecline();
if (hideOnDecline) {

@@ -393,16 +352,12 @@ this.setState({

* https://web.dev/samesite-cookie-recipes/#handling-incompatible-clients
*/
;
*/;
_proto.setCookie = function setCookie(cookieName, cookieValue) {
var _this$props4 = this.props,
extraCookieOptions = _this$props4.extraCookieOptions,
expires = _this$props4.expires,
sameSite = _this$props4.sameSite;
var _this$props = this.props,
extraCookieOptions = _this$props.extraCookieOptions,
expires = _this$props.expires,
sameSite = _this$props.sameSite;
var cookieSecurity = this.props.cookieSecurity;
if (cookieSecurity === undefined) {
cookieSecurity = window.location ? window.location.protocol === "https:" : true;
}
var cookieOptions = _extends({

@@ -413,11 +368,9 @@ expires: expires

secure: cookieSecurity
}); // Fallback for older browsers where can not set SameSite=None,
});
// Fallback for older browsers where can not set SameSite=None,
// SEE: https://web.dev/samesite-cookie-recipes/#handling-incompatible-clients
if (sameSite === SAME_SITE_OPTIONS.NONE) {
Cookies.set(getLegacyCookieName(cookieName), cookieValue, cookieOptions);
} // set the regular cookie
}
// set the regular cookie
Cookies.set(cookieName, cookieValue, cookieOptions);

@@ -429,5 +382,3 @@ }

* to: https://web.dev/samesite-cookie-recipes/#handling-incompatible-clients
*/
;
*/;
_proto.getCookieValue = function getCookieValue() {

@@ -437,6 +388,4 @@ var cookieName = this.props.cookieName;

};
_proto.render = function render() {
var _this2 = this;
// If the bar shouldn't be visible don't render anything.

@@ -446,3 +395,2 @@ switch (this.props.visible) {

return null;
case VISIBILITY_OPTIONS.BY_COOKIE_VALUE:

@@ -452,36 +400,34 @@ if (!this.state.visible) {

}
break;
}
var _this$props5 = this.props,
location = _this$props5.location,
style = _this$props5.style,
buttonStyle = _this$props5.buttonStyle,
declineButtonStyle = _this$props5.declineButtonStyle,
contentStyle = _this$props5.contentStyle,
disableStyles = _this$props5.disableStyles,
buttonText = _this$props5.buttonText,
declineButtonText = _this$props5.declineButtonText,
containerClasses = _this$props5.containerClasses,
contentClasses = _this$props5.contentClasses,
buttonClasses = _this$props5.buttonClasses,
buttonWrapperClasses = _this$props5.buttonWrapperClasses,
declineButtonClasses = _this$props5.declineButtonClasses,
buttonId = _this$props5.buttonId,
declineButtonId = _this$props5.declineButtonId,
disableButtonStyles = _this$props5.disableButtonStyles,
enableDeclineButton = _this$props5.enableDeclineButton,
flipButtons = _this$props5.flipButtons,
ButtonComponent = _this$props5.ButtonComponent,
overlay = _this$props5.overlay,
overlayClasses = _this$props5.overlayClasses,
overlayStyle = _this$props5.overlayStyle,
ariaAcceptLabel = _this$props5.ariaAcceptLabel,
ariaDeclineLabel = _this$props5.ariaDeclineLabel,
customContainerAttributes = _this$props5.customContainerAttributes,
customContentAttributes = _this$props5.customContentAttributes,
customButtonProps = _this$props5.customButtonProps,
customDeclineButtonProps = _this$props5.customDeclineButtonProps,
customButtonWrapperAttributes = _this$props5.customButtonWrapperAttributes;
var _this$props2 = this.props,
location = _this$props2.location,
style = _this$props2.style,
buttonStyle = _this$props2.buttonStyle,
declineButtonStyle = _this$props2.declineButtonStyle,
contentStyle = _this$props2.contentStyle,
disableStyles = _this$props2.disableStyles,
buttonText = _this$props2.buttonText,
declineButtonText = _this$props2.declineButtonText,
containerClasses = _this$props2.containerClasses,
contentClasses = _this$props2.contentClasses,
buttonClasses = _this$props2.buttonClasses,
buttonWrapperClasses = _this$props2.buttonWrapperClasses,
declineButtonClasses = _this$props2.declineButtonClasses,
buttonId = _this$props2.buttonId,
declineButtonId = _this$props2.declineButtonId,
disableButtonStyles = _this$props2.disableButtonStyles,
enableDeclineButton = _this$props2.enableDeclineButton,
flipButtons = _this$props2.flipButtons,
ButtonComponent = _this$props2.ButtonComponent,
overlay = _this$props2.overlay,
overlayClasses = _this$props2.overlayClasses,
overlayStyle = _this$props2.overlayStyle,
ariaAcceptLabel = _this$props2.ariaAcceptLabel,
ariaDeclineLabel = _this$props2.ariaDeclineLabel,
customContainerAttributes = _this$props2.customContainerAttributes,
customContentAttributes = _this$props2.customContentAttributes,
customButtonProps = _this$props2.customButtonProps,
customDeclineButtonProps = _this$props2.customDeclineButtonProps,
customButtonWrapperAttributes = _this$props2.customButtonWrapperAttributes;
var myStyle = {};

@@ -492,3 +438,2 @@ var myButtonStyle = {};

var myOverlayStyle = {};
if (disableStyles) {

@@ -505,4 +450,4 @@ // if styles are disabled use the provided styles (or none)

myContentStyle = Object.assign({}, _extends({}, this.state.contentStyle, contentStyle));
myOverlayStyle = Object.assign({}, _extends({}, this.state.overlayStyle, overlayStyle)); // switch to disable JUST the button styles
myOverlayStyle = Object.assign({}, _extends({}, this.state.overlayStyle, overlayStyle));
// switch to disable JUST the button styles
if (disableButtonStyles) {

@@ -515,5 +460,4 @@ myButtonStyle = Object.assign({}, buttonStyle);

}
} // syntactic sugar to enable user to easily select top / bottom
}
// syntactic sugar to enable user to easily select top / bottom
switch (location) {

@@ -523,3 +467,2 @@ case POSITION_OPTIONS.TOP:

break;
case POSITION_OPTIONS.BOTTOM:

@@ -529,5 +472,4 @@ myStyle.bottom = "0";

}
var buttonsToRender = []; // add decline button
var buttonsToRender = [];
// add decline button
enableDeclineButton && buttonsToRender.push(React.createElement(ButtonComponent, Object.assign({

@@ -542,4 +484,4 @@ key: "declineButton",

}
}, customDeclineButtonProps), declineButtonText)); // add accept button
}, customDeclineButtonProps), declineButtonText));
// add accept button
buttonsToRender.push(React.createElement(ButtonComponent, Object.assign({

@@ -555,7 +497,5 @@ key: "acceptButton",

}, customButtonProps), buttonText));
if (flipButtons) {
buttonsToRender.reverse();
}
return React.createElement(ConditionalWrapper, {

@@ -584,3 +524,2 @@ condition: overlay,

};
return CookieConsent;

@@ -587,0 +526,0 @@ }(Component);

{
"name": "react-cookie-consent",
"version": "8.0.1",
"version": "9.0.0",
"description": "A small, simple and customizable cookie consent bar for use in React applications.",

@@ -35,2 +35,3 @@ "keywords": [

"build-storybook": "build-storybook",
"install-husky": "npx husky install",
"lint": "tsdx lint",

@@ -43,4 +44,7 @@ "major": "npm --no-git-tag-version version major",

"prettier": "prettier 'src/**/*.{js*,ts*,htm*,md,scss}' --write",
"install-husky": "npx husky install",
"publish": "npx np",
"release": "npm run build && git add -A && git tag $npm_package_version && git commit -m \"release $npm_package_version\" && git push && git push --tags && npm publish",
"release-major": "npm run major && npm run release",
"release-minor": "npm run minor && npm run release",
"release-patch": "npm run patch && npm run release",
"size": "size-limit",

@@ -74,2 +78,3 @@ "start": "tsdx watch",

"babel-loader": "^8.2.5",
"gh-pages": "^4.0.0",
"husky": "^8.0.1",

@@ -76,0 +81,0 @@ "prettier": "^2.6.2",

@@ -7,6 +7,4 @@ # :cookie: react-cookie-consent :cookie:

Demo: https://mastermindzh.github.io/react-cookie-consent/
Demo (storybook): <https://mastermindzh.github.io/react-cookie-consent/>
Example branch: https://github.com/Mastermindzh/react-cookie-consent/tree/example
![Downloads](https://img.shields.io/npm/dm/react-cookie-consent) ![Dependent repos (via libraries.io)](https://img.shields.io/librariesio/dependent-repos/npm/react-cookie-consent) ![GitHub contributors](https://img.shields.io/github/contributors/mastermindzh/react-cookie-consent) ![Minified size](https://img.shields.io/bundlephobia/min/react-cookie-consent) ![npm type definitions](https://img.shields.io/npm/types/react-cookie-consent) ![license-mit](https://img.shields.io/badge/license-MIT-green)

@@ -22,20 +20,24 @@

- [Installation](#installation)
- [Using it](#using-it)
- [getting the cookies value in your own code](#getting-the-cookies-value-in-your-own-code)
- [Props](#props)
- [Debugging it](#debugging-it)
- [Why are there two cookies? One of which named "Legacy"](#why-are-there-two-cookies-one-of-which-named-legacy)
- [Styling it](#styling-it)
- [Examples](#examples)
- [Changing the bar background to red](#changing-the-bar-background-to-red)
- [Changing the button font-weight to bold](#changing-the-button-font-weight-to-bold)
- [Using predefined CSS classes](#using-predefined-css-classes)
- [Accept on scroll](#accept-on-scroll)
- [Flipping the buttons](#flipping-the-buttons)
- [Extra cookie options](#extra-cookie-options)
- [Rainbows!](#rainbows)
- [Overlay](#overlay)
- [Contributor information](#contributor-information)
- [Projects using react-cookie-consent](#projects-using-react-cookie-consent)
- [:cookie: react-cookie-consent :cookie:](#cookie-react-cookie-consent-cookie)
- [Default look](#default-look)
- [Table of contents](#table-of-contents)
- [Installation](#installation)
- [Using it](#using-it)
- [getting the cookies value in your own code](#getting-the-cookies-value-in-your-own-code)
- [reset the cookies value in your own code](#reset-the-cookies-value-in-your-own-code)
- [Props](#props)
- [Debugging it](#debugging-it)
- [Why are there two cookies? One of which named "Legacy"](#why-are-there-two-cookies-one-of-which-named-legacy)
- [Styling it](#styling-it)
- [Examples](#examples)
- [Changing the bar background to red](#changing-the-bar-background-to-red)
- [Changing the button font-weight to bold](#changing-the-button-font-weight-to-bold)
- [Using predefined CSS classes](#using-predefined-css-classes)
- [Accept on scroll](#accept-on-scroll)
- [Flipping the buttons](#flipping-the-buttons)
- [Extra cookie options](#extra-cookie-options)
- [Rainbows](#rainbows)
- [Overlay](#overlay)
- [Contributor information](#contributor-information)
- [Projects using react-cookie-consent](#projects-using-react-cookie-consent)

@@ -120,3 +122,3 @@ <!-- tocstop -->

react-cookie-consent exports a function called `getCookieConsentValue`. You can use it in your own code like so:
react-cookie-consent exports a function called `getCookieConsentValue(cookieName: string)`. You can use it in your own code like so:

@@ -126,3 +128,3 @@ ```js

console.log(getCookieConsentValue());
console.log(getCookieConsentValue("your_custom_cookie_name"));
```

@@ -153,3 +155,3 @@

| declineButtonText | string or React component | "I decline" | Text to appear on the decline button |
| cookieName | string | "CookieConsent" | Name of the cookie used to track whether the user has agreed. |
| cookieName | string | "CookieConsent" | Name of the cookie used to track whether the user has agreed. Note that you also have to pass this to the `getCookieConsentValue` and `resetCookieConsentValue` functions as they default to "CookieConsent" as well. |
| cookieValue | string or boolean or number | true | Value to be saved under the cookieName. |

@@ -306,3 +308,3 @@ | declineCookieValue | string or boolean or number | false | Value to be saved under the cookieName when declined. |

#### Rainbows!
#### Rainbows

@@ -309,0 +311,0 @@ ![rainbows!](https://github.com/Mastermindzh/react-cookie-consent/blob/master/images/rainbow.png?raw=true)

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc