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 3.1.2 to 4.0.0

8

cjs/useCookies.js

@@ -44,3 +44,9 @@ "use strict";

}, [cookies]);
return [allCookies, cookies.set.bind(cookies), cookies.remove.bind(cookies)];
var setCookie = (0, _react.useMemo)(function () {
return cookies.set.bind(cookies);
}, [cookies]);
var removeCookie = (0, _react.useMemo)(function () {
return cookies.remove.bind(cookies);
}, [cookies]);
return [allCookies, setCookie, removeCookie];
}

@@ -47,0 +53,0 @@

5

cjs/withCookies.d.ts
import * as React from 'react';
import { ReactCookieProps } from './types';
export default function withCookies<T>(WrapperComponent: React.ComponentType<T & ReactCookieProps>): React.ComponentType<T>;
declare type Diff<T, U> = T extends U ? never : T;
declare type Omit<T, K extends keyof T> = Pick<T, Diff<keyof T, K>>;
export default function withCookies<T extends ReactCookieProps>(WrapperComponent: React.ComponentType<T>): React.ComponentType<Omit<T, keyof ReactCookieProps>>;
export {};

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

import { useContext, useEffect, useState, useRef } from 'react';
import { useContext, useEffect, useState, useRef, useMemo } from 'react';
import CookiesContext from './CookiesContext';

@@ -24,3 +24,5 @@ export default function useCookies(dependencies) {

}, [cookies]);
return [allCookies, cookies.set.bind(cookies), cookies.remove.bind(cookies)];
var setCookie = useMemo(function () { return cookies.set.bind(cookies); }, [cookies]);
var removeCookie = useMemo(function () { return cookies.remove.bind(cookies); }, [cookies]);
return [allCookies, setCookie, removeCookie];
}

@@ -27,0 +29,0 @@ function shouldUpdate(dependencies, newCookies, oldCookies) {

import * as React from 'react';
import { ReactCookieProps } from './types';
export default function withCookies<T>(WrapperComponent: React.ComponentType<T & ReactCookieProps>): React.ComponentType<T>;
declare type Diff<T, U> = T extends U ? never : T;
declare type Omit<T, K extends keyof T> = Pick<T, Diff<keyof T, K>>;
export default function withCookies<T extends ReactCookieProps>(WrapperComponent: React.ComponentType<T>): React.ComponentType<Omit<T, keyof ReactCookieProps>>;
export {};

@@ -44,3 +44,9 @@ "use strict";

}, [cookies]);
return [allCookies, cookies.set.bind(cookies), cookies.remove.bind(cookies)];
var setCookie = (0, _react.useMemo)(function () {
return cookies.set.bind(cookies);
}, [cookies]);
var removeCookie = (0, _react.useMemo)(function () {
return cookies.remove.bind(cookies);
}, [cookies]);
return [allCookies, setCookie, removeCookie];
}

@@ -47,0 +53,0 @@

import * as React from 'react';
import { ReactCookieProps } from './types';
export default function withCookies<T>(WrapperComponent: React.ComponentType<T & ReactCookieProps>): React.ComponentType<T>;
declare type Diff<T, U> = T extends U ? never : T;
declare type Omit<T, K extends keyof T> = Pick<T, Diff<keyof T, K>>;
export default function withCookies<T extends ReactCookieProps>(WrapperComponent: React.ComponentType<T>): React.ComponentType<Omit<T, keyof ReactCookieProps>>;
export {};
{
"name": "react-cookie",
"version": "3.1.2",
"version": "4.0.0",
"description": "Universal cookies for React",

@@ -39,3 +39,3 @@ "main": "cjs/index.js",

"hoist-non-react-statics": "^3.0.0",
"universal-cookie": "^3.1.0"
"universal-cookie": "^4.0.0"
},

@@ -42,0 +42,0 @@ "devDependencies": {

@@ -732,3 +732,9 @@ (function (global, factory) {

}, [cookies]);
return [allCookies, cookies.set.bind(cookies), cookies.remove.bind(cookies)];
var setCookie = (0, _react.useMemo)(function () {
return cookies.set.bind(cookies);
}, [cookies]);
var removeCookie = (0, _react.useMemo)(function () {
return cookies.remove.bind(cookies);
}, [cookies]);
return [allCookies, setCookie, removeCookie];
}

@@ -735,0 +741,0 @@

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

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