release 6.4.0

This commit is contained in:
Rick van Lieshout 2021-09-17 18:25:41 +02:00
parent c3ba87e62f
commit 7136086602
3 changed files with 92 additions and 70 deletions

View File

@ -179,16 +179,22 @@
return l(); return l();
}, },
OPTIONS: function () { OPTIONS: function () {
return O; return m;
}, },
SAME_SITE_OPTIONS: function () { SAME_SITE_OPTIONS: function () {
return g; return g;
}, },
VISIBLE_OPTIONS: function () {
return S;
},
default: function () { default: function () {
return w; return B;
}, },
getCookieConsentValue: function () { getCookieConsentValue: function () {
return S; return C;
},
resetCookieConsentValue: function () {
return k;
}, },
}); });
const e = require("react"); const e = require("react");
@ -278,8 +284,8 @@
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return e; return e;
} }
function m(e) { function O(e) {
return (m = Object.setPrototypeOf return (O = Object.setPrototypeOf
? Object.getPrototypeOf ? Object.getPrototypeOf
: function (e) { : function (e) {
return e.__proto__ || Object.getPrototypeOf(e); return e.__proto__ || Object.getPrototypeOf(e);
@ -298,24 +304,29 @@
e e
); );
} }
var O = { TOP: "top", BOTTOM: "bottom", NONE: "none" }, var m = { TOP: "top", BOTTOM: "bottom", NONE: "none" },
g = { STRICT: "strict", LAX: "lax", NONE: "none" }, g = { STRICT: "strict", LAX: "lax", NONE: "none" },
S = function () { S = { HIDDEN: "hidden", SHOW: "show", BY_COOKIE_VALUE: "byCookieValue" },
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : k, C = function () {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : w,
t = l().get(e); t = l().get(e);
return void 0 === t && (t = l().get(C(e))), t; return void 0 === t && (t = l().get(x(e))), t;
}, },
C = function (e) { k = function () {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : w;
l().remove(e);
},
x = function (e) {
return "".concat(e, "-legacy"); return "".concat(e, "-legacy");
}, },
k = "CookieConsent", w = "CookieConsent",
x = function (e) { j = function (e) {
var t = e.condition, var t = e.condition,
n = e.wrapper, n = e.wrapper,
o = e.children; o = e.children;
return t ? n(o) : o; return t ? n(o) : o;
}, },
j = (function (e) { T = (function (e) {
!(function (e, t) { !(function (e, t) {
if ("function" != typeof t && null !== t) if ("function" != typeof t && null !== t)
throw new TypeError("Super expression must either be null or a function"); throw new TypeError("Super expression must either be null or a function");
@ -344,9 +355,9 @@
})()), })()),
function () { function () {
var e, var e,
t = m(r); t = O(r);
if (i) { if (i) {
var n = m(this).constructor; var n = O(this).constructor;
e = Reflect.construct(t, arguments, n); e = Reflect.construct(t, arguments, n);
} else e = t.apply(this, arguments); } else e = t.apply(this, arguments);
return y(this, e); return y(this, e);
@ -474,21 +485,26 @@
c = this.props.cookieSecurity; c = this.props.cookieSecurity;
void 0 === c && (c = !location || "https:" === location.protocol); void 0 === c && (c = !location || "https:" === location.protocol);
var a = f(f({ expires: r }, o), {}, { sameSite: i, secure: c }); var a = f(f({ expires: r }, o), {}, { sameSite: i, secure: c });
i === g.NONE && l().set(C(e), t, a), l().set(e, t, a); i === g.NONE && l().set(x(e), t, a), l().set(e, t, a);
}, },
}, },
{ {
key: "getCookieValue", key: "getCookieValue",
value: function () { value: function () {
var e = this.props.cookieName; var e = this.props.cookieName;
return S(e); return C(e);
}, },
}, },
{ {
key: "render", key: "render",
value: function () { value: function () {
var e = this; var e = this;
if (!this.state.visible) return null; switch (this.props.visible) {
case S.HIDDEN:
return null;
case S.BY_COOKIE_VALUE:
if (!this.state.visible) return null;
}
var n = this.props, var n = this.props,
o = n.location, o = n.location,
r = n.style, r = n.style,
@ -502,57 +518,57 @@
b = n.contentClasses, b = n.contentClasses,
y = n.buttonClasses, y = n.buttonClasses,
v = n.buttonWrapperClasses, v = n.buttonWrapperClasses,
m = n.declineButtonClasses, O = n.declineButtonClasses,
h = n.buttonId, h = n.buttonId,
g = n.declineButtonId, g = n.declineButtonId,
S = n.disableButtonStyles, C = n.disableButtonStyles,
C = n.enableDeclineButton, k = n.enableDeclineButton,
k = n.flipButtons, x = n.flipButtons,
j = n.ButtonComponent, w = n.ButtonComponent,
w = n.overlay, T = n.overlay,
T = n.overlayClasses, B = n.overlayClasses,
B = n.overlayStyle, E = n.overlayStyle,
P = n.ariaAcceptLabel, P = n.ariaAcceptLabel,
E = n.ariaDeclineLabel, D = n.ariaDeclineLabel,
D = {},
I = {}, I = {},
N = {},
_ = {}, _ = {},
R = {}; N = {},
A = {},
L = {};
switch ( switch (
(a (a
? ((D = u({}, r)), ? ((I = u({}, r)),
(I = u({}, i)), (_ = u({}, i)),
(N = u({}, c)), (N = u({}, c)),
(_ = u({}, l)), (A = u({}, l)),
(R = u({}, B))) (L = u({}, E)))
: ((D = u({}, f(f({}, this.state.style), r))), : ((I = u({}, f(f({}, this.state.style), r))),
(_ = u({}, f(f({}, this.state.contentStyle), l))), (A = u({}, f(f({}, this.state.contentStyle), l))),
(R = u({}, f(f({}, this.state.overlayStyle), B))), (L = u({}, f(f({}, this.state.overlayStyle), E))),
S C
? ((I = u({}, i)), (N = u({}, c))) ? ((_ = u({}, i)), (N = u({}, c)))
: ((I = u({}, f(f({}, this.state.buttonStyle), i))), : ((_ = u({}, f(f({}, this.state.buttonStyle), i))),
(N = u({}, f(f({}, this.state.declineButtonStyle), c))))), (N = u({}, f(f({}, this.state.declineButtonStyle), c))))),
o) o)
) { ) {
case O.TOP: case m.TOP:
D.top = "0"; I.top = "0";
break; break;
case O.BOTTOM: case m.BOTTOM:
D.bottom = "0"; I.bottom = "0";
} }
var A = []; var R = [];
return ( return (
C && k &&
A.push( R.push(
t().createElement( t().createElement(
j, w,
{ {
key: "declineButton", key: "declineButton",
style: N, style: N,
className: m, className: O,
id: g, id: g,
"aria-label": E, "aria-label": D,
onClick: function () { onClick: function () {
e.decline(); e.decline();
}, },
@ -560,12 +576,12 @@
p p
) )
), ),
A.push( R.push(
t().createElement( t().createElement(
j, w,
{ {
key: "acceptButton", key: "acceptButton",
style: I, style: _,
className: y, className: y,
id: h, id: h,
"aria-label": P, "aria-label": P,
@ -576,23 +592,23 @@
s s
) )
), ),
k && A.reverse(), x && R.reverse(),
t().createElement( t().createElement(
x, j,
{ {
condition: w, condition: T,
wrapper: function (e) { wrapper: function (e) {
return t().createElement("div", { style: R, className: T }, e); return t().createElement("div", { style: L, className: B }, e);
}, },
}, },
t().createElement( t().createElement(
"div", "div",
{ className: "".concat(d), style: D }, { className: "".concat(d), style: I },
t().createElement("div", { style: _, className: b }, this.props.children), t().createElement("div", { style: A, className: b }, this.props.children),
t().createElement( t().createElement(
"div", "div",
{ className: "".concat(v) }, { className: "".concat(v) },
A.map(function (e) { R.map(function (e) {
return e; return e;
}) })
) )
@ -605,10 +621,15 @@
a a
); );
})(e.Component); })(e.Component);
(j.propTypes = { (T.propTypes = {
location: i().oneOf( location: i().oneOf(
Object.keys(O).map(function (e) { Object.keys(m).map(function (e) {
return O[e]; return m[e];
})
),
visible: i().oneOf(
Object.keys(S).map(function (e) {
return S[e];
}) })
), ),
sameSite: i().oneOf( sameSite: i().oneOf(
@ -655,14 +676,15 @@
acceptOnScroll: i().bool, acceptOnScroll: i().bool,
acceptOnScrollPercentage: i().number, acceptOnScrollPercentage: i().number,
}), }),
(j.defaultProps = { (T.defaultProps = {
disableStyles: !1, disableStyles: !1,
hideOnAccept: !0, hideOnAccept: !0,
hideOnDecline: !0, hideOnDecline: !0,
location: O.BOTTOM, location: m.BOTTOM,
visible: S.BY_COOKIE_VALUE,
onAccept: function () {}, onAccept: function () {},
onDecline: function () {}, onDecline: function () {},
cookieName: k, cookieName: w,
cookieValue: !0, cookieValue: !0,
declineCookieValue: !1, declineCookieValue: !1,
setDeclineCookie: !0, setDeclineCookie: !0,
@ -715,7 +737,7 @@
acceptOnScroll: !1, acceptOnScroll: !1,
acceptOnScrollPercentage: 25, acceptOnScrollPercentage: 25,
}); });
const w = j; const B = T;
})(), })(),
(module.exports = o); (module.exports = o);
})(); })();

4
package-lock.json generated
View File

@ -1,11 +1,11 @@
{ {
"name": "react-cookie-consent", "name": "react-cookie-consent",
"version": "6.3.0", "version": "6.4.0",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"version": "6.3.0", "version": "6.4.0",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"js-cookie": "^2.2.1", "js-cookie": "^2.2.1",

View File

@ -4,7 +4,7 @@
"name": "Rick van Lieshout", "name": "Rick van Lieshout",
"email": "info@rickvanlieshout.com" "email": "info@rickvanlieshout.com"
}, },
"version": "6.3.0", "version": "6.4.0",
"description": "A small, simple and customizable cookie consent bar for use in React applications.", "description": "A small, simple and customizable cookie consent bar for use in React applications.",
"main": "build/index.js", "main": "build/index.js",
"types": "build/index.d.ts", "types": "build/index.d.ts",