mirror of
https://github.com/Mastermindzh/react-cookie-consent.git
synced 2025-01-20 18:41:44 +01:00
Fixes typo with js cookie samesite props
This commit is contained in:
parent
a45da474b4
commit
3cf103ae3a
24
src/index.js
24
src/index.js
@ -114,7 +114,7 @@ class CookieConsent extends Component {
|
|||||||
hideOnAccept,
|
hideOnAccept,
|
||||||
onAccept,
|
onAccept,
|
||||||
extraCookieOptions,
|
extraCookieOptions,
|
||||||
samesite,
|
sameSite,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
// fire onAccept
|
// fire onAccept
|
||||||
@ -123,13 +123,13 @@ class CookieConsent extends Component {
|
|||||||
// remove listener if set
|
// remove listener if set
|
||||||
window.removeEventListener("scroll", this.handleScroll);
|
window.removeEventListener("scroll", this.handleScroll);
|
||||||
|
|
||||||
if (samesite === SAMESITE_OPTIONS.NONE) {
|
if (sameSite === SAMESITE_OPTIONS.NONE) {
|
||||||
Cookies.set(cookieName, cookieValue, { expires, samesite, secure: true, ...extraCookieOptions });
|
Cookies.set(cookieName, cookieValue, { expires, sameSite, secure: true, ...extraCookieOptions });
|
||||||
|
|
||||||
// Fallback for older browsers where can not set SameSite=None, SEE: https://web.dev/samesite-cookie-recipes/#handling-incompatible-clients
|
// Fallback for older browsers where can not set SameSite=None, SEE: https://web.dev/sameSite-cookie-recipes/#handling-incompatible-clients
|
||||||
Cookies.set(cookieName, cookieValue, { expires, secure: true, ...extraCookieOptions });
|
Cookies.set(cookieName, cookieValue, { expires, secure: true, ...extraCookieOptions });
|
||||||
} else {
|
} else {
|
||||||
Cookies.set(cookieName, cookieValue, { expires, samesite, ...extraCookieOptions });
|
Cookies.set(cookieName, cookieValue, { expires, sameSite, ...extraCookieOptions });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hideOnAccept) {
|
if (hideOnAccept) {
|
||||||
@ -149,7 +149,7 @@ class CookieConsent extends Component {
|
|||||||
onDecline,
|
onDecline,
|
||||||
extraCookieOptions,
|
extraCookieOptions,
|
||||||
setDeclineCookie,
|
setDeclineCookie,
|
||||||
samesite,
|
sameSite,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
// fire onDecline
|
// fire onDecline
|
||||||
@ -158,13 +158,13 @@ class CookieConsent extends Component {
|
|||||||
// remove listener if set
|
// remove listener if set
|
||||||
window.removeEventListener("scroll", this.handleScroll);
|
window.removeEventListener("scroll", this.handleScroll);
|
||||||
|
|
||||||
if (setDeclineCookie && samesite === SAMESITE_OPTIONS.NONE) {
|
if (setDeclineCookie && sameSite === SAMESITE_OPTIONS.NONE) {
|
||||||
Cookies.set(cookieName, declineCookieValue, { expires, samesite, secure: true, ...extraCookieOptions });
|
Cookies.set(cookieName, declineCookieValue, { expires, sameSite, secure: true, ...extraCookieOptions });
|
||||||
|
|
||||||
// Fallback for older browsers where can not set SameSite=None, SEE: https://web.dev/samesite-cookie-recipes/#handling-incompatible-clients
|
// Fallback for older browsers where can not set SameSite=None, SEE: https://web.dev/sameSite-cookie-recipes/#handling-incompatible-clients
|
||||||
Cookies.set(cookieName, declineCookieValue, { expires, secure: true, ...extraCookieOptions });
|
Cookies.set(cookieName, declineCookieValue, { expires, secure: true, ...extraCookieOptions });
|
||||||
} else if (setDeclineCookie) {
|
} else if (setDeclineCookie) {
|
||||||
Cookies.set(cookieName, declineCookieValue, { expires, samesite, ...extraCookieOptions });
|
Cookies.set(cookieName, declineCookieValue, { expires, sameSite, ...extraCookieOptions });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hideOnDecline) {
|
if (hideOnDecline) {
|
||||||
@ -294,7 +294,7 @@ class CookieConsent extends Component {
|
|||||||
|
|
||||||
CookieConsent.propTypes = {
|
CookieConsent.propTypes = {
|
||||||
location: PropTypes.oneOf(Object.keys(OPTIONS).map((key) => OPTIONS[key])),
|
location: PropTypes.oneOf(Object.keys(OPTIONS).map((key) => OPTIONS[key])),
|
||||||
samesite: PropTypes.oneOf(Object.keys(SAMESITE_OPTIONS).map((key) => SAMESITE_OPTIONS[key])),
|
sameSite: PropTypes.oneOf(Object.keys(SAMESITE_OPTIONS).map((key) => SAMESITE_OPTIONS[key])),
|
||||||
style: PropTypes.object,
|
style: PropTypes.object,
|
||||||
buttonStyle: PropTypes.object,
|
buttonStyle: PropTypes.object,
|
||||||
declineButtonStyle: PropTypes.object,
|
declineButtonStyle: PropTypes.object,
|
||||||
@ -336,7 +336,7 @@ CookieConsent.defaultProps = {
|
|||||||
acceptOnScroll: false,
|
acceptOnScroll: false,
|
||||||
acceptOnScrollPercentage: 25,
|
acceptOnScrollPercentage: 25,
|
||||||
location: OPTIONS.BOTTOM,
|
location: OPTIONS.BOTTOM,
|
||||||
samesite: SAMESITE_OPTIONS.STRICT,
|
sameSite: SAMESITE_OPTIONS.STRICT,
|
||||||
onAccept: () => { },
|
onAccept: () => { },
|
||||||
onDecline: () => { },
|
onDecline: () => { },
|
||||||
cookieName: "CookieConsent",
|
cookieName: "CookieConsent",
|
||||||
|
Loading…
Reference in New Issue
Block a user