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.2.0 to 7.2.1

8

package.json
{
"name": "react-cookie",
"version": "7.2.0",
"version": "7.2.1",
"description": "Universal cookies for React",

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

"devDependencies": {
"@babel/cli": "^7.24.8",
"@babel/cli": "^7.25.7",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"rimraf": "^6.0.1",
"rollup": "^4.19.0",
"typescript": "^5.5.3"
"rollup": "^4.24.0",
"typescript": "^5.6.3"
},

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

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

***************************************************************************** */
/* global Reflect, Promise, SuppressedError, Symbol */
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */

@@ -83,3 +83,3 @@

var reactIs$1 = {exports: {}};
var reactIs = {exports: {}};

@@ -275,112 +275,128 @@ var reactIs_development = {};

{
reactIs$1.exports = requireReactIs_development();
var hasRequiredReactIs;
function requireReactIs () {
if (hasRequiredReactIs) return reactIs.exports;
hasRequiredReactIs = 1;
{
reactIs.exports = requireReactIs_development();
}
return reactIs.exports;
}
var reactIsExports = reactIs$1.exports;
var hoistNonReactStatics_cjs;
var hasRequiredHoistNonReactStatics_cjs;
var reactIs = reactIsExports;
function requireHoistNonReactStatics_cjs () {
if (hasRequiredHoistNonReactStatics_cjs) return hoistNonReactStatics_cjs;
hasRequiredHoistNonReactStatics_cjs = 1;
/**
* Copyright 2015, Yahoo! Inc.
* Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
var REACT_STATICS = {
childContextTypes: true,
contextType: true,
contextTypes: true,
defaultProps: true,
displayName: true,
getDefaultProps: true,
getDerivedStateFromError: true,
getDerivedStateFromProps: true,
mixins: true,
propTypes: true,
type: true
};
var KNOWN_STATICS = {
name: true,
length: true,
prototype: true,
caller: true,
callee: true,
arguments: true,
arity: true
};
var FORWARD_REF_STATICS = {
'$$typeof': true,
render: true,
defaultProps: true,
displayName: true,
propTypes: true
};
var MEMO_STATICS = {
'$$typeof': true,
compare: true,
defaultProps: true,
displayName: true,
propTypes: true,
type: true
};
var TYPE_STATICS = {};
TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;
TYPE_STATICS[reactIs.Memo] = MEMO_STATICS;
var reactIs = requireReactIs();
function getStatics(component) {
// React v16.11 and below
if (reactIs.isMemo(component)) {
return MEMO_STATICS;
} // React v16.12 and above
/**
* Copyright 2015, Yahoo! Inc.
* Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
var REACT_STATICS = {
childContextTypes: true,
contextType: true,
contextTypes: true,
defaultProps: true,
displayName: true,
getDefaultProps: true,
getDerivedStateFromError: true,
getDerivedStateFromProps: true,
mixins: true,
propTypes: true,
type: true
};
var KNOWN_STATICS = {
name: true,
length: true,
prototype: true,
caller: true,
callee: true,
arguments: true,
arity: true
};
var FORWARD_REF_STATICS = {
'$$typeof': true,
render: true,
defaultProps: true,
displayName: true,
propTypes: true
};
var MEMO_STATICS = {
'$$typeof': true,
compare: true,
defaultProps: true,
displayName: true,
propTypes: true,
type: true
};
var TYPE_STATICS = {};
TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;
TYPE_STATICS[reactIs.Memo] = MEMO_STATICS;
function getStatics(component) {
// React v16.11 and below
if (reactIs.isMemo(component)) {
return MEMO_STATICS;
} // React v16.12 and above
return TYPE_STATICS[component['$$typeof']] || REACT_STATICS;
}
var defineProperty = Object.defineProperty;
var getOwnPropertyNames = Object.getOwnPropertyNames;
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
var getPrototypeOf = Object.getPrototypeOf;
var objectPrototype = Object.prototype;
function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {
if (typeof sourceComponent !== 'string') {
// don't hoist over string (html) components
if (objectPrototype) {
var inheritedComponent = getPrototypeOf(sourceComponent);
return TYPE_STATICS[component['$$typeof']] || REACT_STATICS;
}
if (inheritedComponent && inheritedComponent !== objectPrototype) {
hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);
}
}
var defineProperty = Object.defineProperty;
var getOwnPropertyNames = Object.getOwnPropertyNames;
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
var getPrototypeOf = Object.getPrototypeOf;
var objectPrototype = Object.prototype;
function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {
if (typeof sourceComponent !== 'string') {
// don't hoist over string (html) components
if (objectPrototype) {
var inheritedComponent = getPrototypeOf(sourceComponent);
var keys = getOwnPropertyNames(sourceComponent);
if (inheritedComponent && inheritedComponent !== objectPrototype) {
hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);
}
}
if (getOwnPropertySymbols) {
keys = keys.concat(getOwnPropertySymbols(sourceComponent));
}
var keys = getOwnPropertyNames(sourceComponent);
var targetStatics = getStatics(targetComponent);
var sourceStatics = getStatics(sourceComponent);
if (getOwnPropertySymbols) {
keys = keys.concat(getOwnPropertySymbols(sourceComponent));
}
for (var i = 0; i < keys.length; ++i) {
var key = keys[i];
var targetStatics = getStatics(targetComponent);
var sourceStatics = getStatics(sourceComponent);
if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {
var descriptor = getOwnPropertyDescriptor(sourceComponent, key);
for (var i = 0; i < keys.length; ++i) {
var key = keys[i];
try {
// Avoid failures from read-only properties
defineProperty(targetComponent, key, descriptor);
} catch (e) {}
}
}
}
if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {
var descriptor = getOwnPropertyDescriptor(sourceComponent, key);
return targetComponent;
try {
// Avoid failures from read-only properties
defineProperty(targetComponent, key, descriptor);
} catch (e) {}
}
}
}
return targetComponent;
}
hoistNonReactStatics_cjs = hoistNonReactStatics;
return hoistNonReactStatics_cjs;
}
var hoistNonReactStatics_cjs = hoistNonReactStatics;
var hoistNonReactStatics_cjsExports = requireHoistNonReactStatics_cjs();
var hoistStatics = /*@__PURE__*/getDefaultExportFromCjs(hoistNonReactStatics_cjsExports);
var hoistStatics = /*@__PURE__*/getDefaultExportFromCjs(hoistNonReactStatics_cjs);
function withCookies(WrappedComponent) {

@@ -387,0 +403,0 @@ // @ts-ignore

@@ -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 O(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 S(e){return O(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 S(e)||O(e)===a},l.isConcurrentMode=S,l.isContextConsumer=function(e){return O(e)===c},l.isContextProvider=function(e){return O(e)===i},l.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},l.isForwardRef=function(e){return O(e)===u},l.isFragment=function(e){return O(e)===r},l.isLazy=function(e){return O(e)===b},l.isMemo=function(e){return O(e)===m},l.isPortal=function(e){return O(e)===o},l.isProfiler=function(e){return O(e)===s},l.isStrictMode=function(e){return O(e)===n},l.isSuspense=function(e){return O(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=O,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,O=Object.getOwnPropertySymbols,S=Object.getOwnPropertyDescriptor,w=Object.getPrototypeOf,$=Object.prototype;var k=function e(t,o,r){if("string"!=typeof o){if($){var n=w(o);n&&n!==$&&e(t,n,r)}var s=C(o);O&&(s=s.concat(O(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=S(o,f);try{v(t,f,p)}catch(e){}}}}return t},P=f(k);e.Cookies=t,e.CookiesProvider=a,e.useCookies=function(e,t){const r=o.useContext(s);if(!r)throw new Error("Missing <CookiesProvider>");const n=Object.assign(Object.assign({},{doNotUpdate:!0}),t),[i,c]=o.useState((()=>r.getAll(n)));"undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement&&o.useLayoutEffect((()=>{function t(){const t=r.getAll(n);(function(e,t,o){if(!e)return!0;for(let r of e)if(t[r]!==o[r])return!0;return!1})(e||null,t,i)&&c(t)}return r.addChangeListener(t),()=>{r.removeChangeListener(t)}}),[r,i]);const a=o.useMemo((()=>r.set.bind(r)),[r]),f=o.useMemo((()=>r.remove.bind(r)),[r]),p=o.useMemo((()=>r.update.bind(r)),[r]);return[i,a,f,p]},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)}}));
!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 u,p,l,d,y={exports:{}},m={};function b(){return p||(p=1,y.exports=function(){if(u)return m;u=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,p=e?Symbol.for("react.forward_ref"):60112,l=e?Symbol.for("react.suspense"):60113,d=e?Symbol.for("react.suspense_list"):60120,y=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 O(e){if("object"==typeof e&&null!==e){var u=e.$$typeof;switch(u){case t:switch(e=e.type){case a:case f:case r:case s:case n:case l:return e;default:switch(e=e&&e.$$typeof){case c:case p:case b:case y:case i:return e;default:return u}}case o:return u}}}function S(e){return O(e)===f}return m.AsyncMode=a,m.ConcurrentMode=f,m.ContextConsumer=c,m.ContextProvider=i,m.Element=t,m.ForwardRef=p,m.Fragment=r,m.Lazy=b,m.Memo=y,m.Portal=o,m.Profiler=s,m.StrictMode=n,m.Suspense=l,m.isAsyncMode=function(e){return S(e)||O(e)===a},m.isConcurrentMode=S,m.isContextConsumer=function(e){return O(e)===c},m.isContextProvider=function(e){return O(e)===i},m.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},m.isForwardRef=function(e){return O(e)===p},m.isFragment=function(e){return O(e)===r},m.isLazy=function(e){return O(e)===b},m.isMemo=function(e){return O(e)===y},m.isPortal=function(e){return O(e)===o},m.isProfiler=function(e){return O(e)===s},m.isStrictMode=function(e){return O(e)===n},m.isSuspense=function(e){return O(e)===l},m.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===r||e===f||e===s||e===n||e===l||e===d||"object"==typeof e&&null!==e&&(e.$$typeof===b||e.$$typeof===y||e.$$typeof===i||e.$$typeof===c||e.$$typeof===p||e.$$typeof===g||e.$$typeof===v||e.$$typeof===C||e.$$typeof===h)},m.typeOf=O,m}()),y.exports}var h=function(){if(d)return l;d=1;var e=b(),t={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},o={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},r={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},n={};function s(o){return e.isMemo(o)?r:n[o.$$typeof]||t}n[e.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},n[e.Memo]=r;var i=Object.defineProperty,c=Object.getOwnPropertyNames,a=Object.getOwnPropertySymbols,f=Object.getOwnPropertyDescriptor,u=Object.getPrototypeOf,p=Object.prototype;return l=function e(t,r,n){if("string"!=typeof r){if(p){var l=u(r);l&&l!==p&&e(t,l,n)}var d=c(r);a&&(d=d.concat(a(r)));for(var y=s(t),m=s(r),b=0;b<d.length;++b){var h=d[b];if(!(o[h]||n&&n[h]||m&&m[h]||y&&y[h])){var g=f(r,h);try{i(t,h,g)}catch(e){}}}}return t}}(),g=f(h);e.Cookies=t,e.CookiesProvider=a,e.useCookies=function(e,t){const r=o.useContext(s);if(!r)throw new Error("Missing <CookiesProvider>");const n=Object.assign(Object.assign({},{doNotUpdate:!0}),t),[i,c]=o.useState((()=>r.getAll(n)));"undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement&&o.useLayoutEffect((()=>{function t(){const t=r.getAll(n);(function(e,t,o){if(!e)return!0;for(let r of e)if(t[r]!==o[r])return!0;return!1})(e||null,t,i)&&c(t)}return r.addChangeListener(t),()=>{r.removeChangeListener(t)}}),[r,i]);const a=o.useMemo((()=>r.set.bind(r)),[r]),f=o.useMemo((()=>r.remove.bind(r)),[r]),u=o.useMemo((()=>r.update.bind(r)),[r]);return[i,a,f,u]},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,g(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