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

react-cookie-disclaimer

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-cookie-disclaimer - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

.eslintrc

6

dist/index.js

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

module.exports=function(e){var t={};function r(o){if(t[o])return t[o].exports;var n=t[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,o){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(r.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(o,n,function(t){return e[t]}.bind(null,n));return o},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="/",r(r.s=0)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=r(1);t.default=o.CookieDisclaimer},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CookieDisclaimer=void 0;var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},n=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),i=r(2),u=l(i),c=l(r(5)),a=r(8);function l(e){return e&&e.__esModule?e:{default:e}}r(9);var s=t.CookieDisclaimer=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.state={close:!1,hasStorage:a.LocalStorage.get("react-cookie-disclaimer")},r.closeDisclaimer=r.closeDisclaimer.bind(r),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),n(t,[{key:"closeDisclaimer",value:function(){this.setState({close:!0}),a.LocalStorage.set("react-cookie-disclaimer",!0),this.props.bottomPosition||(document.body.style.marginTop=0)}},{key:"componentDidMount",value:function(){if(!this.state.hasStorage&&!this.props.bottomPosition){var e=document.getElementById("cookie-disclaimer").offsetHeight;document.body.style.marginTop=e+"px"}}},{key:"render",value:function(){if(this.state.hasStorage)return null;var e=this.props,t=e.background,r=e.bottomPosition,n=e.color,i=e.cookiePolicyLink,c=e.cookiePolicyText,a=e.cookiePolicyName,l=e.text,s=this.state.close,f=o({visibility:s?"hidden":"visible",backgroundColor:t,color:n},r?{bottom:0}:{top:0});return u.default.createElement("div",{className:"cookie-disclaimer",id:"cookie-disclaimer",style:f},u.default.createElement("div",{className:"cookie-disclaimer__close",onClick:this.closeDisclaimer}),u.default.createElement("div",{className:"cookie-disclaimer__text"},l,u.default.createElement("span",{style:{display:i?"inline":"none"}}," "+c+" ",u.default.createElement("a",{href:i,style:{color:n}},a))))}}]),t}(i.Component);s.propTypes={background:c.default.string,bottomPosition:c.default.bool,color:c.default.string,text:c.default.string},s.defaultProps={background:"#fff",bottomPosition:!1,color:"#000",cookiePolicyLink:"",cookiePolicyName:"Cookie Policy",cookiePolicyText:"By continuing to use the service, you agree to our use of cookies as described in the",text:"This website uses cookies to improve service, for analytical and advertising purposes."}},function(e,t,r){"use strict";e.exports=r(3)},function(e,t,r){"use strict";
module.exports=function(e){var t={};function r(o){if(t[o])return t[o].exports;var n=t[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,o){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(r.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(o,n,function(t){return e[t]}.bind(null,n));return o},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="/",r(r.s=0)}([function(e,t,r){"use strict";var o;Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=((o=r(1))&&o.__esModule?o:{default:o}).default;t.default=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o,n=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!==a(e)&&"function"!=typeof e)return{default:e};var t=u();if(t&&t.has(e))return t.get(e);var r={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var i=o?Object.getOwnPropertyDescriptor(e,n):null;i&&(i.get||i.set)?Object.defineProperty(r,n,i):r[n]=e[n]}r.default=e,t&&t.set(e,r);return r}(r(2)),i=(o=r(5))&&o.__esModule?o:{default:o},c=r(8);function u(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return u=function(){return e},e}function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function f(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function p(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function y(e,t){return(y=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function d(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}r(9);var m=function(e){function t(e){var r,o,n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),o=this,(r=!(n=s(t).call(this,e))||"object"!==a(n)&&"function"!=typeof n?p(o):n).state={close:!1,hasStorage:c.LocalStorage.get("react-cookie-disclaimer")},r.closeDisclaimer=r.closeDisclaimer.bind(p(r)),r}var r,o,i;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&y(e,t)}(t,e),r=t,(o=[{key:"closeDisclaimer",value:function(){this.setState({close:!0}),c.LocalStorage.set("react-cookie-disclaimer",!0),this.props.bottomPosition||(document.body.style.marginTop=0)}},{key:"componentDidMount",value:function(){if(!this.state.hasStorage&&!this.props.bottomPosition){var e=document.getElementById("cookie-disclaimer").offsetHeight;document.body.style.marginTop="".concat(e,"px")}}},{key:"render",value:function(){if(this.state.hasStorage)return null;var e=this.props,t=e.background,r=e.bottomPosition,o=e.color,i=e.cookiePolicyLink,c=e.cookiePolicyText,u=e.cookiePolicyName,a=e.text,f=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?l(Object(r),!0).forEach((function(t){d(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):l(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({visibility:this.state.close?"hidden":"visible",backgroundColor:t,color:o},r?{bottom:0}:{top:0});return n.default.createElement("div",{className:"cookie-disclaimer",id:"cookie-disclaimer",style:f},n.default.createElement("div",{className:"cookie-disclaimer__close",onClick:this.closeDisclaimer}),n.default.createElement("div",{className:"cookie-disclaimer__text"},a,n.default.createElement("span",{className:"cookie-disclaimer__cookie-policy",style:{display:i?"inline":"none"}}," ".concat(c," "),n.default.createElement("a",{className:"cookie-disclaimer__cookie-policy-link",href:i,style:{color:o}},u))))}}])&&f(r.prototype,o),i&&f(r,i),t}(n.Component);d(m,"propTypes",{background:i.default.string,bottomPosition:i.default.bool,color:i.default.string,cookiePolicyLink:i.default.string,cookiePolicyName:i.default.string,cookiePolicyText:i.default.string,text:i.default.string}),d(m,"defaultProps",{background:"#fff",bottomPosition:!1,color:"#000",cookiePolicyLink:"",cookiePolicyName:"Cookie Policy",cookiePolicyText:"By continuing to use the service, you agree to our use of cookies as described in the",text:"This website uses cookies to improve service, for analytical and advertising purposes."});var b=m;t.default=b},function(e,t,r){"use strict";e.exports=r(3)},function(e,t,r){"use strict";
/** @license React v16.12.0

@@ -9,3 +9,3 @@ * react.production.min.js

* LICENSE file in the root directory of this source tree.
*/var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n=r(4),i="function"==typeof Symbol&&Symbol.for,u=i?Symbol.for("react.element"):60103,c=i?Symbol.for("react.portal"):60106,a=i?Symbol.for("react.fragment"):60107,l=i?Symbol.for("react.strict_mode"):60108,s=i?Symbol.for("react.profiler"):60114,f=i?Symbol.for("react.provider"):60109,p=i?Symbol.for("react.context"):60110,y=i?Symbol.for("react.forward_ref"):60112,d=i?Symbol.for("react.suspense"):60113;i&&Symbol.for("react.suspense_list");var m=i?Symbol.for("react.memo"):60115,b=i?Symbol.for("react.lazy"):60116;i&&Symbol.for("react.fundamental"),i&&Symbol.for("react.responder"),i&&Symbol.for("react.scope");var v="function"==typeof Symbol&&Symbol.iterator;function g(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r<arguments.length;r++)t+="&args[]="+encodeURIComponent(arguments[r]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S={};function O(e,t,r){this.props=e,this.context=t,this.refs=S,this.updater=r||h}function _(){}function k(e,t,r){this.props=e,this.context=t,this.refs=S,this.updater=r||h}O.prototype.isReactComponent={},O.prototype.setState=function(e,t){if("object"!==(void 0===e?"undefined":o(e))&&"function"!=typeof e&&null!=e)throw Error(g(85));this.updater.enqueueSetState(this,e,t,"setState")},O.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},_.prototype=O.prototype;var j=k.prototype=new _;j.constructor=k,n(j,O.prototype),j.isPureReactComponent=!0;var P={current:null},x={current:null},w=Object.prototype.hasOwnProperty,C={key:!0,ref:!0,__self:!0,__source:!0};function E(e,t,r){var o,n={},i=null,c=null;if(null!=t)for(o in void 0!==t.ref&&(c=t.ref),void 0!==t.key&&(i=""+t.key),t)w.call(t,o)&&!C.hasOwnProperty(o)&&(n[o]=t[o]);var a=arguments.length-2;if(1===a)n.children=r;else if(1<a){for(var l=Array(a),s=0;s<a;s++)l[s]=arguments[s+2];n.children=l}if(e&&e.defaultProps)for(o in a=e.defaultProps)void 0===n[o]&&(n[o]=a[o]);return{$$typeof:u,type:e,key:i,ref:c,props:n,_owner:x.current}}function I(e){return"object"===(void 0===e?"undefined":o(e))&&null!==e&&e.$$typeof===u}var R=/\/+/g,T=[];function $(e,t,r,o){if(T.length){var n=T.pop();return n.result=e,n.keyPrefix=t,n.func=r,n.context=o,n.count=0,n}return{result:e,keyPrefix:t,func:r,context:o,count:0}}function N(e){e.result=null,e.keyPrefix=null,e.func=null,e.context=null,e.count=0,10>T.length&&T.push(e)}function D(e,t,r){return null==e?0:function e(t,r,n,i){var a=void 0===t?"undefined":o(t);"undefined"!==a&&"boolean"!==a||(t=null);var l=!1;if(null===t)l=!0;else switch(a){case"string":case"number":l=!0;break;case"object":switch(t.$$typeof){case u:case c:l=!0}}if(l)return n(i,t,""===r?"."+M(t,0):r),1;if(l=0,r=""===r?".":r+":",Array.isArray(t))for(var s=0;s<t.length;s++){var f=r+M(a=t[s],s);l+=e(a,f,n,i)}else if(null===t||"object"!==(void 0===t?"undefined":o(t))?f=null:f="function"==typeof(f=v&&t[v]||t["@@iterator"])?f:null,"function"==typeof f)for(t=f.call(t),s=0;!(a=t.next()).done;)l+=e(a=a.value,f=r+M(a,s++),n,i);else if("object"===a)throw n=""+t,Error(g(31,"[object Object]"===n?"object with keys {"+Object.keys(t).join(", ")+"}":n,""));return l}(e,"",t,r)}function M(e,t){return"object"===(void 0===e?"undefined":o(e))&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+(""+e).replace(/[=:]/g,(function(e){return t[e]}))}(e.key):t.toString(36)}function U(e,t){e.func.call(e.context,t,e.count++)}function L(e,t,r){var o=e.result,n=e.keyPrefix;e=e.func.call(e.context,t,e.count++),Array.isArray(e)?A(e,o,r,(function(e){return e})):null!=e&&(I(e)&&(e=function(e,t){return{$$typeof:u,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(e,n+(!e.key||t&&t.key===e.key?"":(""+e.key).replace(R,"$&/")+"/")+r)),o.push(e))}function A(e,t,r,o,n){var i="";null!=r&&(i=(""+r).replace(R,"$&/")+"/"),D(e,L,t=$(t,i,o,n)),N(t)}function q(){var e=P.current;if(null===e)throw Error(g(321));return e}var B={Children:{map:function(e,t,r){if(null==e)return e;var o=[];return A(e,o,null,t,r),o},forEach:function(e,t,r){if(null==e)return e;D(e,U,t=$(null,null,t,r)),N(t)},count:function(e){return D(e,(function(){return null}),null)},toArray:function(e){var t=[];return A(e,t,null,(function(e){return e})),t},only:function(e){if(!I(e))throw Error(g(143));return e}},createRef:function(){return{current:null}},Component:O,PureComponent:k,createContext:function(e,t){return void 0===t&&(t=null),(e={$$typeof:p,_calculateChangedBits:t,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null}).Provider={$$typeof:f,_context:e},e.Consumer=e},forwardRef:function(e){return{$$typeof:y,render:e}},lazy:function(e){return{$$typeof:b,_ctor:e,_status:-1,_result:null}},memo:function(e,t){return{$$typeof:m,type:e,compare:void 0===t?null:t}},useCallback:function(e,t){return q().useCallback(e,t)},useContext:function(e,t){return q().useContext(e,t)},useEffect:function(e,t){return q().useEffect(e,t)},useImperativeHandle:function(e,t,r){return q().useImperativeHandle(e,t,r)},useDebugValue:function(){},useLayoutEffect:function(e,t){return q().useLayoutEffect(e,t)},useMemo:function(e,t){return q().useMemo(e,t)},useReducer:function(e,t,r){return q().useReducer(e,t,r)},useRef:function(e){return q().useRef(e)},useState:function(e){return q().useState(e)},Fragment:a,Profiler:s,StrictMode:l,Suspense:d,createElement:E,cloneElement:function(e,t,r){if(null==e)throw Error(g(267,e));var o=n({},e.props),i=e.key,c=e.ref,a=e._owner;if(null!=t){if(void 0!==t.ref&&(c=t.ref,a=x.current),void 0!==t.key&&(i=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(s in t)w.call(t,s)&&!C.hasOwnProperty(s)&&(o[s]=void 0===t[s]&&void 0!==l?l[s]:t[s])}var s=arguments.length-2;if(1===s)o.children=r;else if(1<s){l=Array(s);for(var f=0;f<s;f++)l[f]=arguments[f+2];o.children=l}return{$$typeof:u,type:e.type,key:i,ref:c,props:o,_owner:a}},createFactory:function(e){var t=E.bind(null,e);return t.type=e,t},isValidElement:I,version:"16.12.0",__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{ReactCurrentDispatcher:P,ReactCurrentBatchConfig:{suspense:null},ReactCurrentOwner:x,IsSomeRendererActing:{current:!1},assign:n}},F={default:B},J=F&&B||F;e.exports=J.default||J},function(e,t,r){"use strict";
*/var o=r(4),n="function"==typeof Symbol&&Symbol.for,i=n?Symbol.for("react.element"):60103,c=n?Symbol.for("react.portal"):60106,u=n?Symbol.for("react.fragment"):60107,a=n?Symbol.for("react.strict_mode"):60108,l=n?Symbol.for("react.profiler"):60114,f=n?Symbol.for("react.provider"):60109,s=n?Symbol.for("react.context"):60110,p=n?Symbol.for("react.forward_ref"):60112,y=n?Symbol.for("react.suspense"):60113;n&&Symbol.for("react.suspense_list");var d=n?Symbol.for("react.memo"):60115,m=n?Symbol.for("react.lazy"):60116;n&&Symbol.for("react.fundamental"),n&&Symbol.for("react.responder"),n&&Symbol.for("react.scope");var b="function"==typeof Symbol&&Symbol.iterator;function g(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r<arguments.length;r++)t+="&args[]="+encodeURIComponent(arguments[r]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},h={};function O(e,t,r){this.props=e,this.context=t,this.refs=h,this.updater=r||v}function S(){}function k(e,t,r){this.props=e,this.context=t,this.refs=h,this.updater=r||v}O.prototype.isReactComponent={},O.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error(g(85));this.updater.enqueueSetState(this,e,t,"setState")},O.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},S.prototype=O.prototype;var _=k.prototype=new S;_.constructor=k,o(_,O.prototype),_.isPureReactComponent=!0;var j={current:null},P={current:null},w=Object.prototype.hasOwnProperty,x={key:!0,ref:!0,__self:!0,__source:!0};function E(e,t,r){var o,n={},c=null,u=null;if(null!=t)for(o in void 0!==t.ref&&(u=t.ref),void 0!==t.key&&(c=""+t.key),t)w.call(t,o)&&!x.hasOwnProperty(o)&&(n[o]=t[o]);var a=arguments.length-2;if(1===a)n.children=r;else if(1<a){for(var l=Array(a),f=0;f<a;f++)l[f]=arguments[f+2];n.children=l}if(e&&e.defaultProps)for(o in a=e.defaultProps)void 0===n[o]&&(n[o]=a[o]);return{$$typeof:i,type:e,key:c,ref:u,props:n,_owner:P.current}}function C(e){return"object"==typeof e&&null!==e&&e.$$typeof===i}var I=/\/+/g,R=[];function T(e,t,r,o){if(R.length){var n=R.pop();return n.result=e,n.keyPrefix=t,n.func=r,n.context=o,n.count=0,n}return{result:e,keyPrefix:t,func:r,context:o,count:0}}function $(e){e.result=null,e.keyPrefix=null,e.func=null,e.context=null,e.count=0,10>R.length&&R.push(e)}function N(e,t,r){return null==e?0:function e(t,r,o,n){var u=typeof t;"undefined"!==u&&"boolean"!==u||(t=null);var a=!1;if(null===t)a=!0;else switch(u){case"string":case"number":a=!0;break;case"object":switch(t.$$typeof){case i:case c:a=!0}}if(a)return o(n,t,""===r?"."+D(t,0):r),1;if(a=0,r=""===r?".":r+":",Array.isArray(t))for(var l=0;l<t.length;l++){var f=r+D(u=t[l],l);a+=e(u,f,o,n)}else if(null===t||"object"!=typeof t?f=null:f="function"==typeof(f=b&&t[b]||t["@@iterator"])?f:null,"function"==typeof f)for(t=f.call(t),l=0;!(u=t.next()).done;)a+=e(u=u.value,f=r+D(u,l++),o,n);else if("object"===u)throw o=""+t,Error(g(31,"[object Object]"===o?"object with keys {"+Object.keys(t).join(", ")+"}":o,""));return a}(e,"",t,r)}function D(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+(""+e).replace(/[=:]/g,(function(e){return t[e]}))}(e.key):t.toString(36)}function M(e,t){e.func.call(e.context,t,e.count++)}function L(e,t,r){var o=e.result,n=e.keyPrefix;e=e.func.call(e.context,t,e.count++),Array.isArray(e)?U(e,o,r,(function(e){return e})):null!=e&&(C(e)&&(e=function(e,t){return{$$typeof:i,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(e,n+(!e.key||t&&t.key===e.key?"":(""+e.key).replace(I,"$&/")+"/")+r)),o.push(e))}function U(e,t,r,o,n){var i="";null!=r&&(i=(""+r).replace(I,"$&/")+"/"),N(e,L,t=T(t,i,o,n)),$(t)}function A(){var e=j.current;if(null===e)throw Error(g(321));return e}var q={Children:{map:function(e,t,r){if(null==e)return e;var o=[];return U(e,o,null,t,r),o},forEach:function(e,t,r){if(null==e)return e;N(e,M,t=T(null,null,t,r)),$(t)},count:function(e){return N(e,(function(){return null}),null)},toArray:function(e){var t=[];return U(e,t,null,(function(e){return e})),t},only:function(e){if(!C(e))throw Error(g(143));return e}},createRef:function(){return{current:null}},Component:O,PureComponent:k,createContext:function(e,t){return void 0===t&&(t=null),(e={$$typeof:s,_calculateChangedBits:t,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null}).Provider={$$typeof:f,_context:e},e.Consumer=e},forwardRef:function(e){return{$$typeof:p,render:e}},lazy:function(e){return{$$typeof:m,_ctor:e,_status:-1,_result:null}},memo:function(e,t){return{$$typeof:d,type:e,compare:void 0===t?null:t}},useCallback:function(e,t){return A().useCallback(e,t)},useContext:function(e,t){return A().useContext(e,t)},useEffect:function(e,t){return A().useEffect(e,t)},useImperativeHandle:function(e,t,r){return A().useImperativeHandle(e,t,r)},useDebugValue:function(){},useLayoutEffect:function(e,t){return A().useLayoutEffect(e,t)},useMemo:function(e,t){return A().useMemo(e,t)},useReducer:function(e,t,r){return A().useReducer(e,t,r)},useRef:function(e){return A().useRef(e)},useState:function(e){return A().useState(e)},Fragment:u,Profiler:l,StrictMode:a,Suspense:y,createElement:E,cloneElement:function(e,t,r){if(null==e)throw Error(g(267,e));var n=o({},e.props),c=e.key,u=e.ref,a=e._owner;if(null!=t){if(void 0!==t.ref&&(u=t.ref,a=P.current),void 0!==t.key&&(c=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(f in t)w.call(t,f)&&!x.hasOwnProperty(f)&&(n[f]=void 0===t[f]&&void 0!==l?l[f]:t[f])}var f=arguments.length-2;if(1===f)n.children=r;else if(1<f){l=Array(f);for(var s=0;s<f;s++)l[s]=arguments[s+2];n.children=l}return{$$typeof:i,type:e.type,key:c,ref:u,props:n,_owner:a}},createFactory:function(e){var t=E.bind(null,e);return t.type=e,t},isValidElement:C,version:"16.12.0",__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{ReactCurrentDispatcher:j,ReactCurrentBatchConfig:{suspense:null},ReactCurrentOwner:P,IsSomeRendererActing:{current:!1},assign:o}},B={default:q},F=B&&q||B;e.exports=F.default||F},function(e,t,r){"use strict";
/*

@@ -15,2 +15,2 @@ object-assign

@license MIT
*/var o=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;function u(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach((function(e){o[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},o)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var r,c,a=u(e),l=1;l<arguments.length;l++){for(var s in r=Object(arguments[l]))n.call(r,s)&&(a[s]=r[s]);if(o){c=o(r);for(var f=0;f<c.length;f++)i.call(r,c[f])&&(a[c[f]]=r[c[f]])}}return a}},function(e,t,r){"use strict";e.exports=r(6)()},function(e,t,r){"use strict";var o=r(7);function n(){}function i(){}i.resetWarningCache=n,e.exports=function(){function e(e,t,r,n,i,u){if(u!==o){var c=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw c.name="Invariant Violation",c}}function t(){return e}e.isRequired=e;var r={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:n};return r.PropTypes=r,r}},function(e,t,r){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,r){"use strict";var o={Cookie:{get:function(e){var t=document.cookie.match(new RegExp("(?:^|; )"+e.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g,"\\$1")+"=([^;]*)"));return t?decodeURIComponent(t[1]):void 0},set:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=Object.assign({path:"/"},r);o.expires&&(o.expires=o.expires.toUTCString());var n=encodeURIComponent(e)+"="+encodeURIComponent(t);for(var i in o){n+="; "+i;var u=o[i];!0!==u&&(n+="="+u)}document.cookie=n},remove:function(e){this.set(e,"",{"max-age":-1})}},LocalStorage:{set:function(e,t){localStorage.setItem(e,t)},get:function(e){return localStorage.getItem(e)?localStorage.getItem(e):null},setObject:function(e,t){localStorage.setItem(e,JSON.stringify(t))},getObject:function(e){return JSON.parse(localStorage.getItem(e))?JSON.parse(localStorage.getItem(e)):{}},remove:function(e){localStorage.removeItem(e)},clear:function(){localStorage.clear()}},SessionStorage:{set:function(e,t){sessionStorage.setItem(e,t)},get:function(e){return sessionStorage.getItem(e)?sessionStorage.getItem(e):null},setObject:function(e,t){sessionStorage.setItem(e,JSON.stringify(t))},getObject:function(e){return JSON.parse(sessionStorage.getItem(e))?JSON.parse(sessionStorage.getItem(e)):null},remove:function(e){sessionStorage.removeItem(e)},clear:function(){sessionStorage.clear()}}};e.exports=o},function(e,t,r){}]);
*/var o=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;function c(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach((function(e){o[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},o)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var r,u,a=c(e),l=1;l<arguments.length;l++){for(var f in r=Object(arguments[l]))n.call(r,f)&&(a[f]=r[f]);if(o){u=o(r);for(var s=0;s<u.length;s++)i.call(r,u[s])&&(a[u[s]]=r[u[s]])}}return a}},function(e,t,r){e.exports=r(6)()},function(e,t,r){"use strict";var o=r(7);function n(){}function i(){}i.resetWarningCache=n,e.exports=function(){function e(e,t,r,n,i,c){if(c!==o){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}function t(){return e}e.isRequired=e;var r={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:n};return r.PropTypes=r,r}},function(e,t,r){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t){var r={Cookie:{get:function(e){var t=document.cookie.match(new RegExp("(?:^|; )"+e.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g,"\\$1")+"=([^;]*)"));return t?decodeURIComponent(t[1]):void 0},set:function(e,t,r={}){var o=Object.assign({path:"/"},r);o.expires&&(o.expires=o.expires.toUTCString());var n=encodeURIComponent(e)+"="+encodeURIComponent(t);for(var i in o){n+="; "+i;var c=o[i];!0!==c&&(n+="="+c)}document.cookie=n},remove:function(e){this.set(e,"",{"max-age":-1})}},LocalStorage:{set:function(e,t){localStorage.setItem(e,t)},get:function(e){return localStorage.getItem(e)?localStorage.getItem(e):null},setObject:function(e,t){localStorage.setItem(e,JSON.stringify(t))},getObject:function(e){return JSON.parse(localStorage.getItem(e))?JSON.parse(localStorage.getItem(e)):{}},remove:function(e){localStorage.removeItem(e)},clear:function(){localStorage.clear()}},SessionStorage:{set:function(e,t){sessionStorage.setItem(e,t)},get:function(e){return sessionStorage.getItem(e)?sessionStorage.getItem(e):null},setObject:function(e,t){sessionStorage.setItem(e,JSON.stringify(t))},getObject:function(e){return JSON.parse(sessionStorage.getItem(e))?JSON.parse(sessionStorage.getItem(e)):null},remove:function(e){sessionStorage.removeItem(e)},clear:function(){sessionStorage.clear()}}};e.exports=r},function(e,t,r){}]);
{
"name": "react-cookie-disclaimer",
"version": "1.0.1",
"version": "1.0.2",
"description": "The package will help you to display a notification about the use of cookies on the site",

@@ -8,3 +8,5 @@ "main": "./dist/index.js",

"build": "webpack --mode production",
"test": "echo \"Error: no test specified\" && exit 1"
"lint": "eslint --report-unused-disable-directives src",
"fix": "eslint --fix --report-unused-disable-directives src",
"test": "jest"
},

@@ -28,10 +30,22 @@ "repository": {

"devDependencies": {
"babel-core": "^6.26.3",
"@babel/core": "^7.8.3",
"@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/preset-env": "^7.8.3",
"@babel/preset-react": "^7.8.3",
"babel-core": "^7.0.0-bridge.0",
"babel-eslint": "^10.0.3",
"babel-loader": "^7",
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-2": "^6.24.1",
"css-loader": "^3.4.0",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.2",
"enzyme-to-json": "^3.4.3",
"eslint": "^6.8.0",
"eslint-config-airbnb-base": "^14.0.0",
"eslint-plugin-import": "^2.20.0",
"eslint-plugin-react": "^7.17.0",
"jest": "^24.9.0",
"jest-css-modules-transform": "^3.1.0",
"jest-enzyme": "^7.1.2",
"mini-css-extract-plugin": "^0.9.0",
"prop-types": "^15.7.2",
"style-loader": "^1.1.1",

@@ -43,4 +57,25 @@ "webpack": "^4.41.4",

"combo-storage": "^1.1.2",
"react": "^16.12.0"
"prop-types": "^15.7.2",
"react": "^16.12.0",
"react-dom": "^16.12.0"
},
"jest": {
"testEnvironment": "node",
"moduleFileExtensions": [
"js",
"jsx"
],
"moduleDirectories": [
"node_modules",
"src"
],
"setupFilesAfterEnv": [
"<rootDir>/node_modules/jest-enzyme/lib/index.js",
"<rootDir>/jest-setup-tests.js"
],
"transform": {
"^.+\\.js$": "babel-jest",
".+\\.(css|styl|less|sass|scss)$": "<rootDir>/node_modules/jest-css-modules-transform"
}
}
}

@@ -7,3 +7,3 @@ import React, { Component } from 'react';

export class CookieDisclaimer extends Component {
class CookieDisclaimer extends Component {
constructor(props) {

@@ -13,3 +13,3 @@ super(props);

close: false,
hasStorage: LocalStorage.get('react-cookie-disclaimer')
hasStorage: LocalStorage.get('react-cookie-disclaimer'),
};

@@ -23,2 +23,5 @@ this.closeDisclaimer = this.closeDisclaimer.bind(this);

color: PropTypes.string,
cookiePolicyLink: PropTypes.string,
cookiePolicyName: PropTypes.string,
cookiePolicyText: PropTypes.string,
text: PropTypes.string,

@@ -37,17 +40,19 @@ };

closeDisclaimer(){
this.setState({close: true});
closeDisclaimer() {
this.setState({ close: true });
LocalStorage.set('react-cookie-disclaimer', true);
if(!this.props.bottomPosition) {
if (!this.props.bottomPosition) {
document.body.style.marginTop = 0;
}
}
componentDidMount() {
if(!this.state.hasStorage && !this.props.bottomPosition) {
if (!this.state.hasStorage && !this.props.bottomPosition) {
const disclaimer = document.getElementById('cookie-disclaimer').offsetHeight;
document.body.style.marginTop = disclaimer + 'px';
document.body.style.marginTop = `${disclaimer}px`;
}
}
render() {
if(this.state.hasStorage) {
if (this.state.hasStorage) {
return null;

@@ -62,14 +67,14 @@ }

cookiePolicyName,
text
text,
} = this.props;
const closeDisclaimer = this.state.close;
const positionObj = bottomPosition ? {bottom: 0} : {top: 0};
const positionObj = bottomPosition ? { bottom: 0 } : { top: 0 };
const style = {
visibility: closeDisclaimer ? 'hidden' : 'visible',
backgroundColor: background,
color: color,
...positionObj
color,
...positionObj,
};
return(
return (
<div className='cookie-disclaimer' id='cookie-disclaimer' style={style}>

@@ -79,5 +84,5 @@ <div className='cookie-disclaimer__close' onClick={this.closeDisclaimer} />

{text}
<span style={{display: cookiePolicyLink ? 'inline' : 'none'}}>
<span className='cookie-disclaimer__cookie-policy' style={{ display: cookiePolicyLink ? 'inline' : 'none' }}>
{` ${cookiePolicyText} `}
<a href={cookiePolicyLink} style={{color: color}}>{cookiePolicyName}</a>
<a className='cookie-disclaimer__cookie-policy-link' href={cookiePolicyLink} style={{ color }}>{cookiePolicyName}</a>
</span>

@@ -89,1 +94,2 @@ </div>

}
export default CookieDisclaimer;

@@ -1,3 +0,3 @@

import { CookieDisclaimer } from "./components/CookieDisclaimer/CookieDisclaimer";
import CookieDisclaimer from './components/CookieDisclaimer/CookieDisclaimer';
export default CookieDisclaimer;

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