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

react-cookie

Package Overview
Dependencies
Maintainers
1
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-cookie - npm Package Compare versions

Comparing version 7.1.0 to 7.1.1

4

cjs/index.js

@@ -88,3 +88,3 @@ 'use strict';

const _a = this.props, { forwardedRef, cookies } = _a, restProps = __rest(_a, ["forwardedRef", "cookies"]);
const allCookies = cookies.getAll();
const allCookies = cookies.getAll({ doNotUpdate: true });
return (React__namespace.createElement(WrappedComponent, Object.assign({}, restProps, { ref: forwardedRef, cookies: cookies, allCookies: allCookies })));

@@ -114,3 +114,3 @@ }

}
const [allCookies, setCookies] = React.useState(() => cookies.getAll());
const [allCookies, setCookies] = React.useState(() => cookies.getAll({ doNotUpdate: true }));
if (isInBrowser()) {

@@ -117,0 +117,0 @@ React.useLayoutEffect(() => {

{
"name": "react-cookie",
"version": "7.1.0",
"version": "7.1.1",
"description": "Universal cookies for React",

@@ -53,8 +53,8 @@ "main": "cjs/index.js",

"devDependencies": {
"@babel/cli": "^7.23.9",
"@babel/cli": "^7.24.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"rimraf": "^5.0.5",
"rollup": "^4.10.0",
"typescript": "^5.3.3"
"rollup": "^4.13.2",
"typescript": "^5.4.3"
},

@@ -61,0 +61,0 @@ "peerDependencies": {

@@ -414,3 +414,3 @@ (function (global, factory) {

const _a = this.props, { forwardedRef, cookies } = _a, restProps = __rest(_a, ["forwardedRef", "cookies"]);
const allCookies = cookies.getAll();
const allCookies = cookies.getAll({ doNotUpdate: true });
return (React__namespace.createElement(WrappedComponent, Object.assign({}, restProps, { ref: forwardedRef, cookies: cookies, allCookies: allCookies })));

@@ -440,3 +440,3 @@ }

}
const [allCookies, setCookies] = React.useState(() => cookies.getAll());
const [allCookies, setCookies] = React.useState(() => cookies.getAll({ doNotUpdate: true }));
if (isInBrowser()) {

@@ -443,0 +443,0 @@ React.useLayoutEffect(() => {

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("universal-cookie"),require("react")):"function"==typeof define&&define.amd?define(["exports","universal-cookie","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ReactCookie={},e.UniversalCookie,e.React)}(this,(function(e,t,o){"use strict";function r(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(o){if("default"!==o){var r=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,r.get?r:{enumerable:!0,get:function(){return e[o]}})}})),t.default=e,Object.freeze(t)}var n=r(o);const s=n.createContext(new t),{Provider:i,Consumer:c}=s;class a extends n.Component{constructor(e){super(e),e.cookies?this.cookies=e.cookies:this.cookies=new t(void 0,e.defaultSetOptions)}render(){return n.createElement(i,{value:this.cookies},this.props.children)}}function f(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}"function"==typeof SuppressedError&&SuppressedError;var p,u={exports:{}},l={};u.exports=function(){if(p)return l;p=1;var e="function"==typeof Symbol&&Symbol.for,t=e?Symbol.for("react.element"):60103,o=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,n=e?Symbol.for("react.strict_mode"):60108,s=e?Symbol.for("react.profiler"):60114,i=e?Symbol.for("react.provider"):60109,c=e?Symbol.for("react.context"):60110,a=e?Symbol.for("react.async_mode"):60111,f=e?Symbol.for("react.concurrent_mode"):60111,u=e?Symbol.for("react.forward_ref"):60112,d=e?Symbol.for("react.suspense"):60113,y=e?Symbol.for("react.suspense_list"):60120,m=e?Symbol.for("react.memo"):60115,b=e?Symbol.for("react.lazy"):60116,h=e?Symbol.for("react.block"):60121,g=e?Symbol.for("react.fundamental"):60117,v=e?Symbol.for("react.responder"):60118,C=e?Symbol.for("react.scope"):60119;function S(e){if("object"==typeof e&&null!==e){var p=e.$$typeof;switch(p){case t:switch(e=e.type){case a:case f:case r:case s:case n:case d:return e;default:switch(e=e&&e.$$typeof){case c:case u:case b:case m:case i:return e;default:return p}}case o:return p}}}function w(e){return S(e)===f}return l.AsyncMode=a,l.ConcurrentMode=f,l.ContextConsumer=c,l.ContextProvider=i,l.Element=t,l.ForwardRef=u,l.Fragment=r,l.Lazy=b,l.Memo=m,l.Portal=o,l.Profiler=s,l.StrictMode=n,l.Suspense=d,l.isAsyncMode=function(e){return w(e)||S(e)===a},l.isConcurrentMode=w,l.isContextConsumer=function(e){return S(e)===c},l.isContextProvider=function(e){return S(e)===i},l.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},l.isForwardRef=function(e){return S(e)===u},l.isFragment=function(e){return S(e)===r},l.isLazy=function(e){return S(e)===b},l.isMemo=function(e){return S(e)===m},l.isPortal=function(e){return S(e)===o},l.isProfiler=function(e){return S(e)===s},l.isStrictMode=function(e){return S(e)===n},l.isSuspense=function(e){return S(e)===d},l.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===r||e===f||e===s||e===n||e===d||e===y||"object"==typeof e&&null!==e&&(e.$$typeof===b||e.$$typeof===m||e.$$typeof===i||e.$$typeof===c||e.$$typeof===u||e.$$typeof===g||e.$$typeof===v||e.$$typeof===C||e.$$typeof===h)},l.typeOf=S,l}();var d=u.exports,y={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},m={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},b={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},h={};function g(e){return d.isMemo(e)?b:h[e.$$typeof]||y}h[d.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},h[d.Memo]=b;var v=Object.defineProperty,C=Object.getOwnPropertyNames,S=Object.getOwnPropertySymbols,w=Object.getOwnPropertyDescriptor,O=Object.getPrototypeOf,$=Object.prototype;var k=function e(t,o,r){if("string"!=typeof o){if($){var n=O(o);n&&n!==$&&e(t,n,r)}var s=C(o);S&&(s=s.concat(S(o)));for(var i=g(t),c=g(o),a=0;a<s.length;++a){var f=s[a];if(!(m[f]||r&&r[f]||c&&c[f]||i&&i[f])){var p=w(o,f);try{v(t,f,p)}catch(e){}}}}return t},P=f(k);e.Cookies=t,e.CookiesProvider=a,e.useCookies=function(e){const t=o.useContext(s);if(!t)throw new Error("Missing <CookiesProvider>");const[r,n]=o.useState((()=>t.getAll()));"undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement&&o.useLayoutEffect((()=>{function o(){const o=t.getAll({doNotUpdate:!0});(function(e,t,o){if(!e)return!0;for(let r of e)if(t[r]!==o[r])return!0;return!1})(e||null,o,r)&&n(o)}return t.addChangeListener(o),()=>{t.removeChangeListener(o)}}),[t,r]);const i=o.useMemo((()=>t.set.bind(t)),[t]),c=o.useMemo((()=>t.remove.bind(t)),[t]),a=o.useMemo((()=>t.update.bind(t)),[t]);return[r,i,c,a]},e.withCookies=function(e){const t=e.displayName||e.name;class o extends n.Component{constructor(){super(...arguments),this.onChange=()=>{this.forceUpdate()}}listen(){this.props.cookies.addChangeListener(this.onChange)}unlisten(e){(e||this.props.cookies).removeChangeListener(this.onChange)}componentDidMount(){this.listen()}componentDidUpdate(e){e.cookies!==this.props.cookies&&(this.unlisten(e.cookies),this.listen())}componentWillUnmount(){this.unlisten()}render(){const t=this.props,{forwardedRef:o,cookies:r}=t,s=function(e,t){var o={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(o[r[n]]=e[r[n]])}return o}(t,["forwardedRef","cookies"]),i=r.getAll();return n.createElement(e,Object.assign({},s,{ref:o,cookies:r,allCookies:i}))}}o.displayName=`withCookies(${t})`,o.WrappedComponent=e;const r=n.forwardRef(((e,t)=>n.createElement(c,null,(r=>n.createElement(o,Object.assign({cookies:r},e,{forwardedRef:t}))))));return r.displayName=o.displayName,r.WrappedComponent=o.WrappedComponent,P(r,e)}}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("universal-cookie"),require("react")):"function"==typeof define&&define.amd?define(["exports","universal-cookie","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ReactCookie={},e.UniversalCookie,e.React)}(this,(function(e,t,o){"use strict";function r(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(o){if("default"!==o){var r=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,r.get?r:{enumerable:!0,get:function(){return e[o]}})}})),t.default=e,Object.freeze(t)}var n=r(o);const s=n.createContext(new t),{Provider:i,Consumer:c}=s;class a extends n.Component{constructor(e){super(e),e.cookies?this.cookies=e.cookies:this.cookies=new t(void 0,e.defaultSetOptions)}render(){return n.createElement(i,{value:this.cookies},this.props.children)}}function f(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}"function"==typeof SuppressedError&&SuppressedError;var p,u={exports:{}},l={};u.exports=function(){if(p)return l;p=1;var e="function"==typeof Symbol&&Symbol.for,t=e?Symbol.for("react.element"):60103,o=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,n=e?Symbol.for("react.strict_mode"):60108,s=e?Symbol.for("react.profiler"):60114,i=e?Symbol.for("react.provider"):60109,c=e?Symbol.for("react.context"):60110,a=e?Symbol.for("react.async_mode"):60111,f=e?Symbol.for("react.concurrent_mode"):60111,u=e?Symbol.for("react.forward_ref"):60112,d=e?Symbol.for("react.suspense"):60113,y=e?Symbol.for("react.suspense_list"):60120,m=e?Symbol.for("react.memo"):60115,b=e?Symbol.for("react.lazy"):60116,h=e?Symbol.for("react.block"):60121,g=e?Symbol.for("react.fundamental"):60117,v=e?Symbol.for("react.responder"):60118,C=e?Symbol.for("react.scope"):60119;function S(e){if("object"==typeof e&&null!==e){var p=e.$$typeof;switch(p){case t:switch(e=e.type){case a:case f:case r:case s:case n:case d:return e;default:switch(e=e&&e.$$typeof){case c:case u:case b:case m:case i:return e;default:return p}}case o:return p}}}function w(e){return S(e)===f}return l.AsyncMode=a,l.ConcurrentMode=f,l.ContextConsumer=c,l.ContextProvider=i,l.Element=t,l.ForwardRef=u,l.Fragment=r,l.Lazy=b,l.Memo=m,l.Portal=o,l.Profiler=s,l.StrictMode=n,l.Suspense=d,l.isAsyncMode=function(e){return w(e)||S(e)===a},l.isConcurrentMode=w,l.isContextConsumer=function(e){return S(e)===c},l.isContextProvider=function(e){return S(e)===i},l.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},l.isForwardRef=function(e){return S(e)===u},l.isFragment=function(e){return S(e)===r},l.isLazy=function(e){return S(e)===b},l.isMemo=function(e){return S(e)===m},l.isPortal=function(e){return S(e)===o},l.isProfiler=function(e){return S(e)===s},l.isStrictMode=function(e){return S(e)===n},l.isSuspense=function(e){return S(e)===d},l.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===r||e===f||e===s||e===n||e===d||e===y||"object"==typeof e&&null!==e&&(e.$$typeof===b||e.$$typeof===m||e.$$typeof===i||e.$$typeof===c||e.$$typeof===u||e.$$typeof===g||e.$$typeof===v||e.$$typeof===C||e.$$typeof===h)},l.typeOf=S,l}();var d=u.exports,y={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},m={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},b={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},h={};function g(e){return d.isMemo(e)?b:h[e.$$typeof]||y}h[d.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},h[d.Memo]=b;var v=Object.defineProperty,C=Object.getOwnPropertyNames,S=Object.getOwnPropertySymbols,w=Object.getOwnPropertyDescriptor,O=Object.getPrototypeOf,$=Object.prototype;var k=function e(t,o,r){if("string"!=typeof o){if($){var n=O(o);n&&n!==$&&e(t,n,r)}var s=C(o);S&&(s=s.concat(S(o)));for(var i=g(t),c=g(o),a=0;a<s.length;++a){var f=s[a];if(!(m[f]||r&&r[f]||c&&c[f]||i&&i[f])){var p=w(o,f);try{v(t,f,p)}catch(e){}}}}return t},P=f(k);e.Cookies=t,e.CookiesProvider=a,e.useCookies=function(e){const t=o.useContext(s);if(!t)throw new Error("Missing <CookiesProvider>");const[r,n]=o.useState((()=>t.getAll({doNotUpdate:!0})));"undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement&&o.useLayoutEffect((()=>{function o(){const o=t.getAll({doNotUpdate:!0});(function(e,t,o){if(!e)return!0;for(let r of e)if(t[r]!==o[r])return!0;return!1})(e||null,o,r)&&n(o)}return t.addChangeListener(o),()=>{t.removeChangeListener(o)}}),[t,r]);const i=o.useMemo((()=>t.set.bind(t)),[t]),c=o.useMemo((()=>t.remove.bind(t)),[t]),a=o.useMemo((()=>t.update.bind(t)),[t]);return[r,i,c,a]},e.withCookies=function(e){const t=e.displayName||e.name;class o extends n.Component{constructor(){super(...arguments),this.onChange=()=>{this.forceUpdate()}}listen(){this.props.cookies.addChangeListener(this.onChange)}unlisten(e){(e||this.props.cookies).removeChangeListener(this.onChange)}componentDidMount(){this.listen()}componentDidUpdate(e){e.cookies!==this.props.cookies&&(this.unlisten(e.cookies),this.listen())}componentWillUnmount(){this.unlisten()}render(){const t=this.props,{forwardedRef:o,cookies:r}=t,s=function(e,t){var o={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(o[r[n]]=e[r[n]])}return o}(t,["forwardedRef","cookies"]),i=r.getAll({doNotUpdate:!0});return n.createElement(e,Object.assign({},s,{ref:o,cookies:r,allCookies:i}))}}o.displayName=`withCookies(${t})`,o.WrappedComponent=e;const r=n.forwardRef(((e,t)=>n.createElement(c,null,(r=>n.createElement(o,Object.assign({cookies:r},e,{forwardedRef:t}))))));return r.displayName=o.displayName,r.WrappedComponent=o.WrappedComponent,P(r,e)}}));

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