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.2 to 2.0.0

.travis.yml

15

dist/index.js

@@ -1,14 +0,1 @@

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
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/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";
/*
object-assign
(c) Sindre Sorhus
@license MIT
*/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){}]);
module.exports=function(e){var t={};function o(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,o),r.l=!0,r.exports}return o.m=e,o.c=t,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)o.d(n,r,function(t){return e[t]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="/",o(o.s=0)}([function(e,t,o){"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=((n=o(1))&&n.__esModule?n:{default:n}).default;t.default=r},function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n,r=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!==s(e)&&"function"!=typeof e)return{default:e};var t=a();if(t&&t.has(e))return t.get(e);var o={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var i=n?Object.getOwnPropertyDescriptor(e,r):null;i&&(i.get||i.set)?Object.defineProperty(o,r,i):o[r]=e[r]}o.default=e,t&&t.set(e,o);return o}(o(2)),i=(n=o(3))&&n.__esModule?n:{default:n},c=o(6);function a(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return a=function(){return e},e}function s(e){return(s="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 o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,n)}return o}function u(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?l(Object(o),!0).forEach((function(t){g(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):l(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}function f(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function p(e){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(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 g(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var b={position:"fixed",right:0,left:0,boxShadow:"0 0 3px rgba(0, 0, 0, 0.12), 0 0 2px rgba(0, 0, 0, 0.24)"},m={textAlign:"center",position:"absolute",transform:"rotate(45deg)",cursor:"pointer",fontFamily:"-webkit-pictograph"},v=function(e){function t(e){var o,n,r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n=this,(o=!(r=p(t).call(this,e))||"object"!==s(r)&&"function"!=typeof r?d(n):r).state={close:!1,hasStorage:c.LocalStorage.get("react-cookie-disclaimer")},o.closeDisclaimer=o.closeDisclaimer.bind(d(o)),o}var o,n,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),o=t,(n=[{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,o=e.bottomPosition,n=e.children,i=e.color,c=e.cookiePolicyLink,a=e.cookiePolicyText,s=e.cookiePolicyName,l=e.closeIconSize,f=e.closeIconPositionTop,p=e.padding,d=e.text,y=o?{bottom:0}:{top:0},g=u({visibility:this.state.close?"hidden":"visible",backgroundColor:t,padding:"".concat(p,"px"),paddingRight:"".concat(l+p,"px"),color:i},y,{},b),v=u({lineHeight:"".concat(l,"px"),width:"".concat(l,"px"),height:"".concat(l,"px"),fontSize:"".concat(l,"px"),marginTop:f?0:"".concat(l/-2,"px"),right:"".concat(p/2,"px"),top:f?"".concat(p/2,"px"):"50%"},m);return r.default.createElement("div",{id:"cookie-disclaimer",style:g},r.default.createElement("div",{id:"cookie-disclaimer-close",onClick:this.closeDisclaimer,style:v},"+"),n||r.default.createElement("div",{id:"cookie-disclaimer-text"},d,r.default.createElement("span",{id:"cookie-policy",style:{display:c?"inline":"none"}}," ".concat(a," "),r.default.createElement("a",{id:"cookie-policy-link",href:c,style:{color:i}},s))))}}])&&f(o.prototype,n),i&&f(o,i),t}(r.Component);g(v,"propTypes",{background:i.default.string,bottomPosition:i.default.bool,children:i.default.any,color:i.default.string,cookiePolicyLink:i.default.string,cookiePolicyName:i.default.string,cookiePolicyText:i.default.string,closeIconSize:i.default.number,closeIconPositionTop:i.default.bool,padding:i.default.number,text:i.default.string}),g(v,"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",closeIconSize:28,closeIconPositionTop:!1,padding:20,text:"This website uses cookies to improve service, for analytical and advertising purposes."});var O=v;t.default=O},function(e,t){e.exports=require("react")},function(e,t,o){e.exports=o(4)()},function(e,t,o){"use strict";var n=o(5);function r(){}function i(){}i.resetWarningCache=r,e.exports=function(){function e(e,t,o,r,i,c){if(c!==n){var a=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 a.name="Invariant Violation",a}}function t(){return e}e.isRequired=e;var o={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:r};return o.PropTypes=o,o}},function(e,t,o){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t){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,o={}){var n=Object.assign({path:"/"},o);n.expires&&(n.expires=n.expires.toUTCString());var r=encodeURIComponent(e)+"="+encodeURIComponent(t);for(var i in n){r+="; "+i;var c=n[i];!0!==c&&(r+="="+c)}document.cookie=r},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}]);
{
"name": "react-cookie-disclaimer",
"version": "1.0.2",
"version": "2.0.0",
"description": "The package will help you to display a notification about the use of cookies on the site",

@@ -10,3 +10,4 @@ "main": "./dist/index.js",

"fix": "eslint --fix --report-unused-disable-directives src",
"test": "jest"
"test": "jest",
"coveralls": "jest --coverage && cat ./coverage/lcov.info | coveralls"
},

@@ -38,3 +39,3 @@ "repository": {

"babel-preset-stage-2": "^6.24.1",
"css-loader": "^3.4.0",
"coveralls": "^3.0.9",
"enzyme": "^3.11.0",

@@ -50,4 +51,2 @@ "enzyme-adapter-react-16": "^1.15.2",

"jest-enzyme": "^7.1.2",
"mini-css-extract-plugin": "^0.9.0",
"style-loader": "^1.1.1",
"webpack": "^4.41.4",

@@ -54,0 +53,0 @@ "webpack-cli": "^3.3.10"

![react-cookie-disclaimer](https://repository-images.githubusercontent.com/229484861/fbde4700-36cf-11ea-88fe-db2690c68f8e)
<p align="center">
<a href="https://www.npmjs.com/package/react-cookie-disclaimer">
<img src="https://img.shields.io/npm/v/react-cookie-disclaimer" alt="npm version">
</a>
<a href="https://travis-ci.org/awibox/react-cookie-disclaimer">
<img src='https://travis-ci.org/awibox/react-cookie-disclaimer.svg?branch=master' alt='Build' />
</a>
<a href='https://coveralls.io/github/awibox/react-cookie-disclaimer?branch=master'>
<img src='https://coveralls.io/repos/github/awibox/react-cookie-disclaimer/badge.svg?branch=master' alt='Coverage Status' />
</a>
<a href="https://www.npmjs.com/package/react-cookie-disclaimer">
<img src="https://img.shields.io/npm/dm/react-cookie-disclaimer" alt="Downloads">
</a>
<img src="https://img.shields.io/npm/l/react-cookie-disclaimer" alt="license">
</p>
## Table of contents

@@ -7,2 +23,3 @@ * [Installation](#installation)

* [The settings of the component](#settings)
* [Custom content](#custom)
* [Example](#example)

@@ -25,3 +42,2 @@

import CookieDisclaimer from 'react-cookie-disclaimer';
import 'react-cookie-disclaimer/dist/css/main.css';
```

@@ -35,3 +51,3 @@ Then use the component in your application. For example:

## The settings of the component
### background
### background (string)
Sets the color for the background in any format that supports css.

@@ -43,3 +59,3 @@ ```typescript jsx

### bottomPosition
### bottomPosition (boolean)
By default, the notification is displayed at the top of the page and the value of this parameter is ```false```.

@@ -50,4 +66,5 @@ If set to ```true```, the notification will be displayed at the bottom.

```
Default value: ``` false ```
### color
### color (string)
Sets the color of the text and the cross to close.

@@ -59,3 +76,3 @@ ```typescript jsx

### cookiePolicyName
### cookiePolicyName (string)
Sets the name for the cookie policy link

@@ -67,3 +84,3 @@ ```typescript jsx

### cookiePolicyText
### cookiePolicyText (string)
Sets the text before the cookie policy link.

@@ -76,3 +93,3 @@ It is recommended to set value because default text may change in future versions.

### cookiePolicyLink
### cookiePolicyLink (string)
Link to your cookie policy.

@@ -84,3 +101,3 @@ If the link value is not set, the link with the name (cookiePolicyName) and the text before the link (cookiePolicyText) will not be displayed.

### text
### text (string)
This is the main text that will be displayed in the notification. It is recommended to set value because default text may change in future versions.

@@ -92,2 +109,31 @@ ```typescript jsx

### closeIconSize (number)
Sets the size of the icon to close the notification
```typescript jsx
<CookieDisclaimer closeIconSize={20} />
```
Default value: ``` 28 ```
### closeIconPositionTop (boolean)
By default the icon for closing is displayed in the middle relative to the height of the notification and the value of this parameter is ```false```.
If set to ```true```, the closing icon will be displayed on the top.
```typescript jsx
<CookieDisclaimer closeIconPositionTop={true} />
```
Default value: ``` false ```
### padding (number)
Sets padding for cookie notification
```typescript jsx
<CookieDisclaimer padding={15} />
```
Default value: ``` 20 ```
<a name="custom"></a>
## Custom content
You can place your own content in the notification. You should call the component as follows:
```typescript jsx
<CookieDisclaimer background='#0079c1' color='#fff'>Custom content <a href={yourLink}>Link</a> other text</CookieDisclaimer>
```
<a name="example"></a>

@@ -103,9 +149,11 @@ ## Example

<CookieDisclaimer
background='#0079c1'
bottomPosition={false}
color='#fff'
cookiePolicyName='Cookie Policy'
cookiePolicyLink='/cookie-policy'
cookiePolicyText='By continuing to use the service, you agree to our'
text='This website uses cookies to improve service.'
background='#0079c1'
bottomPosition={false}
closeIconSize={30}
closeIconPositionTop={false}
color='#fff'
cookiePolicyName='Cookie Policy'
cookiePolicyLink='/cookie-policy'
cookiePolicyText='By continuing to use the service, you agree to our'
text='This website uses cookies to improve service.'
/>

@@ -112,0 +160,0 @@ </div>

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

import CookieDisclaimer from './components/CookieDisclaimer/CookieDisclaimer';
import CookieDisclaimer from './components/CookieDisclaimer';
export default CookieDisclaimer;
const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');

@@ -25,21 +24,19 @@ module.exports = {

loader: 'babel-loader',
},
{
test: /\.css$/i,
use: [
{
loader: MiniCssExtractPlugin.loader,
},
'css-loader',
],
},
}
]
},
plugins: [
new MiniCssExtractPlugin({
fallback : 'style-loader',
filename: './css/[name].css',
chunkFilename: './css/[name].css',
}),
],
externals: {
react: {
commonjs: "react",
commonjs2: "react",
amd: "React",
root: "React"
},
"react-dom": {
commonjs: "react-dom",
commonjs2: "react-dom",
amd: "ReactDOM",
root: "ReactDOM"
}
}
};
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